@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.1 → 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 +1820 -290
- package/dist/cjs/backfill/backfill.d.ts +171 -0
- package/dist/cjs/backfill/backfill.js +177 -0
- package/dist/cjs/checkpointer/actions/delete-thread.d.ts +50 -0
- package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
- package/dist/cjs/checkpointer/actions/get-tuple.d.ts +36 -0
- package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
- package/dist/cjs/checkpointer/actions/list.d.ts +55 -0
- package/dist/cjs/checkpointer/actions/list.js +70 -0
- package/dist/cjs/checkpointer/actions/put-writes.d.ts +49 -0
- package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
- package/dist/cjs/checkpointer/actions/put.d.ts +95 -0
- package/dist/cjs/checkpointer/actions/put.js +79 -0
- package/dist/cjs/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
- package/dist/cjs/checkpointer/internal/listing.d.ts +149 -0
- package/dist/cjs/checkpointer/internal/listing.js +104 -0
- package/dist/cjs/checkpointer/internal/parse.d.ts +298 -0
- package/dist/cjs/checkpointer/internal/parse.js +184 -0
- package/dist/cjs/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
- package/dist/cjs/checkpointer/internal/read.d.ts +135 -0
- package/dist/cjs/checkpointer/internal/read.js +132 -0
- package/dist/cjs/checkpointer/internal/rows.d.ts +644 -0
- package/dist/cjs/checkpointer/internal/rows.js +356 -0
- package/dist/cjs/checkpointer/internal/setup.d.ts +47 -0
- package/dist/cjs/checkpointer/internal/setup.js +25 -0
- package/dist/cjs/checkpointer/saver.d.ts +306 -0
- package/dist/cjs/checkpointer/saver.js +56 -0
- package/dist/cjs/checkpointer/types.d.ts +51 -0
- package/dist/cjs/factory/factory.d.ts +154 -0
- package/dist/cjs/factory/factory.js +137 -0
- package/dist/{factory → cjs/factory}/types.d.ts +33 -14
- package/dist/cjs/history/actions/add-messages.d.ts +51 -0
- package/dist/cjs/history/actions/add-messages.js +17 -0
- package/dist/cjs/history/actions/clear.d.ts +52 -0
- package/dist/cjs/history/actions/clear.js +29 -0
- package/dist/cjs/history/actions/get-messages.d.ts +60 -0
- package/dist/cjs/history/actions/get-messages.js +58 -0
- package/dist/cjs/history/actions/list-sessions.d.ts +55 -0
- package/dist/cjs/history/actions/list-sessions.js +67 -0
- package/dist/cjs/history/actions/reconcile-count.d.ts +49 -0
- package/dist/cjs/history/actions/reconcile-count.js +8 -0
- package/dist/cjs/history/chat-message-history.d.ts +267 -0
- package/dist/cjs/history/chat-message-history.js +61 -0
- package/dist/cjs/history/internal/append.d.ts +244 -0
- package/dist/cjs/history/internal/append.js +267 -0
- package/dist/cjs/history/internal/message-read.d.ts +84 -0
- package/dist/cjs/history/internal/message-read.js +93 -0
- package/dist/cjs/history/internal/parse.d.ts +153 -0
- package/dist/cjs/history/internal/parse.js +113 -0
- package/dist/cjs/history/internal/rows.d.ts +196 -0
- package/dist/cjs/history/internal/rows.js +96 -0
- package/dist/cjs/history/internal/session.d.ts +350 -0
- package/dist/cjs/history/internal/session.js +296 -0
- package/dist/cjs/history/internal/setup.d.ts +64 -0
- package/dist/cjs/history/internal/setup.js +60 -0
- package/dist/cjs/history/session-adapter.d.ts +112 -0
- package/dist/cjs/history/session-adapter.js +38 -0
- package/dist/cjs/history/types.d.ts +102 -0
- package/dist/cjs/index.d.ts +53 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/shared/adapter.d.ts +146 -0
- package/dist/cjs/shared/adapter.js +70 -0
- package/dist/cjs/shared/clock.d.ts +52 -0
- package/dist/cjs/shared/clock.js +14 -0
- package/dist/cjs/shared/codec/codec.d.ts +336 -0
- package/dist/cjs/shared/codec/codec.js +162 -0
- package/dist/cjs/shared/codec/compression.d.ts +66 -0
- package/dist/cjs/shared/codec/compression.js +45 -0
- package/dist/cjs/shared/codec/json-serde.d.ts +80 -0
- package/dist/cjs/shared/codec/json-serde.js +58 -0
- package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +22 -2
- package/dist/{shared → cjs/shared}/codec/s3/client-types.js +0 -1
- package/dist/cjs/shared/codec/s3/client.d.ts +63 -0
- package/dist/cjs/shared/codec/s3/client.js +78 -0
- package/dist/cjs/shared/codec/s3/config.d.ts +260 -0
- package/dist/cjs/shared/codec/s3/config.js +92 -0
- package/dist/cjs/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
- package/dist/cjs/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/cjs/shared/codec/s3/offloader.js +289 -0
- package/dist/cjs/shared/concurrency.d.ts +43 -0
- package/dist/{shared → cjs/shared}/concurrency.js +10 -9
- package/dist/cjs/shared/dynamodb/abort.d.ts +47 -0
- package/dist/cjs/shared/dynamodb/abort.js +16 -0
- package/dist/cjs/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
- package/dist/cjs/shared/dynamodb/cancellation.d.ts +124 -0
- package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
- package/dist/cjs/shared/dynamodb/client.d.ts +177 -0
- package/dist/{shared → cjs/shared}/dynamodb/client.js +12 -14
- package/dist/cjs/shared/dynamodb/idempotent-write.d.ts +596 -0
- package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
- package/dist/cjs/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/cjs/shared/dynamodb/paginate.js +90 -0
- package/dist/cjs/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
- package/dist/cjs/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
- package/dist/cjs/shared/dynamodb/retry.d.ts +317 -0
- 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/cjs/shared/dynamodb/table-schema.d.ts +199 -0
- package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
- package/dist/cjs/shared/errors/base-error.d.ts +231 -0
- package/dist/cjs/shared/errors/base-error.js +73 -0
- package/dist/cjs/shared/errors/boundary.d.ts +86 -0
- 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/cjs/shared/errors/error-code.d.ts +95 -0
- package/dist/{shared → cjs/shared}/errors/error-code.js +12 -2
- package/dist/cjs/shared/errors/errors.d.ts +233 -0
- package/dist/cjs/shared/errors/errors.js +123 -0
- package/dist/cjs/shared/logging/logger.d.ts +80 -0
- package/dist/cjs/shared/logging/logger.js +30 -0
- package/dist/cjs/shared/logging/redaction.d.ts +123 -0
- package/dist/cjs/shared/logging/redaction.js +145 -0
- package/dist/cjs/shared/logging/secret-patterns.d.ts +227 -0
- package/dist/cjs/shared/logging/secret-patterns.js +93 -0
- package/dist/cjs/shared/logging/truncate.d.ts +197 -0
- package/dist/cjs/shared/logging/truncate.js +31 -0
- package/dist/cjs/shared/options.d.ts +100 -0
- package/dist/cjs/shared/ulid.d.ts +80 -0
- package/dist/{shared → cjs/shared}/ulid.js +7 -21
- package/dist/cjs/shared/validation/collaborators.d.ts +160 -0
- package/dist/cjs/shared/validation/collaborators.js +79 -0
- package/dist/cjs/shared/validation/option-shape.d.ts +91 -0
- package/dist/cjs/shared/validation/option-shape.js +31 -0
- package/dist/cjs/shared/validation/options.d.ts +145 -0
- package/dist/cjs/shared/validation/options.js +166 -0
- package/dist/cjs/shared/validation/primitives.d.ts +292 -0
- package/dist/cjs/shared/validation/primitives.js +114 -0
- package/dist/cjs/shared/validation/ttl.d.ts +94 -0
- package/dist/cjs/shared/validation/ttl.js +52 -0
- package/dist/cjs/store/actions/list-namespaces.d.ts +79 -0
- package/dist/cjs/store/actions/list-namespaces.js +92 -0
- package/dist/cjs/store/actions/put.d.ts +43 -0
- package/dist/cjs/store/actions/put.js +49 -0
- package/dist/cjs/store/actions/reconcile-vector-index.d.ts +38 -0
- package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
- package/dist/cjs/store/actions/search.d.ts +38 -0
- 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/cjs/store/internal/filter.d.ts +43 -0
- 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/cjs/store/internal/item-write.d.ts +270 -0
- package/dist/cjs/store/internal/item-write.js +181 -0
- package/dist/cjs/store/internal/parse.d.ts +230 -0
- package/dist/cjs/store/internal/parse.js +180 -0
- package/dist/cjs/store/internal/rows.d.ts +359 -0
- package/dist/cjs/store/internal/rows.js +166 -0
- package/dist/cjs/store/internal/semantic-search.d.ts +168 -0
- package/dist/{store/internal/text-path.js → cjs/store/internal/semantic-search.js} +92 -28
- package/dist/cjs/store/internal/setup.d.ts +96 -0
- package/dist/cjs/store/internal/setup.js +103 -0
- package/dist/cjs/store/internal/table-search.d.ts +100 -0
- package/dist/cjs/store/internal/table-search.js +123 -0
- package/dist/cjs/store/internal/vector-index.d.ts +258 -0
- package/dist/cjs/store/internal/vector-index.js +269 -0
- package/dist/cjs/store/store.d.ts +329 -0
- package/dist/cjs/store/store.js +97 -0
- package/dist/cjs/store/types.d.ts +111 -0
- package/dist/cjs/store/vector-backend.d.ts +104 -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/esm/checkpointer/actions/delete-thread.d.ts +50 -0
- package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
- package/dist/esm/checkpointer/actions/get-tuple.d.ts +36 -0
- 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/esm/checkpointer/actions/put-writes.d.ts +49 -0
- 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/esm/checkpointer/internal/listing.d.ts +149 -0
- 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/esm/checkpointer/saver.d.ts +306 -0
- 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/esm/history/actions/add-messages.d.ts +51 -0
- package/dist/esm/history/actions/add-messages.js +14 -0
- package/dist/esm/history/actions/clear.d.ts +52 -0
- 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/esm/history/actions/reconcile-count.d.ts +49 -0
- package/dist/esm/history/actions/reconcile-count.js +5 -0
- package/dist/esm/history/chat-message-history.d.ts +267 -0
- 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/esm/history/internal/rows.d.ts +196 -0
- 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/esm/history/session-adapter.d.ts +112 -0
- 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/esm/shared/clock.d.ts +52 -0
- 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/esm/shared/codec/s3/config.d.ts +260 -0
- 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/esm/shared/concurrency.d.ts +43 -0
- package/dist/esm/shared/concurrency.js +27 -0
- package/dist/esm/shared/dynamodb/abort.d.ts +47 -0
- 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/esm/shared/dynamodb/cancellation.d.ts +124 -0
- package/dist/esm/shared/dynamodb/cancellation.js +30 -0
- package/dist/esm/shared/dynamodb/client.d.ts +177 -0
- package/dist/esm/shared/dynamodb/client.js +35 -0
- package/dist/esm/shared/dynamodb/idempotent-write.d.ts +596 -0
- 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/esm/shared/dynamodb/table-schema.d.ts +199 -0
- 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/esm/shared/errors/error-code.d.ts +95 -0
- package/dist/esm/shared/errors/error-code.js +24 -0
- package/dist/esm/shared/errors/errors.d.ts +233 -0
- package/dist/esm/shared/errors/errors.js +110 -0
- package/dist/esm/shared/logging/logger.d.ts +80 -0
- 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/esm/shared/logging/secret-patterns.d.ts +227 -0
- package/dist/esm/shared/logging/secret-patterns.js +83 -0
- package/dist/esm/shared/logging/truncate.d.ts +197 -0
- 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/esm/shared/ulid.d.ts +80 -0
- package/dist/esm/shared/ulid.js +77 -0
- package/dist/esm/shared/validation/collaborators.d.ts +160 -0
- package/dist/esm/shared/validation/collaborators.js +70 -0
- package/dist/esm/shared/validation/option-shape.d.ts +91 -0
- 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/esm/shared/validation/primitives.d.ts +292 -0
- 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/esm/store/actions/reconcile-vector-index.d.ts +38 -0
- 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/esm/store/internal/rows.d.ts +359 -0
- 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/esm/store/store.d.ts +329 -0
- 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 +68 -46
- package/dist/checkpointer/actions/delete-thread.d.ts +0 -10
- package/dist/checkpointer/actions/delete-thread.js +0 -38
- package/dist/checkpointer/actions/get-tuple.d.ts +0 -11
- package/dist/checkpointer/actions/get-tuple.js +0 -25
- package/dist/checkpointer/actions/list.d.ts +0 -20
- package/dist/checkpointer/actions/list.js +0 -113
- package/dist/checkpointer/actions/put-writes.d.ts +0 -15
- package/dist/checkpointer/actions/put-writes.js +0 -62
- package/dist/checkpointer/actions/put.d.ts +0 -17
- package/dist/checkpointer/actions/put.js +0 -73
- package/dist/checkpointer/internal/assemble.d.ts +0 -17
- package/dist/checkpointer/internal/assemble.js +0 -38
- package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +0 -24
- package/dist/checkpointer/internal/checkpoint-write-verify.js +0 -67
- package/dist/checkpointer/internal/configurable.d.ts +0 -12
- package/dist/checkpointer/internal/configurable.js +0 -24
- package/dist/checkpointer/internal/fetch.d.ts +0 -19
- package/dist/checkpointer/internal/fetch.js +0 -88
- package/dist/checkpointer/internal/filter-match.d.ts +0 -13
- package/dist/checkpointer/internal/filter-match.js +0 -15
- package/dist/checkpointer/internal/item-reader.d.ts +0 -66
- package/dist/checkpointer/internal/item-reader.js +0 -113
- package/dist/checkpointer/internal/item-writer.d.ts +0 -35
- package/dist/checkpointer/internal/item-writer.js +0 -107
- package/dist/checkpointer/internal/keys.d.ts +0 -41
- package/dist/checkpointer/internal/keys.js +0 -117
- package/dist/checkpointer/internal/list-scope.d.ts +0 -61
- package/dist/checkpointer/internal/list-scope.js +0 -108
- package/dist/checkpointer/internal/pending-sends.d.ts +0 -13
- package/dist/checkpointer/internal/pending-sends.js +0 -29
- package/dist/checkpointer/internal/query.d.ts +0 -21
- package/dist/checkpointer/internal/query.js +0 -42
- package/dist/checkpointer/internal/regular-write.d.ts +0 -28
- package/dist/checkpointer/internal/regular-write.js +0 -66
- package/dist/checkpointer/internal/setup.d.ts +0 -33
- package/dist/checkpointer/internal/setup.js +0 -38
- package/dist/checkpointer/internal/special-write-cas.d.ts +0 -29
- package/dist/checkpointer/internal/special-write-cas.js +0 -104
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -23
- package/dist/checkpointer/internal/special-write-cleanup.js +0 -50
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -53
- package/dist/checkpointer/internal/special-write-verify.js +0 -80
- package/dist/checkpointer/internal/stored-channels.d.ts +0 -31
- package/dist/checkpointer/internal/stored-channels.js +0 -70
- package/dist/checkpointer/internal/validation.d.ts +0 -18
- package/dist/checkpointer/internal/validation.js +0 -40
- package/dist/checkpointer/internal/write-guard.d.ts +0 -20
- package/dist/checkpointer/internal/write-guard.js +0 -48
- package/dist/checkpointer/internal/write-index.d.ts +0 -36
- package/dist/checkpointer/internal/write-index.js +0 -41
- package/dist/checkpointer/saver.d.ts +0 -70
- package/dist/checkpointer/saver.js +0 -105
- package/dist/checkpointer/types.d.ts +0 -58
- package/dist/factory/factory.d.ts +0 -40
- package/dist/factory/factory.js +0 -87
- package/dist/history/actions/add-messages.d.ts +0 -15
- package/dist/history/actions/add-messages.js +0 -77
- package/dist/history/actions/clear.d.ts +0 -10
- package/dist/history/actions/clear.js +0 -34
- package/dist/history/actions/get-messages.d.ts +0 -17
- package/dist/history/actions/get-messages.js +0 -79
- package/dist/history/actions/list-sessions.d.ts +0 -13
- package/dist/history/actions/list-sessions.js +0 -53
- package/dist/history/actions/reconcile-count.d.ts +0 -12
- package/dist/history/actions/reconcile-count.js +0 -64
- package/dist/history/chat-message-history.d.ts +0 -73
- package/dist/history/chat-message-history.js +0 -111
- package/dist/history/internal/append-saga.d.ts +0 -25
- package/dist/history/internal/append-saga.js +0 -79
- package/dist/history/internal/compensation.d.ts +0 -25
- package/dist/history/internal/compensation.js +0 -92
- package/dist/history/internal/item-mapper.d.ts +0 -9
- package/dist/history/internal/item-mapper.js +0 -27
- package/dist/history/internal/keys.d.ts +0 -16
- package/dist/history/internal/keys.js +0 -48
- package/dist/history/internal/message-chunker.d.ts +0 -13
- package/dist/history/internal/message-chunker.js +0 -67
- package/dist/history/internal/message-transaction.d.ts +0 -25
- package/dist/history/internal/message-transaction.js +0 -61
- package/dist/history/internal/message-window.d.ts +0 -17
- package/dist/history/internal/message-window.js +0 -49
- package/dist/history/internal/query.d.ts +0 -23
- package/dist/history/internal/query.js +0 -39
- package/dist/history/internal/session-count.d.ts +0 -47
- package/dist/history/internal/session-count.js +0 -115
- package/dist/history/internal/session-title.d.ts +0 -19
- package/dist/history/internal/session-title.js +0 -43
- package/dist/history/internal/session-update.d.ts +0 -27
- package/dist/history/internal/session-update.js +0 -69
- package/dist/history/internal/setup.d.ts +0 -31
- package/dist/history/internal/setup.js +0 -43
- package/dist/history/internal/title-generator.d.ts +0 -12
- package/dist/history/internal/title-generator.js +0 -41
- package/dist/history/internal/ttl-anchor.d.ts +0 -24
- package/dist/history/internal/ttl-anchor.js +0 -38
- package/dist/history/internal/validation.d.ts +0 -25
- package/dist/history/internal/validation.js +0 -53
- package/dist/history/session-adapter.d.ts +0 -29
- package/dist/history/session-adapter.js +0 -35
- package/dist/history/types.d.ts +0 -69
- package/dist/index.d.ts +0 -29
- package/dist/index.js +0 -32
- package/dist/shared/clock.d.ts +0 -8
- package/dist/shared/clock.js +0 -16
- package/dist/shared/codec/codec.d.ts +0 -53
- package/dist/shared/codec/codec.js +0 -66
- package/dist/shared/codec/compression.d.ts +0 -24
- package/dist/shared/codec/compression.js +0 -48
- package/dist/shared/codec/descriptor-keys.d.ts +0 -12
- package/dist/shared/codec/descriptor-keys.js +0 -14
- package/dist/shared/codec/encode.d.ts +0 -13
- package/dist/shared/codec/encode.js +0 -43
- package/dist/shared/codec/json-serde.d.ts +0 -7
- package/dist/shared/codec/json-serde.js +0 -17
- package/dist/shared/codec/payload-loss.d.ts +0 -12
- package/dist/shared/codec/payload-loss.js +0 -38
- package/dist/shared/codec/s3/adapter-config.d.ts +0 -13
- package/dist/shared/codec/s3/adapter-config.js +0 -22
- package/dist/shared/codec/s3/bounded-body.d.ts +0 -14
- package/dist/shared/codec/s3/bounded-body.js +0 -47
- package/dist/shared/codec/s3/client.d.ts +0 -18
- package/dist/shared/codec/s3/client.js +0 -46
- package/dist/shared/codec/s3/config.d.ts +0 -51
- package/dist/shared/codec/s3/config.js +0 -58
- package/dist/shared/codec/s3/delete.d.ts +0 -7
- package/dist/shared/codec/s3/delete.js +0 -28
- package/dist/shared/codec/s3/key-scope.d.ts +0 -23
- package/dist/shared/codec/s3/key-scope.js +0 -44
- package/dist/shared/codec/s3/lifecycle.d.ts +0 -14
- package/dist/shared/codec/s3/lifecycle.js +0 -63
- package/dist/shared/codec/s3/offloader.d.ts +0 -44
- package/dist/shared/codec/s3/offloader.js +0 -118
- package/dist/shared/codec/s3/orphans.d.ts +0 -23
- package/dist/shared/codec/s3/orphans.js +0 -71
- package/dist/shared/codec/s3/read-write.d.ts +0 -18
- package/dist/shared/codec/s3/read-write.js +0 -51
- package/dist/shared/codec/s3/retry.d.ts +0 -5
- package/dist/shared/codec/s3/retry.js +0 -22
- package/dist/shared/concurrency.d.ts +0 -6
- package/dist/shared/constants.d.ts +0 -112
- package/dist/shared/constants.js +0 -115
- package/dist/shared/dynamodb/abort.d.ts +0 -9
- package/dist/shared/dynamodb/abort.js +0 -27
- package/dist/shared/dynamodb/backoff.d.ts +0 -15
- package/dist/shared/dynamodb/backoff.js +0 -48
- package/dist/shared/dynamodb/batch-write.d.ts +0 -22
- package/dist/shared/dynamodb/batch-write.js +0 -53
- package/dist/shared/dynamodb/cancellation.d.ts +0 -6
- package/dist/shared/dynamodb/cancellation.js +0 -7
- package/dist/shared/dynamodb/client.d.ts +0 -28
- package/dist/shared/dynamodb/conditional-put.d.ts +0 -67
- package/dist/shared/dynamodb/conditional-put.js +0 -76
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -21
- package/dist/shared/dynamodb/drain-unprocessed.js +0 -43
- package/dist/shared/dynamodb/expiry.d.ts +0 -16
- package/dist/shared/dynamodb/expiry.js +0 -29
- package/dist/shared/dynamodb/paginate-core.d.ts +0 -24
- package/dist/shared/dynamodb/paginate-core.js +0 -82
- package/dist/shared/dynamodb/paginate.d.ts +0 -14
- package/dist/shared/dynamodb/paginate.js +0 -19
- package/dist/shared/dynamodb/partition-delete.d.ts +0 -39
- package/dist/shared/dynamodb/partition-delete.js +0 -71
- package/dist/shared/dynamodb/retry-classifier.d.ts +0 -17
- package/dist/shared/dynamodb/retry-classifier.js +0 -118
- package/dist/shared/dynamodb/retry-policy.d.ts +0 -26
- package/dist/shared/dynamodb/retry-policy.js +0 -22
- package/dist/shared/dynamodb/retry.d.ts +0 -31
- package/dist/shared/dynamodb/retry.js +0 -57
- package/dist/shared/dynamodb/scan.d.ts +0 -14
- package/dist/shared/dynamodb/scan.js +0 -19
- package/dist/shared/dynamodb/types.d.ts +0 -23
- package/dist/shared/errors/base-error.d.ts +0 -30
- package/dist/shared/errors/base-error.js +0 -27
- package/dist/shared/errors/boundary.d.ts +0 -18
- package/dist/shared/errors/boundary.js +0 -46
- package/dist/shared/errors/error-code.d.ts +0 -13
- package/dist/shared/errors/errors.d.ts +0 -68
- package/dist/shared/errors/errors.js +0 -114
- package/dist/shared/errors/upstream-error.d.ts +0 -16
- package/dist/shared/errors/upstream-error.js +0 -27
- package/dist/shared/errors/wrap-error.d.ts +0 -7
- package/dist/shared/errors/wrap-error.js +0 -15
- package/dist/shared/logging/logger.d.ts +0 -18
- package/dist/shared/logging/logger.js +0 -15
- package/dist/shared/logging/redaction-walk.d.ts +0 -23
- package/dist/shared/logging/redaction-walk.js +0 -112
- package/dist/shared/logging/redaction.d.ts +0 -39
- package/dist/shared/logging/redaction.js +0 -75
- package/dist/shared/logging/secret-patterns.d.ts +0 -92
- package/dist/shared/logging/secret-patterns.js +0 -133
- package/dist/shared/options.d.ts +0 -37
- package/dist/shared/ulid.d.ts +0 -23
- package/dist/shared/validation/options.d.ts +0 -8
- package/dist/shared/validation/options.js +0 -90
- package/dist/shared/validation/primitives.d.ts +0 -29
- package/dist/shared/validation/primitives.js +0 -82
- package/dist/shared/validation/ttl.d.ts +0 -28
- package/dist/shared/validation/ttl.js +0 -52
- package/dist/store/actions/get.d.ts +0 -13
- package/dist/store/actions/get.js +0 -73
- package/dist/store/actions/list-namespaces.d.ts +0 -8
- package/dist/store/actions/list-namespaces.js +0 -59
- package/dist/store/actions/put.d.ts +0 -10
- package/dist/store/actions/put.js +0 -96
- package/dist/store/actions/reconcile-vector-index.d.ts +0 -18
- package/dist/store/actions/reconcile-vector-index.js +0 -26
- package/dist/store/actions/search.d.ts +0 -9
- package/dist/store/actions/search.js +0 -34
- package/dist/store/internal/backend-search.d.ts +0 -4
- package/dist/store/internal/backend-search.js +0 -74
- package/dist/store/internal/batch-plan.d.ts +0 -11
- package/dist/store/internal/batch-plan.js +0 -52
- package/dist/store/internal/candidates.d.ts +0 -23
- package/dist/store/internal/candidates.js +0 -94
- package/dist/store/internal/filter.d.ts +0 -9
- package/dist/store/internal/filter.js +0 -85
- package/dist/store/internal/index-reconcile.d.ts +0 -21
- package/dist/store/internal/index-reconcile.js +0 -118
- package/dist/store/internal/index-sync.d.ts +0 -10
- package/dist/store/internal/index-sync.js +0 -25
- package/dist/store/internal/item-mapper.d.ts +0 -27
- package/dist/store/internal/item-mapper.js +0 -61
- package/dist/store/internal/keys.d.ts +0 -17
- package/dist/store/internal/keys.js +0 -41
- package/dist/store/internal/namespace-match.d.ts +0 -11
- package/dist/store/internal/namespace-match.js +0 -40
- package/dist/store/internal/option-validation.d.ts +0 -13
- package/dist/store/internal/option-validation.js +0 -77
- package/dist/store/internal/overwrite-swap.d.ts +0 -32
- package/dist/store/internal/overwrite-swap.js +0 -68
- package/dist/store/internal/persist.d.ts +0 -28
- package/dist/store/internal/persist.js +0 -64
- package/dist/store/internal/query.d.ts +0 -11
- package/dist/store/internal/query.js +0 -48
- package/dist/store/internal/ranker.d.ts +0 -18
- package/dist/store/internal/ranker.js +0 -39
- package/dist/store/internal/read-existing.d.ts +0 -23
- package/dist/store/internal/read-existing.js +0 -41
- package/dist/store/internal/score-direction.d.ts +0 -31
- package/dist/store/internal/score-direction.js +0 -38
- package/dist/store/internal/search-filter.d.ts +0 -3
- package/dist/store/internal/search-filter.js +0 -10
- package/dist/store/internal/semantic-search.d.ts +0 -34
- package/dist/store/internal/semantic-search.js +0 -87
- package/dist/store/internal/setup.d.ts +0 -36
- package/dist/store/internal/setup.js +0 -40
- package/dist/store/internal/text-path.d.ts +0 -17
- package/dist/store/internal/validation.d.ts +0 -18
- package/dist/store/internal/validation.js +0 -51
- package/dist/store/internal/write-verify.d.ts +0 -42
- package/dist/store/internal/write-verify.js +0 -71
- package/dist/store/store.d.ts +0 -61
- package/dist/store/store.js +0 -107
- package/dist/store/types.d.ts +0 -50
- package/dist/store/types.js +0 -2
- package/dist/store/vector-backend.d.ts +0 -43
- package/dist/store/vector-backend.js +0 -2
- /package/dist/{checkpointer → cjs/checkpointer}/types.js +0 -0
- /package/dist/{factory → cjs/factory}/types.js +0 -0
- /package/dist/{history → cjs/history}/types.js +0 -0
- /package/dist/{shared → cjs/shared}/options.js +0 -0
- /package/dist/{shared/dynamodb → cjs/store}/types.js +0 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { WRITES_IDX_MAP } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import { nowIso } from '../../shared/clock.js';
|
|
3
|
+
import { codecDepsOf, collectS3Keys, decodePayload, encodePayload, } from '../../shared/codec/codec.js';
|
|
4
|
+
import { cleanUpS3Orphans } from '../../shared/codec/s3/offloader.js';
|
|
5
|
+
import { DEFAULT_READ_CONCURRENCY, mapWithConcurrency } from '../../shared/concurrency.js';
|
|
6
|
+
import { namedDescriptor } from '../../shared/dynamodb/partition-delete.js';
|
|
7
|
+
import { BACKFILLED_AT, DEFAULT_INDEX_SHARDS, indexKeys, } from '../../shared/dynamodb/recency-index.js';
|
|
8
|
+
import { ADAPTER_TAGS, assertReadableRow, KEY_SEPARATOR, PARTITION_KEY_ATTRIBUTE, ROW_FORMAT_VERSION, SORT_KEY_ATTRIBUTE, } from '../../shared/dynamodb/table-schema.js';
|
|
9
|
+
import { validationError } from '../../shared/errors/errors.js';
|
|
10
|
+
import { truncateForLog } from '../../shared/logging/truncate.js';
|
|
11
|
+
import { createUlidFactory } from '../../shared/ulid.js';
|
|
12
|
+
export const WRITE_GROUP_ATTRIBUTE = 'writeGroup';
|
|
13
|
+
const WRITE_INDEX_PAD_WIDTH = 10;
|
|
14
|
+
const WRITE_INDEX_OFFSET = 8;
|
|
15
|
+
export const MIN_ENCODABLE_WRITE_INDEX = -WRITE_INDEX_OFFSET;
|
|
16
|
+
var CheckpointRowKind;
|
|
17
|
+
(function (CheckpointRowKind) {
|
|
18
|
+
CheckpointRowKind["META"] = "META";
|
|
19
|
+
CheckpointRowKind["PAYLOAD"] = "PAYLOAD";
|
|
20
|
+
CheckpointRowKind["WRITE"] = "WRITE";
|
|
21
|
+
})(CheckpointRowKind || (CheckpointRowKind = {}));
|
|
22
|
+
const ADAPTER_PARTITION_PREFIX = `${ADAPTER_TAGS.checkpointer}${KEY_SEPARATOR}`;
|
|
23
|
+
export function checkpointerPartitionPrefix() {
|
|
24
|
+
return ADAPTER_PARTITION_PREFIX;
|
|
25
|
+
}
|
|
26
|
+
export function partitionKey(threadId) {
|
|
27
|
+
return `${ADAPTER_PARTITION_PREFIX}${threadId}`;
|
|
28
|
+
}
|
|
29
|
+
export function metaSortKey(checkpointNs, checkpointId) {
|
|
30
|
+
return `${CheckpointRowKind.META}${KEY_SEPARATOR}${checkpointNs}${KEY_SEPARATOR}${checkpointId}`;
|
|
31
|
+
}
|
|
32
|
+
export function metaSortKeyPrefix(checkpointNs) {
|
|
33
|
+
return `${CheckpointRowKind.META}${KEY_SEPARATOR}${checkpointNs}${KEY_SEPARATOR}`;
|
|
34
|
+
}
|
|
35
|
+
export function metaAnyNamespacePrefix() {
|
|
36
|
+
return `${CheckpointRowKind.META}${KEY_SEPARATOR}`;
|
|
37
|
+
}
|
|
38
|
+
export function payloadSortKey(checkpointNs, checkpointId) {
|
|
39
|
+
return `${CheckpointRowKind.PAYLOAD}${KEY_SEPARATOR}${checkpointNs}${KEY_SEPARATOR}${checkpointId}`;
|
|
40
|
+
}
|
|
41
|
+
export function writeSortKey(at) {
|
|
42
|
+
const offsetIndex = at.index + WRITE_INDEX_OFFSET;
|
|
43
|
+
if (!Number.isInteger(offsetIndex) ||
|
|
44
|
+
offsetIndex < 0 ||
|
|
45
|
+
offsetIndex.toString().length > WRITE_INDEX_PAD_WIDTH) {
|
|
46
|
+
throw validationError(`write index ${at.index} is not an integer encodable at offset ${WRITE_INDEX_OFFSET} ` +
|
|
47
|
+
`with ${WRITE_INDEX_PAD_WIDTH} digits`, 'index');
|
|
48
|
+
}
|
|
49
|
+
const paddedIndex = offsetIndex.toString().padStart(WRITE_INDEX_PAD_WIDTH, '0');
|
|
50
|
+
return [
|
|
51
|
+
CheckpointRowKind.WRITE,
|
|
52
|
+
at.checkpointNs,
|
|
53
|
+
at.checkpointId,
|
|
54
|
+
at.taskId,
|
|
55
|
+
paddedIndex,
|
|
56
|
+
at.channel,
|
|
57
|
+
].join(KEY_SEPARATOR);
|
|
58
|
+
}
|
|
59
|
+
export function writeSortKeyBytes(at) {
|
|
60
|
+
return Buffer.byteLength(writeSortKey({ ...at, index: 0 }), 'utf8');
|
|
61
|
+
}
|
|
62
|
+
export function isCheckpointerSortKey(sortKey) {
|
|
63
|
+
return Object.values(CheckpointRowKind).some((kind) => sortKey.startsWith(`${kind}${KEY_SEPARATOR}`));
|
|
64
|
+
}
|
|
65
|
+
export function writeSortKeyPrefix(checkpointNs, checkpointId) {
|
|
66
|
+
return `${CheckpointRowKind.WRITE}${KEY_SEPARATOR}${checkpointNs}${KEY_SEPARATOR}${checkpointId}${KEY_SEPARATOR}`;
|
|
67
|
+
}
|
|
68
|
+
export function metaRowKey(at) {
|
|
69
|
+
return { PK: partitionKey(at.threadId), SK: metaSortKey(at.checkpointNs, at.checkpointId) };
|
|
70
|
+
}
|
|
71
|
+
export function payloadRowKey(at) {
|
|
72
|
+
return { PK: partitionKey(at.threadId), SK: payloadSortKey(at.checkpointNs, at.checkpointId) };
|
|
73
|
+
}
|
|
74
|
+
export function partitionQuery(tableName, partition, options = {}) {
|
|
75
|
+
const params = {
|
|
76
|
+
TableName: tableName,
|
|
77
|
+
KeyConditionExpression: '#pk = :pk',
|
|
78
|
+
ExpressionAttributeNames: { '#pk': PARTITION_KEY_ATTRIBUTE },
|
|
79
|
+
ExpressionAttributeValues: { ':pk': partition },
|
|
80
|
+
};
|
|
81
|
+
if (options.consistent)
|
|
82
|
+
params.ConsistentRead = true;
|
|
83
|
+
return params;
|
|
84
|
+
}
|
|
85
|
+
export function beginsWithQuery(tableName, partition, skPrefix, options = {}) {
|
|
86
|
+
const bounded = options.beforeSortKey !== undefined;
|
|
87
|
+
const params = {
|
|
88
|
+
TableName: tableName,
|
|
89
|
+
KeyConditionExpression: bounded
|
|
90
|
+
? '#pk = :pk AND #sk BETWEEN :skPrefix AND :before'
|
|
91
|
+
: '#pk = :pk AND begins_with(#sk, :skPrefix)',
|
|
92
|
+
ExpressionAttributeNames: { '#pk': PARTITION_KEY_ATTRIBUTE, '#sk': SORT_KEY_ATTRIBUTE },
|
|
93
|
+
ExpressionAttributeValues: {
|
|
94
|
+
':pk': partition,
|
|
95
|
+
':skPrefix': skPrefix,
|
|
96
|
+
...(bounded ? { ':before': options.beforeSortKey } : {}),
|
|
97
|
+
},
|
|
98
|
+
ScanIndexForward: options.ascending ?? false,
|
|
99
|
+
};
|
|
100
|
+
if (options.limit !== undefined && options.limit >= 1)
|
|
101
|
+
params.Limit = options.limit;
|
|
102
|
+
if (options.consistent)
|
|
103
|
+
params.ConsistentRead = true;
|
|
104
|
+
return params;
|
|
105
|
+
}
|
|
106
|
+
function withTtl(item, ttlTimestamp) {
|
|
107
|
+
if (ttlTimestamp !== undefined)
|
|
108
|
+
item.ttl = ttlTimestamp;
|
|
109
|
+
return item;
|
|
110
|
+
}
|
|
111
|
+
async function releaseUploads(context, uploaded, operation) {
|
|
112
|
+
if (!context.offloader)
|
|
113
|
+
return;
|
|
114
|
+
await cleanUpS3Orphans(context.offloader, {
|
|
115
|
+
keys: collectS3Keys(uploaded),
|
|
116
|
+
operation,
|
|
117
|
+
logger: context.logger,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const nextPutObjectId = createUlidFactory();
|
|
121
|
+
export async function buildCheckpointRows(context, request, ttlTimestamp) {
|
|
122
|
+
const { threadId, checkpointNs, checkpointId } = request.address;
|
|
123
|
+
const deps = codecDepsOf(context, request.signal);
|
|
124
|
+
const pk = partitionKey(threadId);
|
|
125
|
+
const objectId = nextPutObjectId();
|
|
126
|
+
const checkpointDescriptor = await encodePayload(request.checkpoint, deps, {
|
|
127
|
+
keyParts: [threadId, checkpointNs, checkpointId, 'checkpoint'],
|
|
128
|
+
objectId,
|
|
129
|
+
row: { pk, sk: payloadSortKey(checkpointNs, checkpointId) },
|
|
130
|
+
});
|
|
131
|
+
let metadataDescriptor;
|
|
132
|
+
try {
|
|
133
|
+
metadataDescriptor = await encodePayload(request.metadata, deps, {
|
|
134
|
+
keyParts: [threadId, checkpointNs, checkpointId, 'metadata'],
|
|
135
|
+
objectId,
|
|
136
|
+
row: { pk, sk: metaSortKey(checkpointNs, checkpointId) },
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
await releaseUploads(context, [checkpointDescriptor], 'put.encode');
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
const index = indexKeys('CHKPT', checkpointId, nowIso(), context.indexShards ?? DEFAULT_INDEX_SHARDS);
|
|
144
|
+
const meta = {
|
|
145
|
+
PK: pk,
|
|
146
|
+
SK: metaSortKey(checkpointNs, checkpointId),
|
|
147
|
+
v: ROW_FORMAT_VERSION,
|
|
148
|
+
...index,
|
|
149
|
+
threadId,
|
|
150
|
+
checkpointNs,
|
|
151
|
+
checkpointId,
|
|
152
|
+
metadata: metadataDescriptor,
|
|
153
|
+
};
|
|
154
|
+
if (request.parentCheckpointId !== undefined)
|
|
155
|
+
meta.parentCheckpointId = request.parentCheckpointId;
|
|
156
|
+
const payload = {
|
|
157
|
+
PK: pk,
|
|
158
|
+
SK: payloadSortKey(checkpointNs, checkpointId),
|
|
159
|
+
v: ROW_FORMAT_VERSION,
|
|
160
|
+
checkpoint: checkpointDescriptor,
|
|
161
|
+
};
|
|
162
|
+
return { meta: withTtl(meta, ttlTimestamp), payload: withTtl(payload, ttlTimestamp) };
|
|
163
|
+
}
|
|
164
|
+
export async function buildWriteRows(context, request, writeGroup, ttlTimestamp) {
|
|
165
|
+
const { threadId, checkpointNs, checkpointId } = request.address;
|
|
166
|
+
const { taskId, taskPath } = request;
|
|
167
|
+
const deps = codecDepsOf(context, request.signal);
|
|
168
|
+
const pk = partitionKey(threadId);
|
|
169
|
+
const items = [];
|
|
170
|
+
try {
|
|
171
|
+
for (const { channel, value, index, occurrence } of resolveWriteIndices(request.writes)) {
|
|
172
|
+
const sk = writeSortKey({ checkpointNs, checkpointId, taskId, index, channel });
|
|
173
|
+
const descriptor = await encodePayload(value, deps, {
|
|
174
|
+
keyParts: [threadId, checkpointNs, checkpointId, taskId, `write-${index}`, channel],
|
|
175
|
+
objectId: writeGroup,
|
|
176
|
+
row: { pk, sk },
|
|
177
|
+
});
|
|
178
|
+
const item = {
|
|
179
|
+
PK: pk,
|
|
180
|
+
SK: sk,
|
|
181
|
+
v: ROW_FORMAT_VERSION,
|
|
182
|
+
taskId,
|
|
183
|
+
index,
|
|
184
|
+
channel,
|
|
185
|
+
...(taskPath === undefined ? {} : { taskPath }),
|
|
186
|
+
writeGroup,
|
|
187
|
+
occurrence,
|
|
188
|
+
value: descriptor,
|
|
189
|
+
};
|
|
190
|
+
items.push(withTtl(item, ttlTimestamp));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
await releaseUploads(context, items.map((item) => item.value), 'putWrites.encode');
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
return items;
|
|
198
|
+
}
|
|
199
|
+
export function parseMetaRow(raw) {
|
|
200
|
+
assertReadableRow(raw, 'checkpoint');
|
|
201
|
+
const isCheckpoint = typeof raw.threadId === 'string' &&
|
|
202
|
+
typeof raw.checkpointId === 'string' &&
|
|
203
|
+
typeof raw.checkpointNs === 'string' &&
|
|
204
|
+
typeof raw.metadata === 'object' &&
|
|
205
|
+
raw.metadata !== null;
|
|
206
|
+
if (!isCheckpoint)
|
|
207
|
+
return undefined;
|
|
208
|
+
const item = raw;
|
|
209
|
+
const consistent = item.PK === partitionKey(item.threadId) &&
|
|
210
|
+
item.SK === metaSortKey(item.checkpointNs, item.checkpointId);
|
|
211
|
+
return consistent ? item : undefined;
|
|
212
|
+
}
|
|
213
|
+
export function parseWriteRow(raw) {
|
|
214
|
+
assertReadableRow(raw, 'pending write');
|
|
215
|
+
const isWrite = typeof raw.taskId === 'string' &&
|
|
216
|
+
typeof raw.channel === 'string' &&
|
|
217
|
+
(raw.taskPath === undefined || typeof raw.taskPath === 'string') &&
|
|
218
|
+
typeof raw.value === 'object' &&
|
|
219
|
+
raw.value !== null;
|
|
220
|
+
return isWrite ? raw : undefined;
|
|
221
|
+
}
|
|
222
|
+
export function parseHeadRow(context, raw, reader) {
|
|
223
|
+
if (raw === undefined)
|
|
224
|
+
return undefined;
|
|
225
|
+
const meta = parseMetaRow(raw);
|
|
226
|
+
if (!meta) {
|
|
227
|
+
context.logger.warn(`${reader}: skipped a row that is not a checkpoint meta item`, {
|
|
228
|
+
sortKey: truncateForLog(raw.SK),
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return meta;
|
|
232
|
+
}
|
|
233
|
+
export async function readCheckpoint(context, item, threadId, signal) {
|
|
234
|
+
return decodePayload(item.checkpoint, codecDepsOf(context, signal), [threadId]);
|
|
235
|
+
}
|
|
236
|
+
export async function readMetadata(context, item, threadId, signal) {
|
|
237
|
+
return decodePayload(item.metadata, codecDepsOf(context, signal), [threadId]);
|
|
238
|
+
}
|
|
239
|
+
export function compareByCodePoint(a, b) {
|
|
240
|
+
let i = 0;
|
|
241
|
+
let j = 0;
|
|
242
|
+
while (i < a.length && j < b.length) {
|
|
243
|
+
const left = a.codePointAt(i);
|
|
244
|
+
const right = b.codePointAt(j);
|
|
245
|
+
if (left !== right)
|
|
246
|
+
return left < right ? -1 : 1;
|
|
247
|
+
i += left > 0xffff ? 2 : 1;
|
|
248
|
+
j += right > 0xffff ? 2 : 1;
|
|
249
|
+
}
|
|
250
|
+
if (i >= a.length && j >= b.length)
|
|
251
|
+
return 0;
|
|
252
|
+
return i >= a.length ? -1 : 1;
|
|
253
|
+
}
|
|
254
|
+
export function compareWriteOrder(a, b) {
|
|
255
|
+
return (compareByCodePoint(a.taskPath ?? '', b.taskPath ?? '') ||
|
|
256
|
+
compareByCodePoint(a.taskId, b.taskId) ||
|
|
257
|
+
a.index - b.index ||
|
|
258
|
+
compareByCodePoint(a.channel, b.channel));
|
|
259
|
+
}
|
|
260
|
+
export async function toPendingWrites(context, items, threadId, signal) {
|
|
261
|
+
const deps = codecDepsOf(context, signal);
|
|
262
|
+
const live = [...dropSupersededWrites(items)].sort(compareWriteOrder);
|
|
263
|
+
const values = await mapWithConcurrency(live, context.readConcurrency ?? DEFAULT_READ_CONCURRENCY, (item) => decodePayload(item.value, deps, [threadId]));
|
|
264
|
+
return live.map((item, index) => [
|
|
265
|
+
item.taskId,
|
|
266
|
+
item.channel,
|
|
267
|
+
values[index],
|
|
268
|
+
]);
|
|
269
|
+
}
|
|
270
|
+
export function resolveWriteIndices(writes) {
|
|
271
|
+
const bySpecialIndex = new Map();
|
|
272
|
+
const regular = [];
|
|
273
|
+
const occurrences = new Map();
|
|
274
|
+
writes.forEach(([channel, value], positional) => {
|
|
275
|
+
if (Object.hasOwn(WRITES_IDX_MAP, channel)) {
|
|
276
|
+
const index = WRITES_IDX_MAP[channel];
|
|
277
|
+
bySpecialIndex.set(index, { channel, value, index, occurrence: 0 });
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const occurrence = occurrences.get(channel) ?? 0;
|
|
281
|
+
occurrences.set(channel, occurrence + 1);
|
|
282
|
+
regular.push({ channel, value, index: positional, occurrence });
|
|
283
|
+
});
|
|
284
|
+
return [...bySpecialIndex.values(), ...regular];
|
|
285
|
+
}
|
|
286
|
+
export function dropSupersededWrites(items) {
|
|
287
|
+
const identity = (item) => JSON.stringify([item.taskId, item.channel, item.occurrence ?? 0]);
|
|
288
|
+
const groupOf = (item) => item.writeGroup ?? '';
|
|
289
|
+
const earliestGroup = new Map();
|
|
290
|
+
for (const item of items) {
|
|
291
|
+
const id = identity(item);
|
|
292
|
+
const seen = earliestGroup.get(id);
|
|
293
|
+
const group = groupOf(item);
|
|
294
|
+
if (seen === undefined || group < seen)
|
|
295
|
+
earliestGroup.set(id, group);
|
|
296
|
+
}
|
|
297
|
+
return items.filter((item) => earliestGroup.get(identity(item)) === groupOf(item));
|
|
298
|
+
}
|
|
299
|
+
const PAYLOAD_ATTRIBUTES = ['metadata', 'checkpoint', 'value'];
|
|
300
|
+
export function checkpointRowDescriptors(row) {
|
|
301
|
+
const named = [];
|
|
302
|
+
for (const attribute of PAYLOAD_ATTRIBUTES) {
|
|
303
|
+
const entry = namedDescriptor(row, attribute);
|
|
304
|
+
if (entry !== undefined)
|
|
305
|
+
named.push(entry);
|
|
306
|
+
}
|
|
307
|
+
return named;
|
|
308
|
+
}
|
|
309
|
+
export function checkpointRowUnit(row) {
|
|
310
|
+
return row.SK.split(KEY_SEPARATOR).slice(1, 3).join(KEY_SEPARATOR);
|
|
311
|
+
}
|
|
312
|
+
export function checkpointRowKind(row) {
|
|
313
|
+
return row.SK.split(KEY_SEPARATOR)[0];
|
|
314
|
+
}
|
|
315
|
+
export function checkpointIndexTarget(row) {
|
|
316
|
+
const pk = typeof row.PK === 'string' ? row.PK : '';
|
|
317
|
+
const sk = typeof row.SK === 'string' ? row.SK : '';
|
|
318
|
+
if (!pk.startsWith(ADAPTER_PARTITION_PREFIX))
|
|
319
|
+
return undefined;
|
|
320
|
+
return sk.startsWith(metaAnyNamespacePrefix()) && typeof row.checkpointId === 'string'
|
|
321
|
+
? { tag: 'CHKPT', id: row.checkpointId, at: BACKFILLED_AT }
|
|
322
|
+
: undefined;
|
|
323
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides which options the saver accepts, and how the saver is assembled from
|
|
3
|
+
* them.
|
|
4
|
+
*
|
|
5
|
+
* The exhaustive key list of the constructor's options lives here,
|
|
6
|
+
* compiler-checked against its type, beside the code that resolves those
|
|
7
|
+
* options into the context every action receives. `list`'s and
|
|
8
|
+
* `getDeltaChannelHistory`'s options have no list: LangGraph defines them, so
|
|
9
|
+
* a key it adds is ignored rather than refused (decision record 28).
|
|
10
|
+
*/
|
|
11
|
+
import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
12
|
+
import { type AdapterCore, type AdapterShell } from '../../shared/adapter.js';
|
|
13
|
+
import type { DynamoDBSaverOptions } from '../types.js';
|
|
14
|
+
/**
|
|
15
|
+
* The keys of the saver's constructor options, exhaustive in both directions:
|
|
16
|
+
* `allKeysOf<T>` makes omitting or inventing one a compile error, so the list
|
|
17
|
+
* cannot rot away from the type it guards. It lives with the feature because
|
|
18
|
+
* the type it is checked against does; `shared/` knows no feature.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SAVER_KEYS: readonly string[];
|
|
21
|
+
/** Resolved collaborators shared by every checkpointer action. */
|
|
22
|
+
export interface CheckpointerContext extends AdapterCore {
|
|
23
|
+
serde: SerializerProtocol;
|
|
24
|
+
}
|
|
25
|
+
/** Result of wiring up a checkpointer from its options. */
|
|
26
|
+
export interface CheckpointerSetup {
|
|
27
|
+
context: CheckpointerContext;
|
|
28
|
+
shell: AdapterShell;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check the options, then resolve the client, offloader and serializer.
|
|
32
|
+
*
|
|
33
|
+
* Accepts: `options` — already held to the saver's key list by its constructor,
|
|
34
|
+
* which must read `serde` before anything else runs; checked here before
|
|
35
|
+
* anything is built, so no half-built saver exists when one is wrong. `serde` —
|
|
36
|
+
* the serializer the base class resolved, which is the caller's own serializer
|
|
37
|
+
* when they gave one.
|
|
38
|
+
*
|
|
39
|
+
* Returns: the context every action receives, and the shell that releases what
|
|
40
|
+
* it holds — a client the caller passed in is never destroyed by `destroy()`.
|
|
41
|
+
*
|
|
42
|
+
* Throws: `VALIDATION` for an option or collaborator that fails a check,
|
|
43
|
+
* naming the offending option.
|
|
44
|
+
*
|
|
45
|
+
* Guarantees: constructing a saver performs no I/O.
|
|
46
|
+
*/
|
|
47
|
+
export declare function setUpCheckpointer(options: DynamoDBSaverOptions, serde: SerializerProtocol): CheckpointerSetup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { openAdapter } from '../../shared/adapter.js';
|
|
2
|
+
import { allKeysOf } from '../../shared/validation/option-shape.js';
|
|
3
|
+
export const SAVER_KEYS = allKeysOf({
|
|
4
|
+
tableName: 'tableName',
|
|
5
|
+
client: 'client',
|
|
6
|
+
clientConfig: 'clientConfig',
|
|
7
|
+
createClient: 'createClient',
|
|
8
|
+
ttl: 'ttl',
|
|
9
|
+
logger: 'logger',
|
|
10
|
+
retry: 'retry',
|
|
11
|
+
indexShards: 'indexShards',
|
|
12
|
+
indexName: 'indexName',
|
|
13
|
+
readConcurrency: 'readConcurrency',
|
|
14
|
+
compression: 'compression',
|
|
15
|
+
s3: 's3',
|
|
16
|
+
serde: 'serde',
|
|
17
|
+
});
|
|
18
|
+
export function setUpCheckpointer(options, serde) {
|
|
19
|
+
const shell = openAdapter(options, 'checkpointer');
|
|
20
|
+
return { shell, context: { ...shell.core, serde } };
|
|
21
|
+
}
|