@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,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compress = compress;
|
|
4
|
-
exports.decompress = decompress;
|
|
5
|
-
const node_util_1 = require("node:util");
|
|
6
|
-
const node_zlib_1 = require("node:zlib");
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const base_error_1 = require("../errors/base-error");
|
|
9
|
-
const error_code_1 = require("../errors/error-code");
|
|
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
|
-
/** Minimum fraction of the original size the gzip output must beat to be kept. */
|
|
13
|
-
const COMPRESSION_GAIN_RATIO = 0.9;
|
|
14
|
-
/**
|
|
15
|
-
* Gzip `data` when it is at least `minSizeBytes` and compression actually saves
|
|
16
|
-
* space. Returns the bytes to store and a `compressed` flag the caller records
|
|
17
|
-
* in the payload descriptor; compression is never inferred from the bytes.
|
|
18
|
-
*/
|
|
19
|
-
async function compress(data, config) {
|
|
20
|
-
const minSize = config.minSizeBytes ?? constants_1.DEFAULT_COMPRESSION_MIN_BYTES;
|
|
21
|
-
if (!config.enabled || data.length < minSize)
|
|
22
|
-
return { bytes: data, compressed: false };
|
|
23
|
-
const level = config.level ?? constants_1.DEFAULT_COMPRESSION_LEVEL;
|
|
24
|
-
const gzipped = new Uint8Array(await gzipAsync(data, { level }));
|
|
25
|
-
if (gzipped.length >= data.length * COMPRESSION_GAIN_RATIO) {
|
|
26
|
-
return { bytes: data, compressed: false };
|
|
27
|
-
}
|
|
28
|
-
return { bytes: gzipped, compressed: true };
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Gunzip `data` when `compressed` is true; otherwise return it unchanged. Throws
|
|
32
|
-
* a {@link DynamoDBLangGraphError} with code `COMPRESSION_LIMIT` if the output
|
|
33
|
-
* would exceed `maxBytes` (bomb guard).
|
|
34
|
-
*/
|
|
35
|
-
async function decompress(data, compressed, maxBytes = constants_1.DEFAULT_MAX_DECOMPRESSED_BYTES) {
|
|
36
|
-
if (!compressed)
|
|
37
|
-
return data;
|
|
38
|
-
try {
|
|
39
|
-
return new Uint8Array(await gunzipAsync(data, { maxOutputLength: maxBytes }));
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
const err = error;
|
|
43
|
-
if (err.code === 'ERR_BUFFER_TOO_LARGE') {
|
|
44
|
-
throw new base_error_1.DynamoDBLangGraphError(`Refusing to decompress: output would exceed ${maxBytes} bytes`, error_code_1.ErrorCode.COMPRESSION_LIMIT, {}, error);
|
|
45
|
-
}
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PayloadLocation } from './codec';
|
|
2
|
-
/**
|
|
3
|
-
* The part of a descriptor cleanup needs: where the payload lives and, for S3,
|
|
4
|
-
* its key. A full `PayloadDescriptor` satisfies it, and so does the projection
|
|
5
|
-
* a pre-write read returns without the inline bytes.
|
|
6
|
-
*/
|
|
7
|
-
export interface DescriptorRef {
|
|
8
|
-
location: PayloadLocation;
|
|
9
|
-
s3Key?: string;
|
|
10
|
-
}
|
|
11
|
-
/** Collect the S3 keys of any offloaded descriptors, for orphan cleanup. */
|
|
12
|
-
export declare function collectS3Keys(descriptors: readonly DescriptorRef[]): string[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectS3Keys = collectS3Keys;
|
|
4
|
-
const codec_1 = require("./codec");
|
|
5
|
-
/** Collect the S3 keys of any offloaded descriptors, for orphan cleanup. */
|
|
6
|
-
function collectS3Keys(descriptors) {
|
|
7
|
-
const keys = [];
|
|
8
|
-
for (const descriptor of descriptors) {
|
|
9
|
-
if (descriptor.location === codec_1.PayloadLocation.S3 && descriptor.s3Key !== undefined) {
|
|
10
|
-
keys.push(descriptor.s3Key);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return keys;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type CodecDeps, type PayloadDescriptor } from './codec';
|
|
2
|
-
/** Options controlling where an offloaded payload's S3 key is built from. */
|
|
3
|
-
export interface EncodeOptions {
|
|
4
|
-
keyParts: readonly string[];
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Encode `value`: serialize via serde, compress (if configured), then offload
|
|
8
|
-
* to S3 when the compressed bytes exceed the offloader's threshold. Returns a
|
|
9
|
-
* descriptor recording how to read it back. Without an offloader, bytes that
|
|
10
|
-
* cannot fit a DynamoDB item are rejected here (see
|
|
11
|
-
* {@link assertInlinePayloadFits}).
|
|
12
|
-
*/
|
|
13
|
-
export declare function encodePayload<T>(value: T, deps: CodecDeps, options: EncodeOptions): Promise<PayloadDescriptor>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodePayload = encodePayload;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
const errors_1 = require("../errors/errors");
|
|
6
|
-
const codec_1 = require("./codec");
|
|
7
|
-
const compression_1 = require("./compression");
|
|
8
|
-
/**
|
|
9
|
-
* Reject bytes that cannot be stored inline. Without an offloader the only
|
|
10
|
-
* alternative is a raw `ValidationException` from DynamoDB after the network
|
|
11
|
-
* round trip, which names neither the cause nor the remedy.
|
|
12
|
-
*/
|
|
13
|
-
function assertInlinePayloadFits(bytes, deps) {
|
|
14
|
-
if (bytes.length <= constants_1.MAX_INLINE_PAYLOAD_BYTES)
|
|
15
|
-
return;
|
|
16
|
-
const hint = deps.compression?.enabled
|
|
17
|
-
? ''
|
|
18
|
-
: ', or enable compression if the data compresses well';
|
|
19
|
-
throw new errors_1.ValidationError(`payload of ${bytes.length} bytes exceeds the ${constants_1.MAX_INLINE_PAYLOAD_BYTES}-byte inline limit ` +
|
|
20
|
-
`(DynamoDB items are capped at 400 KB); configure s3 offloading${hint}`, 'payload');
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Encode `value`: serialize via serde, compress (if configured), then offload
|
|
24
|
-
* to S3 when the compressed bytes exceed the offloader's threshold. Returns a
|
|
25
|
-
* descriptor recording how to read it back. Without an offloader, bytes that
|
|
26
|
-
* cannot fit a DynamoDB item are rejected here (see
|
|
27
|
-
* {@link assertInlinePayloadFits}).
|
|
28
|
-
*/
|
|
29
|
-
async function encodePayload(value, deps, options) {
|
|
30
|
-
const [serdeType, raw] = await deps.serde.dumpsTyped(value);
|
|
31
|
-
const { bytes, compressed } = deps.compression
|
|
32
|
-
? await (0, compression_1.compress)(raw, deps.compression)
|
|
33
|
-
: { bytes: raw, compressed: false };
|
|
34
|
-
const base = { schemaVersion: codec_1.DESCRIPTOR_SCHEMA_VERSION, serdeType, compressed };
|
|
35
|
-
if (deps.offloader && deps.offloader.shouldOffload(bytes)) {
|
|
36
|
-
const s3Key = deps.offloader.buildKey(options.keyParts);
|
|
37
|
-
await deps.offloader.upload(s3Key, bytes);
|
|
38
|
-
return { ...base, location: codec_1.PayloadLocation.S3, s3Key };
|
|
39
|
-
}
|
|
40
|
-
if (!deps.offloader)
|
|
41
|
-
assertInlinePayloadFits(bytes, deps);
|
|
42
|
-
return { ...base, location: codec_1.PayloadLocation.INLINE, bytes };
|
|
43
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SerializerProtocol } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
/**
|
|
3
|
-
* A minimal JSON serializer implementing LangGraph's {@link SerializerProtocol},
|
|
4
|
-
* used by adapters (the store, history) that persist plain JSON values through
|
|
5
|
-
* the shared payload codec.
|
|
6
|
-
*/
|
|
7
|
-
export declare const JSON_SERDE: SerializerProtocol;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSON_SERDE = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A minimal JSON serializer implementing LangGraph's {@link SerializerProtocol},
|
|
6
|
-
* used by adapters (the store, history) that persist plain JSON values through
|
|
7
|
-
* the shared payload codec.
|
|
8
|
-
*/
|
|
9
|
-
exports.JSON_SERDE = {
|
|
10
|
-
async dumpsTyped(value) {
|
|
11
|
-
return ['json', new TextEncoder().encode(JSON.stringify(value))];
|
|
12
|
-
},
|
|
13
|
-
async loadsTyped(_type, data) {
|
|
14
|
-
const text = typeof data === 'string' ? data : new TextDecoder().decode(data);
|
|
15
|
-
return JSON.parse(text);
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* True when an offloaded object no longer exists — a lifecycle sweep removed
|
|
3
|
-
* it, or a competing overwrite deleted it between a row read and the download.
|
|
4
|
-
*/
|
|
5
|
-
export declare function isMissingObjectError(error: Error): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* True when a payload can never be read again — its object is gone, it trips
|
|
8
|
-
* the decompression guard, or its key lies outside the row's own path — as
|
|
9
|
-
* opposed to a failure that may succeed on retry or after a configuration fix
|
|
10
|
-
* (throttling, network, permissions).
|
|
11
|
-
*/
|
|
12
|
-
export declare function isPermanentPayloadLoss(error: Error): boolean;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMissingObjectError = isMissingObjectError;
|
|
4
|
-
exports.isPermanentPayloadLoss = isPermanentPayloadLoss;
|
|
5
|
-
const error_code_1 = require("../errors/error-code");
|
|
6
|
-
/**
|
|
7
|
-
* True when an offloaded object no longer exists — a lifecycle sweep removed
|
|
8
|
-
* it, or a competing overwrite deleted it between a row read and the download.
|
|
9
|
-
*/
|
|
10
|
-
function isMissingObjectError(error) {
|
|
11
|
-
const coded = error;
|
|
12
|
-
return coded.code === error_code_1.ErrorCode.S3_OFFLOAD_FAILED && coded.cause?.name === 'NoSuchKey';
|
|
13
|
-
}
|
|
14
|
-
/** Validation fields that condemn the row itself rather than the caller's input. */
|
|
15
|
-
const ROW_REJECTION_FIELDS = ['s3Key', 'descriptor'];
|
|
16
|
-
/**
|
|
17
|
-
* True when a row's descriptor can never be read by this adapter: its key lies
|
|
18
|
-
* outside the S3 path its own identifiers allow (see `assertKeyInScope`), or
|
|
19
|
-
* its shape is one this version does not understand.
|
|
20
|
-
*/
|
|
21
|
-
function isRowRejection(error) {
|
|
22
|
-
const coded = error;
|
|
23
|
-
return (coded.code === error_code_1.ErrorCode.VALIDATION &&
|
|
24
|
-
coded.context?.field !== undefined &&
|
|
25
|
-
ROW_REJECTION_FIELDS.includes(coded.context.field));
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* True when a payload can never be read again — its object is gone, it trips
|
|
29
|
-
* the decompression guard, or its key lies outside the row's own path — as
|
|
30
|
-
* opposed to a failure that may succeed on retry or after a configuration fix
|
|
31
|
-
* (throttling, network, permissions).
|
|
32
|
-
*/
|
|
33
|
-
function isPermanentPayloadLoss(error) {
|
|
34
|
-
const coded = error;
|
|
35
|
-
return (coded.code === error_code_1.ErrorCode.COMPRESSION_LIMIT ||
|
|
36
|
-
isMissingObjectError(error) ||
|
|
37
|
-
isRowRejection(error));
|
|
38
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import { type S3OffloadConfig } from './config';
|
|
3
|
-
/** The adapters that share one bucket, each under its own default key prefix. */
|
|
4
|
-
export type AdapterName = 'checkpointer' | 'store' | 'history';
|
|
5
|
-
/**
|
|
6
|
-
* Resolve an adapter's `s3` option into the offloader's configuration: the
|
|
7
|
-
* adapter-scoped default key prefix when none is given, and the DynamoDB
|
|
8
|
-
* client's region when the S3 client config names none. The S3 SDK does not
|
|
9
|
-
* follow region redirects by default, so a bucket reachable only through the
|
|
10
|
-
* region the DynamoDB side was configured with used to fail with an opaque
|
|
11
|
-
* `PermanentRedirect` on the first offload.
|
|
12
|
-
*/
|
|
13
|
-
export declare function offloaderConfigFor(s3: S3OffloadConfig, adapter: AdapterName, clientConfig?: DynamoDBClientConfig): S3OffloadConfig;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.offloaderConfigFor = offloaderConfigFor;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
const client_types_1 = require("./client-types");
|
|
6
|
-
const config_1 = require("./config");
|
|
7
|
-
/**
|
|
8
|
-
* Resolve an adapter's `s3` option into the offloader's configuration: the
|
|
9
|
-
* adapter-scoped default key prefix when none is given, and the DynamoDB
|
|
10
|
-
* client's region when the S3 client config names none. The S3 SDK does not
|
|
11
|
-
* follow region redirects by default, so a bucket reachable only through the
|
|
12
|
-
* region the DynamoDB side was configured with used to fail with an opaque
|
|
13
|
-
* `PermanentRedirect` on the first offload.
|
|
14
|
-
*/
|
|
15
|
-
function offloaderConfigFor(s3, adapter, clientConfig) {
|
|
16
|
-
const region = (0, client_types_1.s3ClientOptions)(s3.clientConfig).region ?? clientConfig?.region;
|
|
17
|
-
return {
|
|
18
|
-
...s3,
|
|
19
|
-
keyPrefix: s3.keyPrefix ?? (0, config_1.defaultAdapterKeyPrefix)(constants_1.DEFAULT_S3_KEY_PREFIX, adapter),
|
|
20
|
-
...(region === undefined ? {} : { clientConfig: { ...s3.clientConfig, region } }),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DynamoDBLangGraphError } from '../../errors/base-error';
|
|
2
|
-
/** The part of an S3 `GetObject` body this module relies on. */
|
|
3
|
-
export interface S3Body {
|
|
4
|
-
transformToByteArray(): Promise<Uint8Array>;
|
|
5
|
-
}
|
|
6
|
-
/** The typed error for an object over the download cap. */
|
|
7
|
-
export declare function oversizedObjectError(key: string, bytes: number, maxBytes: number): DynamoDBLangGraphError;
|
|
8
|
-
/**
|
|
9
|
-
* Buffer an S3 body without ever holding more than `maxBytes` of it. A
|
|
10
|
-
* streaming body is consumed chunk by chunk and abandoned the moment the
|
|
11
|
-
* running total passes the cap; a body that only offers
|
|
12
|
-
* `transformToByteArray()` is read whole and then checked.
|
|
13
|
-
*/
|
|
14
|
-
export declare function readBodyBounded(body: S3Body, key: string, maxBytes: number): Promise<Uint8Array>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oversizedObjectError = oversizedObjectError;
|
|
4
|
-
exports.readBodyBounded = readBodyBounded;
|
|
5
|
-
const base_error_1 = require("../../errors/base-error");
|
|
6
|
-
const error_code_1 = require("../../errors/error-code");
|
|
7
|
-
/** The typed error for an object over the download cap. */
|
|
8
|
-
function oversizedObjectError(key, bytes, maxBytes) {
|
|
9
|
-
return new base_error_1.DynamoDBLangGraphError(`S3 object ${key} exceeds the ${maxBytes}-byte maxDownloadBytes cap ` +
|
|
10
|
-
`(${bytes} bytes declared or read)`, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'download', key });
|
|
11
|
-
}
|
|
12
|
-
function concat(chunks, total) {
|
|
13
|
-
const out = new Uint8Array(total);
|
|
14
|
-
let offset = 0;
|
|
15
|
-
for (const chunk of chunks) {
|
|
16
|
-
out.set(chunk, offset);
|
|
17
|
-
offset += chunk.length;
|
|
18
|
-
}
|
|
19
|
-
return out;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Buffer an S3 body without ever holding more than `maxBytes` of it. A
|
|
23
|
-
* streaming body is consumed chunk by chunk and abandoned the moment the
|
|
24
|
-
* running total passes the cap; a body that only offers
|
|
25
|
-
* `transformToByteArray()` is read whole and then checked.
|
|
26
|
-
*/
|
|
27
|
-
async function readBodyBounded(body, key, maxBytes) {
|
|
28
|
-
const streaming = body;
|
|
29
|
-
const iterate = streaming[Symbol.asyncIterator];
|
|
30
|
-
if (typeof iterate !== 'function') {
|
|
31
|
-
const whole = new Uint8Array(await body.transformToByteArray());
|
|
32
|
-
if (whole.length > maxBytes)
|
|
33
|
-
throw oversizedObjectError(key, whole.length, maxBytes);
|
|
34
|
-
return whole;
|
|
35
|
-
}
|
|
36
|
-
const chunks = [];
|
|
37
|
-
let total = 0;
|
|
38
|
-
for await (const chunk of { [Symbol.asyncIterator]: iterate.bind(streaming) }) {
|
|
39
|
-
total += chunk.length;
|
|
40
|
-
if (total > maxBytes) {
|
|
41
|
-
streaming.destroy?.();
|
|
42
|
-
throw oversizedObjectError(key, total, maxBytes);
|
|
43
|
-
}
|
|
44
|
-
chunks.push(chunk);
|
|
45
|
-
}
|
|
46
|
-
return concat(chunks, total);
|
|
47
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
-
import type { S3ClientConfigLike } from './client-types';
|
|
3
|
-
type S3Sdk = typeof import('@aws-sdk/client-s3');
|
|
4
|
-
/**
|
|
5
|
-
* Lazily import the optional `@aws-sdk/client-s3` peer, caching the module. A
|
|
6
|
-
* failed import is not cached, so an install or a fixed bundle can succeed on
|
|
7
|
-
* a later call.
|
|
8
|
-
*/
|
|
9
|
-
export declare function loadS3Sdk(): Promise<S3Sdk>;
|
|
10
|
-
/**
|
|
11
|
-
* Construct an `S3Client` from `config` using the lazily-loaded SDK. Defaults
|
|
12
|
-
* `maxAttempts: 1` so the SDK's own internal retries are disabled and this
|
|
13
|
-
* library's retry/backoff/classification system is the sole retry layer,
|
|
14
|
-
* matching {@link resolveDynamoDBClient}'s equivalent default; an explicit
|
|
15
|
-
* `maxAttempts` in `config` still wins.
|
|
16
|
-
*/
|
|
17
|
-
export declare function createDefaultS3Client(config: S3ClientConfigLike): Promise<S3Client>;
|
|
18
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadS3Sdk = loadS3Sdk;
|
|
4
|
-
exports.createDefaultS3Client = createDefaultS3Client;
|
|
5
|
-
const errors_1 = require("../../errors/errors");
|
|
6
|
-
/** Codes Node and bundlers use for an import that cannot be resolved. */
|
|
7
|
-
const MISSING_MODULE_CODES = ['ERR_MODULE_NOT_FOUND', 'MODULE_NOT_FOUND'];
|
|
8
|
-
let sdkPromise;
|
|
9
|
-
/**
|
|
10
|
-
* Convert a failed import of the optional peer into a typed error that names
|
|
11
|
-
* the remedy. Any other failure (a broken build, a syntax error inside the
|
|
12
|
-
* package) passes through unchanged.
|
|
13
|
-
*/
|
|
14
|
-
function wrapMissingPeer(error) {
|
|
15
|
-
const code = error.code;
|
|
16
|
-
if (code !== undefined && MISSING_MODULE_CODES.includes(code)) {
|
|
17
|
-
throw new errors_1.ValidationError('S3 offload requires the optional peer @aws-sdk/client-s3 (npm install @aws-sdk/client-s3); ' +
|
|
18
|
-
'bundlers must keep it installed or external', 's3', error);
|
|
19
|
-
}
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Lazily import the optional `@aws-sdk/client-s3` peer, caching the module. A
|
|
24
|
-
* failed import is not cached, so an install or a fixed bundle can succeed on
|
|
25
|
-
* a later call.
|
|
26
|
-
*/
|
|
27
|
-
async function loadS3Sdk() {
|
|
28
|
-
if (!sdkPromise) {
|
|
29
|
-
sdkPromise = import('@aws-sdk/client-s3').catch((error) => {
|
|
30
|
-
sdkPromise = undefined;
|
|
31
|
-
return wrapMissingPeer(error);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return sdkPromise;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Construct an `S3Client` from `config` using the lazily-loaded SDK. Defaults
|
|
38
|
-
* `maxAttempts: 1` so the SDK's own internal retries are disabled and this
|
|
39
|
-
* library's retry/backoff/classification system is the sole retry layer,
|
|
40
|
-
* matching {@link resolveDynamoDBClient}'s equivalent default; an explicit
|
|
41
|
-
* `maxAttempts` in `config` still wins.
|
|
42
|
-
*/
|
|
43
|
-
async function createDefaultS3Client(config) {
|
|
44
|
-
const { S3Client: S3ClientCtor } = await loadS3Sdk();
|
|
45
|
-
return new S3ClientCtor({ maxAttempts: 1, ...config });
|
|
46
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfigLike } from './client-types';
|
|
2
|
-
/** Configuration for offloading large payloads to S3. */
|
|
3
|
-
export interface S3OffloadConfig {
|
|
4
|
-
bucketName: string;
|
|
5
|
-
keyPrefix?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Serialized payloads at or above this size are offloaded (default 350 KB).
|
|
8
|
-
* Only the payload counts: the store's inline embedding (about 10 bytes per
|
|
9
|
-
* dimension, so ~10 KB at 1024 dims and ~45 KB at 4096) lives on the same
|
|
10
|
-
* item and is not part of it, so keep `thresholdBytes` plus the embedding
|
|
11
|
-
* under DynamoDB's 400 KB item limit or the put fails with a raw
|
|
12
|
-
* `ValidationException`.
|
|
13
|
-
*/
|
|
14
|
-
thresholdBytes?: number;
|
|
15
|
-
serverSideEncryption?: string;
|
|
16
|
-
sseKmsKeyId?: string;
|
|
17
|
-
/** Largest object this adapter will buffer from S3 (default 50 MiB). */
|
|
18
|
-
maxDownloadBytes?: number;
|
|
19
|
-
/**
|
|
20
|
-
* S3 client configuration (an `S3ClientConfig`). `region` defaults to the
|
|
21
|
-
* adapter's DynamoDB region.
|
|
22
|
-
*/
|
|
23
|
-
clientConfig?: S3ClientConfigLike;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Build a fully-qualified S3 key: `${prefix}${parts, each base64url-encoded,
|
|
27
|
-
* joined with '/'}.bin`. Encoding (not rejecting) is what makes two distinct
|
|
28
|
-
* `parts` arrays never collide, since a namespace element or key is allowed
|
|
29
|
-
* to contain '/' (only the DynamoDB '#' separator is forbidden at the
|
|
30
|
-
* validation layer) and base64url's output alphabet never contains '/'.
|
|
31
|
-
*
|
|
32
|
-
* The produced key is checked against S3's 1024-byte object-key cap: the
|
|
33
|
-
* encoding grows every part by a third, so identifiers that each pass their
|
|
34
|
-
* own length rule can still compose a key S3 would reject with a raw error.
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildS3Key(prefix: string, parts: readonly string[]): string;
|
|
37
|
-
/**
|
|
38
|
-
* The key prefix doubles as the S3 lifecycle rule's `Filter.Prefix`. An empty
|
|
39
|
-
* or root prefix would make that rule expire the whole bucket, and a prefix
|
|
40
|
-
* without a trailing `/` (`app/langgraph`) would also match every sibling
|
|
41
|
-
* object that merely starts with the same characters (`app/langgraph-other/`).
|
|
42
|
-
*/
|
|
43
|
-
export declare function assertScopedKeyPrefix(keyPrefix: string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Build a deterministic, TTL-independent lifecycle rule id from the prefix.
|
|
46
|
-
* Trailing slashes are trimmed with a loop rather than `/\/+$/`, whose
|
|
47
|
-
* backtracking is quadratic in the number of slashes.
|
|
48
|
-
*/
|
|
49
|
-
export declare function buildLifecycleRuleId(prefix: string): string;
|
|
50
|
-
/** An adapter's default S3 key prefix: the shared base plus its own segment. */
|
|
51
|
-
export declare function defaultAdapterKeyPrefix(base: string, adapter: string): string;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildS3Key = buildS3Key;
|
|
4
|
-
exports.assertScopedKeyPrefix = assertScopedKeyPrefix;
|
|
5
|
-
exports.buildLifecycleRuleId = buildLifecycleRuleId;
|
|
6
|
-
exports.defaultAdapterKeyPrefix = defaultAdapterKeyPrefix;
|
|
7
|
-
const constants_1 = require("../../constants");
|
|
8
|
-
const errors_1 = require("../../errors/errors");
|
|
9
|
-
const key_scope_1 = require("./key-scope");
|
|
10
|
-
/**
|
|
11
|
-
* Build a fully-qualified S3 key: `${prefix}${parts, each base64url-encoded,
|
|
12
|
-
* joined with '/'}.bin`. Encoding (not rejecting) is what makes two distinct
|
|
13
|
-
* `parts` arrays never collide, since a namespace element or key is allowed
|
|
14
|
-
* to contain '/' (only the DynamoDB '#' separator is forbidden at the
|
|
15
|
-
* validation layer) and base64url's output alphabet never contains '/'.
|
|
16
|
-
*
|
|
17
|
-
* The produced key is checked against S3's 1024-byte object-key cap: the
|
|
18
|
-
* encoding grows every part by a third, so identifiers that each pass their
|
|
19
|
-
* own length rule can still compose a key S3 would reject with a raw error.
|
|
20
|
-
*/
|
|
21
|
-
function buildS3Key(prefix, parts) {
|
|
22
|
-
const encoded = parts.map(key_scope_1.encodeKeyPart);
|
|
23
|
-
const key = `${prefix}${encoded.join('/')}.bin`;
|
|
24
|
-
const bytes = Buffer.byteLength(key, 'utf8');
|
|
25
|
-
if (bytes > constants_1.MAX_S3_KEY_BYTES) {
|
|
26
|
-
throw new errors_1.ValidationError(`the offloaded S3 object key would be ${bytes} bytes; S3 caps keys at ` +
|
|
27
|
-
`${constants_1.MAX_S3_KEY_BYTES} — shorten the identifiers or the keyPrefix`, 's3Key');
|
|
28
|
-
}
|
|
29
|
-
return key;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The key prefix doubles as the S3 lifecycle rule's `Filter.Prefix`. An empty
|
|
33
|
-
* or root prefix would make that rule expire the whole bucket, and a prefix
|
|
34
|
-
* without a trailing `/` (`app/langgraph`) would also match every sibling
|
|
35
|
-
* object that merely starts with the same characters (`app/langgraph-other/`).
|
|
36
|
-
*/
|
|
37
|
-
function assertScopedKeyPrefix(keyPrefix) {
|
|
38
|
-
if (keyPrefix === '' || keyPrefix === '/' || !keyPrefix.endsWith('/')) {
|
|
39
|
-
throw new errors_1.ValidationError('s3.keyPrefix must be a non-empty path that ends with "/" (for example "langgraph/"): ' +
|
|
40
|
-
'it scopes both the offloaded objects and the S3 lifecycle rule', 's3.keyPrefix');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Build a deterministic, TTL-independent lifecycle rule id from the prefix.
|
|
45
|
-
* Trailing slashes are trimmed with a loop rather than `/\/+$/`, whose
|
|
46
|
-
* backtracking is quadratic in the number of slashes.
|
|
47
|
-
*/
|
|
48
|
-
function buildLifecycleRuleId(prefix) {
|
|
49
|
-
let trimmed = prefix;
|
|
50
|
-
while (trimmed.endsWith('/'))
|
|
51
|
-
trimmed = trimmed.slice(0, -1);
|
|
52
|
-
const slug = trimmed.replace(/[^a-zA-Z0-9-]/g, '-') || 'default';
|
|
53
|
-
return `langgraph-ttl-${slug}`;
|
|
54
|
-
}
|
|
55
|
-
/** An adapter's default S3 key prefix: the shared base plus its own segment. */
|
|
56
|
-
function defaultAdapterKeyPrefix(base, adapter) {
|
|
57
|
-
return `${base}${adapter}/`;
|
|
58
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
-
/**
|
|
3
|
-
* Delete `keys` from `bucket` in chunks of 1000 (the DeleteObjects limit).
|
|
4
|
-
* Returns the keys S3 reported as failed — never throws on per-key errors so
|
|
5
|
-
* callers (orphan cleanup) can decide how loudly to react.
|
|
6
|
-
*/
|
|
7
|
-
export declare function deleteObjects(client: S3Client, bucket: string, keys: string[]): Promise<string[]>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteObjects = deleteObjects;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
const client_1 = require("./client");
|
|
6
|
-
/**
|
|
7
|
-
* Delete `keys` from `bucket` in chunks of 1000 (the DeleteObjects limit).
|
|
8
|
-
* Returns the keys S3 reported as failed — never throws on per-key errors so
|
|
9
|
-
* callers (orphan cleanup) can decide how loudly to react.
|
|
10
|
-
*/
|
|
11
|
-
async function deleteObjects(client, bucket, keys) {
|
|
12
|
-
if (keys.length === 0)
|
|
13
|
-
return [];
|
|
14
|
-
const { DeleteObjectsCommand } = await (0, client_1.loadS3Sdk)();
|
|
15
|
-
const failed = [];
|
|
16
|
-
for (let offset = 0; offset < keys.length; offset += constants_1.S3_DELETE_BATCH_MAX) {
|
|
17
|
-
const chunk = keys.slice(offset, offset + constants_1.S3_DELETE_BATCH_MAX);
|
|
18
|
-
const response = await client.send(new DeleteObjectsCommand({
|
|
19
|
-
Bucket: bucket,
|
|
20
|
-
Delete: { Objects: chunk.map((key) => ({ Key: key })), Quiet: true },
|
|
21
|
-
}));
|
|
22
|
-
for (const error of response.Errors ?? []) {
|
|
23
|
-
if (error.Key)
|
|
24
|
-
failed.push(error.Key);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return failed;
|
|
28
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** base64url-encode one key part; the output alphabet never contains `/` or `.`. */
|
|
2
|
-
export declare function encodeKeyPart(part: string): string;
|
|
3
|
-
/**
|
|
4
|
-
* The path every key `buildS3Key(prefix, [...parts, ...more])` shares: the
|
|
5
|
-
* prefix plus the encoded `parts` joined by `/`, with neither `.bin` nor a
|
|
6
|
-
* trailing `/`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function s3KeyScope(prefix: string, parts: readonly string[]): string;
|
|
9
|
-
/**
|
|
10
|
-
* True when `key` was produced by `buildS3Key` from exactly `parts`
|
|
11
|
-
* (`<scope>.bin`) or from `parts` plus further parts (`<scope>/…`). An empty
|
|
12
|
-
* `parts` degrades to a prefix-only check. Because parts are base64url-encoded
|
|
13
|
-
* and joined by `/`, an identifier sharing a leading substring with another
|
|
14
|
-
* (`t` and `t1`) never matches its scope.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isKeyInScope(key: string, prefix: string, parts: readonly string[]): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Refuse a row-sourced `s3Key` that lies outside the path the row's own
|
|
19
|
-
* identifiers produce. A row is trusted for its shape, not for the object it
|
|
20
|
-
* points at: a writer able to place one row in a partition must not be able
|
|
21
|
-
* to make this library download or delete another tenant's object.
|
|
22
|
-
*/
|
|
23
|
-
export declare function assertKeyInScope(key: string, prefix: string, parts: readonly string[]): void;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeKeyPart = encodeKeyPart;
|
|
4
|
-
exports.s3KeyScope = s3KeyScope;
|
|
5
|
-
exports.isKeyInScope = isKeyInScope;
|
|
6
|
-
exports.assertKeyInScope = assertKeyInScope;
|
|
7
|
-
const errors_1 = require("../../errors/errors");
|
|
8
|
-
/** base64url-encode one key part; the output alphabet never contains `/` or `.`. */
|
|
9
|
-
function encodeKeyPart(part) {
|
|
10
|
-
return Buffer.from(part, 'utf8').toString('base64url');
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The path every key `buildS3Key(prefix, [...parts, ...more])` shares: the
|
|
14
|
-
* prefix plus the encoded `parts` joined by `/`, with neither `.bin` nor a
|
|
15
|
-
* trailing `/`.
|
|
16
|
-
*/
|
|
17
|
-
function s3KeyScope(prefix, parts) {
|
|
18
|
-
return `${prefix}${parts.map(encodeKeyPart).join('/')}`;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* True when `key` was produced by `buildS3Key` from exactly `parts`
|
|
22
|
-
* (`<scope>.bin`) or from `parts` plus further parts (`<scope>/…`). An empty
|
|
23
|
-
* `parts` degrades to a prefix-only check. Because parts are base64url-encoded
|
|
24
|
-
* and joined by `/`, an identifier sharing a leading substring with another
|
|
25
|
-
* (`t` and `t1`) never matches its scope.
|
|
26
|
-
*/
|
|
27
|
-
function isKeyInScope(key, prefix, parts) {
|
|
28
|
-
const scope = s3KeyScope(prefix, parts);
|
|
29
|
-
if (parts.length === 0)
|
|
30
|
-
return key.startsWith(scope);
|
|
31
|
-
return key === `${scope}.bin` || key.startsWith(`${scope}/`);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Refuse a row-sourced `s3Key` that lies outside the path the row's own
|
|
35
|
-
* identifiers produce. A row is trusted for its shape, not for the object it
|
|
36
|
-
* points at: a writer able to place one row in a partition must not be able
|
|
37
|
-
* to make this library download or delete another tenant's object.
|
|
38
|
-
*/
|
|
39
|
-
function assertKeyInScope(key, prefix, parts) {
|
|
40
|
-
if (isKeyInScope(key, prefix, parts))
|
|
41
|
-
return;
|
|
42
|
-
throw new errors_1.ValidationError(`s3Key "${key}" lies outside the S3 path this row may reference ` +
|
|
43
|
-
`("${s3KeyScope(prefix, parts)}"); refusing to touch an object the row does not own`, 's3Key');
|
|
44
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
-
/**
|
|
3
|
-
* Idempotently ensure a `days`-day expiration lifecycle rule exists for
|
|
4
|
-
* `prefix`. Reads existing rules, preserves user-defined ones and the
|
|
5
|
-
* bucket-level `TransitionDefaultMinimumObjectSize` (a Put replaces the whole
|
|
6
|
-
* configuration, so dropping it would reset the bucket to the default), and
|
|
7
|
-
* only adds/updates the library's prefix-scoped rule.
|
|
8
|
-
*
|
|
9
|
-
* Noncurrent versions expire after the same number of days, so a versioned
|
|
10
|
-
* bucket does not retain every superseded payload forever; the field is inert
|
|
11
|
-
* on an unversioned bucket. The prefix is re-checked here because this rule is
|
|
12
|
-
* the one place an unscoped prefix would destroy data outside this library's.
|
|
13
|
-
*/
|
|
14
|
-
export declare function ensureLifecycleRule(client: S3Client, bucket: string, prefix: string, days: number): Promise<void>;
|