@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.2 → 1.0.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 (409) hide show
  1. package/README.md +390 -193
  2. package/dist/{backfill → cjs/backfill}/backfill.d.ts +15 -12
  3. package/dist/cjs/backfill/backfill.js +177 -0
  4. package/dist/{checkpointer → cjs/checkpointer}/actions/delete-thread.d.ts +1 -1
  5. package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
  6. package/dist/{checkpointer → cjs/checkpointer}/actions/get-tuple.d.ts +4 -3
  7. package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
  8. package/dist/{checkpointer → cjs/checkpointer}/actions/list.d.ts +7 -4
  9. package/dist/cjs/checkpointer/actions/list.js +70 -0
  10. package/dist/{checkpointer → cjs/checkpointer}/actions/put-writes.d.ts +8 -6
  11. package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
  12. package/dist/{checkpointer → cjs/checkpointer}/actions/put.d.ts +21 -15
  13. package/dist/cjs/checkpointer/actions/put.js +79 -0
  14. package/dist/{checkpointer → cjs/checkpointer}/internal/delta-history.d.ts +38 -26
  15. package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
  16. package/dist/{checkpointer → cjs/checkpointer}/internal/listing.d.ts +4 -4
  17. package/dist/cjs/checkpointer/internal/listing.js +104 -0
  18. package/dist/{checkpointer → cjs/checkpointer}/internal/parse.d.ts +51 -15
  19. package/dist/cjs/checkpointer/internal/parse.js +184 -0
  20. package/dist/{checkpointer → cjs/checkpointer}/internal/pending-writes.d.ts +64 -25
  21. package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
  22. package/dist/{checkpointer → cjs/checkpointer}/internal/read.d.ts +15 -10
  23. package/dist/cjs/checkpointer/internal/read.js +132 -0
  24. package/dist/{checkpointer → cjs/checkpointer}/internal/rows.d.ts +94 -21
  25. package/dist/cjs/checkpointer/internal/rows.js +356 -0
  26. package/dist/{checkpointer → cjs/checkpointer}/internal/setup.d.ts +13 -20
  27. package/dist/cjs/checkpointer/internal/setup.js +25 -0
  28. package/dist/{checkpointer → cjs/checkpointer}/saver.d.ts +72 -36
  29. package/dist/cjs/checkpointer/saver.js +56 -0
  30. package/dist/{checkpointer → cjs/checkpointer}/types.d.ts +1 -1
  31. package/dist/cjs/checkpointer/types.js +2 -0
  32. package/dist/{factory → cjs/factory}/factory.d.ts +25 -20
  33. package/dist/cjs/factory/factory.js +137 -0
  34. package/dist/{factory → cjs/factory}/types.d.ts +12 -12
  35. package/dist/cjs/factory/types.js +2 -0
  36. package/dist/{history → cjs/history}/actions/add-messages.d.ts +18 -10
  37. package/dist/cjs/history/actions/add-messages.js +17 -0
  38. package/dist/{history → cjs/history}/actions/clear.d.ts +1 -1
  39. package/dist/cjs/history/actions/clear.js +29 -0
  40. package/dist/{history → cjs/history}/actions/get-messages.d.ts +11 -9
  41. package/dist/cjs/history/actions/get-messages.js +58 -0
  42. package/dist/{history → cjs/history}/actions/list-sessions.d.ts +3 -3
  43. package/dist/cjs/history/actions/list-sessions.js +67 -0
  44. package/dist/{history → cjs/history}/actions/reconcile-count.d.ts +13 -9
  45. package/dist/cjs/history/actions/reconcile-count.js +8 -0
  46. package/dist/{history → cjs/history}/chat-message-history.d.ts +62 -30
  47. package/dist/cjs/history/chat-message-history.js +61 -0
  48. package/dist/{history → cjs/history}/internal/append.d.ts +64 -32
  49. package/dist/cjs/history/internal/append.js +267 -0
  50. package/dist/{history → cjs/history}/internal/message-read.d.ts +3 -3
  51. package/dist/cjs/history/internal/message-read.js +93 -0
  52. package/dist/{history → cjs/history}/internal/parse.d.ts +2 -2
  53. package/dist/cjs/history/internal/parse.js +113 -0
  54. package/dist/{history → cjs/history}/internal/rows.d.ts +11 -10
  55. package/dist/cjs/history/internal/rows.js +96 -0
  56. package/dist/{history → cjs/history}/internal/session.d.ts +41 -22
  57. package/dist/cjs/history/internal/session.js +296 -0
  58. package/dist/{history → cjs/history}/internal/setup.d.ts +2 -2
  59. package/dist/cjs/history/internal/setup.js +60 -0
  60. package/dist/{history → cjs/history}/session-adapter.d.ts +0 -6
  61. package/dist/cjs/history/session-adapter.js +38 -0
  62. package/dist/{history → cjs/history}/types.d.ts +18 -15
  63. package/dist/cjs/history/types.js +2 -0
  64. package/dist/{index.d.ts → cjs/index.d.ts} +27 -27
  65. package/dist/cjs/index.js +25 -0
  66. package/dist/cjs/package.json +1 -0
  67. package/dist/{shared → cjs/shared}/adapter.d.ts +27 -16
  68. package/dist/cjs/shared/adapter.js +70 -0
  69. package/dist/cjs/shared/clock.js +14 -0
  70. package/dist/{shared → cjs/shared}/codec/codec.d.ts +37 -20
  71. package/dist/cjs/shared/codec/codec.js +162 -0
  72. package/dist/{shared → cjs/shared}/codec/compression.d.ts +9 -4
  73. package/dist/cjs/shared/codec/compression.js +45 -0
  74. package/dist/cjs/shared/codec/json-serde.js +58 -0
  75. package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +2 -1
  76. package/dist/cjs/shared/codec/s3/client-types.js +6 -0
  77. package/dist/{shared → cjs/shared}/codec/s3/client.d.ts +25 -7
  78. package/dist/cjs/shared/codec/s3/client.js +78 -0
  79. package/dist/{shared → cjs/shared}/codec/s3/config.d.ts +12 -7
  80. package/dist/cjs/shared/codec/s3/config.js +92 -0
  81. package/dist/{shared → cjs/shared}/codec/s3/lifecycle.d.ts +71 -17
  82. package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
  83. package/dist/{shared → cjs/shared}/codec/s3/offloader.d.ts +42 -29
  84. package/dist/cjs/shared/codec/s3/offloader.js +289 -0
  85. package/dist/cjs/shared/concurrency.js +31 -0
  86. package/dist/{shared → cjs/shared}/dynamodb/abort.d.ts +2 -2
  87. package/dist/cjs/shared/dynamodb/abort.js +16 -0
  88. package/dist/{shared → cjs/shared}/dynamodb/batch-write.d.ts +2 -2
  89. package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
  90. package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
  91. package/dist/{shared → cjs/shared}/dynamodb/client.d.ts +24 -22
  92. package/dist/cjs/shared/dynamodb/client.js +40 -0
  93. package/dist/{shared → cjs/shared}/dynamodb/idempotent-write.d.ts +64 -19
  94. package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
  95. package/dist/{shared → cjs/shared}/dynamodb/paginate.d.ts +2 -2
  96. package/dist/cjs/shared/dynamodb/paginate.js +90 -0
  97. package/dist/{shared → cjs/shared}/dynamodb/partition-delete.d.ts +6 -6
  98. package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
  99. package/dist/{shared → cjs/shared}/dynamodb/recency-index.d.ts +27 -15
  100. package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
  101. package/dist/{shared → cjs/shared}/dynamodb/retry.d.ts +37 -6
  102. package/dist/cjs/shared/dynamodb/retry.js +193 -0
  103. package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
  104. package/dist/cjs/shared/dynamodb/row-size.js +30 -0
  105. package/dist/{shared → cjs/shared}/dynamodb/table-schema.d.ts +27 -18
  106. package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
  107. package/dist/{shared → cjs/shared}/errors/base-error.d.ts +42 -7
  108. package/dist/cjs/shared/errors/base-error.js +73 -0
  109. package/dist/{shared → cjs/shared}/errors/boundary.d.ts +29 -14
  110. package/dist/cjs/shared/errors/boundary.js +61 -0
  111. package/dist/cjs/shared/errors/classify.d.ts +206 -0
  112. package/dist/cjs/shared/errors/classify.js +232 -0
  113. package/dist/{shared → cjs/shared}/errors/error-code.d.ts +17 -10
  114. package/dist/cjs/shared/errors/error-code.js +27 -0
  115. package/dist/{shared → cjs/shared}/errors/errors.d.ts +75 -9
  116. package/dist/cjs/shared/errors/errors.js +123 -0
  117. package/dist/cjs/shared/logging/logger.js +30 -0
  118. package/dist/{shared → cjs/shared}/logging/redaction.d.ts +8 -4
  119. package/dist/cjs/shared/logging/redaction.js +145 -0
  120. package/dist/{shared → cjs/shared}/logging/secret-patterns.d.ts +30 -7
  121. package/dist/cjs/shared/logging/secret-patterns.js +93 -0
  122. package/dist/cjs/shared/logging/truncate.js +31 -0
  123. package/dist/{shared → cjs/shared}/options.d.ts +27 -11
  124. package/dist/cjs/shared/options.js +2 -0
  125. package/dist/cjs/shared/ulid.js +83 -0
  126. package/dist/{shared → cjs/shared}/validation/collaborators.d.ts +21 -2
  127. package/dist/cjs/shared/validation/collaborators.js +79 -0
  128. package/dist/{shared → cjs/shared}/validation/option-shape.d.ts +7 -5
  129. package/dist/cjs/shared/validation/option-shape.js +31 -0
  130. package/dist/{shared → cjs/shared}/validation/options.d.ts +4 -4
  131. package/dist/cjs/shared/validation/options.js +166 -0
  132. package/dist/cjs/shared/validation/primitives.js +114 -0
  133. package/dist/{shared → cjs/shared}/validation/ttl.d.ts +26 -9
  134. package/dist/cjs/shared/validation/ttl.js +52 -0
  135. package/dist/{store → cjs/store}/actions/list-namespaces.d.ts +5 -5
  136. package/dist/cjs/store/actions/list-namespaces.js +92 -0
  137. package/dist/{store → cjs/store}/actions/put.d.ts +11 -4
  138. package/dist/cjs/store/actions/put.js +49 -0
  139. package/dist/{store → cjs/store}/actions/reconcile-vector-index.d.ts +5 -5
  140. package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
  141. package/dist/{store → cjs/store}/actions/search.d.ts +2 -2
  142. package/dist/cjs/store/actions/search.js +26 -0
  143. package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
  144. package/dist/cjs/store/internal/batch-plan.js +32 -0
  145. package/dist/{store → cjs/store}/internal/filter.d.ts +3 -3
  146. package/dist/cjs/store/internal/filter.js +64 -0
  147. package/dist/cjs/store/internal/get-item.d.ts +77 -0
  148. package/dist/cjs/store/internal/get-item.js +58 -0
  149. package/dist/{store → cjs/store}/internal/item-write.d.ts +72 -32
  150. package/dist/cjs/store/internal/item-write.js +181 -0
  151. package/dist/{store → cjs/store}/internal/parse.d.ts +15 -10
  152. package/dist/cjs/store/internal/parse.js +180 -0
  153. package/dist/{store → cjs/store}/internal/rows.d.ts +38 -34
  154. package/dist/cjs/store/internal/rows.js +166 -0
  155. package/dist/{store → cjs/store}/internal/semantic-search.d.ts +2 -2
  156. package/dist/cjs/store/internal/semantic-search.js +211 -0
  157. package/dist/{store → cjs/store}/internal/setup.d.ts +10 -15
  158. package/dist/cjs/store/internal/setup.js +103 -0
  159. package/dist/{store → cjs/store}/internal/table-search.d.ts +5 -5
  160. package/dist/cjs/store/internal/table-search.js +123 -0
  161. package/dist/{store → cjs/store}/internal/vector-index.d.ts +26 -15
  162. package/dist/cjs/store/internal/vector-index.js +269 -0
  163. package/dist/{store → cjs/store}/store.d.ts +82 -39
  164. package/dist/cjs/store/store.js +97 -0
  165. package/dist/{store → cjs/store}/types.d.ts +25 -10
  166. package/dist/cjs/store/types.js +2 -0
  167. package/dist/cjs/store/vector-backend.js +4 -0
  168. package/dist/esm/backfill/backfill.d.ts +171 -0
  169. package/dist/esm/backfill/backfill.js +170 -0
  170. package/dist/{checkpointer/actions/delete-thread.js → esm/checkpointer/actions/delete-thread.d.ts} +4 -26
  171. package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
  172. package/dist/{checkpointer/actions/get-tuple.js → esm/checkpointer/actions/get-tuple.d.ts} +7 -24
  173. package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
  174. package/dist/esm/checkpointer/actions/list.d.ts +55 -0
  175. package/dist/esm/checkpointer/actions/list.js +67 -0
  176. package/dist/{checkpointer/actions/put-writes.js → esm/checkpointer/actions/put-writes.d.ts} +10 -37
  177. package/dist/esm/checkpointer/actions/put-writes.js +18 -0
  178. package/dist/esm/checkpointer/actions/put.d.ts +95 -0
  179. package/dist/esm/checkpointer/actions/put.js +75 -0
  180. package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
  181. package/dist/esm/checkpointer/internal/delta-history.js +126 -0
  182. package/dist/{checkpointer/internal/listing.js → esm/checkpointer/internal/listing.d.ts} +22 -118
  183. package/dist/esm/checkpointer/internal/listing.js +95 -0
  184. package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
  185. package/dist/esm/checkpointer/internal/parse.js +169 -0
  186. package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
  187. package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
  188. package/dist/esm/checkpointer/internal/read.d.ts +135 -0
  189. package/dist/esm/checkpointer/internal/read.js +125 -0
  190. package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
  191. package/dist/esm/checkpointer/internal/rows.js +323 -0
  192. package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
  193. package/dist/esm/checkpointer/internal/setup.js +21 -0
  194. package/dist/{checkpointer/saver.js → esm/checkpointer/saver.d.ts} +84 -87
  195. package/dist/esm/checkpointer/saver.js +52 -0
  196. package/dist/esm/checkpointer/types.d.ts +51 -0
  197. package/dist/esm/checkpointer/types.js +1 -0
  198. package/dist/esm/factory/factory.d.ts +154 -0
  199. package/dist/esm/factory/factory.js +133 -0
  200. package/dist/esm/factory/types.d.ts +76 -0
  201. package/dist/esm/factory/types.js +1 -0
  202. package/dist/{history/actions/add-messages.js → esm/history/actions/add-messages.d.ts} +20 -26
  203. package/dist/esm/history/actions/add-messages.js +14 -0
  204. package/dist/{history/actions/clear.js → esm/history/actions/clear.d.ts} +4 -35
  205. package/dist/esm/history/actions/clear.js +26 -0
  206. package/dist/esm/history/actions/get-messages.d.ts +60 -0
  207. package/dist/esm/history/actions/get-messages.js +55 -0
  208. package/dist/esm/history/actions/list-sessions.d.ts +55 -0
  209. package/dist/esm/history/actions/list-sessions.js +64 -0
  210. package/dist/{history/actions/reconcile-count.js → esm/history/actions/reconcile-count.d.ts} +14 -16
  211. package/dist/esm/history/actions/reconcile-count.js +5 -0
  212. package/dist/{history/chat-message-history.js → esm/history/chat-message-history.d.ts} +76 -87
  213. package/dist/esm/history/chat-message-history.js +57 -0
  214. package/dist/esm/history/internal/append.d.ts +244 -0
  215. package/dist/esm/history/internal/append.js +259 -0
  216. package/dist/esm/history/internal/message-read.d.ts +84 -0
  217. package/dist/esm/history/internal/message-read.js +89 -0
  218. package/dist/esm/history/internal/parse.d.ts +153 -0
  219. package/dist/esm/history/internal/parse.js +105 -0
  220. package/dist/{history/internal/rows.js → esm/history/internal/rows.d.ts} +58 -112
  221. package/dist/esm/history/internal/rows.js +83 -0
  222. package/dist/esm/history/internal/session.d.ts +350 -0
  223. package/dist/esm/history/internal/session.js +285 -0
  224. package/dist/esm/history/internal/setup.d.ts +64 -0
  225. package/dist/esm/history/internal/setup.js +56 -0
  226. package/dist/{history/session-adapter.js → esm/history/session-adapter.d.ts} +25 -39
  227. package/dist/esm/history/session-adapter.js +34 -0
  228. package/dist/esm/history/types.d.ts +102 -0
  229. package/dist/esm/history/types.js +1 -0
  230. package/dist/esm/index.d.ts +53 -0
  231. package/dist/esm/index.js +10 -0
  232. package/dist/esm/shared/adapter.d.ts +146 -0
  233. package/dist/esm/shared/adapter.js +65 -0
  234. package/dist/{shared/clock.js → esm/shared/clock.d.ts} +3 -14
  235. package/dist/esm/shared/clock.js +9 -0
  236. package/dist/esm/shared/codec/codec.d.ts +336 -0
  237. package/dist/esm/shared/codec/codec.js +150 -0
  238. package/dist/esm/shared/codec/compression.d.ts +66 -0
  239. package/dist/esm/shared/codec/compression.js +40 -0
  240. package/dist/esm/shared/codec/json-serde.d.ts +80 -0
  241. package/dist/esm/shared/codec/json-serde.js +54 -0
  242. package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
  243. package/dist/esm/shared/codec/s3/client-types.js +3 -0
  244. package/dist/esm/shared/codec/s3/client.d.ts +63 -0
  245. package/dist/esm/shared/codec/s3/client.js +40 -0
  246. package/dist/{shared/codec/s3/config.js → esm/shared/codec/s3/config.d.ts} +45 -93
  247. package/dist/esm/shared/codec/s3/config.js +79 -0
  248. package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
  249. package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
  250. package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
  251. package/dist/esm/shared/codec/s3/offloader.js +278 -0
  252. package/dist/{shared/concurrency.js → esm/shared/concurrency.d.ts} +2 -37
  253. package/dist/esm/shared/concurrency.js +27 -0
  254. package/dist/{shared/dynamodb/abort.js → esm/shared/dynamodb/abort.d.ts} +4 -16
  255. package/dist/esm/shared/dynamodb/abort.js +12 -0
  256. package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
  257. package/dist/esm/shared/dynamodb/batch-write.js +74 -0
  258. package/dist/{shared/dynamodb/cancellation.js → esm/shared/dynamodb/cancellation.d.ts} +25 -53
  259. package/dist/esm/shared/dynamodb/cancellation.js +30 -0
  260. package/dist/{shared/dynamodb/client.js → esm/shared/dynamodb/client.d.ts} +74 -64
  261. package/dist/esm/shared/dynamodb/client.js +35 -0
  262. package/dist/{shared/dynamodb/idempotent-write.js → esm/shared/dynamodb/idempotent-write.d.ts} +172 -169
  263. package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
  264. package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
  265. package/dist/esm/shared/dynamodb/paginate.js +84 -0
  266. package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
  267. package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
  268. package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
  269. package/dist/esm/shared/dynamodb/recency-index.js +136 -0
  270. package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
  271. package/dist/esm/shared/dynamodb/retry.js +180 -0
  272. package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
  273. package/dist/esm/shared/dynamodb/row-size.js +26 -0
  274. package/dist/{shared/dynamodb/table-schema.js → esm/shared/dynamodb/table-schema.d.ts} +57 -67
  275. package/dist/esm/shared/dynamodb/table-schema.js +43 -0
  276. package/dist/esm/shared/errors/base-error.d.ts +231 -0
  277. package/dist/esm/shared/errors/base-error.js +64 -0
  278. package/dist/esm/shared/errors/boundary.d.ts +86 -0
  279. package/dist/esm/shared/errors/boundary.js +54 -0
  280. package/dist/esm/shared/errors/classify.d.ts +206 -0
  281. package/dist/esm/shared/errors/classify.js +220 -0
  282. package/dist/{shared/errors/error-code.js → esm/shared/errors/error-code.d.ts} +39 -43
  283. package/dist/esm/shared/errors/error-code.js +24 -0
  284. package/dist/{shared/errors/errors.js → esm/shared/errors/errors.d.ts} +92 -98
  285. package/dist/esm/shared/errors/errors.js +110 -0
  286. package/dist/{shared/logging/logger.js → esm/shared/logging/logger.d.ts} +22 -52
  287. package/dist/esm/shared/logging/logger.js +25 -0
  288. package/dist/esm/shared/logging/redaction.d.ts +123 -0
  289. package/dist/esm/shared/logging/redaction.js +140 -0
  290. package/dist/{shared/logging/secret-patterns.js → esm/shared/logging/secret-patterns.d.ts} +46 -87
  291. package/dist/esm/shared/logging/secret-patterns.js +83 -0
  292. package/dist/{shared/logging/truncate.js → esm/shared/logging/truncate.d.ts} +6 -40
  293. package/dist/esm/shared/logging/truncate.js +25 -0
  294. package/dist/esm/shared/options.d.ts +100 -0
  295. package/dist/esm/shared/options.js +1 -0
  296. package/dist/{shared/ulid.js → esm/shared/ulid.d.ts} +4 -84
  297. package/dist/esm/shared/ulid.js +77 -0
  298. package/dist/{shared/validation/collaborators.js → esm/shared/validation/collaborators.d.ts} +37 -65
  299. package/dist/esm/shared/validation/collaborators.js +70 -0
  300. package/dist/{shared/validation/option-shape.js → esm/shared/validation/option-shape.d.ts} +14 -36
  301. package/dist/esm/shared/validation/option-shape.js +24 -0
  302. package/dist/esm/shared/validation/options.d.ts +145 -0
  303. package/dist/esm/shared/validation/options.js +156 -0
  304. package/dist/{shared/validation/primitives.js → esm/shared/validation/primitives.d.ts} +30 -125
  305. package/dist/esm/shared/validation/primitives.js +100 -0
  306. package/dist/esm/shared/validation/ttl.d.ts +94 -0
  307. package/dist/esm/shared/validation/ttl.js +46 -0
  308. package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
  309. package/dist/esm/store/actions/list-namespaces.js +86 -0
  310. package/dist/esm/store/actions/put.d.ts +43 -0
  311. package/dist/esm/store/actions/put.js +46 -0
  312. package/dist/{store/actions/reconcile-vector-index.js → esm/store/actions/reconcile-vector-index.d.ts} +8 -16
  313. package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
  314. package/dist/esm/store/actions/search.d.ts +38 -0
  315. package/dist/esm/store/actions/search.js +23 -0
  316. package/dist/esm/store/internal/batch-plan.d.ts +56 -0
  317. package/dist/esm/store/internal/batch-plan.js +28 -0
  318. package/dist/esm/store/internal/filter.d.ts +43 -0
  319. package/dist/esm/store/internal/filter.js +60 -0
  320. package/dist/esm/store/internal/get-item.d.ts +77 -0
  321. package/dist/esm/store/internal/get-item.js +54 -0
  322. package/dist/esm/store/internal/item-write.d.ts +270 -0
  323. package/dist/esm/store/internal/item-write.js +173 -0
  324. package/dist/esm/store/internal/parse.d.ts +230 -0
  325. package/dist/esm/store/internal/parse.js +169 -0
  326. package/dist/{store/internal/rows.js → esm/store/internal/rows.d.ts} +111 -199
  327. package/dist/esm/store/internal/rows.js +147 -0
  328. package/dist/esm/store/internal/semantic-search.d.ts +168 -0
  329. package/dist/esm/store/internal/semantic-search.js +200 -0
  330. package/dist/esm/store/internal/setup.d.ts +96 -0
  331. package/dist/esm/store/internal/setup.js +98 -0
  332. package/dist/esm/store/internal/table-search.d.ts +100 -0
  333. package/dist/esm/store/internal/table-search.js +119 -0
  334. package/dist/esm/store/internal/vector-index.d.ts +258 -0
  335. package/dist/esm/store/internal/vector-index.js +256 -0
  336. package/dist/{store/store.js → esm/store/store.d.ts} +99 -133
  337. package/dist/esm/store/store.js +93 -0
  338. package/dist/esm/store/types.d.ts +111 -0
  339. package/dist/esm/store/types.js +1 -0
  340. package/dist/esm/store/vector-backend.d.ts +104 -0
  341. package/dist/esm/store/vector-backend.js +1 -0
  342. package/package.json +50 -44
  343. package/dist/backfill/backfill.js +0 -393
  344. package/dist/checkpointer/actions/list.js +0 -142
  345. package/dist/checkpointer/actions/put.js +0 -195
  346. package/dist/checkpointer/internal/delta-history.js +0 -252
  347. package/dist/checkpointer/internal/parse.js +0 -372
  348. package/dist/checkpointer/internal/pending-writes.js +0 -588
  349. package/dist/checkpointer/internal/read.js +0 -264
  350. package/dist/checkpointer/internal/rows.js +0 -834
  351. package/dist/checkpointer/internal/setup.js +0 -72
  352. package/dist/checkpointer/types.js +0 -12
  353. package/dist/factory/factory.js +0 -266
  354. package/dist/factory/types.js +0 -10
  355. package/dist/history/actions/get-messages.js +0 -141
  356. package/dist/history/actions/list-sessions.js +0 -156
  357. package/dist/history/internal/append.js +0 -500
  358. package/dist/history/internal/message-read.js +0 -204
  359. package/dist/history/internal/parse.js +0 -252
  360. package/dist/history/internal/session.js +0 -628
  361. package/dist/history/internal/setup.js +0 -106
  362. package/dist/history/types.js +0 -12
  363. package/dist/index.js +0 -51
  364. package/dist/shared/adapter.js +0 -143
  365. package/dist/shared/codec/codec.js +0 -441
  366. package/dist/shared/codec/compression.js +0 -89
  367. package/dist/shared/codec/json-serde.js +0 -191
  368. package/dist/shared/codec/s3/client-types.js +0 -26
  369. package/dist/shared/codec/s3/client.js +0 -97
  370. package/dist/shared/codec/s3/lifecycle.js +0 -355
  371. package/dist/shared/codec/s3/offloader.js +0 -658
  372. package/dist/shared/dynamodb/batch-write.js +0 -173
  373. package/dist/shared/dynamodb/paginate.js +0 -188
  374. package/dist/shared/dynamodb/partition-delete.js +0 -340
  375. package/dist/shared/dynamodb/recency-index.js +0 -377
  376. package/dist/shared/dynamodb/retry.js +0 -463
  377. package/dist/shared/errors/base-error.js +0 -174
  378. package/dist/shared/errors/boundary.js +0 -143
  379. package/dist/shared/errors/classify.d.ts +0 -97
  380. package/dist/shared/errors/classify.js +0 -257
  381. package/dist/shared/logging/redaction.js +0 -316
  382. package/dist/shared/options.js +0 -11
  383. package/dist/shared/validation/options.js +0 -328
  384. package/dist/shared/validation/ttl.js +0 -132
  385. package/dist/store/actions/list-namespaces.js +0 -197
  386. package/dist/store/actions/put.js +0 -78
  387. package/dist/store/actions/search.js +0 -66
  388. package/dist/store/internal/batch-plan.d.ts +0 -26
  389. package/dist/store/internal/batch-plan.js +0 -109
  390. package/dist/store/internal/filter.js +0 -137
  391. package/dist/store/internal/get-item.d.ts +0 -45
  392. package/dist/store/internal/get-item.js +0 -115
  393. package/dist/store/internal/item-write.js +0 -463
  394. package/dist/store/internal/parse.js +0 -350
  395. package/dist/store/internal/semantic-search.js +0 -389
  396. package/dist/store/internal/setup.js +0 -223
  397. package/dist/store/internal/table-search.js +0 -213
  398. package/dist/store/internal/vector-index.js +0 -546
  399. package/dist/store/types.js +0 -15
  400. package/dist/store/vector-backend.js +0 -17
  401. /package/dist/{shared → cjs/shared}/clock.d.ts +0 -0
  402. /package/dist/{shared → cjs/shared}/codec/json-serde.d.ts +0 -0
  403. /package/dist/{shared → cjs/shared}/concurrency.d.ts +0 -0
  404. /package/dist/{shared → cjs/shared}/dynamodb/cancellation.d.ts +0 -0
  405. /package/dist/{shared → cjs/shared}/logging/logger.d.ts +0 -0
  406. /package/dist/{shared → cjs/shared}/logging/truncate.d.ts +0 -0
  407. /package/dist/{shared → cjs/shared}/ulid.d.ts +0 -0
  408. /package/dist/{shared → cjs/shared}/validation/primitives.d.ts +0 -0
  409. /package/dist/{store → cjs/store}/vector-backend.d.ts +0 -0
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_CAUSE_DEPTH = exports.DEFAULT_RETRYABLE_ERRORS = exports.AWS_ERROR_CODES = exports.TRANSIENT_HTTP_STATUSES = exports.TRANSIENT_NETWORK_ERROR_CODES = void 0;
4
+ exports.isCorrectedClockSkew = isCorrectedClockSkew;
5
+ exports.classifyAwsError = classifyAwsError;
6
+ exports.classifiableCause = classifiableCause;
7
+ exports.awsDiagnostics = awsDiagnostics;
8
+ exports.endedWithoutAnswer = endedWithoutAnswer;
9
+ exports.mayStillBeInFlight = mayStillBeInFlight;
10
+ exports.refusedByService = refusedByService;
11
+ exports.isMissingObject = isMissingObject;
12
+ exports.isMissingLifecycleConfiguration = isMissingLifecycleConfiguration;
13
+ const cancellation_js_1 = require("../dynamodb/cancellation.js");
14
+ const error_code_js_1 = require("./error-code.js");
15
+ exports.TRANSIENT_NETWORK_ERROR_CODES = [
16
+ 'ECONNRESET',
17
+ 'ECONNREFUSED',
18
+ 'EPIPE',
19
+ 'ETIMEDOUT',
20
+ 'EHOSTUNREACH',
21
+ 'ENETUNREACH',
22
+ 'ENOTFOUND',
23
+ 'EAI_AGAIN',
24
+ ];
25
+ exports.TRANSIENT_HTTP_STATUSES = [429, 500, 502, 503, 504];
26
+ const PRECONDITION_FAILED_STATUS = 412;
27
+ const TRANSACTION_CANCELLED = 'TransactionCanceledException';
28
+ exports.AWS_ERROR_CODES = {
29
+ ProvisionedThroughputExceededException: error_code_js_1.ErrorCode.THROTTLED,
30
+ ThrottlingException: error_code_js_1.ErrorCode.THROTTLED,
31
+ RequestLimitExceeded: error_code_js_1.ErrorCode.THROTTLED,
32
+ SlowDown: error_code_js_1.ErrorCode.THROTTLED,
33
+ InternalServerError: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
34
+ InternalFailure: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
35
+ ServiceUnavailable: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
36
+ InternalError: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
37
+ RequestTimeout: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
38
+ RequestTimeoutException: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
39
+ TimeoutError: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
40
+ TransactionConflictException: error_code_js_1.ErrorCode.CONTENTION,
41
+ TransactionInProgressException: error_code_js_1.ErrorCode.CONTENTION,
42
+ ReplicatedWriteConflictException: error_code_js_1.ErrorCode.CONTENTION,
43
+ ConditionalRequestConflict: error_code_js_1.ErrorCode.CONTENTION,
44
+ AccessDeniedException: error_code_js_1.ErrorCode.ACCESS_DENIED,
45
+ AccessDenied: error_code_js_1.ErrorCode.ACCESS_DENIED,
46
+ ExpiredTokenException: error_code_js_1.ErrorCode.ACCESS_DENIED,
47
+ ExpiredToken: error_code_js_1.ErrorCode.ACCESS_DENIED,
48
+ IncompleteSignature: error_code_js_1.ErrorCode.ACCESS_DENIED,
49
+ IncompleteSignatureException: error_code_js_1.ErrorCode.ACCESS_DENIED,
50
+ InvalidAccessKeyId: error_code_js_1.ErrorCode.ACCESS_DENIED,
51
+ InvalidSignatureException: error_code_js_1.ErrorCode.ACCESS_DENIED,
52
+ MissingAuthenticationTokenException: error_code_js_1.ErrorCode.ACCESS_DENIED,
53
+ NotAuthorized: error_code_js_1.ErrorCode.ACCESS_DENIED,
54
+ RequestTimeTooSkewed: error_code_js_1.ErrorCode.ACCESS_DENIED,
55
+ SignatureDoesNotMatch: error_code_js_1.ErrorCode.ACCESS_DENIED,
56
+ UnrecognizedClientException: error_code_js_1.ErrorCode.ACCESS_DENIED,
57
+ CredentialsProviderError: error_code_js_1.ErrorCode.ACCESS_DENIED,
58
+ ResourceNotFoundException: error_code_js_1.ErrorCode.NOT_FOUND,
59
+ NoSuchBucket: error_code_js_1.ErrorCode.NOT_FOUND,
60
+ NoSuchKey: error_code_js_1.ErrorCode.NOT_FOUND,
61
+ NoSuchLifecycleConfiguration: error_code_js_1.ErrorCode.NOT_FOUND,
62
+ ValidationException: error_code_js_1.ErrorCode.AWS_REJECTED,
63
+ ValidationError: error_code_js_1.ErrorCode.AWS_REJECTED,
64
+ IdempotentParameterMismatchException: error_code_js_1.ErrorCode.AWS_REJECTED,
65
+ MalformedHttpRequestException: error_code_js_1.ErrorCode.AWS_REJECTED,
66
+ RequestEntityTooLargeException: error_code_js_1.ErrorCode.AWS_REJECTED,
67
+ ConditionalCheckFailedException: error_code_js_1.ErrorCode.CONDITION_CONFLICT,
68
+ PreconditionFailed: error_code_js_1.ErrorCode.CONDITION_CONFLICT,
69
+ ItemCollectionSizeLimitExceededException: error_code_js_1.ErrorCode.AWS_REQUEST_FAILED,
70
+ InvalidEndpointException: error_code_js_1.ErrorCode.AWS_REQUEST_FAILED,
71
+ TransactionCanceledException: error_code_js_1.ErrorCode.AWS_REQUEST_FAILED,
72
+ AbortError: error_code_js_1.ErrorCode.ABORTED,
73
+ };
74
+ const RETRYABLE_CODES = [
75
+ error_code_js_1.ErrorCode.THROTTLED,
76
+ error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
77
+ error_code_js_1.ErrorCode.CONTENTION,
78
+ ];
79
+ exports.DEFAULT_RETRYABLE_ERRORS = [
80
+ ...Object.entries(exports.AWS_ERROR_CODES)
81
+ .filter(([, code]) => RETRYABLE_CODES.includes(code))
82
+ .map(([name]) => name),
83
+ ...exports.TRANSIENT_NETWORK_ERROR_CODES,
84
+ ];
85
+ function declaredCodeOf(name) {
86
+ return typeof name === 'string' && Object.hasOwn(exports.AWS_ERROR_CODES, name)
87
+ ? exports.AWS_ERROR_CODES[name]
88
+ : undefined;
89
+ }
90
+ function isCorrectedClockSkew(fields) {
91
+ if (fields.$metadata?.clockSkewCorrected === true)
92
+ return true;
93
+ return (fields.name === 'InvalidSignatureException' &&
94
+ typeof fields.message === 'string' &&
95
+ fields.message.includes('Signature expired'));
96
+ }
97
+ function statusOf(fields) {
98
+ const metadata = fields.$metadata;
99
+ return typeof metadata === 'object' &&
100
+ metadata !== null &&
101
+ typeof metadata.httpStatusCode === 'number'
102
+ ? metadata.httpStatusCode
103
+ : undefined;
104
+ }
105
+ function isAwsShaped(fields) {
106
+ if (typeof fields.$metadata === 'object' && fields.$metadata !== null)
107
+ return true;
108
+ const { name } = fields;
109
+ return (typeof name === 'string' && (declaredCodeOf(name) !== undefined || name.endsWith('Exception')));
110
+ }
111
+ function cancellationCode(error) {
112
+ if ((0, cancellation_js_1.conditionalCheckFailure)(error) !== undefined)
113
+ return error_code_js_1.ErrorCode.CONDITION_CONFLICT;
114
+ if ((0, cancellation_js_1.transientCancellation)(error) === true) {
115
+ return (0, cancellation_js_1.throttledCancellation)(error) ? error_code_js_1.ErrorCode.THROTTLED : error_code_js_1.ErrorCode.CONTENTION;
116
+ }
117
+ return exports.AWS_ERROR_CODES[TRANSACTION_CANCELLED];
118
+ }
119
+ function classifyAwsError(error) {
120
+ if (typeof error !== 'object' || error === null)
121
+ return error_code_js_1.ErrorCode.UNEXPECTED_ERROR;
122
+ const fields = error;
123
+ if (fields.name === TRANSACTION_CANCELLED)
124
+ return cancellationCode(error);
125
+ if (isCorrectedClockSkew(fields))
126
+ return error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE;
127
+ const declared = declaredCodeOf(fields.name);
128
+ if (declared !== undefined)
129
+ return declared;
130
+ if (typeof fields.code === 'string' && exports.TRANSIENT_NETWORK_ERROR_CODES.includes(fields.code)) {
131
+ return error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE;
132
+ }
133
+ const status = statusOf(fields);
134
+ if (status === PRECONDITION_FAILED_STATUS)
135
+ return error_code_js_1.ErrorCode.CONDITION_CONFLICT;
136
+ if (status === 429)
137
+ return error_code_js_1.ErrorCode.THROTTLED;
138
+ if (status !== undefined && exports.TRANSIENT_HTTP_STATUSES.includes(status)) {
139
+ return error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE;
140
+ }
141
+ return isAwsShaped(fields) ? error_code_js_1.ErrorCode.AWS_REQUEST_FAILED : error_code_js_1.ErrorCode.UNEXPECTED_ERROR;
142
+ }
143
+ exports.MAX_CAUSE_DEPTH = 32;
144
+ function classifiableCause(error) {
145
+ const seen = new WeakSet();
146
+ let node = error;
147
+ for (let depth = 0; depth <= exports.MAX_CAUSE_DEPTH; depth += 1) {
148
+ if (classifyAwsError(node) !== error_code_js_1.ErrorCode.UNEXPECTED_ERROR)
149
+ return node;
150
+ if (typeof node !== 'object' || node === null || seen.has(node))
151
+ break;
152
+ seen.add(node);
153
+ const next = node.cause;
154
+ if (next === undefined)
155
+ break;
156
+ node = next;
157
+ }
158
+ return error;
159
+ }
160
+ function awsDiagnostics(error) {
161
+ if (typeof error !== 'object' || error === null)
162
+ return {};
163
+ const fields = error;
164
+ if (!isAwsShaped(fields))
165
+ return {};
166
+ const out = {};
167
+ if (typeof fields.name === 'string')
168
+ out.awsErrorName = fields.name;
169
+ const status = statusOf(fields);
170
+ if (status !== undefined)
171
+ out.httpStatusCode = status;
172
+ const requestId = fields.$metadata?.requestId;
173
+ if (typeof requestId === 'string')
174
+ out.requestId = requestId;
175
+ return out;
176
+ }
177
+ const CLIENT_SIDE_CUTS = ['TimeoutError', 'AbortError'];
178
+ const MAX_ANSWER_DEPTH = 8;
179
+ function endedWithoutAnswer(error) {
180
+ const seen = new WeakSet();
181
+ let node = error;
182
+ for (let depth = 0; depth < MAX_ANSWER_DEPTH; depth += 1) {
183
+ if (typeof node !== 'object' || node === null || seen.has(node))
184
+ return false;
185
+ seen.add(node);
186
+ const fields = node;
187
+ if (statusOf(fields) !== undefined)
188
+ return false;
189
+ if (typeof fields.name === 'string' && CLIENT_SIDE_CUTS.includes(fields.name))
190
+ return true;
191
+ if (typeof fields.code === 'string' && exports.TRANSIENT_NETWORK_ERROR_CODES.includes(fields.code)) {
192
+ return true;
193
+ }
194
+ node = node.cause;
195
+ }
196
+ return false;
197
+ }
198
+ const TRANSACTION_IN_PROGRESS = 'TransactionInProgressException';
199
+ const SERVER_ERROR_STATUS_MIN = 500;
200
+ const SERVER_ERROR_STATUS_MAX = 599;
201
+ function mayStillBeInFlight(error) {
202
+ if (endedWithoutAnswer(error))
203
+ return true;
204
+ if (typeof error !== 'object' || error === null)
205
+ return false;
206
+ const fields = error;
207
+ if (fields.name === TRANSACTION_IN_PROGRESS)
208
+ return true;
209
+ const status = statusOf(fields);
210
+ return (status !== undefined && status >= SERVER_ERROR_STATUS_MIN && status <= SERVER_ERROR_STATUS_MAX);
211
+ }
212
+ const REFUSED = [
213
+ error_code_js_1.ErrorCode.AWS_REJECTED,
214
+ error_code_js_1.ErrorCode.ACCESS_DENIED,
215
+ error_code_js_1.ErrorCode.NOT_FOUND,
216
+ error_code_js_1.ErrorCode.CONDITION_CONFLICT,
217
+ ];
218
+ function refusedByService(error) {
219
+ if (typeof error !== 'object' || error === null)
220
+ return false;
221
+ if (error.name === TRANSACTION_CANCELLED)
222
+ return true;
223
+ return REFUSED.includes(classifyAwsError(error));
224
+ }
225
+ function isMissingObject(error) {
226
+ return (typeof error === 'object' && error !== null && error.name === 'NoSuchKey');
227
+ }
228
+ function isMissingLifecycleConfiguration(error) {
229
+ return (typeof error === 'object' &&
230
+ error !== null &&
231
+ error.name === 'NoSuchLifecycleConfiguration');
232
+ }
@@ -13,8 +13,10 @@ export declare enum ErrorCode {
13
13
  /** A row or payload written in a format version newer than this package reads. */
14
14
  FORMAT_UNSUPPORTED = "FORMAT_UNSUPPORTED",
15
15
  /**
16
- * A checkpoint a delta channel still needs has expired, so the channel cannot
17
- * be reconstructed and the read refuses rather than returning a shorter value.
16
+ * A checkpoint a delta channel still needs cannot be read — it has expired,
17
+ * the sweep has since removed it, or the chain of parents loops back on
18
+ * itself — so the channel cannot be reconstructed and the read refuses
19
+ * rather than returning a shorter value.
18
20
  */
19
21
  ANCESTOR_EXPIRED = "ANCESTOR_EXPIRED",
20
22
  CONDITION_CONFLICT = "CONDITION_CONFLICT",
@@ -43,8 +45,9 @@ export declare enum ErrorCode {
43
45
  * AWS or the network failed transiently: `InternalServerError`,
44
46
  * `InternalFailure`, `ServiceUnavailable`, S3's `InternalError`, a request
45
47
  * timeout (`RequestTimeout`, `RequestTimeoutException`, the SDK's
46
- * `TimeoutError`), an HTTP 500/502/503/504, or a reset, refused or
47
- * unreachable connection. Retry after a backoff. A write that failed this way
48
+ * `TimeoutError`), an HTTP 500/502/503/504, a reset, refused or unreachable
49
+ * connection, or a signing failure the SDK corrected its clock for or
50
+ * reports as expired. Retry after a backoff. A write that failed this way
48
51
  * may still have been applied.
49
52
  */
50
53
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
@@ -53,20 +56,24 @@ export declare enum ErrorCode {
53
56
  * `TransactionConflictException`, `TransactionInProgressException`,
54
57
  * `ReplicatedWriteConflictException`, S3's `ConditionalRequestConflict`, or a
55
58
  * cancelled transaction whose only transient cause is a conflict. Retry; more
56
- * capacity would not help.
59
+ * capacity would not help. `ensureS3LifecycleRule()` raises it when every one
60
+ * of its five rounds needs a write.
57
61
  */
58
62
  CONTENTION = "CONTENTION",
59
63
  /**
60
64
  * AWS refused the caller's identity or permissions: `AccessDeniedException`,
61
65
  * S3's `AccessDenied`, an expired, unrecognised or malformed credential or
62
- * signature. Fix the credentials or the IAM policy; do not retry.
63
- * `context.awsErrorName` says which.
66
+ * signature — or the SDK's credential chain found no credentials to sign
67
+ * with (`CredentialsProviderError`). Fix the credentials or the IAM policy;
68
+ * do not retry. `context.awsErrorName` says which.
64
69
  */
65
70
  ACCESS_DENIED = "ACCESS_DENIED",
66
71
  /**
67
- * The table, index, bucket or object is not there: `ResourceNotFoundException`,
68
- * S3's `NoSuchBucket` or `NoSuchKey`. Not an absent item — a read of a key that
69
- * holds nothing returns nothing.
72
+ * The table or the bucket is not there: `ResourceNotFoundException`, or S3's
73
+ * `NoSuchBucket` from the lifecycle calls. A missing index is `AWS_REJECTED`
74
+ * — DynamoDB refuses a query naming one with a `ValidationException` — and a
75
+ * missing S3 object on a transfer is `S3_OFFLOAD_FAILED`. Not an absent item:
76
+ * a read of a key that holds nothing returns nothing.
70
77
  */
71
78
  NOT_FOUND = "NOT_FOUND",
72
79
  /**
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorCode = void 0;
4
+ var ErrorCode;
5
+ (function (ErrorCode) {
6
+ ErrorCode["VALIDATION"] = "VALIDATION";
7
+ ErrorCode["FORMAT_UNSUPPORTED"] = "FORMAT_UNSUPPORTED";
8
+ ErrorCode["ANCESTOR_EXPIRED"] = "ANCESTOR_EXPIRED";
9
+ ErrorCode["CONDITION_CONFLICT"] = "CONDITION_CONFLICT";
10
+ ErrorCode["RETRY_EXHAUSTED"] = "RETRY_EXHAUSTED";
11
+ ErrorCode["BATCH_WRITE_INCOMPLETE"] = "BATCH_WRITE_INCOMPLETE";
12
+ ErrorCode["COMPRESSION_LIMIT"] = "COMPRESSION_LIMIT";
13
+ ErrorCode["PAYLOAD_CORRUPT"] = "PAYLOAD_CORRUPT";
14
+ ErrorCode["S3_OFFLOAD_FAILED"] = "S3_OFFLOAD_FAILED";
15
+ ErrorCode["RESULT_TRUNCATED"] = "RESULT_TRUNCATED";
16
+ ErrorCode["ABORTED"] = "ABORTED";
17
+ ErrorCode["COMPENSATION_FAILED"] = "COMPENSATION_FAILED";
18
+ ErrorCode["THROTTLED"] = "THROTTLED";
19
+ ErrorCode["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
20
+ ErrorCode["CONTENTION"] = "CONTENTION";
21
+ ErrorCode["ACCESS_DENIED"] = "ACCESS_DENIED";
22
+ ErrorCode["NOT_FOUND"] = "NOT_FOUND";
23
+ ErrorCode["AWS_REJECTED"] = "AWS_REJECTED";
24
+ ErrorCode["AWS_REQUEST_FAILED"] = "AWS_REQUEST_FAILED";
25
+ ErrorCode["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
26
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
27
+ Object.freeze(ErrorCode);
@@ -9,13 +9,16 @@
9
9
  * than inside the factory are decided here once per code, on the one error
10
10
  * class (record 19). `FORMAT_UNSUPPORTED`, `PAYLOAD_CORRUPT`,
11
11
  * `COMPRESSION_LIMIT`, `S3_OFFLOAD_FAILED` and `ANCESTOR_EXPIRED` are raised
12
- * with `new DynamoDBLangGraphError` at their own call sites instead, and
13
- * every AWS-classified code is wrapped once, by `wrapForeignError` in the
14
- * error boundary, not per code here.
12
+ * with `new DynamoDBLangGraphError` at their own call sites instead; so is
13
+ * `CONTENTION` when `ensureLifecycleRule` gives up on a lifecycle write that
14
+ * never stays, which is this package's own verdict rather than an AWS
15
+ * rejection. Every other occurrence of an AWS-classified code, `CONTENTION`
16
+ * included, is wrapped once, by `wrapForeignError` in the error boundary, not
17
+ * per code here.
15
18
  */
16
- import type { WriteRequest } from '../dynamodb/client';
17
- import { DynamoDBLangGraphError } from './base-error';
18
- import { ErrorCode } from './error-code';
19
+ import type { WriteRequest } from '../dynamodb/client.js';
20
+ import { DynamoDBLangGraphError } from './base-error.js';
21
+ import { ErrorCode } from './error-code.js';
19
22
  /**
20
23
  * The error for input that failed a check before any AWS call was made.
21
24
  *
@@ -42,21 +45,57 @@ export declare function validationError(message: string, field?: string, cause?:
42
45
  * Throws: nothing; building an error may not fail.
43
46
  */
44
47
  export declare function conflictError(message: string, cause?: Error): DynamoDBLangGraphError<ErrorCode.CONDITION_CONFLICT>;
48
+ /**
49
+ * Record on `error` that an attempt of the budget it ended may still land.
50
+ *
51
+ * Accepts: `error` — the failure a retry budget is about to throw as it is: a
52
+ * refusal that is not retried, so it is thrown bare rather than wrapped in
53
+ * `RETRY_EXHAUSTED`, after an earlier attempt of the same budget got no
54
+ * answer. Credentials expiring mid-budget are the ordinary way there.
55
+ *
56
+ * Returns: `error`, carrying the record for {@link retryBudgetMayStillLand}.
57
+ * An error that cannot take a property — frozen, or not an object — is
58
+ * returned as it is, and then reads as answered, which is how every error
59
+ * read before this record existed.
60
+ *
61
+ * Throws: nothing, for any value.
62
+ */
63
+ export declare function markMayStillLand<E extends Error>(error: E): E;
45
64
  /**
46
65
  * The error for a retried operation that exhausted its attempt budget.
47
66
  *
48
67
  * Accepts: `attempts` — how many were made before the budget ran out.
49
68
  * `cause` — the last failure, kept so a caller can classify what actually
50
- * went wrong.
69
+ * went wrong. `mayStillLand` — whether any attempt of the budget, not only the
70
+ * last, left DynamoDB free to apply it later; read back by
71
+ * {@link retryBudgetMayStillLand}. Defaults to false, which is what a caller
72
+ * outside `withRetry` — one built by an older release, or a test double — gets
73
+ * for not recording one.
51
74
  *
52
75
  * Returns: a `RETRY_EXHAUSTED` error, with `context.attempts` when `attempts`
53
- * was given. It says the attempts are spent, **not** that the operation did
76
+ * was given, and the `awsErrorName`, `httpStatusCode` and `requestId` of the
77
+ * last failure when that failure was AWS's, so a count by status needs no walk
78
+ * of `cause`. It says the attempts are spent, **not** that the operation did
54
79
  * not happen: a write whose response was lost is reported this way too, which
55
80
  * is why every caller that would delete something reads the row back first.
56
81
  *
57
82
  * Throws: nothing; building an error may not fail.
58
83
  */
59
- export declare function retryExhaustedError(message: string, attempts?: number, cause?: Error): DynamoDBLangGraphError<ErrorCode.RETRY_EXHAUSTED>;
84
+ export declare function retryExhaustedError(message: string, attempts?: number, cause?: Error, mayStillLand?: boolean): DynamoDBLangGraphError<ErrorCode.RETRY_EXHAUSTED>;
85
+ /**
86
+ * Whether some attempt of the retry budget this error ended — recorded across
87
+ * every attempt `withRetry` made, not re-derived from the error, which is only
88
+ * the last one — left DynamoDB free to apply it later.
89
+ *
90
+ * Accepts: `error` — any error; one {@link retryExhaustedError} built, or one
91
+ * {@link markMayStillLand} marked, carries the record.
92
+ *
93
+ * Returns: the flag recorded on the error; false for any other error,
94
+ * including a `RETRY_EXHAUSTED` error built without passing one.
95
+ *
96
+ * Throws: nothing, for any value.
97
+ */
98
+ export declare function retryBudgetMayStillLand(error: Error): boolean;
60
99
  /**
61
100
  * The error for a paginated read that hit its runaway guard (item or
62
101
  * iteration cap) while more data remained, so the result would have been
@@ -165,3 +204,30 @@ export declare function batchWriteAllIncompleteError(batch: IncompleteBatch): Dy
165
204
  * `rollbackError` before anything reads off them.
166
205
  */
167
206
  export declare function compensationFailedError(cause: Error, rollbackError: Error): DynamoDBLangGraphError<ErrorCode.COMPENSATION_FAILED>;
207
+ /**
208
+ * The error for an append-saga chunk whose own outcome could not be
209
+ * established, raised once every chunk this call *could* confirm has already
210
+ * been undone — the rollback itself did not fail; this chunk alone could not
211
+ * be read back, or its write may still be applied after the read.
212
+ *
213
+ * Accepts: `cause` — the failing chunk's own failure. `unsettledBecause` —
214
+ * why its outcome is unknown: the read-back's own failure, or the write's
215
+ * own failure, when some attempt of it may still be applied. Both are built
216
+ * from a `catch`, so either may be whatever a `throw` produced rather than
217
+ * an `Error`.
218
+ *
219
+ * Returns: a `COMPENSATION_FAILED` error carrying `cause` as `cause` and
220
+ * `unsettledBecause` as `details.rollbackError`, each normalised through
221
+ * `toError` so both are always error-shaped. Its message says the chunk's
222
+ * own fate could not be established — never that a rollback failed, since
223
+ * every chunk this call could confirm was already rolled back before this is
224
+ * raised. The session's `messageCount` may have drifted, which
225
+ * `reconcileMessageCount` repairs; the quoted text of both errors is
226
+ * redacted before it is embedded.
227
+ *
228
+ * Throws: nothing; building an error may not fail. Reading `.message` off a
229
+ * thrown `null` or `undefined` would throw here, which is why `toError`
230
+ * normalises both `cause` and `unsettledBecause` before anything reads off
231
+ * them.
232
+ */
233
+ export declare function unsettledAppendError(cause: Error, unsettledBecause: Error): DynamoDBLangGraphError<ErrorCode.COMPENSATION_FAILED>;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validationError = validationError;
4
+ exports.conflictError = conflictError;
5
+ exports.markMayStillLand = markMayStillLand;
6
+ exports.retryExhaustedError = retryExhaustedError;
7
+ exports.retryBudgetMayStillLand = retryBudgetMayStillLand;
8
+ exports.resultTruncatedError = resultTruncatedError;
9
+ exports.abortError = abortError;
10
+ exports.batchWriteIncompleteError = batchWriteIncompleteError;
11
+ exports.batchWriteAllIncompleteError = batchWriteAllIncompleteError;
12
+ exports.compensationFailedError = compensationFailedError;
13
+ exports.unsettledAppendError = unsettledAppendError;
14
+ const secret_patterns_js_1 = require("../logging/secret-patterns.js");
15
+ const base_error_js_1 = require("./base-error.js");
16
+ const classify_js_1 = require("./classify.js");
17
+ const error_code_js_1 = require("./error-code.js");
18
+ function build(factory, spec) {
19
+ const error = new base_error_js_1.DynamoDBLangGraphError(spec.message, spec.code, spec.context, spec.cause, spec.details);
20
+ Error.captureStackTrace(error, factory);
21
+ return error;
22
+ }
23
+ function validationError(message, field, cause) {
24
+ return build(validationError, {
25
+ message,
26
+ code: error_code_js_1.ErrorCode.VALIDATION,
27
+ context: field === undefined ? {} : { field },
28
+ cause,
29
+ });
30
+ }
31
+ function conflictError(message, cause) {
32
+ return build(conflictError, { message, code: error_code_js_1.ErrorCode.CONDITION_CONFLICT, context: {}, cause });
33
+ }
34
+ const MAY_STILL_LAND = Symbol('retryBudget.mayStillLand');
35
+ function markMayStillLand(error) {
36
+ if (typeof error === 'object' && error !== null && Object.isExtensible(error)) {
37
+ Object.defineProperty(error, MAY_STILL_LAND, { value: true, enumerable: false });
38
+ }
39
+ return error;
40
+ }
41
+ function retryExhaustedError(message, attempts, cause, mayStillLand = false) {
42
+ const error = build(retryExhaustedError, {
43
+ message,
44
+ code: error_code_js_1.ErrorCode.RETRY_EXHAUSTED,
45
+ context: {
46
+ ...(attempts === undefined ? {} : { attempts }),
47
+ ...(cause === undefined ? {} : (0, classify_js_1.awsDiagnostics)(cause)),
48
+ },
49
+ cause,
50
+ });
51
+ Object.defineProperty(error, MAY_STILL_LAND, { value: mayStillLand, enumerable: false });
52
+ return error;
53
+ }
54
+ function retryBudgetMayStillLand(error) {
55
+ if (typeof error !== 'object' || error === null)
56
+ return false;
57
+ return error[MAY_STILL_LAND] === true;
58
+ }
59
+ function resultTruncatedError(cap, limit) {
60
+ return build(resultTruncatedError, {
61
+ message: `paginated read truncated at the ${cap} cap (${limit}) with more data remaining`,
62
+ code: error_code_js_1.ErrorCode.RESULT_TRUNCATED,
63
+ context: { field: cap },
64
+ });
65
+ }
66
+ function abortError(message = 'Operation aborted', cause) {
67
+ return build(abortError, { message, code: error_code_js_1.ErrorCode.ABORTED, context: {}, cause });
68
+ }
69
+ function batchWriteIncompleteError(succeededCount, unprocessed, retries, cause) {
70
+ const items = Array.isArray(unprocessed) ? [...unprocessed] : [];
71
+ return build(batchWriteIncompleteError, {
72
+ message: `batchWrite did not drain after ${retries} UnprocessedItems retries: ` +
73
+ `${succeededCount} item(s) persisted, ${items.length} still un-acked.`,
74
+ code: error_code_js_1.ErrorCode.BATCH_WRITE_INCOMPLETE,
75
+ context: {},
76
+ cause,
77
+ details: { kind: 'drain', succeededCount, unprocessed: items, retries },
78
+ });
79
+ }
80
+ function batchWriteAllIncompleteError(batch) {
81
+ const { succeeded, total, succeededCount = 0, unit = 'chunk' } = batch;
82
+ const failed = Array.isArray(batch.failures) ? [...batch.failures] : [];
83
+ return build(batchWriteAllIncompleteError, {
84
+ message: `${unit === 'chunk' ? 'batchWriteAll' : 'the partition delete'} did not fully drain: ` +
85
+ `${succeeded}/${total} ${unit}(s) succeeded, ` +
86
+ `${failed.length} ${unit}(s) failed. ${succeededCount} write(s) persisted before the failure.`,
87
+ code: error_code_js_1.ErrorCode.BATCH_WRITE_INCOMPLETE,
88
+ context: {},
89
+ cause: failed[0],
90
+ details: {
91
+ kind: 'pass',
92
+ unit,
93
+ succeededChunks: succeeded,
94
+ totalChunks: total,
95
+ failedChunks: failed,
96
+ succeededCount,
97
+ },
98
+ });
99
+ }
100
+ function compensationFailedError(cause, rollbackError) {
101
+ const trigger = (0, base_error_js_1.toError)(cause);
102
+ const rollback = (0, base_error_js_1.toError)(rollbackError);
103
+ return build(compensationFailedError, {
104
+ message: `compensation failed after an append error: ${(0, secret_patterns_js_1.redactedMessage)(trigger)} ` +
105
+ `(rollback: ${(0, secret_patterns_js_1.redactedMessage)(rollback)})`,
106
+ code: error_code_js_1.ErrorCode.COMPENSATION_FAILED,
107
+ context: {},
108
+ cause: trigger,
109
+ details: { rollbackError: rollback },
110
+ });
111
+ }
112
+ function unsettledAppendError(cause, unsettledBecause) {
113
+ const trigger = (0, base_error_js_1.toError)(cause);
114
+ const unsettled = (0, base_error_js_1.toError)(unsettledBecause);
115
+ return build(unsettledAppendError, {
116
+ message: `an append chunk could not be settled after ${(0, secret_patterns_js_1.redactedMessage)(trigger)} ` +
117
+ `(unsettled because: ${(0, secret_patterns_js_1.redactedMessage)(unsettled)})`,
118
+ code: error_code_js_1.ErrorCode.COMPENSATION_FAILED,
119
+ context: {},
120
+ cause: trigger,
121
+ details: { rollbackError: unsettled },
122
+ });
123
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SILENT_LOGGER = void 0;
4
+ exports.absorbLoggerFailure = absorbLoggerFailure;
5
+ exports.resolveLogger = resolveLogger;
6
+ exports.SILENT_LOGGER = {
7
+ info() { },
8
+ warn() { },
9
+ error() { },
10
+ debug() { },
11
+ };
12
+ function absorbLoggerFailure(emit) {
13
+ try {
14
+ emit();
15
+ }
16
+ catch {
17
+ }
18
+ }
19
+ function containedLogger(inner) {
20
+ const deliver = (level) => (message, ...args) => absorbLoggerFailure(() => inner[level](message, ...args));
21
+ return {
22
+ info: deliver('info'),
23
+ warn: deliver('warn'),
24
+ error: deliver('error'),
25
+ debug: deliver('debug'),
26
+ };
27
+ }
28
+ function resolveLogger(logger) {
29
+ return logger === undefined ? exports.SILENT_LOGGER : containedLogger(logger);
30
+ }
@@ -6,7 +6,7 @@
6
6
  * that looks like a secret and any text that looks like one; the same walk
7
7
  * serves `redactSecrets` for a value a caller wants to log themselves.
8
8
  */
9
- import { type LogArgument, type Logger } from './logger';
9
+ import { type LogArgument, type Logger } from './logger.js';
10
10
  /**
11
11
  * Recursively clone `value`, replacing any value at a secret-looking key with
12
12
  * `[REDACTED]` and any recognised secret *shape* inside a string — including an
@@ -26,15 +26,19 @@ import { type LogArgument, type Logger } from './logger';
26
26
  * cyclic or shared graph is fine; each node is walked once. `patterns` and
27
27
  * `valuePatterns` — the key names and value shapes to redact, an array of
28
28
  * strings and an array of `RegExp` respectively; both default to this
29
- * package's own lists, and an empty one turns that rule off.
29
+ * package's own lists, and an empty one turns that rule off. A key name is
30
+ * matched by its normalised form — lower-case, punctuation removed — against
31
+ * the end of each key's, so `'apiKey'` covers `x-api-key` and `API_KEY`.
30
32
  *
31
33
  * Returns: a redacted clone. The input is never mutated — a logger that
32
34
  * scrubbed the caller's own object would corrupt the very data the application
33
35
  * is working with.
34
36
  *
35
37
  * Throws: `VALIDATION` naming `patterns` or `valuePatterns` for a list this
36
- * function could not apply, which is a mistake in the call itself and is
37
- * raised before anything is walked. Nothing after that: a value whose
38
+ * function could not apply — a non-array, a wrong entry, or a key name with
39
+ * no letter or digit in it, which would match every key — which is a mistake
40
+ * in the call itself and is raised before anything is walked. Nothing after
41
+ * that: a value whose
38
42
  * redaction fails — a throwing getter, a structure deep enough to exhaust the
39
43
  * stack — is replaced whole by `[UNREDACTABLE]`, since a logger that throws
40
44
  * takes down the operation it was only observing. {@link redactLogger}