@effect-vfs/core 0.1.0 → 0.3.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.
Files changed (58) hide show
  1. package/README.md +97 -8
  2. package/dist/BytePath.d.ts +34 -0
  3. package/dist/BytePath.d.ts.map +1 -0
  4. package/dist/BytePath.js +16 -0
  5. package/dist/Snapshot.d.ts +5 -5
  6. package/dist/Snapshot.d.ts.map +1 -1
  7. package/dist/Snapshot.js +5 -6
  8. package/dist/SnapshotDelta.d.ts +193 -0
  9. package/dist/SnapshotDelta.d.ts.map +1 -0
  10. package/dist/SnapshotDelta.js +139 -0
  11. package/dist/VirtualFileSystem.d.ts +193 -342
  12. package/dist/VirtualFileSystem.d.ts.map +1 -1
  13. package/dist/VirtualFileSystem.js +104 -1774
  14. package/dist/internal/bytePath.d.ts +10 -0
  15. package/dist/internal/bytePath.d.ts.map +1 -0
  16. package/dist/internal/bytePath.js +46 -0
  17. package/dist/internal/canonicalBase64.d.ts +7 -0
  18. package/dist/internal/canonicalBase64.d.ts.map +1 -0
  19. package/dist/internal/canonicalBase64.js +11 -0
  20. package/dist/internal/image.d.ts +28 -31
  21. package/dist/internal/image.d.ts.map +1 -1
  22. package/dist/internal/image.js +14 -23
  23. package/dist/internal/snapshotDelta.d.ts +87 -0
  24. package/dist/internal/snapshotDelta.d.ts.map +1 -0
  25. package/dist/internal/snapshotDelta.js +576 -0
  26. package/dist/internal/snapshotDeltaModel.d.ts +10 -0
  27. package/dist/internal/snapshotDeltaModel.d.ts.map +1 -0
  28. package/dist/internal/snapshotDeltaModel.js +13 -0
  29. package/dist/internal/virtualFileSystem/errors.d.ts +26 -0
  30. package/dist/internal/virtualFileSystem/errors.d.ts.map +1 -0
  31. package/dist/internal/virtualFileSystem/errors.js +32 -0
  32. package/dist/internal/virtualFileSystem/fixture.d.ts +63 -0
  33. package/dist/internal/virtualFileSystem/fixture.d.ts.map +1 -0
  34. package/dist/internal/virtualFileSystem/fixture.js +144 -0
  35. package/dist/internal/{content.d.ts → virtualFileSystem/overlayContent.d.ts} +4 -14
  36. package/dist/internal/virtualFileSystem/overlayContent.d.ts.map +1 -0
  37. package/dist/internal/{content.js → virtualFileSystem/overlayContent.js} +3 -7
  38. package/dist/internal/{overlayChanges.d.ts → virtualFileSystem/overlayDiff.d.ts} +1 -1
  39. package/dist/internal/virtualFileSystem/overlayDiff.d.ts.map +1 -0
  40. package/dist/internal/{overlayChanges.js → virtualFileSystem/overlayDiff.js} +4 -15
  41. package/dist/internal/virtualFileSystem/path.d.ts +43 -0
  42. package/dist/internal/virtualFileSystem/path.d.ts.map +1 -0
  43. package/dist/internal/virtualFileSystem/path.js +124 -0
  44. package/dist/internal/virtualFileSystem/testHooks.d.ts +20 -0
  45. package/dist/internal/virtualFileSystem/testHooks.d.ts.map +1 -0
  46. package/dist/internal/virtualFileSystem/testHooks.js +23 -0
  47. package/dist/internal/virtualFileSystem/watchHub.d.ts +16 -0
  48. package/dist/internal/virtualFileSystem/watchHub.d.ts.map +1 -0
  49. package/dist/internal/virtualFileSystem/watchHub.js +33 -0
  50. package/dist/internal/virtualFileSystem.d.ts +290 -0
  51. package/dist/internal/virtualFileSystem.d.ts.map +1 -0
  52. package/dist/internal/virtualFileSystem.js +1677 -0
  53. package/package.json +5 -4
  54. package/dist/internal/content.d.ts.map +0 -1
  55. package/dist/internal/overlayChanges.d.ts.map +0 -1
  56. package/dist/internal/overlayTesting.d.ts +0 -12
  57. package/dist/internal/overlayTesting.d.ts.map +0 -1
  58. package/dist/internal/overlayTesting.js +0 -12
@@ -1,31 +1,29 @@
1
- import * as Context from "effect/Context";
2
- import { DecodeLimits, ImageError, type Snapshot } from "./Snapshot.js";
3
- export { DecodeLimits, ImageError, type Snapshot, SnapshotTypeId } from "./Snapshot.js";
4
- import * as Effect from "effect/Effect";
5
- import * as Schema from "effect/Schema";
6
- import * as Scope from "effect/Scope";
7
- import * as Stream from "effect/Stream";
8
- declare const BytePathId: unique symbol;
9
- declare const VolumeId: unique symbol;
10
- declare const CallerId: unique symbol;
11
- declare const FileHandleId: unique symbol;
12
- declare const DirectoryHandleId: unique symbol;
13
1
  /**
14
- * An opaque path that preserves arbitrary non-NUL bytes without UTF-8 conversion.
2
+ * Runtime-neutral virtual filesystem contracts and constructors.
15
3
  *
16
- * @category models
17
- * @since 0.1.0
18
- */
19
- export interface BytePath {
20
- readonly [BytePathId]: true;
21
- }
22
- /**
23
- * Schema for an opaque byte-preserving filesystem path.
4
+ * **Details**
5
+ *
6
+ * Volumes own isolated namespaces. Callers carry path context and credentials,
7
+ * while file and directory handles use `Scope` for deterministic release.
24
8
  *
25
- * @category schemas
26
9
  * @since 0.1.0
27
10
  */
