@farukada/aws-langgraph-dynamodb-ts 0.9.0 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +282 -49
- package/dist/checkpointer/actions/delete-thread.d.ts +3 -2
- package/dist/checkpointer/actions/delete-thread.js +5 -2
- package/dist/checkpointer/actions/get-tuple.d.ts +3 -2
- package/dist/checkpointer/actions/get-tuple.js +10 -4
- package/dist/checkpointer/actions/list.d.ts +14 -4
- package/dist/checkpointer/actions/list.js +89 -63
- package/dist/checkpointer/actions/put-writes.d.ts +5 -5
- package/dist/checkpointer/actions/put-writes.js +12 -41
- package/dist/checkpointer/actions/put.d.ts +10 -3
- package/dist/checkpointer/actions/put.js +42 -12
- package/dist/checkpointer/internal/assemble.d.ts +10 -3
- package/dist/checkpointer/internal/assemble.js +7 -6
- package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +24 -0
- package/dist/checkpointer/internal/checkpoint-write-verify.js +67 -0
- package/dist/checkpointer/internal/configurable.d.ts +0 -1
- package/dist/checkpointer/internal/configurable.js +10 -9
- package/dist/checkpointer/internal/fetch.d.ts +14 -5
- package/dist/checkpointer/internal/fetch.js +56 -14
- package/dist/checkpointer/internal/filter-match.d.ts +3 -2
- package/dist/checkpointer/internal/filter-match.js +4 -3
- package/dist/checkpointer/internal/item-reader.d.ts +17 -6
- package/dist/checkpointer/internal/item-reader.js +39 -14
- package/dist/checkpointer/internal/item-writer.d.ts +12 -3
- package/dist/checkpointer/internal/item-writer.js +24 -9
- package/dist/checkpointer/internal/keys.d.ts +11 -1
- package/dist/checkpointer/internal/keys.js +33 -3
- package/dist/checkpointer/internal/list-scope.d.ts +61 -0
- package/dist/checkpointer/internal/list-scope.js +108 -0
- package/dist/checkpointer/internal/pending-sends.d.ts +13 -0
- package/dist/checkpointer/internal/pending-sends.js +29 -0
- package/dist/checkpointer/internal/query.d.ts +2 -1
- package/dist/checkpointer/internal/query.js +9 -3
- package/dist/checkpointer/internal/regular-write.d.ts +28 -0
- package/dist/checkpointer/internal/regular-write.js +66 -0
- package/dist/checkpointer/internal/setup.d.ts +3 -1
- package/dist/checkpointer/internal/setup.js +10 -8
- package/dist/checkpointer/internal/special-write-cas.d.ts +1 -2
- package/dist/checkpointer/internal/special-write-cas.js +9 -9
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +1 -2
- package/dist/checkpointer/internal/special-write-cleanup.js +10 -7
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -1
- package/dist/checkpointer/internal/special-write-verify.js +18 -3
- package/dist/checkpointer/internal/stored-channels.d.ts +31 -0
- package/dist/checkpointer/internal/stored-channels.js +70 -0
- package/dist/checkpointer/internal/validation.d.ts +11 -6
- package/dist/checkpointer/internal/validation.js +19 -9
- package/dist/checkpointer/internal/write-guard.d.ts +8 -1
- package/dist/checkpointer/internal/write-guard.js +16 -7
- package/dist/checkpointer/internal/write-index.d.ts +0 -1
- package/dist/checkpointer/internal/write-index.js +0 -1
- package/dist/checkpointer/saver.d.ts +50 -10
- package/dist/checkpointer/saver.js +59 -17
- package/dist/checkpointer/types.d.ts +8 -1
- package/dist/checkpointer/types.js +0 -1
- package/dist/factory/factory.d.ts +22 -25
- package/dist/factory/factory.js +58 -18
- package/dist/factory/types.d.ts +57 -0
- package/dist/factory/types.js +2 -0
- package/dist/history/actions/add-messages.d.ts +1 -2
- package/dist/history/actions/add-messages.js +4 -4
- package/dist/history/actions/clear.d.ts +3 -2
- package/dist/history/actions/clear.js +5 -2
- package/dist/history/actions/get-messages.d.ts +13 -6
- package/dist/history/actions/get-messages.js +63 -42
- package/dist/history/actions/list-sessions.d.ts +1 -1
- package/dist/history/actions/list-sessions.js +8 -12
- package/dist/history/actions/reconcile-count.d.ts +1 -2
- package/dist/history/actions/reconcile-count.js +20 -7
- package/dist/history/chat-message-history.d.ts +51 -26
- package/dist/history/chat-message-history.js +60 -30
- package/dist/history/internal/append-saga.d.ts +7 -2
- package/dist/history/internal/append-saga.js +58 -14
- package/dist/history/internal/compensation.d.ts +6 -2
- package/dist/history/internal/compensation.js +14 -6
- package/dist/history/internal/item-mapper.d.ts +0 -3
- package/dist/history/internal/item-mapper.js +2 -8
- package/dist/history/internal/keys.d.ts +0 -1
- package/dist/history/internal/keys.js +0 -1
- package/dist/history/internal/message-chunker.d.ts +0 -1
- package/dist/history/internal/message-chunker.js +0 -1
- package/dist/history/internal/message-transaction.d.ts +0 -1
- package/dist/history/internal/message-transaction.js +3 -2
- package/dist/history/internal/message-window.d.ts +17 -0
- package/dist/history/internal/message-window.js +49 -0
- package/dist/history/internal/query.d.ts +16 -3
- package/dist/history/internal/query.js +13 -5
- package/dist/history/internal/session-count.d.ts +8 -2
- package/dist/history/internal/session-count.js +14 -8
- package/dist/history/internal/session-title.d.ts +0 -1
- package/dist/history/internal/session-title.js +1 -2
- package/dist/history/internal/session-update.d.ts +0 -1
- package/dist/history/internal/session-update.js +0 -1
- package/dist/history/internal/setup.d.ts +3 -1
- package/dist/history/internal/setup.js +16 -8
- package/dist/history/internal/title-generator.d.ts +0 -1
- package/dist/history/internal/title-generator.js +19 -3
- package/dist/history/internal/ttl-anchor.d.ts +1 -2
- package/dist/history/internal/ttl-anchor.js +5 -5
- package/dist/history/internal/validation.d.ts +19 -3
- package/dist/history/internal/validation.js +41 -4
- package/dist/history/session-adapter.d.ts +9 -3
- package/dist/history/session-adapter.js +6 -3
- package/dist/history/types.d.ts +23 -2
- package/dist/history/types.js +0 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.js +5 -3
- package/dist/shared/clock.d.ts +6 -1
- package/dist/shared/clock.js +9 -1
- package/dist/shared/codec/codec.d.ts +26 -17
- package/dist/shared/codec/codec.js +46 -24
- package/dist/shared/codec/compression.d.ts +1 -2
- package/dist/shared/codec/compression.js +2 -3
- package/dist/shared/codec/descriptor-keys.d.ts +11 -3
- package/dist/shared/codec/descriptor-keys.js +2 -2
- package/dist/shared/codec/encode.d.ts +13 -0
- package/dist/shared/codec/encode.js +43 -0
- package/dist/shared/codec/json-serde.d.ts +0 -1
- package/dist/shared/codec/json-serde.js +0 -1
- package/dist/shared/codec/payload-loss.d.ts +12 -0
- package/dist/shared/codec/payload-loss.js +38 -0
- package/dist/shared/codec/s3/adapter-config.d.ts +13 -0
- package/dist/shared/codec/s3/adapter-config.js +22 -0
- package/dist/shared/codec/s3/bounded-body.d.ts +14 -0
- package/dist/shared/codec/s3/bounded-body.js +47 -0
- package/dist/shared/codec/s3/client-types.d.ts +34 -0
- package/dist/shared/codec/s3/client-types.js +7 -0
- package/dist/shared/codec/s3/client.d.ts +11 -5
- package/dist/shared/codec/s3/client.js +25 -3
- package/dist/shared/codec/s3/config.d.ts +32 -5
- package/dist/shared/codec/s3/config.js +37 -5
- package/dist/shared/codec/s3/delete.d.ts +0 -1
- package/dist/shared/codec/s3/delete.js +0 -1
- package/dist/shared/codec/s3/key-scope.d.ts +23 -0
- package/dist/shared/codec/s3/key-scope.js +44 -0
- package/dist/shared/codec/s3/lifecycle.d.ts +11 -5
- package/dist/shared/codec/s3/lifecycle.js +32 -16
- package/dist/shared/codec/s3/offloader.d.ts +6 -2
- package/dist/shared/codec/s3/offloader.js +21 -3
- package/dist/shared/codec/s3/orphans.d.ts +6 -1
- package/dist/shared/codec/s3/orphans.js +15 -2
- package/dist/shared/codec/s3/read-write.d.ts +7 -3
- package/dist/shared/codec/s3/read-write.js +16 -8
- package/dist/shared/codec/s3/retry.d.ts +4 -4
- package/dist/shared/codec/s3/retry.js +13 -16
- package/dist/shared/concurrency.d.ts +6 -0
- package/dist/shared/concurrency.js +30 -0
- package/dist/shared/constants.d.ts +53 -5
- package/dist/shared/constants.js +55 -7
- package/dist/shared/dynamodb/abort.d.ts +9 -0
- package/dist/shared/dynamodb/abort.js +27 -0
- package/dist/shared/dynamodb/backoff.d.ts +4 -4
- package/dist/shared/dynamodb/backoff.js +7 -7
- package/dist/shared/dynamodb/batch-write.d.ts +0 -1
- package/dist/shared/dynamodb/batch-write.js +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts +0 -1
- package/dist/shared/dynamodb/cancellation.js +0 -1
- package/dist/shared/dynamodb/client.d.ts +9 -2
- package/dist/shared/dynamodb/client.js +24 -1
- package/dist/shared/dynamodb/conditional-put.d.ts +18 -2
- package/dist/shared/dynamodb/conditional-put.js +19 -2
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +3 -1
- package/dist/shared/dynamodb/drain-unprocessed.js +1 -2
- package/dist/shared/dynamodb/expiry.d.ts +16 -0
- package/dist/shared/dynamodb/expiry.js +29 -0
- package/dist/shared/dynamodb/paginate-core.d.ts +5 -3
- package/dist/shared/dynamodb/paginate-core.js +47 -17
- package/dist/shared/dynamodb/paginate.d.ts +0 -1
- package/dist/shared/dynamodb/paginate.js +1 -2
- package/dist/shared/dynamodb/partition-delete.d.ts +7 -1
- package/dist/shared/dynamodb/partition-delete.js +4 -3
- package/dist/shared/dynamodb/retry-classifier.d.ts +10 -2
- package/dist/shared/dynamodb/retry-classifier.js +42 -11
- package/dist/shared/dynamodb/retry-policy.d.ts +26 -0
- package/dist/shared/dynamodb/retry-policy.js +22 -0
- package/dist/shared/dynamodb/retry.d.ts +14 -1
- package/dist/shared/dynamodb/retry.js +11 -7
- package/dist/shared/dynamodb/scan.d.ts +0 -1
- package/dist/shared/dynamodb/scan.js +1 -2
- package/dist/shared/dynamodb/types.d.ts +1 -2
- package/dist/shared/dynamodb/types.js +0 -1
- package/dist/shared/errors/base-error.d.ts +14 -6
- package/dist/shared/errors/base-error.js +8 -9
- package/dist/shared/errors/boundary.d.ts +18 -0
- package/dist/shared/errors/boundary.js +46 -0
- package/dist/shared/errors/error-code.d.ts +2 -2
- package/dist/shared/errors/error-code.js +1 -1
- package/dist/shared/errors/errors.d.ts +13 -13
- package/dist/shared/errors/errors.js +18 -16
- package/dist/shared/errors/upstream-error.d.ts +16 -0
- package/dist/shared/errors/upstream-error.js +27 -0
- package/dist/shared/errors/wrap-error.d.ts +0 -9
- package/dist/shared/errors/wrap-error.js +0 -15
- package/dist/shared/logging/logger.d.ts +6 -2
- package/dist/shared/logging/logger.js +0 -1
- package/dist/shared/logging/redaction-walk.d.ts +2 -2
- package/dist/shared/logging/redaction-walk.js +38 -18
- package/dist/shared/logging/redaction.d.ts +9 -5
- package/dist/shared/logging/redaction.js +19 -4
- package/dist/shared/logging/secret-patterns.d.ts +21 -3
- package/dist/shared/logging/secret-patterns.js +32 -6
- package/dist/shared/options.d.ts +9 -4
- package/dist/shared/options.js +0 -1
- package/dist/shared/ulid.d.ts +15 -2
- package/dist/shared/ulid.js +35 -3
- package/dist/shared/validation/options.d.ts +8 -0
- package/dist/shared/validation/options.js +90 -0
- package/dist/shared/validation/primitives.d.ts +14 -10
- package/dist/shared/validation/primitives.js +23 -25
- package/dist/shared/validation/ttl.d.ts +14 -7
- package/dist/shared/validation/ttl.js +29 -11
- package/dist/store/actions/get.d.ts +11 -3
- package/dist/store/actions/get.js +52 -14
- package/dist/store/actions/list-namespaces.d.ts +0 -1
- package/dist/store/actions/list-namespaces.js +10 -6
- package/dist/store/actions/put.d.ts +0 -1
- package/dist/store/actions/put.js +24 -13
- package/dist/store/actions/reconcile-vector-index.d.ts +3 -2
- package/dist/store/actions/reconcile-vector-index.js +2 -3
- package/dist/store/actions/search.d.ts +1 -2
- package/dist/store/actions/search.js +11 -38
- package/dist/store/internal/backend-search.d.ts +1 -2
- package/dist/store/internal/backend-search.js +12 -6
- package/dist/store/internal/batch-plan.d.ts +11 -0
- package/dist/store/internal/batch-plan.js +52 -0
- package/dist/store/internal/candidates.d.ts +23 -0
- package/dist/store/internal/candidates.js +94 -0
- package/dist/store/internal/filter.d.ts +0 -1
- package/dist/store/internal/filter.js +0 -1
- package/dist/store/internal/index-reconcile.d.ts +5 -6
- package/dist/store/internal/index-reconcile.js +25 -12
- package/dist/store/internal/index-sync.d.ts +0 -1
- package/dist/store/internal/index-sync.js +0 -1
- package/dist/store/internal/item-mapper.d.ts +5 -3
- package/dist/store/internal/item-mapper.js +14 -6
- package/dist/store/internal/keys.d.ts +0 -1
- package/dist/store/internal/keys.js +0 -1
- package/dist/store/internal/namespace-match.d.ts +0 -1
- package/dist/store/internal/namespace-match.js +0 -1
- package/dist/store/internal/option-validation.d.ts +13 -0
- package/dist/store/internal/option-validation.js +77 -0
- package/dist/store/internal/overwrite-swap.d.ts +0 -1
- package/dist/store/internal/overwrite-swap.js +10 -4
- package/dist/store/internal/persist.d.ts +3 -2
- package/dist/store/internal/persist.js +16 -11
- package/dist/store/internal/query.d.ts +6 -1
- package/dist/store/internal/query.js +17 -1
- package/dist/store/internal/ranker.d.ts +7 -2
- package/dist/store/internal/ranker.js +10 -2
- package/dist/store/internal/read-existing.d.ts +9 -5
- package/dist/store/internal/read-existing.js +22 -10
- package/dist/store/internal/score-direction.d.ts +0 -1
- package/dist/store/internal/score-direction.js +0 -1
- package/dist/store/internal/search-filter.d.ts +0 -1
- package/dist/store/internal/search-filter.js +0 -1
- package/dist/store/internal/semantic-search.d.ts +26 -5
- package/dist/store/internal/semantic-search.js +59 -19
- package/dist/store/internal/setup.d.ts +5 -13
- package/dist/store/internal/setup.js +11 -63
- package/dist/store/internal/text-path.d.ts +17 -0
- package/dist/store/internal/text-path.js +147 -0
- package/dist/store/internal/validation.d.ts +8 -3
- package/dist/store/internal/validation.js +21 -5
- package/dist/store/internal/write-verify.d.ts +15 -10
- package/dist/store/internal/write-verify.js +24 -21
- package/dist/store/store.d.ts +37 -9
- package/dist/store/store.js +52 -17
- package/dist/store/types.d.ts +6 -2
- package/dist/store/types.js +0 -1
- package/dist/store/vector-backend.d.ts +0 -1
- package/dist/store/vector-backend.js +0 -1
- package/package.json +21 -15
- 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.map +0 -1
- package/dist/checkpointer/internal/assemble.js.map +0 -1
- package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
- package/dist/checkpointer/internal/configurable.js.map +0 -1
- package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
- package/dist/checkpointer/internal/fetch.js.map +0 -1
- package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
- package/dist/checkpointer/internal/filter-match.js.map +0 -1
- package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-reader.js.map +0 -1
- package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-writer.js.map +0 -1
- package/dist/checkpointer/internal/keys.d.ts.map +0 -1
- package/dist/checkpointer/internal/keys.js.map +0 -1
- package/dist/checkpointer/internal/query.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
- package/dist/checkpointer/internal/validation.d.ts.map +0 -1
- package/dist/checkpointer/internal/validation.js.map +0 -1
- package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-guard.js.map +0 -1
- package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/history/internal/append-saga.js.map +0 -1
- package/dist/history/internal/compensation.d.ts.map +0 -1
- package/dist/history/internal/compensation.js.map +0 -1
- package/dist/history/internal/item-mapper.d.ts.map +0 -1
- package/dist/history/internal/item-mapper.js.map +0 -1
- package/dist/history/internal/keys.d.ts.map +0 -1
- package/dist/history/internal/keys.js.map +0 -1
- package/dist/history/internal/message-chunker.d.ts.map +0 -1
- package/dist/history/internal/message-chunker.js.map +0 -1
- package/dist/history/internal/message-transaction.d.ts.map +0 -1
- package/dist/history/internal/message-transaction.js.map +0 -1
- package/dist/history/internal/query.d.ts.map +0 -1
- package/dist/history/internal/query.js.map +0 -1
- package/dist/history/internal/session-count.d.ts.map +0 -1
- package/dist/history/internal/session-count.js.map +0 -1
- package/dist/history/internal/session-title.d.ts.map +0 -1
- package/dist/history/internal/session-title.js.map +0 -1
- package/dist/history/internal/session-update.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/history/internal/title-generator.js.map +0 -1
- package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
- package/dist/history/internal/ttl-anchor.js.map +0 -1
- package/dist/history/internal/validation.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/shared/codec/s3/orphans.js.map +0 -1
- package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
- package/dist/shared/codec/s3/read-write.js.map +0 -1
- package/dist/shared/codec/s3/retry.d.ts.map +0 -1
- package/dist/shared/codec/s3/retry.js.map +0 -1
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/shared/dynamodb/conditional-put.js.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
- package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/shared/dynamodb/scan.js.map +0 -1
- package/dist/shared/dynamodb/types.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/store/internal/index-reconcile.js.map +0 -1
- package/dist/store/internal/index-sync.d.ts.map +0 -1
- package/dist/store/internal/index-sync.js.map +0 -1
- package/dist/store/internal/item-mapper.d.ts.map +0 -1
- package/dist/store/internal/item-mapper.js.map +0 -1
- package/dist/store/internal/keys.d.ts.map +0 -1
- package/dist/store/internal/keys.js.map +0 -1
- package/dist/store/internal/namespace-match.d.ts.map +0 -1
- package/dist/store/internal/namespace-match.js.map +0 -1
- package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
- package/dist/store/internal/overwrite-swap.js.map +0 -1
- package/dist/store/internal/persist.d.ts.map +0 -1
- package/dist/store/internal/persist.js.map +0 -1
- package/dist/store/internal/query.d.ts.map +0 -1
- package/dist/store/internal/query.js.map +0 -1
- package/dist/store/internal/ranker.d.ts.map +0 -1
- package/dist/store/internal/ranker.js.map +0 -1
- package/dist/store/internal/read-existing.d.ts.map +0 -1
- package/dist/store/internal/read-existing.js.map +0 -1
- package/dist/store/internal/score-direction.d.ts.map +0 -1
- package/dist/store/internal/score-direction.js.map +0 -1
- package/dist/store/internal/search-filter.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/store/internal/validation.js.map +0 -1
- package/dist/store/internal/write-verify.d.ts.map +0 -1
- 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,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reportGuardRejection = reportGuardRejection;
|
|
4
|
+
exports.rejectionProvesForeignRow = rejectionProvesForeignRow;
|
|
5
|
+
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
4
6
|
/**
|
|
5
7
|
* The channel recorded on the row that turned a write away, or undefined when
|
|
6
|
-
* the service returned no attributes
|
|
7
|
-
* 'ALL_OLD'` attaches the existing item to the exception at no extra round
|
|
8
|
-
* trip, but — verified against real DynamoDB — the document client does not
|
|
9
|
-
* unmarshall an *error* payload the way it unmarshalls a response, so the
|
|
10
|
-
* attribute arrives in raw AttributeValue form.
|
|
8
|
+
* the service returned no attributes (`ReturnValuesOnConditionCheckFailure:
|
|
9
|
+
* 'ALL_OLD'` attaches the existing item to the exception at no extra round trip).
|
|
11
10
|
*/
|
|
12
11
|
function rejectedChannel(error) {
|
|
13
|
-
return error
|
|
12
|
+
return (0, conditional_put_1.rejectedItem)(error)?.channel;
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Report a guard rejection. Sort keys carry their channel, so a rejection
|
|
@@ -36,4 +35,14 @@ function reportGuardRejection(context, item, error) {
|
|
|
36
35
|
channel: item.channel,
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* True when the guard rejection's returned row provably belongs to another
|
|
40
|
+
* `putWrites` call, so this call's own upload is dead and safe to delete. A
|
|
41
|
+
* retried put whose response was lost can be rejected by the row it wrote
|
|
42
|
+
* itself, so an equal group — or no attributes at all — proves nothing and
|
|
43
|
+
* must not be taken as "my upload is dead".
|
|
44
|
+
*/
|
|
45
|
+
function rejectionProvesForeignRow(item, error) {
|
|
46
|
+
const group = (0, conditional_put_1.rejectedItem)(error)?.writeGroup;
|
|
47
|
+
return group !== undefined && group !== item.writeGroup;
|
|
48
|
+
}
|
|
@@ -1,30 +1,70 @@
|
|
|
1
1
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
-
import { BaseCheckpointSaver, type Checkpoint, type CheckpointListOptions, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import { BaseCheckpointSaver, type ChannelVersions, type Checkpoint, type CheckpointListOptions, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from '@langchain/langgraph-checkpoint';
|
|
3
|
+
import type { CancelOptions } from '../shared/options';
|
|
3
4
|
import type { DynamoDBSaverOptions } from './types';
|
|
4
5
|
/**
|
|
5
6
|
* DynamoDB-backed LangGraph checkpoint saver. A thin orchestrator: it resolves
|
|
6
7
|
* its collaborators once and delegates every operation to a focused action.
|
|
8
|
+
* Every public method is the library's error boundary — a raw AWS SDK error
|
|
9
|
+
* escaping an action surfaces as an `UpstreamError`.
|
|
7
10
|
*/
|
|
8
11
|
export declare class DynamoDBSaver extends BaseCheckpointSaver {
|
|
9
12
|
private readonly context;
|
|
10
13
|
private readonly ownsClient;
|
|
11
14
|
private readonly ddbClient;
|
|
12
15
|
constructor(options: DynamoDBSaverOptions);
|
|
16
|
+
/**
|
|
17
|
+
* Read one checkpoint with its metadata and pending writes: the one
|
|
18
|
+
* `checkpoint_id` names, else the newest in the namespace. Strongly
|
|
19
|
+
* consistent, so a checkpoint just written is always seen. Returns
|
|
20
|
+
* `undefined` for an unknown thread or checkpoint, or a config without a
|
|
21
|
+
* thread.
|
|
22
|
+
* @throws ValidationError for a malformed identifier; UpstreamError, RetryExhaustedError, AbortError (`config.signal`).
|
|
23
|
+
*/
|
|
13
24
|
getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Stream checkpoints newest first: one namespace, every namespace of a
|
|
27
|
+
* thread when `checkpoint_ns` is omitted, or every thread in the table when
|
|
28
|
+
* `thread_id` is omitted (a table scan). Eventually consistent. `before`,
|
|
29
|
+
* `filter` and `limit` follow the reference savers.
|
|
30
|
+
* @remarks One read per page plus two per yielded tuple (see the README cost table).
|
|
31
|
+
* @throws ValidationError, UpstreamError, RetryExhaustedError, AbortError.
|
|
32
|
+
*/
|
|
14
33
|
list(config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
|
|
15
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Store a checkpoint and its metadata in one transaction and return the
|
|
36
|
+
* config that addresses it. `config.checkpoint_id` becomes the parent;
|
|
37
|
+
* `newVersions` names the channels that changed, and only those plus the
|
|
38
|
+
* ones the parent stored are persisted. Last writer wins for a repeated
|
|
39
|
+
* `checkpoint_id`.
|
|
40
|
+
* @throws ValidationError; UpstreamError; RetryExhaustedError; AbortError; S3_OFFLOAD_FAILED when an offloaded payload cannot be uploaded.
|
|
41
|
+
*/
|
|
42
|
+
put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, newVersions?: ChannelVersions): Promise<RunnableConfig>;
|
|
43
|
+
/**
|
|
44
|
+
* Store a task's pending writes for the checkpoint `config` names, one row
|
|
45
|
+
* per write, written in parallel. Regular writes are first-write-wins;
|
|
46
|
+
* special channels (`__interrupt__`, `__resume__`, `__error__`,
|
|
47
|
+
* `__scheduled__`) overwrite, guarded so two concurrent calls never orphan
|
|
48
|
+
* an offloaded object.
|
|
49
|
+
* @throws ValidationError when `checkpoint_id` is missing or a channel is malformed; UpstreamError; RetryExhaustedError; AbortError.
|
|
50
|
+
*/
|
|
16
51
|
putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
|
|
17
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Delete every checkpoint, payload and pending write of a thread and their
|
|
54
|
+
* offloaded objects. Single pass: call it when the thread is quiescent.
|
|
55
|
+
* @throws BatchWriteAllIncompleteError when a delete batch does not fully drain; UpstreamError; AbortError (`options.signal`).
|
|
56
|
+
*/
|
|
57
|
+
deleteThread(threadId: string, options?: CancelOptions): Promise<void>;
|
|
18
58
|
/** Release owned resources (the underlying client and any S3 client). */
|
|
19
59
|
destroy(): void;
|
|
20
60
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `s3:GetLifecycleConfiguration
|
|
25
|
-
* permissions (broader than the
|
|
26
|
-
* needs) — call this once during
|
|
61
|
+
* Provision an S3 lifecycle expiration rule matching the configured TTL, so
|
|
62
|
+
* offloaded objects don't outlive their DynamoDB item forever. No-ops when
|
|
63
|
+
* S3 offload or TTL isn't configured; throws when the bucket cannot be read
|
|
64
|
+
* or written. Requires the `s3:GetLifecycleConfiguration` /
|
|
65
|
+
* `s3:PutLifecycleConfiguration` bucket-level permissions (broader than the
|
|
66
|
+
* object-level CRUD the rest of S3 offload needs) — call this once during
|
|
67
|
+
* deployment/provisioning, not per-request.
|
|
27
68
|
*/
|
|
28
69
|
ensureS3LifecycleRule(): Promise<void>;
|
|
29
70
|
}
|
|
30
|
-
//# sourceMappingURL=saver.d.ts.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynamoDBSaver = void 0;
|
|
4
4
|
const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
|
5
|
+
const boundary_1 = require("../shared/errors/boundary");
|
|
5
6
|
const ttl_1 = require("../shared/validation/ttl");
|
|
6
7
|
const delete_thread_1 = require("./actions/delete-thread");
|
|
7
8
|
const get_tuple_1 = require("./actions/get-tuple");
|
|
@@ -12,6 +13,8 @@ const setup_1 = require("./internal/setup");
|
|
|
12
13
|
/**
|
|
13
14
|
* DynamoDB-backed LangGraph checkpoint saver. A thin orchestrator: it resolves
|
|
14
15
|
* its collaborators once and delegates every operation to a focused action.
|
|
16
|
+
* Every public method is the library's error boundary — a raw AWS SDK error
|
|
17
|
+
* escaping an action surfaces as an `UpstreamError`.
|
|
15
18
|
*/
|
|
16
19
|
class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
|
|
17
20
|
context;
|
|
@@ -24,20 +27,57 @@ class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
|
|
|
24
27
|
this.ownsClient = setup.ownsClient;
|
|
25
28
|
this.ddbClient = setup.ddbClient;
|
|
26
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Read one checkpoint with its metadata and pending writes: the one
|
|
32
|
+
* `checkpoint_id` names, else the newest in the namespace. Strongly
|
|
33
|
+
* consistent, so a checkpoint just written is always seen. Returns
|
|
34
|
+
* `undefined` for an unknown thread or checkpoint, or a config without a
|
|
35
|
+
* thread.
|
|
36
|
+
* @throws ValidationError for a malformed identifier; UpstreamError, RetryExhaustedError, AbortError (`config.signal`).
|
|
37
|
+
*/
|
|
27
38
|
async getTuple(config) {
|
|
28
|
-
return (0, get_tuple_1.getCheckpointTuple)(this.context, config);
|
|
39
|
+
return (0, boundary_1.guardPublic)('saver.getTuple', () => (0, get_tuple_1.getCheckpointTuple)(this.context, config));
|
|
29
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Stream checkpoints newest first: one namespace, every namespace of a
|
|
43
|
+
* thread when `checkpoint_ns` is omitted, or every thread in the table when
|
|
44
|
+
* `thread_id` is omitted (a table scan). Eventually consistent. `before`,
|
|
45
|
+
* `filter` and `limit` follow the reference savers.
|
|
46
|
+
* @remarks One read per page plus two per yielded tuple (see the README cost table).
|
|
47
|
+
* @throws ValidationError, UpstreamError, RetryExhaustedError, AbortError.
|
|
48
|
+
*/
|
|
30
49
|
list(config, options) {
|
|
31
|
-
return (0, list_1.listCheckpoints)(this.context, config, options);
|
|
50
|
+
return (0, boundary_1.guardPublicIterable)('saver.list', (0, list_1.listCheckpoints)(this.context, config, options));
|
|
32
51
|
}
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Store a checkpoint and its metadata in one transaction and return the
|
|
54
|
+
* config that addresses it. `config.checkpoint_id` becomes the parent;
|
|
55
|
+
* `newVersions` names the channels that changed, and only those plus the
|
|
56
|
+
* ones the parent stored are persisted. Last writer wins for a repeated
|
|
57
|
+
* `checkpoint_id`.
|
|
58
|
+
* @throws ValidationError; UpstreamError; RetryExhaustedError; AbortError; S3_OFFLOAD_FAILED when an offloaded payload cannot be uploaded.
|
|
59
|
+
*/
|
|
60
|
+
async put(config, checkpoint, metadata, newVersions) {
|
|
61
|
+
return (0, boundary_1.guardPublic)('saver.put', () => (0, put_1.putCheckpoint)(this.context, config, checkpoint, metadata, newVersions));
|
|
35
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Store a task's pending writes for the checkpoint `config` names, one row
|
|
65
|
+
* per write, written in parallel. Regular writes are first-write-wins;
|
|
66
|
+
* special channels (`__interrupt__`, `__resume__`, `__error__`,
|
|
67
|
+
* `__scheduled__`) overwrite, guarded so two concurrent calls never orphan
|
|
68
|
+
* an offloaded object.
|
|
69
|
+
* @throws ValidationError when `checkpoint_id` is missing or a channel is malformed; UpstreamError; RetryExhaustedError; AbortError.
|
|
70
|
+
*/
|
|
36
71
|
async putWrites(config, writes, taskId) {
|
|
37
|
-
return (0, put_writes_1.putWrites)(this.context, config, writes, taskId);
|
|
72
|
+
return (0, boundary_1.guardPublic)('saver.putWrites', () => (0, put_writes_1.putWrites)(this.context, config, writes, taskId));
|
|
38
73
|
}
|
|
39
|
-
|
|
40
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Delete every checkpoint, payload and pending write of a thread and their
|
|
76
|
+
* offloaded objects. Single pass: call it when the thread is quiescent.
|
|
77
|
+
* @throws BatchWriteAllIncompleteError when a delete batch does not fully drain; UpstreamError; AbortError (`options.signal`).
|
|
78
|
+
*/
|
|
79
|
+
async deleteThread(threadId, options) {
|
|
80
|
+
return (0, boundary_1.guardPublic)('saver.deleteThread', () => (0, delete_thread_1.deleteThread)(this.context, threadId, options));
|
|
41
81
|
}
|
|
42
82
|
/** Release owned resources (the underlying client and any S3 client). */
|
|
43
83
|
destroy() {
|
|
@@ -46,18 +86,20 @@ class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
|
|
|
46
86
|
this.ddbClient?.destroy();
|
|
47
87
|
}
|
|
48
88
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* `s3:GetLifecycleConfiguration
|
|
53
|
-
* permissions (broader than the
|
|
54
|
-
* needs) — call this once during
|
|
89
|
+
* Provision an S3 lifecycle expiration rule matching the configured TTL, so
|
|
90
|
+
* offloaded objects don't outlive their DynamoDB item forever. No-ops when
|
|
91
|
+
* S3 offload or TTL isn't configured; throws when the bucket cannot be read
|
|
92
|
+
* or written. Requires the `s3:GetLifecycleConfiguration` /
|
|
93
|
+
* `s3:PutLifecycleConfiguration` bucket-level permissions (broader than the
|
|
94
|
+
* object-level CRUD the rest of S3 offload needs) — call this once during
|
|
95
|
+
* deployment/provisioning, not per-request.
|
|
55
96
|
*/
|
|
56
97
|
async ensureS3LifecycleRule() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
98
|
+
return (0, boundary_1.guardPublic)('saver.ensureS3LifecycleRule', async () => {
|
|
99
|
+
if (!this.context.offloader || !this.context.ttl)
|
|
100
|
+
return;
|
|
101
|
+
await this.context.offloader.ensureLifecycleRule((0, ttl_1.lifecycleExpirationDays)(this.context.ttl));
|
|
102
|
+
});
|
|
60
103
|
}
|
|
61
104
|
}
|
|
62
105
|
exports.DynamoDBSaver = DynamoDBSaver;
|
|
63
|
-
//# sourceMappingURL=saver.js.map
|
|
@@ -11,6 +11,8 @@ export interface CheckpointConfigurable {
|
|
|
11
11
|
thread_id: string;
|
|
12
12
|
checkpoint_ns?: string;
|
|
13
13
|
checkpoint_id?: string;
|
|
14
|
+
/** Legacy alias of `checkpoint_id` that older callers and API-shaped configs still emit. */
|
|
15
|
+
thread_ts?: string;
|
|
14
16
|
}
|
|
15
17
|
/** The lightweight `META#` item: structural fields + serialized metadata. */
|
|
16
18
|
export interface CheckpointMetaItem {
|
|
@@ -21,6 +23,12 @@ export interface CheckpointMetaItem {
|
|
|
21
23
|
checkpointId: string;
|
|
22
24
|
parentCheckpointId?: string;
|
|
23
25
|
metadata: PayloadDescriptor;
|
|
26
|
+
/**
|
|
27
|
+
* The channels whose values the PAYLOAD row holds: those the put's
|
|
28
|
+
* `newVersions` named plus those carried over from the parent. Absent on
|
|
29
|
+
* rows written before this attribute, which hold every value they were given.
|
|
30
|
+
*/
|
|
31
|
+
storedChannels?: string[];
|
|
24
32
|
ttl?: number;
|
|
25
33
|
}
|
|
26
34
|
/** The heavy `PAYLOAD#` item: the serialized checkpoint. */
|
|
@@ -48,4 +56,3 @@ export interface CheckpointWriteItem {
|
|
|
48
56
|
value: PayloadDescriptor;
|
|
49
57
|
ttl?: number;
|
|
50
58
|
}
|
|
51
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import type { DynamoDBClient, DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import type { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
|
|
3
1
|
import { DynamoDBSaver } from '../checkpointer/saver';
|
|
4
2
|
import type { DynamoDBSaverOptions } from '../checkpointer/types';
|
|
5
3
|
import { DynamoDBChatMessageHistory } from '../history/chat-message-history';
|
|
6
4
|
import type { DynamoDBChatMessageHistoryOptions } from '../history/types';
|
|
7
|
-
import type { Logger } from '../shared/logging/logger';
|
|
8
5
|
import { DynamoDBStore } from '../store/store';
|
|
9
6
|
import type { DynamoDBStoreOptions } from '../store/types';
|
|
10
|
-
|
|
11
|
-
export interface FactoryBaseOptions {
|
|
12
|
-
client?: DynamoDBDocument;
|
|
13
|
-
clientConfig?: DynamoDBClientConfig;
|
|
14
|
-
createClient?: (config: DynamoDBClientConfig) => DynamoDBClient;
|
|
15
|
-
logger?: Logger;
|
|
16
|
-
}
|
|
17
|
-
/** Per-adapter options for {@link DynamoDBFactory.createAll} (client is shared). */
|
|
18
|
-
export interface CreateAllOptions {
|
|
19
|
-
saver: Omit<DynamoDBSaverOptions, 'client' | 'clientConfig' | 'createClient'>;
|
|
20
|
-
store: Omit<DynamoDBStoreOptions, 'client' | 'clientConfig' | 'createClient'>;
|
|
21
|
-
history: Omit<DynamoDBChatMessageHistoryOptions, 'client' | 'clientConfig' | 'createClient'>;
|
|
22
|
-
}
|
|
23
|
-
/** The three adapters sharing one client, plus a combined `destroy`. */
|
|
24
|
-
export interface CreatedAdapters {
|
|
25
|
-
saver: DynamoDBSaver;
|
|
26
|
-
store: DynamoDBStore;
|
|
27
|
-
history: DynamoDBChatMessageHistory;
|
|
28
|
-
destroy: () => void;
|
|
29
|
-
}
|
|
7
|
+
import type { CreateAllOptions, CreatedAdapters, FactoryBaseOptions } from './types';
|
|
30
8
|
/**
|
|
31
9
|
* Convenience constructors for the adapters. Individual `create*` methods each
|
|
32
10
|
* build their own client; {@link createAll} builds one shared client used by all
|
|
@@ -35,9 +13,28 @@ export interface CreatedAdapters {
|
|
|
35
13
|
export declare class DynamoDBFactory {
|
|
36
14
|
private readonly base;
|
|
37
15
|
constructor(base?: FactoryBaseOptions);
|
|
16
|
+
/** The base options every adapter inherits regardless of which client it uses. */
|
|
17
|
+
private sharedDefaults;
|
|
18
|
+
/**
|
|
19
|
+
* Per-adapter options replace the factory's client choice as a unit: a
|
|
20
|
+
* `client` handed to `createSaver` also displaces the base `clientConfig`
|
|
21
|
+
* and `createClient`, because carrying those along is exactly the ambiguous
|
|
22
|
+
* combination the adapters' option validation rejects. The shared
|
|
23
|
+
* `ttl`/`compression`/`s3`/`retry` defaults stay either way.
|
|
24
|
+
*/
|
|
25
|
+
private defaultsFor;
|
|
26
|
+
/** A saver on its own client, with the factory's shared defaults underneath `options`. */
|
|
38
27
|
createSaver(options: DynamoDBSaverOptions): DynamoDBSaver;
|
|
28
|
+
/** A store on its own client, with the factory's shared defaults underneath `options`. */
|
|
39
29
|
createStore(options: DynamoDBStoreOptions): DynamoDBStore;
|
|
30
|
+
/** A chat history on its own client, with the factory's shared defaults underneath `options`. */
|
|
40
31
|
createChatMessageHistory(options: DynamoDBChatMessageHistoryOptions): DynamoDBChatMessageHistory;
|
|
41
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Build the adapters whose sections are given, all on one shared client and
|
|
34
|
+
* with the factory's shared defaults underneath each section. If any
|
|
35
|
+
* constructor throws (a store with `vectorBackend` but no `index`, say), the
|
|
36
|
+
* adapters already built and the freshly created client are destroyed
|
|
37
|
+
* before the error propagates, so a failed call leaks nothing.
|
|
38
|
+
*/
|
|
39
|
+
createAll<O extends CreateAllOptions>(options: O): CreatedAdapters<O>;
|
|
42
40
|
}
|
|
43
|
-
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory/factory.js
CHANGED
|
@@ -5,6 +5,11 @@ const saver_1 = require("../checkpointer/saver");
|
|
|
5
5
|
const chat_message_history_1 = require("../history/chat-message-history");
|
|
6
6
|
const client_1 = require("../shared/dynamodb/client");
|
|
7
7
|
const store_1 = require("../store/store");
|
|
8
|
+
function overridesClient(options) {
|
|
9
|
+
return (options.client !== undefined ||
|
|
10
|
+
options.clientConfig !== undefined ||
|
|
11
|
+
options.createClient !== undefined);
|
|
12
|
+
}
|
|
8
13
|
/**
|
|
9
14
|
* Convenience constructors for the adapters. Individual `create*` methods each
|
|
10
15
|
* build their own client; {@link createAll} builds one shared client used by all
|
|
@@ -15,33 +20,68 @@ class DynamoDBFactory {
|
|
|
15
20
|
constructor(base = {}) {
|
|
16
21
|
this.base = base;
|
|
17
22
|
}
|
|
23
|
+
/** The base options every adapter inherits regardless of which client it uses. */
|
|
24
|
+
sharedDefaults() {
|
|
25
|
+
const { logger, ttl, compression, s3, retry } = this.base;
|
|
26
|
+
return { logger, ttl, compression, s3, retry };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Per-adapter options replace the factory's client choice as a unit: a
|
|
30
|
+
* `client` handed to `createSaver` also displaces the base `clientConfig`
|
|
31
|
+
* and `createClient`, because carrying those along is exactly the ambiguous
|
|
32
|
+
* combination the adapters' option validation rejects. The shared
|
|
33
|
+
* `ttl`/`compression`/`s3`/`retry` defaults stay either way.
|
|
34
|
+
*/
|
|
35
|
+
defaultsFor(options) {
|
|
36
|
+
return overridesClient(options) ? this.sharedDefaults() : this.base;
|
|
37
|
+
}
|
|
38
|
+
/** A saver on its own client, with the factory's shared defaults underneath `options`. */
|
|
18
39
|
createSaver(options) {
|
|
19
|
-
return new saver_1.DynamoDBSaver({ ...this.
|
|
40
|
+
return new saver_1.DynamoDBSaver({ ...this.defaultsFor(options), ...options });
|
|
20
41
|
}
|
|
42
|
+
/** A store on its own client, with the factory's shared defaults underneath `options`. */
|
|
21
43
|
createStore(options) {
|
|
22
|
-
return new store_1.DynamoDBStore({ ...this.
|
|
44
|
+
return new store_1.DynamoDBStore({ ...this.defaultsFor(options), ...options });
|
|
23
45
|
}
|
|
46
|
+
/** A chat history on its own client, with the factory's shared defaults underneath `options`. */
|
|
24
47
|
createChatMessageHistory(options) {
|
|
25
|
-
return new chat_message_history_1.DynamoDBChatMessageHistory({ ...this.
|
|
48
|
+
return new chat_message_history_1.DynamoDBChatMessageHistory({ ...this.defaultsFor(options), ...options });
|
|
26
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Build the adapters whose sections are given, all on one shared client and
|
|
52
|
+
* with the factory's shared defaults underneath each section. If any
|
|
53
|
+
* constructor throws (a store with `vectorBackend` but no `index`, say), the
|
|
54
|
+
* adapters already built and the freshly created client are destroyed
|
|
55
|
+
* before the error propagates, so a failed call leaks nothing.
|
|
56
|
+
*/
|
|
27
57
|
createAll(options) {
|
|
28
58
|
const resolved = (0, client_1.resolveDynamoDBClient)(this.base);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
history.destroy();
|
|
41
|
-
resolved.ddbClient?.destroy();
|
|
42
|
-
},
|
|
59
|
+
const shared = { ...this.sharedDefaults(), client: resolved.client };
|
|
60
|
+
const built = [];
|
|
61
|
+
/** Record an adapter the moment it exists, so a later failure can still tear it down. */
|
|
62
|
+
const track = (adapter) => {
|
|
63
|
+
built.push(adapter);
|
|
64
|
+
return adapter;
|
|
65
|
+
};
|
|
66
|
+
const destroy = () => {
|
|
67
|
+
for (const adapter of built)
|
|
68
|
+
adapter.destroy();
|
|
69
|
+
resolved.ddbClient?.destroy();
|
|
43
70
|
};
|
|
71
|
+
const { saver, store, history } = options;
|
|
72
|
+
try {
|
|
73
|
+
const adapters = {
|
|
74
|
+
saver: saver && track(new saver_1.DynamoDBSaver({ ...shared, ...saver })),
|
|
75
|
+
store: store && track(new store_1.DynamoDBStore({ ...shared, ...store })),
|
|
76
|
+
history: history && track(new chat_message_history_1.DynamoDBChatMessageHistory({ ...shared, ...history })),
|
|
77
|
+
destroy,
|
|
78
|
+
};
|
|
79
|
+
return adapters;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
destroy();
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
44
85
|
}
|
|
45
86
|
}
|
|
46
87
|
exports.DynamoDBFactory = DynamoDBFactory;
|
|
47
|
-
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
|
|
2
|
+
import type { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
|
|
3
|
+
import type { DynamoDBSaver } from '../checkpointer/saver';
|
|
4
|
+
import type { DynamoDBSaverOptions } from '../checkpointer/types';
|
|
5
|
+
import type { DynamoDBChatMessageHistory } from '../history/chat-message-history';
|
|
6
|
+
import type { DynamoDBChatMessageHistoryOptions } from '../history/types';
|
|
7
|
+
import type { CompressionConfig } from '../shared/codec/compression';
|
|
8
|
+
import type { S3OffloadConfig } from '../shared/codec/s3/config';
|
|
9
|
+
import type { RetryPolicy } from '../shared/dynamodb/retry-policy';
|
|
10
|
+
import type { Logger } from '../shared/logging/logger';
|
|
11
|
+
import type { TtlOption } from '../shared/validation/ttl';
|
|
12
|
+
import type { DynamoDBStore } from '../store/store';
|
|
13
|
+
import type { DynamoDBStoreOptions } from '../store/types';
|
|
14
|
+
/**
|
|
15
|
+
* Defaults applied to every adapter the factory builds: the client (or how to
|
|
16
|
+
* build one) and the cross-cutting options a team usually wants identical
|
|
17
|
+
* across its checkpointer, store and history. A per-adapter option wins.
|
|
18
|
+
*/
|
|
19
|
+
export interface FactoryBaseOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Reused as-is by every adapter. Construct it with `maxAttempts: 1`, or the
|
|
22
|
+
* SDK's own retries stack inside the library's retry budget (each adapter
|
|
23
|
+
* logs a `warn` at construction when they would).
|
|
24
|
+
*/
|
|
25
|
+
client?: DynamoDBDocument;
|
|
26
|
+
clientConfig?: DynamoDBClientConfig;
|
|
27
|
+
logger?: Logger;
|
|
28
|
+
ttl?: TtlOption;
|
|
29
|
+
compression?: CompressionConfig;
|
|
30
|
+
s3?: S3OffloadConfig;
|
|
31
|
+
retry?: RetryPolicy;
|
|
32
|
+
}
|
|
33
|
+
/** An adapter's own options inside {@link CreateAllOptions}: everything but the shared client. */
|
|
34
|
+
export type AdapterSection<Options> = Omit<Options, 'client' | 'clientConfig' | 'createClient'>;
|
|
35
|
+
/** Per-adapter options for `DynamoDBFactory.createAll`; omit a section to skip that adapter. */
|
|
36
|
+
export interface CreateAllOptions {
|
|
37
|
+
saver?: AdapterSection<DynamoDBSaverOptions>;
|
|
38
|
+
store?: AdapterSection<DynamoDBStoreOptions>;
|
|
39
|
+
history?: AdapterSection<DynamoDBChatMessageHistoryOptions>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The adapters `createAll` built, typed by the sections it was given: an
|
|
43
|
+
* omitted section is `undefined`. The default names the all-three result.
|
|
44
|
+
*/
|
|
45
|
+
export interface CreatedAdapters<O extends CreateAllOptions = Required<CreateAllOptions>> {
|
|
46
|
+
saver: O extends {
|
|
47
|
+
saver: object;
|
|
48
|
+
} ? DynamoDBSaver : undefined;
|
|
49
|
+
store: O extends {
|
|
50
|
+
store: object;
|
|
51
|
+
} ? DynamoDBStore : undefined;
|
|
52
|
+
history: O extends {
|
|
53
|
+
history: object;
|
|
54
|
+
} ? DynamoDBChatMessageHistory : undefined;
|
|
55
|
+
/** Tear down every built adapter and the shared client, once. */
|
|
56
|
+
destroy: () => void;
|
|
57
|
+
}
|
|
@@ -12,5 +12,4 @@ import type { HistoryContext } from '../internal/setup';
|
|
|
12
12
|
* Per item the 400 KB DynamoDB limit still applies; enable S3 offloading so
|
|
13
13
|
* large payloads become small descriptors and stay well under the limits.
|
|
14
14
|
*/
|
|
15
|
-
export declare function addMessages(context: HistoryContext, sessionId: string, messages: BaseMessage[]): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=add-messages.d.ts.map
|
|
15
|
+
export declare function addMessages(context: HistoryContext, sessionId: string, messages: BaseMessage[], signal?: AbortSignal): Promise<void>;
|
|
@@ -57,13 +57,14 @@ async function buildItems(context, sessionId, stored, ttlTimestamp) {
|
|
|
57
57
|
* Per item the 400 KB DynamoDB limit still applies; enable S3 offloading so
|
|
58
58
|
* large payloads become small descriptors and stay well under the limits.
|
|
59
59
|
*/
|
|
60
|
-
async function addMessages(context, sessionId, messages) {
|
|
60
|
+
async function addMessages(context, sessionId, messages, signal) {
|
|
61
61
|
(0, validation_1.validateSessionId)(sessionId);
|
|
62
62
|
if (messages.length === 0)
|
|
63
63
|
return;
|
|
64
64
|
const stored = (0, messages_1.mapChatMessagesToStoredMessages)(messages);
|
|
65
|
+
(0, validation_1.validateStorableMessages)(stored);
|
|
65
66
|
const anchor = context.ttl
|
|
66
|
-
? await (0, ttl_anchor_1.resolveTtlAnchor)(context, sessionId, (0, ttl_1.calculateTtlTimestamp)(context.ttl))
|
|
67
|
+
? await (0, ttl_anchor_1.resolveTtlAnchor)(context, sessionId, (0, ttl_1.calculateTtlTimestamp)(context.ttl), signal)
|
|
67
68
|
: undefined;
|
|
68
69
|
const items = await buildItems(context, sessionId, stored, anchor?.ttlTimestamp);
|
|
69
70
|
const chunks = (0, message_chunker_1.chunkBySize)(items, MAX_MESSAGES_PER_TRANSACTION, MAX_TRANSACTION_BYTES);
|
|
@@ -72,6 +73,5 @@ async function addMessages(context, sessionId, messages) {
|
|
|
72
73
|
title: (0, title_generator_1.deriveTitle)(stored),
|
|
73
74
|
ttlTimestamp: anchor?.ttlTimestamp,
|
|
74
75
|
forceTtlRefresh: anchor?.refresh,
|
|
75
|
-
});
|
|
76
|
+
}, signal);
|
|
76
77
|
}
|
|
77
|
-
//# sourceMappingURL=add-messages.js.map
|
|
@@ -5,5 +5,6 @@ import type { HistoryContext } from '../internal/setup';
|
|
|
5
5
|
* place and logged, so a shared-table partition holding a foreign row is never
|
|
6
6
|
* collaterally wiped.
|
|
7
7
|
*/
|
|
8
|
-
export declare function clearSession(context: HistoryContext, sessionId: string
|
|
9
|
-
|
|
8
|
+
export declare function clearSession(context: HistoryContext, sessionId: string, options?: {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}): Promise<void>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.clearSession = clearSession;
|
|
4
4
|
const partition_delete_1 = require("../../shared/dynamodb/partition-delete");
|
|
5
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
5
6
|
const keys_1 = require("../internal/keys");
|
|
6
7
|
const query_1 = require("../internal/query");
|
|
7
8
|
const validation_1 = require("../internal/validation");
|
|
@@ -15,17 +16,19 @@ function descriptorsOf(row) {
|
|
|
15
16
|
* place and logged, so a shared-table partition holding a foreign row is never
|
|
16
17
|
* collaterally wiped.
|
|
17
18
|
*/
|
|
18
|
-
async function clearSession(context, sessionId) {
|
|
19
|
+
async function clearSession(context, sessionId, options = {}) {
|
|
19
20
|
(0, validation_1.validateSessionId)(sessionId);
|
|
20
21
|
await (0, partition_delete_1.deletePartitionRows)({
|
|
21
22
|
client: context.client,
|
|
22
23
|
tableName: context.tableName,
|
|
23
24
|
params: (0, query_1.sessionItemsQuery)(context.tableName, sessionId, { consistent: true }),
|
|
24
25
|
logger: context.logger,
|
|
26
|
+
retry: (0, retry_policy_1.retryFor)(context, options.signal),
|
|
27
|
+
signal: options.signal,
|
|
25
28
|
offloader: context.offloader,
|
|
26
29
|
operation: 'history.clear',
|
|
27
30
|
ownsSortKey: keys_1.isHistorySortKey,
|
|
28
31
|
descriptorsOf,
|
|
32
|
+
scope: [sessionId],
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
|
-
//# sourceMappingURL=clear.js.map
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { type BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { CancelOptions } from '../../shared/options';
|
|
2
3
|
import type { HistoryContext } from '../internal/setup';
|
|
4
|
+
import type { MessageWindow } from '../types';
|
|
3
5
|
/**
|
|
4
|
-
* Return a session's messages in chronological order
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Return a session's messages in chronological order — the whole session, or
|
|
7
|
+
* the window `options` selects: `limit` keeps only the newest `limit`
|
|
8
|
+
* messages, `before` only those appended before that instant (see
|
|
9
|
+
* {@link readWindow}). Items past their TTL are filtered out on read
|
|
10
|
+
* (DynamoDB's background TTL sweep can lag by up to 48h), so the returned
|
|
11
|
+
* history is never stale. A corrupt item — see
|
|
12
|
+
* {@link decodeMessage} for exactly what counts — is handled per
|
|
13
|
+
* `onCorruptMessage`: `'throw'` fails the read with the underlying error;
|
|
14
|
+
* `'skip'` (the default) reports it at `error` with its sort key and returns
|
|
15
|
+
* the rest. Every other failure propagates regardless of the policy.
|
|
8
16
|
*/
|
|
9
|
-
export declare function getMessages(context: HistoryContext, sessionId: string): Promise<BaseMessage[]>;
|
|
10
|
-
//# sourceMappingURL=get-messages.d.ts.map
|
|
17
|
+
export declare function getMessages(context: HistoryContext, sessionId: string, options?: MessageWindow & CancelOptions): Promise<BaseMessage[]>;
|