@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,571 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides the checkpointer's row format.
|
|
3
|
+
*
|
|
4
|
+
* A checkpoint is three kinds of row in its thread's partition — a light META
|
|
5
|
+
* row a listing reads, a heavy PAYLOAD row, and one WRITE row per pending
|
|
6
|
+
* write — and everything about how they are keyed, what they carry, and how a
|
|
7
|
+
* checkpoint and its writes become rows and come back is decided here: the
|
|
8
|
+
* sort-key segments and their order, the offset that lets the reserved negative
|
|
9
|
+
* write indices sort as plain strings, the `writeGroup` and `occurrence` that
|
|
10
|
+
* identify a write across calls, the recency-index keys a META row carries, and
|
|
11
|
+
* which rows a read admits as this adapter's own. Nothing else composes or
|
|
12
|
+
* splits a checkpointer key.
|
|
13
|
+
*/
|
|
14
|
+
import type { QueryCommandInput } from '@aws-sdk/lib-dynamodb';
|
|
15
|
+
import type { Checkpoint, CheckpointMetadata, CheckpointPendingWrite, PendingWrite, PendingWriteValue } from '@langchain/langgraph-checkpoint';
|
|
16
|
+
import { type PayloadDescriptor } from '../../shared/codec/codec';
|
|
17
|
+
import type { AttributeMap } from '../../shared/dynamodb/client';
|
|
18
|
+
import { type NamedDescriptor } from '../../shared/dynamodb/partition-delete';
|
|
19
|
+
import { type IndexTarget } from '../../shared/dynamodb/recency-index';
|
|
20
|
+
import { type RowKey } from '../../shared/dynamodb/table-schema';
|
|
21
|
+
import type { CheckpointerContext } from './setup';
|
|
22
|
+
/** Where one stored checkpoint lives: from a parsed address, or from a row's own identifiers. */
|
|
23
|
+
export interface CheckpointLocation {
|
|
24
|
+
readonly threadId: string;
|
|
25
|
+
readonly checkpointNs: string;
|
|
26
|
+
readonly checkpointId: string;
|
|
27
|
+
}
|
|
28
|
+
/** Where one pending write lives: its checkpoint, its task, its index and its channel. */
|
|
29
|
+
export interface WriteRowLocation {
|
|
30
|
+
readonly checkpointNs: string;
|
|
31
|
+
readonly checkpointId: string;
|
|
32
|
+
readonly taskId: string;
|
|
33
|
+
readonly index: number;
|
|
34
|
+
readonly channel: string;
|
|
35
|
+
}
|
|
36
|
+
/** The lightweight `META#` row: structural fields + serialized metadata. */
|
|
37
|
+
export interface CheckpointMetaRow {
|
|
38
|
+
PK: string;
|
|
39
|
+
SK: string;
|
|
40
|
+
/** Row format version; absent on rows written before it existed (see `table-schema.ts`). */
|
|
41
|
+
v?: number;
|
|
42
|
+
/** Recency-index keys; absent on rows written before the index existed. */
|
|
43
|
+
gsi1pk?: string;
|
|
44
|
+
gsi1sk?: string;
|
|
45
|
+
threadId: string;
|
|
46
|
+
checkpointNs: string;
|
|
47
|
+
checkpointId: string;
|
|
48
|
+
parentCheckpointId?: string;
|
|
49
|
+
metadata: PayloadDescriptor;
|
|
50
|
+
ttl?: number;
|
|
51
|
+
}
|
|
52
|
+
/** The heavy `PAYLOAD#` row: the serialized checkpoint. */
|
|
53
|
+
export interface CheckpointPayloadRow {
|
|
54
|
+
PK: string;
|
|
55
|
+
SK: string;
|
|
56
|
+
/** Row format version; absent on rows written before it existed (see `table-schema.ts`). */
|
|
57
|
+
v?: number;
|
|
58
|
+
checkpoint: PayloadDescriptor;
|
|
59
|
+
ttl?: number;
|
|
60
|
+
}
|
|
61
|
+
/** A `WRITE#` row: one pending write for a checkpoint/task. */
|
|
62
|
+
export interface CheckpointWriteRow {
|
|
63
|
+
PK: string;
|
|
64
|
+
SK: string;
|
|
65
|
+
/** Row format version; absent on rows written before it existed (see `table-schema.ts`). */
|
|
66
|
+
v?: number;
|
|
67
|
+
taskId: string;
|
|
68
|
+
index: number;
|
|
69
|
+
channel: string;
|
|
70
|
+
/** Identifies the `putWrites` call that produced this row; see {@link WRITE_GROUP_ATTRIBUTE}. */
|
|
71
|
+
writeGroup: string;
|
|
72
|
+
/**
|
|
73
|
+
* How many earlier writes in the same call already used this channel.
|
|
74
|
+
* Optional: rows written before 0.9.0 carry none and read back as 0, which
|
|
75
|
+
* is exactly the identity they were stored under.
|
|
76
|
+
*/
|
|
77
|
+
occurrence?: number;
|
|
78
|
+
value: PayloadDescriptor;
|
|
79
|
+
ttl?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The attribute a WRITE row carries the id of the `putWrites` call that wrote
|
|
83
|
+
* it in. A special write's compare-and-swap pins it, and a thread delete pins
|
|
84
|
+
* a WRITE row's delete to it; a per-call ULID is already unique, so it needs no
|
|
85
|
+
* separate revision attribute.
|
|
86
|
+
*/
|
|
87
|
+
export declare const WRITE_GROUP_ATTRIBUTE = "writeGroup";
|
|
88
|
+
/**
|
|
89
|
+
* The most negative write index the sort key can encode, `-WRITE_INDEX_OFFSET`.
|
|
90
|
+
* A static test pins it against the peer's `WRITES_IDX_MAP`, so a peer bump
|
|
91
|
+
* that adds a more negative special slot fails loudly instead of producing
|
|
92
|
+
* unsortable keys.
|
|
93
|
+
*/
|
|
94
|
+
export declare const MIN_ENCODABLE_WRITE_INDEX: number;
|
|
95
|
+
/**
|
|
96
|
+
* The tag every checkpointer partition key starts with.
|
|
97
|
+
*
|
|
98
|
+
* Accepts: nothing — the tag is fixed, and the function exists so no caller
|
|
99
|
+
* composes it by hand.
|
|
100
|
+
*
|
|
101
|
+
* Returns: the tag, for a table-wide `begins_with` over this adapter's rows.
|
|
102
|
+
*
|
|
103
|
+
* Throws: nothing.
|
|
104
|
+
*/
|
|
105
|
+
export declare function checkpointerPartitionPrefix(): string;
|
|
106
|
+
/**
|
|
107
|
+
* Partition key for a thread: the adapter tag plus the thread id.
|
|
108
|
+
*
|
|
109
|
+
* Accepts: `threadId` — normally validated, so it cannot contain the separator.
|
|
110
|
+
*
|
|
111
|
+
* Returns: the partition key. Total, like every key builder here: a row read
|
|
112
|
+
* from a shared table is *tested* against these, so a malformed value must
|
|
113
|
+
* compose a key that matches nothing rather than fail the read.
|
|
114
|
+
*
|
|
115
|
+
* Throws: nothing.
|
|
116
|
+
*/
|
|
117
|
+
export declare function partitionKey(threadId: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* Sort key for a checkpoint's lightweight metadata item.
|
|
120
|
+
*
|
|
121
|
+
* Accepts: `checkpointNs` — possibly empty, which is the root namespace.
|
|
122
|
+
* `checkpointId` — the checkpoint's own id.
|
|
123
|
+
*
|
|
124
|
+
* Returns: the sort key. The namespace sits above the id so a namespace's
|
|
125
|
+
* checkpoints are contiguous and a `begins_with` selects exactly them.
|
|
126
|
+
*
|
|
127
|
+
* Throws: nothing.
|
|
128
|
+
*/
|
|
129
|
+
export declare function metaSortKey(checkpointNs: string, checkpointId: string): string;
|
|
130
|
+
/**
|
|
131
|
+
* `begins_with` prefix selecting every META item in one namespace.
|
|
132
|
+
*
|
|
133
|
+
* Accepts: `checkpointNs` — the namespace to scope to; empty scopes to the root
|
|
134
|
+
* namespace, not to every namespace.
|
|
135
|
+
*
|
|
136
|
+
* Returns: the prefix, separator-terminated, so the namespace `a` does not also
|
|
137
|
+
* select `ab`.
|
|
138
|
+
*
|
|
139
|
+
* Throws: nothing.
|
|
140
|
+
*/
|
|
141
|
+
export declare function metaSortKeyPrefix(checkpointNs: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* `begins_with` prefix selecting every META item of a thread.
|
|
144
|
+
*
|
|
145
|
+
* Accepts: nothing — the prefix is the same for every thread, because the
|
|
146
|
+
* thread is already the partition.
|
|
147
|
+
*
|
|
148
|
+
* Returns: the kind prefix alone, so the selection spans every namespace of the
|
|
149
|
+
* thread — what a `list` with no `checkpoint_ns` asks for.
|
|
150
|
+
*
|
|
151
|
+
* Throws: nothing.
|
|
152
|
+
*/
|
|
153
|
+
export declare function metaAnyNamespacePrefix(): string;
|
|
154
|
+
/**
|
|
155
|
+
* Sort key for a checkpoint's heavy payload item.
|
|
156
|
+
*
|
|
157
|
+
* Accepts: as {@link metaSortKey}.
|
|
158
|
+
*
|
|
159
|
+
* Returns: the sort key of the row holding the checkpoint itself, which is
|
|
160
|
+
* written before its META row and read only after one is found.
|
|
161
|
+
*
|
|
162
|
+
* Throws: nothing.
|
|
163
|
+
*/
|
|
164
|
+
export declare function payloadSortKey(checkpointNs: string, checkpointId: string): string;
|
|
165
|
+
/**
|
|
166
|
+
* Sort key for a single pending write. The trailing `channel` segment is what
|
|
167
|
+
* keeps two *different* channels from ever occupying one row: without it, a
|
|
168
|
+
* retried task whose write mix changed could compute an index another channel
|
|
169
|
+
* already holds, and the first-write-wins guard — which cannot tell a
|
|
170
|
+
* genuine retry from an unrelated write — would silently discard it. The
|
|
171
|
+
* channel is appended verbatim as the final segment, so two sort keys collide
|
|
172
|
+
* only when their channels are byte-identical; `writeSortKeyPrefix` stops at
|
|
173
|
+
* the checkpoint id, ahead of this segment, so `begins_with` reads are
|
|
174
|
+
* unaffected.
|
|
175
|
+
*
|
|
176
|
+
* The composed length is not checked here: `parsePutWritesRequest` refuses a
|
|
177
|
+
* write whose key would pass the cap, measured by {@link writeSortKeyBytes},
|
|
178
|
+
* before anything is encoded.
|
|
179
|
+
*
|
|
180
|
+
* Accepts: `at` — the write's location: `at.index`, an integer (padding a
|
|
181
|
+
* fraction produced `00000009.5`, which no longer orders numerically);
|
|
182
|
+
* `at.channel`, separator-free, which `parseWriteChannel` establishes before
|
|
183
|
+
* any key is built; `at.checkpointNs`, `at.checkpointId` and `at.taskId`, the
|
|
184
|
+
* other parsed identifiers.
|
|
185
|
+
*
|
|
186
|
+
* Returns: the sort key, its index zero-padded to a fixed width so the special
|
|
187
|
+
* negative slots order below the positional ones.
|
|
188
|
+
*
|
|
189
|
+
* Throws: `VALIDATION` naming `index` for an index this encoding cannot
|
|
190
|
+
* represent.
|
|
191
|
+
*/
|
|
192
|
+
export declare function writeSortKey(at: WriteRowLocation): string;
|
|
193
|
+
/**
|
|
194
|
+
* The UTF-8 length of the WRITE sort key a write would get, without refusing
|
|
195
|
+
* one over DynamoDB's cap.
|
|
196
|
+
*
|
|
197
|
+
* Accepts: `at` — the write's location without its index: `at.checkpointNs`,
|
|
198
|
+
* `at.checkpointId`, `at.taskId` and `at.channel`, the four segments of a
|
|
199
|
+
* WRITE sort key other than the index. The index is zero-padded to a fixed
|
|
200
|
+
* width, so the length is the same for every index a write can take, and
|
|
201
|
+
* index 0 stands for them all.
|
|
202
|
+
*
|
|
203
|
+
* Returns: the byte length DynamoDB measures the composed key by.
|
|
204
|
+
*
|
|
205
|
+
* Throws: nothing.
|
|
206
|
+
*/
|
|
207
|
+
export declare function writeSortKeyBytes(at: Omit<WriteRowLocation, 'index'>): number;
|
|
208
|
+
/**
|
|
209
|
+
* Whether `sortKey` is one this adapter writes.
|
|
210
|
+
*
|
|
211
|
+
* Accepts: any sort key read from a thread's partition.
|
|
212
|
+
*
|
|
213
|
+
* Returns: whether it starts with one of this adapter's kind tags. A partition
|
|
214
|
+
* query carries no sort-key condition, so a partition-wide delete uses this to
|
|
215
|
+
* leave a row it does not own in place rather than deleting the whole partition
|
|
216
|
+
* blindly.
|
|
217
|
+
*
|
|
218
|
+
* Throws: nothing.
|
|
219
|
+
*/
|
|
220
|
+
export declare function isCheckpointerSortKey(sortKey: string): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* `begins_with` prefix selecting every WRITE item of one checkpoint.
|
|
223
|
+
*
|
|
224
|
+
* Accepts: the namespace and checkpoint the writes belong to.
|
|
225
|
+
*
|
|
226
|
+
* Returns: the prefix, separator-terminated, so one checkpoint's writes never
|
|
227
|
+
* include another's whose id merely starts the same way.
|
|
228
|
+
*
|
|
229
|
+
* Throws: nothing.
|
|
230
|
+
*/
|
|
231
|
+
export declare function writeSortKeyPrefix(checkpointNs: string, checkpointId: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* The key of one checkpoint's META row.
|
|
234
|
+
*
|
|
235
|
+
* Accepts: `at` — the checkpoint's thread, namespace and id.
|
|
236
|
+
*
|
|
237
|
+
* Returns: the row's partition and sort key.
|
|
238
|
+
*
|
|
239
|
+
* Throws: nothing.
|
|
240
|
+
*/
|
|
241
|
+
export declare function metaRowKey(at: CheckpointLocation): RowKey;
|
|
242
|
+
/**
|
|
243
|
+
* The key of one checkpoint's PAYLOAD row.
|
|
244
|
+
*
|
|
245
|
+
* Accepts: `at` — the checkpoint's thread, namespace and id.
|
|
246
|
+
*
|
|
247
|
+
* Returns: the row's partition and sort key.
|
|
248
|
+
*
|
|
249
|
+
* Throws: nothing.
|
|
250
|
+
*/
|
|
251
|
+
export declare function payloadRowKey(at: CheckpointLocation): RowKey;
|
|
252
|
+
/** Options for {@link partitionQuery}. */
|
|
253
|
+
export interface PartitionQueryOptions {
|
|
254
|
+
consistent?: boolean;
|
|
255
|
+
}
|
|
256
|
+
/** Options for {@link beginsWithQuery}. */
|
|
257
|
+
export interface BeginsWithQueryOptions {
|
|
258
|
+
limit?: number;
|
|
259
|
+
/** Inclusive upper bound on the sort key; turns the prefix match into a `BETWEEN`. */
|
|
260
|
+
beforeSortKey?: string;
|
|
261
|
+
ascending?: boolean;
|
|
262
|
+
consistent?: boolean;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Query input selecting every item in a thread's partition.
|
|
266
|
+
*
|
|
267
|
+
* Accepts: the thread whose partition to read.
|
|
268
|
+
*
|
|
269
|
+
* Returns: the Query input, with no sort-key condition: it selects this
|
|
270
|
+
* adapter's META, PAYLOAD and WRITE rows and any row another adapter left in
|
|
271
|
+
* the partition — which is why every caller filters with
|
|
272
|
+
* `isCheckpointerSortKey`.
|
|
273
|
+
*
|
|
274
|
+
* Throws: nothing.
|
|
275
|
+
*/
|
|
276
|
+
export declare function partitionQuery(tableName: string, partition: string, options?: PartitionQueryOptions): QueryCommandInput;
|
|
277
|
+
/**
|
|
278
|
+
* Query input for a `begins_with` sort-key prefix.
|
|
279
|
+
*
|
|
280
|
+
* Accepts: `options.ascending` — sort-key order; newest-first is the default
|
|
281
|
+
* because that is what "the latest checkpoint" asks for. `options.limit` — rows
|
|
282
|
+
* DynamoDB evaluates per page, not a total. `options.consistent` — for a read
|
|
283
|
+
* whose answer a write depends on.
|
|
284
|
+
*
|
|
285
|
+
* Returns: the Query input.
|
|
286
|
+
*
|
|
287
|
+
* Throws: nothing.
|
|
288
|
+
*/
|
|
289
|
+
export declare function beginsWithQuery(tableName: string, partition: string, skPrefix: string, options?: BeginsWithQueryOptions): QueryCommandInput;
|
|
290
|
+
/** What a checkpoint's META and PAYLOAD rows are built from. */
|
|
291
|
+
export interface CheckpointRowsSource {
|
|
292
|
+
readonly address: CheckpointLocation;
|
|
293
|
+
readonly parentCheckpointId: string | undefined;
|
|
294
|
+
readonly checkpoint: Checkpoint;
|
|
295
|
+
readonly metadata: CheckpointMetadata;
|
|
296
|
+
readonly signal: AbortSignal | undefined;
|
|
297
|
+
}
|
|
298
|
+
/** What one call's WRITE rows are built from. */
|
|
299
|
+
export interface WriteRowsSource {
|
|
300
|
+
readonly address: CheckpointLocation;
|
|
301
|
+
readonly taskId: string;
|
|
302
|
+
readonly writes: PendingWrite[];
|
|
303
|
+
readonly signal: AbortSignal | undefined;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Encode a checkpoint + metadata into its META and PAYLOAD rows.
|
|
307
|
+
*
|
|
308
|
+
* Each call draws one object id and uploads both offloaded payloads under it,
|
|
309
|
+
* below the row that points at each. A second put of the same checkpoint id — a
|
|
310
|
+
* put the caller re-issues after a lost response, or a repair tool re-writing a
|
|
311
|
+
* checkpoint — draws another, so it never names an object the first put
|
|
312
|
+
* uploaded, and the verification after a failed transaction can tell the two
|
|
313
|
+
* puts' rows apart by the key alone.
|
|
314
|
+
*
|
|
315
|
+
* Accepts: `request` — parsed by `parsePutRequest`: the address the rows are
|
|
316
|
+
* keyed by (its `checkpointId` is `checkpoint.id`), the parent, the checkpoint
|
|
317
|
+
* — every channel value it carries is stored; see `putCheckpoint` for why
|
|
318
|
+
* nothing is narrowed away — the metadata, and the signal that cancels the
|
|
319
|
+
* uploads. `ttlTimestamp` — stamped on both rows so they expire together.
|
|
320
|
+
*
|
|
321
|
+
* Returns: the META row (light: ids, metadata, index keys) and the PAYLOAD row
|
|
322
|
+
* (heavy: the checkpoint itself), which the caller writes in that order —
|
|
323
|
+
* payload first, so a META row never names a payload that is not there yet.
|
|
324
|
+
*
|
|
325
|
+
* Throws: `VALIDATION` naming `value` for a checkpoint the serializer cannot
|
|
326
|
+
* represent; `S3_OFFLOAD_FAILED` when an offloaded payload cannot be uploaded.
|
|
327
|
+
* Encoding precedes every write, so a checkpoint that cannot be stored never
|
|
328
|
+
* half-writes a thread — and a metadata payload refused after the checkpoint's
|
|
329
|
+
* own object has uploaded releases that object before the failure leaves here
|
|
330
|
+
* (see {@link releaseUploads}), so a refusal strands nothing either.
|
|
331
|
+
*/
|
|
332
|
+
export declare function buildCheckpointRows(context: CheckpointerContext, request: CheckpointRowsSource, ttlTimestamp?: number): Promise<{
|
|
333
|
+
meta: CheckpointMetaRow;
|
|
334
|
+
payload: CheckpointPayloadRow;
|
|
335
|
+
}>;
|
|
336
|
+
/**
|
|
337
|
+
* Encode a task's pending writes into one row per write.
|
|
338
|
+
*
|
|
339
|
+
* Accepts: `request` — parsed by `parsePutWritesRequest`, so every channel is
|
|
340
|
+
* well-formed and every composed sort key fits before this runs, and a bad one
|
|
341
|
+
* costs no S3 object. `writeGroup` — unique per `putWrites` *call*, not per
|
|
342
|
+
* write, and stored on every row the call produces: it is what tells one
|
|
343
|
+
* call's writes apart from another's when `dropSupersededWrites` resolves
|
|
344
|
+
* first-write-wins, and it is the object id every offloaded write of the call
|
|
345
|
+
* is uploaded under. Two calls writing the same bytes for the same row
|
|
346
|
+
* therefore upload two objects, and each row names only its own call's.
|
|
347
|
+
* `ttlTimestamp` — stamped on every row.
|
|
348
|
+
*
|
|
349
|
+
* Returns: one row per write, special channels first, each carrying its
|
|
350
|
+
* `occurrence` so a channel emitted twice by one call keeps both values.
|
|
351
|
+
*
|
|
352
|
+
* Throws: `VALIDATION` naming `value`; `S3_OFFLOAD_FAILED`. A payload refused
|
|
353
|
+
* partway through releases the objects the earlier writes of the same call had
|
|
354
|
+
* already uploaded (see {@link releaseUploads}), so a build that throws
|
|
355
|
+
* returns the caller to where it started.
|
|
356
|
+
*/
|
|
357
|
+
export declare function buildWriteRows(context: CheckpointerContext, request: WriteRowsSource, writeGroup: string, ttlTimestamp?: number): Promise<CheckpointWriteRow[]>;
|
|
358
|
+
/**
|
|
359
|
+
* Narrow a raw row to a {@link CheckpointMetaRow}.
|
|
360
|
+
*
|
|
361
|
+
* Accepts: `raw` — any row carrying the `META#` sort-key prefix, which on a
|
|
362
|
+
* shared table another writer can produce too.
|
|
363
|
+
*
|
|
364
|
+
* Returns: the item, or undefined for a row that merely shares the prefix, and
|
|
365
|
+
* for one whose own `threadId`/`checkpointNs`/`checkpointId` disagree with the
|
|
366
|
+
* DynamoDB key it was found at. The test is on the attributes a checkpoint must
|
|
367
|
+
* have, not on a cast: this is the one boundary where a row may not have been
|
|
368
|
+
* written by this adapter. A `metadata` of `null` is refused here, since
|
|
369
|
+
* dereferencing it later raised a raw `TypeError`.
|
|
370
|
+
*
|
|
371
|
+
* Throws: `FORMAT_UNSUPPORTED` for a row a newer version wrote — checked
|
|
372
|
+
* **before** the shape, as every other read of this package's rows checks it,
|
|
373
|
+
* so a row a newer release wrote is reported as newer rather than judged
|
|
374
|
+
* against attribute names it may no longer use. Skipping it would report a
|
|
375
|
+
* thread as shorter than it is.
|
|
376
|
+
*
|
|
377
|
+
* Guarantees: a row's attributes are bound to the partition it lives in. Those
|
|
378
|
+
* attributes name the S3 scope the row's payloads are read under and the thread
|
|
379
|
+
* the assembled tuple reports, so a writer confined to its own partition could
|
|
380
|
+
* otherwise hand back another tenant's offloaded payload under that tenant's
|
|
381
|
+
* `thread_id` — the same binding `parseStoreRow` makes for store items. The
|
|
382
|
+
* binding is judged under this release's rules, which is why it is judged only
|
|
383
|
+
* for a row this release can read.
|
|
384
|
+
*/
|
|
385
|
+
export declare function parseMetaRow(raw: AttributeMap): CheckpointMetaRow | undefined;
|
|
386
|
+
/**
|
|
387
|
+
* Narrow a candidate head row, saying so when it is not one of ours.
|
|
388
|
+
*
|
|
389
|
+
* Accepts: `raw` — the row a newest-first read returned, or undefined when it
|
|
390
|
+
* returned none.
|
|
391
|
+
*
|
|
392
|
+
* Returns: the item, or undefined for an absent or foreign row — logged at
|
|
393
|
+
* `warn` in the second case, because a foreign row at the head of a thread is
|
|
394
|
+
* an operator's problem even though this read recovers from it.
|
|
395
|
+
*
|
|
396
|
+
* Throws: as {@link parseMetaRow}.
|
|
397
|
+
*
|
|
398
|
+
* Guarantees: a foreign row is skipped, never returned. Returning one made
|
|
399
|
+
* `assembleTuple` miss its payload and report the thread as empty, so LangGraph
|
|
400
|
+
* started a new run on top of the real history.
|
|
401
|
+
*/
|
|
402
|
+
export declare function parseHeadRow(context: CheckpointerContext, raw: AttributeMap | undefined): CheckpointMetaRow | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* Decode the checkpoint stored in a PAYLOAD item.
|
|
405
|
+
*
|
|
406
|
+
* Accepts: `threadId` — the **caller's**, from the config, never the row's: it
|
|
407
|
+
* scopes which S3 object the row may point at, so it must come from the
|
|
408
|
+
* partition the caller asked for. A row that names an object outside that scope
|
|
409
|
+
* is refused by the codec rather than downloaded. `signal` — cancels the
|
|
410
|
+
* download an offloaded payload costs.
|
|
411
|
+
*
|
|
412
|
+
* Returns: the checkpoint.
|
|
413
|
+
*
|
|
414
|
+
* Throws: `PAYLOAD_CORRUPT` for bytes that cannot be decoded, `VALIDATION`
|
|
415
|
+
* for a descriptor pointing outside the row's scope and for a payload the
|
|
416
|
+
* configured serde refuses to reconstruct, and whatever the download throws.
|
|
417
|
+
*/
|
|
418
|
+
export declare function readCheckpoint(context: CheckpointerContext, item: CheckpointPayloadRow, threadId: string, signal?: AbortSignal): Promise<Checkpoint>;
|
|
419
|
+
/**
|
|
420
|
+
* Decode the metadata stored in a META item.
|
|
421
|
+
*
|
|
422
|
+
* Accepts: as {@link readCheckpoint}, for the metadata blob instead of the
|
|
423
|
+
* checkpoint.
|
|
424
|
+
*
|
|
425
|
+
* Returns: the metadata.
|
|
426
|
+
*
|
|
427
|
+
* Throws: as {@link readCheckpoint}.
|
|
428
|
+
*/
|
|
429
|
+
export declare function readMetadata(context: CheckpointerContext, item: CheckpointMetaRow, threadId: string, signal?: AbortSignal): Promise<CheckpointMetadata>;
|
|
430
|
+
/**
|
|
431
|
+
* Decode WRITE items into `[taskId, channel, value]` pending-write tuples.
|
|
432
|
+
*
|
|
433
|
+
* Accepts: `items` — one checkpoint's WRITE rows, in any order; empty is empty.
|
|
434
|
+
* `threadId` — the caller's, as in {@link readCheckpoint}. `signal` — cancels
|
|
435
|
+
* the downloads, all of which share it.
|
|
436
|
+
*
|
|
437
|
+
* Returns: the writes LangGraph replays, first-write-wins already resolved by
|
|
438
|
+
* `dropSupersededWrites`, in the order the surviving rows were read.
|
|
439
|
+
*
|
|
440
|
+
* Throws: whatever a decode throws — the first one, with the rest allowed to
|
|
441
|
+
* settle.
|
|
442
|
+
*
|
|
443
|
+
* Guarantees: payloads decode several at a time, so a checkpoint with many
|
|
444
|
+
* offloaded writes costs one round of downloads rather than one per write.
|
|
445
|
+
*/
|
|
446
|
+
export declare function toPendingWrites(context: CheckpointerContext, items: CheckpointWriteRow[], threadId: string, signal?: AbortSignal): Promise<CheckpointPendingWrite[]>;
|
|
447
|
+
/** One write with its sort-key index resolved exactly once. */
|
|
448
|
+
export interface ResolvedWrite {
|
|
449
|
+
channel: string;
|
|
450
|
+
value: PendingWriteValue;
|
|
451
|
+
index: number;
|
|
452
|
+
/**
|
|
453
|
+
* How many earlier writes in this same call already used this channel. A
|
|
454
|
+
* retry that emits a channel *more* often than the original call produces a
|
|
455
|
+
* row at an occurrence no earlier call ever wrote — it collides with nothing
|
|
456
|
+
* and commits cleanly, so the read-side dedup must not mistake it for a
|
|
457
|
+
* superseding duplicate.
|
|
458
|
+
*/
|
|
459
|
+
occurrence: number;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Assign every write in one `putWrites` call its sort-key index, in a single
|
|
463
|
+
* pass — nothing recomputes it downstream, so the deduped array's positions
|
|
464
|
+
* cannot disagree with the ones the caller's array produced.
|
|
465
|
+
*
|
|
466
|
+
* A regular write's index is its position in the caller's array, exactly as
|
|
467
|
+
* the reference `MemorySaver` computes it: that is what makes stored writes
|
|
468
|
+
* replay in the order the task emitted them. A special channel takes its
|
|
469
|
+
* fixed `WRITES_IDX_MAP` slot instead, and a later duplicate replaces an
|
|
470
|
+
* earlier one (last-write-wins, again matching the reference).
|
|
471
|
+
*
|
|
472
|
+
* Positions are not stable across calls, which is why the *sort key* also
|
|
473
|
+
* carries the channel and each call stamps its rows with a shared
|
|
474
|
+
* `writeGroup` — see {@link buildWriteRows} and `dropSupersededWrites`.
|
|
475
|
+
*
|
|
476
|
+
* `Object.hasOwn` guards WRITES_IDX_MAP's own `Object.prototype` chain — a
|
|
477
|
+
* channel literally named `constructor`/`toString`/etc. must be treated as
|
|
478
|
+
* regular, not resolve to an inherited function reference.
|
|
479
|
+
*
|
|
480
|
+
* Accepts: `writes` — one `putWrites` call's writes, already validated for
|
|
481
|
+
* channel shape; empty is empty.
|
|
482
|
+
*
|
|
483
|
+
* Returns: the special writes first, then the regular ones. A special channel
|
|
484
|
+
* appearing twice yields one entry (the last), a regular channel appearing
|
|
485
|
+
* twice yields two, distinguished by `occurrence`.
|
|
486
|
+
*
|
|
487
|
+
* Throws: nothing.
|
|
488
|
+
*
|
|
489
|
+
* Guarantees: within one call, `(channel, occurrence)` is unique — which is
|
|
490
|
+
* what lets `dropSupersededWrites` treat it as an identity across calls.
|
|
491
|
+
*/
|
|
492
|
+
export declare function resolveWriteIndices(writes: PendingWrite[]): ResolvedWrite[];
|
|
493
|
+
/**
|
|
494
|
+
* Resolve a task's pending writes to one row per `(taskId, channel,
|
|
495
|
+
* occurrence)`, keeping the earliest `putWrites` call that wrote it.
|
|
496
|
+
*
|
|
497
|
+
* A regular write's index is its position in the caller's array, so a retried
|
|
498
|
+
* task whose write mix changed places an already-committed channel at a
|
|
499
|
+
* different index, where the first-write-wins guard cannot recognise it and a
|
|
500
|
+
* second row commits. Replaying both double-counts an accumulating channel.
|
|
501
|
+
* Each call stamps its rows with one `writeGroup`, and the earliest group per
|
|
502
|
+
* identity is the call that actually won.
|
|
503
|
+
*
|
|
504
|
+
* `occurrence` is part of the identity so a retry that legitimately emits a
|
|
505
|
+
* channel *more* often than the original keeps both values, which is what
|
|
506
|
+
* `MemorySaver` does when it keys first-write-wins on `(taskId, index)`.
|
|
507
|
+
*
|
|
508
|
+
* Accepts: `items` — the WRITE rows of one checkpoint, in any order; empty is
|
|
509
|
+
* empty. A row written before `writeGroup` or `occurrence` existed carries
|
|
510
|
+
* neither, and both are normalised at the edge rather than tested for.
|
|
511
|
+
*
|
|
512
|
+
* Returns: the rows to replay, in the order given. One per `(taskId, channel,
|
|
513
|
+
* occurrence)`: the row whose `writeGroup` sorts earliest, which is the call
|
|
514
|
+
* that actually won the first-write-wins guard.
|
|
515
|
+
*
|
|
516
|
+
* Throws: nothing.
|
|
517
|
+
*
|
|
518
|
+
* Guarantees: exactly one row survives per identity. Two rows could tie only by
|
|
519
|
+
* sharing a `writeGroup` as well, and one call assigns each of its channels a
|
|
520
|
+
* distinct `occurrence`, so within a call the identity is already unique.
|
|
521
|
+
*/
|
|
522
|
+
export declare function dropSupersededWrites(items: CheckpointWriteRow[]): CheckpointWriteRow[];
|
|
523
|
+
/**
|
|
524
|
+
* The offloaded payloads a checkpointer row references, each named by the
|
|
525
|
+
* attribute holding it, because a row is pinned through a document path over
|
|
526
|
+
* that name.
|
|
527
|
+
*
|
|
528
|
+
* Accepts: `row` — a row of this adapter's partition.
|
|
529
|
+
*
|
|
530
|
+
* Returns: the descriptors, each named by its attribute. An attribute the row
|
|
531
|
+
* leaves out and one it holds `null` in both name no payload, which is what
|
|
532
|
+
* `namedDescriptor` decides.
|
|
533
|
+
*
|
|
534
|
+
* Throws: nothing.
|
|
535
|
+
*/
|
|
536
|
+
export declare function checkpointRowDescriptors(row: AttributeMap): NamedDescriptor[];
|
|
537
|
+
/**
|
|
538
|
+
* The checkpoint a row belongs to.
|
|
539
|
+
*
|
|
540
|
+
* Accepts: `row` — a row of this adapter's partition.
|
|
541
|
+
*
|
|
542
|
+
* Returns: the `ns#id` unit: the namespace and id its sort key carries in the
|
|
543
|
+
* same two segments whatever its kind, which is exact rather than hopeful
|
|
544
|
+
* because the separator is forbidden inside every segment.
|
|
545
|
+
*
|
|
546
|
+
* Throws: nothing.
|
|
547
|
+
*/
|
|
548
|
+
export declare function checkpointRowUnit(row: AttributeMap): string;
|
|
549
|
+
/**
|
|
550
|
+
* The row kind.
|
|
551
|
+
*
|
|
552
|
+
* Accepts: `row` — a row of this adapter's partition.
|
|
553
|
+
*
|
|
554
|
+
* Returns: the kind, which is the sort key's leading segment.
|
|
555
|
+
*
|
|
556
|
+
* Throws: nothing.
|
|
557
|
+
*/
|
|
558
|
+
export declare function checkpointRowKind(row: AttributeMap): string;
|
|
559
|
+
/**
|
|
560
|
+
* Where a checkpointer row sits in the recency index, for a row written before
|
|
561
|
+
* the index existed.
|
|
562
|
+
*
|
|
563
|
+
* Accepts: `row` — any row of the table.
|
|
564
|
+
*
|
|
565
|
+
* Returns: a META row's identity — its checkpoint id, at {@link BACKFILLED_AT},
|
|
566
|
+
* because a META row records no time of its own — or `undefined` for any other
|
|
567
|
+
* row, this adapter's or not.
|
|
568
|
+
*
|
|
569
|
+
* Throws: nothing.
|
|
570
|
+
*/
|
|
571
|
+
export declare function checkpointIndexTarget(row: AttributeMap): IndexTarget | undefined;
|