@farukada/aws-langgraph-dynamodb-ts 0.9.0 → 1.0.0-rc.1
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 +282 -49
- package/dist/checkpointer/actions/delete-thread.d.ts +3 -2
- package/dist/checkpointer/actions/delete-thread.js +5 -2
- package/dist/checkpointer/actions/get-tuple.d.ts +3 -2
- package/dist/checkpointer/actions/get-tuple.js +10 -4
- package/dist/checkpointer/actions/list.d.ts +14 -4
- package/dist/checkpointer/actions/list.js +89 -63
- package/dist/checkpointer/actions/put-writes.d.ts +5 -5
- package/dist/checkpointer/actions/put-writes.js +12 -41
- package/dist/checkpointer/actions/put.d.ts +10 -3
- package/dist/checkpointer/actions/put.js +42 -12
- package/dist/checkpointer/internal/assemble.d.ts +10 -3
- package/dist/checkpointer/internal/assemble.js +7 -6
- package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +24 -0
- package/dist/checkpointer/internal/checkpoint-write-verify.js +67 -0
- package/dist/checkpointer/internal/configurable.d.ts +0 -1
- package/dist/checkpointer/internal/configurable.js +10 -9
- package/dist/checkpointer/internal/fetch.d.ts +14 -5
- package/dist/checkpointer/internal/fetch.js +56 -14
- package/dist/checkpointer/internal/filter-match.d.ts +3 -2
- package/dist/checkpointer/internal/filter-match.js +4 -3
- package/dist/checkpointer/internal/item-reader.d.ts +17 -6
- package/dist/checkpointer/internal/item-reader.js +39 -14
- package/dist/checkpointer/internal/item-writer.d.ts +12 -3
- package/dist/checkpointer/internal/item-writer.js +24 -9
- package/dist/checkpointer/internal/keys.d.ts +11 -1
- package/dist/checkpointer/internal/keys.js +33 -3
- package/dist/checkpointer/internal/list-scope.d.ts +61 -0
- package/dist/checkpointer/internal/list-scope.js +108 -0
- package/dist/checkpointer/internal/pending-sends.d.ts +13 -0
- package/dist/checkpointer/internal/pending-sends.js +29 -0
- package/dist/checkpointer/internal/query.d.ts +2 -1
- package/dist/checkpointer/internal/query.js +9 -3
- package/dist/checkpointer/internal/regular-write.d.ts +28 -0
- package/dist/checkpointer/internal/regular-write.js +66 -0
- package/dist/checkpointer/internal/setup.d.ts +3 -1
- package/dist/checkpointer/internal/setup.js +10 -8
- package/dist/checkpointer/internal/special-write-cas.d.ts +1 -2
- package/dist/checkpointer/internal/special-write-cas.js +9 -9
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +1 -2
- package/dist/checkpointer/internal/special-write-cleanup.js +10 -7
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -1
- package/dist/checkpointer/internal/special-write-verify.js +18 -3
- package/dist/checkpointer/internal/stored-channels.d.ts +31 -0
- package/dist/checkpointer/internal/stored-channels.js +70 -0
- package/dist/checkpointer/internal/validation.d.ts +11 -6
- package/dist/checkpointer/internal/validation.js +19 -9
- package/dist/checkpointer/internal/write-guard.d.ts +8 -1
- package/dist/checkpointer/internal/write-guard.js +16 -7
- package/dist/checkpointer/internal/write-index.d.ts +0 -1
- package/dist/checkpointer/internal/write-index.js +0 -1
- package/dist/checkpointer/saver.d.ts +50 -10
- package/dist/checkpointer/saver.js +59 -17
- package/dist/checkpointer/types.d.ts +8 -1
- package/dist/checkpointer/types.js +0 -1
- package/dist/factory/factory.d.ts +22 -25
- package/dist/factory/factory.js +58 -18
- package/dist/factory/types.d.ts +57 -0
- package/dist/factory/types.js +2 -0
- package/dist/history/actions/add-messages.d.ts +1 -2
- package/dist/history/actions/add-messages.js +4 -4
- package/dist/history/actions/clear.d.ts +3 -2
- package/dist/history/actions/clear.js +5 -2
- package/dist/history/actions/get-messages.d.ts +13 -6
- package/dist/history/actions/get-messages.js +63 -42
- package/dist/history/actions/list-sessions.d.ts +1 -1
- package/dist/history/actions/list-sessions.js +8 -12
- package/dist/history/actions/reconcile-count.d.ts +1 -2
- package/dist/history/actions/reconcile-count.js +20 -7
- package/dist/history/chat-message-history.d.ts +51 -26
- package/dist/history/chat-message-history.js +60 -30
- package/dist/history/internal/append-saga.d.ts +7 -2
- package/dist/history/internal/append-saga.js +58 -14
- package/dist/history/internal/compensation.d.ts +6 -2
- package/dist/history/internal/compensation.js +14 -6
- package/dist/history/internal/item-mapper.d.ts +0 -3
- package/dist/history/internal/item-mapper.js +2 -8
- package/dist/history/internal/keys.d.ts +0 -1
- package/dist/history/internal/keys.js +0 -1
- package/dist/history/internal/message-chunker.d.ts +0 -1
- package/dist/history/internal/message-chunker.js +0 -1
- package/dist/history/internal/message-transaction.d.ts +0 -1
- package/dist/history/internal/message-transaction.js +3 -2
- package/dist/history/internal/message-window.d.ts +17 -0
- package/dist/history/internal/message-window.js +49 -0
- package/dist/history/internal/query.d.ts +16 -3
- package/dist/history/internal/query.js +13 -5
- package/dist/history/internal/session-count.d.ts +8 -2
- package/dist/history/internal/session-count.js +14 -8
- package/dist/history/internal/session-title.d.ts +0 -1
- package/dist/history/internal/session-title.js +1 -2
- package/dist/history/internal/session-update.d.ts +0 -1
- package/dist/history/internal/session-update.js +0 -1
- package/dist/history/internal/setup.d.ts +3 -1
- package/dist/history/internal/setup.js +16 -8
- package/dist/history/internal/title-generator.d.ts +0 -1
- package/dist/history/internal/title-generator.js +19 -3
- package/dist/history/internal/ttl-anchor.d.ts +1 -2
- package/dist/history/internal/ttl-anchor.js +5 -5
- package/dist/history/internal/validation.d.ts +19 -3
- package/dist/history/internal/validation.js +41 -4
- package/dist/history/session-adapter.d.ts +9 -3
- package/dist/history/session-adapter.js +6 -3
- package/dist/history/types.d.ts +23 -2
- package/dist/history/types.js +0 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.js +5 -3
- package/dist/shared/clock.d.ts +6 -1
- package/dist/shared/clock.js +9 -1
- package/dist/shared/codec/codec.d.ts +26 -17
- package/dist/shared/codec/codec.js +46 -24
- package/dist/shared/codec/compression.d.ts +1 -2
- package/dist/shared/codec/compression.js +2 -3
- package/dist/shared/codec/descriptor-keys.d.ts +11 -3
- package/dist/shared/codec/descriptor-keys.js +2 -2
- package/dist/shared/codec/encode.d.ts +13 -0
- package/dist/shared/codec/encode.js +43 -0
- package/dist/shared/codec/json-serde.d.ts +0 -1
- package/dist/shared/codec/json-serde.js +0 -1
- package/dist/shared/codec/payload-loss.d.ts +12 -0
- package/dist/shared/codec/payload-loss.js +38 -0
- package/dist/shared/codec/s3/adapter-config.d.ts +13 -0
- package/dist/shared/codec/s3/adapter-config.js +22 -0
- package/dist/shared/codec/s3/bounded-body.d.ts +14 -0
- package/dist/shared/codec/s3/bounded-body.js +47 -0
- package/dist/shared/codec/s3/client-types.d.ts +34 -0
- package/dist/shared/codec/s3/client-types.js +7 -0
- package/dist/shared/codec/s3/client.d.ts +11 -5
- package/dist/shared/codec/s3/client.js +25 -3
- package/dist/shared/codec/s3/config.d.ts +32 -5
- package/dist/shared/codec/s3/config.js +37 -5
- package/dist/shared/codec/s3/delete.d.ts +0 -1
- package/dist/shared/codec/s3/delete.js +0 -1
- package/dist/shared/codec/s3/key-scope.d.ts +23 -0
- package/dist/shared/codec/s3/key-scope.js +44 -0
- package/dist/shared/codec/s3/lifecycle.d.ts +11 -5
- package/dist/shared/codec/s3/lifecycle.js +32 -16
- package/dist/shared/codec/s3/offloader.d.ts +6 -2
- package/dist/shared/codec/s3/offloader.js +21 -3
- package/dist/shared/codec/s3/orphans.d.ts +6 -1
- package/dist/shared/codec/s3/orphans.js +15 -2
- package/dist/shared/codec/s3/read-write.d.ts +7 -3
- package/dist/shared/codec/s3/read-write.js +16 -8
- package/dist/shared/codec/s3/retry.d.ts +4 -4
- package/dist/shared/codec/s3/retry.js +13 -16
- package/dist/shared/concurrency.d.ts +6 -0
- package/dist/shared/concurrency.js +30 -0
- package/dist/shared/constants.d.ts +53 -5
- package/dist/shared/constants.js +55 -7
- package/dist/shared/dynamodb/abort.d.ts +9 -0
- package/dist/shared/dynamodb/abort.js +27 -0
- package/dist/shared/dynamodb/backoff.d.ts +4 -4
- package/dist/shared/dynamodb/backoff.js +7 -7
- package/dist/shared/dynamodb/batch-write.d.ts +0 -1
- package/dist/shared/dynamodb/batch-write.js +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts +0 -1
- package/dist/shared/dynamodb/cancellation.js +0 -1
- package/dist/shared/dynamodb/client.d.ts +9 -2
- package/dist/shared/dynamodb/client.js +24 -1
- package/dist/shared/dynamodb/conditional-put.d.ts +18 -2
- package/dist/shared/dynamodb/conditional-put.js +19 -2
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +3 -1
- package/dist/shared/dynamodb/drain-unprocessed.js +1 -2
- package/dist/shared/dynamodb/expiry.d.ts +16 -0
- package/dist/shared/dynamodb/expiry.js +29 -0
- package/dist/shared/dynamodb/paginate-core.d.ts +5 -3
- package/dist/shared/dynamodb/paginate-core.js +47 -17
- package/dist/shared/dynamodb/paginate.d.ts +0 -1
- package/dist/shared/dynamodb/paginate.js +1 -2
- package/dist/shared/dynamodb/partition-delete.d.ts +7 -1
- package/dist/shared/dynamodb/partition-delete.js +4 -3
- package/dist/shared/dynamodb/retry-classifier.d.ts +10 -2
- package/dist/shared/dynamodb/retry-classifier.js +42 -11
- package/dist/shared/dynamodb/retry-policy.d.ts +26 -0
- package/dist/shared/dynamodb/retry-policy.js +22 -0
- package/dist/shared/dynamodb/retry.d.ts +14 -1
- package/dist/shared/dynamodb/retry.js +11 -7
- package/dist/shared/dynamodb/scan.d.ts +0 -1
- package/dist/shared/dynamodb/scan.js +1 -2
- package/dist/shared/dynamodb/types.d.ts +1 -2
- package/dist/shared/dynamodb/types.js +0 -1
- package/dist/shared/errors/base-error.d.ts +14 -6
- package/dist/shared/errors/base-error.js +8 -9
- package/dist/shared/errors/boundary.d.ts +18 -0
- package/dist/shared/errors/boundary.js +46 -0
- package/dist/shared/errors/error-code.d.ts +2 -2
- package/dist/shared/errors/error-code.js +1 -1
- package/dist/shared/errors/errors.d.ts +13 -13
- package/dist/shared/errors/errors.js +18 -16
- package/dist/shared/errors/upstream-error.d.ts +16 -0
- package/dist/shared/errors/upstream-error.js +27 -0
- package/dist/shared/errors/wrap-error.d.ts +0 -9
- package/dist/shared/errors/wrap-error.js +0 -15
- package/dist/shared/logging/logger.d.ts +6 -2
- package/dist/shared/logging/logger.js +0 -1
- package/dist/shared/logging/redaction-walk.d.ts +2 -2
- package/dist/shared/logging/redaction-walk.js +38 -18
- package/dist/shared/logging/redaction.d.ts +9 -5
- package/dist/shared/logging/redaction.js +19 -4
- package/dist/shared/logging/secret-patterns.d.ts +21 -3
- package/dist/shared/logging/secret-patterns.js +32 -6
- package/dist/shared/options.d.ts +9 -4
- package/dist/shared/options.js +0 -1
- package/dist/shared/ulid.d.ts +15 -2
- package/dist/shared/ulid.js +35 -3
- package/dist/shared/validation/options.d.ts +8 -0
- package/dist/shared/validation/options.js +90 -0
- package/dist/shared/validation/primitives.d.ts +14 -10
- package/dist/shared/validation/primitives.js +23 -25
- package/dist/shared/validation/ttl.d.ts +14 -7
- package/dist/shared/validation/ttl.js +29 -11
- package/dist/store/actions/get.d.ts +11 -3
- package/dist/store/actions/get.js +52 -14
- package/dist/store/actions/list-namespaces.d.ts +0 -1
- package/dist/store/actions/list-namespaces.js +10 -6
- package/dist/store/actions/put.d.ts +0 -1
- package/dist/store/actions/put.js +24 -13
- package/dist/store/actions/reconcile-vector-index.d.ts +3 -2
- package/dist/store/actions/reconcile-vector-index.js +2 -3
- package/dist/store/actions/search.d.ts +1 -2
- package/dist/store/actions/search.js +11 -38
- package/dist/store/internal/backend-search.d.ts +1 -2
- package/dist/store/internal/backend-search.js +12 -6
- package/dist/store/internal/batch-plan.d.ts +11 -0
- package/dist/store/internal/batch-plan.js +52 -0
- package/dist/store/internal/candidates.d.ts +23 -0
- package/dist/store/internal/candidates.js +94 -0
- package/dist/store/internal/filter.d.ts +0 -1
- package/dist/store/internal/filter.js +0 -1
- package/dist/store/internal/index-reconcile.d.ts +5 -6
- package/dist/store/internal/index-reconcile.js +25 -12
- package/dist/store/internal/index-sync.d.ts +0 -1
- package/dist/store/internal/index-sync.js +0 -1
- package/dist/store/internal/item-mapper.d.ts +5 -3
- package/dist/store/internal/item-mapper.js +14 -6
- package/dist/store/internal/keys.d.ts +0 -1
- package/dist/store/internal/keys.js +0 -1
- package/dist/store/internal/namespace-match.d.ts +0 -1
- package/dist/store/internal/namespace-match.js +0 -1
- package/dist/store/internal/option-validation.d.ts +13 -0
- package/dist/store/internal/option-validation.js +77 -0
- package/dist/store/internal/overwrite-swap.d.ts +0 -1
- package/dist/store/internal/overwrite-swap.js +10 -4
- package/dist/store/internal/persist.d.ts +3 -2
- package/dist/store/internal/persist.js +16 -11
- package/dist/store/internal/query.d.ts +6 -1
- package/dist/store/internal/query.js +17 -1
- package/dist/store/internal/ranker.d.ts +7 -2
- package/dist/store/internal/ranker.js +10 -2
- package/dist/store/internal/read-existing.d.ts +9 -5
- package/dist/store/internal/read-existing.js +22 -10
- package/dist/store/internal/score-direction.d.ts +0 -1
- package/dist/store/internal/score-direction.js +0 -1
- package/dist/store/internal/search-filter.d.ts +0 -1
- package/dist/store/internal/search-filter.js +0 -1
- package/dist/store/internal/semantic-search.d.ts +26 -5
- package/dist/store/internal/semantic-search.js +59 -19
- package/dist/store/internal/setup.d.ts +5 -13
- package/dist/store/internal/setup.js +11 -63
- package/dist/store/internal/text-path.d.ts +17 -0
- package/dist/store/internal/text-path.js +147 -0
- package/dist/store/internal/validation.d.ts +8 -3
- package/dist/store/internal/validation.js +21 -5
- package/dist/store/internal/write-verify.d.ts +15 -10
- package/dist/store/internal/write-verify.js +24 -21
- package/dist/store/store.d.ts +37 -9
- package/dist/store/store.js +52 -17
- package/dist/store/types.d.ts +6 -2
- package/dist/store/types.js +0 -1
- package/dist/store/vector-backend.d.ts +0 -1
- package/dist/store/vector-backend.js +0 -1
- package/package.json +21 -15
- 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.map +0 -1
- package/dist/checkpointer/internal/assemble.js.map +0 -1
- package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
- package/dist/checkpointer/internal/configurable.js.map +0 -1
- package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
- package/dist/checkpointer/internal/fetch.js.map +0 -1
- package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
- package/dist/checkpointer/internal/filter-match.js.map +0 -1
- package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-reader.js.map +0 -1
- package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-writer.js.map +0 -1
- package/dist/checkpointer/internal/keys.d.ts.map +0 -1
- package/dist/checkpointer/internal/keys.js.map +0 -1
- package/dist/checkpointer/internal/query.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
- package/dist/checkpointer/internal/validation.d.ts.map +0 -1
- package/dist/checkpointer/internal/validation.js.map +0 -1
- package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-guard.js.map +0 -1
- package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/history/internal/append-saga.js.map +0 -1
- package/dist/history/internal/compensation.d.ts.map +0 -1
- package/dist/history/internal/compensation.js.map +0 -1
- package/dist/history/internal/item-mapper.d.ts.map +0 -1
- package/dist/history/internal/item-mapper.js.map +0 -1
- package/dist/history/internal/keys.d.ts.map +0 -1
- package/dist/history/internal/keys.js.map +0 -1
- package/dist/history/internal/message-chunker.d.ts.map +0 -1
- package/dist/history/internal/message-chunker.js.map +0 -1
- package/dist/history/internal/message-transaction.d.ts.map +0 -1
- package/dist/history/internal/message-transaction.js.map +0 -1
- package/dist/history/internal/query.d.ts.map +0 -1
- package/dist/history/internal/query.js.map +0 -1
- package/dist/history/internal/session-count.d.ts.map +0 -1
- package/dist/history/internal/session-count.js.map +0 -1
- package/dist/history/internal/session-title.d.ts.map +0 -1
- package/dist/history/internal/session-title.js.map +0 -1
- package/dist/history/internal/session-update.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/history/internal/title-generator.js.map +0 -1
- package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
- package/dist/history/internal/ttl-anchor.js.map +0 -1
- package/dist/history/internal/validation.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/shared/codec/s3/orphans.js.map +0 -1
- package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
- package/dist/shared/codec/s3/read-write.js.map +0 -1
- package/dist/shared/codec/s3/retry.d.ts.map +0 -1
- package/dist/shared/codec/s3/retry.js.map +0 -1
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/shared/dynamodb/conditional-put.js.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
- package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/shared/dynamodb/scan.js.map +0 -1
- package/dist/shared/dynamodb/types.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/store/internal/index-reconcile.js.map +0 -1
- package/dist/store/internal/index-sync.d.ts.map +0 -1
- package/dist/store/internal/index-sync.js.map +0 -1
- package/dist/store/internal/item-mapper.d.ts.map +0 -1
- package/dist/store/internal/item-mapper.js.map +0 -1
- package/dist/store/internal/keys.d.ts.map +0 -1
- package/dist/store/internal/keys.js.map +0 -1
- package/dist/store/internal/namespace-match.d.ts.map +0 -1
- package/dist/store/internal/namespace-match.js.map +0 -1
- package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
- package/dist/store/internal/overwrite-swap.js.map +0 -1
- package/dist/store/internal/persist.d.ts.map +0 -1
- package/dist/store/internal/persist.js.map +0 -1
- package/dist/store/internal/query.d.ts.map +0 -1
- package/dist/store/internal/query.js.map +0 -1
- package/dist/store/internal/ranker.d.ts.map +0 -1
- package/dist/store/internal/ranker.js.map +0 -1
- package/dist/store/internal/read-existing.d.ts.map +0 -1
- package/dist/store/internal/read-existing.js.map +0 -1
- package/dist/store/internal/score-direction.d.ts.map +0 -1
- package/dist/store/internal/score-direction.js.map +0 -1
- package/dist/store/internal/search-filter.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/store/internal/validation.js.map +0 -1
- package/dist/store/internal/write-verify.d.ts.map +0 -1
- 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,13 @@
|
|
|
1
|
+
import { type Checkpoint } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import { type ReadOptions } from './fetch';
|
|
3
|
+
import type { CheckpointerContext } from './setup';
|
|
4
|
+
/**
|
|
5
|
+
* Pre-v4 checkpoints kept a task's `Send`s as `__pregel_tasks` pending writes
|
|
6
|
+
* on the parent rather than in the checkpoint itself. Reading such a
|
|
7
|
+
* checkpoint rebuilds `channel_values[TASKS]` from those writes and stamps
|
|
8
|
+
* the channel with the highest version the checkpoint already carries (or
|
|
9
|
+
* the first version when it carries none), exactly as the reference savers
|
|
10
|
+
* do, so a thread written before LangGraph 0.2 still resumes. A v4 checkpoint,
|
|
11
|
+
* or one without a parent, is returned untouched.
|
|
12
|
+
*/
|
|
13
|
+
export declare function migratePendingSends(context: CheckpointerContext, checkpoint: Checkpoint, threadId: string, checkpointNs: string, parentCheckpointId: string | undefined, read: ReadOptions): Promise<Checkpoint>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migratePendingSends = migratePendingSends;
|
|
4
|
+
const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
|
5
|
+
const fetch_1 = require("./fetch");
|
|
6
|
+
/**
|
|
7
|
+
* Pre-v4 checkpoints kept a task's `Send`s as `__pregel_tasks` pending writes
|
|
8
|
+
* on the parent rather than in the checkpoint itself. Reading such a
|
|
9
|
+
* checkpoint rebuilds `channel_values[TASKS]` from those writes and stamps
|
|
10
|
+
* the channel with the highest version the checkpoint already carries (or
|
|
11
|
+
* the first version when it carries none), exactly as the reference savers
|
|
12
|
+
* do, so a thread written before LangGraph 0.2 still resumes. A v4 checkpoint,
|
|
13
|
+
* or one without a parent, is returned untouched.
|
|
14
|
+
*/
|
|
15
|
+
async function migratePendingSends(context, checkpoint, threadId, checkpointNs, parentCheckpointId, read) {
|
|
16
|
+
if (checkpoint.v >= 4 || parentCheckpointId === undefined)
|
|
17
|
+
return checkpoint;
|
|
18
|
+
const writes = await (0, fetch_1.fetchPendingWrites)(context, threadId, checkpointNs, parentCheckpointId, read);
|
|
19
|
+
const sends = writes.filter(([, channel]) => channel === langgraph_checkpoint_1.TASKS).map(([, , value]) => value);
|
|
20
|
+
const versions = Object.values(checkpoint.channel_versions);
|
|
21
|
+
return {
|
|
22
|
+
...checkpoint,
|
|
23
|
+
channel_values: { ...checkpoint.channel_values, [langgraph_checkpoint_1.TASKS]: sends },
|
|
24
|
+
channel_versions: {
|
|
25
|
+
...checkpoint.channel_versions,
|
|
26
|
+
[langgraph_checkpoint_1.TASKS]: versions.length > 0 ? (0, langgraph_checkpoint_1.maxChannelVersion)(...versions) : 1,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -6,6 +6,8 @@ export interface PartitionQueryOptions {
|
|
|
6
6
|
/** Options for {@link beginsWithQuery}. */
|
|
7
7
|
export interface BeginsWithQueryOptions {
|
|
8
8
|
limit?: number;
|
|
9
|
+
/** Inclusive upper bound on the sort key; turns the prefix match into a `BETWEEN`. */
|
|
10
|
+
beforeSortKey?: string;
|
|
9
11
|
ascending?: boolean;
|
|
10
12
|
consistent?: boolean;
|
|
11
13
|
}
|
|
@@ -17,4 +19,3 @@ export declare function partitionQuery(tableName: string, partition: string, opt
|
|
|
17
19
|
* never appear bare. Defaults to newest-first ordering.
|
|
18
20
|
*/
|
|
19
21
|
export declare function beginsWithQuery(tableName: string, partition: string, skPrefix: string, options?: BeginsWithQueryOptions): QueryCommandInput;
|
|
20
|
-
//# sourceMappingURL=query.d.ts.map
|
|
@@ -20,11 +20,18 @@ function partitionQuery(tableName, partition, options = {}) {
|
|
|
20
20
|
* never appear bare. Defaults to newest-first ordering.
|
|
21
21
|
*/
|
|
22
22
|
function beginsWithQuery(tableName, partition, skPrefix, options = {}) {
|
|
23
|
+
const bounded = options.beforeSortKey !== undefined;
|
|
23
24
|
const params = {
|
|
24
25
|
TableName: tableName,
|
|
25
|
-
KeyConditionExpression:
|
|
26
|
+
KeyConditionExpression: bounded
|
|
27
|
+
? '#pk = :pk AND #sk BETWEEN :skPrefix AND :before'
|
|
28
|
+
: '#pk = :pk AND begins_with(#sk, :skPrefix)',
|
|
26
29
|
ExpressionAttributeNames: { '#pk': 'PK', '#sk': 'SK' },
|
|
27
|
-
ExpressionAttributeValues: {
|
|
30
|
+
ExpressionAttributeValues: {
|
|
31
|
+
':pk': partition,
|
|
32
|
+
':skPrefix': skPrefix,
|
|
33
|
+
...(bounded ? { ':before': options.beforeSortKey } : {}),
|
|
34
|
+
},
|
|
28
35
|
ScanIndexForward: options.ascending ?? false,
|
|
29
36
|
};
|
|
30
37
|
if (options.limit !== undefined)
|
|
@@ -33,4 +40,3 @@ function beginsWithQuery(tableName, partition, skPrefix, options = {}) {
|
|
|
33
40
|
params.ConsistentRead = true;
|
|
34
41
|
return params;
|
|
35
42
|
}
|
|
36
|
-
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CheckpointWriteItem } from '../types';
|
|
2
|
+
import type { CheckpointerContext } from './setup';
|
|
3
|
+
/**
|
|
4
|
+
* Outcome of {@link writeRegularItems}: never rejects. `deadUploads` holds
|
|
5
|
+
* exactly the items whose own S3 upload is confirmed unreferenced — a
|
|
6
|
+
* verified non-commit, or a guard rejection whose returned row provably
|
|
7
|
+
* belongs to another call — and is therefore safe to delete. Everything else
|
|
8
|
+
* either committed, was turned away by a row this call may have written
|
|
9
|
+
* itself, or could not be verified; none of those may be cleaned up.
|
|
10
|
+
*/
|
|
11
|
+
export interface RegularWriteOutcome {
|
|
12
|
+
deadUploads: CheckpointWriteItem[];
|
|
13
|
+
error?: Error;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Write regular items with a first-write-wins guard. Every `PutCommand` fully
|
|
17
|
+
* settles (`Promise.allSettled`) before this resolves and never rejects; a
|
|
18
|
+
* genuine failure is reported via `error`, not thrown.
|
|
19
|
+
*
|
|
20
|
+
* A failure is not proof of a non-commit: `withDynamoDBRetry` re-issues a put
|
|
21
|
+
* whose response was lost, and the re-issues can time out at the transport, so
|
|
22
|
+
* the budget is spent on a `RetryExhaustedError` while the row is live.
|
|
23
|
+
* Treating that as "never reached DynamoDB" deleted the object the live row
|
|
24
|
+
* pointed at, making the checkpoint's pending writes unreadable forever. Each
|
|
25
|
+
* such failure is therefore verified against the row before it is classified,
|
|
26
|
+
* and a committed one is not an error at all.
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeRegularItems(context: CheckpointerContext, items: CheckpointWriteItem[], signal?: AbortSignal): Promise<RegularWriteOutcome>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeRegularItems = writeRegularItems;
|
|
4
|
+
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
5
|
+
const retry_1 = require("../../shared/dynamodb/retry");
|
|
6
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
7
|
+
const special_write_verify_1 = require("./special-write-verify");
|
|
8
|
+
const write_guard_1 = require("./write-guard");
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a non-guard failure by reading the row back. Without an offloader
|
|
11
|
+
* there is no object to protect, so the write is simply reported as not
|
|
12
|
+
* committed and the caller's cleanup is a no-op. The row holding this call's
|
|
13
|
+
* own `writeGroup` means the put landed and only its response was lost.
|
|
14
|
+
*/
|
|
15
|
+
async function verifyFailure(context, item) {
|
|
16
|
+
if (!context.offloader)
|
|
17
|
+
return 'not-committed';
|
|
18
|
+
try {
|
|
19
|
+
const observed = await (0, special_write_verify_1.readSpecialRow)(context, item);
|
|
20
|
+
return observed.revision === item.writeGroup ? 'committed' : 'not-committed';
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return 'unverified';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Write regular items with a first-write-wins guard. Every `PutCommand` fully
|
|
28
|
+
* settles (`Promise.allSettled`) before this resolves and never rejects; a
|
|
29
|
+
* genuine failure is reported via `error`, not thrown.
|
|
30
|
+
*
|
|
31
|
+
* A failure is not proof of a non-commit: `withDynamoDBRetry` re-issues a put
|
|
32
|
+
* whose response was lost, and the re-issues can time out at the transport, so
|
|
33
|
+
* the budget is spent on a `RetryExhaustedError` while the row is live.
|
|
34
|
+
* Treating that as "never reached DynamoDB" deleted the object the live row
|
|
35
|
+
* pointed at, making the checkpoint's pending writes unreadable forever. Each
|
|
36
|
+
* such failure is therefore verified against the row before it is classified,
|
|
37
|
+
* and a committed one is not an error at all.
|
|
38
|
+
*/
|
|
39
|
+
async function writeRegularItems(context, items, signal) {
|
|
40
|
+
const results = await Promise.allSettled(items.map((item) => (0, retry_1.withDynamoDBRetry)(() => context.client.put({
|
|
41
|
+
TableName: context.tableName,
|
|
42
|
+
Item: item,
|
|
43
|
+
ConditionExpression: 'attribute_not_exists(PK)',
|
|
44
|
+
ReturnValuesOnConditionCheckFailure: 'ALL_OLD',
|
|
45
|
+
}), (0, retry_policy_1.retryFor)(context, signal))));
|
|
46
|
+
const outcome = { deadUploads: [] };
|
|
47
|
+
for (const [index, result] of results.entries()) {
|
|
48
|
+
if (result.status === 'fulfilled')
|
|
49
|
+
continue;
|
|
50
|
+
const item = items[index];
|
|
51
|
+
const reason = result.reason;
|
|
52
|
+
if ((0, conditional_put_1.isConditionalCheckFailed)(reason)) {
|
|
53
|
+
(0, write_guard_1.reportGuardRejection)(context, item, reason);
|
|
54
|
+
if ((0, write_guard_1.rejectionProvesForeignRow)(item, reason))
|
|
55
|
+
outcome.deadUploads.push(item);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const verdict = await verifyFailure(context, item);
|
|
59
|
+
if (verdict === 'committed')
|
|
60
|
+
continue;
|
|
61
|
+
if (verdict === 'not-committed')
|
|
62
|
+
outcome.deadUploads.push(item);
|
|
63
|
+
outcome.error = outcome.error ?? reason;
|
|
64
|
+
}
|
|
65
|
+
return outcome;
|
|
66
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
|
|
|
3
3
|
import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
4
4
|
import type { CompressionConfig } from '../../shared/codec/compression';
|
|
5
5
|
import { S3Offloader } from '../../shared/codec/s3/offloader';
|
|
6
|
+
import type { RetryOptions } from '../../shared/dynamodb/retry';
|
|
6
7
|
import { type Logger } from '../../shared/logging/logger';
|
|
7
8
|
import type { TtlOption } from '../../shared/validation/ttl';
|
|
8
9
|
import type { DynamoDBSaverOptions } from '../types';
|
|
@@ -15,6 +16,8 @@ export interface CheckpointerContext {
|
|
|
15
16
|
offloader?: S3Offloader;
|
|
16
17
|
ttl?: TtlOption;
|
|
17
18
|
logger: Logger;
|
|
19
|
+
/** Retry budget and backoff for every DynamoDB call, with the retry debug log attached. */
|
|
20
|
+
retry?: RetryOptions;
|
|
18
21
|
}
|
|
19
22
|
/** Result of wiring up a checkpointer from its options. */
|
|
20
23
|
export interface CheckpointerSetup {
|
|
@@ -28,4 +31,3 @@ export interface CheckpointerSetup {
|
|
|
28
31
|
* tear resources down.
|
|
29
32
|
*/
|
|
30
33
|
export declare function setUpCheckpointer(options: DynamoDBSaverOptions, serde: SerializerProtocol): CheckpointerSetup;
|
|
31
|
-
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setUpCheckpointer = setUpCheckpointer;
|
|
4
|
-
const
|
|
4
|
+
const adapter_config_1 = require("../../shared/codec/s3/adapter-config");
|
|
5
5
|
const offloader_1 = require("../../shared/codec/s3/offloader");
|
|
6
|
-
const constants_1 = require("../../shared/constants");
|
|
7
6
|
const client_1 = require("../../shared/dynamodb/client");
|
|
7
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
8
8
|
const logger_1 = require("../../shared/logging/logger");
|
|
9
|
+
const options_1 = require("../../shared/validation/options");
|
|
9
10
|
/**
|
|
10
11
|
* Resolve the DynamoDB client, optional S3 offloader, and logging into the
|
|
11
12
|
* context every action receives, plus the ownership info the class needs to
|
|
12
13
|
* tear resources down.
|
|
13
14
|
*/
|
|
14
15
|
function setUpCheckpointer(options, serde) {
|
|
16
|
+
(0, options_1.validateBaseAdapterOptions)(options);
|
|
17
|
+
const logger = (0, logger_1.resolveLogger)(options.logger);
|
|
15
18
|
const resolved = (0, client_1.resolveDynamoDBClient)(options);
|
|
19
|
+
if (!resolved.ownsClient)
|
|
20
|
+
void (0, client_1.warnOnStackedRetries)(resolved.client, logger);
|
|
16
21
|
const offloader = options.s3
|
|
17
|
-
? new offloader_1.S3Offloader(
|
|
18
|
-
...options.s3,
|
|
19
|
-
keyPrefix: options.s3.keyPrefix ?? (0, config_1.defaultAdapterKeyPrefix)(constants_1.DEFAULT_S3_KEY_PREFIX, 'checkpointer'),
|
|
20
|
-
})
|
|
22
|
+
? new offloader_1.S3Offloader((0, adapter_config_1.offloaderConfigFor)(options.s3, 'checkpointer', options.clientConfig))
|
|
21
23
|
: undefined;
|
|
22
24
|
return {
|
|
23
25
|
context: {
|
|
@@ -27,10 +29,10 @@ function setUpCheckpointer(options, serde) {
|
|
|
27
29
|
compression: options.compression,
|
|
28
30
|
offloader,
|
|
29
31
|
ttl: options.ttl,
|
|
30
|
-
logger
|
|
32
|
+
logger,
|
|
33
|
+
retry: (0, retry_policy_1.resolveRetryPolicy)(options.retry, logger),
|
|
31
34
|
},
|
|
32
35
|
ddbClient: resolved.ddbClient,
|
|
33
36
|
ownsClient: resolved.ownsClient,
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
|
-
//# sourceMappingURL=setup.js.map
|
|
@@ -26,5 +26,4 @@ import { type SpecialWriteOutcome } from './special-write-verify';
|
|
|
26
26
|
* under `Promise.all`, whose own cleanup depends on every branch resolving
|
|
27
27
|
* rather than short-circuiting.
|
|
28
28
|
*/
|
|
29
|
-
export declare function writeSpecialItem(context: CheckpointerContext, item: CheckpointWriteItem): Promise<SpecialWriteOutcome>;
|
|
30
|
-
//# sourceMappingURL=special-write-cas.d.ts.map
|
|
29
|
+
export declare function writeSpecialItem(context: CheckpointerContext, item: CheckpointWriteItem, signal?: AbortSignal): Promise<SpecialWriteOutcome>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.writeSpecialItem = writeSpecialItem;
|
|
4
4
|
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
5
5
|
const retry_1 = require("../../shared/dynamodb/retry");
|
|
6
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
6
7
|
const special_write_verify_1 = require("./special-write-verify");
|
|
7
8
|
/**
|
|
8
9
|
* Retry a conditional put up to {@link OVERWRITE_CAS_MAX_ATTEMPTS} times,
|
|
@@ -23,7 +24,7 @@ const special_write_verify_1 = require("./special-write-verify");
|
|
|
23
24
|
* Only a rejection whose re-read proves some *other* writer holds the row is
|
|
24
25
|
* retried; every other failure is already settled by the verification.
|
|
25
26
|
*/
|
|
26
|
-
async function attemptCasWrites(context, item, initial) {
|
|
27
|
+
async function attemptCasWrites(context, item, initial, signal) {
|
|
27
28
|
let observed = initial;
|
|
28
29
|
for (let attempt = 1; attempt <= conditional_put_1.OVERWRITE_CAS_MAX_ATTEMPTS; attempt++) {
|
|
29
30
|
const attempted = observed;
|
|
@@ -32,7 +33,7 @@ async function attemptCasWrites(context, item, initial) {
|
|
|
32
33
|
TableName: context.tableName,
|
|
33
34
|
Item: item,
|
|
34
35
|
...(0, conditional_put_1.revisionGuard)(special_write_verify_1.SPECIAL_REVISION_ATTRIBUTE, attempted),
|
|
35
|
-
}));
|
|
36
|
+
}), (0, retry_policy_1.retryFor)(context, signal));
|
|
36
37
|
return { done: true, outcome: { committed: true, superseded: attempted.value } };
|
|
37
38
|
}
|
|
38
39
|
catch (error) {
|
|
@@ -49,9 +50,9 @@ async function attemptCasWrites(context, item, initial) {
|
|
|
49
50
|
* Overwrite the row unconditionally once the compare-and-swap budget is spent,
|
|
50
51
|
* verifying rather than assuming if that put fails too.
|
|
51
52
|
*/
|
|
52
|
-
async function overwriteUnconditionally(context, item, observed) {
|
|
53
|
+
async function overwriteUnconditionally(context, item, observed, signal) {
|
|
53
54
|
try {
|
|
54
|
-
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({ TableName: context.tableName, Item: item }));
|
|
55
|
+
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({ TableName: context.tableName, Item: item }), (0, retry_policy_1.retryFor)(context, signal));
|
|
55
56
|
return { committed: true, superseded: observed.value };
|
|
56
57
|
}
|
|
57
58
|
catch (error) {
|
|
@@ -83,22 +84,21 @@ async function overwriteUnconditionally(context, item, observed) {
|
|
|
83
84
|
* under `Promise.all`, whose own cleanup depends on every branch resolving
|
|
84
85
|
* rather than short-circuiting.
|
|
85
86
|
*/
|
|
86
|
-
async function writeSpecialItem(context, item) {
|
|
87
|
+
async function writeSpecialItem(context, item, signal) {
|
|
87
88
|
try {
|
|
88
89
|
if (!context.offloader) {
|
|
89
|
-
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({ TableName: context.tableName, Item: item }));
|
|
90
|
+
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({ TableName: context.tableName, Item: item }), (0, retry_policy_1.retryFor)(context, signal));
|
|
90
91
|
return { committed: true };
|
|
91
92
|
}
|
|
92
93
|
const initial = await (0, special_write_verify_1.readSpecialRow)(context, item);
|
|
93
|
-
const attempt = await attemptCasWrites(context, item, initial);
|
|
94
|
+
const attempt = await attemptCasWrites(context, item, initial, signal);
|
|
94
95
|
if (attempt.done)
|
|
95
96
|
return attempt.outcome;
|
|
96
97
|
context.logger.warn('putWrites: special-write compare-and-swap exhausted; overwriting unconditionally, which ' +
|
|
97
98
|
'can orphan one S3 object under a concurrent call (reclaimed by ensureS3LifecycleRule)', { sortKey: item.SK, channel: item.channel, attempts: conditional_put_1.OVERWRITE_CAS_MAX_ATTEMPTS });
|
|
98
|
-
return await overwriteUnconditionally(context, item, attempt.observed);
|
|
99
|
+
return await overwriteUnconditionally(context, item, attempt.observed, signal);
|
|
99
100
|
}
|
|
100
101
|
catch (error) {
|
|
101
102
|
return { committed: false, error: error };
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
//# sourceMappingURL=special-write-cas.js.map
|
|
@@ -20,5 +20,4 @@ import type { CheckpointerContext } from './setup';
|
|
|
20
20
|
* whose own cleanup depends on every branch resolving rather than
|
|
21
21
|
* short-circuiting.
|
|
22
22
|
*/
|
|
23
|
-
export declare function writeSpecialItemsWithCleanup(context: CheckpointerContext, items: CheckpointWriteItem[]): Promise<Error | undefined>;
|
|
24
|
-
//# sourceMappingURL=special-write-cleanup.d.ts.map
|
|
23
|
+
export declare function writeSpecialItemsWithCleanup(context: CheckpointerContext, threadId: string, items: CheckpointWriteItem[], signal?: AbortSignal): Promise<Error | undefined>;
|
|
@@ -4,14 +4,18 @@ exports.writeSpecialItemsWithCleanup = writeSpecialItemsWithCleanup;
|
|
|
4
4
|
const descriptor_keys_1 = require("../../shared/codec/descriptor-keys");
|
|
5
5
|
const orphans_1 = require("../../shared/codec/s3/orphans");
|
|
6
6
|
const special_write_cas_1 = require("./special-write-cas");
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Best-effort delete the S3 objects backing `descriptors`, if offloading is on.
|
|
9
|
+
* `scope` is given for descriptors read back from rows (the superseded values)
|
|
10
|
+
* and omitted for this call's own uploads.
|
|
11
|
+
*/
|
|
12
|
+
async function deleteDescriptors(context, descriptors, label, scope) {
|
|
9
13
|
if (!context.offloader)
|
|
10
14
|
return;
|
|
11
15
|
const present = descriptors.filter((d) => d !== undefined);
|
|
12
16
|
if (present.length === 0)
|
|
13
17
|
return;
|
|
14
|
-
await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)(present), label, context.logger);
|
|
18
|
+
await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)(present), label, context.logger, scope === undefined ? {} : { scope });
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* Write special (negative-index) items, then clean up the correct side of each.
|
|
@@ -33,15 +37,14 @@ async function deleteDescriptors(context, descriptors, label) {
|
|
|
33
37
|
* whose own cleanup depends on every branch resolving rather than
|
|
34
38
|
* short-circuiting.
|
|
35
39
|
*/
|
|
36
|
-
async function writeSpecialItemsWithCleanup(context, items) {
|
|
40
|
+
async function writeSpecialItemsWithCleanup(context, threadId, items, signal) {
|
|
37
41
|
if (items.length === 0)
|
|
38
42
|
return undefined;
|
|
39
43
|
const outcomes = await Promise.all(items.map(async (item) => [
|
|
40
44
|
item,
|
|
41
|
-
await (0, special_write_cas_1.writeSpecialItem)(context, item),
|
|
45
|
+
await (0, special_write_cas_1.writeSpecialItem)(context, item, signal),
|
|
42
46
|
]));
|
|
43
|
-
await deleteDescriptors(context, outcomes.filter(([, o]) => o.committed).map(([, o]) => o.superseded), 'putWrites.special.previous');
|
|
47
|
+
await deleteDescriptors(context, outcomes.filter(([, o]) => o.committed).map(([, o]) => o.superseded), 'putWrites.special.previous', [threadId]);
|
|
44
48
|
await deleteDescriptors(context, outcomes.filter(([, o]) => !o.committed).map(([item]) => item.value), 'putWrites.special.newUpload');
|
|
45
49
|
return outcomes.find(([, o]) => o.error)?.[1].error;
|
|
46
50
|
}
|
|
47
|
-
//# sourceMappingURL=special-write-cleanup.js.map
|
|
@@ -51,4 +51,3 @@ export declare function readSpecialRow(context: CheckpointerContext, item: Check
|
|
|
51
51
|
* row — the same trade `store/internal/persist.ts` makes.
|
|
52
52
|
*/
|
|
53
53
|
export declare function verifyAfterFailure(context: CheckpointerContext, item: CheckpointWriteItem, attempted: SpecialRowState, error: Error): Promise<VerifiedFailure>;
|
|
54
|
-
//# sourceMappingURL=special-write-verify.d.ts.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SPECIAL_REVISION_ATTRIBUTE = void 0;
|
|
4
4
|
exports.readSpecialRow = readSpecialRow;
|
|
5
5
|
exports.verifyAfterFailure = verifyAfterFailure;
|
|
6
|
+
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
6
7
|
const retry_1 = require("../../shared/dynamodb/retry");
|
|
7
8
|
/**
|
|
8
9
|
* A special row already carries a per-call ULID in `writeGroup`, so it needs no
|
|
@@ -17,7 +18,7 @@ async function readSpecialRow(context, item) {
|
|
|
17
18
|
ConsistentRead: true,
|
|
18
19
|
ProjectionExpression: '#v, #g',
|
|
19
20
|
ExpressionAttributeNames: { '#v': 'value', '#g': exports.SPECIAL_REVISION_ATTRIBUTE },
|
|
20
|
-
}));
|
|
21
|
+
}), context.retry);
|
|
21
22
|
if (!result.Item)
|
|
22
23
|
return { exists: false };
|
|
23
24
|
return {
|
|
@@ -26,6 +27,21 @@ async function readSpecialRow(context, item) {
|
|
|
26
27
|
revision: result.Item[exports.SPECIAL_REVISION_ATTRIBUTE],
|
|
27
28
|
};
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The row as it stood when the put failed: a guard rejection carries it (see
|
|
32
|
+
* `rejectedItem`), so the strongly-consistent read is spent only for a failure
|
|
33
|
+
* that does not — a lost response, or a rejection whose row vanished since.
|
|
34
|
+
*/
|
|
35
|
+
async function observeRow(context, item, error) {
|
|
36
|
+
const rejected = (0, conditional_put_1.isConditionalCheckFailed)(error) ? (0, conditional_put_1.rejectedItem)(error) : undefined;
|
|
37
|
+
if (!rejected)
|
|
38
|
+
return readSpecialRow(context, item);
|
|
39
|
+
return {
|
|
40
|
+
exists: true,
|
|
41
|
+
value: rejected.value,
|
|
42
|
+
revision: rejected[exports.SPECIAL_REVISION_ATTRIBUTE],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
29
45
|
/**
|
|
30
46
|
* Read the row back after a put failed, and report what that failure actually
|
|
31
47
|
* did — never assuming it did nothing.
|
|
@@ -52,7 +68,7 @@ async function readSpecialRow(context, item) {
|
|
|
52
68
|
*/
|
|
53
69
|
async function verifyAfterFailure(context, item, attempted, error) {
|
|
54
70
|
try {
|
|
55
|
-
const observed = await
|
|
71
|
+
const observed = await observeRow(context, item, error);
|
|
56
72
|
if (observed.revision === item.writeGroup) {
|
|
57
73
|
return { outcome: { committed: true, superseded: attempted.value } };
|
|
58
74
|
}
|
|
@@ -62,4 +78,3 @@ async function verifyAfterFailure(context, item, attempted, error) {
|
|
|
62
78
|
return { outcome: { committed: true, error } };
|
|
63
79
|
}
|
|
64
80
|
}
|
|
65
|
-
//# sourceMappingURL=special-write-verify.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChannelVersions, Checkpoint } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import type { CheckpointerContext } from './setup';
|
|
3
|
+
/**
|
|
4
|
+
* The channels a put stores values for. With `newVersions` the reference
|
|
5
|
+
* savers store only the channels that changed in this step and rebuild the
|
|
6
|
+
* rest from earlier checkpoints on read; here the rest are carried into the
|
|
7
|
+
* new row directly — every channel the parent stored that this put still
|
|
8
|
+
* holds a value for — so a read never walks ancestors. A value the put holds
|
|
9
|
+
* for a channel that neither changed nor was stored before has no version of
|
|
10
|
+
* record and is not stored. Without `newVersions` (a caller predating the
|
|
11
|
+
* argument) every value given is stored, and so it is when `parentStored` is
|
|
12
|
+
* `undefined`: the parent row predates the attribute and held everything.
|
|
13
|
+
*/
|
|
14
|
+
export declare function selectStoredChannels(checkpoint: Checkpoint, newVersions: ChannelVersions | undefined, parentStored: readonly string[] | undefined): string[];
|
|
15
|
+
/** The checkpoint as it is stored: `channel_values` narrowed to `channels`, everything else untouched. */
|
|
16
|
+
export declare function withStoredChannels(checkpoint: Checkpoint, channels: readonly string[]): Checkpoint;
|
|
17
|
+
/** True when `newVersions` already names every value the checkpoint carries, so nothing needs carrying over. */
|
|
18
|
+
export declare function coversEveryChannel(checkpoint: Checkpoint, newVersions: ChannelVersions): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The parent's stored-channel list, read from its META row with a consistent
|
|
21
|
+
* projection of that one attribute. `undefined` when the parent is gone
|
|
22
|
+
* (deleted or expired) or predates the attribute: both mean "carry every
|
|
23
|
+
* value the put holds", the behaviour those rows were written under.
|
|
24
|
+
*/
|
|
25
|
+
export declare function readParentStoredChannels(context: CheckpointerContext, threadId: string, checkpointNs: string, parentCheckpointId: string, signal?: AbortSignal): Promise<readonly string[] | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the channels a put stores, spending the parent read only when it
|
|
28
|
+
* can change the answer: never without `newVersions` or a parent, and not
|
|
29
|
+
* when `newVersions` already covers every value the put carries.
|
|
30
|
+
*/
|
|
31
|
+
export declare function storedChannelsFor(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpoint: Checkpoint, newVersions: ChannelVersions | undefined, parentCheckpointId: string | undefined, signal?: AbortSignal): Promise<string[]>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectStoredChannels = selectStoredChannels;
|
|
4
|
+
exports.withStoredChannels = withStoredChannels;
|
|
5
|
+
exports.coversEveryChannel = coversEveryChannel;
|
|
6
|
+
exports.readParentStoredChannels = readParentStoredChannels;
|
|
7
|
+
exports.storedChannelsFor = storedChannelsFor;
|
|
8
|
+
const retry_1 = require("../../shared/dynamodb/retry");
|
|
9
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
10
|
+
const keys_1 = require("./keys");
|
|
11
|
+
/**
|
|
12
|
+
* The channels a put stores values for. With `newVersions` the reference
|
|
13
|
+
* savers store only the channels that changed in this step and rebuild the
|
|
14
|
+
* rest from earlier checkpoints on read; here the rest are carried into the
|
|
15
|
+
* new row directly — every channel the parent stored that this put still
|
|
16
|
+
* holds a value for — so a read never walks ancestors. A value the put holds
|
|
17
|
+
* for a channel that neither changed nor was stored before has no version of
|
|
18
|
+
* record and is not stored. Without `newVersions` (a caller predating the
|
|
19
|
+
* argument) every value given is stored, and so it is when `parentStored` is
|
|
20
|
+
* `undefined`: the parent row predates the attribute and held everything.
|
|
21
|
+
*/
|
|
22
|
+
function selectStoredChannels(checkpoint, newVersions, parentStored) {
|
|
23
|
+
const present = Object.keys(checkpoint.channel_values);
|
|
24
|
+
if (newVersions === undefined)
|
|
25
|
+
return present;
|
|
26
|
+
const keep = new Set([...Object.keys(newVersions), ...(parentStored ?? present)]);
|
|
27
|
+
return present.filter((channel) => keep.has(channel));
|
|
28
|
+
}
|
|
29
|
+
/** The checkpoint as it is stored: `channel_values` narrowed to `channels`, everything else untouched. */
|
|
30
|
+
function withStoredChannels(checkpoint, channels) {
|
|
31
|
+
const channelValues = {};
|
|
32
|
+
for (const channel of channels)
|
|
33
|
+
channelValues[channel] = checkpoint.channel_values[channel];
|
|
34
|
+
return { ...checkpoint, channel_values: channelValues };
|
|
35
|
+
}
|
|
36
|
+
/** True when `newVersions` already names every value the checkpoint carries, so nothing needs carrying over. */
|
|
37
|
+
function coversEveryChannel(checkpoint, newVersions) {
|
|
38
|
+
return Object.keys(checkpoint.channel_values).every((channel) => Object.hasOwn(newVersions, channel));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The parent's stored-channel list, read from its META row with a consistent
|
|
42
|
+
* projection of that one attribute. `undefined` when the parent is gone
|
|
43
|
+
* (deleted or expired) or predates the attribute: both mean "carry every
|
|
44
|
+
* value the put holds", the behaviour those rows were written under.
|
|
45
|
+
*/
|
|
46
|
+
async function readParentStoredChannels(context, threadId, checkpointNs, parentCheckpointId, signal) {
|
|
47
|
+
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
48
|
+
TableName: context.tableName,
|
|
49
|
+
Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.metaSortKey)(checkpointNs, parentCheckpointId) },
|
|
50
|
+
ConsistentRead: true,
|
|
51
|
+
ProjectionExpression: '#sc',
|
|
52
|
+
ExpressionAttributeNames: { '#sc': 'storedChannels' },
|
|
53
|
+
}), (0, retry_policy_1.retryFor)(context, signal));
|
|
54
|
+
const stored = result.Item?.storedChannels;
|
|
55
|
+
return Array.isArray(stored) ? stored : undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolve the channels a put stores, spending the parent read only when it
|
|
59
|
+
* can change the answer: never without `newVersions` or a parent, and not
|
|
60
|
+
* when `newVersions` already covers every value the put carries.
|
|
61
|
+
*/
|
|
62
|
+
async function storedChannelsFor(context, threadId, checkpointNs, checkpoint, newVersions, parentCheckpointId, signal) {
|
|
63
|
+
if (newVersions === undefined)
|
|
64
|
+
return selectStoredChannels(checkpoint, undefined, []);
|
|
65
|
+
if (parentCheckpointId === undefined || coversEveryChannel(checkpoint, newVersions)) {
|
|
66
|
+
return selectStoredChannels(checkpoint, newVersions, []);
|
|
67
|
+
}
|
|
68
|
+
const parentStored = await readParentStoredChannels(context, threadId, checkpointNs, parentCheckpointId, signal);
|
|
69
|
+
return selectStoredChannels(checkpoint, newVersions, parentStored);
|
|
70
|
+
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
/** Validate a thread id
|
|
1
|
+
/** Validate a thread id: non-blank, separator- and control-char-free, at most 1024 bytes. */
|
|
2
2
|
export declare function validateThreadId(threadId: string): void;
|
|
3
3
|
/**
|
|
4
4
|
* Validate a checkpoint namespace. Unlike the other identifiers an empty value
|
|
5
|
-
* is legal — it is the root namespace — so only the separator
|
|
6
|
-
*
|
|
5
|
+
* is legal — it is the root namespace — so only the separator, control-character
|
|
6
|
+
* and length rules apply.
|
|
7
7
|
*/
|
|
8
8
|
export declare function validateCheckpointNs(checkpointNs: string): void;
|
|
9
|
-
/** Validate a checkpoint id
|
|
9
|
+
/** Validate a checkpoint id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
10
10
|
export declare function validateCheckpointId(checkpointId: string): void;
|
|
11
|
-
/** Validate a task id
|
|
11
|
+
/** Validate a task id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
12
12
|
export declare function validateTaskId(taskId: string): void;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Validate a pending-write channel name. It is the trailing segment of the
|
|
15
|
+
* WRITE sort key, so it obeys the same rules as every other segment; LangGraph
|
|
16
|
+
* channel names never contain the reserved separator.
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateChannel(channel: string): void;
|
|
@@ -4,27 +4,37 @@ exports.validateThreadId = validateThreadId;
|
|
|
4
4
|
exports.validateCheckpointNs = validateCheckpointNs;
|
|
5
5
|
exports.validateCheckpointId = validateCheckpointId;
|
|
6
6
|
exports.validateTaskId = validateTaskId;
|
|
7
|
+
exports.validateChannel = validateChannel;
|
|
8
|
+
const constants_1 = require("../../shared/constants");
|
|
7
9
|
const primitives_1 = require("../../shared/validation/primitives");
|
|
8
10
|
const keys_1 = require("./keys");
|
|
9
|
-
/** Validate a thread id
|
|
11
|
+
/** Validate a thread id: non-blank, separator- and control-char-free, at most 1024 bytes. */
|
|
10
12
|
function validateThreadId(threadId) {
|
|
11
|
-
(0, primitives_1.validateIdentifier)(threadId, keys_1.SORT_KEY_SEPARATOR, 'thread_id');
|
|
13
|
+
(0, primitives_1.validateIdentifier)(threadId, keys_1.SORT_KEY_SEPARATOR, 'thread_id', constants_1.MAX_PARTITION_ID_BYTES);
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* Validate a checkpoint namespace. Unlike the other identifiers an empty value
|
|
15
|
-
* is legal — it is the root namespace — so only the separator
|
|
16
|
-
*
|
|
17
|
+
* is legal — it is the root namespace — so only the separator, control-character
|
|
18
|
+
* and length rules apply.
|
|
17
19
|
*/
|
|
18
20
|
function validateCheckpointNs(checkpointNs) {
|
|
19
21
|
(0, primitives_1.assertNoSeparator)(checkpointNs, keys_1.SORT_KEY_SEPARATOR, 'checkpoint_ns');
|
|
20
22
|
(0, primitives_1.assertNoControlChars)(checkpointNs, 'checkpoint_ns');
|
|
23
|
+
(0, primitives_1.assertMaxBytes)(checkpointNs, 'checkpoint_ns', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
21
24
|
}
|
|
22
|
-
/** Validate a checkpoint id
|
|
25
|
+
/** Validate a checkpoint id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
23
26
|
function validateCheckpointId(checkpointId) {
|
|
24
|
-
(0, primitives_1.validateIdentifier)(checkpointId, keys_1.SORT_KEY_SEPARATOR, 'checkpoint_id');
|
|
27
|
+
(0, primitives_1.validateIdentifier)(checkpointId, keys_1.SORT_KEY_SEPARATOR, 'checkpoint_id', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
25
28
|
}
|
|
26
|
-
/** Validate a task id
|
|
29
|
+
/** Validate a task id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
27
30
|
function validateTaskId(taskId) {
|
|
28
|
-
(0, primitives_1.validateIdentifier)(taskId, keys_1.SORT_KEY_SEPARATOR, 'taskId');
|
|
31
|
+
(0, primitives_1.validateIdentifier)(taskId, keys_1.SORT_KEY_SEPARATOR, 'taskId', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Validate a pending-write channel name. It is the trailing segment of the
|
|
35
|
+
* WRITE sort key, so it obeys the same rules as every other segment; LangGraph
|
|
36
|
+
* channel names never contain the reserved separator.
|
|
37
|
+
*/
|
|
38
|
+
function validateChannel(channel) {
|
|
39
|
+
(0, primitives_1.validateIdentifier)(channel, keys_1.SORT_KEY_SEPARATOR, 'channel', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
29
40
|
}
|
|
30
|
-
//# sourceMappingURL=validation.js.map
|
|
@@ -10,4 +10,11 @@ import type { CheckpointerContext } from './setup';
|
|
|
10
10
|
* told apart, so it is treated as the ordinary duplicate.
|
|
11
11
|
*/
|
|
12
12
|
export declare function reportGuardRejection(context: CheckpointerContext, item: CheckpointWriteItem, error: Error): void;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* True when the guard rejection's returned row provably belongs to another
|
|
15
|
+
* `putWrites` call, so this call's own upload is dead and safe to delete. A
|
|
16
|
+
* retried put whose response was lost can be rejected by the row it wrote
|
|
17
|
+
* itself, so an equal group — or no attributes at all — proves nothing and
|
|
18
|
+
* must not be taken as "my upload is dead".
|
|
19
|
+
*/
|
|
20
|
+
export declare function rejectionProvesForeignRow(item: CheckpointWriteItem, error: Error): boolean;
|