@effect-dynamodb/schema 1.42.2 → 1.44.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 (61) hide show
  1. package/dist/Aggregate.d.ts +15 -3
  2. package/dist/Aggregate.d.ts.map +1 -1
  3. package/dist/Aggregate.js +4 -2
  4. package/dist/Aggregate.js.map +1 -1
  5. package/dist/DynamoModel.d.ts +227 -30
  6. package/dist/DynamoModel.d.ts.map +1 -1
  7. package/dist/DynamoModel.js +153 -38
  8. package/dist/DynamoModel.js.map +1 -1
  9. package/dist/Entity.d.ts +38 -10
  10. package/dist/Entity.d.ts.map +1 -1
  11. package/dist/Entity.js +32 -2
  12. package/dist/Entity.js.map +1 -1
  13. package/dist/Errors.d.ts +77 -4
  14. package/dist/Errors.d.ts.map +1 -1
  15. package/dist/Errors.js +36 -0
  16. package/dist/Errors.js.map +1 -1
  17. package/dist/index.d.ts +3 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/internal/AggregateCursor.d.ts +5 -0
  22. package/dist/internal/AggregateCursor.d.ts.map +1 -1
  23. package/dist/internal/AggregateSchemas.d.ts +54 -2
  24. package/dist/internal/AggregateSchemas.d.ts.map +1 -1
  25. package/dist/internal/AggregateSchemas.js +145 -4
  26. package/dist/internal/AggregateSchemas.js.map +1 -1
  27. package/dist/internal/AggregateTypes.d.ts +13 -5
  28. package/dist/internal/AggregateTypes.d.ts.map +1 -1
  29. package/dist/internal/BlobPointer.d.ts +157 -0
  30. package/dist/internal/BlobPointer.d.ts.map +1 -0
  31. package/dist/internal/BlobPointer.js +471 -0
  32. package/dist/internal/BlobPointer.js.map +1 -0
  33. package/dist/internal/Crc64Nvme.d.ts +42 -0
  34. package/dist/internal/Crc64Nvme.d.ts.map +1 -0
  35. package/dist/internal/Crc64Nvme.js +128 -0
  36. package/dist/internal/Crc64Nvme.js.map +1 -0
  37. package/dist/internal/EntityConfig.d.ts +30 -0
  38. package/dist/internal/EntityConfig.d.ts.map +1 -1
  39. package/dist/internal/EntityOffload.d.ts +112 -0
  40. package/dist/internal/EntityOffload.d.ts.map +1 -0
  41. package/dist/internal/EntityOffload.js +260 -0
  42. package/dist/internal/EntityOffload.js.map +1 -0
  43. package/dist/internal/EntityPacked.d.ts +11 -10
  44. package/dist/internal/EntityPacked.d.ts.map +1 -1
  45. package/dist/internal/EntityPacked.js +6 -5
  46. package/dist/internal/EntityPacked.js.map +1 -1
  47. package/dist/internal/EntitySchemas.d.ts +11 -2
  48. package/dist/internal/EntitySchemas.d.ts.map +1 -1
  49. package/dist/internal/EntitySchemas.js +37 -5
  50. package/dist/internal/EntitySchemas.js.map +1 -1
  51. package/dist/internal/EntityTypes.d.ts +40 -2
  52. package/dist/internal/EntityTypes.d.ts.map +1 -1
  53. package/dist/internal/PackedCodec.d.ts +82 -27
  54. package/dist/internal/PackedCodec.d.ts.map +1 -1
  55. package/dist/internal/PackedCodec.js +175 -44
  56. package/dist/internal/PackedCodec.js.map +1 -1
  57. package/dist/internal/Sha256.d.ts +34 -0
  58. package/dist/internal/Sha256.d.ts.map +1 -0
  59. package/dist/internal/Sha256.js +144 -0
  60. package/dist/internal/Sha256.js.map +1 -0
  61. package/package.json +1 -1
