@effect-vfs/core 0.3.0 → 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.
Files changed (69) hide show
  1. package/README.md +36 -149
  2. package/dist/BytePath.d.ts +34 -2
  3. package/dist/BytePath.d.ts.map +1 -1
  4. package/dist/BytePath.js +1 -1
  5. package/dist/LiveVolume.d.ts +101 -0
  6. package/dist/LiveVolume.d.ts.map +1 -0
  7. package/dist/LiveVolume.js +72 -0
  8. package/dist/Snapshot.d.ts +60 -2
  9. package/dist/Snapshot.d.ts.map +1 -1
  10. package/dist/Snapshot.js +59 -1
  11. package/dist/SnapshotDelta.d.ts +113 -3
  12. package/dist/SnapshotDelta.d.ts.map +1 -1
  13. package/dist/SnapshotDelta.js +112 -2
  14. package/dist/VirtualFileSystem.d.ts +1224 -90
  15. package/dist/VirtualFileSystem.d.ts.map +1 -1
  16. package/dist/VirtualFileSystem.js +678 -20
  17. package/dist/VirtualFileSystemError.d.ts +54 -0
  18. package/dist/VirtualFileSystemError.d.ts.map +1 -0
  19. package/dist/VirtualFileSystemError.js +49 -0
  20. package/dist/index.d.ts +15 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +15 -1
  23. package/dist/internal/bytePath.d.ts.map +1 -1
  24. package/dist/internal/bytePath.js +5 -10
  25. package/dist/internal/bytes.d.ts +6 -0
  26. package/dist/internal/bytes.d.ts.map +1 -0
  27. package/dist/internal/bytes.js +17 -0
  28. package/dist/internal/canonicalBase64.d.ts +13 -5
  29. package/dist/internal/canonicalBase64.d.ts.map +1 -1
  30. package/dist/internal/canonicalBase64.js +28 -6
  31. package/dist/internal/image.d.ts +76 -90
  32. package/dist/internal/image.d.ts.map +1 -1
  33. package/dist/internal/image.js +98 -89
  34. package/dist/internal/liveImage.d.ts +286 -0
  35. package/dist/internal/liveImage.d.ts.map +1 -0
  36. package/dist/internal/liveImage.js +176 -0
  37. package/dist/internal/metadata.d.ts +28 -0
  38. package/dist/internal/metadata.d.ts.map +1 -0
  39. package/dist/internal/metadata.js +29 -0
  40. package/dist/internal/snapshotDelta.d.ts.map +1 -1
  41. package/dist/internal/snapshotDelta.js +346 -300
  42. package/dist/internal/snapshotDeltaModel.d.ts +2 -2
  43. package/dist/internal/snapshotDeltaModel.d.ts.map +1 -1
  44. package/dist/internal/snapshotDeltaModel.js +3 -1
  45. package/dist/internal/virtualFileSystem/errors.d.ts +6 -20
  46. package/dist/internal/virtualFileSystem/errors.d.ts.map +1 -1
  47. package/dist/internal/virtualFileSystem/errors.js +22 -7
  48. package/dist/internal/virtualFileSystem/fixture.d.ts +4 -1
  49. package/dist/internal/virtualFileSystem/fixture.d.ts.map +1 -1
  50. package/dist/internal/virtualFileSystem/fixture.js +80 -74
  51. package/dist/internal/virtualFileSystem/overlayContent.d.ts.map +1 -1
  52. package/dist/internal/virtualFileSystem/overlayContent.js +9 -2
  53. package/dist/internal/virtualFileSystem/overlayDiff.d.ts +2 -11
  54. package/dist/internal/virtualFileSystem/overlayDiff.d.ts.map +1 -1
  55. package/dist/internal/virtualFileSystem/overlayDiff.js +45 -71
  56. package/dist/internal/virtualFileSystem/path.d.ts +15 -14
  57. package/dist/internal/virtualFileSystem/path.d.ts.map +1 -1
  58. package/dist/internal/virtualFileSystem/path.js +57 -54
  59. package/dist/internal/virtualFileSystem/stagedState.d.ts +22 -0
  60. package/dist/internal/virtualFileSystem/stagedState.d.ts.map +1 -0
  61. package/dist/internal/virtualFileSystem/stagedState.js +62 -0
  62. package/dist/internal/virtualFileSystem/testHooks.d.ts.map +1 -1
  63. package/dist/internal/virtualFileSystem/watchHub.d.ts +3 -3
  64. package/dist/internal/virtualFileSystem/watchHub.d.ts.map +1 -1
  65. package/dist/internal/virtualFileSystem/watchHub.js +45 -24
  66. package/dist/internal/virtualFileSystem.d.ts +307 -23
  67. package/dist/internal/virtualFileSystem.d.ts.map +1 -1
  68. package/dist/internal/virtualFileSystem.js +1738 -525
  69. package/package.json +23 -5
