@farukada/aws-langgraph-dynamodb-ts 0.8.0 → 1.0.0-rc.1

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 (482) hide show
  1. package/README.md +282 -49
  2. package/dist/checkpointer/actions/delete-thread.d.ts +3 -2
  3. package/dist/checkpointer/actions/delete-thread.js +5 -2
  4. package/dist/checkpointer/actions/get-tuple.d.ts +3 -2
  5. package/dist/checkpointer/actions/get-tuple.js +10 -4
  6. package/dist/checkpointer/actions/list.d.ts +14 -4
  7. package/dist/checkpointer/actions/list.js +94 -61
  8. package/dist/checkpointer/actions/put-writes.d.ts +5 -5
  9. package/dist/checkpointer/actions/put-writes.js +12 -40
  10. package/dist/checkpointer/actions/put.d.ts +10 -3
  11. package/dist/checkpointer/actions/put.js +42 -12
  12. package/dist/checkpointer/internal/assemble.d.ts +10 -3
  13. package/dist/checkpointer/internal/assemble.js +7 -6
  14. package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +24 -0
  15. package/dist/checkpointer/internal/checkpoint-write-verify.js +67 -0
  16. package/dist/checkpointer/internal/configurable.d.ts +0 -1
  17. package/dist/checkpointer/internal/configurable.js +10 -9
  18. package/dist/checkpointer/internal/fetch.d.ts +14 -5
  19. package/dist/checkpointer/internal/fetch.js +56 -14
  20. package/dist/checkpointer/internal/filter-match.d.ts +3 -2
  21. package/dist/checkpointer/internal/filter-match.js +4 -3
  22. package/dist/checkpointer/internal/item-reader.d.ts +31 -6
  23. package/dist/checkpointer/internal/item-reader.js +54 -15
  24. package/dist/checkpointer/internal/item-writer.d.ts +12 -3
  25. package/dist/checkpointer/internal/item-writer.js +26 -10
  26. package/dist/checkpointer/internal/keys.d.ts +11 -1
  27. package/dist/checkpointer/internal/keys.js +33 -3
  28. package/dist/checkpointer/internal/list-scope.d.ts +61 -0
  29. package/dist/checkpointer/internal/list-scope.js +108 -0
  30. package/dist/checkpointer/internal/pending-sends.d.ts +13 -0
  31. package/dist/checkpointer/internal/pending-sends.js +29 -0
  32. package/dist/checkpointer/internal/query.d.ts +2 -1
  33. package/dist/checkpointer/internal/query.js +9 -3
  34. package/dist/checkpointer/internal/regular-write.d.ts +28 -0
  35. package/dist/checkpointer/internal/regular-write.js +66 -0
  36. package/dist/checkpointer/internal/setup.d.ts +3 -1
  37. package/dist/checkpointer/internal/setup.js +10 -8
  38. package/dist/checkpointer/internal/special-write-cas.d.ts +29 -0
  39. package/dist/checkpointer/internal/special-write-cas.js +104 -0
  40. package/dist/checkpointer/internal/special-write-cleanup.d.ts +19 -14
  41. package/dist/checkpointer/internal/special-write-cleanup.js +35 -87
  42. package/dist/checkpointer/internal/special-write-verify.d.ts +53 -0
  43. package/dist/checkpointer/internal/special-write-verify.js +80 -0
  44. package/dist/checkpointer/internal/stored-channels.d.ts +31 -0
  45. package/dist/checkpointer/internal/stored-channels.js +70 -0
  46. package/dist/checkpointer/internal/validation.d.ts +11 -6
  47. package/dist/checkpointer/internal/validation.js +19 -9
  48. package/dist/checkpointer/internal/write-guard.d.ts +8 -9
  49. package/dist/checkpointer/internal/write-guard.js +16 -16
  50. package/dist/checkpointer/internal/write-index.d.ts +8 -1
  51. package/dist/checkpointer/internal/write-index.js +6 -3
  52. package/dist/checkpointer/saver.d.ts +50 -10
  53. package/dist/checkpointer/saver.js +59 -17
  54. package/dist/checkpointer/types.d.ts +14 -1
  55. package/dist/checkpointer/types.js +0 -1
  56. package/dist/factory/factory.d.ts +22 -25
  57. package/dist/factory/factory.js +58 -18
  58. package/dist/factory/types.d.ts +57 -0
  59. package/dist/factory/types.js +2 -0
  60. package/dist/history/actions/add-messages.d.ts +1 -2
  61. package/dist/history/actions/add-messages.js +4 -4
  62. package/dist/history/actions/clear.d.ts +3 -2
  63. package/dist/history/actions/clear.js +5 -2
  64. package/dist/history/actions/get-messages.d.ts +13 -6
  65. package/dist/history/actions/get-messages.js +63 -42
  66. package/dist/history/actions/list-sessions.d.ts +1 -1
  67. package/dist/history/actions/list-sessions.js +8 -12
  68. package/dist/history/actions/reconcile-count.d.ts +1 -2
  69. package/dist/history/actions/reconcile-count.js +20 -7
  70. package/dist/history/chat-message-history.d.ts +51 -26
  71. package/dist/history/chat-message-history.js +60 -30
  72. package/dist/history/internal/append-saga.d.ts +7 -2
  73. package/dist/history/internal/append-saga.js +58 -14
  74. package/dist/history/internal/compensation.d.ts +6 -2
  75. package/dist/history/internal/compensation.js +14 -6
  76. package/dist/history/internal/item-mapper.d.ts +0 -3
  77. package/dist/history/internal/item-mapper.js +2 -8
  78. package/dist/history/internal/keys.d.ts +0 -1
  79. package/dist/history/internal/keys.js +0 -1
  80. package/dist/history/internal/message-chunker.d.ts +0 -1
  81. package/dist/history/internal/message-chunker.js +0 -1
  82. package/dist/history/internal/message-transaction.d.ts +0 -1
  83. package/dist/history/internal/message-transaction.js +3 -2
  84. package/dist/history/internal/message-window.d.ts +17 -0
  85. package/dist/history/internal/message-window.js +49 -0
  86. package/dist/history/internal/query.d.ts +16 -3
  87. package/dist/history/internal/query.js +13 -5
  88. package/dist/history/internal/session-count.d.ts +8 -2
  89. package/dist/history/internal/session-count.js +14 -8
  90. package/dist/history/internal/session-title.d.ts +0 -1
  91. package/dist/history/internal/session-title.js +1 -2
  92. package/dist/history/internal/session-update.d.ts +0 -1
  93. package/dist/history/internal/session-update.js +0 -1
  94. package/dist/history/internal/setup.d.ts +3 -1
  95. package/dist/history/internal/setup.js +16 -8
  96. package/dist/history/internal/title-generator.d.ts +0 -1
  97. package/dist/history/internal/title-generator.js +19 -3
  98. package/dist/history/internal/ttl-anchor.d.ts +1 -2
  99. package/dist/history/internal/ttl-anchor.js +5 -5
  100. package/dist/history/internal/validation.d.ts +19 -3
  101. package/dist/history/internal/validation.js +41 -4
  102. package/dist/history/session-adapter.d.ts +9 -3
  103. package/dist/history/session-adapter.js +6 -3
  104. package/dist/history/types.d.ts +23 -2
  105. package/dist/history/types.js +0 -1
  106. package/dist/index.d.ts +12 -5
  107. package/dist/index.js +5 -3
  108. package/dist/shared/clock.d.ts +6 -1
  109. package/dist/shared/clock.js +9 -1
  110. package/dist/shared/codec/codec.d.ts +26 -17
  111. package/dist/shared/codec/codec.js +46 -24
  112. package/dist/shared/codec/compression.d.ts +1 -2
  113. package/dist/shared/codec/compression.js +2 -3
  114. package/dist/shared/codec/descriptor-keys.d.ts +11 -3
  115. package/dist/shared/codec/descriptor-keys.js +2 -2
  116. package/dist/shared/codec/encode.d.ts +13 -0
  117. package/dist/shared/codec/encode.js +43 -0
  118. package/dist/shared/codec/json-serde.d.ts +0 -1
  119. package/dist/shared/codec/json-serde.js +0 -1
  120. package/dist/shared/codec/payload-loss.d.ts +12 -0
  121. package/dist/shared/codec/payload-loss.js +38 -0
  122. package/dist/shared/codec/s3/adapter-config.d.ts +13 -0
  123. package/dist/shared/codec/s3/adapter-config.js +22 -0
  124. package/dist/shared/codec/s3/bounded-body.d.ts +14 -0
  125. package/dist/shared/codec/s3/bounded-body.js +47 -0
  126. package/dist/shared/codec/s3/client-types.d.ts +34 -0
  127. package/dist/shared/codec/s3/client-types.js +7 -0
  128. package/dist/shared/codec/s3/client.d.ts +11 -5
  129. package/dist/shared/codec/s3/client.js +25 -3
  130. package/dist/shared/codec/s3/config.d.ts +32 -5
  131. package/dist/shared/codec/s3/config.js +37 -5
  132. package/dist/shared/codec/s3/delete.d.ts +0 -1
  133. package/dist/shared/codec/s3/delete.js +0 -1
  134. package/dist/shared/codec/s3/key-scope.d.ts +23 -0
  135. package/dist/shared/codec/s3/key-scope.js +44 -0
  136. package/dist/shared/codec/s3/lifecycle.d.ts +11 -5
  137. package/dist/shared/codec/s3/lifecycle.js +32 -16
  138. package/dist/shared/codec/s3/offloader.d.ts +6 -2
  139. package/dist/shared/codec/s3/offloader.js +21 -3
  140. package/dist/shared/codec/s3/orphans.d.ts +6 -1
  141. package/dist/shared/codec/s3/orphans.js +15 -2
  142. package/dist/shared/codec/s3/read-write.d.ts +7 -3
  143. package/dist/shared/codec/s3/read-write.js +16 -8
  144. package/dist/shared/codec/s3/retry.d.ts +4 -4
  145. package/dist/shared/codec/s3/retry.js +13 -16
  146. package/dist/shared/concurrency.d.ts +6 -0
  147. package/dist/shared/concurrency.js +30 -0
  148. package/dist/shared/constants.d.ts +68 -5
  149. package/dist/shared/constants.js +70 -7
  150. package/dist/shared/dynamodb/abort.d.ts +9 -0
  151. package/dist/shared/dynamodb/abort.js +27 -0
  152. package/dist/shared/dynamodb/backoff.d.ts +4 -4
  153. package/dist/shared/dynamodb/backoff.js +7 -7
  154. package/dist/shared/dynamodb/batch-write.d.ts +0 -1
  155. package/dist/shared/dynamodb/batch-write.js +0 -1
  156. package/dist/shared/dynamodb/cancellation.d.ts +0 -1
  157. package/dist/shared/dynamodb/cancellation.js +0 -1
  158. package/dist/shared/dynamodb/client.d.ts +9 -2
  159. package/dist/shared/dynamodb/client.js +24 -1
  160. package/dist/shared/dynamodb/conditional-put.d.ts +67 -0
  161. package/dist/shared/dynamodb/conditional-put.js +76 -0
  162. package/dist/shared/dynamodb/drain-unprocessed.d.ts +3 -1
  163. package/dist/shared/dynamodb/drain-unprocessed.js +1 -2
  164. package/dist/shared/dynamodb/expiry.d.ts +16 -0
  165. package/dist/shared/dynamodb/expiry.js +29 -0
  166. package/dist/shared/dynamodb/paginate-core.d.ts +5 -3
  167. package/dist/shared/dynamodb/paginate-core.js +47 -17
  168. package/dist/shared/dynamodb/paginate.d.ts +0 -1
  169. package/dist/shared/dynamodb/paginate.js +1 -2
  170. package/dist/shared/dynamodb/partition-delete.d.ts +7 -1
  171. package/dist/shared/dynamodb/partition-delete.js +4 -3
  172. package/dist/shared/dynamodb/retry-classifier.d.ts +10 -2
  173. package/dist/shared/dynamodb/retry-classifier.js +42 -11
  174. package/dist/shared/dynamodb/retry-policy.d.ts +26 -0
  175. package/dist/shared/dynamodb/retry-policy.js +22 -0
  176. package/dist/shared/dynamodb/retry.d.ts +14 -1
  177. package/dist/shared/dynamodb/retry.js +11 -7
  178. package/dist/shared/dynamodb/scan.d.ts +0 -1
  179. package/dist/shared/dynamodb/scan.js +1 -2
  180. package/dist/shared/dynamodb/types.d.ts +1 -2
  181. package/dist/shared/dynamodb/types.js +0 -1
  182. package/dist/shared/errors/base-error.d.ts +14 -6
  183. package/dist/shared/errors/base-error.js +8 -9
  184. package/dist/shared/errors/boundary.d.ts +18 -0
  185. package/dist/shared/errors/boundary.js +46 -0
  186. package/dist/shared/errors/error-code.d.ts +2 -2
  187. package/dist/shared/errors/error-code.js +1 -1
  188. package/dist/shared/errors/errors.d.ts +13 -13
  189. package/dist/shared/errors/errors.js +18 -16
  190. package/dist/shared/errors/upstream-error.d.ts +16 -0
  191. package/dist/shared/errors/upstream-error.js +27 -0
  192. package/dist/shared/errors/wrap-error.d.ts +0 -9
  193. package/dist/shared/errors/wrap-error.js +0 -15
  194. package/dist/shared/logging/logger.d.ts +6 -2
  195. package/dist/shared/logging/logger.js +0 -1
  196. package/dist/shared/logging/redaction-walk.d.ts +2 -2
  197. package/dist/shared/logging/redaction-walk.js +38 -18
  198. package/dist/shared/logging/redaction.d.ts +14 -6
  199. package/dist/shared/logging/redaction.js +19 -4
  200. package/dist/shared/logging/secret-patterns.d.ts +54 -3
  201. package/dist/shared/logging/secret-patterns.js +67 -8
  202. package/dist/shared/options.d.ts +9 -4
  203. package/dist/shared/options.js +0 -1
  204. package/dist/shared/ulid.d.ts +15 -2
  205. package/dist/shared/ulid.js +35 -3
  206. package/dist/shared/validation/options.d.ts +8 -0
  207. package/dist/shared/validation/options.js +90 -0
  208. package/dist/shared/validation/primitives.d.ts +14 -10
  209. package/dist/shared/validation/primitives.js +23 -25
  210. package/dist/shared/validation/ttl.d.ts +14 -7
  211. package/dist/shared/validation/ttl.js +29 -11
  212. package/dist/store/actions/get.d.ts +11 -3
  213. package/dist/store/actions/get.js +52 -14
  214. package/dist/store/actions/list-namespaces.d.ts +0 -1
  215. package/dist/store/actions/list-namespaces.js +10 -6
  216. package/dist/store/actions/put.d.ts +0 -1
  217. package/dist/store/actions/put.js +27 -28
  218. package/dist/store/actions/reconcile-vector-index.d.ts +3 -2
  219. package/dist/store/actions/reconcile-vector-index.js +2 -3
  220. package/dist/store/actions/search.d.ts +1 -2
  221. package/dist/store/actions/search.js +11 -38
  222. package/dist/store/internal/backend-search.d.ts +1 -2
  223. package/dist/store/internal/backend-search.js +14 -7
  224. package/dist/store/internal/batch-plan.d.ts +11 -0
  225. package/dist/store/internal/batch-plan.js +52 -0
  226. package/dist/store/internal/candidates.d.ts +23 -0
  227. package/dist/store/internal/candidates.js +94 -0
  228. package/dist/store/internal/filter.d.ts +0 -1
  229. package/dist/store/internal/filter.js +25 -6
  230. package/dist/store/internal/index-reconcile.d.ts +5 -6
  231. package/dist/store/internal/index-reconcile.js +32 -13
  232. package/dist/store/internal/index-sync.d.ts +0 -1
  233. package/dist/store/internal/index-sync.js +0 -1
  234. package/dist/store/internal/item-mapper.d.ts +6 -3
  235. package/dist/store/internal/item-mapper.js +16 -6
  236. package/dist/store/internal/keys.d.ts +0 -1
  237. package/dist/store/internal/keys.js +0 -1
  238. package/dist/store/internal/namespace-match.d.ts +0 -1
  239. package/dist/store/internal/namespace-match.js +0 -1
  240. package/dist/store/internal/option-validation.d.ts +13 -0
  241. package/dist/store/internal/option-validation.js +77 -0
  242. package/dist/store/internal/overwrite-swap.d.ts +32 -0
  243. package/dist/store/internal/overwrite-swap.js +68 -0
  244. package/dist/store/internal/persist.d.ts +24 -7
  245. package/dist/store/internal/persist.js +49 -19
  246. package/dist/store/internal/query.d.ts +6 -1
  247. package/dist/store/internal/query.js +17 -1
  248. package/dist/store/internal/ranker.d.ts +7 -2
  249. package/dist/store/internal/ranker.js +10 -2
  250. package/dist/store/internal/read-existing.d.ts +23 -0
  251. package/dist/store/internal/read-existing.js +41 -0
  252. package/dist/store/internal/score-direction.d.ts +31 -0
  253. package/dist/store/internal/score-direction.js +38 -0
  254. package/dist/store/internal/search-filter.d.ts +0 -1
  255. package/dist/store/internal/search-filter.js +0 -1
  256. package/dist/store/internal/semantic-search.d.ts +26 -5
  257. package/dist/store/internal/semantic-search.js +59 -19
  258. package/dist/store/internal/setup.d.ts +6 -12
  259. package/dist/store/internal/setup.js +12 -24
  260. package/dist/store/internal/text-path.d.ts +17 -0
  261. package/dist/store/internal/text-path.js +147 -0
  262. package/dist/store/internal/validation.d.ts +8 -3
  263. package/dist/store/internal/validation.js +21 -5
  264. package/dist/store/internal/write-verify.d.ts +27 -9
  265. package/dist/store/internal/write-verify.js +35 -19
  266. package/dist/store/store.d.ts +37 -9
  267. package/dist/store/store.js +52 -17
  268. package/dist/store/types.d.ts +22 -2
  269. package/dist/store/types.js +0 -1
  270. package/dist/store/vector-backend.d.ts +6 -7
  271. package/dist/store/vector-backend.js +0 -1
  272. package/package.json +21 -15
  273. package/dist/checkpointer/actions/delete-thread.d.ts.map +0 -1
  274. package/dist/checkpointer/actions/delete-thread.js.map +0 -1
  275. package/dist/checkpointer/actions/get-tuple.d.ts.map +0 -1
  276. package/dist/checkpointer/actions/get-tuple.js.map +0 -1
  277. package/dist/checkpointer/actions/list.d.ts.map +0 -1
  278. package/dist/checkpointer/actions/list.js.map +0 -1
  279. package/dist/checkpointer/actions/put-writes.d.ts.map +0 -1
  280. package/dist/checkpointer/actions/put-writes.js.map +0 -1
  281. package/dist/checkpointer/actions/put.d.ts.map +0 -1
  282. package/dist/checkpointer/actions/put.js.map +0 -1
  283. package/dist/checkpointer/internal/assemble.d.ts.map +0 -1
  284. package/dist/checkpointer/internal/assemble.js.map +0 -1
  285. package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
  286. package/dist/checkpointer/internal/configurable.js.map +0 -1
  287. package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
  288. package/dist/checkpointer/internal/fetch.js.map +0 -1
  289. package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
  290. package/dist/checkpointer/internal/filter-match.js.map +0 -1
  291. package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
  292. package/dist/checkpointer/internal/item-reader.js.map +0 -1
  293. package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
  294. package/dist/checkpointer/internal/item-writer.js.map +0 -1
  295. package/dist/checkpointer/internal/keys.d.ts.map +0 -1
  296. package/dist/checkpointer/internal/keys.js.map +0 -1
  297. package/dist/checkpointer/internal/query.d.ts.map +0 -1
  298. package/dist/checkpointer/internal/query.js.map +0 -1
  299. package/dist/checkpointer/internal/setup.d.ts.map +0 -1
  300. package/dist/checkpointer/internal/setup.js.map +0 -1
  301. package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
  302. package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
  303. package/dist/checkpointer/internal/validation.d.ts.map +0 -1
  304. package/dist/checkpointer/internal/validation.js.map +0 -1
  305. package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
  306. package/dist/checkpointer/internal/write-guard.js.map +0 -1
  307. package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
  308. package/dist/checkpointer/internal/write-index.js.map +0 -1
  309. package/dist/checkpointer/saver.d.ts.map +0 -1
  310. package/dist/checkpointer/saver.js.map +0 -1
  311. package/dist/checkpointer/types.d.ts.map +0 -1
  312. package/dist/checkpointer/types.js.map +0 -1
  313. package/dist/factory/factory.d.ts.map +0 -1
  314. package/dist/factory/factory.js.map +0 -1
  315. package/dist/history/actions/add-messages.d.ts.map +0 -1
  316. package/dist/history/actions/add-messages.js.map +0 -1
  317. package/dist/history/actions/clear.d.ts.map +0 -1
  318. package/dist/history/actions/clear.js.map +0 -1
  319. package/dist/history/actions/get-messages.d.ts.map +0 -1
  320. package/dist/history/actions/get-messages.js.map +0 -1
  321. package/dist/history/actions/list-sessions.d.ts.map +0 -1
  322. package/dist/history/actions/list-sessions.js.map +0 -1
  323. package/dist/history/actions/reconcile-count.d.ts.map +0 -1
  324. package/dist/history/actions/reconcile-count.js.map +0 -1
  325. package/dist/history/chat-message-history.d.ts.map +0 -1
  326. package/dist/history/chat-message-history.js.map +0 -1
  327. package/dist/history/internal/append-saga.d.ts.map +0 -1
  328. package/dist/history/internal/append-saga.js.map +0 -1
  329. package/dist/history/internal/compensation.d.ts.map +0 -1
  330. package/dist/history/internal/compensation.js.map +0 -1
  331. package/dist/history/internal/item-mapper.d.ts.map +0 -1
  332. package/dist/history/internal/item-mapper.js.map +0 -1
  333. package/dist/history/internal/keys.d.ts.map +0 -1
  334. package/dist/history/internal/keys.js.map +0 -1
  335. package/dist/history/internal/message-chunker.d.ts.map +0 -1
  336. package/dist/history/internal/message-chunker.js.map +0 -1
  337. package/dist/history/internal/message-transaction.d.ts.map +0 -1
  338. package/dist/history/internal/message-transaction.js.map +0 -1
  339. package/dist/history/internal/query.d.ts.map +0 -1
  340. package/dist/history/internal/query.js.map +0 -1
  341. package/dist/history/internal/session-count.d.ts.map +0 -1
  342. package/dist/history/internal/session-count.js.map +0 -1
  343. package/dist/history/internal/session-title.d.ts.map +0 -1
  344. package/dist/history/internal/session-title.js.map +0 -1
  345. package/dist/history/internal/session-update.d.ts.map +0 -1
  346. package/dist/history/internal/session-update.js.map +0 -1
  347. package/dist/history/internal/setup.d.ts.map +0 -1
  348. package/dist/history/internal/setup.js.map +0 -1
  349. package/dist/history/internal/title-generator.d.ts.map +0 -1
  350. package/dist/history/internal/title-generator.js.map +0 -1
  351. package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
  352. package/dist/history/internal/ttl-anchor.js.map +0 -1
  353. package/dist/history/internal/validation.d.ts.map +0 -1
  354. package/dist/history/internal/validation.js.map +0 -1
  355. package/dist/history/session-adapter.d.ts.map +0 -1
  356. package/dist/history/session-adapter.js.map +0 -1
  357. package/dist/history/types.d.ts.map +0 -1
  358. package/dist/history/types.js.map +0 -1
  359. package/dist/index.d.ts.map +0 -1
  360. package/dist/index.js.map +0 -1
  361. package/dist/shared/clock.d.ts.map +0 -1
  362. package/dist/shared/clock.js.map +0 -1
  363. package/dist/shared/codec/codec.d.ts.map +0 -1
  364. package/dist/shared/codec/codec.js.map +0 -1
  365. package/dist/shared/codec/compression.d.ts.map +0 -1
  366. package/dist/shared/codec/compression.js.map +0 -1
  367. package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
  368. package/dist/shared/codec/descriptor-keys.js.map +0 -1
  369. package/dist/shared/codec/json-serde.d.ts.map +0 -1
  370. package/dist/shared/codec/json-serde.js.map +0 -1
  371. package/dist/shared/codec/s3/client.d.ts.map +0 -1
  372. package/dist/shared/codec/s3/client.js.map +0 -1
  373. package/dist/shared/codec/s3/config.d.ts.map +0 -1
  374. package/dist/shared/codec/s3/config.js.map +0 -1
  375. package/dist/shared/codec/s3/delete.d.ts.map +0 -1
  376. package/dist/shared/codec/s3/delete.js.map +0 -1
  377. package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
  378. package/dist/shared/codec/s3/lifecycle.js.map +0 -1
  379. package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
  380. package/dist/shared/codec/s3/offloader.js.map +0 -1
  381. package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
  382. package/dist/shared/codec/s3/orphans.js.map +0 -1
  383. package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
  384. package/dist/shared/codec/s3/read-write.js.map +0 -1
  385. package/dist/shared/codec/s3/retry.d.ts.map +0 -1
  386. package/dist/shared/codec/s3/retry.js.map +0 -1
  387. package/dist/shared/constants.d.ts.map +0 -1
  388. package/dist/shared/constants.js.map +0 -1
  389. package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
  390. package/dist/shared/dynamodb/backoff.js.map +0 -1
  391. package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
  392. package/dist/shared/dynamodb/batch-write.js.map +0 -1
  393. package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
  394. package/dist/shared/dynamodb/cancellation.js.map +0 -1
  395. package/dist/shared/dynamodb/client.d.ts.map +0 -1
  396. package/dist/shared/dynamodb/client.js.map +0 -1
  397. package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
  398. package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
  399. package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
  400. package/dist/shared/dynamodb/paginate-core.js.map +0 -1
  401. package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
  402. package/dist/shared/dynamodb/paginate.js.map +0 -1
  403. package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
  404. package/dist/shared/dynamodb/partition-delete.js.map +0 -1
  405. package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
  406. package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
  407. package/dist/shared/dynamodb/retry.d.ts.map +0 -1
  408. package/dist/shared/dynamodb/retry.js.map +0 -1
  409. package/dist/shared/dynamodb/scan.d.ts.map +0 -1
  410. package/dist/shared/dynamodb/scan.js.map +0 -1
  411. package/dist/shared/dynamodb/types.d.ts.map +0 -1
  412. package/dist/shared/dynamodb/types.js.map +0 -1
  413. package/dist/shared/errors/base-error.d.ts.map +0 -1
  414. package/dist/shared/errors/base-error.js.map +0 -1
  415. package/dist/shared/errors/error-code.d.ts.map +0 -1
  416. package/dist/shared/errors/error-code.js.map +0 -1
  417. package/dist/shared/errors/errors.d.ts.map +0 -1
  418. package/dist/shared/errors/errors.js.map +0 -1
  419. package/dist/shared/errors/wrap-error.d.ts.map +0 -1
  420. package/dist/shared/errors/wrap-error.js.map +0 -1
  421. package/dist/shared/logging/logger.d.ts.map +0 -1
  422. package/dist/shared/logging/logger.js.map +0 -1
  423. package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
  424. package/dist/shared/logging/redaction-walk.js.map +0 -1
  425. package/dist/shared/logging/redaction.d.ts.map +0 -1
  426. package/dist/shared/logging/redaction.js.map +0 -1
  427. package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
  428. package/dist/shared/logging/secret-patterns.js.map +0 -1
  429. package/dist/shared/options.d.ts.map +0 -1
  430. package/dist/shared/options.js.map +0 -1
  431. package/dist/shared/ulid.d.ts.map +0 -1
  432. package/dist/shared/ulid.js.map +0 -1
  433. package/dist/shared/validation/primitives.d.ts.map +0 -1
  434. package/dist/shared/validation/primitives.js.map +0 -1
  435. package/dist/shared/validation/ttl.d.ts.map +0 -1
  436. package/dist/shared/validation/ttl.js.map +0 -1
  437. package/dist/store/actions/get.d.ts.map +0 -1
  438. package/dist/store/actions/get.js.map +0 -1
  439. package/dist/store/actions/list-namespaces.d.ts.map +0 -1
  440. package/dist/store/actions/list-namespaces.js.map +0 -1
  441. package/dist/store/actions/put.d.ts.map +0 -1
  442. package/dist/store/actions/put.js.map +0 -1
  443. package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
  444. package/dist/store/actions/reconcile-vector-index.js.map +0 -1
  445. package/dist/store/actions/search.d.ts.map +0 -1
  446. package/dist/store/actions/search.js.map +0 -1
  447. package/dist/store/internal/backend-search.d.ts.map +0 -1
  448. package/dist/store/internal/backend-search.js.map +0 -1
  449. package/dist/store/internal/filter.d.ts.map +0 -1
  450. package/dist/store/internal/filter.js.map +0 -1
  451. package/dist/store/internal/index-reconcile.d.ts.map +0 -1
  452. package/dist/store/internal/index-reconcile.js.map +0 -1
  453. package/dist/store/internal/index-sync.d.ts.map +0 -1
  454. package/dist/store/internal/index-sync.js.map +0 -1
  455. package/dist/store/internal/item-mapper.d.ts.map +0 -1
  456. package/dist/store/internal/item-mapper.js.map +0 -1
  457. package/dist/store/internal/keys.d.ts.map +0 -1
  458. package/dist/store/internal/keys.js.map +0 -1
  459. package/dist/store/internal/namespace-match.d.ts.map +0 -1
  460. package/dist/store/internal/namespace-match.js.map +0 -1
  461. package/dist/store/internal/persist.d.ts.map +0 -1
  462. package/dist/store/internal/persist.js.map +0 -1
  463. package/dist/store/internal/query.d.ts.map +0 -1
  464. package/dist/store/internal/query.js.map +0 -1
  465. package/dist/store/internal/ranker.d.ts.map +0 -1
  466. package/dist/store/internal/ranker.js.map +0 -1
  467. package/dist/store/internal/search-filter.d.ts.map +0 -1
  468. package/dist/store/internal/search-filter.js.map +0 -1
  469. package/dist/store/internal/semantic-search.d.ts.map +0 -1
  470. package/dist/store/internal/semantic-search.js.map +0 -1
  471. package/dist/store/internal/setup.d.ts.map +0 -1
  472. package/dist/store/internal/setup.js.map +0 -1
  473. package/dist/store/internal/validation.d.ts.map +0 -1
  474. package/dist/store/internal/validation.js.map +0 -1
  475. package/dist/store/internal/write-verify.d.ts.map +0 -1
  476. package/dist/store/internal/write-verify.js.map +0 -1
  477. package/dist/store/store.d.ts.map +0 -1
  478. package/dist/store/store.js.map +0 -1
  479. package/dist/store/types.d.ts.map +0 -1
  480. package/dist/store/types.js.map +0 -1
  481. package/dist/store/vector-backend.d.ts.map +0 -1
  482. package/dist/store/vector-backend.js.map +0 -1
