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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. package/README.md +390 -193
  2. package/dist/{backfill → cjs/backfill}/backfill.d.ts +15 -12
  3. package/dist/cjs/backfill/backfill.js +177 -0
  4. package/dist/{checkpointer → cjs/checkpointer}/actions/delete-thread.d.ts +1 -1
  5. package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
  6. package/dist/{checkpointer → cjs/checkpointer}/actions/get-tuple.d.ts +4 -3
  7. package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
  8. package/dist/{checkpointer → cjs/checkpointer}/actions/list.d.ts +7 -4
  9. package/dist/cjs/checkpointer/actions/list.js +70 -0
  10. package/dist/{checkpointer → cjs/checkpointer}/actions/put-writes.d.ts +8 -6
  11. package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
  12. package/dist/{checkpointer → cjs/checkpointer}/actions/put.d.ts +21 -15
  13. package/dist/cjs/checkpointer/actions/put.js +79 -0
  14. package/dist/{checkpointer → cjs/checkpointer}/internal/delta-history.d.ts +38 -26
  15. package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
  16. package/dist/{checkpointer → cjs/checkpointer}/internal/listing.d.ts +4 -4
  17. package/dist/cjs/checkpointer/internal/listing.js +104 -0
  18. package/dist/{checkpointer → cjs/checkpointer}/internal/parse.d.ts +51 -15
  19. package/dist/cjs/checkpointer/internal/parse.js +184 -0
  20. package/dist/{checkpointer → cjs/checkpointer}/internal/pending-writes.d.ts +64 -25
  21. package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
  22. package/dist/{checkpointer → cjs/checkpointer}/internal/read.d.ts +15 -10
  23. package/dist/cjs/checkpointer/internal/read.js +132 -0
  24. package/dist/{checkpointer → cjs/checkpointer}/internal/rows.d.ts +94 -21
  25. package/dist/cjs/checkpointer/internal/rows.js +356 -0
  26. package/dist/{checkpointer → cjs/checkpointer}/internal/setup.d.ts +13 -20
  27. package/dist/cjs/checkpointer/internal/setup.js +25 -0
  28. package/dist/{checkpointer → cjs/checkpointer}/saver.d.ts +72 -36
  29. package/dist/cjs/checkpointer/saver.js +56 -0
  30. package/dist/{checkpointer → cjs/checkpointer}/types.d.ts +1 -1
  31. package/dist/cjs/checkpointer/types.js +2 -0
  32. package/dist/{factory → cjs/factory}/factory.d.ts +25 -20
  33. package/dist/cjs/factory/factory.js +137 -0
  34. package/dist/{factory → cjs/factory}/types.d.ts +12 -12
  35. package/dist/cjs/factory/types.js +2 -0
  36. package/dist/{history → cjs/history}/actions/add-messages.d.ts +18 -10
  37. package/dist/cjs/history/actions/add-messages.js +17 -0
  38. package/dist/{history → cjs/history}/actions/clear.d.ts +1 -1
  39. package/dist/cjs/history/actions/clear.js +29 -0
  40. package/dist/{history → cjs/history}/actions/get-messages.d.ts +11 -9
  41. package/dist/cjs/history/actions/get-messages.js +58 -0
  42. package/dist/{history → cjs/history}/actions/list-sessions.d.ts +3 -3
  43. package/dist/cjs/history/actions/list-sessions.js +67 -0
  44. package/dist/{history → cjs/history}/actions/reconcile-count.d.ts +13 -9
  45. package/dist/cjs/history/actions/reconcile-count.js +8 -0
  46. package/dist/{history → cjs/history}/chat-message-history.d.ts +62 -30
  47. package/dist/cjs/history/chat-message-history.js +61 -0
  48. package/dist/{history → cjs/history}/internal/append.d.ts +64 -32
  49. package/dist/cjs/history/internal/append.js +267 -0
  50. package/dist/{history → cjs/history}/internal/message-read.d.ts +3 -3
  51. package/dist/cjs/history/internal/message-read.js +93 -0
  52. package/dist/{history → cjs/history}/internal/parse.d.ts +2 -2
  53. package/dist/cjs/history/internal/parse.js +113 -0
  54. package/dist/{history → cjs/history}/internal/rows.d.ts +11 -10
  55. package/dist/cjs/history/internal/rows.js +96 -0
  56. package/dist/{history → cjs/history}/internal/session.d.ts +41 -22
  57. package/dist/cjs/history/internal/session.js +296 -0
  58. package/dist/{history → cjs/history}/internal/setup.d.ts +2 -2
  59. package/dist/cjs/history/internal/setup.js +60 -0
  60. package/dist/{history → cjs/history}/session-adapter.d.ts +0 -6
  61. package/dist/cjs/history/session-adapter.js +38 -0
  62. package/dist/{history → cjs/history}/types.d.ts +18 -15
  63. package/dist/cjs/history/types.js +2 -0
  64. package/dist/{index.d.ts → cjs/index.d.ts} +27 -27
  65. package/dist/cjs/index.js +25 -0
  66. package/dist/cjs/package.json +1 -0
  67. package/dist/{shared → cjs/shared}/adapter.d.ts +27 -16
  68. package/dist/cjs/shared/adapter.js +70 -0
  69. package/dist/cjs/shared/clock.js +14 -0
  70. package/dist/{shared → cjs/shared}/codec/codec.d.ts +37 -20
  71. package/dist/cjs/shared/codec/codec.js +162 -0
  72. package/dist/{shared → cjs/shared}/codec/compression.d.ts +9 -4
  73. package/dist/cjs/shared/codec/compression.js +45 -0
  74. package/dist/cjs/shared/codec/json-serde.js +58 -0
  75. package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +2 -1
  76. package/dist/cjs/shared/codec/s3/client-types.js +6 -0
  77. package/dist/{shared → cjs/shared}/codec/s3/client.d.ts +25 -7
  78. package/dist/cjs/shared/codec/s3/client.js +78 -0
  79. package/dist/{shared → cjs/shared}/codec/s3/config.d.ts +12 -7
  80. package/dist/cjs/shared/codec/s3/config.js +92 -0
  81. package/dist/{shared → cjs/shared}/codec/s3/lifecycle.d.ts +71 -17
  82. package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
  83. package/dist/{shared → cjs/shared}/codec/s3/offloader.d.ts +42 -29
  84. package/dist/cjs/shared/codec/s3/offloader.js +289 -0
  85. package/dist/cjs/shared/concurrency.js +31 -0
  86. package/dist/{shared → cjs/shared}/dynamodb/abort.d.ts +2 -2
  87. package/dist/cjs/shared/dynamodb/abort.js +16 -0
  88. package/dist/{shared → cjs/shared}/dynamodb/batch-write.d.ts +2 -2
  89. package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
  90. package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
  91. package/dist/{shared → cjs/shared}/dynamodb/client.d.ts +24 -22
  92. package/dist/cjs/shared/dynamodb/client.js +40 -0
  93. package/dist/{shared → cjs/shared}/dynamodb/idempotent-write.d.ts +64 -19
  94. package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
  95. package/dist/{shared → cjs/shared}/dynamodb/paginate.d.ts +2 -2
  96. package/dist/cjs/shared/dynamodb/paginate.js +90 -0
  97. package/dist/{shared → cjs/shared}/dynamodb/partition-delete.d.ts +6 -6
  98. package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
  99. package/dist/{shared → cjs/shared}/dynamodb/recency-index.d.ts +27 -15
  100. package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
  101. package/dist/{shared → cjs/shared}/dynamodb/retry.d.ts +37 -6
  102. package/dist/cjs/shared/dynamodb/retry.js +193 -0
  103. package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
  104. package/dist/cjs/shared/dynamodb/row-size.js +30 -0
  105. package/dist/{shared → cjs/shared}/dynamodb/table-schema.d.ts +27 -18
  106. package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
  107. package/dist/{shared → cjs/shared}/errors/base-error.d.ts +42 -7
  108. package/dist/cjs/shared/errors/base-error.js +73 -0
  109. package/dist/{shared → cjs/shared}/errors/boundary.d.ts +29 -14
  110. package/dist/cjs/shared/errors/boundary.js +61 -0
  111. package/dist/cjs/shared/errors/classify.d.ts +206 -0
  112. package/dist/cjs/shared/errors/classify.js +232 -0
  113. package/dist/{shared → cjs/shared}/errors/error-code.d.ts +17 -10
  114. package/dist/cjs/shared/errors/error-code.js +27 -0
  115. package/dist/{shared → cjs/shared}/errors/errors.d.ts +75 -9
  116. package/dist/cjs/shared/errors/errors.js +123 -0
  117. package/dist/cjs/shared/logging/logger.js +30 -0
  118. package/dist/{shared → cjs/shared}/logging/redaction.d.ts +8 -4
  119. package/dist/cjs/shared/logging/redaction.js +145 -0
  120. package/dist/{shared → cjs/shared}/logging/secret-patterns.d.ts +30 -7
  121. package/dist/cjs/shared/logging/secret-patterns.js +93 -0
  122. package/dist/cjs/shared/logging/truncate.js +31 -0
  123. package/dist/{shared → cjs/shared}/options.d.ts +27 -11
  124. package/dist/cjs/shared/options.js +2 -0
  125. package/dist/cjs/shared/ulid.js +83 -0
  126. package/dist/{shared → cjs/shared}/validation/collaborators.d.ts +21 -2
  127. package/dist/cjs/shared/validation/collaborators.js +79 -0
  128. package/dist/{shared → cjs/shared}/validation/option-shape.d.ts +7 -5
  129. package/dist/cjs/shared/validation/option-shape.js +31 -0
  130. package/dist/{shared → cjs/shared}/validation/options.d.ts +4 -4
  131. package/dist/cjs/shared/validation/options.js +166 -0
  132. package/dist/cjs/shared/validation/primitives.js +114 -0
  133. package/dist/{shared → cjs/shared}/validation/ttl.d.ts +26 -9
  134. package/dist/cjs/shared/validation/ttl.js +52 -0
  135. package/dist/{store → cjs/store}/actions/list-namespaces.d.ts +5 -5
  136. package/dist/cjs/store/actions/list-namespaces.js +92 -0
  137. package/dist/{store → cjs/store}/actions/put.d.ts +11 -4
  138. package/dist/cjs/store/actions/put.js +49 -0
  139. package/dist/{store → cjs/store}/actions/reconcile-vector-index.d.ts +5 -5
  140. package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
  141. package/dist/{store → cjs/store}/actions/search.d.ts +2 -2
  142. package/dist/cjs/store/actions/search.js +26 -0
  143. package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
  144. package/dist/cjs/store/internal/batch-plan.js +32 -0
  145. package/dist/{store → cjs/store}/internal/filter.d.ts +3 -3
  146. package/dist/cjs/store/internal/filter.js +64 -0
  147. package/dist/cjs/store/internal/get-item.d.ts +77 -0
  148. package/dist/cjs/store/internal/get-item.js +58 -0
  149. package/dist/{store → cjs/store}/internal/item-write.d.ts +72 -32
  150. package/dist/cjs/store/internal/item-write.js +181 -0
  151. package/dist/{store → cjs/store}/internal/parse.d.ts +15 -10
  152. package/dist/cjs/store/internal/parse.js +180 -0
  153. package/dist/{store → cjs/store}/internal/rows.d.ts +38 -34
  154. package/dist/cjs/store/internal/rows.js +166 -0
  155. package/dist/{store → cjs/store}/internal/semantic-search.d.ts +2 -2
  156. package/dist/cjs/store/internal/semantic-search.js +211 -0
  157. package/dist/{store → cjs/store}/internal/setup.d.ts +10 -15
  158. package/dist/cjs/store/internal/setup.js +103 -0
  159. package/dist/{store → cjs/store}/internal/table-search.d.ts +5 -5
  160. package/dist/cjs/store/internal/table-search.js +123 -0
  161. package/dist/{store → cjs/store}/internal/vector-index.d.ts +26 -15
  162. package/dist/cjs/store/internal/vector-index.js +269 -0
  163. package/dist/{store → cjs/store}/store.d.ts +82 -39
  164. package/dist/cjs/store/store.js +97 -0
  165. package/dist/{store → cjs/store}/types.d.ts +25 -10
  166. package/dist/cjs/store/types.js +2 -0
  167. package/dist/cjs/store/vector-backend.js +4 -0
  168. package/dist/esm/backfill/backfill.d.ts +171 -0
  169. package/dist/esm/backfill/backfill.js +170 -0
  170. package/dist/{checkpointer/actions/delete-thread.js → esm/checkpointer/actions/delete-thread.d.ts} +4 -26
  171. package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
  172. package/dist/{checkpointer/actions/get-tuple.js → esm/checkpointer/actions/get-tuple.d.ts} +7 -24
  173. package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
  174. package/dist/esm/checkpointer/actions/list.d.ts +55 -0
  175. package/dist/esm/checkpointer/actions/list.js +67 -0
  176. package/dist/{checkpointer/actions/put-writes.js → esm/checkpointer/actions/put-writes.d.ts} +10 -37
  177. package/dist/esm/checkpointer/actions/put-writes.js +18 -0
  178. package/dist/esm/checkpointer/actions/put.d.ts +95 -0
  179. package/dist/esm/checkpointer/actions/put.js +75 -0
  180. package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
  181. package/dist/esm/checkpointer/internal/delta-history.js +126 -0
  182. package/dist/{checkpointer/internal/listing.js → esm/checkpointer/internal/listing.d.ts} +22 -118
  183. package/dist/esm/checkpointer/internal/listing.js +95 -0
  184. package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
  185. package/dist/esm/checkpointer/internal/parse.js +169 -0
  186. package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
  187. package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
  188. package/dist/esm/checkpointer/internal/read.d.ts +135 -0
  189. package/dist/esm/checkpointer/internal/read.js +125 -0
  190. package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
  191. package/dist/esm/checkpointer/internal/rows.js +323 -0
  192. package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
  193. package/dist/esm/checkpointer/internal/setup.js +21 -0
  194. package/dist/{checkpointer/saver.js → esm/checkpointer/saver.d.ts} +84 -87
  195. package/dist/esm/checkpointer/saver.js +52 -0
  196. package/dist/esm/checkpointer/types.d.ts +51 -0
  197. package/dist/esm/checkpointer/types.js +1 -0
  198. package/dist/esm/factory/factory.d.ts +154 -0
  199. package/dist/esm/factory/factory.js +133 -0
  200. package/dist/esm/factory/types.d.ts +76 -0
  201. package/dist/esm/factory/types.js +1 -0
  202. package/dist/{history/actions/add-messages.js → esm/history/actions/add-messages.d.ts} +20 -26
  203. package/dist/esm/history/actions/add-messages.js +14 -0
  204. package/dist/{history/actions/clear.js → esm/history/actions/clear.d.ts} +4 -35
  205. package/dist/esm/history/actions/clear.js +26 -0
  206. package/dist/esm/history/actions/get-messages.d.ts +60 -0
  207. package/dist/esm/history/actions/get-messages.js +55 -0
  208. package/dist/esm/history/actions/list-sessions.d.ts +55 -0
  209. package/dist/esm/history/actions/list-sessions.js +64 -0
  210. package/dist/{history/actions/reconcile-count.js → esm/history/actions/reconcile-count.d.ts} +14 -16
  211. package/dist/esm/history/actions/reconcile-count.js +5 -0
  212. package/dist/{history/chat-message-history.js → esm/history/chat-message-history.d.ts} +76 -87
  213. package/dist/esm/history/chat-message-history.js +57 -0
  214. package/dist/esm/history/internal/append.d.ts +244 -0
  215. package/dist/esm/history/internal/append.js +259 -0
  216. package/dist/esm/history/internal/message-read.d.ts +84 -0
  217. package/dist/esm/history/internal/message-read.js +89 -0
  218. package/dist/esm/history/internal/parse.d.ts +153 -0
  219. package/dist/esm/history/internal/parse.js +105 -0
  220. package/dist/{history/internal/rows.js → esm/history/internal/rows.d.ts} +58 -112
  221. package/dist/esm/history/internal/rows.js +83 -0
  222. package/dist/esm/history/internal/session.d.ts +350 -0
  223. package/dist/esm/history/internal/session.js +285 -0
  224. package/dist/esm/history/internal/setup.d.ts +64 -0
  225. package/dist/esm/history/internal/setup.js +56 -0
  226. package/dist/{history/session-adapter.js → esm/history/session-adapter.d.ts} +25 -39
  227. package/dist/esm/history/session-adapter.js +34 -0
  228. package/dist/esm/history/types.d.ts +102 -0
  229. package/dist/esm/history/types.js +1 -0
  230. package/dist/esm/index.d.ts +53 -0
  231. package/dist/esm/index.js +10 -0
  232. package/dist/esm/shared/adapter.d.ts +146 -0
  233. package/dist/esm/shared/adapter.js +65 -0
  234. package/dist/{shared/clock.js → esm/shared/clock.d.ts} +3 -14
  235. package/dist/esm/shared/clock.js +9 -0
  236. package/dist/esm/shared/codec/codec.d.ts +336 -0
  237. package/dist/esm/shared/codec/codec.js +150 -0
  238. package/dist/esm/shared/codec/compression.d.ts +66 -0
  239. package/dist/esm/shared/codec/compression.js +40 -0
  240. package/dist/esm/shared/codec/json-serde.d.ts +80 -0
  241. package/dist/esm/shared/codec/json-serde.js +54 -0
  242. package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
  243. package/dist/esm/shared/codec/s3/client-types.js +3 -0
  244. package/dist/esm/shared/codec/s3/client.d.ts +63 -0
  245. package/dist/esm/shared/codec/s3/client.js +40 -0
  246. package/dist/{shared/codec/s3/config.js → esm/shared/codec/s3/config.d.ts} +45 -93
  247. package/dist/esm/shared/codec/s3/config.js +79 -0
  248. package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
  249. package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
  250. package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
  251. package/dist/esm/shared/codec/s3/offloader.js +278 -0
  252. package/dist/{shared/concurrency.js → esm/shared/concurrency.d.ts} +2 -37
  253. package/dist/esm/shared/concurrency.js +27 -0
  254. package/dist/{shared/dynamodb/abort.js → esm/shared/dynamodb/abort.d.ts} +4 -16
  255. package/dist/esm/shared/dynamodb/abort.js +12 -0
  256. package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
  257. package/dist/esm/shared/dynamodb/batch-write.js +74 -0
  258. package/dist/{shared/dynamodb/cancellation.js → esm/shared/dynamodb/cancellation.d.ts} +25 -53
  259. package/dist/esm/shared/dynamodb/cancellation.js +30 -0
  260. package/dist/{shared/dynamodb/client.js → esm/shared/dynamodb/client.d.ts} +74 -64
  261. package/dist/esm/shared/dynamodb/client.js +35 -0
  262. package/dist/{shared/dynamodb/idempotent-write.js → esm/shared/dynamodb/idempotent-write.d.ts} +172 -169
  263. package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
  264. package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
  265. package/dist/esm/shared/dynamodb/paginate.js +84 -0
  266. package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
  267. package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
  268. package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
  269. package/dist/esm/shared/dynamodb/recency-index.js +136 -0
  270. package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
  271. package/dist/esm/shared/dynamodb/retry.js +180 -0
  272. package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
  273. package/dist/esm/shared/dynamodb/row-size.js +26 -0
  274. package/dist/{shared/dynamodb/table-schema.js → esm/shared/dynamodb/table-schema.d.ts} +57 -67
  275. package/dist/esm/shared/dynamodb/table-schema.js +43 -0
  276. package/dist/esm/shared/errors/base-error.d.ts +231 -0
  277. package/dist/esm/shared/errors/base-error.js +64 -0
  278. package/dist/esm/shared/errors/boundary.d.ts +86 -0
  279. package/dist/esm/shared/errors/boundary.js +54 -0
  280. package/dist/esm/shared/errors/classify.d.ts +206 -0
  281. package/dist/esm/shared/errors/classify.js +220 -0
  282. package/dist/{shared/errors/error-code.js → esm/shared/errors/error-code.d.ts} +39 -43
  283. package/dist/esm/shared/errors/error-code.js +24 -0
  284. package/dist/{shared/errors/errors.js → esm/shared/errors/errors.d.ts} +92 -98
  285. package/dist/esm/shared/errors/errors.js +110 -0
  286. package/dist/{shared/logging/logger.js → esm/shared/logging/logger.d.ts} +22 -52
  287. package/dist/esm/shared/logging/logger.js +25 -0
  288. package/dist/esm/shared/logging/redaction.d.ts +123 -0
  289. package/dist/esm/shared/logging/redaction.js +140 -0
  290. package/dist/{shared/logging/secret-patterns.js → esm/shared/logging/secret-patterns.d.ts} +46 -87
  291. package/dist/esm/shared/logging/secret-patterns.js +83 -0
  292. package/dist/{shared/logging/truncate.js → esm/shared/logging/truncate.d.ts} +6 -40
  293. package/dist/esm/shared/logging/truncate.js +25 -0
  294. package/dist/esm/shared/options.d.ts +100 -0
  295. package/dist/esm/shared/options.js +1 -0
  296. package/dist/{shared/ulid.js → esm/shared/ulid.d.ts} +4 -84
  297. package/dist/esm/shared/ulid.js +77 -0
  298. package/dist/{shared/validation/collaborators.js → esm/shared/validation/collaborators.d.ts} +37 -65
  299. package/dist/esm/shared/validation/collaborators.js +70 -0
  300. package/dist/{shared/validation/option-shape.js → esm/shared/validation/option-shape.d.ts} +14 -36
  301. package/dist/esm/shared/validation/option-shape.js +24 -0
  302. package/dist/esm/shared/validation/options.d.ts +145 -0
  303. package/dist/esm/shared/validation/options.js +156 -0
  304. package/dist/{shared/validation/primitives.js → esm/shared/validation/primitives.d.ts} +30 -125
  305. package/dist/esm/shared/validation/primitives.js +100 -0
  306. package/dist/esm/shared/validation/ttl.d.ts +94 -0
  307. package/dist/esm/shared/validation/ttl.js +46 -0
  308. package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
  309. package/dist/esm/store/actions/list-namespaces.js +86 -0
  310. package/dist/esm/store/actions/put.d.ts +43 -0
  311. package/dist/esm/store/actions/put.js +46 -0
  312. package/dist/{store/actions/reconcile-vector-index.js → esm/store/actions/reconcile-vector-index.d.ts} +8 -16
  313. package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
  314. package/dist/esm/store/actions/search.d.ts +38 -0
  315. package/dist/esm/store/actions/search.js +23 -0
  316. package/dist/esm/store/internal/batch-plan.d.ts +56 -0
  317. package/dist/esm/store/internal/batch-plan.js +28 -0
  318. package/dist/esm/store/internal/filter.d.ts +43 -0
  319. package/dist/esm/store/internal/filter.js +60 -0
  320. package/dist/esm/store/internal/get-item.d.ts +77 -0
  321. package/dist/esm/store/internal/get-item.js +54 -0
  322. package/dist/esm/store/internal/item-write.d.ts +270 -0
  323. package/dist/esm/store/internal/item-write.js +173 -0
  324. package/dist/esm/store/internal/parse.d.ts +230 -0
  325. package/dist/esm/store/internal/parse.js +169 -0
  326. package/dist/{store/internal/rows.js → esm/store/internal/rows.d.ts} +111 -199
  327. package/dist/esm/store/internal/rows.js +147 -0
  328. package/dist/esm/store/internal/semantic-search.d.ts +168 -0
  329. package/dist/esm/store/internal/semantic-search.js +200 -0
  330. package/dist/esm/store/internal/setup.d.ts +96 -0
  331. package/dist/esm/store/internal/setup.js +98 -0
  332. package/dist/esm/store/internal/table-search.d.ts +100 -0
  333. package/dist/esm/store/internal/table-search.js +119 -0
  334. package/dist/esm/store/internal/vector-index.d.ts +258 -0
  335. package/dist/esm/store/internal/vector-index.js +256 -0
  336. package/dist/{store/store.js → esm/store/store.d.ts} +99 -133
  337. package/dist/esm/store/store.js +93 -0
  338. package/dist/esm/store/types.d.ts +111 -0
  339. package/dist/esm/store/types.js +1 -0
  340. package/dist/esm/store/vector-backend.d.ts +104 -0
  341. package/dist/esm/store/vector-backend.js +1 -0
  342. package/package.json +50 -44
  343. package/dist/backfill/backfill.js +0 -393
  344. package/dist/checkpointer/actions/list.js +0 -142
  345. package/dist/checkpointer/actions/put.js +0 -195
  346. package/dist/checkpointer/internal/delta-history.js +0 -252
  347. package/dist/checkpointer/internal/parse.js +0 -372
  348. package/dist/checkpointer/internal/pending-writes.js +0 -588
  349. package/dist/checkpointer/internal/read.js +0 -264
  350. package/dist/checkpointer/internal/rows.js +0 -834
  351. package/dist/checkpointer/internal/setup.js +0 -72
  352. package/dist/checkpointer/types.js +0 -12
  353. package/dist/factory/factory.js +0 -266
  354. package/dist/factory/types.js +0 -10
  355. package/dist/history/actions/get-messages.js +0 -141
  356. package/dist/history/actions/list-sessions.js +0 -156
  357. package/dist/history/internal/append.js +0 -500
  358. package/dist/history/internal/message-read.js +0 -204
  359. package/dist/history/internal/parse.js +0 -252
  360. package/dist/history/internal/session.js +0 -628
  361. package/dist/history/internal/setup.js +0 -106
  362. package/dist/history/types.js +0 -12
  363. package/dist/index.js +0 -51
  364. package/dist/shared/adapter.js +0 -143
  365. package/dist/shared/codec/codec.js +0 -441
  366. package/dist/shared/codec/compression.js +0 -89
  367. package/dist/shared/codec/json-serde.js +0 -191
  368. package/dist/shared/codec/s3/client-types.js +0 -26
  369. package/dist/shared/codec/s3/client.js +0 -97
  370. package/dist/shared/codec/s3/lifecycle.js +0 -355
  371. package/dist/shared/codec/s3/offloader.js +0 -658
  372. package/dist/shared/dynamodb/batch-write.js +0 -173
  373. package/dist/shared/dynamodb/paginate.js +0 -188
  374. package/dist/shared/dynamodb/partition-delete.js +0 -340
  375. package/dist/shared/dynamodb/recency-index.js +0 -377
  376. package/dist/shared/dynamodb/retry.js +0 -463
  377. package/dist/shared/errors/base-error.js +0 -174
  378. package/dist/shared/errors/boundary.js +0 -143
  379. package/dist/shared/errors/classify.d.ts +0 -97
  380. package/dist/shared/errors/classify.js +0 -257
  381. package/dist/shared/logging/redaction.js +0 -316
  382. package/dist/shared/options.js +0 -11
  383. package/dist/shared/validation/options.js +0 -328
  384. package/dist/shared/validation/ttl.js +0 -132
  385. package/dist/store/actions/list-namespaces.js +0 -197
  386. package/dist/store/actions/put.js +0 -78
  387. package/dist/store/actions/search.js +0 -66
  388. package/dist/store/internal/batch-plan.d.ts +0 -26
  389. package/dist/store/internal/batch-plan.js +0 -109
  390. package/dist/store/internal/filter.js +0 -137
  391. package/dist/store/internal/get-item.d.ts +0 -45
  392. package/dist/store/internal/get-item.js +0 -115
  393. package/dist/store/internal/item-write.js +0 -463
  394. package/dist/store/internal/parse.js +0 -350
  395. package/dist/store/internal/semantic-search.js +0 -389
  396. package/dist/store/internal/setup.js +0 -223
  397. package/dist/store/internal/table-search.js +0 -213
  398. package/dist/store/internal/vector-index.js +0 -546
  399. package/dist/store/types.js +0 -15
  400. package/dist/store/vector-backend.js +0 -17
  401. /package/dist/{shared → cjs/shared}/clock.d.ts +0 -0
  402. /package/dist/{shared → cjs/shared}/codec/json-serde.d.ts +0 -0
  403. /package/dist/{shared → cjs/shared}/concurrency.d.ts +0 -0
  404. /package/dist/{shared → cjs/shared}/dynamodb/cancellation.d.ts +0 -0
  405. /package/dist/{shared → cjs/shared}/logging/logger.d.ts +0 -0
  406. /package/dist/{shared → cjs/shared}/logging/truncate.d.ts +0 -0
  407. /package/dist/{shared → cjs/shared}/ulid.d.ts +0 -0
  408. /package/dist/{shared → cjs/shared}/validation/primitives.d.ts +0 -0
  409. /package/dist/{store → cjs/store}/vector-backend.d.ts +0 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Hides which options the history and its methods accept, and how the history
