@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.1 → 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 (608) hide show
  1. package/README.md +1820 -290
  2. package/dist/cjs/backfill/backfill.d.ts +171 -0
  3. package/dist/cjs/backfill/backfill.js +177 -0
  4. package/dist/cjs/checkpointer/actions/delete-thread.d.ts +50 -0
  5. package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
  6. package/dist/cjs/checkpointer/actions/get-tuple.d.ts +36 -0
  7. package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
  8. package/dist/cjs/checkpointer/actions/list.d.ts +55 -0
  9. package/dist/cjs/checkpointer/actions/list.js +70 -0
  10. package/dist/cjs/checkpointer/actions/put-writes.d.ts +49 -0
  11. package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
  12. package/dist/cjs/checkpointer/actions/put.d.ts +95 -0
  13. package/dist/cjs/checkpointer/actions/put.js +79 -0
  14. package/dist/cjs/checkpointer/internal/delta-history.d.ts +124 -0
  15. package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
  16. package/dist/cjs/checkpointer/internal/listing.d.ts +149 -0
  17. package/dist/cjs/checkpointer/internal/listing.js +104 -0
  18. package/dist/cjs/checkpointer/internal/parse.d.ts +298 -0
  19. package/dist/cjs/checkpointer/internal/parse.js +184 -0
  20. package/dist/cjs/checkpointer/internal/pending-writes.d.ts +314 -0
  21. package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
  22. package/dist/cjs/checkpointer/internal/read.d.ts +135 -0
  23. package/dist/cjs/checkpointer/internal/read.js +132 -0
  24. package/dist/cjs/checkpointer/internal/rows.d.ts +644 -0
  25. package/dist/cjs/checkpointer/internal/rows.js +356 -0
  26. package/dist/cjs/checkpointer/internal/setup.d.ts +47 -0
  27. package/dist/cjs/checkpointer/internal/setup.js +25 -0
  28. package/dist/cjs/checkpointer/saver.d.ts +306 -0
  29. package/dist/cjs/checkpointer/saver.js +56 -0
  30. package/dist/cjs/checkpointer/types.d.ts +51 -0
  31. package/dist/cjs/factory/factory.d.ts +154 -0
  32. package/dist/cjs/factory/factory.js +137 -0
  33. package/dist/{factory → cjs/factory}/types.d.ts +33 -14
  34. package/dist/cjs/history/actions/add-messages.d.ts +51 -0
  35. package/dist/cjs/history/actions/add-messages.js +17 -0
  36. package/dist/cjs/history/actions/clear.d.ts +52 -0
  37. package/dist/cjs/history/actions/clear.js +29 -0
  38. package/dist/cjs/history/actions/get-messages.d.ts +60 -0
  39. package/dist/cjs/history/actions/get-messages.js +58 -0
  40. package/dist/cjs/history/actions/list-sessions.d.ts +55 -0
  41. package/dist/cjs/history/actions/list-sessions.js +67 -0
  42. package/dist/cjs/history/actions/reconcile-count.d.ts +49 -0
  43. package/dist/cjs/history/actions/reconcile-count.js +8 -0
  44. package/dist/cjs/history/chat-message-history.d.ts +267 -0
  45. package/dist/cjs/history/chat-message-history.js +61 -0
  46. package/dist/cjs/history/internal/append.d.ts +244 -0
  47. package/dist/cjs/history/internal/append.js +267 -0
  48. package/dist/cjs/history/internal/message-read.d.ts +84 -0
  49. package/dist/cjs/history/internal/message-read.js +93 -0
  50. package/dist/cjs/history/internal/parse.d.ts +153 -0
  51. package/dist/cjs/history/internal/parse.js +113 -0
  52. package/dist/cjs/history/internal/rows.d.ts +196 -0
  53. package/dist/cjs/history/internal/rows.js +96 -0
  54. package/dist/cjs/history/internal/session.d.ts +350 -0
  55. package/dist/cjs/history/internal/session.js +296 -0
  56. package/dist/cjs/history/internal/setup.d.ts +64 -0
  57. package/dist/cjs/history/internal/setup.js +60 -0
  58. package/dist/cjs/history/session-adapter.d.ts +112 -0
  59. package/dist/cjs/history/session-adapter.js +38 -0
  60. package/dist/cjs/history/types.d.ts +102 -0
  61. package/dist/cjs/index.d.ts +53 -0
  62. package/dist/cjs/index.js +25 -0
  63. package/dist/cjs/package.json +1 -0
  64. package/dist/cjs/shared/adapter.d.ts +146 -0
  65. package/dist/cjs/shared/adapter.js +70 -0
  66. package/dist/cjs/shared/clock.d.ts +52 -0
  67. package/dist/cjs/shared/clock.js +14 -0
  68. package/dist/cjs/shared/codec/codec.d.ts +336 -0
  69. package/dist/cjs/shared/codec/codec.js +162 -0
  70. package/dist/cjs/shared/codec/compression.d.ts +66 -0
  71. package/dist/cjs/shared/codec/compression.js +45 -0
  72. package/dist/cjs/shared/codec/json-serde.d.ts +80 -0
  73. package/dist/cjs/shared/codec/json-serde.js +58 -0
  74. package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +22 -2
  75. package/dist/{shared → cjs/shared}/codec/s3/client-types.js +0 -1
  76. package/dist/cjs/shared/codec/s3/client.d.ts +63 -0
  77. package/dist/cjs/shared/codec/s3/client.js +78 -0
  78. package/dist/cjs/shared/codec/s3/config.d.ts +260 -0
  79. package/dist/cjs/shared/codec/s3/config.js +92 -0
  80. package/dist/cjs/shared/codec/s3/lifecycle.d.ts +220 -0
  81. package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
  82. package/dist/cjs/shared/codec/s3/offloader.d.ts +428 -0
  83. package/dist/cjs/shared/codec/s3/offloader.js +289 -0
  84. package/dist/cjs/shared/concurrency.d.ts +43 -0
  85. package/dist/{shared → cjs/shared}/concurrency.js +10 -9
  86. package/dist/cjs/shared/dynamodb/abort.d.ts +47 -0
  87. package/dist/cjs/shared/dynamodb/abort.js +16 -0
  88. package/dist/cjs/shared/dynamodb/batch-write.d.ts +86 -0
  89. package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
  90. package/dist/cjs/shared/dynamodb/cancellation.d.ts +124 -0
  91. package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
  92. package/dist/cjs/shared/dynamodb/client.d.ts +177 -0
  93. package/dist/{shared → cjs/shared}/dynamodb/client.js +12 -14
  94. package/dist/cjs/shared/dynamodb/idempotent-write.d.ts +596 -0
  95. package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
  96. package/dist/cjs/shared/dynamodb/paginate.d.ts +111 -0
  97. package/dist/cjs/shared/dynamodb/paginate.js +90 -0
  98. package/dist/cjs/shared/dynamodb/partition-delete.d.ts +204 -0
  99. package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
  100. package/dist/cjs/shared/dynamodb/recency-index.d.ts +243 -0
  101. package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
  102. package/dist/cjs/shared/dynamodb/retry.d.ts +317 -0
  103. package/dist/cjs/shared/dynamodb/retry.js +193 -0
  104. package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
  105. package/dist/cjs/shared/dynamodb/row-size.js +30 -0
  106. package/dist/cjs/shared/dynamodb/table-schema.d.ts +199 -0
  107. package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
  108. package/dist/cjs/shared/errors/base-error.d.ts +231 -0
  109. package/dist/cjs/shared/errors/base-error.js +73 -0
  110. package/dist/cjs/shared/errors/boundary.d.ts +86 -0
  111. package/dist/cjs/shared/errors/boundary.js +61 -0
  112. package/dist/cjs/shared/errors/classify.d.ts +206 -0
  113. package/dist/cjs/shared/errors/classify.js +232 -0
  114. package/dist/cjs/shared/errors/error-code.d.ts +95 -0
  115. package/dist/{shared → cjs/shared}/errors/error-code.js +12 -2
  116. package/dist/cjs/shared/errors/errors.d.ts +233 -0
  117. package/dist/cjs/shared/errors/errors.js +123 -0
  118. package/dist/cjs/shared/logging/logger.d.ts +80 -0
  119. package/dist/cjs/shared/logging/logger.js +30 -0
  120. package/dist/cjs/shared/logging/redaction.d.ts +123 -0
  121. package/dist/cjs/shared/logging/redaction.js +145 -0
  122. package/dist/cjs/shared/logging/secret-patterns.d.ts +227 -0
  123. package/dist/cjs/shared/logging/secret-patterns.js +93 -0
  124. package/dist/cjs/shared/logging/truncate.d.ts +197 -0
  125. package/dist/cjs/shared/logging/truncate.js +31 -0
  126. package/dist/cjs/shared/options.d.ts +100 -0
  127. package/dist/cjs/shared/ulid.d.ts +80 -0
  128. package/dist/{shared → cjs/shared}/ulid.js +7 -21
  129. package/dist/cjs/shared/validation/collaborators.d.ts +160 -0
  130. package/dist/cjs/shared/validation/collaborators.js +79 -0
  131. package/dist/cjs/shared/validation/option-shape.d.ts +91 -0
  132. package/dist/cjs/shared/validation/option-shape.js +31 -0
  133. package/dist/cjs/shared/validation/options.d.ts +145 -0
  134. package/dist/cjs/shared/validation/options.js +166 -0
  135. package/dist/cjs/shared/validation/primitives.d.ts +292 -0
  136. package/dist/cjs/shared/validation/primitives.js +114 -0
  137. package/dist/cjs/shared/validation/ttl.d.ts +94 -0
  138. package/dist/cjs/shared/validation/ttl.js +52 -0
  139. package/dist/cjs/store/actions/list-namespaces.d.ts +79 -0
  140. package/dist/cjs/store/actions/list-namespaces.js +92 -0
  141. package/dist/cjs/store/actions/put.d.ts +43 -0
  142. package/dist/cjs/store/actions/put.js +49 -0
  143. package/dist/cjs/store/actions/reconcile-vector-index.d.ts +38 -0
  144. package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
  145. package/dist/cjs/store/actions/search.d.ts +38 -0
  146. package/dist/cjs/store/actions/search.js +26 -0
  147. package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
  148. package/dist/cjs/store/internal/batch-plan.js +32 -0
  149. package/dist/cjs/store/internal/filter.d.ts +43 -0
  150. package/dist/cjs/store/internal/filter.js +64 -0
  151. package/dist/cjs/store/internal/get-item.d.ts +77 -0
  152. package/dist/cjs/store/internal/get-item.js +58 -0
  153. package/dist/cjs/store/internal/item-write.d.ts +270 -0
  154. package/dist/cjs/store/internal/item-write.js +181 -0
  155. package/dist/cjs/store/internal/parse.d.ts +230 -0
  156. package/dist/cjs/store/internal/parse.js +180 -0
  157. package/dist/cjs/store/internal/rows.d.ts +359 -0
  158. package/dist/cjs/store/internal/rows.js +166 -0
  159. package/dist/cjs/store/internal/semantic-search.d.ts +168 -0
  160. package/dist/{store/internal/text-path.js → cjs/store/internal/semantic-search.js} +92 -28
  161. package/dist/cjs/store/internal/setup.d.ts +96 -0
  162. package/dist/cjs/store/internal/setup.js +103 -0
  163. package/dist/cjs/store/internal/table-search.d.ts +100 -0
  164. package/dist/cjs/store/internal/table-search.js +123 -0
  165. package/dist/cjs/store/internal/vector-index.d.ts +258 -0
  166. package/dist/cjs/store/internal/vector-index.js +269 -0
  167. package/dist/cjs/store/store.d.ts +329 -0
  168. package/dist/cjs/store/store.js +97 -0
  169. package/dist/cjs/store/types.d.ts +111 -0
  170. package/dist/cjs/store/vector-backend.d.ts +104 -0
  171. package/dist/cjs/store/vector-backend.js +4 -0
  172. package/dist/esm/backfill/backfill.d.ts +171 -0
  173. package/dist/esm/backfill/backfill.js +170 -0
  174. package/dist/esm/checkpointer/actions/delete-thread.d.ts +50 -0
  175. package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
  176. package/dist/esm/checkpointer/actions/get-tuple.d.ts +36 -0
  177. package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
  178. package/dist/esm/checkpointer/actions/list.d.ts +55 -0
  179. package/dist/esm/checkpointer/actions/list.js +67 -0
  180. package/dist/esm/checkpointer/actions/put-writes.d.ts +49 -0
  181. package/dist/esm/checkpointer/actions/put-writes.js +18 -0
  182. package/dist/esm/checkpointer/actions/put.d.ts +95 -0
  183. package/dist/esm/checkpointer/actions/put.js +75 -0
  184. package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
  185. package/dist/esm/checkpointer/internal/delta-history.js +126 -0
  186. package/dist/esm/checkpointer/internal/listing.d.ts +149 -0
  187. package/dist/esm/checkpointer/internal/listing.js +95 -0
  188. package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
  189. package/dist/esm/checkpointer/internal/parse.js +169 -0
  190. package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
  191. package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
  192. package/dist/esm/checkpointer/internal/read.d.ts +135 -0
  193. package/dist/esm/checkpointer/internal/read.js +125 -0
  194. package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
  195. package/dist/esm/checkpointer/internal/rows.js +323 -0
  196. package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
  197. package/dist/esm/checkpointer/internal/setup.js +21 -0
  198. package/dist/esm/checkpointer/saver.d.ts +306 -0
  199. package/dist/esm/checkpointer/saver.js +52 -0
  200. package/dist/esm/checkpointer/types.d.ts +51 -0
  201. package/dist/esm/checkpointer/types.js +1 -0
  202. package/dist/esm/factory/factory.d.ts +154 -0
  203. package/dist/esm/factory/factory.js +133 -0
  204. package/dist/esm/factory/types.d.ts +76 -0
  205. package/dist/esm/factory/types.js +1 -0
  206. package/dist/esm/history/actions/add-messages.d.ts +51 -0
  207. package/dist/esm/history/actions/add-messages.js +14 -0
  208. package/dist/esm/history/actions/clear.d.ts +52 -0
  209. package/dist/esm/history/actions/clear.js +26 -0
  210. package/dist/esm/history/actions/get-messages.d.ts +60 -0
  211. package/dist/esm/history/actions/get-messages.js +55 -0
  212. package/dist/esm/history/actions/list-sessions.d.ts +55 -0
  213. package/dist/esm/history/actions/list-sessions.js +64 -0
  214. package/dist/esm/history/actions/reconcile-count.d.ts +49 -0
  215. package/dist/esm/history/actions/reconcile-count.js +5 -0
  216. package/dist/esm/history/chat-message-history.d.ts +267 -0
  217. package/dist/esm/history/chat-message-history.js +57 -0
  218. package/dist/esm/history/internal/append.d.ts +244 -0
  219. package/dist/esm/history/internal/append.js +259 -0
  220. package/dist/esm/history/internal/message-read.d.ts +84 -0
  221. package/dist/esm/history/internal/message-read.js +89 -0
  222. package/dist/esm/history/internal/parse.d.ts +153 -0
  223. package/dist/esm/history/internal/parse.js +105 -0
  224. package/dist/esm/history/internal/rows.d.ts +196 -0
  225. package/dist/esm/history/internal/rows.js +83 -0
  226. package/dist/esm/history/internal/session.d.ts +350 -0
  227. package/dist/esm/history/internal/session.js +285 -0
  228. package/dist/esm/history/internal/setup.d.ts +64 -0
  229. package/dist/esm/history/internal/setup.js +56 -0
  230. package/dist/esm/history/session-adapter.d.ts +112 -0
  231. package/dist/esm/history/session-adapter.js +34 -0
  232. package/dist/esm/history/types.d.ts +102 -0
  233. package/dist/esm/history/types.js +1 -0
  234. package/dist/esm/index.d.ts +53 -0
  235. package/dist/esm/index.js +10 -0
  236. package/dist/esm/shared/adapter.d.ts +146 -0
  237. package/dist/esm/shared/adapter.js +65 -0
  238. package/dist/esm/shared/clock.d.ts +52 -0
  239. package/dist/esm/shared/clock.js +9 -0
  240. package/dist/esm/shared/codec/codec.d.ts +336 -0
  241. package/dist/esm/shared/codec/codec.js +150 -0
  242. package/dist/esm/shared/codec/compression.d.ts +66 -0
  243. package/dist/esm/shared/codec/compression.js +40 -0
  244. package/dist/esm/shared/codec/json-serde.d.ts +80 -0
  245. package/dist/esm/shared/codec/json-serde.js +54 -0
  246. package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
  247. package/dist/esm/shared/codec/s3/client-types.js +3 -0
  248. package/dist/esm/shared/codec/s3/client.d.ts +63 -0
  249. package/dist/esm/shared/codec/s3/client.js +40 -0
  250. package/dist/esm/shared/codec/s3/config.d.ts +260 -0
  251. package/dist/esm/shared/codec/s3/config.js +79 -0
  252. package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
  253. package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
  254. package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
  255. package/dist/esm/shared/codec/s3/offloader.js +278 -0
  256. package/dist/esm/shared/concurrency.d.ts +43 -0
  257. package/dist/esm/shared/concurrency.js +27 -0
  258. package/dist/esm/shared/dynamodb/abort.d.ts +47 -0
  259. package/dist/esm/shared/dynamodb/abort.js +12 -0
  260. package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
  261. package/dist/esm/shared/dynamodb/batch-write.js +74 -0
  262. package/dist/esm/shared/dynamodb/cancellation.d.ts +124 -0
  263. package/dist/esm/shared/dynamodb/cancellation.js +30 -0
  264. package/dist/esm/shared/dynamodb/client.d.ts +177 -0
  265. package/dist/esm/shared/dynamodb/client.js +35 -0
  266. package/dist/esm/shared/dynamodb/idempotent-write.d.ts +596 -0
  267. package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
  268. package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
  269. package/dist/esm/shared/dynamodb/paginate.js +84 -0
  270. package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
  271. package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
  272. package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
  273. package/dist/esm/shared/dynamodb/recency-index.js +136 -0
  274. package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
  275. package/dist/esm/shared/dynamodb/retry.js +180 -0
  276. package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
  277. package/dist/esm/shared/dynamodb/row-size.js +26 -0
  278. package/dist/esm/shared/dynamodb/table-schema.d.ts +199 -0
  279. package/dist/esm/shared/dynamodb/table-schema.js +43 -0
  280. package/dist/esm/shared/errors/base-error.d.ts +231 -0
  281. package/dist/esm/shared/errors/base-error.js +64 -0
  282. package/dist/esm/shared/errors/boundary.d.ts +86 -0
  283. package/dist/esm/shared/errors/boundary.js +54 -0
  284. package/dist/esm/shared/errors/classify.d.ts +206 -0
  285. package/dist/esm/shared/errors/classify.js +220 -0
  286. package/dist/esm/shared/errors/error-code.d.ts +95 -0
  287. package/dist/esm/shared/errors/error-code.js +24 -0
  288. package/dist/esm/shared/errors/errors.d.ts +233 -0
  289. package/dist/esm/shared/errors/errors.js +110 -0
  290. package/dist/esm/shared/logging/logger.d.ts +80 -0
  291. package/dist/esm/shared/logging/logger.js +25 -0
  292. package/dist/esm/shared/logging/redaction.d.ts +123 -0
  293. package/dist/esm/shared/logging/redaction.js +140 -0
  294. package/dist/esm/shared/logging/secret-patterns.d.ts +227 -0
  295. package/dist/esm/shared/logging/secret-patterns.js +83 -0
  296. package/dist/esm/shared/logging/truncate.d.ts +197 -0
  297. package/dist/esm/shared/logging/truncate.js +25 -0
  298. package/dist/esm/shared/options.d.ts +100 -0
  299. package/dist/esm/shared/options.js +1 -0
  300. package/dist/esm/shared/ulid.d.ts +80 -0
  301. package/dist/esm/shared/ulid.js +77 -0
  302. package/dist/esm/shared/validation/collaborators.d.ts +160 -0
  303. package/dist/esm/shared/validation/collaborators.js +70 -0
  304. package/dist/esm/shared/validation/option-shape.d.ts +91 -0
  305. package/dist/esm/shared/validation/option-shape.js +24 -0
  306. package/dist/esm/shared/validation/options.d.ts +145 -0
  307. package/dist/esm/shared/validation/options.js +156 -0
  308. package/dist/esm/shared/validation/primitives.d.ts +292 -0
  309. package/dist/esm/shared/validation/primitives.js +100 -0
  310. package/dist/esm/shared/validation/ttl.d.ts +94 -0
  311. package/dist/esm/shared/validation/ttl.js +46 -0
  312. package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
  313. package/dist/esm/store/actions/list-namespaces.js +86 -0
  314. package/dist/esm/store/actions/put.d.ts +43 -0
  315. package/dist/esm/store/actions/put.js +46 -0
  316. package/dist/esm/store/actions/reconcile-vector-index.d.ts +38 -0
  317. package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
  318. package/dist/esm/store/actions/search.d.ts +38 -0
  319. package/dist/esm/store/actions/search.js +23 -0
  320. package/dist/esm/store/internal/batch-plan.d.ts +56 -0
  321. package/dist/esm/store/internal/batch-plan.js +28 -0
  322. package/dist/esm/store/internal/filter.d.ts +43 -0
  323. package/dist/esm/store/internal/filter.js +60 -0
  324. package/dist/esm/store/internal/get-item.d.ts +77 -0
  325. package/dist/esm/store/internal/get-item.js +54 -0
  326. package/dist/esm/store/internal/item-write.d.ts +270 -0
  327. package/dist/esm/store/internal/item-write.js +173 -0
  328. package/dist/esm/store/internal/parse.d.ts +230 -0
  329. package/dist/esm/store/internal/parse.js +169 -0
  330. package/dist/esm/store/internal/rows.d.ts +359 -0
  331. package/dist/esm/store/internal/rows.js +147 -0
  332. package/dist/esm/store/internal/semantic-search.d.ts +168 -0
  333. package/dist/esm/store/internal/semantic-search.js +200 -0
  334. package/dist/esm/store/internal/setup.d.ts +96 -0
  335. package/dist/esm/store/internal/setup.js +98 -0
  336. package/dist/esm/store/internal/table-search.d.ts +100 -0
  337. package/dist/esm/store/internal/table-search.js +119 -0
  338. package/dist/esm/store/internal/vector-index.d.ts +258 -0
  339. package/dist/esm/store/internal/vector-index.js +256 -0
  340. package/dist/esm/store/store.d.ts +329 -0
  341. package/dist/esm/store/store.js +93 -0
  342. package/dist/esm/store/types.d.ts +111 -0
  343. package/dist/esm/store/types.js +1 -0
  344. package/dist/esm/store/vector-backend.d.ts +104 -0
  345. package/dist/esm/store/vector-backend.js +1 -0
  346. package/package.json +68 -46
  347. package/dist/checkpointer/actions/delete-thread.d.ts +0 -10
  348. package/dist/checkpointer/actions/delete-thread.js +0 -38
  349. package/dist/checkpointer/actions/get-tuple.d.ts +0 -11
  350. package/dist/checkpointer/actions/get-tuple.js +0 -25
  351. package/dist/checkpointer/actions/list.d.ts +0 -20
  352. package/dist/checkpointer/actions/list.js +0 -113
  353. package/dist/checkpointer/actions/put-writes.d.ts +0 -15
  354. package/dist/checkpointer/actions/put-writes.js +0 -62
  355. package/dist/checkpointer/actions/put.d.ts +0 -17
  356. package/dist/checkpointer/actions/put.js +0 -73
  357. package/dist/checkpointer/internal/assemble.d.ts +0 -17
  358. package/dist/checkpointer/internal/assemble.js +0 -38
  359. package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +0 -24
  360. package/dist/checkpointer/internal/checkpoint-write-verify.js +0 -67
  361. package/dist/checkpointer/internal/configurable.d.ts +0 -12
  362. package/dist/checkpointer/internal/configurable.js +0 -24
  363. package/dist/checkpointer/internal/fetch.d.ts +0 -19
  364. package/dist/checkpointer/internal/fetch.js +0 -88
  365. package/dist/checkpointer/internal/filter-match.d.ts +0 -13
  366. package/dist/checkpointer/internal/filter-match.js +0 -15
  367. package/dist/checkpointer/internal/item-reader.d.ts +0 -66
  368. package/dist/checkpointer/internal/item-reader.js +0 -113
  369. package/dist/checkpointer/internal/item-writer.d.ts +0 -35
  370. package/dist/checkpointer/internal/item-writer.js +0 -107
  371. package/dist/checkpointer/internal/keys.d.ts +0 -41
  372. package/dist/checkpointer/internal/keys.js +0 -117
  373. package/dist/checkpointer/internal/list-scope.d.ts +0 -61
  374. package/dist/checkpointer/internal/list-scope.js +0 -108
  375. package/dist/checkpointer/internal/pending-sends.d.ts +0 -13
  376. package/dist/checkpointer/internal/pending-sends.js +0 -29
  377. package/dist/checkpointer/internal/query.d.ts +0 -21
  378. package/dist/checkpointer/internal/query.js +0 -42
  379. package/dist/checkpointer/internal/regular-write.d.ts +0 -28
  380. package/dist/checkpointer/internal/regular-write.js +0 -66
  381. package/dist/checkpointer/internal/setup.d.ts +0 -33
  382. package/dist/checkpointer/internal/setup.js +0 -38
  383. package/dist/checkpointer/internal/special-write-cas.d.ts +0 -29
  384. package/dist/checkpointer/internal/special-write-cas.js +0 -104
  385. package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -23
  386. package/dist/checkpointer/internal/special-write-cleanup.js +0 -50
  387. package/dist/checkpointer/internal/special-write-verify.d.ts +0 -53
  388. package/dist/checkpointer/internal/special-write-verify.js +0 -80
  389. package/dist/checkpointer/internal/stored-channels.d.ts +0 -31
  390. package/dist/checkpointer/internal/stored-channels.js +0 -70
  391. package/dist/checkpointer/internal/validation.d.ts +0 -18
  392. package/dist/checkpointer/internal/validation.js +0 -40
  393. package/dist/checkpointer/internal/write-guard.d.ts +0 -20
  394. package/dist/checkpointer/internal/write-guard.js +0 -48
  395. package/dist/checkpointer/internal/write-index.d.ts +0 -36
  396. package/dist/checkpointer/internal/write-index.js +0 -41
  397. package/dist/checkpointer/saver.d.ts +0 -70
  398. package/dist/checkpointer/saver.js +0 -105
  399. package/dist/checkpointer/types.d.ts +0 -58
  400. package/dist/factory/factory.d.ts +0 -40
  401. package/dist/factory/factory.js +0 -87
  402. package/dist/history/actions/add-messages.d.ts +0 -15
  403. package/dist/history/actions/add-messages.js +0 -77
  404. package/dist/history/actions/clear.d.ts +0 -10
  405. package/dist/history/actions/clear.js +0 -34
  406. package/dist/history/actions/get-messages.d.ts +0 -17
  407. package/dist/history/actions/get-messages.js +0 -79
  408. package/dist/history/actions/list-sessions.d.ts +0 -13
  409. package/dist/history/actions/list-sessions.js +0 -53
  410. package/dist/history/actions/reconcile-count.d.ts +0 -12
  411. package/dist/history/actions/reconcile-count.js +0 -64
  412. package/dist/history/chat-message-history.d.ts +0 -73
  413. package/dist/history/chat-message-history.js +0 -111
  414. package/dist/history/internal/append-saga.d.ts +0 -25
  415. package/dist/history/internal/append-saga.js +0 -79
  416. package/dist/history/internal/compensation.d.ts +0 -25
  417. package/dist/history/internal/compensation.js +0 -92
  418. package/dist/history/internal/item-mapper.d.ts +0 -9
  419. package/dist/history/internal/item-mapper.js +0 -27
  420. package/dist/history/internal/keys.d.ts +0 -16
  421. package/dist/history/internal/keys.js +0 -48
  422. package/dist/history/internal/message-chunker.d.ts +0 -13
  423. package/dist/history/internal/message-chunker.js +0 -67
  424. package/dist/history/internal/message-transaction.d.ts +0 -25
  425. package/dist/history/internal/message-transaction.js +0 -61
  426. package/dist/history/internal/message-window.d.ts +0 -17
  427. package/dist/history/internal/message-window.js +0 -49
  428. package/dist/history/internal/query.d.ts +0 -23
  429. package/dist/history/internal/query.js +0 -39
  430. package/dist/history/internal/session-count.d.ts +0 -47
  431. package/dist/history/internal/session-count.js +0 -115
  432. package/dist/history/internal/session-title.d.ts +0 -19
  433. package/dist/history/internal/session-title.js +0 -43
  434. package/dist/history/internal/session-update.d.ts +0 -27
  435. package/dist/history/internal/session-update.js +0 -69
  436. package/dist/history/internal/setup.d.ts +0 -31
  437. package/dist/history/internal/setup.js +0 -43
  438. package/dist/history/internal/title-generator.d.ts +0 -12
  439. package/dist/history/internal/title-generator.js +0 -41
  440. package/dist/history/internal/ttl-anchor.d.ts +0 -24
  441. package/dist/history/internal/ttl-anchor.js +0 -38
  442. package/dist/history/internal/validation.d.ts +0 -25
  443. package/dist/history/internal/validation.js +0 -53
  444. package/dist/history/session-adapter.d.ts +0 -29
  445. package/dist/history/session-adapter.js +0 -35
  446. package/dist/history/types.d.ts +0 -69
  447. package/dist/index.d.ts +0 -29
  448. package/dist/index.js +0 -32
  449. package/dist/shared/clock.d.ts +0 -8
  450. package/dist/shared/clock.js +0 -16
  451. package/dist/shared/codec/codec.d.ts +0 -53
  452. package/dist/shared/codec/codec.js +0 -66
  453. package/dist/shared/codec/compression.d.ts +0 -24
  454. package/dist/shared/codec/compression.js +0 -48
  455. package/dist/shared/codec/descriptor-keys.d.ts +0 -12
  456. package/dist/shared/codec/descriptor-keys.js +0 -14
  457. package/dist/shared/codec/encode.d.ts +0 -13
  458. package/dist/shared/codec/encode.js +0 -43
  459. package/dist/shared/codec/json-serde.d.ts +0 -7
  460. package/dist/shared/codec/json-serde.js +0 -17
  461. package/dist/shared/codec/payload-loss.d.ts +0 -12
  462. package/dist/shared/codec/payload-loss.js +0 -38
  463. package/dist/shared/codec/s3/adapter-config.d.ts +0 -13
  464. package/dist/shared/codec/s3/adapter-config.js +0 -22
  465. package/dist/shared/codec/s3/bounded-body.d.ts +0 -14
  466. package/dist/shared/codec/s3/bounded-body.js +0 -47
  467. package/dist/shared/codec/s3/client.d.ts +0 -18
  468. package/dist/shared/codec/s3/client.js +0 -46
  469. package/dist/shared/codec/s3/config.d.ts +0 -51
  470. package/dist/shared/codec/s3/config.js +0 -58
  471. package/dist/shared/codec/s3/delete.d.ts +0 -7
  472. package/dist/shared/codec/s3/delete.js +0 -28
  473. package/dist/shared/codec/s3/key-scope.d.ts +0 -23
  474. package/dist/shared/codec/s3/key-scope.js +0 -44
  475. package/dist/shared/codec/s3/lifecycle.d.ts +0 -14
  476. package/dist/shared/codec/s3/lifecycle.js +0 -63
  477. package/dist/shared/codec/s3/offloader.d.ts +0 -44
  478. package/dist/shared/codec/s3/offloader.js +0 -118
  479. package/dist/shared/codec/s3/orphans.d.ts +0 -23
  480. package/dist/shared/codec/s3/orphans.js +0 -71
  481. package/dist/shared/codec/s3/read-write.d.ts +0 -18
  482. package/dist/shared/codec/s3/read-write.js +0 -51
  483. package/dist/shared/codec/s3/retry.d.ts +0 -5
  484. package/dist/shared/codec/s3/retry.js +0 -22
  485. package/dist/shared/concurrency.d.ts +0 -6
  486. package/dist/shared/constants.d.ts +0 -112
  487. package/dist/shared/constants.js +0 -115
  488. package/dist/shared/dynamodb/abort.d.ts +0 -9
  489. package/dist/shared/dynamodb/abort.js +0 -27
  490. package/dist/shared/dynamodb/backoff.d.ts +0 -15
  491. package/dist/shared/dynamodb/backoff.js +0 -48
  492. package/dist/shared/dynamodb/batch-write.d.ts +0 -22
  493. package/dist/shared/dynamodb/batch-write.js +0 -53
  494. package/dist/shared/dynamodb/cancellation.d.ts +0 -6
  495. package/dist/shared/dynamodb/cancellation.js +0 -7
  496. package/dist/shared/dynamodb/client.d.ts +0 -28
  497. package/dist/shared/dynamodb/conditional-put.d.ts +0 -67
  498. package/dist/shared/dynamodb/conditional-put.js +0 -76
  499. package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -21
  500. package/dist/shared/dynamodb/drain-unprocessed.js +0 -43
  501. package/dist/shared/dynamodb/expiry.d.ts +0 -16
  502. package/dist/shared/dynamodb/expiry.js +0 -29
  503. package/dist/shared/dynamodb/paginate-core.d.ts +0 -24
  504. package/dist/shared/dynamodb/paginate-core.js +0 -82
  505. package/dist/shared/dynamodb/paginate.d.ts +0 -14
  506. package/dist/shared/dynamodb/paginate.js +0 -19
  507. package/dist/shared/dynamodb/partition-delete.d.ts +0 -39
  508. package/dist/shared/dynamodb/partition-delete.js +0 -71
  509. package/dist/shared/dynamodb/retry-classifier.d.ts +0 -17
  510. package/dist/shared/dynamodb/retry-classifier.js +0 -118
  511. package/dist/shared/dynamodb/retry-policy.d.ts +0 -26
  512. package/dist/shared/dynamodb/retry-policy.js +0 -22
  513. package/dist/shared/dynamodb/retry.d.ts +0 -31
  514. package/dist/shared/dynamodb/retry.js +0 -57
  515. package/dist/shared/dynamodb/scan.d.ts +0 -14
  516. package/dist/shared/dynamodb/scan.js +0 -19
  517. package/dist/shared/dynamodb/types.d.ts +0 -23
  518. package/dist/shared/errors/base-error.d.ts +0 -30
  519. package/dist/shared/errors/base-error.js +0 -27
  520. package/dist/shared/errors/boundary.d.ts +0 -18
  521. package/dist/shared/errors/boundary.js +0 -46
  522. package/dist/shared/errors/error-code.d.ts +0 -13
  523. package/dist/shared/errors/errors.d.ts +0 -68
  524. package/dist/shared/errors/errors.js +0 -114
  525. package/dist/shared/errors/upstream-error.d.ts +0 -16
  526. package/dist/shared/errors/upstream-error.js +0 -27
  527. package/dist/shared/errors/wrap-error.d.ts +0 -7
  528. package/dist/shared/errors/wrap-error.js +0 -15
  529. package/dist/shared/logging/logger.d.ts +0 -18
  530. package/dist/shared/logging/logger.js +0 -15
  531. package/dist/shared/logging/redaction-walk.d.ts +0 -23
  532. package/dist/shared/logging/redaction-walk.js +0 -112
  533. package/dist/shared/logging/redaction.d.ts +0 -39
  534. package/dist/shared/logging/redaction.js +0 -75
  535. package/dist/shared/logging/secret-patterns.d.ts +0 -92
  536. package/dist/shared/logging/secret-patterns.js +0 -133
  537. package/dist/shared/options.d.ts +0 -37
  538. package/dist/shared/ulid.d.ts +0 -23
  539. package/dist/shared/validation/options.d.ts +0 -8
  540. package/dist/shared/validation/options.js +0 -90
  541. package/dist/shared/validation/primitives.d.ts +0 -29
  542. package/dist/shared/validation/primitives.js +0 -82
  543. package/dist/shared/validation/ttl.d.ts +0 -28
  544. package/dist/shared/validation/ttl.js +0 -52
  545. package/dist/store/actions/get.d.ts +0 -13
  546. package/dist/store/actions/get.js +0 -73
  547. package/dist/store/actions/list-namespaces.d.ts +0 -8
  548. package/dist/store/actions/list-namespaces.js +0 -59
  549. package/dist/store/actions/put.d.ts +0 -10
  550. package/dist/store/actions/put.js +0 -96
  551. package/dist/store/actions/reconcile-vector-index.d.ts +0 -18
  552. package/dist/store/actions/reconcile-vector-index.js +0 -26
  553. package/dist/store/actions/search.d.ts +0 -9
  554. package/dist/store/actions/search.js +0 -34
  555. package/dist/store/internal/backend-search.d.ts +0 -4
  556. package/dist/store/internal/backend-search.js +0 -74
  557. package/dist/store/internal/batch-plan.d.ts +0 -11
  558. package/dist/store/internal/batch-plan.js +0 -52
  559. package/dist/store/internal/candidates.d.ts +0 -23
  560. package/dist/store/internal/candidates.js +0 -94
  561. package/dist/store/internal/filter.d.ts +0 -9
  562. package/dist/store/internal/filter.js +0 -85
  563. package/dist/store/internal/index-reconcile.d.ts +0 -21
  564. package/dist/store/internal/index-reconcile.js +0 -118
  565. package/dist/store/internal/index-sync.d.ts +0 -10
  566. package/dist/store/internal/index-sync.js +0 -25
  567. package/dist/store/internal/item-mapper.d.ts +0 -27
  568. package/dist/store/internal/item-mapper.js +0 -61
  569. package/dist/store/internal/keys.d.ts +0 -17
  570. package/dist/store/internal/keys.js +0 -41
  571. package/dist/store/internal/namespace-match.d.ts +0 -11
  572. package/dist/store/internal/namespace-match.js +0 -40
  573. package/dist/store/internal/option-validation.d.ts +0 -13
  574. package/dist/store/internal/option-validation.js +0 -77
  575. package/dist/store/internal/overwrite-swap.d.ts +0 -32
  576. package/dist/store/internal/overwrite-swap.js +0 -68
  577. package/dist/store/internal/persist.d.ts +0 -28
  578. package/dist/store/internal/persist.js +0 -64
  579. package/dist/store/internal/query.d.ts +0 -11
  580. package/dist/store/internal/query.js +0 -48
  581. package/dist/store/internal/ranker.d.ts +0 -18
  582. package/dist/store/internal/ranker.js +0 -39
  583. package/dist/store/internal/read-existing.d.ts +0 -23
  584. package/dist/store/internal/read-existing.js +0 -41
  585. package/dist/store/internal/score-direction.d.ts +0 -31
  586. package/dist/store/internal/score-direction.js +0 -38
  587. package/dist/store/internal/search-filter.d.ts +0 -3
  588. package/dist/store/internal/search-filter.js +0 -10
  589. package/dist/store/internal/semantic-search.d.ts +0 -34
  590. package/dist/store/internal/semantic-search.js +0 -87
  591. package/dist/store/internal/setup.d.ts +0 -36
  592. package/dist/store/internal/setup.js +0 -40
  593. package/dist/store/internal/text-path.d.ts +0 -17
  594. package/dist/store/internal/validation.d.ts +0 -18
  595. package/dist/store/internal/validation.js +0 -51
  596. package/dist/store/internal/write-verify.d.ts +0 -42
  597. package/dist/store/internal/write-verify.js +0 -71
  598. package/dist/store/store.d.ts +0 -61
  599. package/dist/store/store.js +0 -107
  600. package/dist/store/types.d.ts +0 -50
  601. package/dist/store/types.js +0 -2
  602. package/dist/store/vector-backend.d.ts +0 -43
  603. package/dist/store/vector-backend.js +0 -2
  604. /package/dist/{checkpointer → cjs/checkpointer}/types.js +0 -0
  605. /package/dist/{factory → cjs/factory}/types.js +0 -0
  606. /package/dist/{history → cjs/history}/types.js +0 -0
  607. /package/dist/{shared → cjs/shared}/options.js +0 -0
  608. /package/dist/{shared/dynamodb → cjs/store}/types.js +0 -0
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reconcileMessageCount = reconcileMessageCount;
4
+ const parse_js_1 = require("../internal/parse.js");
5
+ const session_js_1 = require("../internal/session.js");
6
+ async function reconcileMessageCount(context, sessionId, signal) {
7
+ return (0, session_js_1.repairMessageCount)(context, (0, parse_js_1.parseSessionId)(sessionId), signal);
8
+ }
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Hides that chat history is a set of actions behind one error boundary.
3
+ *
4
+ * The public class holds only what it resolved from its options and routes
5
+ * each read and write to the action that implements it, through
6
+ * `guardPublic`. Every method is the error boundary, so no error but the
7
+ * library's own reaches a caller (record 13) — an asynchronous one through
8
+ * `guardPublic`, and the synchronous `destroy` and `forSession` through
9
+ * `guardPublicSync`; `forSession` is also the one route from it to
10
+ * LangChain's single-session history. Where an action lives, how it reads or
11
+ * writes, and which client or offloader it uses can change without touching
12
+ * this surface.
13
+ */
14
+ import type { BaseMessage } from '@langchain/core/messages';
15
+ import type { CancelOptions } from '../shared/options.js';
16
+ import { type AdapterWindow, DynamoDBSessionChatMessageHistory } from './session-adapter.js';
17
+ import type { DynamoDBChatMessageHistoryOptions, GetMessagesOptions, ListSessionsOptions, SessionPage } from './types.js';
18
+ /**
19
+ * DynamoDB-backed multi-session chat history. Each message is its own row,
20
+ * ordered by when it was appended, beside one metadata row per session, and
21
+ * every message in a session shares one TTL. An append costs the same however
22
+ * long the session is and takes no lock. Use {@link forSession} to get a
23
+ * single-session LangChain adapter. Every public method rejects only with this
24
+ * library's error.
25
+ */
26
+ export declare class DynamoDBChatMessageHistory {
27
+ private readonly context;
28
+ private readonly shell;
29
+ /**
30
+ * Accepts: `options` — validated here, so a misconfiguration surfaces at
31
+ * construction rather than on the first request.
32
+ *
33
+ * Returns: an adapter that owns the client it built, or borrows the one it
34
+ * was given.
35
+ *
36
+ * Throws: `VALIDATION` naming the offending option.
37
+ *
38
+ * Guarantees: no I/O. Constructing the adapter issues no request.
39
+ */
40
+ constructor(options: DynamoDBChatMessageHistoryOptions);
41
+ /**
42
+ * Get a session's messages in chronological order.
43
+ *
44
+ * Accepts: `sessionId` — validated. `options.limit` — an integer from 1 to
45
+ * 10,000; only the newest that many messages. `0` is
46
+ * refused rather than answered with an empty conversation, which is the one
47
+ * place this package refuses a `limit` of zero. `options.before` — a valid
48
+ * `Date`; only messages appended before that instant. Neither given reads
49
+ * the whole session. `options.signal` — aborts the reads.
50
+ *
51
+ * Returns: the messages, oldest first. A session that does not exist and one
52
+ * whose messages have all expired both return nothing.
53
+ *
54
+ * Throws: `VALIDATION` for a malformed session id or window, an invalid
55
+ * `signal`, or naming `options.<key>` for a key this package does not read;
56
+ * `VALIDATION` naming `s3Key` for a row addressing an object outside the
57
+ * session's own path, and naming `message` for a row in this session's
58
+ * message key space that this adapter did not write, both whatever the
59
+ * corruption policy;
60
+ * `COMPRESSION_LIMIT` for a payload larger than this reader's
61
+ * `compression.maxDecompressedBytes`, whatever the corruption policy too;
62
+ * `FORMAT_UNSUPPORTED` for a row, or a payload, a newer release wrote;
63
+ * a classified AWS failure;
64
+ * `ABORTED`; and, under `onCorruptMessage: 'throw'`, the decode error of a
65
+ * corrupt row.
66
+ *
67
+ * Guarantees: strongly consistent, so the turn just appended is visible.
68
+ * Expired messages are filtered on read, so the history is never stale.
69
+ * @remarks One query page plus one S3 download per offloaded message.
70
+ */
71
+ getMessages(sessionId: string, options?: GetMessagesOptions): Promise<BaseMessage[]>;
72
+ /**
73
+ * Append messages to a session.
74
+ *
75
+ * Accepts: `sessionId` — validated. `messages` — LangChain messages; an empty
76
+ * list writes nothing and is not an error. `options.signal` — ends the
77
+ * upload or chunk transaction in flight and any wait between them; a chunk
78
+ * that landed before the cancel is rolled back like any other committed
79
+ * chunk of a failed append.
80
+ *
81
+ * Returns: nothing, and only once every message has landed.
82
+ *
83
+ * Throws: `VALIDATION` naming `messages`, for a value that is not itself
84
+ * an array, or, with the offending index, for an element that is not a
85
+ * message or one that could never be read back; naming `payload` for a
86
+ * message too large to store inline without `s3`, or, once offloaded,
87
+ * larger than `s3.maxDownloadBytes`; naming `s3Key` for an offloaded
88
+ * object's key over S3's cap; or naming `signal` or `options.<key>` for a
89
+ * key this package does not read; `S3_OFFLOAD_FAILED` when an offloaded
90
+ * message cannot be uploaded;
91
+ * `COMPENSATION_FAILED` when a chunk fails and either the rollback fails
92
+ * too or that chunk's own outcome could not be established;
93
+ * `RETRY_EXHAUSTED` after 18 contended attempts; a classified AWS failure;
94
+ * `ABORTED`.
95
+ *
96
+ * Guarantees: a caller observes all messages or none — except the one
97
+ * chunk a failed call could not settle: an `ABORTED` append whose in-flight
98
+ * chunk commits after the call returns, or a `COMPENSATION_FAILED` append
99
+ * whose failing chunk's own outcome could not be established. Read the
100
+ * session back before deciding whether to resend those messages. One
101
+ * transaction per chunk of up to 99 keeps `messageCount` exact. Lock-free
102
+ * and safe under concurrent appends to one session; every message shares
103
+ * the session's TTL when one is configured.
104
+ */
105
+ addMessages(sessionId: string, messages: BaseMessage[], options?: CancelOptions): Promise<void>;
106
+ /**
107
+ * Append one message.
108
+ *
109
+ * Accepts: as {@link addMessages}, for a single message.
110
+ *
111
+ * Returns: nothing.
112
+ *
113
+ * Throws: as {@link addMessages}.
114
+ */
115
+ addMessage(sessionId: string, message: BaseMessage, options?: CancelOptions): Promise<void>;
116
+ /**
117
+ * Delete a session's messages, metadata and offloaded objects.
118
+ *
119
+ * Accepts: `sessionId` — validated. `options.signal` — ends the read or
120
+ * delete in flight and any wait between them; rows already deleted stay
121
+ * deleted.
122
+ *
123
+ * Returns: nothing. Clearing a session that does not exist is not an error.
124
+ *
125
+ * Throws: `VALIDATION` for a malformed session id, an invalid `signal`,
126
+ * or an `options.<key>` this package does not read;
127
+ * `BATCH_WRITE_INCOMPLETE` when a row's delete fails, counting rows
128
+ * rather than batches; a classified AWS failure; `ABORTED` when the signal fires,
129
+ * which is what a cancel surfaces as rather than an incomplete delete, even
130
+ * when it fires part-way through the pass. A row refused because it
131
+ * was rewritten after the partition read raises nothing: it is left in place,
132
+ * reported at `warn`, and counted as skipped.
133
+ *
134
+ * Guarantees: a row this adapter did not write is left in place and logged,
135
+ * and neither is a row rewritten since the read — an append landing during
136
+ * the call moves the session row's own write id, so that row survives with
137
+ * the session it belongs to instead of being removed under a live
138
+ * conversation. Single pass: call it when the session is quiescent, since a
139
+ * message appended while it runs may survive it, and the surviving session
140
+ * row then over-counts until `reconcileMessageCount` repairs it.
141
+ */
142
+ clear(sessionId: string, options?: CancelOptions): Promise<void>;
143
+ /**
144
+ * List every session as a metadata summary, most recently updated first.
145
+ * With a configured `indexName` this reads each index shard newest-first,
146
+ * merges the shards and pages by the opaque `nextCursor`. Without one it
147
+ * falls back to a filtered table scan — cross-tenant by construction,
148
+ * bounded by `maxItems` / `maxIterations`, and returning the newest `limit`
149
+ * sessions, or every session when no limit is given, with no cursor.
150
+ *
151
+ * Accepts: `options.limit` — an integer from 0 to 10,000;
152
+ * the page size with the index, the newest N without it, and `0` an empty
153
+ * page read from neither. `options.cursor` — from a previous page,
154
+ * and only with a configured `indexName`. `options.maxItems` /
155
+ * `maxIterations` — caps on the scan path. `options.signal` — aborts the
156
+ * reads.
157
+ *
158
+ * Returns: the page and, while rows may remain, a `nextCursor`. A page may
159
+ * come back shorter than `limit` while more rows remain: expired and foreign
160
+ * rows are dropped after the read. A cursor does not promise more rows:
161
+ * DynamoDB can end a shard's page at its last row and still return a key to
162
+ * continue from, and the page after such a cursor can come back empty. Stop
163
+ * when `nextCursor` is absent, never when a page looks short.
164
+ *
165
+ * Throws: `VALIDATION` naming `limit`, `cursor`, `maxItems`,
166
+ * `maxIterations`, `signal`, or `options.<key>` for a key this package does
167
+ * not read; `RESULT_TRUNCATED` past either cap on the scan path, or for an
168
+ * index shard whose pages do not end; `FORMAT_UNSUPPORTED` for a session row
169
+ * a newer release wrote; a classified AWS failure; `ABORTED`.
170
+ *
171
+ * Guarantees: with a configured `indexName` each shard is read one DynamoDB
172
+ * page at a time, and its next page whenever it has no row buffered and the
173
+ * page still needs one, so a shard can cost a query whose rows the page never
174
+ * takes; at most `readConcurrency` shards are queried at once. Memory is the
175
+ * page being built, up to `limit` rows and so bounded by
176
+ * 10,000, plus at most one DynamoDB page per shard,
177
+ * whatever the table holds.
178
+ */
179
+ listSessions(options?: ListSessionsOptions): Promise<SessionPage>;
180
+ /**
181
+ * Recompute and repair a session's `messageCount` from the stored messages.
182
+ * A maintenance tool for external corruption; run it when the session is idle.
183
+ *
184
+ * Accepts: `sessionId` — validated, and an existing session.
185
+ * `options.signal` — aborts the reads.
186
+ *
187
+ * Returns: the count now stored: the session's live message rows, which is
188
+ * what `getMessages` returns, except for a row it drops as corrupt under
189
+ * `onCorruptMessage: 'skip'`, which is counted here all the same.
190
+ *
191
+ * Throws: `VALIDATION` for a malformed session id, an invalid `signal`,
192
+ * or an `options.<key>` this package does not read; `CONDITION_CONFLICT` when the
193
+ * session does not exist or stayed busy through every attempt;
194
+ * `FORMAT_UNSUPPORTED` for a message row a newer release wrote, and
195
+ * `VALIDATION` naming `message` for a row in the session's message key
196
+ * space that this adapter did not write, both of which `getMessages` refuses
197
+ * too — a count is a repair only while it agrees with the read;
198
+ * a classified AWS failure; `ABORTED`.
199
+ *
200
+ * Guarantees: safe on a live session — the write is pinned to the value the
201
+ * row held when the count was computed, so a concurrent append makes it
202
+ * recount instead of clobbering the increment.
203
+ */
204
+ reconcileMessageCount(sessionId: string, options?: CancelOptions): Promise<number>;
205
+ /**
206
+ * Get a single-session LangChain adapter for `sessionId`.
207
+ *
208
+ * Accepts: `sessionId` — validated by the adapter's own constructor, the
209
+ * same rule every other method applies. `window.limit` — bounds what the
210
+ * adapter feeds the chain to the newest that many messages; validated the
211
+ * same way.
212
+ *
213
+ * Returns: an adapter implementing `BaseListChatMessageHistory`, which is
214
+ * what `RunnableWithMessageHistory` takes.
215
+ *
216
+ * Throws: `VALIDATION` naming `sessionId`, `window` for a window that is
217
+ * not an object, `window.<key>` for a key the adapter does not declare, or
218
+ * `limit` — raised by the constructed adapter, so a bad id or window fails
219
+ * here rather than on first use.
220
+ */
221
+ forSession(sessionId: string, window?: AdapterWindow): DynamoDBSessionChatMessageHistory;
222
+ /**
223
+ * Release owned resources.
224
+ *
225
+ * Accepts: nothing.
226
+ *
227
+ * Returns: nothing. Idempotent, and a no-op for a client the caller injected
228
+ * — that one is theirs to close.
229
+ *
230
+ * Throws: the first failure a resource's own `destroy` raised, as a
231
+ * `DynamoDBLangGraphError` (`UNEXPECTED_ERROR` unless the failure was AWS's)
232
+ * with it as `cause` — raised only after every other resource has been
233
+ * released, and only by the first call: `destroy()` is idempotent.
234
+ */
235
+ destroy(): void;
236
+ /**
237
+ * Provision an S3 lifecycle expiration rule matching the configured TTL, so
238
+ * offloaded objects don't outlive their DynamoDB item forever.
239
+ *
240
+ * Accepts: nothing; the rule follows the configured `s3` and `ttl`. A no-op
241
+ * without both.
242
+ *
243
+ * Returns: nothing. Installing a rule that is already there is a no-op too.
244
+ * When it writes the rules but cannot confirm within its polling window
245
+ * that a re-read shows them — S3 documents that a lifecycle configuration
246
+ * can take minutes to propagate — it logs a `warn` and returns rather than
247
+ * throwing: the rules were written, and a later call can confirm them.
248
+ *
249
+ * Throws: `VALIDATION` naming `s3.keyPrefix` on a rule-id collision;
250
+ * a classified AWS failure when the bucket's lifecycle cannot be read or
251
+ * written; `CONTENTION` when every one of the five rounds this call polls
252
+ * needs a write — a competing writer replacing the configuration on every
253
+ * single re-read.
254
+ * @remarks Requires the bucket-level `s3:GetLifecycleConfiguration` /
255
+ * `s3:PutLifecycleConfiguration` permissions, broader than the object-level
256
+ * CRUD the rest of S3 offload needs — call it once during provisioning, not
257
+ * per request. When several adapters or processes provision the same
258
+ * bucket, call them one at a time and run each again after a few minutes
259
+ * once every one of them has run.
260
+ *
261
+ * Lowering the `ttl` is safe for new rows at once; the rule is not. Lower
262
+ * `ttl` now, and call this again only once the old `ttl` has elapsed since,
263
+ * because until then rows written under the old value still name objects
264
+ * the shorter rule would expire. Raising the `ttl` is safe at once.
265
+ */
266
+ ensureS3LifecycleRule(): Promise<void>;
267
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoDBChatMessageHistory = void 0;
4
+ const boundary_js_1 = require("../shared/errors/boundary.js");
5
+ const collaborators_js_1 = require("../shared/validation/collaborators.js");
6
+ const add_messages_js_1 = require("./actions/add-messages.js");
7
+ const clear_js_1 = require("./actions/clear.js");
8
+ const get_messages_js_1 = require("./actions/get-messages.js");
9
+ const list_sessions_js_1 = require("./actions/list-sessions.js");
10
+ const reconcile_count_js_1 = require("./actions/reconcile-count.js");
11
+ const setup_js_1 = require("./internal/setup.js");
12
+ const session_adapter_js_1 = require("./session-adapter.js");
13
+ class DynamoDBChatMessageHistory {
14
+ context;
15
+ shell;
16
+ constructor(options) {
17
+ const setup = (0, setup_js_1.setUpHistory)(options);
18
+ this.context = setup.context;
19
+ this.shell = setup.shell;
20
+ }
21
+ getMessages(sessionId, options) {
22
+ return (0, boundary_js_1.guardPublic)('history.getMessages', () => (0, get_messages_js_1.getMessages)(this.context, sessionId, options), this.context.tableName);
23
+ }
24
+ addMessages(sessionId, messages, options) {
25
+ return (0, boundary_js_1.guardPublic)('history.addMessages', () => {
26
+ (0, collaborators_js_1.assertCancelOptions)(options);
27
+ return (0, add_messages_js_1.addMessages)(this.context, sessionId, messages, options?.signal);
28
+ }, this.context.tableName);
29
+ }
30
+ addMessage(sessionId, message, options) {
31
+ return (0, boundary_js_1.guardPublic)('history.addMessage', () => {
32
+ (0, collaborators_js_1.assertCancelOptions)(options);
33
+ return (0, add_messages_js_1.addMessages)(this.context, sessionId, [message], options?.signal);
34
+ }, this.context.tableName);
35
+ }
36
+ clear(sessionId, options) {
37
+ return (0, boundary_js_1.guardPublic)('history.clear', () => {
38
+ (0, collaborators_js_1.assertCancelOptions)(options);
39
+ return (0, clear_js_1.clearSession)(this.context, sessionId, options);
40
+ }, this.context.tableName);
41
+ }
42
+ listSessions(options) {
43
+ return (0, boundary_js_1.guardPublic)('history.listSessions', () => (0, list_sessions_js_1.listSessions)(this.context, options), this.context.tableName);
44
+ }
45
+ reconcileMessageCount(sessionId, options) {
46
+ return (0, boundary_js_1.guardPublic)('history.reconcileMessageCount', () => {
47
+ (0, collaborators_js_1.assertCancelOptions)(options);
48
+ return (0, reconcile_count_js_1.reconcileMessageCount)(this.context, sessionId, options?.signal);
49
+ }, this.context.tableName);
50
+ }
51
+ forSession(sessionId, window) {
52
+ return (0, boundary_js_1.guardPublicSync)('history.forSession', () => new session_adapter_js_1.DynamoDBSessionChatMessageHistory(this, sessionId, window), this.context.tableName);
53
+ }
54
+ destroy() {
55
+ (0, boundary_js_1.guardPublicSync)('history.destroy', () => this.shell.release(), this.context.tableName);
56
+ }
57
+ async ensureS3LifecycleRule() {
58
+ return (0, boundary_js_1.guardPublic)('history.ensureS3LifecycleRule', () => this.shell.ensureLifecycleRule(), this.context.tableName);
59
+ }
60
+ }
61
+ exports.DynamoDBChatMessageHistory = DynamoDBChatMessageHistory;
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Hides how an append of any size commits all-or-nothing, as its caller sees it.
3
+ *
4
+ * One `TransactWriteItems` carries at most a hundred items and four megabytes,
5
+ * so a large append is several transactions, each writing its messages and the
6
+ * SESSION row's update together. When one of them fails the append is rolled
7
+ * back: committed chunks are deleted and their effect on the SESSION row
8
+ * reverted, and each S3 object is released only once no row can name it.
9
+ * Every failure but a refusal is read back before anything is undone, and a
10
+ * chunk that may still commit keeps its objects. This is also the
11
+ * one module that writes a message row, which is what lets a delete pin a
12
+ * message row to the SESSION row's `writeId`.
13
+ */
14
+ import { type RowKey } from '../../shared/dynamodb/table-schema.js';
15
+ import type { SessionId, StorableMessages } from './parse.js';
16
+ import { type MessageRow } from './rows.js';
17
+ import { type SessionUpdateFields, type TtlAnchorResult } from './session.js';
18
+ import { type HistoryContext } from './setup.js';
19
+ /** One append, parsed: the session, its messages in stored form, and the session's ttl anchor. */
20
+ export interface AppendRequest {
21
+ readonly sessionId: SessionId;
22
+ readonly messages: StorableMessages;
23
+ /** The session's creation-anchored ttl, when the adapter has a ttl. */
24
+ readonly anchor: TtlAnchorResult | undefined;
25
+ readonly signal?: AbortSignal;
26
+ }
27
+ /** Shared per-append metadata applied to every chunk's session update. */
28
+ interface AppendFields {
29
+ now: string;
30
+ title?: string;
31
+ ttlTimestamp?: number;
32
+ forceTtlRefresh?: boolean;
33
+ /** The expired anchor the session row carries, which the first chunk starts the session over from. */
34
+ restart?: number;
35
+ }
36
+ /** An append cut into chunks, with the fields every chunk's SESSION update stamps. */
37
+ export interface ChunkedAppend {
38
+ readonly sessionId: SessionId;
39
+ readonly chunks: MessageRow[][];
40
+ readonly fields: AppendFields;
41
+ readonly signal?: AbortSignal;
42
+ }
43
+ /** A chunk that committed, retained so it can be rolled back on a later failure. */
44
+ interface CommittedChunk {
45
+ keys: RowKey[];
46
+ count: number;
47
+ }
48
+ /** How far a failed append got, which decides what its rollback undoes. */
49
+ export interface FailedAppend {
50
+ readonly committed: CommittedChunk[];
51
+ readonly trigger: Error;
52
+ /** True when the failing chunk's own outcome could not be read back. */
53
+ readonly uncertain: boolean;
54
+ /** Why the failing chunk's outcome is unknown: the read-back's own failure, or the write's failure when some attempt of it may still be applied. */
55
+ readonly unsettledBecause?: Error;
56
+ }
57
+ /**
58
+ * Append messages to a session: encode them, cut them into transactions, and
59
+ * commit them all or undo what committed.
60
+ *
61
+ * Accepts: `request` — the parsed session and messages, the ttl anchor, and
62
+ * the caller's signal.
63
+ *
64
+ * Returns: nothing, once every chunk has committed.
65
+ *
66
+ * Throws: the first chunk's failure after the append is rolled back;
67
+ * `COMPENSATION_FAILED` when the rollback itself fails, or when a failing
68
+ * chunk's own outcome could not be established; `ABORTED` when the signal
69
+ * fires, after the same rollback; whatever encoding a message throws, after
70
+ * this call's own uploads are released.
71
+ */
72
+ export declare function appendMessages(context: HistoryContext, request: AppendRequest): Promise<void>;
73
+ /**
74
+ * Undo a failed batch. Always throws. S3 cleanup is split by commit status so
75
+ * no live row is ever left pointing at a deleted object: the never-committed
76
+ * suffix is cleaned immediately, the committed prefix only after its rows are
77
+ * confirmed deleted. If the rollback itself fails, the committed chunks' S3
78
+ * objects are deliberately left in place (their rows may survive) and it
79
+ * raises `COMPENSATION_FAILED` carrying both the trigger and the rollback
80
+ * error. Once the rollback has succeeded, it rethrows the trigger unchanged —
81
+ * unless the failing chunk itself is unsettled and the trigger is not a
82
+ * cancel, in which case it raises `COMPENSATION_FAILED` again, this time
83
+ * carrying `failure.unsettledBecause`: the rollback did not fail, but the
84
+ * session still cannot be called restored while that one chunk's own fate is
85
+ * unknown. A cancel is always reported as the cancel it is.
86
+ *
87
+ * `failure.uncertain` marks the failed chunk
88
+ * (`append.chunks[failure.committed.length]`) as one whose outcome could not be
89
+ * verified: its rows may be live, so its objects are leaked rather than
90
+ * deleted, while the never-attempted chunks after it are still cleaned.
91
+ *
92
+ * Accepts: `append` — the append that failed: its `sessionId`, its `chunks` in
93
+ * order, and the `fields.now` and `fields.title` its first chunk stamped on
94
+ * the session row. `failure.committed` — the chunks known to have landed, in
95
+ * order; empty means the very first chunk failed, and then the only thing to
96
+ * undo is the session row this call may have created. `failure.trigger` — the
97
+ * failure that started this. `failure.uncertain` — see above.
98
+ * `failure.unsettledBecause` — why the failing chunk is unsettled, when it
99
+ * is: the read-back's own failure, or the write's own failure when some
100
+ * attempt of it may still be applied.
101
+ *
102
+ * Returns: never; the declared `Promise<never>` is the contract.
103
+ *
104
+ * Throws: `failure.trigger` when the rollback succeeded and the failing chunk
105
+ * is settled, or is a cancel; `COMPENSATION_FAILED` when the rollback itself
106
+ * failed, carrying both the trigger and the rollback error as
107
+ * `details.rollbackError`; or when the rollback succeeded but the failing
108
+ * chunk is unsettled and the trigger is not a cancel, carrying the trigger
109
+ * and `failure.unsettledBecause` as `details.rollbackError`.
110
+ *
111
+ * Guarantees: an object is deleted only once no row can reference it — the
112
+ * never-committed suffix immediately, the committed prefix only after its rows
113
+ * are confirmed gone, and an unverified chunk never. Storage is leaked in
114
+ * preference to leaving a live row pointing at a deleted object.
115
+ *
116
+ * None of its three log lines can stop it: all three go through
117
+ * {@link reportStep}. Otherwise a throw from the first would skip the S3
118
+ * cleanup, the rollback, the count revert and the rethrow all at once, leaving
119
+ * every committed chunk in the table with `messageCount` still counting it,
120
+ * and handing the caller the logger's own error in place of the failure that
121
+ * started this. Announcing the rollback is not the rollback.
122
+ */
123
+ export declare function compensate(context: HistoryContext, append: ChunkedAppend, failure: FailedAppend): Promise<never>;
124
+ /**
125
+ * Append message chunks with caller-observed atomicity. Each chunk commits its
126
+ * messages and count in one transaction; if a later chunk fails, every
127
+ * already-committed chunk is deleted and its count reverted, and the batch's
128
+ * S3 objects are cleaned once their rows are gone, restoring the pre-call
129
+ * state before the error is rethrown. Except on a failed rollback, or a chunk
130
+ * whose outcome cannot be established (below), which surface as
131
+ * `COMPENSATION_FAILED`; a failed rollback deliberately leaves the committed
132
+ * chunks' S3 objects behind, since their rows may survive.
133
+ *
134
+ * A failure that is not a refusal is ambiguous — the transaction may have
135
+ * committed and lost its response — so the chunk is read back first. Present
136
+ * means it committed. Absent means it did not, unless some attempt of it may
137
+ * still be applied by DynamoDB — one that got no answer, or one DynamoDB
138
+ * answered as still in progress (`TransactionInProgressException`) or with a
139
+ * server error (5xx). A failed read, and that last case, leave the chunk
140
+ * unsettled: its objects are leaked, the rest is rolled back, and the call
141
+ * fails with `COMPENSATION_FAILED`, or with `ABORTED` when the caller
142
+ * cancelled. A chunk that landed although the cancel cut its answer short is
143
+ * rolled back with the rest, and no chunk is sent once the signal has fired.
144
+ *
145
+ * Accepts: `append.sessionId` — the session every chunk writes to.
146
+ * `append.chunks` — in order, each already within the transaction's limits;
147
+ * no chunks is no work and no write. `append.fields` — the session update every
148
+ * chunk carries. `append.signal` — aborts between chunks.
149
+ *
150
+ * Returns: nothing, and only when every chunk is known to have committed.
151
+ *
152
+ * Throws: the first chunk's failure, after the rollback has restored the
153
+ * pre-call state; `COMPENSATION_FAILED` carrying both that failure and the
154
+ * rollback's own, when the rollback could not finish; `COMPENSATION_FAILED`
155
+ * too, carrying the failing chunk's own unsettled reason as
156
+ * `details.rollbackError`, when the rollback succeeded but that chunk's own
157
+ * outcome could not be established; `ABORTED` when the signal fires, after
158
+ * the same rollback.
159
+ *
160
+ * Guarantees: each message's S3 key carries its own ULID, so no two rows of any
161
+ * call can address the same object and the rollback's cleanup can never delete
162
+ * an object a surviving row still points at. What a caller observes is
163
+ * all-or-nothing; what the table holds is all-or-nothing only until a
164
+ * rollback fails, or a failing chunk's own outcome cannot be established,
165
+ * which is why either case is a distinct error and not a rethrow.
166
+ */
167
+ export declare function appendChunks(context: HistoryContext, append: ChunkedAppend): Promise<void>;
168
+ /** Per-call retry seams (injected in tests to keep backoff instant). */
169
+ export interface ChunkRetryOptions {
170
+ rng?: () => number;
171
+ signal?: AbortSignal;
172
+ }
173
+ /**
174
+ * Atomically write a chunk of message items together with the session-metadata
175
+ * count update in one {@link https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html | TransactWriteItems}
176
+ * call, so `messageCount` can never disagree with the messages that landed. A
177
+ * single `ClientRequestToken` is used per attempt so a re-sent commit (e.g.
178
+ * after a lost response) is idempotent and never double-applies the count
179
+ * `ADD`. When `fields.forceTtlRefresh` is set, the session update carries a
180
+ * monotonic ConditionExpression (see session.ts), and when `fields.restart`
181
+ * names an expired anchor it is pinned to that anchor; if — and only if —
182
+ * that condition loses a race against a concurrent caller who just healed or
183
+ * restarted the same session, this retries the identical chunk once with
184
+ * `forceTtlRefresh: false` and no `restart` (safe: `if_not_exists` and `ADD`
185
+ * then converge on whatever already won) rather than losing the message
186
+ * writes to a benign ttl race. A
187
+ * cancellation caused by any other item (a genuine message-row conflict) is
188
+ * not retried here — it propagates for the normal transient-conflict retry
189
+ * budget inside `withDynamoDBRetry` to handle, or to the caller otherwise.
190
+ *
191
+ * Accepts: `items` — one chunk, already within the transaction's limits.
192
+ * `fields` — the session-metadata update accompanying it; its `indexShards` and
193
+ * its `writeId` are taken from the adapter's context, never from the caller.
194
+ * `retry.signal` — aborts between attempts.
195
+ *
196
+ * Returns: nothing. The chunk and the count are committed together or not at
197
+ * all.
198
+ *
199
+ * Throws: whatever the transaction throws — including a
200
+ * `TransactionCanceledException` for a genuine conflict, after the retry budget
201
+ * is spent. The caller compensates; this function never partially succeeds.
202
+ *
203
+ * Guarantees: `messageCount` can never disagree with the messages that landed,
204
+ * because they land in one transaction. At most one extra attempt is spent on
205
+ * the benign ttl race, and it carries its own request token, so a retry can
206
+ * never double-apply the count — and its own deadline of
207
+ * `MAX_WRITE_LIFETIME_MS`, so the retrying stops while that token is
208
+ * still deduplicating rather than after it has expired. The SESSION row's
209
+ * `writeId` moves if and only if a message row was added: the update travels in
210
+ * the same transaction as the rows, and nothing else writes it.
211
+ */
212
+ export declare function writeMessageChunk(context: HistoryContext, items: MessageRow[], fields: Omit<SessionUpdateFields, 'writeId'>, retry?: ChunkRetryOptions): Promise<void>;
213
+ /**
214
+ * Conservatively estimate a message row's stored size.
215
+ *
216
+ * Accepts: any message row, inline or offloaded — an offloaded one measures
217
+ * its S3 key, since that is what the row actually carries.
218
+ *
219
+ * Returns: an estimate at or above the real marshalled size. Erring high is the
220
+ * whole point: an underestimate builds a transaction DynamoDB refuses, and the
221
+ * cost of erring high is one extra transaction.
222
+ *
223
+ * Throws: nothing.
224
+ */
225
+ export declare function estimateRowBytes(item: MessageRow): number;
226
+ /**
227
+ * Split message items into transaction-sized chunks.
228
+ *
229
+ * Accepts: `items` — in order; empty yields no chunks, so an append of nothing
230
+ * issues no write. `maxItems` and `maxBytes` — the transaction's two limits,
231
+ * both binding.
232
+ *
233
+ * Returns: the chunks, in order, each within both limits — except that a single
234
+ * item larger than `maxBytes` is placed alone rather than dropped: refusing it
235
+ * here would lose a message that DynamoDB might still accept, and if it does
236
+ * not, the transaction says so.
237
+ *
238
+ * Throws: nothing.
239
+ *
240
+ * Guarantees: order is preserved across chunks, so messages keep the order the
241
+ * caller wrote them in, which is the order their ULIDs already encode.
242
+ */
243
+ export declare function chunkBySize(items: MessageRow[], maxItems: number, maxBytes: number): MessageRow[][];
244
+ export {};