@archildata/just-bash 0.8.18 → 0.8.20
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/dist/index.cjs +633 -678
- package/dist/index.d.cts +131 -136
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +210 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/shell.mjs +319 -0
- package/dist/shell.mjs.map +1 -0
- package/dist/src-zhIdm_Vq.mjs +622 -0
- package/dist/src-zhIdm_Vq.mjs.map +1 -0
- package/package.json +19 -18
- package/dist/index.d.ts +0 -215
- package/dist/index.js +0 -652
- package/dist/shell.js +0 -313
package/dist/index.d.cts
CHANGED
|
@@ -1,59 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ArchilClient, UnixUser } from '@archildata/native';
|
|
3
|
-
import * as just_bash from 'just-bash';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Archil filesystem adapter for just-bash
|
|
7
|
-
*
|
|
8
|
-
* Implements the IFileSystem interface from just-bash using the ArchilClient
|
|
9
|
-
* from @archildata/native for direct protocol access to Archil distributed filesystems.
|
|
10
|
-
*/
|
|
1
|
+
import { ArchilClient, UnixUser } from "@archildata/native";
|
|
11
2
|
|
|
3
|
+
//#region src/ArchilFs.d.ts
|
|
12
4
|
type BufferEncoding = "utf8" | "utf-8" | "ascii" | "binary" | "base64" | "hex" | "latin1";
|
|
13
5
|
type FileContent = string | Uint8Array;
|
|
14
6
|
interface FsStat {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
isFile: boolean;
|
|
8
|
+
isDirectory: boolean;
|
|
9
|
+
isSymbolicLink: boolean;
|
|
10
|
+
mode: number;
|
|
11
|
+
size: number;
|
|
12
|
+
mtime: Date;
|
|
21
13
|
}
|
|
22
14
|
interface DirentEntry {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
name: string;
|
|
16
|
+
isFile: boolean;
|
|
17
|
+
isDirectory: boolean;
|
|
18
|
+
isSymbolicLink: boolean;
|
|
27
19
|
}
|
|
28
20
|
interface IFileSystem {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
21
|
+
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
22
|
+
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
23
|
+
readdir(path: string): Promise<string[]>;
|
|
24
|
+
readdirWithFileTypes?(path: string): Promise<DirentEntry[]>;
|
|
25
|
+
stat(path: string): Promise<FsStat>;
|
|
26
|
+
lstat(path: string): Promise<FsStat>;
|
|
27
|
+
exists(path: string): Promise<boolean>;
|
|
28
|
+
readlink(path: string): Promise<string>;
|
|
29
|
+
realpath(path: string): Promise<string>;
|
|
30
|
+
writeFile(path: string, content: FileContent): Promise<void>;
|
|
31
|
+
appendFile(path: string, content: FileContent): Promise<void>;
|
|
32
|
+
mkdir(path: string, options?: {
|
|
33
|
+
recursive?: boolean;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
rm(path: string, options?: {
|
|
36
|
+
recursive?: boolean;
|
|
37
|
+
force?: boolean;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
cp(src: string, dest: string, options?: {
|
|
40
|
+
recursive?: boolean;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
mv(src: string, dest: string): Promise<void>;
|
|
43
|
+
symlink(target: string, path: string): Promise<void>;
|
|
44
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
45
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
46
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
47
|
+
resolvePath(base: string, ...paths: string[]): string;
|
|
48
|
+
getAllPaths?(): string[];
|
|
57
49
|
}
|
|
58
50
|
/**
|
|
59
51
|
* ArchilFs implements the just-bash IFileSystem interface using Archil protocol.
|
|
@@ -83,89 +75,90 @@ interface IFileSystem {
|
|
|
83
75
|
* ```
|
|
84
76
|
*/
|
|
85
77
|
declare class ArchilFs implements IFileSystem {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
78
|
+
private client;
|
|
79
|
+
private user?;
|
|
80
|
+
private rootInodeId;
|
|
81
|
+
private constructor();
|
|
82
|
+
/**
|
|
83
|
+
* Create an ArchilFs adapter, optionally rooted at a subdirectory.
|
|
84
|
+
*
|
|
85
|
+
* The subdirectory path is resolved eagerly: if any component does not
|
|
86
|
+
* exist or is not a directory, this method throws immediately.
|
|
87
|
+
*
|
|
88
|
+
* @param client - Connected ArchilClient instance
|
|
89
|
+
* @param options - Optional configuration
|
|
90
|
+
* @param options.user - Unix user context for permission checks
|
|
91
|
+
* @param options.subdirectory - Subdirectory to treat as the root of the filesystem
|
|
92
|
+
*/
|
|
93
|
+
static create(client: ArchilClient, options?: {
|
|
94
|
+
user?: UnixUser;
|
|
95
|
+
subdirectory?: string;
|
|
96
|
+
}): Promise<ArchilFs>;
|
|
97
|
+
/**
|
|
98
|
+
* Normalize a path (remove . and .., ensure leading /)
|
|
99
|
+
*/
|
|
100
|
+
private normalizePath;
|
|
101
|
+
private static readonly MAX_SYMLINKS;
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a path to its inode ID, walking the directory tree.
|
|
104
|
+
* Follows symlinks on intermediate components but NOT on the final
|
|
105
|
+
* component (matching lstat/readlink semantics).
|
|
106
|
+
*/
|
|
107
|
+
private resolve;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve a path, following symlinks on ALL components including the
|
|
110
|
+
* final one (like stat(2)). Use resolve() when you need lstat semantics.
|
|
111
|
+
*/
|
|
112
|
+
private resolveFollow;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve parent directory and get child name
|
|
115
|
+
*/
|
|
116
|
+
private resolveParent;
|
|
117
|
+
/**
|
|
118
|
+
* Convert InodeAttributes to FsStat
|
|
119
|
+
*/
|
|
120
|
+
private toStat;
|
|
121
|
+
private static readonly DIR_PAGE_SIZE;
|
|
122
|
+
/**
|
|
123
|
+
* Read all directory entries using the paginated API.
|
|
124
|
+
*/
|
|
125
|
+
private readAllDirectoryEntries;
|
|
126
|
+
resolvePath(base: string, ...paths: string[]): string;
|
|
127
|
+
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
128
|
+
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
129
|
+
readdir(path: string): Promise<string[]>;
|
|
130
|
+
readdirWithFileTypes(path: string): Promise<DirentEntry[]>;
|
|
131
|
+
stat(path: string): Promise<FsStat>;
|
|
132
|
+
lstat(path: string): Promise<FsStat>;
|
|
133
|
+
exists(path: string): Promise<boolean>;
|
|
134
|
+
readlink(path: string): Promise<string>;
|
|
135
|
+
realpath(path: string, symlinkDepth?: number): Promise<string>;
|
|
136
|
+
writeFile(path: string, content: FileContent): Promise<void>;
|
|
137
|
+
appendFile(path: string, content: FileContent): Promise<void>;
|
|
138
|
+
mkdir(path: string, options?: {
|
|
139
|
+
recursive?: boolean;
|
|
140
|
+
}): Promise<void>;
|
|
141
|
+
private mkdirSingle;
|
|
142
|
+
rm(path: string, options?: {
|
|
143
|
+
recursive?: boolean;
|
|
144
|
+
force?: boolean;
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
cp(src: string, dest: string, options?: {
|
|
147
|
+
recursive?: boolean;
|
|
148
|
+
}): Promise<void>;
|
|
149
|
+
mv(src: string, dest: string): Promise<void>;
|
|
150
|
+
symlink(target: string, path: string): Promise<void>;
|
|
151
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
152
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
153
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
154
|
+
getAllPaths(): string[];
|
|
155
|
+
/**
|
|
156
|
+
* Resolve a path to its inode ID (public wrapper for delegation operations)
|
|
157
|
+
*/
|
|
158
|
+
resolveInodeId(path: string): Promise<number>;
|
|
167
159
|
}
|
|
168
|
-
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/commands.d.ts
|
|
169
162
|
/**
|
|
170
163
|
* Create the `archil` custom command for use with just-bash.
|
|
171
164
|
*
|
|
@@ -189,8 +182,9 @@ declare class ArchilFs implements IFileSystem {
|
|
|
189
182
|
* await bash.exec('archil checkin /mydir');
|
|
190
183
|
* ```
|
|
191
184
|
*/
|
|
192
|
-
declare function createArchilCommand(client: ArchilClient, fs: ArchilFs):
|
|
193
|
-
|
|
185
|
+
declare function createArchilCommand(client: ArchilClient, fs: ArchilFs): import("just-bash").Command;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/index.d.ts
|
|
194
188
|
/**
|
|
195
189
|
* Create an ArchilFs instance, optionally rooted at a subdirectory.
|
|
196
190
|
*
|
|
@@ -207,9 +201,10 @@ declare function createArchilCommand(client: ArchilClient, fs: ArchilFs): just_b
|
|
|
207
201
|
* const fs = await createArchilFs(client, { user: { uid: 1000, gid: 1000 } });
|
|
208
202
|
* ```
|
|
209
203
|
*/
|
|
210
|
-
declare function createArchilFs(client:
|
|
211
|
-
|
|
212
|
-
|
|
204
|
+
declare function createArchilFs(client: import("@archildata/native").ArchilClient, options?: {
|
|
205
|
+
user?: import("@archildata/native").UnixUser;
|
|
206
|
+
subdirectory?: string;
|
|
213
207
|
}): Promise<ArchilFs>;
|
|
214
|
-
|
|
208
|
+
//#endregion
|
|
215
209
|
export { ArchilFs, type BufferEncoding, type DirentEntry, type FileContent, type FsStat, type IFileSystem, createArchilCommand, createArchilFs };
|
|
210
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/ArchilFs.ts","../src/commands.ts","../src/index.ts"],"mappings":";;;KAcY,cAAA;AAAA,KASA,WAAA,YAAuB,UAAU;AAAA,UAE5B,MAAA;EACf,MAAA;EACA,WAAA;EACA,cAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA,EAAO,IAAI;AAAA;AAAA,UAGI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,UAAa,IAAA,UAAc,OAAA;IAAY,SAAA;EAAA,IAAwB,OAAA;EA2BlE,EAAA,CAAG,GAAA,UAAa,IAAA,WAAe,OAAA;EAc/B,OAAA,CAAQ,MAAA,UAAgB,IAAA,WAAe,OAAA;EAiBvC,IAAA,CAAK,YAAA,UAAsB,OAAA,WAAkB,OAAA;EAS7C,KAAA,CAAM,IAAA,UAAc,IAAA,WAAe,OAAA;EAKnC,MAAA,CAAO,IAAA,UAAc,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA,GAAO,OAAA;EAsBtD,WAAA;EA/oBW;;;EAspBL,cAAA,CAAe,IAAA,WAAe,OAAA;AAAA;;;;AAjvBtC;;;;AAA0B;AAS1B;;;;AAA6C;AAE7C;;;;;;;;;;;;iBCGgB,mBAAA,CAAoB,MAAA,EAAQ,YAAA,EAAc,EAAA,EAAI,QAAQ,uBAAA,OAAA;;;;ADUtD;AAGhB;;;;;;;;;;;;;;iBEmBsB,cAAA,CACpB,MAAA,+BAAqC,YAAA,EACrC,OAAA;EAAY,IAAA,gCAAoC,QAAA;EAAU,YAAA;AAAA,IACzD,OAAO,CAAC,QAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { ArchilClient, UnixUser } from "@archildata/native";
|
|
2
|
+
|
|
3
|
+
//#region src/ArchilFs.d.ts
|
|
4
|
+
type BufferEncoding = "utf8" | "utf-8" | "ascii" | "binary" | "base64" | "hex" | "latin1";
|
|
5
|
+
type FileContent = string | Uint8Array;
|
|
6
|
+
interface FsStat {
|
|
7
|
+
isFile: boolean;
|
|
8
|
+
isDirectory: boolean;
|
|
9
|
+
isSymbolicLink: boolean;
|
|
10
|
+
mode: number;
|
|
11
|
+
size: number;
|
|
12
|
+
mtime: Date;
|
|
13
|
+
}
|
|
14
|
+
interface DirentEntry {
|
|
15
|
+
name: string;
|
|
16
|
+
isFile: boolean;
|
|
17
|
+
isDirectory: boolean;
|
|
18
|
+
isSymbolicLink: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface IFileSystem {
|
|
21
|
+
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
22
|
+
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
23
|
+
readdir(path: string): Promise<string[]>;
|
|
24
|
+
readdirWithFileTypes?(path: string): Promise<DirentEntry[]>;
|
|
25
|
+
stat(path: string): Promise<FsStat>;
|
|
26
|
+
lstat(path: string): Promise<FsStat>;
|
|
27
|
+
exists(path: string): Promise<boolean>;
|
|
28
|
+
readlink(path: string): Promise<string>;
|
|
29
|
+
realpath(path: string): Promise<string>;
|
|
30
|
+
writeFile(path: string, content: FileContent): Promise<void>;
|
|
31
|
+
appendFile(path: string, content: FileContent): Promise<void>;
|
|
32
|
+
mkdir(path: string, options?: {
|
|
33
|
+
recursive?: boolean;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
rm(path: string, options?: {
|
|
36
|
+
recursive?: boolean;
|
|
37
|
+
force?: boolean;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
cp(src: string, dest: string, options?: {
|
|
40
|
+
recursive?: boolean;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
mv(src: string, dest: string): Promise<void>;
|
|
43
|
+
symlink(target: string, path: string): Promise<void>;
|
|
44
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
45
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
46
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
47
|
+
resolvePath(base: string, ...paths: string[]): string;
|
|
48
|
+
getAllPaths?(): string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* ArchilFs implements the just-bash IFileSystem interface using Archil protocol.
|
|
52
|
+
*
|
|
53
|
+
* This adapter provides:
|
|
54
|
+
* - Path-to-inode resolution
|
|
55
|
+
* - Full filesystem operations via Archil protocol
|
|
56
|
+
* - Optional user context for permission checks
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* import { ArchilClient } from '@archildata/native';
|
|
61
|
+
* import { ArchilFs } from '@archildata/just-bash';
|
|
62
|
+
*
|
|
63
|
+
* const client = await ArchilClient.connect({
|
|
64
|
+
* region: 'aws-us-east-1',
|
|
65
|
+
* diskName: 'myaccount/mydisk',
|
|
66
|
+
* authToken: 'adt_xxx',
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* const fs = await ArchilFs.create(client);
|
|
70
|
+
*
|
|
71
|
+
* // Use with just-bash
|
|
72
|
+
* import { Bash } from 'just-bash';
|
|
73
|
+
* const bash = new Bash({ fs });
|
|
74
|
+
* await bash.run('ls -la /');
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare class ArchilFs implements IFileSystem {
|
|
78
|
+
private client;
|
|
79
|
+
private user?;
|
|
80
|
+
private rootInodeId;
|
|
81
|
+
private constructor();
|
|
82
|
+
/**
|
|
83
|
+
* Create an ArchilFs adapter, optionally rooted at a subdirectory.
|
|
84
|
+
*
|
|
85
|
+
* The subdirectory path is resolved eagerly: if any component does not
|
|
86
|
+
* exist or is not a directory, this method throws immediately.
|
|
87
|
+
*
|
|
88
|
+
* @param client - Connected ArchilClient instance
|
|
89
|
+
* @param options - Optional configuration
|
|
90
|
+
* @param options.user - Unix user context for permission checks
|
|
91
|
+
* @param options.subdirectory - Subdirectory to treat as the root of the filesystem
|
|
92
|
+
*/
|
|
93
|
+
static create(client: ArchilClient, options?: {
|
|
94
|
+
user?: UnixUser;
|
|
95
|
+
subdirectory?: string;
|
|
96
|
+
}): Promise<ArchilFs>;
|
|
97
|
+
/**
|
|
98
|
+
* Normalize a path (remove . and .., ensure leading /)
|
|
99
|
+
*/
|
|
100
|
+
private normalizePath;
|
|
101
|
+
private static readonly MAX_SYMLINKS;
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a path to its inode ID, walking the directory tree.
|
|
104
|
+
* Follows symlinks on intermediate components but NOT on the final
|
|
105
|
+
* component (matching lstat/readlink semantics).
|
|
106
|
+
*/
|
|
107
|
+
private resolve;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve a path, following symlinks on ALL components including the
|
|
110
|
+
* final one (like stat(2)). Use resolve() when you need lstat semantics.
|
|
111
|
+
*/
|
|
112
|
+
private resolveFollow;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve parent directory and get child name
|
|
115
|
+
*/
|
|
116
|
+
private resolveParent;
|
|
117
|
+
/**
|
|
118
|
+
* Convert InodeAttributes to FsStat
|
|
119
|
+
*/
|
|
120
|
+
private toStat;
|
|
121
|
+
private static readonly DIR_PAGE_SIZE;
|
|
122
|
+
/**
|
|
123
|
+
* Read all directory entries using the paginated API.
|
|
124
|
+
*/
|
|
125
|
+
private readAllDirectoryEntries;
|
|
126
|
+
resolvePath(base: string, ...paths: string[]): string;
|
|
127
|
+
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
128
|
+
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
129
|
+
readdir(path: string): Promise<string[]>;
|
|
130
|
+
readdirWithFileTypes(path: string): Promise<DirentEntry[]>;
|
|
131
|
+
stat(path: string): Promise<FsStat>;
|
|
132
|
+
lstat(path: string): Promise<FsStat>;
|
|
133
|
+
exists(path: string): Promise<boolean>;
|
|
134
|
+
readlink(path: string): Promise<string>;
|
|
135
|
+
realpath(path: string, symlinkDepth?: number): Promise<string>;
|
|
136
|
+
writeFile(path: string, content: FileContent): Promise<void>;
|
|
137
|
+
appendFile(path: string, content: FileContent): Promise<void>;
|
|
138
|
+
mkdir(path: string, options?: {
|
|
139
|
+
recursive?: boolean;
|
|
140
|
+
}): Promise<void>;
|
|
141
|
+
private mkdirSingle;
|
|
142
|
+
rm(path: string, options?: {
|
|
143
|
+
recursive?: boolean;
|
|
144
|
+
force?: boolean;
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
cp(src: string, dest: string, options?: {
|
|
147
|
+
recursive?: boolean;
|
|
148
|
+
}): Promise<void>;
|
|
149
|
+
mv(src: string, dest: string): Promise<void>;
|
|
150
|
+
symlink(target: string, path: string): Promise<void>;
|
|
151
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
152
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
153
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
154
|
+
getAllPaths(): string[];
|
|
155
|
+
/**
|
|
156
|
+
* Resolve a path to its inode ID (public wrapper for delegation operations)
|
|
157
|
+
*/
|
|
158
|
+
resolveInodeId(path: string): Promise<number>;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/commands.d.ts
|
|
162
|
+
/**
|
|
163
|
+
* Create the `archil` custom command for use with just-bash.
|
|
164
|
+
*
|
|
165
|
+
* Provides checkout/checkin delegation management, delegation listing, and
|
|
166
|
+
* cache control (invalidate-cache, set-cache-expiry) as a shell command that
|
|
167
|
+
* works in scripts, pipes, and interactive use.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* import { Bash } from 'just-bash';
|
|
172
|
+
* import { ArchilFs, createArchilCommand } from '@archildata/just-bash';
|
|
173
|
+
*
|
|
174
|
+
* const fs = await ArchilFs.create(client);
|
|
175
|
+
* const bash = new Bash({
|
|
176
|
+
* fs,
|
|
177
|
+
* customCommands: [createArchilCommand(client, fs)],
|
|
178
|
+
* });
|
|
179
|
+
*
|
|
180
|
+
* await bash.exec('archil checkout /mydir');
|
|
181
|
+
* await bash.exec('echo "hello" > /mydir/file.txt');
|
|
182
|
+
* await bash.exec('archil checkin /mydir');
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function createArchilCommand(client: ArchilClient, fs: ArchilFs): import("just-bash").Command;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/index.d.ts
|
|
188
|
+
/**
|
|
189
|
+
* Create an ArchilFs instance, optionally rooted at a subdirectory.
|
|
190
|
+
*
|
|
191
|
+
* @param client - Connected ArchilClient instance
|
|
192
|
+
* @param options - Optional configuration
|
|
193
|
+
* @returns Configured ArchilFs instance
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* import { ArchilClient } from '@archildata/native';
|
|
198
|
+
* import { createArchilFs } from '@archildata/just-bash';
|
|
199
|
+
*
|
|
200
|
+
* const client = await ArchilClient.connectAuthenticated({...});
|
|
201
|
+
* const fs = await createArchilFs(client, { user: { uid: 1000, gid: 1000 } });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare function createArchilFs(client: import("@archildata/native").ArchilClient, options?: {
|
|
205
|
+
user?: import("@archildata/native").UnixUser;
|
|
206
|
+
subdirectory?: string;
|
|
207
|
+
}): Promise<ArchilFs>;
|
|
208
|
+
//#endregion
|
|
209
|
+
export { ArchilFs, type BufferEncoding, type DirentEntry, type FileContent, type FsStat, type IFileSystem, createArchilCommand, createArchilFs };
|
|
210
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ArchilFs.ts","../src/commands.ts","../src/index.ts"],"mappings":";;;KAcY,cAAA;AAAA,KASA,WAAA,YAAuB,UAAU;AAAA,UAE5B,MAAA;EACf,MAAA;EACA,WAAA;EACA,cAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA,EAAO,IAAI;AAAA;AAAA,UAGI,WAAA;EACf,IAAA;EACA,MAAA;EACA,WAAA;EACA,cAAA;AAAA;AAAA,UAGe,WAAA;EAEf,QAAA,CAAS,IAAA,UAAc,QAAA,GAAW,cAAA,GAAiB,OAAA;EACnD,cAAA,CAAe,IAAA,WAAe,OAAA,CAAQ,UAAA;EACtC,OAAA,CAAQ,IAAA,WAAe,OAAA;EACvB,oBAAA,EAAsB,IAAA,WAAe,OAAA,CAAQ,WAAA;EAC7C,IAAA,CAAK,IAAA,WAAe,OAAA,CAAQ,MAAA;EAC5B,KAAA,CAAM,IAAA,WAA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