@effect-vfs/core 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/BytePath.d.ts +18 -5
  2. package/dist/BytePath.d.ts.map +1 -1
  3. package/dist/BytePath.js +9 -9
  4. package/dist/Snapshot.d.ts +3 -3
  5. package/dist/Snapshot.d.ts.map +1 -1
  6. package/dist/Snapshot.js +3 -4
  7. package/dist/SnapshotDelta.d.ts +97 -30
  8. package/dist/SnapshotDelta.d.ts.map +1 -1
  9. package/dist/SnapshotDelta.js +51 -24
  10. package/dist/VirtualFileSystem.d.ts +122 -344
  11. package/dist/VirtualFileSystem.d.ts.map +1 -1
  12. package/dist/VirtualFileSystem.js +53 -1773
  13. package/dist/internal/bytePath.d.ts +10 -0
  14. package/dist/internal/bytePath.d.ts.map +1 -0
  15. package/dist/internal/bytePath.js +46 -0
  16. package/dist/internal/canonicalBase64.d.ts +3 -3
  17. package/dist/internal/canonicalBase64.d.ts.map +1 -1
  18. package/dist/internal/canonicalBase64.js +3 -3
  19. package/dist/internal/image.d.ts +21 -26
  20. package/dist/internal/image.d.ts.map +1 -1
  21. package/dist/internal/image.js +4 -9
  22. package/dist/internal/snapshotDelta.d.ts +0 -1
  23. package/dist/internal/snapshotDelta.d.ts.map +1 -1
  24. package/dist/internal/snapshotDelta.js +15 -28
  25. package/dist/internal/snapshotDeltaModel.d.ts +10 -0
  26. package/dist/internal/snapshotDeltaModel.d.ts.map +1 -0
  27. package/dist/internal/snapshotDeltaModel.js +13 -0
  28. package/dist/internal/virtualFileSystem/errors.d.ts +26 -0
  29. package/dist/internal/virtualFileSystem/errors.d.ts.map +1 -0
  30. package/dist/internal/virtualFileSystem/errors.js +32 -0
  31. package/dist/internal/virtualFileSystem/fixture.d.ts +63 -0
  32. package/dist/internal/virtualFileSystem/fixture.d.ts.map +1 -0
  33. package/dist/internal/virtualFileSystem/fixture.js +144 -0
  34. package/dist/internal/{content.d.ts → virtualFileSystem/overlayContent.d.ts} +4 -14
  35. package/dist/internal/virtualFileSystem/overlayContent.d.ts.map +1 -0
  36. package/dist/internal/{content.js → virtualFileSystem/overlayContent.js} +3 -7
  37. package/dist/internal/{overlayChanges.d.ts → virtualFileSystem/overlayDiff.d.ts} +1 -1
  38. package/dist/internal/virtualFileSystem/overlayDiff.d.ts.map +1 -0
  39. package/dist/internal/virtualFileSystem/path.d.ts +43 -0
  40. package/dist/internal/virtualFileSystem/path.d.ts.map +1 -0
  41. package/dist/internal/virtualFileSystem/path.js +124 -0
  42. package/dist/internal/virtualFileSystem/testHooks.d.ts +20 -0
  43. package/dist/internal/virtualFileSystem/testHooks.d.ts.map +1 -0
  44. package/dist/internal/virtualFileSystem/testHooks.js +23 -0
  45. package/dist/internal/virtualFileSystem/watchHub.d.ts +16 -0
  46. package/dist/internal/virtualFileSystem/watchHub.d.ts.map +1 -0
  47. package/dist/internal/virtualFileSystem/watchHub.js +33 -0
  48. package/dist/internal/virtualFileSystem.d.ts +290 -0
  49. package/dist/internal/virtualFileSystem.d.ts.map +1 -0
  50. package/dist/internal/virtualFileSystem.js +1677 -0
  51. package/package.json +1 -1
  52. package/dist/internal/content.d.ts.map +0 -1
  53. package/dist/internal/overlayChanges.d.ts.map +0 -1
  54. package/dist/internal/overlayTesting.d.ts +0 -12
  55. package/dist/internal/overlayTesting.d.ts.map +0 -1
  56. package/dist/internal/overlayTesting.js +0 -12
  57. /package/dist/internal/{overlayChanges.js → virtualFileSystem/overlayDiff.js} +0 -0