@@ -5,6 +5,7 @@ exports.downloadObject = downloadObject;
5
5
  const retry_1 = require("../../dynamodb/retry");
6
6
  const base_error_1 = require("../../errors/base-error");
7
7
  const error_code_1 = require("../../errors/error-code");
8
+ const bounded_body_1 = require("./bounded-body");
8
9
  const client_1 = require("./client");
9
10
  const retry_2 = require("./retry");
10
11
  /** Upload `data` to S3, wrapping failures as `S3_OFFLOAD_FAILED`. */
@@ -18,26 +19,33 @@ async function uploadObject(client, params) {
18
19
  ContentType: 'application/octet-stream',
19
20
  ServerSideEncryption: params.serverSideEncryption,
20
21
  ...(params.sseKmsKeyId ? { SSEKMSKeyId: params.sseKmsKeyId } : {}),
21
- })), { maxAttempts: 3, retryableErrors: retry_2.RETRYABLE_S3_SIGNALS });
22
+ })), { maxAttempts: 3, isRetryable: retry_2.isTransientS3Error });
22
23
  }
23
24
  catch (error) {
24
- throw new base_error_1.DynamoDbLangGraphError(error.message, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'upload', key: params.key }, error);
25
+ throw new base_error_1.DynamoDBLangGraphError(error.message, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'upload', key: params.key }, error);
25
26
  }