@@ -1,37 +1,28 @@
1
1
  // Snapshot validation and serialization used by VirtualFileSystem.
2
2
  import * as ByteSize from "effect/ByteSize";
3
3
  import * as Effect from "effect/Effect";
4
- import * as Encoding from "effect/Encoding";
4
+ import * as Match from "effect/Match";
5
5
  import * as Result from "effect/Result";
6
6
  import * as Schema from "effect/Schema";
7
7
  import { DecodeLimits, ImageError, SnapshotTypeId } from "../Snapshot.js";
8
- import * as CanonicalBase64 from "./canonicalBase64.js";
8
+ import { CanonicalBase64 } from "./canonicalBase64.js";
9
+ import { StoredMetadata, WireStoredMetadata } from "./metadata.js";
9
10
  class SnapshotImpl {
10
11
  [SnapshotTypeId] = SnapshotTypeId;
11
12
  }
12
- const integer = Schema.String.check(Schema.isPattern(/^(?:0|-?[1-9][0-9]{0,127})(?![\s\S])/));
13
13
  /** @internal */
14
- export const StoredMetadata = Schema.Struct({
15
- uid: Schema.Natural,
16
- gid: Schema.Natural,
17
- mode: Schema.Natural.check(Schema.isLessThanOrEqualTo(0o7777)),
18
- atimeNs: integer,
19
- mtimeNs: integer,
20
- ctimeNs: integer,
21
- birthtimeNs: integer
22
- });
14
+ export { StoredMetadata };
23
15
  const id = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(128));
24
16
  /** @internal */
25
- export const Record = Schema.Union([
26
- Schema.Struct({
17
+ export const Record = Schema.TaggedUnion({
18
+ directory: {
27
19
  id,
28
- kind: Schema.Literal("directory"),
29
20
  metadata: StoredMetadata,
30
- entries: Schema.Array(Schema.Struct({ name: Schema.String, target: id }))
31
- }),
32
- Schema.Struct({ id, kind: Schema.Literal("file"), metadata: StoredMetadata, data: Schema.String }),
33
- Schema.Struct({ id, kind: Schema.Literal("symlink"), metadata: StoredMetadata, target: Schema.String })
34
- ]);
21
+ entries: Schema.Array(Schema.Struct({ name: CanonicalBase64.Encoded, target: id }))
22
+ },
23
+ file: { id, metadata: StoredMetadata, data: CanonicalBase64.Encoded },
24
+ symlink: { id, metadata: StoredMetadata, target: CanonicalBase64.Encoded }
25
+ });
35
26
  /** @internal */