@@ -1,13 +1,28 @@
1
+ import type * as Equal from "effect/Equal";
2
+ import type { Pipeable } from "effect/Pipeable";
1
3
  import * as Schema from "effect/Schema";
2
- export declare const BytePathId: unique symbol;
4
+ /**
5
+ * Type identifier for opaque byte-preserving filesystem paths.
6
+ *
7
+ * @category type ids
8
+ * @since 0.1.0
9
+ */
10
+ export declare const BytePathId: "@effect-vfs/core/BytePath";
11
+ /**
12
+ * Type identifier for opaque byte-preserving filesystem paths.
13
+ *
14
+ * @category type ids
15
+ * @since 0.1.0
16
+ */
17
+ export type BytePathId = typeof BytePathId;
3
18
  /**
4
19
  * An opaque path that preserves arbitrary non-NUL bytes without UTF-8 conversion.
5
20
  *
6
21
  * @category models
7
22
  * @since 0.1.0
8
23
  */
9
- export interface BytePath {
10
- readonly [BytePathId]: true;
24
+ export interface BytePath extends Equal.Equal, Pipeable {
25
+ readonly [BytePathId]: BytePathId;
11
26
  }
12
27
  /**
13
28
  * Schema for an opaque byte-preserving filesystem path.
@@ -16,6 +31,4 @@ export interface BytePath {
16
31
  * @since 0.1.0
17
32
  */
18
33
  export declare const BytePath: Schema.declare<BytePath, BytePath>;
19
- export declare const make: (bytes: Uint8Array) => BytePath;
20
- export declare const getBytes: (path: BytePath) => Uint8Array | undefined;
21
34
  //# sourceMappingURL=BytePath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BytePath.d.ts","sourceRoot":"","sources":["../src/BytePath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,eAAO,MAAM,UAAU,eAAsC,CAAA;AAI7D;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,oCAEpB,CAAA;AAED,eAAO,MAAM,IAAI,UAAW,UAAU,KAAG,QAIxC,CAAA;AAED,eAAO,MAAM,QAAQ,SAAU,QAAQ,KAAG,UAAU,GAAG,SAAgC,CAAA"}
1
+ {"version":3,"file":"BytePath.d.ts","sourceRoot":"","sources":["../src/BytePath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,2BAAiD,CAAA;AAE1E;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,QAAS,SAAQ,KAAK,CAAC,KAAK,EAAE,QAAQ;IACrD,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;CAClC;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,oCAAgD,CAAA"}
package/dist/BytePath.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import * as Schema from "effect/Schema";
2
- export const BytePathId = Symbol("@effect-vfs/core/BytePath");
3
- const bytePaths = new WeakMap();
2
+ import * as Internal from "./internal/bytePath.js";
3
+ /**
4
+ * Type identifier for opaque byte-preserving filesystem paths.
5
+ *
6
+ * @category type ids
7
+ * @since 0.1.0
8
+ */
9
+ export const BytePathId = Internal.BytePathId;
4
10
  /**
5
11
  * Schema for an opaque byte-preserving filesystem path.
6
12
  *
7
13
  * @category schemas
8
14
  * @since 0.1.0
9
15
  */
10
- export const BytePath = Schema.declare((value) => typeof value === "object" && value !== null && bytePaths.has(value));
11
- export const make = (bytes) => {
12
- const path = Object.freeze({ [BytePathId]: true });
13
- bytePaths.set(path, bytes);
14
- return path;
15
- };
16
- export const getBytes = (path) => bytePaths.get(path);
16
+ export const BytePath = Schema.declare(Internal.isBytePath);
@@ -5,7 +5,7 @@ import * as Schema from "effect/Schema";
5
5
  * @category type ids
6
6
  * @since 0.1.0
7
7
  */
8
- export declare const SnapshotTypeId: unique symbol;
8
+ export declare const SnapshotTypeId: "@effect-vfs/core/Snapshot";
9
9
  /**
10
10
  * Type identifier for opaque filesystem snapshots.
11
11
  *
@@ -48,9 +48,9 @@ export declare const DecodeLimits: Schema.Struct<{
48
48
  /** Maximum accepted encoded input length in bytes. */
49
49
  readonly maxEncodedBytes: Schema.ByteSize;
50
50
  /** Maximum number of stored metadata and content records. */
51
- readonly maxRecords: Schema.Finite;
51
+ readonly maxRecords: Schema.Natural;
52
52
  /** Maximum number of namespace entries. */
53
- readonly maxEntries: Schema.Finite;
53
+ readonly maxEntries: Schema.Natural;
54
54
  /** Maximum combined decoded byte content. */
55
55
  readonly maxDecodedBytes: Schema.ByteSize;
56
56
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"Snapshot.d.ts","sourceRoot":"","sources":["../src/Snapshot.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAQvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,eAAsC,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAA;AAElD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,cAAc,CAAA;CAC1C;;;;AAED;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,gBAA+B;IAC7D,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,eAAe,CAAA;IAC9F,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC;CAAG;AAEL;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB,sDAAsD;;IAEtD,6DAA6D;;IAE7D,2CAA2C;;IAE3C,6CAA6C;;EAE7C,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA"}
1
+ {"version":3,"file":"Snapshot.d.ts","sourceRoot":"","sources":["../src/Snapshot.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAG,2BAAoC,CAAA;AAElE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAA;AAElD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,cAAc,CAAA;CAC1C;;;;AAED;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,gBAA+B;IAC7D,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,eAAe,CAAA;IAC9F,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC;CAAG;AAEL;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB,sDAAsD;;IAEtD,6DAA6D;;IAE7D,2CAA2C;;IAE3C,6CAA6C;;EAE7C,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA"}
package/dist/Snapshot.js CHANGED
@@ -9,14 +9,13 @@
9
9
  */
10
10
  import * as Data from "effect/Data";
11
11
  import * as Schema from "effect/Schema";
12
- const Natural = Schema.Finite.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));
13
12
  /**
14
13
  * Type identifier for opaque filesystem snapshots.
15
14
  *
16
15
  * @category type ids
17
16
  * @since 0.1.0
18
17
  */
19
- export const SnapshotTypeId = Symbol("@effect-vfs/core/Snapshot");
18
+ export const SnapshotTypeId = "@effect-vfs/core/Snapshot";
20
19
  /**
21
20
  * Describes a snapshot encoding, decoding, structure, or resource-limit failure.
22
21
  *
@@ -35,9 +34,9 @@ export const DecodeLimits = Schema.Struct({
35
34
  /** Maximum accepted encoded input length in bytes. */
36
35
  maxEncodedBytes: Schema.ByteSize,
37
36
  /** Maximum number of stored metadata and content records. */
38
- maxRecords: Natural,
37
+ maxRecords: Schema.Natural,
39
38
  /** Maximum number of namespace entries. */
40
- maxEntries: Natural,
39
+ maxEntries: Schema.Natural,
41
40
  /** Maximum combined decoded byte content. */
42
41
  maxDecodedBytes: Schema.ByteSize
43
42
  });
