@effect-vfs/core 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +29 -21
  2. package/dist/BytePath.d.ts +115 -4
  3. package/dist/BytePath.d.ts.map +1 -1
  4. package/dist/BytePath.js +155 -0
  5. package/dist/Caller.d.ts +391 -0
  6. package/dist/Caller.d.ts.map +1 -0
  7. package/dist/Caller.js +199 -0
  8. package/dist/FileHandle.d.ts +50 -0
  9. package/dist/FileHandle.d.ts.map +1 -0
  10. package/dist/FileHandle.js +28 -0
  11. package/dist/Fixture.d.ts +155 -0
  12. package/dist/Fixture.d.ts.map +1 -0
  13. package/dist/Fixture.js +65 -0
  14. package/dist/LiveVolume.d.ts +13 -20
  15. package/dist/LiveVolume.d.ts.map +1 -1
  16. package/dist/LiveVolume.js +19 -14
  17. package/dist/Metadata.d.ts +186 -0
  18. package/dist/Metadata.d.ts.map +1 -0
  19. package/dist/Metadata.js +125 -0
  20. package/dist/Snapshot.d.ts +32 -53
  21. package/dist/Snapshot.d.ts.map +1 -1
  22. package/dist/Snapshot.js +27 -49
  23. package/dist/SnapshotDelta.d.ts +24 -39
  24. package/dist/SnapshotDelta.d.ts.map +1 -1
  25. package/dist/SnapshotDelta.js +14 -35
  26. package/dist/Target.d.ts +225 -0
  27. package/dist/Target.d.ts.map +1 -0
  28. package/dist/Target.js +92 -0
  29. package/dist/Testing.d.ts +132 -0
  30. package/dist/Testing.d.ts.map +1 -0
  31. package/dist/Testing.js +100 -0
  32. package/dist/VfsError.d.ts +200 -0
  33. package/dist/VfsError.d.ts.map +1 -0
  34. package/dist/VfsError.js +165 -0
  35. package/dist/VirtualFileSystem.d.ts +676 -353
  36. package/dist/VirtualFileSystem.d.ts.map +1 -1
  37. package/dist/VirtualFileSystem.js +487 -121
  38. package/dist/Volume.d.ts +211 -0
  39. package/dist/Volume.d.ts.map +1 -0
  40. package/dist/Volume.js +172 -0
  41. package/dist/Watch.d.ts +68 -0
  42. package/dist/Watch.d.ts.map +1 -0
  43. package/dist/Watch.js +46 -0
  44. package/dist/index.d.ts +56 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +56 -1
  47. package/dist/internal/budget.d.ts +90 -0
  48. package/dist/internal/budget.d.ts.map +1 -0
  49. package/dist/internal/budget.js +70 -0
  50. package/dist/internal/bytePath.d.ts +2 -0
  51. package/dist/internal/bytePath.d.ts.map +1 -1
  52. package/dist/internal/bytePath.js +3 -2
  53. package/dist/internal/bytes.d.ts +3 -0
  54. package/dist/internal/bytes.d.ts.map +1 -1
  55. package/dist/internal/bytes.js +4 -2
  56. package/dist/internal/canonicalBase64.d.ts +1 -4
  57. package/dist/internal/canonicalBase64.d.ts.map +1 -1
  58. package/dist/internal/canonicalBase64.js +9 -13
  59. package/dist/internal/errors.d.ts +47 -5
  60. package/dist/internal/errors.d.ts.map +1 -1
  61. package/dist/internal/errors.js +80 -36
  62. package/dist/internal/fixture.d.ts +2 -2
  63. package/dist/internal/fixture.d.ts.map +1 -1
  64. package/dist/internal/fixture.js +57 -74
  65. package/dist/internal/hex128.d.ts +12 -0
  66. package/dist/internal/hex128.d.ts.map +1 -0
  67. package/dist/internal/hex128.js +7 -0
  68. package/dist/internal/hmac.d.ts +5 -0
  69. package/dist/internal/hmac.d.ts.map +1 -0
  70. package/dist/internal/hmac.js +150 -0
  71. package/dist/internal/image.d.ts +14 -117
  72. package/dist/internal/image.d.ts.map +1 -1
  73. package/dist/internal/image.js +137 -167
  74. package/dist/internal/inodeTable.d.ts +20 -0
  75. package/dist/internal/inodeTable.d.ts.map +1 -0
  76. package/dist/internal/inodeTable.js +48 -0
  77. package/dist/internal/lines.d.ts +36 -0
  78. package/dist/internal/lines.d.ts.map +1 -0
  79. package/dist/internal/lines.js +115 -0
  80. package/dist/internal/liveImage.d.ts +19 -278
  81. package/dist/internal/liveImage.d.ts.map +1 -1
  82. package/dist/internal/liveImage.js +75 -166
  83. package/dist/internal/merkle.d.ts +45 -0
  84. package/dist/internal/merkle.d.ts.map +1 -0
  85. package/dist/internal/merkle.js +179 -0
  86. package/dist/internal/metadata.d.ts +2 -13
  87. package/dist/internal/metadata.d.ts.map +1 -1
  88. package/dist/internal/metadata.js +5 -15
  89. package/dist/internal/overlayDiff.d.ts +2 -2
  90. package/dist/internal/overlayDiff.d.ts.map +1 -1
  91. package/dist/internal/overlayDiff.js +4 -15
  92. package/dist/internal/path.d.ts +17 -5
  93. package/dist/internal/path.d.ts.map +1 -1
  94. package/dist/internal/path.js +38 -24
  95. package/dist/internal/snapshotDelta.d.ts +61 -60
  96. package/dist/internal/snapshotDelta.d.ts.map +1 -1
  97. package/dist/internal/snapshotDelta.js +605 -503
  98. package/dist/internal/snapshotDeltaModel.d.ts.map +1 -1
  99. package/dist/internal/snapshotDeltaModel.js +0 -1
  100. package/dist/internal/testSeams.d.ts +17 -0
  101. package/dist/internal/testSeams.d.ts.map +1 -0
  102. package/dist/internal/testSeams.js +20 -0
  103. package/dist/internal/tree.d.ts +225 -0
  104. package/dist/internal/tree.d.ts.map +1 -0
  105. package/dist/internal/tree.js +385 -0
  106. package/dist/internal/turnstile.d.ts +8 -0
  107. package/dist/internal/turnstile.d.ts.map +1 -0
  108. package/dist/internal/turnstile.js +43 -0
  109. package/dist/internal/virtualFileSystem.d.ts +44 -488
  110. package/dist/internal/virtualFileSystem.d.ts.map +1 -1
  111. package/dist/internal/virtualFileSystem.js +2111 -2466
  112. package/dist/internal/volumeState.d.ts +111 -0
  113. package/dist/internal/volumeState.d.ts.map +1 -0
  114. package/dist/internal/volumeState.js +202 -0
  115. package/dist/internal/watchHub.d.ts +15 -6
  116. package/dist/internal/watchHub.d.ts.map +1 -1
  117. package/dist/internal/watchHub.js +56 -42
  118. package/package.json +54 -10
  119. package/dist/VirtualFileSystemError.d.ts +0 -54
  120. package/dist/VirtualFileSystemError.d.ts.map +0 -1
  121. package/dist/VirtualFileSystemError.js +0 -49
  122. package/dist/internal/overlayContent.d.ts +0 -15
  123. package/dist/internal/overlayContent.d.ts.map +0 -1
  124. package/dist/internal/overlayContent.js +0 -29
  125. package/dist/internal/stagedState.d.ts +0 -22
  126. package/dist/internal/stagedState.d.ts.map +0 -1
  127. package/dist/internal/stagedState.js +0 -62
  128. package/dist/internal/testHooks.d.ts +0 -20
  129. package/dist/internal/testHooks.d.ts.map +0 -1
  130. package/dist/internal/testHooks.js +0 -23
