@effect-vfs/core 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -149
- package/dist/BytePath.d.ts +2 -1
- package/dist/BytePath.d.ts.map +1 -1
- package/dist/LiveVolume.d.ts +101 -0
- package/dist/LiveVolume.d.ts.map +1 -0
- package/dist/LiveVolume.js +72 -0
- package/dist/Snapshot.d.ts +4 -2
- package/dist/Snapshot.d.ts.map +1 -1
- package/dist/Snapshot.js +4 -2
- package/dist/VirtualFileSystem.d.ts +333 -108
- package/dist/VirtualFileSystem.d.ts.map +1 -1
- package/dist/VirtualFileSystem.js +119 -29
- package/dist/VirtualFileSystemError.d.ts +54 -0
- package/dist/VirtualFileSystemError.d.ts.map +1 -0
- package/dist/VirtualFileSystemError.js +49 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/internal/liveImage.d.ts +286 -0
- package/dist/internal/liveImage.d.ts.map +1 -0
- package/dist/internal/liveImage.js +176 -0
- package/dist/internal/virtualFileSystem/errors.d.ts +4 -23
- package/dist/internal/virtualFileSystem/errors.d.ts.map +1 -1
- package/dist/internal/virtualFileSystem/errors.js +11 -15
- package/dist/internal/virtualFileSystem/fixture.d.ts +4 -1
- package/dist/internal/virtualFileSystem/fixture.d.ts.map +1 -1
- package/dist/internal/virtualFileSystem/fixture.js +8 -2
- package/dist/internal/virtualFileSystem/stagedState.d.ts +22 -0
- package/dist/internal/virtualFileSystem/stagedState.d.ts.map +1 -0
- package/dist/internal/virtualFileSystem/stagedState.js +62 -0
- package/dist/internal/virtualFileSystem/watchHub.d.ts +3 -3
- package/dist/internal/virtualFileSystem/watchHub.d.ts.map +1 -1
- package/dist/internal/virtualFileSystem/watchHub.js +42 -21
- package/dist/internal/virtualFileSystem.d.ts +223 -15
- package/dist/internal/virtualFileSystem.d.ts.map +1 -1
- package/dist/internal/virtualFileSystem.js +1288 -153
- package/package.json +9 -1
|
@@ -8,11 +8,17 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @since 0.1.0
|
|
10
10
|
*/
|
|
11
|
+
import type * as ByteSize from "effect/ByteSize";
|
|
12
|
+
import * as Context from "effect/Context";
|
|
13
|
+
import type * as Crypto from "effect/Crypto";
|
|
11
14
|
import * as Effect from "effect/Effect";
|
|
15
|
+
import type * as Order from "effect/Order";
|
|
16
|
+
import type * as PlatformError from "effect/PlatformError";
|
|
12
17
|
import * as Schema from "effect/Schema";
|
|
13
18
|
import type * as Scope from "effect/Scope";
|
|
14
19
|
import type * as Stream from "effect/Stream";
|
|
15
20
|
import type { BytePath } from "./BytePath.js";
|
|
21
|
+
import type { ConfigurationError, FsError } from "./VirtualFileSystemError.js";
|
|
16
22
|
export { BytePath } from "./BytePath.js";
|
|
17
23
|
import type { DecodeLimits, ImageError, Snapshot } from "./Snapshot.js";
|
|
18
24
|
export { DecodeLimits, ImageError, type Snapshot, SnapshotTypeId } from "./Snapshot.js";
|
|
@@ -78,9 +84,14 @@ export type FsCode = typeof FsCode.Type;
|
|
|
78
84
|
/**
|
|
79
85
|
* Describes an expected filesystem operation failure.
|
|
80
86
|
*
|
|
87
|
+
* Durable providers distinguish `StorageRejected` (the operation definitely did not commit),
|
|
88
|
+
* `OutcomeUnknown` (it may have committed), and `VolumeUnavailable` (the provider cannot safely
|
|
89
|
+
* serve further operations until recovery). Built-in memory volumes never emit these codes.
|
|
90
|
+
*
|
|
81
91
|
* @example
|
|
82
92
|
* ```ts
|
|
83
93
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
94
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
84
95
|
* import { Effect } from "effect"
|
|
85
96
|
*
|
|
86
97
|
* const program = Effect.gen(function*() {
|
|
@@ -96,23 +107,21 @@ export type FsCode = typeof FsCode.Type;
|
|
|
96
107
|
* )
|
|
97
108
|
* })
|
|
98
109
|
*
|
|
99
|
-
* Effect.runPromise(program).then(console.log)
|
|
110
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
100
111
|
* // Uint8Array(0) []
|
|
101
112
|
* ```
|
|
102
113
|
*
|
|
103
114
|
* @category errors
|
|
104
115
|
* @since 0.1.0
|
|
105
116
|
*/
|
|
106
|
-
export
|
|
107
|
-
/** @internal */
|
|
108
|
-
export interface FsError extends VfsModel.FsError {
|
|
109
|
-
}
|
|
117
|
+
export { FsError } from "./VirtualFileSystemError.js";
|
|
110
118
|
/**
|
|
111
119
|
* Describes an invalid volume or caller option and names the rejected field.
|
|
112
120
|
*
|
|
113
121
|
* @example
|
|
114
122
|
* ```ts
|
|
115
123
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
124
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
116
125
|
* import { Effect } from "effect"
|
|
117
126
|
*
|
|
118
127
|
* // `field` names the rejected option, so the caller learns which key was wrong.
|
|
@@ -126,17 +135,14 @@ export interface FsError extends VfsModel.FsError {
|
|
|
126
135
|
* )
|
|
127
136
|
* })
|
|
128
137
|
*
|
|
129
|
-
* Effect.runPromise(program).then(console.log)
|
|
138
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
130
139
|
* // rejected maxEntries
|
|
131
140
|
* ```
|
|
132
141
|
*
|
|
133
142
|
* @category errors
|
|
134
143
|
* @since 0.1.0
|
|
135
144
|
*/
|
|
136
|
-
export
|
|
137
|
-
/** @internal */
|
|
138
|
-
export interface ConfigurationError extends VfsModel.ConfigurationError {
|
|
139
|
-
}
|
|
145
|
+
export { ConfigurationError } from "./VirtualFileSystemError.js";
|
|
140
146
|
/**
|
|
141
147
|
* Schema for a caller's numeric identity, supplementary groups, and explicit privilege.
|
|
142
148
|
*
|
|
@@ -157,6 +163,7 @@ export type Identity = typeof Identity.Type;
|
|
|
157
163
|
* @example
|
|
158
164
|
* ```ts
|
|
159
165
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
166
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
160
167
|
* import { Effect } from "effect"
|
|
161
168
|
*
|
|
162
169
|
* const program = Effect.gen(function*() {
|
|
@@ -177,7 +184,7 @@ export type Identity = typeof Identity.Type;
|
|
|
177
184
|
* return ((yield* user.stat("/home/user")).mode & 0o777).toString(8)
|
|
178
185
|
* })
|
|
179
186
|
*
|
|
180
|
-
* Effect.runPromise(program).then(console.log)
|
|
187
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
181
188
|
* // 755
|
|
182
189
|
* ```
|
|
183
190
|
*
|
|
@@ -192,12 +199,69 @@ export declare const RootCallerOptions: typeof VfsModel.RootCallerOptions;
|
|
|
192
199
|
* @since 0.1.0
|
|
193
200
|
*/
|
|
194
201
|
export type RootCallerOptions = typeof RootCallerOptions.Type;
|
|
202
|
+
/**
|
|
203
|
+
* Schema for the failure boundary survived by an acknowledged volume write.
|
|
204
|
+
*
|
|
205
|
+
* @category schemas
|
|
206
|
+
* @since 0.1.0
|
|
207
|
+
*/
|
|
208
|
+
export declare const VolumeDurability: typeof VfsModel.VolumeDurability;
|
|
209
|
+
/**
|
|
210
|
+
* The failure boundary survived by an acknowledged volume write.
|
|
211
|
+
*
|
|
212
|
+
* @category models
|
|
213
|
+
* @since 0.1.0
|
|
214
|
+
*/
|
|
215
|
+
export type VolumeDurability = typeof VolumeDurability.Type;
|
|
216
|
+
/**
|
|
217
|
+
* Weakest-to-strongest ordering for volume durability guarantees.
|
|
218
|
+
*
|
|
219
|
+
* @category ordering
|
|
220
|
+
* @since 0.1.0
|
|
221
|
+
*/
|
|
222
|
+
export declare const VolumeDurabilityOrder: Order.Order<VolumeDurability>;
|
|
223
|
+
/**
|
|
224
|
+
* Returns whether `actual` survives at least the failure boundary required by `required`.
|
|
225
|
+
*
|
|
226
|
+
* @category predicates
|
|
227
|
+
* @since 0.1.0
|
|
228
|
+
*/
|
|
229
|
+
export declare const isVolumeDurabilityAtLeast: (actual: VolumeDurability, required: VolumeDurability) => boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Schema for the stable logical identity of a volume.
|
|
232
|
+
*
|
|
233
|
+
* @category schemas
|
|
234
|
+
* @since 0.1.0
|
|
235
|
+
*/
|
|
236
|
+
export declare const VolumeIdentity: typeof VfsModel.VolumeIdentity;
|
|
237
|
+
/**
|
|
238
|
+
* Stable logical identity of a volume as a branded 128-bit lowercase hexadecimal string.
|
|
239
|
+
*
|
|
240
|
+
* @category models
|
|
241
|
+
* @since 0.1.0
|
|
242
|
+
*/
|
|
243
|
+
export type VolumeIdentity = typeof VolumeIdentity.Type;
|
|
244
|
+
/**
|
|
245
|
+
* Schema for one uninterrupted storage lifetime of a volume.
|
|
246
|
+
*
|
|
247
|
+
* @category schemas
|
|
248
|
+
* @since 0.1.0
|
|
249
|
+
*/
|
|
250
|
+
export declare const VolumeIncarnation: typeof VfsModel.VolumeIncarnation;
|
|
251
|
+
/**
|
|
252
|
+
* One uninterrupted storage lifetime as a branded 128-bit lowercase hexadecimal string.
|
|
253
|
+
*
|
|
254
|
+
* @category models
|
|
255
|
+
* @since 0.1.0
|
|
256
|
+
*/
|
|
257
|
+
export type VolumeIncarnation = typeof VolumeIncarnation.Type;
|
|
195
258
|
/**
|
|
196
259
|
* Schema for optional volume capacity and path limits.
|
|
197
260
|
*
|
|
198
261
|
* @example
|
|
199
262
|
* ```ts
|
|
200
263
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
264
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
201
265
|
* import { ByteSize, Effect } from "effect"
|
|
202
266
|
*
|
|
203
267
|
* // Every limit is optional, and each one is enforced once set.
|
|
@@ -214,7 +278,7 @@ export type RootCallerOptions = typeof RootCallerOptions.Type;
|
|
|
214
278
|
* )
|
|
215
279
|
* })
|
|
216
280
|
*
|
|
217
|
-
* Effect.runPromise(program).then(console.log)
|
|
281
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
218
282
|
* // FileTooLarge
|
|
219
283
|
* ```
|
|
220
284
|
*
|
|
@@ -223,18 +287,48 @@ export type RootCallerOptions = typeof RootCallerOptions.Type;
|
|
|
223
287
|
*/
|
|
224
288
|
export declare const VolumeOptions: typeof VfsModel.VolumeOptions;
|
|
225
289
|
/**
|
|
226
|
-
* Capacity and path limits for a volume.
|
|
290
|
+
* Capacity, admission, watch retention, and path limits for a volume.
|
|
291
|
+
* `maxPendingOperations` defaults to 64 and `maxWatchEvents` defaults to 256.
|
|
227
292
|
*
|
|
228
293
|
* @category models
|
|
229
294
|
* @since 0.1.0
|
|
230
295
|
*/
|
|
231
296
|
export type VolumeOptions = typeof VolumeOptions.Type;
|
|
297
|
+
/**
|
|
298
|
+
* Effective capacity and path limits of a live volume. An absent limit is unlimited.
|
|
299
|
+
* `maxFileBytes` always includes the engine's maximum representable file size.
|
|
300
|
+
*
|
|
301
|
+
* @category models
|
|
302
|
+
* @since 0.1.0
|
|
303
|
+
*/
|
|
304
|
+
export interface VolumeLimits {
|
|
305
|
+
readonly maxBytes: ByteSize.ByteSize | undefined;
|
|
306
|
+
readonly maxFileBytes: ByteSize.ByteSize;
|
|
307
|
+
readonly maxEntries: number | undefined;
|
|
308
|
+
readonly maxPathBytes: ByteSize.ByteSize | undefined;
|
|
309
|
+
/** Waiting budget; at most this many plus one callers are admitted at once. */
|
|
310
|
+
readonly maxPendingOperations: number;
|
|
311
|
+
/** Maximum retained events per watch subscriber, including the rescan marker. */
|
|
312
|
+
readonly maxWatchEvents: number;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Live logical content and directory-entry usage of a volume.
|
|
316
|
+
* Open unlinked files remain in `usedBytes` until their last handle closes.
|
|
317
|
+
*
|
|
318
|
+
* @category models
|
|
319
|
+
* @since 0.1.0
|
|
320
|
+
*/
|
|
321
|
+
export interface VolumeUsage {
|
|
322
|
+
readonly usedBytes: bigint;
|
|
323
|
+
readonly entries: number;
|
|
324
|
+
}
|
|
232
325
|
/**
|
|
233
326
|
* Schema for filesystem node metadata with bigint inode, size, and nanosecond fields.
|
|
234
327
|
*
|
|
235
328
|
* @example
|
|
236
329
|
* ```ts
|
|
237
330
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
331
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
238
332
|
* import { Effect } from "effect"
|
|
239
333
|
*
|
|
240
334
|
* // Sizes and inode numbers are bigint; times are nanosecond timestamps.
|
|
@@ -251,7 +345,7 @@ export type VolumeOptions = typeof VolumeOptions.Type;
|
|
|
251
345
|
* return [metadata.kind, metadata.size, metadata.nlink]
|
|
252
346
|
* })
|
|
253
347
|
*
|
|
254
|
-
* Effect.runPromise(program).then(console.log)
|
|
348
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
255
349
|
* // [ 'file', 3n, 1 ]
|
|
256
350
|
* ```
|
|
257
351
|
*
|
|
@@ -281,6 +375,7 @@ export interface ObjectReference {
|
|
|
281
375
|
* @example
|
|
282
376
|
* ```ts
|
|
283
377
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
378
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
284
379
|
* import { Effect } from "effect"
|
|
285
380
|
*
|
|
286
381
|
* // References survive renames, and each observation carries the revision it
|
|
@@ -302,7 +397,7 @@ export interface ObjectReference {
|
|
|
302
397
|
* return [before.value.kind, after.value.kind]
|
|
303
398
|
* })
|
|
304
399
|
*
|
|
305
|
-
* Effect.runPromise(program).then(console.log)
|
|
400
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
306
401
|
* // [ 'directory', 'directory' ]
|
|
307
402
|
* ```
|
|
308
403
|
*
|
|
@@ -323,6 +418,44 @@ export interface DirectoryEntry {
|
|
|
323
418
|
readonly name: Uint8Array;
|
|
324
419
|
readonly reference: ObjectReference;
|
|
325
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* A directory revision transition captured inside one coordinated operation.
|
|
423
|
+
*
|
|
424
|
+
* @category schemas
|
|
425
|
+
* @since 0.4.0
|
|
426
|
+
*/
|
|
427
|
+
export declare const DirectoryChange: typeof VfsModel.DirectoryChange;
|
|
428
|
+
/**
|
|
429
|
+
* A directory revision transition captured inside one coordinated operation.
|
|
430
|
+
*
|
|
431
|
+
* @category models
|
|
432
|
+
* @since 0.4.0
|
|
433
|
+
*/
|
|
434
|
+
export type DirectoryChange = typeof DirectoryChange.Type;
|
|
435
|
+
/**
|
|
436
|
+
* The identity and parent-directory transition produced by a named entry mutation.
|
|
437
|
+
*
|
|
438
|
+
* @category models
|
|
439
|
+
* @since 0.4.0
|
|
440
|
+
*/
|
|
441
|
+
export interface ReferenceEntryResult {
|
|
442
|
+
readonly reference: ObjectReference;
|
|
443
|
+
readonly directory: DirectoryChange;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* The directory transitions produced by a same-directory or cross-directory rename.
|
|
447
|
+
*
|
|
448
|
+
* @category schemas
|
|
449
|
+
* @since 0.4.0
|
|
450
|
+
*/
|
|
451
|
+
export declare const RenameReferenceResult: typeof VfsModel.RenameReferenceResult;
|
|
452
|
+
/**
|
|
453
|
+
* The directory transitions produced by a same-directory or cross-directory rename.
|
|
454
|
+
*
|
|
455
|
+
* @category models
|
|
456
|
+
* @since 0.4.0
|
|
457
|
+
*/
|
|
458
|
+
export type RenameReferenceResult = typeof RenameReferenceResult.Type;
|
|
326
459
|
/**
|
|
327
460
|
* Resolves a relative path from a live directory handle instead of the caller's directory.
|
|
328
461
|
*
|
|
@@ -339,6 +472,7 @@ export interface RelativeOptions {
|
|
|
339
472
|
* @example
|
|
340
473
|
* ```ts
|
|
341
474
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
475
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
342
476
|
* import { Effect } from "effect"
|
|
343
477
|
*
|
|
344
478
|
* const program = Effect.gen(function*() {
|
|
@@ -362,7 +496,7 @@ export interface RelativeOptions {
|
|
|
362
496
|
* return [followed.toString(8), unchanged.toString(8)]
|
|
363
497
|
* })
|
|
364
498
|
*
|
|
365
|
-
* Effect.runPromise(program).then(console.log)
|
|
499
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
366
500
|
* // [ '600', '600' ]
|
|
367
501
|
* ```
|
|
368
502
|
*
|
|
@@ -400,6 +534,7 @@ export declare const TimeUpdate: typeof VfsModel.TimeUpdate;
|
|
|
400
534
|
* @example
|
|
401
535
|
* ```ts
|
|
402
536
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
537
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
403
538
|
* import { Effect } from "effect"
|
|
404
539
|
*
|
|
405
540
|
* const program = Effect.gen(function*() {
|
|
@@ -421,7 +556,7 @@ export declare const TimeUpdate: typeof VfsModel.TimeUpdate;
|
|
|
421
556
|
* return [metadata.atimeNs, metadata.mtimeNs === 1_000n]
|
|
422
557
|
* })
|
|
423
558
|
*
|
|
424
|
-
* Effect.runPromise(program).then(console.log)
|
|
559
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
425
560
|
* // [ 1000n, false ]
|
|
426
561
|
* ```
|
|
427
562
|
*
|
|
@@ -442,6 +577,7 @@ export type Times = typeof Times.Type;
|
|
|
442
577
|
* @example
|
|
443
578
|
* ```ts
|
|
444
579
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
580
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
445
581
|
* import { Effect } from "effect"
|
|
446
582
|
*
|
|
447
583
|
* // The handle anchors relative paths to the directory itself, so a rename in
|
|
@@ -463,7 +599,7 @@ export type Times = typeof Times.Type;
|
|
|
463
599
|
* return yield* caller.readDirectory("/renamed")
|
|
464
600
|
* }).pipe(Effect.scoped)
|
|
465
601
|
*
|
|
466
|
-
* Effect.runPromise(program).then(console.log)
|
|
602
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
467
603
|
* // [ 'notes.txt' ]
|
|
468
604
|
* ```
|
|
469
605
|
*
|
|
@@ -495,6 +631,7 @@ export type SeekMode = typeof SeekMode.Type;
|
|
|
495
631
|
* @example
|
|
496
632
|
* ```ts
|
|
497
633
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
634
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
498
635
|
* import { Effect } from "effect"
|
|
499
636
|
*
|
|
500
637
|
* // `access` is required; `create` decides whether a missing file is an error.
|
|
@@ -512,7 +649,7 @@ export type SeekMode = typeof SeekMode.Type;
|
|
|
512
649
|
* return (yield* handle.stat).size
|
|
513
650
|
* }).pipe(Effect.scoped)
|
|
514
651
|
*
|
|
515
|
-
* Effect.runPromise(program).then(console.log)
|
|
652
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
516
653
|
* // 2n
|
|
517
654
|
* ```
|
|
518
655
|
*
|
|
@@ -527,12 +664,90 @@ export declare const OpenSettings: typeof VfsModel.OpenSettings;
|
|
|
527
664
|
* @since 0.1.0
|
|
528
665
|
*/
|
|
529
666
|
export type OpenOptions = typeof OpenSettings.Type & RelativeOptions;
|
|
667
|
+
/**
|
|
668
|
+
* Settings for creating a directory through a parent object reference.
|
|
669
|
+
* `exactMode` skips the caller's umask for an explicit creation mode; permission policy still applies.
|
|
670
|
+
*
|
|
671
|
+
* @category schemas
|
|
672
|
+
* @since 0.4.0
|
|
673
|
+
*/
|
|
674
|
+
export declare const MkdirReferenceSettings: typeof VfsModel.MkdirReferenceSettings;
|
|
675
|
+
/**
|
|
676
|
+
* Settings for creating a directory through a parent object reference.
|
|
677
|
+
* `exactMode` skips the caller's umask for an explicit creation mode; permission policy still applies.
|
|
678
|
+
*
|
|
679
|
+
* @category models
|
|
680
|
+
* @since 0.4.0
|
|
681
|
+
*/
|
|
682
|
+
export type MkdirReferenceSettings = typeof MkdirReferenceSettings.Type;
|
|
683
|
+
/**
|
|
684
|
+
* Settings for creating a symbolic link through a parent object reference.
|
|
685
|
+
*
|
|
686
|
+
* @category schemas
|
|
687
|
+
* @since 0.4.0
|
|
688
|
+
*/
|
|
689
|
+
export declare const SymlinkReferenceSettings: typeof VfsModel.SymlinkReferenceSettings;
|
|
690
|
+
/**
|
|
691
|
+
* Settings for creating a symbolic link through a parent object reference.
|
|
692
|
+
*
|
|
693
|
+
* @category models
|
|
694
|
+
* @since 0.4.0
|
|
695
|
+
*/
|
|
696
|
+
export type SymlinkReferenceSettings = typeof SymlinkReferenceSettings.Type;
|
|
697
|
+
/**
|
|
698
|
+
* Settings for opening an existing regular-file reference.
|
|
699
|
+
*
|
|
700
|
+
* @category schemas
|
|
701
|
+
* @since 0.4.0
|
|
702
|
+
*/
|
|
703
|
+
export declare const OpenReferenceSettings: typeof VfsModel.OpenReferenceSettings;
|
|
704
|
+
/**
|
|
705
|
+
* Settings for opening an existing regular-file reference.
|
|
706
|
+
*
|
|
707
|
+
* @category models
|
|
708
|
+
* @since 0.4.0
|
|
709
|
+
*/
|
|
710
|
+
export type OpenReferenceSettings = typeof OpenReferenceSettings.Type;
|
|
711
|
+
/**
|
|
712
|
+
* Settings for atomically looking up or creating and opening one referenced child.
|
|
713
|
+
* `exactMode` skips the caller's umask for an explicit creation mode; permission policy still applies.
|
|
714
|
+
*
|
|
715
|
+
* @category schemas
|
|
716
|
+
* @since 0.4.0
|
|
717
|
+
*/
|
|
718
|
+
export declare const OpenChildReferenceSettings: typeof VfsModel.OpenChildReferenceSettings;
|
|
719
|
+
/**
|
|
720
|
+
* Settings for atomically looking up or creating and opening one referenced child.
|
|
721
|
+
* `exactMode` skips the caller's umask for an explicit creation mode; permission policy still applies.
|
|
722
|
+
* Initial mode, times, `initialSize`, and owner apply only to a newly created file.
|
|
723
|
+
* `expectedChild: null` requires an absent direct child. An observation requires
|
|
724
|
+
* the same direct object, revision, and timestamps; a mismatch fails with
|
|
725
|
+
* `StaleReference` before changing the file. Omission skips this observation check.
|
|
726
|
+
* This condition checks the named entry before any final symbolic-link traversal.
|
|
727
|
+
*
|
|
728
|
+
* @category models
|
|
729
|
+
* @since 0.4.0
|
|
730
|
+
*/
|
|
731
|
+
export type OpenChildReferenceSettings = typeof OpenChildReferenceSettings.Type;
|
|
732
|
+
/**
|
|
733
|
+
* A scoped child-open result captured inside one coordinated operation.
|
|
734
|
+
*
|
|
735
|
+
* @category models
|
|
736
|
+
* @since 0.4.0
|
|
737
|
+
*/
|
|
738
|
+
export interface OpenChildReferenceResult {
|
|
739
|
+
readonly handle: FileHandle;
|
|
740
|
+
readonly reference: ObjectReference;
|
|
741
|
+
readonly created: boolean;
|
|
742
|
+
readonly directory: DirectoryChange;
|
|
743
|
+
}
|
|
530
744
|
/**
|
|
531
745
|
* Options for an atomic whole-file write, including replacement and final mode controls.
|
|
532
746
|
*
|
|
533
747
|
* @example
|
|
534
748
|
* ```ts
|
|
535
749
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
750
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
536
751
|
* import { Effect } from "effect"
|
|
537
752
|
*
|
|
538
753
|
* const program = Effect.gen(function*() {
|
|
@@ -560,7 +775,7 @@ export type OpenOptions = typeof OpenSettings.Type & RelativeOptions;
|
|
|
560
775
|
* return [refused, new TextDecoder().decode(yield* caller.readFile("/app.conf"))]
|
|
561
776
|
* })
|
|
562
777
|
*
|
|
563
|
-
* Effect.runPromise(program).then(console.log)
|
|
778
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
564
779
|
* // [ 'AlreadyExists', 'v2' ]
|
|
565
780
|
* ```
|
|
566
781
|
*
|
|
@@ -574,6 +789,7 @@ export type WriteFileOptions = VfsModel.WriteFileOptions;
|
|
|
574
789
|
* @example
|
|
575
790
|
* ```ts
|
|
576
791
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
792
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
577
793
|
* import { Effect } from "effect"
|
|
578
794
|
*
|
|
579
795
|
* const program = Effect.gen(function*() {
|
|
@@ -592,7 +808,7 @@ export type WriteFileOptions = VfsModel.WriteFileOptions;
|
|
|
592
808
|
* return [slice, yield* handle.seek(0n, "current")]
|
|
593
809
|
* }).pipe(Effect.scoped)
|
|
594
810
|
*
|
|
595
|
-
* Effect.runPromise(program).then(console.log)
|
|
811
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
596
812
|
* // [ Uint8Array(2) [ 2, 3 ], 4n ]
|
|
597
813
|
* ```
|
|
598
814
|
*
|
|
@@ -615,7 +831,7 @@ export interface FileHandle {
|
|
|
615
831
|
readonly truncate: (length: bigint) => Effect.Effect<void, FsError>;
|
|
616
832
|
/** Reads metadata for the open file. */
|
|
617
833
|
readonly stat: Effect.Effect<Metadata, FsError>;
|
|
618
|
-
/** Checks handle
|
|
834
|
+
/** Checks handle and provider health. Durable mutations have already committed; memory volumes have nothing to flush. */
|
|
619
835
|
readonly sync: Effect.Effect<void, FsError>;
|
|
620
836
|
/** Closes the handle. A repeated explicit close fails; scope cleanup remains safe. */
|
|
621
837
|
readonly close: Effect.Effect<void, FsError>;
|
|
@@ -626,6 +842,7 @@ export interface FileHandle {
|
|
|
626
842
|
* @example
|
|
627
843
|
* ```ts
|
|
628
844
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
845
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
629
846
|
* import { Effect } from "effect"
|
|
630
847
|
*
|
|
631
848
|
* // Whole-file reads and writes need no scope. `writeFile` always takes an
|
|
@@ -643,13 +860,14 @@ export interface FileHandle {
|
|
|
643
860
|
* return yield* caller.readDirectory("/work")
|
|
644
861
|
* })
|
|
645
862
|
*
|
|
646
|
-
* Effect.runPromise(program).then(console.log)
|
|
863
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
647
864
|
* // [ 'notes.txt' ]
|
|
648
865
|
* ```
|
|
649
866
|
*
|
|
650
867
|
* @example
|
|
651
868
|
* ```ts
|
|
652
869
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
870
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
653
871
|
* import { Effect } from "effect"
|
|
654
872
|
*
|
|
655
873
|
* // Reach for a handle when a whole-file write will not do. A handle carries a
|
|
@@ -669,13 +887,14 @@ export interface FileHandle {
|
|
|
669
887
|
* return new TextDecoder().decode(yield* handle.read(64))
|
|
670
888
|
* }).pipe(Effect.scoped)
|
|
671
889
|
*
|
|
672
|
-
* Effect.runPromise(program).then(console.log)
|
|
890
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
673
891
|
* // first second
|
|
674
892
|
* ```
|
|
675
893
|
*
|
|
676
894
|
* @example
|
|
677
895
|
* ```ts
|
|
678
896
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
897
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
679
898
|
* import { Effect } from "effect"
|
|
680
899
|
*
|
|
681
900
|
* // A derived caller holds the directory's identity, not its path, so renaming
|
|
@@ -696,7 +915,7 @@ export interface FileHandle {
|
|
|
696
915
|
* return yield* caller.readDirectory("/dist")
|
|
697
916
|
* }).pipe(Effect.scoped)
|
|
698
917
|
*
|
|
699
|
-
* Effect.runPromise(program).then(console.log)
|
|
918
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
700
919
|
* // [ 'out.txt' ]
|
|
701
920
|
* ```
|
|
702
921
|
*
|
|
@@ -714,12 +933,38 @@ export interface Caller {
|
|
|
714
933
|
readonly parentReference: (directory: ObjectReference) => Effect.Effect<ObjectReference, FsError>;
|
|
715
934
|
/** Reads metadata and its matching live revision. Requires no permission on the object, as `stat` does not. */
|
|
716
935
|
readonly observeMetadata: (reference: ObjectReference) => Effect.Effect<ObjectObservation<Metadata>, FsError>;
|
|
936
|
+
/** Checks permission bits on the exact referenced object without resolving a path. */
|
|
937
|
+
readonly accessReference: (reference: ObjectReference, bits?: number) => Effect.Effect<void, FsError>;
|
|
717
938
|
/** Reads owned directory entries and their matching directory revision. */
|
|
718
939
|
readonly observeDirectory: (reference: ObjectReference) => Effect.Effect<ObjectObservation<ReadonlyArray<DirectoryEntry>>, FsError>;
|
|
719
940
|
/** Reads an owned symbolic-link target through a stable reference. Requires no permission on the link. */
|
|
720
941
|
readonly readLinkReference: (reference: ObjectReference) => Effect.Effect<Uint8Array, FsError>;
|
|
721
|
-
/**
|
|
722
|
-
readonly
|
|
942
|
+
/** Creates one directory from a referenced parent and returns its exact identity and directory transition. */
|
|
943
|
+
readonly mkdirReference: (directory: ObjectReference, name: Uint8Array, settings?: MkdirReferenceSettings) => Effect.Effect<ReferenceEntryResult, FsError>;
|
|
944
|
+
/** Creates one symbolic link from a referenced parent and returns its exact identity and directory transition. */
|
|
945
|
+
readonly symlinkReference: (target: PathInput, directory: ObjectReference, name: Uint8Array, settings?: SymlinkReferenceSettings) => Effect.Effect<ReferenceEntryResult, FsError>;
|
|
946
|
+
/** Creates another name for the exact source object; symbolic links are not followed. */
|
|
947
|
+
readonly linkReference: (source: ObjectReference, destinationDirectory: ObjectReference, destinationName: Uint8Array) => Effect.Effect<ReferenceEntryResult, FsError>;
|
|
948
|
+
/** Removes a non-directory child and returns the parent directory transition. */
|
|
949
|
+
readonly unlinkReference: (directory: ObjectReference, name: Uint8Array) => Effect.Effect<DirectoryChange, FsError>;
|
|
950
|
+
/** Removes an empty directory child and returns the parent directory transition. */
|
|
951
|
+
readonly rmdirReference: (directory: ObjectReference, name: Uint8Array) => Effect.Effect<DirectoryChange, FsError>;
|
|
952
|
+
/** Removes a child of either type in one coordinated mutation and returns the parent directory transition. */
|
|
953
|
+
readonly removeReference: (directory: ObjectReference, name: Uint8Array) => Effect.Effect<DirectoryChange, FsError>;
|
|
954
|
+
/** Renames one referenced child and returns one transition per distinct parent directory. */
|
|
955
|
+
readonly renameReference: (sourceDirectory: ObjectReference, sourceName: Uint8Array, destinationDirectory: ObjectReference, destinationName: Uint8Array) => Effect.Effect<RenameReferenceResult, FsError>;
|
|
956
|
+
/** Changes permission bits on the exact referenced object. */
|
|
957
|
+
readonly chmodReference: (reference: ObjectReference, mode: number) => Effect.Effect<void, FsError>;
|
|
958
|
+
/** Changes ownership on the exact referenced object. */
|
|
959
|
+
readonly chownReference: (reference: ObjectReference, owner: OwnerUpdate) => Effect.Effect<void, FsError>;
|
|
960
|
+
/** Changes timestamps on the exact referenced object. */
|
|
961
|
+
readonly utimesReference: (reference: ObjectReference, times: Times) => Effect.Effect<void, FsError>;
|
|
962
|
+
/** Changes the length of the exact referenced regular file. */
|
|
963
|
+
readonly truncateReference: (reference: ObjectReference, length: bigint) => Effect.Effect<void, FsError>;
|
|
964
|
+
/** Opens an existing referenced regular file. Omitted settings preserve read-only behavior. */
|
|
965
|
+
readonly openReference: (reference: ObjectReference, settings?: OpenReferenceSettings) => Effect.Effect<FileHandle, FsError, Scope.Scope>;
|
|
966
|
+
/** Atomically looks up or creates and opens one child; `expected` guards its current identity, with `null` meaning absent. */
|
|
967
|
+
readonly openChildReference: (directory: ObjectReference, name: Uint8Array, settings: OpenChildReferenceSettings, expected?: ObjectReference | null) => Effect.Effect<OpenChildReferenceResult, FsError, Scope.Scope>;
|
|
723
968
|
/** Reads metadata, following the final symbolic link by default. */
|
|
724
969
|
readonly stat: (path: PathInput, options?: RelativeOptions) => Effect.Effect<Metadata, FsError>;
|
|
725
970
|
/** Atomically moves an entry within this volume without replacing a non-empty directory. */
|
|
@@ -790,6 +1035,7 @@ export interface Caller {
|
|
|
790
1035
|
* @example
|
|
791
1036
|
* ```ts
|
|
792
1037
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1038
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
793
1039
|
* import { Effect, Fiber, Stream } from "effect"
|
|
794
1040
|
*
|
|
795
1041
|
* const program = Effect.gen(function*() {
|
|
@@ -814,7 +1060,7 @@ export interface Caller {
|
|
|
814
1060
|
* ))
|
|
815
1061
|
* }).pipe(Effect.scoped)
|
|
816
1062
|
*
|
|
817
|
-
* Effect.runPromise(program).then(console.log)
|
|
1063
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
818
1064
|
* // [ 'Create /logs', 'Remove /logs' ]
|
|
819
1065
|
* ```
|
|
820
1066
|
*
|
|
@@ -822,9 +1068,9 @@ export interface Caller {
|
|
|
822
1068
|
* @since 0.1.0
|
|
823
1069
|
*/
|
|
824
1070
|
export interface Change {
|
|
825
|
-
/** Kind of committed
|
|
826
|
-
readonly _tag: "Create" | "Update" | "Remove";
|
|
827
|
-
/** Absolute path of the changed entry. */
|
|
1071
|
+
/** Kind of committed change. `Rescan` means this subscriber lost events. */
|
|
1072
|
+
readonly _tag: "Create" | "Update" | "Remove" | "Rescan";
|
|
1073
|
+
/** Absolute path of the changed entry, or `/` when retained events were lost. */
|
|
828
1074
|
readonly path: BytePath;
|
|
829
1075
|
}
|
|
830
1076
|
/**
|
|
@@ -880,6 +1126,7 @@ export type OverlayChange = typeof OverlayChange.Type;
|
|
|
880
1126
|
* @example
|
|
881
1127
|
* ```ts
|
|
882
1128
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1129
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
883
1130
|
* import { Effect } from "effect"
|
|
884
1131
|
*
|
|
885
1132
|
* const program = Effect.gen(function*() {
|
|
@@ -895,7 +1142,7 @@ export type OverlayChange = typeof OverlayChange.Type;
|
|
|
895
1142
|
* return [plain.length, timed.length]
|
|
896
1143
|
* })
|
|
897
1144
|
*
|
|
898
|
-
* Effect.runPromise(program).then(console.log)
|
|
1145
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
899
1146
|
* // [ 1, 2 ]
|
|
900
1147
|
* ```
|
|
901
1148
|
*
|
|
@@ -916,6 +1163,7 @@ export type OverlayChangesOptions = typeof OverlayChangesOptions.Type;
|
|
|
916
1163
|
* @example
|
|
917
1164
|
* ```ts
|
|
918
1165
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1166
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
919
1167
|
* import { Effect } from "effect"
|
|
920
1168
|
*
|
|
921
1169
|
* const program = Effect.gen(function*() {
|
|
@@ -939,7 +1187,7 @@ export type OverlayChangesOptions = typeof OverlayChangesOptions.Type;
|
|
|
939
1187
|
* ]
|
|
940
1188
|
* })
|
|
941
1189
|
*
|
|
942
|
-
* Effect.runPromise(program).then(console.log)
|
|
1190
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
943
1191
|
* // [ [ 'Added' ], 'built' ]
|
|
944
1192
|
* ```
|
|
945
1193
|
*
|
|
@@ -958,6 +1206,7 @@ export interface OverlayCapture {
|
|
|
958
1206
|
* @example
|
|
959
1207
|
* ```ts
|
|
960
1208
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1209
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
961
1210
|
* import { Effect, Fiber, Option, Stream } from "effect"
|
|
962
1211
|
*
|
|
963
1212
|
* const program = Effect.gen(function*() {
|
|
@@ -977,7 +1226,7 @@ export interface OverlayCapture {
|
|
|
977
1226
|
* return Option.getOrElse(Option.map(change, (event) => event._tag), () => "none")
|
|
978
1227
|
* }).pipe(Effect.scoped)
|
|
979
1228
|
*
|
|
980
|
-
* Effect.runPromise(program).then(console.log)
|
|
1229
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
981
1230
|
* // Create
|
|
982
1231
|
* ```
|
|
983
1232
|
*
|
|
@@ -985,13 +1234,23 @@ export interface OverlayCapture {
|
|
|
985
1234
|
* @since 0.1.0
|
|
986
1235
|
*/
|
|
987
1236
|
export interface Volume {
|
|
988
|
-
/**
|
|
989
|
-
readonly
|
|
1237
|
+
/** The strongest failure boundary survived by acknowledged writes. */
|
|
1238
|
+
readonly durability: VolumeDurability;
|
|
1239
|
+
/** Stable logical identity, preserved across reconstruction only when supplied explicitly. */
|
|
1240
|
+
readonly identity: VolumeIdentity;
|
|
1241
|
+
/** Fresh identity for this uninterrupted storage lifetime. */
|
|
1242
|
+
readonly incarnation: VolumeIncarnation;
|
|
1243
|
+
/** Effective static limits, where `undefined` means unlimited. */
|
|
1244
|
+
readonly limits: VolumeLimits;
|
|
1245
|
+
/** Samples content bytes and directory entries together from the current committed state. */
|
|
1246
|
+
readonly usage: Effect.Effect<VolumeUsage, FsError>;
|
|
1247
|
+
/** Opens a scoped stream of future changes. `Rescan` at `/` requires a full rescan; events are not replayed. */
|
|
1248
|
+
readonly watch: Effect.Effect<Stream.Stream<Change>, FsError, Scope.Scope>;
|
|
990
1249
|
/** Captures an isolated snapshot of the reachable namespace and metadata. */
|
|
991
|
-
readonly snapshot: Effect.Effect<Snapshot, ImageError>;
|
|
1250
|
+
readonly snapshot: Effect.Effect<Snapshot, ImageError | FsError>;
|
|
992
1251
|
readonly [VolumeId]: true;
|
|
993
1252
|
/** Creates a caller rooted at `/` with independent credentials, umask, and current directory. */
|
|
994
|
-
readonly caller: (options?: RootCallerOptions) => Effect.Effect<Caller, ConfigurationError>;
|
|
1253
|
+
readonly caller: (options?: RootCallerOptions) => Effect.Effect<Caller, ConfigurationError | FsError>;
|
|
995
1254
|
}
|
|
996
1255
|
/**
|
|
997
1256
|
* An ordinary volume with final-state inspection relative to one immutable snapshot base.
|
|
@@ -999,6 +1258,7 @@ export interface Volume {
|
|
|
999
1258
|
* @example
|
|
1000
1259
|
* ```ts
|
|
1001
1260
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1261
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1002
1262
|
* import { Effect } from "effect"
|
|
1003
1263
|
*
|
|
1004
1264
|
* const program = Effect.gen(function*() {
|
|
@@ -1016,7 +1276,7 @@ export interface Volume {
|
|
|
1016
1276
|
* return captured.changes.map((change) => change._tag)
|
|
1017
1277
|
* })
|
|
1018
1278
|
*
|
|
1019
|
-
* Effect.runPromise(program).then(console.log)
|
|
1279
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1020
1280
|
* // [ 'Added' ]
|
|
1021
1281
|
* ```
|
|
1022
1282
|
*
|
|
@@ -1025,9 +1285,9 @@ export interface Volume {
|
|
|
1025
1285
|
*/
|
|
1026
1286
|
export interface OverlayVolume extends Volume {
|
|
1027
1287
|
/** Computes final differences from the immutable base when this reusable effect executes. */
|
|
1028
|
-
readonly changes: (options?: OverlayChangesOptions) => Effect.Effect<ReadonlyArray<OverlayChange>, ConfigurationError | ImageError>;
|
|
1288
|
+
readonly changes: (options?: OverlayChangesOptions) => Effect.Effect<ReadonlyArray<OverlayChange>, ConfigurationError | ImageError | FsError>;
|
|
1029
1289
|
/** Captures one committed state when this reusable effect executes. */
|
|
1030
|
-
readonly capture: (options?: OverlayChangesOptions) => Effect.Effect<OverlayCapture, ConfigurationError | ImageError>;
|
|
1290
|
+
readonly capture: (options?: OverlayChangesOptions) => Effect.Effect<OverlayCapture, ConfigurationError | ImageError | FsError>;
|
|
1031
1291
|
}
|
|
1032
1292
|
/**
|
|
1033
1293
|
* Optional Effect service for providing an existing filesystem caller.
|
|
@@ -1035,6 +1295,7 @@ export interface OverlayVolume extends Volume {
|
|
|
1035
1295
|
* @example
|
|
1036
1296
|
* ```ts
|
|
1037
1297
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1298
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1038
1299
|
* import { Effect } from "effect"
|
|
1039
1300
|
*
|
|
1040
1301
|
* // Code depending on the service does not choose the volume it runs against.
|
|
@@ -1056,7 +1317,7 @@ export interface OverlayVolume extends Volume {
|
|
|
1056
1317
|
* return yield* readVersion.pipe(Effect.provideService(Vfs.CurrentFileSystem, caller))
|
|
1057
1318
|
* })
|
|
1058
1319
|
*
|
|
1059
|
-
* Effect.runPromise(program).then(console.log)
|
|
1320
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1060
1321
|
* // Uint8Array(1) [ 49 ]
|
|
1061
1322
|
* ```
|
|
1062
1323
|
*
|
|
@@ -1064,15 +1325,22 @@ export interface OverlayVolume extends Volume {
|
|
|
1064
1325
|
* @category services
|
|
1065
1326
|
* @since 0.1.0
|
|
1066
1327
|
*/
|
|
1067
|
-
export declare const CurrentFileSystem:
|
|
1068
|
-
/**
|
|
1069
|
-
|
|
1328
|
+
export declare const CurrentFileSystem: Context.Service<CurrentFileSystem, Caller>;
|
|
1329
|
+
/**
|
|
1330
|
+
* The caller supplied by the optional filesystem service.
|
|
1331
|
+
*
|
|
1332
|
+
* @category services
|
|
1333
|
+
* @since 0.1.0
|
|
1334
|
+
*/
|
|
1335
|
+
export interface CurrentFileSystem extends Caller {
|
|
1336
|
+
}
|
|
1070
1337
|
/**
|
|
1071
1338
|
* Encodes a snapshot as owned UTF-8 JSON bytes using the version 1 snapshot format.
|
|
1072
1339
|
*
|
|
1073
1340
|
* @example
|
|
1074
1341
|
* ```ts
|
|
1075
1342
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1343
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1076
1344
|
* import { Effect } from "effect"
|
|
1077
1345
|
*
|
|
1078
1346
|
* // Bytes are portable: store or transmit them, then decode under explicit limits.
|
|
@@ -1091,7 +1359,7 @@ export type CurrentFileSystem = VfsModel.CurrentFileSystem;
|
|
|
1091
1359
|
* return JSON.parse(new TextDecoder().decode(bytes)).version
|
|
1092
1360
|
* })
|
|
1093
1361
|
*
|
|
1094
|
-
* Effect.runPromise(program).then(console.log)
|
|
1362
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1095
1363
|
* // 1
|
|
1096
1364
|
* ```
|
|
1097
1365
|
*
|
|
@@ -1106,6 +1374,7 @@ export declare const encodeSnapshot: (snapshot: Snapshot) => Effect.Effect<Uint8
|
|
|
1106
1374
|
* @example
|
|
1107
1375
|
* ```ts
|
|
1108
1376
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1377
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1109
1378
|
* import { ByteSize, Effect } from "effect"
|
|
1110
1379
|
*
|
|
1111
1380
|
* // Limits are mandatory: decoding is the boundary where untrusted input arrives.
|
|
@@ -1124,7 +1393,7 @@ export declare const encodeSnapshot: (snapshot: Snapshot) => Effect.Effect<Uint8
|
|
|
1124
1393
|
* )
|
|
1125
1394
|
* })
|
|
1126
1395
|
*
|
|
1127
|
-
* Effect.runPromise(program).then(console.log)
|
|
1396
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1128
1397
|
* // [ 'LimitExceeded', 'encodedBytes' ]
|
|
1129
1398
|
* ```
|
|
1130
1399
|
*
|
|
@@ -1170,18 +1439,7 @@ export declare const decodeSnapshot: (input: Uint8Array, limits: DecodeLimits) =
|
|
|
1170
1439
|
* @category snapshots
|
|
1171
1440
|
* @since 0.1.0
|
|
1172
1441
|
*/
|
|
1173
|
-
export declare const diffSnapshots: (base: Snapshot, target: Snapshot, limits?:
|
|
1174
|
-
readonly maxEncodedBytes: import("effect/ByteSize").ByteSize;
|
|
1175
|
-
readonly maxIdentityBytes: import("effect/ByteSize").ByteSize;
|
|
1176
|
-
readonly maxDeltaRecords: number;
|
|
1177
|
-
readonly maxDecodedDeltaBytes: import("effect/ByteSize").ByteSize;
|
|
1178
|
-
readonly maxBaseRecords: number;
|
|
1179
|
-
readonly maxTargetRecords: number;
|
|
1180
|
-
readonly maxEntries: number;
|
|
1181
|
-
readonly maxOutputRecords: number;
|
|
1182
|
-
readonly maxOutputBytes: import("effect/ByteSize").ByteSize;
|
|
1183
|
-
readonly maxInheritedRecords: number;
|
|
1184
|
-
} | undefined) => Effect.Effect<SnapshotDeltaModel.SnapshotDelta, VfsModel.ConfigurationError | ImageError | import("effect/PlatformError").PlatformError, import("effect/Crypto").Crypto>;
|
|
1442
|
+
export declare const diffSnapshots: (base: Snapshot, target: Snapshot, limits?: SnapshotDeltaModel.SnapshotDeltaLimits) => Effect.Effect<SnapshotDeltaModel.SnapshotDelta, ConfigurationError | ImageError | PlatformError.PlatformError, Crypto.Crypto>;
|
|
1185
1443
|
/**
|
|
1186
1444
|
* Verifies an exact snapshot delta against its base and derives an owned path-oriented summary.
|
|
1187
1445
|
* Requires the platform-neutral `Crypto.Crypto` service for base identity. Provide
|
|
@@ -1216,34 +1474,7 @@ export declare const diffSnapshots: (base: Snapshot, target: Snapshot, limits?:
|
|
|
1216
1474
|
* @category snapshots
|
|
1217
1475
|
* @since 0.1.0
|
|
1218
1476
|
*/
|
|
1219
|
-
export declare const inspectSnapshotDelta: (base: Snapshot, delta: SnapshotDeltaModel.SnapshotDelta, options?:
|
|
1220
|
-
readonly includeTimestamps?: boolean;
|
|
1221
|
-
} | undefined, limits?: {
|
|
1222
|
-
readonly maxEncodedBytes: import("effect/ByteSize").ByteSize;
|
|
1223
|
-
readonly maxIdentityBytes: import("effect/ByteSize").ByteSize;
|
|
1224
|
-
readonly maxDeltaRecords: number;
|
|
1225
|
-
readonly maxDecodedDeltaBytes: import("effect/ByteSize").ByteSize;
|
|
1226
|
-
readonly maxBaseRecords: number;
|
|
1227
|
-
readonly maxTargetRecords: number;
|
|
1228
|
-
readonly maxEntries: number;
|
|
1229
|
-
readonly maxOutputRecords: number;
|
|
1230
|
-
readonly maxOutputBytes: import("effect/ByteSize").ByteSize;
|
|
1231
|
-
readonly maxInheritedRecords: number;
|
|
1232
|
-
} | undefined) => Effect.Effect<readonly ({
|
|
1233
|
-
readonly _tag: "Added";
|
|
1234
|
-
readonly path: BytePath;
|
|
1235
|
-
readonly kind: "directory" | "file" | "symlink";
|
|
1236
|
-
} | {
|
|
1237
|
-
readonly _tag: "Removed";
|
|
1238
|
-
readonly path: BytePath;
|
|
1239
|
-
readonly kind: "directory" | "file" | "symlink";
|
|
1240
|
-
} | {
|
|
1241
|
-
readonly _tag: "Updated";
|
|
1242
|
-
readonly path: BytePath;
|
|
1243
|
-
readonly beforeKind: "directory" | "file" | "symlink";
|
|
1244
|
-
readonly afterKind: "directory" | "file" | "symlink";
|
|
1245
|
-
readonly differences: readonly ("atimeNs" | "birthtimeNs" | "content" | "ctimeNs" | "gid" | "hardLinks" | "kind" | "mode" | "mtimeNs" | "target" | "uid")[];
|
|
1246
|
-
})[], VfsModel.ConfigurationError | ImageError | import("effect/PlatformError").PlatformError | SnapshotDeltaModel.SnapshotDeltaError, import("effect/Crypto").Crypto>;
|
|
1477
|
+
export declare const inspectSnapshotDelta: (base: Snapshot, delta: SnapshotDeltaModel.SnapshotDelta, options?: SnapshotDeltaModel.SnapshotChangesOptions, limits?: SnapshotDeltaModel.SnapshotDeltaLimits) => Effect.Effect<ReadonlyArray<SnapshotDeltaModel.SnapshotChange>, ConfigurationError | ImageError | PlatformError.PlatformError | SnapshotDeltaModel.SnapshotDeltaError, Crypto.Crypto>;
|
|
1247
1478
|
/**
|
|
1248
1479
|
* Applies an exact delta to its semantically matching base and returns a new snapshot.
|
|
1249
1480
|
* Requires the platform-neutral `Crypto.Crypto` service for base identity. Provide
|
|
@@ -1283,18 +1514,7 @@ export declare const inspectSnapshotDelta: (base: Snapshot, delta: SnapshotDelta
|
|
|
1283
1514
|
* @category snapshots
|
|
1284
1515
|
* @since 0.1.0
|
|
1285
1516
|
*/
|
|
1286
|
-
export declare const applySnapshotDelta: (base: Snapshot, delta: SnapshotDeltaModel.SnapshotDelta, limits?:
|
|
1287
|
-
readonly maxEncodedBytes: import("effect/ByteSize").ByteSize;
|
|
1288
|
-
readonly maxIdentityBytes: import("effect/ByteSize").ByteSize;
|
|
1289
|
-
readonly maxDeltaRecords: number;
|
|
1290
|
-
readonly maxDecodedDeltaBytes: import("effect/ByteSize").ByteSize;
|
|
1291
|
-
readonly maxBaseRecords: number;
|
|
1292
|
-
readonly maxTargetRecords: number;
|
|
1293
|
-
readonly maxEntries: number;
|
|
1294
|
-
readonly maxOutputRecords: number;
|
|
1295
|
-
readonly maxOutputBytes: import("effect/ByteSize").ByteSize;
|
|
1296
|
-
readonly maxInheritedRecords: number;
|
|
1297
|
-
} | undefined) => Effect.Effect<Snapshot, VfsModel.ConfigurationError | ImageError | import("effect/PlatformError").PlatformError | SnapshotDeltaModel.SnapshotDeltaError, import("effect/Crypto").Crypto>;
|
|
1517
|
+
export declare const applySnapshotDelta: (base: Snapshot, delta: SnapshotDeltaModel.SnapshotDelta, limits?: SnapshotDeltaModel.SnapshotDeltaLimits) => Effect.Effect<Snapshot, ConfigurationError | ImageError | PlatformError.PlatformError | SnapshotDeltaModel.SnapshotDeltaError, Crypto.Crypto>;
|
|
1298
1518
|
/**
|
|
1299
1519
|
* Creates an Effect Schema codec between owned bytes and opaque snapshot deltas.
|
|
1300
1520
|
* Omission uses `SnapshotDeltaLimits.default`.
|
|
@@ -1381,6 +1601,7 @@ export declare const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array,
|
|
|
1381
1601
|
* @example
|
|
1382
1602
|
* ```ts
|
|
1383
1603
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1604
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1384
1605
|
* import { Effect, Schema } from "effect"
|
|
1385
1606
|
*
|
|
1386
1607
|
* // Fixtures must list every parent directory before its children.
|
|
@@ -1394,7 +1615,7 @@ export declare const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array,
|
|
|
1394
1615
|
* Effect.catchTag("ImageError", (error) => Effect.succeed(`rejected: ${error.code}`))
|
|
1395
1616
|
* )
|
|
1396
1617
|
*
|
|
1397
|
-
* Effect.runPromise(program).then(console.log)
|
|
1618
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1398
1619
|
* // rejected: InvalidStructure
|
|
1399
1620
|
* ```
|
|
1400
1621
|
*
|
|
@@ -1420,6 +1641,7 @@ export type Fixture = typeof Fixture.Type;
|
|
|
1420
1641
|
* @example
|
|
1421
1642
|
* ```ts
|
|
1422
1643
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1644
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1423
1645
|
* import { Effect } from "effect"
|
|
1424
1646
|
*
|
|
1425
1647
|
* const program = Effect.gen(function*() {
|
|
@@ -1432,7 +1654,7 @@ export type Fixture = typeof Fixture.Type;
|
|
|
1432
1654
|
* return yield* caller.readFile("/work/notes.txt")
|
|
1433
1655
|
* })
|
|
1434
1656
|
*
|
|
1435
|
-
* Effect.runPromise(program).then(console.log)
|
|
1657
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1436
1658
|
* // Uint8Array(2) [ 104, 105 ]
|
|
1437
1659
|
* ```
|
|
1438
1660
|
*
|
|
@@ -1440,13 +1662,14 @@ export type Fixture = typeof Fixture.Type;
|
|
|
1440
1662
|
* @category constructors
|
|
1441
1663
|
* @since 0.1.0
|
|
1442
1664
|
*/
|
|
1443
|
-
export declare const make: (options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError>;
|
|
1665
|
+
export declare const make: (options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | PlatformError.PlatformError, Crypto.Crypto>;
|
|
1444
1666
|
/**
|
|
1445
1667
|
* Restores a fresh volume from an opaque snapshot under the supplied destination limits.
|
|
1446
1668
|
*
|
|
1447
1669
|
* @example
|
|
1448
1670
|
* ```ts
|
|
1449
1671
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1672
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1450
1673
|
* import { Effect } from "effect"
|
|
1451
1674
|
*
|
|
1452
1675
|
* const program = Effect.gen(function*() {
|
|
@@ -1473,7 +1696,7 @@ export declare const make: (options?: VolumeOptions) => Effect.Effect<Volume, Co
|
|
|
1473
1696
|
* ]
|
|
1474
1697
|
* })
|
|
1475
1698
|
*
|
|
1476
|
-
* Effect.runPromise(program).then(console.log)
|
|
1699
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1477
1700
|
* // [ 'one', 'two' ]
|
|
1478
1701
|
* ```
|
|
1479
1702
|
*
|
|
@@ -1481,7 +1704,7 @@ export declare const make: (options?: VolumeOptions) => Effect.Effect<Volume, Co
|
|
|
1481
1704
|
* @category constructors
|
|
1482
1705
|
* @since 0.1.0
|
|
1483
1706
|
*/
|
|
1484
|
-
export declare const fromSnapshot: (snapshot: Snapshot, options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | ImageError>;
|
|
1707
|
+
export declare const fromSnapshot: (snapshot: Snapshot, options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | ImageError | PlatformError.PlatformError, Crypto.Crypto>;
|
|
1485
1708
|
/**
|
|
1486
1709
|
* Creates an isolated writable volume relative to one immutable snapshot base.
|
|
1487
1710
|
*
|
|
@@ -1498,6 +1721,7 @@ export declare const fromSnapshot: (snapshot: Snapshot, options?: VolumeOptions)
|
|
|
1498
1721
|
* @example
|
|
1499
1722
|
* ```ts
|
|
1500
1723
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1724
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1501
1725
|
* import { Effect } from "effect"
|
|
1502
1726
|
*
|
|
1503
1727
|
* const program = Effect.gen(function*() {
|
|
@@ -1523,7 +1747,7 @@ export declare const fromSnapshot: (snapshot: Snapshot, options?: VolumeOptions)
|
|
|
1523
1747
|
* ]
|
|
1524
1748
|
* })
|
|
1525
1749
|
*
|
|
1526
|
-
* Effect.runPromise(program).then(console.log)
|
|
1750
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1527
1751
|
* // [ '{}', [ 'Updated' ] ]
|
|
1528
1752
|
* ```
|
|
1529
1753
|
*
|
|
@@ -1531,13 +1755,14 @@ export declare const fromSnapshot: (snapshot: Snapshot, options?: VolumeOptions)
|
|
|
1531
1755
|
* @category constructors
|
|
1532
1756
|
* @since 0.1.0
|
|
1533
1757
|
*/
|
|
1534
|
-
export declare const makeOverlay: (base: Snapshot, options?: VolumeOptions) => Effect.Effect<OverlayVolume, ConfigurationError | ImageError>;
|
|
1758
|
+
export declare const makeOverlay: (base: Snapshot, options?: VolumeOptions) => Effect.Effect<OverlayVolume, ConfigurationError | ImageError | PlatformError.PlatformError, Crypto.Crypto>;
|
|
1535
1759
|
/**
|
|
1536
1760
|
* Builds a fresh volume from a validated final-state fixture.
|
|
1537
1761
|
*
|
|
1538
1762
|
* @example
|
|
1539
1763
|
* ```ts
|
|
1540
1764
|
* import { VirtualFileSystem as Vfs } from "@effect-vfs/core"
|
|
1765
|
+
* import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto"
|
|
1541
1766
|
* import { Effect } from "effect"
|
|
1542
1767
|
*
|
|
1543
1768
|
* const encoder = new TextEncoder()
|
|
@@ -1559,7 +1784,7 @@ export declare const makeOverlay: (base: Snapshot, options?: VolumeOptions) => E
|
|
|
1559
1784
|
* return yield* (yield* volume.caller()).readDirectory("/project")
|
|
1560
1785
|
* })
|
|
1561
1786
|
*
|
|
1562
|
-
* Effect.runPromise(program).then(console.log)
|
|
1787
|
+
* Effect.runPromise(program.pipe(Effect.provide(NodeCrypto.layer))).then(console.log)
|
|
1563
1788
|
* // [ 'package.json', 'latest' ]
|
|
1564
1789
|
* ```
|
|
1565
1790
|
*
|
|
@@ -1567,5 +1792,5 @@ export declare const makeOverlay: (base: Snapshot, options?: VolumeOptions) => E
|
|
|
1567
1792
|
* @category constructors
|
|
1568
1793
|
* @since 0.1.0
|
|
1569
1794
|
*/
|
|
1570
|
-
export declare const fromFixture: (fixture: Fixture, options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | ImageError>;
|
|
1795
|
+
export declare const fromFixture: (fixture: Fixture, options?: VolumeOptions) => Effect.Effect<Volume, ConfigurationError | ImageError | PlatformError.PlatformError, Crypto.Crypto>;
|
|
1571
1796
|
//# sourceMappingURL=VirtualFileSystem.d.ts.map
|