@@ -0,0 +1,157 @@
1
+ /**
2
+ * @internal The blob pointer codec — Packed header layout `010` (#179, design
3
+ * §4.2): the stored form of an offloaded value, naming the object version that
4
+ * holds it.
5
+ *
6
+ * ## Header (byte 0): `010 kk ccc`
7
+ *
8
+ * - bits 7–5, layout version: `010` (a blob pointer).
9
+ * - bits 4–3, kind: `00` json (an overflow field's value), `01` bytes (a
10
+ * binary field's value); `10`, `11` reserved.
11
+ * - bits 2–0, codec of the **object bytes**: `000` none, `001` gzip, `010`
12
+ * brotli, `011` zstd — json only, a bytes pointer is always `000`;
13
+ * `100`–`111` reserved.
14
+ *
15
+ * Writers emit `0x40`–`0x43` (json) and `0x48` (bytes); every other layout-`010`
16
+ * byte is refused.
17
+ *
18
+ * ## Body
19
+ *
20
+ * Integers are unsigned LEB128 (minimal encoding) unless sized; fixed
21
+ * multi-byte fields are big-endian.
22
+ *
23
+ * | Size | Field |
24
+ * |-------|-------|
25
+ * | 1 | header |
26
+ * | 4 | magic `EDBP` (`0x45 0x44 0x42 0x50`) |
27
+ * | 1 | flags — bit 0: a content type follows; bits 1–7 reserved, 0 |
28
+ * | 1 | checksum algorithm — `0x01` CRC-64/NVME (8 bytes); `0x02` SHA-256 is reserved and not written |
29
+ * | n | checksum (the content's, §5) |
30
+ * | var | object size — bytes of the stored object |
31
+ * | var | content size — bytes the checksum covers: the uncompressed JSON (json), the object (bytes) |
32
+ * | var+k | key length (1 … 1,024) + key (UTF-8) |
33
+ * | var+v | version length (0 … 1,024) + version (UTF-8; empty = an immutable key from a key-per-write store) |
34
+ * | var+c | when flags bit 0: content-type length (1 … 255) + content type (US-ASCII) |
35
+ * | 4 | trailer — low 32 bits of the CRC-64/NVME of every byte before it |
36
+ *
37
+ * ## Two stored forms of the same bytes
38
+ *
39
+ * - **Overflow fields** store the bytes as a `B` value.
40
+ * - **Binary fields** store them as `S` text: `~edbp:` followed by the
41
+ * unpadded base64url of the bytes. `~` and `:` are outside every base64
42
+ * alphabet, so no base64 text starts with the sentinel, and a reader that
43
+ * predates pointers fails the field's `Uint8Array` schema on the text instead
44
+ * of returning the pointer bytes as content.
45
+ *
46
+ * ## Strictness
47
+ *
48
+ * One pointer has exactly one encoding in each form: the decoder refuses
49
+ * reserved header, flag and algorithm values, a bad magic or trailer,
50
+ * truncation, trailing bytes, non-minimal or unsafe LEB128 integers, lengths
51
+ * out of range, invalid UTF-8, a non-ASCII content type, an object size that
52
+ * differs from the content size when nothing is compressed, and text that is
53
+ * padded or not canonical base64url. Every {@link BlobPointer} value — made by
54
+ * {@link make} or {@link decode} — is encodable, and decodes back to itself.
55
+ *
56
+ * Pure, synchronous and AWS-free: no fetching here. Callers resolve pointers.
57
+ *
58
+ * Not part of the public API.
59
+ */
60
+ import { Inspectable, Option, Pipeable } from "effect";
61
+ import type { CompressionCodec } from "../DynamoModel.js";
62
+ /** A stored object version: `version` `""` is an immutable key (a key-per-write store). */
63
+ export interface BlobRef {
64
+ readonly key: string;
65
+ readonly version: string;
66
+ }
67
+ /** A content checksum (design §5). Only CRC-64/NVME is written. */
68
+ export interface BlobChecksum {
69
+ readonly algorithm: "crc64nvme";
70
+ /** 8 bytes, most significant first. */
71
+ readonly value: Uint8Array;
72
+ }
73
+ /** What a pointer's value is: an overflow field's JSON, or a binary field's bytes. */
74
+ export type BlobPointerKind = "json" | "bytes";
75
+ /** The fields of a {@link BlobPointer}. */
76
+ export interface BlobPointerFields {
77
+ readonly kind: BlobPointerKind;
78
+ /** Codec of the object bytes; always `"none"` for a bytes pointer. */
79
+ readonly codec: CompressionCodec | "none";
80
+ readonly ref: BlobRef;
81
+ /** Bytes of the stored object. */
82
+ readonly objectSize: number;
83
+ /** Bytes the checksum covers: the uncompressed JSON (json), the object (bytes). */
84
+ readonly contentSize: number;
85
+ readonly checksum: BlobChecksum;
86
+ readonly contentType: Option.Option<string>;
87
+ }
88
+ export declare const BlobPointerTypeId: unique symbol;
89
+ export type BlobPointerTypeId = typeof BlobPointerTypeId;
90
+ /** A decoded blob pointer (Packed layout `010`). */
91
+ export interface BlobPointer extends BlobPointerFields, Pipeable.Pipeable, Inspectable.Inspectable {
92
+ readonly [BlobPointerTypeId]: BlobPointerTypeId;
93
+ }
94
+ /** True iff `u` is a {@link BlobPointer} — never true of a parsed JSON value. */
95
+ export declare const isBlobPointer: (u: unknown) => u is BlobPointer;
96
+ /** Layout version of a pointer (bits 7–5). */
97
+ export declare const LAYOUT_VERSION_POINTER = 2;
98
+ /** Kind codes (bits 4–3). */
99
+ export declare const KIND_JSON = 0;
100
+ export declare const KIND_BYTES = 1;
101
+ /** The magic after the header: ASCII `EDBP`. */
102
+ export declare const MAGIC: ReadonlyArray<number>;
103
+ /** Flags bit 0: a content type follows the version. */
104
+ export declare const FLAG_CONTENT_TYPE = 1;
105
+ /** Checksum algorithm codes. */
106
+ export declare const CHECKSUM_CRC64NVME = 1;
107
+ /** Reserved for adversarial integrity (design §5); not read or written by this version. */
108
+ export declare const CHECKSUM_SHA256 = 2;
109
+ /** Bounds of the length-prefixed fields, in bytes. */
110
+ export declare const MAX_KEY_BYTES = 1024;
111
+ export declare const MAX_VERSION_BYTES = 1024;
112
+ export declare const MAX_CONTENT_TYPE_BYTES = 255;
113
+ /** Bytes of the trailer. */
114
+ export declare const TRAILER_BYTES = 4;
115
+ /** The sentinel a binary field's `S` pointer text starts with. */
116
+ export declare const TEXT_PREFIX = "~edbp:";
117
+ /** A pointer header this version can read. */
118
+ export interface PointerHeader {
119
+ readonly version: 2;
120
+ readonly kind: BlobPointerKind;
121
+ readonly codec: CompressionCodec | "none";
122
+ }
123
+ /** The header byte of a pointer of `kind` whose object is compressed with `codec`. */
124
+ export declare const pointerHeaderByte: (kind: BlobPointerKind, codec: CompressionCodec | "none") => number;
125
+ /** True iff byte 0 of a `B` value has the pointer layout (`0x40`–`0x5F`). */
126
+ export declare const isPointerHeader: (byte: number) => boolean;
127
+ /**
128
+ * Parse a layout-`010` header byte. Returns a reason string for a reserved
129
+ * kind or codec. The caller has checked the layout version.
130
+ */
131
+ export declare const parsePointerHeader: (byte: number) => PointerHeader | string;
132
+ /**
133
+ * A pointer from its fields, or the reason they do not make one (an
134
+ * out-of-range length or size, a malformed string, a compressed bytes
135
+ * pointer, …). Every pointer made here is encodable.
136
+ */
137
+ export declare const make: (fields: BlobPointerFields) => BlobPointer | string;
138
+ /** The `B` form of `pointer`: header, body and trailer. */
139
+ export declare const encode: (pointer: BlobPointer) => Uint8Array;
140
+ /** The `S` form of `pointer`: `~edbp:` + the unpadded base64url of {@link encode}. */
141
+ export declare const encodeText: (pointer: BlobPointer) => string;
142
+ /**
143
+ * Decode the `B` form of a pointer, or return the reason it is not a valid
144
+ * one (see the module header's strictness rules). Accepts either kind; the
145
+ * caller checks the kind its attribute stores.
146
+ */
147
+ export declare const decode: (bytes: Uint8Array) => BlobPointer | string;
148
+ /** True iff `text` starts with the binary pointer sentinel `~edbp:`. */
149
+ export declare const isPointerText: (text: string) => boolean;
150
+ /**
151
+ * Decode the `S` form of a pointer: `undefined` when `text` does not start
152
+ * with `~edbp:` (it is not a pointer), the reason when it does but is not
153
+ * canonical unpadded base64url of a valid pointer, or the pointer. Accepts
154
+ * either kind; the caller checks the kind its attribute stores.
155
+ */
156
+ export declare const decodeText: (text: string) => BlobPointer | string | undefined;
157
+ //# sourceMappingURL=BlobPointer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobPointer.d.ts","sourceRoot":"","sources":["../../src/internal/BlobPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,QAAQ,CAAA;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAOzD,2FAA2F;AAC3F,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAA;IAC/B,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAC3B;AAED,sFAAsF;AACtF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAA;AAE9C,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAA;IACzC,QAAQ,CAAC,GAAG,E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CAAA;AAyBnC,8CAA8C;AAC9C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAA;CAC1C;AAED,sFAAsF;AACtF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,eAAe,EACrB,OAAO,gBAAgB,GAAG,MAAM,KAC/B,MAGgB,CAAA;AAEnB,6EAA6E;AAC7E,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,OAAgD,CAAA;AAE/F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,aAAa,GAAG,MAWjE,CAAA;AAuHD;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,QAAQ,iBAAiB,KAAG,WAAW,GAAG,MAG9D,CAAA;AAsBD,2DAA2D;AAC3D,eAAO,MAAM,MAAM,GAAI,SAAS,WAAW,KAAG,UAqB7C,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,UAAU,GAAI,SAAS,WAAW,KAAG,MACD,CAAA;AAsEjD;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,UAAU,KAAG,WAAW,GAAG,MAqExD,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OAAuC,CAAA;AAIpF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,WAAW,GAAG,MAAM,GAAG,SAehE,CAAA"}
@@ -0,0 +1,471 @@
1
+ /**
2
+ * @internal The blob pointer codec — Packed header layout `010` (#179, design
3
+ * §4.2): the stored form of an offloaded value, naming the object version that
4
+ * holds it.
5
+ *
6
+ * ## Header (byte 0): `010 kk ccc`
7
+ *
8
+ * - bits 7–5, layout version: `010` (a blob pointer).
9
+ * - bits 4–3, kind: `00` json (an overflow field's value), `01` bytes (a
10
+ * binary field's value); `10`, `11` reserved.
11
+ * - bits 2–0, codec of the **object bytes**: `000` none, `001` gzip, `010`
12
+ * brotli, `011` zstd — json only, a bytes pointer is always `000`;
13
+ * `100`–`111` reserved.
14
+ *
15
+ * Writers emit `0x40`–`0x43` (json) and `0x48` (bytes); every other layout-`010`
16
+ * byte is refused.
17
+ *
18
+ * ## Body
19
+ *
20
+ * Integers are unsigned LEB128 (minimal encoding) unless sized; fixed
21
+ * multi-byte fields are big-endian.
22
+ *
23
+ * | Size | Field |
24
+ * |-------|-------|
25
+ * | 1 | header |
26
+ * | 4 | magic `EDBP` (`0x45 0x44 0x42 0x50`) |
27
+ * | 1 | flags — bit 0: a content type follows; bits 1–7 reserved, 0 |
28
+ * | 1 | checksum algorithm — `0x01` CRC-64/NVME (8 bytes); `0x02` SHA-256 is reserved and not written |
29
+ * | n | checksum (the content's, §5) |
30
+ * | var | object size — bytes of the stored object |
31
+ * | var | content size — bytes the checksum covers: the uncompressed JSON (json), the object (bytes) |
32
+ * | var+k | key length (1 … 1,024) + key (UTF-8) |
33
+ * | var+v | version length (0 … 1,024) + version (UTF-8; empty = an immutable key from a key-per-write store) |
34
+ * | var+c | when flags bit 0: content-type length (1 … 255) + content type (US-ASCII) |
35
+ * | 4 | trailer — low 32 bits of the CRC-64/NVME of every byte before it |
36
+ *
37
+ * ## Two stored forms of the same bytes
38
+ *
39
+ * - **Overflow fields** store the bytes as a `B` value.
40
+ * - **Binary fields** store them as `S` text: `~edbp:` followed by the
41
+ * unpadded base64url of the bytes. `~` and `:` are outside every base64
42
+ * alphabet, so no base64 text starts with the sentinel, and a reader that
43
+ * predates pointers fails the field's `Uint8Array` schema on the text instead
44
+ * of returning the pointer bytes as content.
45
+ *
46
+ * ## Strictness
47
+ *
48
+ * One pointer has exactly one encoding in each form: the decoder refuses
49
+ * reserved header, flag and algorithm values, a bad magic or trailer,
50
+ * truncation, trailing bytes, non-minimal or unsafe LEB128 integers, lengths
51
+ * out of range, invalid UTF-8, a non-ASCII content type, an object size that
52
+ * differs from the content size when nothing is compressed, and text that is
53
+ * padded or not canonical base64url. Every {@link BlobPointer} value — made by
54
+ * {@link make} or {@link decode} — is encodable, and decodes back to itself.
55
+ *
56
+ * Pure, synchronous and AWS-free: no fetching here. Callers resolve pointers.
57
+ *
58
+ * Not part of the public API.
59
+ */
60
+ import { Inspectable, Option, Pipeable, Result } from "effect";
61
+ import { Base64Url } from "effect/encoding";
62
+ import { CRC64NVME_BYTES, crc64nvme } from "./Crc64Nvme.js";
63
+ export const BlobPointerTypeId = Symbol.for("effect-dynamodb/BlobPointer");
64
+ /** True iff `u` is a {@link BlobPointer} — never true of a parsed JSON value. */
65
+ export const isBlobPointer = (u) => typeof u === "object" && u !== null && BlobPointerTypeId in u;
66
+ // ---------------------------------------------------------------------------
67
+ // Layout constants
68
+ // ---------------------------------------------------------------------------
69
+ /** Layout version of a pointer (bits 7–5). */
70
+ export const LAYOUT_VERSION_POINTER = 0b010;
71
+ /** Kind codes (bits 4–3). */
72
+ export const KIND_JSON = 0b00;
73
+ export const KIND_BYTES = 0b01;
74
+ /** The magic after the header: ASCII `EDBP`. */
75
+ export const MAGIC = [0x45, 0x44, 0x42, 0x50];
76
+ /** Flags bit 0: a content type follows the version. */
77
+ export const FLAG_CONTENT_TYPE = 0x01;
78
+ /** Checksum algorithm codes. */
79
+ export const CHECKSUM_CRC64NVME = 0x01;
80
+ /** Reserved for adversarial integrity (design §5); not read or written by this version. */
81
+ export const CHECKSUM_SHA256 = 0x02;
82
+ /** Bounds of the length-prefixed fields, in bytes. */
83
+ export const MAX_KEY_BYTES = 1_024;
84
+ export const MAX_VERSION_BYTES = 1_024;
85
+ export const MAX_CONTENT_TYPE_BYTES = 255;
86
+ /** Bytes of the trailer. */
87
+ export const TRAILER_BYTES = 4;
88
+ /** The sentinel a binary field's `S` pointer text starts with. */
89
+ export const TEXT_PREFIX = "~edbp:";
90
+ /** The smallest valid pointer: a 1-byte key, empty version, no content type. */
91
+ const MIN_BYTES = 1 + MAGIC.length + 1 + 1 + CRC64NVME_BYTES + 1 + 1 + 1 + 1 + 1 + TRAILER_BYTES;
92
+ const codecCodes = {
93
+ none: 0b000,
94
+ gzip: 0b001,
95
+ brotli: 0b010,
96
+ zstd: 0b011,
97
+ };
98
+ const codecByCode = [
99
+ "none",
100
+ "gzip",
101
+ "brotli",
102
+ "zstd",
103
+ ];
104
+ const hex = (byte) => `0x${byte.toString(16).padStart(2, "0")}`;
105
+ /** The header byte of a pointer of `kind` whose object is compressed with `codec`. */
106
+ export const pointerHeaderByte = (kind, codec) => (LAYOUT_VERSION_POINTER << 5) |
107
+ ((kind === "json" ? KIND_JSON : KIND_BYTES) << 3) |
108
+ codecCodes[codec];
109
+ /** True iff byte 0 of a `B` value has the pointer layout (`0x40`–`0x5F`). */
110
+ export const isPointerHeader = (byte) => byte >>> 5 === LAYOUT_VERSION_POINTER;
111
+ /**
112
+ * Parse a layout-`010` header byte. Returns a reason string for a reserved
113
+ * kind or codec. The caller has checked the layout version.
114
+ */
115
+ export const parsePointerHeader = (byte) => {
116
+ const kind = (byte >>> 3) & 0b11;
117
+ const codec = byte & 0b111;
118
+ const what = `header byte ${hex(byte)} is a blob pointer (layout version 2)`;
119
+ if (kind !== KIND_JSON && kind !== KIND_BYTES)
120
+ return `${what} with reserved pointer kind ${kind}`;
121
+ const name = codecByCode[codec];
122
+ if (name === undefined)
123
+ return `${what} with unknown codec code ${codec}`;
124
+ if (kind === KIND_BYTES && name !== "none") {
125
+ return `${what} of kind bytes with codec ${name}: a compressed bytes pointer is reserved`;
126
+ }
127
+ return { version: 2, kind: kind === KIND_JSON ? "json" : "bytes", codec: name };
128
+ };
129
+ // ---------------------------------------------------------------------------
130
+ // Construction
131
+ // ---------------------------------------------------------------------------
132
+ const encoder = new TextEncoder();
133
+ // `ignoreBOM`: a leading U+FEFF is part of a key, not a byte-order mark.
134
+ const fatalDecoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
135
+ const hexOf = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
136
+ const PointerProto = Object.assign(Object.create(Inspectable.BaseProto), {
137
+ [BlobPointerTypeId]: BlobPointerTypeId,
138
+ pipe() {
139
+ return Pipeable.pipeArguments(this, arguments);
140
+ },
141
+ toJSON() {
142
+ return {
143
+ _id: "BlobPointer",
144
+ kind: this.kind,
145
+ codec: this.codec,
146
+ ref: { key: this.ref.key, version: this.ref.version },
147
+ objectSize: this.objectSize,
148
+ contentSize: this.contentSize,
149
+ checksum: { algorithm: this.checksum.algorithm, value: hexOf(this.checksum.value) },
150
+ contentType: Option.getOrUndefined(this.contentType),
151
+ };
152
+ },
153
+ });
154
+ /** The UTF-8 bytes of `text`, or `undefined` when it holds a lone surrogate. */
155
+ const utf8 = (text) => {
156
+ const bytes = encoder.encode(text);
157
+ // A lone surrogate encodes as U+FFFD: the text would not survive a round trip.
158
+ return fatalDecoder.decode(bytes) === text ? bytes : undefined;
159
+ };
160
+ const isSize = (n) => typeof n === "number" && Number.isSafeInteger(n) && n >= 0;
161
+ const isAscii = (text) => {
162
+ for (let i = 0; i < text.length; i++)
163
+ if (text.charCodeAt(i) > 0x7f)
164
+ return false;
165
+ return true;
166
+ };
167
+ /** Every field of a valid pointer, or the reason it is not one. */
168
+ const validate = (fields) => {
169
+ if (fields.kind !== "json" && fields.kind !== "bytes") {
170
+ return `kind ${String(fields.kind)} is not "json" or "bytes"`;
171
+ }
172
+ if (!Object.hasOwn(codecCodes, fields.codec))
173
+ return `codec ${String(fields.codec)} is unknown`;
174
+ if (fields.kind === "bytes" && fields.codec !== "none") {
175
+ return `a bytes pointer is never compressed (codec ${fields.codec})`;
176
+ }
177
+ if (typeof fields.ref?.key !== "string" || typeof fields.ref.version !== "string") {
178
+ return "ref must be { key: string, version: string }";
179
+ }
180
+ const key = utf8(fields.ref.key);
181
+ if (key === undefined)
182
+ return "the key is not well-formed Unicode";
183
+ if (key.length < 1 || key.length > MAX_KEY_BYTES) {
184
+ return `the key is ${key.length} UTF-8 bytes, outside 1 … ${MAX_KEY_BYTES}`;
185
+ }
186
+ const version = utf8(fields.ref.version);
187
+ if (version === undefined)
188
+ return "the version is not well-formed Unicode";
189
+ if (version.length > MAX_VERSION_BYTES) {
190
+ return `the version is ${version.length} UTF-8 bytes, over ${MAX_VERSION_BYTES}`;
191
+ }
192
+ if (!isSize(fields.objectSize))
193
+ return `object size ${fields.objectSize} is not a safe size`;
194
+ if (!isSize(fields.contentSize))
195
+ return `content size ${fields.contentSize} is not a safe size`;
196
+ if (fields.codec === "none" && fields.objectSize !== fields.contentSize) {
197
+ return (`object size ${fields.objectSize} differs from content size ${fields.contentSize}, ` +
198
+ "but nothing is compressed");
199
+ }
200
+ if (fields.checksum?.algorithm !== "crc64nvme") {
201
+ return `checksum algorithm ${String(fields.checksum?.algorithm)} is not "crc64nvme"`;
202
+ }
203
+ const value = fields.checksum.value;
204
+ if (!(value instanceof Uint8Array) || value.length !== CRC64NVME_BYTES) {
205
+ return `a crc64nvme checksum is ${CRC64NVME_BYTES} bytes`;
206
+ }
207
+ if (!Option.isOption(fields.contentType))
208
+ return "contentType must be an Option";
209
+ if (Option.isSome(fields.contentType)) {
210
+ const contentType = fields.contentType.value;
211
+ if (typeof contentType !== "string" || !isAscii(contentType)) {
212
+ return "the content type is not US-ASCII";
213
+ }
214
+ if (contentType.length < 1 || contentType.length > MAX_CONTENT_TYPE_BYTES) {
215
+ return `the content type is ${contentType.length} bytes, outside 1 … ${MAX_CONTENT_TYPE_BYTES}`;
216
+ }
217
+ }
218
+ return undefined;
219
+ };
220
+ const build = (fields) => Object.freeze(Object.assign(Object.create(PointerProto), {
221
+ kind: fields.kind,
222
+ codec: fields.codec,
223
+ ref: Object.freeze({ key: fields.ref.key, version: fields.ref.version }),
224
+ objectSize: fields.objectSize,
225
+ contentSize: fields.contentSize,
226
+ checksum: Object.freeze({
227
+ algorithm: "crc64nvme",
228
+ // A copy: the pointer never aliases its caller's (or the stored item's)
229
+ // bytes. Not `.slice()`: a Node `Buffer`'s `slice` is a view of the same
230
+ // memory. The bytes stay writable — a typed array cannot be frozen.
231
+ value: new Uint8Array(fields.checksum.value),
232
+ }),
233
+ contentType: fields.contentType,
234
+ }));
235
+ /**
236
+ * A pointer from its fields, or the reason they do not make one (an
237
+ * out-of-range length or size, a malformed string, a compressed bytes
238
+ * pointer, …). Every pointer made here is encodable.
239
+ */
240
+ export const make = (fields) => {
241
+ const reason = validate(fields);
242
+ return reason === undefined ? build(fields) : `invalid blob pointer: ${reason}`;
243
+ };
244
+ // ---------------------------------------------------------------------------
245
+ // LEB128
246
+ // ---------------------------------------------------------------------------
247
+ const pushLeb = (out, value) => {
248
+ let v = value;
249
+ while (v >= 0x80) {
250
+ out.push((v % 0x80) | 0x80);
251
+ v = Math.floor(v / 0x80);
252
+ }
253
+ out.push(v);
254
+ };
255
+ /** At most 8 groups: 56 bits, enough for every safe integer. */
256
+ const MAX_LEB_BYTES = 8;
257
+ // ---------------------------------------------------------------------------
258
+ // Encode
259
+ // ---------------------------------------------------------------------------
260
+ /** The `B` form of `pointer`: header, body and trailer. */
261
+ export const encode = (pointer) => {
262
+ const out = [pointerHeaderByte(pointer.kind, pointer.codec), ...MAGIC];
263
+ const contentType = Option.getOrUndefined(pointer.contentType);
264
+ out.push(contentType === undefined ? 0 : FLAG_CONTENT_TYPE, CHECKSUM_CRC64NVME);
265
+ for (const byte of pointer.checksum.value)
266
+ out.push(byte);
267
+ pushLeb(out, pointer.objectSize);
268
+ pushLeb(out, pointer.contentSize);
269
+ const key = encoder.encode(pointer.ref.key);
270
+ pushLeb(out, key.length);
271
+ for (const byte of key)
272
+ out.push(byte);
273
+ const version = encoder.encode(pointer.ref.version);
274
+ pushLeb(out, version.length);
275
+ for (const byte of version)
276
+ out.push(byte);
277
+ if (contentType !== undefined) {
278
+ pushLeb(out, contentType.length);
279
+ for (let i = 0; i < contentType.length; i++)
280
+ out.push(contentType.charCodeAt(i));
281
+ }
282
+ const bytes = new Uint8Array(out.length + TRAILER_BYTES);
283
+ bytes.set(out);
284
+ bytes.set(crc64nvme(bytes.subarray(0, out.length)).subarray(4), out.length);
285
+ return bytes;
286
+ };
287
+ /** The `S` form of `pointer`: `~edbp:` + the unpadded base64url of {@link encode}. */
288
+ export const encodeText = (pointer) => TEXT_PREFIX + Base64Url.encode(encode(pointer));
289
+ // ---------------------------------------------------------------------------
290
+ // Decode
291
+ // ---------------------------------------------------------------------------
292
+ class Reader {
293
+ bytes;
294
+ end;
295
+ offset;
296
+ constructor(bytes, offset, end) {
297
+ this.bytes = bytes;
298
+ this.end = end;
299
+ this.offset = offset;
300
+ }
301
+ /** An unsigned LEB128 safe integer, or the reason it is not one. */
302
+ leb(field) {
303
+ let value = 0;
304
+ let scale = 1;
305
+ for (let n = 0; n < MAX_LEB_BYTES; n++) {
306
+ if (this.offset >= this.end)
307
+ return `truncated in the ${field}`;
308
+ const byte = this.bytes[this.offset++];
309
+ value += (byte & 0x7f) * scale;
310
+ if ((byte & 0x80) === 0) {
311
+ if (byte === 0 && n > 0)
312
+ return `the ${field} is not minimally encoded`;
313
+ if (!Number.isSafeInteger(value))
314
+ return `the ${field} is not a safe integer`;
315
+ return value;
316
+ }
317
+ scale *= 0x80;
318
+ }
319
+ return `the ${field} is longer than ${MAX_LEB_BYTES} bytes`;
320
+ }
321
+ /** `length` bytes, or the reason they are not there. */
322
+ take(length, field) {
323
+ if (this.end - this.offset < length)
324
+ return `truncated in the ${field}`;
325
+ const out = this.bytes.subarray(this.offset, this.offset + length);
326
+ this.offset += length;
327
+ return out;
328
+ }
329
+ /** A length-prefixed field of `min … max` bytes, or the reason it is not one. */
330
+ prefixed(field, min, max) {
331
+ const length = this.leb(`${field} length`);
332
+ if (typeof length === "string")
333
+ return length;
334
+ if (length < min || length > max) {
335
+ return `the ${field} length ${length} is outside ${min} … ${max}`;
336
+ }
337
+ return this.take(length, field);
338
+ }
339
+ }
340
+ const utf8Text = (bytes) => {
341
+ try {
342
+ return fatalDecoder.decode(bytes);
343
+ }
344
+ catch {
345
+ return undefined;
346
+ }
347
+ };
348
+ const asciiText = (bytes) => {
349
+ let text = "";
350
+ for (const byte of bytes) {
351
+ if (byte > 0x7f)
352
+ return undefined;
353
+ text += String.fromCharCode(byte);
354
+ }
355
+ return text;
356
+ };
357
+ /**
358
+ * Decode the `B` form of a pointer, or return the reason it is not a valid
359
+ * one (see the module header's strictness rules). Accepts either kind; the
360
+ * caller checks the kind its attribute stores.
361
+ */
362
+ export const decode = (bytes) => {
363
+ if (bytes.length === 0)
364
+ return "the blob pointer is empty";
365
+ if (!isPointerHeader(bytes[0])) {
366
+ return `header byte ${hex(bytes[0])} is not a blob pointer (layout version 2)`;
367
+ }
368
+ const header = parsePointerHeader(bytes[0]);
369
+ if (typeof header === "string")
370
+ return header;
371
+ for (let i = 0; i < MAGIC.length; i++) {
372
+ if (bytes.length <= 1 + i)
373
+ return "the blob pointer is truncated in its magic";
374
+ if (bytes[1 + i] !== MAGIC[i])
375
+ return "the blob pointer has a bad magic (expected EDBP)";
376
+ }
377
+ if (bytes.length < MIN_BYTES) {
378
+ return `the blob pointer is truncated: ${bytes.length} bytes, under the minimum ${MIN_BYTES}`;
379
+ }
380
+ const end = bytes.length - TRAILER_BYTES;
381
+ const trailer = crc64nvme(bytes.subarray(0, end));
382
+ for (let i = 0; i < TRAILER_BYTES; i++) {
383
+ if (bytes[end + i] !== trailer[4 + i]) {
384
+ return "the blob pointer's trailer does not match its bytes (truncated or corrupt)";
385
+ }
386
+ }
387
+ const reader = new Reader(bytes, 1 + MAGIC.length, end);
388
+ const flags = bytes[reader.offset++];
389
+ if ((flags & ~FLAG_CONTENT_TYPE) !== 0) {
390
+ return `the blob pointer sets reserved flag bits (flags ${hex(flags)})`;
391
+ }
392
+ const algorithm = bytes[reader.offset++];
393
+ if (algorithm === CHECKSUM_SHA256) {
394
+ return "the blob pointer's checksum algorithm 0x02 (SHA-256) is reserved and not supported by this version";
395
+ }
396
+ if (algorithm !== CHECKSUM_CRC64NVME) {
397
+ return `the blob pointer has unknown checksum algorithm ${hex(algorithm)}`;
398
+ }
399
+ const checksum = reader.take(CRC64NVME_BYTES, "checksum");
400
+ if (typeof checksum === "string")
401
+ return checksum;
402
+ const objectSize = reader.leb("object size");
403
+ if (typeof objectSize === "string")
404
+ return objectSize;
405
+ const contentSize = reader.leb("content size");
406
+ if (typeof contentSize === "string")
407
+ return contentSize;
408
+ const keyBytes = reader.prefixed("key", 1, MAX_KEY_BYTES);
409
+ if (typeof keyBytes === "string")
410
+ return keyBytes;
411
+ const key = utf8Text(keyBytes);
412
+ if (key === undefined)
413
+ return "the blob pointer's key is not valid UTF-8";
414
+ const versionBytes = reader.prefixed("version", 0, MAX_VERSION_BYTES);
415
+ if (typeof versionBytes === "string")
416
+ return versionBytes;
417
+ const version = utf8Text(versionBytes);
418
+ if (version === undefined)
419
+ return "the blob pointer's version is not valid UTF-8";
420
+ let contentType = Option.none();
421
+ if ((flags & FLAG_CONTENT_TYPE) !== 0) {
422
+ const typeBytes = reader.prefixed("content type", 1, MAX_CONTENT_TYPE_BYTES);
423
+ if (typeof typeBytes === "string")
424
+ return typeBytes;
425
+ const text = asciiText(typeBytes);
426
+ if (text === undefined)
427
+ return "the blob pointer's content type is not US-ASCII";
428
+ contentType = Option.some(text);
429
+ }
430
+ if (reader.offset !== end) {
431
+ return `the blob pointer has ${end - reader.offset} unexpected bytes before its trailer`;
432
+ }
433
+ const fields = {
434
+ kind: header.kind,
435
+ codec: header.codec,
436
+ ref: { key, version },
437
+ objectSize,
438
+ contentSize,
439
+ checksum: { algorithm: "crc64nvme", value: checksum },
440
+ contentType,
441
+ };
442
+ const reason = validate(fields);
443
+ return reason === undefined ? build(fields) : `the blob pointer is invalid: ${reason}`;
444
+ };
445
+ /** True iff `text` starts with the binary pointer sentinel `~edbp:`. */
446
+ export const isPointerText = (text) => text.startsWith(TEXT_PREFIX);
447
+ const BASE64URL = /^[A-Za-z0-9_-]*$/;
448
+ /**
449
+ * Decode the `S` form of a pointer: `undefined` when `text` does not start
450
+ * with `~edbp:` (it is not a pointer), the reason when it does but is not
451
+ * canonical unpadded base64url of a valid pointer, or the pointer. Accepts
452
+ * either kind; the caller checks the kind its attribute stores.
453
+ */
454
+ export const decodeText = (text) => {
455
+ if (!isPointerText(text))
456
+ return undefined;
457
+ const body = text.slice(TEXT_PREFIX.length);
458
+ if (!BASE64URL.test(body) || body.length % 4 === 1) {
459
+ return `the text after "${TEXT_PREFIX}" is not unpadded base64url`;
460
+ }
461
+ const decoded = Base64Url.decode(body);
462
+ if (Result.isFailure(decoded)) {
463
+ return `the text after "${TEXT_PREFIX}" is not unpadded base64url`;
464
+ }
465
+ const bytes = decoded.success;
466
+ if (Base64Url.encode(bytes) !== body) {
467
+ return `the text after "${TEXT_PREFIX}" is not canonical base64url`;
468
+ }
469
+ return decode(bytes);
470
+ };
471
+ //# sourceMappingURL=BlobPointer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobPointer.js","sourceRoot":"","sources":["../../src/internal/BlobPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAoC3D,MAAM,CAAC,MAAM,iBAAiB,GAAkB,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;AAQzF,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAU,EAAoB,EAAE,CAC5D,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,iBAAiB,IAAI,CAAC,CAAA;AAE/D,8EAA8E;AAC9E,mBAAmB;AACnB,8EA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