@@ -6,33 +6,72 @@
6
6
  import * as ByteSize from "effect/ByteSize";
7
7
  import * as Schema from "effect/Schema";
8
8
  import { BytePath } from "./BytePath.js";
9
- /** Type identifier for opaque snapshot deltas. */
10
- export declare const SnapshotDeltaTypeId: unique symbol;
11
- /** Type identifier for opaque snapshot deltas. */
9
+ /**
10
+ * Type identifier for opaque snapshot deltas.
11
+ *
12
+ * @category type ids
13
+ * @since 0.1.0
14
+ */
15
+ export declare const SnapshotDeltaTypeId: "@effect-vfs/core/SnapshotDelta";
16
+ /**
17
+ * Type identifier for opaque snapshot deltas.
18
+ *
19
+ * @category type ids
20
+ * @since 0.1.0
21
+ */
12
22
  export type SnapshotDeltaTypeId = typeof SnapshotDeltaTypeId;
13
- /** An immutable, opaque description of the exact difference between two snapshots. */
23
+ /**
24
+ * An immutable, opaque description of the exact difference between two snapshots.
25
+ *
26
+ * @category models
27
+ * @since 0.1.0
28
+ */
14
29
  export interface SnapshotDelta {
15
30
  readonly [SnapshotDeltaTypeId]: SnapshotDeltaTypeId;
16
31
  }
