@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
@@ -0,0 +1,54 @@
1
+ import type { FsCode, PathInput } from "./VirtualFileSystem.js";
2
+ declare const FsError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "FsError";
4
+ } & Readonly<A>;
5
+ /**
6
+ * An expected filesystem operation failure.
7
+ *
8
+ * The `code` distinguishes portable failures while `operation` names the action.
9
+ * Byte paths are intentionally omitted from the formatted message.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { VirtualFileSystemError } from "@effect-vfs/core"
14
+ *
15
+ * const error = new VirtualFileSystemError.FsError({ code: "NotFound", operation: "readFile" })
16
+ * console.log(error.code, error.message)
17
+ * // NotFound readFile failed with NotFound
18
+ * ```
19
+ *
20
+ * @category errors
21
+ * @since 0.1.0
22
+ */
23
+ export declare class FsError extends FsError_base<{
24
+ readonly code: FsCode;
25
+ readonly operation: string;
26
+ readonly path?: PathInput;
27
+ }> {
28
+ get message(): string;
29
+ }
30
+ declare const ConfigurationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
31
+ readonly _tag: "ConfigurationError";
32
+ } & Readonly<A>;
33
+ /**
34
+ * An invalid volume or caller option, identified by its field name.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * import { VirtualFileSystemError } from "@effect-vfs/core"
39
+ *
40
+ * const error = new VirtualFileSystemError.ConfigurationError({ field: "maxEntries" })
41
+ * console.log(error.field, error.message)
42
+ * // maxEntries Invalid option: maxEntries
43
+ * ```
44
+ *
45
+ * @category errors
46
+ * @since 0.1.0
47
+ */
48
+ export declare class ConfigurationError extends ConfigurationError_base<{
49
+ readonly field: string;
50
+ }> {
51
+ get message(): string;
52
+ }
53
+ export {};
54
+ //# sourceMappingURL=VirtualFileSystemError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualFileSystemError.d.ts","sourceRoot":"","sources":["../src/VirtualFileSystemError.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;;;;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAQ,SAAQ,aAA4B;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAC1B,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;;;;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,kBAAmB,SAAQ,wBAAuC;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Tagged errors shared by the public filesystem API and its implementation.
3
+ *
4
+ * @since 0.1.0
5
+ */
6
+ import * as Data from "effect/Data";
7
+ /**
8
+ * An expected filesystem operation failure.
9
+ *
10
+ * The `code` distinguishes portable failures while `operation` names the action.
11
+ * Byte paths are intentionally omitted from the formatted message.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { VirtualFileSystemError } from "@effect-vfs/core"
16
+ *
17
+ * const error = new VirtualFileSystemError.FsError({ code: "NotFound", operation: "readFile" })
18
+ * console.log(error.code, error.message)
19
+ * // NotFound readFile failed with NotFound
20
+ * ```
21
+ *
22
+ * @category errors
23
+ * @since 0.1.0
24
+ */
25
+ export class FsError extends Data.TaggedError("FsError") {
26
+ get message() {
27
+ return `${this.operation} failed with ${this.code}`;
28
+ }
29
+ }
30
+ /**
31
+ * An invalid volume or caller option, identified by its field name.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { VirtualFileSystemError } from "@effect-vfs/core"
36
+ *
37
+ * const error = new VirtualFileSystemError.ConfigurationError({ field: "maxEntries" })
38
+ * console.log(error.field, error.message)
39
+ * // maxEntries Invalid option: maxEntries
40
+ * ```
41
+ *
42
+ * @category errors
43
+ * @since 0.1.0
44
+ */
45
+ export class ConfigurationError extends Data.TaggedError("ConfigurationError") {
46
+ get message() {
47
+ return `Invalid option: ${this.field}`;
48
+ }
49
+ }
package/dist/index.d.ts CHANGED
@@ -6,8 +6,22 @@
6
6
  /**
7
7
  * Virtual filesystem contracts, schemas, errors, and constructors.
8
8
  *
9
- * @category exports
9
+ * @category re-exports
10
10
  * @since 0.1.0
11
11
  */
12
12
  export * as VirtualFileSystem from "./VirtualFileSystem.js";
