@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
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { CheckpointMetaItem, CheckpointPayloadItem } from '../types';
|
|
2
|
-
import type { CheckpointerContext } from './setup';
|
|
3
|
-
/** What a post-failure verification read could establish about a put. */
|
|
4
|
-
export type CheckpointWriteVerdict = 'landed' | 'not-landed' | 'unverified';
|
|
5
|
-
/**
|
|
6
|
-
* Read one of the two rows back after the META+PAYLOAD transaction failed and
|
|
7
|
-
* report what that failure actually did — never assuming it did nothing.
|
|
8
|
-
*
|
|
9
|
-
* No rejection is proof of a non-commit: `withDynamoDBRetry` re-issues a
|
|
10
|
-
* transaction whose response was lost, and the re-issues can time out at the
|
|
11
|
-
* transport without reaching DynamoDB, so the budget is spent on a
|
|
12
|
-
* `RetryExhaustedError` while the rows are committed. Deleting the uploads on
|
|
13
|
-
* that basis stranded the head checkpoint of a thread on a `NoSuchKey`.
|
|
14
|
-
*
|
|
15
|
-
* Keys are nonced per call (see `buildCheckpointItems`), so "the row holds
|
|
16
|
-
* this attempt's key" is the same statement as "this attempt's write is
|
|
17
|
-
* live". When neither descriptor is offloaded there is nothing to delete, so
|
|
18
|
-
* the answer is simply "safe to clean up", a no-op for the caller.
|
|
19
|
-
*
|
|
20
|
-
* A read failure establishes nothing; the caller then leaks one object at
|
|
21
|
-
* worst (reclaimed by `ensureS3LifecycleRule`) rather than deleting one a live
|
|
22
|
-
* row may point at — the same trade `store/internal/persist.ts` makes.
|
|
23
|
-
*/
|
|
24
|
-
export declare function verifyCheckpointLanded(context: CheckpointerContext, meta: CheckpointMetaItem, payload: CheckpointPayloadItem): Promise<CheckpointWriteVerdict>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyCheckpointLanded = verifyCheckpointLanded;
|
|
4
|
-
const codec_1 = require("../../shared/codec/codec");
|
|
5
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
6
|
-
/** The S3 key an offloaded descriptor points at, or undefined for inline/absent. */
|
|
7
|
-
function offloadedKey(descriptor) {
|
|
8
|
-
return descriptor?.location === codec_1.PayloadLocation.S3 ? descriptor.s3Key : undefined;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Pick the row carrying an offloaded descriptor. The META and PAYLOAD rows
|
|
12
|
-
* commit in one transaction, so one of them is enough; with neither offloaded
|
|
13
|
-
* there is nothing to protect and no read to spend.
|
|
14
|
-
*/
|
|
15
|
-
function chooseProbe(meta, payload) {
|
|
16
|
-
const metaKey = offloadedKey(meta.metadata);
|
|
17
|
-
if (metaKey !== undefined) {
|
|
18
|
-
return { key: { PK: meta.PK, SK: meta.SK }, attribute: 'metadata', expected: metaKey };
|
|
19
|
-
}
|
|
20
|
-
const payloadKey = offloadedKey(payload.checkpoint);
|
|
21
|
-
if (payloadKey !== undefined) {
|
|
22
|
-
return {
|
|
23
|
-
key: { PK: payload.PK, SK: payload.SK },
|
|
24
|
-
attribute: 'checkpoint',
|
|
25
|
-
expected: payloadKey,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Read one of the two rows back after the META+PAYLOAD transaction failed and
|
|
32
|
-
* report what that failure actually did — never assuming it did nothing.
|
|
33
|
-
*
|
|
34
|
-
* No rejection is proof of a non-commit: `withDynamoDBRetry` re-issues a
|
|
35
|
-
* transaction whose response was lost, and the re-issues can time out at the
|
|
36
|
-
* transport without reaching DynamoDB, so the budget is spent on a
|
|
37
|
-
* `RetryExhaustedError` while the rows are committed. Deleting the uploads on
|
|
38
|
-
* that basis stranded the head checkpoint of a thread on a `NoSuchKey`.
|
|
39
|
-
*
|
|
40
|
-
* Keys are nonced per call (see `buildCheckpointItems`), so "the row holds
|
|
41
|
-
* this attempt's key" is the same statement as "this attempt's write is
|
|
42
|
-
* live". When neither descriptor is offloaded there is nothing to delete, so
|
|
43
|
-
* the answer is simply "safe to clean up", a no-op for the caller.
|
|
44
|
-
*
|
|
45
|
-
* A read failure establishes nothing; the caller then leaks one object at
|
|
46
|
-
* worst (reclaimed by `ensureS3LifecycleRule`) rather than deleting one a live
|
|
47
|
-
* row may point at — the same trade `store/internal/persist.ts` makes.
|
|
48
|
-
*/
|
|
49
|
-
async function verifyCheckpointLanded(context, meta, payload) {
|
|
50
|
-
const probe = chooseProbe(meta, payload);
|
|
51
|
-
if (!probe)
|
|
52
|
-
return 'not-landed';
|
|
53
|
-
try {
|
|
54
|
-
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
55
|
-
TableName: context.tableName,
|
|
56
|
-
Key: probe.key,
|
|
57
|
-
ConsistentRead: true,
|
|
58
|
-
ProjectionExpression: '#d',
|
|
59
|
-
ExpressionAttributeNames: { '#d': probe.attribute },
|
|
60
|
-
}), context.retry);
|
|
61
|
-
const stored = result.Item?.[probe.attribute];
|
|
62
|
-
return offloadedKey(stored) === probe.expected ? 'landed' : 'not-landed';
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return 'unverified';
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
-
/** The thread/namespace/checkpoint identifiers extracted from a config. */
|
|
3
|
-
export interface ResolvedConfigurable {
|
|
4
|
-
threadId: string;
|
|
5
|
-
checkpointNs: string;
|
|
6
|
-
checkpointId?: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Narrow `RunnableConfig.configurable` to the identifiers the saver needs,
|
|
10
|
-
* defaulting the namespace to empty and validating that a thread id is present.
|
|
11
|
-
*/
|
|
12
|
-
export declare function readConfigurable(config: RunnableConfig): ResolvedConfigurable;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readConfigurable = readConfigurable;
|
|
4
|
-
const validation_1 = require("./validation");
|
|
5
|
-
/**
|
|
6
|
-
* Narrow `RunnableConfig.configurable` to the identifiers the saver needs,
|
|
7
|
-
* defaulting the namespace to empty and validating that a thread id is present.
|
|
8
|
-
*/
|
|
9
|
-
function readConfigurable(config) {
|
|
10
|
-
const configurable = (config.configurable ?? {});
|
|
11
|
-
(0, validation_1.validateThreadId)(configurable.thread_id);
|
|
12
|
-
const checkpointNs = configurable.checkpoint_ns ?? '';
|
|
13
|
-
(0, validation_1.validateCheckpointNs)(checkpointNs);
|
|
14
|
-
/**
|
|
15
|
-
* `null`, `''` and the legacy `thread_ts` alias resolve the way the reference's
|
|
16
|
-
* `getCheckpointId` does: a falsy id addresses the latest checkpoint rather
|
|
17
|
-
* than failing a config that was built from JSON or ported from another saver.
|
|
18
|
-
*/
|
|
19
|
-
const rawId = configurable.checkpoint_id ?? configurable.thread_ts;
|
|
20
|
-
const checkpointId = rawId ? rawId : undefined;
|
|
21
|
-
if (checkpointId !== undefined)
|
|
22
|
-
(0, validation_1.validateCheckpointId)(checkpointId);
|
|
23
|
-
return { threadId: configurable.thread_id, checkpointNs, checkpointId };
|
|
24
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { CheckpointPendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
import type { CheckpointMetaItem, CheckpointPayloadItem } from '../types';
|
|
3
|
-
import type { CheckpointerContext } from './setup';
|
|
4
|
-
/** Per-read options for the payload and writes reads. */
|
|
5
|
-
export interface ReadOptions {
|
|
6
|
-
signal?: AbortSignal;
|
|
7
|
-
/** `false` for bulk reads (`list`) that trade read-your-writes for half the read cost. */
|
|
8
|
-
consistent?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Fetch the target META item: by id when given, else the newest in the
|
|
12
|
-
* namespace. The newest-first read pages one row at a time past any foreign
|
|
13
|
-
* row until it finds a real checkpoint.
|
|
14
|
-
*/
|
|
15
|
-
export declare function fetchTargetMeta(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId?: string, signal?: AbortSignal): Promise<CheckpointMetaItem | undefined>;
|
|
16
|
-
/** Fetch the PAYLOAD item for a checkpoint. */
|
|
17
|
-
export declare function fetchPayload(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, read?: ReadOptions): Promise<CheckpointPayloadItem | undefined>;
|
|
18
|
-
/** Fetch and decode every pending write for a checkpoint, in write order. */
|
|
19
|
-
export declare function fetchPendingWrites(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, read?: ReadOptions): Promise<CheckpointPendingWrite[]>;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchTargetMeta = fetchTargetMeta;
|
|
4
|
-
exports.fetchPayload = fetchPayload;
|
|
5
|
-
exports.fetchPendingWrites = fetchPendingWrites;
|
|
6
|
-
const clock_1 = require("../../shared/clock");
|
|
7
|
-
const constants_1 = require("../../shared/constants");
|
|
8
|
-
const expiry_1 = require("../../shared/dynamodb/expiry");
|
|
9
|
-
const paginate_1 = require("../../shared/dynamodb/paginate");
|
|
10
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
11
|
-
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
12
|
-
const item_reader_1 = require("./item-reader");
|
|
13
|
-
const keys_1 = require("./keys");
|
|
14
|
-
const query_1 = require("./query");
|
|
15
|
-
/**
|
|
16
|
-
* Fetch the target META item: by id when given, else the newest in the
|
|
17
|
-
* namespace. The newest-first read pages one row at a time past any foreign
|
|
18
|
-
* row until it finds a real checkpoint.
|
|
19
|
-
*/
|
|
20
|
-
async function fetchTargetMeta(context, threadId, checkpointNs, checkpointId, signal) {
|
|
21
|
-
/** Expired rows are absent to every reader, however long DynamoDB's sweep lags. */
|
|
22
|
-
const now = (0, clock_1.nowSeconds)();
|
|
23
|
-
if (checkpointId !== undefined) {
|
|
24
|
-
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
25
|
-
TableName: context.tableName,
|
|
26
|
-
Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.metaSortKey)(checkpointNs, checkpointId) },
|
|
27
|
-
ConsistentRead: true,
|
|
28
|
-
}), (0, retry_policy_1.retryFor)(context, signal));
|
|
29
|
-
const meta = (0, item_reader_1.narrowHead)(context, result.Item);
|
|
30
|
-
return meta && !(0, expiry_1.isExpiredRow)(meta, now) ? meta : undefined;
|
|
31
|
-
}
|
|
32
|
-
const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.metaSortKeyPrefix)(checkpointNs), {
|
|
33
|
-
limit: 1,
|
|
34
|
-
consistent: true,
|
|
35
|
-
});
|
|
36
|
-
const rows = (0, paginate_1.paginateQuery)({
|
|
37
|
-
retry: (0, retry_policy_1.retryFor)(context, signal),
|
|
38
|
-
signal,
|
|
39
|
-
client: context.client,
|
|
40
|
-
params: (0, expiry_1.withoutExpired)(params, now),
|
|
41
|
-
maxItems: Number.POSITIVE_INFINITY,
|
|
42
|
-
maxIterations: Number.POSITIVE_INFINITY,
|
|
43
|
-
});
|
|
44
|
-
for await (const raw of rows) {
|
|
45
|
-
const meta = (0, item_reader_1.narrowHead)(context, raw);
|
|
46
|
-
if (meta && !(0, expiry_1.isExpiredRow)(meta, now))
|
|
47
|
-
return meta;
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
/** Fetch the PAYLOAD item for a checkpoint. */
|
|
52
|
-
async function fetchPayload(context, threadId, checkpointNs, checkpointId, read = {}) {
|
|
53
|
-
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
54
|
-
TableName: context.tableName,
|
|
55
|
-
Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.payloadSortKey)(checkpointNs, checkpointId) },
|
|
56
|
-
ConsistentRead: read.consistent ?? true,
|
|
57
|
-
}), (0, retry_policy_1.retryFor)(context, read.signal));
|
|
58
|
-
return result.Item;
|
|
59
|
-
}
|
|
60
|
-
/** Fetch and decode every pending write for a checkpoint, in write order. */
|
|
61
|
-
async function fetchPendingWrites(context, threadId, checkpointNs, checkpointId, read = {}) {
|
|
62
|
-
const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.writeSortKeyPrefix)(checkpointNs, checkpointId), { ascending: true, consistent: read.consistent ?? true });
|
|
63
|
-
/**
|
|
64
|
-
* Unbounded: the read must be complete to be correct, and a Send fan-out
|
|
65
|
-
* retried with a changed write order leaves superseded rows behind that
|
|
66
|
-
* count toward any cap. Past the warning threshold the read still succeeds,
|
|
67
|
-
* but an operator is told the checkpoint is unusually heavy.
|
|
68
|
-
*/
|
|
69
|
-
const items = [];
|
|
70
|
-
for await (const item of (0, paginate_1.paginateQuery)({
|
|
71
|
-
retry: (0, retry_policy_1.retryFor)(context, read.signal),
|
|
72
|
-
signal: read.signal,
|
|
73
|
-
client: context.client,
|
|
74
|
-
params,
|
|
75
|
-
maxItems: Number.POSITIVE_INFINITY,
|
|
76
|
-
maxIterations: Number.POSITIVE_INFINITY,
|
|
77
|
-
})) {
|
|
78
|
-
items.push(item);
|
|
79
|
-
}
|
|
80
|
-
if (items.length >= constants_1.LIST_SCAN_WARN_THRESHOLD) {
|
|
81
|
-
context.logger.warn('getTuple: a checkpoint carries very many pending-write rows; the read is complete but slow', {
|
|
82
|
-
threadId,
|
|
83
|
-
checkpointId,
|
|
84
|
-
rows: items.length,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return (0, item_reader_1.toPendingWrites)(context, items, threadId);
|
|
88
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** A JSON-comparable value used in metadata filters. */
|
|
2
|
-
export type FilterValue = string | number | boolean | null | FilterValue[] | {
|
|
3
|
-
[key: string]: FilterValue;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* True when every key in `filter` is present in `metadata` with a deeply equal
|
|
7
|
-
* value. Equality is structural and key-order-independent for nested objects,
|
|
8
|
-
* order-significant for arrays, and type-strict (no `3` vs `'3'` coercion). An
|
|
9
|
-
* empty filter matches everything. Only own properties count: a filter on
|
|
10
|
-
* `constructor` or `toString` compares against nothing, not against the
|
|
11
|
-
* prototype's function, the same rule the store's filter applies.
|
|
12
|
-
*/
|
|
13
|
-
export declare function matchesFilter(metadata: Record<string, FilterValue>, filter: Record<string, FilterValue>): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.matchesFilter = matchesFilter;
|
|
4
|
-
const node_util_1 = require("node:util");
|
|
5
|
-
/**
|
|
6
|
-
* True when every key in `filter` is present in `metadata` with a deeply equal
|
|
7
|
-
* value. Equality is structural and key-order-independent for nested objects,
|
|
8
|
-
* order-significant for arrays, and type-strict (no `3` vs `'3'` coercion). An
|
|
9
|
-
* empty filter matches everything. Only own properties count: a filter on
|
|
10
|
-
* `constructor` or `toString` compares against nothing, not against the
|
|
11
|
-
* prototype's function, the same rule the store's filter applies.
|
|
12
|
-
*/
|
|
13
|
-
function matchesFilter(metadata, filter) {
|
|
14
|
-
return Object.entries(filter).every(([key, value]) => (0, node_util_1.isDeepStrictEqual)(Object.hasOwn(metadata, key) ? metadata[key] : undefined, value));
|
|
15
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Checkpoint, CheckpointMetadata, CheckpointPendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
import type { DocItem } from '../../shared/dynamodb/types';
|
|
3
|
-
import type { CheckpointMetaItem, CheckpointPayloadItem, CheckpointWriteItem } from '../types';
|
|
4
|
-
import type { CheckpointerContext } from './setup';
|
|
5
|
-
/**
|
|
6
|
-
* Narrow a raw row to a {@link CheckpointMetaItem}, or `undefined` for a row
|
|
7
|
-
* that merely shares the `META#` sort-key prefix. Replaces an unchecked cast
|
|
8
|
-
* at the one boundary where a row may not have been written by this adapter.
|
|
9
|
-
*/
|
|
10
|
-
export declare function narrowMetaItem(raw: DocItem): CheckpointMetaItem | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Narrow a candidate head row, warning when a row that merely shares the
|
|
13
|
-
* `META#` prefix is not a checkpoint meta item. Returning such a row used to
|
|
14
|
-
* make `assembleTuple` miss its payload and report the thread as empty, so
|
|
15
|
-
* LangGraph started a new run on top of the real history; a foreign row is
|
|
16
|
-
* skipped and logged instead, exactly as `list()` treats it.
|
|
17
|
-
*/
|
|
18
|
-
export declare function narrowHead(context: CheckpointerContext, raw: DocItem | undefined): CheckpointMetaItem | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Decode the checkpoint stored in a PAYLOAD item. `threadId` is the caller's
|
|
21
|
-
* (from the config), never the row's: it scopes which S3 object the row may
|
|
22
|
-
* point at, so it must come from the partition the caller asked for.
|
|
23
|
-
*/
|
|
24
|
-
export declare function readCheckpoint(context: CheckpointerContext, item: CheckpointPayloadItem, threadId: string): Promise<Checkpoint>;
|
|
25
|
-
/** Decode the metadata stored in a META item; see {@link readCheckpoint} for `threadId`. */
|
|
26
|
-
export declare function readMetadata(context: CheckpointerContext, item: CheckpointMetaItem, threadId: string): Promise<CheckpointMetadata>;
|
|
27
|
-
/**
|
|
28
|
-
* Drop rows a later `putWrites` call added for a task and channel an earlier
|
|
29
|
-
* call had already committed.
|
|
30
|
-
*
|
|
31
|
-
* A regular write's index is its position in the caller's array, so a retried
|
|
32
|
-
* task whose write mix changed can place an already-committed channel at a
|
|
33
|
-
* second index — a new row, which would replay that channel's value twice. For
|
|
34
|
-
* an accumulating channel (a `messages` add-reducer, a Topic) that
|
|
35
|
-
* double-counts. Every row carries the `writeGroup` of the call that wrote it,
|
|
36
|
-
* which distinguishes that case from a channel a *single* call legitimately
|
|
37
|
-
* wrote more than once (a task emitting two Sends), where both values must
|
|
38
|
-
* survive.
|
|
39
|
-
*
|
|
40
|
-
* Write groups are time-ordered ULIDs, so the smallest one for a `(task,
|
|
41
|
-
* channel)` pair identifies the earliest committed call — first-write-wins,
|
|
42
|
-
* the same rule the write-side guard applies, extended to the case the guard
|
|
43
|
-
* cannot see. Selecting by *order encountered* would not do: rows arrive
|
|
44
|
-
* sorted by index, and a retry emitting fewer writes moves an
|
|
45
|
-
* already-committed channel to a smaller index, where it sorts ahead of the
|
|
46
|
-
* original row and would hand back the later call's value instead. The
|
|
47
|
-
* superseded row stays in DynamoDB and is removed by `deleteThread` or TTL
|
|
48
|
-
* like any other.
|
|
49
|
-
*
|
|
50
|
-
* Identity is `(task, channel, occurrence)`, not `(task, channel)`. Keying on
|
|
51
|
-
* the channel alone treated *any* second row for a channel as a superseding
|
|
52
|
-
* duplicate — including one a retry added at an occurrence no earlier call had
|
|
53
|
-
* ever written, which the write-side guard accepted cleanly. That row was then
|
|
54
|
-
* discarded on read, silently returning fewer values than were written, with
|
|
55
|
-
* `putWrites()` having reported success. For that specific shape — a retry
|
|
56
|
-
* that legitimately emits a channel *more* often than the original call —
|
|
57
|
-
* keeping the occurrence restores the upstream outcome: `MemorySaver` keys
|
|
58
|
-
* first-write-wins on `(taskId, idx)`, so a grown retry keeps both values
|
|
59
|
-
* there too. That is not a claim of parity in general: a retry that reorders
|
|
60
|
-
* or shrinks its writes is still resolved to the earliest call per `(task,
|
|
61
|
-
* channel, occurrence)` as above, which is what keeps an accumulating channel
|
|
62
|
-
* from being double-counted — a case `MemorySaver` does not have to handle.
|
|
63
|
-
*/
|
|
64
|
-
export declare function dropSupersededWrites(items: CheckpointWriteItem[]): CheckpointWriteItem[];
|
|
65
|
-
/** Decode WRITE items into `[taskId, channel, value]` pending-write tuples. */
|
|
66
|
-
export declare function toPendingWrites(context: CheckpointerContext, items: CheckpointWriteItem[], threadId: string): Promise<CheckpointPendingWrite[]>;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.narrowMetaItem = narrowMetaItem;
|
|
4
|
-
exports.narrowHead = narrowHead;
|
|
5
|
-
exports.readCheckpoint = readCheckpoint;
|
|
6
|
-
exports.readMetadata = readMetadata;
|
|
7
|
-
exports.dropSupersededWrites = dropSupersededWrites;
|
|
8
|
-
exports.toPendingWrites = toPendingWrites;
|
|
9
|
-
const codec_1 = require("../../shared/codec/codec");
|
|
10
|
-
const concurrency_1 = require("../../shared/concurrency");
|
|
11
|
-
const constants_1 = require("../../shared/constants");
|
|
12
|
-
const item_writer_1 = require("./item-writer");
|
|
13
|
-
/**
|
|
14
|
-
* Narrow a raw row to a {@link CheckpointMetaItem}, or `undefined` for a row
|
|
15
|
-
* that merely shares the `META#` sort-key prefix. Replaces an unchecked cast
|
|
16
|
-
* at the one boundary where a row may not have been written by this adapter.
|
|
17
|
-
*/
|
|
18
|
-
function narrowMetaItem(raw) {
|
|
19
|
-
return typeof raw.checkpointId === 'string' &&
|
|
20
|
-
typeof raw.checkpointNs === 'string' &&
|
|
21
|
-
raw.metadata !== undefined
|
|
22
|
-
? raw
|
|
23
|
-
: undefined;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Narrow a candidate head row, warning when a row that merely shares the
|
|
27
|
-
* `META#` prefix is not a checkpoint meta item. Returning such a row used to
|
|
28
|
-
* make `assembleTuple` miss its payload and report the thread as empty, so
|
|
29
|
-
* LangGraph started a new run on top of the real history; a foreign row is
|
|
30
|
-
* skipped and logged instead, exactly as `list()` treats it.
|
|
31
|
-
*/
|
|
32
|
-
function narrowHead(context, raw) {
|
|
33
|
-
if (raw === undefined)
|
|
34
|
-
return undefined;
|
|
35
|
-
const meta = narrowMetaItem(raw);
|
|
36
|
-
if (!meta) {
|
|
37
|
-
context.logger.warn('getTuple: skipped a row that is not a checkpoint meta item', {
|
|
38
|
-
sortKey: raw.SK,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return meta;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Decode the checkpoint stored in a PAYLOAD item. `threadId` is the caller's
|
|
45
|
-
* (from the config), never the row's: it scopes which S3 object the row may
|
|
46
|
-
* point at, so it must come from the partition the caller asked for.
|
|
47
|
-
*/
|
|
48
|
-
async function readCheckpoint(context, item, threadId) {
|
|
49
|
-
return (0, codec_1.decodePayload)(item.checkpoint, (0, item_writer_1.codecDeps)(context), [threadId]);
|
|
50
|
-
}
|
|
51
|
-
/** Decode the metadata stored in a META item; see {@link readCheckpoint} for `threadId`. */
|
|
52
|
-
async function readMetadata(context, item, threadId) {
|
|
53
|
-
return (0, codec_1.decodePayload)(item.metadata, (0, item_writer_1.codecDeps)(context), [threadId]);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Drop rows a later `putWrites` call added for a task and channel an earlier
|
|
57
|
-
* call had already committed.
|
|
58
|
-
*
|
|
59
|
-
* A regular write's index is its position in the caller's array, so a retried
|
|
60
|
-
* task whose write mix changed can place an already-committed channel at a
|
|
61
|
-
* second index — a new row, which would replay that channel's value twice. For
|
|
62
|
-
* an accumulating channel (a `messages` add-reducer, a Topic) that
|
|
63
|
-
* double-counts. Every row carries the `writeGroup` of the call that wrote it,
|
|
64
|
-
* which distinguishes that case from a channel a *single* call legitimately
|
|
65
|
-
* wrote more than once (a task emitting two Sends), where both values must
|
|
66
|
-
* survive.
|
|
67
|
-
*
|
|
68
|
-
* Write groups are time-ordered ULIDs, so the smallest one for a `(task,
|
|
69
|
-
* channel)` pair identifies the earliest committed call — first-write-wins,
|
|
70
|
-
* the same rule the write-side guard applies, extended to the case the guard
|
|
71
|
-
* cannot see. Selecting by *order encountered* would not do: rows arrive
|
|
72
|
-
* sorted by index, and a retry emitting fewer writes moves an
|
|
73
|
-
* already-committed channel to a smaller index, where it sorts ahead of the
|
|
74
|
-
* original row and would hand back the later call's value instead. The
|
|
75
|
-
* superseded row stays in DynamoDB and is removed by `deleteThread` or TTL
|
|
76
|
-
* like any other.
|
|
77
|
-
*
|
|
78
|
-
* Identity is `(task, channel, occurrence)`, not `(task, channel)`. Keying on
|
|
79
|
-
* the channel alone treated *any* second row for a channel as a superseding
|
|
80
|
-
* duplicate — including one a retry added at an occurrence no earlier call had
|
|
81
|
-
* ever written, which the write-side guard accepted cleanly. That row was then
|
|
82
|
-
* discarded on read, silently returning fewer values than were written, with
|
|
83
|
-
* `putWrites()` having reported success. For that specific shape — a retry
|
|
84
|
-
* that legitimately emits a channel *more* often than the original call —
|
|
85
|
-
* keeping the occurrence restores the upstream outcome: `MemorySaver` keys
|
|
86
|
-
* first-write-wins on `(taskId, idx)`, so a grown retry keeps both values
|
|
87
|
-
* there too. That is not a claim of parity in general: a retry that reorders
|
|
88
|
-
* or shrinks its writes is still resolved to the earliest call per `(task,
|
|
89
|
-
* channel, occurrence)` as above, which is what keeps an accumulating channel
|
|
90
|
-
* from being double-counted — a case `MemorySaver` does not have to handle.
|
|
91
|
-
*/
|
|
92
|
-
function dropSupersededWrites(items) {
|
|
93
|
-
const identity = (item) => JSON.stringify([item.taskId, item.channel, item.occurrence ?? 0]);
|
|
94
|
-
const earliestGroup = new Map();
|
|
95
|
-
for (const item of items) {
|
|
96
|
-
const id = identity(item);
|
|
97
|
-
const seen = earliestGroup.get(id);
|
|
98
|
-
if (seen === undefined || item.writeGroup < seen)
|
|
99
|
-
earliestGroup.set(id, item.writeGroup);
|
|
100
|
-
}
|
|
101
|
-
return items.filter((item) => earliestGroup.get(identity(item)) === item.writeGroup);
|
|
102
|
-
}
|
|
103
|
-
/** Decode WRITE items into `[taskId, channel, value]` pending-write tuples. */
|
|
104
|
-
async function toPendingWrites(context, items, threadId) {
|
|
105
|
-
const deps = (0, item_writer_1.codecDeps)(context);
|
|
106
|
-
const live = dropSupersededWrites(items);
|
|
107
|
-
const values = await (0, concurrency_1.mapWithConcurrency)(live, constants_1.DEFAULT_READ_CONCURRENCY, (item) => (0, codec_1.decodePayload)(item.value, deps, [threadId]));
|
|
108
|
-
return live.map((item, index) => [
|
|
109
|
-
item.taskId,
|
|
110
|
-
item.channel,
|
|
111
|
-
values[index],
|
|
112
|
-
]);
|
|
113
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Checkpoint, CheckpointMetadata, PendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
import { type CodecDeps } from '../../shared/codec/codec';
|
|
3
|
-
import type { CheckpointMetaItem, CheckpointPayloadItem, CheckpointWriteItem } from '../types';
|
|
4
|
-
import type { CheckpointerContext } from './setup';
|
|
5
|
-
/** Map a context to the codec collaborators. */
|
|
6
|
-
export declare function codecDeps(context: CheckpointerContext): CodecDeps;
|
|
7
|
-
/**
|
|
8
|
-
* Encode a checkpoint + metadata into its META and PAYLOAD items. `nonce` is
|
|
9
|
-
* unique per `put()` call and is appended to both S3 key part lists, so a
|
|
10
|
-
* second put of the same checkpoint id — a retry after a lost response, or a
|
|
11
|
-
* repair tool re-writing a checkpoint — never shares an object with the first.
|
|
12
|
-
* That is what makes "the row holds my key" equivalent to "my write is live"
|
|
13
|
-
* for the post-failure verification in `put.ts`, and what keeps a failed
|
|
14
|
-
* re-put's cleanup from deleting the object the first, successful put's rows
|
|
15
|
-
* point at. `storedChannels` narrows the stored `channel_values` (see
|
|
16
|
-
* `selectStoredChannels`); by default every value is stored.
|
|
17
|
-
*/
|
|
18
|
-
export declare function buildCheckpointItems(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpoint: Checkpoint, metadata: CheckpointMetadata, nonce: string, parentCheckpointId?: string, ttlTimestamp?: number, storedChannels?: readonly string[]): Promise<{
|
|
19
|
-
meta: CheckpointMetaItem;
|
|
20
|
-
payload: CheckpointPayloadItem;
|
|
21
|
-
}>;
|
|
22
|
-
/**
|
|
23
|
-
* Encode a task's pending writes into one item per write. `nonce` must be
|
|
24
|
-
* unique per `putWrites` *call* (not per write) and is appended to every
|
|
25
|
-
* write's S3 offload keyParts — regular and special alike — so a repeated
|
|
26
|
-
* write (a retried task re-emitting the same channel, or two calls to the
|
|
27
|
-
* same special channel) never shares an S3 location with any earlier
|
|
28
|
-
* attempt. Special (negative-index) writes still overwrite their DynamoDB
|
|
29
|
-
* row in place (see {@link writeSpecialItemsWithCleanup}), but that
|
|
30
|
-
* overwrite-safety now comes from reading the previous descriptor before
|
|
31
|
-
* writing and only cleaning it up after the new row is confirmed committed —
|
|
32
|
-
* the same pattern store/actions/put.ts uses for the identical "overwrite in
|
|
33
|
-
* place, nonce every upload" shape.
|
|
34
|
-
*/
|
|
35
|
-
export declare function buildWriteItems(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, taskId: string, writes: PendingWrite[], nonce: string, ttlTimestamp?: number): Promise<CheckpointWriteItem[]>;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.codecDeps = codecDeps;
|
|
4
|
-
exports.buildCheckpointItems = buildCheckpointItems;
|
|
5
|
-
exports.buildWriteItems = buildWriteItems;
|
|
6
|
-
const encode_1 = require("../../shared/codec/encode");
|
|
7
|
-
const keys_1 = require("./keys");
|
|
8
|
-
const stored_channels_1 = require("./stored-channels");
|
|
9
|
-
const validation_1 = require("./validation");
|
|
10
|
-
const write_index_1 = require("./write-index");
|
|
11
|
-
/** Map a context to the codec collaborators. */
|
|
12
|
-
function codecDeps(context) {
|
|
13
|
-
return { serde: context.serde, compression: context.compression, offloader: context.offloader };
|
|
14
|
-
}
|
|
15
|
-
function withTtl(item, ttlTimestamp) {
|
|
16
|
-
if (ttlTimestamp !== undefined)
|
|
17
|
-
item.ttl = ttlTimestamp;
|
|
18
|
-
return item;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Encode a checkpoint + metadata into its META and PAYLOAD items. `nonce` is
|
|
22
|
-
* unique per `put()` call and is appended to both S3 key part lists, so a
|
|
23
|
-
* second put of the same checkpoint id — a retry after a lost response, or a
|
|
24
|
-
* repair tool re-writing a checkpoint — never shares an object with the first.
|
|
25
|
-
* That is what makes "the row holds my key" equivalent to "my write is live"
|
|
26
|
-
* for the post-failure verification in `put.ts`, and what keeps a failed
|
|
27
|
-
* re-put's cleanup from deleting the object the first, successful put's rows
|
|
28
|
-
* point at. `storedChannels` narrows the stored `channel_values` (see
|
|
29
|
-
* `selectStoredChannels`); by default every value is stored.
|
|
30
|
-
*/
|
|
31
|
-
async function buildCheckpointItems(context, threadId, checkpointNs, checkpoint, metadata, nonce, parentCheckpointId, ttlTimestamp, storedChannels = Object.keys(checkpoint.channel_values)) {
|
|
32
|
-
const deps = codecDeps(context);
|
|
33
|
-
const pk = (0, keys_1.partitionKey)(threadId);
|
|
34
|
-
const checkpointDescriptor = await (0, encode_1.encodePayload)((0, stored_channels_1.withStoredChannels)(checkpoint, storedChannels), deps, {
|
|
35
|
-
keyParts: [threadId, checkpointNs, checkpoint.id, 'checkpoint', nonce],
|
|
36
|
-
});
|
|
37
|
-
const metadataDescriptor = await (0, encode_1.encodePayload)(metadata, deps, {
|
|
38
|
-
keyParts: [threadId, checkpointNs, checkpoint.id, 'metadata', nonce],
|
|
39
|
-
});
|
|
40
|
-
const meta = {
|
|
41
|
-
PK: pk,
|
|
42
|
-
SK: (0, keys_1.metaSortKey)(checkpointNs, checkpoint.id),
|
|
43
|
-
threadId,
|
|
44
|
-
checkpointNs,
|
|
45
|
-
checkpointId: checkpoint.id,
|
|
46
|
-
metadata: metadataDescriptor,
|
|
47
|
-
storedChannels: [...storedChannels],
|
|
48
|
-
};
|
|
49
|
-
if (parentCheckpointId !== undefined)
|
|
50
|
-
meta.parentCheckpointId = parentCheckpointId;
|
|
51
|
-
const payload = {
|
|
52
|
-
PK: pk,
|
|
53
|
-
SK: (0, keys_1.payloadSortKey)(checkpointNs, checkpoint.id),
|
|
54
|
-
checkpoint: checkpointDescriptor,
|
|
55
|
-
};
|
|
56
|
-
return { meta: withTtl(meta, ttlTimestamp), payload: withTtl(payload, ttlTimestamp) };
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Encode a task's pending writes into one item per write. `nonce` must be
|
|
60
|
-
* unique per `putWrites` *call* (not per write) and is appended to every
|
|
61
|
-
* write's S3 offload keyParts — regular and special alike — so a repeated
|
|
62
|
-
* write (a retried task re-emitting the same channel, or two calls to the
|
|
63
|
-
* same special channel) never shares an S3 location with any earlier
|
|
64
|
-
* attempt. Special (negative-index) writes still overwrite their DynamoDB
|
|
65
|
-
* row in place (see {@link writeSpecialItemsWithCleanup}), but that
|
|
66
|
-
* overwrite-safety now comes from reading the previous descriptor before
|
|
67
|
-
* writing and only cleaning it up after the new row is confirmed committed —
|
|
68
|
-
* the same pattern store/actions/put.ts uses for the identical "overwrite in
|
|
69
|
-
* place, nonce every upload" shape.
|
|
70
|
-
*/
|
|
71
|
-
async function buildWriteItems(context, threadId, checkpointNs, checkpointId, taskId, writes, nonce, ttlTimestamp) {
|
|
72
|
-
/** Reject a bad channel before any payload is encoded or uploaded. */
|
|
73
|
-
for (const [channel] of writes)
|
|
74
|
-
(0, validation_1.validateChannel)(channel);
|
|
75
|
-
const deps = codecDeps(context);
|
|
76
|
-
const pk = (0, keys_1.partitionKey)(threadId);
|
|
77
|
-
const items = [];
|
|
78
|
-
for (const { channel, value, index, occurrence } of (0, write_index_1.resolveWriteIndices)(writes)) {
|
|
79
|
-
/**
|
|
80
|
-
* `channel` is part of the key as well as the index: two channels can
|
|
81
|
-
* share an index (each channel's first occurrence is 0), so without it
|
|
82
|
-
* their uploads would collide on one S3 object within a single call.
|
|
83
|
-
*/
|
|
84
|
-
const descriptor = await (0, encode_1.encodePayload)(value, deps, {
|
|
85
|
-
keyParts: [threadId, checkpointNs, checkpointId, taskId, `write-${index}`, channel, nonce],
|
|
86
|
-
});
|
|
87
|
-
const item = {
|
|
88
|
-
PK: pk,
|
|
89
|
-
SK: (0, keys_1.writeSortKey)(checkpointNs, checkpointId, taskId, index, channel),
|
|
90
|
-
taskId,
|
|
91
|
-
index,
|
|
92
|
-
channel,
|
|
93
|
-
/**
|
|
94
|
-
* Shared by every row this call writes. Positions shift when a retried
|
|
95
|
-
* task's write mix changes, so a channel an earlier call already
|
|
96
|
-
* committed can land at a second index and be replayed twice; the group
|
|
97
|
-
* is what lets the read side tell that apart from a channel a single
|
|
98
|
-
* call legitimately wrote more than once.
|
|
99
|
-
*/
|
|
100
|
-
writeGroup: nonce,
|
|
101
|
-
occurrence,
|
|
102
|
-
value: descriptor,
|
|
103
|
-
};
|
|
104
|
-
items.push(withTtl(item, ttlTimestamp));
|
|
105
|
-
}
|
|
106
|
-
return items;
|
|
107
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/** Reserved separator joining sort-key segments; forbidden inside any segment. */
|
|
2
|
-
export declare const SORT_KEY_SEPARATOR = "#";
|
|
3
|
-
/**
|
|
4
|
-
* The most negative write index the sort key can encode, `-WRITE_INDEX_OFFSET`.
|
|
5
|
-
* A static test pins it against the peer's `WRITES_IDX_MAP`, so a peer bump
|
|
6
|
-
* that adds a more negative special slot fails loudly instead of producing
|
|
7
|
-
* unsortable keys.
|
|
8
|
-
*/
|
|
9
|
-
export declare const MIN_ENCODABLE_WRITE_INDEX: number;
|
|
10
|
-
/** The tag every checkpointer partition key starts with, for a table-wide `begins_with`. */
|
|
11
|
-
export declare function checkpointerPartitionPrefix(): string;
|
|
12
|
-
/** Partition key for a thread: the adapter tag plus the thread id. */
|
|
13
|
-
export declare function partitionKey(threadId: string): string;
|
|
14
|
-
/** Sort key for a checkpoint's lightweight metadata item. */
|
|
15
|
-
export declare function metaSortKey(checkpointNs: string, checkpointId: string): string;
|
|
16
|
-
/** `begins_with` prefix selecting every META item in a namespace (for list). */
|
|
17
|
-
export declare function metaSortKeyPrefix(checkpointNs: string): string;
|
|
18
|
-
/** `begins_with` prefix selecting every META item of a thread, whatever its namespace. */
|
|
19
|
-
export declare function metaAnyNamespacePrefix(): string;
|
|
20
|
-
/** Sort key for a checkpoint's heavy payload item. */
|
|
21
|
-
export declare function payloadSortKey(checkpointNs: string, checkpointId: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Sort key for a single pending write. The trailing `channel` segment is what
|
|
24
|
-
* keeps two *different* channels from ever occupying one row: without it, a
|
|
25
|
-
* retried task whose write mix changed could compute an index another
|
|
26
|
-
* channel already holds, and the first-write-wins guard — which cannot tell a
|
|
27
|
-
* genuine retry from an unrelated write — would silently discard it. The
|
|
28
|
-
* channel is appended verbatim as the final segment, so two sort keys collide
|
|
29
|
-
* only when their channels are byte-identical; `writeSortKeyPrefix` stops at
|
|
30
|
-
* the checkpoint id, ahead of this segment, so `begins_with` reads are
|
|
31
|
-
* unaffected.
|
|
32
|
-
*/
|
|
33
|
-
export declare function writeSortKey(checkpointNs: string, checkpointId: string, taskId: string, index: number, channel: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* True when `sortKey` is one this adapter writes. A partition query carries no
|
|
36
|
-
* sort-key condition, so a partition-wide delete uses this to leave any row it
|
|
37
|
-
* does not own in place rather than deleting the whole partition blindly.
|
|
38
|
-
*/
|
|
39
|
-
export declare function isCheckpointerSortKey(sortKey: string): boolean;
|
|
40
|
-
/** `begins_with` prefix selecting every WRITE item for one checkpoint. */
|
|
41
|
-
export declare function writeSortKeyPrefix(checkpointNs: string, checkpointId: string): string;
|