17
- /** @internal */
18
- export declare const makeSnapshotDelta: (value: object) => SnapshotDelta;
19
- /** @internal */
20
- export declare const snapshotDeltaValue: (delta: SnapshotDelta) => object | undefined;
21
- /** Schema for an already validated opaque snapshot delta. */
32
+ /**
33
+ * Schema for an already validated opaque snapshot delta.
34
+ *
35
+ * @category schemas
36
+ * @since 0.1.0
37
+ */
22
38
  export declare const SnapshotDelta: Schema.declare<SnapshotDelta, SnapshotDelta>;
23
- /** Schema for filesystem entry kinds reported by snapshot inspection. */
39
+ /**
40
+ * Schema for filesystem entry kinds reported by snapshot inspection.
41
+ *
42
+ * @category schemas
43
+ * @since 0.1.0
44
+ */
24
45
  export declare const SnapshotNodeKind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
25
- /** A filesystem entry kind reported by snapshot inspection. */
46
+ /**
47
+ * A filesystem entry kind reported by snapshot inspection.
48
+ *
49
+ * @category models
50
+ * @since 0.1.0
51
+ */
26
52
  export type SnapshotNodeKind = typeof SnapshotNodeKind.Type;
27
- /** Schema for semantic fields that can differ between snapshots. */
53
+ /**
54
+ * Schema for semantic fields that can differ between snapshots.
55
+ *
56
+ * @category schemas
57
+ * @since 0.1.0
58
+ */
28
59
  export declare const SnapshotDifference: Schema.Literals<readonly ["kind", "content", "target", "hardLinks", "mode", "uid", "gid", "atimeNs", "mtimeNs", "ctimeNs", "birthtimeNs"]>;
29
- /** A semantic field that differs between two snapshots. */
60
+ /**
61
+ * A semantic field that differs between two snapshots.
62
+ *
63
+ * @category models
64
+ * @since 0.1.0
65
+ */
30
66
  export type SnapshotDifference = typeof SnapshotDifference.Type;
31
67
  /**
32
68
  * Schema for a path-oriented difference between two snapshots.
33
69
  *
34
70
  * Independent snapshots do not preserve shared lineage, so moves are reported
35
71
  * as a removal and an addition rather than an inferred rename.
72
+ *
73
+ * @category schemas
74
+ * @since 0.1.0
36
75
  */
