@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.1 → 1.0.0
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 +1820 -290
- package/dist/cjs/backfill/backfill.d.ts +171 -0
- package/dist/cjs/backfill/backfill.js +177 -0
- package/dist/cjs/checkpointer/actions/delete-thread.d.ts +50 -0
- package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
- package/dist/cjs/checkpointer/actions/get-tuple.d.ts +36 -0
- package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
- package/dist/cjs/checkpointer/actions/list.d.ts +55 -0
- package/dist/cjs/checkpointer/actions/list.js +70 -0
- package/dist/cjs/checkpointer/actions/put-writes.d.ts +49 -0
- package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
- package/dist/cjs/checkpointer/actions/put.d.ts +95 -0
- package/dist/cjs/checkpointer/actions/put.js +79 -0
- package/dist/cjs/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
- package/dist/cjs/checkpointer/internal/listing.d.ts +149 -0
- package/dist/cjs/checkpointer/internal/listing.js +104 -0
- package/dist/cjs/checkpointer/internal/parse.d.ts +298 -0
- package/dist/cjs/checkpointer/internal/parse.js +184 -0
- package/dist/cjs/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
- package/dist/cjs/checkpointer/internal/read.d.ts +135 -0
- package/dist/cjs/checkpointer/internal/read.js +132 -0
- package/dist/cjs/checkpointer/internal/rows.d.ts +644 -0
- package/dist/cjs/checkpointer/internal/rows.js +356 -0
- package/dist/cjs/checkpointer/internal/setup.d.ts +47 -0
- package/dist/cjs/checkpointer/internal/setup.js +25 -0
- package/dist/cjs/checkpointer/saver.d.ts +306 -0
- package/dist/cjs/checkpointer/saver.js +56 -0
- package/dist/cjs/checkpointer/types.d.ts +51 -0
- package/dist/cjs/factory/factory.d.ts +154 -0
- package/dist/cjs/factory/factory.js +137 -0
- package/dist/{factory → cjs/factory}/types.d.ts +33 -14
- package/dist/cjs/history/actions/add-messages.d.ts +51 -0
- package/dist/cjs/history/actions/add-messages.js +17 -0
- package/dist/cjs/history/actions/clear.d.ts +52 -0
- package/dist/cjs/history/actions/clear.js +29 -0
- package/dist/cjs/history/actions/get-messages.d.ts +60 -0
- package/dist/cjs/history/actions/get-messages.js +58 -0
- package/dist/cjs/history/actions/list-sessions.d.ts +55 -0
- package/dist/cjs/history/actions/list-sessions.js +67 -0
- package/dist/cjs/history/actions/reconcile-count.d.ts +49 -0
- package/dist/cjs/history/actions/reconcile-count.js +8 -0
- package/dist/cjs/history/chat-message-history.d.ts +267 -0
- package/dist/cjs/history/chat-message-history.js +61 -0
- package/dist/cjs/history/internal/append.d.ts +244 -0
- package/dist/cjs/history/internal/append.js +267 -0
- package/dist/cjs/history/internal/message-read.d.ts +84 -0
- package/dist/cjs/history/internal/message-read.js +93 -0
- package/dist/cjs/history/internal/parse.d.ts +153 -0
- package/dist/cjs/history/internal/parse.js +113 -0
- package/dist/cjs/history/internal/rows.d.ts +196 -0
- package/dist/cjs/history/internal/rows.js +96 -0
- package/dist/cjs/history/internal/session.d.ts +350 -0
- package/dist/cjs/history/internal/session.js +296 -0
- package/dist/cjs/history/internal/setup.d.ts +64 -0
- package/dist/cjs/history/internal/setup.js +60 -0
- package/dist/cjs/history/session-adapter.d.ts +112 -0
- package/dist/cjs/history/session-adapter.js +38 -0
- package/dist/cjs/history/types.d.ts +102 -0
- package/dist/cjs/index.d.ts +53 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/shared/adapter.d.ts +146 -0
- package/dist/cjs/shared/adapter.js +70 -0
- package/dist/cjs/shared/clock.d.ts +52 -0
- package/dist/cjs/shared/clock.js +14 -0
- package/dist/cjs/shared/codec/codec.d.ts +336 -0
- package/dist/cjs/shared/codec/codec.js +162 -0
- package/dist/cjs/shared/codec/compression.d.ts +66 -0
- package/dist/cjs/shared/codec/compression.js +45 -0
- package/dist/cjs/shared/codec/json-serde.d.ts +80 -0
- package/dist/cjs/shared/codec/json-serde.js +58 -0
- package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +22 -2
- package/dist/{shared → cjs/shared}/codec/s3/client-types.js +0 -1
- package/dist/cjs/shared/codec/s3/client.d.ts +63 -0
- package/dist/cjs/shared/codec/s3/client.js +78 -0
- package/dist/cjs/shared/codec/s3/config.d.ts +260 -0
- package/dist/cjs/shared/codec/s3/config.js +92 -0
- package/dist/cjs/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
- package/dist/cjs/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/cjs/shared/codec/s3/offloader.js +289 -0
- package/dist/cjs/shared/concurrency.d.ts +43 -0
- package/dist/{shared → cjs/shared}/concurrency.js +10 -9
- package/dist/cjs/shared/dynamodb/abort.d.ts +47 -0
- package/dist/cjs/shared/dynamodb/abort.js +16 -0
- package/dist/cjs/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
- package/dist/cjs/shared/dynamodb/cancellation.d.ts +124 -0
- package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
- package/dist/cjs/shared/dynamodb/client.d.ts +177 -0
- package/dist/{shared → cjs/shared}/dynamodb/client.js +12 -14
- package/dist/cjs/shared/dynamodb/idempotent-write.d.ts +596 -0
- package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
- package/dist/cjs/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/cjs/shared/dynamodb/paginate.js +90 -0
- package/dist/cjs/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
- package/dist/cjs/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
- package/dist/cjs/shared/dynamodb/retry.d.ts +317 -0
- package/dist/cjs/shared/dynamodb/retry.js +193 -0
- package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/cjs/shared/dynamodb/row-size.js +30 -0
- package/dist/cjs/shared/dynamodb/table-schema.d.ts +199 -0
- package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
- package/dist/cjs/shared/errors/base-error.d.ts +231 -0
- package/dist/cjs/shared/errors/base-error.js +73 -0
- package/dist/cjs/shared/errors/boundary.d.ts +86 -0
- package/dist/cjs/shared/errors/boundary.js +61 -0
- package/dist/cjs/shared/errors/classify.d.ts +206 -0
- package/dist/cjs/shared/errors/classify.js +232 -0
- package/dist/cjs/shared/errors/error-code.d.ts +95 -0
- package/dist/{shared → cjs/shared}/errors/error-code.js +12 -2
- package/dist/cjs/shared/errors/errors.d.ts +233 -0
- package/dist/cjs/shared/errors/errors.js +123 -0
- package/dist/cjs/shared/logging/logger.d.ts +80 -0
- package/dist/cjs/shared/logging/logger.js +30 -0
- package/dist/cjs/shared/logging/redaction.d.ts +123 -0
- package/dist/cjs/shared/logging/redaction.js +145 -0
- package/dist/cjs/shared/logging/secret-patterns.d.ts +227 -0
- package/dist/cjs/shared/logging/secret-patterns.js +93 -0
- package/dist/cjs/shared/logging/truncate.d.ts +197 -0
- package/dist/cjs/shared/logging/truncate.js +31 -0
- package/dist/cjs/shared/options.d.ts +100 -0
- package/dist/cjs/shared/ulid.d.ts +80 -0
- package/dist/{shared → cjs/shared}/ulid.js +7 -21
- package/dist/cjs/shared/validation/collaborators.d.ts +160 -0
- package/dist/cjs/shared/validation/collaborators.js +79 -0
- package/dist/cjs/shared/validation/option-shape.d.ts +91 -0
- package/dist/cjs/shared/validation/option-shape.js +31 -0
- package/dist/cjs/shared/validation/options.d.ts +145 -0
- package/dist/cjs/shared/validation/options.js +166 -0
- package/dist/cjs/shared/validation/primitives.d.ts +292 -0
- package/dist/cjs/shared/validation/primitives.js +114 -0
- package/dist/cjs/shared/validation/ttl.d.ts +94 -0
- package/dist/cjs/shared/validation/ttl.js +52 -0
- package/dist/cjs/store/actions/list-namespaces.d.ts +79 -0
- package/dist/cjs/store/actions/list-namespaces.js +92 -0
- package/dist/cjs/store/actions/put.d.ts +43 -0
- package/dist/cjs/store/actions/put.js +49 -0
- package/dist/cjs/store/actions/reconcile-vector-index.d.ts +38 -0
- package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
- package/dist/cjs/store/actions/search.d.ts +38 -0
- package/dist/cjs/store/actions/search.js +26 -0
- package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
- package/dist/cjs/store/internal/batch-plan.js +32 -0
- package/dist/cjs/store/internal/filter.d.ts +43 -0
- package/dist/cjs/store/internal/filter.js +64 -0
- package/dist/cjs/store/internal/get-item.d.ts +77 -0
- package/dist/cjs/store/internal/get-item.js +58 -0
- package/dist/cjs/store/internal/item-write.d.ts +270 -0
- package/dist/cjs/store/internal/item-write.js +181 -0
- package/dist/cjs/store/internal/parse.d.ts +230 -0
- package/dist/cjs/store/internal/parse.js +180 -0
- package/dist/cjs/store/internal/rows.d.ts +359 -0
- package/dist/cjs/store/internal/rows.js +166 -0
- package/dist/cjs/store/internal/semantic-search.d.ts +168 -0
- package/dist/{store/internal/text-path.js → cjs/store/internal/semantic-search.js} +92 -28
- package/dist/cjs/store/internal/setup.d.ts +96 -0
- package/dist/cjs/store/internal/setup.js +103 -0
- package/dist/cjs/store/internal/table-search.d.ts +100 -0
- package/dist/cjs/store/internal/table-search.js +123 -0
- package/dist/cjs/store/internal/vector-index.d.ts +258 -0
- package/dist/cjs/store/internal/vector-index.js +269 -0
- package/dist/cjs/store/store.d.ts +329 -0
- package/dist/cjs/store/store.js +97 -0
- package/dist/cjs/store/types.d.ts +111 -0
- package/dist/cjs/store/vector-backend.d.ts +104 -0
- package/dist/cjs/store/vector-backend.js +4 -0
- package/dist/esm/backfill/backfill.d.ts +171 -0
- package/dist/esm/backfill/backfill.js +170 -0
- package/dist/esm/checkpointer/actions/delete-thread.d.ts +50 -0
- package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
- package/dist/esm/checkpointer/actions/get-tuple.d.ts +36 -0
- package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
- package/dist/esm/checkpointer/actions/list.d.ts +55 -0
- package/dist/esm/checkpointer/actions/list.js +67 -0
- package/dist/esm/checkpointer/actions/put-writes.d.ts +49 -0
- package/dist/esm/checkpointer/actions/put-writes.js +18 -0
- package/dist/esm/checkpointer/actions/put.d.ts +95 -0
- package/dist/esm/checkpointer/actions/put.js +75 -0
- package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/esm/checkpointer/internal/delta-history.js +126 -0
- package/dist/esm/checkpointer/internal/listing.d.ts +149 -0
- package/dist/esm/checkpointer/internal/listing.js +95 -0
- package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
- package/dist/esm/checkpointer/internal/parse.js +169 -0
- package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
- package/dist/esm/checkpointer/internal/read.d.ts +135 -0
- package/dist/esm/checkpointer/internal/read.js +125 -0
- package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
- package/dist/esm/checkpointer/internal/rows.js +323 -0
- package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
- package/dist/esm/checkpointer/internal/setup.js +21 -0
- package/dist/esm/checkpointer/saver.d.ts +306 -0
- package/dist/esm/checkpointer/saver.js +52 -0
- package/dist/esm/checkpointer/types.d.ts +51 -0
- package/dist/esm/checkpointer/types.js +1 -0
- package/dist/esm/factory/factory.d.ts +154 -0
- package/dist/esm/factory/factory.js +133 -0
- package/dist/esm/factory/types.d.ts +76 -0
- package/dist/esm/factory/types.js +1 -0
- package/dist/esm/history/actions/add-messages.d.ts +51 -0
- package/dist/esm/history/actions/add-messages.js +14 -0
- package/dist/esm/history/actions/clear.d.ts +52 -0
- package/dist/esm/history/actions/clear.js +26 -0
- package/dist/esm/history/actions/get-messages.d.ts +60 -0
- package/dist/esm/history/actions/get-messages.js +55 -0
- package/dist/esm/history/actions/list-sessions.d.ts +55 -0
- package/dist/esm/history/actions/list-sessions.js +64 -0
- package/dist/esm/history/actions/reconcile-count.d.ts +49 -0
- package/dist/esm/history/actions/reconcile-count.js +5 -0
- package/dist/esm/history/chat-message-history.d.ts +267 -0
- package/dist/esm/history/chat-message-history.js +57 -0
- package/dist/esm/history/internal/append.d.ts +244 -0
- package/dist/esm/history/internal/append.js +259 -0
- package/dist/esm/history/internal/message-read.d.ts +84 -0
- package/dist/esm/history/internal/message-read.js +89 -0
- package/dist/esm/history/internal/parse.d.ts +153 -0
- package/dist/esm/history/internal/parse.js +105 -0
- package/dist/esm/history/internal/rows.d.ts +196 -0
- package/dist/esm/history/internal/rows.js +83 -0
- package/dist/esm/history/internal/session.d.ts +350 -0
- package/dist/esm/history/internal/session.js +285 -0
- package/dist/esm/history/internal/setup.d.ts +64 -0
- package/dist/esm/history/internal/setup.js +56 -0
- package/dist/esm/history/session-adapter.d.ts +112 -0
- package/dist/esm/history/session-adapter.js +34 -0
- package/dist/esm/history/types.d.ts +102 -0
- package/dist/esm/history/types.js +1 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/shared/adapter.d.ts +146 -0
- package/dist/esm/shared/adapter.js +65 -0
- package/dist/esm/shared/clock.d.ts +52 -0
- package/dist/esm/shared/clock.js +9 -0
- package/dist/esm/shared/codec/codec.d.ts +336 -0
- package/dist/esm/shared/codec/codec.js +150 -0
- package/dist/esm/shared/codec/compression.d.ts +66 -0
- package/dist/esm/shared/codec/compression.js +40 -0
- package/dist/esm/shared/codec/json-serde.d.ts +80 -0
- package/dist/esm/shared/codec/json-serde.js +54 -0
- package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
- package/dist/esm/shared/codec/s3/client-types.js +3 -0
- package/dist/esm/shared/codec/s3/client.d.ts +63 -0
- package/dist/esm/shared/codec/s3/client.js +40 -0
- package/dist/esm/shared/codec/s3/config.d.ts +260 -0
- package/dist/esm/shared/codec/s3/config.js +79 -0
- package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
- package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/esm/shared/codec/s3/offloader.js +278 -0
- package/dist/esm/shared/concurrency.d.ts +43 -0
- package/dist/esm/shared/concurrency.js +27 -0
- package/dist/esm/shared/dynamodb/abort.d.ts +47 -0
- package/dist/esm/shared/dynamodb/abort.js +12 -0
- package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/esm/shared/dynamodb/batch-write.js +74 -0
- package/dist/esm/shared/dynamodb/cancellation.d.ts +124 -0
- package/dist/esm/shared/dynamodb/cancellation.js +30 -0
- package/dist/esm/shared/dynamodb/client.d.ts +177 -0
- package/dist/esm/shared/dynamodb/client.js +35 -0
- package/dist/esm/shared/dynamodb/idempotent-write.d.ts +596 -0
- package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
- package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/esm/shared/dynamodb/paginate.js +84 -0
- package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
- package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/esm/shared/dynamodb/recency-index.js +136 -0
- package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
- package/dist/esm/shared/dynamodb/retry.js +180 -0
- package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/esm/shared/dynamodb/row-size.js +26 -0
- package/dist/esm/shared/dynamodb/table-schema.d.ts +199 -0
- package/dist/esm/shared/dynamodb/table-schema.js +43 -0
- package/dist/esm/shared/errors/base-error.d.ts +231 -0
- package/dist/esm/shared/errors/base-error.js +64 -0
- package/dist/esm/shared/errors/boundary.d.ts +86 -0
- package/dist/esm/shared/errors/boundary.js +54 -0
- package/dist/esm/shared/errors/classify.d.ts +206 -0
- package/dist/esm/shared/errors/classify.js +220 -0
- package/dist/esm/shared/errors/error-code.d.ts +95 -0
- package/dist/esm/shared/errors/error-code.js +24 -0
- package/dist/esm/shared/errors/errors.d.ts +233 -0
- package/dist/esm/shared/errors/errors.js +110 -0
- package/dist/esm/shared/logging/logger.d.ts +80 -0
- package/dist/esm/shared/logging/logger.js +25 -0
- package/dist/esm/shared/logging/redaction.d.ts +123 -0
- package/dist/esm/shared/logging/redaction.js +140 -0
- package/dist/esm/shared/logging/secret-patterns.d.ts +227 -0
- package/dist/esm/shared/logging/secret-patterns.js +83 -0
- package/dist/esm/shared/logging/truncate.d.ts +197 -0
- package/dist/esm/shared/logging/truncate.js +25 -0
- package/dist/esm/shared/options.d.ts +100 -0
- package/dist/esm/shared/options.js +1 -0
- package/dist/esm/shared/ulid.d.ts +80 -0
- package/dist/esm/shared/ulid.js +77 -0
- package/dist/esm/shared/validation/collaborators.d.ts +160 -0
- package/dist/esm/shared/validation/collaborators.js +70 -0
- package/dist/esm/shared/validation/option-shape.d.ts +91 -0
- package/dist/esm/shared/validation/option-shape.js +24 -0
- package/dist/esm/shared/validation/options.d.ts +145 -0
- package/dist/esm/shared/validation/options.js +156 -0
- package/dist/esm/shared/validation/primitives.d.ts +292 -0
- package/dist/esm/shared/validation/primitives.js +100 -0
- package/dist/esm/shared/validation/ttl.d.ts +94 -0
- package/dist/esm/shared/validation/ttl.js +46 -0
- package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
- package/dist/esm/store/actions/list-namespaces.js +86 -0
- package/dist/esm/store/actions/put.d.ts +43 -0
- package/dist/esm/store/actions/put.js +46 -0
- package/dist/esm/store/actions/reconcile-vector-index.d.ts +38 -0
- package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
- package/dist/esm/store/actions/search.d.ts +38 -0
- package/dist/esm/store/actions/search.js +23 -0
- package/dist/esm/store/internal/batch-plan.d.ts +56 -0
- package/dist/esm/store/internal/batch-plan.js +28 -0
- package/dist/esm/store/internal/filter.d.ts +43 -0
- package/dist/esm/store/internal/filter.js +60 -0
- package/dist/esm/store/internal/get-item.d.ts +77 -0
- package/dist/esm/store/internal/get-item.js +54 -0
- package/dist/esm/store/internal/item-write.d.ts +270 -0
- package/dist/esm/store/internal/item-write.js +173 -0
- package/dist/esm/store/internal/parse.d.ts +230 -0
- package/dist/esm/store/internal/parse.js +169 -0
- package/dist/esm/store/internal/rows.d.ts +359 -0
- package/dist/esm/store/internal/rows.js +147 -0
- package/dist/esm/store/internal/semantic-search.d.ts +168 -0
- package/dist/esm/store/internal/semantic-search.js +200 -0
- package/dist/esm/store/internal/setup.d.ts +96 -0
- package/dist/esm/store/internal/setup.js +98 -0
- package/dist/esm/store/internal/table-search.d.ts +100 -0
- package/dist/esm/store/internal/table-search.js +119 -0
- package/dist/esm/store/internal/vector-index.d.ts +258 -0
- package/dist/esm/store/internal/vector-index.js +256 -0
- package/dist/esm/store/store.d.ts +329 -0
- package/dist/esm/store/store.js +93 -0
- package/dist/esm/store/types.d.ts +111 -0
- package/dist/esm/store/types.js +1 -0
- package/dist/esm/store/vector-backend.d.ts +104 -0
- package/dist/esm/store/vector-backend.js +1 -0
- package/package.json +68 -46
- package/dist/checkpointer/actions/delete-thread.d.ts +0 -10
- package/dist/checkpointer/actions/delete-thread.js +0 -38
- package/dist/checkpointer/actions/get-tuple.d.ts +0 -11
- package/dist/checkpointer/actions/get-tuple.js +0 -25
- package/dist/checkpointer/actions/list.d.ts +0 -20
- package/dist/checkpointer/actions/list.js +0 -113
- package/dist/checkpointer/actions/put-writes.d.ts +0 -15
- package/dist/checkpointer/actions/put-writes.js +0 -62
- package/dist/checkpointer/actions/put.d.ts +0 -17
- package/dist/checkpointer/actions/put.js +0 -73
- package/dist/checkpointer/internal/assemble.d.ts +0 -17
- package/dist/checkpointer/internal/assemble.js +0 -38
- package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +0 -24
- package/dist/checkpointer/internal/checkpoint-write-verify.js +0 -67
- package/dist/checkpointer/internal/configurable.d.ts +0 -12
- package/dist/checkpointer/internal/configurable.js +0 -24
- package/dist/checkpointer/internal/fetch.d.ts +0 -19
- package/dist/checkpointer/internal/fetch.js +0 -88
- package/dist/checkpointer/internal/filter-match.d.ts +0 -13
- package/dist/checkpointer/internal/filter-match.js +0 -15
- package/dist/checkpointer/internal/item-reader.d.ts +0 -66
- package/dist/checkpointer/internal/item-reader.js +0 -113
- package/dist/checkpointer/internal/item-writer.d.ts +0 -35
- package/dist/checkpointer/internal/item-writer.js +0 -107
- package/dist/checkpointer/internal/keys.d.ts +0 -41
- package/dist/checkpointer/internal/keys.js +0 -117
- package/dist/checkpointer/internal/list-scope.d.ts +0 -61
- package/dist/checkpointer/internal/list-scope.js +0 -108
- package/dist/checkpointer/internal/pending-sends.d.ts +0 -13
- package/dist/checkpointer/internal/pending-sends.js +0 -29
- package/dist/checkpointer/internal/query.d.ts +0 -21
- package/dist/checkpointer/internal/query.js +0 -42
- package/dist/checkpointer/internal/regular-write.d.ts +0 -28
- package/dist/checkpointer/internal/regular-write.js +0 -66
- package/dist/checkpointer/internal/setup.d.ts +0 -33
- package/dist/checkpointer/internal/setup.js +0 -38
- package/dist/checkpointer/internal/special-write-cas.d.ts +0 -29
- package/dist/checkpointer/internal/special-write-cas.js +0 -104
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -23
- package/dist/checkpointer/internal/special-write-cleanup.js +0 -50
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -53
- package/dist/checkpointer/internal/special-write-verify.js +0 -80
- package/dist/checkpointer/internal/stored-channels.d.ts +0 -31
- package/dist/checkpointer/internal/stored-channels.js +0 -70
- package/dist/checkpointer/internal/validation.d.ts +0 -18
- package/dist/checkpointer/internal/validation.js +0 -40
- package/dist/checkpointer/internal/write-guard.d.ts +0 -20
- package/dist/checkpointer/internal/write-guard.js +0 -48
- package/dist/checkpointer/internal/write-index.d.ts +0 -36
- package/dist/checkpointer/internal/write-index.js +0 -41
- package/dist/checkpointer/saver.d.ts +0 -70
- package/dist/checkpointer/saver.js +0 -105
- package/dist/checkpointer/types.d.ts +0 -58
- package/dist/factory/factory.d.ts +0 -40
- package/dist/factory/factory.js +0 -87
- package/dist/history/actions/add-messages.d.ts +0 -15
- package/dist/history/actions/add-messages.js +0 -77
- package/dist/history/actions/clear.d.ts +0 -10
- package/dist/history/actions/clear.js +0 -34
- package/dist/history/actions/get-messages.d.ts +0 -17
- package/dist/history/actions/get-messages.js +0 -79
- package/dist/history/actions/list-sessions.d.ts +0 -13
- package/dist/history/actions/list-sessions.js +0 -53
- package/dist/history/actions/reconcile-count.d.ts +0 -12
- package/dist/history/actions/reconcile-count.js +0 -64
- package/dist/history/chat-message-history.d.ts +0 -73
- package/dist/history/chat-message-history.js +0 -111
- package/dist/history/internal/append-saga.d.ts +0 -25
- package/dist/history/internal/append-saga.js +0 -79
- package/dist/history/internal/compensation.d.ts +0 -25
- package/dist/history/internal/compensation.js +0 -92
- package/dist/history/internal/item-mapper.d.ts +0 -9
- package/dist/history/internal/item-mapper.js +0 -27
- package/dist/history/internal/keys.d.ts +0 -16
- package/dist/history/internal/keys.js +0 -48
- package/dist/history/internal/message-chunker.d.ts +0 -13
- package/dist/history/internal/message-chunker.js +0 -67
- package/dist/history/internal/message-transaction.d.ts +0 -25
- package/dist/history/internal/message-transaction.js +0 -61
- package/dist/history/internal/message-window.d.ts +0 -17
- package/dist/history/internal/message-window.js +0 -49
- package/dist/history/internal/query.d.ts +0 -23
- package/dist/history/internal/query.js +0 -39
- package/dist/history/internal/session-count.d.ts +0 -47
- package/dist/history/internal/session-count.js +0 -115
- package/dist/history/internal/session-title.d.ts +0 -19
- package/dist/history/internal/session-title.js +0 -43
- package/dist/history/internal/session-update.d.ts +0 -27
- package/dist/history/internal/session-update.js +0 -69
- package/dist/history/internal/setup.d.ts +0 -31
- package/dist/history/internal/setup.js +0 -43
- package/dist/history/internal/title-generator.d.ts +0 -12
- package/dist/history/internal/title-generator.js +0 -41
- package/dist/history/internal/ttl-anchor.d.ts +0 -24
- package/dist/history/internal/ttl-anchor.js +0 -38
- package/dist/history/internal/validation.d.ts +0 -25
- package/dist/history/internal/validation.js +0 -53
- package/dist/history/session-adapter.d.ts +0 -29
- package/dist/history/session-adapter.js +0 -35
- package/dist/history/types.d.ts +0 -69
- package/dist/index.d.ts +0 -29
- package/dist/index.js +0 -32
- package/dist/shared/clock.d.ts +0 -8
- package/dist/shared/clock.js +0 -16
- package/dist/shared/codec/codec.d.ts +0 -53
- package/dist/shared/codec/codec.js +0 -66
- package/dist/shared/codec/compression.d.ts +0 -24
- package/dist/shared/codec/compression.js +0 -48
- package/dist/shared/codec/descriptor-keys.d.ts +0 -12
- package/dist/shared/codec/descriptor-keys.js +0 -14
- package/dist/shared/codec/encode.d.ts +0 -13
- package/dist/shared/codec/encode.js +0 -43
- package/dist/shared/codec/json-serde.d.ts +0 -7
- package/dist/shared/codec/json-serde.js +0 -17
- package/dist/shared/codec/payload-loss.d.ts +0 -12
- package/dist/shared/codec/payload-loss.js +0 -38
- package/dist/shared/codec/s3/adapter-config.d.ts +0 -13
- package/dist/shared/codec/s3/adapter-config.js +0 -22
- package/dist/shared/codec/s3/bounded-body.d.ts +0 -14
- package/dist/shared/codec/s3/bounded-body.js +0 -47
- package/dist/shared/codec/s3/client.d.ts +0 -18
- package/dist/shared/codec/s3/client.js +0 -46
- package/dist/shared/codec/s3/config.d.ts +0 -51
- package/dist/shared/codec/s3/config.js +0 -58
- package/dist/shared/codec/s3/delete.d.ts +0 -7
- package/dist/shared/codec/s3/delete.js +0 -28
- package/dist/shared/codec/s3/key-scope.d.ts +0 -23
- package/dist/shared/codec/s3/key-scope.js +0 -44
- package/dist/shared/codec/s3/lifecycle.d.ts +0 -14
- package/dist/shared/codec/s3/lifecycle.js +0 -63
- package/dist/shared/codec/s3/offloader.d.ts +0 -44
- package/dist/shared/codec/s3/offloader.js +0 -118
- package/dist/shared/codec/s3/orphans.d.ts +0 -23
- package/dist/shared/codec/s3/orphans.js +0 -71
- package/dist/shared/codec/s3/read-write.d.ts +0 -18
- package/dist/shared/codec/s3/read-write.js +0 -51
- package/dist/shared/codec/s3/retry.d.ts +0 -5
- package/dist/shared/codec/s3/retry.js +0 -22
- package/dist/shared/concurrency.d.ts +0 -6
- package/dist/shared/constants.d.ts +0 -112
- package/dist/shared/constants.js +0 -115
- package/dist/shared/dynamodb/abort.d.ts +0 -9
- package/dist/shared/dynamodb/abort.js +0 -27
- package/dist/shared/dynamodb/backoff.d.ts +0 -15
- package/dist/shared/dynamodb/backoff.js +0 -48
- package/dist/shared/dynamodb/batch-write.d.ts +0 -22
- package/dist/shared/dynamodb/batch-write.js +0 -53
- package/dist/shared/dynamodb/cancellation.d.ts +0 -6
- package/dist/shared/dynamodb/cancellation.js +0 -7
- package/dist/shared/dynamodb/client.d.ts +0 -28
- package/dist/shared/dynamodb/conditional-put.d.ts +0 -67
- package/dist/shared/dynamodb/conditional-put.js +0 -76
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -21
- package/dist/shared/dynamodb/drain-unprocessed.js +0 -43
- package/dist/shared/dynamodb/expiry.d.ts +0 -16
- package/dist/shared/dynamodb/expiry.js +0 -29
- package/dist/shared/dynamodb/paginate-core.d.ts +0 -24
- package/dist/shared/dynamodb/paginate-core.js +0 -82
- package/dist/shared/dynamodb/paginate.d.ts +0 -14
- package/dist/shared/dynamodb/paginate.js +0 -19
- package/dist/shared/dynamodb/partition-delete.d.ts +0 -39
- package/dist/shared/dynamodb/partition-delete.js +0 -71
- package/dist/shared/dynamodb/retry-classifier.d.ts +0 -17
- package/dist/shared/dynamodb/retry-classifier.js +0 -118
- package/dist/shared/dynamodb/retry-policy.d.ts +0 -26
- package/dist/shared/dynamodb/retry-policy.js +0 -22
- package/dist/shared/dynamodb/retry.d.ts +0 -31
- package/dist/shared/dynamodb/retry.js +0 -57
- package/dist/shared/dynamodb/scan.d.ts +0 -14
- package/dist/shared/dynamodb/scan.js +0 -19
- package/dist/shared/dynamodb/types.d.ts +0 -23
- package/dist/shared/errors/base-error.d.ts +0 -30
- package/dist/shared/errors/base-error.js +0 -27
- package/dist/shared/errors/boundary.d.ts +0 -18
- package/dist/shared/errors/boundary.js +0 -46
- package/dist/shared/errors/error-code.d.ts +0 -13
- package/dist/shared/errors/errors.d.ts +0 -68
- package/dist/shared/errors/errors.js +0 -114
- package/dist/shared/errors/upstream-error.d.ts +0 -16
- package/dist/shared/errors/upstream-error.js +0 -27
- package/dist/shared/errors/wrap-error.d.ts +0 -7
- package/dist/shared/errors/wrap-error.js +0 -15
- package/dist/shared/logging/logger.d.ts +0 -18
- package/dist/shared/logging/logger.js +0 -15
- package/dist/shared/logging/redaction-walk.d.ts +0 -23
- package/dist/shared/logging/redaction-walk.js +0 -112
- package/dist/shared/logging/redaction.d.ts +0 -39
- package/dist/shared/logging/redaction.js +0 -75
- package/dist/shared/logging/secret-patterns.d.ts +0 -92
- package/dist/shared/logging/secret-patterns.js +0 -133
- package/dist/shared/options.d.ts +0 -37
- package/dist/shared/ulid.d.ts +0 -23
- package/dist/shared/validation/options.d.ts +0 -8
- package/dist/shared/validation/options.js +0 -90
- package/dist/shared/validation/primitives.d.ts +0 -29
- package/dist/shared/validation/primitives.js +0 -82
- package/dist/shared/validation/ttl.d.ts +0 -28
- package/dist/shared/validation/ttl.js +0 -52
- package/dist/store/actions/get.d.ts +0 -13
- package/dist/store/actions/get.js +0 -73
- package/dist/store/actions/list-namespaces.d.ts +0 -8
- package/dist/store/actions/list-namespaces.js +0 -59
- package/dist/store/actions/put.d.ts +0 -10
- package/dist/store/actions/put.js +0 -96
- package/dist/store/actions/reconcile-vector-index.d.ts +0 -18
- package/dist/store/actions/reconcile-vector-index.js +0 -26
- package/dist/store/actions/search.d.ts +0 -9
- package/dist/store/actions/search.js +0 -34
- package/dist/store/internal/backend-search.d.ts +0 -4
- package/dist/store/internal/backend-search.js +0 -74
- package/dist/store/internal/batch-plan.d.ts +0 -11
- package/dist/store/internal/batch-plan.js +0 -52
- package/dist/store/internal/candidates.d.ts +0 -23
- package/dist/store/internal/candidates.js +0 -94
- package/dist/store/internal/filter.d.ts +0 -9
- package/dist/store/internal/filter.js +0 -85
- package/dist/store/internal/index-reconcile.d.ts +0 -21
- package/dist/store/internal/index-reconcile.js +0 -118
- package/dist/store/internal/index-sync.d.ts +0 -10
- package/dist/store/internal/index-sync.js +0 -25
- package/dist/store/internal/item-mapper.d.ts +0 -27
- package/dist/store/internal/item-mapper.js +0 -61
- package/dist/store/internal/keys.d.ts +0 -17
- package/dist/store/internal/keys.js +0 -41
- package/dist/store/internal/namespace-match.d.ts +0 -11
- package/dist/store/internal/namespace-match.js +0 -40
- package/dist/store/internal/option-validation.d.ts +0 -13
- package/dist/store/internal/option-validation.js +0 -77
- package/dist/store/internal/overwrite-swap.d.ts +0 -32
- package/dist/store/internal/overwrite-swap.js +0 -68
- package/dist/store/internal/persist.d.ts +0 -28
- package/dist/store/internal/persist.js +0 -64
- package/dist/store/internal/query.d.ts +0 -11
- package/dist/store/internal/query.js +0 -48
- package/dist/store/internal/ranker.d.ts +0 -18
- package/dist/store/internal/ranker.js +0 -39
- package/dist/store/internal/read-existing.d.ts +0 -23
- package/dist/store/internal/read-existing.js +0 -41
- package/dist/store/internal/score-direction.d.ts +0 -31
- package/dist/store/internal/score-direction.js +0 -38
- package/dist/store/internal/search-filter.d.ts +0 -3
- package/dist/store/internal/search-filter.js +0 -10
- package/dist/store/internal/semantic-search.d.ts +0 -34
- package/dist/store/internal/semantic-search.js +0 -87
- package/dist/store/internal/setup.d.ts +0 -36
- package/dist/store/internal/setup.js +0 -40
- package/dist/store/internal/text-path.d.ts +0 -17
- package/dist/store/internal/validation.d.ts +0 -18
- package/dist/store/internal/validation.js +0 -51
- package/dist/store/internal/write-verify.d.ts +0 -42
- package/dist/store/internal/write-verify.js +0 -71
- package/dist/store/store.d.ts +0 -61
- package/dist/store/store.js +0 -107
- package/dist/store/types.d.ts +0 -50
- package/dist/store/types.js +0 -2
- package/dist/store/vector-backend.d.ts +0 -43
- package/dist/store/vector-backend.js +0 -2
- /package/dist/{checkpointer → cjs/checkpointer}/types.js +0 -0
- /package/dist/{factory → cjs/factory}/types.js +0 -0
- /package/dist/{history → cjs/history}/types.js +0 -0
- /package/dist/{shared → cjs/shared}/options.js +0 -0
- /package/dist/{shared/dynamodb → cjs/store}/types.js +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toPublicError = toPublicError;
|
|
4
|
+
exports.guardPublic = guardPublic;
|
|
5
|
+
exports.guardPublicIterable = guardPublicIterable;
|
|
6
|
+
exports.guardPublicSync = guardPublicSync;
|
|
7
|
+
exports.wrapForeignError = wrapForeignError;
|
|
8
|
+
const secret_patterns_js_1 = require("../logging/secret-patterns.js");
|
|
9
|
+
const truncate_js_1 = require("../logging/truncate.js");
|
|
10
|
+
const base_error_js_1 = require("./base-error.js");
|
|
11
|
+
const classify_js_1 = require("./classify.js");
|
|
12
|
+
function stampContext(error, operation, tableName) {
|
|
13
|
+
const context = error.context;
|
|
14
|
+
if (typeof context !== 'object' || context === null)
|
|
15
|
+
return;
|
|
16
|
+
try {
|
|
17
|
+
context.operation ??= operation;
|
|
18
|
+
if (tableName !== undefined)
|
|
19
|
+
context.tableName ??= tableName;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function toPublicError(error, operation, tableName) {
|
|
25
|
+
const normalized = (0, base_error_js_1.toError)(error);
|
|
26
|
+
const publicError = (0, base_error_js_1.isDynamoDBLangGraphError)(normalized)
|
|
27
|
+
? normalized
|
|
28
|
+
: wrapForeignError(normalized, operation);
|
|
29
|
+
stampContext(publicError, operation, tableName);
|
|
30
|
+
return publicError;
|
|
31
|
+
}
|
|
32
|
+
async function guardPublic(operation, fn, tableName) {
|
|
33
|
+
try {
|
|
34
|
+
return await fn();
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw toPublicError(error, operation, tableName);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function* guardPublicIterable(operation, source, tableName) {
|
|
41
|
+
try {
|
|
42
|
+
for await (const item of source)
|
|
43
|
+
yield item;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw toPublicError(error, operation, tableName);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function guardPublicSync(operation, fn, tableName) {
|
|
50
|
+
try {
|
|
51
|
+
return fn();
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw toPublicError(error, operation, tableName);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function wrapForeignError(cause, operation) {
|
|
58
|
+
const below = (0, base_error_js_1.toError)(cause);
|
|
59
|
+
const classifiable = (0, classify_js_1.classifiableCause)(below);
|
|
60
|
+
return new base_error_js_1.DynamoDBLangGraphError(`${operation}: ${(0, truncate_js_1.truncateForLog)(below.name)}: ${(0, secret_patterns_js_1.redactedMessage)(below)}`, (0, classify_js_1.classifyAwsError)(classifiable), { operation, ...(0, classify_js_1.awsDiagnostics)(classifiable) }, below);
|
|
61
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides which AWS failures are the same failure.
|
|
3
|
+
*
|
|
4
|
+
* An SDK error arrives as a name, an HTTP status, a Node network `code` or —
|
|
5
|
+
* for a cancelled transaction — a list of per-item reasons, and several of
|
|
6
|
+
* those arrivals mean one thing to a caller deciding what to do. Their mapping
|
|
7
|
+
* to one `ErrorCode`, and the retry layer's default list of transient names,
|
|
8
|
+
* come from one table here (record 19), so no call site compares an AWS
|
|
9
|
+
* exception name of its own.
|
|
10
|
+
*/
|
|
11
|
+
import type { ErrorContext } from './base-error.js';
|
|
12
|
+
import { ErrorCode } from './error-code.js';
|
|
13
|
+
/** The fields an AWS SDK v3 error, or a transport error under it, can carry. */
|
|
14
|
+
/** The fields of an SDK error this module reads; exported for the retry layer's own walk. */
|
|
15
|
+
export interface AwsErrorFields {
|
|
16
|
+
name?: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
message?: string;
|
|
19
|
+
$metadata?: {
|
|
20
|
+
httpStatusCode?: number;
|
|
21
|
+
requestId?: string;
|
|
22
|
+
clockSkewCorrected?: boolean;
|
|
23
|
+
} | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The Node.js system error codes the SDK's own retry strategy treats as
|
|
27
|
+
* transient regardless of name (`@smithy/core` retry `NODEJS_TIMEOUT_ERROR_CODES`
|
|
28
|
+
* and `NODEJS_NETWORK_ERROR_CODES`). Matched on the error's own `code`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const TRANSIENT_NETWORK_ERROR_CODES: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* HTTP statuses the SDK retries regardless of name: throttling (429) and the
|
|
33
|
+
* transient server statuses (`@smithy/core` retry `TRANSIENT_ERROR_STATUS_CODES`).
|
|
34
|
+
* They classify an error the SDK could not map to a modeled exception, which
|
|
35
|
+
* arrives as `name: 'Unknown'` with only its status.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TRANSIENT_HTTP_STATUSES: readonly number[];
|
|
38
|
+
/**
|
|
39
|
+
* AWS error name to code. Each name is declared by the installed
|
|
40
|
+
* `@aws-sdk/client-dynamodb` or `@aws-sdk/client-s3`, or documented on a page
|
|
41
|
+
* `test/static/aws-error-names.test.ts` cites; that test fails on any other.
|
|
42
|
+
*/
|
|
43
|
+
export declare const AWS_ERROR_CODES: Readonly<Record<string, ErrorCode>>;
|
|
44
|
+
/**
|
|
45
|
+
* The retry layer's default tokens: every name {@link AWS_ERROR_CODES} maps to
|
|
46
|
+
* a retryable code, and the network codes. Derived rather than listed, so the
|
|
47
|
+
* retry layer and the code a caller sees share one list of transient names.
|
|
48
|
+
* They differ at two edges: the retry layer also retries on the SDK's
|
|
49
|
+
* `$retryable` trait, which {@link classifyAwsError} does not read, and it
|
|
50
|
+
* walks the cause chain matching `errno` and `syscall` too, where the
|
|
51
|
+
* classifier reads one error's `name`, `code` and status.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_RETRYABLE_ERRORS: readonly string[];
|
|
54
|
+
/**
|
|
55
|
+
* Whether the SDK itself would retry this signing failure.
|
|
56
|
+
*
|
|
57
|
+
* Accepts: `fields` — an error's own fields, as the SDK sets them.
|
|
58
|
+
*
|
|
59
|
+
* Returns: true when the SDK corrected its clock offset on the response
|
|
60
|
+
* (`$metadata.clockSkewCorrected`, set once the skew passes four minutes), or
|
|
61
|
+
* the service reports the signature expired (`InvalidSignatureException`
|
|
62
|
+
* saying so) — the SDK's own `isTransientError`, kept here because this
|
|
63
|
+
* package switches the SDK's retries off and would otherwise fail a host
|
|
64
|
+
* whose clock drifts on its first request, where a stock client recovers on
|
|
65
|
+
* the next.
|
|
66
|
+
*
|
|
67
|
+
* Throws: nothing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function isCorrectedClockSkew(fields: AwsErrorFields): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The code a failure that is not one of this library's own belongs to.
|
|
72
|
+
*
|
|
73
|
+
* Accepts: anything a `catch` can bind — an SDK error, a transport error, a
|
|
74
|
+
* value from caller-supplied code, `null`, a string.
|
|
75
|
+
*
|
|
76
|
+
* Returns: a transaction cancellation's code from its reasons (a sole
|
|
77
|
+
* `ConditionalCheckFailed` cause is `CONDITION_CONFLICT`; all-transient causes
|
|
78
|
+
* are `THROTTLED` or `CONTENTION`); otherwise `SERVICE_UNAVAILABLE` for a
|
|
79
|
+
* signing failure the SDK corrected its clock for or reports expired
|
|
80
|
+
* ({@link isCorrectedClockSkew}); otherwise the table's code for the error's
|
|
81
|
+
* own `name`; otherwise `SERVICE_UNAVAILABLE` for a transient network `code`;
|
|
82
|
+
* otherwise by HTTP status — 412 `CONDITION_CONFLICT`, 429 `THROTTLED`,
|
|
83
|
+
* 500/502/503/504 `SERVICE_UNAVAILABLE`; otherwise `AWS_REQUEST_FAILED` for an
|
|
84
|
+
* AWS-shaped error and `UNEXPECTED_ERROR` for anything else. Only the error's
|
|
85
|
+
* own fields are read, never its `cause`.
|
|
86
|
+
*
|
|
87
|
+
* Throws: nothing, for any value. It runs inside `catch` blocks.
|
|
88
|
+
*/
|
|
89
|
+
export declare function classifyAwsError(error: Error): ErrorCode;
|
|
90
|
+
/**
|
|
91
|
+
* How far a walk down a cause chain goes before giving up: deep enough for
|
|
92
|
+
* any chain a real failure builds, and a bound in case a `cause` loops
|
|
93
|
+
* through objects a `Set` of seen nodes cannot pair. Shared by
|
|
94
|
+
* {@link classifiableCause} and the retry layer's own walk.
|
|
95
|
+
*/
|
|
96
|
+
export declare const MAX_CAUSE_DEPTH = 32;
|
|
97
|
+
/**
|
|
98
|
+
* The node in `error`'s own cause chain — `error` itself, then its `cause`,
|
|
99
|
+
* then that error's own `cause`, and so on — that {@link classifyAwsError}
|
|
100
|
+
* does not answer `UNEXPECTED_ERROR` for.
|
|
101
|
+
*
|
|
102
|
+
* Accepts: `error` — the outermost failure to classify, already normalised by
|
|
103
|
+
* `toError`.
|
|
104
|
+
*
|
|
105
|
+
* Returns: the first node the classifier places under an AWS or network code,
|
|
106
|
+
* so a caller's own error wrapping a modeled SDK exception, an SDK error whose
|
|
107
|
+
* own `cause` is a raw transport failure, or a `RETRY_EXHAUSTED` error wrapping
|
|
108
|
+
* either as its own `cause`, still classifies — and still yields diagnostics —
|
|
109
|
+
* on the AWS/network failure underneath rather than losing it one level up —
|
|
110
|
+
* the same failure the retry layer's cause-chain walk (`isRetryableError` in
|
|
111
|
+
* `shared/dynamodb/retry.ts`) already sees. `error` itself when nothing in its
|
|
112
|
+
* chain classifies either. The walk gives up after {@link MAX_CAUSE_DEPTH}
|
|
113
|
+
* nodes, and a cycle in the chain stops it rather than looping, exactly as
|
|
114
|
+
* that other walk does.
|
|
115
|
+
*
|
|
116
|
+
* Throws: nothing, for any value `toError` can produce.
|
|
117
|
+
*/
|
|
118
|
+
export declare function classifiableCause(error: Error): Error;
|
|
119
|
+
/**
|
|
120
|
+
* The fields an operator needs first, lifted off an AWS-shaped error.
|
|
121
|
+
*
|
|
122
|
+
* Accepts: anything a `catch` can bind.
|
|
123
|
+
*
|
|
124
|
+
* Returns: `awsErrorName`, `requestId` and `httpStatusCode`, each only when
|
|
125
|
+
* present and well-typed, for an error carrying `$metadata` or a name the table
|
|
126
|
+
* knows or that ends in `Exception`; `{}` for anything else — a bare network
|
|
127
|
+
* failure included, since it may be a caller's own connection rather than AWS's.
|
|
128
|
+
*
|
|
129
|
+
* Throws: nothing, for any value.
|
|
130
|
+
*/
|
|
131
|
+
export declare function awsDiagnostics(error: Error): Pick<ErrorContext, 'awsErrorName' | 'requestId' | 'httpStatusCode'>;
|
|
132
|
+
/**
|
|
133
|
+
* Whether a failed request ended on this side, before the service answered it.
|
|
134
|
+
*
|
|
135
|
+
* Accepts: anything a `catch` can bind, and `undefined`.
|
|
136
|
+
*
|
|
137
|
+
* Returns: true when the failure, or a cause beneath it, is a cut this side
|
|
138
|
+
* made — the SDK's own `TimeoutError` or `AbortError`, or a Node network error
|
|
139
|
+
* such as `ECONNRESET` or `ETIMEDOUT` — and no node on the way carries the HTTP
|
|
140
|
+
* status of a response. The service may still apply a request cut that way
|
|
141
|
+
* after the caller has stopped waiting for it. False for everything else: a
|
|
142
|
+
* failure the service answered, and one that says nothing about the transport,
|
|
143
|
+
* such as a value a caller's own code threw. A cycle in the chain ends the walk.
|
|
144
|
+
*
|
|
145
|
+
* Throws: nothing, for any value.
|
|
146
|
+
*/
|
|
147
|
+
export declare function endedWithoutAnswer(error: Error | undefined): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Whether one attempt's own failure leaves DynamoDB free to apply it later,
|
|
150
|
+
* judged from that attempt alone.
|
|
151
|
+
*
|
|
152
|
+
* Accepts: anything a `catch` can bind, and `undefined`.
|
|
153
|
+
*
|
|
154
|
+
* Returns: true when the attempt {@link endedWithoutAnswer}; when the service
|
|
155
|
+
* answered that its own earlier attempt under the same `ClientRequestToken`
|
|
156
|
+
* was still being processed (`TransactionInProgressException`); or when it
|
|
157
|
+
* answered with a server error, an HTTP 5xx. AWS says of a 500
|
|
158
|
+
* (`InternalServerError`) that the request "may have succeeded or failed", with
|
|
159
|
+
* no later point documented as settling it (DynamoDB Developer Guide, *Error
|
|
160
|
+
* handling*:
|
|
161
|
+
* https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html);
|
|
162
|
+
* this library treats every 5xx the same way. False for a refusal, a throttle,
|
|
163
|
+
* or any other definite answer.
|
|
164
|
+
*
|
|
165
|
+
* Throws: nothing, for any value.
|
|
166
|
+
*/
|
|
167
|
+
export declare function mayStillBeInFlight(error: Error | undefined): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the service refused a request outright, so that none of it was applied.
|
|
170
|
+
*
|
|
171
|
+
* Accepts: anything a `catch` can bind.
|
|
172
|
+
*
|
|
173
|
+
* Returns: true for a cancelled transaction — DynamoDB applies none of a
|
|
174
|
+
* transaction it cancels — and for a failure the classifier places under a
|
|
175
|
+
* refusal: a malformed request, a denied permission, a missing table or index,
|
|
176
|
+
* a failed condition. False for everything else, a spent retry budget and a
|
|
177
|
+
* cancel included, since neither says what the service did.
|
|
178
|
+
*
|
|
179
|
+
* Throws: nothing, for any value.
|
|
180
|
+
*/
|
|
181
|
+
export declare function refusedByService(error: Error): boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Whether an S3 read failed because the object is gone.
|
|
184
|
+
*
|
|
185
|
+
* Accepts: anything a `catch` can bind.
|
|
186
|
+
*
|
|
187
|
+
* Returns: true for `NoSuchKey` only. `NOT_FOUND` also covers a missing
|
|
188
|
+
* bucket, which is a configuration fault; reading it as a lost payload would
|
|
189
|
+
* write off data that is still there.
|
|
190
|
+
*
|
|
191
|
+
* Throws: nothing, for any value.
|
|
192
|
+
*/
|
|
193
|
+
export declare function isMissingObject(error: Error): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Whether reading a bucket's lifecycle configuration failed because the bucket
|
|
196
|
+
* has none.
|
|
197
|
+
*
|
|
198
|
+
* Accepts: anything a `catch` can bind.
|
|
199
|
+
*
|
|
200
|
+
* Returns: true for `NoSuchLifecycleConfiguration` only. `NOT_FOUND` also
|
|
201
|
+
* covers a missing bucket, table or object; reading one of those as "no rules
|
|
202
|
+
* yet" would start a rule set for a bucket that is not there.
|
|
203
|
+
*
|
|
204
|
+
* Throws: nothing, for any value.
|
|
205
|
+
*/
|
|
206
|
+
export declare function isMissingLifecycleConfiguration(error: Error): boolean;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_CAUSE_DEPTH = exports.DEFAULT_RETRYABLE_ERRORS = exports.AWS_ERROR_CODES = exports.TRANSIENT_HTTP_STATUSES = exports.TRANSIENT_NETWORK_ERROR_CODES = void 0;
|
|
4
|
+
exports.isCorrectedClockSkew = isCorrectedClockSkew;
|
|
5
|
+
exports.classifyAwsError = classifyAwsError;
|
|
6
|
+
exports.classifiableCause = classifiableCause;
|
|
7
|
+
exports.awsDiagnostics = awsDiagnostics;
|
|
8
|
+
exports.endedWithoutAnswer = endedWithoutAnswer;
|
|
9
|
+
exports.mayStillBeInFlight = mayStillBeInFlight;
|
|
10
|
+
exports.refusedByService = refusedByService;
|
|
11
|
+
exports.isMissingObject = isMissingObject;
|
|
12
|
+
exports.isMissingLifecycleConfiguration = isMissingLifecycleConfiguration;
|
|
13
|
+
const cancellation_js_1 = require("../dynamodb/cancellation.js");
|
|
14
|
+
const error_code_js_1 = require("./error-code.js");
|
|
15
|
+
exports.TRANSIENT_NETWORK_ERROR_CODES = [
|
|
16
|
+
'ECONNRESET',
|
|
17
|
+
'ECONNREFUSED',
|
|
18
|
+
'EPIPE',
|
|
19
|
+
'ETIMEDOUT',
|
|
20
|
+
'EHOSTUNREACH',
|
|
21
|
+
'ENETUNREACH',
|
|
22
|
+
'ENOTFOUND',
|
|
23
|
+
'EAI_AGAIN',
|
|
24
|
+
];
|
|
25
|
+
exports.TRANSIENT_HTTP_STATUSES = [429, 500, 502, 503, 504];
|
|
26
|
+
const PRECONDITION_FAILED_STATUS = 412;
|
|
27
|
+
const TRANSACTION_CANCELLED = 'TransactionCanceledException';
|
|
28
|
+
exports.AWS_ERROR_CODES = {
|
|
29
|
+
ProvisionedThroughputExceededException: error_code_js_1.ErrorCode.THROTTLED,
|
|
30
|
+
ThrottlingException: error_code_js_1.ErrorCode.THROTTLED,
|
|
31
|
+
RequestLimitExceeded: error_code_js_1.ErrorCode.THROTTLED,
|
|
32
|
+
SlowDown: error_code_js_1.ErrorCode.THROTTLED,
|
|
33
|
+
InternalServerError: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
34
|
+
InternalFailure: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
35
|
+
ServiceUnavailable: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
36
|
+
InternalError: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
37
|
+
RequestTimeout: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
38
|
+
RequestTimeoutException: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
39
|
+
TimeoutError: error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
40
|
+
TransactionConflictException: error_code_js_1.ErrorCode.CONTENTION,
|
|
41
|
+
TransactionInProgressException: error_code_js_1.ErrorCode.CONTENTION,
|
|
42
|
+
ReplicatedWriteConflictException: error_code_js_1.ErrorCode.CONTENTION,
|
|
43
|
+
ConditionalRequestConflict: error_code_js_1.ErrorCode.CONTENTION,
|
|
44
|
+
AccessDeniedException: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
45
|
+
AccessDenied: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
46
|
+
ExpiredTokenException: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
47
|
+
ExpiredToken: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
48
|
+
IncompleteSignature: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
49
|
+
IncompleteSignatureException: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
50
|
+
InvalidAccessKeyId: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
51
|
+
InvalidSignatureException: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
52
|
+
MissingAuthenticationTokenException: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
53
|
+
NotAuthorized: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
54
|
+
RequestTimeTooSkewed: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
55
|
+
SignatureDoesNotMatch: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
56
|
+
UnrecognizedClientException: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
57
|
+
CredentialsProviderError: error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
58
|
+
ResourceNotFoundException: error_code_js_1.ErrorCode.NOT_FOUND,
|
|
59
|
+
NoSuchBucket: error_code_js_1.ErrorCode.NOT_FOUND,
|
|
60
|
+
NoSuchKey: error_code_js_1.ErrorCode.NOT_FOUND,
|
|
61
|
+
NoSuchLifecycleConfiguration: error_code_js_1.ErrorCode.NOT_FOUND,
|
|
62
|
+
ValidationException: error_code_js_1.ErrorCode.AWS_REJECTED,
|
|
63
|
+
ValidationError: error_code_js_1.ErrorCode.AWS_REJECTED,
|
|
64
|
+
IdempotentParameterMismatchException: error_code_js_1.ErrorCode.AWS_REJECTED,
|
|
65
|
+
MalformedHttpRequestException: error_code_js_1.ErrorCode.AWS_REJECTED,
|
|
66
|
+
RequestEntityTooLargeException: error_code_js_1.ErrorCode.AWS_REJECTED,
|
|
67
|
+
ConditionalCheckFailedException: error_code_js_1.ErrorCode.CONDITION_CONFLICT,
|
|
68
|
+
PreconditionFailed: error_code_js_1.ErrorCode.CONDITION_CONFLICT,
|
|
69
|
+
ItemCollectionSizeLimitExceededException: error_code_js_1.ErrorCode.AWS_REQUEST_FAILED,
|
|
70
|
+
InvalidEndpointException: error_code_js_1.ErrorCode.AWS_REQUEST_FAILED,
|
|
71
|
+
TransactionCanceledException: error_code_js_1.ErrorCode.AWS_REQUEST_FAILED,
|
|
72
|
+
AbortError: error_code_js_1.ErrorCode.ABORTED,
|
|
73
|
+
};
|
|
74
|
+
const RETRYABLE_CODES = [
|
|
75
|
+
error_code_js_1.ErrorCode.THROTTLED,
|
|
76
|
+
error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE,
|
|
77
|
+
error_code_js_1.ErrorCode.CONTENTION,
|
|
78
|
+
];
|
|
79
|
+
exports.DEFAULT_RETRYABLE_ERRORS = [
|
|
80
|
+
...Object.entries(exports.AWS_ERROR_CODES)
|
|
81
|
+
.filter(([, code]) => RETRYABLE_CODES.includes(code))
|
|
82
|
+
.map(([name]) => name),
|
|
83
|
+
...exports.TRANSIENT_NETWORK_ERROR_CODES,
|
|
84
|
+
];
|
|
85
|
+
function declaredCodeOf(name) {
|
|
86
|
+
return typeof name === 'string' && Object.hasOwn(exports.AWS_ERROR_CODES, name)
|
|
87
|
+
? exports.AWS_ERROR_CODES[name]
|
|
88
|
+
: undefined;
|
|
89
|
+
}
|
|
90
|
+
function isCorrectedClockSkew(fields) {
|
|
91
|
+
if (fields.$metadata?.clockSkewCorrected === true)
|
|
92
|
+
return true;
|
|
93
|
+
return (fields.name === 'InvalidSignatureException' &&
|
|
94
|
+
typeof fields.message === 'string' &&
|
|
95
|
+
fields.message.includes('Signature expired'));
|
|
96
|
+
}
|
|
97
|
+
function statusOf(fields) {
|
|
98
|
+
const metadata = fields.$metadata;
|
|
99
|
+
return typeof metadata === 'object' &&
|
|
100
|
+
metadata !== null &&
|
|
101
|
+
typeof metadata.httpStatusCode === 'number'
|
|
102
|
+
? metadata.httpStatusCode
|
|
103
|
+
: undefined;
|
|
104
|
+
}
|
|
105
|
+
function isAwsShaped(fields) {
|
|
106
|
+
if (typeof fields.$metadata === 'object' && fields.$metadata !== null)
|
|
107
|
+
return true;
|
|
108
|
+
const { name } = fields;
|
|
109
|
+
return (typeof name === 'string' && (declaredCodeOf(name) !== undefined || name.endsWith('Exception')));
|
|
110
|
+
}
|
|
111
|
+
function cancellationCode(error) {
|
|
112
|
+
if ((0, cancellation_js_1.conditionalCheckFailure)(error) !== undefined)
|
|
113
|
+
return error_code_js_1.ErrorCode.CONDITION_CONFLICT;
|
|
114
|
+
if ((0, cancellation_js_1.transientCancellation)(error) === true) {
|
|
115
|
+
return (0, cancellation_js_1.throttledCancellation)(error) ? error_code_js_1.ErrorCode.THROTTLED : error_code_js_1.ErrorCode.CONTENTION;
|
|
116
|
+
}
|
|
117
|
+
return exports.AWS_ERROR_CODES[TRANSACTION_CANCELLED];
|
|
118
|
+
}
|
|
119
|
+
function classifyAwsError(error) {
|
|
120
|
+
if (typeof error !== 'object' || error === null)
|
|
121
|
+
return error_code_js_1.ErrorCode.UNEXPECTED_ERROR;
|
|
122
|
+
const fields = error;
|
|
123
|
+
if (fields.name === TRANSACTION_CANCELLED)
|
|
124
|
+
return cancellationCode(error);
|
|
125
|
+
if (isCorrectedClockSkew(fields))
|
|
126
|
+
return error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE;
|
|
127
|
+
const declared = declaredCodeOf(fields.name);
|
|
128
|
+
if (declared !== undefined)
|
|
129
|
+
return declared;
|
|
130
|
+
if (typeof fields.code === 'string' && exports.TRANSIENT_NETWORK_ERROR_CODES.includes(fields.code)) {
|
|
131
|
+
return error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE;
|
|
132
|
+
}
|
|
133
|
+
const status = statusOf(fields);
|
|
134
|
+
if (status === PRECONDITION_FAILED_STATUS)
|
|
135
|
+
return error_code_js_1.ErrorCode.CONDITION_CONFLICT;
|
|
136
|
+
if (status === 429)
|
|
137
|
+
return error_code_js_1.ErrorCode.THROTTLED;
|
|
138
|
+
if (status !== undefined && exports.TRANSIENT_HTTP_STATUSES.includes(status)) {
|
|
139
|
+
return error_code_js_1.ErrorCode.SERVICE_UNAVAILABLE;
|
|
140
|
+
}
|
|
141
|
+
return isAwsShaped(fields) ? error_code_js_1.ErrorCode.AWS_REQUEST_FAILED : error_code_js_1.ErrorCode.UNEXPECTED_ERROR;
|
|
142
|
+
}
|
|
143
|
+
exports.MAX_CAUSE_DEPTH = 32;
|
|
144
|
+
function classifiableCause(error) {
|
|
145
|
+
const seen = new WeakSet();
|
|
146
|
+
let node = error;
|
|
147
|
+
for (let depth = 0; depth <= exports.MAX_CAUSE_DEPTH; depth += 1) {
|
|
148
|
+
if (classifyAwsError(node) !== error_code_js_1.ErrorCode.UNEXPECTED_ERROR)
|
|
149
|
+
return node;
|
|
150
|
+
if (typeof node !== 'object' || node === null || seen.has(node))
|
|
151
|
+
break;
|
|
152
|
+
seen.add(node);
|
|
153
|
+
const next = node.cause;
|
|
154
|
+
if (next === undefined)
|
|
155
|
+
break;
|
|
156
|
+
node = next;
|
|
157
|
+
}
|
|
158
|
+
return error;
|
|
159
|
+
}
|
|
160
|
+
function awsDiagnostics(error) {
|
|
161
|
+
if (typeof error !== 'object' || error === null)
|
|
162
|
+
return {};
|
|
163
|
+
const fields = error;
|
|
164
|
+
if (!isAwsShaped(fields))
|
|
165
|
+
return {};
|
|
166
|
+
const out = {};
|
|
167
|
+
if (typeof fields.name === 'string')
|
|
168
|
+
out.awsErrorName = fields.name;
|
|
169
|
+
const status = statusOf(fields);
|
|
170
|
+
if (status !== undefined)
|
|
171
|
+
out.httpStatusCode = status;
|
|
172
|
+
const requestId = fields.$metadata?.requestId;
|
|
173
|
+
if (typeof requestId === 'string')
|
|
174
|
+
out.requestId = requestId;
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
const CLIENT_SIDE_CUTS = ['TimeoutError', 'AbortError'];
|
|
178
|
+
const MAX_ANSWER_DEPTH = 8;
|
|
179
|
+
function endedWithoutAnswer(error) {
|
|
180
|
+
const seen = new WeakSet();
|
|
181
|
+
let node = error;
|
|
182
|
+
for (let depth = 0; depth < MAX_ANSWER_DEPTH; depth += 1) {
|
|
183
|
+
if (typeof node !== 'object' || node === null || seen.has(node))
|
|
184
|
+
return false;
|
|
185
|
+
seen.add(node);
|
|
186
|
+
const fields = node;
|
|
187
|
+
if (statusOf(fields) !== undefined)
|
|
188
|
+
return false;
|
|
189
|
+
if (typeof fields.name === 'string' && CLIENT_SIDE_CUTS.includes(fields.name))
|
|
190
|
+
return true;
|
|
191
|
+
if (typeof fields.code === 'string' && exports.TRANSIENT_NETWORK_ERROR_CODES.includes(fields.code)) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
node = node.cause;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
const TRANSACTION_IN_PROGRESS = 'TransactionInProgressException';
|
|
199
|
+
const SERVER_ERROR_STATUS_MIN = 500;
|
|
200
|
+
const SERVER_ERROR_STATUS_MAX = 599;
|
|
201
|
+
function mayStillBeInFlight(error) {
|
|
202
|
+
if (endedWithoutAnswer(error))
|
|
203
|
+
return true;
|
|
204
|
+
if (typeof error !== 'object' || error === null)
|
|
205
|
+
return false;
|
|
206
|
+
const fields = error;
|
|
207
|
+
if (fields.name === TRANSACTION_IN_PROGRESS)
|
|
208
|
+
return true;
|
|
209
|
+
const status = statusOf(fields);
|
|
210
|
+
return (status !== undefined && status >= SERVER_ERROR_STATUS_MIN && status <= SERVER_ERROR_STATUS_MAX);
|
|
211
|
+
}
|
|
212
|
+
const REFUSED = [
|
|
213
|
+
error_code_js_1.ErrorCode.AWS_REJECTED,
|
|
214
|
+
error_code_js_1.ErrorCode.ACCESS_DENIED,
|
|
215
|
+
error_code_js_1.ErrorCode.NOT_FOUND,
|
|
216
|
+
error_code_js_1.ErrorCode.CONDITION_CONFLICT,
|
|
217
|
+
];
|
|
218
|
+
function refusedByService(error) {
|
|
219
|
+
if (typeof error !== 'object' || error === null)
|
|
220
|
+
return false;
|
|
221
|
+
if (error.name === TRANSACTION_CANCELLED)
|
|
222
|
+
return true;
|
|
223
|
+
return REFUSED.includes(classifyAwsError(error));
|
|
224
|
+
}
|
|
225
|
+
function isMissingObject(error) {
|
|
226
|
+
return (typeof error === 'object' && error !== null && error.name === 'NoSuchKey');
|
|
227
|
+
}
|
|
228
|
+
function isMissingLifecycleConfiguration(error) {
|
|
229
|
+
return (typeof error === 'object' &&
|
|
230
|
+
error !== null &&
|
|
231
|
+
error.name === 'NoSuchLifecycleConfiguration');
|
|
232
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides which outcomes a caller can tell apart.
|
|
3
|
+
*
|
|
4
|
+
* Every error this library raises carries one of these codes, and a caller
|
|
5
|
+
* branches on the code rather than on a class, a message or an AWS name. What
|
|
6
|
+
* produces each code is decided elsewhere, so a newly seen AWS failure maps
|
|
7
|
+
* onto an existing code without touching this list, and the list is frozen so
|
|
8
|
+
* no consumer sharing it in a process can change what a comparison means.
|
|
9
|
+
*/
|
|
10
|
+
/** Stable, branchable classification for every error this library throws. */
|
|
11
|
+
export declare enum ErrorCode {
|
|
12
|
+
VALIDATION = "VALIDATION",
|
|
13
|
+
/** A row or payload written in a format version newer than this package reads. */
|
|
14
|
+
FORMAT_UNSUPPORTED = "FORMAT_UNSUPPORTED",
|
|
15
|
+
/**
|
|
16
|
+
* A checkpoint a delta channel still needs cannot be read — it has expired,
|
|
17
|
+
* the sweep has since removed it, or the chain of parents loops back on
|
|
18
|
+
* itself — so the channel cannot be reconstructed and the read refuses
|
|
19
|
+
* rather than returning a shorter value.
|
|
20
|
+
*/
|
|
21
|
+
ANCESTOR_EXPIRED = "ANCESTOR_EXPIRED",
|
|
22
|
+
CONDITION_CONFLICT = "CONDITION_CONFLICT",
|
|
23
|
+
RETRY_EXHAUSTED = "RETRY_EXHAUSTED",
|
|
24
|
+
BATCH_WRITE_INCOMPLETE = "BATCH_WRITE_INCOMPLETE",
|
|
25
|
+
COMPRESSION_LIMIT = "COMPRESSION_LIMIT",
|
|
26
|
+
/**
|
|
27
|
+
* A stored payload's bytes do not match the form its row declares: the row
|
|
28
|
+
* says gzip and they are not, or they are not the serializer's output. The
|
|
29
|
+
* payload can never be read, so it is reported rather than retried.
|
|
30
|
+
*/
|
|
31
|
+
PAYLOAD_CORRUPT = "PAYLOAD_CORRUPT",
|
|
32
|
+
S3_OFFLOAD_FAILED = "S3_OFFLOAD_FAILED",
|
|
33
|
+
RESULT_TRUNCATED = "RESULT_TRUNCATED",
|
|
34
|
+
ABORTED = "ABORTED",
|
|
35
|
+
COMPENSATION_FAILED = "COMPENSATION_FAILED",
|
|
36
|
+
/**
|
|
37
|
+
* AWS throttled the request: `ProvisionedThroughputExceededException`,
|
|
38
|
+
* `ThrottlingException`, `RequestLimitExceeded`, S3's `SlowDown`, an HTTP
|
|
39
|
+
* 429, or a cancelled transaction whose causes are all transient and include
|
|
40
|
+
* a throttling reason. Back off, or raise the table's capacity or the account
|
|
41
|
+
* quota.
|
|
42
|
+
*/
|
|
43
|
+
THROTTLED = "THROTTLED",
|
|
44
|
+
/**
|
|
45
|
+
* AWS or the network failed transiently: `InternalServerError`,
|
|
46
|
+
* `InternalFailure`, `ServiceUnavailable`, S3's `InternalError`, a request
|
|
47
|
+
* timeout (`RequestTimeout`, `RequestTimeoutException`, the SDK's
|
|
48
|
+
* `TimeoutError`), an HTTP 500/502/503/504, a reset, refused or unreachable
|
|
49
|
+
* connection, or a signing failure the SDK corrected its clock for or
|
|
50
|
+
* reports as expired. Retry after a backoff. A write that failed this way
|
|
51
|
+
* may still have been applied.
|
|
52
|
+
*/
|
|
53
|
+
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
54
|
+
/**
|
|
55
|
+
* Another request was writing the same item or object at the same moment:
|
|
56
|
+
* `TransactionConflictException`, `TransactionInProgressException`,
|
|
57
|
+
* `ReplicatedWriteConflictException`, S3's `ConditionalRequestConflict`, or a
|
|
58
|
+
* cancelled transaction whose only transient cause is a conflict. Retry; more
|
|
59
|
+
* capacity would not help. `ensureS3LifecycleRule()` raises it when every one
|
|
60
|
+
* of its five rounds needs a write.
|
|
61
|
+
*/
|
|
62
|
+
CONTENTION = "CONTENTION",
|
|
63
|
+
/**
|
|
64
|
+
* AWS refused the caller's identity or permissions: `AccessDeniedException`,
|
|
65
|
+
* S3's `AccessDenied`, an expired, unrecognised or malformed credential or
|
|
66
|
+
* signature — or the SDK's credential chain found no credentials to sign
|
|
67
|
+
* with (`CredentialsProviderError`). Fix the credentials or the IAM policy;
|
|
68
|
+
* do not retry. `context.awsErrorName` says which.
|
|
69
|
+
*/
|
|
70
|
+
ACCESS_DENIED = "ACCESS_DENIED",
|
|
71
|
+
/**
|
|
72
|
+
* The table or the bucket is not there: `ResourceNotFoundException`, or S3's
|
|
73
|
+
* `NoSuchBucket` from the lifecycle calls. A missing index is `AWS_REJECTED`
|
|
74
|
+
* — DynamoDB refuses a query naming one with a `ValidationException` — and a
|
|
75
|
+
* missing S3 object on a transfer is `S3_OFFLOAD_FAILED`. Not an absent item:
|
|
76
|
+
* a read of a key that holds nothing returns nothing.
|
|
77
|
+
*/
|
|
78
|
+
NOT_FOUND = "NOT_FOUND",
|
|
79
|
+
/**
|
|
80
|
+
* AWS rejected the request as malformed: `ValidationException`,
|
|
81
|
+
* AWS's `ValidationError` common error, `IdempotentParameterMismatchException`,
|
|
82
|
+
* or a request body it could not read or accept. Retrying the same request
|
|
83
|
+
* fails the same way.
|
|
84
|
+
*/
|
|
85
|
+
AWS_REJECTED = "AWS_REJECTED",
|
|
86
|
+
/** An AWS request failed and no narrower code applies; `context.awsErrorName` names it. */
|
|
87
|
+
AWS_REQUEST_FAILED = "AWS_REQUEST_FAILED",
|
|
88
|
+
/**
|
|
89
|
+
* A failure that came neither from this package's own checks nor from AWS:
|
|
90
|
+
* a `VectorBackend`, an `Embeddings` model, a `serde` or a `MultiSessionHistory`
|
|
91
|
+
* threw something of its own, or this package has a bug. The original is
|
|
92
|
+
* `cause`.
|
|
93
|
+
*/
|
|
94
|
+
UNEXPECTED_ERROR = "UNEXPECTED_ERROR"
|
|
95
|
+
}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ErrorCode = void 0;
|
|
4
|
-
/** Stable, branchable classification for every error this library throws. */
|
|
5
4
|
var ErrorCode;
|
|
6
5
|
(function (ErrorCode) {
|
|
7
6
|
ErrorCode["VALIDATION"] = "VALIDATION";
|
|
7
|
+
ErrorCode["FORMAT_UNSUPPORTED"] = "FORMAT_UNSUPPORTED";
|
|
8
|
+
ErrorCode["ANCESTOR_EXPIRED"] = "ANCESTOR_EXPIRED";
|
|
8
9
|
ErrorCode["CONDITION_CONFLICT"] = "CONDITION_CONFLICT";
|
|
9
10
|
ErrorCode["RETRY_EXHAUSTED"] = "RETRY_EXHAUSTED";
|
|
10
11
|
ErrorCode["BATCH_WRITE_INCOMPLETE"] = "BATCH_WRITE_INCOMPLETE";
|
|
11
12
|
ErrorCode["COMPRESSION_LIMIT"] = "COMPRESSION_LIMIT";
|
|
13
|
+
ErrorCode["PAYLOAD_CORRUPT"] = "PAYLOAD_CORRUPT";
|
|
12
14
|
ErrorCode["S3_OFFLOAD_FAILED"] = "S3_OFFLOAD_FAILED";
|
|
13
15
|
ErrorCode["RESULT_TRUNCATED"] = "RESULT_TRUNCATED";
|
|
14
16
|
ErrorCode["ABORTED"] = "ABORTED";
|
|
15
17
|
ErrorCode["COMPENSATION_FAILED"] = "COMPENSATION_FAILED";
|
|
16
|
-
ErrorCode["
|
|
18
|
+
ErrorCode["THROTTLED"] = "THROTTLED";
|
|
19
|
+
ErrorCode["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
|
|
20
|
+
ErrorCode["CONTENTION"] = "CONTENTION";
|
|
21
|
+
ErrorCode["ACCESS_DENIED"] = "ACCESS_DENIED";
|
|
22
|
+
ErrorCode["NOT_FOUND"] = "NOT_FOUND";
|
|
23
|
+
ErrorCode["AWS_REJECTED"] = "AWS_REJECTED";
|
|
24
|
+
ErrorCode["AWS_REQUEST_FAILED"] = "AWS_REQUEST_FAILED";
|
|
25
|
+
ErrorCode["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
|
|
17
26
|
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
27
|
+
Object.freeze(ErrorCode);
|