26
27
  }
27
- /** Download an object's bytes, wrapping failures/empty bodies as `S3_OFFLOAD_FAILED`. */
28
- async function downloadObject(client, bucket, key) {
28
+ /**
29
+ * Download an object's bytes, wrapping failures/empty bodies as
30
+ * `S3_OFFLOAD_FAILED`. An object over `maxBytes` is refused from its declared
31
+ * `ContentLength` before the body is touched, or while streaming when the
32
+ * length is unknown, so a replaced or hostile object can never exhaust memory.
33
+ */
34
+ async function downloadObject(client, bucket, key, maxBytes) {
29
35
  const { GetObjectCommand } = await (0, client_1.loadS3Sdk)();
30
36
  try {
31
37
  return await (0, retry_1.withRetry)(async () => {
32
38
  const response = await client.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
39
+ if (typeof response.ContentLength === 'number' && response.ContentLength > maxBytes) {
40
+ throw (0, bounded_body_1.oversizedObjectError)(key, response.ContentLength, maxBytes);
41
+ }
33
42
  if (!response.Body) {
34
43
  throw new Error(`S3 object body is empty for key: ${key}`);
35
44
  }
36
- return new Uint8Array(await response.Body.transformToByteArray());
37
- }, { maxAttempts: 3, retryableErrors: retry_2.RETRYABLE_S3_SIGNALS });
45
+ return (0, bounded_body_1.readBodyBounded)(response.Body, key, maxBytes);
46
+ }, { maxAttempts: 3, isRetryable: retry_2.isTransientS3Error });
38
47
  }