3
+ * is assembled from them.
4
+ *
5
+ * The exhaustive key list of every option bag — the constructor's,
6
+ * `getMessages`', `listSessions`' — lives here, compiler-checked against its
7
+ * type, beside the code that resolves the constructor's options into the
8
+ * context every action receives.
9
+ */
10
+ import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
11
+ import { type AdapterCore, type AdapterShell } from '../../shared/adapter.js';
12
+ import type { CorruptMessagePolicy, DynamoDBChatMessageHistoryOptions } from '../types.js';
13
+ /**
14
+ * Max attempts for the message-append transaction. It shares one session's
15
+ * metadata row across every concurrent `addMessages` caller on that session,
16
+ * so a burst of concurrent appends can collide repeatedly; combined with the
17
+ * existing 100ms base / 5000ms cap backoff, this keeps worst-case retrying
18
+ * within AWS's documented guidance to bound conflict retries to "around one
19
+ * minute" (see DynamoDB's "Error retries and exponential backoff" guide).
20
+ * This bound is exact for clients this library constructs, which disable the
21
+ * AWS SDK's own internal retries (`maxAttempts: 1`, see
22
+ * `resolveDynamoDBClient`). An injected client that keeps SDK retries stacks
23
+ * them inside each attempt; construction warns about that.
24
+ */
25
+ export declare const MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = 18;
26
+ /**
27
+ * The keys of each chat-history option bag, exhaustive in both directions:
28
+ * `allKeysOf<T>` makes omitting or inventing one a compile error, so a list
29
+ * cannot rot away from the type it guards. They live with the feature because
30
+ * the types they are checked against do; `shared/` knows no feature.
31
+ */
32
+ export declare const HISTORY_KEYS: readonly string[];
33
+ /** See {@link HISTORY_KEYS}. */
34
+ export declare const GET_MESSAGES_KEYS: readonly string[];
35
+ /** See {@link HISTORY_KEYS}. */
36
+ export declare const LIST_SESSIONS_KEYS: readonly string[];
37
+ /** Resolved collaborators shared by every chat-history action. */
38
+ export interface HistoryContext extends AdapterCore {
39
+ serde: SerializerProtocol;
40
+ ulid: () => string;
41
+ onCorruptMessage: CorruptMessagePolicy;
42
+ }
43
+ /** Result of wiring up a chat-history adapter from its options. */
44
+ export interface HistorySetup {
45
+ context: HistoryContext;
46
+ shell: AdapterShell;
47
+ }
48
+ /**
49
+ * Validate the options, then resolve the client, offloader and serializer.
50
+ *
51
+ * Accepts: `options` — validated first, so no half-built adapter exists when
52
+ * one is wrong. `onCorruptMessage` is checked against its union here because a
53
+ * JavaScript caller can pass a string the type never admits, and an
54
+ * unrecognised policy would silently behave as `'skip'` — dropping messages a
55
+ * caller asked to be told about.
56
+ *
57
+ * Returns: the context every action shares, and the shell that releases what
58
+ * it holds — a client the caller passed in is never destroyed by `destroy()`.
59
+ *
60
+ * Throws: `VALIDATION` naming the offending option.
61
+ *
62
+ * Guarantees: constructing an adapter performs no I/O.
63
+ */
64
+ export declare function setUpHistory(options: DynamoDBChatMessageHistoryOptions): HistorySetup;
@@ -0,0 +1,56 @@
1
+ import { openAdapter } from '../../shared/adapter.js';
2
+ import { JSON_SERDE } from '../../shared/codec/json-serde.js';
3
+ import { validationError } from '../../shared/errors/errors.js';
4
+ import { createUlidFactory } from '../../shared/ulid.js';
5
+ import { allKeysOf, assertShape } from '../../shared/validation/option-shape.js';
6
+ export const MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = 18;
7
+ export const HISTORY_KEYS = allKeysOf({
8
+ tableName: 'tableName',
9
+ client: 'client',
10
+ clientConfig: 'clientConfig',
11
+ createClient: 'createClient',
12
+ ttl: 'ttl',
13
+ logger: 'logger',
14
+ retry: 'retry',
15
+ indexShards: 'indexShards',
16
+ indexName: 'indexName',
17
+ readConcurrency: 'readConcurrency',
18
+ compression: 'compression',
19
+ s3: 's3',
20
+ serde: 'serde',
21
+ onCorruptMessage: 'onCorruptMessage',
22
+ });
23
+ export const GET_MESSAGES_KEYS = allKeysOf({
24
+ limit: 'limit',
25
+ before: 'before',
26
+ signal: 'signal',
27
+ });
28
+ export const LIST_SESSIONS_KEYS = allKeysOf({
29
+ limit: 'limit',
30
+ cursor: 'cursor',
31
+ maxIterations: 'maxIterations',
32
+ maxItems: 'maxItems',
33
+ signal: 'signal',
34
+ });
35
+ const CORRUPT_MESSAGE_POLICIES = ['skip', 'throw'];
36
+ function assertCorruptMessagePolicy(policy) {
37
+ if (policy !== undefined && !CORRUPT_MESSAGE_POLICIES.includes(policy)) {
38
+ throw validationError(`onCorruptMessage must be one of ${CORRUPT_MESSAGE_POLICIES.join(' | ')}`, 'onCorruptMessage');
39
+ }
40
+ }
41
+ export function setUpHistory(options) {
42
+ assertShape(options, HISTORY_KEYS, 'options');
43
+ const shell = openAdapter(options, 'history', {
44
+ options: () => assertCorruptMessagePolicy(options.onCorruptMessage),
45
+ attemptFloor: MESSAGE_APPEND_RETRY_MAX_ATTEMPTS,
46
+ });
47
+ return {
48
+ shell,
49
+ context: {
50
+ ...shell.core,
51
+ serde: options.serde ?? JSON_SERDE,
52
+ ulid: createUlidFactory(),
53
+ onCorruptMessage: options.onCorruptMessage ?? 'skip',
54
+ },
55
+ };
56
+ }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Hides a multi-session history behind LangChain's single-session interface.
4
3
  *
