@farukada/aws-langgraph-dynamodb-ts 0.9.0 → 1.0.0-rc.2
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.
- package/README.md +1720 -154
- package/dist/backfill/backfill.d.ts +168 -0
- package/dist/backfill/backfill.js +393 -0
- package/dist/checkpointer/actions/delete-thread.d.ts +47 -6
- package/dist/checkpointer/actions/delete-thread.js +58 -21
- package/dist/checkpointer/actions/get-tuple.d.ts +29 -4
- package/dist/checkpointer/actions/get-tuple.js +44 -10
- package/dist/checkpointer/actions/list.d.ts +46 -4
- package/dist/checkpointer/actions/list.js +121 -66
- package/dist/checkpointer/actions/put-writes.d.ts +41 -9
- package/dist/checkpointer/actions/put-writes.js +62 -77
- package/dist/checkpointer/actions/put.d.ts +83 -4
- package/dist/checkpointer/actions/put.js +177 -25
- package/dist/checkpointer/internal/delta-history.d.ts +112 -0
- package/dist/checkpointer/internal/delta-history.js +252 -0
- package/dist/checkpointer/internal/listing.d.ts +149 -0
- package/dist/checkpointer/internal/listing.js +245 -0
- package/dist/checkpointer/internal/parse.d.ts +262 -0
- package/dist/checkpointer/internal/parse.js +372 -0
- package/dist/checkpointer/internal/pending-writes.d.ts +275 -0
- package/dist/checkpointer/internal/pending-writes.js +588 -0
- package/dist/checkpointer/internal/read.d.ts +130 -0
- package/dist/checkpointer/internal/read.js +264 -0
- package/dist/checkpointer/internal/rows.d.ts +571 -0
- package/dist/checkpointer/internal/rows.js +834 -0
- package/dist/checkpointer/internal/setup.d.ts +42 -19
- package/dist/checkpointer/internal/setup.js +65 -29
- package/dist/checkpointer/saver.d.ts +256 -16
- package/dist/checkpointer/saver.js +275 -29
- package/dist/checkpointer/types.d.ts +39 -39
- package/dist/checkpointer/types.js +10 -1
- package/dist/factory/factory.d.ts +134 -28
- package/dist/factory/factory.js +240 -21
- package/dist/factory/types.d.ts +76 -0
- package/dist/factory/types.js +10 -0
- package/dist/history/actions/add-messages.d.ts +31 -4
- package/dist/history/actions/add-messages.js +38 -58
- package/dist/history/actions/clear.d.ts +49 -6
- package/dist/history/actions/clear.js +66 -14
- package/dist/history/actions/get-messages.d.ts +54 -6
- package/dist/history/actions/get-messages.js +126 -43
- package/dist/history/actions/list-sessions.d.ts +52 -10
- package/dist/history/actions/list-sessions.js +139 -40
- package/dist/history/actions/reconcile-count.d.ts +42 -10
- package/dist/history/actions/reconcile-count.js +45 -45
- package/dist/history/chat-message-history.d.ts +220 -33
- package/dist/history/chat-message-history.js +240 -43
- package/dist/history/internal/append.d.ts +212 -0
- package/dist/history/internal/append.js +500 -0
- package/dist/history/internal/message-read.d.ts +84 -0
- package/dist/history/internal/message-read.js +204 -0
- package/dist/history/internal/parse.d.ts +153 -0
- package/dist/history/internal/parse.js +252 -0
- package/dist/history/internal/rows.d.ts +195 -0
- package/dist/history/internal/rows.js +250 -0
- package/dist/history/internal/session.d.ts +331 -0
- package/dist/history/internal/session.js +628 -0
- package/dist/history/internal/setup.d.ts +52 -17
- package/dist/history/internal/setup.js +92 -21
- package/dist/history/session-adapter.d.ts +102 -7
- package/dist/history/session-adapter.js +103 -9
- package/dist/history/types.d.ts +80 -29
- package/dist/history/types.js +10 -1
- package/dist/index.d.ts +42 -11
- package/dist/index.js +33 -12
- package/dist/shared/adapter.d.ts +135 -0
- package/dist/shared/adapter.js +143 -0
- package/dist/shared/clock.d.ts +51 -2
- package/dist/shared/clock.js +57 -2
- package/dist/shared/codec/codec.d.ts +288 -13
- package/dist/shared/codec/codec.js +416 -19
- package/dist/shared/codec/compression.d.ts +43 -7
- package/dist/shared/codec/compression.js +53 -13
- package/dist/shared/codec/json-serde.d.ts +76 -4
- package/dist/shared/codec/json-serde.js +181 -8
- package/dist/shared/codec/s3/client-types.d.ts +53 -0
- package/dist/shared/codec/s3/client-types.js +26 -0
- package/dist/shared/codec/s3/client.d.ts +43 -10
- package/dist/shared/codec/s3/client.js +82 -9
- package/dist/shared/codec/s3/config.d.ts +242 -11
- package/dist/shared/codec/s3/config.js +293 -11
- package/dist/shared/codec/s3/lifecycle.d.ts +164 -6
- package/dist/shared/codec/s3/lifecycle.js +335 -27
- package/dist/shared/codec/s3/offloader.d.ts +393 -18
- package/dist/shared/codec/s3/offloader.js +595 -37
- package/dist/shared/concurrency.d.ts +43 -0
- package/dist/shared/concurrency.js +78 -0
- package/dist/shared/dynamodb/abort.d.ts +47 -0
- package/dist/shared/dynamodb/abort.js +59 -0
- package/dist/shared/dynamodb/batch-write.d.ts +77 -14
- package/dist/shared/dynamodb/batch-write.js +146 -27
- package/dist/shared/dynamodb/cancellation.d.ts +121 -4
- package/dist/shared/dynamodb/cancellation.js +147 -3
- package/dist/shared/dynamodb/client.d.ts +162 -8
- package/dist/shared/dynamodb/client.js +153 -5
- package/dist/shared/dynamodb/idempotent-write.d.ts +551 -0
- package/dist/shared/dynamodb/idempotent-write.js +593 -0
- package/dist/shared/dynamodb/paginate.d.ts +105 -9
- package/dist/shared/dynamodb/paginate.js +175 -7
- package/dist/shared/dynamodb/partition-delete.d.ts +185 -14
- package/dist/shared/dynamodb/partition-delete.js +314 -44
- package/dist/shared/dynamodb/recency-index.d.ts +231 -0
- package/dist/shared/dynamodb/recency-index.js +377 -0
- package/dist/shared/dynamodb/retry.d.ts +276 -8
- package/dist/shared/dynamodb/retry.js +433 -23
- package/dist/shared/dynamodb/table-schema.d.ts +190 -0
- package/dist/shared/dynamodb/table-schema.js +209 -0
- package/dist/shared/errors/base-error.d.ts +184 -10
- package/dist/shared/errors/base-error.js +160 -14
- package/dist/shared/errors/boundary.d.ts +71 -0
- package/dist/shared/errors/boundary.js +143 -0
- package/dist/shared/errors/classify.d.ts +97 -0
- package/dist/shared/errors/classify.js +257 -0
- package/dist/shared/errors/error-code.d.ts +77 -2
- package/dist/shared/errors/error-code.js +83 -1
- package/dist/shared/errors/errors.d.ts +158 -59
- package/dist/shared/errors/errors.js +219 -92
- package/dist/shared/logging/logger.d.ts +69 -3
- package/dist/shared/logging/logger.js +97 -3
- package/dist/shared/logging/redaction.d.ts +92 -8
- package/dist/shared/logging/redaction.js +273 -17
- package/dist/shared/logging/secret-patterns.d.ts +149 -19
- package/dist/shared/logging/secret-patterns.js +188 -27
- package/dist/shared/logging/truncate.d.ts +197 -0
- package/dist/shared/logging/truncate.js +231 -0
- package/dist/shared/options.d.ts +59 -7
- package/dist/shared/options.js +9 -1
- package/dist/shared/ulid.d.ts +77 -7
- package/dist/shared/ulid.js +103 -8
- package/dist/shared/validation/collaborators.d.ts +141 -0
- package/dist/shared/validation/collaborators.js +188 -0
- package/dist/shared/validation/option-shape.d.ts +89 -0
- package/dist/shared/validation/option-shape.js +113 -0
- package/dist/shared/validation/options.d.ts +145 -0
- package/dist/shared/validation/options.js +328 -0
- package/dist/shared/validation/primitives.d.ts +288 -21
- package/dist/shared/validation/primitives.js +353 -50
- package/dist/shared/validation/ttl.d.ts +66 -10
- package/dist/shared/validation/ttl.js +113 -15
- package/dist/store/actions/list-namespaces.d.ts +76 -6
- package/dist/store/actions/list-namespaces.js +166 -24
- package/dist/store/actions/put.d.ts +33 -8
- package/dist/store/actions/put.js +53 -60
- package/dist/store/actions/reconcile-vector-index.d.ts +31 -10
- package/dist/store/actions/reconcile-vector-index.js +34 -15
- package/dist/store/actions/search.d.ts +34 -6
- package/dist/store/actions/search.js +56 -51
- package/dist/store/internal/batch-plan.d.ts +26 -0
- package/dist/store/internal/batch-plan.js +109 -0
- package/dist/store/internal/filter.d.ts +36 -3
- package/dist/store/internal/filter.js +66 -15
- package/dist/store/internal/get-item.d.ts +45 -0
- package/dist/store/internal/get-item.js +115 -0
- package/dist/store/internal/item-write.d.ts +230 -0
- package/dist/store/internal/item-write.js +463 -0
- package/dist/store/internal/parse.d.ts +225 -0
- package/dist/store/internal/parse.js +350 -0
- package/dist/store/internal/rows.d.ts +355 -0
- package/dist/store/internal/rows.js +447 -0
- package/dist/store/internal/semantic-search.d.ts +161 -6
- package/dist/store/internal/semantic-search.js +360 -18
- package/dist/store/internal/setup.d.ts +77 -20
- package/dist/store/internal/setup.js +178 -47
- package/dist/store/internal/table-search.d.ts +100 -0
- package/dist/store/internal/table-search.js +213 -0
- package/dist/store/internal/vector-index.d.ts +247 -0
- package/dist/store/internal/vector-index.js +546 -0
- package/dist/store/store.d.ts +270 -17
- package/dist/store/store.js +329 -38
- package/dist/store/types.d.ts +76 -26
- package/dist/store/types.js +13 -1
- package/dist/store/vector-backend.d.ts +64 -4
- package/dist/store/vector-backend.js +15 -1
- package/package.json +58 -36
- package/dist/checkpointer/actions/delete-thread.d.ts.map +0 -1
- package/dist/checkpointer/actions/delete-thread.js.map +0 -1
- package/dist/checkpointer/actions/get-tuple.d.ts.map +0 -1
- package/dist/checkpointer/actions/get-tuple.js.map +0 -1
- package/dist/checkpointer/actions/list.d.ts.map +0 -1
- package/dist/checkpointer/actions/list.js.map +0 -1
- package/dist/checkpointer/actions/put-writes.d.ts.map +0 -1
- package/dist/checkpointer/actions/put-writes.js.map +0 -1
- package/dist/checkpointer/actions/put.d.ts.map +0 -1
- package/dist/checkpointer/actions/put.js.map +0 -1
- package/dist/checkpointer/internal/assemble.d.ts +0 -10
- package/dist/checkpointer/internal/assemble.d.ts.map +0 -1
- package/dist/checkpointer/internal/assemble.js +0 -37
- package/dist/checkpointer/internal/assemble.js.map +0 -1
- package/dist/checkpointer/internal/configurable.d.ts +0 -13
- package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
- package/dist/checkpointer/internal/configurable.js +0 -23
- package/dist/checkpointer/internal/configurable.js.map +0 -1
- package/dist/checkpointer/internal/fetch.d.ts +0 -10
- package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
- package/dist/checkpointer/internal/fetch.js +0 -46
- package/dist/checkpointer/internal/fetch.js.map +0 -1
- package/dist/checkpointer/internal/filter-match.d.ts +0 -12
- package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
- package/dist/checkpointer/internal/filter-match.js +0 -14
- package/dist/checkpointer/internal/filter-match.js.map +0 -1
- package/dist/checkpointer/internal/item-reader.d.ts +0 -55
- package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-reader.js +0 -88
- package/dist/checkpointer/internal/item-reader.js.map +0 -1
- package/dist/checkpointer/internal/item-writer.d.ts +0 -26
- package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-writer.js +0 -92
- package/dist/checkpointer/internal/item-writer.js.map +0 -1
- package/dist/checkpointer/internal/keys.d.ts +0 -31
- package/dist/checkpointer/internal/keys.d.ts.map +0 -1
- package/dist/checkpointer/internal/keys.js +0 -87
- package/dist/checkpointer/internal/keys.js.map +0 -1
- package/dist/checkpointer/internal/query.d.ts +0 -20
- package/dist/checkpointer/internal/query.d.ts.map +0 -1
- package/dist/checkpointer/internal/query.js +0 -36
- package/dist/checkpointer/internal/query.js.map +0 -1
- package/dist/checkpointer/internal/setup.d.ts.map +0 -1
- package/dist/checkpointer/internal/setup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.d.ts +0 -30
- package/dist/checkpointer/internal/special-write-cas.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.js +0 -104
- package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -24
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.js +0 -47
- package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -54
- package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.js +0 -65
- package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
- package/dist/checkpointer/internal/validation.d.ts +0 -13
- package/dist/checkpointer/internal/validation.d.ts.map +0 -1
- package/dist/checkpointer/internal/validation.js +0 -30
- package/dist/checkpointer/internal/validation.js.map +0 -1
- package/dist/checkpointer/internal/write-guard.d.ts +0 -13
- package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-guard.js +0 -39
- package/dist/checkpointer/internal/write-guard.js.map +0 -1
- package/dist/checkpointer/internal/write-index.d.ts +0 -37
- package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-index.js +0 -42
- package/dist/checkpointer/internal/write-index.js.map +0 -1
- package/dist/checkpointer/saver.d.ts.map +0 -1
- package/dist/checkpointer/saver.js.map +0 -1
- package/dist/checkpointer/types.d.ts.map +0 -1
- package/dist/checkpointer/types.js.map +0 -1
- package/dist/factory/factory.d.ts.map +0 -1
- package/dist/factory/factory.js.map +0 -1
- package/dist/history/actions/add-messages.d.ts.map +0 -1
- package/dist/history/actions/add-messages.js.map +0 -1
- package/dist/history/actions/clear.d.ts.map +0 -1
- package/dist/history/actions/clear.js.map +0 -1
- package/dist/history/actions/get-messages.d.ts.map +0 -1
- package/dist/history/actions/get-messages.js.map +0 -1
- package/dist/history/actions/list-sessions.d.ts.map +0 -1
- package/dist/history/actions/list-sessions.js.map +0 -1
- package/dist/history/actions/reconcile-count.d.ts.map +0 -1
- package/dist/history/actions/reconcile-count.js.map +0 -1
- package/dist/history/chat-message-history.d.ts.map +0 -1
- package/dist/history/chat-message-history.js.map +0 -1
- package/dist/history/internal/append-saga.d.ts +0 -20
- package/dist/history/internal/append-saga.d.ts.map +0 -1
- package/dist/history/internal/append-saga.js +0 -35
- package/dist/history/internal/append-saga.js.map +0 -1
- package/dist/history/internal/compensation.d.ts +0 -21
- package/dist/history/internal/compensation.d.ts.map +0 -1
- package/dist/history/internal/compensation.js +0 -84
- package/dist/history/internal/compensation.js.map +0 -1
- package/dist/history/internal/item-mapper.d.ts +0 -12
- package/dist/history/internal/item-mapper.d.ts.map +0 -1
- package/dist/history/internal/item-mapper.js +0 -33
- package/dist/history/internal/item-mapper.js.map +0 -1
- package/dist/history/internal/keys.d.ts +0 -17
- package/dist/history/internal/keys.d.ts.map +0 -1
- package/dist/history/internal/keys.js +0 -49
- package/dist/history/internal/keys.js.map +0 -1
- package/dist/history/internal/message-chunker.d.ts +0 -14
- package/dist/history/internal/message-chunker.d.ts.map +0 -1
- package/dist/history/internal/message-chunker.js +0 -68
- package/dist/history/internal/message-chunker.js.map +0 -1
- package/dist/history/internal/message-transaction.d.ts +0 -26
- package/dist/history/internal/message-transaction.d.ts.map +0 -1
- package/dist/history/internal/message-transaction.js +0 -60
- package/dist/history/internal/message-transaction.js.map +0 -1
- package/dist/history/internal/query.d.ts +0 -10
- package/dist/history/internal/query.d.ts.map +0 -1
- package/dist/history/internal/query.js +0 -31
- package/dist/history/internal/query.js.map +0 -1
- package/dist/history/internal/session-count.d.ts +0 -41
- package/dist/history/internal/session-count.d.ts.map +0 -1
- package/dist/history/internal/session-count.js +0 -109
- package/dist/history/internal/session-count.js.map +0 -1
- package/dist/history/internal/session-title.d.ts +0 -20
- package/dist/history/internal/session-title.d.ts.map +0 -1
- package/dist/history/internal/session-title.js +0 -44
- package/dist/history/internal/session-title.js.map +0 -1
- package/dist/history/internal/session-update.d.ts +0 -28
- package/dist/history/internal/session-update.d.ts.map +0 -1
- package/dist/history/internal/session-update.js +0 -70
- package/dist/history/internal/session-update.js.map +0 -1
- package/dist/history/internal/setup.d.ts.map +0 -1
- package/dist/history/internal/setup.js.map +0 -1
- package/dist/history/internal/title-generator.d.ts +0 -13
- package/dist/history/internal/title-generator.d.ts.map +0 -1
- package/dist/history/internal/title-generator.js +0 -25
- package/dist/history/internal/title-generator.js.map +0 -1
- package/dist/history/internal/ttl-anchor.d.ts +0 -25
- package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
- package/dist/history/internal/ttl-anchor.js +0 -38
- package/dist/history/internal/ttl-anchor.js.map +0 -1
- package/dist/history/internal/validation.d.ts +0 -9
- package/dist/history/internal/validation.d.ts.map +0 -1
- package/dist/history/internal/validation.js +0 -16
- package/dist/history/internal/validation.js.map +0 -1
- package/dist/history/session-adapter.d.ts.map +0 -1
- package/dist/history/session-adapter.js.map +0 -1
- package/dist/history/types.d.ts.map +0 -1
- package/dist/history/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/shared/clock.d.ts.map +0 -1
- package/dist/shared/clock.js.map +0 -1
- package/dist/shared/codec/codec.d.ts.map +0 -1
- package/dist/shared/codec/codec.js.map +0 -1
- package/dist/shared/codec/compression.d.ts.map +0 -1
- package/dist/shared/codec/compression.js.map +0 -1
- package/dist/shared/codec/descriptor-keys.d.ts +0 -4
- package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
- package/dist/shared/codec/descriptor-keys.js +0 -14
- package/dist/shared/codec/descriptor-keys.js.map +0 -1
- package/dist/shared/codec/json-serde.d.ts.map +0 -1
- package/dist/shared/codec/json-serde.js.map +0 -1
- package/dist/shared/codec/s3/client.d.ts.map +0 -1
- package/dist/shared/codec/s3/client.js.map +0 -1
- package/dist/shared/codec/s3/config.d.ts.map +0 -1
- package/dist/shared/codec/s3/config.js.map +0 -1
- package/dist/shared/codec/s3/delete.d.ts +0 -8
- package/dist/shared/codec/s3/delete.d.ts.map +0 -1
- package/dist/shared/codec/s3/delete.js +0 -29
- package/dist/shared/codec/s3/delete.js.map +0 -1
- package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
- package/dist/shared/codec/s3/lifecycle.js.map +0 -1
- package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
- package/dist/shared/codec/s3/offloader.js.map +0 -1
- package/dist/shared/codec/s3/orphans.d.ts +0 -18
- package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
- package/dist/shared/codec/s3/orphans.js +0 -58
- package/dist/shared/codec/s3/orphans.js.map +0 -1
- package/dist/shared/codec/s3/read-write.d.ts +0 -14
- package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
- package/dist/shared/codec/s3/read-write.js +0 -43
- package/dist/shared/codec/s3/read-write.js.map +0 -1
- package/dist/shared/codec/s3/retry.d.ts +0 -5
- package/dist/shared/codec/s3/retry.d.ts.map +0 -1
- package/dist/shared/codec/s3/retry.js +0 -25
- package/dist/shared/codec/s3/retry.js.map +0 -1
- package/dist/shared/constants.d.ts +0 -64
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js +0 -67
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/dynamodb/backoff.d.ts +0 -15
- package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
- package/dist/shared/dynamodb/backoff.js +0 -48
- package/dist/shared/dynamodb/backoff.js.map +0 -1
- package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
- package/dist/shared/dynamodb/batch-write.js.map +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
- package/dist/shared/dynamodb/cancellation.js.map +0 -1
- package/dist/shared/dynamodb/client.d.ts.map +0 -1
- package/dist/shared/dynamodb/client.js.map +0 -1
- package/dist/shared/dynamodb/conditional-put.d.ts +0 -51
- package/dist/shared/dynamodb/conditional-put.d.ts.map +0 -1
- package/dist/shared/dynamodb/conditional-put.js +0 -59
- package/dist/shared/dynamodb/conditional-put.js.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -19
- package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.js +0 -44
- package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
- package/dist/shared/dynamodb/paginate-core.d.ts +0 -22
- package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate-core.js +0 -52
- package/dist/shared/dynamodb/paginate-core.js.map +0 -1
- package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate.js.map +0 -1
- package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
- package/dist/shared/dynamodb/partition-delete.js.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.d.ts +0 -9
- package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.js +0 -87
- package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
- package/dist/shared/dynamodb/retry.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry.js.map +0 -1
- package/dist/shared/dynamodb/scan.d.ts +0 -15
- package/dist/shared/dynamodb/scan.d.ts.map +0 -1
- package/dist/shared/dynamodb/scan.js +0 -20
- package/dist/shared/dynamodb/scan.js.map +0 -1
- package/dist/shared/dynamodb/types.d.ts +0 -24
- package/dist/shared/dynamodb/types.d.ts.map +0 -1
- package/dist/shared/dynamodb/types.js +0 -3
- package/dist/shared/dynamodb/types.js.map +0 -1
- package/dist/shared/errors/base-error.d.ts.map +0 -1
- package/dist/shared/errors/base-error.js.map +0 -1
- package/dist/shared/errors/error-code.d.ts.map +0 -1
- package/dist/shared/errors/error-code.js.map +0 -1
- package/dist/shared/errors/errors.d.ts.map +0 -1
- package/dist/shared/errors/errors.js.map +0 -1
- package/dist/shared/errors/wrap-error.d.ts +0 -16
- package/dist/shared/errors/wrap-error.d.ts.map +0 -1
- package/dist/shared/errors/wrap-error.js +0 -30
- package/dist/shared/errors/wrap-error.js.map +0 -1
- package/dist/shared/logging/logger.d.ts.map +0 -1
- package/dist/shared/logging/logger.js.map +0 -1
- package/dist/shared/logging/redaction-walk.d.ts +0 -23
- package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
- package/dist/shared/logging/redaction-walk.js +0 -92
- package/dist/shared/logging/redaction-walk.js.map +0 -1
- package/dist/shared/logging/redaction.d.ts.map +0 -1
- package/dist/shared/logging/redaction.js.map +0 -1
- package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
- package/dist/shared/logging/secret-patterns.js.map +0 -1
- package/dist/shared/options.d.ts.map +0 -1
- package/dist/shared/options.js.map +0 -1
- package/dist/shared/ulid.d.ts.map +0 -1
- package/dist/shared/ulid.js.map +0 -1
- package/dist/shared/validation/primitives.d.ts.map +0 -1
- package/dist/shared/validation/primitives.js.map +0 -1
- package/dist/shared/validation/ttl.d.ts.map +0 -1
- package/dist/shared/validation/ttl.js.map +0 -1
- package/dist/store/actions/get.d.ts +0 -5
- package/dist/store/actions/get.d.ts.map +0 -1
- package/dist/store/actions/get.js +0 -35
- package/dist/store/actions/get.js.map +0 -1
- package/dist/store/actions/list-namespaces.d.ts.map +0 -1
- package/dist/store/actions/list-namespaces.js.map +0 -1
- package/dist/store/actions/put.d.ts.map +0 -1
- package/dist/store/actions/put.js.map +0 -1
- package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
- package/dist/store/actions/reconcile-vector-index.js.map +0 -1
- package/dist/store/actions/search.d.ts.map +0 -1
- package/dist/store/actions/search.js.map +0 -1
- package/dist/store/internal/backend-search.d.ts +0 -5
- package/dist/store/internal/backend-search.d.ts.map +0 -1
- package/dist/store/internal/backend-search.js +0 -68
- package/dist/store/internal/backend-search.js.map +0 -1
- package/dist/store/internal/filter.d.ts.map +0 -1
- package/dist/store/internal/filter.js.map +0 -1
- package/dist/store/internal/index-reconcile.d.ts +0 -22
- package/dist/store/internal/index-reconcile.d.ts.map +0 -1
- package/dist/store/internal/index-reconcile.js +0 -105
- package/dist/store/internal/index-reconcile.js.map +0 -1
- package/dist/store/internal/index-sync.d.ts +0 -11
- package/dist/store/internal/index-sync.d.ts.map +0 -1
- package/dist/store/internal/index-sync.js +0 -26
- package/dist/store/internal/index-sync.js.map +0 -1
- package/dist/store/internal/item-mapper.d.ts +0 -25
- package/dist/store/internal/item-mapper.d.ts.map +0 -1
- package/dist/store/internal/item-mapper.js +0 -53
- package/dist/store/internal/item-mapper.js.map +0 -1
- package/dist/store/internal/keys.d.ts +0 -18
- package/dist/store/internal/keys.d.ts.map +0 -1
- package/dist/store/internal/keys.js +0 -42
- package/dist/store/internal/keys.js.map +0 -1
- package/dist/store/internal/namespace-match.d.ts +0 -12
- package/dist/store/internal/namespace-match.d.ts.map +0 -1
- package/dist/store/internal/namespace-match.js +0 -41
- package/dist/store/internal/namespace-match.js.map +0 -1
- package/dist/store/internal/overwrite-swap.d.ts +0 -33
- package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
- package/dist/store/internal/overwrite-swap.js +0 -62
- package/dist/store/internal/overwrite-swap.js.map +0 -1
- package/dist/store/internal/persist.d.ts +0 -27
- package/dist/store/internal/persist.d.ts.map +0 -1
- package/dist/store/internal/persist.js +0 -59
- package/dist/store/internal/persist.js.map +0 -1
- package/dist/store/internal/query.d.ts +0 -6
- package/dist/store/internal/query.d.ts.map +0 -1
- package/dist/store/internal/query.js +0 -32
- package/dist/store/internal/query.js.map +0 -1
- package/dist/store/internal/ranker.d.ts +0 -13
- package/dist/store/internal/ranker.d.ts.map +0 -1
- package/dist/store/internal/ranker.js +0 -31
- package/dist/store/internal/ranker.js.map +0 -1
- package/dist/store/internal/read-existing.d.ts +0 -19
- package/dist/store/internal/read-existing.d.ts.map +0 -1
- package/dist/store/internal/read-existing.js +0 -29
- package/dist/store/internal/read-existing.js.map +0 -1
- package/dist/store/internal/score-direction.d.ts +0 -32
- package/dist/store/internal/score-direction.d.ts.map +0 -1
- package/dist/store/internal/score-direction.js +0 -39
- package/dist/store/internal/score-direction.js.map +0 -1
- package/dist/store/internal/search-filter.d.ts +0 -4
- package/dist/store/internal/search-filter.d.ts.map +0 -1
- package/dist/store/internal/search-filter.js +0 -11
- package/dist/store/internal/search-filter.js.map +0 -1
- package/dist/store/internal/semantic-search.d.ts.map +0 -1
- package/dist/store/internal/semantic-search.js.map +0 -1
- package/dist/store/internal/setup.d.ts.map +0 -1
- package/dist/store/internal/setup.js.map +0 -1
- package/dist/store/internal/validation.d.ts +0 -13
- package/dist/store/internal/validation.d.ts.map +0 -1
- package/dist/store/internal/validation.js +0 -35
- package/dist/store/internal/validation.js.map +0 -1
- package/dist/store/internal/write-verify.d.ts +0 -37
- package/dist/store/internal/write-verify.d.ts.map +0 -1
- package/dist/store/internal/write-verify.js +0 -68
- package/dist/store/internal/write-verify.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/types.d.ts.map +0 -1
- package/dist/store/types.js.map +0 -1
- package/dist/store/vector-backend.d.ts.map +0 -1
- package/dist/store/vector-backend.js.map +0 -1
|
@@ -1,63 +1,309 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides the checkpointer's collaborators behind LangGraph's saver contract.
|
|
4
|
+
*
|
|
5
|
+
* `DynamoDBSaver` is the `BaseCheckpointSaver` a graph is handed: it resolves
|
|
6
|
+
* its client, offloader, logger and retry policy once and delegates each
|
|
7
|
+
* read and write to one action, save `getDeltaChannelHistory`, whose walk
|
|
8
|
+
* lives in `internal/delta-history` instead. Each asynchronous method is
|
|
9
|
+
* also the error boundary, so a raw AWS SDK error never reaches a caller
|
|
10
|
+
* unclassified (record 13); `destroy` releases what the saver owns and is
|
|
11
|
+
* the one synchronous exception. Actions can be split, merged or reordered
|
|
12
|
+
* without the public surface moving.
|
|
13
|
+
*/
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.DynamoDBSaver = void 0;
|
|
4
16
|
const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
|
5
|
-
const
|
|
17
|
+
const boundary_1 = require("../shared/errors/boundary");
|
|
18
|
+
const collaborators_1 = require("../shared/validation/collaborators");
|
|
19
|
+
const option_shape_1 = require("../shared/validation/option-shape");
|
|
6
20
|
const delete_thread_1 = require("./actions/delete-thread");
|
|
7
21
|
const get_tuple_1 = require("./actions/get-tuple");
|
|
8
22
|
const list_1 = require("./actions/list");
|
|
9
23
|
const put_1 = require("./actions/put");
|
|
10
24
|
const put_writes_1 = require("./actions/put-writes");
|
|
25
|
+
const delta_history_1 = require("./internal/delta-history");
|
|
26
|
+
const parse_1 = require("./internal/parse");
|
|
11
27
|
const setup_1 = require("./internal/setup");
|
|
12
28
|
/**
|
|
13
|
-
* DynamoDB-backed LangGraph checkpoint saver.
|
|
14
|
-
*
|
|
29
|
+
* DynamoDB-backed LangGraph checkpoint saver. Every public method rejects only
|
|
30
|
+
* with this library's error, whose `code` says what failed — an AWS failure
|
|
31
|
+
* included.
|
|
15
32
|
*/
|
|
16
33
|
class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
|
|
17
34
|
context;
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
shell;
|
|
36
|
+
/**
|
|
37
|
+
* Accepts: `options` — validated here, so a misconfiguration surfaces at
|
|
38
|
+
* construction rather than on the first request. `options.serde` reaches the
|
|
39
|
+
* base class, which is why the resolved `this.serde` is what the context
|
|
40
|
+
* gets.
|
|
41
|
+
*
|
|
42
|
+
* Returns: a saver that owns the client it built, or borrows the one it was
|
|
43
|
+
* given.
|
|
44
|
+
*
|
|
45
|
+
* Throws: `VALIDATION` naming the offending option.
|
|
46
|
+
*
|
|
47
|
+
* Guarantees: no I/O. Constructing a saver issues no request, so it is safe
|
|
48
|
+
* at module scope and in a Lambda's init phase.
|
|
49
|
+
*/
|
|
20
50
|
constructor(options) {
|
|
21
|
-
super(options.serde);
|
|
51
|
+
super((0, option_shape_1.parseShape)(options, setup_1.SAVER_KEYS, 'options').serde);
|
|
22
52
|
const setup = (0, setup_1.setUpCheckpointer)(options, this.serde);
|
|
23
53
|
this.context = setup.context;
|
|
24
|
-
this.
|
|
25
|
-
this.ddbClient = setup.ddbClient;
|
|
54
|
+
this.shell = setup.shell;
|
|
26
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Read one checkpoint with its metadata and pending writes.
|
|
58
|
+
*
|
|
59
|
+
* Accepts: `config` — an object; `config.configurable`, when present, an
|
|
60
|
+
* object too. `config.configurable.checkpoint_id` — names the checkpoint, and
|
|
61
|
+
* `thread_ts` is read in its place when it is absent; the absence of both
|
|
62
|
+
* asks for the newest in the namespace. `checkpoint_ns` defaults to the root
|
|
63
|
+
* namespace. A config naming no `thread_id` is accepted: its other
|
|
64
|
+
* identifiers are still validated. `config.signal` — aborts the reads.
|
|
65
|
+
*
|
|
66
|
+
* Returns: the tuple, or `undefined` for an unknown thread, an unknown
|
|
67
|
+
* checkpoint, a config naming no thread, or a checkpoint whose payload row is
|
|
68
|
+
* not there yet.
|
|
69
|
+
*
|
|
70
|
+
* Throws: `VALIDATION`, before any read, naming `config` for a config that
|
|
71
|
+
* is not an object, `configurable` for a `configurable` that is present and
|
|
72
|
+
* not an object, `signal` for a signal that is not `AbortSignal`-shaped, or
|
|
73
|
+
* `thread_id`, `checkpoint_ns`, `checkpoint_id` or `thread_ts` for a
|
|
74
|
+
* malformed identifier, and — from a row rather than from the call —
|
|
75
|
+
* `descriptor` for a payload descriptor no reader could make sense of, `s3`
|
|
76
|
+
* for an offloaded row with no offloader configured, `s3Key` for a row
|
|
77
|
+
* addressing an object outside the thread's own path, or `serde` for a
|
|
78
|
+
* payload the configured serializer refuses to reconstruct;
|
|
79
|
+
* `FORMAT_UNSUPPORTED` for a row, or a payload, a newer release wrote;
|
|
80
|
+
* `PAYLOAD_CORRUPT` for a payload that is no longer the form its row
|
|
81
|
+
* declares; `S3_OFFLOAD_FAILED` for an offloaded payload that cannot be
|
|
82
|
+
* downloaded; `COMPRESSION_LIMIT` for one whose decompressed size would pass
|
|
83
|
+
* the cap; a classified AWS failure; `RETRY_EXHAUSTED`; `ABORTED`.
|
|
84
|
+
*
|
|
85
|
+
* Guarantees: strongly consistent, so a checkpoint just written is always
|
|
86
|
+
* seen.
|
|
87
|
+
*/
|
|
27
88
|
async getTuple(config) {
|
|
28
|
-
return (0, get_tuple_1.getCheckpointTuple)(this.context, config);
|
|
89
|
+
return (0, boundary_1.guardPublic)('saver.getTuple', () => (0, get_tuple_1.getCheckpointTuple)(this.context, config));
|
|
29
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Stream checkpoints newest first.
|
|
93
|
+
*
|
|
94
|
+
* Accepts: `config` — one namespace, every namespace of a thread when
|
|
95
|
+
* `checkpoint_ns` is omitted, or every thread in the table when `thread_id`
|
|
96
|
+
* is omitted, which is a table scan, or a read of the recency index when
|
|
97
|
+
* `indexName` is set. `options.before`, `options.filter` and
|
|
98
|
+
* `options.limit` follow the reference savers; `limit: 0` yields nothing,
|
|
99
|
+
* and a negative one is refused rather than answered with nothing, so that a
|
|
100
|
+
* page size whose computation went wrong is reported instead of hidden.
|
|
101
|
+
*
|
|
102
|
+
* Returns: an async generator over the tuples. Abandoning it stops the read,
|
|
103
|
+
* so a consumer that breaks early pays for no further page.
|
|
104
|
+
*
|
|
105
|
+
* Throws: `VALIDATION`, raised from the first `.next()`, since a
|
|
106
|
+
* generator runs none of its body until pulled, and before any read: naming
|
|
107
|
+
* `config`, `configurable` or `signal` for a config of the wrong shape, as
|
|
108
|
+
* {@link getTuple} does, or `thread_id`, `checkpoint_ns`, `checkpoint_id` or
|
|
109
|
+
* `thread_ts` for a malformed identifier — all checked before `options`;
|
|
110
|
+
* then `options` for options that are not an object, `options.<key>` for a
|
|
111
|
+
* key this package does not read, `filter` for a filter that is not an
|
|
112
|
+
* object, `limit` for a limit that is not an integer from 0 to
|
|
113
|
+
* `MAX_PAGE_LIMIT` (10,000), and `before` for a `before` that is not an
|
|
114
|
+
* object or whose `configurable.checkpoint_id` is
|
|
115
|
+
* neither absent (`undefined`, `null` or `''`) nor a well-formed checkpoint
|
|
116
|
+
* id. `FORMAT_UNSUPPORTED`; `RESULT_TRUNCATED`, without a `thread_id` and
|
|
117
|
+
* with `indexName`, for an index shard whose pages do not end; a classified AWS failure;
|
|
118
|
+
* `RETRY_EXHAUSTED`; `ABORTED`.
|
|
119
|
+
*
|
|
120
|
+
* Guarantees: eventually consistent — a listing tolerates the replica lag
|
|
121
|
+
* `getTuple` does not.
|
|
122
|
+
* @remarks One read per page — or, without a `thread_id` and with `indexName`,
|
|
123
|
+
* at least one query per index shard per page of 100 rows — plus two per
|
|
124
|
+
* yielded tuple (see the README cost table).
|
|
125
|
+
*/
|
|
30
126
|
list(config, options) {
|
|
31
|
-
return (0, list_1.listCheckpoints)(this.context, config, options);
|
|
127
|
+
return (0, boundary_1.guardPublicIterable)('saver.list', (0, list_1.listCheckpoints)(this.context, config, options));
|
|
32
128
|
}
|
|
33
|
-
|
|
34
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Store a checkpoint and its metadata in one transaction.
|
|
131
|
+
*
|
|
132
|
+
* Accepts: `config` — shaped as {@link getTuple} requires, and naming a
|
|
133
|
+
* `thread_id`. `config.configurable.checkpoint_id` — becomes the new
|
|
134
|
+
* checkpoint's parent. `config.signal` — aborts the write. `checkpoint` —
|
|
135
|
+
* every channel value it carries is stored. `newVersions` — accepted to
|
|
136
|
+
* satisfy `BaseCheckpointSaver.put` and deliberately ignored: LangGraph passes
|
|
137
|
+
* it empty for a fork and for an empty update, so narrowing by it would store
|
|
138
|
+
* nothing for either (decision record 10).
|
|
139
|
+
*
|
|
140
|
+
* Returns: the config addressing the stored checkpoint, which is what the
|
|
141
|
+
* caller passes back to continue the thread.
|
|
142
|
+
*
|
|
143
|
+
* Throws: `VALIDATION` naming `config`, `configurable` or `signal` for a
|
|
144
|
+
* config of the wrong shape, `thread_id` for a missing or malformed thread
|
|
145
|
+
* id, `checkpoint_ns`, `checkpoint_id` or `thread_ts` for a malformed
|
|
146
|
+
* identifier, `checkpoint` for a `null` or `undefined` checkpoint,
|
|
147
|
+
* `checkpoint_id` for a malformed `checkpoint.id`, `payload` for a payload
|
|
148
|
+
* too large to store inline without `s3`, or `s3Key` for an offloaded
|
|
149
|
+
* object's key over S3's cap; `S3_OFFLOAD_FAILED` when an offloaded payload
|
|
150
|
+
* cannot be uploaded; a classified AWS failure; `RETRY_EXHAUSTED`; `ABORTED`.
|
|
151
|
+
*
|
|
152
|
+
* Guarantees: both rows land or neither does. Writing the same
|
|
153
|
+
* `checkpoint.id` again replaces both, so a retry is safe. Each put uploads
|
|
154
|
+
* its offloaded payloads under an id of its own, so the objects the replaced
|
|
155
|
+
* rows named are not deleted with them: they are left to the lifecycle rule
|
|
156
|
+
* `ensureS3LifecycleRule()` provisions.
|
|
157
|
+
*/
|
|
158
|
+
async put(config, checkpoint, metadata, newVersions) {
|
|
159
|
+
return (0, boundary_1.guardPublic)('saver.put', () => (0, put_1.putCheckpoint)(this.context, config, checkpoint, metadata, newVersions));
|
|
35
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Store a task's pending writes for the checkpoint `config` names.
|
|
163
|
+
*
|
|
164
|
+
* Accepts: `config` — shaped as {@link getTuple} requires, naming a
|
|
165
|
+
* `thread_id` and a `checkpoint_id`, since writes attach to a checkpoint.
|
|
166
|
+
* `config.signal` — aborts the writes. `writes` — an array of
|
|
167
|
+
* `[channel, value]` arrays, one row each, written in parallel; an empty list
|
|
168
|
+
* writes nothing. `taskId` — validated as the key segment it becomes.
|
|
169
|
+
*
|
|
170
|
+
* Returns: nothing. Losing a first-write-wins race is a normal outcome, not
|
|
171
|
+
* a failure.
|
|
172
|
+
*
|
|
173
|
+
* Throws: `VALIDATION` naming `taskId` for a malformed task id; `config`,
|
|
174
|
+
* `configurable` or `signal` for a config of the wrong shape; `thread_id`,
|
|
175
|
+
* `checkpoint_ns`, `checkpoint_id` or `thread_ts` for a malformed
|
|
176
|
+
* identifier, and `checkpoint_id` when the config names none; `writes` for
|
|
177
|
+
* writes that is not an array, or holds an entry that is not one; `channel`
|
|
178
|
+
* for a malformed channel; `sortKey` for identifiers composing a sort key
|
|
179
|
+
* over DynamoDB's cap; `payload` for a value too large to store inline
|
|
180
|
+
* without `s3`; or `s3Key` for an offloaded object's key over S3's cap.
|
|
181
|
+
* `S3_OFFLOAD_FAILED`; a classified AWS failure; `RETRY_EXHAUSTED`; `ABORTED`.
|
|
182
|
+
*
|
|
183
|
+
* Guarantees: regular writes are first-write-wins; special channels
|
|
184
|
+
* (`__interrupt__`, `__resume__`, `__error__`, `__scheduled__`) overwrite,
|
|
185
|
+
* with `s3` through a compare-and-swap on the row each call observed, so that
|
|
186
|
+
* each call releases the payload it superseded rather than one a concurrent
|
|
187
|
+
* call already replaced. An offloaded object can still be orphaned and left
|
|
188
|
+
* to the lifecycle rule: when the compare-and-swap is exhausted and the write
|
|
189
|
+
* overwrites unconditionally, when a delete fails, when the row cannot be read
|
|
190
|
+
* before the write, when a failed write cannot be verified, or in one
|
|
191
|
+
* double-fault interleaving (see the README's S3 offloading notes).
|
|
192
|
+
*/
|
|
36
193
|
async putWrites(config, writes, taskId) {
|
|
37
|
-
return (0, put_writes_1.putWrites)(this.context, config, writes, taskId);
|
|
194
|
+
return (0, boundary_1.guardPublic)('saver.putWrites', () => (0, put_writes_1.putWrites)(this.context, config, writes, taskId));
|
|
38
195
|
}
|
|
39
|
-
|
|
40
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Delete every checkpoint, payload and pending write of a thread.
|
|
198
|
+
*
|
|
199
|
+
* Accepts: `threadId` — validated. `options.signal` — aborts between pages.
|
|
200
|
+
*
|
|
201
|
+
* Returns: nothing. Deleting a thread that does not exist is not an error.
|
|
202
|
+
*
|
|
203
|
+
* Throws: `VALIDATION` naming `options` for options that are not an
|
|
204
|
+
* object, `options.<key>` for a key this package does not read, `signal`
|
|
205
|
+
* for a signal that is not `AbortSignal`-shaped, or `thread_id` for a
|
|
206
|
+
* malformed `threadId`;
|
|
207
|
+
* `BATCH_WRITE_INCOMPLETE` when a row's delete fails, counting rows
|
|
208
|
+
* rather than batches and carrying what did succeed; a classified AWS failure;
|
|
209
|
+
* `ABORTED` when the signal fires, which is what a cancel surfaces as
|
|
210
|
+
* rather than an incomplete delete, even when it fires part-way through the
|
|
211
|
+
* pass. A row refused because it was rewritten after the partition read
|
|
212
|
+
* raises nothing: it is left exactly as its writer left it, reported at
|
|
213
|
+
* `warn`, and counted as skipped.
|
|
214
|
+
*
|
|
215
|
+
* Guarantees: a row this adapter did not write is left in place and logged,
|
|
216
|
+
* and neither is a row rewritten since the read — so an acknowledged write is
|
|
217
|
+
* no longer erased, nor the object it names released, by a delete that
|
|
218
|
+
* observed the row before it. Single pass: call it when the thread is
|
|
219
|
+
* quiescent, since a checkpoint written at a key the read never saw survives
|
|
220
|
+
* it, and so does the re-landing of an inline pending write, which carries no
|
|
221
|
+
* request token on purpose. What comes back there is an ordinary row, naming
|
|
222
|
+
* no object this call could have released.
|
|
223
|
+
*/
|
|
224
|
+
async deleteThread(threadId, options) {
|
|
225
|
+
return (0, boundary_1.guardPublic)('saver.deleteThread', () => {
|
|
226
|
+
(0, collaborators_1.assertCancelOptions)(options);
|
|
227
|
+
return (0, delete_thread_1.deleteThread)(this.context, threadId, options);
|
|
228
|
+
});
|
|
41
229
|
}
|
|
42
|
-
/**
|
|
230
|
+
/**
|
|
231
|
+
* Walk a checkpoint's ancestors for the delta channels named, returning each
|
|
232
|
+
* channel's on-path writes oldest-first and its nearest stored value.
|
|
233
|
+
*
|
|
234
|
+
* Overrides the inherited walk, which stops silently at an ancestor it cannot
|
|
235
|
+
* read and lets the consumer restart the channel from empty. A TTL computed
|
|
236
|
+
* per put puts that within reach here, so an ancestor a channel still needs
|
|
237
|
+
* that has expired is reported instead of dropped.
|
|
238
|
+
*
|
|
239
|
+
* Accepts: `options` — must be an object naming exactly `config` and
|
|
240
|
+
* `channels`, the shape `BaseCheckpointSaver`'s own signature declares.
|
|
241
|
+
* `options.channels` — the delta channels to rebuild, required; an empty
|
|
242
|
+
* array reads nothing rather than being refused, since it is a legitimate
|
|
243
|
+
* "nothing to rebuild" request. `options.config` — the checkpoint to walk
|
|
244
|
+
* back from, shaped as {@link getTuple} requires and checked for that shape
|
|
245
|
+
* even when there is nothing to read; its `signal` aborts the whole walk —
|
|
246
|
+
* every ancestor read, not only the first — and the hop it fires on is the
|
|
247
|
+
* last read the call makes.
|
|
248
|
+
*
|
|
249
|
+
* Returns: per channel, its on-path writes oldest-first and the nearest
|
|
250
|
+
* stored value found.
|
|
251
|
+
*
|
|
252
|
+
* Throws: `VALIDATION` naming `options` for options that are not an
|
|
253
|
+
* object, `options.<key>` for an unknown key, `config`, `configurable` or
|
|
254
|
+
* `signal` for a config of the wrong shape, or `channels` for a value that
|
|
255
|
+
* is not an array of strings, and, once a channel is named, `thread_id`,
|
|
256
|
+
* `checkpoint_ns`, `checkpoint_id` or `thread_ts` for a malformed
|
|
257
|
+
* identifier; `ANCESTOR_EXPIRED` when a checkpoint a channel still needs has
|
|
258
|
+
* expired; a classified AWS failure; `RETRY_EXHAUSTED`; `ABORTED`, which a walk
|
|
259
|
+
* cancelled as it reached an expired ancestor reports in place of
|
|
260
|
+
* `ANCESTOR_EXPIRED`.
|
|
261
|
+
*
|
|
262
|
+
* Guarantees: the walk stops at the first ancestor answering for every
|
|
263
|
+
* channel, so a deep thread costs reads only as far back as the nearest
|
|
264
|
+
* snapshot.
|
|
265
|
+
*/
|
|
266
|
+
getDeltaChannelHistory(options) {
|
|
267
|
+
return (0, boundary_1.guardPublic)('saver.getDeltaChannelHistory', () => {
|
|
268
|
+
const request = (0, parse_1.parseDeltaHistoryRequest)(options);
|
|
269
|
+
return (0, delta_history_1.deltaChannelHistory)(this.context, (c) => this.getTuple(c), request.config, request.channels);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Release owned resources.
|
|
274
|
+
*
|
|
275
|
+
* Accepts: nothing.
|
|
276
|
+
*
|
|
277
|
+
* Returns: nothing. Idempotent, and a no-op for a client the caller injected
|
|
278
|
+
* — that one is theirs to close.
|
|
279
|
+
*
|
|
280
|
+
* Throws: whatever a resource's own `destroy` raises — but only after every
|
|
281
|
+
* other one has been released, so a client that fails to close never strands
|
|
282
|
+
* the one behind it.
|
|
283
|
+
*/
|
|
43
284
|
destroy() {
|
|
44
|
-
this.
|
|
45
|
-
if (this.ownsClient)
|
|
46
|
-
this.ddbClient?.destroy();
|
|
285
|
+
this.shell.release();
|
|
47
286
|
}
|
|
48
287
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* `s3
|
|
53
|
-
*
|
|
54
|
-
*
|
|
288
|
+
* Provision an S3 lifecycle expiration rule matching the configured TTL, so
|
|
289
|
+
* offloaded payloads don't outlive the items that point at them.
|
|
290
|
+
*
|
|
291
|
+
* Accepts: nothing; the rule follows the configured `s3` and `ttl`. A no-op
|
|
292
|
+
* without both, since there would be no bucket to rule over or no expiry to
|
|
293
|
+
* match.
|
|
294
|
+
*
|
|
295
|
+
* Returns: nothing. Installing a rule that is already there is a no-op too,
|
|
296
|
+
* so calling it on every deploy is safe.
|
|
297
|
+
*
|
|
298
|
+
* Throws: `VALIDATION` naming `s3.keyPrefix` on a rule-id collision;
|
|
299
|
+
* a classified AWS failure when the bucket's lifecycle cannot be read or written.
|
|
300
|
+
* @remarks Needs the bucket-level `s3:GetLifecycleConfiguration` and
|
|
301
|
+
* `s3:PutLifecycleConfiguration` permissions, which are broader than the
|
|
302
|
+
* object-level CRUD the rest of S3 offload needs. Call it once at deployment,
|
|
303
|
+
* not per request.
|
|
55
304
|
*/
|
|
56
305
|
async ensureS3LifecycleRule() {
|
|
57
|
-
|
|
58
|
-
return;
|
|
59
|
-
await this.context.offloader.ensureLifecycleRule((0, ttl_1.resolveTtlDaysCeil)(this.context.ttl));
|
|
306
|
+
return (0, boundary_1.guardPublic)('saver.ensureS3LifecycleRule', () => this.shell.ensureLifecycleRule());
|
|
60
307
|
}
|
|
61
308
|
}
|
|
62
309
|
exports.DynamoDBSaver = DynamoDBSaver;
|
|
63
|
-
//# sourceMappingURL=saver.js.map
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides the saver's own modules from the shapes a caller types against.
|
|
3
|
+
*
|
|
4
|
+
* The saver's options and the options its delta-channel walk accepts are
|
|
5
|
+
* declared here, apart from the saver and its actions, so a caller can type
|
|
6
|
+
* what it builds without importing either. The narrowed `configurable` is
|
|
7
|
+
* declared beside them for the parser that reads it, not for a caller. The
|
|
8
|
+
* delta-channel options are pinned equal to upstream's inline parameter
|
|
9
|
+
* type, so they change only when LangGraph's do.
|
|
10
|
+
*/
|
|
11
|
+
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
1
12
|
import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
import type { PayloadDescriptor } from '../shared/codec/codec';
|
|
3
13
|
import type { BaseAdapterOptions, CodecOptions } from '../shared/options';
|
|
4
14
|
/** Options for {@link DynamoDBSaver}. */
|
|
5
15
|
export type DynamoDBSaverOptions = BaseAdapterOptions & CodecOptions & {
|
|
6
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Optional serializer override. The default is the base class's, which is
|
|
18
|
+
* LangGraph's `JsonPlusSerializer` — **not** the plain JSON serializer the
|
|
19
|
+
* store and chat-history adapters default to. The two differ on read as
|
|
20
|
+
* well as on write: `JsonPlusSerializer` reconstructs a `Map`, a `Set`, a
|
|
21
|
+
* `Uint8Array` or an allow-listed `langchain_core` class from the `lc`
|
|
22
|
+
* record a stored row carries, so the row selects which constructor runs,
|
|
23
|
+
* while plain JSON parses and reconstructs nothing. Pass the exported
|
|
24
|
+
* `JSON_SERDE` for the narrower read path, at the cost of the JSON
|
|
25
|
+
* projection the README's *Table schema* section tabulates.
|
|
26
|
+
*/
|
|
7
27
|
serde?: SerializerProtocol;
|
|
8
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Options {@link DynamoDBSaver.getDeltaChannelHistory} accepts: the object
|
|
31
|
+
* `BaseCheckpointSaver.getDeltaChannelHistory` declares inline, named so a
|
|
32
|
+
* caller can type the options it builds. A test pins it equal to upstream's
|
|
33
|
+
* parameter type.
|
|
34
|
+
*/
|
|
35
|
+
export interface DeltaChannelHistoryOptions {
|
|
36
|
+
/** The checkpoint to walk back from; must be an object. */
|
|
37
|
+
config: RunnableConfig;
|
|
38
|
+
/**
|
|
39
|
+
* The delta channels to rebuild, as an array of strings; `[]` reads nothing
|
|
40
|
+
* and returns `{}`.
|
|
41
|
+
*/
|
|
42
|
+
channels: string[];
|
|
43
|
+
}
|
|
9
44
|
/** Narrowed shape of `RunnableConfig.configurable` the saver relies on. */
|
|
10
45
|
export interface CheckpointConfigurable {
|
|
11
46
|
thread_id: string;
|
|
12
47
|
checkpoint_ns?: string;
|
|
13
48
|
checkpoint_id?: string;
|
|
49
|
+
/** Legacy alias of `checkpoint_id` that older callers and API-shaped configs still emit. */
|
|
50
|
+
thread_ts?: string;
|
|
14
51
|
}
|
|
15
|
-
/** The lightweight `META#` item: structural fields + serialized metadata. */
|
|
16
|
-
export interface CheckpointMetaItem {
|
|
17
|
-
PK: string;
|
|
18
|
-
SK: string;
|
|
19
|
-
threadId: string;
|
|
20
|
-
checkpointNs: string;
|
|
21
|
-
checkpointId: string;
|
|
22
|
-
parentCheckpointId?: string;
|
|
23
|
-
metadata: PayloadDescriptor;
|
|
24
|
-
ttl?: number;
|
|
25
|
-
}
|
|
26
|
-
/** The heavy `PAYLOAD#` item: the serialized checkpoint. */
|
|
27
|
-
export interface CheckpointPayloadItem {
|
|
28
|
-
PK: string;
|
|
29
|
-
SK: string;
|
|
30
|
-
checkpoint: PayloadDescriptor;
|
|
31
|
-
ttl?: number;
|
|
32
|
-
}
|
|
33
|
-
/** A `WRITE#` item: one pending write for a checkpoint/task. */
|
|
34
|
-
export interface CheckpointWriteItem {
|
|
35
|
-
PK: string;
|
|
36
|
-
SK: string;
|
|
37
|
-
taskId: string;
|
|
38
|
-
index: number;
|
|
39
|
-
channel: string;
|
|
40
|
-
/** Identifies the `putWrites` call that produced this row (see item-writer). */
|
|
41
|
-
writeGroup: string;
|
|
42
|
-
/**
|
|
43
|
-
* How many earlier writes in the same call already used this channel.
|
|
44
|
-
* Optional: rows written before 0.9.0 carry none and read back as 0, which
|
|
45
|
-
* is exactly the identity they were stored under.
|
|
46
|
-
*/
|
|
47
|
-
occurrence?: number;
|
|
48
|
-
value: PayloadDescriptor;
|
|
49
|
-
ttl?: number;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides the saver's own modules from the shapes a caller types against.
|
|
4
|
+
*
|
|
5
|
+
* The saver's options and the options its delta-channel walk accepts are
|
|
6
|
+
* declared here, apart from the saver and its actions, so a caller can type
|
|
7
|
+
* what it builds without importing either. The narrowed `configurable` is
|
|
8
|
+
* declared beside them for the parser that reads it, not for a caller. The
|
|
9
|
+
* delta-channel options are pinned equal to upstream's inline parameter
|
|
10
|
+
* type, so they change only when LangGraph's do.
|
|
11
|
+
*/
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,43 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hides how several adapters share one client and one set of defaults.
|
|
3
|
+
*
|
|
4
|
+
* A caller states its defaults once; which adapter gets the base client
|
|
5
|
+
* choice and which its own, how the DynamoDB region reaches a shared `s3`
|
|
6
|
+
* config, and who destroys a client the factory built rather than was handed
|
|
7
|
+
* are decided here. Teardown is total — one adapter failing to release cannot
|
|
8
|
+
* strand the others — and a `createAll` that fails partway releases what it
|
|
9
|
+
* had built before its own error propagates.
|
|
10
|
+
*/
|
|
3
11
|
import { DynamoDBSaver } from '../checkpointer/saver';
|
|
4
12
|
import type { DynamoDBSaverOptions } from '../checkpointer/types';
|
|
5
13
|
import { DynamoDBChatMessageHistory } from '../history/chat-message-history';
|
|
6
14
|
import type { DynamoDBChatMessageHistoryOptions } from '../history/types';
|
|
7
|
-
import type { Logger } from '../shared/logging/logger';
|
|
8
15
|
import { DynamoDBStore } from '../store/store';
|
|
9
16
|
import type { DynamoDBStoreOptions } from '../store/types';
|
|
10
|
-
|
|
11
|
-
export interface FactoryBaseOptions {
|
|
12
|
-
client?: DynamoDBDocument;
|
|
13
|
-
clientConfig?: DynamoDBClientConfig;
|
|
14
|
-
createClient?: (config: DynamoDBClientConfig) => DynamoDBClient;
|
|
15
|
-
logger?: Logger;
|
|
16
|
-
}
|
|
17
|
-
/** Per-adapter options for {@link DynamoDBFactory.createAll} (client is shared). */
|
|
18
|
-
export interface CreateAllOptions {
|
|
19
|
-
saver: Omit<DynamoDBSaverOptions, 'client' | 'clientConfig' | 'createClient'>;
|
|
20
|
-
store: Omit<DynamoDBStoreOptions, 'client' | 'clientConfig' | 'createClient'>;
|
|
21
|
-
history: Omit<DynamoDBChatMessageHistoryOptions, 'client' | 'clientConfig' | 'createClient'>;
|
|
22
|
-
}
|
|
23
|
-
/** The three adapters sharing one client, plus a combined `destroy`. */
|
|
24
|
-
export interface CreatedAdapters {
|
|
25
|
-
saver: DynamoDBSaver;
|
|
26
|
-
store: DynamoDBStore;
|
|
27
|
-
history: DynamoDBChatMessageHistory;
|
|
28
|
-
destroy: () => void;
|
|
29
|
-
}
|
|
17
|
+
import type { CreateAllOptions, CreatedAdapters, FactoryBaseOptions } from './types';
|
|
30
18
|
/**
|
|
31
|
-
* Convenience constructors for the adapters.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
19
|
+
* Convenience constructors for the adapters.
|
|
20
|
+
*
|
|
21
|
+
* Individual `create*` methods each build their own client; {@link createAll}
|
|
22
|
+
* builds one shared client used by all three and returns a combined `destroy`
|
|
23
|
+
* that tears everything down once. Each adapter validates the options it ends
|
|
24
|
+
* up with, so the same mistake is caught the same way however the adapter was
|
|
25
|
+
* built. The factory checks only what it reads itself before an adapter can:
|
|
26
|
+
* its own base options, client choice and logger, the keys of `createAll`'s
|
|
27
|
+
* argument, and that each adapter's options are an object at all.
|
|
28
|
+
*
|
|
29
|
+
* Every `create*` argument and every `createAll` section is one adapter's
|
|
30
|
+
* options, and a mistake in one is named the way that adapter's constructor
|
|
31
|
+
* names it: `options` for a value that is not an object, and the adapter's own
|
|
32
|
+
* field names (`options.<key>`, `tableName`, …) for anything inside one.
|
|
34
33
|
*/
|
|
35
34
|
export declare class DynamoDBFactory {
|
|
36
35
|
private readonly base;
|
|
36
|
+
/**
|
|
37
|
+
* Accepts: `base` — the defaults every adapter inherits. Checked here, where
|
|
38
|
+
* the caller wrote them: an unknown key would otherwise be ignored, and a
|
|
39
|
+
* `client` next to a `clientConfig` was refused by the first `create*` call
|
|
40
|
+
* and accepted by `createAll`, for the same base. So is the shape of
|
|
41
|
+
* `clientConfig`: `createAll` hands its adapters the client built from it,
|
|
42
|
+
* never the config, so no adapter would see a malformed one. And so is
|
|
43
|
+
* `logger`, which `createAll` logs its own teardown failures through: a
|
|
44
|
+
* malformed one threw from inside that teardown, replacing a failed build's
|
|
45
|
+
* own error with a bare `TypeError`.
|
|
46
|
+
*
|
|
47
|
+
* Returns: a factory holding those defaults. It opens nothing: every client
|
|
48
|
+
* is built by the `create*` call that needs one.
|
|
49
|
+
*
|
|
50
|
+
* Throws: `VALIDATION` naming `options.<key>`, `client`, `clientConfig`,
|
|
51
|
+
* `logger` or `logger.<method>`. Everything else each adapter validates for
|
|
52
|
+
* itself, since a per-adapter value may still replace it.
|
|
53
|
+
*/
|
|
37
54
|
constructor(base?: FactoryBaseOptions);
|
|
55
|
+
/** The base options every adapter inherits regardless of which client it uses. */
|
|
56
|
+
private sharedDefaults;
|
|
57
|
+
/**
|
|
58
|
+
* The base `s3` config with the region the DynamoDB side was configured with
|
|
59
|
+
* already filled in.
|
|
60
|
+
*
|
|
61
|
+
* An adapter normally reads that region off its own `clientConfig`
|
|
62
|
+
* (`offloaderConfigFor`), but the adapters {@link createAll} builds are given
|
|
63
|
+
* the one shared `client` instead — and a `clientConfig` beside a `client` is
|
|
64
|
+
* refused, because for the DynamoDB client it would be silently ignored. So
|
|
65
|
+
* the region has to be carried here, on the config that still needs it:
|
|
66
|
+
* without it, a bucket reachable only through that region fails with an
|
|
67
|
+
* opaque `PermanentRedirect` on the first offload, unlike the identical
|
|
68
|
+
* configuration through `createStore`, which resolves its own region
|
|
69
|
+
* directly.
|
|
70
|
+
*
|
|
71
|
+
* A base `s3`, or its `clientConfig`, that is not an object is handed on
|
|
72
|
+
* unchanged, for each adapter to refuse by its own name: reading `.region`
|
|
73
|
+
* off a `null` one would throw here instead, and writing a region into a
|
|
74
|
+
* malformed `clientConfig` would turn it into an object shape an adapter
|
|
75
|
+
* then accepts instead of refusing.
|
|
76
|
+
*/
|
|
77
|
+
private sharedS3;
|
|
78
|
+
/**
|
|
79
|
+
* Per-adapter options replace the factory's client choice as a unit: a
|
|
80
|
+
* `client` handed to `createSaver` also displaces the base `clientConfig`
|
|
81
|
+
* and `createClient`, because carrying those along is exactly the ambiguous
|
|
82
|
+
* combination the adapters' option validation rejects. The shared
|
|
83
|
+
* `ttl`/`compression`/`s3`/`retry` defaults stay either way.
|
|
84
|
+
*/
|
|
85
|
+
private defaultsFor;
|
|
86
|
+
/**
|
|
87
|
+
* A saver on its own client.
|
|
88
|
+
*
|
|
89
|
+
* Accepts: `options` — the saver's own, laid over the factory's defaults. A
|
|
90
|
+
* per-adapter value wins; see {@link defaultsFor} for how a client choice
|
|
91
|
+
* replaces the factory's as a unit.
|
|
92
|
+
*
|
|
93
|
+
* Returns: the saver, which owns the client it built and releases it on
|
|
94
|
+
* `destroy()`.
|
|
95
|
+
*
|
|
96
|
+
* Throws: `VALIDATION` for any invalid option, naming it as the saver's
|
|
97
|
+
* constructor does — `options` for a value that is not an object, checked
|
|
98
|
+
* before the defaults are laid under it: reading `.client` off a `null`
|
|
99
|
+
* value would throw here, and spreading a string would iterate its
|
|
100
|
+
* characters instead of refusing it.
|
|
101
|
+
*/
|
|
38
102
|
createSaver(options: DynamoDBSaverOptions): DynamoDBSaver;
|
|
103
|
+
/**
|
|
104
|
+
* A store on its own client.
|
|
105
|
+
*
|
|
106
|
+
* Accepts: as {@link createSaver}, for the store's options.
|
|
107
|
+
*
|
|
108
|
+
* Returns: the store.
|
|
109
|
+
*
|
|
110
|
+
* Throws: as {@link createSaver}.
|
|
111
|
+
*/
|
|
39
112
|
createStore(options: DynamoDBStoreOptions): DynamoDBStore;
|
|
113
|
+
/**
|
|
114
|
+
* A chat history on its own client.
|
|
115
|
+
*
|
|
116
|
+
* Accepts: as {@link createSaver}, for the history's options.
|
|
117
|
+
*
|
|
118
|
+
* Returns: the chat history.
|
|
119
|
+
*
|
|
120
|
+
* Throws: as {@link createSaver}.
|
|
121
|
+
*/
|
|
40
122
|
createChatMessageHistory(options: DynamoDBChatMessageHistoryOptions): DynamoDBChatMessageHistory;
|
|
41
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Build the adapters whose sections are given, all on one shared client.
|
|
125
|
+
*
|
|
126
|
+
* Accepts: `options` — a section per adapter, laid over the factory's shared
|
|
127
|
+
* defaults; omitting one, or giving it as `undefined`, skips that adapter,
|
|
128
|
+
* and `{}` builds none. A key that is not a section name is refused rather
|
|
129
|
+
* than ignored, so a misspelt one cannot silently build nothing. Each section
|
|
130
|
+
* is that adapter's options, so one that is not an object, `null` included,
|
|
131
|
+
* is refused before any client is built.
|
|
132
|
+
*
|
|
133
|
+
* Returns: the adapters, typed by the sections asked for, and one `destroy`
|
|
134
|
+
* that releases all of them and the shared client. A client the factory was
|
|
135
|
+
* given rather than built is never destroyed.
|
|
136
|
+
*
|
|
137
|
+
* Throws: `VALIDATION` naming `options` for an argument or a section that
|
|
138
|
+
* is not an object, or `options.<key>` for a key that is not a section name.
|
|
139
|
+
* Whatever an adapter's constructor throws — after the adapters already
|
|
140
|
+
* built and the freshly created client have been released, so a failed call
|
|
141
|
+
* leaks nothing and the constructor's own error is the one that propagates.
|
|
142
|
+
*
|
|
143
|
+
* Guarantees: one DynamoDB client for all three adapters, and one S3 client
|
|
144
|
+
* per adapter, each under its own key prefix in the shared bucket. Teardown
|
|
145
|
+
* is total: one adapter failing to release its resources cannot strand the
|
|
146
|
+
* others.
|
|
147
|
+
*/
|
|
148
|
+
createAll<O extends CreateAllOptions>(options: O): CreatedAdapters<O>;
|
|
42
149
|
}
|
|
43
|
-
//# sourceMappingURL=factory.d.ts.map
|