@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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { QueryCommandInput, ScanCommandInput } from '@aws-sdk/lib-dynamodb';
|
|
2
|
+
/**
|
|
3
|
+
* True when a row carrying a DynamoDB TTL is at or past it. DynamoDB's sweep
|
|
4
|
+
* can lag up to ~48 h, so every read path applies this itself; the value is
|
|
5
|
+
* epoch seconds, the unit the `ttl` attribute uses.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isExpiredRow(row: {
|
|
8
|
+
ttl?: number;
|
|
9
|
+
}, nowSeconds: number): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Exclude expired rows server-side, ANDing any filter the query already has.
|
|
12
|
+
* A filter never replaces the in-process {@link isExpiredRow} check — it only
|
|
13
|
+
* trims transfer — because the two clocks (query build, row iteration) are
|
|
14
|
+
* not the same instant and DynamoDB applies filters after `Limit`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function withoutExpired<T extends QueryCommandInput | ScanCommandInput>(params: T, nowSeconds: number): T;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isExpiredRow = isExpiredRow;
|
|
4
|
+
exports.withoutExpired = withoutExpired;
|
|
5
|
+
/**
|
|
6
|
+
* True when a row carrying a DynamoDB TTL is at or past it. DynamoDB's sweep
|
|
7
|
+
* can lag up to ~48 h, so every read path applies this itself; the value is
|
|
8
|
+
* epoch seconds, the unit the `ttl` attribute uses.
|
|
9
|
+
*/
|
|
10
|
+
function isExpiredRow(row, nowSeconds) {
|
|
11
|
+
return row.ttl !== undefined && row.ttl <= nowSeconds;
|
|
12
|
+
}
|
|
13
|
+
const TTL_FILTER = 'attribute_not_exists(#ttl) OR #ttl > :now';
|
|
14
|
+
/**
|
|
15
|
+
* Exclude expired rows server-side, ANDing any filter the query already has.
|
|
16
|
+
* A filter never replaces the in-process {@link isExpiredRow} check — it only
|
|
17
|
+
* trims transfer — because the two clocks (query build, row iteration) are
|
|
18
|
+
* not the same instant and DynamoDB applies filters after `Limit`.
|
|
19
|
+
*/
|
|
20
|
+
function withoutExpired(params, nowSeconds) {
|
|
21
|
+
return {
|
|
22
|
+
...params,
|
|
23
|
+
FilterExpression: params.FilterExpression
|
|
24
|
+
? `(${params.FilterExpression}) AND (${TTL_FILTER})`
|
|
25
|
+
: TTL_FILTER,
|
|
26
|
+
ExpressionAttributeNames: { ...params.ExpressionAttributeNames, '#ttl': 'ttl' },
|
|
27
|
+
ExpressionAttributeValues: { ...params.ExpressionAttributeValues, ':now': nowSeconds },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RetryOptions } from './retry';
|
|
1
2
|
import type { DocItem } from './types';
|
|
2
3
|
/** One page of results plus the key to resume from (undefined when exhausted). */
|
|
3
4
|
export interface PageResult {
|
|
@@ -6,6 +7,8 @@ export interface PageResult {
|
|
|
6
7
|
}
|
|
7
8
|
/** Options shared by the paginators built on {@link paginatePages}. */
|
|
8
9
|
export interface PaginateCoreOptions {
|
|
10
|
+
/** The adapter's retry options, applied to every page read. */
|
|
11
|
+
retry?: RetryOptions;
|
|
9
12
|
signal?: AbortSignal;
|
|
10
13
|
maxItems?: number;
|
|
11
14
|
maxIterations?: number;
|
|
@@ -14,9 +17,8 @@ export interface PaginateCoreOptions {
|
|
|
14
17
|
* Drive a paged DynamoDB read to completion, yielding each item. Continues past
|
|
15
18
|
* empty pages, honors the abort signal before each fetch, and enforces iteration
|
|
16
19
|
* + in-memory item caps. `fetchPage` performs one page read. When a cap is hit
|
|
17
|
-
* while more data remains, throws {@link ResultTruncatedError} rather
|
|
18
|
-
* silently returning a partial result; pass `Infinity` caps to read to true
|
|
20
|
+
* while more data actually remains, throws {@link ResultTruncatedError} rather
|
|
21
|
+
* than silently returning a partial result; pass `Infinity` caps to read to true
|
|
19
22
|
* completion (e.g. for deletes).
|
|
20
23
|
*/
|
|
21
24
|
export declare function paginatePages(fetchPage: (startKey: DocItem | undefined) => Promise<PageResult>, options?: PaginateCoreOptions): AsyncGenerator<DocItem>;
|
|
22
|
-
//# sourceMappingURL=paginate-core.d.ts.map
|
|
@@ -3,50 +3,80 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.paginatePages = paginatePages;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
const errors_1 = require("../errors/errors");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const abort_1 = require("./abort");
|
|
7
|
+
/** Read the next page, honouring the abort signal and the iteration cap first. */
|
|
8
|
+
async function readPage(reader, startKey) {
|
|
9
|
+
if (reader.iterations >= reader.maxIterations) {
|
|
10
|
+
throw new errors_1.ResultTruncatedError('maxIterations', reader.maxIterations);
|
|
11
|
+
}
|
|
12
|
+
if (reader.signal?.aborted)
|
|
13
|
+
throw (0, abort_1.abortErrorFrom)(reader.signal);
|
|
14
|
+
reader.iterations += 1;
|
|
15
|
+
return reader.fetchPage(startKey);
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* Yield one page's items, counting toward the shared `state.yielded` budget.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
19
|
+
* Reaching the cap with unyielded items still on the page is a truncation;
|
|
20
|
+
* reaching it on the last item is reported as `capped` for the caller to settle.
|
|
14
21
|
*/
|
|
15
22
|
async function* yieldPageItems(page, state, maxItems) {
|
|
16
23
|
for (let index = 0; index < page.items.length; index++) {
|
|
17
24
|
yield page.items[index];
|
|
18
25
|
state.yielded += 1;
|
|
19
26
|
if (state.yielded >= maxItems) {
|
|
20
|
-
if (
|
|
27
|
+
if (index < page.items.length - 1)
|
|
21
28
|
throw new errors_1.ResultTruncatedError('maxItems', maxItems);
|
|
22
|
-
return
|
|
29
|
+
return 'capped';
|
|
23
30
|
}
|
|
24
31
|
}
|
|
32
|
+
return 'exhausted';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether anything remains past `startKey`. DynamoDB returns a
|
|
36
|
+
* `LastEvaluatedKey` whenever it stopped *evaluating* at the 1 MB boundary,
|
|
37
|
+
* whether or not a later item passes the filter, so a trailing key alone proves
|
|
38
|
+
* nothing: the keys are followed until a page carries an item (truncated) or
|
|
39
|
+
* they run out (the result was complete). The probe is charged against the same
|
|
40
|
+
* iteration budget and honours the same signal as the read itself.
|
|
41
|
+
*/
|
|
42
|
+
async function dataRemains(reader, startKey) {
|
|
43
|
+
let key = startKey;
|
|
44
|
+
while (key !== undefined) {
|
|
45
|
+
const page = await readPage(reader, key);
|
|
46
|
+
if (page.items.length > 0)
|
|
47
|
+
return true;
|
|
48
|
+
key = page.lastKey;
|
|
49
|
+
}
|
|
25
50
|
return false;
|
|
26
51
|
}
|
|
27
52
|
/**
|
|
28
53
|
* Drive a paged DynamoDB read to completion, yielding each item. Continues past
|
|
29
54
|
* empty pages, honors the abort signal before each fetch, and enforces iteration
|
|
30
55
|
* + in-memory item caps. `fetchPage` performs one page read. When a cap is hit
|
|
31
|
-
* while more data remains, throws {@link ResultTruncatedError} rather
|
|
32
|
-
* silently returning a partial result; pass `Infinity` caps to read to true
|
|
56
|
+
* while more data actually remains, throws {@link ResultTruncatedError} rather
|
|
57
|
+
* than silently returning a partial result; pass `Infinity` caps to read to true
|
|
33
58
|
* completion (e.g. for deletes).
|
|
34
59
|
*/
|
|
35
60
|
async function* paginatePages(fetchPage, options = {}) {
|
|
36
61
|
const maxItems = options.maxItems ?? constants_1.MAX_TOTAL_ITEMS_IN_MEMORY;
|
|
37
|
-
const
|
|
62
|
+
const reader = {
|
|
63
|
+
fetchPage,
|
|
64
|
+
maxIterations: options.maxIterations ?? constants_1.MAX_LOOP_ITERATIONS,
|
|
65
|
+
iterations: 0,
|
|
66
|
+
signal: options.signal,
|
|
67
|
+
};
|
|
38
68
|
const state = { yielded: 0 };
|
|
39
69
|
let startKey;
|
|
40
|
-
for (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
70
|
+
for (;;) {
|
|
71
|
+
const page = await readPage(reader, startKey);
|
|
72
|
+
const outcome = yield* yieldPageItems(page, state, maxItems);
|
|
73
|
+
if (outcome === 'capped') {
|
|
74
|
+
if (await dataRemains(reader, page.lastKey))
|
|
75
|
+
throw new errors_1.ResultTruncatedError('maxItems', maxItems);
|
|
45
76
|
return;
|
|
77
|
+
}
|
|
46
78
|
startKey = page.lastKey;
|
|
47
79
|
if (startKey === undefined)
|
|
48
80
|
return;
|
|
49
81
|
}
|
|
50
|
-
throw new errors_1.ResultTruncatedError('maxIterations', maxIterations);
|
|
51
82
|
}
|
|
52
|
-
//# sourceMappingURL=paginate-core.js.map
|
|
@@ -12,4 +12,3 @@ export interface PaginateOptions extends PaginateCoreOptions {
|
|
|
12
12
|
* {@link withDynamoDBRetry}, and enforces runaway guards via the shared core.
|
|
13
13
|
*/
|
|
14
14
|
export declare function paginateQuery(options: PaginateOptions): AsyncGenerator<DocItem>;
|
|
15
|
-
//# sourceMappingURL=paginate.d.ts.map
|
|
@@ -10,11 +10,10 @@ const retry_1 = require("./retry");
|
|
|
10
10
|
*/
|
|
11
11
|
function paginateQuery(options) {
|
|
12
12
|
return (0, paginate_core_1.paginatePages)(async (startKey) => {
|
|
13
|
-
const page = await (0, retry_1.withDynamoDBRetry)(() => options.client.query({ ...options.params, ExclusiveStartKey: startKey }), { signal: options.signal });
|
|
13
|
+
const page = await (0, retry_1.withDynamoDBRetry)(() => options.client.query({ ...options.params, ExclusiveStartKey: startKey }), { ...options.retry, signal: options.signal });
|
|
14
14
|
return {
|
|
15
15
|
items: page.Items ?? [],
|
|
16
16
|
lastKey: page.LastEvaluatedKey,
|
|
17
17
|
};
|
|
18
18
|
}, options);
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=paginate.js.map
|
|
@@ -2,6 +2,7 @@ import type { DynamoDBDocument, QueryCommandInput } from '@aws-sdk/lib-dynamodb'
|
|
|
2
2
|
import type { PayloadDescriptor } from '../codec/codec';
|
|
3
3
|
import type { S3Offloader } from '../codec/s3/offloader';
|
|
4
4
|
import type { Logger } from '../logging/logger';
|
|
5
|
+
import type { RetryOptions } from './retry';
|
|
5
6
|
import type { DocItem } from './types';
|
|
6
7
|
/** Collaborators and per-adapter policy for one partition-wide delete. */
|
|
7
8
|
export interface PartitionDeleteOptions {
|
|
@@ -9,6 +10,10 @@ export interface PartitionDeleteOptions {
|
|
|
9
10
|
tableName: string;
|
|
10
11
|
params: QueryCommandInput;
|
|
11
12
|
logger: Logger;
|
|
13
|
+
/** The adapter's retry options for the page reads and batch deletes. */
|
|
14
|
+
retry?: RetryOptions;
|
|
15
|
+
/** Aborting it stops the read between pages and rejects with the library's AbortError. */
|
|
16
|
+
signal?: AbortSignal;
|
|
12
17
|
offloader?: S3Offloader;
|
|
13
18
|
/** Label for log lines and S3-cleanup diagnostics, e.g. `deleteThread`. */
|
|
14
19
|
operation: string;
|
|
@@ -20,6 +25,8 @@ export interface PartitionDeleteOptions {
|
|
|
20
25
|
ownsSortKey: (sortKey: string) => boolean;
|
|
21
26
|
/** The offloaded payload descriptors a row references, if any. */
|
|
22
27
|
descriptorsOf: (row: DocItem) => (PayloadDescriptor | undefined)[];
|
|
28
|
+
/** The partition's own leading S3 key parts; objects outside their path are never deleted. */
|
|
29
|
+
scope: readonly string[];
|
|
23
30
|
}
|
|
24
31
|
/**
|
|
25
32
|
* Delete every row in a partition that belongs to the calling adapter,
|
|
@@ -30,4 +37,3 @@ export interface PartitionDeleteOptions {
|
|
|
30
37
|
* later batch fails. Returns the number of rows deleted.
|
|
31
38
|
*/
|
|
32
39
|
export declare function deletePartitionRows(options: PartitionDeleteOptions): Promise<number>;
|
|
33
|
-
//# sourceMappingURL=partition-delete.d.ts.map
|
|
@@ -13,7 +13,7 @@ async function flushBuffer(options, buffer, progress) {
|
|
|
13
13
|
return;
|
|
14
14
|
const chunks = Math.ceil(buffer.keys.length / constants_1.BATCH_WRITE_MAX);
|
|
15
15
|
try {
|
|
16
|
-
await (0, batch_write_1.batchWriteAll)(options.client, options.tableName, buffer.keys.map((Key) => ({ DeleteRequest: { Key } })));
|
|
16
|
+
await (0, batch_write_1.batchWriteAll)(options.client, options.tableName, buffer.keys.map((Key) => ({ DeleteRequest: { Key } })), { retry: options.retry, signal: options.signal });
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
19
|
/** batchWriteAll's only throw is a BatchWriteAllIncompleteError (see batch-write.ts). */
|
|
@@ -24,7 +24,7 @@ async function flushBuffer(options, buffer, progress) {
|
|
|
24
24
|
progress.succeededChunks += chunks;
|
|
25
25
|
progress.totalChunks += chunks;
|
|
26
26
|
if (options.offloader) {
|
|
27
|
-
await (0, orphans_1.cleanUpS3Orphans)(options.offloader, (0, descriptor_keys_1.collectS3Keys)(buffer.descriptors), options.operation, options.logger);
|
|
27
|
+
await (0, orphans_1.cleanUpS3Orphans)(options.offloader, (0, descriptor_keys_1.collectS3Keys)(buffer.descriptors), options.operation, options.logger, { scope: options.scope });
|
|
28
28
|
}
|
|
29
29
|
buffer.keys = [];
|
|
30
30
|
buffer.descriptors = [];
|
|
@@ -44,6 +44,8 @@ async function deletePartitionRows(options) {
|
|
|
44
44
|
const pages = (0, paginate_1.paginateQuery)({
|
|
45
45
|
client: options.client,
|
|
46
46
|
params: options.params,
|
|
47
|
+
retry: options.retry,
|
|
48
|
+
signal: options.signal,
|
|
47
49
|
maxItems: Number.POSITIVE_INFINITY,
|
|
48
50
|
maxIterations: Number.POSITIVE_INFINITY,
|
|
49
51
|
});
|
|
@@ -67,4 +69,3 @@ async function deletePartitionRows(options) {
|
|
|
67
69
|
options.logger.info(`${options.operation}: deleted rows`, { deleted: progress.writes, skipped });
|
|
68
70
|
return progress.writes;
|
|
69
71
|
}
|
|
70
|
-
//# sourceMappingURL=partition-delete.js.map
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
* TransactionConflictException (transient row contention) IS retryable.
|
|
5
5
|
*/
|
|
6
6
|
export declare const DEFAULT_RETRYABLE_ERRORS: readonly string[];
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* True when `error` (or any cause in its chain) is transient: a transaction
|
|
9
|
+
* cancellation whose every reason is transient (that verdict takes precedence,
|
|
10
|
+
* because a permanent reason arrives with the same statuses as a transient
|
|
11
|
+
* one), an HTTP status in {@link TRANSIENT_HTTP_STATUSES}, the SDK's
|
|
12
|
+
* `$retryable` trait, or an exact match of a `name`/`code`/`errno`/`syscall`
|
|
13
|
+
* token against `retryableErrors`. Exact, not substring: the fields are
|
|
14
|
+
* whole tokens, and a substring rule would let an unrelated name that merely
|
|
15
|
+
* contains one ride along.
|
|
16
|
+
*/
|
|
8
17
|
export declare function isRetryableError(error: Error, retryableErrors: readonly string[]): boolean;
|
|
9
|
-
//# sourceMappingURL=retry-classifier.d.ts.map
|
|
@@ -26,7 +26,17 @@ exports.DEFAULT_RETRYABLE_ERRORS = [
|
|
|
26
26
|
'EAI_AGAIN',
|
|
27
27
|
'NetworkingError',
|
|
28
28
|
'TimeoutError',
|
|
29
|
+
'EHOSTUNREACH',
|
|
30
|
+
'ENETUNREACH',
|
|
31
|
+
'ENOTFOUND',
|
|
29
32
|
];
|
|
33
|
+
/**
|
|
34
|
+
* HTTP statuses the AWS SDK retries regardless of the error name: throttling
|
|
35
|
+
* (429) and the transient server statuses. They matter most for an error the
|
|
36
|
+
* SDK could not map to a modeled exception (an intermediary's HTML 503, a
|
|
37
|
+
* truncated body), which arrives as `name: 'Unknown'` with only its status.
|
|
38
|
+
*/
|
|
39
|
+
const TRANSIENT_HTTP_STATUSES = [429, 500, 502, 503, 504];
|
|
30
40
|
/**
|
|
31
41
|
* Cancellation reason codes (from a `TransactionCanceledException`'s
|
|
32
42
|
* `CancellationReasons`) that are transient and safe to retry. `None` marks an
|
|
@@ -57,31 +67,52 @@ function transactionCancellationRetryable(error) {
|
|
|
57
67
|
return (reasons.length > 0 &&
|
|
58
68
|
reasons.every((reason) => reason.Code === undefined || TRANSIENT_CANCELLATION_REASONS.includes(reason.Code)));
|
|
59
69
|
}
|
|
60
|
-
|
|
70
|
+
/** Add one node's signal tokens, HTTP status and retryable trait to `evidence`. */
|
|
71
|
+
function recordNode(fields, evidence) {
|
|
72
|
+
for (const value of [fields.name, fields.code, fields.errno, fields.syscall]) {
|
|
73
|
+
if (typeof value === 'string')
|
|
74
|
+
evidence.signals.push(value);
|
|
75
|
+
}
|
|
76
|
+
if (typeof fields.$metadata?.httpStatusCode === 'number') {
|
|
77
|
+
evidence.statuses.push(fields.$metadata.httpStatusCode);
|
|
78
|
+
}
|
|
79
|
+
if (fields.$retryable !== undefined && fields.$retryable !== null)
|
|
80
|
+
evidence.retryableByTrait = true;
|
|
81
|
+
}
|
|
82
|
+
function collectEvidence(error) {
|
|
61
83
|
const seen = new WeakSet();
|
|
62
|
-
const
|
|
84
|
+
const evidence = { signals: [], statuses: [], retryableByTrait: false };
|
|
63
85
|
const walk = (node, depth) => {
|
|
64
86
|
if (depth > MAX_CAUSE_DEPTH || node === null || typeof node !== 'object' || seen.has(node)) {
|
|
65
87
|
return;
|
|
66
88
|
}
|
|
67
89
|
seen.add(node);
|
|
68
90
|
const fields = node;
|
|
69
|
-
|
|
70
|
-
if (typeof value === 'string')
|
|
71
|
-
signals.push(value);
|
|
72
|
-
}
|
|
91
|
+
recordNode(fields, evidence);
|
|
73
92
|
if (fields.cause)
|
|
74
93
|
walk(fields.cause, depth + 1);
|
|
75
94
|
};
|
|
76
95
|
walk(error, 0);
|
|
77
|
-
return
|
|
96
|
+
return evidence;
|
|
78
97
|
}
|
|
79
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* True when `error` (or any cause in its chain) is transient: a transaction
|
|
100
|
+
* cancellation whose every reason is transient (that verdict takes precedence,
|
|
101
|
+
* because a permanent reason arrives with the same statuses as a transient
|
|
102
|
+
* one), an HTTP status in {@link TRANSIENT_HTTP_STATUSES}, the SDK's
|
|
103
|
+
* `$retryable` trait, or an exact match of a `name`/`code`/`errno`/`syscall`
|
|
104
|
+
* token against `retryableErrors`. Exact, not substring: the fields are
|
|
105
|
+
* whole tokens, and a substring rule would let an unrelated name that merely
|
|
106
|
+
* contains one ride along.
|
|
107
|
+
*/
|
|
80
108
|
function isRetryableError(error, retryableErrors) {
|
|
81
109
|
const cancellation = transactionCancellationRetryable(error);
|
|
82
110
|
if (cancellation !== undefined)
|
|
83
111
|
return cancellation;
|
|
84
|
-
const
|
|
85
|
-
|
|
112
|
+
const evidence = collectEvidence(error);
|
|
113
|
+
if (evidence.retryableByTrait)
|
|
114
|
+
return true;
|
|
115
|
+
if (evidence.statuses.some((status) => TRANSIENT_HTTP_STATUSES.includes(status)))
|
|
116
|
+
return true;
|
|
117
|
+
return evidence.signals.some((signal) => retryableErrors.includes(signal));
|
|
86
118
|
}
|
|
87
|
-
//# sourceMappingURL=retry-classifier.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Logger } from '../logging/logger';
|
|
2
|
+
import type { RetryOptions } from './retry';
|
|
3
|
+
/**
|
|
4
|
+
* Caller-facing retry tunables for every DynamoDB call an adapter makes. The
|
|
5
|
+
* schedule is full-jitter exponential backoff: `baseDelayMs` doubling per
|
|
6
|
+
* attempt, capped at `maxDelayMs`, for `maxAttempts` attempts. The
|
|
7
|
+
* message-append path never goes below its own contention floor.
|
|
8
|
+
*/
|
|
9
|
+
export interface RetryPolicy {
|
|
10
|
+
/** Attempts per call before `RetryExhaustedError` (default 5). */
|
|
11
|
+
maxAttempts?: number;
|
|
12
|
+
/** First backoff delay in milliseconds (default 100). */
|
|
13
|
+
baseDelayMs?: number;
|
|
14
|
+
/** Cap on a single backoff delay in milliseconds (default 5000). */
|
|
15
|
+
maxDelayMs?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve an adapter's retry policy once, attaching the context logger so
|
|
19
|
+
* every retry is visible at `debug` (attempt, the delay about to be slept, the
|
|
20
|
+
* error name) instead of only surfacing once the budget is exhausted.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveRetryPolicy(policy: RetryPolicy | undefined, logger: Logger): RetryOptions;
|
|
23
|
+
/** The context's retry options plus a per-call cancellation signal, when one is given. */
|
|
24
|
+
export declare function retryFor(context: {
|
|
25
|
+
retry?: RetryOptions;
|
|
26
|
+
}, signal?: AbortSignal): RetryOptions | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRetryPolicy = resolveRetryPolicy;
|
|
4
|
+
exports.retryFor = retryFor;
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
/**
|
|
7
|
+
* Resolve an adapter's retry policy once, attaching the context logger so
|
|
8
|
+
* every retry is visible at `debug` (attempt, the delay about to be slept, the
|
|
9
|
+
* error name) instead of only surfacing once the budget is exhausted.
|
|
10
|
+
*/
|
|
11
|
+
function resolveRetryPolicy(policy, logger) {
|
|
12
|
+
return {
|
|
13
|
+
maxAttempts: policy?.maxAttempts ?? constants_1.DEFAULT_RETRY_MAX_ATTEMPTS,
|
|
14
|
+
baseDelayMs: policy?.baseDelayMs ?? constants_1.INITIAL_BACKOFF_DELAY_MS,
|
|
15
|
+
maxDelayMs: policy?.maxDelayMs ?? constants_1.MAX_BACKOFF_DELAY_MS,
|
|
16
|
+
onRetry: ({ attempt, delayMs, error }) => logger.debug('retrying after a transient error', { attempt, delayMs, error: error.name }),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** The context's retry options plus a per-call cancellation signal, when one is given. */
|
|
20
|
+
function retryFor(context, signal) {
|
|
21
|
+
return signal === undefined ? context.retry : { ...context.retry, signal };
|
|
22
|
+
}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
/** What {@link RetryOptions.onRetry} learns before each backoff sleep. */
|
|
2
|
+
export interface RetryAttemptInfo {
|
|
3
|
+
attempt: number;
|
|
4
|
+
delayMs: number;
|
|
5
|
+
error: Error;
|
|
6
|
+
}
|
|
1
7
|
/** Options controlling {@link withRetry}. */
|
|
2
8
|
export interface RetryOptions {
|
|
3
9
|
maxAttempts?: number;
|
|
4
10
|
baseDelayMs?: number;
|
|
5
11
|
maxDelayMs?: number;
|
|
6
12
|
retryableErrors?: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* Decides retryability instead of `retryableErrors`, so a call site can
|
|
15
|
+
* share one classifier (see `isTransientS3Error`) with paths that do not
|
|
16
|
+
* go through `withRetry`.
|
|
17
|
+
*/
|
|
18
|
+
isRetryable?: (error: Error) => boolean;
|
|
19
|
+
/** Called before every backoff sleep, so retries are visible before the budget is exhausted. */
|
|
20
|
+
onRetry?: (info: RetryAttemptInfo) => void;
|
|
7
21
|
signal?: AbortSignal;
|
|
8
22
|
rng?: () => number;
|
|
9
23
|
}
|
|
@@ -15,4 +29,3 @@ export interface RetryOptions {
|
|
|
15
29
|
export declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
16
30
|
/** {@link withRetry} preset for DynamoDB operations. */
|
|
17
31
|
export declare function withDynamoDBRetry<T>(fn: () => Promise<T>, overrides?: Partial<RetryOptions>): Promise<T>;
|
|
18
|
-
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -5,6 +5,8 @@ exports.withDynamoDBRetry = withDynamoDBRetry;
|
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const errors_1 = require("../errors/errors");
|
|
7
7
|
const wrap_error_1 = require("../errors/wrap-error");
|
|
8
|
+
const secret_patterns_1 = require("../logging/secret-patterns");
|
|
9
|
+
const abort_1 = require("./abort");
|
|
8
10
|
const backoff_1 = require("./backoff");
|
|
9
11
|
const retry_classifier_1 = require("./retry-classifier");
|
|
10
12
|
function delayForAttempt(attempt, base, max, rng) {
|
|
@@ -17,7 +19,8 @@ function resolveRetryOptions(options) {
|
|
|
17
19
|
maxAttempts: options.maxAttempts ?? constants_1.DEFAULT_RETRY_MAX_ATTEMPTS,
|
|
18
20
|
baseDelayMs: options.baseDelayMs ?? constants_1.INITIAL_BACKOFF_DELAY_MS,
|
|
19
21
|
maxDelayMs: options.maxDelayMs ?? constants_1.MAX_BACKOFF_DELAY_MS,
|
|
20
|
-
|
|
22
|
+
isRetryable: options.isRetryable ??
|
|
23
|
+
((error) => (0, retry_classifier_1.isRetryableError)(error, options.retryableErrors ?? retry_classifier_1.DEFAULT_RETRYABLE_ERRORS)),
|
|
21
24
|
rng: options.rng ?? Math.random,
|
|
22
25
|
};
|
|
23
26
|
}
|
|
@@ -27,9 +30,9 @@ function resolveRetryOptions(options) {
|
|
|
27
30
|
* {@link RetryExhaustedError}; an aborted signal throws {@link AbortError}.
|
|
28
31
|
*/
|
|
29
32
|
async function withRetry(fn, options = {}) {
|
|
30
|
-
const { maxAttempts, baseDelayMs, maxDelayMs,
|
|
33
|
+
const { maxAttempts, baseDelayMs, maxDelayMs, isRetryable, rng } = resolveRetryOptions(options);
|
|
31
34
|
if (options.signal?.aborted)
|
|
32
|
-
throw
|
|
35
|
+
throw (0, abort_1.abortErrorFrom)(options.signal);
|
|
33
36
|
let lastError = new Error('Retry failed without error');
|
|
34
37
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
35
38
|
try {
|
|
@@ -37,17 +40,18 @@ async function withRetry(fn, options = {}) {
|
|
|
37
40
|
}
|
|
38
41
|
catch (error) {
|
|
39
42
|
lastError = (0, wrap_error_1.toError)(error);
|
|
40
|
-
if (!(
|
|
43
|
+
if (!isRetryable(lastError))
|
|
41
44
|
throw lastError;
|
|
42
45
|
if (attempt === maxAttempts)
|
|
43
46
|
break;
|
|
44
|
-
|
|
47
|
+
const delayMs = delayForAttempt(attempt, baseDelayMs, maxDelayMs, rng);
|
|
48
|
+
options.onRetry?.({ attempt, delayMs, error: lastError });
|
|
49
|
+
await (0, backoff_1.sleep)(delayMs, options.signal);
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
|
-
throw new errors_1.RetryExhaustedError(`Operation failed after ${maxAttempts} attempts: ${lastError
|
|
52
|
+
throw new errors_1.RetryExhaustedError(`Operation failed after ${maxAttempts} attempts: ${(0, secret_patterns_1.redactedMessage)(lastError)}`, maxAttempts, lastError);
|
|
48
53
|
}
|
|
49
54
|
/** {@link withRetry} preset for DynamoDB operations. */
|
|
50
55
|
async function withDynamoDBRetry(fn, overrides) {
|
|
51
56
|
return withRetry(fn, { maxAttempts: constants_1.DEFAULT_RETRY_MAX_ATTEMPTS, ...overrides });
|
|
52
57
|
}
|
|
53
|
-
//# sourceMappingURL=retry.js.map
|
|
@@ -10,11 +10,10 @@ const retry_1 = require("./retry");
|
|
|
10
10
|
*/
|
|
11
11
|
function paginateScan(options) {
|
|
12
12
|
return (0, paginate_core_1.paginatePages)(async (startKey) => {
|
|
13
|
-
const page = await (0, retry_1.withDynamoDBRetry)(() => options.client.scan({ ...options.params, ExclusiveStartKey: startKey }), { signal: options.signal });
|
|
13
|
+
const page = await (0, retry_1.withDynamoDBRetry)(() => options.client.scan({ ...options.params, ExclusiveStartKey: startKey }), { ...options.retry, signal: options.signal });
|
|
14
14
|
return {
|
|
15
15
|
items: page.Items ?? [],
|
|
16
16
|
lastKey: page.LastEvaluatedKey,
|
|
17
17
|
};
|
|
18
18
|
}, options);
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=scan.js.map
|
|
@@ -13,7 +13,7 @@ interface PutWriteRequest {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/** A BatchWriteItem DeleteRequest. */
|
|
16
|
-
|
|
16
|
+
interface DeleteWriteRequest {
|
|
17
17
|
DeleteRequest: {
|
|
18
18
|
Key: DocItem;
|
|
19
19
|
};
|
|
@@ -21,4 +21,3 @@ export interface DeleteWriteRequest {
|
|
|
21
21
|
/** A single BatchWriteItem write request. */
|
|
22
22
|
export type WriteRequest = PutWriteRequest | DeleteWriteRequest;
|
|
23
23
|
export {};
|
|
24
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { ErrorCode } from './error-code';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Structured, log-safe context attached to every library error. Identifiers
|
|
4
|
+
* and counts only — never a payload or a credential.
|
|
5
|
+
*/
|
|
3
6
|
export interface ErrorContext {
|
|
7
|
+
/** The DynamoDB table the operation targeted, when known. */
|
|
4
8
|
tableName?: string;
|
|
9
|
+
/** The public operation (`saver.put`, `store.batch`, …) or internal step that failed. */
|
|
5
10
|
operation?: string;
|
|
11
|
+
/** The option, argument or cap that failed validation or was exceeded. */
|
|
12
|
+
field?: string;
|
|
13
|
+
/** The S3 object key involved, for offload failures. */
|
|
6
14
|
key?: string;
|
|
15
|
+
/** Attempts made before a retry budget was exhausted. */
|
|
7
16
|
attempts?: number;
|
|
8
17
|
}
|
|
9
18
|
/**
|
|
10
19
|
* Base class for every error this library throws. Carries a branchable
|
|
11
20
|
* {@link ErrorCode}, structured {@link ErrorContext}, and a native `cause`
|
|
12
|
-
* chain. Detected via {@link
|
|
21
|
+
* chain. Detected via {@link isDynamoDBLangGraphError} (a symbol brand) rather
|
|
13
22
|
* than `instanceof`, which is banned repo-wide.
|
|
14
23
|
*/
|
|
15
|
-
export declare class
|
|
24
|
+
export declare class DynamoDBLangGraphError extends Error {
|
|
16
25
|
readonly code: ErrorCode;
|
|
17
26
|
readonly context: ErrorContext;
|
|
18
27
|
constructor(message: string, code: ErrorCode, context?: ErrorContext, cause?: Error);
|
|
19
28
|
}
|
|
20
|
-
/** True when `value` is a {@link
|
|
21
|
-
export declare function
|
|
22
|
-
//# sourceMappingURL=base-error.d.ts.map
|
|
29
|
+
/** True when `value` is a {@link DynamoDBLangGraphError}, detected by brand. */
|
|
30
|
+
export declare function isDynamoDBLangGraphError(value: Error): value is DynamoDBLangGraphError;
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.DynamoDBLangGraphError = void 0;
|
|
4
|
+
exports.isDynamoDBLangGraphError = isDynamoDBLangGraphError;
|
|
5
5
|
const ERROR_BRAND = Symbol.for('@farukada/aws-langgraph-dynamodb-ts/error');
|
|
6
6
|
/**
|
|
7
7
|
* Base class for every error this library throws. Carries a branchable
|
|
8
8
|
* {@link ErrorCode}, structured {@link ErrorContext}, and a native `cause`
|
|
9
|
-
* chain. Detected via {@link
|
|
9
|
+
* chain. Detected via {@link isDynamoDBLangGraphError} (a symbol brand) rather
|
|
10
10
|
* than `instanceof`, which is banned repo-wide.
|
|
11
11
|
*/
|
|
12
|
-
class
|
|
12
|
+
class DynamoDBLangGraphError extends Error {
|
|
13
13
|
code;
|
|
14
14
|
context;
|
|
15
15
|
constructor(message, code, context = {}, cause) {
|
|
16
16
|
super(message, cause === undefined ? undefined : { cause });
|
|
17
|
-
this.name = '
|
|
17
|
+
this.name = 'DynamoDBLangGraphError';
|
|
18
18
|
this.code = code;
|
|
19
19
|
this.context = context;
|
|
20
20
|
Object.defineProperty(this, ERROR_BRAND, { value: true, enumerable: false });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.
|
|
24
|
-
/** True when `value` is a {@link
|
|
25
|
-
function
|
|
23
|
+
exports.DynamoDBLangGraphError = DynamoDBLangGraphError;
|
|
24
|
+
/** True when `value` is a {@link DynamoDBLangGraphError}, detected by brand. */
|
|
25
|
+
function isDynamoDBLangGraphError(value) {
|
|
26
26
|
return ERROR_BRAND in value;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=base-error.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalise anything escaping a public method into the library's error model:
|
|
3
|
+
* a branded library error is returned unchanged (its code was assigned closer
|
|
4
|
+
* to the failure and wins), anything else becomes an {@link UpstreamError}.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toPublicError(error: Error, operation: string): Error;
|
|
7
|
+
/**
|
|
8
|
+
* Run a public operation so that every rejection is a library error. Applied
|
|
9
|
+
* once, at each adapter class method, so internal code can keep rethrowing SDK
|
|
10
|
+
* errors verbatim (the retry classifier depends on their shape).
|
|
11
|
+
*/
|
|
12
|
+
export declare function guardPublic<T>(operation: string, fn: () => Promise<T>): Promise<T>;
|
|
13
|
+
/**
|
|
14
|
+
* The same guard for a streaming result: items pass through, a failure raised
|
|
15
|
+
* mid-iteration is wrapped, and a consumer that stops early still closes the
|
|
16
|
+
* source generator.
|
|
17
|
+
*/
|
|
18
|
+
export declare function guardPublicIterable<T>(operation: string, source: AsyncGenerator<T>): AsyncGenerator<T>;
|