@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
|
@@ -3,11 +3,12 @@ import type { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
|
|
|
3
3
|
import type { IndexConfig, 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 { DynamoDBStoreOptions } from '../types';
|
|
9
10
|
import type { VectorBackend } from '../vector-backend';
|
|
10
|
-
import {
|
|
11
|
+
import type { VectorScoreDirection } from './score-direction';
|
|
11
12
|
/** Resolved collaborators shared by every store action. */
|
|
12
13
|
export interface StoreContext {
|
|
13
14
|
client: DynamoDBDocument;
|
|
@@ -22,6 +23,8 @@ export interface StoreContext {
|
|
|
22
23
|
vectorScoreDirection: VectorScoreDirection;
|
|
23
24
|
maxSearchCandidates: number;
|
|
24
25
|
maxScanItems: number;
|
|
26
|
+
/** Retry budget and backoff for every DynamoDB call, with the retry debug log attached. */
|
|
27
|
+
retry?: RetryOptions;
|
|
25
28
|
}
|
|
26
29
|
/** Result of wiring up a store from its options. */
|
|
27
30
|
export interface StoreSetup {
|
|
@@ -29,16 +32,5 @@ export interface StoreSetup {
|
|
|
29
32
|
ddbClient: DynamoDBClient | undefined;
|
|
30
33
|
ownsClient: boolean;
|
|
31
34
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Resolve the client, optional S3 offloader, serializer, and index config.
|
|
34
|
-
*
|
|
35
|
-
* A `vectorBackend` without an `index` is rejected outright rather than
|
|
36
|
-
* silently degrading: with no embeddings configured, every `put` would compute
|
|
37
|
-
* no vector and instruct the backend to *delete* the item's entry instead of
|
|
38
|
-
* indexing it, and `search()` would fall through to an unranked scan-order
|
|
39
|
-
* listing with no `.score` field and no error — a semantic query returning a
|
|
40
|
-
* normal-looking but meaningless response. `reconcileVectorIndex` already
|
|
41
|
-
* refused this exact misconfiguration.
|
|
42
|
-
*/
|
|
35
|
+
/** Validate the options, then resolve the client, offloader, serializer, and index. */
|
|
43
36
|
export declare function setUpStore(options: DynamoDBStoreOptions): StoreSetup;
|
|
44
|
-
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -2,69 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setUpStore = setUpStore;
|
|
4
4
|
const json_serde_1 = require("../../shared/codec/json-serde");
|
|
5
|
-
const
|
|
5
|
+
const adapter_config_1 = require("../../shared/codec/s3/adapter-config");
|
|
6
6
|
const offloader_1 = require("../../shared/codec/s3/offloader");
|
|
7
7
|
const constants_1 = require("../../shared/constants");
|
|
8
8
|
const client_1 = require("../../shared/dynamodb/client");
|
|
9
|
-
const
|
|
9
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
10
10
|
const logger_1 = require("../../shared/logging/logger");
|
|
11
|
-
const
|
|
12
|
-
/**
|
|
13
|
-
* Reject an `index` that cannot actually embed. `IndexConfig` mandates
|
|
14
|
-
* `embeddings`, but a JavaScript caller can omit it or pass the wrong shape,
|
|
15
|
-
* and the failure then surfaced as a raw `TypeError` deep inside the first
|
|
16
|
-
* `put()`/`search()` rather than this library's typed error at construction.
|
|
17
|
-
*
|
|
18
|
-
* Only `embeddings` is checked. `dims` is part of the upstream type but is
|
|
19
|
-
* never read anywhere in this package, so rejecting a configuration over it
|
|
20
|
-
* would break working callers for no benefit.
|
|
21
|
-
*/
|
|
22
|
-
function assertUsableIndex(index) {
|
|
23
|
-
if (!index)
|
|
24
|
-
return;
|
|
25
|
-
const embeddings = index.embeddings;
|
|
26
|
-
if (typeof embeddings?.embedQuery !== 'function') {
|
|
27
|
-
throw new errors_1.ValidationError('`index.embeddings` must be an Embeddings implementation exposing embedQuery(); ' +
|
|
28
|
-
'without one no embedding can be computed for put() or search()', 'index');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Reject a `vectorScoreDirection` outside the declared union.
|
|
33
|
-
*
|
|
34
|
-
* {@link toRelevanceScores} treats anything it does not recognise as a no-op —
|
|
35
|
-
* the only safe default, since guessing would invert a ranking — so a mistyped
|
|
36
|
-
* or config-file-sourced value would otherwise leave a distance backend ranked
|
|
37
|
-
* backwards with no error and no warning anywhere. Same premise as
|
|
38
|
-
* {@link assertUsableIndex}: a JavaScript caller can pass a string the type
|
|
39
|
-
* never admits.
|
|
40
|
-
*/
|
|
41
|
-
function assertScoreDirection(direction) {
|
|
42
|
-
if (direction === undefined || score_direction_1.VECTOR_SCORE_DIRECTIONS.includes(direction))
|
|
43
|
-
return;
|
|
44
|
-
throw new errors_1.ValidationError(`vectorScoreDirection must be one of ${score_direction_1.VECTOR_SCORE_DIRECTIONS.join(' | ')}; received ` +
|
|
45
|
-
`${JSON.stringify(direction)}, which would be left in the backend's own direction and ` +
|
|
46
|
-
'could rank a distance backend backwards', 'vectorScoreDirection');
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Resolve the client, optional S3 offloader, serializer, and index config.
|
|
50
|
-
*
|
|
51
|
-
* A `vectorBackend` without an `index` is rejected outright rather than
|
|
52
|
-
* silently degrading: with no embeddings configured, every `put` would compute
|
|
53
|
-
* no vector and instruct the backend to *delete* the item's entry instead of
|
|
54
|
-
* indexing it, and `search()` would fall through to an unranked scan-order
|
|
55
|
-
* listing with no `.score` field and no error — a semantic query returning a
|
|
56
|
-
* normal-looking but meaningless response. `reconcileVectorIndex` already
|
|
57
|
-
* refused this exact misconfiguration.
|
|
58
|
-
*/
|
|
11
|
+
const option_validation_1 = require("./option-validation");
|
|
12
|
+
/** Validate the options, then resolve the client, offloader, serializer, and index. */
|
|
59
13
|
function setUpStore(options) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
'is computed, every put would clear the item vector, and search would silently return ' +
|
|
63
|
-
'unranked, score-less results', 'vectorBackend');
|
|
64
|
-
}
|
|
65
|
-
assertUsableIndex(options.index);
|
|
66
|
-
assertScoreDirection(options.vectorScoreDirection);
|
|
14
|
+
(0, option_validation_1.validateStoreOptions)(options);
|
|
15
|
+
const logger = (0, logger_1.resolveLogger)(options.logger);
|
|
67
16
|
const resolved = (0, client_1.resolveDynamoDBClient)(options);
|
|
17
|
+
if (!resolved.ownsClient)
|
|
18
|
+
void (0, client_1.warnOnStackedRetries)(resolved.client, logger);
|
|
68
19
|
return {
|
|
69
20
|
context: {
|
|
70
21
|
client: resolved.client,
|
|
@@ -72,13 +23,11 @@ function setUpStore(options) {
|
|
|
72
23
|
serde: options.serde ?? json_serde_1.JSON_SERDE,
|
|
73
24
|
compression: options.compression,
|
|
74
25
|
offloader: options.s3
|
|
75
|
-
? new offloader_1.S3Offloader(
|
|
76
|
-
...options.s3,
|
|
77
|
-
keyPrefix: options.s3.keyPrefix ?? (0, config_1.defaultAdapterKeyPrefix)(constants_1.DEFAULT_S3_KEY_PREFIX, 'store'),
|
|
78
|
-
})
|
|
26
|
+
? new offloader_1.S3Offloader((0, adapter_config_1.offloaderConfigFor)(options.s3, 'store', options.clientConfig))
|
|
79
27
|
: undefined,
|
|
80
28
|
ttl: options.ttl,
|
|
81
|
-
logger
|
|
29
|
+
logger,
|
|
30
|
+
retry: (0, retry_policy_1.resolveRetryPolicy)(options.retry, logger),
|
|
82
31
|
index: options.index,
|
|
83
32
|
vectorBackend: options.vectorBackend,
|
|
84
33
|
vectorScoreDirection: options.vectorScoreDirection ?? 'relevance',
|
|
@@ -89,4 +38,3 @@ function setUpStore(options) {
|
|
|
89
38
|
ownsClient: resolved.ownsClient,
|
|
90
39
|
};
|
|
91
40
|
}
|
|
92
|
-
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JsonValue } from './filter';
|
|
2
|
+
/**
|
|
3
|
+
* Split a JSON path into tokens the way LangGraph's `InMemoryStore` does: dots
|
|
4
|
+
* separate plain segments, while a `[…]` index and a `{…}` field group each
|
|
5
|
+
* become a token of their own (`tags[0]` → `['tags', '[0]']`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function tokenizePath(path: string): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Extract the indexable text of `value` at `path`, byte-for-byte as LangGraph's
|
|
10
|
+
* `InMemoryStore` does (`store/utils`), so an embedding computed here matches
|
|
11
|
+
* one computed by the reference store for the same document. Supports plain
|
|
12
|
+
* paths, `[n]`/`[-n]`/`[*]` indexing, a bare `*` wildcard, `{a,b.c}` field
|
|
13
|
+
* groups and `$` for the whole document. The package root's `getTextAtPath` is
|
|
14
|
+
* a string-only variant that returns nothing for numbers, booleans, objects
|
|
15
|
+
* and arrays and throws on a `null` intermediate; it must not be used here.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTextAtPath(value: JsonValue, path: string): string[];
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tokenizePath = tokenizePath;
|
|
4
|
+
exports.getTextAtPath = getTextAtPath;
|
|
5
|
+
/** Pretty JSON, exactly as `InMemoryStore` embeds non-scalar values. */
|
|
6
|
+
function pretty(value) {
|
|
7
|
+
return JSON.stringify(value, null, 2);
|
|
8
|
+
}
|
|
9
|
+
function isScalar(value) {
|
|
10
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
11
|
+
}
|
|
12
|
+
/** Text for a leaf: scalars stringify, containers pretty-print, null yields nothing. */
|
|
13
|
+
function leafText(value) {
|
|
14
|
+
if (isScalar(value))
|
|
15
|
+
return [String(value)];
|
|
16
|
+
if (value === null)
|
|
17
|
+
return [];
|
|
18
|
+
return [pretty(value)];
|
|
19
|
+
}
|
|
20
|
+
/** Index just past the closer matching an opener at `start - 1`, honouring nesting. */
|
|
21
|
+
function scanGroup(path, start, open, close) {
|
|
22
|
+
let depth = 1;
|
|
23
|
+
let i = start;
|
|
24
|
+
while (i < path.length && depth > 0) {
|
|
25
|
+
if (path[i] === open)
|
|
26
|
+
depth += 1;
|
|
27
|
+
else if (path[i] === close)
|
|
28
|
+
depth -= 1;
|
|
29
|
+
i += 1;
|
|
30
|
+
}
|
|
31
|
+
return i;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Split a JSON path into tokens the way LangGraph's `InMemoryStore` does: dots
|
|
35
|
+
* separate plain segments, while a `[…]` index and a `{…}` field group each
|
|
36
|
+
* become a token of their own (`tags[0]` → `['tags', '[0]']`).
|
|
37
|
+
*/
|
|
38
|
+
function tokenizePath(path) {
|
|
39
|
+
const tokens = [];
|
|
40
|
+
let current = '';
|
|
41
|
+
const flush = () => {
|
|
42
|
+
if (current.length > 0)
|
|
43
|
+
tokens.push(current);
|
|
44
|
+
current = '';
|
|
45
|
+
};
|
|
46
|
+
let i = 0;
|
|
47
|
+
while (i < path.length) {
|
|
48
|
+
const char = path[i];
|
|
49
|
+
if (char === '[' || char === '{') {
|
|
50
|
+
flush();
|
|
51
|
+
const end = scanGroup(path, i + 1, char, char === '[' ? ']' : '}');
|
|
52
|
+
tokens.push(path.slice(i, end));
|
|
53
|
+
i = end;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (char === '.')
|
|
57
|
+
flush();
|
|
58
|
+
else
|
|
59
|
+
current += char;
|
|
60
|
+
i += 1;
|
|
61
|
+
}
|
|
62
|
+
flush();
|
|
63
|
+
return tokens;
|
|
64
|
+
}
|
|
65
|
+
/** Walk one `{…}`-group field by plain `in` lookups, as the reference does. */
|
|
66
|
+
function groupFieldText(value, field) {
|
|
67
|
+
let current = value;
|
|
68
|
+
for (const token of tokenizePath(field)) {
|
|
69
|
+
if (current !== null && typeof current === 'object' && token in current) {
|
|
70
|
+
current = current[token];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return isScalar(current) ? [String(current)] : [pretty(current)];
|
|
77
|
+
}
|
|
78
|
+
/** Resolve a `[n]`, `[-n]` or `[*]` token against an array; anything else yields nothing. */
|
|
79
|
+
function indexText(value, token, tokens, pos) {
|
|
80
|
+
if (!Array.isArray(value))
|
|
81
|
+
return [];
|
|
82
|
+
const index = token.slice(1, -1);
|
|
83
|
+
if (index === '*')
|
|
84
|
+
return value.flatMap((item) => extract(item, tokens, pos + 1));
|
|
85
|
+
let idx = Number.parseInt(index, 10);
|
|
86
|
+
if (Number.isNaN(idx))
|
|
87
|
+
return [];
|
|
88
|
+
if (idx < 0)
|
|
89
|
+
idx = value.length + idx;
|
|
90
|
+
return idx >= 0 && idx < value.length ? extract(value[idx], tokens, pos + 1) : [];
|
|
91
|
+
}
|
|
92
|
+
/** Resolve a `{a,b.c}` token: each listed field, walked from the current value. */
|
|
93
|
+
function groupText(value, token) {
|
|
94
|
+
if (typeof value !== 'object' || value === null)
|
|
95
|
+
return [];
|
|
96
|
+
const results = [];
|
|
97
|
+
for (const field of token.slice(1, -1).split(',')) {
|
|
98
|
+
const trimmed = field.trim();
|
|
99
|
+
if (tokenizePath(trimmed).length > 0)
|
|
100
|
+
results.push(...groupFieldText(value, trimmed));
|
|
101
|
+
}
|
|
102
|
+
return results;
|
|
103
|
+
}
|
|
104
|
+
/** Resolve a bare `*` token: every array item or every object value. */
|
|
105
|
+
function wildcardText(value, tokens, pos) {
|
|
106
|
+
if (Array.isArray(value))
|
|
107
|
+
return value.flatMap((item) => extract(item, tokens, pos + 1));
|
|
108
|
+
if (typeof value === 'object' && value !== null) {
|
|
109
|
+
return Object.values(value).flatMap((item) => extract(item, tokens, pos + 1));
|
|
110
|
+
}
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
/** Resolve a plain member token by an `in` lookup, exactly as the reference does. */
|
|
114
|
+
function memberText(value, token, tokens, pos) {
|
|
115
|
+
if (typeof value !== 'object' || value === null || !(token in value))
|
|
116
|
+
return [];
|
|
117
|
+
return extract(value[token], tokens, pos + 1);
|
|
118
|
+
}
|
|
119
|
+
function extract(value, tokens, pos) {
|
|
120
|
+
if (pos >= tokens.length)
|
|
121
|
+
return leafText(value);
|
|
122
|
+
const token = tokens[pos];
|
|
123
|
+
if (token.startsWith('[') && token.endsWith(']'))
|
|
124
|
+
return indexText(value, token, tokens, pos);
|
|
125
|
+
const results = pos === 0 && token === '$' ? [pretty(value)] : [];
|
|
126
|
+
if (token.startsWith('{') && token.endsWith('}'))
|
|
127
|
+
results.push(...groupText(value, token));
|
|
128
|
+
else if (token === '*')
|
|
129
|
+
results.push(...wildcardText(value, tokens, pos));
|
|
130
|
+
else
|
|
131
|
+
results.push(...memberText(value, token, tokens, pos));
|
|
132
|
+
return results;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Extract the indexable text of `value` at `path`, byte-for-byte as LangGraph's
|
|
136
|
+
* `InMemoryStore` does (`store/utils`), so an embedding computed here matches
|
|
137
|
+
* one computed by the reference store for the same document. Supports plain
|
|
138
|
+
* paths, `[n]`/`[-n]`/`[*]` indexing, a bare `*` wildcard, `{a,b.c}` field
|
|
139
|
+
* groups and `$` for the whole document. The package root's `getTextAtPath` is
|
|
140
|
+
* a string-only variant that returns nothing for numbers, booleans, objects
|
|
141
|
+
* and arrays and throws on a `null` intermediate; it must not be used here.
|
|
142
|
+
*/
|
|
143
|
+
function getTextAtPath(value, path) {
|
|
144
|
+
if (path === '' || path === '$')
|
|
145
|
+
return [pretty(value)];
|
|
146
|
+
return extract(value, tokenizePath(path), 0);
|
|
147
|
+
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/** Validate search/listNamespaces paging is non-negative integers. */
|
|
2
2
|
export declare function validatePaging(offset: number, limit: number): void;
|
|
3
|
-
/** Validate the namespace is non-empty and each element is a valid identifier. */
|
|
3
|
+
/** Validate the namespace is non-empty and each element is a valid, ≤256-byte identifier. */
|
|
4
4
|
export declare function validateNamespace(namespace: string[]): void;
|
|
5
|
-
/** Validate an item key is a non-
|
|
5
|
+
/** Validate an item key is a non-blank, separator- and control-char-free, ≤256-byte string. */
|
|
6
6
|
export declare function validateKey(key: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Validate a namespace/key pair as the item address it becomes: each segment
|
|
9
|
+
* on its own, then the sort key they compose, which DynamoDB caps at 1024
|
|
10
|
+
* bytes regardless of how short the individual segments are.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateStoreKey(namespace: string[], key: string): void;
|
|
7
13
|
/**
|
|
8
14
|
* Validate an optional namespace depth cap. Left unchecked, a negative value
|
|
9
15
|
* silently inverted truncation via `Array.prototype.slice(0, -n)`, which drops
|
|
10
16
|
* the *last* n elements rather than erroring.
|
|
11
17
|
*/
|
|
12
18
|
export declare function validateMaxDepth(maxDepth?: number): void;
|
|
13
|
-
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validatePaging = validatePaging;
|
|
4
4
|
exports.validateNamespace = validateNamespace;
|
|
5
5
|
exports.validateKey = validateKey;
|
|
6
|
+
exports.validateStoreKey = validateStoreKey;
|
|
6
7
|
exports.validateMaxDepth = validateMaxDepth;
|
|
8
|
+
const constants_1 = require("../../shared/constants");
|
|
9
|
+
const errors_1 = require("../../shared/errors/errors");
|
|
7
10
|
const primitives_1 = require("../../shared/validation/primitives");
|
|
8
11
|
const keys_1 = require("./keys");
|
|
9
12
|
/** Validate search/listNamespaces paging is non-negative integers. */
|
|
@@ -11,16 +14,30 @@ function validatePaging(offset, limit) {
|
|
|
11
14
|
(0, primitives_1.validateInteger)(offset, 'offset', { min: 0 });
|
|
12
15
|
(0, primitives_1.validateInteger)(limit, 'limit', { min: 0 });
|
|
13
16
|
}
|
|
14
|
-
/** Validate the namespace is non-empty and each element is a valid identifier. */
|
|
17
|
+
/** Validate the namespace is non-empty and each element is a valid, ≤256-byte identifier. */
|
|
15
18
|
function validateNamespace(namespace) {
|
|
16
19
|
(0, primitives_1.validateNonEmptyArray)(namespace, 'namespace');
|
|
17
20
|
for (const element of namespace) {
|
|
18
|
-
(0, primitives_1.validateIdentifier)(element, keys_1.NAMESPACE_SEPARATOR, 'namespace element');
|
|
21
|
+
(0, primitives_1.validateIdentifier)(element, keys_1.NAMESPACE_SEPARATOR, 'namespace element', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
|
-
/** Validate an item key is a non-
|
|
24
|
+
/** Validate an item key is a non-blank, separator- and control-char-free, ≤256-byte string. */
|
|
22
25
|
function validateKey(key) {
|
|
23
|
-
(0, primitives_1.validateIdentifier)(key, keys_1.NAMESPACE_SEPARATOR, 'key');
|
|
26
|
+
(0, primitives_1.validateIdentifier)(key, keys_1.NAMESPACE_SEPARATOR, 'key', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validate a namespace/key pair as the item address it becomes: each segment
|
|
30
|
+
* on its own, then the sort key they compose, which DynamoDB caps at 1024
|
|
31
|
+
* bytes regardless of how short the individual segments are.
|
|
32
|
+
*/
|
|
33
|
+
function validateStoreKey(namespace, key) {
|
|
34
|
+
validateNamespace(namespace);
|
|
35
|
+
validateKey(key);
|
|
36
|
+
const bytes = Buffer.byteLength((0, keys_1.sortKey)(namespace, key), 'utf8');
|
|
37
|
+
if (bytes > constants_1.MAX_SORT_KEY_BYTES) {
|
|
38
|
+
throw new errors_1.ValidationError(`namespace and key compose a ${bytes}-byte sort key; DynamoDB caps sort keys at ` +
|
|
39
|
+
`${constants_1.MAX_SORT_KEY_BYTES} bytes`, 'sortKey');
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
42
|
/**
|
|
26
43
|
* Validate an optional namespace depth cap. Left unchecked, a negative value
|
|
@@ -32,4 +49,3 @@ function validateMaxDepth(maxDepth) {
|
|
|
32
49
|
return;
|
|
33
50
|
(0, primitives_1.validateInteger)(maxDepth, 'maxDepth', { min: 1 });
|
|
34
51
|
}
|
|
35
|
-
//# sourceMappingURL=validation.js.map
|
|
@@ -4,9 +4,10 @@ export declare function isRetryExhausted(error: Error): boolean;
|
|
|
4
4
|
/**
|
|
5
5
|
* True when the row is confirmed absent — used to resolve an ambiguous
|
|
6
6
|
* retry-exhausted *delete*, where the delete may well have landed server-side
|
|
7
|
-
* and only its acknowledgement was lost.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* and only its acknowledgement was lost. Only the partition key is projected:
|
|
8
|
+
* existence is the whole question. A failure reading this is not treated as
|
|
9
|
+
* confirmation, which is fail-safe here: the caller only rethrows, and nothing
|
|
10
|
+
* is deleted on the strength of a `false`.
|
|
10
11
|
*/
|
|
11
12
|
export declare function rowIsAbsent(context: StoreContext, key: {
|
|
12
13
|
PK: string;
|
|
@@ -15,12 +16,16 @@ export declare function rowIsAbsent(context: StoreContext, key: {
|
|
|
15
16
|
/** What a post-failure verification read could establish about a write. */
|
|
16
17
|
export type WriteVerdict = 'landed' | 'not-landed' | 'unverified';
|
|
17
18
|
/**
|
|
18
|
-
* Read `record`'s row back to establish what an ambiguous write actually did
|
|
19
|
+
* Read `record`'s row back to establish what an ambiguous write actually did,
|
|
20
|
+
* comparing the row's revision with the one this write carried. Every put
|
|
21
|
+
* stamps a fresh per-call `rev`, so the comparison works for inline and
|
|
22
|
+
* offloaded records alike.
|
|
19
23
|
*
|
|
20
|
-
* - `'landed'`: the row holds `
|
|
21
|
-
*
|
|
22
|
-
* - `'not-landed'`: the row was read and holds something else, or nothing
|
|
23
|
-
* this call's own
|
|
24
|
+
* - `'landed'`: the row holds this write's `rev`, so it committed server-side
|
|
25
|
+
* and only its acknowledgement was lost.
|
|
26
|
+
* - `'not-landed'`: the row was read and holds something else, or nothing —
|
|
27
|
+
* or the record carries no `rev` to compare — so this call's own upload, if
|
|
28
|
+
* any, is dead and safe to delete.
|
|
24
29
|
* - `'unverified'`: the read itself failed, so nothing is established.
|
|
25
30
|
*
|
|
26
31
|
* The third answer used to be folded into the second as a plain `false`, which
|
|
@@ -33,5 +38,5 @@ export type WriteVerdict = 'landed' | 'not-landed' | 'unverified';
|
|
|
33
38
|
export declare function verifyWriteLanded(context: StoreContext, record: {
|
|
34
39
|
PK: string;
|
|
35
40
|
SK: string;
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
rev?: string;
|
|
42
|
+
}): Promise<WriteVerdict>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isRetryExhausted = isRetryExhausted;
|
|
4
4
|
exports.rowIsAbsent = rowIsAbsent;
|
|
5
5
|
exports.verifyWriteLanded = verifyWriteLanded;
|
|
6
|
-
const
|
|
6
|
+
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
7
7
|
const retry_1 = require("../../shared/dynamodb/retry");
|
|
8
8
|
/** True when `error` is a {@link RetryExhaustedError} — by name, not `instanceof` (banned repo-wide). */
|
|
9
9
|
function isRetryExhausted(error) {
|
|
@@ -12,9 +12,10 @@ function isRetryExhausted(error) {
|
|
|
12
12
|
/**
|
|
13
13
|
* True when the row is confirmed absent — used to resolve an ambiguous
|
|
14
14
|
* retry-exhausted *delete*, where the delete may well have landed server-side
|
|
15
|
-
* and only its acknowledgement was lost.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* and only its acknowledgement was lost. Only the partition key is projected:
|
|
16
|
+
* existence is the whole question. A failure reading this is not treated as
|
|
17
|
+
* confirmation, which is fail-safe here: the caller only rethrows, and nothing
|
|
18
|
+
* is deleted on the strength of a `false`.
|
|
18
19
|
*/
|
|
19
20
|
async function rowIsAbsent(context, key) {
|
|
20
21
|
try {
|
|
@@ -22,9 +23,9 @@ async function rowIsAbsent(context, key) {
|
|
|
22
23
|
TableName: context.tableName,
|
|
23
24
|
Key: key,
|
|
24
25
|
ConsistentRead: true,
|
|
25
|
-
ProjectionExpression: '#
|
|
26
|
-
ExpressionAttributeNames: { '#
|
|
27
|
-
}));
|
|
26
|
+
ProjectionExpression: '#pk',
|
|
27
|
+
ExpressionAttributeNames: { '#pk': 'PK' },
|
|
28
|
+
}), context.retry);
|
|
28
29
|
return result.Item === undefined;
|
|
29
30
|
}
|
|
30
31
|
catch {
|
|
@@ -32,12 +33,16 @@ async function rowIsAbsent(context, key) {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
|
-
* Read `record`'s row back to establish what an ambiguous write actually did
|
|
36
|
+
* Read `record`'s row back to establish what an ambiguous write actually did,
|
|
37
|
+
* comparing the row's revision with the one this write carried. Every put
|
|
38
|
+
* stamps a fresh per-call `rev`, so the comparison works for inline and
|
|
39
|
+
* offloaded records alike.
|
|
36
40
|
*
|
|
37
|
-
* - `'landed'`: the row holds `
|
|
38
|
-
*
|
|
39
|
-
* - `'not-landed'`: the row was read and holds something else, or nothing
|
|
40
|
-
* this call's own
|
|
41
|
+
* - `'landed'`: the row holds this write's `rev`, so it committed server-side
|
|
42
|
+
* and only its acknowledgement was lost.
|
|
43
|
+
* - `'not-landed'`: the row was read and holds something else, or nothing —
|
|
44
|
+
* or the record carries no `rev` to compare — so this call's own upload, if
|
|
45
|
+
* any, is dead and safe to delete.
|
|
41
46
|
* - `'unverified'`: the read itself failed, so nothing is established.
|
|
42
47
|
*
|
|
43
48
|
* The third answer used to be folded into the second as a plain `false`, which
|
|
@@ -47,22 +52,20 @@ async function rowIsAbsent(context, key) {
|
|
|
47
52
|
* object (reclaimed by `ensureS3LifecycleRule`) is recoverable, stranding a
|
|
48
53
|
* live row is not.
|
|
49
54
|
*/
|
|
50
|
-
async function verifyWriteLanded(context, record
|
|
55
|
+
async function verifyWriteLanded(context, record) {
|
|
56
|
+
if (record.rev === undefined)
|
|
57
|
+
return 'not-landed';
|
|
51
58
|
try {
|
|
52
59
|
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
53
60
|
TableName: context.tableName,
|
|
54
61
|
Key: { PK: record.PK, SK: record.SK },
|
|
55
62
|
ConsistentRead: true,
|
|
56
|
-
ProjectionExpression: '#
|
|
57
|
-
ExpressionAttributeNames: { '#
|
|
58
|
-
}));
|
|
59
|
-
|
|
60
|
-
return value?.location === codec_1.PayloadLocation.S3 && value.s3Key === expectedS3Key
|
|
61
|
-
? 'landed'
|
|
62
|
-
: 'not-landed';
|
|
63
|
+
ProjectionExpression: '#r',
|
|
64
|
+
ExpressionAttributeNames: { '#r': conditional_put_1.REVISION_ATTRIBUTE },
|
|
65
|
+
}), context.retry);
|
|
66
|
+
return result.Item?.[conditional_put_1.REVISION_ATTRIBUTE] === record.rev ? 'landed' : 'not-landed';
|
|
63
67
|
}
|
|
64
68
|
catch {
|
|
65
69
|
return 'unverified';
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
//# sourceMappingURL=write-verify.js.map
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BaseStore, type Operation, type OperationResults } from '@langchain/langgraph-checkpoint';
|
|
1
|
+
import { BaseStore, type Operation, type OperationResults, type SearchItem, type SearchOperation } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import type { CancelOptions } from '../shared/options';
|
|
2
3
|
import { type VectorReconcileResult } from './actions/reconcile-vector-index';
|
|
3
4
|
import type { DynamoDBStoreOptions } from './types';
|
|
4
5
|
/**
|
|
@@ -12,22 +13,49 @@ export declare class DynamoDBStore extends BaseStore {
|
|
|
12
13
|
private readonly ddbClient;
|
|
13
14
|
constructor(options: DynamoDBStoreOptions);
|
|
14
15
|
private dispatch;
|
|
16
|
+
/**
|
|
17
|
+
* Execute a batch of operations and return their results in operation
|
|
18
|
+
* order. Writes to one item stay ordered; writes to different items, and
|
|
19
|
+
* then all reads, run concurrently — so a get after a put to the same key
|
|
20
|
+
* in one batch observes the put, and a batch of ten gets costs about one
|
|
21
|
+
* round trip rather than ten (see `runBatch`). The library's error boundary
|
|
22
|
+
* for every `BaseStore` method (`get`/`put`/`delete`/`search`/
|
|
23
|
+
* `listNamespaces` all funnel through here): a raw AWS SDK error surfaces
|
|
24
|
+
* as an `UpstreamError`, and one failing operation rejects the whole batch.
|
|
25
|
+
* @throws ValidationError for a malformed namespace, key or value; UpstreamError; RetryExhaustedError; ResultTruncatedError from a listing over its cap.
|
|
26
|
+
*/
|
|
15
27
|
batch<Op extends Operation[]>(operations: Op): Promise<OperationResults<Op>>;
|
|
28
|
+
/**
|
|
29
|
+
* Search with optional cancellation. Overrides the base implementation, which
|
|
30
|
+
* routes through {@link batch} and therefore cannot carry a signal. A plain
|
|
31
|
+
* search stops reading once `offset + limit` matches are in hand; a `query`
|
|
32
|
+
* ranks in-process (up to `maxSearchCandidates`) or through the `vectorBackend`.
|
|
33
|
+
* @throws ValidationError when the candidate set exceeds `maxSearchCandidates`; AbortError; UpstreamError.
|
|
34
|
+
*/
|
|
35
|
+
search(namespacePrefix: string[], options?: Pick<SearchOperation, 'filter' | 'limit' | 'offset' | 'query'> & CancelOptions): Promise<SearchItem[]>;
|
|
16
36
|
/**
|
|
17
37
|
* Repair the configured vector backend against the canonical items under
|
|
18
38
|
* `namespacePrefix`. A maintenance tool; see {@link reconcileVectorIndex}.
|
|
39
|
+
* @throws ValidationError without an `index` and `vectorBackend` or for an empty prefix; ResultTruncatedError past `maxScanItems`.
|
|
40
|
+
*/
|
|
41
|
+
reconcileVectorIndex(namespacePrefix: string[], options?: CancelOptions): Promise<VectorReconcileResult>;
|
|
42
|
+
/**
|
|
43
|
+
* LangGraph's lifecycle hook. A host that manages stores through the
|
|
44
|
+
* upstream `BaseStore` interface calls `stop()`, so it releases the owned
|
|
45
|
+
* client exactly like {@link destroy}, which stays the explicit API. Both
|
|
46
|
+
* are idempotent.
|
|
19
47
|
*/
|
|
20
|
-
|
|
48
|
+
stop(): void;
|
|
21
49
|
/** Release owned resources (the underlying client and any S3 client). */
|
|
22
50
|
destroy(): void;
|
|
23
51
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `s3:GetLifecycleConfiguration
|
|
28
|
-
* permissions (broader than the
|
|
29
|
-
* needs) — call this once during
|
|
52
|
+
* Provision an S3 lifecycle expiration rule matching the configured TTL, so
|
|
53
|
+
* offloaded objects don't outlive their DynamoDB item forever. No-ops when
|
|
54
|
+
* S3 offload or TTL isn't configured; throws when the bucket cannot be read
|
|
55
|
+
* or written. Requires the `s3:GetLifecycleConfiguration` /
|
|
56
|
+
* `s3:PutLifecycleConfiguration` bucket-level permissions (broader than the
|
|
57
|
+
* object-level CRUD the rest of S3 offload needs) — call this once during
|
|
58
|
+
* deployment/provisioning, not per-request.
|
|
30
59
|
*/
|
|
31
60
|
ensureS3LifecycleRule(): Promise<void>;
|
|
32
61
|
}
|
|
33
|
-
//# sourceMappingURL=store.d.ts.map
|