@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
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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");
|
|
5
|
-
const base_error_1 = require("./base-error");
|
|
6
|
-
const error_code_1 = require("./error-code");
|
|
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);
|
|
11
|
-
this.name = 'ValidationError';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ValidationError = ValidationError;
|
|
15
|
-
/** A conditional write failed because the precondition no longer holds. */
|
|
16
|
-
class ConflictError extends base_error_1.DynamoDBLangGraphError {
|
|
17
|
-
constructor(message, cause) {
|
|
18
|
-
super(message, error_code_1.ErrorCode.CONDITION_CONFLICT, {}, cause);
|
|
19
|
-
this.name = 'ConflictError';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.ConflictError = ConflictError;
|
|
23
|
-
/** A retried operation exhausted its attempt budget. */
|
|
24
|
-
class RetryExhaustedError extends base_error_1.DynamoDBLangGraphError {
|
|
25
|
-
constructor(message, attempts, cause) {
|
|
26
|
-
super(message, error_code_1.ErrorCode.RETRY_EXHAUSTED, attempts === undefined ? {} : { attempts }, cause);
|
|
27
|
-
this.name = 'RetryExhaustedError';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.RetryExhaustedError = RetryExhaustedError;
|
|
31
|
-
/**
|
|
32
|
-
* A paginated read hit its runaway guard (item or iteration cap) while more
|
|
33
|
-
* data remained, so the result would have been silently truncated. Narrow the
|
|
34
|
-
* query (filter/prefix) or raise the cap rather than trusting a partial result.
|
|
35
|
-
* `context.field` names the cap that was hit.
|
|
36
|
-
*/
|
|
37
|
-
class ResultTruncatedError extends base_error_1.DynamoDBLangGraphError {
|
|
38
|
-
constructor(cap, limit) {
|
|
39
|
-
super(`paginated read truncated at the ${cap} cap (${limit}) with more data remaining`, error_code_1.ErrorCode.RESULT_TRUNCATED, { field: cap });
|
|
40
|
-
this.name = 'ResultTruncatedError';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.ResultTruncatedError = ResultTruncatedError;
|
|
44
|
-
/** An operation was cancelled via its AbortSignal. */
|
|
45
|
-
class AbortError extends base_error_1.DynamoDBLangGraphError {
|
|
46
|
-
constructor(message = 'Operation aborted', cause) {
|
|
47
|
-
super(message, error_code_1.ErrorCode.ABORTED, {}, cause);
|
|
48
|
-
this.name = 'AbortError';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.AbortError = AbortError;
|
|
52
|
-
/**
|
|
53
|
-
* A BatchWriteItem sequence could not drain its UnprocessedItems. Items NOT
|
|
54
|
-
* listed in {@link unprocessed} were acked by DynamoDB and persist — there is
|
|
55
|
-
* no rollback (drive reconciliation from `unprocessed`). `cause`, when given,
|
|
56
|
-
* is the underlying failure that interrupted the drain (e.g. a thrown,
|
|
57
|
-
* non-UnprocessedItems error from a retry round) rather than a clean exhaustion
|
|
58
|
-
* of the UnprocessedItems retry budget.
|
|
59
|
-
*/
|
|
60
|
-
class BatchWriteIncompleteError extends base_error_1.DynamoDBLangGraphError {
|
|
61
|
-
succeededCount;
|
|
62
|
-
unprocessed;
|
|
63
|
-
constructor(succeededCount, unprocessed, retries, cause) {
|
|
64
|
-
super(`batchWrite did not drain after ${retries} UnprocessedItems retries: ` +
|
|
65
|
-
`${succeededCount} item(s) persisted, ${unprocessed.length} still un-acked.`, error_code_1.ErrorCode.BATCH_WRITE_INCOMPLETE, {}, cause);
|
|
66
|
-
this.name = 'BatchWriteIncompleteError';
|
|
67
|
-
this.succeededCount = succeededCount;
|
|
68
|
-
this.unprocessed = unprocessed;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.BatchWriteIncompleteError = BatchWriteIncompleteError;
|
|
72
|
-
/**
|
|
73
|
-
* batchWriteAll attempts every chunk rather than stopping at the first
|
|
74
|
-
* failure — a mid-sequence chunk failing does not abandon the chunks after
|
|
75
|
-
* it. `failedChunks` holds each failing chunk's own error (commonly a
|
|
76
|
-
* {@link BatchWriteIncompleteError}); every chunk not represented there
|
|
77
|
-
* drained successfully and its writes persist — there is no rollback.
|
|
78
|
-
* `succeededCount` is the exact number of individual write requests
|
|
79
|
-
* confirmed persisted across every chunk (full chunks plus any failed
|
|
80
|
-
* chunk's own partial drain), more precise than `succeededChunks` alone
|
|
81
|
-
* when a chunk partially drains before exhausting its retries.
|
|
82
|
-
*/
|
|
83
|
-
class BatchWriteAllIncompleteError extends base_error_1.DynamoDBLangGraphError {
|
|
84
|
-
succeededChunks;
|
|
85
|
-
totalChunks;
|
|
86
|
-
failedChunks;
|
|
87
|
-
succeededCount;
|
|
88
|
-
constructor(succeededChunks, totalChunks, failedChunks, succeededCount = 0) {
|
|
89
|
-
super(`batchWriteAll did not fully drain: ${succeededChunks}/${totalChunks} chunk(s) succeeded, ` +
|
|
90
|
-
`${failedChunks.length} chunk(s) failed. ${succeededCount} write(s) persisted before the failure.`, error_code_1.ErrorCode.BATCH_WRITE_INCOMPLETE, {}, failedChunks[0]);
|
|
91
|
-
this.name = 'BatchWriteAllIncompleteError';
|
|
92
|
-
this.succeededChunks = succeededChunks;
|
|
93
|
-
this.totalChunks = totalChunks;
|
|
94
|
-
this.failedChunks = failedChunks;
|
|
95
|
-
this.succeededCount = succeededCount;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.BatchWriteAllIncompleteError = BatchWriteAllIncompleteError;
|
|
99
|
-
/**
|
|
100
|
-
* A compensating rollback failed after an append-saga chunk error, so the
|
|
101
|
-
* trigger error could not be cleanly undone. Carries the original trigger as
|
|
102
|
-
* `cause` and the rollback failure as {@link rollbackError}; the session's
|
|
103
|
-
* `messageCount` may have drifted — repair it with `reconcileMessageCount`.
|
|
104
|
-
*/
|
|
105
|
-
class CompensationFailedError extends base_error_1.DynamoDBLangGraphError {
|
|
106
|
-
rollbackError;
|
|
107
|
-
constructor(cause, rollbackError) {
|
|
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);
|
|
110
|
-
this.name = 'CompensationFailedError';
|
|
111
|
-
this.rollbackError = rollbackError;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.CompensationFailedError = CompensationFailedError;
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize a caught value (TypeScript types catch clauses as the implicit
|
|
3
|
-
* unknown) into an `Error`. Error-shaped values pass through; anything else is
|
|
4
|
-
* stringified into a fresh `Error`. This is the boundary where caught values
|
|
5
|
-
* are narrowed — callers do `toError(error as Error)`.
|
|
6
|
-
*/
|
|
7
|
-
export declare function toError(value: Error): Error;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toError = toError;
|
|
4
|
-
/**
|
|
5
|
-
* Normalize a caught value (TypeScript types catch clauses as the implicit
|
|
6
|
-
* unknown) into an `Error`. Error-shaped values pass through; anything else is
|
|
7
|
-
* stringified into a fresh `Error`. This is the boundary where caught values
|
|
8
|
-
* are narrowed — callers do `toError(error as Error)`.
|
|
9
|
-
*/
|
|
10
|
-
function toError(value) {
|
|
11
|
-
if (value !== null && typeof value === 'object' && typeof value.message === 'string') {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
return new Error(typeof value === 'string' ? value : JSON.stringify(value));
|
|
15
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** A value safe to pass as a structured log argument. */
|
|
2
|
-
export type LogArgument = string | number | boolean | null | object;
|
|
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
|
-
*/
|
|
9
|
-
export interface Logger {
|
|
10
|
-
info(message: string, ...args: LogArgument[]): void;
|
|
11
|
-
warn(message: string, ...args: LogArgument[]): void;
|
|
12
|
-
error(message: string, ...args: LogArgument[]): void;
|
|
13
|
-
debug(message: string, ...args: LogArgument[]): void;
|
|
14
|
-
}
|
|
15
|
-
/** Default logger: discards everything. Inject a real logger to enable output. */
|
|
16
|
-
export declare const SILENT_LOGGER: Logger;
|
|
17
|
-
/** Return the injected logger, or {@link SILENT_LOGGER} when none is given. */
|
|
18
|
-
export declare function resolveLogger(logger?: Logger): Logger;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SILENT_LOGGER = void 0;
|
|
4
|
-
exports.resolveLogger = resolveLogger;
|
|
5
|
-
/** Default logger: discards everything. Inject a real logger to enable output. */
|
|
6
|
-
exports.SILENT_LOGGER = {
|
|
7
|
-
info() { },
|
|
8
|
-
warn() { },
|
|
9
|
-
error() { },
|
|
10
|
-
debug() { },
|
|
11
|
-
};
|
|
12
|
-
/** Return the injected logger, or {@link SILENT_LOGGER} when none is given. */
|
|
13
|
-
function resolveLogger(logger) {
|
|
14
|
-
return logger ?? exports.SILENT_LOGGER;
|
|
15
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** A value that {@link redactSecrets} can recurse through. */
|
|
2
|
-
export type Redactable = string | number | boolean | null | undefined | Redactable[] | {
|
|
3
|
-
[key: string]: Redactable;
|
|
4
|
-
};
|
|
5
|
-
/** Any `Redactable` that is a non-null object — what the walk dispatches on. */
|
|
6
|
-
export type RedactableObject = Redactable[] | {
|
|
7
|
-
[key: string]: Redactable;
|
|
8
|
-
};
|
|
9
|
-
/** One step of the recursive walk, threaded into the entry helpers. */
|
|
10
|
-
type Walk = (value: Redactable) => Redactable;
|
|
11
|
-
/** Collaborators threaded through the recursive walk. */
|
|
12
|
-
export interface WalkDeps {
|
|
13
|
-
keyPatterns: readonly string[];
|
|
14
|
-
valuePatterns: readonly RegExp[];
|
|
15
|
-
walk: Walk;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Dispatch one non-null object by its shape: arrays and plain objects recurse,
|
|
19
|
-
* binary views collapse to a label, `Date`/`RegExp` pass through by reference,
|
|
20
|
-
* `Set`/`Map` render as their contents, and an Error takes the path above.
|
|
21
|
-
*/
|
|
22
|
-
export declare function walkObject(current: RedactableObject, deps: WalkDeps): Redactable;
|
|
23
|
-
export {};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.walkObject = walkObject;
|
|
4
|
-
const secret_patterns_1 = require("./secret-patterns");
|
|
5
|
-
/** True when `value` is a Set, tested by tag so a cross-realm Set still matches. */
|
|
6
|
-
function isSetValue(value) {
|
|
7
|
-
return Object.prototype.toString.call(value) === '[object Set]';
|
|
8
|
-
}
|
|
9
|
-
/** True when `value` is a Map, tested by tag so a cross-realm Map still matches. */
|
|
10
|
-
function isMapValue(value) {
|
|
11
|
-
return Object.prototype.toString.call(value) === '[object Map]';
|
|
12
|
-
}
|
|
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
|
-
*/
|
|
18
|
-
function isErrorValue(value) {
|
|
19
|
-
const tag = Object.prototype.toString.call(value);
|
|
20
|
-
return tag === '[object Error]' || tag === '[object DOMException]';
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* True for a value whose identity matters more than its own properties.
|
|
24
|
-
* `Date` and `RegExp` have none, so recursing either would yield a bare `{}`.
|
|
25
|
-
*/
|
|
26
|
-
function isOpaqueValue(value) {
|
|
27
|
-
const tag = Object.prototype.toString.call(value);
|
|
28
|
-
return tag === '[object Date]' || tag === '[object RegExp]';
|
|
29
|
-
}
|
|
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
|
-
*/
|
|
36
|
-
function redactEntries(entries, keyPatterns, walk) {
|
|
37
|
-
const out = {};
|
|
38
|
-
for (const [key, value] of entries) {
|
|
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
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return out;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* A Map's entries as an object. Keys are stringified so a non-string key is
|
|
50
|
-
* still reported rather than dropped, and each is checked against the
|
|
51
|
-
* secret-key patterns exactly as a plain object's own keys are.
|
|
52
|
-
*/
|
|
53
|
-
function redactMap(value, deps) {
|
|
54
|
-
const entries = [...value].map(([key, entry]) => [String(key), entry]);
|
|
55
|
-
return redactEntries(entries, deps.keyPatterns, deps.walk);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Rebuild an Error as a plain object carrying its redacted text alongside its
|
|
59
|
-
* redacted own properties. The one exception is an Error with no own
|
|
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.
|
|
63
|
-
*
|
|
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.
|
|
75
|
-
*/
|
|
76
|
-
function redactError(current, entries, deps) {
|
|
77
|
-
const text = (0, secret_patterns_1.redactErrorText)(current, deps.valuePatterns);
|
|
78
|
-
const aggregated = current.errors;
|
|
79
|
-
const bare = entries.length === 0 && current.cause === undefined && aggregated === undefined;
|
|
80
|
-
if (bare && !text.changed)
|
|
81
|
-
return current;
|
|
82
|
-
const out = redactEntries(entries, deps.keyPatterns, deps.walk);
|
|
83
|
-
out.name = text.name;
|
|
84
|
-
out.message = text.message;
|
|
85
|
-
out.stack = text.stack;
|
|
86
|
-
if (current.cause !== undefined)
|
|
87
|
-
out.cause = deps.walk(current.cause);
|
|
88
|
-
if (Array.isArray(aggregated))
|
|
89
|
-
out.errors = deps.walk(aggregated);
|
|
90
|
-
return out;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Dispatch one non-null object by its shape: arrays and plain objects recurse,
|
|
94
|
-
* binary views collapse to a label, `Date`/`RegExp` pass through by reference,
|
|
95
|
-
* `Set`/`Map` render as their contents, and an Error takes the path above.
|
|
96
|
-
*/
|
|
97
|
-
function walkObject(current, deps) {
|
|
98
|
-
if (Array.isArray(current))
|
|
99
|
-
return current.map(deps.walk);
|
|
100
|
-
if (ArrayBuffer.isView(current))
|
|
101
|
-
return (0, secret_patterns_1.binaryLabel)(current);
|
|
102
|
-
if (isOpaqueValue(current))
|
|
103
|
-
return current;
|
|
104
|
-
if (isSetValue(current))
|
|
105
|
-
return [...current].map(deps.walk);
|
|
106
|
-
if (isMapValue(current))
|
|
107
|
-
return redactMap(current, deps);
|
|
108
|
-
const entries = Object.entries(current);
|
|
109
|
-
if (isErrorValue(current))
|
|
110
|
-
return redactError(current, entries, deps);
|
|
111
|
-
return redactEntries(entries, deps.keyPatterns, deps.walk);
|
|
112
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { LogArgument, Logger } from './logger';
|
|
2
|
-
import { type Redactable } from './redaction-walk';
|
|
3
|
-
/**
|
|
4
|
-
* Recursively clone `value`, replacing any value at a secret-looking key with
|
|
5
|
-
* `[REDACTED]` and any recognised secret *shape* inside a string — including an
|
|
6
|
-
* error's `message`/`stack` text, which key-name matching cannot reach — with
|
|
7
|
-
* the same marker. Cycles become `[Circular]`.
|
|
8
|
-
*
|
|
9
|
-
* An Error with no own enumerable properties whose text holds no secret is
|
|
10
|
-
* passed through by reference, so its identity and stack trace survive; one
|
|
11
|
-
* carrying own data (this library's error types all attach `code`/`context`
|
|
12
|
-
* this way) or a secret in its text is rebuilt instead, with `name`/`message`/
|
|
13
|
-
* `stack` redacted and every other own property recursed like a plain object.
|
|
14
|
-
* `Date`/`RegExp` keep their identity rather than collapsing to `{}`,
|
|
15
|
-
* `Set`/`Map` render as their contents, and binary views become a short label.
|
|
16
|
-
* Does not mutate the input. Accepts any log argument — a typed `Error`, a
|
|
17
|
-
* class instance, a `Record` — so callers never cast.
|
|
18
|
-
*/
|
|
19
|
-
export declare function redactSecrets(value: LogArgument | undefined, patterns?: readonly string[], valuePatterns?: readonly RegExp[]): Redactable;
|
|
20
|
-
/** Options controlling {@link redactLogger}. */
|
|
21
|
-
export interface RedactLoggerOptions {
|
|
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
|
-
*/
|
|
27
|
-
extraKeys?: readonly string[];
|
|
28
|
-
/**
|
|
29
|
-
* Additional secret shapes to redact wherever they appear inside a string.
|
|
30
|
-
* A pattern's first capture group, if it has one, is preserved verbatim and
|
|
31
|
-
* only the remainder of the match is replaced.
|
|
32
|
-
*/
|
|
33
|
-
extraValuePatterns?: readonly RegExp[];
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Wrap a logger so object args are redacted before delegation. The message
|
|
37
|
-
* string is passed through unchanged (never interpolate secrets into it).
|
|
38
|
-
*/
|
|
39
|
-
export declare function redactLogger(inner: Logger, options?: RedactLoggerOptions): Logger;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.redactSecrets = redactSecrets;
|
|
4
|
-
exports.redactLogger = redactLogger;
|
|
5
|
-
const redaction_walk_1 = require("./redaction-walk");
|
|
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]';
|
|
9
|
-
/**
|
|
10
|
-
* Recursively clone `value`, replacing any value at a secret-looking key with
|
|
11
|
-
* `[REDACTED]` and any recognised secret *shape* inside a string — including an
|
|
12
|
-
* error's `message`/`stack` text, which key-name matching cannot reach — with
|
|
13
|
-
* the same marker. Cycles become `[Circular]`.
|
|
14
|
-
*
|
|
15
|
-
* An Error with no own enumerable properties whose text holds no secret is
|
|
16
|
-
* passed through by reference, so its identity and stack trace survive; one
|
|
17
|
-
* carrying own data (this library's error types all attach `code`/`context`
|
|
18
|
-
* this way) or a secret in its text is rebuilt instead, with `name`/`message`/
|
|
19
|
-
* `stack` redacted and every other own property recursed like a plain object.
|
|
20
|
-
* `Date`/`RegExp` keep their identity rather than collapsing to `{}`,
|
|
21
|
-
* `Set`/`Map` render as their contents, and binary views become a short label.
|
|
22
|
-
* Does not mutate the input. Accepts any log argument — a typed `Error`, a
|
|
23
|
-
* class instance, a `Record` — so callers never cast.
|
|
24
|
-
*/
|
|
25
|
-
function redactSecrets(value, patterns = secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS, valuePatterns = secret_patterns_1.DEFAULT_SECRET_VALUE_PATTERNS) {
|
|
26
|
-
const seen = new WeakSet();
|
|
27
|
-
const walk = (current) => {
|
|
28
|
-
if (typeof current === 'string')
|
|
29
|
-
return (0, secret_patterns_1.redactText)(current, valuePatterns);
|
|
30
|
-
if (current === null || typeof current !== 'object')
|
|
31
|
-
return current;
|
|
32
|
-
if (seen.has(current))
|
|
33
|
-
return '[Circular]';
|
|
34
|
-
seen.add(current);
|
|
35
|
-
try {
|
|
36
|
-
return (0, redaction_walk_1.walkObject)(current, { keyPatterns: patterns, valuePatterns, walk });
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
seen.delete(current);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
return walk(value);
|
|
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
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Wrap a logger so object args are redacted before delegation. The message
|
|
59
|
-
* string is passed through unchanged (never interpolate secrets into it).
|
|
60
|
-
*/
|
|
61
|
-
function redactLogger(inner, options = {}) {
|
|
62
|
-
const patterns = options.extraKeys
|
|
63
|
-
? [...secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS, ...options.extraKeys.map(secret_patterns_1.normaliseKey)]
|
|
64
|
-
: secret_patterns_1.DEFAULT_SECRET_KEY_PATTERNS;
|
|
65
|
-
const valuePatterns = options.extraValuePatterns
|
|
66
|
-
? [...secret_patterns_1.DEFAULT_SECRET_VALUE_PATTERNS, ...options.extraValuePatterns]
|
|
67
|
-
: secret_patterns_1.DEFAULT_SECRET_VALUE_PATTERNS;
|
|
68
|
-
const wrap = (args) => args.map((arg) => safeRedact(arg, patterns, valuePatterns));
|
|
69
|
-
return {
|
|
70
|
-
info: (message, ...args) => inner.info(message, ...wrap(args)),
|
|
71
|
-
warn: (message, ...args) => inner.warn(message, ...wrap(args)),
|
|
72
|
-
error: (message, ...args) => inner.error(message, ...wrap(args)),
|
|
73
|
-
debug: (message, ...args) => inner.debug(message, ...wrap(args)),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/** Marker substituted for anything recognised as secret. */
|
|
2
|
-
export declare const REDACTED = "[REDACTED]";
|
|
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
|
-
*/
|
|
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;
|
|
18
|
-
/**
|
|
19
|
-
* Secret shapes recognisable in free text, where key-name matching cannot
|
|
20
|
-
* reach: an error's `message`/`stack`, or any other string value. Deliberately
|
|
21
|
-
* high-confidence — each pattern describes a credential *format* rather than a
|
|
22
|
-
* word that merely sounds sensitive — so ordinary operational text survives
|
|
23
|
-
* redaction unchanged.
|
|
24
|
-
*
|
|
25
|
-
* The credential-pair pattern (last) tolerates a **closing quote after the
|
|
26
|
-
* keyword**, because that is what `JSON.stringify` produces
|
|
27
|
-
* (`{"password":"…"}`) and requiring the separator to follow the bare keyword
|
|
28
|
-
* matched nothing at all there — a silent, complete bypass on the single most
|
|
29
|
-
* common shape a downstream HTTP error arrives in. Its group 1 is the keyword
|
|
30
|
-
* and separator, preserved by {@link redactText}.
|
|
31
|
-
*
|
|
32
|
-
* Its value side tries three shapes, and their order is load-bearing:
|
|
33
|
-
* 1. a fully-quoted span that consumes escapes, so `{"password":"a\"b"}` is
|
|
34
|
-
* redacted whole. Ending the span at the escaped quote stopped the
|
|
35
|
-
* redaction short and printed the rest of the secret verbatim.
|
|
36
|
-
* 2. an unquoted JSON scalar — number, `true`, `false`, `null` — required to
|
|
37
|
-
* end at a real delimiter — `,`, `}`, `]` or end of input, optionally
|
|
38
|
-
* preceded by whitespace. Without this alternative,
|
|
39
|
-
* `{"apiKey":123,"region":"us-east-1"}` fell through to the fallback below,
|
|
40
|
-
* which then destroyed every sibling field after the secret. The lookahead
|
|
41
|
-
* is what stops the alternative truncating a value it does not fully
|
|
42
|
-
* describe, such as `token=123abc`, and leaking the tail it left behind.
|
|
43
|
-
* Whitespace alone does not end a scalar: treating a space as a delimiter
|
|
44
|
-
* made `api_key: 5 items` redact to `api_key: [REDACTED] items`, which
|
|
45
|
-
* reads as a partial redaction of a value the pattern never described.
|
|
46
|
-
* 3. the rest of the line, so a multi-word secret is redacted whole instead of
|
|
47
|
-
* up to its first space. Trying the two precise shapes first is what keeps
|
|
48
|
-
* this fallback from over-redacting sibling JSON fields.
|
|
49
|
-
*/
|
|
50
|
-
export declare const DEFAULT_SECRET_VALUE_PATTERNS: readonly RegExp[];
|
|
51
|
-
/** True when `key`'s normalised form equals or ends with any (normalised) pattern. */
|
|
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;
|
|
59
|
-
/**
|
|
60
|
-
* Replace every recognised secret shape inside `value` with {@link REDACTED},
|
|
61
|
-
* leaving the surrounding text intact so a redacted message stays readable.
|
|
62
|
-
* Each pattern is rebuilt per call so a `g` flag's `lastIndex` never leaks
|
|
63
|
-
* between invocations.
|
|
64
|
-
*
|
|
65
|
-
* A pattern may capture a leading group it wants **preserved**: only the rest
|
|
66
|
-
* of the match is replaced, which is what keeps `apiKey=[REDACTED]` saying
|
|
67
|
-
* which field was redacted instead of collapsing to a bare marker. A pattern
|
|
68
|
-
* with no group is replaced whole, as before. `String.prototype.replace`
|
|
69
|
-
* passes the match *offset* — a number — as the second callback argument when
|
|
70
|
-
* the pattern has no group, hence the `typeof` test rather than an
|
|
71
|
-
* `undefined` check.
|
|
72
|
-
*/
|
|
73
|
-
export declare function redactText(value: string, patterns: readonly RegExp[]): string;
|
|
74
|
-
/**
|
|
75
|
-
* A short label for a binary view. Recursing one would explode it into a
|
|
76
|
-
* per-index numeric map, both unreadable and far larger than the value itself.
|
|
77
|
-
*/
|
|
78
|
-
export declare function binaryLabel(value: ArrayBufferView): string;
|
|
79
|
-
/** An Error's redacted non-enumerable text, plus whether redaction changed it. */
|
|
80
|
-
export interface RedactedErrorText {
|
|
81
|
-
name: string;
|
|
82
|
-
message: string;
|
|
83
|
-
stack: string | undefined;
|
|
84
|
-
changed: boolean;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Redact an Error's `name`/`message`/`stack`. `changed` reports whether any
|
|
88
|
-
* secret was actually found, which is what decides between passing a bare
|
|
89
|
-
* Error through by reference (preserving its identity and stack trace) and
|
|
90
|
-
* rebuilding it so the secret cannot escape.
|
|
91
|
-
*/
|
|
92
|
-
export declare function redactErrorText(error: Error, patterns: readonly RegExp[]): RedactedErrorText;
|