36
27
  export const Document = Schema.Struct({
37
28
  format: Schema.Literal("effect-vfs"),
@@ -39,97 +30,111 @@ export const Document = Schema.Struct({
39
30
  root: id,
40
31
  records: Schema.Array(Record)
41
32
  });
33
+ const WireRecord = Schema.TaggedUnion({
34
+ directory: {
35
+ id,
36
+ metadata: WireStoredMetadata,
37
+ entries: Schema.Array(Schema.Struct({ name: Schema.String, target: id }))
38
+ },
39
+ file: { id, metadata: WireStoredMetadata, data: Schema.String },
40
+ symlink: { id, metadata: WireStoredMetadata, target: Schema.String }
41
+ });
42
+ const WireDocument = Schema.Struct({
43
+ format: Schema.Literal("effect-vfs"),
44
+ version: Schema.Literal(1),
45
+ root: id,
46
+ records: Schema.Array(WireRecord)
47
+ });
48
+ const VersionProbe = Schema.Struct({
49
+ format: Schema.Literal("effect-vfs"),
50
+ version: Schema.Unknown
51
+ });
42
52
  const snapshots = new WeakMap();
43
53
  /** @internal */
44
- export const decodedLength = CanonicalBase64.decodedLength;
45
- /** @internal */
46
- export const base64 = (input) => {
47
- // Effect's encoder concatenates individual characters. Join bounded chunks so snapshots
48
- // retain flat strings instead of those intermediate string chains. A multiple of three
49
- // keeps padding in the final chunk only, preserving canonical base64.
50
- const chunkBytes = 12_288;
51
- const chunks = [];
52
- for (let offset = 0; offset < input.length; offset += chunkBytes) {
53
- chunks.push(Encoding.encodeBase64(input.subarray(offset, offset + chunkBytes)));
54
- }
55
- return chunks.join("");
56
- };
57
- const error = (code, field) => new ImageError({ code, ...(field === undefined ? {} : { field }) });
58
- /** @internal */
59
- export const bytes = (value) => {
60
- return CanonicalBase64.decodeTrusted(value);
61
- };
62
- /** @internal */
63
54
  export const inspect = (snapshot) => Effect.suspend(() => {
64
55
  const document = snapshots.get(snapshot);
65
- return document === undefined ? Effect.fail(error("InvalidStructure", "snapshot")) : Effect.succeed(document);
56
+ return document === undefined
57
+ ? new ImageError({ code: "InvalidStructure", field: "snapshot" })
58
+ : Effect.succeed(document);
66
59
  });
67
60
  /** @internal */
68
- export const capture = Effect.fnUntraced(function* (input, limits) {
69
- const decoded = Schema.decodeUnknownResult(Document, { onExcessProperty: "error" })(input);
70
- if (Result.isFailure(decoded))
71
- return yield* error("InvalidStructure");
72
- const document = decoded.success;
61
+ export const capture = Effect.fnUntraced(function* (input, limits, trusted = false) {
62
+ const wire = trusted ? undefined : Schema.decodeUnknownResult(WireDocument, { onExcessProperty: "error" })(input);
63
+ if (wire !== undefined && Result.isFailure(wire)) {
64
+ return yield* new ImageError({ code: "InvalidStructure", field: "document" });
65
+ }
66
+ const decoded = trusted ? undefined : Schema.decodeUnknownResult(Document, { onExcessProperty: "error" })(input);
67
+ if (decoded !== undefined && Result.isFailure(decoded)) {
68
+ return yield* new ImageError({ code: "InvalidEncoding", field: "document" });
69
+ }
70
+ // SAFETY: a trusted caller passes a Document it built; an untrusted one has just been decoded.
71
+ const document = decoded === undefined ? input : decoded.success;
73
72
  const records = new Map();
74
73
  let entries = 0;
75
74
  let payload = ByteSize.zero;
76
75
  if (limits !== undefined && document.records.length > limits.maxRecords) {
77
- return yield* error("LimitExceeded", "records");
76
+ return yield* new ImageError({ code: "LimitExceeded", field: "records" });
78
77
  }
79
78
  for (const record of document.records) {
80
79
  if (records.has(record.id))
81
- return yield* error("InvalidStructure", "id");
80
+ return yield* new ImageError({ code: "InvalidStructure", field: "id" });
82
81
  records.set(record.id, record);
83
- if (record.kind === "directory")
82
+ Match.value(record).pipe(Match.tag("directory", (record) => {
84
83
  entries += record.entries.length;
84
+ }), Match.undefined);
85
85
  }
86
- if (limits !== undefined && entries > limits.maxEntries)
87
- return yield* error("LimitExceeded", "entries");
88
- // Count every payload before allocating any decoded payload buffer.
89
- for (const record of document.records) {
90
- const values = record.kind === "directory"
91
- ? record.entries.map((entry) => entry.name)
92
- : [record.kind === "file" ? record.data : record.target];
93
- for (const value of values) {
94
- if (!CanonicalBase64.isCanonical(value))
95
- return yield* error("InvalidEncoding", record.id);
96
- payload = ByteSize.sum(payload, ByteSize.bytes(decodedLength(value)));
97
- if (limits !== undefined && ByteSize.isGreaterThan(payload, limits.maxDecodedBytes)) {
98
- return yield* error("LimitExceeded", "bytes");
86
+ if (limits !== undefined && entries > limits.maxEntries) {
87
+ return yield* new ImageError({ code: "LimitExceeded", field: "entries" });
88
+ }
89
+ // Count every payload before allocating any decoded payload buffer. Trusted records carry
90
+ // base64 this module produced, so the scan only runs when a limit depends on the tally.
91
+ if (!trusted || limits !== undefined) {
92
+ for (const record of document.records) {
93
+ const values = Match.value(record).pipe(Match.tag("directory", (record) => record.entries.map((entry) => entry.name)), Match.tag("file", (record) => [record.data]), Match.tag("symlink", (record) => [record.target]), Match.exhaustive);
94
+ for (const value of values) {
95
+ if (!CanonicalBase64.is(value)) {
96
+ return yield* new ImageError({ code: "InvalidEncoding", field: record.id });
97
+ }
98
+ payload = ByteSize.sum(payload, ByteSize.bytes(CanonicalBase64.decodedLength(value)));
99
+ if (limits !== undefined && ByteSize.isGreaterThan(payload, limits.maxDecodedBytes)) {
100
+ return yield* new ImageError({ code: "LimitExceeded", field: "bytes" });
101
+ }
99
102
  }
100
103
  }
101
104
  }
102
105
  const root = records.get(document.root);
103
- if (root?.kind !== "directory")
104
- return yield* error("InvalidStructure", "root");
106
+ if (root === undefined || !Record.guards.directory(root)) {
107
+ return yield* new ImageError({ code: "InvalidStructure", field: "root" });
108
+ }
105
109
  const parents = new Map();
106
110
  for (const record of document.records) {
107
- if (record.kind === "directory") {
111
+ if (Record.guards.directory(record)) {
108
112
  const names = new Set();
109
113
  for (const entry of record.entries) {
110
- if (names.has(entry.name) || decodedLength(entry.name) < 1 || decodedLength(entry.name) > 255) {
111
- return yield* error("InvalidStructure", "name");
112
- }
114
+ if (names.has(entry.name) || CanonicalBase64.decodedLength(entry.name) < 1 ||
115
+ CanonicalBase64.decodedLength(entry.name) > 255)
116
+ return yield* new ImageError({ code: "InvalidStructure", field: "name" });
113
117
  names.add(entry.name);
114
- const name = bytes(entry.name);
118
+ const name = yield* CanonicalBase64.decode(entry.name);
115
119
  if (name.includes(0) || name.includes(47) || (name.length === 1 && name[0] === 46) ||
116
120
  (name.length === 2 && name[0] === 46 && name[1] === 46))
117
- return yield* error("InvalidStructure", "name");
121
+ return yield* new ImageError({ code: "InvalidStructure", field: "name" });
118
122
  const target = records.get(entry.target);
119
123
  if (target === undefined)
120
- return yield* error("InvalidStructure", "target");
124
+ return yield* new ImageError({ code: "InvalidStructure", field: "target" });
121
125
  parents.set(target.id, (parents.get(target.id) ?? 0) + 1);
122
126
  }
123
127
  }
124
- else if (record.kind === "symlink" && bytes(record.target).includes(0)) {
125
- return yield* error("InvalidStructure", "symlink");
128
+ else if (Record.guards.symlink(record) && (yield* CanonicalBase64.decode(record.target)).includes(0)) {
129
+ return yield* new ImageError({ code: "InvalidStructure", field: "symlink" });
126
130
  }
127
131
  }
128
132
  if (parents.has(root.id))
129
- return yield* error("InvalidStructure", "root");
133
+ return yield* new ImageError({ code: "InvalidStructure", field: "root" });
130
134
  for (const record of document.records) {
131
- if (record !== root && (record.kind === "directory" ? parents.get(record.id) !== 1 : !parents.has(record.id))) {
132
- return yield* error("InvalidStructure", "parent");
135
+ const invalidParent = Match.value(record).pipe(Match.tag("directory", (record) => parents.get(record.id) !== 1), Match.tag("file", (record) => !parents.has(record.id)), Match.tag("symlink", (record) => !parents.has(record.id)), Match.exhaustive);
136
+ if (record !== root && invalidParent) {
137
+ return yield* new ImageError({ code: "InvalidStructure", field: "parent" });
133
138
  }
134
139
  }
135
140
  const visited = new Set();
@@ -140,39 +145,43 @@ export const capture = Effect.fnUntraced(function* (input, limits) {
140
145
  continue;
141
146
  visited.add(next);
142
147
  const record = records.get(next);
143
- if (record?.kind === "directory") {
144
- for (const entry of record.entries)
145
- pending.push(entry.target);
148
+ if (record !== undefined) {
149
+ Match.value(record).pipe(Match.tag("directory", (record) => {
150
+ for (const entry of record.entries)
151
+ pending.push(entry.target);
152
+ }), Match.tag("file", () => undefined), Match.tag("symlink", () => undefined), Match.exhaustive);
146
153
  }
147
154
  }
148
155
  if (visited.size !== records.size)
149
- return yield* error("InvalidStructure", "reachability");
156
+ return yield* new ImageError({ code: "InvalidStructure", field: "reachability" });
150
157
  const snapshot = Object.freeze(new SnapshotImpl());
151
158
  snapshots.set(snapshot, document);
152
159
  return snapshot;
153
160
  });
154
161
  /** @internal */
155
162
  export const encodeSnapshot = Effect.fn("VirtualFileSystem.encodeSnapshot")(function* (snapshot) {
156
- const text = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown))(yield* inspect(snapshot)).pipe(Effect.mapError(() => error("InvalidStructure")));
163
+ const text = yield* Schema.encodeEffect(Schema.fromJsonString(Document))(yield* inspect(snapshot)).pipe(Effect.mapError(() => new ImageError({ code: "InvalidStructure", field: "text" })));
157
164
  return new TextEncoder().encode(text);
158
165
  });
159
166
  /** @internal */
160
167
  export const decodeSnapshot = Effect.fn("VirtualFileSystem.decodeSnapshot")(function* (input, limits) {
161
168
  const checked = Schema.decodeResult(DecodeLimits, { onExcessProperty: "error" })(limits);
162
169
  if (Result.isFailure(checked))
163
- return yield* error("InvalidStructure", "limits");
164
- if (!(input instanceof Uint8Array) || !(input.buffer instanceof ArrayBuffer))
165
- return yield* error("InvalidEncoding");
170
+ return yield* new ImageError({ code: "InvalidStructure", field: "limits" });
171
+ if (!(input instanceof Uint8Array) || !(input.buffer instanceof ArrayBuffer)) {
172
+ return yield* new ImageError({ code: "InvalidEncoding", field: "input" });
173
+ }
166
174
  if (ByteSize.isGreaterThan(ByteSize.bytes(input.byteLength), checked.success.maxEncodedBytes)) {
167
- return yield* error("LimitExceeded", "encodedBytes");
175
+ return yield* new ImageError({ code: "LimitExceeded", field: "encodedBytes" });
168
176
  }
169
177
  const text = yield* Effect.try({
170
178
  try: () => new TextDecoder("utf-8", { fatal: true }).decode(new Uint8Array(input)),
171
- catch: () => error("InvalidEncoding")
179
+ catch: () => new ImageError({ code: "InvalidEncoding", field: "text" })
172
180
  });
173
- const value = yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown))(text).pipe(Effect.mapError(() => error("InvalidEncoding")));
174
- if (typeof value === "object" && value !== null && "format" in value && value.format === "effect-vfs" &&
175
- "version" in value && value.version !== 1)
176
- return yield* error("UnsupportedVersion");
181
+ const value = yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown))(text).pipe(Effect.mapError(() => new ImageError({ code: "InvalidEncoding", field: "text" })));
182
+ const version = Schema.decodeUnknownResult(VersionProbe)(value);
183
+ if (Result.isSuccess(version) && version.success.version !== 1) {
184
+ return yield* new ImageError({ code: "UnsupportedVersion", field: "version" });
185
+ }
177
186
  return yield* capture(value, checked.success);
178
187
  });
@@ -0,0 +1,286 @@
1
+ import * as ByteSize from "effect/ByteSize";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Schema from "effect/Schema";
4
+ import { ImageError } from "../Snapshot.js";
5
+ /** @internal */
6
+ export declare const Record: Schema.TaggedUnion<{
7
+ readonly directory: Schema.TaggedStruct<"directory", {
8
+ readonly ino: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
9
+ readonly revision: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
10
+ readonly lineage: Schema.optionalKey<Schema.String>;
11
+ readonly metadata: Schema.Struct<{
12
+ readonly uid: Schema.Natural;
13
+ readonly gid: Schema.Natural;
14
+ readonly mode: Schema.Natural;
15
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
16
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
17
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
18
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
19
+ readonly nlink: Schema.Natural;
20
+ readonly size: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
21
+ }>;
22
+ readonly entries: Schema.$Array<Schema.Struct<{
23
+ readonly name: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
24
+ readonly target: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
25
+ }>>;
26
+ }>;
27
+ readonly file: Schema.TaggedStruct<"file", {
28
+ readonly ino: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
29
+ readonly revision: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
30
+ readonly lineage: Schema.optionalKey<Schema.String>;
31
+ readonly metadata: Schema.Struct<{
32
+ readonly uid: Schema.Natural;
33
+ readonly gid: Schema.Natural;
34
+ readonly mode: Schema.Natural;
35
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
36
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
37
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
38
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
39
+ readonly nlink: Schema.Natural;
40
+ readonly size: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
41
+ }>;
42
+ readonly data: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
43
+ }>;
44
+ readonly symlink: Schema.TaggedStruct<"symlink", {
45
+ readonly ino: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
46
+ readonly revision: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
47
+ readonly lineage: Schema.optionalKey<Schema.String>;
48
+ readonly metadata: Schema.Struct<{
49
+ readonly uid: Schema.Natural;
50
+ readonly gid: Schema.Natural;
51
+ readonly mode: Schema.Natural;
52
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
53
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
54
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
55
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
56
+ readonly nlink: Schema.Natural;
57
+ readonly size: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
58
+ }>;
59
+ readonly target: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
60
+ }>;
61
+ }>;
62
+ /** @internal */
63
+ export type Record = typeof Record.Type;
64
+ /** @internal */
65
+ export declare const Document: Schema.Struct<{
66
+ readonly format: Schema.Literal<"effect-vfs-live">;
67
+ readonly version: Schema.Literal<1>;
68
+ readonly identity: Schema.String;
69
+ readonly root: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
70
+ readonly nextInode: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
71
+ readonly revisionCounter: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
72
+ readonly entries: Schema.Natural;
73
+ readonly usedBytes: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
74
+ readonly limits: Schema.Struct<{
75
+ readonly maxEntries: Schema.optionalKey<Schema.Natural>;
76
+ readonly maxBytes: Schema.optionalKey<Schema.decodeTo<Schema.BigInt, Schema.String, never, never>>;
77
+ readonly maxFileBytes: Schema.optionalKey<Schema.decodeTo<Schema.BigInt, Schema.String, never, never>>;
78
+ readonly maxPathBytes: Schema.optionalKey<Schema.decodeTo<Schema.BigInt, Schema.String, never, never>>;
79
+ }>;
80
+ readonly retainedFiles: Schema.$Array<Schema.decodeTo<Schema.BigInt, Schema.String, never, never>>;
81
+ readonly records: Schema.$Array<Schema.TaggedUnion<{
82
+ readonly directory: Schema.TaggedStruct<"directory", {
83
+ readonly ino: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
84
+ readonly revision: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
85
+ readonly lineage: Schema.optionalKey<Schema.String>;
86
+ readonly metadata: Schema.Struct<{
87
+ readonly uid: Schema.Natural;
88
+ readonly gid: Schema.Natural;
89
+ readonly mode: Schema.Natural;
90
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
91
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
92
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
93
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
94
+ readonly nlink: Schema.Natural;
95
+ readonly size: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
96
+ }>;
97
+ readonly entries: Schema.$Array<Schema.Struct<{
98
+ readonly name: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
99
+ readonly target: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
100
+ }>>;
101
+ }>;
102
+ readonly file: Schema.TaggedStruct<"file", {
103
+ readonly ino: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
104
+ readonly revision: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
105
+ readonly lineage: Schema.optionalKey<Schema.String>;
106
+ readonly metadata: Schema.Struct<{
107
+ readonly uid: Schema.Natural;
108
+ readonly gid: Schema.Natural;
109
+ readonly mode: Schema.Natural;
110
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
111
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
112
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
113
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
114
+ readonly nlink: Schema.Natural;
115
+ readonly size: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
116
+ }>;
117
+ readonly data: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
118
+ }>;
119
+ readonly symlink: Schema.TaggedStruct<"symlink", {
120
+ readonly ino: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
121
+ readonly revision: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
122
+ readonly lineage: Schema.optionalKey<Schema.String>;
123
+ readonly metadata: Schema.Struct<{
124
+ readonly uid: Schema.Natural;
125
+ readonly gid: Schema.Natural;
126
+ readonly mode: Schema.Natural;
127
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
128
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
129
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
130
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
131
+ readonly nlink: Schema.Natural;
132
+ readonly size: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
133
+ }>;
134
+ readonly target: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
135
+ }>;
136
+ }>>;
137
+ }>;
138
+ /** @internal */
139
+ export type Document = typeof Document.Type;
140
+ /** @internal */
141
+ export declare const encode: (document: {
142
+ readonly format: "effect-vfs-live";
143
+ readonly version: 1;
144
+ readonly identity: string;
145
+ readonly root: bigint;
146
+ readonly nextInode: bigint;
147
+ readonly revisionCounter: bigint;
148
+ readonly entries: number;
149
+ readonly usedBytes: bigint;
150
+ readonly limits: {
151
+ readonly maxEntries?: number;
152
+ readonly maxBytes?: bigint;
153
+ readonly maxFileBytes?: bigint;
154
+ readonly maxPathBytes?: bigint;
155
+ };
156
+ readonly retainedFiles: readonly bigint[];
157
+ readonly records: readonly ({
158
+ readonly _tag: "directory";
159
+ readonly ino: bigint;
160
+ readonly revision: bigint;
161
+ readonly lineage?: string;
162
+ readonly metadata: {
163
+ readonly uid: number;
164
+ readonly gid: number;
165
+ readonly mode: number;
166
+ readonly atimeNs: bigint;
167
+ readonly mtimeNs: bigint;
168
+ readonly ctimeNs: bigint;
169
+ readonly birthtimeNs: bigint;
170
+ readonly nlink: number;
171
+ readonly size: bigint;
172
+ };
173
+ readonly entries: readonly {
174
+ readonly name: string & import("effect/Brand").Brand<"CanonicalBase64">;
175
+ readonly target: bigint;
176
+ }[];
177
+ } | {
178
+ readonly _tag: "file";
179
+ readonly ino: bigint;
180
+ readonly revision: bigint;
181
+ readonly lineage?: string;
182
+ readonly metadata: {
183
+ readonly uid: number;
184
+ readonly gid: number;
185
+ readonly mode: number;
186
+ readonly atimeNs: bigint;
187
+ readonly mtimeNs: bigint;
188
+ readonly ctimeNs: bigint;
189
+ readonly birthtimeNs: bigint;
190
+ readonly nlink: number;
191
+ readonly size: bigint;
192
+ };
193
+ readonly data: string & import("effect/Brand").Brand<"CanonicalBase64">;
194
+ } | {
195
+ readonly _tag: "symlink";
196
+ readonly ino: bigint;
197
+ readonly revision: bigint;
198
+ readonly lineage?: string;
199
+ readonly metadata: {
200
+ readonly uid: number;
201
+ readonly gid: number;
202
+ readonly mode: number;
203
+ readonly atimeNs: bigint;
204
+ readonly mtimeNs: bigint;
205
+ readonly ctimeNs: bigint;
206
+ readonly birthtimeNs: bigint;
207
+ readonly nlink: number;
208
+ readonly size: bigint;
209
+ };
210
+ readonly target: string & import("effect/Brand").Brand<"CanonicalBase64">;
211
+ })[];
212
+ }) => Effect.Effect<Uint8Array<ArrayBuffer>, ImageError, never>;
213
+ /** @internal */
214
+ export declare const decode: (bytes: Uint8Array<ArrayBufferLike>, maxEncodedBytes: ByteSize.ByteSize) => Effect.Effect<{
215
+ readonly format: "effect-vfs-live";
216
+ readonly version: 1;
217
+ readonly identity: string;
218
+ readonly root: bigint;
219
+ readonly nextInode: bigint;
220
+ readonly revisionCounter: bigint;
221
+ readonly entries: number;
222
+ readonly usedBytes: bigint;
223
+ readonly limits: {
224
+ readonly maxEntries?: number;
225
+ readonly maxBytes?: bigint;
226
+ readonly maxFileBytes?: bigint;
227
+ readonly maxPathBytes?: bigint;
228
+ };
229
+ readonly retainedFiles: readonly bigint[];
230
+ readonly records: readonly ({
231
+ readonly _tag: "directory";
232
+ readonly ino: bigint;
233
+ readonly revision: bigint;
234
+ readonly lineage?: string;
235
+ readonly metadata: {
236
+ readonly uid: number;
237
+ readonly gid: number;
238
+ readonly mode: number;
239
+ readonly atimeNs: bigint;
240
+ readonly mtimeNs: bigint;
241
+ readonly ctimeNs: bigint;
242
+ readonly birthtimeNs: bigint;
243
+ readonly nlink: number;
244
+ readonly size: bigint;
245
+ };
246
+ readonly entries: readonly {
247
+ readonly name: string & import("effect/Brand").Brand<"CanonicalBase64">;
248
+ readonly target: bigint;
249
+ }[];
250
+ } | {
251
+ readonly _tag: "file";
252
+ readonly ino: bigint;
253
+ readonly revision: bigint;
254
+ readonly lineage?: string;
255
+ readonly metadata: {
256
+ readonly uid: number;
257
+ readonly gid: number;
258
+ readonly mode: number;
259
+ readonly atimeNs: bigint;
260
+ readonly mtimeNs: bigint;
261
+ readonly ctimeNs: bigint;
262
+ readonly birthtimeNs: bigint;
263
+ readonly nlink: number;
264
+ readonly size: bigint;
265
+ };
266
+ readonly data: string & import("effect/Brand").Brand<"CanonicalBase64">;
267
+ } | {
268
+ readonly _tag: "symlink";
269
+ readonly ino: bigint;
270
+ readonly revision: bigint;
271
+ readonly lineage?: string;
272
+ readonly metadata: {
273
+ readonly uid: number;
274
+ readonly gid: number;
275
+ readonly mode: number;
276
+ readonly atimeNs: bigint;
277
+ readonly mtimeNs: bigint;
278
+ readonly ctimeNs: bigint;
279
+ readonly birthtimeNs: bigint;
280
+ readonly nlink: number;
281
+ readonly size: bigint;
282
+ };
283
+ readonly target: string & import("effect/Brand").Brand<"CanonicalBase64">;
284
+ })[];
285
+ }, ImageError, never>;
286
+ //# sourceMappingURL=liveImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liveImage.d.ts","sourceRoot":"","sources":["../../src/internal/liveImage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAmB3C,gBAAgB;AAChB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOjB,CAAA;AAEF,gBAAgB;AAChB,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC,gBAAgB;AAChB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnB,CAAA;AAEF,gBAAgB;AAChB,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAgI3C,gBAAgB;AAChB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAMjB,CAAA;AAEF,gBAAgB;AAChB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuBjB,CAAA"}