@fnndsc/fond 0.6.2 → 0.7.0
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 -3
- package/dist/errorStack.d.ts +0 -6
- package/dist/errorStack.js +0 -9
- package/dist/errorStack.js.map +1 -1
- package/dist/heldWriter.d.ts +130 -0
- package/dist/heldWriter.js +539 -0
- package/dist/heldWriter.js.map +1 -0
- package/dist/homePath.d.ts +60 -0
- package/dist/homePath.js +117 -0
- package/dist/homePath.js.map +1 -0
- package/dist/hostPlace.d.ts +275 -0
- package/dist/hostPlace.js +777 -0
- package/dist/hostPlace.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/placedPath.d.ts +250 -0
- package/dist/placedPath.js +757 -0
- package/dist/placedPath.js.map +1 -0
- package/dist/publication.d.ts +43 -0
- package/dist/publication.js +55 -0
- package/dist/publication.js.map +1 -0
- package/dist/recordFile.d.ts +61 -0
- package/dist/recordFile.js +258 -0
- package/dist/recordFile.js.map +1 -0
- package/dist/vfs/contract.js +19 -5
- package/dist/vfs/contract.js.map +1 -1
- package/dist/vfs/dispatcher.d.ts +222 -13
- package/dist/vfs/dispatcher.js +483 -73
- package/dist/vfs/dispatcher.js.map +1 -1
- package/dist/vfs/memory.d.ts +107 -3
- package/dist/vfs/memory.js +198 -24
- package/dist/vfs/memory.js.map +1 -1
- package/dist/vfs/naming.d.ts +97 -0
- package/dist/vfs/naming.js +122 -0
- package/dist/vfs/naming.js.map +1 -0
- package/dist/vfs/outcome.d.ts +72 -2
- package/dist/vfs/outcome.js +84 -3
- package/dist/vfs/outcome.js.map +1 -1
- package/dist/vfs/provider.d.ts +191 -6
- package/dist/vfs/render.d.ts +7 -0
- package/dist/vfs/render.js +16 -13
- package/dist/vfs/render.js.map +1 -1
- package/package.json +1 -1
package/dist/vfs/dispatcher.d.ts
CHANGED
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
import { Result } from "../result.js";
|
|
15
|
-
import { VFSProvider, VFSItem, CpOptions, type VFSSubtree } from "./provider.js";
|
|
15
|
+
import { VFSProvider, VFSItem, CpOptions, type HolderProof, type HolderProofOptions, type RenameOptions, type VFSSubtree, type WriteOptions } from "./provider.js";
|
|
16
16
|
import { type VfsOutcome } from "./outcome.js";
|
|
17
|
+
/** Where a path stands in a session's tree (`VFSDispatcher.path_standing`). */
|
|
18
|
+
export type PathStanding = 'outside' | 'absent' | 'unknown';
|
|
17
19
|
/**
|
|
18
20
|
* Routes filesystem requests to the mount that owns each path, or to the
|
|
19
21
|
* fallback.
|
|
@@ -60,6 +62,23 @@ export declare class VFSDispatcher {
|
|
|
60
62
|
* @returns The matching mount, or the fallback.
|
|
61
63
|
*/
|
|
62
64
|
provider_get(pathStr: string): VFSProvider;
|
|
65
|
+
/**
|
|
66
|
+
* Where a path stands for the session that owns this tree.
|
|
67
|
+
*
|
|
68
|
+
* `outside`: no mount serves it and the fallback holds nothing, so the
|
|
69
|
+
* path is not this tree's at all. `absent`: the mount that owns it has
|
|
70
|
+
* proved nothing is there (`absence_prove`). `unknown`: anything else,
|
|
71
|
+
* a mount that cannot prove absence, a proof that failed, or a path
|
|
72
|
+
* above a mount.
|
|
73
|
+
*
|
|
74
|
+
* A caller that would look somewhere else for a file (the engine's own
|
|
75
|
+
* disk) may do so on `outside` or `absent`, and never on `unknown`: a
|
|
76
|
+
* read that failed is not a file that is missing.
|
|
77
|
+
*
|
|
78
|
+
* @param pathStr - The absolute path.
|
|
79
|
+
* @returns Where it stands.
|
|
80
|
+
*/
|
|
81
|
+
path_standing(pathStr: string): Promise<PathStanding>;
|
|
63
82
|
/**
|
|
64
83
|
* Whether a path belongs to a mount rather than to the fallback.
|
|
65
84
|
*
|
|
@@ -96,9 +115,42 @@ export declare class VFSDispatcher {
|
|
|
96
115
|
sort?: "name" | "size" | "date" | "owner";
|
|
97
116
|
reverse?: boolean;
|
|
98
117
|
}): Promise<Result<VFSItem[]>>;
|
|
118
|
+
/**
|
|
119
|
+
* The names the mounts below a folder add to it: for each mount whose
|
|
120
|
+
* prefix lies under the folder, the prefix's next segment after it.
|
|
121
|
+
*
|
|
122
|
+
* @param cleanPath - The folder, absolute, with no trailing `/`.
|
|
123
|
+
* @returns The names, none when no mount lies under it.
|
|
124
|
+
*/
|
|
125
|
+
private mountNames_below;
|
|
126
|
+
/**
|
|
127
|
+
* Lists a folder that holds mounts: each mount's name, then what the store
|
|
128
|
+
* holds there under any other name. The store is asked by the path the
|
|
129
|
+
* resolver gives, or by the path as asked when it gives none.
|
|
130
|
+
*
|
|
131
|
+
* @param pathStr - The folder, as it was asked.
|
|
132
|
+
* @param virtualSubdirs - The names the mounts below it add.
|
|
133
|
+
* @param options - Sort controls.
|
|
134
|
+
* @returns The mounts' names and the store's rows.
|
|
135
|
+
*/
|
|
136
|
+
private mountFolder_list;
|
|
137
|
+
/**
|
|
138
|
+
* What the store holds at a folder of mounts, listed beside the mounts.
|
|
139
|
+
* The store holding nothing there, by its own proof (`holder_prove`), is
|
|
140
|
+
* an answer, as is a session with no store. Any other failure to read it
|
|
141
|
+
* stays on the error stack as the listing's diagnostic, so a listing that
|
|
142
|
+
* could not read the store is never taken for a whole one.
|
|
143
|
+
*
|
|
144
|
+
* @param at - The folder, as the store is asked it.
|
|
145
|
+
* @param options - Sort controls.
|
|
146
|
+
* @returns The store's rows there; none when it holds none or could not be read.
|
|
147
|
+
*/
|
|
148
|
+
private storeRows_beside;
|
|
99
149
|
/**
|
|
100
150
|
* The path a provider is asked with: as given for a mount, and through
|
|
101
|
-
* the path resolver for the fallback, when one is registered. An
|
|
151
|
+
* the path resolver for the fallback, when one is registered. An entry
|
|
152
|
+
* (what rm, rmdir and a rename's source act on) has only its folder
|
|
153
|
+
* resolved (the root is the root): a link it names is the link, never what it points at. An
|
|
102
154
|
* operation never proceeds on a guessed path: a path that does not
|
|
103
155
|
* resolve fails the operation.
|
|
104
156
|
*
|
|
@@ -106,18 +158,77 @@ export declare class VFSDispatcher {
|
|
|
106
158
|
* @param pathStr - The path as asked.
|
|
107
159
|
* @param what - How a resolution failure names the path (`source path`, `path`).
|
|
108
160
|
* @param operation - The verb, for the failure's words.
|
|
161
|
+
* @param entry - The last part names the entry itself, unresolved.
|
|
109
162
|
* @returns The path to ask with, or why the operation cannot proceed.
|
|
110
163
|
*/
|
|
111
164
|
private pathFor_provider;
|
|
112
165
|
/**
|
|
113
|
-
*
|
|
166
|
+
* The mount that owns a path, or none.
|
|
167
|
+
*
|
|
168
|
+
* {@link provider_get} answers the fallback for whatever no mount claims,
|
|
169
|
+
* and that includes a path that is only a parent of mounts (`/net` above
|
|
170
|
+
* `/net/pacs`), which the fallback has no folder behind. Such a path has
|
|
171
|
+
* no owner: nothing can be copied out of it or into it.
|
|
172
|
+
*
|
|
173
|
+
* @param pathStr - The absolute path.
|
|
174
|
+
* @returns The owning mount or the fallback; null for a parent of mounts.
|
|
175
|
+
*/
|
|
176
|
+
private owner_find;
|
|
177
|
+
/**
|
|
178
|
+
* Copies within a mount, or out of a mount that offers it into the
|
|
179
|
+
* fallback; any other pair of mounts answers `EXDEV`.
|
|
180
|
+
*
|
|
181
|
+
* A mount's `cp` is given two paths and treats both as its own, so a copy
|
|
182
|
+
* handed to the source's mount with a destination it does not own writes
|
|
183
|
+
* somewhere nobody asked for. Who owns each path is settled here, before
|
|
184
|
+
* either mount is asked anything, and again once the paths are resolved,
|
|
185
|
+
* since a resolver can answer a path another mount owns:
|
|
114
186
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
187
|
+
* - both paths in one mount: it copies, or refuses its own destination;
|
|
188
|
+
* - the source in a mount that declares `copiesOut`, the destination in
|
|
189
|
+
* the fallback: the source's mount copies, the destination resolved as
|
|
190
|
+
* the fallback resolves its own paths;
|
|
191
|
+
* - anything else, a parent of mounts on either side included: `EXDEV`.
|
|
192
|
+
*
|
|
193
|
+
* @param asked - Source path.
|
|
194
|
+
* @param askedDest - Destination path.
|
|
117
195
|
* @param options - Copy options.
|
|
118
196
|
* @returns Done, or why not.
|
|
119
197
|
*/
|
|
120
|
-
cp(
|
|
198
|
+
cp(asked: string, askedDest: string, options: CpOptions): Promise<VfsOutcome>;
|
|
199
|
+
/**
|
|
200
|
+
* A copy's options with the check the mount asks of every path it would
|
|
201
|
+
* write: inside the source `EINVAL`, not the mount's own `EXDEV`, then the caller's.
|
|
202
|
+
*
|
|
203
|
+
* @param options - The copy's options, as asked.
|
|
204
|
+
* @param destination - The mount the destination belongs to.
|
|
205
|
+
* @param fromPath - The source, resolved and canonical.
|
|
206
|
+
* @returns The options, the check bound.
|
|
207
|
+
*/
|
|
208
|
+
private copyOptions_bind;
|
|
209
|
+
/**
|
|
210
|
+
* The refusal of a path a copy or a move would write that is not the
|
|
211
|
+
* mount's own: below a folder of mounts, or another mount's.
|
|
212
|
+
*
|
|
213
|
+
* @param provider - The mount that writes.
|
|
214
|
+
* @param at - The path it would write, canonical.
|
|
215
|
+
* @param operation - The verb, for the words.
|
|
216
|
+
* @returns `EXDEV`, or null when the path is the mount's own.
|
|
217
|
+
*/
|
|
218
|
+
private finalOwner_refuse;
|
|
219
|
+
/**
|
|
220
|
+
* Whether the mount that owns a destination honours `intoFolder`
|
|
221
|
+
* (`intoFolderOffered`); a path no mount owns takes nothing.
|
|
222
|
+
*
|
|
223
|
+
* @param pathStr - The destination.
|
|
224
|
+
* @returns True when its mount declares it.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* if (!dispatcher.intoFolder_offered('/proc/tags/qc')) refuse();
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
intoFolder_offered(pathStr: string): boolean;
|
|
121
232
|
/**
|
|
122
233
|
* Reads a file whole, as text, through the provider that owns it.
|
|
123
234
|
*
|
|
@@ -149,9 +260,10 @@ export declare class VFSDispatcher {
|
|
|
149
260
|
*
|
|
150
261
|
* @param pathStr - The absolute path of the file.
|
|
151
262
|
* @param content - The new content, whole.
|
|
263
|
+
* @param options - What becomes of a file already there.
|
|
152
264
|
* @returns Done, or why not.
|
|
153
265
|
*/
|
|
154
|
-
write(pathStr: string, content: string | Buffer): Promise<VfsOutcome>;
|
|
266
|
+
write(pathStr: string, content: string | Buffer, options?: WriteOptions): Promise<VfsOutcome>;
|
|
155
267
|
/**
|
|
156
268
|
* Makes a folder, through the provider that owns its path.
|
|
157
269
|
*
|
|
@@ -175,22 +287,118 @@ export declare class VFSDispatcher {
|
|
|
175
287
|
*/
|
|
176
288
|
mkdirTree(pathStr: string): Promise<VfsOutcome>;
|
|
177
289
|
/**
|
|
178
|
-
* Removes an empty folder, through the provider that owns it
|
|
290
|
+
* Removes an empty folder, through the provider that owns it, as asked
|
|
291
|
+
* and as resolved: a path that resolves into another mount, or one no
|
|
292
|
+
* mount owns, answers `EXDEV`.
|
|
179
293
|
*
|
|
180
294
|
* @param pathStr - The absolute path of the folder.
|
|
181
295
|
* @returns Done, or why not.
|
|
182
296
|
*/
|
|
183
297
|
rmdir(pathStr: string): Promise<VfsOutcome>;
|
|
184
298
|
/**
|
|
185
|
-
* Renames within one mount; a rename across mounts answers `EXDEV
|
|
299
|
+
* Renames within one mount; a rename across mounts answers `EXDEV`, and
|
|
300
|
+
* so does one with an operand no mount owns (a parent of mounts, or a
|
|
301
|
+
* path below one), as asked or as resolved: such a path is handed to the
|
|
302
|
+
* fallback only for want of an owner, and nothing behind it is a folder.
|
|
303
|
+
* The source is the entry itself (a link is the link); a link at the end
|
|
304
|
+
* of the destination is followed.
|
|
186
305
|
*
|
|
187
306
|
* @param src - The absolute path now.
|
|
188
|
-
* @param dest - The absolute path it takes.
|
|
307
|
+
* @param dest - The absolute path it takes, or with `mvNaming` a folder it goes into.
|
|
308
|
+
* @param options - How the mount names the entry; passed through as given.
|
|
189
309
|
* @returns Done, or why not.
|
|
190
310
|
*/
|
|
191
|
-
rename(src: string, dest: string): Promise<VfsOutcome>;
|
|
311
|
+
rename(src: string, dest: string, options?: RenameOptions): Promise<VfsOutcome>;
|
|
312
|
+
/**
|
|
313
|
+
* The nearest path, at or above a path, that no provider owns (a parent of
|
|
314
|
+
* mounts), on the walk up a proof of the path would make. A mount proves
|
|
315
|
+
* within itself, so only a path the fallback owns walks up to the root.
|
|
316
|
+
*
|
|
317
|
+
* @param pathStr - The path.
|
|
318
|
+
* @returns That path, or null when every step has an owner.
|
|
319
|
+
*/
|
|
320
|
+
private ownerless_find;
|
|
321
|
+
/**
|
|
322
|
+
* Whether what holds a path is proved before an act on it: where the
|
|
323
|
+
* owning mount offers a proof, and where no mount owns the path or a step
|
|
324
|
+
* above it (there the proof answers an error). False for a mount with its
|
|
325
|
+
* own verbs and no proof (the tag projection): it is asked directly.
|
|
326
|
+
*
|
|
327
|
+
* @param pathStr - The path.
|
|
328
|
+
* @returns True when {@link holder_prove} decides.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* if (!dispatcher.holderProof_offered(target)) return dispatcher.rm(target);
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
holderProof_offered(pathStr: string): boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Proves what holds a path, through the mount that owns it, resolved as
|
|
338
|
+
* the act it decides is resolved (the same provider, the same
|
|
339
|
+
* `pathFor_provider`), so a proof and the act it allows are about one
|
|
340
|
+
* place: the entry itself for rm, rmdir and a rename's source (`entry`),
|
|
341
|
+
* a link at the end followed for anything else. A path no provider owns,
|
|
342
|
+
* or one whose proof would walk up through a parent of mounts, is an
|
|
343
|
+
* error: mount names are not an absence. So is one that resolves to a
|
|
344
|
+
* path another mount owns (`EXDEV`): the provider chosen for the path as
|
|
345
|
+
* asked holds nothing of that path's.
|
|
346
|
+
*
|
|
347
|
+
* @param pathStr - The absolute path.
|
|
348
|
+
* @param options - Whether the last part names the entry itself.
|
|
349
|
+
* @returns What holds it, or why that could not be proved.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* const proof: VfsOutcome<HolderProof> = await dispatcher.holder_prove('/home/ada/x', { entry: true });
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
holder_prove(pathStr: string, options?: HolderProofOptions): Promise<VfsOutcome<HolderProof>>;
|
|
357
|
+
/**
|
|
358
|
+
* The refusal of a path that resolves to one another mount owns: the
|
|
359
|
+
* provider chosen for the path as asked would be handed a path it does
|
|
360
|
+
* not own, and would answer for its own map (an absence, a removal of
|
|
361
|
+
* nothing) instead of the owner's.
|
|
362
|
+
*
|
|
363
|
+
* @param provider - The provider chosen for the path as asked.
|
|
364
|
+
* @param asked - The path as asked.
|
|
365
|
+
* @param resolved - The path it resolved to.
|
|
366
|
+
* @param operation - The verb, for the words.
|
|
367
|
+
* @returns `EXDEV`, or null when the resolved path is the provider's own.
|
|
368
|
+
*/
|
|
369
|
+
private ownerElsewhere_refuse;
|
|
370
|
+
/**
|
|
371
|
+
* The path a removal hands its provider, the entry itself (only its folder
|
|
372
|
+
* resolved: a link is removed, never what it points at), owned as rename's operands are:
|
|
373
|
+
* no operand a parent of mounts (or below one), as asked or as resolved,
|
|
374
|
+
* and the resolved path the same provider's own.
|
|
375
|
+
*
|
|
376
|
+
* @param provider - The provider chosen for the path as asked.
|
|
377
|
+
* @param pathStr - The path as asked.
|
|
378
|
+
* @param operation - The verb (`rm`, `rmdir`).
|
|
379
|
+
* @returns The path to ask with, or why the removal is not asked (`EXDEV`, `EIO`).
|
|
380
|
+
*/
|
|
381
|
+
private removalPath_resolve;
|
|
382
|
+
/**
|
|
383
|
+
* The refusal of a rename or a removal with an operand no mount owns: a
|
|
384
|
+
* parent of mounts, or a path below one that the fallback would be handed
|
|
385
|
+
* for want of an owner. Nothing is moved out of one or into one, or removed.
|
|
386
|
+
*
|
|
387
|
+
* @param pathStr - An operand, as asked or as resolved.
|
|
388
|
+
* @param operation - The verb (`mv`, `rm`, `rmdir`).
|
|
389
|
+
* @returns `EXDEV`, or null when every step up has an owner.
|
|
390
|
+
*/
|
|
391
|
+
private mutationOwnerless_refuse;
|
|
392
|
+
/**
|
|
393
|
+
* The refusal of a proof that would read a parent of mounts as a folder.
|
|
394
|
+
*
|
|
395
|
+
* @param pathStr - The path asked, or the one it resolved to.
|
|
396
|
+
* @returns The failure, or null when every step up has an owner.
|
|
397
|
+
*/
|
|
398
|
+
private ownerless_refuse;
|
|
192
399
|
/**
|
|
193
|
-
* Removes a file or a link, through the provider that owns it
|
|
400
|
+
* Removes a file or a link, through the provider that owns it, as asked
|
|
401
|
+
* and as resolved (`EXDEV` otherwise, as {@link rmdir}).
|
|
194
402
|
*
|
|
195
403
|
* @param pathStr - The absolute path of the entry.
|
|
196
404
|
* @returns Done, or why not.
|
|
@@ -205,7 +413,8 @@ export declare class VFSDispatcher {
|
|
|
205
413
|
rmTree_offered(pathStr: string): boolean;
|
|
206
414
|
/**
|
|
207
415
|
* Removes a folder and everything under it in one step, where the
|
|
208
|
-
* owning provider can; elsewhere `EROFS`, and `rm -r` walks instead.
|
|
416
|
+
* owning provider can; elsewhere `EROFS`, and `rm -r` walks instead. Owned
|
|
417
|
+
* as asked and as resolved (`EXDEV` otherwise, as {@link rmdir}).
|
|
209
418
|
*
|
|
210
419
|
* @param pathStr - The absolute path of the folder.
|
|
211
420
|
* @returns Done, or why not.
|