@farukada/aws-langgraph-dynamodb-ts 0.9.0 → 1.0.0-rc.2
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 +1720 -154
- package/dist/backfill/backfill.d.ts +168 -0
- package/dist/backfill/backfill.js +393 -0
- package/dist/checkpointer/actions/delete-thread.d.ts +47 -6
- package/dist/checkpointer/actions/delete-thread.js +58 -21
- package/dist/checkpointer/actions/get-tuple.d.ts +29 -4
- package/dist/checkpointer/actions/get-tuple.js +44 -10
- package/dist/checkpointer/actions/list.d.ts +46 -4
- package/dist/checkpointer/actions/list.js +121 -66
- package/dist/checkpointer/actions/put-writes.d.ts +41 -9
- package/dist/checkpointer/actions/put-writes.js +62 -77
- package/dist/checkpointer/actions/put.d.ts +83 -4
- package/dist/checkpointer/actions/put.js +177 -25
- package/dist/checkpointer/internal/delta-history.d.ts +112 -0
- package/dist/checkpointer/internal/delta-history.js +252 -0
- package/dist/checkpointer/internal/listing.d.ts +149 -0
- package/dist/checkpointer/internal/listing.js +245 -0
- package/dist/checkpointer/internal/parse.d.ts +262 -0
- package/dist/checkpointer/internal/parse.js +372 -0
- package/dist/checkpointer/internal/pending-writes.d.ts +275 -0
- package/dist/checkpointer/internal/pending-writes.js +588 -0
- package/dist/checkpointer/internal/read.d.ts +130 -0
- package/dist/checkpointer/internal/read.js +264 -0
- package/dist/checkpointer/internal/rows.d.ts +571 -0
- package/dist/checkpointer/internal/rows.js +834 -0
- package/dist/checkpointer/internal/setup.d.ts +42 -19
- package/dist/checkpointer/internal/setup.js +65 -29
- package/dist/checkpointer/saver.d.ts +256 -16
- package/dist/checkpointer/saver.js +275 -29
- package/dist/checkpointer/types.d.ts +39 -39
- package/dist/checkpointer/types.js +10 -1
- package/dist/factory/factory.d.ts +134 -28
- package/dist/factory/factory.js +240 -21
- package/dist/factory/types.d.ts +76 -0
- package/dist/factory/types.js +10 -0
- package/dist/history/actions/add-messages.d.ts +31 -4
- package/dist/history/actions/add-messages.js +38 -58
- package/dist/history/actions/clear.d.ts +49 -6
- package/dist/history/actions/clear.js +66 -14
- package/dist/history/actions/get-messages.d.ts +54 -6
- package/dist/history/actions/get-messages.js +126 -43
- package/dist/history/actions/list-sessions.d.ts +52 -10
- package/dist/history/actions/list-sessions.js +139 -40
- package/dist/history/actions/reconcile-count.d.ts +42 -10
- package/dist/history/actions/reconcile-count.js +45 -45
- package/dist/history/chat-message-history.d.ts +220 -33
- package/dist/history/chat-message-history.js +240 -43
- package/dist/history/internal/append.d.ts +212 -0
- package/dist/history/internal/append.js +500 -0
- package/dist/history/internal/message-read.d.ts +84 -0
- package/dist/history/internal/message-read.js +204 -0
- package/dist/history/internal/parse.d.ts +153 -0
- package/dist/history/internal/parse.js +252 -0
- package/dist/history/internal/rows.d.ts +195 -0
- package/dist/history/internal/rows.js +250 -0
- package/dist/history/internal/session.d.ts +331 -0
- package/dist/history/internal/session.js +628 -0
- package/dist/history/internal/setup.d.ts +52 -17
- package/dist/history/internal/setup.js +92 -21
- package/dist/history/session-adapter.d.ts +102 -7
- package/dist/history/session-adapter.js +103 -9
- package/dist/history/types.d.ts +80 -29
- package/dist/history/types.js +10 -1
- package/dist/index.d.ts +42 -11
- package/dist/index.js +33 -12
- package/dist/shared/adapter.d.ts +135 -0
- package/dist/shared/adapter.js +143 -0
- package/dist/shared/clock.d.ts +51 -2
- package/dist/shared/clock.js +57 -2
- package/dist/shared/codec/codec.d.ts +288 -13
- package/dist/shared/codec/codec.js +416 -19
- package/dist/shared/codec/compression.d.ts +43 -7
- package/dist/shared/codec/compression.js +53 -13
- package/dist/shared/codec/json-serde.d.ts +76 -4
- package/dist/shared/codec/json-serde.js +181 -8
- package/dist/shared/codec/s3/client-types.d.ts +53 -0
- package/dist/shared/codec/s3/client-types.js +26 -0
- package/dist/shared/codec/s3/client.d.ts +43 -10
- package/dist/shared/codec/s3/client.js +82 -9
- package/dist/shared/codec/s3/config.d.ts +242 -11
- package/dist/shared/codec/s3/config.js +293 -11
- package/dist/shared/codec/s3/lifecycle.d.ts +164 -6
- package/dist/shared/codec/s3/lifecycle.js +335 -27
- package/dist/shared/codec/s3/offloader.d.ts +393 -18
- package/dist/shared/codec/s3/offloader.js +595 -37
- package/dist/shared/concurrency.d.ts +43 -0
- package/dist/shared/concurrency.js +78 -0
- package/dist/shared/dynamodb/abort.d.ts +47 -0
- package/dist/shared/dynamodb/abort.js +59 -0
- package/dist/shared/dynamodb/batch-write.d.ts +77 -14
- package/dist/shared/dynamodb/batch-write.js +146 -27
- package/dist/shared/dynamodb/cancellation.d.ts +121 -4
- package/dist/shared/dynamodb/cancellation.js +147 -3
- package/dist/shared/dynamodb/client.d.ts +162 -8
- package/dist/shared/dynamodb/client.js +153 -5
- package/dist/shared/dynamodb/idempotent-write.d.ts +551 -0
- package/dist/shared/dynamodb/idempotent-write.js +593 -0
- package/dist/shared/dynamodb/paginate.d.ts +105 -9
- package/dist/shared/dynamodb/paginate.js +175 -7
- package/dist/shared/dynamodb/partition-delete.d.ts +185 -14
- package/dist/shared/dynamodb/partition-delete.js +314 -44
- package/dist/shared/dynamodb/recency-index.d.ts +231 -0
- package/dist/shared/dynamodb/recency-index.js +377 -0
- package/dist/shared/dynamodb/retry.d.ts +276 -8
- package/dist/shared/dynamodb/retry.js +433 -23
- package/dist/shared/dynamodb/table-schema.d.ts +190 -0
- package/dist/shared/dynamodb/table-schema.js +209 -0
- package/dist/shared/errors/base-error.d.ts +184 -10
- package/dist/shared/errors/base-error.js +160 -14
- package/dist/shared/errors/boundary.d.ts +71 -0
- package/dist/shared/errors/boundary.js +143 -0
- package/dist/shared/errors/classify.d.ts +97 -0
- package/dist/shared/errors/classify.js +257 -0
- package/dist/shared/errors/error-code.d.ts +77 -2
- package/dist/shared/errors/error-code.js +83 -1
- package/dist/shared/errors/errors.d.ts +158 -59
- package/dist/shared/errors/errors.js +219 -92
- package/dist/shared/logging/logger.d.ts +69 -3
- package/dist/shared/logging/logger.js +97 -3
- package/dist/shared/logging/redaction.d.ts +92 -8
- package/dist/shared/logging/redaction.js +273 -17
- package/dist/shared/logging/secret-patterns.d.ts +149 -19
- package/dist/shared/logging/secret-patterns.js +188 -27
- package/dist/shared/logging/truncate.d.ts +197 -0
- package/dist/shared/logging/truncate.js +231 -0
- package/dist/shared/options.d.ts +59 -7
- package/dist/shared/options.js +9 -1
- package/dist/shared/ulid.d.ts +77 -7
- package/dist/shared/ulid.js +103 -8
- package/dist/shared/validation/collaborators.d.ts +141 -0
- package/dist/shared/validation/collaborators.js +188 -0
- package/dist/shared/validation/option-shape.d.ts +89 -0
- package/dist/shared/validation/option-shape.js +113 -0
- package/dist/shared/validation/options.d.ts +145 -0
- package/dist/shared/validation/options.js +328 -0
- package/dist/shared/validation/primitives.d.ts +288 -21
- package/dist/shared/validation/primitives.js +353 -50
- package/dist/shared/validation/ttl.d.ts +66 -10
- package/dist/shared/validation/ttl.js +113 -15
- package/dist/store/actions/list-namespaces.d.ts +76 -6
- package/dist/store/actions/list-namespaces.js +166 -24
- package/dist/store/actions/put.d.ts +33 -8
- package/dist/store/actions/put.js +53 -60
- package/dist/store/actions/reconcile-vector-index.d.ts +31 -10
- package/dist/store/actions/reconcile-vector-index.js +34 -15
- package/dist/store/actions/search.d.ts +34 -6
- package/dist/store/actions/search.js +56 -51
- package/dist/store/internal/batch-plan.d.ts +26 -0
- package/dist/store/internal/batch-plan.js +109 -0
- package/dist/store/internal/filter.d.ts +36 -3
- package/dist/store/internal/filter.js +66 -15
- package/dist/store/internal/get-item.d.ts +45 -0
- package/dist/store/internal/get-item.js +115 -0
- package/dist/store/internal/item-write.d.ts +230 -0
- package/dist/store/internal/item-write.js +463 -0
- package/dist/store/internal/parse.d.ts +225 -0
- package/dist/store/internal/parse.js +350 -0
- package/dist/store/internal/rows.d.ts +355 -0
- package/dist/store/internal/rows.js +447 -0
- package/dist/store/internal/semantic-search.d.ts +161 -6
- package/dist/store/internal/semantic-search.js +360 -18
- package/dist/store/internal/setup.d.ts +77 -20
- package/dist/store/internal/setup.js +178 -47
- package/dist/store/internal/table-search.d.ts +100 -0
- package/dist/store/internal/table-search.js +213 -0
- package/dist/store/internal/vector-index.d.ts +247 -0
- package/dist/store/internal/vector-index.js +546 -0
- package/dist/store/store.d.ts +270 -17
- package/dist/store/store.js +329 -38
- package/dist/store/types.d.ts +76 -26
- package/dist/store/types.js +13 -1
- package/dist/store/vector-backend.d.ts +64 -4
- package/dist/store/vector-backend.js +15 -1
- package/package.json +58 -36
- package/dist/checkpointer/actions/delete-thread.d.ts.map +0 -1
- package/dist/checkpointer/actions/delete-thread.js.map +0 -1
- package/dist/checkpointer/actions/get-tuple.d.ts.map +0 -1
- package/dist/checkpointer/actions/get-tuple.js.map +0 -1
- package/dist/checkpointer/actions/list.d.ts.map +0 -1
- package/dist/checkpointer/actions/list.js.map +0 -1
- package/dist/checkpointer/actions/put-writes.d.ts.map +0 -1
- package/dist/checkpointer/actions/put-writes.js.map +0 -1
- package/dist/checkpointer/actions/put.d.ts.map +0 -1
- package/dist/checkpointer/actions/put.js.map +0 -1
- package/dist/checkpointer/internal/assemble.d.ts +0 -10
- package/dist/checkpointer/internal/assemble.d.ts.map +0 -1
- package/dist/checkpointer/internal/assemble.js +0 -37
- package/dist/checkpointer/internal/assemble.js.map +0 -1
- package/dist/checkpointer/internal/configurable.d.ts +0 -13
- package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
- package/dist/checkpointer/internal/configurable.js +0 -23
- package/dist/checkpointer/internal/configurable.js.map +0 -1
- package/dist/checkpointer/internal/fetch.d.ts +0 -10
- package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
- package/dist/checkpointer/internal/fetch.js +0 -46
- package/dist/checkpointer/internal/fetch.js.map +0 -1
- package/dist/checkpointer/internal/filter-match.d.ts +0 -12
- package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
- package/dist/checkpointer/internal/filter-match.js +0 -14
- package/dist/checkpointer/internal/filter-match.js.map +0 -1
- package/dist/checkpointer/internal/item-reader.d.ts +0 -55
- package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-reader.js +0 -88
- package/dist/checkpointer/internal/item-reader.js.map +0 -1
- package/dist/checkpointer/internal/item-writer.d.ts +0 -26
- package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-writer.js +0 -92
- package/dist/checkpointer/internal/item-writer.js.map +0 -1
- package/dist/checkpointer/internal/keys.d.ts +0 -31
- package/dist/checkpointer/internal/keys.d.ts.map +0 -1
- package/dist/checkpointer/internal/keys.js +0 -87
- package/dist/checkpointer/internal/keys.js.map +0 -1
- package/dist/checkpointer/internal/query.d.ts +0 -20
- package/dist/checkpointer/internal/query.d.ts.map +0 -1
- package/dist/checkpointer/internal/query.js +0 -36
- package/dist/checkpointer/internal/query.js.map +0 -1
- package/dist/checkpointer/internal/setup.d.ts.map +0 -1
- package/dist/checkpointer/internal/setup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.d.ts +0 -30
- package/dist/checkpointer/internal/special-write-cas.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.js +0 -104
- package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -24
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.js +0 -47
- package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -54
- package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.js +0 -65
- package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
- package/dist/checkpointer/internal/validation.d.ts +0 -13
- package/dist/checkpointer/internal/validation.d.ts.map +0 -1
- package/dist/checkpointer/internal/validation.js +0 -30
- package/dist/checkpointer/internal/validation.js.map +0 -1
- package/dist/checkpointer/internal/write-guard.d.ts +0 -13
- package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-guard.js +0 -39
- package/dist/checkpointer/internal/write-guard.js.map +0 -1
- package/dist/checkpointer/internal/write-index.d.ts +0 -37
- package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-index.js +0 -42
- package/dist/checkpointer/internal/write-index.js.map +0 -1
- package/dist/checkpointer/saver.d.ts.map +0 -1
- package/dist/checkpointer/saver.js.map +0 -1
- package/dist/checkpointer/types.d.ts.map +0 -1
- package/dist/checkpointer/types.js.map +0 -1
- package/dist/factory/factory.d.ts.map +0 -1
- package/dist/factory/factory.js.map +0 -1
- package/dist/history/actions/add-messages.d.ts.map +0 -1
- package/dist/history/actions/add-messages.js.map +0 -1
- package/dist/history/actions/clear.d.ts.map +0 -1
- package/dist/history/actions/clear.js.map +0 -1
- package/dist/history/actions/get-messages.d.ts.map +0 -1
- package/dist/history/actions/get-messages.js.map +0 -1
- package/dist/history/actions/list-sessions.d.ts.map +0 -1
- package/dist/history/actions/list-sessions.js.map +0 -1
- package/dist/history/actions/reconcile-count.d.ts.map +0 -1
- package/dist/history/actions/reconcile-count.js.map +0 -1
- package/dist/history/chat-message-history.d.ts.map +0 -1
- package/dist/history/chat-message-history.js.map +0 -1
- package/dist/history/internal/append-saga.d.ts +0 -20
- package/dist/history/internal/append-saga.d.ts.map +0 -1
- package/dist/history/internal/append-saga.js +0 -35
- package/dist/history/internal/append-saga.js.map +0 -1
- package/dist/history/internal/compensation.d.ts +0 -21
- package/dist/history/internal/compensation.d.ts.map +0 -1
- package/dist/history/internal/compensation.js +0 -84
- package/dist/history/internal/compensation.js.map +0 -1
- package/dist/history/internal/item-mapper.d.ts +0 -12
- package/dist/history/internal/item-mapper.d.ts.map +0 -1
- package/dist/history/internal/item-mapper.js +0 -33
- package/dist/history/internal/item-mapper.js.map +0 -1
- package/dist/history/internal/keys.d.ts +0 -17
- package/dist/history/internal/keys.d.ts.map +0 -1
- package/dist/history/internal/keys.js +0 -49
- package/dist/history/internal/keys.js.map +0 -1
- package/dist/history/internal/message-chunker.d.ts +0 -14
- package/dist/history/internal/message-chunker.d.ts.map +0 -1
- package/dist/history/internal/message-chunker.js +0 -68
- package/dist/history/internal/message-chunker.js.map +0 -1
- package/dist/history/internal/message-transaction.d.ts +0 -26
- package/dist/history/internal/message-transaction.d.ts.map +0 -1
- package/dist/history/internal/message-transaction.js +0 -60
- package/dist/history/internal/message-transaction.js.map +0 -1
- package/dist/history/internal/query.d.ts +0 -10
- package/dist/history/internal/query.d.ts.map +0 -1
- package/dist/history/internal/query.js +0 -31
- package/dist/history/internal/query.js.map +0 -1
- package/dist/history/internal/session-count.d.ts +0 -41
- package/dist/history/internal/session-count.d.ts.map +0 -1
- package/dist/history/internal/session-count.js +0 -109
- package/dist/history/internal/session-count.js.map +0 -1
- package/dist/history/internal/session-title.d.ts +0 -20
- package/dist/history/internal/session-title.d.ts.map +0 -1
- package/dist/history/internal/session-title.js +0 -44
- package/dist/history/internal/session-title.js.map +0 -1
- package/dist/history/internal/session-update.d.ts +0 -28
- package/dist/history/internal/session-update.d.ts.map +0 -1
- package/dist/history/internal/session-update.js +0 -70
- package/dist/history/internal/session-update.js.map +0 -1
- package/dist/history/internal/setup.d.ts.map +0 -1
- package/dist/history/internal/setup.js.map +0 -1
- package/dist/history/internal/title-generator.d.ts +0 -13
- package/dist/history/internal/title-generator.d.ts.map +0 -1
- package/dist/history/internal/title-generator.js +0 -25
- package/dist/history/internal/title-generator.js.map +0 -1
- package/dist/history/internal/ttl-anchor.d.ts +0 -25
- package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
- package/dist/history/internal/ttl-anchor.js +0 -38
- package/dist/history/internal/ttl-anchor.js.map +0 -1
- package/dist/history/internal/validation.d.ts +0 -9
- package/dist/history/internal/validation.d.ts.map +0 -1
- package/dist/history/internal/validation.js +0 -16
- package/dist/history/internal/validation.js.map +0 -1
- package/dist/history/session-adapter.d.ts.map +0 -1
- package/dist/history/session-adapter.js.map +0 -1
- package/dist/history/types.d.ts.map +0 -1
- package/dist/history/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/shared/clock.d.ts.map +0 -1
- package/dist/shared/clock.js.map +0 -1
- package/dist/shared/codec/codec.d.ts.map +0 -1
- package/dist/shared/codec/codec.js.map +0 -1
- package/dist/shared/codec/compression.d.ts.map +0 -1
- package/dist/shared/codec/compression.js.map +0 -1
- package/dist/shared/codec/descriptor-keys.d.ts +0 -4
- package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
- package/dist/shared/codec/descriptor-keys.js +0 -14
- package/dist/shared/codec/descriptor-keys.js.map +0 -1
- package/dist/shared/codec/json-serde.d.ts.map +0 -1
- package/dist/shared/codec/json-serde.js.map +0 -1
- package/dist/shared/codec/s3/client.d.ts.map +0 -1
- package/dist/shared/codec/s3/client.js.map +0 -1
- package/dist/shared/codec/s3/config.d.ts.map +0 -1
- package/dist/shared/codec/s3/config.js.map +0 -1
- package/dist/shared/codec/s3/delete.d.ts +0 -8
- package/dist/shared/codec/s3/delete.d.ts.map +0 -1
- package/dist/shared/codec/s3/delete.js +0 -29
- package/dist/shared/codec/s3/delete.js.map +0 -1
- package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
- package/dist/shared/codec/s3/lifecycle.js.map +0 -1
- package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
- package/dist/shared/codec/s3/offloader.js.map +0 -1
- package/dist/shared/codec/s3/orphans.d.ts +0 -18
- package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
- package/dist/shared/codec/s3/orphans.js +0 -58
- package/dist/shared/codec/s3/orphans.js.map +0 -1
- package/dist/shared/codec/s3/read-write.d.ts +0 -14
- package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
- package/dist/shared/codec/s3/read-write.js +0 -43
- package/dist/shared/codec/s3/read-write.js.map +0 -1
- package/dist/shared/codec/s3/retry.d.ts +0 -5
- package/dist/shared/codec/s3/retry.d.ts.map +0 -1
- package/dist/shared/codec/s3/retry.js +0 -25
- package/dist/shared/codec/s3/retry.js.map +0 -1
- package/dist/shared/constants.d.ts +0 -64
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js +0 -67
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/dynamodb/backoff.d.ts +0 -15
- package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
- package/dist/shared/dynamodb/backoff.js +0 -48
- package/dist/shared/dynamodb/backoff.js.map +0 -1
- package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
- package/dist/shared/dynamodb/batch-write.js.map +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
- package/dist/shared/dynamodb/cancellation.js.map +0 -1
- package/dist/shared/dynamodb/client.d.ts.map +0 -1
- package/dist/shared/dynamodb/client.js.map +0 -1
- package/dist/shared/dynamodb/conditional-put.d.ts +0 -51
- package/dist/shared/dynamodb/conditional-put.d.ts.map +0 -1
- package/dist/shared/dynamodb/conditional-put.js +0 -59
- package/dist/shared/dynamodb/conditional-put.js.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -19
- package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.js +0 -44
- package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
- package/dist/shared/dynamodb/paginate-core.d.ts +0 -22
- package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate-core.js +0 -52
- package/dist/shared/dynamodb/paginate-core.js.map +0 -1
- package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate.js.map +0 -1
- package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
- package/dist/shared/dynamodb/partition-delete.js.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.d.ts +0 -9
- package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.js +0 -87
- package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
- package/dist/shared/dynamodb/retry.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry.js.map +0 -1
- package/dist/shared/dynamodb/scan.d.ts +0 -15
- package/dist/shared/dynamodb/scan.d.ts.map +0 -1
- package/dist/shared/dynamodb/scan.js +0 -20
- package/dist/shared/dynamodb/scan.js.map +0 -1
- package/dist/shared/dynamodb/types.d.ts +0 -24
- package/dist/shared/dynamodb/types.d.ts.map +0 -1
- package/dist/shared/dynamodb/types.js +0 -3
- package/dist/shared/dynamodb/types.js.map +0 -1
- package/dist/shared/errors/base-error.d.ts.map +0 -1
- package/dist/shared/errors/base-error.js.map +0 -1
- package/dist/shared/errors/error-code.d.ts.map +0 -1
- package/dist/shared/errors/error-code.js.map +0 -1
- package/dist/shared/errors/errors.d.ts.map +0 -1
- package/dist/shared/errors/errors.js.map +0 -1
- package/dist/shared/errors/wrap-error.d.ts +0 -16
- package/dist/shared/errors/wrap-error.d.ts.map +0 -1
- package/dist/shared/errors/wrap-error.js +0 -30
- package/dist/shared/errors/wrap-error.js.map +0 -1
- package/dist/shared/logging/logger.d.ts.map +0 -1
- package/dist/shared/logging/logger.js.map +0 -1
- package/dist/shared/logging/redaction-walk.d.ts +0 -23
- package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
- package/dist/shared/logging/redaction-walk.js +0 -92
- package/dist/shared/logging/redaction-walk.js.map +0 -1
- package/dist/shared/logging/redaction.d.ts.map +0 -1
- package/dist/shared/logging/redaction.js.map +0 -1
- package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
- package/dist/shared/logging/secret-patterns.js.map +0 -1
- package/dist/shared/options.d.ts.map +0 -1
- package/dist/shared/options.js.map +0 -1
- package/dist/shared/ulid.d.ts.map +0 -1
- package/dist/shared/ulid.js.map +0 -1
- package/dist/shared/validation/primitives.d.ts.map +0 -1
- package/dist/shared/validation/primitives.js.map +0 -1
- package/dist/shared/validation/ttl.d.ts.map +0 -1
- package/dist/shared/validation/ttl.js.map +0 -1
- package/dist/store/actions/get.d.ts +0 -5
- package/dist/store/actions/get.d.ts.map +0 -1
- package/dist/store/actions/get.js +0 -35
- package/dist/store/actions/get.js.map +0 -1
- package/dist/store/actions/list-namespaces.d.ts.map +0 -1
- package/dist/store/actions/list-namespaces.js.map +0 -1
- package/dist/store/actions/put.d.ts.map +0 -1
- package/dist/store/actions/put.js.map +0 -1
- package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
- package/dist/store/actions/reconcile-vector-index.js.map +0 -1
- package/dist/store/actions/search.d.ts.map +0 -1
- package/dist/store/actions/search.js.map +0 -1
- package/dist/store/internal/backend-search.d.ts +0 -5
- package/dist/store/internal/backend-search.d.ts.map +0 -1
- package/dist/store/internal/backend-search.js +0 -68
- package/dist/store/internal/backend-search.js.map +0 -1
- package/dist/store/internal/filter.d.ts.map +0 -1
- package/dist/store/internal/filter.js.map +0 -1
- package/dist/store/internal/index-reconcile.d.ts +0 -22
- package/dist/store/internal/index-reconcile.d.ts.map +0 -1
- package/dist/store/internal/index-reconcile.js +0 -105
- package/dist/store/internal/index-reconcile.js.map +0 -1
- package/dist/store/internal/index-sync.d.ts +0 -11
- package/dist/store/internal/index-sync.d.ts.map +0 -1
- package/dist/store/internal/index-sync.js +0 -26
- package/dist/store/internal/index-sync.js.map +0 -1
- package/dist/store/internal/item-mapper.d.ts +0 -25
- package/dist/store/internal/item-mapper.d.ts.map +0 -1
- package/dist/store/internal/item-mapper.js +0 -53
- package/dist/store/internal/item-mapper.js.map +0 -1
- package/dist/store/internal/keys.d.ts +0 -18
- package/dist/store/internal/keys.d.ts.map +0 -1
- package/dist/store/internal/keys.js +0 -42
- package/dist/store/internal/keys.js.map +0 -1
- package/dist/store/internal/namespace-match.d.ts +0 -12
- package/dist/store/internal/namespace-match.d.ts.map +0 -1
- package/dist/store/internal/namespace-match.js +0 -41
- package/dist/store/internal/namespace-match.js.map +0 -1
- package/dist/store/internal/overwrite-swap.d.ts +0 -33
- package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
- package/dist/store/internal/overwrite-swap.js +0 -62
- package/dist/store/internal/overwrite-swap.js.map +0 -1
- package/dist/store/internal/persist.d.ts +0 -27
- package/dist/store/internal/persist.d.ts.map +0 -1
- package/dist/store/internal/persist.js +0 -59
- package/dist/store/internal/persist.js.map +0 -1
- package/dist/store/internal/query.d.ts +0 -6
- package/dist/store/internal/query.d.ts.map +0 -1
- package/dist/store/internal/query.js +0 -32
- package/dist/store/internal/query.js.map +0 -1
- package/dist/store/internal/ranker.d.ts +0 -13
- package/dist/store/internal/ranker.d.ts.map +0 -1
- package/dist/store/internal/ranker.js +0 -31
- package/dist/store/internal/ranker.js.map +0 -1
- package/dist/store/internal/read-existing.d.ts +0 -19
- package/dist/store/internal/read-existing.d.ts.map +0 -1
- package/dist/store/internal/read-existing.js +0 -29
- package/dist/store/internal/read-existing.js.map +0 -1
- package/dist/store/internal/score-direction.d.ts +0 -32
- package/dist/store/internal/score-direction.d.ts.map +0 -1
- package/dist/store/internal/score-direction.js +0 -39
- package/dist/store/internal/score-direction.js.map +0 -1
- package/dist/store/internal/search-filter.d.ts +0 -4
- package/dist/store/internal/search-filter.d.ts.map +0 -1
- package/dist/store/internal/search-filter.js +0 -11
- package/dist/store/internal/search-filter.js.map +0 -1
- package/dist/store/internal/semantic-search.d.ts.map +0 -1
- package/dist/store/internal/semantic-search.js.map +0 -1
- package/dist/store/internal/setup.d.ts.map +0 -1
- package/dist/store/internal/setup.js.map +0 -1
- package/dist/store/internal/validation.d.ts +0 -13
- package/dist/store/internal/validation.d.ts.map +0 -1
- package/dist/store/internal/validation.js +0 -35
- package/dist/store/internal/validation.js.map +0 -1
- package/dist/store/internal/write-verify.d.ts +0 -37
- package/dist/store/internal/write-verify.d.ts.map +0 -1
- package/dist/store/internal/write-verify.js +0 -68
- package/dist/store/internal/write-verify.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/types.d.ts.map +0 -1
- package/dist/store/types.js.map +0 -1
- package/dist/store/vector-backend.d.ts.map +0 -1
- package/dist/store/vector-backend.js.map +0 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides the conventions every row of the shared table follows, whichever
|
|
4
|
+
* adapter wrote it.
|
|
5
|
+
*
|
|
6
|
+
* The three adapters share one table (record 2), so a few things are decided
|
|
7
|
+
* once for all of them: the two key attributes every row has, the format
|
|
8
|
+
* version every row is stamped with and refused above (record 7), the `ttl`
|
|
9
|
+
* attribute that makes a row absent before DynamoDB's sweep removes it, and the
|
|
10
|
+
* order the server gives string keys. Which segments a feature's keys carry is
|
|
11
|
+
* that feature's `rows` module's decision; that they are written into these
|
|
12
|
+
* attributes and read back in this order is this module's.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SUPPORTED_ROW_FORMAT_VERSION = exports.ROW_FORMAT_VERSION = exports.ADAPTER_TAGS = exports.KEY_SEPARATOR = exports.MAX_SORT_KEY_BYTES = exports.MAX_KEY_SEGMENT_BYTES = exports.MAX_PARTITION_ID_BYTES = exports.SORT_KEY_ATTRIBUTE = exports.PARTITION_KEY_ATTRIBUTE = void 0;
|
|
16
|
+
exports.rowKeyOf = rowKeyOf;
|
|
17
|
+
exports.rowVersionOf = rowVersionOf;
|
|
18
|
+
exports.assertReadableRow = assertReadableRow;
|
|
19
|
+
exports.withRowVersion = withRowVersion;
|
|
20
|
+
exports.isExpiredRow = isExpiredRow;
|
|
21
|
+
exports.withoutExpired = withoutExpired;
|
|
22
|
+
exports.compareSortKeys = compareSortKeys;
|
|
23
|
+
const base_error_1 = require("../errors/base-error");
|
|
24
|
+
const error_code_1 = require("../errors/error-code");
|
|
25
|
+
/** The attribute every row is partitioned by. */
|
|
26
|
+
exports.PARTITION_KEY_ATTRIBUTE = 'PK';
|
|
27
|
+
/** The attribute every row is sorted by within its partition. */
|
|
28
|
+
exports.SORT_KEY_ATTRIBUTE = 'SK';
|
|
29
|
+
/**
|
|
30
|
+
* Byte caps on caller-supplied identifiers, measured as UTF-8. DynamoDB caps a
|
|
31
|
+
* partition key at 2048 bytes and a sort key at 1024; S3 caps an object key at
|
|
32
|
+
* 1024. These leave room for the adapter prefixes and separators that compose
|
|
33
|
+
* the stored keys, so a value that passes validation fails as a typed error
|
|
34
|
+
* here rather than as a raw AWS ValidationException on the write.
|
|
35
|
+
*
|
|
36
|
+
* Partition-key identifiers: `thread_id` and `sessionId`.
|
|
37
|
+
*/
|
|
38
|
+
exports.MAX_PARTITION_ID_BYTES = 1024;
|
|
39
|
+
/**
|
|
40
|
+
* Sort-key segments: `checkpoint_ns`, `checkpoint_id`, `taskId`, a pending-write
|
|
41
|
+
* channel, a store namespace element and a store `key`.
|
|
42
|
+
*/
|
|
43
|
+
exports.MAX_KEY_SEGMENT_BYTES = 256;
|
|
44
|
+
/**
|
|
45
|
+
* DynamoDB cap on a whole sort key; composed keys are checked against it too.
|
|
46
|
+
*
|
|
47
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html
|
|
48
|
+
*/
|
|
49
|
+
exports.MAX_SORT_KEY_BYTES = 1024;
|
|
50
|
+
/**
|
|
51
|
+
* The separator between the segments of every key this package composes. No
|
|
52
|
+
* caller-supplied identifier may contain it (the parsers refuse it), which is
|
|
53
|
+
* what lets a key be read back into its parts and matched by prefix (record 2).
|
|
54
|
+
*/
|
|
55
|
+
exports.KEY_SEPARATOR = '#';
|
|
56
|
+
/**
|
|
57
|
+
* The tag each adapter's partition keys open with. The three differ in their
|
|
58
|
+
* first character, so no two adapters' partitions can collide on a shared
|
|
59
|
+
* table, whatever identifiers their callers reuse (record 2).
|
|
60
|
+
*/
|
|
61
|
+
exports.ADAPTER_TAGS = { checkpointer: 'CHKPT', store: 'STORE', history: 'HIST' };
|
|
62
|
+
/**
|
|
63
|
+
* The key of a row already in hand.
|
|
64
|
+
*
|
|
65
|
+
* Accepts: `row` — an item read from, or about to be written to, the table.
|
|
66
|
+
*
|
|
67
|
+
* Returns: its `PK` and `SK`, and nothing else, so it can be sent as a `Key`
|
|
68
|
+
* without the rest of the item.
|
|
69
|
+
*
|
|
70
|
+
* Throws: nothing.
|
|
71
|
+
*/
|
|
72
|
+
function rowKeyOf(row) {
|
|
73
|
+
return { PK: row.PK, SK: row.SK };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The format version this package stamps on every row it writes.
|
|
77
|
+
*
|
|
78
|
+
* Before it existed, "written by an older version" was inferred from a missing
|
|
79
|
+
* attribute — `rev`, `occurrence`, `writeGroup`, `storedChannels`. That
|
|
80
|
+
* inference is unreadable to a maintainer and it is not even expressible: a
|
|
81
|
+
* lookup cannot tell an attribute that is *absent* from one that is *present
|
|
82
|
+
* and undefined*, which reversed first-write-wins for pending writes across an
|
|
83
|
+
* upgrade. A row states its own version instead.
|
|
84
|
+
*/
|
|
85
|
+
exports.ROW_FORMAT_VERSION = 1;
|
|
86
|
+
/** The highest version this package knows how to read. */
|
|
87
|
+
exports.SUPPORTED_ROW_FORMAT_VERSION = 1;
|
|
88
|
+
/**
|
|
89
|
+
* A row's format version.
|
|
90
|
+
*
|
|
91
|
+
* Accepts: `row` — any row. One carrying no numeric `v` predates the attribute.
|
|
92
|
+
*
|
|
93
|
+
* Returns: the stamped version, or `0` for a row without one — the version
|
|
94
|
+
* whose rules applied when it was written.
|
|
95
|
+
*
|
|
96
|
+
* Throws: nothing.
|
|
97
|
+
*/
|
|
98
|
+
function rowVersionOf(row) {
|
|
99
|
+
return typeof row.v === 'number' ? row.v : 0;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Refuse a row written by a newer version of this package.
|
|
103
|
+
*
|
|
104
|
+
* Accepts: `row` — any row; one at or below
|
|
105
|
+
* {@link SUPPORTED_ROW_FORMAT_VERSION} is accepted, which includes every row
|
|
106
|
+
* written before the attribute existed. `what` — the row kind, named in the
|
|
107
|
+
* message.
|
|
108
|
+
*
|
|
109
|
+
* Returns: nothing: `row` is kept under its declared type, and this checks
|
|
110
|
+
* it.
|
|
111
|
+
*
|
|
112
|
+
* Throws: `FORMAT_UNSUPPORTED` naming the field `v`. Guessing at a shape this
|
|
113
|
+
* version does not know is how a reader returns a checkpoint with silently
|
|
114
|
+
* missing state, so the caller is told to upgrade instead.
|
|
115
|
+
*/
|
|
116
|
+
function assertReadableRow(row, what) {
|
|
117
|
+
const version = rowVersionOf(row);
|
|
118
|
+
if (version <= exports.SUPPORTED_ROW_FORMAT_VERSION)
|
|
119
|
+
return;
|
|
120
|
+
throw new base_error_1.DynamoDBLangGraphError(`this ${what} row was written in format version ${version}; this version of the library ` +
|
|
121
|
+
`reads up to ${exports.SUPPORTED_ROW_FORMAT_VERSION} — upgrade to read it`, error_code_1.ErrorCode.FORMAT_UNSUPPORTED, { field: 'v' });
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The item with this release's format version stamped on it.
|
|
125
|
+
*
|
|
126
|
+
* Accepts: `item` — any item about to be written; an existing `v` is replaced.
|
|
127
|
+
*
|
|
128
|
+
* Returns: a copy carrying `v`, leaving the input untouched.
|
|
129
|
+
*
|
|
130
|
+
* Throws: nothing.
|
|
131
|
+
*/
|
|
132
|
+
function withRowVersion(item) {
|
|
133
|
+
return { ...item, v: exports.ROW_FORMAT_VERSION };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Whether a row has reached its TTL.
|
|
137
|
+
*
|
|
138
|
+
* Accepts: `row` — any row; one without a `ttl` attribute never expires.
|
|
139
|
+
* `nowSeconds` — the current epoch **second**, the unit the attribute uses.
|
|
140
|
+
*
|
|
141
|
+
* Returns: true when `ttl <= nowSeconds`, so the expiry instant itself counts
|
|
142
|
+
* as expired.
|
|
143
|
+
*
|
|
144
|
+
* Throws: nothing.
|
|
145
|
+
*
|
|
146
|
+
* Guarantees: an expired row is absent to every reader even while DynamoDB's
|
|
147
|
+
* own sweep lags, which it may by up to 48 hours
|
|
148
|
+
* (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html).
|
|
149
|
+
*/
|
|
150
|
+
function isExpiredRow(row, nowSeconds) {
|
|
151
|
+
return row.ttl !== undefined && row.ttl <= nowSeconds;
|
|
152
|
+
}
|
|
153
|
+
const TTL_FILTER = 'attribute_not_exists(#ttl) OR #ttl > :now';
|
|
154
|
+
/**
|
|
155
|
+
* The same query with expired rows filtered out server-side.
|
|
156
|
+
*
|
|
157
|
+
* Accepts: `params` — a Query or Scan input, with or without a
|
|
158
|
+
* `FilterExpression`; an existing one is ANDed rather than replaced.
|
|
159
|
+
* `nowSeconds` — the epoch second to compare against.
|
|
160
|
+
*
|
|
161
|
+
* Returns: a copy carrying the added filter and the `#ttl` / `:now` aliases. No
|
|
162
|
+
* other call site in this package uses those two names, so the merge cannot
|
|
163
|
+
* shadow a caller's own alias.
|
|
164
|
+
*
|
|
165
|
+
* Throws: nothing.
|
|
166
|
+
*
|
|
167
|
+
* Guarantees: this trims transfer only. It never replaces the in-process
|
|
168
|
+
* {@link isExpiredRow} check, because the query is built and its rows are read
|
|
169
|
+
* at two different instants, and DynamoDB applies a filter *after* `Limit`.
|
|
170
|
+
*/
|
|
171
|
+
function withoutExpired(params, nowSeconds) {
|
|
172
|
+
return {
|
|
173
|
+
...params,
|
|
174
|
+
FilterExpression: params.FilterExpression
|
|
175
|
+
? `(${params.FilterExpression}) AND (${TTL_FILTER})`
|
|
176
|
+
: TTL_FILTER,
|
|
177
|
+
ExpressionAttributeNames: { ...params.ExpressionAttributeNames, '#ttl': 'ttl' },
|
|
178
|
+
ExpressionAttributeValues: { ...params.ExpressionAttributeValues, ':now': nowSeconds },
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Order two DynamoDB string sort keys the way the server orders them.
|
|
183
|
+
*
|
|
184
|
+
* DynamoDB compares a string key by the bytes of its UTF-8 encoding.
|
|
185
|
+
* JavaScript's `<` and `>` compare UTF-16 code units, and the two disagree
|
|
186
|
+
* wherever an astral character meets one in U+E000-U+FFFF: an astral character
|
|
187
|
+
* is a surrogate pair starting at U+D800, so `'A\u{1F600}' < 'A!'` in
|
|
188
|
+
* JavaScript and the reverse on the server. Any listing that merges or bounds
|
|
189
|
+
* rows in memory and then resumes with a key condition has to use this order,
|
|
190
|
+
* or the boundary it draws is not the boundary the next query reads from, and
|
|
191
|
+
* a row is skipped or handed out twice.
|
|
192
|
+
*
|
|
193
|
+
* The comparison is written on the bytes rather than on code points. The two
|
|
194
|
+
* agree — UTF-8 was designed so that byte order is code-point order — but the
|
|
195
|
+
* bytes are what DynamoDB documents itself as comparing, so the code states the
|
|
196
|
+
* server's rule instead of a property that happens to coincide with it.
|
|
197
|
+
*
|
|
198
|
+
* Accepts: `left`, `right` — any two strings; well-formedness is not required,
|
|
199
|
+
* since an unpaired surrogate encodes to the replacement character's bytes and
|
|
200
|
+
* so still compares deterministically.
|
|
201
|
+
*
|
|
202
|
+
* Returns: a negative number when `left` sorts before `right`, a positive one
|
|
203
|
+
* when it sorts after, and `0` when the two encode to the same bytes.
|
|
204
|
+
*
|
|
205
|
+
* Throws: nothing.
|
|
206
|
+
*/
|
|
207
|
+
function compareSortKeys(left, right) {
|
|
208
|
+
return Buffer.compare(Buffer.from(left, 'utf8'), Buffer.from(right, 'utf8'));
|
|
209
|
+
}
|
|
@@ -1,22 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides the one error class and what counts as an error at all.
|
|
3
|
+
*
|
|
4
|
+
* Every failure this package raises is a `DynamoDBLangGraphError` told apart by
|
|
5
|
+
* its code (record 19), recognisable across copies of the package by a brand
|
|
6
|
+
* rather than by `instanceof`; and whatever a caller's code or a dependency
|
|
7
|
+
* throws — a string, `undefined`, an object — is turned into an `Error` before
|
|
8
|
+
* anything reads it.
|
|
9
|
+
*/
|
|
10
|
+
import type { WriteRequest } from '../dynamodb/client';
|
|
1
11
|
import { ErrorCode } from './error-code';
|
|
2
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Structured, log-safe context attached to every library error. Identifiers
|
|
14
|
+
* and counts only — never a payload or a credential.
|
|
15
|
+
*/
|
|
3
16
|
export interface ErrorContext {
|
|
17
|
+
/** The DynamoDB table the operation targeted, when known. */
|
|
4
18
|
tableName?: string;
|
|
19
|
+
/** The public operation (`saver.put`, `store.batch`, …) or internal step that failed. */
|
|
5
20
|
operation?: string;
|
|
21
|
+
/** The option, argument or cap that failed validation or was exceeded. */
|
|
22
|
+
field?: string;
|
|
23
|
+
/** The S3 object key involved, for offload failures. */
|
|
6
24
|
key?: string;
|
|
25
|
+
/** Attempts made before a retry budget was exhausted. */
|
|
7
26
|
attempts?: number;
|
|
27
|
+
/** The thread a checkpointer failure belongs to. */
|
|
28
|
+
threadId?: string;
|
|
29
|
+
/** The checkpoint a checkpointer failure names. */
|
|
30
|
+
checkpointId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The AWS exception name of the failure underneath, when that failure was
|
|
33
|
+
* AWS-shaped (it carried the SDK's `$metadata`, or a name the classifier
|
|
34
|
+
* knows or that ends in `Exception`). Lifted off `cause.name` so a log line
|
|
35
|
+
* or an alert can branch on it without walking `cause`.
|
|
36
|
+
*/
|
|
37
|
+
awsErrorName?: string;
|
|
38
|
+
/** The AWS request id (`cause.$metadata.requestId`), which AWS Support asks for. */
|
|
39
|
+
requestId?: string;
|
|
40
|
+
/** The HTTP status of the failed AWS response (`cause.$metadata.httpStatusCode`). */
|
|
41
|
+
httpStatusCode?: number;
|
|
42
|
+
}
|
|
43
|
+
/** What one `BatchWriteItem` drain left behind when it ran out of rounds. */
|
|
44
|
+
export interface BatchDrainDetails {
|
|
45
|
+
readonly kind: 'drain';
|
|
46
|
+
/** Writes DynamoDB acknowledged; they persist, since there is no rollback. */
|
|
47
|
+
readonly succeededCount: number;
|
|
48
|
+
/** The requests DynamoDB did not acknowledge, verbatim, so they can be re-submitted. */
|
|
49
|
+
readonly unprocessed: readonly WriteRequest[];
|
|
50
|
+
/** `UnprocessedItems` rounds spent. */
|
|
51
|
+
readonly retries: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The tally of a pass that attempted every chunk (`unit: 'chunk'`, 25-row
|
|
55
|
+
* `BatchWriteItem` chunks) or every row (`unit: 'row'`, one conditional delete
|
|
56
|
+
* per row) before reporting.
|
|
57
|
+
*/
|
|
58
|
+
export interface BatchPassDetails {
|
|
59
|
+
readonly kind: 'pass';
|
|
60
|
+
readonly unit: 'chunk' | 'row';
|
|
61
|
+
readonly succeededChunks: number;
|
|
62
|
+
readonly totalChunks: number;
|
|
63
|
+
/** Each failing chunk's or row's own error. */
|
|
64
|
+
readonly failedChunks: readonly Error[];
|
|
65
|
+
/** Individual writes confirmed persisted across the whole pass. */
|
|
66
|
+
readonly succeededCount: number;
|
|
67
|
+
}
|
|
68
|
+
/** What a `BATCH_WRITE_INCOMPLETE` error reports: one drain, or a whole pass. */
|
|
69
|
+
export type BatchWriteIncompleteDetails = BatchDrainDetails | BatchPassDetails;
|
|
70
|
+
/** What a `COMPENSATION_FAILED` error reports besides its trigger, which is `cause`. */
|
|
71
|
+
export interface CompensationFailedDetails {
|
|
72
|
+
/** Why the rollback itself could not finish; itself often a `BATCH_WRITE_INCOMPLETE`. */
|
|
73
|
+
readonly rollbackError: Error;
|
|
74
|
+
}
|
|
75
|
+
/** The codes that carry details, and the shape each one carries. */
|
|
76
|
+
export interface ErrorDetailsByCode {
|
|
77
|
+
[ErrorCode.BATCH_WRITE_INCOMPLETE]: BatchWriteIncompleteDetails;
|
|
78
|
+
[ErrorCode.COMPENSATION_FAILED]: CompensationFailedDetails;
|
|
8
79
|
}
|
|
80
|
+
/** The details a code carries; `undefined` for every code not in {@link ErrorDetailsByCode}. */
|
|
81
|
+
export type ErrorDetailsFor<C extends ErrorCode> = C extends keyof ErrorDetailsByCode ? ErrorDetailsByCode[C] : undefined;
|
|
9
82
|
/**
|
|
10
83
|
* Base class for every error this library throws. Carries a branchable
|
|
11
|
-
* {@link ErrorCode}, structured {@link ErrorContext},
|
|
12
|
-
*
|
|
13
|
-
* than `instanceof`,
|
|
84
|
+
* {@link ErrorCode}, structured {@link ErrorContext}, code-specific
|
|
85
|
+
* {@link details}, and a native `cause` chain. Detected via
|
|
86
|
+
* {@link isDynamoDBLangGraphError} (a symbol brand) rather than `instanceof`,
|
|
87
|
+
* which is banned repo-wide.
|
|
14
88
|
*/
|
|
15
|
-
export declare class
|
|
16
|
-
readonly code:
|
|
89
|
+
export declare class DynamoDBLangGraphError<C extends ErrorCode = ErrorCode> extends Error {
|
|
90
|
+
readonly code: C;
|
|
17
91
|
readonly context: ErrorContext;
|
|
18
|
-
|
|
92
|
+
/** Declared, not emitted: a code without details leaves no `undefined`-valued own property. */
|
|
93
|
+
readonly details: ErrorDetailsFor<C>;
|
|
94
|
+
/**
|
|
95
|
+
* Accepts: `message` — already redacted by whoever composed it, since it reaches
|
|
96
|
+
* `err.message`, which an application may print without a redacting logger.
|
|
97
|
+
* `code` — the code this error branches on. `context` — identifiers and counts
|
|
98
|
+
* only, never a payload or a credential. It is **copied**, so a caller that
|
|
99
|
+
* reuses one builder object cannot rewrite the context of an error already in
|
|
100
|
+
* flight; `null` reads as an absent one. `cause` — the failure below this one,
|
|
101
|
+
* kept as the native `cause` chain. `details` — the code-specific record
|
|
102
|
+
* {@link ErrorDetailsByCode} names, copied like `context`. The parameter is
|
|
103
|
+
* optional for every code, including the two whose `details` property is
|
|
104
|
+
* typed as always present (`BATCH_WRITE_INCOMPLETE`, `COMPENSATION_FAILED`):
|
|
105
|
+
* nothing at compile time stops a direct `new` from leaving it out, and an
|
|
106
|
+
* error built that way has no `details` at runtime whatever its type says.
|
|
107
|
+
* Inside this package those two codes are only ever built by the factories
|
|
108
|
+
* that always pass them.
|
|
109
|
+
*
|
|
110
|
+
* Returns: the error, branded so {@link isDynamoDBLangGraphError} recognises it
|
|
111
|
+
* across realms and across two copies of this package. The brand is
|
|
112
|
+
* non-enumerable, so it never reaches a log or a JSON serialization.
|
|
113
|
+
*
|
|
114
|
+
* Throws: nothing; building an error may not fail.
|
|
115
|
+
*/
|
|
116
|
+
constructor(message: string, code: C, context?: ErrorContext, cause?: Error, details?: ErrorDetailsFor<C>);
|
|
19
117
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Every library error, as a union discriminated by `code`: comparing `code`
|
|
120
|
+
* narrows `details` to the shape that code carries.
|
|
121
|
+
*/
|
|
122
|
+
export type AnyDynamoDBLangGraphError = {
|
|
123
|
+
[C in ErrorCode]: DynamoDBLangGraphError<C>;
|
|
124
|
+
}[ErrorCode];
|
|
125
|
+
/**
|
|
126
|
+
* Whether `value` is one of this library's errors.
|
|
127
|
+
*
|
|
128
|
+
* Accepts: any error, from any realm or any copy of this package — and, since
|
|
129
|
+
* the documented place to call this is inside a `catch`, any other value a
|
|
130
|
+
* `throw` can produce: `null`, `undefined`, a string, a number, a symbol.
|
|
131
|
+
*
|
|
132
|
+
* Returns: whether it carries the brand, narrowed to the union discriminated by
|
|
133
|
+
* `code`. A symbol registered by name, not `instanceof`: two copies of this
|
|
134
|
+
* package in one dependency tree produce two classes but one symbol, and an
|
|
135
|
+
* error crossing a realm boundary keeps its properties while losing its
|
|
136
|
+
* prototype. Anything that cannot carry a property answers `false`. Earlier
|
|
137
|
+
* releases set the same brand, so an older copy of this package installed
|
|
138
|
+
* beside this one has its errors recognised too — in that release's shape: no
|
|
139
|
+
* `details`, the counts as flat properties, and possibly a code this union
|
|
140
|
+
* does not list (`UPSTREAM`).
|
|
141
|
+
*
|
|
142
|
+
* Throws: nothing. The `in` operator raises a `TypeError` on a non-object, and
|
|
143
|
+
* a guard that throws inside the `catch` it was called from would replace the
|
|
144
|
+
* failure the caller is reporting with one of its own.
|
|
145
|
+
*/
|
|
146
|
+
export declare function isDynamoDBLangGraphError(value: Error): value is AnyDynamoDBLangGraphError;
|
|
147
|
+
/**
|
|
148
|
+
* Whether `value` is one of this library's errors carrying `code`.
|
|
149
|
+
*
|
|
150
|
+
* Accepts: anything a `catch` can bind. `code` — the code to test for.
|
|
151
|
+
*
|
|
152
|
+
* Returns: `true` only for a branded error whose `code` is `code`, narrowed so
|
|
153
|
+
* its `details` are typed. An unbranded object that merely carries a `code`
|
|
154
|
+
* property is not one: recognition is by brand and code together, never by a
|
|
155
|
+
* name or a shape.
|
|
156
|
+
*
|
|
157
|
+
* Throws: nothing, for any value.
|
|
158
|
+
*/
|
|
159
|
+
export declare function hasErrorCode<C extends ErrorCode>(value: Error, code: C): value is DynamoDBLangGraphError<C>;
|
|
160
|
+
/**
|
|
161
|
+
* What a log line calls a failure.
|
|
162
|
+
*
|
|
163
|
+
* Accepts: any error a `catch` bound.
|
|
164
|
+
*
|
|
165
|
+
* Returns: the `code` of one of this library's errors, and the `name` of any
|
|
166
|
+
* other. Every library error shares one name, so the name alone would log
|
|
167
|
+
* `DynamoDBLangGraphError` for a refused input and a spent retry budget alike;
|
|
168
|
+
* the code is what tells them apart, and like a name it is an identifier, never
|
|
169
|
+
* a payload.
|
|
170
|
+
*
|
|
171
|
+
* Throws: nothing for an error. A value that cannot carry a property raises
|
|
172
|
+
* the `TypeError` reading its `name` raises, as reading it directly would.
|
|
173
|
+
*/
|
|
174
|
+
export declare function failureLabel(error: Error): string;
|
|
175
|
+
/**
|
|
176
|
+
* A caught value as an `Error`.
|
|
177
|
+
*
|
|
178
|
+
* Kept in this module rather than in `boundary.ts`, which otherwise reads as
|
|
179
|
+
* its natural home: `shared/logging/secret-patterns.ts` calls this to
|
|
180
|
+
* normalise whatever a `catch` bound before redacting it, and `boundary.ts`
|
|
181
|
+
* itself calls `redactedMessage` while building the error it wraps a foreign
|
|
182
|
+
* failure into. Both edges are real, so the two modules cannot import each
|
|
183
|
+
* other without a cycle; this module depends on neither.
|
|
184
|
+
*
|
|
185
|
+
* Accepts: `value` — declared `Error` because callers narrow a catch clause
|
|
186
|
+
* with `toError(error as Error)`, but anything can be thrown in JavaScript:
|
|
187
|
+
* a string, `undefined`, a plain object, a `BigInt`, a symbol.
|
|
188
|
+
*
|
|
189
|
+
* Returns: the value itself when it is error-shaped — an object carrying a
|
|
190
|
+
* string `message`, which keeps an SDK error's own fields and `cause` intact;
|
|
191
|
+
* otherwise a fresh `Error` describing what was thrown.
|
|
192
|
+
*
|
|
193
|
+
* Throws: **nothing**. This runs inside `catch` blocks, so a throw here would
|
|
194
|
+
* discard the failure being reported and replace it with its own.
|
|
195
|
+
*/
|
|
196
|
+
export declare function toError(value: Error): Error;
|
|
@@ -1,28 +1,174 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides the one error class and what counts as an error at all.
|
|
4
|
+
*
|
|
5
|
+
* Every failure this package raises is a `DynamoDBLangGraphError` told apart by
|
|
6
|
+
* its code (record 19), recognisable across copies of the package by a brand
|
|
7
|
+
* rather than by `instanceof`; and whatever a caller's code or a dependency
|
|
8
|
+
* throws — a string, `undefined`, an object — is turned into an `Error` before
|
|
9
|
+
* anything reads it.
|
|
10
|
+
*/
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
12
|
+
exports.DynamoDBLangGraphError = void 0;
|
|
13
|
+
exports.isDynamoDBLangGraphError = isDynamoDBLangGraphError;
|
|
14
|
+
exports.hasErrorCode = hasErrorCode;
|
|
15
|
+
exports.failureLabel = failureLabel;
|
|
16
|
+
exports.toError = toError;
|
|
17
|
+
const error_code_1 = require("./error-code");
|
|
5
18
|
const ERROR_BRAND = Symbol.for('@farukada/aws-langgraph-dynamodb-ts/error');
|
|
19
|
+
/**
|
|
20
|
+
* A shallow copy of `details` with every array copied too, so a caller reusing
|
|
21
|
+
* its request buffer or failure list cannot rewrite what the error reported.
|
|
22
|
+
* Anything that is not an object is returned as it is: building an error may
|
|
23
|
+
* not fail.
|
|
24
|
+
*/
|
|
25
|
+
function copyDetails(details) {
|
|
26
|
+
if (details === null || typeof details !== 'object')
|
|
27
|
+
return details;
|
|
28
|
+
return Object.fromEntries(Object.entries(details).map(([key, value]) => [key, Array.isArray(value) ? [...value] : value]));
|
|
29
|
+
}
|
|
6
30
|
/**
|
|
7
31
|
* Base class for every error this library throws. Carries a branchable
|
|
8
|
-
* {@link ErrorCode}, structured {@link ErrorContext},
|
|
9
|
-
*
|
|
10
|
-
* than `instanceof`,
|
|
32
|
+
* {@link ErrorCode}, structured {@link ErrorContext}, code-specific
|
|
33
|
+
* {@link details}, and a native `cause` chain. Detected via
|
|
34
|
+
* {@link isDynamoDBLangGraphError} (a symbol brand) rather than `instanceof`,
|
|
35
|
+
* which is banned repo-wide.
|
|
11
36
|
*/
|
|
12
|
-
class
|
|
37
|
+
class DynamoDBLangGraphError extends Error {
|
|
13
38
|
code;
|
|
14
39
|
context;
|
|
15
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Accepts: `message` — already redacted by whoever composed it, since it reaches
|
|
42
|
+
* `err.message`, which an application may print without a redacting logger.
|
|
43
|
+
* `code` — the code this error branches on. `context` — identifiers and counts
|
|
44
|
+
* only, never a payload or a credential. It is **copied**, so a caller that
|
|
45
|
+
* reuses one builder object cannot rewrite the context of an error already in
|
|
46
|
+
* flight; `null` reads as an absent one. `cause` — the failure below this one,
|
|
47
|
+
* kept as the native `cause` chain. `details` — the code-specific record
|
|
48
|
+
* {@link ErrorDetailsByCode} names, copied like `context`. The parameter is
|
|
49
|
+
* optional for every code, including the two whose `details` property is
|
|
50
|
+
* typed as always present (`BATCH_WRITE_INCOMPLETE`, `COMPENSATION_FAILED`):
|
|
51
|
+
* nothing at compile time stops a direct `new` from leaving it out, and an
|
|
52
|
+
* error built that way has no `details` at runtime whatever its type says.
|
|
53
|
+
* Inside this package those two codes are only ever built by the factories
|
|
54
|
+
* that always pass them.
|
|
55
|
+
*
|
|
56
|
+
* Returns: the error, branded so {@link isDynamoDBLangGraphError} recognises it
|
|
57
|
+
* across realms and across two copies of this package. The brand is
|
|
58
|
+
* non-enumerable, so it never reaches a log or a JSON serialization.
|
|
59
|
+
*
|
|
60
|
+
* Throws: nothing; building an error may not fail.
|
|
61
|
+
*/
|
|
62
|
+
constructor(message, code, context = {}, cause, details) {
|
|
16
63
|
super(message, cause === undefined ? undefined : { cause });
|
|
17
|
-
this.name = '
|
|
64
|
+
this.name = 'DynamoDBLangGraphError';
|
|
18
65
|
this.code = code;
|
|
19
|
-
this.context = context;
|
|
66
|
+
this.context = { ...context };
|
|
67
|
+
if (details !== undefined)
|
|
68
|
+
this.details = copyDetails(details);
|
|
20
69
|
Object.defineProperty(this, ERROR_BRAND, { value: true, enumerable: false });
|
|
21
70
|
}
|
|
22
71
|
}
|
|
23
|
-
exports.
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
72
|
+
exports.DynamoDBLangGraphError = DynamoDBLangGraphError;
|
|
73
|
+
/**
|
|
74
|
+
* Whether `value` is one of this library's errors.
|
|
75
|
+
*
|
|
76
|
+
* Accepts: any error, from any realm or any copy of this package — and, since
|
|
77
|
+
* the documented place to call this is inside a `catch`, any other value a
|
|
78
|
+
* `throw` can produce: `null`, `undefined`, a string, a number, a symbol.
|
|
79
|
+
*
|
|
80
|
+
* Returns: whether it carries the brand, narrowed to the union discriminated by
|
|
81
|
+
* `code`. A symbol registered by name, not `instanceof`: two copies of this
|
|
82
|
+
* package in one dependency tree produce two classes but one symbol, and an
|
|
83
|
+
* error crossing a realm boundary keeps its properties while losing its
|
|
84
|
+
* prototype. Anything that cannot carry a property answers `false`. Earlier
|
|
85
|
+
* releases set the same brand, so an older copy of this package installed
|
|
86
|
+
* beside this one has its errors recognised too — in that release's shape: no
|
|
87
|
+
* `details`, the counts as flat properties, and possibly a code this union
|
|
88
|
+
* does not list (`UPSTREAM`).
|
|
89
|
+
*
|
|
90
|
+
* Throws: nothing. The `in` operator raises a `TypeError` on a non-object, and
|
|
91
|
+
* a guard that throws inside the `catch` it was called from would replace the
|
|
92
|
+
* failure the caller is reporting with one of its own.
|
|
93
|
+
*/
|
|
94
|
+
function isDynamoDBLangGraphError(value) {
|
|
95
|
+
return typeof value === 'object' && value !== null && ERROR_BRAND in value;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether `value` is one of this library's errors carrying `code`.
|
|
99
|
+
*
|
|
100
|
+
* Accepts: anything a `catch` can bind. `code` — the code to test for.
|
|
101
|
+
*
|
|
102
|
+
* Returns: `true` only for a branded error whose `code` is `code`, narrowed so
|
|
103
|
+
* its `details` are typed. An unbranded object that merely carries a `code`
|
|
104
|
+
* property is not one: recognition is by brand and code together, never by a
|
|
105
|
+
* name or a shape.
|
|
106
|
+
*
|
|
107
|
+
* Throws: nothing, for any value.
|
|
108
|
+
*/
|
|
109
|
+
function hasErrorCode(value, code) {
|
|
110
|
+
return isDynamoDBLangGraphError(value) && value.code === code;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* What a log line calls a failure.
|
|
114
|
+
*
|
|
115
|
+
* Accepts: any error a `catch` bound.
|
|
116
|
+
*
|
|
117
|
+
* Returns: the `code` of one of this library's errors, and the `name` of any
|
|
118
|
+
* other. Every library error shares one name, so the name alone would log
|
|
119
|
+
* `DynamoDBLangGraphError` for a refused input and a spent retry budget alike;
|
|
120
|
+
* the code is what tells them apart, and like a name it is an identifier, never
|
|
121
|
+
* a payload.
|
|
122
|
+
*
|
|
123
|
+
* Throws: nothing for an error. A value that cannot carry a property raises
|
|
124
|
+
* the `TypeError` reading its `name` raises, as reading it directly would.
|
|
125
|
+
*/
|
|
126
|
+
function failureLabel(error) {
|
|
127
|
+
return isDynamoDBLangGraphError(error) ? error.code : error.name;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A description of a thrown value that is not an `Error`, for its message.
|
|
131
|
+
*
|
|
132
|
+
* `JSON.stringify` is the best available rendering and it throws on a circular
|
|
133
|
+
* structure and on a `BigInt`, so it is guarded: this runs inside a `catch`,
|
|
134
|
+
* where throwing would replace the failure the caller is trying to report.
|
|
135
|
+
*/
|
|
136
|
+
function describeThrown(value) {
|
|
137
|
+
if (typeof value === 'string')
|
|
138
|
+
return value;
|
|
139
|
+
if (value === undefined || value === null)
|
|
140
|
+
return `${String(value)} was thrown`;
|
|
141
|
+
try {
|
|
142
|
+
return JSON.stringify(value) ?? `a ${typeof value} value was thrown`;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return `an unserializable ${typeof value} value was thrown`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A caught value as an `Error`.
|
|
150
|
+
*
|
|
151
|
+
* Kept in this module rather than in `boundary.ts`, which otherwise reads as
|
|
152
|
+
* its natural home: `shared/logging/secret-patterns.ts` calls this to
|
|
153
|
+
* normalise whatever a `catch` bound before redacting it, and `boundary.ts`
|
|
154
|
+
* itself calls `redactedMessage` while building the error it wraps a foreign
|
|
155
|
+
* failure into. Both edges are real, so the two modules cannot import each
|
|
156
|
+
* other without a cycle; this module depends on neither.
|
|
157
|
+
*
|
|
158
|
+
* Accepts: `value` — declared `Error` because callers narrow a catch clause
|
|
159
|
+
* with `toError(error as Error)`, but anything can be thrown in JavaScript:
|
|
160
|
+
* a string, `undefined`, a plain object, a `BigInt`, a symbol.
|
|
161
|
+
*
|
|
162
|
+
* Returns: the value itself when it is error-shaped — an object carrying a
|
|
163
|
+
* string `message`, which keeps an SDK error's own fields and `cause` intact;
|
|
164
|
+
* otherwise a fresh `Error` describing what was thrown.
|
|
165
|
+
*
|
|
166
|
+
* Throws: **nothing**. This runs inside `catch` blocks, so a throw here would
|
|
167
|
+
* discard the failure being reported and replace it with its own.
|
|
168
|
+
*/
|
|
169
|
+
function toError(value) {
|
|
170
|
+
if (value !== null && typeof value === 'object' && typeof value.message === 'string') {
|
|
171
|
+
return value;
|
|
172
|
+
}
|
|
173
|
+
return new Error(describeThrown(value));
|
|
27
174
|
}
|
|
28
|
-
//# sourceMappingURL=base-error.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides what crosses the public boundary.
|
|
3
|
+
*
|
|
4
|
+
* Only this package's own error leaves a public method (record 13): an error of
|
|
5
|
+
* its own passes through with the operation named, and anything else — an SDK
|
|
6
|
+
* failure, a caller's thrown value — is classified and wrapped with its cause
|
|
7
|
+
* attached and its text redacted.
|
|
8
|
+
*/
|
|
9
|
+
import { type AnyDynamoDBLangGraphError, DynamoDBLangGraphError } from './base-error';
|
|
10
|
+
/**
|
|
11
|
+
* Normalise anything escaping a public method into the library's error model.
|
|
12
|
+
*
|
|
13
|
+
* Accepts: anything a `catch` produced — an `Error`, or a value that is not one
|
|
14
|
+
* (`toError` settles that first).
|
|
15
|
+
*
|
|
16
|
+
* Returns: a branded library error unchanged, since its code was assigned
|
|
17
|
+
* closer to the failure and wins; anything else wrapped by
|
|
18
|
+
* {@link wrapForeignError}, with the code the classifier assigns.
|
|
19
|
+
*
|
|
20
|
+
* Throws: nothing. It runs inside a `catch`, where throwing would discard the
|
|
21
|
+
* failure being reported and replace it with its own.
|
|
22
|
+
*/
|
|
23
|
+
export declare function toPublicError(error: Error, operation: string): AnyDynamoDBLangGraphError;
|
|
24
|
+
/**
|
|
25
|
+
* Run a public operation so that every rejection is a library error.
|
|
26
|
+
*
|
|
27
|
+
* Accepts: `operation` — the public method's name, which the wrapped error
|
|
28
|
+
* carries. `fn` — the work.
|
|
29
|
+
*
|
|
30
|
+
* Returns: whatever `fn` resolves to, untouched.
|
|
31
|
+
*
|
|
32
|
+
* Throws: a library error, always. Applied once, at each adapter class method,
|
|
33
|
+
* so internal code can keep rethrowing SDK errors verbatim — the retry
|
|
34
|
+
* classifier depends on their shape, and wrapping them early would blind it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function guardPublic<T>(operation: string, fn: () => Promise<T>): Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* The same guard for a streaming result.
|
|
39
|
+
*
|
|
40
|
+
* Accepts: `operation` — the public method's name. `source` — the generator to
|
|
41
|
+
* relay.
|
|
42
|
+
*
|
|
43
|
+
* Returns: a generator yielding the source's items untouched. A consumer that
|
|
44
|
+
* stops early still closes the source, so an abandoned listing stops reading
|
|
45
|
+
* rather than paging on in the background.
|
|
46
|
+
*
|
|
47
|
+
* Throws: a library error, always — including for a failure raised
|
|
48
|
+
* mid-iteration, which is the case a `try` around the loop body would miss.
|
|
49
|
+
*/
|
|
50
|
+
export declare function guardPublicIterable<T>(operation: string, source: AsyncGenerator<T>): AsyncGenerator<T>;
|
|
51
|
+
/**
|
|
52
|
+
* A failure from below this library, as one of its errors.
|
|
53
|
+
*
|
|
54
|
+
* Accepts: `cause` — whatever a `catch` bound: an AWS SDK error, a transport
|
|
55
|
+
* error, or what a `VectorBackend`, `Embeddings`, `serde` or `MultiSessionHistory`
|
|
56
|
+
* threw. `operation` — the public method it surfaced through.
|
|
57
|
+
*
|
|
58
|
+
* Returns: an error whose code is {@link classifyAwsError}'s answer for
|
|
59
|
+
* {@link classifiableCause} of the normalised `cause` — so an AWS or network
|
|
60
|
+
* failure found down the cause chain still earns its own code rather than
|
|
61
|
+
* `UNEXPECTED_ERROR`. Its context names `operation` and — for whichever node
|
|
62
|
+
* was classified — `awsErrorName`, `requestId` and `httpStatusCode`. Its
|
|
63
|
+
* `cause` is the original, normalised through {@link toError}, kept whole
|
|
64
|
+
* regardless of which node down the chain supplied the code. The message
|
|
65
|
+
* quotes the cause's own name cut at the log cap and its own text redacted
|
|
66
|
+
* and cut at the relay cap, because `err.message` reaches applications that
|
|
67
|
+
* print it without a redacting logger.
|
|
68
|
+
*
|
|
69
|
+
* Throws: nothing, for any value.
|
|
70
|
+
*/
|
|
71
|
+
export declare function wrapForeignError(cause: Error, operation: string): DynamoDBLangGraphError;
|