28
- export declare const BytePath: Schema.declare<BytePath, BytePath>;
11
+ import * as Effect from "effect/Effect";
12
+ import * as Schema from "effect/Schema";
13
+ import type * as Scope from "effect/Scope";
14
+ import type * as Stream from "effect/Stream";
15
+ import { BytePath } from "./BytePath.js";
16
+ export { BytePath } from "./BytePath.js";
17
+ import { DecodeLimits, ImageError, type Snapshot } from "./Snapshot.js";
18
+ export { DecodeLimits, ImageError, type Snapshot, SnapshotTypeId } from "./Snapshot.js";
19
+ import * as VfsModel from "./internal/virtualFileSystem.js";
20
+ import * as SnapshotDeltaModel from "./SnapshotDelta.js";
21
+ export { SnapshotChange, SnapshotChangesOptions, type SnapshotDelta, SnapshotDeltaError, SnapshotDeltaLimits, SnapshotDeltaTypeId, SnapshotDifference, SnapshotNodeKind } from "./SnapshotDelta.js";
22
+ declare const VolumeId: typeof VfsModel.VolumeId;
23
+ declare const CallerId: typeof VfsModel.CallerId;
24
+ declare const FileHandleId: typeof VfsModel.FileHandleId;
25
+ declare const DirectoryHandleId: typeof VfsModel.DirectoryHandleId;
26
+ declare const ObjectReferenceId: typeof VfsModel.ObjectReferenceId;
29
27
  /**
30
28
  * A UTF-8 string path or an opaque byte-preserving path.
31
29
  *
@@ -39,7 +37,7 @@ export type PathInput = string | BytePath;
39
37
  * @category schemas
40
38
  * @since 0.1.0
41
39
  */
42
- export declare const FsCode: Schema.Literals<readonly ["NotFound", "AlreadyExists", "NotEmpty", "NotDirectory", "AccessDenied", "InvalidHandle", "ForeignHandle", "ClosedCaller", "InvalidArgument", "InvalidPathEncoding", "PathTooLong", "NoSpace", "IsDirectory", "FileTooLarge", "NoData", "SymlinkLoop", "UnrepresentableName"]>;
40
+ export declare const FsCode: typeof VfsModel.FsCode;
43
41
  /**
44
42
  * A portable virtual filesystem error code.
45
43
  *
@@ -47,37 +45,25 @@ export declare const FsCode: Schema.Literals<readonly ["NotFound", "AlreadyExist
47
45
  * @since 0.1.0
48
46
  */
49
47
  export type FsCode = typeof FsCode.Type;
50
- declare const FsError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
51
- readonly _tag: "FsError";
52
- } & Readonly<A>;
53
48
  /**
54
49
  * Describes an expected filesystem operation failure.
55
50
  *
56
51
  * @category errors
57
52
  * @since 0.1.0
58
53
  */
59
- export declare class FsError extends FsError_base<{
60
- /** Machine-readable reason for the failure. */
61
- readonly code: FsCode;
62
- /** Operation that detected the failure. */
63
- readonly operation: string;
64
- /** Path involved in the failure, when one path identifies it. */
65
- readonly path?: PathInput;
66
- }> {
54
+ export declare const FsError: typeof VfsModel.FsError;
55
+ /** @internal */
56
+ export interface FsError extends VfsModel.FsError {
67
57
  }
68
- declare const ConfigurationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
69
- readonly _tag: "ConfigurationError";
70
- } & Readonly<A>;
71
58
  /**
72
59
  * Describes an invalid volume or caller option and names the rejected field.
73
60
  *
74
61
  * @category errors
75
62
  * @since 0.1.0
76
63
  */