39
48
  catch (error) {
40
- throw new base_error_1.DynamoDbLangGraphError(error.message, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'download', key }, error);
49
+ throw new base_error_1.DynamoDBLangGraphError(error.message, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'download', key }, error);
41
50
  }
42
51
  }
43
- //# sourceMappingURL=read-write.js.map
@@ -1,5 +1,5 @@
1
- declare const RETRYABLE_S3_SIGNALS: readonly string[];
2
- export { RETRYABLE_S3_SIGNALS };
3
- /** True when `error` looks like a transient S3 failure worth retrying. */
1
+ /**
2
+ * True when `error` looks like a transient S3 failure worth retrying — the one
3
+ * classifier for uploads, downloads and orphan cleanup.
4
+ */
4
5
  export declare function isTransientS3Error(error: Error): boolean;
5
- //# sourceMappingURL=retry.d.ts.map
@@ -1,25 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RETRYABLE_S3_SIGNALS = void 0;
4
3
  exports.isTransientS3Error = isTransientS3Error;
4
+ const retry_classifier_1 = require("../../dynamodb/retry-classifier");
5
+ /**
6
+ * Transient S3 signals: everything the DynamoDB classifier already treats as
7
+ * transient (the SDK transport `TimeoutError`, socket errors, `RequestTimeout`,
8
+ * `ServiceUnavailable`, …) plus the two names only S3 uses. HTTP 429/5xx and
9
+ * the `$retryable` trait are recognised by the shared classifier itself.
10
+ */
5
11
  const RETRYABLE_S3_SIGNALS = [
12
+ ...retry_classifier_1.DEFAULT_RETRYABLE_ERRORS,
6
13
  'SlowDown',
7
14
  'InternalError',
8
- 'ServiceUnavailable',
9
- 'RequestTimeout',
10
- 'ThrottlingException',
11
- 'ECONNRESET',
12
- 'ETIMEDOUT',
13
- 'NetworkingError',
14
15
  ];
