@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,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides what a single read counts as absent, and how it outlives an overwrite.
|
|
4
|
+
*
|
|
5
|
+
* A get reads its row strongly consistently and answers `null` alike for a
|
|
6
|
+
* missing row, an expired one and a row this adapter does not own. When the
|
|
7
|
+
* object an offloaded row names is deleted between the row read and the
|
|
8
|
+
* download, one re-read settles whether the item was replaced, removed or
|
|
9
|
+
* truly lost. A caller gets an item or `null` and never sees the race.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getItem = getItem;
|
|
13
|
+
const clock_1 = require("../../shared/clock");
|
|
14
|
+
const codec_1 = require("../../shared/codec/codec");
|
|
15
|
+
const retry_1 = require("../../shared/dynamodb/retry");
|
|
16
|
+
const table_schema_1 = require("../../shared/dynamodb/table-schema");
|
|
17
|
+
const rows_1 = require("./rows");
|
|
18
|
+
/**
|
|
19
|
+
* Read the row strongly consistently and narrow it rather than cast. A
|
|
20
|
+
* foreign row sharing this key has no `namespace`, and one carrying a `value`
|
|
21
|
+
* PayloadDescriptor in the same shape a store item uses (a checkpointer WRITE
|
|
22
|
+
* row) would otherwise decode cleanly and be handed back as the caller's own
|
|
23
|
+
* value. The narrow is the whole-row one, so a row with no `createdAt` or
|
|
24
|
+
* `updatedAt` is refused here rather than decoded into an item whose
|
|
25
|
+
* timestamps are `Invalid Date`.
|
|
26
|
+
*/
|
|
27
|
+
async function readRow(context, namespace, key, signal) {
|
|
28
|
+
const result = await (0, retry_1.withDynamoDBRetry)((request) => context.client.get({
|
|
29
|
+
TableName: context.tableName,
|
|
30
|
+
Key: (0, rows_1.itemRowKey)({ namespace, key }),
|
|
31
|
+
ConsistentRead: true,
|
|
32
|
+
}, request), (0, retry_1.retryFor)(context, signal));
|
|
33
|
+
if (!result.Item)
|
|
34
|
+
return undefined;
|
|
35
|
+
const record = (0, rows_1.parseWholeStoreRow)(result.Item);
|
|
36
|
+
if (!record) {
|
|
37
|
+
context.logger.warn('store.get: ignored a row that is not a store item', {
|
|
38
|
+
partitionKey: (0, rows_1.partitionKey)(namespace),
|
|
39
|
+
sortKey: (0, rows_1.sortKey)(namespace, key),
|
|
40
|
+
});
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
// A row past its ttl is absent to every reader, however long DynamoDB's sweep lags.
|
|
44
|
+
return (0, table_schema_1.isExpiredRow)(record, (0, clock_1.nowSeconds)()) ? undefined : record;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* True when both records point at the same offloaded object.
|
|
48
|
+
*
|
|
49
|
+
* Only `read` is known to hold a descriptor: it is the row whose download just
|
|
50
|
+
* failed. `reread` is whatever the overwrite this recovery exists for left
|
|
51
|
+
* behind, which can be a `null` where the descriptor belongs, so it is tested
|
|
52
|
+
* for presence first. A row pointing at nothing is not pointing at the object
|
|
53
|
+
* this read lost, so it is decoded like any other replacement and answered with
|
|
54
|
+
* the coded error that names the descriptor — not with a property read that
|
|
55
|
+
* would replace the download's own failure with a bare `TypeError`.
|
|
56
|
+
*/
|
|
57
|
+
function sameObject(read, reread) {
|
|
58
|
+
const fresh = reread.value;
|
|
59
|
+
if (!fresh)
|
|
60
|
+
return false;
|
|
61
|
+
return (read.value.location === codec_1.PayloadLocation.S3 &&
|
|
62
|
+
fresh.location === codec_1.PayloadLocation.S3 &&
|
|
63
|
+
read.value.s3Key === fresh.s3Key);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retrieve a single item by namespace and key (strongly consistent), or null.
|
|
67
|
+
*
|
|
68
|
+
* An offloaded item can lose a race with a concurrent overwrite: between the
|
|
69
|
+
* row read and the S3 download the writer commits a new descriptor and deletes
|
|
70
|
+
* the object this read was about to fetch. That surfaces as `NoSuchKey`, and
|
|
71
|
+
* one strongly-consistent re-read settles it — the row now points at the new
|
|
72
|
+
* object (return that), is gone (null), or still points at the same missing
|
|
73
|
+
* object (a genuine loss, rethrown). A row the overwrite left with no
|
|
74
|
+
* descriptor at all is a replacement like any other: it is decoded, and refused
|
|
75
|
+
* by its own coded error. Any other download failure propagates.
|
|
76
|
+
*
|
|
77
|
+
* Accepts: `address` — parsed; no check is repeated here. `signal` — aborts
|
|
78
|
+
* the reads.
|
|
79
|
+
*
|
|
80
|
+
* Returns: the item, or `null` for one that does not exist, has expired, or
|
|
81
|
+
* whose key holds a row this adapter does not own — which includes a row whose
|
|
82
|
+
* `createdAt` or `updatedAt` is not the string this package writes there, since
|
|
83
|
+
* an item is reported with both. The answers are one on purpose: a caller
|
|
84
|
+
* cannot act on the difference, and reporting a foreign row would leak that a
|
|
85
|
+
* shared table holds one.
|
|
86
|
+
*
|
|
87
|
+
* Throws: `VALIDATION` naming — for a row whose descriptor is not one —
|
|
88
|
+
* `descriptor`; `FORMAT_UNSUPPORTED` for
|
|
89
|
+
* a row, or a payload, written by a newer version, which is *not* reported as
|
|
90
|
+
* absent — hiding an item that exists is worse than failing; `PAYLOAD_CORRUPT`
|
|
91
|
+
* or the download's own error for a payload that cannot be read; `ABORTED`
|
|
92
|
+
* when the signal fires.
|
|
93
|
+
*
|
|
94
|
+
* Guarantees: strongly consistent — an item just written is always seen, and
|
|
95
|
+
* the ttl is honoured here rather than waited for.
|
|
96
|
+
*/
|
|
97
|
+
async function getItem(context, address, signal) {
|
|
98
|
+
const { namespace, key } = address;
|
|
99
|
+
const record = await readRow(context, namespace, key, signal);
|
|
100
|
+
if (!record)
|
|
101
|
+
return null;
|
|
102
|
+
try {
|
|
103
|
+
return await (0, rows_1.readStoreItem)(context, record, signal);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (!(0, codec_1.isMissingObjectError)(error))
|
|
107
|
+
throw error;
|
|
108
|
+
const fresh = await readRow(context, namespace, key, signal);
|
|
109
|
+
if (!fresh)
|
|
110
|
+
return null;
|
|
111
|
+
if (sameObject(record, fresh))
|
|
112
|
+
throw error;
|
|
113
|
+
return (0, rows_1.readStoreItem)(context, fresh, signal);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides how an item's row is replaced or removed without stranding its S3
|
|
3
|
+
* object or deleting one a live row still names.
|
|
4
|
+
*
|
|
5
|
+
* A put with an offloader pins its write to the revision it observed and
|
|
6
|
+
* re-reads when a concurrent writer wins; once the budget is spent it
|
|
7
|
+
* overwrites and may leak one object to the lifecycle rule. A delete pins
|
|
8
|
+
* itself the same way. Either releases the payload it superseded only once its
|
|
9
|
+
* own write committed, and a write whose outcome was lost is read back before
|
|
10
|
+
* anything is released. Without an offloader there is no object to protect,
|
|
11
|
+
* and a put is a plain write.
|
|
12
|
+
*/
|
|
13
|
+
import { type WriteVerdict } from '../../shared/dynamodb/idempotent-write';
|
|
14
|
+
import type { StoreAddress } from './parse';
|
|
15
|
+
import { type ExistingRowMeta, type StoreItemRow } from './rows';
|
|
16
|
+
import type { StoreContext } from './setup';
|
|
17
|
+
/**
|
|
18
|
+
* Delete the item and, when a vector backend is configured, drop its vector.
|
|
19
|
+
*
|
|
20
|
+
* The row is read first, then removed inside a one-item `TransactWriteItems`
|
|
21
|
+
* conditioned on the revision that read observed. An unconditional delete
|
|
22
|
+
* erases a put that commits between the caller's call and the write — no lost
|
|
23
|
+
* acknowledgement needed, no S3 involved — and releases the object that put
|
|
24
|
+
* uploaded. The condition refuses that, and the request token makes a lost
|
|
25
|
+
* acknowledgement harmless: the replay is answered from DynamoDB's idempotency
|
|
26
|
+
* cache instead of removing whatever has arrived since.
|
|
27
|
+
*
|
|
28
|
+
* **A key with no row costs one read and sends no write at all**, which is the
|
|
29
|
+
* same race closed from the other side: there is nothing to pin, so a put that
|
|
30
|
+
* lands mid-call survives. The S3 release and the vector sync still run, since
|
|
31
|
+
* a key with no row can still have a stranded vector and clearing it is a
|
|
32
|
+
* repair path callers have today — and the vector sync goes through the same
|
|
33
|
+
* confirmation as every other path rather than letting the pre-read stand in
|
|
34
|
+
* for it, so the put that lands mid-call keeps its vector too.
|
|
35
|
+
*
|
|
36
|
+
* What a caller can and cannot tell apart:
|
|
37
|
+
*
|
|
38
|
+
* - **Compare-and-swap exhaustion resolves rather than throwing.** Three
|
|
39
|
+
* consecutive writers between a re-pin and its attempt leave the item in
|
|
40
|
+
* place, release nothing — correctly, a live row names the object — and emit
|
|
41
|
+
* one `warn`. Throwing instead would add a failure mode to an interleaving
|
|
42
|
+
* that succeeds today, which every caller deleting in a `finally` would have
|
|
43
|
+
* to handle.
|
|
44
|
+
* - **The vector is dropped only on a confirmation, and that window is
|
|
45
|
+
* narrowed rather than closed.** Immediately before the backend call — and
|
|
46
|
+
* above the S3 cleanup, so no round trip with its own retries sits inside the
|
|
47
|
+
* window — one strongly-consistent projected read asks whether the key holds
|
|
48
|
+
* a row now, and a row that is there keeps its vector and logs one `info`.
|
|
49
|
+
* That covers both interleavings that would otherwise erase a live item's vector: a
|
|
50
|
+
* put recreating the row this call removed, and the compare-and-swap above
|
|
51
|
+
* resolving with the row untouched. What is left is a put committing between
|
|
52
|
+
* that read and the backend call, two adjacent statements apart. Closing it
|
|
53
|
+
* needs a compare-and-swap **on the vector backend** — delete this vector
|
|
54
|
+
* only if it is still the one written at time T — which the `VectorBackend`
|
|
55
|
+
* contract cannot express and no implementation would be obliged to honour,
|
|
56
|
+
* so `reconcileVectorIndex` stays the named repair for it.
|
|
57
|
+
* - **A deadline cut and a spent budget are one error.** The transaction's
|
|
58
|
+
* budget is additionally bounded by `MAX_WRITE_LIFETIME_MS`, so a caller who
|
|
59
|
+
* configures a long retry policy can see the budget end there rather than at
|
|
60
|
+
* its own last attempt; both arrive as `RETRY_EXHAUSTED` and neither says
|
|
61
|
+
* which bound stopped it.
|
|
62
|
+
* - **The pre-read is a new way for this call to fail.** It issues no read
|
|
63
|
+
* today, so a delete of a key with *no row* can now fail where it always
|
|
64
|
+
* succeeded. Nothing has been written when it does: no row removed, no object
|
|
65
|
+
* released, no vector touched. The error types a caller sees are unchanged —
|
|
66
|
+
* `store.delete` already documents `RETRY_EXHAUSTED` — but "deleting an
|
|
67
|
+
* item that is not there is not an error" now describes the outcome rather
|
|
68
|
+
* than the round trip.
|
|
69
|
+
*
|
|
70
|
+
* Accepts: `address` — parsed; the namespace and key the cleanup is scoped and
|
|
71
|
+
* logged by, and the row's key is derived from it.
|
|
72
|
+
*
|
|
73
|
+
* Returns: nothing. The item is gone, was already gone, or — on
|
|
74
|
+
* compare-and-swap exhaustion — is still there and was left alone.
|
|
75
|
+
*
|
|
76
|
+
* Throws: whatever the pre-read throws; whatever the transaction throws other
|
|
77
|
+
* than a guard rejection, which is this call's own business; and
|
|
78
|
+
* `RETRY_EXHAUSTED` when the budget is spent and a read cannot confirm the
|
|
79
|
+
* row is gone. Three things about that list are worth saying rather than
|
|
80
|
+
* leaving to be inferred. The **pre-read** is why a delete of a key with no row
|
|
81
|
+
* can now fail at all, and nothing has been written when it does. A **guard
|
|
82
|
+
* rejection** is refused rather than raised: the row it names was replaced
|
|
83
|
+
* after this call observed it, so removing it would erase that put and release
|
|
84
|
+
* the object the put uploaded, and re-pinning on the row the rejection carried
|
|
85
|
+
* is strictly safer than either raising or proceeding. And **exhausting** those
|
|
86
|
+
* re-pins throws nothing either — it resolves with the item still there and one
|
|
87
|
+
* `warn`, so a caller that needs the item gone re-runs once the key is
|
|
88
|
+
* quiescent rather than catching anything.
|
|
89
|
+
*
|
|
90
|
+
* Guarantees: the object released is the **last observation's**, on every path
|
|
91
|
+
* that releases at all — the pre-read's when nothing re-pinned, the rejected
|
|
92
|
+
* row's when something did. It is never read back from the response, so by
|
|
93
|
+
* construction the object of a delete whose acknowledgement was lost is not
|
|
94
|
+
* leaked. Nothing is released while the outcome is unknown: only a
|
|
95
|
+
* confirmed absence or a confirmed delete licenses it. And the backend's
|
|
96
|
+
* `delete` is never reached without a confirmation immediately before it, on
|
|
97
|
+
* every path including the one whose key never had a row: one rule with no
|
|
98
|
+
* exception, because an exception on a repair-shaped path is where the erasure
|
|
99
|
+
* comes back unnoticed.
|
|
100
|
+
*/
|
|
101
|
+
export declare function deleteStoreItem(context: StoreContext, address: StoreAddress): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Put the record and clean up whichever side is now dead.
|
|
104
|
+
*
|
|
105
|
+
* The compare-and-swap path runs **only when an offloader is configured**:
|
|
106
|
+
* without one there is no S3 object to orphan, so a plain last-write-wins put
|
|
107
|
+
* stays correct and costs no extra write capacity (DynamoDB charges for a
|
|
108
|
+
* failed conditional write too). With one, the swap is what lets this call
|
|
109
|
+
* delete exactly the payload it superseded rather than a descriptor a racer may
|
|
110
|
+
* already have replaced.
|
|
111
|
+
*
|
|
112
|
+
* Every failure reaching the catch arrives after at least one put was issued —
|
|
113
|
+
* `putWithRevisionSwap` only re-reads from inside its own catch — so none of
|
|
114
|
+
* them proves a non-commit on its own: a put can commit server-side and lose
|
|
115
|
+
* its response, and a `ConditionalCheckFailedException` is as consistent with
|
|
116
|
+
* hitting the row this call just wrote as with a competitor's win. The row is
|
|
117
|
+
* therefore read back (`verifyWriteLanded`) before anything is deleted. Only a
|
|
118
|
+
* confirmed `'not-landed'` deletes this record's own object; a confirmed
|
|
119
|
+
* `'landed'` cleans up the previous object like the success path and swallows
|
|
120
|
+
* the error, and an `'unverified'` read deletes nothing and rethrows — leaking
|
|
121
|
+
* one object at worst rather than stranding a live row pointing at a deleted
|
|
122
|
+
* one. The verification compares the per-call `rev`, so an inline record is
|
|
123
|
+
* verified too: otherwise a lost acknowledgement of an inline overwrite would be
|
|
124
|
+
* reported as a failure while the previous offloaded object was never cleaned.
|
|
125
|
+
*
|
|
126
|
+
* Neither release reads the row again first. The record's object is uploaded
|
|
127
|
+
* under the record's own `rev`, which no other put uses, so no row another put
|
|
128
|
+
* commits names it; and the record names only that object, never the one it
|
|
129
|
+
* superseded.
|
|
130
|
+
*
|
|
131
|
+
* Accepts: `record` — the fully encoded row, its payload already uploaded if it
|
|
132
|
+
* was offloaded. `existing` — what the caller read before encoding.
|
|
133
|
+
*
|
|
134
|
+
* Returns: nothing. The row is committed and exactly one side's object, at
|
|
135
|
+
* most, has been released.
|
|
136
|
+
*
|
|
137
|
+
* Throws: whatever the write throws, unless the verification proves the write
|
|
138
|
+
* landed after all — in which case the error is swallowed and the cleanup runs
|
|
139
|
+
* as on the success path.
|
|
140
|
+
*
|
|
141
|
+
* Guarantees: this record's own object is released only after a read proves
|
|
142
|
+
* the write did not land, and a superseded object only after this record is
|
|
143
|
+
* committed. The failure modes are ordered by which is worse: a leaked object
|
|
144
|
+
* costs storage until the lifecycle rule reclaims it, while a row pointing at a
|
|
145
|
+
* deleted object is unreadable data, so every ambiguous case leaks instead of
|
|
146
|
+
* deletes.
|
|
147
|
+
*/
|
|
148
|
+
export declare function persistRow(context: StoreContext, record: StoreItemRow, existing: ExistingRowMeta): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Commit `record`, re-reading and retrying while another writer holds the row,
|
|
151
|
+
* and return the state this write actually superseded — the only descriptor
|
|
152
|
+
* safe to delete afterwards.
|
|
153
|
+
*
|
|
154
|
+
* Without the swap both racers read the same previous descriptor, both commit,
|
|
155
|
+
* and both delete it, orphaning the loser's own upload. Retrying against the
|
|
156
|
+
* *re-read* state is what makes each writer supersede exactly one payload.
|
|
157
|
+
*
|
|
158
|
+
* A rejection is not proof a competitor won: `withDynamoDBRetry` retries
|
|
159
|
+
* transient errors, so an attempt can commit server-side, its response can be
|
|
160
|
+
* lost, and the retried put can hit the row it just wrote and fail the same
|
|
161
|
+
* guard — indistinguishable from a competitor's win by the rejection alone.
|
|
162
|
+
* Each attempt's pinned observation is captured in `attempted` before the
|
|
163
|
+
* put, so that when a re-read finds the row already holding *this call's
|
|
164
|
+
* own* `rev`, the swap returns whatever `attempted` held — never this
|
|
165
|
+
* record's own just-committed value, which would strand the live row
|
|
166
|
+
* pointing at a deleted object. That comparison is guarded on `rev` being
|
|
167
|
+
* set: `rev` is optional on the record type, and an unnonced record against a
|
|
168
|
+
* pre-0.9.0 revision-less row would otherwise match `undefined === undefined`
|
|
169
|
+
* and claim a race it never entered.
|
|
170
|
+
*
|
|
171
|
+
* On exhaustion the write proceeds unconditionally and warns. That is
|
|
172
|
+
* deliberate: the fallback is precisely the pre-0.9.0 behaviour — one possible
|
|
173
|
+
* orphan, reclaimed by a lifecycle rule — so pathological contention degrades
|
|
174
|
+
* instead of turning a working put into an error. `createdAt` is refreshed from
|
|
175
|
+
* each re-read so a row created by whoever won keeps its true creation time.
|
|
176
|
+
*
|
|
177
|
+
* Accepts: `record` — the row to commit, carrying this call's own `rev`.
|
|
178
|
+
* `existing` — what the caller read before encoding, used as the first pin; an
|
|
179
|
+
* `exists: false` observation pins "no row", so a creation races correctly too.
|
|
180
|
+
*
|
|
181
|
+
* Returns: the state this write actually superseded — the descriptor safe to
|
|
182
|
+
* delete — which is the last observation the winning put was pinned to, never
|
|
183
|
+
* this record's own value.
|
|
184
|
+
*
|
|
185
|
+
* Throws: whatever the put throws other than a conditional-check failure; those
|
|
186
|
+
* are the swap's own business.
|
|
187
|
+
*
|
|
188
|
+
* Guarantees: at most {@link OVERWRITE_CAS_MAX_ATTEMPTS} conditional puts, and
|
|
189
|
+
* a re-read only when the rejection did not already carry the row that caused
|
|
190
|
+
* it.
|
|
191
|
+
*/
|
|
192
|
+
export declare function putWithRevisionSwap(context: StoreContext, record: StoreItemRow, existing: ExistingRowMeta): Promise<ExistingRowMeta>;
|
|
193
|
+
/**
|
|
194
|
+
* Whether `error` is a spent retry budget.
|
|
195
|
+
*
|
|
196
|
+
* Accepts: any error, and equally anything else a `throw` can produce.
|
|
197
|
+
* Recognised by brand and code: the code is the one thing an error crossing a
|
|
198
|
+
* module or realm boundary can be relied on to keep.
|
|
199
|
+
*
|
|
200
|
+
* Returns: whether the write is ambiguous for the reason retries were spent,
|
|
201
|
+
* which is the only failure a verification read is allowed to resolve.
|
|
202
|
+
*
|
|
203
|
+
* Throws: **nothing**, for any value. A value carrying no such code is not a
|
|
204
|
+
* spent budget, so the caller rethrows it rather than spending a read on it.
|
|
205
|
+
*/
|
|
206
|
+
export declare function isRetryExhausted(error: Error): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Read `record`'s row back to establish what an ambiguous write actually did,
|
|
209
|
+
* comparing the row's revision with the one this write carried. Every put
|
|
210
|
+
* stamps a fresh per-call `rev`, so the comparison works for inline and
|
|
211
|
+
* offloaded records alike.
|
|
212
|
+
*
|
|
213
|
+
* Accepts: `record` — the row this call wrote, carrying the `rev` it stamped.
|
|
214
|
+
* A record with no `rev` has nothing to compare and is reported `'not-landed'`
|
|
215
|
+
* without spending a read.
|
|
216
|
+
*
|
|
217
|
+
* Returns: `'landed'`, `'not-landed'` or `'unverified'`; see
|
|
218
|
+
* {@link WriteVerdict} for what each answer licenses the caller to do. Only the
|
|
219
|
+
* `rev` is read: an offloaded record's key ends in that same `rev`, so the row
|
|
220
|
+
* holding a different one never names this write's object, and a cleanup
|
|
221
|
+
* needs nothing more from it.
|
|
222
|
+
*
|
|
223
|
+
* Throws: nothing — a failed verification is `'unverified'`, which is an
|
|
224
|
+
* answer, not an error.
|
|
225
|
+
*/
|
|
226
|
+
export declare function verifyWriteLanded(context: StoreContext, record: {
|
|
227
|
+
PK: string;
|
|
228
|
+
SK: string;
|
|
229
|
+
rev?: string;
|
|
230
|
+
}): Promise<WriteVerdict>;
|