13
+ /**
14
+ * Structured filesystem and configuration failures.
15
+ *
16
+ * @category re-exports
17
+ * @since 0.4.0
18
+ */
19
+ export * as VirtualFileSystemError from "./VirtualFileSystemError.js";
20
+ /**
21
+ * Live volume image boundary for storage adapters.
22
+ *
23
+ * @category re-exports
24
+ * @since 0.4.0
25
+ */
26
+ export * as LiveVolume from "./LiveVolume.js";
13
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;;;;GAKG;AACH,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAA;AAErE;;;;;GAKG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -6,7 +6,21 @@
6
6
  /**
7
7
  * Virtual filesystem contracts, schemas, errors, and constructors.
8
8
  *
9
- * @category exports
9
+ * @category re-exports
10
10
  * @since 0.1.0
11
11
  */
12
12
  export * as VirtualFileSystem from "./VirtualFileSystem.js";
13
+ /**
14
+ * Structured filesystem and configuration failures.
15
+ *
16
+ * @category re-exports
17
+ * @since 0.4.0
18
+ */
19
+ export * as VirtualFileSystemError from "./VirtualFileSystemError.js";
20
+ /**
21
+ * Live volume image boundary for storage adapters.
22
+ *
23
+ * @category re-exports
24
+ * @since 0.4.0
25
+ */
26
+ export * as LiveVolume from "./LiveVolume.js";
@@ -1 +1 @@
1
- {"version":3,"file":"bytePath.d.ts","sourceRoot":"","sources":["../../src/internal/bytePath.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,gBAAgB;AAChB,eAAO,MAAM,UAAU,EAAG,2BAAoC,CAAA;AAgC9D,gBAAgB;AAChB,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,QAC4B,CAAA;AAEjF,gBAAgB;AAChB,eAAO,MAAM,IAAI,UAAW,UAAU,KAAG,QAIxC,CAAA;AAED,gBAAgB;AAChB,eAAO,MAAM,QAAQ,SAAU,QAAQ,KAAG,UAAU,GAAG,SAAgC,CAAA"}
1
+ {"version":3,"file":"bytePath.d.ts","sourceRoot":"","sources":["../../src/internal/bytePath.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,gBAAgB;AAChB,eAAO,MAAM,UAAU,EAAG,2BAAoC,CAAA;AA6B9D,gBAAgB;AAChB,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,QAA6D,CAAA;AAElH,gBAAgB;AAChB,eAAO,MAAM,IAAI,UAAW,UAAU,KAAG,QAMxC,CAAA;AAED,gBAAgB;AAChB,eAAO,MAAM,QAAQ,SAAU,QAAQ,KAAG,UAAU,GAAG,SAAgC,CAAA"}
@@ -2,6 +2,8 @@
2
2
  import * as Equal from "effect/Equal";
3
3
  import * as Hash from "effect/Hash";
4
4
  import { pipeArguments } from "effect/Pipeable";
5
+ import * as Predicate from "effect/Predicate";
6
+ import { sameBytes } from "./bytes.js";
5
7
  /** @internal */
6
8
  export const BytePathId = "@effect-vfs/core/BytePath";
7
9
  const bytePaths = new WeakMap();
@@ -17,15 +19,7 @@ const BytePathProto = {
17
19
  [Equal.symbol](that) {
18
20
  if (!isBytePath(that))
19
21
  return false;
20
- const selfBytes = bytePaths.get(this);
21
- const thatBytes = bytePaths.get(that);
22
- if (selfBytes.length !== thatBytes.length)
23
- return false;
24
- for (let index = 0; index < selfBytes.length; index++) {
25
- if (selfBytes[index] !== thatBytes[index])
26
- return false;
27
- }
28
- return true;
22
+ return sameBytes(bytePaths.get(this), bytePaths.get(that));
29
23
  },
30
24
  [Hash.symbol]() {
31
25
  return hashBytes(bytePaths.get(this));
@@ -35,9 +29,10 @@ const BytePathProto = {
35
29
  }
36
30
  };
37
31
  /** @internal */
38
- export const isBytePath = (value) => typeof value === "object" && value !== null && bytePaths.has(value);
32
+ export const isBytePath = (value) => Predicate.isObject(value) && bytePaths.has(value);
39
33
  /** @internal */
40
34
  export const make = (bytes) => {
35
+ // SAFETY: BytePathProto implements every member of the opaque BytePath contract.
41
36
  const path = Object.create(BytePathProto);
42
37
  bytePaths.set(path, bytes);
43
38
  return Object.freeze(path);
@@ -0,0 +1,6 @@
1
+ import * as Order from "effect/Order";
2
+ /** @internal */
3
+ export declare const bytesOrder: Order.Order<Uint8Array>;
4
+ /** @internal */
5
+ export declare const sameBytes: (left: Uint8Array | undefined, right: Uint8Array | undefined) => boolean;
6
+ //# sourceMappingURL=bytes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/internal/bytes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAerC,gBAAgB;AAChB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAA4B,CAAA;AAG3E,gBAAgB;AAChB,eAAO,MAAM,SAAS,SAAU,UAAU,GAAG,SAAS,SAAS,UAAU,GAAG,SAAS,KAAG,OACU,CAAA"}
@@ -0,0 +1,17 @@
1
+ // Byte-array comparison shared by the overlay diff, the snapshot delta, and BytePath equality.
2
+ import * as Order from "effect/Order";
3
+ const compareBytes = (left, right) => {
4
+ const length = Math.min(left.length, right.length);
5
+ for (let index = 0; index < length; index++) {
6
+ const l = left[index];
7
+ const r = right[index];
8
+ if (l !== r)
9
+ return l < r ? -1 : 1;
10
+ }
11
+ return left.length === right.length ? 0 : left.length < right.length ? -1 : 1;
12
+ };
13
+ /** @internal */
14
+ export const bytesOrder = Order.make(compareBytes);
15
+ // A plain loop: Equal.equals would hash both arrays and memoise the pair in a WeakMap first.
16
+ /** @internal */
17
+ export const sameBytes = (left, right) => left === right || (left !== undefined && right !== undefined && compareBytes(left, right) === 0);
@@ -1,7 +1,15 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
+ declare const Encoded: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
4
+ type Encoded = typeof Encoded.Type;
1
5
  /** @internal */
2
- export declare const isCanonical: (value: string) => boolean;
3
- /** @internal */
4
- export declare const decodedLength: (value: string) => number;
5
- /** @internal */
6
- export declare const decodeTrusted: (value: string) => Uint8Array;
6
+ export declare const CanonicalBase64: {
7
+ Encoded: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
8
+ Bytes: Schema.decodeTo<Schema.Uint8Array, Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">, never, never>;
9
+ decode: (input: Encoded) => Effect.Effect<Uint8Array<ArrayBufferLike>, never, never>;
10
+ encode: (input: Uint8Array) => Encoded;
11
+ decodedLength: (value: Encoded) => number;
12
+ is: (value: string) => value is Encoded;
13
+ };
14
+ export {};
7
15
  //# sourceMappingURL=canonicalBase64.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"canonicalBase64.d.ts","sourceRoot":"","sources":["../../src/internal/canonicalBase64.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,OAGP,CAAA;AAErC,gBAAgB;AAChB,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,MACmC,CAAA;AAEjF,gBAAgB;AAChB,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,UAC4D,CAAA"}
1
+ {"version":3,"file":"canonicalBase64.d.ts","sourceRoot":"","sources":["../../src/internal/canonicalBase64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AA0BvC,QAAA,MAAM,OAAO,uEAGZ,CAAA;AASD,KAAK,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAElC,gBAAgB;AAChB,eAAO,MAAM,eAAe;;;oBAGV,OAAO;oBACP,UAAU,KAAG,OAAO;2BACb,OAAO,KAAG,MAAM;gBAC3B,MAAM,KAAG,KAAK,IAAI,OAAO;CACtC,CAAA"}
@@ -1,11 +1,33 @@
1
+ import * as Effect from "effect/Effect";
1
2
  import * as Encoding from "effect/Encoding";
2
- import * as Result from "effect/Result";
3
+ import * as Schema from "effect/Schema";
4
+ import * as SchemaGetter from "effect/SchemaGetter";
3
5
  const canonicalTail = /^(?:[A-Za-z0-9+/]{4}|[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?(?![\s\S])/;
4
- /** @internal */
5
- export const isCanonical = (value) => value.length % 4 === 0 &&
6
+ const isCanonical = (value) => value.length % 4 === 0 &&
6
7
  !/[^A-Za-z0-9+/]/.test(value.slice(0, -4)) &&
7
8
  canonicalTail.test(value.slice(-4));
9
+ const decodedLength = (value) => value.length / 4 * 3 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
10
+ const encode = (input) => {
11
+ // Join bounded chunks to avoid the encoder's intermediate string chains. Three-byte
12
+ // boundaries keep padding in the final chunk, preserving the canonical representation.
13
+ const chunkBytes = 12_288;
14
+ const chunks = [];
15
+ for (let offset = 0; offset < input.length; offset += chunkBytes) {
16
+ chunks.push(Encoding.encodeBase64(input.subarray(offset, offset + chunkBytes)));
17
+ }
18
+ return Encoded.make(chunks.join(""));
19
+ };
20
+ const Encoded = Schema.String.pipe(Schema.refine((value) => isCanonical(value), { expected: "canonical padded base64" }), Schema.brand("CanonicalBase64"));
21
+ const Bytes = Encoded.pipe(Schema.decodeTo(Schema.Uint8Array, {
22
+ decode: SchemaGetter.decodeBase64(),
23
+ encode: SchemaGetter.transform((input) => encode(input))
24
+ }));
8
25
  /** @internal */
9
- export const decodedLength = (value) => value.length / 4 * 3 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
10
- /** @internal */
11
- export const decodeTrusted = (value) => Result.getOrThrowWith(Encoding.decodeBase64(value), () => new Error("Invalid trusted canonical base64"));
26
+ export const CanonicalBase64 = {
27
+ Encoded,
28
+ Bytes,
29
+ decode: (input) => Schema.decodeEffect(Bytes)(input).pipe(Effect.orDie),
30
+ encode: (input) => encode(input),
31
+ decodedLength: (value) => decodedLength(value),
32
+ is: (value) => isCanonical(value)
33
+ };
@@ -2,122 +2,108 @@ import * as ByteSize from "effect/ByteSize";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Schema from "effect/Schema";
4
4
  import { ImageError, type Snapshot } from "../Snapshot.js";
5
- import * as CanonicalBase64 from "./canonicalBase64.js";
5
+ import { StoredMetadata } from "./metadata.js";
6
6
  /** @internal */
7
- export declare const StoredMetadata: Schema.Struct<{
8
- readonly uid: Schema.Natural;
9
- readonly gid: Schema.Natural;
10
- readonly mode: Schema.Natural;
11
- readonly atimeNs: Schema.String;
12
- readonly mtimeNs: Schema.String;
13
- readonly ctimeNs: Schema.String;
14
- readonly birthtimeNs: Schema.String;
15
- }>;
16
- /** @internal */
17
- export type StoredMetadata = typeof StoredMetadata.Type;
18
- /** @internal */
19
- export declare const Record: Schema.Union<readonly [Schema.Struct<{
20
- readonly id: Schema.String;
21
- readonly kind: Schema.Literal<"directory">;
22
- readonly metadata: Schema.Struct<{
23
- readonly uid: Schema.Natural;
24
- readonly gid: Schema.Natural;
25
- readonly mode: Schema.Natural;
26
- readonly atimeNs: Schema.String;
27
- readonly mtimeNs: Schema.String;
28
- readonly ctimeNs: Schema.String;
29
- readonly birthtimeNs: Schema.String;
30
- }>;
31
- readonly entries: Schema.$Array<Schema.Struct<{
32
- readonly name: Schema.String;
33
- readonly target: Schema.String;
34
- }>>;
35
- }>, Schema.Struct<{
36
- readonly id: Schema.String;
37
- readonly kind: Schema.Literal<"file">;
38
- readonly metadata: Schema.Struct<{
39
- readonly uid: Schema.Natural;
40
- readonly gid: Schema.Natural;
41
- readonly mode: Schema.Natural;
42
- readonly atimeNs: Schema.String;
43
- readonly mtimeNs: Schema.String;
44
- readonly ctimeNs: Schema.String;
45
- readonly birthtimeNs: Schema.String;
46
- }>;
47
- readonly data: Schema.String;
48
- }>, Schema.Struct<{
49
- readonly id: Schema.String;
50
- readonly kind: Schema.Literal<"symlink">;
51
- readonly metadata: Schema.Struct<{
52
- readonly uid: Schema.Natural;
53
- readonly gid: Schema.Natural;
54
- readonly mode: Schema.Natural;
55
- readonly atimeNs: Schema.String;
56
- readonly mtimeNs: Schema.String;
57
- readonly ctimeNs: Schema.String;
58
- readonly birthtimeNs: Schema.String;
59
- }>;
60
- readonly target: Schema.String;
61
- }>]>;
7
+ export { StoredMetadata };
62
8
  /** @internal */
63
- export type Record = typeof Record.Type;
64
- /** @internal */
65
- export declare const Document: Schema.Struct<{
66
- readonly format: Schema.Literal<"effect-vfs">;
67
- readonly version: Schema.Literal<1>;
68
- readonly root: Schema.String;
69
- readonly records: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
9
+ export declare const Record: Schema.TaggedUnion<{
10
+ readonly directory: Schema.TaggedStruct<"directory", {
70
11
  readonly id: Schema.String;
71
- readonly kind: Schema.Literal<"directory">;
72
12
  readonly metadata: Schema.Struct<{
73
13
  readonly uid: Schema.Natural;
74
14
  readonly gid: Schema.Natural;
75
15
  readonly mode: Schema.Natural;
76
- readonly atimeNs: Schema.String;
77
- readonly mtimeNs: Schema.String;
78
- readonly ctimeNs: Schema.String;
79
- readonly birthtimeNs: Schema.String;
16
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
17
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
18
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
19
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
80
20
  }>;
81
21
  readonly entries: Schema.$Array<Schema.Struct<{
82
- readonly name: Schema.String;
22
+ readonly name: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
83
23
  readonly target: Schema.String;
84
24
  }>>;
85
- }>, Schema.Struct<{
25
+ }>;
26
+ readonly file: Schema.TaggedStruct<"file", {
86
27
  readonly id: Schema.String;
87
- readonly kind: Schema.Literal<"file">;
88
28
  readonly metadata: Schema.Struct<{
89
29
  readonly uid: Schema.Natural;
90
30
  readonly gid: Schema.Natural;
91
31
  readonly mode: Schema.Natural;
92
- readonly atimeNs: Schema.String;
93
- readonly mtimeNs: Schema.String;
94
- readonly ctimeNs: Schema.String;
95
- readonly birthtimeNs: Schema.String;
32
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
33
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
34
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
35
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
96
36
  }>;
97
- readonly data: Schema.String;
98
- }>, Schema.Struct<{
37
+ readonly data: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
38
+ }>;
39
+ readonly symlink: Schema.TaggedStruct<"symlink", {
99
40
  readonly id: Schema.String;
100
- readonly kind: Schema.Literal<"symlink">;
101
41
  readonly metadata: Schema.Struct<{
102
42
  readonly uid: Schema.Natural;
103
43
  readonly gid: Schema.Natural;
104
44
  readonly mode: Schema.Natural;
105
- readonly atimeNs: Schema.String;
106
- readonly mtimeNs: Schema.String;
107
- readonly ctimeNs: Schema.String;
108
- readonly birthtimeNs: Schema.String;
45
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
46
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
47
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
48
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
109
49
  }>;
110
- readonly target: Schema.String;
111
- }>]>>;
50
+ readonly target: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
51
+ }>;
112
52
  }>;
113
53
  /** @internal */
114
- export type Document = typeof Document.Type;
115
- /** @internal */
116
- export declare const decodedLength: typeof CanonicalBase64.decodedLength;
54
+ export type Record = typeof Record.Type;
117
55
  /** @internal */
118
- export declare const base64: (input: Uint8Array) => string;
56
+ export declare const Document: Schema.Struct<{
57
+ readonly format: Schema.Literal<"effect-vfs">;
58
+ readonly version: Schema.Literal<1>;
59
+ readonly root: Schema.String;
60
+ readonly records: Schema.$Array<Schema.TaggedUnion<{
61
+ readonly directory: Schema.TaggedStruct<"directory", {
62
+ readonly id: Schema.String;
63
+ readonly metadata: Schema.Struct<{
64
+ readonly uid: Schema.Natural;
65
+ readonly gid: Schema.Natural;
66
+ readonly mode: Schema.Natural;
67
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
68
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
69
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
70
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
71
+ }>;
72
+ readonly entries: Schema.$Array<Schema.Struct<{
73
+ readonly name: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
74
+ readonly target: Schema.String;
75
+ }>>;
76
+ }>;
77
+ readonly file: Schema.TaggedStruct<"file", {
78
+ readonly id: Schema.String;
79
+ readonly metadata: Schema.Struct<{
80
+ readonly uid: Schema.Natural;
81
+ readonly gid: Schema.Natural;
82
+ readonly mode: Schema.Natural;
83
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
84
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
85
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
86
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
87
+ }>;
88
+ readonly data: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
89
+ }>;
90
+ readonly symlink: Schema.TaggedStruct<"symlink", {
91
+ readonly id: Schema.String;
92
+ readonly metadata: Schema.Struct<{
93
+ readonly uid: Schema.Natural;
94
+ readonly gid: Schema.Natural;
95
+ readonly mode: Schema.Natural;
96
+ readonly atimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
97
+ readonly mtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
98
+ readonly ctimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
99
+ readonly birthtimeNs: Schema.decodeTo<Schema.BigInt, Schema.String, never, never>;
100
+ }>;
101
+ readonly target: Schema.brand<Schema.refine<string, Schema.String>, "CanonicalBase64">;
102
+ }>;
103
+ }>>;
104
+ }>;
119
105
  /** @internal */
120
- export declare const bytes: (value: string) => Uint8Array;
106
+ export type Document = typeof Document.Type;
121
107
  /** @internal */
122
108
  export declare const inspect: (snapshot: Snapshot) => Effect.Effect<Document, ImageError>;
123
109
  /** @internal */
@@ -126,7 +112,7 @@ export declare const capture: (input: unknown, limits?: {
126
112
  readonly maxRecords: number;
127
113
  readonly maxEntries: number;
128
114
  readonly maxDecodedBytes: ByteSize.ByteSize;
129
- } | undefined) => Effect.Effect<Snapshot, ImageError, never>;
115
+ } | undefined, trusted?: any) => Effect.Effect<Snapshot, ImageError, never>;
130
116
  /** @internal */
131
117
  export declare const encodeSnapshot: (snapshot: Snapshot) => Effect.Effect<Uint8Array<ArrayBuffer>, ImageError, never>;
132
118
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/internal/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAgB,UAAU,EAAE,KAAK,QAAQ,EAAkB,MAAM,gBAAgB,CAAA;AACxF,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AAQvD,gBAAgB;AAChB,eAAO,MAAM,cAAc;;;;;;;;EAQzB,CAAA;AAEF,gBAAgB;AAChB,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAIvD,gBAAgB;AAChB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASjB,CAAA;AAEF,gBAAgB;AAChB,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC,gBAAgB;AAChB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnB,CAAA;AAEF,gBAAgB;AAChB,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAI3C,gBAAgB;AAChB,eAAO,MAAM,aAAa,sCAAgC,CAAA;AAE1D,gBAAgB;AAChB,eAAO,MAAM,MAAM,UAAW,UAAU,KAAG,MAU1C,CAAA;AAKD,gBAAgB;AAChB,eAAO,MAAM,KAAK,UAAW,MAAM,KAAG,UAErC,CAAA;AAED,gBAAgB;AAChB,eAAO,MAAM,OAAO,aAAc,QAAQ,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAI3E,CAAA;AAEJ,gBAAgB;AAChB,eAAO,MAAM,OAAO;;;;;4DAwElB,CAAA;AAEF,gBAAgB;AAChB,eAAO,MAAM,cAAc,mFAKzB,CAAA;AAEF,gBAAgB;AAChB,eAAO,MAAM,cAAc;;;;;gDAqB1B,CAAA"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/internal/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAgB,UAAU,EAAE,KAAK,QAAQ,EAAkB,MAAM,gBAAgB,CAAA;AAExF,OAAO,EAAE,cAAc,EAAsB,MAAM,eAAe,CAAA;AAMlE,gBAAgB;AAChB,OAAO,EAAE,cAAc,EAAE,CAAA;AAIzB,gBAAgB;AAChB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQjB,CAAA;AAEF,gBAAgB;AAChB,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC,gBAAgB;AAChB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnB,CAAA;AAwBF,gBAAgB;AAChB,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAI3C,gBAAgB;AAChB,eAAO,MAAM,OAAO,aAAc,QAAQ,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAO3E,CAAA;AAEJ,gBAAgB;AAChB,eAAO,MAAM,OAAO;;;;;2EAiJlB,CAAA;AAEF,gBAAgB;AAChB,eAAO,MAAM,cAAc,mFAMzB,CAAA;AAEF,gBAAgB;AAChB,eAAO,MAAM,cAAc;;;;;gDA+B1B,CAAA"}