instrumentality 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/road.d.ts +8 -8
- package/dist/road.d.ts.map +1 -1
- package/dist/road.js +12 -14
- package/package.json +1 -1
- package/src/base.ts +0 -1
- package/src/road.ts +13 -15
package/README.md
CHANGED
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,MAAO,SAAQ,KAAK;IAAY,IAAI,SAA0B;CAAE;AAK7E;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAazH;AAID;;;;;;GAMG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB1E;AAID;;;;;GAKG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,IACvD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAGhE;;;;;GAKG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAChD;IAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAAE,GAAG,UAAU,CAAC,CAAC,CAAC;CAAC,CAAC,QAA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@ -14,7 +14,7 @@ export declare class RdErr extends bs.InsErr {
|
|
|
14
14
|
* @returns The constructor function corresponding to the file mode.
|
|
15
15
|
* @throws If the file mode is unknown, throws a {@link RdErr}.
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function resolveMode(statmode: number): typeof File | typeof Folder | typeof SymbolicLink | typeof BlockDevice;
|
|
18
18
|
/**
|
|
19
19
|
* Creates a new instance of the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
20
20
|
*
|
|
@@ -34,7 +34,7 @@ export declare function factory(lookFor: string): Promise<BlockDevice | File | F
|
|
|
34
34
|
export declare function lockFor(roadOrPath: Road | string): Promise<void> | undefined;
|
|
35
35
|
export declare abstract class Road {
|
|
36
36
|
/** The absolute path to the file or directory that this Road instance represents.
|
|
37
|
-
* Intentionally made protected to prevent external modification, as changing this value could lead to inconsistencies and unexpected behavior. */
|
|
37
|
+
* @remarks Intentionally made protected to prevent external modification, as changing this value could lead to inconsistencies and unexpected behavior. */
|
|
38
38
|
protected pointsTo: string;
|
|
39
39
|
/** Indicates whether the file or directory represented by this Road instance can be modified.
|
|
40
40
|
* Changing this value does not affect the actual file system permissions, but rather serves as a safeguard within the application to prevent accidental modifications. */
|
|
@@ -59,7 +59,7 @@ export declare abstract class Road {
|
|
|
59
59
|
* @throws If the specified path does not exist, throws a fs.{@link Error}.
|
|
60
60
|
* @throws If the type of the file or directory at the specified path does not match the type of this instance, throws a {@link RdErr}. Useful for subclasses.
|
|
61
61
|
*/
|
|
62
|
-
constructor(lookFor: string, typeCheck: boolean);
|
|
62
|
+
constructor(lookFor: string, typeCheck: boolean | 1 | 0);
|
|
63
63
|
/**
|
|
64
64
|
* Verifies that the file or directory represented by this Road instance exists, is of the same type as this instance, and (optionally) is writable.
|
|
65
65
|
*
|
|
@@ -91,18 +91,18 @@ export declare abstract class Road {
|
|
|
91
91
|
/**
|
|
92
92
|
* Checks if the file or directory represented by this Road is both visible and of the same type as expected.
|
|
93
93
|
*/
|
|
94
|
-
existsSync(): boolean;
|
|
95
94
|
exists(): Promise<boolean>;
|
|
95
|
+
existsSync(): boolean;
|
|
96
96
|
/**
|
|
97
97
|
* @returns The file system stats for the file or directory.
|
|
98
|
-
* @see {@link fs.
|
|
98
|
+
* @see {@link fs.lstat}
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
stats(): Promise<fs.Stats>;
|
|
101
101
|
/**
|
|
102
102
|
* @returns The file system stats for the file or directory.
|
|
103
|
-
* @see {@link fs.
|
|
103
|
+
* @see {@link fs.lstatSync}
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
statsSync(): fs.Stats;
|
|
106
106
|
/**
|
|
107
107
|
* @returns The amount of path segments in the absolute path to the file or directory represented by this Road instance, minus one (i.e., the depth of the file or directory in the file system hierarchy).
|
|
108
108
|
* @remarks As subclasses of {@link Road} require all paths to be absolute/normalized and valid, this method is guaranteed to return a non-negative integer.
|
package/dist/road.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"road.d.ts","sourceRoot":"","sources":["../src/road.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,WAAW,CAAA;AAI/B;;GAEG;AACH,qBAAa,KAAM,SAAQ,EAAE,CAAC,MAAM;IAAY,IAAI,SAA+B;CAAE;AAIrF;;;;;;GAMG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"road.d.ts","sourceRoot":"","sources":["../src/road.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,WAAW,CAAA;AAI/B;;GAEG;AACH,qBAAa,KAAM,SAAQ,EAAE,CAAC,MAAM;IAAY,IAAI,SAA+B;CAAE;AAIrF;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AS,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,IAAW,CAAA;AAChE,eAAO,IAAI,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAW,CAAA;AAE9C;;;;GAIG;AACH,wBAAgB,oBAAoB,SASnC;AACD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,QAW3C;AAGD,wBAAgB,IAAI,CAAC,CAAC,SAAS,IAAI,EAAE,UAAU,EAAE;IAAE,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,CAAC,CAAA;CAAE,EAAE,WAAW,EAAE,OAAO,GAAG,CAAC,GAAG,UAAU,GAAG,eAAe,CAQ1I"}
|
package/dist/road.js
CHANGED
|
@@ -21,7 +21,7 @@ export class RdErr extends bs.InsErr {
|
|
|
21
21
|
* @returns The constructor function corresponding to the file mode.
|
|
22
22
|
* @throws If the file mode is unknown, throws a {@link RdErr}.
|
|
23
23
|
*/
|
|
24
|
-
export function
|
|
24
|
+
export function resolveMode(statmode) {
|
|
25
25
|
switch (statmode & fsc.S_IFMT) {
|
|
26
26
|
case fsc.S_IFREG: return File;
|
|
27
27
|
case fsc.S_IFDIR: return Folder;
|
|
@@ -42,12 +42,12 @@ export function modeCtor(statmode) {
|
|
|
42
42
|
*/
|
|
43
43
|
export function factorySync(lookFor) {
|
|
44
44
|
fs.accessSync(lookFor, fsc.F_OK);
|
|
45
|
-
return new (
|
|
45
|
+
return new (resolveMode(fs.lstatSync(lookFor).mode))(lookFor, false);
|
|
46
46
|
}
|
|
47
47
|
/** Async version of {@link factorySync}. */
|
|
48
48
|
export async function factory(lookFor) {
|
|
49
49
|
await fp.access(lookFor, fsc.F_OK);
|
|
50
|
-
return new (
|
|
50
|
+
return new (resolveMode((await fp.lstat(lookFor)).mode))(lookFor, false);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* A map that keeps track of locked roads to prevent concurrent modifications. The keys are the absolute paths of the roads, and the values are promises that resolve when the lock is released.
|
|
@@ -67,7 +67,7 @@ export function lockFor(roadOrPath) {
|
|
|
67
67
|
}
|
|
68
68
|
export class Road {
|
|
69
69
|
/** The absolute path to the file or directory that this Road instance represents.
|
|
70
|
-
* Intentionally made protected to prevent external modification, as changing this value could lead to inconsistencies and unexpected behavior. */
|
|
70
|
+
* @remarks Intentionally made protected to prevent external modification, as changing this value could lead to inconsistencies and unexpected behavior. */
|
|
71
71
|
pointsTo;
|
|
72
72
|
/** Indicates whether the file or directory represented by this Road instance can be modified.
|
|
73
73
|
* Changing this value does not affect the actual file system permissions, but rather serves as a safeguard within the application to prevent accidental modifications. */
|
|
@@ -76,14 +76,14 @@ export class Road {
|
|
|
76
76
|
/** Accessor for the absolute path to the file or directory that this Road instance represents. */
|
|
77
77
|
get isAt() { return this.pointsTo; }
|
|
78
78
|
/** Accessor for the name of the file or directory that this Road instance represents. */
|
|
79
|
-
get name() { return
|
|
79
|
+
get name() { return this.isAt.slice(this.isAt.lastIndexOf(ph.sep) + 1); }
|
|
80
80
|
/** Same as {@link isAt} but for compatibility with external libraries that try to convert the object to a string. */
|
|
81
81
|
toString() { return this.isAt; }
|
|
82
82
|
/** Returns the OS file type of the file or directory.
|
|
83
83
|
* Return value (OS type) and the type of this instance are not guaranteed to be the same, as the file system may have changed since this instance was created. */
|
|
84
|
-
typeSync() { return (
|
|
84
|
+
typeSync() { return (resolveMode(fs.lstatSync(this.isAt).mode)); }
|
|
85
85
|
/** Async version of {@link typeSync}. */
|
|
86
|
-
async type() { return (
|
|
86
|
+
async type() { return (resolveMode((await fp.lstat(this.isAt)).mode)); }
|
|
87
87
|
/**
|
|
88
88
|
* Constructs a new Road instance representing the file or directory at the specified path.
|
|
89
89
|
*
|
|
@@ -186,20 +186,18 @@ export class Road {
|
|
|
186
186
|
/**
|
|
187
187
|
* Checks if the file or directory represented by this Road is both visible and of the same type as expected.
|
|
188
188
|
*/
|
|
189
|
-
existsSync() { return this.verifySync(fsc.F_OK, true); }
|
|
190
189
|
async exists() { return this.verify(fsc.F_OK, true); }
|
|
190
|
+
existsSync() { return this.verifySync(fsc.F_OK, true); }
|
|
191
191
|
/**
|
|
192
192
|
* @returns The file system stats for the file or directory.
|
|
193
|
-
* @see {@link fs.
|
|
193
|
+
* @see {@link fs.lstat}
|
|
194
194
|
*/
|
|
195
|
-
|
|
195
|
+
async stats() { return fp.lstat(this.isAt); }
|
|
196
196
|
/**
|
|
197
197
|
* @returns The file system stats for the file or directory.
|
|
198
|
-
* @see {@link fs.
|
|
198
|
+
* @see {@link fs.lstatSync}
|
|
199
199
|
*/
|
|
200
|
-
|
|
201
|
-
return fp.lstat(this.isAt);
|
|
202
|
-
}
|
|
200
|
+
statsSync() { return fs.lstatSync(this.isAt); }
|
|
203
201
|
/**
|
|
204
202
|
* @returns The amount of path segments in the absolute path to the file or directory represented by this Road instance, minus one (i.e., the depth of the file or directory in the file system hierarchy).
|
|
205
203
|
* @remarks As subclasses of {@link Road} require all paths to be absolute/normalized and valid, this method is guaranteed to return a non-negative integer.
|
package/package.json
CHANGED
package/src/base.ts
CHANGED
|
@@ -257,7 +257,6 @@ export function encode122(data_: ArrayLike<number>): string {
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
|
|
260
|
-
|
|
261
260
|
/**
|
|
262
261
|
* Decodes a base-122 encoded string back into its original byte representation.
|
|
263
262
|
* The decoding process reverses the encoding, extracting 7 bits of data from each character and handling two-byte sequences for illegal characters.
|
package/src/road.ts
CHANGED
|
@@ -24,7 +24,7 @@ export class RdErr extends bs.InsErr { override name = "Instrumentality-Road-Err
|
|
|
24
24
|
* @returns The constructor function corresponding to the file mode.
|
|
25
25
|
* @throws If the file mode is unknown, throws a {@link RdErr}.
|
|
26
26
|
*/
|
|
27
|
-
export function
|
|
27
|
+
export function resolveMode(statmode: number) {
|
|
28
28
|
switch (statmode & fsc.S_IFMT) {
|
|
29
29
|
case fsc.S_IFREG: return File
|
|
30
30
|
case fsc.S_IFDIR: return Folder
|
|
@@ -48,12 +48,12 @@ export function modeCtor(statmode: number) {
|
|
|
48
48
|
*/
|
|
49
49
|
export function factorySync(lookFor: string) {
|
|
50
50
|
fs.accessSync(lookFor, fsc.F_OK)
|
|
51
|
-
return new (
|
|
51
|
+
return new (resolveMode(fs.lstatSync(lookFor).mode))(lookFor, false)
|
|
52
52
|
}
|
|
53
53
|
/** Async version of {@link factorySync}. */
|
|
54
54
|
export async function factory(lookFor: string) {
|
|
55
55
|
await fp.access(lookFor, fsc.F_OK)
|
|
56
|
-
return new (
|
|
56
|
+
return new (resolveMode((await fp.lstat(lookFor)).mode))(lookFor, false)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
|
|
@@ -79,7 +79,7 @@ export function lockFor(roadOrPath: Road | string) {
|
|
|
79
79
|
|
|
80
80
|
export abstract class Road {
|
|
81
81
|
/** The absolute path to the file or directory that this Road instance represents.
|
|
82
|
-
* Intentionally made protected to prevent external modification, as changing this value could lead to inconsistencies and unexpected behavior. */
|
|
82
|
+
* @remarks Intentionally made protected to prevent external modification, as changing this value could lead to inconsistencies and unexpected behavior. */
|
|
83
83
|
protected pointsTo: string
|
|
84
84
|
/** Indicates whether the file or directory represented by this Road instance can be modified.
|
|
85
85
|
* Changing this value does not affect the actual file system permissions, but rather serves as a safeguard within the application to prevent accidental modifications. */
|
|
@@ -89,14 +89,14 @@ export abstract class Road {
|
|
|
89
89
|
/** Accessor for the absolute path to the file or directory that this Road instance represents. */
|
|
90
90
|
get isAt() { return this.pointsTo }
|
|
91
91
|
/** Accessor for the name of the file or directory that this Road instance represents. */
|
|
92
|
-
get name() { return
|
|
92
|
+
get name() { return this.isAt.slice(this.isAt.lastIndexOf(ph.sep) + 1) }
|
|
93
93
|
/** Same as {@link isAt} but for compatibility with external libraries that try to convert the object to a string. */
|
|
94
94
|
toString() { return this.isAt }
|
|
95
95
|
/** Returns the OS file type of the file or directory.
|
|
96
96
|
* Return value (OS type) and the type of this instance are not guaranteed to be the same, as the file system may have changed since this instance was created. */
|
|
97
|
-
typeSync() { return (
|
|
97
|
+
typeSync() { return (resolveMode(fs.lstatSync(this.isAt).mode)) }
|
|
98
98
|
/** Async version of {@link typeSync}. */
|
|
99
|
-
async type() { return (
|
|
99
|
+
async type() { return (resolveMode((await fp.lstat(this.isAt)).mode)) }
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* Constructs a new Road instance representing the file or directory at the specified path.
|
|
@@ -107,7 +107,7 @@ export abstract class Road {
|
|
|
107
107
|
* @throws If the specified path does not exist, throws a fs.{@link Error}.
|
|
108
108
|
* @throws If the type of the file or directory at the specified path does not match the type of this instance, throws a {@link RdErr}. Useful for subclasses.
|
|
109
109
|
*/
|
|
110
|
-
constructor(lookFor: string, typeCheck: boolean) {
|
|
110
|
+
constructor(lookFor: string, typeCheck: boolean | 1 | 0) {
|
|
111
111
|
this.pointsTo = ph.resolve(lookFor)
|
|
112
112
|
if (typeCheck && !(this instanceof this.typeSync())) // `this` directly refers to the subclass
|
|
113
113
|
throw new RdErr(`Type missmatch: Path '${this.isAt}' is not of constructed type ${this.constructor.name}.`)
|
|
@@ -201,20 +201,18 @@ export abstract class Road {
|
|
|
201
201
|
/**
|
|
202
202
|
* Checks if the file or directory represented by this Road is both visible and of the same type as expected.
|
|
203
203
|
*/
|
|
204
|
-
existsSync() { return this.verifySync(fsc.F_OK, true) }
|
|
205
204
|
async exists() { return this.verify(fsc.F_OK, true) }
|
|
205
|
+
existsSync() { return this.verifySync(fsc.F_OK, true) }
|
|
206
206
|
/**
|
|
207
207
|
* @returns The file system stats for the file or directory.
|
|
208
|
-
* @see {@link fs.
|
|
208
|
+
* @see {@link fs.lstat}
|
|
209
209
|
*/
|
|
210
|
-
|
|
210
|
+
async stats() { return fp.lstat(this.isAt) }
|
|
211
211
|
/**
|
|
212
212
|
* @returns The file system stats for the file or directory.
|
|
213
|
-
* @see {@link fs.
|
|
213
|
+
* @see {@link fs.lstatSync}
|
|
214
214
|
*/
|
|
215
|
-
|
|
216
|
-
return fp.lstat(this.isAt)
|
|
217
|
-
}
|
|
215
|
+
statsSync() { return fs.lstatSync(this.isAt) }
|
|
218
216
|
|
|
219
217
|
/**
|
|
220
218
|
* @returns The amount of path segments in the absolute path to the file or directory represented by this Road instance, minus one (i.e., the depth of the file or directory in the file system hierarchy).
|