@farukada/aws-langgraph-dynamodb-ts 0.8.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 +94 -61
- package/dist/checkpointer/actions/put-writes.d.ts +5 -5
- package/dist/checkpointer/actions/put-writes.js +12 -40
- 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 +31 -6
- package/dist/checkpointer/internal/item-reader.js +54 -15
- package/dist/checkpointer/internal/item-writer.d.ts +12 -3
- package/dist/checkpointer/internal/item-writer.js +26 -10
- 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 +29 -0
- package/dist/checkpointer/internal/special-write-cas.js +104 -0
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +19 -14
- package/dist/checkpointer/internal/special-write-cleanup.js +35 -87
- package/dist/checkpointer/internal/special-write-verify.d.ts +53 -0
- package/dist/checkpointer/internal/special-write-verify.js +80 -0
- 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 -9
- package/dist/checkpointer/internal/write-guard.js +16 -16
- package/dist/checkpointer/internal/write-index.d.ts +8 -1
- package/dist/checkpointer/internal/write-index.js +6 -3
- package/dist/checkpointer/saver.d.ts +50 -10
- package/dist/checkpointer/saver.js +59 -17
- package/dist/checkpointer/types.d.ts +14 -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 +68 -5
- package/dist/shared/constants.js +70 -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 +67 -0
- package/dist/shared/dynamodb/conditional-put.js +76 -0
- 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 +14 -6
- package/dist/shared/logging/redaction.js +19 -4
- package/dist/shared/logging/secret-patterns.d.ts +54 -3
- package/dist/shared/logging/secret-patterns.js +67 -8
- 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 +27 -28
- 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 +14 -7
- 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 +25 -6
- package/dist/store/internal/index-reconcile.d.ts +5 -6
- package/dist/store/internal/index-reconcile.js +32 -13
- 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 +6 -3
- package/dist/store/internal/item-mapper.js +16 -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 +32 -0
- package/dist/store/internal/overwrite-swap.js +68 -0
- package/dist/store/internal/persist.d.ts +24 -7
- package/dist/store/internal/persist.js +49 -19
- 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 +23 -0
- package/dist/store/internal/read-existing.js +41 -0
- package/dist/store/internal/score-direction.d.ts +31 -0
- package/dist/store/internal/score-direction.js +38 -0
- 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 +6 -12
- package/dist/store/internal/setup.js +12 -24
- 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 +27 -9
- package/dist/store/internal/write-verify.js +35 -19
- package/dist/store/store.d.ts +37 -9
- package/dist/store/store.js +52 -17
- package/dist/store/types.d.ts +22 -2
- package/dist/store/types.js +0 -1
- package/dist/store/vector-backend.d.ts +6 -7
- 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-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.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/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/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/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,23 +1,29 @@
|
|
|
1
1
|
import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
|
|
2
2
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
3
|
+
/** The read window an adapter applies to every `getMessages`. */
|
|
4
|
+
export type AdapterWindow = {
|
|
5
|
+
limit?: number;
|
|
6
|
+
};
|
|
3
7
|
/** The session-scoped operations a single-session adapter delegates to. */
|
|
4
8
|
export interface SessionBackend {
|
|
5
|
-
getMessages(sessionId: string): Promise<BaseMessage[]>;
|
|
9
|
+
getMessages(sessionId: string, window?: AdapterWindow): Promise<BaseMessage[]>;
|
|
6
10
|
addMessages(sessionId: string, messages: BaseMessage[]): Promise<void>;
|
|
7
11
|
clear(sessionId: string): Promise<void>;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
14
|
* Single-session view over a {@link SessionBackend}, implementing LangChain's
|
|
11
15
|
* `BaseListChatMessageHistory` so it can drive `RunnableWithMessageHistory`.
|
|
16
|
+
* A `window` bounds what every read hands the chain — `{ limit: 50 }` feeds it
|
|
17
|
+
* the newest fifty messages instead of the whole session.
|
|
12
18
|
*/
|
|
13
19
|
export declare class DynamoDBSessionChatMessageHistory extends BaseListChatMessageHistory {
|
|
14
20
|
private readonly backend;
|
|
15
21
|
private readonly sessionId;
|
|
22
|
+
private readonly window?;
|
|
16
23
|
lc_namespace: string[];
|
|
17
|
-
constructor(backend: SessionBackend, sessionId: string);
|
|
24
|
+
constructor(backend: SessionBackend, sessionId: string, window?: AdapterWindow | undefined);
|
|
18
25
|
getMessages(): Promise<BaseMessage[]>;
|
|
19
26
|
addMessage(message: BaseMessage): Promise<void>;
|
|
20
27
|
addMessages(messages: BaseMessage[]): Promise<void>;
|
|
21
28
|
clear(): Promise<void>;
|
|
22
29
|
}
|
|
23
|
-
//# sourceMappingURL=session-adapter.d.ts.map
|
|
@@ -5,18 +5,22 @@ const chat_history_1 = require("@langchain/core/chat_history");
|
|
|
5
5
|
/**
|
|
6
6
|
* Single-session view over a {@link SessionBackend}, implementing LangChain's
|
|
7
7
|
* `BaseListChatMessageHistory` so it can drive `RunnableWithMessageHistory`.
|
|
8
|
+
* A `window` bounds what every read hands the chain — `{ limit: 50 }` feeds it
|
|
9
|
+
* the newest fifty messages instead of the whole session.
|
|
8
10
|
*/
|
|
9
11
|
class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessageHistory {
|
|
10
12
|
backend;
|
|
11
13
|
sessionId;
|
|
14
|
+
window;
|
|
12
15
|
lc_namespace = ['langchain', 'stores', 'message', 'dynamodb'];
|
|
13
|
-
constructor(backend, sessionId) {
|
|
16
|
+
constructor(backend, sessionId, window) {
|
|
14
17
|
super();
|
|
15
18
|
this.backend = backend;
|
|
16
19
|
this.sessionId = sessionId;
|
|
20
|
+
this.window = window;
|
|
17
21
|
}
|
|
18
22
|
getMessages() {
|
|
19
|
-
return this.backend.getMessages(this.sessionId);
|
|
23
|
+
return this.backend.getMessages(this.sessionId, this.window);
|
|
20
24
|
}
|
|
21
25
|
addMessage(message) {
|
|
22
26
|
return this.backend.addMessages(this.sessionId, [message]);
|
|
@@ -29,4 +33,3 @@ class DynamoDBSessionChatMessageHistory extends chat_history_1.BaseListChatMessa
|
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
exports.DynamoDBSessionChatMessageHistory = DynamoDBSessionChatMessageHistory;
|
|
32
|
-
//# sourceMappingURL=session-adapter.js.map
|
package/dist/history/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
2
2
|
import type { PayloadDescriptor } from '../shared/codec/codec';
|
|
3
|
-
import type { BaseAdapterOptions, CodecOptions } from '../shared/options';
|
|
3
|
+
import type { BaseAdapterOptions, CancelOptions, CodecOptions } from '../shared/options';
|
|
4
4
|
/** Options for {@link DynamoDBChatMessageHistory}. */
|
|
5
5
|
export type DynamoDBChatMessageHistoryOptions = BaseAdapterOptions & CodecOptions & {
|
|
6
6
|
/** Optional serializer override (defaults to the JSON serializer). */
|
|
@@ -18,6 +18,26 @@ export type DynamoDBChatMessageHistoryOptions = BaseAdapterOptions & CodecOption
|
|
|
18
18
|
};
|
|
19
19
|
/** How `getMessages` handles an item it cannot decode. */
|
|
20
20
|
export type CorruptMessagePolicy = 'skip' | 'throw';
|
|
21
|
+
/**
|
|
22
|
+
* Which slice of a session `getMessages` returns. Both bounds are optional
|
|
23
|
+
* and combine: `{ limit: 50, before }` is the fifty messages just before
|
|
24
|
+
* `before`.
|
|
25
|
+
*/
|
|
26
|
+
export interface MessageWindow {
|
|
27
|
+
/** Return only the newest `limit` messages — still in chronological order. */
|
|
28
|
+
limit?: number;
|
|
29
|
+
/** Return only messages appended before this instant (millisecond precision). */
|
|
30
|
+
before?: Date;
|
|
31
|
+
}
|
|
32
|
+
/** Options for `getMessages`: the read window plus cancellation. */
|
|
33
|
+
export type GetMessagesOptions = MessageWindow & CancelOptions;
|
|
34
|
+
/** Options for `listSessions`: the scan caps plus cancellation. */
|
|
35
|
+
export interface ListSessionsOptions extends CancelOptions {
|
|
36
|
+
/** Cap on scan pages before `ResultTruncatedError` (default 1000). */
|
|
37
|
+
maxIterations?: number;
|
|
38
|
+
/** Cap on rows read into memory before `ResultTruncatedError` (default 10 000). */
|
|
39
|
+
maxItems?: number;
|
|
40
|
+
}
|
|
21
41
|
/** Summary of a stored chat session. */
|
|
22
42
|
export interface SessionMetadata {
|
|
23
43
|
sessionId: string;
|
|
@@ -25,6 +45,8 @@ export interface SessionMetadata {
|
|
|
25
45
|
messageCount: number;
|
|
26
46
|
createdAt: string;
|
|
27
47
|
updatedAt: string;
|
|
48
|
+
/** When the session's TTL expires, as an ISO-8601 instant; absent when no TTL is stored. */
|
|
49
|
+
expiresAt?: string;
|
|
28
50
|
}
|
|
29
51
|
/** A single stored chat message item (one per message, ordered by its ULID). */
|
|
30
52
|
export interface ChatMessageItem {
|
|
@@ -45,4 +67,3 @@ export interface ChatSessionItem {
|
|
|
45
67
|
updatedAt: string;
|
|
46
68
|
ttl?: number;
|
|
47
69
|
}
|
|
48
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/history/types.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,19 +4,26 @@ export { DynamoDBStore } from './store/store';
|
|
|
4
4
|
export type { DynamoDBStoreOptions } from './store/types';
|
|
5
5
|
export type { VectorReconcileResult } from './store/actions/reconcile-vector-index';
|
|
6
6
|
export type { VectorBackend, VectorMatch, VectorRef } from './store/vector-backend';
|
|
7
|
+
export type { VectorScoreDirection } from './store/internal/score-direction';
|
|
7
8
|
export { DynamoDBChatMessageHistory } from './history/chat-message-history';
|
|
8
9
|
export { DynamoDBSessionChatMessageHistory } from './history/session-adapter';
|
|
9
|
-
export type {
|
|
10
|
+
export type { AdapterWindow, SessionBackend } from './history/session-adapter';
|
|
11
|
+
export type { CorruptMessagePolicy, DynamoDBChatMessageHistoryOptions, GetMessagesOptions, ListSessionsOptions, MessageWindow, SessionMetadata, } from './history/types';
|
|
10
12
|
export { DynamoDBFactory } from './factory/factory';
|
|
11
|
-
export type { CreateAllOptions, CreatedAdapters, FactoryBaseOptions } from './factory/
|
|
12
|
-
export {
|
|
13
|
+
export type { AdapterSection, CreateAllOptions, CreatedAdapters, FactoryBaseOptions, } from './factory/types';
|
|
14
|
+
export { DynamoDBLangGraphError, isDynamoDBLangGraphError } from './shared/errors/base-error';
|
|
13
15
|
export type { ErrorContext } from './shared/errors/base-error';
|
|
14
16
|
export { ErrorCode } from './shared/errors/error-code';
|
|
15
17
|
export { AbortError, BatchWriteAllIncompleteError, BatchWriteIncompleteError, CompensationFailedError, ConflictError, ResultTruncatedError, RetryExhaustedError, ValidationError, } from './shared/errors/errors';
|
|
18
|
+
export { UpstreamError } from './shared/errors/upstream-error';
|
|
16
19
|
export type { Logger, LogArgument } from './shared/logging/logger';
|
|
17
20
|
export { redactLogger, redactSecrets } from './shared/logging/redaction';
|
|
18
|
-
export type {
|
|
21
|
+
export type { RedactLoggerOptions } from './shared/logging/redaction';
|
|
22
|
+
export type { Redactable } from './shared/logging/redaction-walk';
|
|
23
|
+
export type { CancelOptions, BaseAdapterOptions, CodecOptions } from './shared/options';
|
|
24
|
+
export type { RetryAttemptInfo, RetryOptions } from './shared/dynamodb/retry';
|
|
25
|
+
export type { RetryPolicy } from './shared/dynamodb/retry-policy';
|
|
19
26
|
export type { TtlOption } from './shared/validation/ttl';
|
|
20
27
|
export type { CompressionConfig } from './shared/codec/compression';
|
|
21
28
|
export type { S3OffloadConfig } from './shared/codec/s3/config';
|
|
22
|
-
|
|
29
|
+
export type { S3ClientConfigLike, S3ClientLike, S3ClientOption, S3ClientOptions, S3CommandLike, S3RegionLike, } from './shared/codec/s3/client-types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.redactSecrets = exports.redactLogger = exports.ValidationError = exports.RetryExhaustedError = exports.ResultTruncatedError = exports.ConflictError = exports.CompensationFailedError = exports.BatchWriteIncompleteError = exports.BatchWriteAllIncompleteError = exports.AbortError = exports.ErrorCode = exports.
|
|
3
|
+
exports.redactSecrets = exports.redactLogger = exports.UpstreamError = exports.ValidationError = exports.RetryExhaustedError = exports.ResultTruncatedError = exports.ConflictError = exports.CompensationFailedError = exports.BatchWriteIncompleteError = exports.BatchWriteAllIncompleteError = exports.AbortError = exports.ErrorCode = exports.isDynamoDBLangGraphError = exports.DynamoDBLangGraphError = exports.DynamoDBFactory = exports.DynamoDBSessionChatMessageHistory = exports.DynamoDBChatMessageHistory = exports.DynamoDBStore = exports.DynamoDBSaver = void 0;
|
|
4
4
|
var saver_1 = require("./checkpointer/saver");
|
|
5
5
|
Object.defineProperty(exports, "DynamoDBSaver", { enumerable: true, get: function () { return saver_1.DynamoDBSaver; } });
|
|
6
6
|
var store_1 = require("./store/store");
|
|
@@ -12,7 +12,8 @@ Object.defineProperty(exports, "DynamoDBSessionChatMessageHistory", { enumerable
|
|
|
12
12
|
var factory_1 = require("./factory/factory");
|
|
13
13
|
Object.defineProperty(exports, "DynamoDBFactory", { enumerable: true, get: function () { return factory_1.DynamoDBFactory; } });
|
|
14
14
|
var base_error_1 = require("./shared/errors/base-error");
|
|
15
|
-
Object.defineProperty(exports, "
|
|
15
|
+
Object.defineProperty(exports, "DynamoDBLangGraphError", { enumerable: true, get: function () { return base_error_1.DynamoDBLangGraphError; } });
|
|
16
|
+
Object.defineProperty(exports, "isDynamoDBLangGraphError", { enumerable: true, get: function () { return base_error_1.isDynamoDBLangGraphError; } });
|
|
16
17
|
var error_code_1 = require("./shared/errors/error-code");
|
|
17
18
|
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return error_code_1.ErrorCode; } });
|
|
18
19
|
var errors_1 = require("./shared/errors/errors");
|
|
@@ -24,7 +25,8 @@ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: functio
|
|
|
24
25
|
Object.defineProperty(exports, "ResultTruncatedError", { enumerable: true, get: function () { return errors_1.ResultTruncatedError; } });
|
|
25
26
|
Object.defineProperty(exports, "RetryExhaustedError", { enumerable: true, get: function () { return errors_1.RetryExhaustedError; } });
|
|
26
27
|
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
28
|
+
var upstream_error_1 = require("./shared/errors/upstream-error");
|
|
29
|
+
Object.defineProperty(exports, "UpstreamError", { enumerable: true, get: function () { return upstream_error_1.UpstreamError; } });
|
|
27
30
|
var redaction_1 = require("./shared/logging/redaction");
|
|
28
31
|
Object.defineProperty(exports, "redactLogger", { enumerable: true, get: function () { return redaction_1.redactLogger; } });
|
|
29
32
|
Object.defineProperty(exports, "redactSecrets", { enumerable: true, get: function () { return redaction_1.redactSecrets; } });
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
package/dist/shared/clock.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/** Current time as an ISO-8601 string, derived from the (test-freezable) clock. */
|
|
2
2
|
export declare function nowIso(): string;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Current time as whole epoch seconds, the unit DynamoDB TTL uses. Every
|
|
5
|
+
* expiry stamp, expiry filter and ttl-anchor comparison reads this one seam
|
|
6
|
+
* so they agree with each other under a frozen or skewed clock.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nowSeconds(): number;
|
package/dist/shared/clock.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nowIso = nowIso;
|
|
4
|
+
exports.nowSeconds = nowSeconds;
|
|
4
5
|
/** Current time as an ISO-8601 string, derived from the (test-freezable) clock. */
|
|
5
6
|
function nowIso() {
|
|
6
7
|
return new Date(Date.now()).toISOString();
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Current time as whole epoch seconds, the unit DynamoDB TTL uses. Every
|
|
11
|
+
* expiry stamp, expiry filter and ttl-anchor comparison reads this one seam
|
|
12
|
+
* so they agree with each other under a frozen or skewed clock.
|
|
13
|
+
*/
|
|
14
|
+
function nowSeconds() {
|
|
15
|
+
return Math.floor(Date.now() / 1000);
|
|
16
|
+
}
|
|
@@ -6,18 +6,26 @@ export declare enum PayloadLocation {
|
|
|
6
6
|
INLINE = "INLINE",
|
|
7
7
|
S3 = "S3"
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Version of the persisted descriptor shape. Absent on rows written before it
|
|
11
|
+
* existed, which read as version 1; a higher value marks a row written by a
|
|
12
|
+
* newer library and is refused rather than misread.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DESCRIPTOR_SCHEMA_VERSION = 1;
|
|
15
|
+
/** Fields every descriptor carries, whatever its location. */
|
|
16
|
+
interface DescriptorBase {
|
|
17
|
+
schemaVersion?: number;
|
|
12
18
|
serdeType: string;
|
|
13
19
|
compressed: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** A payload stored inline as bytes in the DynamoDB item. */
|
|
22
|
+
interface InlinePayloadDescriptor extends DescriptorBase {
|
|
23
|
+
location: PayloadLocation.INLINE;
|
|
14
24
|
bytes: Uint8Array;
|
|
15
25
|
}
|
|
16
26
|
/** A payload offloaded to S3, referenced by key. */
|
|
17
|
-
interface S3PayloadDescriptor {
|
|
27
|
+
interface S3PayloadDescriptor extends DescriptorBase {
|
|
18
28
|
location: PayloadLocation.S3;
|
|
19
|
-
serdeType: string;
|
|
20
|
-
compressed: boolean;
|
|
21
29
|
s3Key: string;
|
|
22
30
|
}
|
|
23
31
|
/** The result of encoding a payload. */
|
|
@@ -28,17 +36,18 @@ export interface CodecDeps {
|
|
|
28
36
|
compression?: CompressionConfig;
|
|
29
37
|
offloader?: S3Offloader;
|
|
30
38
|
}
|
|
31
|
-
/** Options controlling where an offloaded payload's S3 key is built from. */
|
|
32
|
-
export interface EncodeOptions {
|
|
33
|
-
keyParts: readonly string[];
|
|
34
|
-
}
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
40
|
+
* Fetch a descriptor's bytes — an S3 download when offloaded — and undo
|
|
41
|
+
* compression. Infrastructure only, no deserialization: a caller that needs to
|
|
42
|
+
* tell a transport or permission failure from bad data does this step and
|
|
43
|
+
* `loadsTyped` separately (see `history/actions/get-messages.ts`).
|
|
44
|
+
*
|
|
45
|
+
* `scope` is the row's own leading key parts (`[threadId]`, `[...namespace,
|
|
46
|
+
* key]`, `[sessionId]`): an offloaded key is downloaded only when it lies under
|
|
47
|
+
* the path those parts produce, so a row can never point this adapter at an
|
|
48
|
+
* object it does not own.
|
|
39
49
|
*/
|
|
40
|
-
export declare function
|
|
41
|
-
/** Decode a {@link PayloadDescriptor} produced by {@link
|
|
42
|
-
export declare function decodePayload<T>(descriptor: PayloadDescriptor, deps: CodecDeps): Promise<T>;
|
|
50
|
+
export declare function readPayloadBytes(descriptor: PayloadDescriptor, deps: CodecDeps, scope: readonly string[]): Promise<Uint8Array>;
|
|
51
|
+
/** Decode a {@link PayloadDescriptor} produced by `encodePayload`; see {@link readPayloadBytes} for `scope`. */
|
|
52
|
+
export declare function decodePayload<T>(descriptor: PayloadDescriptor, deps: CodecDeps, scope: readonly string[]): Promise<T>;
|
|
43
53
|
export {};
|
|
44
|
-
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayloadLocation = void 0;
|
|
4
|
-
exports.
|
|
3
|
+
exports.DESCRIPTOR_SCHEMA_VERSION = exports.PayloadLocation = void 0;
|
|
4
|
+
exports.readPayloadBytes = readPayloadBytes;
|
|
5
5
|
exports.decodePayload = decodePayload;
|
|
6
|
+
const errors_1 = require("../errors/errors");
|
|
6
7
|
const compression_1 = require("./compression");
|
|
7
8
|
/** Where an encoded payload lives. */
|
|
8
9
|
var PayloadLocation;
|
|
@@ -10,35 +11,56 @@ var PayloadLocation;
|
|
|
10
11
|
PayloadLocation["INLINE"] = "INLINE";
|
|
11
12
|
PayloadLocation["S3"] = "S3";
|
|
12
13
|
})(PayloadLocation || (exports.PayloadLocation = PayloadLocation = {}));
|
|
14
|
+
/**
|
|
15
|
+
* Version of the persisted descriptor shape. Absent on rows written before it
|
|
16
|
+
* existed, which read as version 1; a higher value marks a row written by a
|
|
17
|
+
* newer library and is refused rather than misread.
|
|
18
|
+
*/
|
|
19
|
+
exports.DESCRIPTOR_SCHEMA_VERSION = 1;
|
|
13
20
|
function requireOffloader(deps) {
|
|
14
21
|
if (!deps.offloader) {
|
|
15
|
-
throw new
|
|
22
|
+
throw new errors_1.ValidationError("this row's payload is offloaded to S3 but the adapter has no `s3` configuration; " +
|
|
23
|
+
'configure the bucket the writer used', 's3');
|
|
16
24
|
}
|
|
17
25
|
return deps.offloader;
|
|
18
26
|
}
|
|
27
|
+
/** Refuse a descriptor this version cannot read: a newer schema, or an unknown location. */
|
|
28
|
+
function assertReadableDescriptor(descriptor) {
|
|
29
|
+
const version = descriptor.schemaVersion ?? exports.DESCRIPTOR_SCHEMA_VERSION;
|
|
30
|
+
if (version > exports.DESCRIPTOR_SCHEMA_VERSION) {
|
|
31
|
+
throw new errors_1.ValidationError(`payload descriptor schemaVersion ${version} was written by a newer version of this ` +
|
|
32
|
+
'library; upgrade to read it', 'descriptor');
|
|
33
|
+
}
|
|
34
|
+
const locations = Object.values(PayloadLocation);
|
|
35
|
+
if (!locations.includes(descriptor.location)) {
|
|
36
|
+
throw new errors_1.ValidationError(`payload descriptor has an unknown location ${JSON.stringify(descriptor.location)}`, 'descriptor');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
19
39
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
40
|
+
* Fetch a descriptor's bytes — an S3 download when offloaded — and undo
|
|
41
|
+
* compression. Infrastructure only, no deserialization: a caller that needs to
|
|
42
|
+
* tell a transport or permission failure from bad data does this step and
|
|
43
|
+
* `loadsTyped` separately (see `history/actions/get-messages.ts`).
|
|
44
|
+
*
|
|
45
|
+
* `scope` is the row's own leading key parts (`[threadId]`, `[...namespace,
|
|
46
|
+
* key]`, `[sessionId]`): an offloaded key is downloaded only when it lies under
|
|
47
|
+
* the path those parts produce, so a row can never point this adapter at an
|
|
48
|
+
* object it does not own.
|
|
23
49
|
*/
|
|
24
|
-
async function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
async function readPayloadBytes(descriptor, deps, scope) {
|
|
51
|
+
assertReadableDescriptor(descriptor);
|
|
52
|
+
let raw;
|
|
53
|
+
if (descriptor.location === PayloadLocation.S3) {
|
|
54
|
+
const offloader = requireOffloader(deps);
|
|
55
|
+
offloader.assertOwnedKey(descriptor.s3Key, scope);
|
|
56
|
+
raw = await offloader.download(descriptor.s3Key);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
raw = descriptor.bytes;
|
|
33
60
|
}
|
|
34
|
-
return
|
|
61
|
+
return (0, compression_1.decompress)(raw, descriptor.compressed, deps.compression?.maxDecompressedBytes);
|
|
35
62
|
}
|
|
36
|
-
/** Decode a {@link PayloadDescriptor} produced by {@link
|
|
37
|
-
async function decodePayload(descriptor, deps) {
|
|
38
|
-
|
|
39
|
-
? await requireOffloader(deps).download(descriptor.s3Key)
|
|
40
|
-
: descriptor.bytes;
|
|
41
|
-
const bytes = await (0, compression_1.decompress)(raw, descriptor.compressed, deps.compression?.maxDecompressedBytes);
|
|
42
|
-
return deps.serde.loadsTyped(descriptor.serdeType, bytes);
|
|
63
|
+
/** Decode a {@link PayloadDescriptor} produced by `encodePayload`; see {@link readPayloadBytes} for `scope`. */
|
|
64
|
+
async function decodePayload(descriptor, deps, scope) {
|
|
65
|
+
return deps.serde.loadsTyped(descriptor.serdeType, await readPayloadBytes(descriptor, deps, scope));
|
|
43
66
|
}
|
|
44
|
-
//# sourceMappingURL=codec.js.map
|
|
@@ -18,8 +18,7 @@ export interface CompressionResult {
|
|
|
18
18
|
export declare function compress(data: Uint8Array, config: CompressionConfig): Promise<CompressionResult>;
|
|
19
19
|
/**
|
|
20
20
|
* Gunzip `data` when `compressed` is true; otherwise return it unchanged. Throws
|
|
21
|
-
* a {@link
|
|
21
|
+
* a {@link DynamoDBLangGraphError} with code `COMPRESSION_LIMIT` if the output
|
|
22
22
|
* would exceed `maxBytes` (bomb guard).
|
|
23
23
|
*/
|
|
24
24
|
export declare function decompress(data: Uint8Array, compressed: boolean, maxBytes?: number): Promise<Uint8Array>;
|
|
25
|
-
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -29,7 +29,7 @@ async function compress(data, config) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Gunzip `data` when `compressed` is true; otherwise return it unchanged. Throws
|
|
32
|
-
* a {@link
|
|
32
|
+
* a {@link DynamoDBLangGraphError} with code `COMPRESSION_LIMIT` if the output
|
|
33
33
|
* would exceed `maxBytes` (bomb guard).
|
|
34
34
|
*/
|
|
35
35
|
async function decompress(data, compressed, maxBytes = constants_1.DEFAULT_MAX_DECOMPRESSED_BYTES) {
|
|
@@ -41,9 +41,8 @@ async function decompress(data, compressed, maxBytes = constants_1.DEFAULT_MAX_D
|
|
|
41
41
|
catch (error) {
|
|
42
42
|
const err = error;
|
|
43
43
|
if (err.code === 'ERR_BUFFER_TOO_LARGE') {
|
|
44
|
-
throw new base_error_1.
|
|
44
|
+
throw new base_error_1.DynamoDBLangGraphError(`Refusing to decompress: output would exceed ${maxBytes} bytes`, error_code_1.ErrorCode.COMPRESSION_LIMIT, {}, error);
|
|
45
45
|
}
|
|
46
46
|
throw error;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
//# sourceMappingURL=compression.js.map
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PayloadLocation } from './codec';
|
|
2
|
+
/**
|
|
3
|
+
* The part of a descriptor cleanup needs: where the payload lives and, for S3,
|
|
4
|
+
* its key. A full `PayloadDescriptor` satisfies it, and so does the projection
|
|
5
|
+
* a pre-write read returns without the inline bytes.
|
|
6
|
+
*/
|
|
7
|
+
export interface DescriptorRef {
|
|
8
|
+
location: PayloadLocation;
|
|
9
|
+
s3Key?: string;
|
|
10
|
+
}
|
|
2
11
|
/** Collect the S3 keys of any offloaded descriptors, for orphan cleanup. */
|
|
3
|
-
export declare function collectS3Keys(descriptors: readonly
|
|
4
|
-
//# sourceMappingURL=descriptor-keys.d.ts.map
|
|
12
|
+
export declare function collectS3Keys(descriptors: readonly DescriptorRef[]): string[];
|
|
@@ -6,9 +6,9 @@ const codec_1 = require("./codec");
|
|
|
6
6
|
function collectS3Keys(descriptors) {
|
|
7
7
|
const keys = [];
|
|
8
8
|
for (const descriptor of descriptors) {
|
|
9
|
-
if (descriptor.location === codec_1.PayloadLocation.S3)
|
|
9
|
+
if (descriptor.location === codec_1.PayloadLocation.S3 && descriptor.s3Key !== undefined) {
|
|
10
10
|
keys.push(descriptor.s3Key);
|
|
11
|
+
}
|
|
11
12
|
}
|
|
12
13
|
return keys;
|
|
13
14
|
}
|
|
14
|
-
//# sourceMappingURL=descriptor-keys.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CodecDeps, type PayloadDescriptor } from './codec';
|
|
2
|
+
/** Options controlling where an offloaded payload's S3 key is built from. */
|
|
3
|
+
export interface EncodeOptions {
|
|
4
|
+
keyParts: readonly string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Encode `value`: serialize via serde, compress (if configured), then offload
|
|
8
|
+
* to S3 when the compressed bytes exceed the offloader's threshold. Returns a
|
|
9
|
+
* descriptor recording how to read it back. Without an offloader, bytes that
|
|
10
|
+
* cannot fit a DynamoDB item are rejected here (see
|
|
11
|
+
* {@link assertInlinePayloadFits}).
|
|
12
|
+
*/
|
|
13
|
+
export declare function encodePayload<T>(value: T, deps: CodecDeps, options: EncodeOptions): Promise<PayloadDescriptor>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodePayload = encodePayload;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const errors_1 = require("../errors/errors");
|
|
6
|
+
const codec_1 = require("./codec");
|
|
7
|
+
const compression_1 = require("./compression");
|
|
8
|
+
/**
|
|
9
|
+
* Reject bytes that cannot be stored inline. Without an offloader the only
|
|
10
|
+
* alternative is a raw `ValidationException` from DynamoDB after the network
|
|
11
|
+
* round trip, which names neither the cause nor the remedy.
|
|
12
|
+
*/
|
|
13
|
+
function assertInlinePayloadFits(bytes, deps) {
|
|
14
|
+
if (bytes.length <= constants_1.MAX_INLINE_PAYLOAD_BYTES)
|
|
15
|
+
return;
|
|
16
|
+
const hint = deps.compression?.enabled
|
|
17
|
+
? ''
|
|
18
|
+
: ', or enable compression if the data compresses well';
|
|
19
|
+
throw new errors_1.ValidationError(`payload of ${bytes.length} bytes exceeds the ${constants_1.MAX_INLINE_PAYLOAD_BYTES}-byte inline limit ` +
|
|
20
|
+
`(DynamoDB items are capped at 400 KB); configure s3 offloading${hint}`, 'payload');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Encode `value`: serialize via serde, compress (if configured), then offload
|
|
24
|
+
* to S3 when the compressed bytes exceed the offloader's threshold. Returns a
|
|
25
|
+
* descriptor recording how to read it back. Without an offloader, bytes that
|
|
26
|
+
* cannot fit a DynamoDB item are rejected here (see
|
|
27
|
+
* {@link assertInlinePayloadFits}).
|
|
28
|
+
*/
|
|
29
|
+
async function encodePayload(value, deps, options) {
|
|
30
|
+
const [serdeType, raw] = await deps.serde.dumpsTyped(value);
|
|
31
|
+
const { bytes, compressed } = deps.compression
|
|
32
|
+
? await (0, compression_1.compress)(raw, deps.compression)
|
|
33
|
+
: { bytes: raw, compressed: false };
|
|
34
|
+
const base = { schemaVersion: codec_1.DESCRIPTOR_SCHEMA_VERSION, serdeType, compressed };
|
|
35
|
+
if (deps.offloader && deps.offloader.shouldOffload(bytes)) {
|
|
36
|
+
const s3Key = deps.offloader.buildKey(options.keyParts);
|
|
37
|
+
await deps.offloader.upload(s3Key, bytes);
|
|
38
|
+
return { ...base, location: codec_1.PayloadLocation.S3, s3Key };
|
|
39
|
+
}
|
|
40
|
+
if (!deps.offloader)
|
|
41
|
+
assertInlinePayloadFits(bytes, deps);
|
|
42
|
+
return { ...base, location: codec_1.PayloadLocation.INLINE, bytes };
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when an offloaded object no longer exists — a lifecycle sweep removed
|
|
3
|
+
* it, or a competing overwrite deleted it between a row read and the download.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isMissingObjectError(error: Error): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* True when a payload can never be read again — its object is gone, it trips
|
|
8
|
+
* the decompression guard, or its key lies outside the row's own path — as
|
|
9
|
+
* opposed to a failure that may succeed on retry or after a configuration fix
|
|
10
|
+
* (throttling, network, permissions).
|
|
11
|
+
*/
|
|
12
|
+
export declare function isPermanentPayloadLoss(error: Error): boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMissingObjectError = isMissingObjectError;
|
|
4
|
+
exports.isPermanentPayloadLoss = isPermanentPayloadLoss;
|
|
5
|
+
const error_code_1 = require("../errors/error-code");
|
|
6
|
+
/**
|
|
7
|
+
* True when an offloaded object no longer exists — a lifecycle sweep removed
|
|
8
|
+
* it, or a competing overwrite deleted it between a row read and the download.
|
|
9
|
+
*/
|
|
10
|
+
function isMissingObjectError(error) {
|
|
11
|
+
const coded = error;
|
|
12
|
+
return coded.code === error_code_1.ErrorCode.S3_OFFLOAD_FAILED && coded.cause?.name === 'NoSuchKey';
|
|
13
|
+
}
|
|
14
|
+
/** Validation fields that condemn the row itself rather than the caller's input. */
|
|
15
|
+
const ROW_REJECTION_FIELDS = ['s3Key', 'descriptor'];
|
|
16
|
+
/**
|
|
17
|
+
* True when a row's descriptor can never be read by this adapter: its key lies
|
|
18
|
+
* outside the S3 path its own identifiers allow (see `assertKeyInScope`), or
|
|
19
|
+
* its shape is one this version does not understand.
|
|
20
|
+
*/
|
|
21
|
+
function isRowRejection(error) {
|
|
22
|
+
const coded = error;
|
|
23
|
+
return (coded.code === error_code_1.ErrorCode.VALIDATION &&
|
|
24
|
+
coded.context?.field !== undefined &&
|
|
25
|
+
ROW_REJECTION_FIELDS.includes(coded.context.field));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* True when a payload can never be read again — its object is gone, it trips
|
|
29
|
+
* the decompression guard, or its key lies outside the row's own path — as
|
|
30
|
+
* opposed to a failure that may succeed on retry or after a configuration fix
|
|
31
|
+
* (throttling, network, permissions).
|
|
32
|
+
*/
|
|
33
|
+
function isPermanentPayloadLoss(error) {
|
|
34
|
+
const coded = error;
|
|
35
|
+
return (coded.code === error_code_1.ErrorCode.COMPRESSION_LIMIT ||
|
|
36
|
+
isMissingObjectError(error) ||
|
|
37
|
+
isRowRejection(error));
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
|
|
2
|
+
import { type S3OffloadConfig } from './config';
|
|
3
|
+
/** The adapters that share one bucket, each under its own default key prefix. */
|
|
4
|
+
export type AdapterName = 'checkpointer' | 'store' | 'history';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve an adapter's `s3` option into the offloader's configuration: the
|
|
7
|
+
* adapter-scoped default key prefix when none is given, and the DynamoDB
|
|
8
|
+
* client's region when the S3 client config names none. The S3 SDK does not
|
|
9
|
+
* follow region redirects by default, so a bucket reachable only through the
|
|
10
|
+
* region the DynamoDB side was configured with used to fail with an opaque
|
|
11
|
+
* `PermanentRedirect` on the first offload.
|
|
12
|
+
*/
|
|
13
|
+
export declare function offloaderConfigFor(s3: S3OffloadConfig, adapter: AdapterName, clientConfig?: DynamoDBClientConfig): S3OffloadConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.offloaderConfigFor = offloaderConfigFor;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const client_types_1 = require("./client-types");
|
|
6
|
+
const config_1 = require("./config");
|
|
7
|
+
/**
|
|
8
|
+
* Resolve an adapter's `s3` option into the offloader's configuration: the
|
|
9
|
+
* adapter-scoped default key prefix when none is given, and the DynamoDB
|
|
10
|
+
* client's region when the S3 client config names none. The S3 SDK does not
|
|
11
|
+
* follow region redirects by default, so a bucket reachable only through the
|
|
12
|
+
* region the DynamoDB side was configured with used to fail with an opaque
|
|
13
|
+
* `PermanentRedirect` on the first offload.
|
|
14
|
+
*/
|
|
15
|
+
function offloaderConfigFor(s3, adapter, clientConfig) {
|
|
16
|
+
const region = (0, client_types_1.s3ClientOptions)(s3.clientConfig).region ?? clientConfig?.region;
|
|
17
|
+
return {
|
|
18
|
+
...s3,
|
|
19
|
+
keyPrefix: s3.keyPrefix ?? (0, config_1.defaultAdapterKeyPrefix)(constants_1.DEFAULT_S3_KEY_PREFIX, adapter),
|
|
20
|
+
...(region === undefined ? {} : { clientConfig: { ...s3.clientConfig, region } }),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DynamoDBLangGraphError } from '../../errors/base-error';
|
|
2
|
+
/** The part of an S3 `GetObject` body this module relies on. */
|
|
3
|
+
export interface S3Body {
|
|
4
|
+
transformToByteArray(): Promise<Uint8Array>;
|
|
5
|
+
}
|
|
6
|
+
/** The typed error for an object over the download cap. */
|
|
7
|
+
export declare function oversizedObjectError(key: string, bytes: number, maxBytes: number): DynamoDBLangGraphError;
|
|
8
|
+
/**
|
|
9
|
+
* Buffer an S3 body without ever holding more than `maxBytes` of it. A
|
|
10
|
+
* streaming body is consumed chunk by chunk and abandoned the moment the
|
|
11
|
+
* running total passes the cap; a body that only offers
|
|
12
|
+
* `transformToByteArray()` is read whole and then checked.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readBodyBounded(body: S3Body, key: string, maxBytes: number): Promise<Uint8Array>;
|