15
- exports.RETRYABLE_S3_SIGNALS = RETRYABLE_S3_SIGNALS;
16
- /** True when `error` looks like a transient S3 failure worth retrying. */
16
+ /**
17
+ * True when `error` looks like a transient S3 failure worth retrying — the one
18
+ * classifier for uploads, downloads and orphan cleanup.
19
+ */
17
20
  function isTransientS3Error(error) {
18
- const fields = error;
19
- const status = fields.$metadata?.httpStatusCode;
20
- if (typeof status === 'number' && (status === 429 || (status >= 500 && status < 600)))
21
- return true;
22
- const signals = [fields.name, fields.code].filter((value) => typeof value === 'string');
23
- return signals.some((signal) => RETRYABLE_S3_SIGNALS.some((retryable) => signal.includes(retryable)));
21
+ return (0, retry_classifier_1.isRetryableError)(error, RETRYABLE_S3_SIGNALS);
24
22
  }
25
- //# sourceMappingURL=retry.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Map `items` through `fn` with at most `limit` calls in flight, preserving
3
+ * input order in the result. The first rejection wins: no further item is
4
+ * started, the calls already in flight settle, and that error propagates.
5
+ */
6
+ export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapWithConcurrency = mapWithConcurrency;
4
+ /**
5
+ * Map `items` through `fn` with at most `limit` calls in flight, preserving
6
+ * input order in the result. The first rejection wins: no further item is
7
+ * started, the calls already in flight settle, and that error propagates.
8
+ */
9
+ async function mapWithConcurrency(items, limit, fn) {
10
+ const results = [];
11
+ let next = 0;
12
+ let failure;
13
+ const worker = async () => {
14
+ while (failure === undefined && next < items.length) {
15
+ const index = next;
16
+ next += 1;
17
+ try {
18
+ results[index] = await fn(items[index], index);
19
+ }
20
+ catch (error) {
21
+ failure ??= error;
22
+ }
23
+ }
24
+ };
25
+ const workers = Math.max(1, Math.min(limit, items.length));
26
+ await Promise.all(Array.from({ length: workers }, worker));
27
+ if (failure !== undefined)
28
+ throw failure;
29
+ return results;
30
+ }
@@ -1,6 +1,6 @@
1
1
  /** Maximum TTL expressed in days (5 years). */
2
2
  export declare const MAX_TTL_DAYS: number;
3
- /** Maximum TTL expressed in seconds (100 years). */
3
+ /** Maximum TTL expressed in seconds: the same five years as {@link MAX_TTL_DAYS}. */
4
4
  export declare const MAX_TTL_SECONDS: number;
5
5
  /** Hard cap on query-pagination loop iterations (runaway-loop guard). */
6
6
  export declare const MAX_LOOP_ITERATIONS = 1000;
@@ -20,6 +20,13 @@ export declare const MAX_BACKOFF_DELAY_MS = 5000;
20
20
  export declare const S3_DELETE_BATCH_MAX = 1000;
21
21
  /** Default payload size that triggers S3 offload (350 KB; 50 KB under the DDB 400 KB cap). */
22
22
  export declare const DEFAULT_S3_THRESHOLD_BYTES: number;
23
+ /**
24
+ * Largest serialized payload stored inline when no S3 offloader is configured:
25
+ * DynamoDB's 400 KB item cap less 8 KB of headroom for the item's keys,
26
+ * attribute names and descriptor fields. Exceeding it fails before the write
27
+ * with a typed error instead of a raw `ValidationException` after it.
28
+ */
29
+ export declare const MAX_INLINE_PAYLOAD_BYTES: number;
23
30
  /** Default S3 key prefix for offloaded payloads. */
24
31
  export declare const DEFAULT_S3_KEY_PREFIX = "langgraph-checkpoints/";
25
32
  /** Default S3 server-side encryption algorithm. */
@@ -30,8 +37,17 @@ export declare const DEFAULT_COMPRESSION_MIN_BYTES = 1024;
30
37
  export declare const DEFAULT_COMPRESSION_LEVEL = 6;
31
38
  /** Default gzip-bomb guard: maximum decompressed output (50 MiB). */
32
39
  export declare const DEFAULT_MAX_DECOMPRESSED_BYTES: number;
40
+ /**
41
+ * Default cap on an offloaded object buffered from S3 (50 MiB), checked against
42
+ * `ContentLength` before the body is read and enforced while streaming when
43
+ * the length is unknown. Together with {@link DEFAULT_MAX_DECOMPRESSED_BYTES}
44
+ * it bounds the memory any single payload can claim.
45
+ */
46
+ export declare const DEFAULT_MAX_S3_DOWNLOAD_BYTES: number;
33
47
  /** Default maximum attempts for transient-error retries. */
34
48
  export declare const DEFAULT_RETRY_MAX_ATTEMPTS = 5;
49
+ /** Largest `retry.maxAttempts` an adapter accepts; beyond it a retry loop is a hang, not a policy. */
50
+ export declare const MAX_RETRY_ATTEMPTS = 100;
35
51
  /**
36
52
  * Max attempts for the message-append transaction. It shares one session's
37
53
  * metadata row across every concurrent `addMessages` caller on that session,
@@ -39,11 +55,58 @@ export declare const DEFAULT_RETRY_MAX_ATTEMPTS = 5;
39
55
  * existing 100ms base / 5000ms cap backoff, this keeps worst-case retrying
40
56
  * within AWS's documented guidance to bound conflict retries to "around one
41
57
  * minute" (see DynamoDB's "Error retries and exponential backoff" guide).
42
- * This bound is exact, not a floor: the DynamoDB client disables the AWS
43
- * SDK's own internal retries by default (see `resolveDynamoDBClient`), so
44
- * this is the only retry layer in play.
58
+ * This bound is exact for clients this library constructs, which disable the
59
+ * AWS SDK's own internal retries (`maxAttempts: 1`, see
60
+ * `resolveDynamoDBClient`). An injected client that keeps SDK retries stacks
61
+ * them inside each attempt; construction warns about that.
45
62
  */
46
63
  export declare const MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = 18;
64
+ /**
65
+ * Offloaded payloads decoded at once by one read (`getTuple` pending writes,
66
+ * `search` candidates, `getMessages`). Each offloaded row costs one S3 GET, so
67
+ * a serial loop scaled latency linearly with the row count; eight in flight
68
+ * keeps the win without bursting a bucket.
69
+ */
70
+ export declare const DEFAULT_READ_CONCURRENCY = 8;
47
71
  /** Default cap on candidates the in-DB semantic ranker will score. */
