effect-dynamodb 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 (221) hide show
  1. package/dist/Aggregate.d.ts +157 -20
  2. package/dist/Aggregate.d.ts.map +1 -1
  3. package/dist/Aggregate.js +1219 -286
  4. package/dist/Aggregate.js.map +1 -1
  5. package/dist/Batch.d.ts +17 -4
  6. package/dist/Batch.d.ts.map +1 -1
  7. package/dist/Batch.js +129 -62
  8. package/dist/Batch.js.map +1 -1
  9. package/dist/BlobGc.d.ts +243 -0
  10. package/dist/BlobGc.d.ts.map +1 -0
  11. package/dist/BlobGc.js +961 -0
  12. package/dist/BlobGc.js.map +1 -0
  13. package/dist/BlobStore.d.ts +83 -0
  14. package/dist/BlobStore.d.ts.map +1 -0
  15. package/dist/BlobStore.js +70 -0
  16. package/dist/BlobStore.js.map +1 -0
  17. package/dist/Collection.d.ts +88 -8
  18. package/dist/Collection.d.ts.map +1 -1
  19. package/dist/Collection.js +22 -26
  20. package/dist/Collection.js.map +1 -1
  21. package/dist/Collections.d.ts +0 -7
  22. package/dist/Collections.d.ts.map +1 -1
  23. package/dist/Collections.js +0 -16
  24. package/dist/Collections.js.map +1 -1
  25. package/dist/DynamoClient.d.ts +68 -35
  26. package/dist/DynamoClient.d.ts.map +1 -1
  27. package/dist/DynamoClient.js +58 -12
  28. package/dist/DynamoClient.js.map +1 -1
  29. package/dist/Entity.d.ts +403 -104
  30. package/dist/Entity.d.ts.map +1 -1
  31. package/dist/Entity.js +1771 -382
  32. package/dist/Entity.js.map +1 -1
  33. package/dist/EventStore.d.ts +323 -77
  34. package/dist/EventStore.d.ts.map +1 -1
  35. package/dist/EventStore.js +473 -96
  36. package/dist/EventStore.js.map +1 -1
  37. package/dist/Offload.d.ts +199 -0
  38. package/dist/Offload.d.ts.map +1 -0
  39. package/dist/Offload.js +120 -0
  40. package/dist/Offload.js.map +1 -0
  41. package/dist/Query.d.ts +132 -59
  42. package/dist/Query.d.ts.map +1 -1
  43. package/dist/Query.js +95 -31
  44. package/dist/Query.js.map +1 -1
  45. package/dist/StorageEncoding.d.ts +62 -15
  46. package/dist/StorageEncoding.d.ts.map +1 -1
  47. package/dist/StorageEncoding.js +108 -24
  48. package/dist/StorageEncoding.js.map +1 -1
  49. package/dist/Table.d.ts +1 -1
  50. package/dist/Table.d.ts.map +1 -1
  51. package/dist/Transaction.d.ts +16 -3
  52. package/dist/Transaction.d.ts.map +1 -1
  53. package/dist/Transaction.js +28 -9
  54. package/dist/Transaction.js.map +1 -1
  55. package/dist/blob/S3BlobStore.d.ts +178 -0
  56. package/dist/blob/S3BlobStore.d.ts.map +1 -0
  57. package/dist/blob/S3BlobStore.js +770 -0
  58. package/dist/blob/S3BlobStore.js.map +1 -0
  59. package/dist/blob/s3.d.ts +122 -0
  60. package/dist/blob/s3.d.ts.map +1 -0
  61. package/dist/blob/s3.js +143 -0
  62. package/dist/blob/s3.js.map +1 -0
  63. package/dist/index.d.ts +9 -3
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +4 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/internal/AggregateWrite.d.ts +130 -0
  68. package/dist/internal/AggregateWrite.d.ts.map +1 -0
  69. package/dist/internal/AggregateWrite.js +341 -0
  70. package/dist/internal/AggregateWrite.js.map +1 -0
  71. package/dist/internal/BlobCalls.d.ts +70 -0
  72. package/dist/internal/BlobCalls.d.ts.map +1 -0
  73. package/dist/internal/BlobCalls.js +105 -0
  74. package/dist/internal/BlobCalls.js.map +1 -0
  75. package/dist/internal/BlobKeys.d.ts +100 -0
  76. package/dist/internal/BlobKeys.d.ts.map +1 -0
  77. package/dist/internal/BlobKeys.js +135 -0
  78. package/dist/internal/BlobKeys.js.map +1 -0
  79. package/dist/internal/BlobLedger.d.ts +323 -0
  80. package/dist/internal/BlobLedger.d.ts.map +1 -0
  81. package/dist/internal/BlobLedger.js +1012 -0
  82. package/dist/internal/BlobLedger.js.map +1 -0
  83. package/dist/internal/BlobMetadata.d.ts +109 -0
  84. package/dist/internal/BlobMetadata.d.ts.map +1 -0
  85. package/dist/internal/BlobMetadata.js +249 -0
  86. package/dist/internal/BlobMetadata.js.map +1 -0
  87. package/dist/internal/BlobResolver.d.ts +146 -0
  88. package/dist/internal/BlobResolver.d.ts.map +1 -0
  89. package/dist/internal/BlobResolver.js +417 -0
  90. package/dist/internal/BlobResolver.js.map +1 -0
  91. package/dist/internal/BlobStoreContract.d.ts +214 -0
  92. package/dist/internal/BlobStoreContract.d.ts.map +1 -0
  93. package/dist/internal/BlobStoreContract.js +181 -0
  94. package/dist/internal/BlobStoreContract.js.map +1 -0
  95. package/dist/internal/BoundCrud.d.ts +153 -53
  96. package/dist/internal/BoundCrud.d.ts.map +1 -1
  97. package/dist/internal/BoundCrud.js +27 -5
  98. package/dist/internal/BoundCrud.js.map +1 -1
  99. package/dist/internal/BoundQuery.d.ts +49 -33
  100. package/dist/internal/BoundQuery.d.ts.map +1 -1
  101. package/dist/internal/BoundQuery.js +8 -2
  102. package/dist/internal/BoundQuery.js.map +1 -1
  103. package/dist/internal/BoundVectorQuery.d.ts +59 -25
  104. package/dist/internal/BoundVectorQuery.d.ts.map +1 -1
  105. package/dist/internal/BoundVectorQuery.js +38 -17
  106. package/dist/internal/BoundVectorQuery.js.map +1 -1
  107. package/dist/internal/Capacity.d.ts +17 -2
  108. package/dist/internal/Capacity.d.ts.map +1 -1
  109. package/dist/internal/Capacity.js +47 -9
  110. package/dist/internal/Capacity.js.map +1 -1
  111. package/dist/internal/ConditionHolds.d.ts.map +1 -1
  112. package/dist/internal/ConditionHolds.js +2 -8
  113. package/dist/internal/ConditionHolds.js.map +1 -1
  114. package/dist/internal/CredentialRefusal.d.ts.map +1 -1
  115. package/dist/internal/CredentialRefusal.js +4 -0
  116. package/dist/internal/CredentialRefusal.js.map +1 -1
  117. package/dist/internal/Digest.d.ts +4 -3
  118. package/dist/internal/Digest.d.ts.map +1 -1
  119. package/dist/internal/Digest.js +25 -82
  120. package/dist/internal/Digest.js.map +1 -1
  121. package/dist/internal/EntityCombinators.d.ts +93 -45
  122. package/dist/internal/EntityCombinators.d.ts.map +1 -1
  123. package/dist/internal/EntityCombinators.js +42 -7
  124. package/dist/internal/EntityCombinators.js.map +1 -1
  125. package/dist/internal/EntityOps.d.ts +47 -6
  126. package/dist/internal/EntityOps.d.ts.map +1 -1
  127. package/dist/internal/EntityOps.js +30 -10
  128. package/dist/internal/EntityOps.js.map +1 -1
  129. package/dist/internal/EventProjection.d.ts +99 -25
  130. package/dist/internal/EventProjection.d.ts.map +1 -1
  131. package/dist/internal/EventProjection.js +124 -33
  132. package/dist/internal/EventProjection.js.map +1 -1
  133. package/dist/internal/ExpressionLimits.d.ts +22 -3
  134. package/dist/internal/ExpressionLimits.d.ts.map +1 -1
  135. package/dist/internal/ExpressionLimits.js +46 -7
  136. package/dist/internal/ExpressionLimits.js.map +1 -1
  137. package/dist/internal/GcSupport.d.ts +258 -0
  138. package/dist/internal/GcSupport.d.ts.map +1 -0
  139. package/dist/internal/GcSupport.js +284 -0
  140. package/dist/internal/GcSupport.js.map +1 -0
  141. package/dist/internal/ItemSize.d.ts +7 -1
  142. package/dist/internal/ItemSize.d.ts.map +1 -1
  143. package/dist/internal/ItemSize.js +13 -5
  144. package/dist/internal/ItemSize.js.map +1 -1
  145. package/dist/internal/MemoryBlobStore.d.ts +203 -0
  146. package/dist/internal/MemoryBlobStore.d.ts.map +1 -0
  147. package/dist/internal/MemoryBlobStore.js +623 -0
  148. package/dist/internal/MemoryBlobStore.js.map +1 -0
  149. package/dist/internal/MultiProjection.d.ts +56 -28
  150. package/dist/internal/MultiProjection.d.ts.map +1 -1
  151. package/dist/internal/MultiProjection.js +9 -3
  152. package/dist/internal/MultiProjection.js.map +1 -1
  153. package/dist/internal/Multipart.d.ts +96 -0
  154. package/dist/internal/Multipart.d.ts.map +1 -0
  155. package/dist/internal/Multipart.js +143 -0
  156. package/dist/internal/Multipart.js.map +1 -0
  157. package/dist/internal/OffloadChange.d.ts +187 -0
  158. package/dist/internal/OffloadChange.d.ts.map +1 -0
  159. package/dist/internal/OffloadChange.js +391 -0
  160. package/dist/internal/OffloadChange.js.map +1 -0
  161. package/dist/internal/OffloadInput.d.ts +141 -0
  162. package/dist/internal/OffloadInput.d.ts.map +1 -0
  163. package/dist/internal/OffloadInput.js +236 -0
  164. package/dist/internal/OffloadInput.js.map +1 -0
  165. package/dist/internal/OffloadRead.d.ts +140 -0
  166. package/dist/internal/OffloadRead.d.ts.map +1 -0
  167. package/dist/internal/OffloadRead.js +369 -0
  168. package/dist/internal/OffloadRead.js.map +1 -0
  169. package/dist/internal/OffloadTypes.d.ts +182 -0
  170. package/dist/internal/OffloadTypes.d.ts.map +1 -0
  171. package/dist/internal/OffloadTypes.js +15 -0
  172. package/dist/internal/OffloadTypes.js.map +1 -0
  173. package/dist/internal/OffloadValues.d.ts +87 -0
  174. package/dist/internal/OffloadValues.d.ts.map +1 -0
  175. package/dist/internal/OffloadValues.js +114 -0
  176. package/dist/internal/OffloadValues.js.map +1 -0
  177. package/dist/internal/OffloadWrite.d.ts +267 -0
  178. package/dist/internal/OffloadWrite.d.ts.map +1 -0
  179. package/dist/internal/OffloadWrite.js +766 -0
  180. package/dist/internal/OffloadWrite.js.map +1 -0
  181. package/dist/internal/Packed.d.ts +58 -23
  182. package/dist/internal/Packed.d.ts.map +1 -1
  183. package/dist/internal/Packed.js +108 -33
  184. package/dist/internal/Packed.js.map +1 -1
  185. package/dist/internal/ProjectionEngine.d.ts +28 -3
  186. package/dist/internal/ProjectionEngine.d.ts.map +1 -1
  187. package/dist/internal/ProjectionEngine.js +47 -9
  188. package/dist/internal/ProjectionEngine.js.map +1 -1
  189. package/dist/internal/RangePlanner.d.ts +3 -6
  190. package/dist/internal/RangePlanner.d.ts.map +1 -1
  191. package/dist/internal/RangePlanner.js +3 -29
  192. package/dist/internal/RangePlanner.js.map +1 -1
  193. package/dist/internal/Rekey.d.ts +16 -0
  194. package/dist/internal/Rekey.d.ts.map +1 -1
  195. package/dist/internal/Rekey.js +31 -2
  196. package/dist/internal/Rekey.js.map +1 -1
  197. package/dist/internal/StoredPointer.d.ts +19 -0
  198. package/dist/internal/StoredPointer.d.ts.map +1 -0
  199. package/dist/internal/StoredPointer.js +59 -0
  200. package/dist/internal/StoredPointer.js.map +1 -0
  201. package/dist/internal/TransactPlan.d.ts +18 -1
  202. package/dist/internal/TransactPlan.d.ts.map +1 -1
  203. package/dist/internal/TransactPlan.js +50 -10
  204. package/dist/internal/TransactPlan.js.map +1 -1
  205. package/dist/internal/TransactWriteOps.d.ts +33 -12
  206. package/dist/internal/TransactWriteOps.d.ts.map +1 -1
  207. package/dist/internal/TransactWriteOps.js +49 -19
  208. package/dist/internal/TransactWriteOps.js.map +1 -1
  209. package/dist/internal/TransactableOps.d.ts +58 -11
  210. package/dist/internal/TransactableOps.d.ts.map +1 -1
  211. package/dist/internal/TransactableOps.js +95 -19
  212. package/dist/internal/TransactableOps.js.map +1 -1
  213. package/dist/internal/Utf8Order.d.ts +21 -0
  214. package/dist/internal/Utf8Order.d.ts.map +1 -0
  215. package/dist/internal/Utf8Order.js +44 -0
  216. package/dist/internal/Utf8Order.js.map +1 -0
  217. package/dist/internal/WriteDiagnosis.d.ts +7 -1
  218. package/dist/internal/WriteDiagnosis.d.ts.map +1 -1
  219. package/dist/internal/WriteDiagnosis.js +12 -16
  220. package/dist/internal/WriteDiagnosis.js.map +1 -1
  221. package/package.json +15 -4
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @internal Object keys of offloaded values (#179, design §4.5).
3
+ *
4
+ * ```
5
+ * key = <offload.prefix, else the store prefix> P "/" F "/" O
6
+ *
7
+ * P = hex128(SHA-256("edd-blob/1" 0x00 table 0x00 canon(pk))) — the partition
8
+ * F = hex128(SHA-256(P 0x00 canon(family sk))) — the item family
9
+ * O = hex128(SHA-256(F 0x00 canon(row sk) 0x00 attribute)) — the row + attribute
10
+ * ```
11
+ *
12
+ * - `hex128` is the first 16 bytes of the digest as 32 lowercase hex
13
+ * characters.
14
+ * - `canon` writes a key attribute value with its type: `s:` + text, `n:` +
15
+ * the number's canonical text (below), `b:` + standard base64. `S "1"` and
16
+ * `N 1` differ.
17
+ * - Strings enter the digests as UTF-8; `P` and `F` enter the next level as
18
+ * their hex text.
19
+ * - `table` is the physical table name.
20
+ *
21
+ * Every key is the prefix plus {@link HASHED_KEY_BYTES} bytes, so it never
22
+ * leaks an item key into S3 logs or inventories, and its length is known
23
+ * before upload (the item budget counts a pointer at its upper bound, §6.3).
24
+ *
25
+ * The family prefix (`…P/F/`) holds every object any row of the item family
26
+ * ever had; the partition prefix (`…P/`) holds a whole aggregate or stream.
27
+ * GC trusts the trailing `P/F` to decide what is a table's own (§11.2), so the
28
+ * digest is a fixed, vendored SHA-256 — never a service (`effect/crypto`'s
29
+ * `Digest`), which tests may stub and unbound write paths do not have.
30
+ *
31
+ * Pure and synchronous. Not part of the public API.
32
+ */
33
+ /**
34
+ * A key attribute value in its DynamoDB wire shape. A table key is always a
35
+ * string, number or binary; the library's own tables key on strings.
36
+ */
37
+ export type KeyAttributeValue = {
38
+ readonly S: string;
39
+ } | {
40
+ readonly N: string;
41
+ } | {
42
+ readonly B: Uint8Array;
43
+ };
44
+ /** Hex characters in one key segment (`hex128`). */
45
+ export declare const HASH_HEX_CHARS = 32;
46
+ /** Bytes a key adds to its prefix: `P/F/O`. */
47
+ export declare const HASHED_KEY_BYTES: number;
48
+ /** The domain separator of the partition digest, versioning the key scheme. */
49
+ export declare const KEY_SCHEME = "edd-blob/1";
50
+ /** The family sort key of EventStore rows: the stream is the family (§4.5). */
51
+ export declare const STREAM_FAMILY_SK: KeyAttributeValue;
52
+ /**
53
+ * The canonical text of a DynamoDB number: equal numbers get equal text,
54
+ * whatever their spelling (`"1.50"`, `"015e-1"`, `"1.5E0"` → `"15e-1"`; zero
55
+ * → `"0"`), so a key read back from DynamoDB (which trims zeros) hashes like
56
+ * the one written.
57
+ *
58
+ * @throws when `text` is not a decimal number.
59
+ */
60
+ export declare const canonicalNumber: (text: string) => string;
61
+ /** A key attribute value with its type: `s:` text, `n:` canonical number, `b:` base64. */
62
+ export declare const canon: (value: KeyAttributeValue) => string;
63
+ /** `P`: the partition of `pk` in `table`. */
64
+ export declare const partitionHash: (table: string, pk: KeyAttributeValue) => string;
65
+ /** `F`: the item family of `familySk` in partition `partition`. */
66
+ export declare const familyHash: (partition: string, familySk: KeyAttributeValue) => string;
67
+ /**
68
+ * `O`: the row `rowSk`'s `attribute` in family `family`.
69
+ *
70
+ * @throws when `attribute` contains U+0000 — the separator. A row key may
71
+ * contain it, so the digest input stays unambiguous only while attribute
72
+ * names do not (DynamoDB attribute names in practice never do).
73
+ */
74
+ export declare const objectHash: (family: string, rowSk: KeyAttributeValue, attribute: string) => string;
75
+ /** Where an offloaded value of one row attribute lives (§4.5's table of rows). */
76
+ export interface BlobKeyTarget {
77
+ /** The physical table name. */
78
+ readonly table: string;
79
+ readonly pk: KeyAttributeValue;
80
+ /**
81
+ * The item family's sort key: the live SK for an entity's rows (its time-series
82
+ * events and lifecycle copies included), {@link STREAM_FAMILY_SK} for an
83
+ * EventStore stream, the edge item's SK for an aggregate edge.
84
+ */
85
+ readonly familySk: KeyAttributeValue;
86
+ /**
87
+ * The row's own sort key: the live SK, a time-series event item's SK, an
88
+ * EventStore event or snapshot SK, an edge item's SK.
89
+ */
90
+ readonly rowSk: KeyAttributeValue;
91
+ /** The stored attribute name. */
92
+ readonly attribute: string;
93
+ }
94
+ /** `<prefix>P/`: every object of a partition (an aggregate, a stream). */
95
+ export declare const partitionPrefix: (prefix: string, target: Pick<BlobKeyTarget, "table" | "pk">) => string;
96
+ /** `<prefix>P/F/`: every object any row of the item family ever had. */
97
+ export declare const familyPrefix: (prefix: string, target: Pick<BlobKeyTarget, "table" | "pk" | "familySk">) => string;
98
+ /** `<prefix>P/F/O`: the stable key of one row attribute's object. */
99
+ export declare const objectKey: (prefix: string, target: BlobKeyTarget)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CAAA;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,0EAA0E;AAC1E,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAAC,KAC1C,MAA+D,CAAA;AAElE,wEAAwE;AACxE,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,EACd,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,GAAG,UAAU,CAAC,KACvD,MAGF,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,QAAQ,aAAa,KAAG,MAIjE,CAAA"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @internal Object keys of offloaded values (#179, design §4.5).
3
+ *
4
+ * ```
5
+ * key = <offload.prefix, else the store prefix> P "/" F "/" O
6
+ *
7
+ * P = hex128(SHA-256("edd-blob/1" 0x00 table 0x00 canon(pk))) — the partition
8
+ * F = hex128(SHA-256(P 0x00 canon(family sk))) — the item family
9
+ * O = hex128(SHA-256(F 0x00 canon(row sk) 0x00 attribute)) — the row + attribute
10
+ * ```
11
+ *
12
+ * - `hex128` is the first 16 bytes of the digest as 32 lowercase hex
13
+ * characters.
14
+ * - `canon` writes a key attribute value with its type: `s:` + text, `n:` +
15
+ * the number's canonical text (below), `b:` + standard base64. `S "1"` and
16
+ * `N 1` differ.
17
+ * - Strings enter the digests as UTF-8; `P` and `F` enter the next level as
18
+ * their hex text.
19
+ * - `table` is the physical table name.
20
+ *
21
+ * Every key is the prefix plus {@link HASHED_KEY_BYTES} bytes, so it never
22
+ * leaks an item key into S3 logs or inventories, and its length is known
23
+ * before upload (the item budget counts a pointer at its upper bound, §6.3).
24
+ *
25
+ * The family prefix (`…P/F/`) holds every object any row of the item family
26
+ * ever had; the partition prefix (`…P/`) holds a whole aggregate or stream.
27
+ * GC trusts the trailing `P/F` to decide what is a table's own (§11.2), so the
28
+ * digest is a fixed, vendored SHA-256 — never a service (`effect/crypto`'s
29
+ * `Digest`), which tests may stub and unbound write paths do not have.
30
+ *
31
+ * Pure and synchronous. Not part of the public API.
32
+ */
33
+ import { sha256 } from "@effect-dynamodb/schema/internal/Sha256.js";
34
+ import { Base64 } from "effect/encoding";
35
+ /** Hex characters in one key segment (`hex128`). */
36
+ export const HASH_HEX_CHARS = 32;
37
+ /** Bytes a key adds to its prefix: `P/F/O`. */
38
+ export const HASHED_KEY_BYTES = HASH_HEX_CHARS * 3 + 2;
39
+ /** The domain separator of the partition digest, versioning the key scheme. */
40
+ export const KEY_SCHEME = "edd-blob/1";
41
+ /** The family sort key of EventStore rows: the stream is the family (§4.5). */
42
+ export const STREAM_FAMILY_SK = Object.freeze({ S: "" });
43
+ const encoder = new TextEncoder();
44
+ const hex128 = (parts) => {
45
+ const chunks = parts.map((part) => encoder.encode(part));
46
+ const separators = chunks.length - 1;
47
+ const input = new Uint8Array(chunks.reduce((n, chunk) => n + chunk.length, separators));
48
+ let offset = 0;
49
+ chunks.forEach((chunk, i) => {
50
+ input.set(chunk, offset);
51
+ offset += chunk.length;
52
+ // 0x00 between parts (a fresh array is zero-filled)
53
+ if (i < separators)
54
+ offset += 1;
55
+ });
56
+ const digest = sha256(input);
57
+ let out = "";
58
+ for (let i = 0; i < 16; i++)
59
+ out += digest[i].toString(16).padStart(2, "0");
60
+ return out;
61
+ };
62
+ const NUMBER_RE = /^([+-]?)(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/;
63
+ /**
64
+ * The canonical text of a DynamoDB number: equal numbers get equal text,
65
+ * whatever their spelling (`"1.50"`, `"015e-1"`, `"1.5E0"` → `"15e-1"`; zero
66
+ * → `"0"`), so a key read back from DynamoDB (which trims zeros) hashes like
67
+ * the one written.
68
+ *
69
+ * @throws when `text` is not a decimal number.
70
+ */
71
+ export const canonicalNumber = (text) => {
72
+ const match = NUMBER_RE.exec(text);
73
+ const [, sign = "", whole = "", fraction = "", exponent = "0"] = match ?? [];
74
+ if (match === null || whole.length + fraction.length === 0) {
75
+ throw new Error(`BlobKeys: ${JSON.stringify(text)} is not a DynamoDB number`);
76
+ }
77
+ let digits = (whole + fraction).replace(/^0+/, "");
78
+ let exp = Number(exponent) - fraction.length;
79
+ if (!Number.isSafeInteger(exp)) {
80
+ throw new Error(`BlobKeys: the exponent of ${JSON.stringify(text)} is out of range`);
81
+ }
82
+ if (digits.length === 0)
83
+ return "0";
84
+ const trimmed = digits.replace(/0+$/, "");
85
+ exp += digits.length - trimmed.length;
86
+ digits = trimmed;
87
+ return `${sign === "-" ? "-" : ""}${digits}e${exp}`;
88
+ };
89
+ /** A key attribute value with its type: `s:` text, `n:` canonical number, `b:` base64. */
90
+ export const canon = (value) => {
91
+ const v = value;
92
+ if (typeof v.S === "string")
93
+ return `s:${v.S}`;
94
+ if (typeof v.N === "string")
95
+ return `n:${canonicalNumber(v.N)}`;
96
+ if (v.B instanceof Uint8Array)
97
+ return `b:${Base64.encode(v.B)}`;
98
+ throw new Error("BlobKeys: a key attribute value must be { S }, { N } or { B }");
99
+ };
100
+ /** `P`: the partition of `pk` in `table`. */
101
+ export const partitionHash = (table, pk) => {
102
+ if (table.length === 0 || table.includes("\u0000")) {
103
+ throw new Error(`BlobKeys: invalid table name ${JSON.stringify(table)}`);
104
+ }
105
+ return hex128([KEY_SCHEME, table, canon(pk)]);
106
+ };
107
+ /** `F`: the item family of `familySk` in partition `partition`. */
108
+ export const familyHash = (partition, familySk) => hex128([partition, canon(familySk)]);
109
+ /**
110
+ * `O`: the row `rowSk`'s `attribute` in family `family`.
111
+ *
112
+ * @throws when `attribute` contains U+0000 — the separator. A row key may
113
+ * contain it, so the digest input stays unambiguous only while attribute
114
+ * names do not (DynamoDB attribute names in practice never do).
115
+ */
116
+ export const objectHash = (family, rowSk, attribute) => {
117
+ if (attribute.length === 0 || attribute.includes("\u0000")) {
118
+ throw new Error(`BlobKeys: invalid attribute name ${JSON.stringify(attribute)}`);
119
+ }
120
+ return hex128([family, canon(rowSk), attribute]);
121
+ };
122
+ /** `<prefix>P/`: every object of a partition (an aggregate, a stream). */
123
+ export const partitionPrefix = (prefix, target) => `${prefix}${partitionHash(target.table, target.pk)}/`;
124
+ /** `<prefix>P/F/`: every object any row of the item family ever had. */
125
+ export const familyPrefix = (prefix, target) => {
126
+ const partition = partitionHash(target.table, target.pk);
127
+ return `${prefix}${partition}/${familyHash(partition, target.familySk)}/`;
128
+ };
129
+ /** `<prefix>P/F/O`: the stable key of one row attribute's object. */
130
+ export const objectKey = (prefix, target) => {
131
+ const partition = partitionHash(target.table, target.pk);
132
+ const family = familyHash(partition, target.familySk);
133
+ return `${prefix}${partition}/${family}/${objectHash(family, target.rowSk, target.attribute)}`;
134
+ };
135
+ //# sourceMappingURL=BlobKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobKeys.js","sourceRoot":"","sources":["../../src/internal/BlobKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4CAA4C,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAWxC,oDAAoD;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAEhC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,GAAG,CAAC,GAAG,CAAC,CAAA;AAEtD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA;AAEtC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAsB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;AAE3E,MAAM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AoC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAClF,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;AAClD,CAAC,CAAA;AAsBD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EACd,MAA2C,EACnC,EAAE,CAAC,GAAG,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAA;AAElE,wEAAwE;AACxE,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,MAAwD,EAChD,EAAE;IACV,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACxD,OAAO,GAAG,MAAM,GAAG,SAAS,IAAI,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAA;AAC3E,CAAC,CAAA;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,MAAqB,EAAU,EAAE;IACzE,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACxD,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAA;IACrD,OAAO,GAAG,MAAM,GAAG,SAAS,IAAI,MAAM,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,CAAA;AAChG,CAAC,CAAA"}
@@ -0,0 +1,323 @@
1
+ /**
2
+ * @internal The upload ledger (#179, design §6.2): who owns an offloaded
3
+ * value's upload until DynamoDB has decided whether the write that carries
4
+ * its pointer committed.
5
+ *
6
+ * - **Root.** The outermost library operation that can upload opens a ledger
7
+ * ({@link root}); nested library calls reuse it. `Capacity.detachContext`
8
+ * clears it from a bound client's captured context, as it clears the
9
+ * current operation, so a bound op joins the ledger of whatever runs it.
10
+ * - **Entries.** Every upload ({@link upload}) becomes an entry — its ref, the
11
+ * store it went to, its target (table, entity, attribute, row key), when it
12
+ * started, and its state, starting `pending`. An upload of the same content
13
+ * to the same key in one ledger is memoised: a re-planned transaction, a
14
+ * rebuilt `additionalItems`, a `commandHandler` retry that decides the same
15
+ * content upload once.
16
+ * - **Streams and handles** (design §3.8, §7). A stream is single-use: it
17
+ * uploads once, for one key of one ledger, memoised by its identity — a
18
+ * second key, a later operation or a retry after its upload failed is
19
+ * refused (`[EDD-9120]`). A handle's content is copied into a new version
20
+ * (the store's `copy` within the handle's own store, else streamed into a
21
+ * `put`), never shared. A `put` (or `copy`) failure that says its multipart
22
+ * upload may have completed (`completeLost`), and a `put` or `copy` an
23
+ * interruption cut short (`interrupted`), are reported at exit.
24
+ * - **Settling.** `Capacity.client`, the one place every library DynamoDB
25
+ * request goes through, hands each write request of a ledger with entries to
26
+ * {@link guard}: it refuses a request carrying an upload older than its
27
+ * store's `maxUploadAge` (`BlobStoreError { reason: "Expired" }`, nothing
28
+ * sent), gives a `TransactWriteItems` or PartiQL `ExecuteTransaction` the
29
+ * library's own `ClientRequestToken` and a single-item write `ReturnValuesOnConditionCheckFailure:
30
+ * "ALL_OLD"`, and settles the entries the request carries by its outcome —
31
+ * `$metadata.attempts`, the token, the `ALL_OLD` / `ALL_NEW` evidence
32
+ * (the table of §6.2).
33
+ * - **Lattice.** `pending < rejected < inDoubt < committed`: an entry only
34
+ * moves up, so a version attempt 2 committed is never deleted because
35
+ * attempt 1 was rejected.
36
+ * - **Exit.** When the root exits — success, failure or interruption — the
37
+ * `pending` and `rejected` entries are deleted (uninterruptibly, one
38
+ * `store.delete` per store, best-effort: a failed delete never replaces the
39
+ * operation's outcome). `inDoubt` entries, failed deletes and uploads whose
40
+ * version no entry names (a lost multipart completion; a store call an
41
+ * interruption cut short; a store answer that names no version of the
42
+ * requested key, which is refused and never deleted) are logged at
43
+ * `Warning` and delivered to the
44
+ * `Offload.layerObserver` observer.
45
+ * - **Read cache.** Each buffered entry's content (the JSON text, or the
46
+ * bytes) is kept by ref, so decoding what the operation just wrote never
47
+ * fetches it. A stream's or a copy's content is never in hand, so is not.
48
+ *
49
+ * No AWS SDK import: requests and responses are read structurally.
50
+ *
51
+ * Not part of the public API (`Offload.layerObserver` is).
52
+ */
53
+ import type { CompressionCodec } from "@effect-dynamodb/schema/DynamoModel.js";
54
+ import type { BlobStoreError, ValidationError } from "@effect-dynamodb/schema/Errors.js";
55
+ import { type BlobChecksum, type BlobPointer, type BlobRef } from "@effect-dynamodb/schema/internal/BlobPointer.js";
56
+ import { Context, Deferred, Effect, Layer, Option, Semaphore, Stream } from "effect";
57
+ import { type BlobStoreService } from "./BlobStoreContract.js";
58
+ import { type BlobHandle } from "./OffloadValues.js";
59
+ /** Why an upload could not be settled. */
60
+ export type UnsettledReason =
61
+ /** The outcome of the DynamoDB write that carried it is unknown: the version is kept. */
62
+ "inDoubt"
63
+ /** DynamoDB rejected the write, but deleting the version failed: it is left behind. */
64
+ | "rollbackFailed"
65
+ /** A multipart upload completed but its response was lost: the version has no pointer. */
66
+ | "completeLost"
67
+ /**
68
+ * The operation was interrupted while a store call (`put` or `copy`) was in
69
+ * flight: whatever version the store wrote — a `PutObject` or `CopyObject`
70
+ * it received, a `CompleteMultipartUpload` that answered as the
71
+ * interruption arrived — has no pointer. Reported for every interrupted
72
+ * call, written or not: the library cannot see inside the call.
73
+ */
74
+ | "interrupted"
75
+ /**
76
+ * The store's answer to the upload broke the contract (no ref, a ref outside
77
+ * the requested key, a ref it had already returned): whatever version it
78
+ * wrote has no pointer.
79
+ */
80
+ | "answerRefused";
81
+ /**
82
+ * An upload the library could not settle. The item it was written for is the
83
+ * one to queue for `gc.sweep`; leaks no process could report are found by
84
+ * `gc.sweepStore`.
85
+ */
86
+ export interface UnsettledUpload {
87
+ readonly reason: UnsettledReason;
88
+ /** The physical table name. */
89
+ readonly table: string;
90
+ /** The entity type, or `"<stream>.event"` / `"<stream>.snapshot"`. */
91
+ readonly entityType: string;
92
+ /** The stored attribute name. */
93
+ readonly attribute: string;
94
+ /** The library operation that uploaded it, e.g. `"Entity.put"`. */
95
+ readonly operation: string;
96
+ /** The primary key of the row it was written for (stored attribute names). */
97
+ readonly rowKey: Readonly<Record<string, unknown>>;
98
+ /** The object key. */
99
+ readonly key: string;
100
+ /**
101
+ * The object version; `Option.none()` when it is unknown (`completeLost`,
102
+ * `interrupted`, `answerRefused`).
103
+ */
104
+ readonly ref: Option.Option<BlobRef>;
105
+ /** The store's `name`. */
106
+ readonly store: string;
107
+ /** Why: the failed delete's error, the lost response's, the refused answer's `Rejected` error. */
108
+ readonly cause?: unknown;
109
+ }
110
+ /** Options of `Offload.layerObserver`. */
111
+ export interface ObserverOptions {
112
+ /**
113
+ * Called once per upload the library could not settle, after the operation
114
+ * that made it exits. A failure is logged at `Warning` and never changes the
115
+ * operation's result.
116
+ */
117
+ readonly onUnsettled: (upload: UnsettledUpload) => Effect.Effect<void>;
118
+ }
119
+ /** The unsettled-upload observer. Default: none. */
120
+ export declare const Observer: Context.Reference<ObserverOptions | undefined>;
121
+ /**
122
+ * Deliver every upload the library could not settle to `onUnsettled`, for
123
+ * everything run under this layer (and every client bound while it was in
124
+ * context).
125
+ */
126
+ export declare const layerObserver: (options: ObserverOptions) => Layer.Layer<never>;
127
+ /** Where an entry stands: it only moves up. */
128
+ export type EntryState = "pending" | "rejected" | "inDoubt" | "committed";
129
+ /** The row attribute an upload is for. */
130
+ export interface UploadTarget {
131
+ readonly table: string;
132
+ /** The entity type, or `"<stream>.event"` / `"<stream>.snapshot"`. */
133
+ readonly entityType: string;
134
+ /** The stored attribute name. */
135
+ readonly attribute: string;
136
+ /** The row's primary key (stored attribute names). */
137
+ readonly rowKey: Readonly<Record<string, unknown>>;
138
+ /** The library operation, e.g. `"Entity.put"`. */
139
+ readonly operation: string;
140
+ /**
141
+ * The member's rows copy pointers (`versioned: { retain }`, `softDelete`,
142
+ * `timeSeries`): an `ALL_OLD` image without the pointer then does not prove
143
+ * the write never committed — an earlier commit's pointer may live on in a
144
+ * snapshot, tombstone or event the live row no longer shows.
145
+ */
146
+ readonly copiesPointers: boolean;
147
+ }
148
+ /** What an upload holds: the uncompressed JSON (json), or the bytes. */
149
+ export type LedgerContent = {
150
+ readonly kind: "json";
151
+ readonly text: string;
152
+ } | {
153
+ readonly kind: "bytes";
154
+ readonly bytes: Uint8Array;
155
+ };
156
+ /** One upload. */
157
+ export interface LedgerEntry {
158
+ readonly ref: BlobRef;
159
+ /** The store it went to, which rollback deletes from. */
160
+ readonly store: BlobStoreService;
161
+ readonly target: UploadTarget;
162
+ /** Epoch millis, from the uploading fiber's `Clock`, taken before the store call. */
163
+ readonly startedAt: number;
164
+ /** The pointer naming it (`undefined` when the store's answer was refused). */
165
+ readonly pointer: BlobPointer | undefined;
166
+ state: EntryState;
167
+ }
168
+ interface Memo {
169
+ readonly deferred: Deferred.Deferred<Uploaded, BlobStoreError | ValidationError>;
170
+ }
171
+ /** A settled-to-be upload: its entry and the pointer naming it. */
172
+ interface Uploaded {
173
+ readonly entry: LedgerEntry;
174
+ readonly pointer: BlobPointer;
175
+ }
176
+ /** A root operation's uploads. */
177
+ export interface Ledger {
178
+ readonly entries: Map<string, LedgerEntry>;
179
+ readonly memo: Map<BlobStoreService, Map<string, Memo>>;
180
+ readonly cache: Map<string, LedgerContent>;
181
+ readonly permits: Map<BlobStoreService, Semaphore.Semaphore>;
182
+ /** The `ClientRequestToken`s this ledger gave transactions. */
183
+ readonly tokens: Set<string>;
184
+ /**
185
+ * Uploads whose version no entry names (`completeLost`, `interrupted`,
186
+ * `answerRefused`): reported at exit.
187
+ */
188
+ readonly lost: Array<UnsettledUpload>;
189
+ closed: boolean;
190
+ }
191
+ /** The ledger of the root operation the fiber runs in. Never captured by a bind site. */
192
+ export declare const CurrentLedger: Context.Reference<Ledger | undefined>;
193
+ /** The open ledger of the current fiber, if any. */
194
+ export declare const current: Effect.Effect<Ledger | undefined>;
195
+ /** What the ledger uploaded under `ref`, if it did. */
196
+ export declare const cached: (ledger: Ledger | undefined, ref: BlobRef) => LedgerContent | undefined;
197
+ /**
198
+ * Keep `content` in the ledger's read cache as what `ref` names, though the
199
+ * ledger did not upload it: a read pointer a projection's row rewrite reuses
200
+ * (design §6.11), whose content the write just compared — decoding the
201
+ * write's result then fetches nothing. No entry: nothing settles or rolls it
202
+ * back.
203
+ */
204
+ export declare const remember: (ledger: Ledger | undefined, ref: BlobRef, content: LedgerContent) => void;
205
+ /**
206
+ * Run `effect` as the root of a ledger, or in the ledger already open: every
207
+ * upload inside it is settled by the requests that carry it and, at exit,
208
+ * rolled back when DynamoDB provably did not commit it.
209
+ */
210
+ export declare const root: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
211
+ /** {@link root} when `enabled` (a member that offloads something), else `effect`. */
212
+ export declare const rootIf: <A, E, R>(enabled: boolean, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
213
+ /** True iff `member` (an entity) offloads a field. */
214
+ export declare const offloads: (member: unknown) => boolean;
215
+ /**
216
+ * A stream to upload (design §3.8, §7): **single-use** — run at most once,
217
+ * for one target object. Its checksum is computed as it is consumed.
218
+ */
219
+ export interface StreamContent {
220
+ readonly kind: "stream";
221
+ readonly stream: Stream.Stream<Uint8Array, unknown>;
222
+ /** The caller's `Stream` value, which single use is keyed on. */
223
+ readonly identity: object;
224
+ /** The body's length, when the caller gave it (`Offload.source`). */
225
+ readonly contentLength: number | undefined;
226
+ }
227
+ /**
228
+ * A handle's content, to copy into a new version (design §3.8): with the
229
+ * store's `copy` when the handle reads from the target store, else streamed
230
+ * from the handle into a `put`.
231
+ */
232
+ export interface CopyContent {
233
+ readonly kind: "copy";
234
+ readonly handle: BlobHandle;
235
+ }
236
+ /** What an upload sends: buffered content, a stream, or a handle's content. */
237
+ export type UploadContent = LedgerContent | StreamContent | CopyContent;
238
+ /** One value to upload. */
239
+ export interface UploadSpec {
240
+ readonly store: BlobStoreService;
241
+ /** The derived object key (design §4.5). */
242
+ readonly key: string;
243
+ /** The content: the uncompressed JSON (json), the field's bytes, a stream or a handle. */
244
+ readonly content: UploadContent;
245
+ /** Codec of the object bytes (json only; `"none"` for bytes). */
246
+ readonly codec: CompressionCodec | "none";
247
+ /** The object bytes, when compressed (buffered content only). Default: the content's bytes. */
248
+ readonly body?: Uint8Array | undefined;
249
+ /** The object's `Content-Type` (design §4.4). */
250
+ readonly contentType: string;
251
+ /** The content type the pointer records, if any. */
252
+ readonly pointerContentType?: string | undefined;
253
+ /**
254
+ * The object metadata (design §4.6), or its builder given the content
255
+ * checksum: the ledger computes that checksum once, for the memo key, the
256
+ * pointer and the metadata, which it builds only when the upload is not
257
+ * memoised. A stream's checksum is known only once it is consumed, so its
258
+ * builder is given a zero checksum — metadata records one only for
259
+ * compressed json, never for bytes.
260
+ */
261
+ readonly metadata: Readonly<Record<string, string>> | ((checksum: BlobChecksum) => Readonly<Record<string, string>>);
262
+ readonly target: UploadTarget;
263
+ }
264
+ /** What an upload fails with: the store's failure, or an unusable input (`[EDD-9120]`). */
265
+ export type UploadError = BlobStoreError | ValidationError;
266
+ /**
267
+ * Why a stream cannot be uploaded to `key` of `store` in `ledger`, or
268
+ * `undefined` when it can (its first use, or the same upload again: a
269
+ * re-planned or retried request reuses its pointer). A stream is consumed
270
+ * once, for one target object: never for a second object, by a later
271
+ * operation, or again after its upload failed.
272
+ */
273
+ export declare const streamRefusal: (ledger: Ledger | undefined, identity: object, store: BlobStoreService, key: string) => string | undefined;
274
+ /** The `[EDD-9120]` refusal of a stream {@link streamRefusal} refused. */
275
+ export declare const singleUseError: (entityType: string, operation: string, attribute: string, why: string) => ValidationError;
276
+ /**
277
+ * Upload one value through the current ledger and return the pointer that
278
+ * names it. The entry is `pending` until a request carrying the pointer
279
+ * settles it. The same content for the same key and store in one ledger
280
+ * uploads once (an upload older than the store's `maxUploadAge` that no
281
+ * request committed is not reused); a stream uploads at most once, for one
282
+ * key (`[EDD-9120]` otherwise). Uploads run at the store's
283
+ * `writeConcurrency` per ledger.
284
+ *
285
+ * Dies when no ledger is open: every write path runs under a root.
286
+ */
287
+ export declare const upload: {
288
+ /** Buffered content never fails with a `ValidationError`. */
289
+ (spec: UploadSpec & {
290
+ readonly content: LedgerContent;
291
+ }): Effect.Effect<BlobPointer, BlobStoreError>;
292
+ (spec: UploadSpec): Effect.Effect<BlobPointer, UploadError>;
293
+ };
294
+ /**
295
+ * The write commands a ledger settles. A PartiQL request is one too (`insert()`, design §6.2);
296
+ * one that only reads (`SELECT`) carries no pointer to settle ({@link refsOfRequest}).
297
+ */
298
+ export declare const WRITE_COMMANDS: ReadonlySet<string>;
299
+ /** The ledger a request of `command` settles: an open one with entries, for a write. */
300
+ export declare const settling: (ledger: Ledger | undefined, command: string) => Ledger | undefined;
301
+ type Item = Readonly<Record<string, unknown>>;
302
+ /**
303
+ * The first attribute of a marshalled row that holds a well-formed blob pointer, in either stored
304
+ * form and at any depth, whatever its member now declares; `undefined` when none does. Rekey's
305
+ * backstop (design §11.10): a row holding one must never move.
306
+ */
307
+ export declare const pointerAttributeOf: (item: unknown) => string | undefined;
308
+ /** The refs of every pointer an item (a marshalled image) holds. */
309
+ export declare const refsOfItem: (item: unknown) => Set<string>;
310
+ /** The SDK exception name of a client failure. */
311
+ export declare const errorName: (error: unknown) => string | undefined;
312
+ /** `$metadata.attempts` of a client failure (on the SDK error it wraps), if reported. */
313
+ export declare const attemptsOf: (error: unknown) => number | undefined;
314
+ /**
315
+ * Send one write request of a ledger with entries (`send` is the choke
316
+ * point's own sending): refuse it with `Expired` when it carries an upload
317
+ * older than its store's `maxUploadAge`, prepare it ({@link prepare}), and
318
+ * settle the entries it carries by its outcome. A request carrying none of
319
+ * the ledger's uploads is sent unchanged.
320
+ */
321
+ export declare const guard: <A, E, R>(ledger: Ledger, command: string, input: Item, send: (input: Item) => Effect.Effect<A, E, R>, isNotSent: (error: unknown) => boolean) => Effect.Effect<A, E | BlobStoreError, R>;
322
+ export {};
323
+ //# sourceMappingURL=BlobLedger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobLedger.d.ts","sourceRoot":"","sources":["../../src/internal/BlobLedger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACxF,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,KAAK,OAAO,EAMb,MAAM,iDAAiD,CAAA;AAExD,OAAO,EAGL,OAAO,EACP,QAAQ,EAER,MAAM,EAEN,KAAK,EACL,MAAM,EACN,SAAS,EACT,MAAM,EACP,MAAM,QAAQ,CAAA;AAEf,OAAO,EAKL,KAAK,gBAAgB,EAEtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,oBAAoB,CAAA;AAMnE,0CAA0C;AAC1C,MAAM,MAAM,eAAe;AACzB,yFAAyF;AACvF,SAAS;AACX,uFAAuF;GACrF,gBAAgB;AAClB,0FAA0F;GACxF,cAAc;AAChB;;;;;;GAMG;GACD,aAAa;AACf;;;;GAIG;GACD,eAAe,CAAA;AAEnB;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,mEAAmE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