@@ -0,0 +1,391 @@
1
+ import * as Schema from "effect/Schema";
2
+ import type { ObjectReference } from "./VirtualFileSystem.js";
3
+ /**
4
+ * Brand key that marks a caller.
5
+ *
6
+ * @category type IDs
7
+ * @since 0.6.0
8
+ */
9
+ export declare const CallerId: unique symbol;
10
+ /**
11
+ * Brand key that marks a caller.
12
+ *
13
+ * @category type IDs
14
+ * @since 0.6.0
15
+ */
16
+ export type CallerId = typeof CallerId;
17
+ /**
18
+ * Brand key that marks an object reference.
19
+ *
20
+ * @category type IDs
21
+ * @since 0.6.0
22
+ */
23
+ export declare const ObjectReferenceId: unique symbol;
24
+ /**
25
+ * Brand key that marks an object reference.
26
+ *
27
+ * @category type IDs
28
+ * @since 0.6.0
29
+ */
30
+ export type ObjectReferenceId = typeof ObjectReferenceId;
31
+ /**
32
+ * Schema for a caller's credentials. `privileged` is explicit; uid zero alone
33
+ * grants nothing.
34
+ *
35
+ * @category schemas
36
+ * @since 0.6.0
37
+ */
38
+ export declare const Identity: Schema.Struct<{
39
+ readonly uid: Schema.Natural;
40
+ readonly gid: Schema.Natural;
41
+ readonly groups: Schema.$Array<Schema.Natural>;
42
+ readonly privileged: Schema.Boolean;
43
+ }>;
44
+ /**
45
+ * A caller's credentials.
46
+ *
47
+ * @category models
48
+ * @since 0.6.0
49
+ */
50
+ export type Identity = typeof Identity.Type;
51
+ /**
52
+ * Schema for the options of a root caller.
53
+ *
54
+ * @category schemas
55
+ * @since 0.6.0
56
+ */
57
+ export declare const RootCallerOptions: Schema.Struct<{
58
+ readonly identity: Schema.optionalKey<Schema.Struct<{
59
+ readonly uid: Schema.Natural;
60
+ readonly gid: Schema.Natural;
61
+ readonly groups: Schema.$Array<Schema.Natural>;
62
+ readonly privileged: Schema.Boolean;
63
+ }>>;
64
+ readonly umask: Schema.optionalKey<Schema.Natural>;
65
+ }>;
66
+ /**
67
+ * Options of a root caller.
68
+ *
69
+ * @category models
70
+ * @since 0.6.0
71
+ */
72
+ export type RootCallerOptions = typeof RootCallerOptions.Type;
73
+ /**
74
+ * Schema for the options of `open` on a target: the access mode, whether a
75
+ * missing file is created, the creation mode, and append and truncate flags.
76
+ *
77
+ * @category schemas
78
+ * @since 0.6.0
79
+ */
80
+ export declare const OpenOptions: Schema.Struct<{
81
+ readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
82
+ readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
83
+ readonly mode: Schema.optionalKey<Schema.Natural>;
84
+ readonly append: Schema.optionalKey<Schema.Boolean>;
85
+ readonly truncate: Schema.optionalKey<Schema.Boolean>;
86
+ }>;
87
+ /**
88
+ * Options of `open` on a target.
89
+ *
90
+ * @category models
91
+ * @since 0.6.0
92
+ */
93
+ export type OpenOptions = typeof OpenOptions.Type;
94
+ /**
95
+ * Schema for the options of `writeFile`: the open options plus whether a
96
+ * final symbolic link is replaced or followed and the mode the file ends with.
97
+ *
98
+ * @category schemas
99
+ * @since 0.6.0
100
+ */
101
+ export declare const WriteFileOptions: Schema.Struct<{
102
+ readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
103
+ readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
104
+ readonly mode: Schema.optionalKey<Schema.Natural>;
105
+ readonly append: Schema.optionalKey<Schema.Boolean>;
106
+ readonly truncate: Schema.optionalKey<Schema.Boolean>;
107
+ readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
108
+ readonly replaceFinalSymlink: Schema.optionalKey<Schema.Boolean>;
109
+ readonly finalMode: Schema.optionalKey<Schema.Natural>;
110
+ }>;
111
+ /**
112
+ * Options of `writeFile`.
113
+ *
114
+ * @category models
115
+ * @since 0.6.0
116
+ */
117
+ export type WriteFileOptions = typeof WriteFileOptions.Type;
118
+ /**
119
+ * Schema for a directory's revision before and after a change.
120
+ *
121
+ * @category schemas
122
+ * @since 0.6.0
123
+ */
124
+ export declare const DirectoryChange: Schema.Struct<{
125
+ readonly before: Schema.BigInt;
126
+ readonly after: Schema.BigInt;
127
+ }>;
128
+ /**
129
+ * A directory's revision before and after a change.
130
+ *
131
+ * @category models
132
+ * @since 0.6.0
133
+ */
134
+ export type DirectoryChange = typeof DirectoryChange.Type;
135
+ /**
136
+ * Schema for the result of `rename`.
137
+ *
138
+ * @category schemas
139
+ * @since 0.6.0
140
+ */
141
+ export declare const RenameReferenceResult: Schema.TaggedUnion<{
142
+ readonly DifferentDirectories: Schema.TaggedStruct<"DifferentDirectories", {
143
+ readonly sourceDirectory: Schema.Struct<{
144
+ readonly before: Schema.BigInt;
145
+ readonly after: Schema.BigInt;
146
+ }>;
147
+ readonly destinationDirectory: Schema.Struct<{
148
+ readonly before: Schema.BigInt;
149
+ readonly after: Schema.BigInt;
150
+ }>;
151
+ }>;
152
+ readonly SameDirectory: Schema.TaggedStruct<"SameDirectory", {
153
+ readonly directory: Schema.Struct<{
154
+ readonly before: Schema.BigInt;
155
+ readonly after: Schema.BigInt;
156
+ }>;
157
+ }>;
158
+ }>;
159
+ /**
160
+ * The result of `rename`.
161
+ *
162
+ * @category models
163
+ * @since 0.6.0
164
+ */
165
+ export type RenameReferenceResult = typeof RenameReferenceResult.Type;
166
+ /**
167
+ * Schema for the options of `mkdir`. `exactMode` skips the caller's umask for
168
+ * an explicit creation mode; permission policy still applies. `recursive`
169
+ * creates every missing directory on the path in one change, as `mkdir -p`
170
+ * does, and succeeds when the final directory already exists; the mode
171
+ * applies to every directory it creates and the times to the final one.
172
+ *
173
+ * @category schemas
174
+ * @since 0.6.0
175
+ */
176
+ export declare const MkdirOptions: Schema.Struct<{
177
+ readonly mode: Schema.optionalKey<Schema.Natural>;
178
+ readonly exactMode: Schema.optionalKey<Schema.Boolean>;
179
+ readonly times: Schema.optionalKey<Schema.Struct<{
180
+ readonly access: Schema.Union<readonly [Schema.Struct<{
181
+ readonly kind: Schema.Literal<"now">;
182
+ }>, Schema.Struct<{
183
+ readonly kind: Schema.Literal<"omit">;
184
+ }>, Schema.Struct<{
185
+ readonly kind: Schema.Literal<"value">;
186
+ readonly nanoseconds: Schema.BigInt;
187
+ }>]>;
188
+ readonly modification: Schema.Union<readonly [Schema.Struct<{
189
+ readonly kind: Schema.Literal<"now">;
190
+ }>, Schema.Struct<{
191
+ readonly kind: Schema.Literal<"omit">;
192
+ }>, Schema.Struct<{
193
+ readonly kind: Schema.Literal<"value">;
194
+ readonly nanoseconds: Schema.BigInt;
195
+ }>]>;
196
+ }>>;
197
+ readonly recursive: Schema.optionalKey<Schema.Boolean>;
198
+ }>;
199
+ /**
200
+ * Options of `mkdir`.
201
+ *
202
+ * @category models
203
+ * @since 0.6.0
204
+ */
205
+ export type MkdirOptions = typeof MkdirOptions.Type;
206
+ /**
207
+ * Schema for the options of `walk`: the order entries arrive in and the
208
+ * optional bounds on how deep, how many, and how many bytes the walk may
209
+ * reach. `order` defaults to `"pre"`, each directory before its entries; a
210
+ * `"post"` walk reports each directory after them. Every bound defaults to
211
+ * unbounded, and a walk that would pass one fails with `LimitExceeded` naming
212
+ * the bound in `field`.
213
+ *
214
+ * @category schemas
215
+ * @since 0.6.0
216
+ */
217
+ export declare const WalkOptions: Schema.Struct<{
218
+ readonly order: Schema.optionalKey<Schema.Literals<readonly ["pre", "post"]>>;
219
+ readonly maxDepth: Schema.optionalKey<Schema.Natural>;
220
+ readonly maxEntries: Schema.optionalKey<Schema.Natural>;
221
+ readonly maxBytes: Schema.optionalKey<Schema.ByteSize>;
222
+ }>;
223
+ /**
224
+ * Options of `walk`.
225
+ *
226
+ * @category models
227
+ * @since 0.6.0
228
+ */
229
+ export type WalkOptions = typeof WalkOptions.Type;
230
+ /**
231
+ * Schema for the options of `remove`. `recursive` removes a directory and
232
+ * everything under it; `force` succeeds when the target itself is missing.
233
+ *
234
+ * @category schemas
235
+ * @since 0.6.0
236
+ */
237
+ export declare const RemoveOptions: Schema.Struct<{
238
+ readonly recursive: Schema.optionalKey<Schema.Boolean>;
239
+ readonly force: Schema.optionalKey<Schema.Boolean>;
240
+ }>;
241
+ /**
242
+ * Options of `remove`.
243
+ *
244
+ * @category models
245
+ * @since 0.6.0
246
+ */
247
+ export type RemoveOptions = typeof RemoveOptions.Type;
248
+ /**
249
+ * Schema for the options of `symlink`.
250
+ *
251
+ * @category schemas
252
+ * @since 0.6.0
253
+ */
254
+ export declare const SymlinkOptions: Schema.Struct<{
255
+ readonly times: Schema.optionalKey<Schema.Struct<{
256
+ readonly access: Schema.Union<readonly [Schema.Struct<{
257
+ readonly kind: Schema.Literal<"now">;
258
+ }>, Schema.Struct<{
259
+ readonly kind: Schema.Literal<"omit">;
260
+ }>, Schema.Struct<{
261
+ readonly kind: Schema.Literal<"value">;
262
+ readonly nanoseconds: Schema.BigInt;
263
+ }>]>;
264
+ readonly modification: Schema.Union<readonly [Schema.Struct<{
265
+ readonly kind: Schema.Literal<"now">;
266
+ }>, Schema.Struct<{
267
+ readonly kind: Schema.Literal<"omit">;
268
+ }>, Schema.Struct<{
269
+ readonly kind: Schema.Literal<"value">;
270
+ readonly nanoseconds: Schema.BigInt;
271
+ }>]>;
272
+ }>>;
273
+ }>;
274
+ /**
275
+ * Options of `symlink`.
276
+ *
277
+ * @category models
278
+ * @since 0.6.0
279
+ */
280
+ export type SymlinkOptions = typeof SymlinkOptions.Type;
281
+ /**
282
+ * Schema for the attributes `setattr` changes together: a regular file's
283
+ * size, the permission mode, the owner, and the access and modification
284
+ * times. An omitted attribute keeps its current value. `expected` pins the
285
+ * target's revision the caller last observed, checked inside the same change,
286
+ * and fails as `StaleReference` naming `expected` when the target has moved
287
+ * on, so a change decided from that observation never applies to a newer one.
288
+ *
289
+ * @category schemas
290
+ * @since 0.6.0
291
+ */
292
+ export declare const SetattrOptions: Schema.Struct<{
293
+ readonly size: Schema.optionalKey<Schema.BigInt>;
294
+ readonly mode: Schema.optionalKey<Schema.Natural>;
295
+ readonly owner: Schema.optionalKey<Schema.Struct<{
296
+ readonly uid: Schema.optionalKey<Schema.Natural>;
297
+ readonly gid: Schema.optionalKey<Schema.Natural>;
298
+ }>>;
299
+ readonly times: Schema.optionalKey<Schema.Struct<{
300
+ readonly access: Schema.Union<readonly [Schema.Struct<{
301
+ readonly kind: Schema.Literal<"now">;
302
+ }>, Schema.Struct<{
303
+ readonly kind: Schema.Literal<"omit">;
304
+ }>, Schema.Struct<{
305
+ readonly kind: Schema.Literal<"value">;
306
+ readonly nanoseconds: Schema.BigInt;
307
+ }>]>;
308
+ readonly modification: Schema.Union<readonly [Schema.Struct<{
309
+ readonly kind: Schema.Literal<"now">;
310
+ }>, Schema.Struct<{
311
+ readonly kind: Schema.Literal<"omit">;
312
+ }>, Schema.Struct<{
313
+ readonly kind: Schema.Literal<"value">;
314
+ readonly nanoseconds: Schema.BigInt;
315
+ }>]>;
316
+ }>>;
317
+ readonly expected: Schema.optionalKey<Schema.Struct<{
318
+ readonly revision: Schema.BigInt;
319
+ }>>;
320
+ }>;
321
+ /**
322
+ * Attributes of `setattr`.
323
+ *
324
+ * @category models
325
+ * @since 0.6.0
326
+ */
327
+ export type SetattrOptions = typeof SetattrOptions.Type;
328
+ /**
329
+ * Schema for an object reference: any value carrying the reference brand. Whether the volume issued it is checked
330
+ * where it is used.
331
+ *
332
+ * @internal
333
+ */
334
+ export declare const ObjectReferenceSchema: Schema.declare<ObjectReference, ObjectReference>;
335
+ /**
336
+ * Schema for the options of `open` on an entry, a lookup-or-create-and-open in
337
+ * one gate hold. `expected` pins the child the caller last observed under the
338
+ * name (or `null` for none) and fails as `VolumeBusy` when another has
339
+ * appeared; `expectedChild` pins its revision and times as well and fails as
340
+ * `StaleReference` when they moved.
341
+ *
342
+ * @category schemas
343
+ * @since 0.6.0
344
+ */
345
+ export declare const OpenEntryOptions: Schema.Struct<{
346
+ readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
347
+ readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
348
+ readonly mode: Schema.optionalKey<Schema.Natural>;
349
+ readonly append: Schema.optionalKey<Schema.Boolean>;
350
+ readonly truncate: Schema.optionalKey<Schema.Boolean>;
351
+ readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
352
+ readonly times: Schema.optionalKey<Schema.Struct<{
353
+ readonly access: Schema.Union<readonly [Schema.Struct<{
354
+ readonly kind: Schema.Literal<"now">;
355
+ }>, Schema.Struct<{
356
+ readonly kind: Schema.Literal<"omit">;
357
+ }>, Schema.Struct<{
358
+ readonly kind: Schema.Literal<"value">;
359
+ readonly nanoseconds: Schema.BigInt;
360
+ }>]>;
361
+ readonly modification: Schema.Union<readonly [Schema.Struct<{
362
+ readonly kind: Schema.Literal<"now">;
363
+ }>, Schema.Struct<{
364
+ readonly kind: Schema.Literal<"omit">;
365
+ }>, Schema.Struct<{
366
+ readonly kind: Schema.Literal<"value">;
367
+ readonly nanoseconds: Schema.BigInt;
368
+ }>]>;
369
+ }>>;
370
+ readonly initialSize: Schema.optionalKey<Schema.BigInt>;
371
+ readonly exactMode: Schema.optionalKey<Schema.Boolean>;
372
+ readonly owner: Schema.optionalKey<Schema.Struct<{
373
+ readonly uid: Schema.optionalKey<Schema.Natural>;
374
+ readonly gid: Schema.optionalKey<Schema.Natural>;
375
+ }>>;
376
+ readonly expected: Schema.optionalKey<Schema.NullOr<Schema.declare<ObjectReference, ObjectReference>>>;
377
+ readonly expectedChild: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
378
+ readonly reference: Schema.declare<ObjectReference, ObjectReference>;
379
+ readonly revision: Schema.BigInt;
380
+ readonly atimeNs: Schema.BigInt;
381
+ readonly mtimeNs: Schema.BigInt;
382
+ }>>>;
383
+ }>;
384
+ /**
385
+ * Options of `open` on an entry.
386
+ *
387
+ * @category models
388
+ * @since 0.6.0
389
+ */
390
+ export type OpenEntryOptions = typeof OpenEntryOptions.Type;
391
+ //# sourceMappingURL=Caller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Caller.d.ts","sourceRoot":"","sources":["../src/Caller.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,MAA8C,CAAA;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,MAAuD,CAAA;AAE9F;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;;;;;EAKnB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;EAG5B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;;EAMtB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAK3B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;EAMhC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAA;AAErE;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;EAKvB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW;;;;;EAKtB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;EAGxB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAEzB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,kDAEjC,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAA"}
package/dist/Caller.js ADDED
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Caller identity brands and schemas: credentials, root caller options, and
3
+ * the settings and results of the operations a caller performs.
4
+ *
5
+ * @since 0.6.0
6
+ */
7
+ import * as Predicate from "effect/Predicate";
8
+ import * as Schema from "effect/Schema";
9
+ import { Mode, OwnerUpdate, Times, Timestamp } from "./Metadata.js";
10
+ /**
11
+ * Brand key that marks a caller.
12
+ *
13
+ * @category type IDs
14
+ * @since 0.6.0
15
+ */
16
+ export const CallerId = Symbol.for("@effect-vfs/core/Caller");
17
+ /**
18
+ * Brand key that marks an object reference.
19
+ *
20
+ * @category type IDs
21
+ * @since 0.6.0
22
+ */
23
+ export const ObjectReferenceId = Symbol.for("@effect-vfs/core/ObjectReference");
24
+ /**
25
+ * Schema for a caller's credentials. `privileged` is explicit; uid zero alone
26
+ * grants nothing.
27
+ *
28
+ * @category schemas
29
+ * @since 0.6.0
30
+ */
31
+ export const Identity = Schema.Struct({
32
+ uid: Schema.Natural,
33
+ gid: Schema.Natural,
34
+ groups: Schema.Array(Schema.Natural),
35
+ privileged: Schema.Boolean
36
+ });
37
+ /**
38
+ * Schema for the options of a root caller.
39
+ *
40
+ * @category schemas
41
+ * @since 0.6.0
42
+ */
43
+ export const RootCallerOptions = Schema.Struct({
44
+ identity: Schema.optionalKey(Identity),
45
+ umask: Schema.optionalKey(Schema.Natural.check(Schema.isLessThanOrEqualTo(0o777)))
46
+ });
47
+ /**
48
+ * Schema for the options of `open` on a target: the access mode, whether a
49
+ * missing file is created, the creation mode, and append and truncate flags.
50
+ *
51
+ * @category schemas
52
+ * @since 0.6.0
53
+ */
54
+ export const OpenOptions = Schema.Struct({
55
+ access: Schema.Literals(["read", "write", "readWrite"]),
56
+ create: Schema.optionalKey(Schema.Literals(["never", "ifMissing", "exclusive"])),
57
+ mode: Schema.optionalKey(Mode),
58
+ append: Schema.optionalKey(Schema.Boolean),
59
+ truncate: Schema.optionalKey(Schema.Boolean)
60
+ });
61
+ /**
62
+ * Schema for the options of `writeFile`: the open options plus whether a
63
+ * final symbolic link is replaced or followed and the mode the file ends with.
64
+ *
65
+ * @category schemas
66
+ * @since 0.6.0
67
+ */
68
+ export const WriteFileOptions = Schema.Struct({
69
+ ...OpenOptions.fields,
70
+ followFinalSymlink: Schema.optionalKey(Schema.Boolean),
71
+ replaceFinalSymlink: Schema.optionalKey(Schema.Boolean),
72
+ finalMode: Schema.optionalKey(Mode)
73
+ });
74
+ /**
75
+ * Schema for a directory's revision before and after a change.
76
+ *
77
+ * @category schemas
78
+ * @since 0.6.0
79
+ */
80
+ export const DirectoryChange = Schema.Struct({
81
+ before: Schema.BigInt,
82
+ after: Schema.BigInt
83
+ });
84
+ /**
85
+ * Schema for the result of `rename`.
86
+ *
87
+ * @category schemas
88
+ * @since 0.6.0
89
+ */
90
+ export const RenameReferenceResult = Schema.TaggedUnion({
91
+ SameDirectory: { directory: DirectoryChange },
92
+ DifferentDirectories: {
93
+ sourceDirectory: DirectoryChange,
94
+ destinationDirectory: DirectoryChange
95
+ }
96
+ });
97
+ /**
98
+ * Schema for the options of `mkdir`. `exactMode` skips the caller's umask for
99
+ * an explicit creation mode; permission policy still applies. `recursive`
100
+ * creates every missing directory on the path in one change, as `mkdir -p`
101
+ * does, and succeeds when the final directory already exists; the mode
102
+ * applies to every directory it creates and the times to the final one.
103
+ *
104
+ * @category schemas
105
+ * @since 0.6.0
106
+ */
107
+ export const MkdirOptions = Schema.Struct({
108
+ mode: Schema.optionalKey(Mode),
109
+ exactMode: Schema.optionalKey(Schema.Boolean),
110
+ times: Schema.optionalKey(Times),
111
+ recursive: Schema.optionalKey(Schema.Boolean)
112
+ });
113
+ /**
114
+ * Schema for the options of `walk`: the order entries arrive in and the
115
+ * optional bounds on how deep, how many, and how many bytes the walk may
116
+ * reach. `order` defaults to `"pre"`, each directory before its entries; a
117
+ * `"post"` walk reports each directory after them. Every bound defaults to
118
+ * unbounded, and a walk that would pass one fails with `LimitExceeded` naming
119
+ * the bound in `field`.
120
+ *
121
+ * @category schemas
122
+ * @since 0.6.0
123
+ */
124
+ export const WalkOptions = Schema.Struct({
125
+ order: Schema.optionalKey(Schema.Literals(["pre", "post"])),
126
+ maxDepth: Schema.optionalKey(Schema.Natural),
127
+ maxEntries: Schema.optionalKey(Schema.Natural),
128
+ maxBytes: Schema.optionalKey(Schema.ByteSize)
129
+ });
130
+ /**
131
+ * Schema for the options of `remove`. `recursive` removes a directory and
132
+ * everything under it; `force` succeeds when the target itself is missing.
133
+ *
134
+ * @category schemas
135
+ * @since 0.6.0
136
+ */
137
+ export const RemoveOptions = Schema.Struct({
138
+ recursive: Schema.optionalKey(Schema.Boolean),
139
+ force: Schema.optionalKey(Schema.Boolean)
140
+ });
141
+ /**
142
+ * Schema for the options of `symlink`.
143
+ *
144
+ * @category schemas
145
+ * @since 0.6.0
146
+ */
147
+ export const SymlinkOptions = Schema.Struct({
148
+ times: Schema.optionalKey(Times)
149
+ });
150
+ /**
151
+ * Schema for the attributes `setattr` changes together: a regular file's
152
+ * size, the permission mode, the owner, and the access and modification
153
+ * times. An omitted attribute keeps its current value. `expected` pins the
154
+ * target's revision the caller last observed, checked inside the same change,
155
+ * and fails as `StaleReference` naming `expected` when the target has moved
156
+ * on, so a change decided from that observation never applies to a newer one.
157
+ *
158
+ * @category schemas
159
+ * @since 0.6.0
160
+ */
161
+ export const SetattrOptions = Schema.Struct({
162
+ size: Schema.optionalKey(Schema.BigInt.check(Schema.isGreaterThanOrEqualToBigInt(0n))),
163
+ mode: Schema.optionalKey(Mode),
164
+ owner: Schema.optionalKey(OwnerUpdate),
165
+ times: Schema.optionalKey(Times),
166
+ expected: Schema.optionalKey(Schema.Struct({ revision: Schema.BigInt }))
167
+ });
168
+ /**
169
+ * Schema for an object reference: any value carrying the reference brand. Whether the volume issued it is checked
170
+ * where it is used.
171
+ *
172
+ * @internal
173
+ */
174
+ export const ObjectReferenceSchema = Schema.declare((input) => Predicate.hasProperty(ObjectReferenceId)(input) && input[ObjectReferenceId] === true);
175
+ /**
176
+ * Schema for the options of `open` on an entry, a lookup-or-create-and-open in
177
+ * one gate hold. `expected` pins the child the caller last observed under the
178
+ * name (or `null` for none) and fails as `VolumeBusy` when another has
179
+ * appeared; `expectedChild` pins its revision and times as well and fails as
180
+ * `StaleReference` when they moved.
181
+ *
182
+ * @category schemas
183
+ * @since 0.6.0
184
+ */
185
+ export const OpenEntryOptions = Schema.Struct({
186
+ ...OpenOptions.fields,
187
+ followFinalSymlink: Schema.optionalKey(Schema.Boolean),
188
+ times: Schema.optionalKey(Times),
189
+ initialSize: Schema.optionalKey(Schema.BigInt),
190
+ exactMode: Schema.optionalKey(Schema.Boolean),
191
+ owner: Schema.optionalKey(OwnerUpdate),
192
+ expected: Schema.optionalKey(Schema.NullOr(ObjectReferenceSchema)),
193
+ expectedChild: Schema.optionalKey(Schema.NullOr(Schema.Struct({
194
+ reference: ObjectReferenceSchema,
195
+ revision: Schema.BigInt,
196
+ atimeNs: Timestamp,
197
+ mtimeNs: Timestamp
198
+ })))
199
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Identity brands and schemas for open file and directory handles.
3
+ *
4
+ * @since 0.6.0
5
+ */
6
+ import * as Schema from "effect/Schema";
7
+ /**
8
+ * Brand key that marks an open file handle.
9
+ *
10
+ * @category type IDs
11
+ * @since 0.6.0
12
+ */
13
+ export declare const FileHandleId: unique symbol;
14
+ /**
15
+ * Brand key that marks an open file handle.
16
+ *
17
+ * @category type IDs
18
+ * @since 0.6.0
19
+ */
20
+ export type FileHandleId = typeof FileHandleId;
21
+ /**
22
+ * Brand key that marks an open directory handle.
23
+ *
24
+ * @category type IDs
25
+ * @since 0.6.0
26
+ */
27
+ export declare const DirectoryHandleId: unique symbol;
28
+ /**
29
+ * Brand key that marks an open directory handle.
30
+ *
31
+ * @category type IDs
32
+ * @since 0.6.0
33
+ */
34
+ export type DirectoryHandleId = typeof DirectoryHandleId;
35
+ /**
36
+ * Schema for the origin of a seek: the file start, the current position, the
37
+ * end, or the next data or hole region.
38
+ *
39
+ * @category schemas
40
+ * @since 0.6.0
41
+ */
42
+ export declare const SeekMode: Schema.Literals<readonly ["start", "current", "end", "data", "hole"]>;
43
+ /**
44
+ * The origin of a seek.
45
+ *
46
+ * @category models
47
+ * @since 0.6.0
48
+ */
49
+ export type SeekMode = typeof SeekMode.Type;
50
+ //# sourceMappingURL=FileHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileHandle.d.ts","sourceRoot":"","sources":["../src/FileHandle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,MAAkD,CAAA;AAEpF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,MAAuD,CAAA;AAE9F;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,uEAA+D,CAAA;AAEpF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Identity brands and schemas for open file and directory handles.
3
+ *
4
+ * @since 0.6.0
5
+ */
6
+ import * as Schema from "effect/Schema";
7
+ /**
8
+ * Brand key that marks an open file handle.
9
+ *
10
+ * @category type IDs
11
+ * @since 0.6.0
12
+ */
13
+ export const FileHandleId = Symbol.for("@effect-vfs/core/FileHandle");
14
+ /**
15
+ * Brand key that marks an open directory handle.
16
+ *
17
+ * @category type IDs
18
+ * @since 0.6.0
19
+ */
20
+ export const DirectoryHandleId = Symbol.for("@effect-vfs/core/DirectoryHandle");
21
+ /**
22
+ * Schema for the origin of a seek: the file start, the current position, the
23
+ * end, or the next data or hole region.
24
+ *
25
+ * @category schemas
26
+ * @since 0.6.0
27
+ */
28
+ export const SeekMode = Schema.Literals(["start", "current", "end", "data", "hole"]);