@@ -8,28 +7,32 @@
8
7
  * multi-session history it wraps, through the same error boundary. The window
9
8
  * bounds what a chain reads, never what is written or cleared.
10
9
  */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DynamoDBSessionChatMessageHistory = void 0;
13
- const chat_history_1 = require("@langchain/core/chat_history");
14
- const boundary_1 = require("../shared/errors/boundary");
15
- const collaborators_1 = require("../shared/validation/collaborators");
16
- const option_shape_1 = require("../shared/validation/option-shape");
17
- const parse_1 = require("./internal/parse");
18
- /** Every key {@link AdapterWindow} declares, compiler-checked against its type. */
19
- const ADAPTER_WINDOW_KEYS = (0, option_shape_1.allKeysOf)({ limit: 'limit' });
20
- /** {@link MultiSessionHistory}'s own members, the ones this adapter calls. */
21
- const MULTI_SESSION_HISTORY_MEMBERS = ['getMessages', 'addMessages', 'clear'];
10
+ import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
11
+ import type { BaseMessage } from '@langchain/core/messages';
12
+ /** The read window an adapter applies to every `getMessages`. */
13
+ export type AdapterWindow = {
14
+ limit?: number;
15
+ };
16
+ /**
17
+ * A history holding many sessions, addressed by session id: what a
18
+ * single-session adapter wraps. `DynamoDBChatMessageHistory` is one.
19
+ */
20
+ export interface MultiSessionHistory {
21
+ getMessages(sessionId: string, window?: AdapterWindow): Promise<BaseMessage[]>;
22
+ addMessages(sessionId: string, messages: BaseMessage[]): Promise<void>;
23
+ clear(sessionId: string): Promise<void>;
24
+ }
22
25
  /**
23
26
  * Single-session view over a {@link MultiSessionHistory}, implementing LangChain's
24
27
  * `BaseListChatMessageHistory` so it can drive `RunnableWithMessageHistory`.
25
28
  * A `window` bounds what every read hands the chain — `{ limit: 50 }` feeds it
26
29
  * the newest fifty messages instead of the whole session.
27
30
  */
