@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.2 → 1.0.0
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 +390 -193
- package/dist/{backfill → cjs/backfill}/backfill.d.ts +15 -12
- package/dist/cjs/backfill/backfill.js +177 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/delete-thread.d.ts +1 -1
- package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/get-tuple.d.ts +4 -3
- package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/list.d.ts +7 -4
- package/dist/cjs/checkpointer/actions/list.js +70 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/put-writes.d.ts +8 -6
- package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/put.d.ts +21 -15
- package/dist/cjs/checkpointer/actions/put.js +79 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/delta-history.d.ts +38 -26
- package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/listing.d.ts +4 -4
- package/dist/cjs/checkpointer/internal/listing.js +104 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/parse.d.ts +51 -15
- package/dist/cjs/checkpointer/internal/parse.js +184 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/pending-writes.d.ts +64 -25
- package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/read.d.ts +15 -10
- package/dist/cjs/checkpointer/internal/read.js +132 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/rows.d.ts +94 -21
- package/dist/cjs/checkpointer/internal/rows.js +356 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/setup.d.ts +13 -20
- package/dist/cjs/checkpointer/internal/setup.js +25 -0
- package/dist/{checkpointer → cjs/checkpointer}/saver.d.ts +72 -36
- package/dist/cjs/checkpointer/saver.js +56 -0
- package/dist/{checkpointer → cjs/checkpointer}/types.d.ts +1 -1
- package/dist/cjs/checkpointer/types.js +2 -0
- package/dist/{factory → cjs/factory}/factory.d.ts +25 -20
- package/dist/cjs/factory/factory.js +137 -0
- package/dist/{factory → cjs/factory}/types.d.ts +12 -12
- package/dist/cjs/factory/types.js +2 -0
- package/dist/{history → cjs/history}/actions/add-messages.d.ts +18 -10
- package/dist/cjs/history/actions/add-messages.js +17 -0
- package/dist/{history → cjs/history}/actions/clear.d.ts +1 -1
- package/dist/cjs/history/actions/clear.js +29 -0
- package/dist/{history → cjs/history}/actions/get-messages.d.ts +11 -9
- package/dist/cjs/history/actions/get-messages.js +58 -0
- package/dist/{history → cjs/history}/actions/list-sessions.d.ts +3 -3
- package/dist/cjs/history/actions/list-sessions.js +67 -0
- package/dist/{history → cjs/history}/actions/reconcile-count.d.ts +13 -9
- package/dist/cjs/history/actions/reconcile-count.js +8 -0
- package/dist/{history → cjs/history}/chat-message-history.d.ts +62 -30
- package/dist/cjs/history/chat-message-history.js +61 -0
- package/dist/{history → cjs/history}/internal/append.d.ts +64 -32
- package/dist/cjs/history/internal/append.js +267 -0
- package/dist/{history → cjs/history}/internal/message-read.d.ts +3 -3
- package/dist/cjs/history/internal/message-read.js +93 -0
- package/dist/{history → cjs/history}/internal/parse.d.ts +2 -2
- package/dist/cjs/history/internal/parse.js +113 -0
- package/dist/{history → cjs/history}/internal/rows.d.ts +11 -10
- package/dist/cjs/history/internal/rows.js +96 -0
- package/dist/{history → cjs/history}/internal/session.d.ts +41 -22
- package/dist/cjs/history/internal/session.js +296 -0
- package/dist/{history → cjs/history}/internal/setup.d.ts +2 -2
- package/dist/cjs/history/internal/setup.js +60 -0
- package/dist/{history → cjs/history}/session-adapter.d.ts +0 -6
- package/dist/cjs/history/session-adapter.js +38 -0
- package/dist/{history → cjs/history}/types.d.ts +18 -15
- package/dist/cjs/history/types.js +2 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +27 -27
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/package.json +1 -0
- package/dist/{shared → cjs/shared}/adapter.d.ts +27 -16
- package/dist/cjs/shared/adapter.js +70 -0
- package/dist/cjs/shared/clock.js +14 -0
- package/dist/{shared → cjs/shared}/codec/codec.d.ts +37 -20
- package/dist/cjs/shared/codec/codec.js +162 -0
- package/dist/{shared → cjs/shared}/codec/compression.d.ts +9 -4
- package/dist/cjs/shared/codec/compression.js +45 -0
- package/dist/cjs/shared/codec/json-serde.js +58 -0
- package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +2 -1
- package/dist/cjs/shared/codec/s3/client-types.js +6 -0
- package/dist/{shared → cjs/shared}/codec/s3/client.d.ts +25 -7
- package/dist/cjs/shared/codec/s3/client.js +78 -0
- package/dist/{shared → cjs/shared}/codec/s3/config.d.ts +12 -7
- package/dist/cjs/shared/codec/s3/config.js +92 -0
- package/dist/{shared → cjs/shared}/codec/s3/lifecycle.d.ts +71 -17
- package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
- package/dist/{shared → cjs/shared}/codec/s3/offloader.d.ts +42 -29
- package/dist/cjs/shared/codec/s3/offloader.js +289 -0
- package/dist/cjs/shared/concurrency.js +31 -0
- package/dist/{shared → cjs/shared}/dynamodb/abort.d.ts +2 -2
- package/dist/cjs/shared/dynamodb/abort.js +16 -0
- package/dist/{shared → cjs/shared}/dynamodb/batch-write.d.ts +2 -2
- package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
- package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
- package/dist/{shared → cjs/shared}/dynamodb/client.d.ts +24 -22
- package/dist/cjs/shared/dynamodb/client.js +40 -0
- package/dist/{shared → cjs/shared}/dynamodb/idempotent-write.d.ts +64 -19
- package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
- package/dist/{shared → cjs/shared}/dynamodb/paginate.d.ts +2 -2
- package/dist/cjs/shared/dynamodb/paginate.js +90 -0
- package/dist/{shared → cjs/shared}/dynamodb/partition-delete.d.ts +6 -6
- package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
- package/dist/{shared → cjs/shared}/dynamodb/recency-index.d.ts +27 -15
- package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
- package/dist/{shared → cjs/shared}/dynamodb/retry.d.ts +37 -6
- package/dist/cjs/shared/dynamodb/retry.js +193 -0
- package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/cjs/shared/dynamodb/row-size.js +30 -0
- package/dist/{shared → cjs/shared}/dynamodb/table-schema.d.ts +27 -18
- package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
- package/dist/{shared → cjs/shared}/errors/base-error.d.ts +42 -7
- package/dist/cjs/shared/errors/base-error.js +73 -0
- package/dist/{shared → cjs/shared}/errors/boundary.d.ts +29 -14
- package/dist/cjs/shared/errors/boundary.js +61 -0
- package/dist/cjs/shared/errors/classify.d.ts +206 -0
- package/dist/cjs/shared/errors/classify.js +232 -0
- package/dist/{shared → cjs/shared}/errors/error-code.d.ts +17 -10
- package/dist/cjs/shared/errors/error-code.js +27 -0
- package/dist/{shared → cjs/shared}/errors/errors.d.ts +75 -9
- package/dist/cjs/shared/errors/errors.js +123 -0
- package/dist/cjs/shared/logging/logger.js +30 -0
- package/dist/{shared → cjs/shared}/logging/redaction.d.ts +8 -4
- package/dist/cjs/shared/logging/redaction.js +145 -0
- package/dist/{shared → cjs/shared}/logging/secret-patterns.d.ts +30 -7
- package/dist/cjs/shared/logging/secret-patterns.js +93 -0
- package/dist/cjs/shared/logging/truncate.js +31 -0
- package/dist/{shared → cjs/shared}/options.d.ts +27 -11
- package/dist/cjs/shared/options.js +2 -0
- package/dist/cjs/shared/ulid.js +83 -0
- package/dist/{shared → cjs/shared}/validation/collaborators.d.ts +21 -2
- package/dist/cjs/shared/validation/collaborators.js +79 -0
- package/dist/{shared → cjs/shared}/validation/option-shape.d.ts +7 -5
- package/dist/cjs/shared/validation/option-shape.js +31 -0
- package/dist/{shared → cjs/shared}/validation/options.d.ts +4 -4
- package/dist/cjs/shared/validation/options.js +166 -0
- package/dist/cjs/shared/validation/primitives.js +114 -0
- package/dist/{shared → cjs/shared}/validation/ttl.d.ts +26 -9
- package/dist/cjs/shared/validation/ttl.js +52 -0
- package/dist/{store → cjs/store}/actions/list-namespaces.d.ts +5 -5
- package/dist/cjs/store/actions/list-namespaces.js +92 -0
- package/dist/{store → cjs/store}/actions/put.d.ts +11 -4
- package/dist/cjs/store/actions/put.js +49 -0
- package/dist/{store → cjs/store}/actions/reconcile-vector-index.d.ts +5 -5
- package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
- package/dist/{store → cjs/store}/actions/search.d.ts +2 -2
- package/dist/cjs/store/actions/search.js +26 -0
- package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
- package/dist/cjs/store/internal/batch-plan.js +32 -0
- package/dist/{store → cjs/store}/internal/filter.d.ts +3 -3
- package/dist/cjs/store/internal/filter.js +64 -0
- package/dist/cjs/store/internal/get-item.d.ts +77 -0
- package/dist/cjs/store/internal/get-item.js +58 -0
- package/dist/{store → cjs/store}/internal/item-write.d.ts +72 -32
- package/dist/cjs/store/internal/item-write.js +181 -0
- package/dist/{store → cjs/store}/internal/parse.d.ts +15 -10
- package/dist/cjs/store/internal/parse.js +180 -0
- package/dist/{store → cjs/store}/internal/rows.d.ts +38 -34
- package/dist/cjs/store/internal/rows.js +166 -0
- package/dist/{store → cjs/store}/internal/semantic-search.d.ts +2 -2
- package/dist/cjs/store/internal/semantic-search.js +211 -0
- package/dist/{store → cjs/store}/internal/setup.d.ts +10 -15
- package/dist/cjs/store/internal/setup.js +103 -0
- package/dist/{store → cjs/store}/internal/table-search.d.ts +5 -5
- package/dist/cjs/store/internal/table-search.js +123 -0
- package/dist/{store → cjs/store}/internal/vector-index.d.ts +26 -15
- package/dist/cjs/store/internal/vector-index.js +269 -0
- package/dist/{store → cjs/store}/store.d.ts +82 -39
- package/dist/cjs/store/store.js +97 -0
- package/dist/{store → cjs/store}/types.d.ts +25 -10
- package/dist/cjs/store/types.js +2 -0
- package/dist/cjs/store/vector-backend.js +4 -0
- package/dist/esm/backfill/backfill.d.ts +171 -0
- package/dist/esm/backfill/backfill.js +170 -0
- package/dist/{checkpointer/actions/delete-thread.js → esm/checkpointer/actions/delete-thread.d.ts} +4 -26
- package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
- package/dist/{checkpointer/actions/get-tuple.js → esm/checkpointer/actions/get-tuple.d.ts} +7 -24
- package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
- package/dist/esm/checkpointer/actions/list.d.ts +55 -0
- package/dist/esm/checkpointer/actions/list.js +67 -0
- package/dist/{checkpointer/actions/put-writes.js → esm/checkpointer/actions/put-writes.d.ts} +10 -37
- package/dist/esm/checkpointer/actions/put-writes.js +18 -0
- package/dist/esm/checkpointer/actions/put.d.ts +95 -0
- package/dist/esm/checkpointer/actions/put.js +75 -0
- package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/esm/checkpointer/internal/delta-history.js +126 -0
- package/dist/{checkpointer/internal/listing.js → esm/checkpointer/internal/listing.d.ts} +22 -118
- package/dist/esm/checkpointer/internal/listing.js +95 -0
- package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
- package/dist/esm/checkpointer/internal/parse.js +169 -0
- package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
- package/dist/esm/checkpointer/internal/read.d.ts +135 -0
- package/dist/esm/checkpointer/internal/read.js +125 -0
- package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
- package/dist/esm/checkpointer/internal/rows.js +323 -0
- package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
- package/dist/esm/checkpointer/internal/setup.js +21 -0
- package/dist/{checkpointer/saver.js → esm/checkpointer/saver.d.ts} +84 -87
- package/dist/esm/checkpointer/saver.js +52 -0
- package/dist/esm/checkpointer/types.d.ts +51 -0
- package/dist/esm/checkpointer/types.js +1 -0
- package/dist/esm/factory/factory.d.ts +154 -0
- package/dist/esm/factory/factory.js +133 -0
- package/dist/esm/factory/types.d.ts +76 -0
- package/dist/esm/factory/types.js +1 -0
- package/dist/{history/actions/add-messages.js → esm/history/actions/add-messages.d.ts} +20 -26
- package/dist/esm/history/actions/add-messages.js +14 -0
- package/dist/{history/actions/clear.js → esm/history/actions/clear.d.ts} +4 -35
- package/dist/esm/history/actions/clear.js +26 -0
- package/dist/esm/history/actions/get-messages.d.ts +60 -0
- package/dist/esm/history/actions/get-messages.js +55 -0
- package/dist/esm/history/actions/list-sessions.d.ts +55 -0
- package/dist/esm/history/actions/list-sessions.js +64 -0
- package/dist/{history/actions/reconcile-count.js → esm/history/actions/reconcile-count.d.ts} +14 -16
- package/dist/esm/history/actions/reconcile-count.js +5 -0
- package/dist/{history/chat-message-history.js → esm/history/chat-message-history.d.ts} +76 -87
- package/dist/esm/history/chat-message-history.js +57 -0
- package/dist/esm/history/internal/append.d.ts +244 -0
- package/dist/esm/history/internal/append.js +259 -0
- package/dist/esm/history/internal/message-read.d.ts +84 -0
- package/dist/esm/history/internal/message-read.js +89 -0
- package/dist/esm/history/internal/parse.d.ts +153 -0
- package/dist/esm/history/internal/parse.js +105 -0
- package/dist/{history/internal/rows.js → esm/history/internal/rows.d.ts} +58 -112
- package/dist/esm/history/internal/rows.js +83 -0
- package/dist/esm/history/internal/session.d.ts +350 -0
- package/dist/esm/history/internal/session.js +285 -0
- package/dist/esm/history/internal/setup.d.ts +64 -0
- package/dist/esm/history/internal/setup.js +56 -0
- package/dist/{history/session-adapter.js → esm/history/session-adapter.d.ts} +25 -39
- package/dist/esm/history/session-adapter.js +34 -0
- package/dist/esm/history/types.d.ts +102 -0
- package/dist/esm/history/types.js +1 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/shared/adapter.d.ts +146 -0
- package/dist/esm/shared/adapter.js +65 -0
- package/dist/{shared/clock.js → esm/shared/clock.d.ts} +3 -14
- package/dist/esm/shared/clock.js +9 -0
- package/dist/esm/shared/codec/codec.d.ts +336 -0
- package/dist/esm/shared/codec/codec.js +150 -0
- package/dist/esm/shared/codec/compression.d.ts +66 -0
- package/dist/esm/shared/codec/compression.js +40 -0
- package/dist/esm/shared/codec/json-serde.d.ts +80 -0
- package/dist/esm/shared/codec/json-serde.js +54 -0
- package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
- package/dist/esm/shared/codec/s3/client-types.js +3 -0
- package/dist/esm/shared/codec/s3/client.d.ts +63 -0
- package/dist/esm/shared/codec/s3/client.js +40 -0
- package/dist/{shared/codec/s3/config.js → esm/shared/codec/s3/config.d.ts} +45 -93
- package/dist/esm/shared/codec/s3/config.js +79 -0
- package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
- package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/esm/shared/codec/s3/offloader.js +278 -0
- package/dist/{shared/concurrency.js → esm/shared/concurrency.d.ts} +2 -37
- package/dist/esm/shared/concurrency.js +27 -0
- package/dist/{shared/dynamodb/abort.js → esm/shared/dynamodb/abort.d.ts} +4 -16
- package/dist/esm/shared/dynamodb/abort.js +12 -0
- package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/esm/shared/dynamodb/batch-write.js +74 -0
- package/dist/{shared/dynamodb/cancellation.js → esm/shared/dynamodb/cancellation.d.ts} +25 -53
- package/dist/esm/shared/dynamodb/cancellation.js +30 -0
- package/dist/{shared/dynamodb/client.js → esm/shared/dynamodb/client.d.ts} +74 -64
- package/dist/esm/shared/dynamodb/client.js +35 -0
- package/dist/{shared/dynamodb/idempotent-write.js → esm/shared/dynamodb/idempotent-write.d.ts} +172 -169
- package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
- package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/esm/shared/dynamodb/paginate.js +84 -0
- package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
- package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/esm/shared/dynamodb/recency-index.js +136 -0
- package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
- package/dist/esm/shared/dynamodb/retry.js +180 -0
- package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/esm/shared/dynamodb/row-size.js +26 -0
- package/dist/{shared/dynamodb/table-schema.js → esm/shared/dynamodb/table-schema.d.ts} +57 -67
- package/dist/esm/shared/dynamodb/table-schema.js +43 -0
- package/dist/esm/shared/errors/base-error.d.ts +231 -0
- package/dist/esm/shared/errors/base-error.js +64 -0
- package/dist/esm/shared/errors/boundary.d.ts +86 -0
- package/dist/esm/shared/errors/boundary.js +54 -0
- package/dist/esm/shared/errors/classify.d.ts +206 -0
- package/dist/esm/shared/errors/classify.js +220 -0
- package/dist/{shared/errors/error-code.js → esm/shared/errors/error-code.d.ts} +39 -43
- package/dist/esm/shared/errors/error-code.js +24 -0
- package/dist/{shared/errors/errors.js → esm/shared/errors/errors.d.ts} +92 -98
- package/dist/esm/shared/errors/errors.js +110 -0
- package/dist/{shared/logging/logger.js → esm/shared/logging/logger.d.ts} +22 -52
- package/dist/esm/shared/logging/logger.js +25 -0
- package/dist/esm/shared/logging/redaction.d.ts +123 -0
- package/dist/esm/shared/logging/redaction.js +140 -0
- package/dist/{shared/logging/secret-patterns.js → esm/shared/logging/secret-patterns.d.ts} +46 -87
- package/dist/esm/shared/logging/secret-patterns.js +83 -0
- package/dist/{shared/logging/truncate.js → esm/shared/logging/truncate.d.ts} +6 -40
- package/dist/esm/shared/logging/truncate.js +25 -0
- package/dist/esm/shared/options.d.ts +100 -0
- package/dist/esm/shared/options.js +1 -0
- package/dist/{shared/ulid.js → esm/shared/ulid.d.ts} +4 -84
- package/dist/esm/shared/ulid.js +77 -0
- package/dist/{shared/validation/collaborators.js → esm/shared/validation/collaborators.d.ts} +37 -65
- package/dist/esm/shared/validation/collaborators.js +70 -0
- package/dist/{shared/validation/option-shape.js → esm/shared/validation/option-shape.d.ts} +14 -36
- package/dist/esm/shared/validation/option-shape.js +24 -0
- package/dist/esm/shared/validation/options.d.ts +145 -0
- package/dist/esm/shared/validation/options.js +156 -0
- package/dist/{shared/validation/primitives.js → esm/shared/validation/primitives.d.ts} +30 -125
- package/dist/esm/shared/validation/primitives.js +100 -0
- package/dist/esm/shared/validation/ttl.d.ts +94 -0
- package/dist/esm/shared/validation/ttl.js +46 -0
- package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
- package/dist/esm/store/actions/list-namespaces.js +86 -0
- package/dist/esm/store/actions/put.d.ts +43 -0
- package/dist/esm/store/actions/put.js +46 -0
- package/dist/{store/actions/reconcile-vector-index.js → esm/store/actions/reconcile-vector-index.d.ts} +8 -16
- package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
- package/dist/esm/store/actions/search.d.ts +38 -0
- package/dist/esm/store/actions/search.js +23 -0
- package/dist/esm/store/internal/batch-plan.d.ts +56 -0
- package/dist/esm/store/internal/batch-plan.js +28 -0
- package/dist/esm/store/internal/filter.d.ts +43 -0
- package/dist/esm/store/internal/filter.js +60 -0
- package/dist/esm/store/internal/get-item.d.ts +77 -0
- package/dist/esm/store/internal/get-item.js +54 -0
- package/dist/esm/store/internal/item-write.d.ts +270 -0
- package/dist/esm/store/internal/item-write.js +173 -0
- package/dist/esm/store/internal/parse.d.ts +230 -0
- package/dist/esm/store/internal/parse.js +169 -0
- package/dist/{store/internal/rows.js → esm/store/internal/rows.d.ts} +111 -199
- package/dist/esm/store/internal/rows.js +147 -0
- package/dist/esm/store/internal/semantic-search.d.ts +168 -0
- package/dist/esm/store/internal/semantic-search.js +200 -0
- package/dist/esm/store/internal/setup.d.ts +96 -0
- package/dist/esm/store/internal/setup.js +98 -0
- package/dist/esm/store/internal/table-search.d.ts +100 -0
- package/dist/esm/store/internal/table-search.js +119 -0
- package/dist/esm/store/internal/vector-index.d.ts +258 -0
- package/dist/esm/store/internal/vector-index.js +256 -0
- package/dist/{store/store.js → esm/store/store.d.ts} +99 -133
- package/dist/esm/store/store.js +93 -0
- package/dist/esm/store/types.d.ts +111 -0
- package/dist/esm/store/types.js +1 -0
- package/dist/esm/store/vector-backend.d.ts +104 -0
- package/dist/esm/store/vector-backend.js +1 -0
- package/package.json +50 -44
- package/dist/backfill/backfill.js +0 -393
- package/dist/checkpointer/actions/list.js +0 -142
- package/dist/checkpointer/actions/put.js +0 -195
- package/dist/checkpointer/internal/delta-history.js +0 -252
- package/dist/checkpointer/internal/parse.js +0 -372
- package/dist/checkpointer/internal/pending-writes.js +0 -588
- package/dist/checkpointer/internal/read.js +0 -264
- package/dist/checkpointer/internal/rows.js +0 -834
- package/dist/checkpointer/internal/setup.js +0 -72
- package/dist/checkpointer/types.js +0 -12
- package/dist/factory/factory.js +0 -266
- package/dist/factory/types.js +0 -10
- package/dist/history/actions/get-messages.js +0 -141
- package/dist/history/actions/list-sessions.js +0 -156
- package/dist/history/internal/append.js +0 -500
- package/dist/history/internal/message-read.js +0 -204
- package/dist/history/internal/parse.js +0 -252
- package/dist/history/internal/session.js +0 -628
- package/dist/history/internal/setup.js +0 -106
- package/dist/history/types.js +0 -12
- package/dist/index.js +0 -51
- package/dist/shared/adapter.js +0 -143
- package/dist/shared/codec/codec.js +0 -441
- package/dist/shared/codec/compression.js +0 -89
- package/dist/shared/codec/json-serde.js +0 -191
- package/dist/shared/codec/s3/client-types.js +0 -26
- package/dist/shared/codec/s3/client.js +0 -97
- package/dist/shared/codec/s3/lifecycle.js +0 -355
- package/dist/shared/codec/s3/offloader.js +0 -658
- package/dist/shared/dynamodb/batch-write.js +0 -173
- package/dist/shared/dynamodb/paginate.js +0 -188
- package/dist/shared/dynamodb/partition-delete.js +0 -340
- package/dist/shared/dynamodb/recency-index.js +0 -377
- package/dist/shared/dynamodb/retry.js +0 -463
- package/dist/shared/errors/base-error.js +0 -174
- package/dist/shared/errors/boundary.js +0 -143
- package/dist/shared/errors/classify.d.ts +0 -97
- package/dist/shared/errors/classify.js +0 -257
- package/dist/shared/logging/redaction.js +0 -316
- package/dist/shared/options.js +0 -11
- package/dist/shared/validation/options.js +0 -328
- package/dist/shared/validation/ttl.js +0 -132
- package/dist/store/actions/list-namespaces.js +0 -197
- package/dist/store/actions/put.js +0 -78
- package/dist/store/actions/search.js +0 -66
- package/dist/store/internal/batch-plan.d.ts +0 -26
- package/dist/store/internal/batch-plan.js +0 -109
- package/dist/store/internal/filter.js +0 -137
- package/dist/store/internal/get-item.d.ts +0 -45
- package/dist/store/internal/get-item.js +0 -115
- package/dist/store/internal/item-write.js +0 -463
- package/dist/store/internal/parse.js +0 -350
- package/dist/store/internal/semantic-search.js +0 -389
- package/dist/store/internal/setup.js +0 -223
- package/dist/store/internal/table-search.js +0 -213
- package/dist/store/internal/vector-index.js +0 -546
- package/dist/store/types.js +0 -15
- package/dist/store/vector-backend.js +0 -17
- /package/dist/{shared → cjs/shared}/clock.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/codec/json-serde.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/concurrency.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/dynamodb/cancellation.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/logging/logger.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/logging/truncate.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/ulid.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/validation/primitives.d.ts +0 -0
- /package/dist/{store → cjs/store}/vector-backend.d.ts +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Hides which public methods share one guarded dispatch, and which do not.
|
|
4
3
|
*
|
|
@@ -7,26 +6,17 @@
|
|
|
7
6
|
* the five answer and refuse alike. `search` guards the same way but calls
|
|
8
7
|
* its own action directly, to carry a signal that `batch` cannot;
|
|
9
8
|
* `reconcileVectorIndex` and `ensureS3LifecycleRule` guard directly too,
|
|
10
|
-
* since neither is a batchable store operation. Each
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* shell,
|
|
14
|
-
*
|
|
9
|
+
* since neither is a batchable store operation. Each public method declared
|
|
10
|
+
* here is also the error boundary (record 13) — an asynchronous one through
|
|
11
|
+
* `guardPublic`, and the synchronous `destroy`, releasing what the store owns
|
|
12
|
+
* through its shell, through `guardPublicSync`; `stop` is that same guarded
|
|
13
|
+
* call under upstream's lifecycle name. The inherited `start()` no-op —
|
|
14
|
+
* declared by `BaseStore`, not overridden here — is neither guarded nor
|
|
15
|
+
* routed through any of this.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const boundary_1 = require("../shared/errors/boundary");
|
|
20
|
-
const collaborators_1 = require("../shared/validation/collaborators");
|
|
21
|
-
const option_shape_1 = require("../shared/validation/option-shape");
|
|
22
|
-
const list_namespaces_1 = require("./actions/list-namespaces");
|
|
23
|
-
const put_1 = require("./actions/put");
|
|
24
|
-
const reconcile_vector_index_1 = require("./actions/reconcile-vector-index");
|
|
25
|
-
const search_1 = require("./actions/search");
|
|
26
|
-
const batch_plan_1 = require("./internal/batch-plan");
|
|
27
|
-
const get_item_1 = require("./internal/get-item");
|
|
28
|
-
const parse_1 = require("./internal/parse");
|
|
29
|
-
const setup_1 = require("./internal/setup");
|
|
17
|
+
import { BaseStore, type Item, type Operation, type OperationResults, type SearchItem } from '@langchain/langgraph-checkpoint';
|
|
18
|
+
import type { CancelOptions } from '../shared/options.js';
|
|
19
|
+
import type { DynamoDBStoreOptions, ListNamespacesOptions, SearchOptions, VectorReconcileResult } from './types.js';
|
|
30
20
|
/**
|
|
31
21
|
* DynamoDB-backed LangGraph store for long-term memory with optional semantic
|
|
32
22
|
* search. `get`, `put`, `delete` and `listNamespaces` answer and refuse exactly
|
|
@@ -34,9 +24,9 @@ const setup_1 = require("./internal/setup");
|
|
|
34
24
|
* own namespace rules. Every public method rejects only with this library's
|
|
35
25
|
* error.
|
|
36
26
|
*/
|
|
37
|
-
class DynamoDBStore extends
|
|
38
|
-
context;
|
|
39
|
-
shell;
|
|
27
|
+
export declare class DynamoDBStore extends BaseStore {
|
|
28
|
+
private readonly context;
|
|
29
|
+
private readonly shell;
|
|
40
30
|
/**
|
|
41
31
|
* Accepts: `options` — validated here, so a misconfiguration surfaces at
|
|
42
32
|
* construction rather than on the first request. A `vectorBackend` without an
|
|
@@ -50,33 +40,17 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
50
40
|
*
|
|
51
41
|
* Guarantees: no I/O. Constructing a store issues no request.
|
|
52
42
|
*/
|
|
53
|
-
constructor(options)
|
|
54
|
-
super();
|
|
55
|
-
const setup = (0, setup_1.setUpStore)(options);
|
|
56
|
-
this.context = setup.context;
|
|
57
|
-
this.shell = setup.shell;
|
|
58
|
-
}
|
|
43
|
+
constructor(options: DynamoDBStoreOptions);
|
|
59
44
|
/**
|
|
60
45
|
* One operation's result: the item for a get, the page for a search, the
|
|
61
46
|
* namespaces for a listing, and `null` for a put or a delete — the value the
|
|
62
47
|
* reference store's `batch` answers a put or a delete with. The kind was
|
|
63
48
|
* decided once, by the parser that built `operation`, so this switches on it
|
|
64
|
-
* instead of asking the operation's shape again.
|
|
49
|
+
* instead of asking the operation's shape again. `readConcurrency` — this
|
|
50
|
+
* operation's share of the call's decode budget, which only a search spends
|
|
51
|
+
* more than one of.
|
|
65
52
|
*/
|
|
66
|
-
|
|
67
|
-
switch (operation.kind) {
|
|
68
|
-
case 'search':
|
|
69
|
-
return (0, search_1.searchItems)(this.context, operation);
|
|
70
|
-
case 'put':
|
|
71
|
-
case 'delete':
|
|
72
|
-
await (0, put_1.putItem)(this.context, operation);
|
|
73
|
-
return null;
|
|
74
|
-
case 'get':
|
|
75
|
-
return (0, get_item_1.getItem)(this.context, operation.address);
|
|
76
|
-
case 'list':
|
|
77
|
-
return (0, list_namespaces_1.listNamespaces)(this.context, operation);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
53
|
+
private dispatch;
|
|
80
54
|
/**
|
|
81
55
|
* Run a batch of already-parsed operations, with no boundary of its own.
|
|
82
56
|
*
|
|
@@ -84,17 +58,18 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
84
58
|
* the brand the *inner* one assigned, so routing `get`, `put`, `delete` and
|
|
85
59
|
* `listNamespaces` through the public {@link batch} reported all four as
|
|
86
60
|
* `store.batch` and left an operator counting AWS failures by
|
|
87
|
-
* `context.operation` unable to tell them apart.
|
|
61
|
+
* `context.operation` unable to tell them apart. The operations one phase
|
|
62
|
+
* keeps in flight together share `this.context.readConcurrency`, the call's
|
|
63
|
+
* one decode budget, so a phase of several concurrent searches never
|
|
64
|
+
* multiplies it (see {@link runBatch}).
|
|
88
65
|
*/
|
|
89
|
-
|
|
90
|
-
return (0, batch_plan_1.runBatch)(operations, (operation) => this.dispatch(operation), this.context.readConcurrency);
|
|
91
|
-
}
|
|
66
|
+
private execute;
|
|
92
67
|
/**
|
|
93
68
|
* Execute a batch of operations and return their results in operation
|
|
94
69
|
* order.
|
|
95
70
|
*
|
|
96
|
-
* Accepts: `operations` — an array of operation objects
|
|
97
|
-
*
|
|
71
|
+
* Accepts: `operations` — an array of operation objects; an empty batch
|
|
72
|
+
* does nothing and returns `[]`. Every
|
|
98
73
|
* operation is checked before any of them runs. A put carrying a `null`
|
|
99
74
|
* value deletes its item. `get`, `put`, `delete` and `listNamespaces` check
|
|
100
75
|
* their own call by the same rules and run the same dispatch, as upstream's
|
|
@@ -117,22 +92,24 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
117
92
|
* search; `offset`, `limit`, `maxDepth`, `matchConditions`, `prefix`,
|
|
118
93
|
* `prefix element`, `suffix` or `suffix element` for a listing; and later,
|
|
119
94
|
* from a running operation, `value` for one JSON cannot represent,
|
|
120
|
-
* `maxSearchCandidates` or `index.dims
|
|
95
|
+
* `maxSearchCandidates` or `index.dims`, or — once a put's row is built —
|
|
96
|
+
* `index` or `value` again for one over DynamoDB's 400 KB item limit, naming
|
|
97
|
+
* `index` when its inline vectors are what pushed it over. A classified AWS
|
|
98
|
+
* failure; `RETRY_EXHAUSTED`;
|
|
121
99
|
* `RESULT_TRUNCATED` from a search or a listing that reads past
|
|
122
|
-
* `maxScanItems`. One failing operation rejects the
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* search
|
|
127
|
-
*
|
|
128
|
-
*
|
|
100
|
+
* `maxScanItems` or `maxIterations`. One failing operation rejects the
|
|
101
|
+
* whole batch.
|
|
102
|
+
*
|
|
103
|
+
* Guarantees: the batch is evaluated as the reference store evaluates one —
|
|
104
|
+
* every get, search and listing is answered as the batch found things, and
|
|
105
|
+
* the puts and deletes land afterwards, one per item, the last one written
|
|
106
|
+
* winning — so two tasks of one superstep that touch one item get the same
|
|
107
|
+
* answers whichever was enqueued first. The reads run concurrently, then the
|
|
108
|
+
* writes, so a batch of ten gets costs about one round trip rather than ten,
|
|
109
|
+
* sharing one `readConcurrency` decode budget between them rather than each
|
|
110
|
+
* holding a full one.
|
|
129
111
|
*/
|
|
130
|
-
|
|
131
|
-
return (0, boundary_1.guardPublic)('store.batch', async () => {
|
|
132
|
-
const results = await this.execute((0, parse_1.parseOperations)(operations));
|
|
133
|
-
return results;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
112
|
+
batch<Op extends Operation[]>(operations: Op): Promise<OperationResults<Op>>;
|
|
136
113
|
/**
|
|
137
114
|
* Retrieve one item. Overrides the base implementation so the call is
|
|
138
115
|
* guarded here; the operation is the one upstream builds.
|
|
@@ -161,14 +138,7 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
161
138
|
* the cap; a classified AWS failure; `RETRY_EXHAUSTED`. Not `ABORTED`: there is no
|
|
162
139
|
* signal to fire.
|
|
163
140
|
*/
|
|
164
|
-
|
|
165
|
-
return (0, boundary_1.guardPublic)('store.get', async () => {
|
|
166
|
-
const [item] = await this.execute([
|
|
167
|
-
{ kind: 'get', address: (0, parse_1.parseStoreAddress)(namespace, key) },
|
|
168
|
-
]);
|
|
169
|
-
return item;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
141
|
+
get(namespace: string[], key: string): Promise<Item | null>;
|
|
172
142
|
/**
|
|
173
143
|
* Store or replace one item. Overrides the base implementation, whose own
|
|
174
144
|
* namespace check threw an error this package does not brand. The value and
|
|
@@ -184,13 +154,16 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
184
154
|
* Returns: nothing.
|
|
185
155
|
*
|
|
186
156
|
* Throws: `VALIDATION` naming `namespace`, `namespace element`, `key`,
|
|
187
|
-
* `sortKey`, `value` or `index`; a
|
|
157
|
+
* `sortKey`, `value` or `index`; `payload` for a value too large to store
|
|
158
|
+
* inline without `s3`, or, once offloaded, larger than
|
|
159
|
+
* `s3.maxDownloadBytes`; `s3Key` for an offloaded object's key over S3's
|
|
160
|
+
* cap; `VALIDATION` again, naming `index` or `value`, for the built row over
|
|
161
|
+
* DynamoDB's 400 KB item limit — `index` when its inline vectors are what
|
|
162
|
+
* pushed it over — checked before anything is written; `S3_OFFLOAD_FAILED`
|
|
163
|
+
* when an offloaded payload cannot be uploaded; a classified AWS failure;
|
|
164
|
+
* `RETRY_EXHAUSTED`.
|
|
188
165
|
*/
|
|
189
|
-
|
|
190
|
-
return (0, boundary_1.guardPublic)('store.put', async () => {
|
|
191
|
-
await this.execute([(0, parse_1.parsePutArguments)(namespace, key, value, index)]);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
166
|
+
put(namespace: string[], key: string, value: Parameters<BaseStore['put']>[2], index?: Parameters<BaseStore['put']>[3]): Promise<void>;
|
|
194
167
|
/**
|
|
195
168
|
* Remove one item, as upstream does: a put operation carrying `null`.
|
|
196
169
|
*
|
|
@@ -220,33 +193,26 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
220
193
|
* Re-run once the key is quiescent. Nothing is released on that path, which
|
|
221
194
|
* is correct: a live row still names the object.
|
|
222
195
|
*/
|
|
223
|
-
|
|
224
|
-
return (0, boundary_1.guardPublic)('store.delete', async () => {
|
|
225
|
-
await this.execute([{ kind: 'delete', address: (0, parse_1.parseStoreAddress)(namespace, key) }]);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
196
|
+
delete(namespace: string[], key: string): Promise<void>;
|
|
228
197
|
/**
|
|
229
198
|
* List the distinct namespaces, sorted, optionally filtered and truncated.
|
|
230
199
|
*
|
|
231
200
|
* Accepts: `options.prefix`/`suffix` — labels a namespace can hold, where
|
|
232
201
|
* `'*'` matches any one label. `options.maxDepth` — at least 1.
|
|
233
|
-
* `options.limit` — an integer from 0 to
|
|
202
|
+
* `options.limit` — an integer from 0 to 10,000, defaulting
|
|
234
203
|
* to 100, where `0` returns an empty listing without reading the table.
|
|
235
204
|
* `options.offset` — a non-negative integer, defaulting to 0.
|
|
236
205
|
*
|
|
237
206
|
* Returns: at most `limit` namespaces from `offset`.
|
|
238
207
|
*
|
|
239
|
-
* Throws: `VALIDATION` naming `options`, `
|
|
240
|
-
* `
|
|
241
|
-
* `
|
|
242
|
-
* for an item written by a newer version; a classified
|
|
208
|
+
* Throws: `VALIDATION` naming `options`, `prefix`, `prefix element`,
|
|
209
|
+
* `suffix`, `suffix element`, `maxDepth`, `limit` or `offset`;
|
|
210
|
+
* `RESULT_TRUNCATED` past `maxScanItems` or `maxIterations`;
|
|
211
|
+
* `FORMAT_UNSUPPORTED` for an item written by a newer version; a classified
|
|
212
|
+
* AWS failure. An option key this version does not read is ignored rather
|
|
213
|
+
* than refused, since the options are LangGraph's (decision record 28).
|
|
243
214
|
*/
|
|
244
|
-
|
|
245
|
-
return (0, boundary_1.guardPublic)('store.listNamespaces', async () => {
|
|
246
|
-
const [namespaces] = await this.execute([(0, parse_1.parseListNamespacesOptions)(options)]);
|
|
247
|
-
return namespaces;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
215
|
+
listNamespaces(options?: ListNamespacesOptions): Promise<string[][]>;
|
|
250
216
|
/**
|
|
251
217
|
* Search with optional cancellation. Overrides the base implementation, which
|
|
252
218
|
* routes through {@link batch} and therefore cannot carry a signal.
|
|
@@ -255,7 +221,7 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
255
221
|
* whole table. `options.query` —
|
|
256
222
|
* absent or empty ranks nothing. `options.filter` — metadata equality on the
|
|
257
223
|
* item's value. `options.offset` — a non-negative integer, defaulting to 0.
|
|
258
|
-
* `options.limit` — an integer from 0 to
|
|
224
|
+
* `options.limit` — an integer from 0 to 10,000, defaulting
|
|
259
225
|
* to 10, where `0` returns an empty page without a read or an embedding.
|
|
260
226
|
* `options.signal` — aborts the reads.
|
|
261
227
|
*
|
|
@@ -263,52 +229,44 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
263
229
|
* a query and an index are configured.
|
|
264
230
|
*
|
|
265
231
|
* Throws: `VALIDATION` naming `namespacePrefix`, `namespacePrefix element`,
|
|
266
|
-
* `
|
|
267
|
-
* `
|
|
268
|
-
* `
|
|
232
|
+
* `options` for options that are not an object, `filter`, `query`, `offset`,
|
|
233
|
+
* `limit`, `maxSearchCandidates`, `index.dims` or `signal`; `ABORTED`;
|
|
234
|
+
* `RESULT_TRUNCATED` when the walk reaches `maxScanItems` or `maxIterations`;
|
|
269
235
|
* `FORMAT_UNSUPPORTED` for an item, or its payload, written by a newer
|
|
270
236
|
* version — a search reads rows it did not name, so one such row anywhere in
|
|
271
237
|
* the prefix it walks reports rather than being passed over; a classified AWS failure.
|
|
238
|
+
* An option key this version does not read is ignored rather than refused:
|
|
239
|
+
* the options are LangGraph's, and a key a later LangGraph adds must not turn
|
|
240
|
+
* a search into a refusal (decision record 28).
|
|
272
241
|
*
|
|
273
242
|
* Guarantees: a plain search stops reading once `offset + limit` matches are
|
|
274
243
|
* in hand; a query ranks in-process up to `maxSearchCandidates`, or through
|
|
275
244
|
* the `vectorBackend` when one is configured.
|
|
276
245
|
*/
|
|
277
|
-
|
|
278
|
-
return (0, boundary_1.guardPublic)('store.search', () => {
|
|
279
|
-
const prefix = (0, parse_1.parseNamespacePrefix)(namespacePrefix, 'namespacePrefix');
|
|
280
|
-
(0, option_shape_1.assertShape)(options, setup_1.STORE_SEARCH_KEYS, 'options');
|
|
281
|
-
(0, collaborators_1.assertSignalLike)(options.signal);
|
|
282
|
-
const { signal, ...rest } = options;
|
|
283
|
-
return (0, search_1.searchItems)(this.context, (0, parse_1.parseSearch)(prefix, rest), signal);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
246
|
+
search(namespacePrefix: string[], options?: SearchOptions): Promise<SearchItem[]>;
|
|
286
247
|
/**
|
|
287
248
|
* Repair the configured vector backend against the canonical items under
|
|
288
249
|
* `namespacePrefix`. A maintenance tool; see the action of the same name.
|
|
289
250
|
*
|
|
290
251
|
* Accepts: `namespacePrefix` — a non-empty namespace. `options.signal` —
|
|
291
|
-
*
|
|
252
|
+
* ends the read or download in flight and any wait between them; vectors
|
|
253
|
+
* already upserted or pruned stay so.
|
|
292
254
|
*
|
|
293
255
|
* Returns: how many vectors were upserted and how many pruned.
|
|
294
256
|
*
|
|
295
257
|
* Throws: `VALIDATION` without both an `index` and a `vectorBackend`, for
|
|
296
258
|
* an empty prefix, for an invalid `signal`, or for `options.<key>` naming a
|
|
297
|
-
* key this package does not read; `RESULT_TRUNCATED` past `maxScanItems
|
|
298
|
-
* `FORMAT_UNSUPPORTED` for an item, or its payload, written by a newer
|
|
259
|
+
* key this package does not read; `RESULT_TRUNCATED` past `maxScanItems` or
|
|
260
|
+
* `maxIterations`; `FORMAT_UNSUPPORTED` for an item, or its payload, written by a newer
|
|
299
261
|
* version — repairing a backend from a view of the prefix that silently
|
|
300
262
|
* omitted such a row would prune the vectors of items that are still there;
|
|
301
263
|
* a classified AWS failure.
|
|
302
264
|
*
|
|
303
265
|
* Guarantees: DynamoDB is never written — only the backend is repaired — and
|
|
304
|
-
* a vector is deleted only on evidence that its item is gone
|
|
266
|
+
* a vector is deleted only on evidence that its item is gone, or unchanged
|
|
267
|
+
* since a snapshot that already found it with nothing to embed.
|
|
305
268
|
*/
|
|
306
|
-
reconcileVectorIndex(namespacePrefix, options)
|
|
307
|
-
return (0, boundary_1.guardPublic)('store.reconcileVectorIndex', () => {
|
|
308
|
-
(0, collaborators_1.assertCancelOptions)(options);
|
|
309
|
-
return (0, reconcile_vector_index_1.reconcileVectorIndex)(this.context, namespacePrefix, options);
|
|
310
|
-
});
|
|
311
|
-
}
|
|
269
|
+
reconcileVectorIndex(namespacePrefix: string[], options?: CancelOptions): Promise<VectorReconcileResult>;
|
|
312
270
|
/**
|
|
313
271
|
* LangGraph's lifecycle hook.
|
|
314
272
|
*
|
|
@@ -321,9 +279,7 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
321
279
|
*
|
|
322
280
|
* Throws: exactly what {@link destroy} throws, since it is that call.
|
|
323
281
|
*/
|
|
324
|
-
stop()
|
|
325
|
-
this.destroy();
|
|
326
|
-
}
|
|
282
|
+
stop(): void;
|
|
327
283
|
/**
|
|
328
284
|
* Release owned resources.
|
|
329
285
|
*
|
|
@@ -332,13 +288,12 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
332
288
|
* Returns: nothing. Idempotent, and a no-op for a client the caller injected
|
|
333
289
|
* — that one is theirs to close.
|
|
334
290
|
*
|
|
335
|
-
* Throws:
|
|
336
|
-
*
|
|
337
|
-
*
|
|
291
|
+
* Throws: the first failure a resource's own `destroy` raised, as a
|
|
292
|
+
* `DynamoDBLangGraphError` (`UNEXPECTED_ERROR` unless the failure was AWS's)
|
|
293
|
+
* with it as `cause` — raised only after every other resource has been
|
|
294
|
+
* released, and only by the first call: `destroy()` is idempotent.
|
|
338
295
|
*/
|
|
339
|
-
destroy()
|
|
340
|
-
this.shell.release();
|
|
341
|
-
}
|
|
296
|
+
destroy(): void;
|
|
342
297
|
/**
|
|
343
298
|
* Provision an S3 lifecycle expiration rule matching the configured TTL, so
|
|
344
299
|
* offloaded objects don't outlive their DynamoDB item forever.
|
|
@@ -347,17 +302,28 @@ class DynamoDBStore extends langgraph_checkpoint_1.BaseStore {
|
|
|
347
302
|
* without both.
|
|
348
303
|
*
|
|
349
304
|
* Returns: nothing. Installing a rule that is already there is a no-op too,
|
|
350
|
-
* so calling it on every deploy is safe.
|
|
305
|
+
* so calling it on every deploy is safe. When it writes the rules but
|
|
306
|
+
* cannot confirm within its polling window that a re-read shows them — S3
|
|
307
|
+
* documents that a lifecycle configuration can take minutes to propagate —
|
|
308
|
+
* it logs a `warn` and returns rather than throwing: the rules were
|
|
309
|
+
* written, and a later call can confirm them.
|
|
351
310
|
*
|
|
352
311
|
* Throws: `VALIDATION` naming `s3.keyPrefix` on a rule-id collision;
|
|
353
|
-
* a classified AWS failure when the bucket's lifecycle cannot be read or
|
|
312
|
+
* a classified AWS failure when the bucket's lifecycle cannot be read or
|
|
313
|
+
* written; `CONTENTION` when every one of the five rounds this call polls
|
|
314
|
+
* needs a write — a competing writer replacing the configuration on every
|
|
315
|
+
* single re-read.
|
|
354
316
|
* @remarks Requires the bucket-level `s3:GetLifecycleConfiguration` /
|
|
355
317
|
* `s3:PutLifecycleConfiguration` permissions, broader than the object-level
|
|
356
318
|
* CRUD the rest of S3 offload needs — call it once during provisioning, not
|
|
357
|
-
* per request.
|
|
319
|
+
* per request. When several adapters or processes provision the same
|
|
320
|
+
* bucket, call them one at a time and run each again after a few minutes
|
|
321
|
+
* once every one of them has run.
|
|
322
|
+
*
|
|
323
|
+
* Lowering the `ttl` is safe for new rows at once; the rule is not. Lower
|
|
324
|
+
* `ttl` now, and call this again only once the old `ttl` has elapsed since,
|
|
325
|
+
* because until then rows written under the old value still name objects
|
|
326
|
+
* the shorter rule would expire. Raising the `ttl` is safe at once.
|
|
358
327
|
*/
|
|
359
|
-
|
|
360
|
-
return (0, boundary_1.guardPublic)('store.ensureS3LifecycleRule', () => this.shell.ensureLifecycleRule());
|
|
361
|
-
}
|
|
328
|
+
ensureS3LifecycleRule(): Promise<void>;
|
|
362
329
|
}
|
|
363
|
-
exports.DynamoDBStore = DynamoDBStore;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { BaseStore, } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import { guardPublic, guardPublicSync } from '../shared/errors/boundary.js';
|
|
3
|
+
import { assertSignalLike, assertCancelOptions } from '../shared/validation/collaborators.js';
|
|
4
|
+
import { assertObjectShape } from '../shared/validation/option-shape.js';
|
|
5
|
+
import { listNamespaces } from './actions/list-namespaces.js';
|
|
6
|
+
import { putItem } from './actions/put.js';
|
|
7
|
+
import { reconcileVectorIndex as reconcileVectorIndexAction } from './actions/reconcile-vector-index.js';
|
|
8
|
+
import { searchItems } from './actions/search.js';
|
|
9
|
+
import { runBatch } from './internal/batch-plan.js';
|
|
10
|
+
import { getItem } from './internal/get-item.js';
|
|
11
|
+
import { parseListNamespacesOptions, parseNamespacePrefix, parseOperations, parsePutArguments, parseSearch, parseStoreAddress, } from './internal/parse.js';
|
|
12
|
+
import { setUpStore } from './internal/setup.js';
|
|
13
|
+
export class DynamoDBStore extends BaseStore {
|
|
14
|
+
context;
|
|
15
|
+
shell;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
super();
|
|
18
|
+
const setup = setUpStore(options);
|
|
19
|
+
this.context = setup.context;
|
|
20
|
+
this.shell = setup.shell;
|
|
21
|
+
}
|
|
22
|
+
async dispatch(operation, readConcurrency) {
|
|
23
|
+
switch (operation.kind) {
|
|
24
|
+
case 'search':
|
|
25
|
+
return searchItems({ ...this.context, readConcurrency }, operation);
|
|
26
|
+
case 'put':
|
|
27
|
+
case 'delete':
|
|
28
|
+
await putItem(this.context, operation);
|
|
29
|
+
return null;
|
|
30
|
+
case 'get':
|
|
31
|
+
return getItem(this.context, operation.address);
|
|
32
|
+
case 'list':
|
|
33
|
+
return listNamespaces(this.context, operation);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async execute(operations) {
|
|
37
|
+
return runBatch(operations, (operation, readConcurrency) => this.dispatch(operation, readConcurrency), this.context.readConcurrency);
|
|
38
|
+
}
|
|
39
|
+
async batch(operations) {
|
|
40
|
+
return guardPublic('store.batch', async () => {
|
|
41
|
+
const results = await this.execute(parseOperations(operations));
|
|
42
|
+
return results;
|
|
43
|
+
}, this.context.tableName);
|
|
44
|
+
}
|
|
45
|
+
async get(namespace, key) {
|
|
46
|
+
return guardPublic('store.get', async () => {
|
|
47
|
+
const [item] = await this.execute([
|
|
48
|
+
{ kind: 'get', address: parseStoreAddress(namespace, key) },
|
|
49
|
+
]);
|
|
50
|
+
return item;
|
|
51
|
+
}, this.context.tableName);
|
|
52
|
+
}
|
|
53
|
+
async put(namespace, key, value, index) {
|
|
54
|
+
return guardPublic('store.put', async () => {
|
|
55
|
+
await this.execute([parsePutArguments(namespace, key, value, index)]);
|
|
56
|
+
}, this.context.tableName);
|
|
57
|
+
}
|
|
58
|
+
async delete(namespace, key) {
|
|
59
|
+
return guardPublic('store.delete', async () => {
|
|
60
|
+
await this.execute([{ kind: 'delete', address: parseStoreAddress(namespace, key) }]);
|
|
61
|
+
}, this.context.tableName);
|
|
62
|
+
}
|
|
63
|
+
async listNamespaces(options = {}) {
|
|
64
|
+
return guardPublic('store.listNamespaces', async () => {
|
|
65
|
+
const [namespaces] = await this.execute([parseListNamespacesOptions(options)]);
|
|
66
|
+
return namespaces;
|
|
67
|
+
}, this.context.tableName);
|
|
68
|
+
}
|
|
69
|
+
async search(namespacePrefix, options = {}) {
|
|
70
|
+
return guardPublic('store.search', () => {
|
|
71
|
+
const prefix = parseNamespacePrefix(namespacePrefix, 'namespacePrefix');
|
|
72
|
+
assertObjectShape(options, 'options');
|
|
73
|
+
assertSignalLike(options.signal);
|
|
74
|
+
const { signal, ...rest } = options;
|
|
75
|
+
return searchItems(this.context, parseSearch(prefix, rest), signal);
|
|
76
|
+
}, this.context.tableName);
|
|
77
|
+
}
|
|
78
|
+
reconcileVectorIndex(namespacePrefix, options) {
|
|
79
|
+
return guardPublic('store.reconcileVectorIndex', () => {
|
|
80
|
+
assertCancelOptions(options);
|
|
81
|
+
return reconcileVectorIndexAction(this.context, namespacePrefix, options);
|
|
82
|
+
}, this.context.tableName);
|
|
83
|
+
}
|
|
84
|
+
stop() {
|
|
85
|
+
this.destroy();
|
|
86
|
+
}
|
|
87
|
+
destroy() {
|
|
88
|
+
guardPublicSync('store.destroy', () => this.shell.release(), this.context.tableName);
|
|
89
|
+
}
|
|
90
|
+
async ensureS3LifecycleRule() {
|
|
91
|
+
return guardPublic('store.ensureS3LifecycleRule', () => this.shell.ensureLifecycleRule(), this.context.tableName);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides the store's own option and result shapes, composed from building
|
|
3
|
+
* blocks declared elsewhere.
|
|
4
|
+
*
|
|
5
|
+
* `DynamoDBStoreOptions`, `SearchOptions`, `ListNamespacesOptions` and
|
|
6
|
+
* `VectorReconcileResult` are declared here. `DynamoDBStoreOptions` composes
|
|
7
|
+
* `BaseAdapterOptions` and `CodecOptions`, and `SearchOptions` composes
|
|
8
|
+
* `CancelOptions` — all three declared once in the shared options module, not
|
|
9
|
+
* copied here — plus `VectorBackend` and `VectorScoreDirection`, declared
|
|
10
|
+
* once in `vector-backend.ts`. Which keys each bag accepts, and the defaults
|
|
11
|
+
* filled in, are decided by the store's setup and parsers, so a caller can
|
|
12
|
+
* type what it builds without learning how it is checked.
|
|
13
|
+
*/
|
|
14
|
+
import type { IndexConfig, SearchOperation, SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
15
|
+
import type { BaseAdapterOptions, CancelOptions, CodecOptions } from '../shared/options.js';
|
|
16
|
+
import type { VectorBackend, VectorScoreDirection } from './vector-backend.js';
|
|
17
|
+
/**
|
|
18
|
+
* Options for {@link DynamoDBStore}.
|
|
19
|
+
*
|
|
20
|
+
* `indexName` and `indexShards` are not store options: no store read uses the
|
|
21
|
+
* recency index, so a store given either refuses it as an unknown key.
|
|
22
|
+
*/
|
|
23
|
+
export type DynamoDBStoreOptions = Omit<BaseAdapterOptions, 'indexName' | 'indexShards'> & CodecOptions & {
|
|
24
|
+
/**
|
|
25
|
+
* Optional semantic-search index configuration (embeddings + fields).
|
|
26
|
+
*
|
|
27
|
+
* Without a `vectorBackend` the vectors live on the item itself, one per
|
|
28
|
+
* text the configured fields extract — a wildcard path such as
|
|
29
|
+
* `sections[*].text` extracts one per element — at up to 10 bytes per
|
|
30
|
+
* dimension. They are not counted toward `s3.thresholdBytes` — offload
|
|
31
|
+
* decides on the payload alone — and a row they would take past
|
|
32
|
+
* DynamoDB's 400 KB item limit is refused with `VALIDATION` naming
|
|
33
|
+
* `index` before anything is written.
|
|
34
|
+
*/
|
|
35
|
+
index?: IndexConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Optional serializer override. The default is the exported `JSON_SERDE`,
|
|
38
|
+
* plain JSON: what it stores is the JSON projection of a value, and the
|
|
39
|
+
* README's *Table schema* section tabulates where that differs from the
|
|
40
|
+
* value itself.
|
|
41
|
+
*/
|
|
42
|
+
serde?: SerializerProtocol;
|
|
43
|
+
/** Optional external vector index; when set, similarity search delegates to it. */
|
|
44
|
+
vectorBackend?: VectorBackend;
|
|
45
|
+
/**
|
|
46
|
+
* Max candidates a semantic search may hold in memory to rank, and the
|
|
47
|
+
* furthest a `vectorBackend` page may reach, before erroring (default
|
|
48
|
+
* 1000). It bounds this process's memory, not the corpus — a corpus larger
|
|
49
|
+
* than this belongs behind a `vectorBackend`.
|
|
50
|
+
*/
|
|
51
|
+
maxSearchCandidates?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Cap on rows read into memory by one search, namespace listing or
|
|
54
|
+
* reconcile before `RESULT_TRUNCATED`. Reaching it is an error, not a
|
|
55
|
+
* truncation: a partial answer is never returned as a complete one.
|
|
56
|
+
* Defaults to 10,000; the ceiling is 1,000,000.
|
|
57
|
+
*/
|
|
58
|
+
maxScanItems?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Cap on DynamoDB pages one search, namespace listing or reconcile reads
|
|
61
|
+
* before `RESULT_TRUNCATED` (default 1000; a page is at most 1 MB).
|
|
62
|
+
* `Infinity` reads to the end. It is the cap a rootless search or listing
|
|
63
|
+
* over a large table meets first when most of what it scans is not store
|
|
64
|
+
* rows, since those pages hold few rows for `maxScanItems` to count.
|
|
65
|
+
*/
|
|
66
|
+
maxIterations?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Direction of the score a `vectorBackend` returns. `'relevance'` (the
|
|
69
|
+
* default) forwards it unchanged; `'distance'` negates and re-sorts, so a
|
|
70
|
+
* distance-native backend (S3 Vectors, FAISS L2, pgvector `<->`) satisfies
|
|
71
|
+
* the higher-is-better contract without the caller wrapping it. Any other
|
|
72
|
+
* value is rejected at construction with a `VALIDATION` error rather than
|
|
73
|
+
* silently ranking one direction as the other.
|
|
74
|
+
*/
|
|
75
|
+
vectorScoreDirection?: VectorScoreDirection;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Options {@link DynamoDBStore.search} accepts: the metadata/paging fields of
|
|
79
|
+
* `SearchOperation` it exposes as its own parameter (`namespacePrefix` is a
|
|
80
|
+
* separate positional argument instead), plus cancellation.
|
|
81
|
+
*/
|
|
82
|
+
export type SearchOptions = Pick<SearchOperation, 'filter' | 'limit' | 'offset' | 'query'> & CancelOptions;
|
|
83
|
+
/**
|
|
84
|
+
* Options {@link DynamoDBStore.listNamespaces} accepts: the object
|
|
85
|
+
* `BaseStore.listNamespaces` declares inline, with the same five optional
|
|
86
|
+
* fields, named so a caller can type the options it builds. A test pins it
|
|
87
|
+
* equal to upstream's parameter type.
|
|
88
|
+
*/
|
|
89
|
+
export interface ListNamespacesOptions {
|
|
90
|
+
/** Only namespaces starting with these labels; `'*'` matches any one label. */
|
|
91
|
+
prefix?: string[];
|
|
92
|
+
/** Only namespaces ending with these labels; `'*'` matches any one label. */
|
|
93
|
+
suffix?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* Truncate each namespace to at most this many labels, at least 1; the
|
|
96
|
+
* namespaces that truncation makes equal are listed once.
|
|
97
|
+
*/
|
|
98
|
+
maxDepth?: number;
|
|
99
|
+
/**
|
|
100
|
+
* How many namespaces to return, from 0 to 10,000;
|
|
101
|
+
* default 100. `0` returns an empty array without reading the table.
|
|
102
|
+
*/
|
|
103
|
+
limit?: number;
|
|
104
|
+
/** How many namespaces to skip first, a non-negative integer; default 0. */
|
|
105
|
+
offset?: number;
|
|
106
|
+
}
|
|
107
|
+
/** Counts returned by {@link DynamoDBStore.reconcileVectorIndex}. */
|
|
108
|
+
export interface VectorReconcileResult {
|
|
109
|
+
upserted: number;
|
|
110
|
+
pruned: number;
|
|
111
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|