@farukada/aws-langgraph-dynamodb-ts 0.9.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 (494) 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 +89 -63
  8. package/dist/checkpointer/actions/put-writes.d.ts +5 -5
  9. package/dist/checkpointer/actions/put-writes.js +12 -41
  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 +17 -6
  23. package/dist/checkpointer/internal/item-reader.js +39 -14
  24. package/dist/checkpointer/internal/item-writer.d.ts +12 -3
  25. package/dist/checkpointer/internal/item-writer.js +24 -9
  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 +1 -2
  39. package/dist/checkpointer/internal/special-write-cas.js +9 -9
  40. package/dist/checkpointer/internal/special-write-cleanup.d.ts +1 -2
  41. package/dist/checkpointer/internal/special-write-cleanup.js +10 -7
  42. package/dist/checkpointer/internal/special-write-verify.d.ts +0 -1
  43. package/dist/checkpointer/internal/special-write-verify.js +18 -3
  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 -1
  49. package/dist/checkpointer/internal/write-guard.js +16 -7
  50. package/dist/checkpointer/internal/write-index.d.ts +0 -1
  51. package/dist/checkpointer/internal/write-index.js +0 -1
  52. package/dist/checkpointer/saver.d.ts +50 -10
  53. package/dist/checkpointer/saver.js +59 -17
  54. package/dist/checkpointer/types.d.ts +8 -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 +53 -5
  149. package/dist/shared/constants.js +55 -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 +18 -2
  161. package/dist/shared/dynamodb/conditional-put.js +19 -2
  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 +9 -5
  199. package/dist/shared/logging/redaction.js +19 -4
  200. package/dist/shared/logging/secret-patterns.d.ts +21 -3
  201. package/dist/shared/logging/secret-patterns.js +32 -6
  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 +24 -13
  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 +12 -6
  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 +0 -1
  230. package/dist/store/internal/index-reconcile.d.ts +5 -6
  231. package/dist/store/internal/index-reconcile.js +25 -12
  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 +5 -3
  235. package/dist/store/internal/item-mapper.js +14 -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 +0 -1
  243. package/dist/store/internal/overwrite-swap.js +10 -4
  244. package/dist/store/internal/persist.d.ts +3 -2
  245. package/dist/store/internal/persist.js +16 -11
  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 +9 -5
  251. package/dist/store/internal/read-existing.js +22 -10
  252. package/dist/store/internal/score-direction.d.ts +0 -1
  253. package/dist/store/internal/score-direction.js +0 -1
  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 +5 -13
  259. package/dist/store/internal/setup.js +11 -63
  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 +15 -10
  265. package/dist/store/internal/write-verify.js +24 -21
  266. package/dist/store/store.d.ts +37 -9
  267. package/dist/store/store.js +52 -17
  268. package/dist/store/types.d.ts +6 -2
  269. package/dist/store/types.js +0 -1
  270. package/dist/store/vector-backend.d.ts +0 -1
  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-cas.d.ts.map +0 -1
  302. package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
  303. package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
  304. package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
  305. package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
  306. package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
  307. package/dist/checkpointer/internal/validation.d.ts.map +0 -1
  308. package/dist/checkpointer/internal/validation.js.map +0 -1
  309. package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
  310. package/dist/checkpointer/internal/write-guard.js.map +0 -1
  311. package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
  312. package/dist/checkpointer/internal/write-index.js.map +0 -1
  313. package/dist/checkpointer/saver.d.ts.map +0 -1
  314. package/dist/checkpointer/saver.js.map +0 -1
  315. package/dist/checkpointer/types.d.ts.map +0 -1
  316. package/dist/checkpointer/types.js.map +0 -1
  317. package/dist/factory/factory.d.ts.map +0 -1
  318. package/dist/factory/factory.js.map +0 -1
  319. package/dist/history/actions/add-messages.d.ts.map +0 -1
  320. package/dist/history/actions/add-messages.js.map +0 -1
  321. package/dist/history/actions/clear.d.ts.map +0 -1
  322. package/dist/history/actions/clear.js.map +0 -1
  323. package/dist/history/actions/get-messages.d.ts.map +0 -1
  324. package/dist/history/actions/get-messages.js.map +0 -1
  325. package/dist/history/actions/list-sessions.d.ts.map +0 -1
  326. package/dist/history/actions/list-sessions.js.map +0 -1
  327. package/dist/history/actions/reconcile-count.d.ts.map +0 -1
  328. package/dist/history/actions/reconcile-count.js.map +0 -1
  329. package/dist/history/chat-message-history.d.ts.map +0 -1
  330. package/dist/history/chat-message-history.js.map +0 -1
  331. package/dist/history/internal/append-saga.d.ts.map +0 -1
  332. package/dist/history/internal/append-saga.js.map +0 -1
  333. package/dist/history/internal/compensation.d.ts.map +0 -1
  334. package/dist/history/internal/compensation.js.map +0 -1
  335. package/dist/history/internal/item-mapper.d.ts.map +0 -1
  336. package/dist/history/internal/item-mapper.js.map +0 -1
  337. package/dist/history/internal/keys.d.ts.map +0 -1
  338. package/dist/history/internal/keys.js.map +0 -1
  339. package/dist/history/internal/message-chunker.d.ts.map +0 -1
  340. package/dist/history/internal/message-chunker.js.map +0 -1
  341. package/dist/history/internal/message-transaction.d.ts.map +0 -1
  342. package/dist/history/internal/message-transaction.js.map +0 -1
  343. package/dist/history/internal/query.d.ts.map +0 -1
  344. package/dist/history/internal/query.js.map +0 -1
  345. package/dist/history/internal/session-count.d.ts.map +0 -1
  346. package/dist/history/internal/session-count.js.map +0 -1
  347. package/dist/history/internal/session-title.d.ts.map +0 -1
  348. package/dist/history/internal/session-title.js.map +0 -1
  349. package/dist/history/internal/session-update.d.ts.map +0 -1
  350. package/dist/history/internal/session-update.js.map +0 -1
  351. package/dist/history/internal/setup.d.ts.map +0 -1
  352. package/dist/history/internal/setup.js.map +0 -1
  353. package/dist/history/internal/title-generator.d.ts.map +0 -1
  354. package/dist/history/internal/title-generator.js.map +0 -1
  355. package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
  356. package/dist/history/internal/ttl-anchor.js.map +0 -1
  357. package/dist/history/internal/validation.d.ts.map +0 -1
  358. package/dist/history/internal/validation.js.map +0 -1
  359. package/dist/history/session-adapter.d.ts.map +0 -1
  360. package/dist/history/session-adapter.js.map +0 -1
  361. package/dist/history/types.d.ts.map +0 -1
  362. package/dist/history/types.js.map +0 -1
  363. package/dist/index.d.ts.map +0 -1
  364. package/dist/index.js.map +0 -1
  365. package/dist/shared/clock.d.ts.map +0 -1
  366. package/dist/shared/clock.js.map +0 -1
  367. package/dist/shared/codec/codec.d.ts.map +0 -1
  368. package/dist/shared/codec/codec.js.map +0 -1
  369. package/dist/shared/codec/compression.d.ts.map +0 -1
  370. package/dist/shared/codec/compression.js.map +0 -1
  371. package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
  372. package/dist/shared/codec/descriptor-keys.js.map +0 -1
  373. package/dist/shared/codec/json-serde.d.ts.map +0 -1
  374. package/dist/shared/codec/json-serde.js.map +0 -1
  375. package/dist/shared/codec/s3/client.d.ts.map +0 -1
  376. package/dist/shared/codec/s3/client.js.map +0 -1
  377. package/dist/shared/codec/s3/config.d.ts.map +0 -1
  378. package/dist/shared/codec/s3/config.js.map +0 -1
  379. package/dist/shared/codec/s3/delete.d.ts.map +0 -1
  380. package/dist/shared/codec/s3/delete.js.map +0 -1
  381. package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
  382. package/dist/shared/codec/s3/lifecycle.js.map +0 -1
  383. package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
  384. package/dist/shared/codec/s3/offloader.js.map +0 -1
  385. package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
  386. package/dist/shared/codec/s3/orphans.js.map +0 -1
  387. package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
  388. package/dist/shared/codec/s3/read-write.js.map +0 -1
  389. package/dist/shared/codec/s3/retry.d.ts.map +0 -1
  390. package/dist/shared/codec/s3/retry.js.map +0 -1
  391. package/dist/shared/constants.d.ts.map +0 -1
  392. package/dist/shared/constants.js.map +0 -1
  393. package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
  394. package/dist/shared/dynamodb/backoff.js.map +0 -1
  395. package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
  396. package/dist/shared/dynamodb/batch-write.js.map +0 -1
  397. package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
  398. package/dist/shared/dynamodb/cancellation.js.map +0 -1
  399. package/dist/shared/dynamodb/client.d.ts.map +0 -1
  400. package/dist/shared/dynamodb/client.js.map +0 -1
  401. package/dist/shared/dynamodb/conditional-put.d.ts.map +0 -1
  402. package/dist/shared/dynamodb/conditional-put.js.map +0 -1
  403. package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
  404. package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
  405. package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
  406. package/dist/shared/dynamodb/paginate-core.js.map +0 -1
  407. package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
  408. package/dist/shared/dynamodb/paginate.js.map +0 -1
  409. package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
  410. package/dist/shared/dynamodb/partition-delete.js.map +0 -1
  411. package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
  412. package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
  413. package/dist/shared/dynamodb/retry.d.ts.map +0 -1
  414. package/dist/shared/dynamodb/retry.js.map +0 -1
  415. package/dist/shared/dynamodb/scan.d.ts.map +0 -1
  416. package/dist/shared/dynamodb/scan.js.map +0 -1
  417. package/dist/shared/dynamodb/types.d.ts.map +0 -1
  418. package/dist/shared/dynamodb/types.js.map +0 -1
  419. package/dist/shared/errors/base-error.d.ts.map +0 -1
  420. package/dist/shared/errors/base-error.js.map +0 -1
  421. package/dist/shared/errors/error-code.d.ts.map +0 -1
  422. package/dist/shared/errors/error-code.js.map +0 -1
  423. package/dist/shared/errors/errors.d.ts.map +0 -1
  424. package/dist/shared/errors/errors.js.map +0 -1
  425. package/dist/shared/errors/wrap-error.d.ts.map +0 -1
  426. package/dist/shared/errors/wrap-error.js.map +0 -1
  427. package/dist/shared/logging/logger.d.ts.map +0 -1
  428. package/dist/shared/logging/logger.js.map +0 -1
  429. package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
  430. package/dist/shared/logging/redaction-walk.js.map +0 -1
  431. package/dist/shared/logging/redaction.d.ts.map +0 -1
  432. package/dist/shared/logging/redaction.js.map +0 -1
  433. package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
  434. package/dist/shared/logging/secret-patterns.js.map +0 -1
  435. package/dist/shared/options.d.ts.map +0 -1
  436. package/dist/shared/options.js.map +0 -1
  437. package/dist/shared/ulid.d.ts.map +0 -1
  438. package/dist/shared/ulid.js.map +0 -1
  439. package/dist/shared/validation/primitives.d.ts.map +0 -1
  440. package/dist/shared/validation/primitives.js.map +0 -1
  441. package/dist/shared/validation/ttl.d.ts.map +0 -1
  442. package/dist/shared/validation/ttl.js.map +0 -1
  443. package/dist/store/actions/get.d.ts.map +0 -1
  444. package/dist/store/actions/get.js.map +0 -1
  445. package/dist/store/actions/list-namespaces.d.ts.map +0 -1
  446. package/dist/store/actions/list-namespaces.js.map +0 -1
  447. package/dist/store/actions/put.d.ts.map +0 -1
  448. package/dist/store/actions/put.js.map +0 -1
  449. package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
  450. package/dist/store/actions/reconcile-vector-index.js.map +0 -1
  451. package/dist/store/actions/search.d.ts.map +0 -1
  452. package/dist/store/actions/search.js.map +0 -1
  453. package/dist/store/internal/backend-search.d.ts.map +0 -1
  454. package/dist/store/internal/backend-search.js.map +0 -1
  455. package/dist/store/internal/filter.d.ts.map +0 -1
  456. package/dist/store/internal/filter.js.map +0 -1
  457. package/dist/store/internal/index-reconcile.d.ts.map +0 -1
  458. package/dist/store/internal/index-reconcile.js.map +0 -1
  459. package/dist/store/internal/index-sync.d.ts.map +0 -1
  460. package/dist/store/internal/index-sync.js.map +0 -1
  461. package/dist/store/internal/item-mapper.d.ts.map +0 -1
  462. package/dist/store/internal/item-mapper.js.map +0 -1
  463. package/dist/store/internal/keys.d.ts.map +0 -1
  464. package/dist/store/internal/keys.js.map +0 -1
  465. package/dist/store/internal/namespace-match.d.ts.map +0 -1
  466. package/dist/store/internal/namespace-match.js.map +0 -1
  467. package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
  468. package/dist/store/internal/overwrite-swap.js.map +0 -1
  469. package/dist/store/internal/persist.d.ts.map +0 -1
  470. package/dist/store/internal/persist.js.map +0 -1
  471. package/dist/store/internal/query.d.ts.map +0 -1
  472. package/dist/store/internal/query.js.map +0 -1
  473. package/dist/store/internal/ranker.d.ts.map +0 -1
  474. package/dist/store/internal/ranker.js.map +0 -1
  475. package/dist/store/internal/read-existing.d.ts.map +0 -1
  476. package/dist/store/internal/read-existing.js.map +0 -1
  477. package/dist/store/internal/score-direction.d.ts.map +0 -1
  478. package/dist/store/internal/score-direction.js.map +0 -1
  479. package/dist/store/internal/search-filter.d.ts.map +0 -1
  480. package/dist/store/internal/search-filter.js.map +0 -1
  481. package/dist/store/internal/semantic-search.d.ts.map +0 -1
  482. package/dist/store/internal/semantic-search.js.map +0 -1
  483. package/dist/store/internal/setup.d.ts.map +0 -1
  484. package/dist/store/internal/setup.js.map +0 -1
  485. package/dist/store/internal/validation.d.ts.map +0 -1
  486. package/dist/store/internal/validation.js.map +0 -1
  487. package/dist/store/internal/write-verify.d.ts.map +0 -1
  488. package/dist/store/internal/write-verify.js.map +0 -1
  489. package/dist/store/store.d.ts.map +0 -1
  490. package/dist/store/store.js.map +0 -1
  491. package/dist/store/types.d.ts.map +0 -1
  492. package/dist/store/types.js.map +0 -1
  493. package/dist/store/vector-backend.d.ts.map +0 -1
  494. package/dist/store/vector-backend.js.map +0 -1
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reportGuardRejection = reportGuardRejection;
4
+ exports.rejectionProvesForeignRow = rejectionProvesForeignRow;
5
+ const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
4
6
  /**
5
7
  * The channel recorded on the row that turned a write away, or undefined when
6
- * the service returned no attributes. `ReturnValuesOnConditionCheckFailure:
7
- * 'ALL_OLD'` attaches the existing item to the exception at no extra round
8
- * trip, but — verified against real DynamoDB — the document client does not
9
- * unmarshall an *error* payload the way it unmarshalls a response, so the
10
- * attribute arrives in raw AttributeValue form.
8
+ * the service returned no attributes (`ReturnValuesOnConditionCheckFailure:
9
+ * 'ALL_OLD'` attaches the existing item to the exception at no extra round trip).
11
10
  */
