@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,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides whether a stored payload's bytes are gzipped.
|
|
3
|
+
*
|
|
4
|
+
* When gzip is attempted, when its output is not worth keeping, and how a read
|
|
5
|
+
* refuses a gzip bomb or a stream that is not gzip are decided here. A caller
|
|
6
|
+
* carries only the flag this module returns, recorded beside the bytes, so
|
|
7
|
+
* compression is never guessed from the bytes and the thresholds can change
|
|
8
|
+
* without touching the codec that stores them.
|
|
9
|
+
*/
|
|
10
|
+
/** Default minimum payload size before gzip compression is attempted. */
|
|
11
|
+
export declare const DEFAULT_COMPRESSION_MIN_BYTES = 1024;
|
|
12
|
+
/** Default gzip compression level (balanced speed/ratio). */
|
|
13
|
+
export declare const DEFAULT_COMPRESSION_LEVEL = 6;
|
|
14
|
+
/** Default gzip-bomb guard: maximum decompressed output (50 MiB). */
|
|
15
|
+
export declare const DEFAULT_MAX_DECOMPRESSED_BYTES: number;
|
|
16
|
+
/** Configuration for payload compression. */
|
|
17
|
+
export interface CompressionConfig {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
minSizeBytes?: number;
|
|
20
|
+
level?: number;
|
|
21
|
+
maxDecompressedBytes?: number;
|
|
22
|
+
}
|
|
23
|
+
/** The bytes to store plus whether they were gzip-compressed. */
|
|
24
|
+
export interface CompressionResult {
|
|
25
|
+
bytes: Uint8Array;
|
|
26
|
+
compressed: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The bytes to store for `data`, gzipped when that is worth doing.
|
|
30
|
+
*
|
|
31
|
+
* Accepts: `data` — any length, including empty. `config.enabled` — `false`
|
|
32
|
+
* returns the input untouched. `config.minSizeBytes` — the size below which
|
|
33
|
+
* gzip is not attempted, default {@link DEFAULT_COMPRESSION_MIN_BYTES}.
|
|
34
|
+
* `config.level` — zlib level 0–9, default {@link DEFAULT_COMPRESSION_LEVEL}.
|
|
35
|
+
* `config.maxDecompressedBytes` — a payload larger than it is stored
|
|
36
|
+
* uncompressed, since no reader configured like this writer would inflate it.
|
|
37
|
+
*
|
|
38
|
+
* Returns: `compressed: true` only when gzip beat the input by more than 10%;
|
|
39
|
+
* otherwise the input bytes and `compressed: false`. The flag is recorded in
|
|
40
|
+
* the payload descriptor, so compression is never inferred from the bytes on
|
|
41
|
+
* read.
|
|
42
|
+
*
|
|
43
|
+
* Throws: whatever `zlib.gzip` rejects with.
|
|
44
|
+
*/
|
|
45
|
+
export declare function compress(data: Uint8Array, config: CompressionConfig): Promise<CompressionResult>;
|
|
46
|
+
/**
|
|
47
|
+
* The payload bytes `data` stands for, gunzipped when the row says so.
|
|
48
|
+
*
|
|
49
|
+
* Accepts: `data` — the bytes as stored. `compressed` — the descriptor's own
|
|
50
|
+
* flag; `false` returns `data` unchanged and inspects nothing. `maxBytes` — the
|
|
51
|
+
* decompressed-output cap, default {@link DEFAULT_MAX_DECOMPRESSED_BYTES}; a
|
|
52
|
+
* reader that configures no compression uses that default whatever the writer
|
|
53
|
+
* used.
|
|
54
|
+
*
|
|
55
|
+
* Returns: the decoded bytes.
|
|
56
|
+
*
|
|
57
|
+
* Throws: `COMPRESSION_LIMIT` when the output would exceed `maxBytes`, and
|
|
58
|
+
* `PAYLOAD_CORRUPT` when `compressed` is true but the bytes are not gzip.
|
|
59
|
+
* `PAYLOAD_CORRUPT` is permanent for that payload
|
|
60
|
+
* ({@link isPermanentPayloadLoss}). `COMPRESSION_LIMIT` is this reader's
|
|
61
|
+
* limit, not the payload's loss: a reader with a larger cap reads it. From
|
|
62
|
+
* this release on, `compress` never produces a payload past its writer's own
|
|
63
|
+
* cap; a payload an earlier release compressed — which did not check it —
|
|
64
|
+
* can still exceed a smaller `maxBytes` here.
|
|
65
|
+
*/
|
|
66
|
+
export declare function decompress(data: Uint8Array, compressed: boolean, maxBytes?: number): Promise<Uint8Array>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_MAX_DECOMPRESSED_BYTES = exports.DEFAULT_COMPRESSION_LEVEL = exports.DEFAULT_COMPRESSION_MIN_BYTES = void 0;
|
|
4
|
+
exports.compress = compress;
|
|
5
|
+
exports.decompress = decompress;
|
|
6
|
+
const node_util_1 = require("node:util");
|
|
7
|
+
const node_zlib_1 = require("node:zlib");
|
|
8
|
+
const base_error_js_1 = require("../errors/base-error.js");
|
|
9
|
+
const error_code_js_1 = require("../errors/error-code.js");
|
|
10
|
+
const gzipAsync = (0, node_util_1.promisify)(node_zlib_1.gzip);
|
|
11
|
+
const gunzipAsync = (0, node_util_1.promisify)(node_zlib_1.gunzip);
|
|
12
|
+
const COMPRESSION_GAIN_RATIO = 0.9;
|
|
13
|
+
exports.DEFAULT_COMPRESSION_MIN_BYTES = 1024;
|
|
14
|
+
exports.DEFAULT_COMPRESSION_LEVEL = 6;
|
|
15
|
+
exports.DEFAULT_MAX_DECOMPRESSED_BYTES = 50 * 1024 * 1024;
|
|
16
|
+
async function compress(data, config) {
|
|
17
|
+
const minSize = config.minSizeBytes ?? exports.DEFAULT_COMPRESSION_MIN_BYTES;
|
|
18
|
+
const readable = config.maxDecompressedBytes ?? exports.DEFAULT_MAX_DECOMPRESSED_BYTES;
|
|
19
|
+
if (!config.enabled || data.length < minSize || data.length > readable) {
|
|
20
|
+
return { bytes: data, compressed: false };
|
|
21
|
+
}
|
|
22
|
+
const level = config.level ?? exports.DEFAULT_COMPRESSION_LEVEL;
|
|
23
|
+
const gzipped = new Uint8Array(await gzipAsync(data, { level }));
|
|
24
|
+
if (gzipped.length >= data.length * COMPRESSION_GAIN_RATIO) {
|
|
25
|
+
return { bytes: data, compressed: false };
|
|
26
|
+
}
|
|
27
|
+
return { bytes: gzipped, compressed: true };
|
|
28
|
+
}
|
|
29
|
+
function corruptPayload(cause) {
|
|
30
|
+
return new base_error_js_1.DynamoDBLangGraphError('the stored payload is marked compressed but is not valid gzip, so it cannot be decoded', error_code_js_1.ErrorCode.PAYLOAD_CORRUPT, {}, cause);
|
|
31
|
+
}
|
|
32
|
+
async function decompress(data, compressed, maxBytes = exports.DEFAULT_MAX_DECOMPRESSED_BYTES) {
|
|
33
|
+
if (!compressed)
|
|
34
|
+
return data;
|
|
35
|
+
try {
|
|
36
|
+
return new Uint8Array(await gunzipAsync(data, { maxOutputLength: maxBytes }));
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const err = error;
|
|
40
|
+
if (err.code === 'ERR_BUFFER_TOO_LARGE') {
|
|
41
|
+
throw new base_error_js_1.DynamoDBLangGraphError(`Refusing to decompress: output would exceed ${maxBytes} bytes`, error_code_js_1.ErrorCode.COMPRESSION_LIMIT, {}, error);
|
|
42
|
+
}
|
|
43
|
+
throw corruptPayload(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides the JSON form: writing it, reading it, and recognising it.
|
|
3
|
+
*
|
|
4
|
+
* The default serde writes a value as JSON under the `json` type and reads
|
|
5
|
+
* back only that type; the codec also asks, when a serde refuses stored bytes,
|
|
6
|
+
* whether those bytes are still JSON at all, which tells a corrupt payload from
|
|
7
|
+
* a serde that would not reconstruct it.
|
|
8
|
+
*/
|
|
9
|
+
import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
10
|
+
/**
|
|
11
|
+
* A plain JSON serializer implementing LangGraph's `SerializerProtocol`:
|
|
12
|
+
* the default `serde` of `DynamoDBStore` and `DynamoDBChatMessageHistory`, and
|
|
13
|
+
* the alternative a `DynamoDBSaver` can be given in place of LangGraph's
|
|
14
|
+
* `JsonPlusSerializer`.
|
|
15
|
+
*
|
|
16
|
+
* It is exported so that choice is available. The checkpointer's default
|
|
17
|
+
* revives a stored `{"lc": …}` record by instantiating the class the record
|
|
18
|
+
* names, so the row selects which constructor runs on read; this serializer
|
|
19
|
+
* runs `JSON.parse` and nothing else, and reconstructs no class at all.
|
|
20
|
+
* Reading with it is the narrower trust boundary, and the price is stated
|
|
21
|
+
* below: it stores the JSON projection of a value, not the value.
|
|
22
|
+
*
|
|
23
|
+
* `dumpsTyped` accepts any value `JSON.stringify` can represent and refuses the
|
|
24
|
+
* rest. A value it cannot represent — `undefined`, a function, a symbol —
|
|
25
|
+
* stringifies to `undefined` and would be stored as **zero bytes**, which reads
|
|
26
|
+
* back as a parse error; a circular structure or a `BigInt` makes it throw. Both
|
|
27
|
+
* are reported as `VALIDATION` naming `value`, at the write, rather than
|
|
28
|
+
* as an unreadable row later — with the refusal attached as `cause` and never
|
|
29
|
+
* quoted into the message, which for a circular structure names the caller's
|
|
30
|
+
* own properties and classes.
|
|
31
|
+
*
|
|
32
|
+
* What it represents, it represents as JSON, which is lossy in ways nothing
|
|
33
|
+
* records: a `Map` or `Set` stores as `{}`, an object key whose value is
|
|
34
|
+
* `undefined` is dropped and an array element is stored as `null`, `NaN` and
|
|
35
|
+
* `Infinity` store as `null`, `-0` as `0`, a `Uint8Array` as an index-keyed
|
|
36
|
+
* object and a `Date` as an ISO string. The README's *Table schema* section
|
|
37
|
+
* holds the whole table, against the checkpointer default column by column.
|
|
38
|
+
*
|
|
39
|
+
* `loadsTyped` reads only the `json` form it writes, and says
|
|
40
|
+
* so before it looks at a byte. Any other declared form is a `VALIDATION` error
|
|
41
|
+
* naming `serde`, because it says what *this* reader may rebuild and not that
|
|
42
|
+
* the payload is damaged. Bytes of that form which do not parse are
|
|
43
|
+
* `PAYLOAD_CORRUPT`, because they can never be read and the caller should
|
|
44
|
+
* report rather than retry; a `data` that is not bytes at all is a
|
|
45
|
+
* `VALIDATION` naming `data`, because that is the caller's mistake and
|
|
46
|
+
* not a row's.
|
|
47
|
+
*
|
|
48
|
+
* Frozen for the reason {@link ErrorCode} is: one object, shared by every
|
|
49
|
+
* adapter in the process that did not pass a `serde` of its own, and
|
|
50
|
+
* reachable from the package root. An assignment to `dumpsTyped` by any one
|
|
51
|
+
* consumer would silently change how every other one writes.
|
|
52
|
+
*/
|
|
53
|
+
export declare const JSON_SERDE: SerializerProtocol;
|
|
54
|
+
/**
|
|
55
|
+
* Whether stored bytes are still the form the row that holds them declares.
|
|
56
|
+
*
|
|
57
|
+
* This is the structural question behind the two ways a decode fails —
|
|
58
|
+
* `PAYLOAD_CORRUPT` for bytes no reader can decode, and the `serde` refusal for
|
|
59
|
+
* bytes *this* reader will not rebuild a value from — and it is the only one
|
|
60
|
+
* this package can answer on its own. `SerializerProtocol` offers no way to ask
|
|
61
|
+
* a serde whether it parsed the bytes before deciding not to reconstruct what
|
|
62
|
+
* they name, and the refusal it throws is a caller's object: its class, its
|
|
63
|
+
* fields and its prose are all whatever that caller chose. Classifying a
|
|
64
|
+
* payload by any of those would make the code mean "a third party said so",
|
|
65
|
+
* which is exactly what neither code may mean.
|
|
66
|
+
*
|
|
67
|
+
* Accepts: `serdeType` — the type stamped on the row, as the descriptor carries
|
|
68
|
+
* it. `bytes` — what the row stored, already decompressed.
|
|
69
|
+
*
|
|
70
|
+
* Returns: whether the bytes still parse as the declared form. A type this
|
|
71
|
+
* package has no grammar for is taken at its word and answers `true`, so its
|
|
72
|
+
* serde's refusal is reported rather than written off: dropping a payload this
|
|
73
|
+
* reader merely cannot check would lose data on nothing but its own ignorance.
|
|
74
|
+
*
|
|
75
|
+
* Throws: **nothing**, for any bytes. It is called from inside the `catch` that
|
|
76
|
+
* is classifying a decode failure, where a throw would replace the failure
|
|
77
|
+
* being reported — and the value it is handed came off a row, so it may be
|
|
78
|
+
* anything that row's writer stored.
|
|
79
|
+
*/
|
|
80
|
+
export declare function bytesHoldDeclaredForm(serdeType: string, bytes: Uint8Array): boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSON_SERDE = void 0;
|
|
4
|
+
exports.bytesHoldDeclaredForm = bytesHoldDeclaredForm;
|
|
5
|
+
const base_error_js_1 = require("../errors/base-error.js");
|
|
6
|
+
const error_code_js_1 = require("../errors/error-code.js");
|
|
7
|
+
const errors_js_1 = require("../errors/errors.js");
|
|
8
|
+
const truncate_js_1 = require("../logging/truncate.js");
|
|
9
|
+
exports.JSON_SERDE = {
|
|
10
|
+
async dumpsTyped(value) {
|
|
11
|
+
let text;
|
|
12
|
+
try {
|
|
13
|
+
text = JSON.stringify(value);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
throw (0, errors_js_1.validationError)('value cannot be serialized as JSON — a circular structure, or a value JSON has no ' +
|
|
17
|
+
'encoding for such as a BigInt; the refusal itself is attached as `cause`', 'value', (0, base_error_js_1.toError)(error));
|
|
18
|
+
}
|
|
19
|
+
if (text === undefined) {
|
|
20
|
+
throw (0, errors_js_1.validationError)('value has no JSON representation (undefined, a function or a symbol), so it cannot be ' +
|
|
21
|
+
'stored; store null instead to record an absent value', 'value');
|
|
22
|
+
}
|
|
23
|
+
return Promise.resolve([JSON_SERDE_TYPE, new TextEncoder().encode(text)]);
|
|
24
|
+
},
|
|
25
|
+
async loadsTyped(type, data) {
|
|
26
|
+
if (type !== JSON_SERDE_TYPE) {
|
|
27
|
+
throw (0, errors_js_1.validationError)(`this serializer reads only the \`${JSON_SERDE_TYPE}\` form it writes, and this payload ` +
|
|
28
|
+
`declares ${(0, truncate_js_1.truncateForLog)(String(JSON.stringify(type)))}; read the row with the ` +
|
|
29
|
+
'serializer that wrote it, or rewrite the row', 'serde');
|
|
30
|
+
}
|
|
31
|
+
let text;
|
|
32
|
+
try {
|
|
33
|
+
text = typeof data === 'string' ? data : new TextDecoder().decode(data);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw (0, errors_js_1.validationError)('data must be the bytes or text this serializer wrote, as a Uint8Array or a string', 'data', error);
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return Promise.resolve(JSON.parse(text));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw new base_error_js_1.DynamoDBLangGraphError('the stored payload is not the JSON this serializer wrote, so it cannot be decoded', error_code_js_1.ErrorCode.PAYLOAD_CORRUPT, {}, error);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
Object.freeze(exports.JSON_SERDE);
|
|
47
|
+
const JSON_SERDE_TYPE = 'json';
|
|
48
|
+
function bytesHoldDeclaredForm(serdeType, bytes) {
|
|
49
|
+
if (serdeType !== JSON_SERDE_TYPE)
|
|
50
|
+
return true;
|
|
51
|
+
try {
|
|
52
|
+
JSON.parse(new TextDecoder().decode(bytes));
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides the S3 SDK's own types from this package's declarations.
|
|
3
|
+
*
|
|
4
|
+
* The S3 client, its config and a command are described by the members this
|
|
5
|
+
* package touches, so no shipped declaration imports the optional
|
|
6
|
+
* `@aws-sdk/client-s3` peer and a caller without it installed still compiles
|
|
7
|
+
* (record 1). A real `S3Client` or `S3ClientConfig` satisfies these shapes as
|
|
8
|
+
* it is, so a caller who has the SDK passes its own values unchanged.
|
|
9
|
+
*/
|
|
1
10
|
/** A region as the SDK accepts it: a string or a provider resolving to one. */
|
|
2
11
|
export type S3RegionLike = string | (() => Promise<string>);
|
|
3
12
|
/** A value an S3 client option can hold. */
|
|
@@ -18,10 +27,20 @@ export interface S3ClientOptions {
|
|
|
18
27
|
* variable is accepted as it is.
|
|
19
28
|
*/
|
|
20
29
|
export type S3ClientConfigLike = S3ClientOptions | object;
|
|
21
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The options of a config, read through the structural type.
|
|
32
|
+
*
|
|
33
|
+
* Accepts: a config as the caller gave it, or nothing.
|
|
34
|
+
*
|
|
35
|
+
* Returns: the same object seen as {@link S3ClientOptions} so `region` and
|
|
36
|
+
* `maxAttempts` can be read; an absent config reads as empty rather than
|
|
37
|
+
* needing a guard at every call site.
|
|
38
|
+
*
|
|
39
|
+
* Throws: nothing.
|
|
40
|
+
*/
|
|
22
41
|
export declare function s3ClientOptions(config: S3ClientConfigLike | undefined): S3ClientOptions;
|
|
23
42
|
/** What every SDK command object carries: its `input`. */
|
|
24
|
-
|
|
43
|
+
interface S3CommandLike {
|
|
25
44
|
input: object;
|
|
26
45
|
}
|
|
27
46
|
/**
|
|
@@ -32,3 +51,4 @@ export interface S3ClientLike {
|
|
|
32
51
|
send(command: S3CommandLike, options?: object): Promise<object>;
|
|
33
52
|
destroy(): void;
|
|
34
53
|
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides that the S3 SDK is loaded on first use, and how its client is set up.
|
|
3
|
+
*
|
|
4
|
+
* An adapter without offload never imports the optional peer; the first
|
|
5
|
+
* offload does, once, and a missing install surfaces as `VALIDATION` naming
|
|
6
|
+
* the remedy (record 1). The client built here defaults to no retries of its
|
|
7
|
+
* own — `maxAttempts: 1` — so this package's retry is the only layer unless a
|
|
8
|
+
* caller's own `maxAttempts` overrides it (record 14), and its idle timer
|
|
9
|
+
* bounds a stalled transfer without bounding a slow one.
|
|
10
|
+
*/
|
|
11
|
+
import type { S3Client } from '@aws-sdk/client-s3';
|
|
12
|
+
import { type S3ClientConfigLike, type S3ClientOptions } from './client-types.js';
|
|
13
|
+
type S3Sdk = typeof import('@aws-sdk/client-s3');
|
|
14
|
+
/**
|
|
15
|
+
* The optional `@aws-sdk/client-s3` peer, imported on first use.
|
|
16
|
+
*
|
|
17
|
+
* Accepts: nothing. Concurrent callers share one import.
|
|
18
|
+
*
|
|
19
|
+
* Returns: the module, cached for every later call.
|
|
20
|
+
*
|
|
21
|
+
* Throws: `VALIDATION` naming `s3` when the package is not installed,
|
|
22
|
+
* carrying the install command; any other import failure — a broken build, a
|
|
23
|
+
* syntax error inside the package — passes through unchanged. A failure is not
|
|
24
|
+
* cached, so an install or a fixed bundle succeeds on a later call. Each
|
|
25
|
+
* concurrent caller of a failed import gets its own error instance
|
|
26
|
+
* (`copyForCaller`), so the public boundary stamping one's `context.operation`
|
|
27
|
+
* cannot leave it sitting in another caller's error too.
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadS3Sdk(): Promise<S3Sdk>;
|
|
30
|
+
/**
|
|
31
|
+
* `config` with the two defaults every S3 client of this library is built
|
|
32
|
+
* with, whichever constructor builds it.
|
|
33
|
+
*
|
|
34
|
+
* Accepts: `config` — the caller's `s3.clientConfig`, or an empty object.
|
|
35
|
+
*
|
|
36
|
+
* Returns: a copy whose `maxAttempts` and `requestHandler` are the caller's
|
|
37
|
+
* own where it gave one and the default where it did not. A key named with
|
|
38
|
+
* `undefined` — a config assembled from settings that were not all set — gave
|
|
39
|
+
* none, and keeps the default.
|
|
40
|
+
*
|
|
41
|
+
* Throws: nothing.
|
|
42
|
+
*
|
|
43
|
+
* Guarantees: `maxAttempts` defaults to 1, so the SDK performs no retries of
|
|
44
|
+
* its own and this library's retry, backoff and classification are the only
|
|
45
|
+
* retry layer — the same default `resolveDynamoDBClient` applies on the
|
|
46
|
+
* DynamoDB side. A default request handler bounds a transfer that has
|
|
47
|
+
* stalled, which `maxAttempts` alone does not; a `requestHandler` in `config`
|
|
48
|
+
* replaces it whole rather than merging with it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function withS3ClientDefaults(config: S3ClientConfigLike): S3ClientOptions;
|
|
51
|
+
/**
|
|
52
|
+
* An `S3Client` built from `config` with the lazily-loaded SDK.
|
|
53
|
+
*
|
|
54
|
+
* Accepts: `config` — any `S3ClientConfig`; an explicit `maxAttempts` or
|
|
55
|
+
* `requestHandler` wins over the defaults {@link withS3ClientDefaults} fills
|
|
56
|
+
* in.
|
|
57
|
+
*
|
|
58
|
+
* Returns: the client. The caller owns it and destroys it.
|
|
59
|
+
*
|
|
60
|
+
* Throws: whatever {@link loadS3Sdk} throws.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createDefaultS3Client(config: S3ClientConfigLike): Promise<S3Client>;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadS3Sdk = loadS3Sdk;
|
|
37
|
+
exports.withS3ClientDefaults = withS3ClientDefaults;
|
|
38
|
+
exports.createDefaultS3Client = createDefaultS3Client;
|
|
39
|
+
const client_js_1 = require("../../dynamodb/client.js");
|
|
40
|
+
const base_error_js_1 = require("../../errors/base-error.js");
|
|
41
|
+
const errors_js_1 = require("../../errors/errors.js");
|
|
42
|
+
const client_types_js_1 = require("./client-types.js");
|
|
43
|
+
const MISSING_MODULE_CODES = ['ERR_MODULE_NOT_FOUND', 'MODULE_NOT_FOUND'];
|
|
44
|
+
let sdkPromise;
|
|
45
|
+
function wrapMissingPeer(error) {
|
|
46
|
+
const code = error.code;
|
|
47
|
+
if (code !== undefined && MISSING_MODULE_CODES.includes(code)) {
|
|
48
|
+
throw (0, errors_js_1.validationError)('S3 offload requires the optional peer @aws-sdk/client-s3 (npm install @aws-sdk/client-s3); ' +
|
|
49
|
+
'bundlers must keep it installed or external', 's3', error);
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
async function loadS3Sdk() {
|
|
54
|
+
if (!sdkPromise) {
|
|
55
|
+
sdkPromise = Promise.resolve().then(() => __importStar(require('@aws-sdk/client-s3'))).catch((error) => {
|
|
56
|
+
sdkPromise = undefined;
|
|
57
|
+
return wrapMissingPeer(error);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return await sdkPromise;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw (0, base_error_js_1.copyForCaller)(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function withS3ClientDefaults(config) {
|
|
68
|
+
const options = (0, client_types_js_1.s3ClientOptions)(config);
|
|
69
|
+
return {
|
|
70
|
+
...options,
|
|
71
|
+
maxAttempts: options.maxAttempts ?? 1,
|
|
72
|
+
requestHandler: options.requestHandler ?? { socketTimeout: client_js_1.DEFAULT_SOCKET_TIMEOUT_MS },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async function createDefaultS3Client(config) {
|
|
76
|
+
const { S3Client: S3ClientCtor } = await loadS3Sdk();
|
|
77
|
+
return new S3ClientCtor(withS3ClientDefaults(config));
|
|
78
|
+
}
|