48
72
  export declare const DEFAULT_MAX_SEARCH_CANDIDATES = 1000;
49
- //# sourceMappingURL=constants.d.ts.map
73
+ /**
74
+ * Raw rows a single `listCheckpoints` call may pull before it warns. The read
75
+ * itself is deliberately unbounded — capping it counted raw rows rather than
76
+ * filter-matched ones, which turned a caller asking for a handful of rare
77
+ * matches over a large thread into a hard error instead of the true answer.
78
+ * The warning restores the operational signal without restoring the wrong
79
+ * error.
80
+ *
81
+ * Its own literal, deliberately: this is the point at which a scan is worth
82
+ * telling an operator about, which is independent of
83
+ * {@link MAX_TOTAL_ITEMS_IN_MEMORY}'s hard collection cap. Aliasing the two
84
+ * meant retuning the memory cap silently moved the warning as well, and it
85
+ * left the pair reported as a duplicate export.
86
+ */
87
+ export declare const LIST_SCAN_WARN_THRESHOLD = 10000;
88
+ /**
89
+ * Byte caps on caller-supplied identifiers, measured as UTF-8. DynamoDB caps a
90
+ * partition key at 2048 bytes and a sort key at 1024; S3 caps an object key at
91
+ * 1024. These leave room for the adapter prefixes and separators that compose
92
+ * the stored keys, so a value that passes validation fails as a typed error
93
+ * here rather than as a raw AWS ValidationException on the write.
94
+ *
95
+ * Partition-key identifiers: `thread_id` and `sessionId`.
96
+ */
97
+ export declare const MAX_PARTITION_ID_BYTES = 1024;
98
+ /**
99
+ * Sort-key segments: `checkpoint_ns`, `checkpoint_id`, `taskId`, a pending-write
100
+ * channel, a store namespace element and a store `key`.
101
+ */
102
+ export declare const MAX_KEY_SEGMENT_BYTES = 256;
103
+ /** DynamoDB cap on a whole sort key; composed keys are checked against it too. */
104
+ export declare const MAX_SORT_KEY_BYTES = 1024;
105
+ /** S3 cap on an object key, applied to the produced offload key. */
106
+ export declare const MAX_S3_KEY_BYTES = 1024;
107
+ /**
108
+ * Extra days an S3 lifecycle rule adds over the TTL it backs. DynamoDB's TTL
109
+ * sweep can lag up to ~48 h past the `ttl` timestamp; the offloaded object
110
+ * must outlive its row, never the other way round.
111
+ */
112
+ export declare const S3_LIFECYCLE_SWEEP_MARGIN_DAYS = 2;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_MAX_SEARCH_CANDIDATES = exports.MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = exports.DEFAULT_RETRY_MAX_ATTEMPTS = exports.DEFAULT_MAX_DECOMPRESSED_BYTES = exports.DEFAULT_COMPRESSION_LEVEL = exports.DEFAULT_COMPRESSION_MIN_BYTES = exports.DEFAULT_S3_SSE = exports.DEFAULT_S3_KEY_PREFIX = exports.DEFAULT_S3_THRESHOLD_BYTES = exports.S3_DELETE_BATCH_MAX = exports.MAX_BACKOFF_DELAY_MS = exports.INITIAL_BACKOFF_DELAY_MS = exports.MAX_UNPROCESSED_RETRIES = exports.BATCH_GET_MAX = exports.BATCH_WRITE_MAX = exports.MAX_TOTAL_ITEMS_IN_MEMORY = exports.MAX_LOOP_ITERATIONS = exports.MAX_TTL_SECONDS = exports.MAX_TTL_DAYS = void 0;
3
+ exports.S3_LIFECYCLE_SWEEP_MARGIN_DAYS = exports.MAX_S3_KEY_BYTES = exports.MAX_SORT_KEY_BYTES = exports.MAX_KEY_SEGMENT_BYTES = exports.MAX_PARTITION_ID_BYTES = exports.LIST_SCAN_WARN_THRESHOLD = exports.DEFAULT_MAX_SEARCH_CANDIDATES = exports.DEFAULT_READ_CONCURRENCY = exports.MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = exports.MAX_RETRY_ATTEMPTS = exports.DEFAULT_RETRY_MAX_ATTEMPTS = exports.DEFAULT_MAX_S3_DOWNLOAD_BYTES = exports.DEFAULT_MAX_DECOMPRESSED_BYTES = exports.DEFAULT_COMPRESSION_LEVEL = exports.DEFAULT_COMPRESSION_MIN_BYTES = exports.DEFAULT_S3_SSE = exports.DEFAULT_S3_KEY_PREFIX = exports.MAX_INLINE_PAYLOAD_BYTES = exports.DEFAULT_S3_THRESHOLD_BYTES = exports.S3_DELETE_BATCH_MAX = exports.MAX_BACKOFF_DELAY_MS = exports.INITIAL_BACKOFF_DELAY_MS = exports.MAX_UNPROCESSED_RETRIES = exports.BATCH_GET_MAX = exports.BATCH_WRITE_MAX = exports.MAX_TOTAL_ITEMS_IN_MEMORY = exports.MAX_LOOP_ITERATIONS = exports.MAX_TTL_SECONDS = exports.MAX_TTL_DAYS = void 0;
4
4
  /** Maximum TTL expressed in days (5 years). */
5
5
  exports.MAX_TTL_DAYS = 365 * 5;
6
- /** Maximum TTL expressed in seconds (100 years). */
7
- exports.MAX_TTL_SECONDS = 100 * 365 * 24 * 60 * 60;
6
+ /** Maximum TTL expressed in seconds: the same five years as {@link MAX_TTL_DAYS}. */
7
+ exports.MAX_TTL_SECONDS = exports.MAX_TTL_DAYS * 24 * 60 * 60;
8
8
  /** Hard cap on query-pagination loop iterations (runaway-loop guard). */
9
9
  exports.MAX_LOOP_ITERATIONS = 1000;
10
10
  /** Hard cap on items collected into memory across a paginated query. */
@@ -23,6 +23,13 @@ exports.MAX_BACKOFF_DELAY_MS = 5000;
23
23
  exports.S3_DELETE_BATCH_MAX = 1000;
24
24
  /** Default payload size that triggers S3 offload (350 KB; 50 KB under the DDB 400 KB cap). */
25
25
  exports.DEFAULT_S3_THRESHOLD_BYTES = 350 * 1024;
26
+ /**
27
+ * Largest serialized payload stored inline when no S3 offloader is configured:
28
+ * DynamoDB's 400 KB item cap less 8 KB of headroom for the item's keys,
29
+ * attribute names and descriptor fields. Exceeding it fails before the write
30
+ * with a typed error instead of a raw `ValidationException` after it.
31
+ */
32
+ exports.MAX_INLINE_PAYLOAD_BYTES = 400 * 1024 - 8 * 1024;
26
33
  /** Default S3 key prefix for offloaded payloads. */
27
34
  exports.DEFAULT_S3_KEY_PREFIX = 'langgraph-checkpoints/';
28
35
  /** Default S3 server-side encryption algorithm. */
@@ -33,8 +40,17 @@ exports.DEFAULT_COMPRESSION_MIN_BYTES = 1024;
33
40
  exports.DEFAULT_COMPRESSION_LEVEL = 6;
34
41
  /** Default gzip-bomb guard: maximum decompressed output (50 MiB). */
35
42
  exports.DEFAULT_MAX_DECOMPRESSED_BYTES = 50 * 1024 * 1024;
43
+ /**
44
+ * Default cap on an offloaded object buffered from S3 (50 MiB), checked against
45
+ * `ContentLength` before the body is read and enforced while streaming when
46
+ * the length is unknown. Together with {@link DEFAULT_MAX_DECOMPRESSED_BYTES}
47
+ * it bounds the memory any single payload can claim.
48
+ */
49
+ exports.DEFAULT_MAX_S3_DOWNLOAD_BYTES = 50 * 1024 * 1024;
36
50
  /** Default maximum attempts for transient-error retries. */
37
51
  exports.DEFAULT_RETRY_MAX_ATTEMPTS = 5;