12
11
  function rejectedChannel(error) {
13
- return error.Item?.channel?.S;
12
+ return (0, conditional_put_1.rejectedItem)(error)?.channel;
14
13
  }
15
14
  /**
16
15
  * Report a guard rejection. Sort keys carry their channel, so a rejection
@@ -36,4 +35,14 @@ function reportGuardRejection(context, item, error) {
36
35
  channel: item.channel,
37
36
  });
38
37
  }
39
- //# sourceMappingURL=write-guard.js.map
38
+ /**
39
+ * True when the guard rejection's returned row provably belongs to another
40
+ * `putWrites` call, so this call's own upload is dead and safe to delete. A
41
+ * retried put whose response was lost can be rejected by the row it wrote
42
+ * itself, so an equal group — or no attributes at all — proves nothing and
43
+ * must not be taken as "my upload is dead".
44
+ */
45
+ function rejectionProvesForeignRow(item, error) {
46
+ const group = (0, conditional_put_1.rejectedItem)(error)?.writeGroup;
47
+ return group !== undefined && group !== item.writeGroup;
48
+ }
@@ -34,4 +34,3 @@ export interface ResolvedWrite {
34
34
  * regular, not resolve to an inherited function reference.
35
35
  */
36
36
  export declare function resolveWriteIndices(writes: PendingWrite[]): ResolvedWrite[];
37
- //# sourceMappingURL=write-index.d.ts.map
@@ -39,4 +39,3 @@ function resolveWriteIndices(writes) {
39
39
  });