28
- class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessageHistory {
29
- backend;
30
- lc_namespace = ['langchain', 'stores', 'message', 'dynamodb'];
31
- sessionId;
32
- window;
31
+ export declare class DynamoDBSessionChatMessageHistory extends BaseListChatMessageHistory {
32
+ private readonly backend;
33
+ lc_namespace: string[];
34
+ private readonly sessionId;
35
+ private readonly window;
33
36
  /**
34
37
  * Accepts: `backend` — the multi-session adapter this view delegates to,
35
38
  * checked structurally for {@link MultiSessionHistory}'s own members. `sessionId`
@@ -50,15 +53,7 @@ class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessa
50
53
  * `window.<key>` for a key `AdapterWindow` does not declare, or `limit`. Checking here reports a caller's mistake at
51
54
  * construction instead of rebranding it as an upstream failure on first use.
52
55
  */
53
- constructor(backend, sessionId, window) {
54
- super();
55
- this.backend = backend;
56
- (0, collaborators_1.assertMembers)(backend, MULTI_SESSION_HISTORY_MEMBERS, 'backend');
57
- this.sessionId = (0, parse_1.parseSessionId)(sessionId);
58
- if (window !== undefined)
59
- (0, option_shape_1.assertShape)(window, ADAPTER_WINDOW_KEYS, 'window');
60
- this.window = window === undefined ? undefined : (0, parse_1.parseMessageWindow)(window);
61
- }
56
+ constructor(backend: MultiSessionHistory, sessionId: string, window?: AdapterWindow);
62
57
  /**
63
58
  * This session's messages in chronological order.
64
59
  *
@@ -73,9 +68,7 @@ class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessa
73
68
  * the code the classifier assigns unless it is already one of this library's
74
69
  * own errors.
75
70
  */
76
- getMessages() {
77
- return (0, boundary_1.guardPublic)('session.getMessages', () => this.backend.getMessages(this.sessionId, this.window));
78
- }
71
+ getMessages(): Promise<BaseMessage[]>;
79
72
  /**
80
73
  * Append one message to this session.
81
74
  *
@@ -85,9 +78,7 @@ class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessa
85
78
  *
86
79
  * Throws: as {@link addMessages}.
87
80
  */
88
- addMessage(message) {
89
- return (0, boundary_1.guardPublic)('session.addMessage', () => this.backend.addMessages(this.sessionId, [message]));
90
- }
81
+ addMessage(message: BaseMessage): Promise<void>;
91
82
  /**
92
83
  * Append messages to this session.
93
84
  *
@@ -102,9 +93,7 @@ class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessa
102
93
  * Guarantees: the window bounds what is *read*, never what is written — the
103
94
  * session keeps every message appended to it.
104
95
  */
105
- addMessages(messages) {
106
- return (0, boundary_1.guardPublic)('session.addMessages', () => this.backend.addMessages(this.sessionId, messages));
107
- }
96
+ addMessages(messages: BaseMessage[]): Promise<void>;
108
97
  /**
109
98
  * Delete this session's messages, metadata and offloaded objects.
110
99
  *
@@ -119,8 +108,5 @@ class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessa
119
108
  * `BaseListChatMessageHistory` declares `clear()`, and a chain that calls it
120
109
  * is asking for exactly that.
121
110
  */
122
- clear() {
123
- return (0, boundary_1.guardPublic)('session.clear', () => this.backend.clear(this.sessionId));
124
- }
111
+ clear(): Promise<void>;
125
112
  }
126
- exports.DynamoDBSessionChatMessageHistory = DynamoDBSessionChatMessageHistory;
@@ -0,0 +1,34 @@
1
+ import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
2
+ import { guardPublic } from '../shared/errors/boundary.js';
3
+ import { assertMembers } from '../shared/validation/collaborators.js';
4
+ import { allKeysOf, assertShape } from '../shared/validation/option-shape.js';
5
+ import { parseMessageWindow, parseSessionId, } from './internal/parse.js';
6
+ const ADAPTER_WINDOW_KEYS = allKeysOf({ limit: 'limit' });
7
+ const MULTI_SESSION_HISTORY_MEMBERS = ['getMessages', 'addMessages', 'clear'];
8
+ export class DynamoDBSessionChatMessageHistory extends BaseListChatMessageHistory {
9
+ backend;
10
+ lc_namespace = ['langchain', 'stores', 'message', 'dynamodb'];
11
+ sessionId;
12
+ window;
13
+ constructor(backend, sessionId, window) {
14
+ super();
15
+ this.backend = backend;
16
+ assertMembers(backend, MULTI_SESSION_HISTORY_MEMBERS, 'backend');
17
+ this.sessionId = parseSessionId(sessionId);
18
+ if (window !== undefined)
19
+ assertShape(window, ADAPTER_WINDOW_KEYS, 'window');
20
+ this.window = window === undefined ? undefined : parseMessageWindow(window);
21
+ }
22
+ getMessages() {
23
+ return guardPublic('session.getMessages', () => this.backend.getMessages(this.sessionId, this.window));
24
+ }
25
+ addMessage(message) {
26
+ return guardPublic('session.addMessage', () => this.backend.addMessages(this.sessionId, [message]));
27
+ }
28
+ addMessages(messages) {
29
+ return guardPublic('session.addMessages', () => this.backend.addMessages(this.sessionId, messages));
30
+ }
31
+ clear() {
32
+ return guardPublic('session.clear', () => this.backend.clear(this.sessionId));
33
+ }
34
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Hides the history's implementation from the types a caller names.
3
+ *
4
+ * Every option and result of the multi-session history's reads, writes and
5
+ * listings is declared here, with no run-time code, so a caller can type
6
+ * what it builds without importing an action, a parser or a row module. The
7
+ * parsed forms the actions work from belong to the parser and the row
8
+ * shapes to the modules that own them, so either can change without moving
9
+ * a published type.
10
+ */
11
+ import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
12
+ import type { BaseAdapterOptions, CancelOptions, CodecOptions } from '../shared/options.js';
13
+ /** Options for {@link DynamoDBChatMessageHistory}. */
14
+ export type DynamoDBChatMessageHistoryOptions = BaseAdapterOptions & CodecOptions & {
15
+ /**
16
+ * Optional serializer override. The default is the exported `JSON_SERDE`,
17
+ * plain JSON: what it stores is the JSON projection of a value, and the
18
+ * README's *Table schema* section tabulates where that differs from the
19
+ * value itself.
20
+ */
21
+ serde?: SerializerProtocol;
22
+ /**
23
+ * What `getMessages` does when a stored message cannot be decoded. It
24
+ * covers a payload nobody can read — bytes that are no longer the form
25
+ * the row declares, a gone S3 object, a descriptor that is not one — and
26
+ * a stored message LangChain cannot rebuild. It does not govern a
27
+ * payload larger than this reader's `compression.maxDecompressedBytes`
28
+ * or `s3.maxDownloadBytes` (a limit of this reader's, not a lost
29
+ * payload), nor a serializer declining intact bytes: a `serdeType` the
30
+ * configured serializer has no grammar for after a config change, like
31
+ * an `lc` record naming a class outside its allow-list, is reported
32
+ * under **both** policies, because a payload this reader merely may not
33
+ * rebuild is not a payload that is gone. `'skip'` (the default) drops
34
+ * the item, logs it at `error` with its sort key so an operator can
35
+ * locate it, and returns the rest; `'throw'` fails the whole read, which
36
+ * is all-or-nothing but leaves the session unreadable until the bad row
37
+ * is removed out of band.
38
+ */
39
+ onCorruptMessage?: CorruptMessagePolicy;
40
+ };
41
+ /** How `getMessages` handles an item it cannot decode. */
42
+ export type CorruptMessagePolicy = 'skip' | 'throw';
43
+ /**
44
+ * Which slice of a session `getMessages` returns. Both bounds are optional
45
+ * and combine: `{ limit: 50, before }` is the fifty messages just before
46
+ * `before`.
47
+ */
48
+ export interface MessageWindow {
49
+ /**
50
+ * Return only the newest `limit` messages — still in chronological order. An
51
+ * integer from 1 to 10,000: the page rule every `limit` in
52
+ * this package follows, with the one floor of 1 it has. `0` is refused rather
53
+ * than answered with nothing, since for a window into a conversation it is
54
+ * far more likely a bug than a request — and the empty window it would
55
+ * produce is what a chain reads as the whole session.
56
+ */
57
+ limit?: number;
58
+ /** Return only messages appended before this instant (millisecond precision). */
59
+ before?: Date;
60
+ }
61
+ /** Options for `getMessages`: the read window plus cancellation. */
62
+ export type GetMessagesOptions = MessageWindow & CancelOptions;
63
+ /** Options for `listSessions`: the page, the scan caps, and cancellation. */
64
+ export interface ListSessionsOptions extends CancelOptions {
65
+ /**
66
+ * How many sessions to return, newest-updated first; an integer from 0 to
67
+ * 10,000.
68
+ *
69
+ * With a configured `indexName` it is the page size and defaults to 100.
70
+ * Without one the read is a table scan that cannot be paged: an explicit
71
+ * limit still selects the newest N, but omitting it returns every session,
72
+ * because there would be no cursor to fetch the rest with. `0` returns an
73
+ * empty page on either path and reads neither.
74
+ */
75
+ limit?: number;
76
+ /**
77
+ * Opaque cursor from a previous page. Requires a configured `indexName` —
78
+ * without the index there is no position to resume from, and passing one is
79
+ * refused rather than answered with the first page again.
80
+ */
81
+ cursor?: string;
82
+ /** Cap on scan pages before `RESULT_TRUNCATED` (default 1000). Scan path only. */
83
+ maxIterations?: number;
84
+ /** Cap on rows read into memory before `RESULT_TRUNCATED` (default 10 000). Scan path only. */
85
+ maxItems?: number;
86
+ }
87
+ /** One page of {@link SessionMetadata}, and where the next one resumes. */
88
+ export interface SessionPage {
89
+ sessions: SessionMetadata[];
90
+ /** Absent when this page is the last one, or when the read was a scan. */
91
+ nextCursor?: string;
92
+ }
93
+ /** Summary of a stored chat session. */
94
+ export interface SessionMetadata {
95
+ sessionId: string;
96
+ title?: string;
97
+ messageCount: number;
98
+ createdAt: string;
99
+ updatedAt: string;
100
+ /** When the session's TTL expires, as an ISO-8601 instant; absent when no TTL is stored. */
101
+ expiresAt?: string;
102
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ /**
2
+ * AWS DynamoDB implementation of LangGraph's checkpoint saver, memory store
3
+ * and chat message history, in TypeScript.
4
+ *
5
+ * Hides where anything lives.
6
+ *
7
+ * This module re-exports and declares nothing of its own, so which module
8
+ * holds an adapter, the factory, the error class, the serializer or a
9
+ * collaborator type is free to change without moving anything a caller
10
+ * imports. What appears here is the whole supported surface; the package's
11
+ * exports map admits no deep import, so nothing else is reachable.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+ export { DynamoDBSaver } from './checkpointer/saver.js';
16
+ export type { DeltaChannelHistoryOptions, DynamoDBSaverOptions } from './checkpointer/types.js';
17
+ export { DynamoDBStore } from './store/store.js';
18
+ export type { DynamoDBStoreOptions, ListNamespacesOptions, SearchOptions, VectorReconcileResult, } from './store/types.js';
19
+ export type { VectorBackend, VectorMatch, VectorRef, VectorScoreDirection, } from './store/vector-backend.js';
20
+ export { DynamoDBChatMessageHistory } from './history/chat-message-history.js';
21
+ export { DynamoDBSessionChatMessageHistory } from './history/session-adapter.js';
22
+ export type { AdapterWindow, MultiSessionHistory } from './history/session-adapter.js';
23
+ export type { CorruptMessagePolicy, DynamoDBChatMessageHistoryOptions, GetMessagesOptions, ListSessionsOptions, SessionPage, MessageWindow, SessionMetadata, } from './history/types.js';
24
+ /**
25
+ * Operator tool: give rows written before the recency index their index keys.
26
+ * Run it before setting `indexName` on any adapter — see its own documentation
27
+ * for why enabling the index first hides pre-existing rows from the listings.
28
+ */
29
+ export { backfillRecencyIndex } from './backfill/backfill.js';
30
+ export type { BackfillOptions, BackfillResult } from './backfill/backfill.js';
31
+ export { DynamoDBFactory } from './factory/factory.js';
32
+ export type { AdapterSection, CreateAllOptions, CreatedAdapters, FactoryBaseOptions, } from './factory/types.js';
33
+ /**
34
+ * The plain JSON serializer the store and chat-history adapters use by
35
+ * default, exported so a checkpointer can be given it in place of LangGraph's
36
+ * `JsonPlusSerializer`, whose read path instantiates the class a stored
37
+ * `{"lc": …}` record names. See the README's *Trust boundary* note and
38
+ * `SECURITY.md`.
39
+ */
40
+ export { JSON_SERDE } from './shared/codec/json-serde.js';
41
+ export { DynamoDBLangGraphError, isDynamoDBLangGraphError } from './shared/errors/base-error.js';
42
+ export type { AnyDynamoDBLangGraphError, BatchDrainDetails, BatchPassDetails, BatchWriteIncompleteDetails, CompensationFailedDetails, ErrorContext, ErrorDetailsByCode, ErrorDetailsFor, } from './shared/errors/base-error.js';
43
+ export { ErrorCode } from './shared/errors/error-code.js';
44
+ export type { Logger, LogArgument } from './shared/logging/logger.js';
45
+ export { redactLogger, redactSecrets } from './shared/logging/redaction.js';
46
+ export type { Redactable, RedactLoggerOptions } from './shared/logging/redaction.js';
47
+ export type { CancelOptions, BaseAdapterOptions, CodecOptions } from './shared/options.js';
48
+ export type { DynamoDBDocumentLike, WriteRequest } from './shared/dynamodb/client.js';
49
+ export type { RetryAttemptInfo, RetryOptions, RetryPolicy } from './shared/dynamodb/retry.js';
50
+ export type { TtlOption } from './shared/validation/ttl.js';
51
+ export type { CompressionConfig } from './shared/codec/compression.js';
52
+ export type { S3OffloadConfig } from './shared/codec/s3/config.js';
53
+ export type { S3ClientConfigLike, S3ClientOption, S3ClientOptions, S3RegionLike, } from './shared/codec/s3/client-types.js';
@@ -0,0 +1,10 @@
1
+ export { DynamoDBSaver } from './checkpointer/saver.js';
2
+ export { DynamoDBStore } from './store/store.js';
3
+ export { DynamoDBChatMessageHistory } from './history/chat-message-history.js';
4
+ export { DynamoDBSessionChatMessageHistory } from './history/session-adapter.js';
5
+ export { backfillRecencyIndex } from './backfill/backfill.js';
6
+ export { DynamoDBFactory } from './factory/factory.js';
7
+ export { JSON_SERDE } from './shared/codec/json-serde.js';
8
+ export { DynamoDBLangGraphError, isDynamoDBLangGraphError } from './shared/errors/base-error.js';
9
+ export { ErrorCode } from './shared/errors/error-code.js';
10
+ export { redactLogger, redactSecrets } from './shared/logging/redaction.js';
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Hides what an adapter owns for its lifetime, and how it lets go of it.
3
+ *
4
+ * Every adapter resolves the same things from its options — a DynamoDB client
5
+ * it either built, and so must destroy, or was handed, and so must not; an S3
6
+ * offloader when it offloads; a logger; a retry policy; the recency index's
7
+ * settings — releases them the same way, and provisions the same lifecycle
8
+ * rule from its ttl. Whether an adapter owns its client is decided in
9
+ * `dynamodb/client.ts`; this module only reads that decision, to release a
10
+ * client it built and leave an injected one alone.
11
+ */
12
+ import type { CompressionConfig } from './codec/compression.js';
13
+ import { type AdapterName } from './codec/s3/config.js';
14
+ import { S3Offloader } from './codec/s3/offloader.js';
15
+ import { type DynamoDBDocumentLike } from './dynamodb/client.js';
16
+ import { type RetryOptions } from './dynamodb/retry.js';
17
+ import { type Logger } from './logging/logger.js';
18
+ import type { BaseAdapterOptions, CodecOptions } from './options.js';
19
+ import { type TtlOption } from './validation/ttl.js';
20
+ /** Anything an adapter holds open and must hand back when it is torn down. */
21
+ export interface Releasable {
22
+ destroy(): void;
23
+ }
24
+ /**
25
+ * Release every resource, whatever any one of them does.
26
+ *
27
+ * The hazard is the one `DynamoDBFactory`'s own `release` names: a teardown
28
+ * written as a sequence of statements stops at the first throw, so everything
29
+ * after it is stranded with no reference left to reach it by. An adapter's
30
+ * teardown is such a sequence — the S3 offloader, then the DynamoDB client it
31
+ * built — and an S3 client whose sockets are already gone throws from its own
32
+ * `destroy`, which would leave the DynamoDB client open for the life of the
33
+ * process. Each resource is therefore released whatever the ones before it
34
+ * threw.
35
+ *
36
+ * Accepts: `resources` — in the order they should be released; an absent one
37
+ * (an adapter with no offloader, a client the caller injected and therefore
38
+ * owns) is skipped rather than guarded at each call site.
39
+ *
40
+ * Returns: nothing.
41
+ *
42
+ * Throws: the **first** failure, and only after every resource has been
43
+ * offered its release, so nothing is stranded behind it. Raised rather than
44
+ * logged because the default logger discards everything: a caller who never
45
+ * configured one would otherwise be told nowhere at all that a client of theirs
46
+ * is still holding sockets. A later failure is dropped, because a caller can
47
+ * act on one report and the first one names the resource that actually broke.
48
+ * A `throw` that produced something other than an `Error` is normalised, so a
49
+ * caller's `catch` is handed the same shape whatever a client raised.
50
+ */
51
+ export declare function releaseOwned(resources: readonly (Releasable | undefined)[]): void;
52
+ /** What every adapter resolves from its options and every operation reads. */
53
+ export interface AdapterCore {
54
+ client: DynamoDBDocumentLike;
55
+ tableName: string;
56
+ compression?: CompressionConfig;
57
+ offloader?: S3Offloader;
58
+ ttl?: TtlOption;
59
+ logger: Logger;
60
+ /** Retry budget and backoff for every DynamoDB call, with the retry debug log attached. */
61
+ retry?: RetryOptions;
62
+ /**
63
+ * Index partitions per adapter for the recency index; see `indexKeys`.
64
+ * Absent means the default, which is where it is resolved.
65
+ */
66
+ indexShards?: number;
67
+ /** Payloads decoded at once by one call; the memory ceiling’s multiplier. */
68
+ readConcurrency?: number;
69
+ /** Name of the recency index, when the table carries one; see `BaseAdapterOptions.indexName`. */
70
+ indexName?: string;
71
+ }
72
+ /** An adapter's hold on what it owns. */
73
+ export interface AdapterShell {
74
+ readonly core: AdapterCore;
75
+ /** Provision the S3 lifecycle rule for the configured ttl; see {@link ensureLifecycleFor}. */
76
+ ensureLifecycleRule(): Promise<void>;
77
+ /**
78
+ * Release the offloader, and the DynamoDB client when the adapter built it;
79
+ * see {@link releaseOwned}. `release` runs once; a later call does nothing.
80
+ */
81
+ release(): void;
82
+ }
83
+ /** The checks an adapter adds to the shared ones, and where they run. */
84
+ export interface AdapterChecks {
85
+ /** Runs after the shared option checks and before the collaborator checks. */
86
+ options?: () => void;
87
+ /** Runs after the shared collaborator checks, before anything is built. */
88
+ collaborators?: () => void;
89
+ /** The fewest attempts the adapter's own writes need; see `resolveRetryPolicy`. */
90
+ attemptFloor?: number;
91
+ }
92
+ /** The options every adapter takes, with the serializer each may add. */
93
+ export type AdapterOptions = BaseAdapterOptions & CodecOptions & {
94
+ serde?: object;
95
+ };
96
+ /**
97
+ * Provision the S3 lifecycle rule that expires what an adapter offloads, on its
98
+ * ttl, so an offloaded payload does not outlive the DynamoDB item that points
99
+ * at it.
100
+ *
101
+ * The rule is expressed in whole days because that is the only granularity S3
102
+ * lifecycle expiration accepts, while the DynamoDB TTL is in seconds; see
103
+ * `lifecycleExpirationDays` for the rounding, which is always up.
104
+ *
105
+ * Accepts: `core` — the adapter's offloader, ttl and logger.
106
+ *
107
+ * Returns: nothing. Without an offloader there is nothing to rule over, and
108
+ * without a ttl no item expires, so any rule would delete a payload a live row
109
+ * still needs: either absence does nothing. Installing a rule that is already
110
+ * there is a no-op too, so calling this on every deploy is safe. When it
111
+ * writes the rules but cannot confirm within its polling window that a
112
+ * re-read shows them — S3 documents that a lifecycle configuration can take
113
+ * minutes to propagate — it logs a `warn` and returns rather than throwing:
114
+ * the rules were written, and a later call can confirm them.
115
+ *
116
+ * Throws: whatever reading or writing the bucket's lifecycle configuration
117
+ * throws, `VALIDATION` naming `s3.keyPrefix` when the rule id this prefix
118
+ * would take is already held by a different prefix, and `CONTENTION` when
119
+ * every one of the five rounds this call polls needs a write — a competing
120
+ * writer replacing the configuration on every single re-read.
121
+ *
122
+ * Guarantees: needs the bucket-level `s3:GetLifecycleConfiguration` /
123
+ * `s3:PutLifecycleConfiguration` permissions, which are broader than the
124
+ * object-level CRUD the rest of offload uses — so this is a provisioning call,
125
+ * not a per-request one.
126
+ */
127
+ export declare function ensureLifecycleFor(core: Pick<AdapterCore, 'offloader' | 'ttl' | 'logger'>): Promise<void>;
128
+ /**
129
+ * Check an adapter's options and resolve what it will own.
130
+ *
131
+ * Accepts: `options` — the adapter's, already held to its own key list, and
132
+ * checked first, so no half-built adapter exists when one is wrong.
133
+ * `adapter` — which adapter, which names its default S3 key prefix. `checks` —
134
+ * the adapter's own option and collaborator checks, and its retry floor.
135
+ *
136
+ * Returns: the shell: the core every operation reads, with every shared
137
+ * default filled in here and nowhere else, and the adapter's two lifetime
138
+ * operations. A client the caller passed in is never destroyed by `release`.
139
+ *
140
+ * Throws: `VALIDATION` for an option or a collaborator that fails a shared
141
+ * check or one of `checks`, in that order.
142
+ *
143
+ * Guarantees: no I/O. The stacked-retry check is deliberately not awaited: it
144
+ * is a warning about a caller-supplied client, not a precondition.
145
+ */
146
+ export declare function openAdapter(options: AdapterOptions, adapter: AdapterName, checks?: AdapterChecks): AdapterShell;
@@ -0,0 +1,65 @@
1
+ import { offloaderConfigFor } from './codec/s3/config.js';
2
+ import { S3Offloader } from './codec/s3/offloader.js';
3
+ import { DEFAULT_READ_CONCURRENCY } from './concurrency.js';
4
+ import { resolveDynamoDBClient, warnOnStackedRetries, } from './dynamodb/client.js';
5
+ import { DEFAULT_INDEX_SHARDS } from './dynamodb/recency-index.js';
6
+ import { resolveRetryPolicy } from './dynamodb/retry.js';
7
+ import { toError } from './errors/base-error.js';
8
+ import { resolveLogger } from './logging/logger.js';
9
+ import { assertBaseCollaborators } from './validation/collaborators.js';
10
+ import { assertBaseAdapterOptions } from './validation/options.js';
11
+ import { lifecycleExpirationDays } from './validation/ttl.js';
12
+ export function releaseOwned(resources) {
13
+ let first;
14
+ for (const resource of resources) {
15
+ try {
16
+ resource?.destroy();
17
+ }
18
+ catch (error) {
19
+ first ??= toError(error);
20
+ }
21
+ }
22
+ if (first !== undefined)
23
+ throw first;
24
+ }
25
+ export async function ensureLifecycleFor(core) {
26
+ if (!core.offloader || !core.ttl)
27
+ return;
28
+ await core.offloader.ensureLifecycleRule(lifecycleExpirationDays(core.ttl), core.logger);
29
+ }
30
+ export function openAdapter(options, adapter, checks = {}) {
31
+ assertBaseAdapterOptions(options);
32
+ checks.options?.();
33
+ assertBaseCollaborators(options);
34
+ checks.collaborators?.();
35
+ const logger = resolveLogger(options.logger);
36
+ const resolved = resolveDynamoDBClient(options);
37
+ if (!resolved.ownsClient)
38
+ void warnOnStackedRetries(resolved.client, logger);
39
+ const offloader = options.s3
40
+ ? new S3Offloader(offloaderConfigFor(options.s3, adapter, options.clientConfig), logger)
41
+ : undefined;
42
+ const core = {
43
+ client: resolved.client,
44
+ tableName: options.tableName,
45
+ compression: options.compression,
46
+ offloader,
47
+ ttl: options.ttl,
48
+ logger,
49
+ retry: resolveRetryPolicy(options.retry, logger, checks.attemptFloor),
50
+ indexShards: options.indexShards ?? DEFAULT_INDEX_SHARDS,
51
+ readConcurrency: options.readConcurrency ?? DEFAULT_READ_CONCURRENCY,
52
+ indexName: options.indexName,
53
+ };
54
+ let released = false;
55
+ return {
56
+ core,
57
+ ensureLifecycleRule: () => ensureLifecycleFor(core),
58
+ release: () => {
59
+ if (released)
60
+ return;
61
+ released = true;
62
+ releaseOwned([offloader, resolved.ownsClient ? resolved.ddbClient : undefined]);
63
+ },
64
+ };
65
+ }