52
+ /** Largest `retry.maxAttempts` an adapter accepts; beyond it a retry loop is a hang, not a policy. */
53
+ exports.MAX_RETRY_ATTEMPTS = 100;
38
54
  /**
39
55
  * Max attempts for the message-append transaction. It shares one session's
40
56
  * metadata row across every concurrent `addMessages` caller on that session,
@@ -42,11 +58,58 @@ exports.DEFAULT_RETRY_MAX_ATTEMPTS = 5;
42
58
  * existing 100ms base / 5000ms cap backoff, this keeps worst-case retrying
43
59
  * within AWS's documented guidance to bound conflict retries to "around one
44
60
  * minute" (see DynamoDB's "Error retries and exponential backoff" guide).
45
- * This bound is exact, not a floor: the DynamoDB client disables the AWS
46
- * SDK's own internal retries by default (see `resolveDynamoDBClient`), so
47
- * this is the only retry layer in play.
61
+ * This bound is exact for clients this library constructs, which disable the
62
+ * AWS SDK's own internal retries (`maxAttempts: 1`, see
63
+ * `resolveDynamoDBClient`). An injected client that keeps SDK retries stacks
64
+ * them inside each attempt; construction warns about that.
48
65
  */
49
66
  exports.MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = 18;
67
+ /**
68
+ * Offloaded payloads decoded at once by one read (`getTuple` pending writes,
69
+ * `search` candidates, `getMessages`). Each offloaded row costs one S3 GET, so
70
+ * a serial loop scaled latency linearly with the row count; eight in flight
71
+ * keeps the win without bursting a bucket.
72
+ */
73
+ exports.DEFAULT_READ_CONCURRENCY = 8;
50
74
  /** Default cap on candidates the in-DB semantic ranker will score. */
51
75
  exports.DEFAULT_MAX_SEARCH_CANDIDATES = 1000;
52
- //# sourceMappingURL=constants.js.map
76
+ /**
77
+ * Raw rows a single `listCheckpoints` call may pull before it warns. The read
78
+ * itself is deliberately unbounded — capping it counted raw rows rather than
79
+ * filter-matched ones, which turned a caller asking for a handful of rare
80
+ * matches over a large thread into a hard error instead of the true answer.
81
+ * The warning restores the operational signal without restoring the wrong
82
+ * error.
83
+ *
84
+ * Its own literal, deliberately: this is the point at which a scan is worth
85
+ * telling an operator about, which is independent of
86
+ * {@link MAX_TOTAL_ITEMS_IN_MEMORY}'s hard collection cap. Aliasing the two
87
+ * meant retuning the memory cap silently moved the warning as well, and it
88
+ * left the pair reported as a duplicate export.
89
+ */
90
+ exports.LIST_SCAN_WARN_THRESHOLD = 10000;
91
+ /**
92
+ * Byte caps on caller-supplied identifiers, measured as UTF-8. DynamoDB caps a
93
+ * partition key at 2048 bytes and a sort key at 1024; S3 caps an object key at
94
+ * 1024. These leave room for the adapter prefixes and separators that compose
95
+ * the stored keys, so a value that passes validation fails as a typed error
96
+ * here rather than as a raw AWS ValidationException on the write.
97
+ *
98
+ * Partition-key identifiers: `thread_id` and `sessionId`.
99
+ */
100
+ exports.MAX_PARTITION_ID_BYTES = 1024;
101
+ /**
102
+ * Sort-key segments: `checkpoint_ns`, `checkpoint_id`, `taskId`, a pending-write
103
+ * channel, a store namespace element and a store `key`.
104
+ */
105
+ exports.MAX_KEY_SEGMENT_BYTES = 256;
106
+ /** DynamoDB cap on a whole sort key; composed keys are checked against it too. */
107
+ exports.MAX_SORT_KEY_BYTES = 1024;
108
+ /** S3 cap on an object key, applied to the produced offload key. */
109
+ exports.MAX_S3_KEY_BYTES = 1024;
110
+ /**
111
+ * Extra days an S3 lifecycle rule adds over the TTL it backs. DynamoDB's TTL
112
+ * sweep can lag up to ~48 h past the `ttl` timestamp; the offloaded object
113
+ * must outlive its row, never the other way round.
114
+ */
115
+ exports.S3_LIFECYCLE_SWEEP_MARGIN_DAYS = 2;
@@ -0,0 +1,9 @@
1
+ import { AbortError } from '../errors/errors';
2
+ /**
3
+ * The library's error for an aborted `signal`. A caller's own `AbortError`
4
+ * used as the abort reason is returned unchanged; anything else — the
5
+ * `DOMException` a bare `controller.abort()` produces, a string, a custom
6
+ * error — becomes the `cause` of a fresh {@link AbortError}, so
7
+ * `code === 'ABORTED'` holds however the signal was aborted.
8
+ */
9
+ export declare function abortErrorFrom(signal: AbortSignal): AbortError;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.abortErrorFrom = abortErrorFrom;
4
+ const base_error_1 = require("../errors/base-error");
5
+ const error_code_1 = require("../errors/error-code");
6
+ const errors_1 = require("../errors/errors");
7
+ const wrap_error_1 = require("../errors/wrap-error");
8
+ /** True when the abort reason already is this library's `AbortError` (a string or DOMException is not). */
9
+ function isLibraryAbort(reason) {
10
+ return (typeof reason === 'object' &&
11
+ reason !== null &&
12
+ (0, base_error_1.isDynamoDBLangGraphError)(reason) &&
13
+ reason.code === error_code_1.ErrorCode.ABORTED);
14
+ }
15
+ /**
16
+ * The library's error for an aborted `signal`. A caller's own `AbortError`
17
+ * used as the abort reason is returned unchanged; anything else — the
18
+ * `DOMException` a bare `controller.abort()` produces, a string, a custom
19
+ * error — becomes the `cause` of a fresh {@link AbortError}, so
20
+ * `code === 'ABORTED'` holds however the signal was aborted.
21
+ */
22
+ function abortErrorFrom(signal) {
23
+ const reason = signal.reason;
24
+ if (isLibraryAbort(reason))
25
+ return reason;
26
+ return new errors_1.AbortError('Operation aborted', reason === undefined ? undefined : (0, wrap_error_1.toError)(reason));
27
+ }
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Sleep for `ms` milliseconds, cancellable via `signal`. If `signal` is already
3
- * aborted the promise rejects synchronously with the abort reason (or an
4
- * {@link AbortError}); otherwise the timer resolves and the listener is removed.
2
+ * Sleep for `ms` milliseconds, cancellable via `signal`. An already-aborted
3
+ * signal rejects at once and an abort while pending rejects the moment it fires; both
4
+ * reject with the library's `AbortError` (see `abortErrorFrom`), so a caller
5
+ * branching on `code === 'ABORTED'` sees it however the signal was aborted.
5
6
  */
6
7
  export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
7
8
  /** Next exponential-backoff delay: double `currentMs`, capped at `maxMs`. */
@@ -12,4 +13,3 @@ export declare function nextBackoffDelay(currentMs: number, maxMs?: number): num
12
13
  * @param rng - RNG seam returning `[0, 1)`. Defaults to `Math.random`.
13
14
  */
14
15
  export declare function fullJitter(delayMs: number, rng?: () => number): number;
15
- //# sourceMappingURL=backoff.d.ts.map
@@ -4,15 +4,16 @@ exports.sleep = sleep;
4
4
  exports.nextBackoffDelay = nextBackoffDelay;
5
5
  exports.fullJitter = fullJitter;
6
6
  const constants_1 = require("../constants");
7
- const errors_1 = require("../errors/errors");
7
+ const abort_1 = require("./abort");
8
8
  /**
9
- * Sleep for `ms` milliseconds, cancellable via `signal`. If `signal` is already
10
- * aborted the promise rejects synchronously with the abort reason (or an
11
- * {@link AbortError}); otherwise the timer resolves and the listener is removed.
9
+ * Sleep for `ms` milliseconds, cancellable via `signal`. An already-aborted
10
+ * signal rejects at once and an abort while pending rejects the moment it fires; both
11
+ * reject with the library's `AbortError` (see `abortErrorFrom`), so a caller
12
+ * branching on `code === 'ABORTED'` sees it however the signal was aborted.
12
13
  */