37
76
  export declare const SnapshotChange: Schema.Union<readonly [Schema.TaggedStruct<"Added", {
38
77
  readonly path: Schema.declare<BytePath, BytePath>;
@@ -46,19 +85,39 @@ export declare const SnapshotChange: Schema.Union<readonly [Schema.TaggedStruct<
46
85
  readonly afterKind: Schema.Literals<readonly ["directory", "file", "symlink"]>;
47
86
  readonly differences: Schema.$Array<Schema.Literals<readonly ["kind", "content", "target", "hardLinks", "mode", "uid", "gid", "atimeNs", "mtimeNs", "ctimeNs", "birthtimeNs"]>>;
48
87
  }>]>;
49
- /** A path-oriented semantic difference between two snapshots. */
88
+ /**
89
+ * A path-oriented semantic difference between two snapshots.
90
+ *
91
+ * @category models
92
+ * @since 0.1.0
93
+ */
50
94
  export type SnapshotChange = typeof SnapshotChange.Type;
51
- /** Schema for snapshot-delta inspection options. */
95
+ /**
96
+ * Schema for snapshot-delta inspection options.
97
+ *
98
+ * @category schemas
99
+ * @since 0.1.0
100
+ */
52
101
  export declare const SnapshotChangesOptions: Schema.Struct<{
53
102
  /** Include access, modification, change, and birth-time differences. Defaults to `false`. */
54
103
  readonly includeTimestamps: Schema.optionalKey<Schema.Boolean>;
55
104
  }>;
56
- /** Filtering options for snapshot-delta inspection. */
105
+ /**
106
+ * Filtering options for snapshot-delta inspection.
107
+ *
108
+ * @category models
109
+ * @since 0.1.0
110
+ */
57
111
  export type SnapshotChangesOptions = typeof SnapshotChangesOptions.Type;
58
112
  declare const SnapshotDeltaError_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 & {
59
113
  readonly _tag: "SnapshotDeltaError";
60
114
  } & Readonly<A>;
61
- /** A valid snapshot delta was inspected or applied against a valid but semantically different base. */
115
+ /**
116
+ * A valid snapshot delta was inspected or applied against a valid but semantically different base.
117
+ *
118
+ * @category errors
119
+ * @since 0.1.0
120
+ */
62
121
  export declare class SnapshotDeltaError extends SnapshotDeltaError_base<{
63
122
  readonly code: "BaseMismatch";
64
123
  }> {
@@ -66,16 +125,21 @@ export declare class SnapshotDeltaError extends SnapshotDeltaError_base<{
66
125
  declare const SnapshotDeltaLimitsSchema: Schema.Struct<{
67
126
  readonly maxEncodedBytes: Schema.ByteSize;
68
127
  readonly maxIdentityBytes: Schema.ByteSize;
69
- readonly maxDeltaRecords: Schema.Finite;
128
+ readonly maxDeltaRecords: Schema.Natural;
70
129
  readonly maxDecodedDeltaBytes: Schema.ByteSize;
71
- readonly maxBaseRecords: Schema.Finite;
72
- readonly maxTargetRecords: Schema.Finite;
73
- readonly maxEntries: Schema.Finite;
74
- readonly maxOutputRecords: Schema.Finite;
130
+ readonly maxBaseRecords: Schema.Natural;
131
+ readonly maxTargetRecords: Schema.Natural;
132
+ readonly maxEntries: Schema.Natural;
133
+ readonly maxOutputRecords: Schema.Natural;
75
134
  readonly maxOutputBytes: Schema.ByteSize;
76
- readonly maxInheritedRecords: Schema.Finite;
135
+ readonly maxInheritedRecords: Schema.Natural;
77
136
  }>;
78
- /** Resource limits shared by delta creation, inspection, encoding, decoding, and application. */
137
+ /**
138
+ * Resource limits shared by delta creation, inspection, encoding, decoding, and application.
139
+ *
140
+ * @category models
141
+ * @since 0.1.0
142
+ */
79
143
  export type SnapshotDeltaLimits = typeof SnapshotDeltaLimitsSchema.Type;
80
144
  /** Constructs and freezes a complete snapshot-delta resource policy. @internal */
81
145
  export declare const makeSnapshotDeltaLimits: (limits: SnapshotDeltaLimits) => SnapshotDeltaLimits;
@@ -84,18 +148,21 @@ export declare const makeSnapshotDeltaLimits: (limits: SnapshotDeltaLimits) => S
84
148
  *
85
149
  * The constrained preset is intended for memory-sensitive environments. The
86
150
  * default preset permits larger snapshots and payloads while remaining finite.
151
+ *
152
+ * @category schemas
153
+ * @since 0.1.0
87
154
  */
88
155
  export declare const SnapshotDeltaLimits: Schema.Struct<{
89
156
  readonly maxEncodedBytes: Schema.ByteSize;
90
157
  readonly maxIdentityBytes: Schema.ByteSize;
91
- readonly maxDeltaRecords: Schema.Finite;
158
+ readonly maxDeltaRecords: Schema.Natural;
92
159
  readonly maxDecodedDeltaBytes: Schema.ByteSize;
93
- readonly maxBaseRecords: Schema.Finite;
94
- readonly maxTargetRecords: Schema.Finite;
95
- readonly maxEntries: Schema.Finite;
96
- readonly maxOutputRecords: Schema.Finite;
160
+ readonly maxBaseRecords: Schema.Natural;
161
+ readonly maxTargetRecords: Schema.Natural;
162
+ readonly maxEntries: Schema.Natural;
163
+ readonly maxOutputRecords: Schema.Natural;
97
164
  readonly maxOutputBytes: Schema.ByteSize;
98
- readonly maxInheritedRecords: Schema.Finite;
165
+ readonly maxInheritedRecords: Schema.Natural;
99
166
  }> & {
100
167
  constrained: {
101
168
  readonly maxEncodedBytes: ByteSize.ByteSize;
@@ -1 +1 @@
1
- {"version":3,"file":"SnapshotDelta.d.ts","sourceRoot":"","sources":["../src/SnapshotDelta.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;A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CAAA;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;IACjC,6FAA6F;;EAE7F,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;;;;AAEvE;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,wBAAuC;IAC7E,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAC9B,CAAC;CAAG;AAEL,QAAA,MAAM,yBAAyB;;;;;;;;;;;EAW7B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAA;AAEvE,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,WAAY,mBAAmB,KAAG,mBACxC,CAAA;AA2B9B;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
@@ -7,23 +7,34 @@ import * as ByteSize from "effect/ByteSize";
7
7
  import * as Data from "effect/Data";
8
8
  import * as Schema from "effect/Schema";
9
9
  import { BytePath } from "./BytePath.js";
10
- const Natural = Schema.Finite.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));
11
- /** Type identifier for opaque snapshot deltas. */
12
- export const SnapshotDeltaTypeId = Symbol("@effect-vfs/core/SnapshotDelta");
13
- const snapshotDeltas = new WeakMap();
14
- /** @internal */
15
- export const makeSnapshotDelta = (value) => {
16
- const delta = Object.freeze({ [SnapshotDeltaTypeId]: SnapshotDeltaTypeId });
17
- snapshotDeltas.set(delta, value);
18
- return delta;
19
- };
20
- /** @internal */
21
- export const snapshotDeltaValue = (delta) => snapshotDeltas.get(delta);
22
- /** Schema for an already validated opaque snapshot delta. */
23
- export const SnapshotDelta = Schema.declare((value) => typeof value === "object" && value !== null && snapshotDeltas.has(value));
24
- /** Schema for filesystem entry kinds reported by snapshot inspection. */
10
+ import * as Internal from "./internal/snapshotDeltaModel.js";
11
+ /**
12
+ * Type identifier for opaque snapshot deltas.
13
+ *
14
+ * @category type ids
15
+ * @since 0.1.0
16
+ */
17
+ export const SnapshotDeltaTypeId = Internal.SnapshotDeltaTypeId;
18
+ /**
19
+ * Schema for an already validated opaque snapshot delta.
20
+ *
21
+ * @category schemas
22
+ * @since 0.1.0
23
+ */
24
+ export const SnapshotDelta = Schema.declare(Internal.isSnapshotDelta);
25
+ /**
26
+ * Schema for filesystem entry kinds reported by snapshot inspection.
27
+ *
28
+ * @category schemas
29
+ * @since 0.1.0
30
+ */
25
31
  export const SnapshotNodeKind = Schema.Literals(["directory", "file", "symlink"]);
26
- /** Schema for semantic fields that can differ between snapshots. */
32
+ /**
33
+ * Schema for semantic fields that can differ between snapshots.
34
+ *
35
+ * @category schemas
36
+ * @since 0.1.0
37
+ */
27
38
  export const SnapshotDifference = Schema.Literals([
28
39
  "kind",
29
40
  "content",
@@ -43,6 +54,9 @@ const SnapshotDifferences = Schema.Array(SnapshotDifference).check(Schema.isMinL
43
54
  *
44
55
  * Independent snapshots do not preserve shared lineage, so moves are reported
45
56
  * as a removal and an addition rather than an inferred rename.
57
+ *
58
+ * @category schemas
59
+ * @since 0.1.0
46
60
  */
47
61
  export const SnapshotChange = Schema.Union([
48
62
  Schema.TaggedStruct("Added", { path: BytePath, kind: SnapshotNodeKind }),
@@ -54,25 +68,35 @@ export const SnapshotChange = Schema.Union([
54
68
  differences: SnapshotDifferences
55
69
  })
56
70
  ]);
57
- /** Schema for snapshot-delta inspection options. */
71
+ /**
72
+ * Schema for snapshot-delta inspection options.
73
+ *
74
+ * @category schemas
75
+ * @since 0.1.0
76
+ */
58
77
  export const SnapshotChangesOptions = Schema.Struct({
59
78
  /** Include access, modification, change, and birth-time differences. Defaults to `false`. */
60
79
  includeTimestamps: Schema.optionalKey(Schema.Boolean)
61
80
  });
62
- /** A valid snapshot delta was inspected or applied against a valid but semantically different base. */
81
+ /**
82
+ * A valid snapshot delta was inspected or applied against a valid but semantically different base.
83
+ *
84
+ * @category errors
85
+ * @since 0.1.0
86
+ */
63
87
  export class SnapshotDeltaError extends Data.TaggedError("SnapshotDeltaError") {
64
88
  }
65
89
  const SnapshotDeltaLimitsSchema = Schema.Struct({
66
90
  maxEncodedBytes: Schema.ByteSize,
67
91
  maxIdentityBytes: Schema.ByteSize,
68
- maxDeltaRecords: Natural,
92
+ maxDeltaRecords: Schema.Natural,
69
93
  maxDecodedDeltaBytes: Schema.ByteSize,
70
- maxBaseRecords: Natural,
71
- maxTargetRecords: Natural,
72
- maxEntries: Natural,
73
- maxOutputRecords: Natural,
94
+ maxBaseRecords: Schema.Natural,
95
+ maxTargetRecords: Schema.Natural,
96
+ maxEntries: Schema.Natural,
97
+ maxOutputRecords: Schema.Natural,
74
98
  maxOutputBytes: Schema.ByteSize,
75
- maxInheritedRecords: Natural
99
+ maxInheritedRecords: Schema.Natural
76
100
  });
77
101
  /** Constructs and freezes a complete snapshot-delta resource policy. @internal */
78
102
  export const makeSnapshotDeltaLimits = (limits) => Object.freeze({ ...limits });
@@ -105,6 +129,9 @@ const defaultLimits = makeSnapshotDeltaLimits({
105
129
  *
106
130
  * The constrained preset is intended for memory-sensitive environments. The
107
131
  * default preset permits larger snapshots and payloads while remaining finite.
132
+ *
133
+ * @category schemas
134
+ * @since 0.1.0
108
135
  */
109
136
  export const SnapshotDeltaLimits = Object.assign(SnapshotDeltaLimitsSchema, {
110
137
  constrained,