@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,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toPublicError = toPublicError;
|
|
4
|
+
exports.guardPublic = guardPublic;
|
|
5
|
+
exports.guardPublicIterable = guardPublicIterable;
|
|
6
|
+
const base_error_1 = require("./base-error");
|
|
7
|
+
const upstream_error_1 = require("./upstream-error");
|
|
8
|
+
const wrap_error_1 = require("./wrap-error");
|
|
9
|
+
/**
|
|
10
|
+
* Normalise anything escaping a public method into the library's error model:
|
|
11
|
+
* a branded library error is returned unchanged (its code was assigned closer
|
|
12
|
+
* to the failure and wins), anything else becomes an {@link UpstreamError}.
|
|
13
|
+
*/
|
|
14
|
+
function toPublicError(error, operation) {
|
|
15
|
+
const normalized = (0, wrap_error_1.toError)(error);
|
|
16
|
+
return (0, base_error_1.isDynamoDBLangGraphError)(normalized)
|
|
17
|
+
? normalized
|
|
18
|
+
: new upstream_error_1.UpstreamError(normalized, operation);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Run a public operation so that every rejection is a library error. Applied
|
|
22
|
+
* once, at each adapter class method, so internal code can keep rethrowing SDK
|
|
23
|
+
* errors verbatim (the retry classifier depends on their shape).
|
|
24
|
+
*/
|
|
25
|
+
async function guardPublic(operation, fn) {
|
|
26
|
+
try {
|
|
27
|
+
return await fn();
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw toPublicError(error, operation);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The same guard for a streaming result: items pass through, a failure raised
|
|
35
|
+
* mid-iteration is wrapped, and a consumer that stops early still closes the
|
|
36
|
+
* source generator.
|
|
37
|
+
*/
|
|
38
|
+
async function* guardPublicIterable(operation, source) {
|
|
39
|
+
try {
|
|
40
|
+
for await (const item of source)
|
|
41
|
+
yield item;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw toPublicError(error, operation);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -8,6 +8,6 @@ export declare enum ErrorCode {
|
|
|
8
8
|
S3_OFFLOAD_FAILED = "S3_OFFLOAD_FAILED",
|
|
9
9
|
RESULT_TRUNCATED = "RESULT_TRUNCATED",
|
|
10
10
|
ABORTED = "ABORTED",
|
|
11
|
-
COMPENSATION_FAILED = "COMPENSATION_FAILED"
|
|
11
|
+
COMPENSATION_FAILED = "COMPENSATION_FAILED",
|
|
12
|
+
UPSTREAM = "UPSTREAM"
|
|
12
13
|
}
|
|
13
|
-
//# sourceMappingURL=error-code.d.ts.map
|
|
@@ -13,5 +13,5 @@ var ErrorCode;
|
|
|
13
13
|
ErrorCode["RESULT_TRUNCATED"] = "RESULT_TRUNCATED";
|
|
14
14
|
ErrorCode["ABORTED"] = "ABORTED";
|
|
15
15
|
ErrorCode["COMPENSATION_FAILED"] = "COMPENSATION_FAILED";
|
|
16
|
+
ErrorCode["UPSTREAM"] = "UPSTREAM";
|
|
16
17
|
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
17
|
-
//# sourceMappingURL=error-code.js.map
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import type { WriteRequest } from '../dynamodb/types';
|
|
2
|
-
import {
|
|
3
|
-
/** Input failed a validation rule before any AWS call was made. */
|
|
4
|
-
export declare class ValidationError extends
|
|
5
|
-
constructor(message: string, field?: string);
|
|
2
|
+
import { DynamoDBLangGraphError } from './base-error';
|
|
3
|
+
/** Input failed a validation rule before any AWS call was made; `context.field` names the input. */
|
|
4
|
+
export declare class ValidationError extends DynamoDBLangGraphError {
|
|
5
|
+
constructor(message: string, field?: string, cause?: Error);
|
|
6
6
|
}
|
|
7
7
|
/** A conditional write failed because the precondition no longer holds. */
|
|
8
|
-
export declare class ConflictError extends
|
|
8
|
+
export declare class ConflictError extends DynamoDBLangGraphError {
|
|
9
9
|
constructor(message: string, cause?: Error);
|
|
10
10
|
}
|
|
11
11
|
/** A retried operation exhausted its attempt budget. */
|
|
12
|
-
export declare class RetryExhaustedError extends
|
|
12
|
+
export declare class RetryExhaustedError extends DynamoDBLangGraphError {
|
|
13
13
|
constructor(message: string, attempts?: number, cause?: Error);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* A paginated read hit its runaway guard (item or iteration cap) while more
|
|
17
17
|
* data remained, so the result would have been silently truncated. Narrow the
|
|
18
18
|
* query (filter/prefix) or raise the cap rather than trusting a partial result.
|
|
19
|
+
* `context.field` names the cap that was hit.
|
|
19
20
|
*/
|
|
20
|
-
export declare class ResultTruncatedError extends
|
|
21
|
+
export declare class ResultTruncatedError extends DynamoDBLangGraphError {
|
|
21
22
|
constructor(cap: string, limit: number);
|
|
22
23
|
}
|
|
23
24
|
/** An operation was cancelled via its AbortSignal. */
|
|
24
|
-
export declare class AbortError extends
|
|
25
|
-
constructor(message?: string);
|
|
25
|
+
export declare class AbortError extends DynamoDBLangGraphError {
|
|
26
|
+
constructor(message?: string, cause?: Error);
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* A BatchWriteItem sequence could not drain its UnprocessedItems. Items NOT
|
|
@@ -32,7 +33,7 @@ export declare class AbortError extends DynamoDbLangGraphError {
|
|
|
32
33
|
* non-UnprocessedItems error from a retry round) rather than a clean exhaustion
|
|
33
34
|
* of the UnprocessedItems retry budget.
|
|
34
35
|
*/
|
|
35
|
-
export declare class BatchWriteIncompleteError extends
|
|
36
|
+
export declare class BatchWriteIncompleteError extends DynamoDBLangGraphError {
|
|
36
37
|
readonly succeededCount: number;
|
|
37
38
|
readonly unprocessed: WriteRequest[];
|
|
38
39
|
constructor(succeededCount: number, unprocessed: WriteRequest[], retries: number, cause?: Error);
|
|
@@ -48,7 +49,7 @@ export declare class BatchWriteIncompleteError extends DynamoDbLangGraphError {
|
|
|
48
49
|
* chunk's own partial drain), more precise than `succeededChunks` alone
|
|
49
50
|
* when a chunk partially drains before exhausting its retries.
|
|
50
51
|
*/
|
|
51
|
-
export declare class BatchWriteAllIncompleteError extends
|
|
52
|
+
export declare class BatchWriteAllIncompleteError extends DynamoDBLangGraphError {
|
|
52
53
|
readonly succeededChunks: number;
|
|
53
54
|
readonly totalChunks: number;
|
|
54
55
|
readonly failedChunks: Error[];
|
|
@@ -61,8 +62,7 @@ export declare class BatchWriteAllIncompleteError extends DynamoDbLangGraphError
|
|
|
61
62
|
* `cause` and the rollback failure as {@link rollbackError}; the session's
|
|
62
63
|
* `messageCount` may have drifted — repair it with `reconcileMessageCount`.
|
|
63
64
|
*/
|
|
64
|
-
export declare class CompensationFailedError extends
|
|
65
|
+
export declare class CompensationFailedError extends DynamoDBLangGraphError {
|
|
65
66
|
readonly rollbackError: Error;
|
|
66
67
|
constructor(cause: Error, rollbackError: Error);
|
|
67
68
|
}
|
|
68
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompensationFailedError = exports.BatchWriteAllIncompleteError = exports.BatchWriteIncompleteError = exports.AbortError = exports.ResultTruncatedError = exports.RetryExhaustedError = exports.ConflictError = exports.ValidationError = void 0;
|
|
4
|
+
const secret_patterns_1 = require("../logging/secret-patterns");
|
|
4
5
|
const base_error_1 = require("./base-error");
|
|
5
6
|
const error_code_1 = require("./error-code");
|
|
6
|
-
/** Input failed a validation rule before any AWS call was made. */
|
|
7
|
-
class ValidationError extends base_error_1.
|
|
8
|
-
constructor(message, field) {
|
|
9
|
-
super(message, error_code_1.ErrorCode.VALIDATION, field === undefined ? {} : {
|
|
7
|
+
/** Input failed a validation rule before any AWS call was made; `context.field` names the input. */
|
|
8
|
+
class ValidationError extends base_error_1.DynamoDBLangGraphError {
|
|
9
|
+
constructor(message, field, cause) {
|
|
10
|
+
super(message, error_code_1.ErrorCode.VALIDATION, field === undefined ? {} : { field }, cause);
|
|
10
11
|
this.name = 'ValidationError';
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.ValidationError = ValidationError;
|
|
14
15
|
/** A conditional write failed because the precondition no longer holds. */
|
|
15
|
-
class ConflictError extends base_error_1.
|
|
16
|
+
class ConflictError extends base_error_1.DynamoDBLangGraphError {
|
|
16
17
|
constructor(message, cause) {
|
|
17
18
|
super(message, error_code_1.ErrorCode.CONDITION_CONFLICT, {}, cause);
|
|
18
19
|
this.name = 'ConflictError';
|
|
@@ -20,7 +21,7 @@ class ConflictError extends base_error_1.DynamoDbLangGraphError {
|
|
|
20
21
|
}
|
|
21
22
|
exports.ConflictError = ConflictError;
|
|
22
23
|
/** A retried operation exhausted its attempt budget. */
|
|
23
|
-
class RetryExhaustedError extends base_error_1.
|
|
24
|
+
class RetryExhaustedError extends base_error_1.DynamoDBLangGraphError {
|
|
24
25
|
constructor(message, attempts, cause) {
|
|
25
26
|
super(message, error_code_1.ErrorCode.RETRY_EXHAUSTED, attempts === undefined ? {} : { attempts }, cause);
|
|
26
27
|
this.name = 'RetryExhaustedError';
|
|
@@ -31,18 +32,19 @@ exports.RetryExhaustedError = RetryExhaustedError;
|
|
|
31
32
|
* A paginated read hit its runaway guard (item or iteration cap) while more
|
|
32
33
|
* data remained, so the result would have been silently truncated. Narrow the
|
|
33
34
|
* query (filter/prefix) or raise the cap rather than trusting a partial result.
|
|
35
|
+
* `context.field` names the cap that was hit.
|
|
34
36
|
*/
|
|
35
|
-
class ResultTruncatedError extends base_error_1.
|
|
37
|
+
class ResultTruncatedError extends base_error_1.DynamoDBLangGraphError {
|
|
36
38
|
constructor(cap, limit) {
|
|
37
|
-
super(`paginated read truncated at the ${cap} cap (${limit}) with more data remaining`, error_code_1.ErrorCode.RESULT_TRUNCATED, {
|
|
39
|
+
super(`paginated read truncated at the ${cap} cap (${limit}) with more data remaining`, error_code_1.ErrorCode.RESULT_TRUNCATED, { field: cap });
|
|
38
40
|
this.name = 'ResultTruncatedError';
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
exports.ResultTruncatedError = ResultTruncatedError;
|
|
42
44
|
/** An operation was cancelled via its AbortSignal. */
|
|
43
|
-
class AbortError extends base_error_1.
|
|
44
|
-
constructor(message = 'Operation aborted') {
|
|
45
|
-
super(message, error_code_1.ErrorCode.ABORTED);
|
|
45
|
+
class AbortError extends base_error_1.DynamoDBLangGraphError {
|
|
46
|
+
constructor(message = 'Operation aborted', cause) {
|
|
47
|
+
super(message, error_code_1.ErrorCode.ABORTED, {}, cause);
|
|
46
48
|
this.name = 'AbortError';
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -55,7 +57,7 @@ exports.AbortError = AbortError;
|
|
|
55
57
|
* non-UnprocessedItems error from a retry round) rather than a clean exhaustion
|
|
56
58
|
* of the UnprocessedItems retry budget.
|
|
57
59
|
*/
|
|
58
|
-
class BatchWriteIncompleteError extends base_error_1.
|
|
60
|
+
class BatchWriteIncompleteError extends base_error_1.DynamoDBLangGraphError {
|
|
59
61
|
succeededCount;
|
|
60
62
|
unprocessed;
|
|
61
63
|
constructor(succeededCount, unprocessed, retries, cause) {
|
|
@@ -78,7 +80,7 @@ exports.BatchWriteIncompleteError = BatchWriteIncompleteError;
|
|
|
78
80
|
* chunk's own partial drain), more precise than `succeededChunks` alone
|
|
79
81
|
* when a chunk partially drains before exhausting its retries.
|
|
80
82
|
*/
|
|
81
|
-
class BatchWriteAllIncompleteError extends base_error_1.
|
|
83
|
+
class BatchWriteAllIncompleteError extends base_error_1.DynamoDBLangGraphError {
|
|
82
84
|
succeededChunks;
|
|
83
85
|
totalChunks;
|
|
84
86
|
failedChunks;
|
|
@@ -100,13 +102,13 @@ exports.BatchWriteAllIncompleteError = BatchWriteAllIncompleteError;
|
|
|
100
102
|
* `cause` and the rollback failure as {@link rollbackError}; the session's
|
|
101
103
|
* `messageCount` may have drifted — repair it with `reconcileMessageCount`.
|
|
102
104
|
*/
|
|
103
|
-
class CompensationFailedError extends base_error_1.
|
|
105
|
+
class CompensationFailedError extends base_error_1.DynamoDBLangGraphError {
|
|
104
106
|
rollbackError;
|
|
105
107
|
constructor(cause, rollbackError) {
|
|
106
|
-
super(`compensation failed after an append error: ${
|
|
108
|
+
super(`compensation failed after an append error: ${(0, secret_patterns_1.redactedMessage)(cause)} ` +
|
|
109
|
+
`(rollback: ${(0, secret_patterns_1.redactedMessage)(rollbackError)})`, error_code_1.ErrorCode.COMPENSATION_FAILED, {}, cause);
|
|
107
110
|
this.name = 'CompensationFailedError';
|
|
108
111
|
this.rollbackError = rollbackError;
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
exports.CompensationFailedError = CompensationFailedError;
|
|
112
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DynamoDBLangGraphError } from './base-error';
|
|
2
|
+
/**
|
|
3
|
+
* A failure that originated below this library — the AWS SDK, the transport,
|
|
4
|
+
* a third-party `VectorBackend` or `Embeddings` — and surfaced through one of
|
|
5
|
+
* its public methods. Wrapping it keeps the promise that every rejection a
|
|
6
|
+
* caller sees is a {@link DynamoDBLangGraphError} with a branchable `code`,
|
|
7
|
+
* while losing nothing a support ticket needs: the SDK's own error name, the
|
|
8
|
+
* request id and HTTP status when present, and the original as `cause`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class UpstreamError extends DynamoDBLangGraphError {
|
|
11
|
+
readonly upstreamName: string;
|
|
12
|
+
/** Declared, not emitted: absent metadata leaves no `undefined`-valued own property behind. */
|
|
13
|
+
readonly requestId?: string;
|
|
14
|
+
readonly httpStatusCode?: number;
|
|
15
|
+
constructor(cause: Error, operation: string);
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpstreamError = void 0;
|
|
4
|
+
const base_error_1 = require("./base-error");
|
|
5
|
+
const error_code_1 = require("./error-code");
|
|
6
|
+
/**
|
|
7
|
+
* A failure that originated below this library — the AWS SDK, the transport,
|
|
8
|
+
* a third-party `VectorBackend` or `Embeddings` — and surfaced through one of
|
|
9
|
+
* its public methods. Wrapping it keeps the promise that every rejection a
|
|
10
|
+
* caller sees is a {@link DynamoDBLangGraphError} with a branchable `code`,
|
|
11
|
+
* while losing nothing a support ticket needs: the SDK's own error name, the
|
|
12
|
+
* request id and HTTP status when present, and the original as `cause`.
|
|
13
|
+
*/
|
|
14
|
+
class UpstreamError extends base_error_1.DynamoDBLangGraphError {
|
|
15
|
+
upstreamName;
|
|
16
|
+
constructor(cause, operation) {
|
|
17
|
+
super(`${operation}: ${cause.name}: ${cause.message}`, error_code_1.ErrorCode.UPSTREAM, { operation }, cause);
|
|
18
|
+
this.name = 'UpstreamError';
|
|
19
|
+
this.upstreamName = cause.name;
|
|
20
|
+
const metadata = cause.$metadata;
|
|
21
|
+
if (metadata?.requestId !== undefined)
|
|
22
|
+
this.requestId = metadata.requestId;
|
|
23
|
+
if (metadata?.httpStatusCode !== undefined)
|
|
24
|
+
this.httpStatusCode = metadata.httpStatusCode;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.UpstreamError = UpstreamError;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { DynamoDbLangGraphError, ErrorContext } from './base-error';
|
|
2
|
-
import { ErrorCode } from './error-code';
|
|
3
1
|
/**
|
|
4
2
|
* Normalize a caught value (TypeScript types catch clauses as the implicit
|
|
5
3
|
* unknown) into an `Error`. Error-shaped values pass through; anything else is
|
|
@@ -7,10 +5,3 @@ import { ErrorCode } from './error-code';
|
|
|
7
5
|
* are narrowed — callers do `toError(error as Error)`.
|
|
8
6
|
*/
|
|
9
7
|
export declare function toError(value: Error): Error;
|
|
10
|
-
/**
|
|
11
|
-
* Wrap a raw error in a coded {@link DynamoDbLangGraphError} with structured
|
|
12
|
-
* context, preserving the original as `cause`. Already-coded errors are
|
|
13
|
-
* returned unchanged so codes assigned closer to the failure win.
|
|
14
|
-
*/
|
|
15
|
-
export declare function wrapError(cause: Error, code: ErrorCode, context?: ErrorContext): DynamoDbLangGraphError;
|
|
16
|
-
//# sourceMappingURL=wrap-error.d.ts.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toError = toError;
|
|
4
|
-
exports.wrapError = wrapError;
|
|
5
|
-
const base_error_1 = require("./base-error");
|
|
6
4
|
/**
|
|
7
5
|
* Normalize a caught value (TypeScript types catch clauses as the implicit
|
|
8
6
|
* unknown) into an `Error`. Error-shaped values pass through; anything else is
|
|
@@ -15,16 +13,3 @@ function toError(value) {
|
|
|
15
13
|
}
|
|
16
14
|
return new Error(typeof value === 'string' ? value : JSON.stringify(value));
|
|
17
15
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Wrap a raw error in a coded {@link DynamoDbLangGraphError} with structured
|
|
20
|
-
* context, preserving the original as `cause`. Already-coded errors are
|
|
21
|
-
* returned unchanged so codes assigned closer to the failure win.
|
|
22
|
-
*/
|
|
23
|
-
function wrapError(cause, code, context) {
|
|
24
|
-
const normalized = toError(cause);
|
|
25
|
-
if ((0, base_error_1.isDynamoDbLangGraphError)(normalized)) {
|
|
26
|
-
return normalized;
|
|
27
|
-
}
|
|
28
|
-
return new base_error_1.DynamoDbLangGraphError(normalized.message, code, context ?? {}, normalized);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=wrap-error.js.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** A value safe to pass as a structured log argument. */
|
|
2
2
|
export type LogArgument = string | number | boolean | null | object;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Pluggable logging interface — consumers supply their own implementation.
|
|
5
|
+
* `args` are structured fields, at most one plain object per call, so an
|
|
6
|
+
* adapter for a structured logger (pino, winston) can merge them into one
|
|
7
|
+
* record; the message is a fixed string and never carries a value.
|
|
8
|
+
*/
|
|
4
9
|
export interface Logger {
|
|
5
10
|
info(message: string, ...args: LogArgument[]): void;
|
|
6
11
|
warn(message: string, ...args: LogArgument[]): void;
|
|
@@ -11,4 +16,3 @@ export interface Logger {
|
|
|
11
16
|
export declare const SILENT_LOGGER: Logger;
|
|
12
17
|
/** Return the injected logger, or {@link SILENT_LOGGER} when none is given. */
|
|
13
18
|
export declare function resolveLogger(logger?: Logger): Logger;
|
|
14
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -7,7 +7,7 @@ export type RedactableObject = Redactable[] | {
|
|
|
7
7
|
[key: string]: Redactable;
|
|
8
8
|
};
|
|
9
9
|
/** One step of the recursive walk, threaded into the entry helpers. */
|
|
10
|
-
|
|
10
|
+
type Walk = (value: Redactable) => Redactable;
|
|
11
11
|
/** Collaborators threaded through the recursive walk. */
|
|
12
12
|
export interface WalkDeps {
|
|
13
13
|
keyPatterns: readonly string[];
|
|
@@ -20,4 +20,4 @@ export interface WalkDeps {
|
|
|
20
20
|
* `Set`/`Map` render as their contents, and an Error takes the path above.
|
|
21
21
|
*/
|
|
22
22
|
export declare function walkObject(current: RedactableObject, deps: WalkDeps): Redactable;
|
|
23
|
-
|
|
23
|
+
export {};
|
|
@@ -10,9 +10,14 @@ function isSetValue(value) {
|
|
|
10
10
|
function isMapValue(value) {
|
|
11
11
|
return Object.prototype.toString.call(value) === '[object Map]';
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* True when `value` is an Error (or subclass) or a `DOMException` — which has
|
|
15
|
+
* its own tag yet carries the same `name`/`message`/`stack` — tested by tag,
|
|
16
|
+
* not `instanceof`, so a cross-realm error still matches.
|
|
17
|
+
*/
|
|
14
18
|
function isErrorValue(value) {
|
|
15
|
-
|
|
19
|
+
const tag = Object.prototype.toString.call(value);
|
|
20
|
+
return tag === '[object Error]' || tag === '[object DOMException]';
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* True for a value whose identity matters more than its own properties.
|
|
@@ -22,11 +27,21 @@ function isOpaqueValue(value) {
|
|
|
22
27
|
const tag = Object.prototype.toString.call(value);
|
|
23
28
|
return tag === '[object Date]' || tag === '[object RegExp]';
|
|
24
29
|
}
|
|
25
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Rebuild entries into a plain object, redacting values at secret-looking
|
|
32
|
+
* keys. Properties are defined, not assigned: `out['__proto__'] = …` would
|
|
33
|
+
* replace the result's prototype (and drop the entry) instead of recording the
|
|
34
|
+
* key as data.
|
|
35
|
+
*/
|
|
26
36
|
function redactEntries(entries, keyPatterns, walk) {
|
|
27
37
|
const out = {};
|
|
28
38
|
for (const [key, value] of entries) {
|
|
29
|
-
out
|
|
39
|
+
Object.defineProperty(out, key, {
|
|
40
|
+
value: (0, secret_patterns_1.isSecretKey)(key, keyPatterns) ? secret_patterns_1.REDACTED : walk(value),
|
|
41
|
+
enumerable: true,
|
|
42
|
+
writable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
});
|
|
30
45
|
}
|
|
31
46
|
return out;
|
|
32
47
|
}
|
|
@@ -42,23 +57,27 @@ function redactMap(value, deps) {
|
|
|
42
57
|
/**
|
|
43
58
|
* Rebuild an Error as a plain object carrying its redacted text alongside its
|
|
44
59
|
* redacted own properties. The one exception is an Error with no own
|
|
45
|
-
* enumerable data
|
|
46
|
-
* its identity and stack trace survive,
|
|
47
|
-
* useful in a log.
|
|
60
|
+
* enumerable data, no `cause`, no aggregated `errors`, and no secret in its
|
|
61
|
+
* text: it is returned by reference so its identity and stack trace survive,
|
|
62
|
+
* which is what keeps a caught error useful in a log.
|
|
48
63
|
*
|
|
49
|
-
* `cause`
|
|
50
|
-
*
|
|
51
|
-
* this the whole chain vanished on every rebuild — and the rebuild
|
|
52
|
-
* fires for this library's own error types, since each attaches an
|
|
53
|
-
* `code`/`context`. A redacted `RetryExhaustedError` would then no
|
|
54
|
-
* whether the underlying failure was a throttle, a validation error
|
|
55
|
-
* network fault, which is the entire reason it carries a cause.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
64
|
+
* `cause` and `AggregateError.errors` are copied explicitly because both are
|
|
65
|
+
* defined *non-enumerable* per spec, so `Object.entries` never sees them.
|
|
66
|
+
* Without this the whole chain vanished on every rebuild — and the rebuild
|
|
67
|
+
* always fires for this library's own error types, since each attaches an
|
|
68
|
+
* enumerable `code`/`context`. A redacted `RetryExhaustedError` would then no
|
|
69
|
+
* longer say whether the underlying failure was a throttle, a validation error
|
|
70
|
+
* or a network fault, which is the entire reason it carries a cause. A bare
|
|
71
|
+
* Error *with* a cause is rebuilt for the same reason: passing it by reference
|
|
72
|
+
* would hand the caller whatever secret the cause carries. Recursing through
|
|
73
|
+
* `walk` redacts the chain too, and the cycle guard handles a cause that
|
|
74
|
+
* points back at its own wrapper.
|
|
58
75
|
*/
|
|
59
76
|
function redactError(current, entries, deps) {
|
|
60
77
|
const text = (0, secret_patterns_1.redactErrorText)(current, deps.valuePatterns);
|
|
61
|
-
|
|
78
|
+
const aggregated = current.errors;
|
|
79
|
+
const bare = entries.length === 0 && current.cause === undefined && aggregated === undefined;
|
|
80
|
+
if (bare && !text.changed)
|
|
62
81
|
return current;
|
|
63
82
|
const out = redactEntries(entries, deps.keyPatterns, deps.walk);
|
|
64
83
|
out.name = text.name;
|
|
@@ -66,6 +85,8 @@ function redactError(current, entries, deps) {
|
|
|
66
85
|
out.stack = text.stack;
|
|
67
86
|
if (current.cause !== undefined)
|
|
68
87
|
out.cause = deps.walk(current.cause);
|
|
88
|
+
if (Array.isArray(aggregated))
|
|
89
|
+
out.errors = deps.walk(aggregated);
|
|
69
90
|
return out;
|
|
70
91
|
}
|
|
71
92
|
/**
|
|
@@ -89,4 +110,3 @@ function walkObject(current, deps) {
|
|
|
89
110
|
return redactError(current, entries, deps);
|
|
90
111
|
return redactEntries(entries, deps.keyPatterns, deps.walk);
|
|
91
112
|
}
|
|
92
|
-
//# sourceMappingURL=redaction-walk.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from './logger';
|
|
1
|
+
import type { LogArgument, Logger } from './logger';
|
|
2
2
|
import { type Redactable } from './redaction-walk';
|
|
3
3
|
/**
|
|
4
4
|
* Recursively clone `value`, replacing any value at a secret-looking key with
|
|
@@ -13,12 +13,17 @@ import { type Redactable } from './redaction-walk';
|
|
|
13
13
|
* `stack` redacted and every other own property recursed like a plain object.
|
|
14
14
|
* `Date`/`RegExp` keep their identity rather than collapsing to `{}`,
|
|
15
15
|
* `Set`/`Map` render as their contents, and binary views become a short label.
|
|
16
|
-
* Does not mutate the input.
|
|
16
|
+
* Does not mutate the input. Accepts any log argument — a typed `Error`, a
|
|
17
|
+
* class instance, a `Record` — so callers never cast.
|
|
17
18
|
*/
|
|
18
|
-
export declare function redactSecrets(value:
|
|
19
|
+
export declare function redactSecrets(value: LogArgument | undefined, patterns?: readonly string[], valuePatterns?: readonly RegExp[]): Redactable;
|
|
19
20
|
/** Options controlling {@link redactLogger}. */
|
|
20
21
|
export interface RedactLoggerOptions {
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Additional key names to redact. Matched like the defaults: a key is
|
|
24
|
+
* redacted when its normalised form (lower-case, punctuation removed) equals
|
|
25
|
+
* or ends with the normalised name, so `'ssn'` covers `SSN` and `user_ssn`.
|
|
26
|
+
*/
|
|
22
27
|
extraKeys?: readonly string[];
|
|
23
28
|
/**
|
|
24
29
|
* Additional secret shapes to redact wherever they appear inside a string.
|
|
@@ -32,4 +37,3 @@ export interface RedactLoggerOptions {
|
|
|
32
37
|
* string is passed through unchanged (never interpolate secrets into it).
|
|
33
38
|
*/
|
|
34
39
|
export declare function redactLogger(inner: Logger, options?: RedactLoggerOptions): Logger;
|
|
35
|
-
//# sourceMappingURL=redaction.d.ts.map
|
|
@@ -4,6 +4,8 @@ exports.redactSecrets = redactSecrets;
|
|
|
4
4
|
exports.redactLogger = redactLogger;
|
|
5
5
|
const redaction_walk_1 = require("./redaction-walk");
|
|
6
6
|
const secret_patterns_1 = require("./secret-patterns");
|
|
7
|
+
/** Substituted for a log argument whose redaction itself failed (a throwing getter, say). */
|
|
8
|
+
const UNREDACTABLE = '[UNREDACTABLE]';
|
|
7
9
|
/**
|
|
8
10
|
* Recursively clone `value`, replacing any value at a secret-looking key with
|
|
9
11
|
* `[REDACTED]` and any recognised secret *shape* inside a string — including an
|
|
@@ -17,7 +19,8 @@ const secret_patterns_1 = require("./secret-patterns");
|
|
|
17
19
|
* `stack` redacted and every other own property recursed like a plain object.
|
|
18
20
|
* `Date`/`RegExp` keep their identity rather than collapsing to `{}`,
|
|
19
21
|
* `Set`/`Map` render as their contents, and binary views become a short label.
|
|
20
|
-
* Does not mutate the input.
|
|
22
|
+
* Does not mutate the input. Accepts any log argument — a typed `Error`, a
|
|
23
|
+
* class instance, a `Record` — so callers never cast.
|
|
21
24
|
*/
|
|
22
25
|
function redactSecrets(value, patterns = secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS, valuePatterns = secret_patterns_1.DEFAULT_SECRET_VALUE_PATTERNS) {
|
|
23
26
|
const seen = new WeakSet();
|
|
@@ -38,18 +41,31 @@ function redactSecrets(value, patterns = secret_patterns_1.DEFAULT_SECRET_KEY_PA
|
|
|
38
41
|
};
|
|
39
42
|
return walk(value);
|
|
40
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Redact one log argument, never throwing: an argument whose redaction fails
|
|
46
|
+
* (a getter that throws, an exotic object) is replaced by a fixed marker rather
|
|
47
|
+
* than either leaking unredacted or failing the library operation that logged.
|
|
48
|
+
*/
|
|
49
|
+
function safeRedact(arg, patterns, valuePatterns) {
|
|
50
|
+
try {
|
|
51
|
+
return redactSecrets(arg, patterns, valuePatterns);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return UNREDACTABLE;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
41
57
|
/**
|
|
42
58
|
* Wrap a logger so object args are redacted before delegation. The message
|
|
43
59
|
* string is passed through unchanged (never interpolate secrets into it).
|
|
44
60
|
*/
|
|
45
61
|
function redactLogger(inner, options = {}) {
|
|
46
62
|
const patterns = options.extraKeys
|
|
47
|
-
? [...secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS, ...options.extraKeys.map(
|
|
63
|
+
? [...secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS, ...options.extraKeys.map(secret_patterns_1.normaliseKey)]
|
|
48
64
|
: secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS;
|
|
49
65
|
const valuePatterns = options.extraValuePatterns
|
|
50
66
|
? [...secret_patterns_1.DEFAULT_SECRET_VALUE_PATTERNS, ...options.extraValuePatterns]
|
|
51
67
|
: secret_patterns_1.DEFAULT_SECRET_VALUE_PATTERNS;
|
|
52
|
-
const wrap = (args) => args.map((arg) =>
|
|
68
|
+
const wrap = (args) => args.map((arg) => safeRedact(arg, patterns, valuePatterns));
|
|
53
69
|
return {
|
|
54
70
|
info: (message, ...args) => inner.info(message, ...wrap(args)),
|
|
55
71
|
warn: (message, ...args) => inner.warn(message, ...wrap(args)),
|
|
@@ -57,4 +73,3 @@ function redactLogger(inner, options = {}) {
|
|
|
57
73
|
debug: (message, ...args) => inner.debug(message, ...wrap(args)),
|
|
58
74
|
};
|
|
59
75
|
}
|
|
60
|
-
//# sourceMappingURL=redaction.js.map
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
/** Marker substituted for anything recognised as secret. */
|
|
2
2
|
export declare const REDACTED = "[REDACTED]";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Key names whose value is a secret. Each entry is a *normalised* name — see
|
|
5
|
+
* {@link normaliseKey} — and matches a key whose normalised form equals it or
|
|
6
|
+
* ends with it. Suffix matching is what catches `secretAccessKey`, `x-api-key`,
|
|
7
|
+
* `client_secret` and `AUTH_TOKEN`; requiring the pattern to be a suffix, not a
|
|
8
|
+
* substring, is what spares `maxTokens`, `total_tokens`, `tokenizer` and
|
|
9
|
+
* `secretary`, which the old substring rule redacted.
|
|
10
|
+
*/
|
|
4
11
|
export declare const DEFAULT_SECRET_KEY_PATTERNS: readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* Canonical form of a key name for matching: lower-case with every character
|
|
14
|
+
* that is not a letter or digit removed, so `api_key`, `x-api-key`, `ApiKey`
|
|
15
|
+
* and `API KEY` all become `apikey`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normaliseKey(key: string): string;
|
|
5
18
|
/**
|
|
6
19
|
* Secret shapes recognisable in free text, where key-name matching cannot
|
|
7
20
|
* reach: an error's `message`/`stack`, or any other string value. Deliberately
|
|
@@ -35,8 +48,14 @@ export declare const DEFAULT_SECRET_KEY_PATTERNS: readonly string[];
|
|
|
35
48
|
* this fallback from over-redacting sibling JSON fields.
|
|
36
49
|
*/
|
|
37
50
|
export declare const DEFAULT_SECRET_VALUE_PATTERNS: readonly RegExp[];
|
|
38
|
-
/** True when `key`
|
|
51
|
+
/** True when `key`'s normalised form equals or ends with any (normalised) pattern. */
|
|
39
52
|
export declare function isSecretKey(key: string, patterns: readonly string[]): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* An error's message with recognised credential shapes redacted, for embedding
|
|
55
|
+
* in another error's message: a wrapper that quotes its cause must not leak a
|
|
56
|
+
* `password=` or token the cause happened to carry.
|
|
57
|
+
*/
|
|
58
|
+
export declare function redactedMessage(error: Error): string;
|
|
40
59
|
/**
|
|
41
60
|
* Replace every recognised secret shape inside `value` with {@link REDACTED},
|
|
42
61
|
* leaving the surrounding text intact so a redacted message stays readable.
|
|
@@ -71,4 +90,3 @@ export interface RedactedErrorText {
|
|
|
71
90
|
* rebuilding it so the secret cannot escape.
|
|
72
91
|
*/
|
|
73
92
|
export declare function redactErrorText(error: Error, patterns: readonly RegExp[]): RedactedErrorText;
|
|
74
|
-
//# sourceMappingURL=secret-patterns.d.ts.map
|