77
- export declare class ConfigurationError extends ConfigurationError_base<{
78
- /** Name of the rejected option. */
79
- readonly field: string;
80
- }> {
64
+ export declare const ConfigurationError: typeof VfsModel.ConfigurationError;
65
+ /** @internal */
66
+ export interface ConfigurationError extends VfsModel.ConfigurationError {
81
67
  }
82
68
  /**
83
69
  * Schema for a caller's numeric identity, supplementary groups, and explicit privilege.
@@ -85,16 +71,7 @@ export declare class ConfigurationError extends ConfigurationError_base<{
85
71
  * @category schemas
86
72
  * @since 0.1.0
87
73
  */
88
- export declare const Identity: Schema.Struct<{
89
- /** Numeric user identifier used by ownership and permission checks. */
90
- readonly uid: Schema.Finite;
91
- /** Primary numeric group identifier. */
92
- readonly gid: Schema.Finite;
93
- /** Supplementary group identifiers used by group permission checks. */
94
- readonly groups: Schema.$Array<Schema.Finite>;
95
- /** Grants root-style permission bypasses independently of `uid`. */
96
- readonly privileged: Schema.Boolean;
97
- }>;
74
+ export declare const Identity: typeof VfsModel.Identity;
98
75
  /**
99
76
  * A caller identity used for permission checks.
100
77
  *
@@ -108,21 +85,7 @@ export type Identity = typeof Identity.Type;
108
85
  * @category schemas
109
86
  * @since 0.1.0
110
87
  */
111
- export declare const RootCallerOptions: Schema.Struct<{
112
- /** Caller identity. Defaults to privileged uid and gid `0`. */
113
- readonly identity: Schema.optionalKey<Schema.Struct<{
114
- /** Numeric user identifier used by ownership and permission checks. */
115
- readonly uid: Schema.Finite;
116
- /** Primary numeric group identifier. */
117
- readonly gid: Schema.Finite;
118
- /** Supplementary group identifiers used by group permission checks. */
119
- readonly groups: Schema.$Array<Schema.Finite>;
120
- /** Grants root-style permission bypasses independently of `uid`. */
121
- readonly privileged: Schema.Boolean;
122
- }>>;
123
- /** Creation mask applied to requested modes. Defaults to `0o022`. */
124
- readonly umask: Schema.optionalKey<Schema.Finite>;
125
- }>;
88
+ export declare const RootCallerOptions: typeof VfsModel.RootCallerOptions;
126
89
  /**
127
90
  * Options for creating a root caller on a volume.
128
91
  *
@@ -136,16 +99,7 @@ export type RootCallerOptions = typeof RootCallerOptions.Type;
136
99
  * @category schemas
137
100
  * @since 0.1.0
138
101
  */
139
- export declare const VolumeOptions: Schema.Struct<{
140
- /** Maximum number of filesystem nodes. Omission leaves the count unbounded. */
141
- readonly maxEntries: Schema.optionalKey<Schema.Finite>;
142
- /** Maximum combined regular-file content in bytes. */
143
- readonly maxBytes: Schema.optionalKey<Schema.Finite>;
144
- /** Maximum content size of one regular file in bytes. */
145
- readonly maxFileBytes: Schema.optionalKey<Schema.Finite>;
146
- /** Maximum encoded byte length of an absolute or relative path. */
147
- readonly maxPathBytes: Schema.optionalKey<Schema.Finite>;
148
- }>;
102
+ export declare const VolumeOptions: typeof VfsModel.VolumeOptions;
149
103
  /**
150
104
  * Capacity and path limits for a volume.
151
105
  *
@@ -159,19 +113,7 @@ export type VolumeOptions = typeof VolumeOptions.Type;
159
113
  * @category schemas
160
114
  * @since 0.1.0
161
115
  */
162
- export declare const Metadata: Schema.Struct<{
163
- readonly kind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
164
- readonly ino: Schema.BigInt;
165
- readonly nlink: Schema.Finite;
166
- readonly size: Schema.BigInt;
167
- readonly uid: Schema.Finite;
168
- readonly gid: Schema.Finite;
169
- readonly mode: Schema.Finite;
170
- readonly atimeNs: Schema.BigInt;
171
- readonly mtimeNs: Schema.BigInt;
172
- readonly ctimeNs: Schema.BigInt;
173
- readonly birthtimeNs: Schema.BigInt;
174
- }>;
116
+ export declare const Metadata: typeof VfsModel.Metadata;
175
117
  /**
176
118
  * Metadata for a directory, regular file, or symbolic link.
177
119
  *
@@ -179,6 +121,35 @@ export declare const Metadata: Schema.Struct<{
179
121
  * @since 0.1.0
180
122
  */
181
123
  export type Metadata = typeof Metadata.Type;
124
+ /**
125
+ * An opaque identity for one object in one live volume.
126
+ *
127
+ * @category models
128
+ * @since 0.1.0
129
+ */
130
+ export interface ObjectReference {
131
+ readonly [ObjectReferenceId]: true;
132
+ }
133
+ /**
134
+ * A value and the revision of the object from the same coordinated observation.
135
+ *
136
+ * @category models
137
+ * @since 0.1.0
138
+ */
139
+ export interface ObjectObservation<A> {
140
+ readonly value: A;
141
+ readonly revision: bigint;
142
+ }
143
+ /**
144
+ * One owned directory name paired with the referenced child object.
145
+ *
146
+ * @category models
147
+ * @since 0.1.0
148
+ */
149
+ export interface DirectoryEntry {
150
+ readonly name: Uint8Array;
151
+ readonly reference: ObjectReference;
152
+ }
182
153
  /**
183
154
  * Resolves a relative path from a live directory handle instead of the caller's directory.
184
155
  *
@@ -205,10 +176,7 @@ export interface MetadataOptions extends RelativeOptions {
205
176
  * @category schemas
206
177
  * @since 0.1.0
207
178
  */
208
- export declare const OwnerUpdate: Schema.Struct<{
209
- readonly uid: Schema.optionalKey<Schema.Finite>;
210
- readonly gid: Schema.optionalKey<Schema.Finite>;
211
- }>;
179
+ export declare const OwnerUpdate: typeof VfsModel.OwnerUpdate;
212
180
  /**
213
181
  * An owner update for `chown` operations.
214
182
  *
@@ -222,38 +190,14 @@ export type OwnerUpdate = typeof OwnerUpdate.Type;
222
190
  * @category schemas
223
191
  * @since 0.1.0
224
192
  */
225
- export declare const TimeUpdate: Schema.Union<readonly [Schema.Struct<{
226
- readonly kind: Schema.Literal<"now">;
227
- }>, Schema.Struct<{
228
- readonly kind: Schema.Literal<"omit">;
229
- }>, Schema.Struct<{
230
- readonly kind: Schema.Literal<"value">;
231
- readonly nanoseconds: Schema.BigInt;
232
- }>]>;
193
+ export declare const TimeUpdate: typeof VfsModel.TimeUpdate;
233
194
  /**
234
195
  * Schema for independent access and modification time updates.
235
196
  *
236
197
  * @category schemas
237
198
  * @since 0.1.0
238
199
  */
239
- export declare const Times: Schema.Struct<{
240
- readonly access: Schema.Union<readonly [Schema.Struct<{
241
- readonly kind: Schema.Literal<"now">;
242
- }>, Schema.Struct<{
243
- readonly kind: Schema.Literal<"omit">;
244
- }>, Schema.Struct<{
245
- readonly kind: Schema.Literal<"value">;
246
- readonly nanoseconds: Schema.BigInt;
247
- }>]>;
248
- readonly modification: Schema.Union<readonly [Schema.Struct<{
249
- readonly kind: Schema.Literal<"now">;
250
- }>, Schema.Struct<{
251
- readonly kind: Schema.Literal<"omit">;
252
- }>, Schema.Struct<{
253
- readonly kind: Schema.Literal<"value">;
254
- readonly nanoseconds: Schema.BigInt;
255
- }>]>;
256
- }>;
200
+ export declare const Times: typeof VfsModel.Times;
257
201
  /**
258
202
  * Access and modification time updates for `utimes` operations.
259
203
  *
@@ -269,9 +213,7 @@ export type Times = typeof Times.Type;
269
213
  */
270
214
  export interface DirectoryHandle {
271
215
  readonly [DirectoryHandleId]: true;
272
- /** Reads metadata for the directory while the handle remains open. */
273
216
  readonly stat: Effect.Effect<Metadata, FsError>;
274
- /** Closes the handle. A repeated explicit close fails; scope cleanup remains safe. */
275
217
  readonly close: Effect.Effect<void, FsError>;
276
218
  }
277
219
  /**
@@ -280,7 +222,7 @@ export interface DirectoryHandle {
280
222
  * @category schemas
281
223
  * @since 0.1.0
282
224
  */
283
- export declare const SeekMode: Schema.Literals<readonly ["start", "current", "end", "data", "hole"]>;
225
+ export declare const SeekMode: typeof VfsModel.SeekMode;
284
226
  /**
285
227
  * The origin used by a file handle seek operation.
286
228
  *
@@ -294,20 +236,7 @@ export type SeekMode = typeof SeekMode.Type;
294
236
  * @category schemas
295
237
  * @since 0.1.0
296
238
  */
297
- export declare const OpenSettings: Schema.Struct<{
298
- /** Permitted operations on the returned handle. */
299
- readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
300
- /** Creation policy. Defaults to `"never"`. */
301
- readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
302
- /** Requested mode for a new file, before applying the caller's umask. */
303
- readonly mode: Schema.optionalKey<Schema.Finite>;
304
- /** Write at the current end of file regardless of the handle cursor. */
305
- readonly append: Schema.optionalKey<Schema.Boolean>;
306
- /** Truncate an existing regular file to zero bytes during open. */
307
- readonly truncate: Schema.optionalKey<Schema.Boolean>;
308
- /** Follow the final symbolic link. Defaults to `true`. */
309
- readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
310
- }>;
239
+ export declare const OpenSettings: typeof VfsModel.OpenSettings;
311
240
  /**
312
241
  * Options for acquiring a scoped file handle.
313
242
  *
@@ -315,31 +244,13 @@ export declare const OpenSettings: Schema.Struct<{
315
244
  * @since 0.1.0
316
245
  */
317
246
  export type OpenOptions = typeof OpenSettings.Type & RelativeOptions;
318
- declare const WriteFileSettings: Schema.Struct<{
319
- /** Permitted operations on the returned handle. */
320
- readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
321
- /** Creation policy. Defaults to `"never"`. */
322
- readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
323
- /** Requested mode for a new file, before applying the caller's umask. */
324
- readonly mode: Schema.optionalKey<Schema.Finite>;
325
- /** Write at the current end of file regardless of the handle cursor. */
326
- readonly append: Schema.optionalKey<Schema.Boolean>;
327
- /** Truncate an existing regular file to zero bytes during open. */
328
- readonly truncate: Schema.optionalKey<Schema.Boolean>;
329
- /** Follow the final symbolic link. Defaults to `true`. */
330
- readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
331
- /** Replace the final symbolic link itself instead of its target. */
332
- readonly replaceFinalSymlink: Schema.optionalKey<Schema.Boolean>;
333
- /** Mode to apply after replacing an existing file. */
334
- readonly finalMode: Schema.optionalKey<Schema.Finite>;
335
- }>;
336
247
  /**
337
248
  * Options for an atomic whole-file write, including replacement and final mode controls.
338
249
  *
339
250
  * @category models
340
251
  * @since 0.1.0
341
252
  */
342
- export type WriteFileOptions = typeof WriteFileSettings.Type & RelativeOptions;
253
+ export type WriteFileOptions = VfsModel.WriteFileOptions;
343
254
  /**
344
255
  * A scoped regular-file capability with an independent bigint cursor.
345
256
  *
@@ -375,13 +286,25 @@ export interface FileHandle {
375
286
  */
376
287
  export interface Caller {
377
288
  readonly [CallerId]: true;
289
+ /** Returns the stable reference for this volume's root directory. */
290
+ readonly rootReference: Effect.Effect<ObjectReference, FsError>;
291
+ /** Looks up one byte-preserving child name from a referenced directory. */
292
+ readonly lookupReference: (directory: ObjectReference, name: Uint8Array) => Effect.Effect<ObjectReference, FsError>;
293
+ /** Returns a referenced directory's current parent. The root is its own parent. */
294
+ readonly parentReference: (directory: ObjectReference) => Effect.Effect<ObjectReference, FsError>;
295
+ /** Reads metadata and its matching live revision. */
296
+ readonly observeMetadata: (reference: ObjectReference) => Effect.Effect<ObjectObservation<Metadata>, FsError>;
297
+ /** Reads owned directory entries and their matching directory revision. */
298
+ readonly observeDirectory: (reference: ObjectReference) => Effect.Effect<ObjectObservation<ReadonlyArray<DirectoryEntry>>, FsError>;
299
+ /** Reads an owned symbolic-link target through a stable reference. */
300
+ readonly readLinkReference: (reference: ObjectReference) => Effect.Effect<Uint8Array, FsError>;
301
+ /** Opens a referenced regular file for reading. */
302
+ readonly openReference: (reference: ObjectReference) => Effect.Effect<FileHandle, FsError, Scope.Scope>;
378
303
  /** Reads metadata, following the final symbolic link by default. */
379
304
  readonly stat: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Metadata, FsError>;
380
305
  /** Atomically moves an entry within this volume without replacing a non-empty directory. */
381
306
  readonly rename: (source: PathInput, destination: PathInput, options?: {
382
- /** Base directory for a relative source path. */
383
307
  readonly sourceRelativeTo?: DirectoryHandle;
384
- /** Base directory for a relative destination path. */
385
308
  readonly destinationRelativeTo?: DirectoryHandle;
386
309
  }) => Effect.Effect<void, FsError>;
387
310
  /** Reads and returns an owned copy of a regular file's complete contents. */
@@ -408,11 +331,8 @@ export interface Caller {
408
331
  readonly lstat: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Metadata, FsError>;
409
332
  /** Creates a hard link to an existing non-directory entry. */
410
333
  readonly link: (source: PathInput, destination: PathInput, options?: {
411
- /** Base directory for a relative source path. */
412
334
  readonly sourceRelativeTo?: DirectoryHandle;
413
- /** Base directory for a relative destination path. */
414
335
  readonly destinationRelativeTo?: DirectoryHandle;
415
- /** Link to the final symbolic link's target instead of the link itself. */
416
336
  readonly followSourceSymlink?: boolean;
417
337
  }) => Effect.Effect<void, FsError>;
418
338
  /** Creates a symbolic link. The target bytes are stored without resolving them. */
@@ -437,7 +357,6 @@ export interface Caller {
437
357
  readonly rmdir: (path: PathInput, options?: RelativeOptions) => Effect.Effect<void, FsError>;
438
358
  /** Creates one directory. Parent directories must already exist. */
439
359
  readonly mkdir: (path: PathInput, options?: RelativeOptions & {
440
- /** Requested mode before applying the caller's umask. Defaults to `0o777`. */
441
360
  readonly mode?: number;
442
361
  }) => Effect.Effect<void, FsError>;
443
362
  /** Creates a scoped caller whose current directory is the resolved directory identity. */
@@ -463,7 +382,7 @@ export interface Change {
463
382
  * @category schemas
464
383
  * @since 0.1.0
465
384
  */
466
- export declare const OverlayNodeKind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
385
+ export declare const OverlayNodeKind: typeof VfsModel.OverlayNodeKind;
467
386
  /**
468
387
  * A filesystem entry kind reported by an overlay summary.
469
388
  *
@@ -477,7 +396,7 @@ export type OverlayNodeKind = typeof OverlayNodeKind.Type;
477
396
  * @category schemas
478
397
  * @since 0.1.0
479
398
  */
480
- export declare const OverlayDifference: Schema.Literals<readonly ["content", "mode", "uid", "gid", "atimeNs", "mtimeNs", "ctimeNs", "birthtimeNs"]>;
399
+ export declare const OverlayDifference: typeof VfsModel.OverlayDifference;
481
400
  /**
482
401
  * A content, ownership, permission, or timestamp field that differs from the overlay base.
483
402
  *
@@ -496,27 +415,7 @@ export type OverlayDifference = typeof OverlayDifference.Type;
496
415
  * @category schemas
497
416
  * @since 0.1.0
498
417
  */
499
- export declare const OverlayChange: Schema.Union<readonly [Schema.TaggedStruct<"Added", {
500
- readonly path: Schema.declare<BytePath, BytePath>;
501
- readonly kind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
502
- }>, Schema.TaggedStruct<"Removed", {
503
- readonly path: Schema.declare<BytePath, BytePath>;
504
- readonly kind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
505
- }>, Schema.TaggedStruct<"Replaced", {
506
- readonly path: Schema.declare<BytePath, BytePath>;
507
- readonly beforeKind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
508
- readonly afterKind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
509
- readonly differences: Schema.$Array<Schema.Literals<readonly ["content", "mode", "uid", "gid", "atimeNs", "mtimeNs", "ctimeNs", "birthtimeNs"]>>;
510
- }>, Schema.TaggedStruct<"Renamed", {
511
- readonly from: Schema.declare<BytePath, BytePath>;
512
- readonly to: Schema.declare<BytePath, BytePath>;
513
- readonly kind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
514
- readonly differences: Schema.$Array<Schema.Literals<readonly ["content", "mode", "uid", "gid", "atimeNs", "mtimeNs", "ctimeNs", "birthtimeNs"]>>;
515
- }>, Schema.TaggedStruct<"Updated", {
516
- readonly path: Schema.declare<BytePath, BytePath>;
517
- readonly kind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
518
- readonly differences: Schema.$Array<Schema.Literals<readonly ["content", "mode", "uid", "gid", "atimeNs", "mtimeNs", "ctimeNs", "birthtimeNs"]>>;
519
- }>]>;
418
+ export declare const OverlayChange: typeof VfsModel.OverlayChange;
520
419
  /**
521
420
  * A path-oriented final-state difference from an overlay's immutable base.
522
421
  *
@@ -530,10 +429,7 @@ export type OverlayChange = typeof OverlayChange.Type;
530
429
  * @category schemas
531
430
  * @since 0.1.0
532
431
  */
533
- export declare const OverlayChangesOptions: Schema.Struct<{
534
- /** Include access, modification, change, and birth-time differences. Defaults to `false`. */
535
- readonly includeTimestamps: Schema.optionalKey<Schema.Boolean>;
536
- }>;
432
+ export declare const OverlayChangesOptions: typeof VfsModel.OverlayChangesOptions;
537
433
  /**
538
434
  * Filtering options for an overlay final-difference summary.
539
435
  *
@@ -580,15 +476,15 @@ export interface OverlayVolume extends Volume {
580
476
  /** Captures one committed state when this reusable effect executes. */
581
477
  readonly capture: (options?: OverlayChangesOptions) => Effect.Effect<OverlayCapture, ConfigurationError | ImageError>;
582
478
  }
583
- declare const CurrentFileSystem_base: Context.ServiceClass<CurrentFileSystem, "@effect-vfs/core/CurrentFileSystem", Caller>;
584
479
  /**
585
480
  * Optional Effect service for providing an existing filesystem caller.
586
481
  *
587
482
  * @category services
588
483
  * @since 0.1.0
589
484
  */
590
- export declare class CurrentFileSystem extends CurrentFileSystem_base {
591
- }
485
+ export declare const CurrentFileSystem: typeof VfsModel.CurrentFileSystem;
486
+ /** @internal */
487
+ export type CurrentFileSystem = VfsModel.CurrentFileSystem;
592
488
  /**
593
489
  * Encodes a snapshot as owned UTF-8 JSON bytes using the version 1 snapshot format.
594
490
  *
@@ -603,6 +499,87 @@ export declare const encodeSnapshot: (snapshot: Snapshot) => Effect.Effect<Uint8
603
499
  * @since 0.1.0
604
500
  */
605
501
  export declare const decodeSnapshot: (input: Uint8Array, limits: DecodeLimits) => Effect.Effect<Snapshot, ImageError>;
502
+ /**
503
+ * Computes an exact portable delta between two immutable snapshots.
504
+ * Requires the platform-neutral `Crypto.Crypto` service for base identity.
505
+ *
506
+ * @category snapshots
507
+ * @since 0.1.0
508
+ */
509
+ export declare const diffSnapshots: (base: Snapshot, target: Snapshot, limits?: {
510
+ readonly maxEncodedBytes: import("effect/ByteSize").ByteSize;
511
+ readonly maxIdentityBytes: import("effect/ByteSize").ByteSize;
512
+ readonly maxDeltaRecords: number;
513
+ readonly maxDecodedDeltaBytes: import("effect/ByteSize").ByteSize;
514
+ readonly maxBaseRecords: number;
515
+ readonly maxTargetRecords: number;
516
+ readonly maxEntries: number;
517
+ readonly maxOutputRecords: number;
518
+ readonly maxOutputBytes: import("effect/ByteSize").ByteSize;
519
+ readonly maxInheritedRecords: number;
520
+ } | undefined) => Effect.Effect<SnapshotDeltaModel.SnapshotDelta, VfsModel.ConfigurationError | ImageError | import("effect/PlatformError").PlatformError, import("effect/Crypto").Crypto>;
521
+ /**
522
+ * Verifies an exact snapshot delta against its base and derives an owned path-oriented summary.
523
+ * Requires the platform-neutral `Crypto.Crypto` service for base identity.
524
+ *
525
+ * @category snapshots
526
+ * @since 0.1.0
527
+ */
528
+ export declare const inspectSnapshotDelta: (base: Snapshot, delta: SnapshotDeltaModel.SnapshotDelta, options?: {
529
+ readonly includeTimestamps?: boolean;
530
+ } | undefined, limits?: {
531
+ readonly maxEncodedBytes: import("effect/ByteSize").ByteSize;
532
+ readonly maxIdentityBytes: import("effect/ByteSize").ByteSize;
533
+ readonly maxDeltaRecords: number;
534
+ readonly maxDecodedDeltaBytes: import("effect/ByteSize").ByteSize;
535
+ readonly maxBaseRecords: number;
536
+ readonly maxTargetRecords: number;
537
+ readonly maxEntries: number;
538
+ readonly maxOutputRecords: number;
539
+ readonly maxOutputBytes: import("effect/ByteSize").ByteSize;
540
+ readonly maxInheritedRecords: number;
541
+ } | undefined) => Effect.Effect<readonly ({
542
+ readonly _tag: "Added";
543
+ readonly path: BytePath;
544
+ readonly kind: "directory" | "file" | "symlink";
545
+ } | {
546
+ readonly _tag: "Removed";
547
+ readonly path: BytePath;
548
+ readonly kind: "directory" | "file" | "symlink";
549
+ } | {
550
+ readonly _tag: "Updated";
551
+ readonly path: BytePath;
552
+ readonly beforeKind: "directory" | "file" | "symlink";
553
+ readonly afterKind: "directory" | "file" | "symlink";
554
+ readonly differences: readonly ("atimeNs" | "birthtimeNs" | "content" | "ctimeNs" | "gid" | "hardLinks" | "kind" | "mode" | "mtimeNs" | "target" | "uid")[];
555
+ })[], VfsModel.ConfigurationError | ImageError | import("effect/PlatformError").PlatformError | SnapshotDeltaModel.SnapshotDeltaError, import("effect/Crypto").Crypto>;
556
+ /**
557
+ * Applies an exact delta to its semantically matching base and returns a new snapshot.
558
+ * Requires the platform-neutral `Crypto.Crypto` service for base identity.
559
+ *
560
+ * @category snapshots
561
+ * @since 0.1.0
562
+ */
563
+ export declare const applySnapshotDelta: (base: Snapshot, delta: SnapshotDeltaModel.SnapshotDelta, limits?: {
564
+ readonly maxEncodedBytes: import("effect/ByteSize").ByteSize;
565
+ readonly maxIdentityBytes: import("effect/ByteSize").ByteSize;
566
+ readonly maxDeltaRecords: number;
567
+ readonly maxDecodedDeltaBytes: import("effect/ByteSize").ByteSize;
568
+ readonly maxBaseRecords: number;
569
+ readonly maxTargetRecords: number;
570
+ readonly maxEntries: number;
571
+ readonly maxOutputRecords: number;
572
+ readonly maxOutputBytes: import("effect/ByteSize").ByteSize;
573
+ readonly maxInheritedRecords: number;
574
+ } | undefined) => Effect.Effect<Snapshot, VfsModel.ConfigurationError | ImageError | import("effect/PlatformError").PlatformError | SnapshotDeltaModel.SnapshotDeltaError, import("effect/Crypto").Crypto>;
575
+ /**
576
+ * Creates an Effect Schema codec between owned bytes and opaque snapshot deltas.
577
+ * Omission uses `SnapshotDeltaLimits.default`.
578
+ *
579
+ * @category schemas
580
+ * @since 0.1.0
581
+ */
582
+ export declare const SnapshotDeltaFromBytes: (limits?: SnapshotDeltaModel.SnapshotDeltaLimits) => Schema.decodeTo<Schema.declare<SnapshotDeltaModel.SnapshotDelta, SnapshotDeltaModel.SnapshotDelta>, Schema.Uint8Array, never, never>;
606
583
  /**
607
584
  * Creates an opaque byte path by copying the input when the Effect executes.
608
585
  *
@@ -613,14 +590,32 @@ export declare const decodeSnapshot: (input: Uint8Array, limits: DecodeLimits) =
613
590
  * @category constructors
614
591
  * @since 0.1.0
615
592
  */
616
- export declare const pathFromBytes: (bytes: Uint8Array<ArrayBufferLike>) => Effect.Effect<BytePath, FsError, never>;
593
+ export declare const pathFromBytes: (bytes: Uint8Array) => Effect.Effect<BytePath, FsError>;
617
594
  /**
618
595
  * Copies the bytes held by an opaque byte path.
619
596
  *
620
597
  * @category getters
621
598
  * @since 0.1.0
622
599
  */
623
- export declare const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array<ArrayBuffer>, FsError, never>;
600
+ export declare const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array, FsError>;
601
+ /**
602
+ * Schema for a complete fixture namespace with optional metadata and forward hard links.
603
+ *
604
+ * **Details**
605
+ *
606
+ * Fixture paths must be absolute, unique, and explicitly include their parent directories.
607
+ *
608
+ * @category schemas
609
+ * @since 0.1.0
610
+ */
611
+ export declare const Fixture: typeof VfsModel.Fixture;
612
+ /**
613
+ * A complete filesystem fixture accepted by `fromFixture`.
614
+ *
615
+ * @category models
616
+ * @since 0.1.0
617
+ */
618
+ export type Fixture = typeof Fixture.Type;
624
619
  /**
625
620
  * Creates a fresh empty volume and captures the current Effect `Clock`.
626
621
  *
@@ -632,24 +627,14 @@ export declare const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array<A
632
627
  * @category constructors
633
628
  * @since 0.1.0
634
629
  */
635
- export declare const make: (options?: {
636
- readonly maxEntries?: number;
637
- readonly maxBytes?: number;
638
- readonly maxFileBytes?: number;
639
- readonly maxPathBytes?: number;
640
- } | undefined) => Effect.Effect<Volume, ConfigurationError, never>;
630
+ export declare const make: (options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError>;
641
631
  /**
642
632
  * Restores a fresh volume from an opaque snapshot under the supplied destination limits.
643
633
  *
644
634
  * @category constructors
645
635
  * @since 0.1.0
646
636
  */
647
- export declare const fromSnapshot: (snapshot: Snapshot, options?: {
648
- readonly maxEntries?: number;
649
- readonly maxBytes?: number;
650
- readonly maxFileBytes?: number;
651
- readonly maxPathBytes?: number;
652
- } | undefined) => Effect.Effect<Volume, ConfigurationError | ImageError, never>;
637
+ export declare const fromSnapshot: (snapshot: Snapshot, options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | ImageError>;
653
638
  /**
654
639
  * Creates an isolated writable volume relative to one immutable snapshot base.
655
640
  *
@@ -666,146 +651,12 @@ export declare const fromSnapshot: (snapshot: Snapshot, options?: {
666
651
  * @category constructors
667
652
  * @since 0.1.0
668
653
  */
669
- export declare const makeOverlay: (base: Snapshot, options?: {
670
- readonly maxEntries?: number;
671
- readonly maxBytes?: number;
672
- readonly maxFileBytes?: number;
673
- readonly maxPathBytes?: number;
674
- } | undefined) => Effect.Effect<OverlayVolume, ConfigurationError | ImageError, never>;
675
- /**
676
- * Schema for a complete fixture namespace with optional metadata and forward hard links.
677
- *
678
- * **Details**
679
- *
680
- * Fixture paths must be absolute, unique, and explicitly include their parent directories.
681
- *
682
- * @category schemas
683
- * @since 0.1.0
684
- */
685
- export declare const Fixture: Schema.Struct<{
686
- readonly rootMetadata: Schema.optionalKey<Schema.Struct<{
687
- readonly uid: Schema.optionalKey<Schema.Finite>;
688
- readonly gid: Schema.optionalKey<Schema.Finite>;
689
- readonly mode: Schema.optionalKey<Schema.Finite>;
690
- readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
691
- readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
692
- readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
693
- readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
694
- }>>;
695
- readonly entries: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
696
- readonly kind: Schema.Literal<"directory">;
697
- readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
698
- readonly metadata: Schema.optionalKey<Schema.Struct<{
699
- readonly uid: Schema.optionalKey<Schema.Finite>;
700
- readonly gid: Schema.optionalKey<Schema.Finite>;
701
- readonly mode: Schema.optionalKey<Schema.Finite>;
702
- readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
703
- readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
704
- readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
705
- readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
706
- }>>;
707
- }>, Schema.Struct<{
708
- readonly kind: Schema.Literal<"file">;
709
- readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
710
- readonly bytes: Schema.Uint8Array;
711
- readonly metadata: Schema.optionalKey<Schema.Struct<{
712
- readonly uid: Schema.optionalKey<Schema.Finite>;
713
- readonly gid: Schema.optionalKey<Schema.Finite>;
714
- readonly mode: Schema.optionalKey<Schema.Finite>;
715
- readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
716
- readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
717
- readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
718
- readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
719
- }>>;
720
- }>, Schema.Struct<{
721
- readonly kind: Schema.Literal<"symlink">;
722
- readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
723
- readonly target: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
724
- readonly metadata: Schema.optionalKey<Schema.Struct<{
725
- readonly uid: Schema.optionalKey<Schema.Finite>;
726
- readonly gid: Schema.optionalKey<Schema.Finite>;
727
- readonly mode: Schema.optionalKey<Schema.Finite>;
728
- readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
729
- readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
730
- readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
731
- readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
732
- }>>;
733
- }>, Schema.Struct<{
734
- readonly kind: Schema.Literal<"hardLink">;
735
- readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
736
- readonly target: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
737
- }>]>>;
738
- }>;
739
- /**
740
- * A complete filesystem fixture accepted by `fromFixture`.
741
- *
742
- * @category models
743
- * @since 0.1.0
744
- */
745
- export type Fixture = typeof Fixture.Type;
654
+ export declare const makeOverlay: (base: Snapshot, options?: VolumeOptions) => Effect.Effect<OverlayVolume, ConfigurationError | ImageError>;
746
655
  /**
747
656
  * Builds a fresh volume from a validated final-state fixture.
748
657
  *
749
658
  * @category constructors
750
659
  * @since 0.1.0
751
660
  */
752
- export declare const fromFixture: (fixture: {
753
- readonly rootMetadata?: {
754
- readonly uid?: number;
755
- readonly gid?: number;
756
- readonly mode?: number;
757
- readonly atimeNs?: bigint;
758
- readonly mtimeNs?: bigint;
759
- readonly ctimeNs?: bigint;
760
- readonly birthtimeNs?: bigint;
761
- };
762
- readonly entries: readonly ({
763
- readonly kind: "directory";
764
- readonly path: string | BytePath;
765
- readonly metadata?: {
766
- readonly uid?: number;
767
- readonly gid?: number;
768
- readonly mode?: number;
769
- readonly atimeNs?: bigint;
770
- readonly mtimeNs?: bigint;
771
- readonly ctimeNs?: bigint;
772
- readonly birthtimeNs?: bigint;
773
- };
774
- } | {
775
- readonly kind: "file";
776
- readonly path: string | BytePath;
777
- readonly bytes: Uint8Array<ArrayBufferLike>;
778
- readonly metadata?: {
779
- readonly uid?: number;
780
- readonly gid?: number;
781
- readonly mode?: number;
782
- readonly atimeNs?: bigint;
783
- readonly mtimeNs?: bigint;
784
- readonly ctimeNs?: bigint;
785
- readonly birthtimeNs?: bigint;
786
- };
787
- } | {
788
- readonly kind: "symlink";
789
- readonly path: string | BytePath;
790
- readonly target: string | BytePath;
791
- readonly metadata?: {
792
- readonly uid?: number;
793
- readonly gid?: number;
794
- readonly mode?: number;
795
- readonly atimeNs?: bigint;
796
- readonly mtimeNs?: bigint;
797
- readonly ctimeNs?: bigint;
798
- readonly birthtimeNs?: bigint;
799
- };
800
- } | {
801
- readonly kind: "hardLink";
802
- readonly path: string | BytePath;
803
- readonly target: string | BytePath;
804
- })[];
805
- }, options?: {
806
- readonly maxEntries?: number;
807
- readonly maxBytes?: number;
808
- readonly maxFileBytes?: number;
809
- readonly maxPathBytes?: number;
810
- } | undefined) => Effect.Effect<Volume, ConfigurationError | ImageError, never>;
661
+ export declare const fromFixture: (fixture: Fixture, options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | ImageError>;
811
662
  //# sourceMappingURL=VirtualFileSystem.d.ts.map