@effect-vfs/core 0.0.1

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.
@@ -0,0 +1,674 @@
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
+ /**
14
+ * An opaque path that preserves arbitrary non-NUL bytes without UTF-8 conversion.
15
+ *
16
+ * @category models
17
+ * @since 0.1.0
18
+ */
19
+ export interface BytePath {
20
+ readonly [BytePathId]: true;
21
+ }
22
+ /**
23
+ * A UTF-8 string path or an opaque byte-preserving path.
24
+ *
25
+ * @category models
26
+ * @since 0.1.0
27
+ */
28
+ export type PathInput = string | BytePath;
29
+ /**
30
+ * Schema for portable virtual filesystem error codes.
31
+ *
32
+ * @category schemas
33
+ * @since 0.1.0
34
+ */
35
+ export declare const FsCode: Schema.Literals<readonly ["NotFound", "AlreadyExists", "NotEmpty", "NotDirectory", "AccessDenied", "InvalidHandle", "ForeignHandle", "ClosedCaller", "InvalidArgument", "InvalidPathEncoding", "PathTooLong", "NoSpace", "IsDirectory", "FileTooLarge", "NoData", "SymlinkLoop", "UnrepresentableName"]>;
36
+ /**
37
+ * A portable virtual filesystem error code.
38
+ *
39
+ * @category models
40
+ * @since 0.1.0
41
+ */
42
+ export type FsCode = typeof FsCode.Type;
43
+ 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 & {
44
+ readonly _tag: "FsError";
45
+ } & Readonly<A>;
46
+ /**
47
+ * Describes an expected filesystem operation failure.
48
+ *
49
+ * @category errors
50
+ * @since 0.1.0
51
+ */
52
+ export declare class FsError extends FsError_base<{
53
+ /** Machine-readable reason for the failure. */
54
+ readonly code: FsCode;
55
+ /** Operation that detected the failure. */
56
+ readonly operation: string;
57
+ /** Path involved in the failure, when one path identifies it. */
58
+ readonly path?: PathInput;
59
+ }> {
60
+ }
61
+ 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 & {
62
+ readonly _tag: "ConfigurationError";
63
+ } & Readonly<A>;
64
+ /**
65
+ * Describes an invalid volume or caller option and names the rejected field.
66
+ *
67
+ * @category errors
68
+ * @since 0.1.0
69
+ */
70
+ export declare class ConfigurationError extends ConfigurationError_base<{
71
+ /** Name of the rejected option. */
72
+ readonly field: string;
73
+ }> {
74
+ }
75
+ /**
76
+ * Schema for a caller's numeric identity, supplementary groups, and explicit privilege.
77
+ *
78
+ * @category schemas
79
+ * @since 0.1.0
80
+ */
81
+ export declare const Identity: Schema.Struct<{
82
+ /** Numeric user identifier used by ownership and permission checks. */
83
+ readonly uid: Schema.Finite;
84
+ /** Primary numeric group identifier. */
85
+ readonly gid: Schema.Finite;
86
+ /** Supplementary group identifiers used by group permission checks. */
87
+ readonly groups: Schema.$Array<Schema.Finite>;
88
+ /** Grants root-style permission bypasses independently of `uid`. */
89
+ readonly privileged: Schema.Boolean;
90
+ }>;
91
+ /**
92
+ * A caller identity used for permission checks.
93
+ *
94
+ * @category models
95
+ * @since 0.1.0
96
+ */
97
+ export type Identity = typeof Identity.Type;
98
+ /**
99
+ * Schema for root caller credentials and creation mask.
100
+ *
101
+ * @category schemas
102
+ * @since 0.1.0
103
+ */
104
+ export declare const RootCallerOptions: Schema.Struct<{
105
+ /** Caller identity. Defaults to privileged uid and gid `0`. */
106
+ readonly identity: Schema.optionalKey<Schema.Struct<{
107
+ /** Numeric user identifier used by ownership and permission checks. */
108
+ readonly uid: Schema.Finite;
109
+ /** Primary numeric group identifier. */
110
+ readonly gid: Schema.Finite;
111
+ /** Supplementary group identifiers used by group permission checks. */
112
+ readonly groups: Schema.$Array<Schema.Finite>;
113
+ /** Grants root-style permission bypasses independently of `uid`. */
114
+ readonly privileged: Schema.Boolean;
115
+ }>>;
116
+ /** Creation mask applied to requested modes. Defaults to `0o022`. */
117
+ readonly umask: Schema.optionalKey<Schema.Finite>;
118
+ }>;
119
+ /**
120
+ * Options for creating a root caller on a volume.
121
+ *
122
+ * @category models
123
+ * @since 0.1.0
124
+ */
125
+ export type RootCallerOptions = typeof RootCallerOptions.Type;
126
+ /**
127
+ * Schema for optional volume capacity and path limits.
128
+ *
129
+ * @category schemas
130
+ * @since 0.1.0
131
+ */
132
+ export declare const VolumeOptions: Schema.Struct<{
133
+ /** Maximum number of filesystem nodes. Omission leaves the count unbounded. */
134
+ readonly maxEntries: Schema.optionalKey<Schema.Finite>;
135
+ /** Maximum combined regular-file content in bytes. */
136
+ readonly maxBytes: Schema.optionalKey<Schema.Finite>;
137
+ /** Maximum content size of one regular file in bytes. */
138
+ readonly maxFileBytes: Schema.optionalKey<Schema.Finite>;
139
+ /** Maximum encoded byte length of an absolute or relative path. */
140
+ readonly maxPathBytes: Schema.optionalKey<Schema.Finite>;
141
+ }>;
142
+ /**
143
+ * Capacity and path limits for a volume.
144
+ *
145
+ * @category models
146
+ * @since 0.1.0
147
+ */
148
+ export type VolumeOptions = typeof VolumeOptions.Type;
149
+ /**
150
+ * Schema for filesystem node metadata with bigint inode, size, and nanosecond fields.
151
+ *
152
+ * @category schemas
153
+ * @since 0.1.0
154
+ */
155
+ export declare const Metadata: Schema.Struct<{
156
+ readonly kind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
157
+ readonly ino: Schema.BigInt;
158
+ readonly nlink: Schema.Finite;
159
+ readonly size: Schema.BigInt;
160
+ readonly uid: Schema.Finite;
161
+ readonly gid: Schema.Finite;
162
+ readonly mode: Schema.Finite;
163
+ readonly atimeNs: Schema.BigInt;
164
+ readonly mtimeNs: Schema.BigInt;
165
+ readonly ctimeNs: Schema.BigInt;
166
+ readonly birthtimeNs: Schema.BigInt;
167
+ }>;
168
+ /**
169
+ * Metadata for a directory, regular file, or symbolic link.
170
+ *
171
+ * @category models
172
+ * @since 0.1.0
173
+ */
174
+ export type Metadata = typeof Metadata.Type;
175
+ /**
176
+ * Resolves a relative path from a live directory handle instead of the caller's directory.
177
+ *
178
+ * @category models
179
+ * @since 0.1.0
180
+ */
181
+ export interface RelativeOptions {
182
+ /** Resolve relative paths from this live, same-volume handle instead of the caller's current directory. */
183
+ readonly relativeTo?: DirectoryHandle;
184
+ }
185
+ /**
186
+ * Controls the base directory and whether metadata operations follow the final symbolic link.
187
+ *
188
+ * @category models
189
+ * @since 0.1.0
190
+ */
191
+ export interface MetadataOptions extends RelativeOptions {
192
+ /** Follow the final symbolic link. Defaults to `true`. */
193
+ readonly followFinalSymlink?: boolean;
194
+ }
195
+ /**
196
+ * Schema for an owner update. Omitted fields retain their existing values.
197
+ *
198
+ * @category schemas
199
+ * @since 0.1.0
200
+ */
201
+ export declare const OwnerUpdate: Schema.Struct<{
202
+ readonly uid: Schema.optionalKey<Schema.Finite>;
203
+ readonly gid: Schema.optionalKey<Schema.Finite>;
204
+ }>;
205
+ /**
206
+ * An owner update for `chown` operations.
207
+ *
208
+ * @category models
209
+ * @since 0.1.0
210
+ */
211
+ export type OwnerUpdate = typeof OwnerUpdate.Type;
212
+ /**
213
+ * Schema for setting a timestamp to the clock, retaining it, or supplying nanoseconds.
214
+ *
215
+ * @category schemas
216
+ * @since 0.1.0
217
+ */
218
+ export declare const TimeUpdate: Schema.Union<readonly [Schema.Struct<{
219
+ readonly kind: Schema.Literal<"now">;
220
+ }>, Schema.Struct<{
221
+ readonly kind: Schema.Literal<"omit">;
222
+ }>, Schema.Struct<{
223
+ readonly kind: Schema.Literal<"value">;
224
+ readonly nanoseconds: Schema.BigInt;
225
+ }>]>;
226
+ /**
227
+ * Schema for independent access and modification time updates.
228
+ *
229
+ * @category schemas
230
+ * @since 0.1.0
231
+ */
232
+ export declare const Times: Schema.Struct<{
233
+ readonly access: Schema.Union<readonly [Schema.Struct<{
234
+ readonly kind: Schema.Literal<"now">;
235
+ }>, Schema.Struct<{
236
+ readonly kind: Schema.Literal<"omit">;
237
+ }>, Schema.Struct<{
238
+ readonly kind: Schema.Literal<"value">;
239
+ readonly nanoseconds: Schema.BigInt;
240
+ }>]>;
241
+ readonly modification: Schema.Union<readonly [Schema.Struct<{
242
+ readonly kind: Schema.Literal<"now">;
243
+ }>, Schema.Struct<{
244
+ readonly kind: Schema.Literal<"omit">;
245
+ }>, Schema.Struct<{
246
+ readonly kind: Schema.Literal<"value">;
247
+ readonly nanoseconds: Schema.BigInt;
248
+ }>]>;
249
+ }>;
250
+ /**
251
+ * Access and modification time updates for `utimes` operations.
252
+ *
253
+ * @category models
254
+ * @since 0.1.0
255
+ */
256
+ export type Times = typeof Times.Type;
257
+ /**
258
+ * A scoped directory capability that can be used for metadata and relative lookup.
259
+ *
260
+ * @category models
261
+ * @since 0.1.0
262
+ */
263
+ export interface DirectoryHandle {
264
+ readonly [DirectoryHandleId]: true;
265
+ /** Reads metadata for the directory while the handle remains open. */
266
+ readonly stat: Effect.Effect<Metadata, FsError>;
267
+ /** Closes the handle. A repeated explicit close fails; scope cleanup remains safe. */
268
+ readonly close: Effect.Effect<void, FsError>;
269
+ }
270
+ /**
271
+ * Schema for file seek origins, including dense-file data and hole queries.
272
+ *
273
+ * @category schemas
274
+ * @since 0.1.0
275
+ */
276
+ export declare const SeekMode: Schema.Literals<readonly ["start", "current", "end", "data", "hole"]>;
277
+ /**
278
+ * The origin used by a file handle seek operation.
279
+ *
280
+ * @category models
281
+ * @since 0.1.0
282
+ */
283
+ export type SeekMode = typeof SeekMode.Type;
284
+ /**
285
+ * Schema for file access, creation, append, truncate, and symlink behavior.
286
+ *
287
+ * @category schemas
288
+ * @since 0.1.0
289
+ */
290
+ export declare const OpenSettings: Schema.Struct<{
291
+ /** Permitted operations on the returned handle. */
292
+ readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
293
+ /** Creation policy. Defaults to `"never"`. */
294
+ readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
295
+ /** Requested mode for a new file, before applying the caller's umask. */
296
+ readonly mode: Schema.optionalKey<Schema.Finite>;
297
+ /** Write at the current end of file regardless of the handle cursor. */
298
+ readonly append: Schema.optionalKey<Schema.Boolean>;
299
+ /** Truncate an existing regular file to zero bytes during open. */
300
+ readonly truncate: Schema.optionalKey<Schema.Boolean>;
301
+ /** Follow the final symbolic link. Defaults to `true`. */
302
+ readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
303
+ }>;
304
+ /**
305
+ * Options for acquiring a scoped file handle.
306
+ *
307
+ * @category models
308
+ * @since 0.1.0
309
+ */
310
+ export type OpenOptions = typeof OpenSettings.Type & RelativeOptions;
311
+ declare const WriteFileSettings: Schema.Struct<{
312
+ /** Permitted operations on the returned handle. */
313
+ readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
314
+ /** Creation policy. Defaults to `"never"`. */
315
+ readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
316
+ /** Requested mode for a new file, before applying the caller's umask. */
317
+ readonly mode: Schema.optionalKey<Schema.Finite>;
318
+ /** Write at the current end of file regardless of the handle cursor. */
319
+ readonly append: Schema.optionalKey<Schema.Boolean>;
320
+ /** Truncate an existing regular file to zero bytes during open. */
321
+ readonly truncate: Schema.optionalKey<Schema.Boolean>;
322
+ /** Follow the final symbolic link. Defaults to `true`. */
323
+ readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
324
+ /** Replace the final symbolic link itself instead of its target. */
325
+ readonly replaceFinalSymlink: Schema.optionalKey<Schema.Boolean>;
326
+ /** Mode to apply after replacing an existing file. */
327
+ readonly finalMode: Schema.optionalKey<Schema.Finite>;
328
+ }>;
329
+ /**
330
+ * Options for an atomic whole-file write, including replacement and final mode controls.
331
+ *
332
+ * @category models
333
+ * @since 0.1.0
334
+ */
335
+ export type WriteFileOptions = typeof WriteFileSettings.Type & RelativeOptions;
336
+ /**
337
+ * A scoped regular-file capability with an independent bigint cursor.
338
+ *
339
+ * @category models
340
+ * @since 0.1.0
341
+ */
342
+ export interface FileHandle {
343
+ readonly [FileHandleId]: true;
344
+ /** Reads up to `maximumBytes` from the cursor and advances it by the returned length. */
345
+ readonly read: (maximumBytes: number) => Effect.Effect<Uint8Array, FsError>;
346
+ /** Reads at `offset` without changing the cursor. */
347
+ readonly pread: (maximumBytes: number, offset: bigint) => Effect.Effect<Uint8Array, FsError>;
348
+ /** Writes at the cursor and advances it, or writes at end of file when opened for append. */
349
+ readonly write: (bytes: Uint8Array) => Effect.Effect<number, FsError>;
350
+ /** Writes at `offset` without changing the cursor. Append mode does not affect positional writes. */
351
+ readonly pwrite: (bytes: Uint8Array, offset: bigint) => Effect.Effect<number, FsError>;
352
+ /** Moves the cursor and returns its new offset. `data` finds content and `hole` finds end of file. */
353
+ readonly seek: (offset: bigint, mode: SeekMode) => Effect.Effect<bigint, FsError>;
354
+ /** Sets the file length without changing the cursor. */
355
+ readonly truncate: (length: bigint) => Effect.Effect<void, FsError>;
356
+ /** Reads metadata for the open file. */
357
+ readonly stat: Effect.Effect<Metadata, FsError>;
358
+ /** Checks handle liveness. In-memory storage has no host or crash durability to flush. */
359
+ readonly sync: Effect.Effect<void, FsError>;
360
+ /** Closes the handle. A repeated explicit close fails; scope cleanup remains safe. */
361
+ readonly close: Effect.Effect<void, FsError>;
362
+ }
363
+ /**
364
+ * A filesystem caller with its own identity, creation mask, and current directory.
365
+ *
366
+ * @category models
367
+ * @since 0.1.0
368
+ */
369
+ export interface Caller {
370
+ readonly [CallerId]: true;
371
+ /** Reads metadata, following the final symbolic link by default. */
372
+ readonly stat: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Metadata, FsError>;
373
+ /** Atomically moves an entry within this volume without replacing a non-empty directory. */
374
+ readonly rename: (source: PathInput, destination: PathInput, options?: {
375
+ /** Base directory for a relative source path. */
376
+ readonly sourceRelativeTo?: DirectoryHandle;
377
+ /** Base directory for a relative destination path. */
378
+ readonly destinationRelativeTo?: DirectoryHandle;
379
+ }) => Effect.Effect<void, FsError>;
380
+ /** Reads and returns an owned copy of a regular file's complete contents. */
381
+ readonly readFile: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Uint8Array, FsError>;
382
+ /** Atomically writes a complete regular file according to the replacement options. */
383
+ readonly writeFile: (path: PathInput, bytes: Uint8Array, options: WriteFileOptions) => Effect.Effect<void, FsError>;
384
+ /** Checks the requested permission bits without opening the entry. */
385
+ readonly access: (path: PathInput, bits?: number, options?: RelativeOptions) => Effect.Effect<void, FsError>;
386
+ /** Sets a regular file's length. Extending creates a zero-filled region. */
387
+ readonly truncate: (path: PathInput, length: bigint, options?: RelativeOptions) => Effect.Effect<void, FsError>;
388
+ /** Changes permission bits, following the final symbolic link by default. */
389
+ readonly chmod: (path: PathInput, mode: number, options?: MetadataOptions) => Effect.Effect<void, FsError>;
390
+ /** Changes uid, gid, or both, following the final symbolic link by default. */
391
+ readonly chown: (path: PathInput, owner: OwnerUpdate, options?: MetadataOptions) => Effect.Effect<void, FsError>;
392
+ /** Updates access and modification times, following the final symbolic link by default. */
393
+ readonly utimes: (path: PathInput, times: Times, options?: MetadataOptions) => Effect.Effect<void, FsError>;
394
+ /** Changes permission bits through a live, same-volume handle. */
395
+ readonly chmodHandle: (handle: FileHandle | DirectoryHandle, mode: number) => Effect.Effect<void, FsError>;
396
+ /** Changes uid, gid, or both through a live, same-volume handle. */
397
+ readonly chownHandle: (handle: FileHandle | DirectoryHandle, owner: OwnerUpdate) => Effect.Effect<void, FsError>;
398
+ /** Updates access and modification times through a live, same-volume handle. */
399
+ readonly utimesHandle: (handle: FileHandle | DirectoryHandle, times: Times) => Effect.Effect<void, FsError>;
400
+ /** Reads metadata without following the final symbolic link. */
401
+ readonly lstat: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Metadata, FsError>;
402
+ /** Creates a hard link to an existing non-directory entry. */
403
+ readonly link: (source: PathInput, destination: PathInput, options?: {
404
+ /** Base directory for a relative source path. */
405
+ readonly sourceRelativeTo?: DirectoryHandle;
406
+ /** Base directory for a relative destination path. */
407
+ readonly destinationRelativeTo?: DirectoryHandle;
408
+ /** Link to the final symbolic link's target instead of the link itself. */
409
+ readonly followSourceSymlink?: boolean;
410
+ }) => Effect.Effect<void, FsError>;
411
+ /** Creates a symbolic link. The target bytes are stored without resolving them. */
412
+ readonly symlink: (target: PathInput, path: PathInput, options?: RelativeOptions) => Effect.Effect<void, FsError>;
413
+ /** Reads a symbolic-link target as UTF-8, failing with `UnrepresentableName` for other bytes. */
414
+ readonly readLink: (path: PathInput, options?: RelativeOptions) => Effect.Effect<string, FsError>;
415
+ /** Reads a symbolic-link target as owned bytes. */
416
+ readonly readLinkBytes: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Uint8Array, FsError>;
417
+ /** Reads directory names as UTF-8, failing if any name is not representable. */
418
+ readonly readDirectory: (path: PathInput, options?: RelativeOptions) => Effect.Effect<ReadonlyArray<string>, FsError>;
419
+ /** Reads directory names as owned byte arrays. */
420
+ readonly readDirectoryBytes: (path: PathInput, options?: RelativeOptions) => Effect.Effect<ReadonlyArray<Uint8Array>, FsError>;
421
+ /** Resolves links and normalizes a path as UTF-8. */
422
+ readonly realPath: (path: PathInput, options?: RelativeOptions) => Effect.Effect<string, FsError>;
423
+ /** Resolves links and normalizes a path without requiring UTF-8 names. */
424
+ readonly realPathBytes: (path: PathInput, options?: RelativeOptions) => Effect.Effect<BytePath, FsError>;
425
+ /** Opens a scoped regular-file handle. The surrounding scope closes it automatically. */
426
+ readonly open: (path: PathInput, options: OpenOptions) => Effect.Effect<FileHandle, FsError, Scope.Scope>;
427
+ /** Removes a non-directory entry. Open handles remain usable until closed. */
428
+ readonly unlink: (path: PathInput, options?: RelativeOptions) => Effect.Effect<void, FsError>;
429
+ /** Removes an empty directory. */
430
+ readonly rmdir: (path: PathInput, options?: RelativeOptions) => Effect.Effect<void, FsError>;
431
+ /** Creates one directory. Parent directories must already exist. */
432
+ readonly mkdir: (path: PathInput, options?: RelativeOptions & {
433
+ /** Requested mode before applying the caller's umask. Defaults to `0o777`. */
434
+ readonly mode?: number;
435
+ }) => Effect.Effect<void, FsError>;
436
+ /** Creates a scoped caller whose current directory is the resolved directory identity. */
437
+ readonly withDirectory: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Caller, FsError, Scope.Scope>;
438
+ /** Opens a scoped directory handle for metadata and relative path resolution. */
439
+ readonly openDirectory: (path: PathInput, options?: RelativeOptions) => Effect.Effect<DirectoryHandle, FsError, Scope.Scope>;
440
+ }
441
+ /**
442
+ * A committed namespace or content change emitted by a volume watch stream.
443
+ *
444
+ * @category models
445
+ * @since 0.1.0
446
+ */
447
+ export interface Change {
448
+ /** Kind of committed namespace or content change. */
449
+ readonly _tag: "Create" | "Update" | "Remove";
450
+ /** Absolute path of the changed entry. */
451
+ readonly path: BytePath;
452
+ }
453
+ /**
454
+ * An isolated virtual filesystem namespace that creates callers, snapshots, and watch streams.
455
+ *
456
+ * @category models
457
+ * @since 0.1.0
458
+ */
459
+ export interface Volume {
460
+ /** Opens a scoped stream of future committed changes. Events are not replayed. */
461
+ readonly watch: Effect.Effect<Stream.Stream<Change>, never, Scope.Scope>;
462
+ /** Captures an isolated snapshot of the reachable namespace and metadata. */
463
+ readonly snapshot: Effect.Effect<Snapshot, ImageError>;
464
+ readonly [VolumeId]: true;
465
+ /** Creates a caller rooted at `/` with independent credentials, umask, and current directory. */
466
+ readonly caller: (options?: RootCallerOptions) => Effect.Effect<Caller, ConfigurationError>;
467
+ }
468
+ declare const CurrentFileSystem_base: Context.ServiceClass<CurrentFileSystem, "@effect-vfs/core/CurrentFileSystem", Caller>;
469
+ /**
470
+ * Optional Effect service for providing an existing filesystem caller.
471
+ *
472
+ * @category services
473
+ * @since 0.1.0
474
+ */
475
+ export declare class CurrentFileSystem extends CurrentFileSystem_base {
476
+ }
477
+ /**
478
+ * Encodes a snapshot as owned UTF-8 JSON bytes using the version 1 snapshot format.
479
+ *
480
+ * @category serialization
481
+ * @since 0.1.0
482
+ */
483
+ export declare const encodeSnapshot: (snapshot: Snapshot) => Effect.Effect<Uint8Array, ImageError>;
484
+ /**
485
+ * Decodes version 1 snapshot bytes while enforcing explicit input and payload limits.
486
+ *
487
+ * @category serialization
488
+ * @since 0.1.0
489
+ */
490
+ export declare const decodeSnapshot: (input: Uint8Array, limits: DecodeLimits) => Effect.Effect<Snapshot, ImageError>;
491
+ /**
492
+ * Creates an opaque byte path by copying the input when the Effect executes.
493
+ *
494
+ * **Gotchas**
495
+ *
496
+ * Shared-memory-backed and detached views fail with `InvalidArgument`.
497
+ *
498
+ * @category constructors
499
+ * @since 0.1.0
500
+ */
501
+ export declare const pathFromBytes: (bytes: Uint8Array<ArrayBufferLike>) => Effect.Effect<BytePath, FsError, never>;
502
+ /**
503
+ * Copies the bytes held by an opaque byte path.
504
+ *
505
+ * @category getters
506
+ * @since 0.1.0
507
+ */
508
+ export declare const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array<ArrayBuffer>, FsError, never>;
509
+ /**
510
+ * Creates a fresh empty volume and captures the current Effect `Clock`.
511
+ *
512
+ * **Details**
513
+ *
514
+ * Each execution creates independent storage. Snapshot image failures cannot
515
+ * arise because this constructor does not accept persisted input.
516
+ *
517
+ * @category constructors
518
+ * @since 0.1.0
519
+ */
520
+ export declare const make: (options?: {
521
+ readonly maxEntries?: number;
522
+ readonly maxBytes?: number;
523
+ readonly maxFileBytes?: number;
524
+ readonly maxPathBytes?: number;
525
+ } | undefined) => Effect.Effect<Volume, ConfigurationError, never>;
526
+ /**
527
+ * Restores a fresh volume from an opaque snapshot under the supplied destination limits.
528
+ *
529
+ * @category constructors
530
+ * @since 0.1.0
531
+ */
532
+ export declare const fromSnapshot: (snapshot: Snapshot, options?: {
533
+ readonly maxEntries?: number;
534
+ readonly maxBytes?: number;
535
+ readonly maxFileBytes?: number;
536
+ readonly maxPathBytes?: number;
537
+ } | undefined) => Effect.Effect<Volume, ConfigurationError | ImageError, never>;
538
+ /**
539
+ * Schema for a complete fixture namespace with optional metadata and forward hard links.
540
+ *
541
+ * **Details**
542
+ *
543
+ * Fixture paths must be absolute, unique, and explicitly include their parent directories.
544
+ *
545
+ * @category schemas
546
+ * @since 0.1.0
547
+ */
548
+ export declare const Fixture: Schema.Struct<{
549
+ readonly rootMetadata: Schema.optionalKey<Schema.Struct<{
550
+ readonly uid: Schema.optionalKey<Schema.Finite>;
551
+ readonly gid: Schema.optionalKey<Schema.Finite>;
552
+ readonly mode: Schema.optionalKey<Schema.Finite>;
553
+ readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
554
+ readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
555
+ readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
556
+ readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
557
+ }>>;
558
+ readonly entries: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
559
+ readonly kind: Schema.Literal<"directory">;
560
+ readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
561
+ readonly metadata: Schema.optionalKey<Schema.Struct<{
562
+ readonly uid: Schema.optionalKey<Schema.Finite>;
563
+ readonly gid: Schema.optionalKey<Schema.Finite>;
564
+ readonly mode: Schema.optionalKey<Schema.Finite>;
565
+ readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
566
+ readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
567
+ readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
568
+ readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
569
+ }>>;
570
+ }>, Schema.Struct<{
571
+ readonly kind: Schema.Literal<"file">;
572
+ readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
573
+ readonly bytes: Schema.Uint8Array;
574
+ readonly metadata: Schema.optionalKey<Schema.Struct<{
575
+ readonly uid: Schema.optionalKey<Schema.Finite>;
576
+ readonly gid: Schema.optionalKey<Schema.Finite>;
577
+ readonly mode: Schema.optionalKey<Schema.Finite>;
578
+ readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
579
+ readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
580
+ readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
581
+ readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
582
+ }>>;
583
+ }>, Schema.Struct<{
584
+ readonly kind: Schema.Literal<"symlink">;
585
+ readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
586
+ readonly target: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
587
+ readonly metadata: Schema.optionalKey<Schema.Struct<{
588
+ readonly uid: Schema.optionalKey<Schema.Finite>;
589
+ readonly gid: Schema.optionalKey<Schema.Finite>;
590
+ readonly mode: Schema.optionalKey<Schema.Finite>;
591
+ readonly atimeNs: Schema.optionalKey<Schema.BigInt>;
592
+ readonly mtimeNs: Schema.optionalKey<Schema.BigInt>;
593
+ readonly ctimeNs: Schema.optionalKey<Schema.BigInt>;
594
+ readonly birthtimeNs: Schema.optionalKey<Schema.BigInt>;
595
+ }>>;
596
+ }>, Schema.Struct<{
597
+ readonly kind: Schema.Literal<"hardLink">;
598
+ readonly path: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
599
+ readonly target: Schema.Union<readonly [Schema.String, Schema.declare<BytePath, BytePath>]>;
600
+ }>]>>;
601
+ }>;
602
+ /**
603
+ * A complete filesystem fixture accepted by `fromFixture`.
604
+ *
605
+ * @category models
606
+ * @since 0.1.0
607
+ */
608
+ export type Fixture = typeof Fixture.Type;
609
+ /**
610
+ * Builds a fresh volume from a validated final-state fixture.
611
+ *
612
+ * @category constructors
613
+ * @since 0.1.0
614
+ */
615
+ export declare const fromFixture: (fixture: {
616
+ readonly rootMetadata?: {
617
+ readonly uid?: number;
618
+ readonly gid?: number;
619
+ readonly mode?: number;
620
+ readonly atimeNs?: bigint;
621
+ readonly mtimeNs?: bigint;
622
+ readonly ctimeNs?: bigint;
623
+ readonly birthtimeNs?: bigint;
624
+ };
625
+ readonly entries: readonly ({
626
+ readonly kind: "directory";
627
+ readonly path: string | BytePath;
628
+ readonly metadata?: {
629
+ readonly uid?: number;
630
+ readonly gid?: number;
631
+ readonly mode?: number;
632
+ readonly atimeNs?: bigint;
633
+ readonly mtimeNs?: bigint;
634
+ readonly ctimeNs?: bigint;
635
+ readonly birthtimeNs?: bigint;
636
+ };
637
+ } | {
638
+ readonly kind: "file";
639
+ readonly path: string | BytePath;
640
+ readonly bytes: Uint8Array<ArrayBufferLike>;
641
+ readonly metadata?: {
642
+ readonly uid?: number;
643
+ readonly gid?: number;
644
+ readonly mode?: number;
645
+ readonly atimeNs?: bigint;
646
+ readonly mtimeNs?: bigint;
647
+ readonly ctimeNs?: bigint;
648
+ readonly birthtimeNs?: bigint;
649
+ };
650
+ } | {
651
+ readonly kind: "symlink";
652
+ readonly path: string | BytePath;
653
+ readonly target: string | BytePath;
654
+ readonly metadata?: {
655
+ readonly uid?: number;
656
+ readonly gid?: number;
657
+ readonly mode?: number;
658
+ readonly atimeNs?: bigint;
659
+ readonly mtimeNs?: bigint;
660
+ readonly ctimeNs?: bigint;
661
+ readonly birthtimeNs?: bigint;
662
+ };
663
+ } | {
664
+ readonly kind: "hardLink";
665
+ readonly path: string | BytePath;
666
+ readonly target: string | BytePath;
667
+ })[];
668
+ }, options?: {
669
+ readonly maxEntries?: number;
670
+ readonly maxBytes?: number;
671
+ readonly maxFileBytes?: number;
672
+ readonly maxPathBytes?: number;
673
+ } | undefined) => Effect.Effect<Volume, ConfigurationError | ImageError, never>;
674
+ //# sourceMappingURL=VirtualFileSystem.d.ts.map