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