40
40
  return [...bySpecialIndex.values(), ...regular];
41
41
  }
42
- //# sourceMappingURL=write-index.js.map
@@ -1,30 +1,70 @@
1
1
  import type { RunnableConfig } from '@langchain/core/runnables';
2
- import { BaseCheckpointSaver, type Checkpoint, type CheckpointListOptions, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from '@langchain/langgraph-checkpoint';
2
+ import { BaseCheckpointSaver, type ChannelVersions, type Checkpoint, type CheckpointListOptions, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from '@langchain/langgraph-checkpoint';
3
+ import type { CancelOptions } from '../shared/options';
3
4
  import type { DynamoDBSaverOptions } from './types';
4
5
  /**
5
6
  * DynamoDB-backed LangGraph checkpoint saver. A thin orchestrator: it resolves
6
7
  * its collaborators once and delegates every operation to a focused action.
8
+ * Every public method is the library's error boundary — a raw AWS SDK error
9
+ * escaping an action surfaces as an `UpstreamError`.
7
10
  */
8
11
  export declare class DynamoDBSaver extends BaseCheckpointSaver {
9
12
  private readonly context;
10
13
  private readonly ownsClient;
11
14
  private readonly ddbClient;
12
15
  constructor(options: DynamoDBSaverOptions);
16
+ /**
17
+ * Read one checkpoint with its metadata and pending writes: the one
18
+ * `checkpoint_id` names, else the newest in the namespace. Strongly
19
+ * consistent, so a checkpoint just written is always seen. Returns
20
+ * `undefined` for an unknown thread or checkpoint, or a config without a
21
+ * thread.
22
+ * @throws ValidationError for a malformed identifier; UpstreamError, RetryExhaustedError, AbortError (`config.signal`).
23
+ */
13
24
  getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
25
+ /**
26
+ * Stream checkpoints newest first: one namespace, every namespace of a
27
+ * thread when `checkpoint_ns` is omitted, or every thread in the table when
28
+ * `thread_id` is omitted (a table scan). Eventually consistent. `before`,
29
+ * `filter` and `limit` follow the reference savers.
30
+ * @remarks One read per page plus two per yielded tuple (see the README cost table).
31
+ * @throws ValidationError, UpstreamError, RetryExhaustedError, AbortError.
32
+ */
14
33
  list(config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
15
- put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;
34
+ /**
35
+ * Store a checkpoint and its metadata in one transaction and return the
36
+ * config that addresses it. `config.checkpoint_id` becomes the parent;
37
+ * `newVersions` names the channels that changed, and only those plus the
38
+ * ones the parent stored are persisted. Last writer wins for a repeated
39
+ * `checkpoint_id`.
40
+ * @throws ValidationError; UpstreamError; RetryExhaustedError; AbortError; S3_OFFLOAD_FAILED when an offloaded payload cannot be uploaded.
41
+ */
42
+ put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, newVersions?: ChannelVersions): Promise<RunnableConfig>;
43
+ /**
44
+ * Store a task's pending writes for the checkpoint `config` names, one row
45
+ * per write, written in parallel. Regular writes are first-write-wins;
46
+ * special channels (`__interrupt__`, `__resume__`, `__error__`,
47
+ * `__scheduled__`) overwrite, guarded so two concurrent calls never orphan
48
+ * an offloaded object.
49
+ * @throws ValidationError when `checkpoint_id` is missing or a channel is malformed; UpstreamError; RetryExhaustedError; AbortError.
50
+ */
16
51
  putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
17
- deleteThread(threadId: string): Promise<void>;
52
+ /**
53
+ * Delete every checkpoint, payload and pending write of a thread and their
54
+ * offloaded objects. Single pass: call it when the thread is quiescent.
55
+ * @throws BatchWriteAllIncompleteError when a delete batch does not fully drain; UpstreamError; AbortError (`options.signal`).
56
+ */
57
+ deleteThread(threadId: string, options?: CancelOptions): Promise<void>;
18
58
  /** Release owned resources (the underlying client and any S3 client). */
19
59
  destroy(): void;
20
60
  /**
21
- * Best-effort provision an S3 lifecycle expiration rule matching the
22
- * configured TTL, so offloaded objects don't outlive their DynamoDB item
23
- * forever. No-ops when S3 offload or TTL isn't configured. Requires the
24
- * `s3:GetLifecycleConfiguration`/`s3:PutLifecycleConfiguration` bucket-level
25
- * permissions (broader than the object-level CRUD the rest of S3 offload
26
- * needs) — call this once during deployment/provisioning, not per-request.
61
+ * Provision an S3 lifecycle expiration rule matching the configured TTL, so
62
+ * offloaded objects don't outlive their DynamoDB item forever. No-ops when
63
+ * S3 offload or TTL isn't configured; throws when the bucket cannot be read
64
+ * or written. Requires the `s3:GetLifecycleConfiguration` /
65
+ * `s3:PutLifecycleConfiguration` bucket-level permissions (broader than the
66
+ * object-level CRUD the rest of S3 offload needs) — call this once during
67
+ * deployment/provisioning, not per-request.
27
68
  */
28
69
  ensureS3LifecycleRule(): Promise<void>;
29
70
  }
30
- //# sourceMappingURL=saver.d.ts.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamoDBSaver = void 0;
4
4
  const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
5
+ const boundary_1 = require("../shared/errors/boundary");
5
6
  const ttl_1 = require("../shared/validation/ttl");
6
7
  const delete_thread_1 = require("./actions/delete-thread");
7
8
  const get_tuple_1 = require("./actions/get-tuple");
@@ -12,6 +13,8 @@ const setup_1 = require("./internal/setup");
12
13
  /**
13
14
  * DynamoDB-backed LangGraph checkpoint saver. A thin orchestrator: it resolves
14
15
  * its collaborators once and delegates every operation to a focused action.
16
+ * Every public method is the library's error boundary — a raw AWS SDK error
17
+ * escaping an action surfaces as an `UpstreamError`.
15
18
  */
16
19
  class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
17
20
  context;
@@ -24,20 +27,57 @@ class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
24
27
  this.ownsClient = setup.ownsClient;
25
28
  this.ddbClient = setup.ddbClient;
26
29
  }
30
+ /**
31
+ * Read one checkpoint with its metadata and pending writes: the one
32
+ * `checkpoint_id` names, else the newest in the namespace. Strongly
33
+ * consistent, so a checkpoint just written is always seen. Returns
34
+ * `undefined` for an unknown thread or checkpoint, or a config without a
35
+ * thread.
36
+ * @throws ValidationError for a malformed identifier; UpstreamError, RetryExhaustedError, AbortError (`config.signal`).
37
+ */
27
38
  async getTuple(config) {
28
- return (0, get_tuple_1.getCheckpointTuple)(this.context, config);
39
+ return (0, boundary_1.guardPublic)('saver.getTuple', () => (0, get_tuple_1.getCheckpointTuple)(this.context, config));
29
40
  }
41
+ /**
42
+ * Stream checkpoints newest first: one namespace, every namespace of a
43
+ * thread when `checkpoint_ns` is omitted, or every thread in the table when
44
+ * `thread_id` is omitted (a table scan). Eventually consistent. `before`,
45
+ * `filter` and `limit` follow the reference savers.
46
+ * @remarks One read per page plus two per yielded tuple (see the README cost table).
47
+ * @throws ValidationError, UpstreamError, RetryExhaustedError, AbortError.
48
+ */
30
49
  list(config, options) {
31
- return (0, list_1.listCheckpoints)(this.context, config, options);
50
+ return (0, boundary_1.guardPublicIterable)('saver.list', (0, list_1.listCheckpoints)(this.context, config, options));
32
51
  }
33
- async put(config, checkpoint, metadata) {
34
- return (0, put_1.putCheckpoint)(this.context, config, checkpoint, metadata);
52
+ /**
53
+ * Store a checkpoint and its metadata in one transaction and return the
54
+ * config that addresses it. `config.checkpoint_id` becomes the parent;
55
+ * `newVersions` names the channels that changed, and only those plus the
56
+ * ones the parent stored are persisted. Last writer wins for a repeated
57
+ * `checkpoint_id`.
58
+ * @throws ValidationError; UpstreamError; RetryExhaustedError; AbortError; S3_OFFLOAD_FAILED when an offloaded payload cannot be uploaded.
59
+ */
60
+ async put(config, checkpoint, metadata, newVersions) {
61
+ return (0, boundary_1.guardPublic)('saver.put', () => (0, put_1.putCheckpoint)(this.context, config, checkpoint, metadata, newVersions));
35
62
  }
63
+ /**
64
+ * Store a task's pending writes for the checkpoint `config` names, one row
65
+ * per write, written in parallel. Regular writes are first-write-wins;
66
+ * special channels (`__interrupt__`, `__resume__`, `__error__`,
67
+ * `__scheduled__`) overwrite, guarded so two concurrent calls never orphan
68
+ * an offloaded object.
69
+ * @throws ValidationError when `checkpoint_id` is missing or a channel is malformed; UpstreamError; RetryExhaustedError; AbortError.
70
+ */
36
71
  async putWrites(config, writes, taskId) {
37
- return (0, put_writes_1.putWrites)(this.context, config, writes, taskId);
72
+ return (0, boundary_1.guardPublic)('saver.putWrites', () => (0, put_writes_1.putWrites)(this.context, config, writes, taskId));
38
73
  }
39
- async deleteThread(threadId) {
40
- return (0, delete_thread_1.deleteThread)(this.context, threadId);
74
+ /**
75
+ * Delete every checkpoint, payload and pending write of a thread and their
76
+ * offloaded objects. Single pass: call it when the thread is quiescent.
77
+ * @throws BatchWriteAllIncompleteError when a delete batch does not fully drain; UpstreamError; AbortError (`options.signal`).
78
+ */
79
+ async deleteThread(threadId, options) {
80
+ return (0, boundary_1.guardPublic)('saver.deleteThread', () => (0, delete_thread_1.deleteThread)(this.context, threadId, options));
41
81
  }
42
82
  /** Release owned resources (the underlying client and any S3 client). */
43
83
  destroy() {
@@ -46,18 +86,20 @@ class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
46
86
  this.ddbClient?.destroy();
47
87
  }
48
88
  /**
49
- * Best-effort provision an S3 lifecycle expiration rule matching the
50
- * configured TTL, so offloaded objects don't outlive their DynamoDB item
51
- * forever. No-ops when S3 offload or TTL isn't configured. Requires the
52
- * `s3:GetLifecycleConfiguration`/`s3:PutLifecycleConfiguration` bucket-level
53
- * permissions (broader than the object-level CRUD the rest of S3 offload
54
- * needs) — call this once during deployment/provisioning, not per-request.
89
+ * Provision an S3 lifecycle expiration rule matching the configured TTL, so
90
+ * offloaded objects don't outlive their DynamoDB item forever. No-ops when
91
+ * S3 offload or TTL isn't configured; throws when the bucket cannot be read
92
+ * or written. Requires the `s3:GetLifecycleConfiguration` /
93
+ * `s3:PutLifecycleConfiguration` bucket-level permissions (broader than the
94
+ * object-level CRUD the rest of S3 offload needs) — call this once during
95
+ * deployment/provisioning, not per-request.
55
96
  */
56
97
  async ensureS3LifecycleRule() {
57
- if (!this.context.offloader || !this.context.ttl)
58
- return;
59
- await this.context.offloader.ensureLifecycleRule((0, ttl_1.resolveTtlDaysCeil)(this.context.ttl));
98
+ return (0, boundary_1.guardPublic)('saver.ensureS3LifecycleRule', async () => {
99
+ if (!this.context.offloader || !this.context.ttl)
100
+ return;
101
+ await this.context.offloader.ensureLifecycleRule((0, ttl_1.lifecycleExpirationDays)(this.context.ttl));
102
+ });
60
103
  }
61
104
  }
62
105
  exports.DynamoDBSaver = DynamoDBSaver;
63
- //# sourceMappingURL=saver.js.map
@@ -11,6 +11,8 @@ export interface CheckpointConfigurable {
11
11
  thread_id: string;
12
12
  checkpoint_ns?: string;
13
13
  checkpoint_id?: string;
14
+ /** Legacy alias of `checkpoint_id` that older callers and API-shaped configs still emit. */
15
+ thread_ts?: string;
14
16
  }
15
17
  /** The lightweight `META#` item: structural fields + serialized metadata. */
16
18
  export interface CheckpointMetaItem {
@@ -21,6 +23,12 @@ export interface CheckpointMetaItem {
21
23
  checkpointId: string;
22
24
  parentCheckpointId?: string;
23
25
  metadata: PayloadDescriptor;
26
+ /**
27
+ * The channels whose values the PAYLOAD row holds: those the put's
28
+ * `newVersions` named plus those carried over from the parent. Absent on
29
+ * rows written before this attribute, which hold every value they were given.
30
+ */
31
+ storedChannels?: string[];
24
32
  ttl?: number;
25
33
  }
26
34
  /** The heavy `PAYLOAD#` item: the serialized checkpoint. */
@@ -48,4 +56,3 @@ export interface CheckpointWriteItem {
48
56
  value: PayloadDescriptor;
49
57
  ttl?: number;
50
58
  }
51
- //# sourceMappingURL=types.d.ts.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1,32 +1,10 @@
1
- import type { DynamoDBClient, DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
2
- import type { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
3
1
  import { DynamoDBSaver } from '../checkpointer/saver';
4
2
  import type { DynamoDBSaverOptions } from '../checkpointer/types';
5
3
  import { DynamoDBChatMessageHistory } from '../history/chat-message-history';
6
4
  import type { DynamoDBChatMessageHistoryOptions } from '../history/types';
7
- import type { Logger } from '../shared/logging/logger';
8
5
  import { DynamoDBStore } from '../store/store';
9
6
  import type { DynamoDBStoreOptions } from '../store/types';
10
- /** Shared client/logger defaults applied to every adapter the factory builds. */
11
- export interface FactoryBaseOptions {
12
- client?: DynamoDBDocument;
13
- clientConfig?: DynamoDBClientConfig;
14
- createClient?: (config: DynamoDBClientConfig) => DynamoDBClient;
15
- logger?: Logger;
16
- }
17
- /** Per-adapter options for {@link DynamoDBFactory.createAll} (client is shared). */
18
- export interface CreateAllOptions {
19
- saver: Omit<DynamoDBSaverOptions, 'client' | 'clientConfig' | 'createClient'>;
20
- store: Omit<DynamoDBStoreOptions, 'client' | 'clientConfig' | 'createClient'>;
21
- history: Omit<DynamoDBChatMessageHistoryOptions, 'client' | 'clientConfig' | 'createClient'>;
22
- }
23
- /** The three adapters sharing one client, plus a combined `destroy`. */
24
- export interface CreatedAdapters {
25
- saver: DynamoDBSaver;
26
- store: DynamoDBStore;
27
- history: DynamoDBChatMessageHistory;
28
- destroy: () => void;
29
- }
7
+ import type { CreateAllOptions, CreatedAdapters, FactoryBaseOptions } from './types';
30
8
  /**
31
9
  * Convenience constructors for the adapters. Individual `create*` methods each
32
10
  * build their own client; {@link createAll} builds one shared client used by all
@@ -35,9 +13,28 @@ export interface CreatedAdapters {
35
13
  export declare class DynamoDBFactory {
36
14
  private readonly base;
37
15
  constructor(base?: FactoryBaseOptions);
16
+ /** The base options every adapter inherits regardless of which client it uses. */
17
+ private sharedDefaults;
18
+ /**
19
+ * Per-adapter options replace the factory's client choice as a unit: a
20
+ * `client` handed to `createSaver` also displaces the base `clientConfig`
21
+ * and `createClient`, because carrying those along is exactly the ambiguous
22
+ * combination the adapters' option validation rejects. The shared
23
+ * `ttl`/`compression`/`s3`/`retry` defaults stay either way.
24
+ */
25
+ private defaultsFor;
26
+ /** A saver on its own client, with the factory's shared defaults underneath `options`. */
38
27
  createSaver(options: DynamoDBSaverOptions): DynamoDBSaver;
28
+ /** A store on its own client, with the factory's shared defaults underneath `options`. */
39
29
  createStore(options: DynamoDBStoreOptions): DynamoDBStore;
30
+ /** A chat history on its own client, with the factory's shared defaults underneath `options`. */
40
31
  createChatMessageHistory(options: DynamoDBChatMessageHistoryOptions): DynamoDBChatMessageHistory;
41
- createAll(options: CreateAllOptions): CreatedAdapters;
32
+ /**
33
+ * Build the adapters whose sections are given, all on one shared client and
34
+ * with the factory's shared defaults underneath each section. If any
35
+ * constructor throws (a store with `vectorBackend` but no `index`, say), the
36
+ * adapters already built and the freshly created client are destroyed
37
+ * before the error propagates, so a failed call leaks nothing.
38
+ */
39
+ createAll<O extends CreateAllOptions>(options: O): CreatedAdapters<O>;
42
40
  }
43
- //# sourceMappingURL=factory.d.ts.map
@@ -5,6 +5,11 @@ const saver_1 = require("../checkpointer/saver");
5
5
  const chat_message_history_1 = require("../history/chat-message-history");
6
6
  const client_1 = require("../shared/dynamodb/client");
7
7
  const store_1 = require("../store/store");
8
+ function overridesClient(options) {
9
+ return (options.client !== undefined ||
10
+ options.clientConfig !== undefined ||
11
+ options.createClient !== undefined);
12
+ }
8
13
  /**
9
14
  * Convenience constructors for the adapters. Individual `create*` methods each
10
15
  * build their own client; {@link createAll} builds one shared client used by all
@@ -15,33 +20,68 @@ class DynamoDBFactory {
15
20
  constructor(base = {}) {
16
21
  this.base = base;
17
22
  }
23
+ /** The base options every adapter inherits regardless of which client it uses. */
24
+ sharedDefaults() {
25
+ const { logger, ttl, compression, s3, retry } = this.base;
26
+ return { logger, ttl, compression, s3, retry };
27
+ }
28
+ /**
29
+ * Per-adapter options replace the factory's client choice as a unit: a
30
+ * `client` handed to `createSaver` also displaces the base `clientConfig`
31
+ * and `createClient`, because carrying those along is exactly the ambiguous
32
+ * combination the adapters' option validation rejects. The shared
33
+ * `ttl`/`compression`/`s3`/`retry` defaults stay either way.
34
+ */
35
+ defaultsFor(options) {
36
+ return overridesClient(options) ? this.sharedDefaults() : this.base;
37
+ }
38
+ /** A saver on its own client, with the factory's shared defaults underneath `options`. */
18
39
  createSaver(options) {
19
- return new saver_1.DynamoDBSaver({ ...this.base, ...options });
40
+ return new saver_1.DynamoDBSaver({ ...this.defaultsFor(options), ...options });
20
41
  }
42
+ /** A store on its own client, with the factory's shared defaults underneath `options`. */
21
43
  createStore(options) {
22
- return new store_1.DynamoDBStore({ ...this.base, ...options });
44
+ return new store_1.DynamoDBStore({ ...this.defaultsFor(options), ...options });
23
45
  }
46
+ /** A chat history on its own client, with the factory's shared defaults underneath `options`. */
24
47
  createChatMessageHistory(options) {
25
- return new chat_message_history_1.DynamoDBChatMessageHistory({ ...this.base, ...options });
48
+ return new chat_message_history_1.DynamoDBChatMessageHistory({ ...this.defaultsFor(options), ...options });
26
49
  }
50
+ /**
51
+ * Build the adapters whose sections are given, all on one shared client and
52
+ * with the factory's shared defaults underneath each section. If any
53
+ * constructor throws (a store with `vectorBackend` but no `index`, say), the
54
+ * adapters already built and the freshly created client are destroyed
55
+ * before the error propagates, so a failed call leaks nothing.
56
+ */
27
57
  createAll(options) {
28
58
  const resolved = (0, client_1.resolveDynamoDBClient)(this.base);
29
- const client = resolved.client;
30
- const saver = new saver_1.DynamoDBSaver({ ...this.base, ...options.saver, client });
31
- const store = new store_1.DynamoDBStore({ ...this.base, ...options.store, client });
32
- const history = new chat_message_history_1.DynamoDBChatMessageHistory({ ...this.base, ...options.history, client });
33
- return {
34
- saver,
35
- store,
36
- history,
37
- destroy: () => {
38
- saver.destroy();
39
- store.destroy();
40
- history.destroy();
41
- resolved.ddbClient?.destroy();
42
- },
59
+ const shared = { ...this.sharedDefaults(), client: resolved.client };
60
+ const built = [];
61
+ /** Record an adapter the moment it exists, so a later failure can still tear it down. */
62
+ const track = (adapter) => {
63
+ built.push(adapter);
64
+ return adapter;
65
+ };
66
+ const destroy = () => {
67
+ for (const adapter of built)
68
+ adapter.destroy();
69
+ resolved.ddbClient?.destroy();
43
70
  };
71
+ const { saver, store, history } = options;
72
+ try {
73
+ const adapters = {
74
+ saver: saver && track(new saver_1.DynamoDBSaver({ ...shared, ...saver })),
75
+ store: store && track(new store_1.DynamoDBStore({ ...shared, ...store })),
76
+ history: history && track(new chat_message_history_1.DynamoDBChatMessageHistory({ ...shared, ...history })),
77
+ destroy,
78
+ };
79
+ return adapters;
80
+ }
81
+ catch (error) {
82
+ destroy();
83
+ throw error;
84
+ }
44
85
  }
45
86
  }
46
87
  exports.DynamoDBFactory = DynamoDBFactory;
47
- //# sourceMappingURL=factory.js.map
@@ -0,0 +1,57 @@
1
+ import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
2
+ import type { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
3
+ import type { DynamoDBSaver } from '../checkpointer/saver';
4
+ import type { DynamoDBSaverOptions } from '../checkpointer/types';
5
+ import type { DynamoDBChatMessageHistory } from '../history/chat-message-history';
6
+ import type { DynamoDBChatMessageHistoryOptions } from '../history/types';
7
+ import type { CompressionConfig } from '../shared/codec/compression';
8
+ import type { S3OffloadConfig } from '../shared/codec/s3/config';
9
+ import type { RetryPolicy } from '../shared/dynamodb/retry-policy';
10
+ import type { Logger } from '../shared/logging/logger';
11
+ import type { TtlOption } from '../shared/validation/ttl';
12
+ import type { DynamoDBStore } from '../store/store';
13
+ import type { DynamoDBStoreOptions } from '../store/types';
14
+ /**
15
+ * Defaults applied to every adapter the factory builds: the client (or how to
16
+ * build one) and the cross-cutting options a team usually wants identical
17
+ * across its checkpointer, store and history. A per-adapter option wins.
18
+ */
19
+ export interface FactoryBaseOptions {
20
+ /**
21
+ * Reused as-is by every adapter. Construct it with `maxAttempts: 1`, or the
22
+ * SDK's own retries stack inside the library's retry budget (each adapter
23
+ * logs a `warn` at construction when they would).
24
+ */
25
+ client?: DynamoDBDocument;
26
+ clientConfig?: DynamoDBClientConfig;
27
+ logger?: Logger;
28
+ ttl?: TtlOption;
29
+ compression?: CompressionConfig;
30
+ s3?: S3OffloadConfig;
31
+ retry?: RetryPolicy;
32
+ }
33
+ /** An adapter's own options inside {@link CreateAllOptions}: everything but the shared client. */
34
+ export type AdapterSection<Options> = Omit<Options, 'client' | 'clientConfig' | 'createClient'>;
35
+ /** Per-adapter options for `DynamoDBFactory.createAll`; omit a section to skip that adapter. */
36
+ export interface CreateAllOptions {
37
+ saver?: AdapterSection<DynamoDBSaverOptions>;
38
+ store?: AdapterSection<DynamoDBStoreOptions>;
39
+ history?: AdapterSection<DynamoDBChatMessageHistoryOptions>;
40
+ }
41
+ /**
42
+ * The adapters `createAll` built, typed by the sections it was given: an
43
+ * omitted section is `undefined`. The default names the all-three result.
44
+ */
45
+ export interface CreatedAdapters<O extends CreateAllOptions = Required<CreateAllOptions>> {
46
+ saver: O extends {
47
+ saver: object;
48
+ } ? DynamoDBSaver : undefined;
49
+ store: O extends {
50
+ store: object;
51
+ } ? DynamoDBStore : undefined;
52
+ history: O extends {
53
+ history: object;
54
+ } ? DynamoDBChatMessageHistory : undefined;
55
+ /** Tear down every built adapter and the shared client, once. */
56
+ destroy: () => void;
57
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -12,5 +12,4 @@ import type { HistoryContext } from '../internal/setup';
12
12
  * Per item the 400 KB DynamoDB limit still applies; enable S3 offloading so
13
13
  * large payloads become small descriptors and stay well under the limits.
14
14
  */
15
- export declare function addMessages(context: HistoryContext, sessionId: string, messages: BaseMessage[]): Promise<void>;
16
- //# sourceMappingURL=add-messages.d.ts.map
15
+ export declare function addMessages(context: HistoryContext, sessionId: string, messages: BaseMessage[], signal?: AbortSignal): Promise<void>;
@@ -57,13 +57,14 @@ async function buildItems(context, sessionId, stored, ttlTimestamp) {
57
57
  * Per item the 400 KB DynamoDB limit still applies; enable S3 offloading so
58
58
  * large payloads become small descriptors and stay well under the limits.
59
59
  */
60
- async function addMessages(context, sessionId, messages) {
60
+ async function addMessages(context, sessionId, messages, signal) {
61
61
  (0, validation_1.validateSessionId)(sessionId);
62
62
  if (messages.length === 0)
63
63
  return;
64
64
  const stored = (0, messages_1.mapChatMessagesToStoredMessages)(messages);
65
+ (0, validation_1.validateStorableMessages)(stored);
65
66
  const anchor = context.ttl
66
- ? await (0, ttl_anchor_1.resolveTtlAnchor)(context, sessionId, (0, ttl_1.calculateTtlTimestamp)(context.ttl))
67
+ ? await (0, ttl_anchor_1.resolveTtlAnchor)(context, sessionId, (0, ttl_1.calculateTtlTimestamp)(context.ttl), signal)
67
68
  : undefined;
68
69
  const items = await buildItems(context, sessionId, stored, anchor?.ttlTimestamp);
69
70
  const chunks = (0, message_chunker_1.chunkBySize)(items, MAX_MESSAGES_PER_TRANSACTION, MAX_TRANSACTION_BYTES);
@@ -72,6 +73,5 @@ async function addMessages(context, sessionId, messages) {
72
73
  title: (0, title_generator_1.deriveTitle)(stored),
73
74
  ttlTimestamp: anchor?.ttlTimestamp,
74
75
  forceTtlRefresh: anchor?.refresh,
75
- });
76
+ }, signal);
76
77
  }
77
- //# sourceMappingURL=add-messages.js.map
@@ -5,5 +5,6 @@ import type { HistoryContext } from '../internal/setup';
5
5
  * place and logged, so a shared-table partition holding a foreign row is never
6
6
  * collaterally wiped.
7
7
  */
8
- export declare function clearSession(context: HistoryContext, sessionId: string): Promise<void>;
9
- //# sourceMappingURL=clear.d.ts.map
8
+ export declare function clearSession(context: HistoryContext, sessionId: string, options?: {
9
+ signal?: AbortSignal;
10
+ }): Promise<void>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clearSession = clearSession;
4
4
  const partition_delete_1 = require("../../shared/dynamodb/partition-delete");
5
+ const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
5
6
  const keys_1 = require("../internal/keys");
6
7
  const query_1 = require("../internal/query");
7
8
  const validation_1 = require("../internal/validation");
@@ -15,17 +16,19 @@ function descriptorsOf(row) {
15
16
  * place and logged, so a shared-table partition holding a foreign row is never
16
17
  * collaterally wiped.
17
18
  */
18
- async function clearSession(context, sessionId) {
19
+ async function clearSession(context, sessionId, options = {}) {
19
20
  (0, validation_1.validateSessionId)(sessionId);
20
21
  await (0, partition_delete_1.deletePartitionRows)({
21
22
  client: context.client,
22
23
  tableName: context.tableName,
23
24
  params: (0, query_1.sessionItemsQuery)(context.tableName, sessionId, { consistent: true }),
24
25
  logger: context.logger,
26
+ retry: (0, retry_policy_1.retryFor)(context, options.signal),
27
+ signal: options.signal,
25
28
  offloader: context.offloader,
26
29
  operation: 'history.clear',
27
30
  ownsSortKey: keys_1.isHistorySortKey,
28
31
  descriptorsOf,
32
+ scope: [sessionId],
29
33
  });
30
34
  }
31
- //# sourceMappingURL=clear.js.map
@@ -1,10 +1,17 @@
1
1
  import { type BaseMessage } from '@langchain/core/messages';
2
+ import type { CancelOptions } from '../../shared/options';
2
3
  import type { HistoryContext } from '../internal/setup';
4
+ import type { MessageWindow } from '../types';
3
5
  /**
4
- * Return a session's messages in chronological order. Items past their TTL are
5
- * filtered out on read (DynamoDB's background TTL sweep can lag by up to 48h),
6
- * so the returned history is never stale. An item that cannot be decoded is
7
- * handled per `onCorruptMessage` (see {@link decodeOrSkip}).
6
+ * Return a session's messages in chronological order — the whole session, or
7
+ * the window `options` selects: `limit` keeps only the newest `limit`
8
+ * messages, `before` only those appended before that instant (see
9
+ * {@link readWindow}). Items past their TTL are filtered out on read
10
+ * (DynamoDB's background TTL sweep can lag by up to 48h), so the returned
11
+ * history is never stale. A corrupt item — see
12
+ * {@link decodeMessage} for exactly what counts — is handled per
13
+ * `onCorruptMessage`: `'throw'` fails the read with the underlying error;
14
+ * `'skip'` (the default) reports it at `error` with its sort key and returns
15
+ * the rest. Every other failure propagates regardless of the policy.
8
16
  */
9
- export declare function getMessages(context: HistoryContext, sessionId: string): Promise<BaseMessage[]>;
10
- //# sourceMappingURL=get-messages.d.ts.map
17
+ export declare function getMessages(context: HistoryContext, sessionId: string, options?: MessageWindow & CancelOptions): Promise<BaseMessage[]>;