13
14
  function sleep(ms, signal) {
14
15
  if (signal?.aborted) {
15
- return Promise.reject(signal.reason ?? new errors_1.AbortError());
16
+ return Promise.reject((0, abort_1.abortErrorFrom)(signal));
16
17
  }
17
18
  return new Promise((resolve, reject) => {
18
19
  let settled = false;
@@ -21,7 +22,7 @@ function sleep(ms, signal) {
21
22
  return;
22
23
  settled = true;
23
24
  clearTimeout(timer);
24
- reject(signal?.reason ?? new errors_1.AbortError());
25
+ reject((0, abort_1.abortErrorFrom)(signal));
25
26
  };
26
27
  const timer = setTimeout(() => {
27
28
  if (settled)
@@ -45,4 +46,3 @@ function nextBackoffDelay(currentMs, maxMs = constants_1.MAX_BACKOFF_DELAY_MS) {
45
46
  function fullJitter(delayMs, rng = Math.random) {
46
47
  return rng() * delayMs;
47
48
  }
48
- //# sourceMappingURL=backoff.js.map
@@ -20,4 +20,3 @@ import type { WriteRequest } from './types';
20
20
  * requires updating both call sites.
21
21
  */
22
22
  export declare function batchWriteAll(client: DynamoDBDocument, tableName: string, requests: WriteRequest[], options?: DrainOptions): Promise<void>;
23
- //# sourceMappingURL=batch-write.d.ts.map
@@ -51,4 +51,3 @@ async function batchWriteAll(client, tableName, requests, options = {}) {
51
51
  throw new errors_1.BatchWriteAllIncompleteError(succeededChunks, totalChunks, failedChunks, succeededCount);
52
52
  }
53
53
  }
54
- //# sourceMappingURL=batch-write.js.map
@@ -4,4 +4,3 @@ export interface CancellationReason {
4
4
  }
5
5
  /** Extract `CancellationReasons` from a transaction-cancellation error, if present. */
6
6
  export declare function getCancellationReasons(error: Error): CancellationReason[] | undefined;
7
- //# sourceMappingURL=cancellation.d.ts.map
@@ -5,4 +5,3 @@ exports.getCancellationReasons = getCancellationReasons;
5
5
  function getCancellationReasons(error) {
6
6
  return error.CancellationReasons;
7
7
  }
8
- //# sourceMappingURL=cancellation.js.map
@@ -1,5 +1,6 @@
1
1
  import { DynamoDBClient, type DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
2
2
  import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
3
+ import type { Logger } from '../logging/logger';
3
4
  /** A resolved DynamoDB client plus its ownership flag. */
4
5
  export interface ResolvedDynamoDBClient {
5
6
  ddbClient: DynamoDBClient | undefined;
@@ -10,7 +11,6 @@ export interface ResolvedDynamoDBClient {
10
11
  export interface ResolveClientOptions {
11
12
  client?: DynamoDBDocument;
12
13
  clientConfig?: DynamoDBClientConfig;
13
- createClient?: (config: DynamoDBClientConfig) => DynamoDBClient;
14
14
  }
15
15
  /**
16
16
  * Resolve the DocumentClient for an adapter. An injected `client` is used as-is
@@ -18,4 +18,11 @@ export interface ResolveClientOptions {
18
18
  * `createClient` seam) and owned, so the adapter destroys it on `destroy()`.
19
19
  */
20
20
  export declare function resolveDynamoDBClient(options: ResolveClientOptions): ResolvedDynamoDBClient;
21
- //# sourceMappingURL=client.d.ts.map
21
+ /**
22
+ * Warn once when an injected client keeps the SDK's own retries. They run
23
+ * inside every attempt of this library's retry layer, so the budget the
24
+ * constants and README describe multiplies (5 × 3 requests per operation with
25
+ * the SDK default) and a throttling event turns into a retry storm. A client
26
+ * that cannot report its setting is left alone; the check never throws.
27
+ */
28
+ export declare function warnOnStackedRetries(client: DynamoDBDocument, logger: Logger): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveDynamoDBClient = resolveDynamoDBClient;
4
+ exports.warnOnStackedRetries = warnOnStackedRetries;
4
5
  const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
5
6
  const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
6
7
  /**
@@ -16,4 +17,26 @@ function resolveDynamoDBClient(options) {
16
17
  const ddbClient = createClient({ maxAttempts: 1, ...options.clientConfig });
17
18
  return { ddbClient, client: lib_dynamodb_1.DynamoDBDocument.from(ddbClient), ownsClient: true };
18
19
  }
19
- //# sourceMappingURL=client.js.map
20
+ /**
21
+ * Warn once when an injected client keeps the SDK's own retries. They run
22
+ * inside every attempt of this library's retry layer, so the budget the
23
+ * constants and README describe multiplies (5 × 3 requests per operation with
24
+ * the SDK default) and a throttling event turns into a retry storm. A client
25
+ * that cannot report its setting is left alone; the check never throws.
26
+ */
27
+ async function warnOnStackedRetries(client, logger) {
28
+ const report = client.config
29
+ ?.maxAttempts;
30
+ if (typeof report !== 'function')
31
+ return;
32
+ try {
33
+ const maxAttempts = await report();
34
+ if (maxAttempts > 1) {
35
+ logger.warn("injected DynamoDB client keeps the SDK's own retries; they stack inside this library's " +
36
+ 'retry budget — construct it with maxAttempts: 1 unless that is intended', { maxAttempts });
37
+ }
38
+ }
39
+ catch {
40
+ /** A client that cannot report its retry setting is left alone. */
41
+ }
42
+ }
@@ -0,0 +1,67 @@
1
+ import type { DocItem } from './types';
2
+ /**
3
+ * Attribute holding a row's revision token on adapters that need one. The
4
+ * checkpointer's special writes reuse their existing per-call `writeGroup`
5
+ * instead, so `revisionGuard` takes the attribute name rather than assuming it.
6
+ */
7
+ export declare const REVISION_ATTRIBUTE = "rev";
8
+ /**
9
+ * Compare-and-swap attempts before a caller gives up and overwrites
10
+ * unconditionally. Kept small on purpose: DynamoDB charges write capacity for a
11
+ * *failed* conditional write too, sized on the existing item, so an aggressive
12
+ * loop turns contention into cost. Three attempts settle every realistic race,
13
+ * and the fallback is exactly the pre-0.9.0 behaviour rather than an error.
14
+ */
15
+ export declare const OVERWRITE_CAS_MAX_ATTEMPTS = 3;
16
+ /** What a caller saw at the row before it tried to overwrite it. */
17
+ export interface ObservedRow {
18
+ exists: boolean;
19
+ revision?: string;
20
+ }
21
+ /**
22
+ * Condition fragments to spread into a `PutCommand` input. Every guard asks
23
+ * DynamoDB to attach the existing row to a rejection, so a compare-and-swap
24
+ * that loses can re-pin from the exception (see {@link rejectedItem}) instead
25
+ * of spending a second strongly-consistent read.
26
+ */
27
+ export interface RevisionGuard {
28
+ ConditionExpression: string;
29
+ ExpressionAttributeNames?: Record<string, string>;
30
+ ExpressionAttributeValues?: Record<string, string>;
31
+ ReturnValuesOnConditionCheckFailure: 'ALL_OLD';
32
+ }
33
+ /**
34
+ * Build the condition admitting a write only while the row still holds the
35
+ * revision this caller observed.
36
+ *
37
+ * Without it, two concurrent overwrites both read the same previous payload
38
+ * descriptor, both commit their own nonced upload, and both delete that same
39
+ * previous object — leaving the loser's upload orphaned with nothing left
40
+ * recording that it ever existed. A post-commit read-back cannot repair that,
41
+ * because neither writer can learn of an object it never saw; only refusing the
42
+ * second write until it re-reads can.
43
+ *
44
+ * A row with no revision attribute was written before 0.9.0. Pinning its
45
+ * *absence* is what makes the swap correct across an upgrade: the first writer
46
+ * to touch such a row stamps one, and any racer still holding the pre-upgrade
47
+ * observation is turned away.
48
+ */
49
+ export declare function revisionGuard(attribute: string, observed: ObservedRow): RevisionGuard;
50
+ /**
51
+ * True when the guard rejected a write — NOT evidence a competitor won: a
52
+ * `PutCommand` retried after its response was lost can re-hit its own
53
+ * committed row and fail identically; the two cases are indistinguishable.
54
+ */
55
+ export declare function isConditionalCheckFailed(error: {
56
+ name?: string;
57
+ }): boolean;
58
+ /**
59
+ * The row that turned a conditional write away, when DynamoDB attached it
60
+ * (`ReturnValuesOnConditionCheckFailure: 'ALL_OLD'`). Verified against real
61
+ * DynamoDB: the document client does not unmarshall an *error* payload the way
62
+ * it unmarshalls a response, so the item arrives in raw AttributeValue form and
63
+ * is unmarshalled here. Undefined when the rejection carries no item — the row
64
+ * was deleted between the observation and the write — in which case the caller
65
+ * falls back to a read.
66
+ */
67
+ export declare function rejectedItem(error: Error): DocItem | undefined;