mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
feat: uid/gid/mode added to metadata (#1551)
This commit is contained in:
@@ -111,6 +111,15 @@ export async function getConfig(effects) {
|
|||||||
if (typeof metadata.len !== 'number' ) {
|
if (typeof metadata.len !== 'number' ) {
|
||||||
throw new TypeError("len is not a number")
|
throw new TypeError("len is not a number")
|
||||||
}
|
}
|
||||||
|
if (typeof metadata.gid !== 'number' ) {
|
||||||
|
throw new TypeError("gid is not a number")
|
||||||
|
}
|
||||||
|
if (typeof metadata.uid !== 'number' ) {
|
||||||
|
throw new TypeError("uid is not a number")
|
||||||
|
}
|
||||||
|
if (typeof metadata.mode !== 'number' ) {
|
||||||
|
throw new TypeError("mode is not a number")
|
||||||
|
}
|
||||||
if (!(metadata.modified instanceof Date )) {
|
if (!(metadata.modified instanceof Date )) {
|
||||||
throw new TypeError("modified is not a Date")
|
throw new TypeError("modified is not a Date")
|
||||||
}
|
}
|
||||||
|
|||||||
4
libs/artifacts/types.d.ts
vendored
4
libs/artifacts/types.d.ts
vendored
@@ -65,7 +65,6 @@ export type Effects = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
export type Metadata = {
|
export type Metadata = {
|
||||||
|
|
||||||
fileType: string,
|
fileType: string,
|
||||||
isDir: boolean,
|
isDir: boolean,
|
||||||
isFile: boolean,
|
isFile: boolean,
|
||||||
@@ -75,6 +74,9 @@ export type Metadata = {
|
|||||||
accessed?: Date,
|
accessed?: Date,
|
||||||
created?: Date,
|
created?: Date,
|
||||||
readonly: boolean,
|
readonly: boolean,
|
||||||
|
uid: number,
|
||||||
|
gid: number,
|
||||||
|
mode: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MigrationRes = {
|
export type MigrationRes = {
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ pub struct MetadataJs {
|
|||||||
accessed: Option<u64>,
|
accessed: Option<u64>,
|
||||||
created: Option<u64>,
|
created: Option<u64>,
|
||||||
readonly: bool,
|
readonly: bool,
|
||||||
|
gid: u32,
|
||||||
|
mode: u32,
|
||||||
|
uid: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
@@ -338,6 +341,7 @@ mod fns {
|
|||||||
*,
|
*,
|
||||||
};
|
};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
use std::os::unix::fs::MetadataExt;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
@@ -420,6 +424,9 @@ mod fns {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(system_time_as_unix_ms),
|
.and_then(system_time_as_unix_ms),
|
||||||
readonly: answer.permissions().readonly(),
|
readonly: answer.permissions().readonly(),
|
||||||
|
gid: answer.gid(),
|
||||||
|
mode: answer.mode(),
|
||||||
|
uid: answer.uid(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(metadata_js)
|
Ok(metadata_js)
|
||||||
|
|||||||
Reference in New Issue
Block a user