@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +390 -193
- package/dist/{backfill → cjs/backfill}/backfill.d.ts +15 -12
- package/dist/cjs/backfill/backfill.js +177 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/delete-thread.d.ts +1 -1
- package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/get-tuple.d.ts +4 -3
- package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/list.d.ts +7 -4
- package/dist/cjs/checkpointer/actions/list.js +70 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/put-writes.d.ts +8 -6
- package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
- package/dist/{checkpointer → cjs/checkpointer}/actions/put.d.ts +21 -15
- package/dist/cjs/checkpointer/actions/put.js +79 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/delta-history.d.ts +38 -26
- package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/listing.d.ts +4 -4
- package/dist/cjs/checkpointer/internal/listing.js +104 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/parse.d.ts +51 -15
- package/dist/cjs/checkpointer/internal/parse.js +184 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/pending-writes.d.ts +64 -25
- package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/read.d.ts +15 -10
- package/dist/cjs/checkpointer/internal/read.js +132 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/rows.d.ts +94 -21
- package/dist/cjs/checkpointer/internal/rows.js +356 -0
- package/dist/{checkpointer → cjs/checkpointer}/internal/setup.d.ts +13 -20
- package/dist/cjs/checkpointer/internal/setup.js +25 -0
- package/dist/{checkpointer → cjs/checkpointer}/saver.d.ts +72 -36
- package/dist/cjs/checkpointer/saver.js +56 -0
- package/dist/{checkpointer → cjs/checkpointer}/types.d.ts +1 -1
- package/dist/cjs/checkpointer/types.js +2 -0
- package/dist/{factory → cjs/factory}/factory.d.ts +25 -20
- package/dist/cjs/factory/factory.js +137 -0
- package/dist/{factory → cjs/factory}/types.d.ts +12 -12
- package/dist/cjs/factory/types.js +2 -0
- package/dist/{history → cjs/history}/actions/add-messages.d.ts +18 -10
- package/dist/cjs/history/actions/add-messages.js +17 -0
- package/dist/{history → cjs/history}/actions/clear.d.ts +1 -1
- package/dist/cjs/history/actions/clear.js +29 -0
- package/dist/{history → cjs/history}/actions/get-messages.d.ts +11 -9
- package/dist/cjs/history/actions/get-messages.js +58 -0
- package/dist/{history → cjs/history}/actions/list-sessions.d.ts +3 -3
- package/dist/cjs/history/actions/list-sessions.js +67 -0
- package/dist/{history → cjs/history}/actions/reconcile-count.d.ts +13 -9
- package/dist/cjs/history/actions/reconcile-count.js +8 -0
- package/dist/{history → cjs/history}/chat-message-history.d.ts +62 -30
- package/dist/cjs/history/chat-message-history.js +61 -0
- package/dist/{history → cjs/history}/internal/append.d.ts +64 -32
- package/dist/cjs/history/internal/append.js +267 -0
- package/dist/{history → cjs/history}/internal/message-read.d.ts +3 -3
- package/dist/cjs/history/internal/message-read.js +93 -0
- package/dist/{history → cjs/history}/internal/parse.d.ts +2 -2
- package/dist/cjs/history/internal/parse.js +113 -0
- package/dist/{history → cjs/history}/internal/rows.d.ts +11 -10
- package/dist/cjs/history/internal/rows.js +96 -0
- package/dist/{history → cjs/history}/internal/session.d.ts +41 -22
- package/dist/cjs/history/internal/session.js +296 -0
- package/dist/{history → cjs/history}/internal/setup.d.ts +2 -2
- package/dist/cjs/history/internal/setup.js +60 -0
- package/dist/{history → cjs/history}/session-adapter.d.ts +0 -6
- package/dist/cjs/history/session-adapter.js +38 -0
- package/dist/{history → cjs/history}/types.d.ts +18 -15
- package/dist/cjs/history/types.js +2 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +27 -27
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/package.json +1 -0
- package/dist/{shared → cjs/shared}/adapter.d.ts +27 -16
- package/dist/cjs/shared/adapter.js +70 -0
- package/dist/cjs/shared/clock.js +14 -0
- package/dist/{shared → cjs/shared}/codec/codec.d.ts +37 -20
- package/dist/cjs/shared/codec/codec.js +162 -0
- package/dist/{shared → cjs/shared}/codec/compression.d.ts +9 -4
- package/dist/cjs/shared/codec/compression.js +45 -0
- package/dist/cjs/shared/codec/json-serde.js +58 -0
- package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +2 -1
- package/dist/cjs/shared/codec/s3/client-types.js +6 -0
- package/dist/{shared → cjs/shared}/codec/s3/client.d.ts +25 -7
- package/dist/cjs/shared/codec/s3/client.js +78 -0
- package/dist/{shared → cjs/shared}/codec/s3/config.d.ts +12 -7
- package/dist/cjs/shared/codec/s3/config.js +92 -0
- package/dist/{shared → cjs/shared}/codec/s3/lifecycle.d.ts +71 -17
- package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
- package/dist/{shared → cjs/shared}/codec/s3/offloader.d.ts +42 -29
- package/dist/cjs/shared/codec/s3/offloader.js +289 -0
- package/dist/cjs/shared/concurrency.js +31 -0
- package/dist/{shared → cjs/shared}/dynamodb/abort.d.ts +2 -2
- package/dist/cjs/shared/dynamodb/abort.js +16 -0
- package/dist/{shared → cjs/shared}/dynamodb/batch-write.d.ts +2 -2
- package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
- package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
- package/dist/{shared → cjs/shared}/dynamodb/client.d.ts +24 -22
- package/dist/cjs/shared/dynamodb/client.js +40 -0
- package/dist/{shared → cjs/shared}/dynamodb/idempotent-write.d.ts +64 -19
- package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
- package/dist/{shared → cjs/shared}/dynamodb/paginate.d.ts +2 -2
- package/dist/cjs/shared/dynamodb/paginate.js +90 -0
- package/dist/{shared → cjs/shared}/dynamodb/partition-delete.d.ts +6 -6
- package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
- package/dist/{shared → cjs/shared}/dynamodb/recency-index.d.ts +27 -15
- package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
- package/dist/{shared → cjs/shared}/dynamodb/retry.d.ts +37 -6
- package/dist/cjs/shared/dynamodb/retry.js +193 -0
- package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/cjs/shared/dynamodb/row-size.js +30 -0
- package/dist/{shared → cjs/shared}/dynamodb/table-schema.d.ts +27 -18
- package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
- package/dist/{shared → cjs/shared}/errors/base-error.d.ts +42 -7
- package/dist/cjs/shared/errors/base-error.js +73 -0
- package/dist/{shared → cjs/shared}/errors/boundary.d.ts +29 -14
- package/dist/cjs/shared/errors/boundary.js +61 -0
- package/dist/cjs/shared/errors/classify.d.ts +206 -0
- package/dist/cjs/shared/errors/classify.js +232 -0
- package/dist/{shared → cjs/shared}/errors/error-code.d.ts +17 -10
- package/dist/cjs/shared/errors/error-code.js +27 -0
- package/dist/{shared → cjs/shared}/errors/errors.d.ts +75 -9
- package/dist/cjs/shared/errors/errors.js +123 -0
- package/dist/cjs/shared/logging/logger.js +30 -0
- package/dist/{shared → cjs/shared}/logging/redaction.d.ts +8 -4
- package/dist/cjs/shared/logging/redaction.js +145 -0
- package/dist/{shared → cjs/shared}/logging/secret-patterns.d.ts +30 -7
- package/dist/cjs/shared/logging/secret-patterns.js +93 -0
- package/dist/cjs/shared/logging/truncate.js +31 -0
- package/dist/{shared → cjs/shared}/options.d.ts +27 -11
- package/dist/cjs/shared/options.js +2 -0
- package/dist/cjs/shared/ulid.js +83 -0
- package/dist/{shared → cjs/shared}/validation/collaborators.d.ts +21 -2
- package/dist/cjs/shared/validation/collaborators.js +79 -0
- package/dist/{shared → cjs/shared}/validation/option-shape.d.ts +7 -5
- package/dist/cjs/shared/validation/option-shape.js +31 -0
- package/dist/{shared → cjs/shared}/validation/options.d.ts +4 -4
- package/dist/cjs/shared/validation/options.js +166 -0
- package/dist/cjs/shared/validation/primitives.js +114 -0
- package/dist/{shared → cjs/shared}/validation/ttl.d.ts +26 -9
- package/dist/cjs/shared/validation/ttl.js +52 -0
- package/dist/{store → cjs/store}/actions/list-namespaces.d.ts +5 -5
- package/dist/cjs/store/actions/list-namespaces.js +92 -0
- package/dist/{store → cjs/store}/actions/put.d.ts +11 -4
- package/dist/cjs/store/actions/put.js +49 -0
- package/dist/{store → cjs/store}/actions/reconcile-vector-index.d.ts +5 -5
- package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
- package/dist/{store → cjs/store}/actions/search.d.ts +2 -2
- package/dist/cjs/store/actions/search.js +26 -0
- package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
- package/dist/cjs/store/internal/batch-plan.js +32 -0
- package/dist/{store → cjs/store}/internal/filter.d.ts +3 -3
- package/dist/cjs/store/internal/filter.js +64 -0
- package/dist/cjs/store/internal/get-item.d.ts +77 -0
- package/dist/cjs/store/internal/get-item.js +58 -0
- package/dist/{store → cjs/store}/internal/item-write.d.ts +72 -32
- package/dist/cjs/store/internal/item-write.js +181 -0
- package/dist/{store → cjs/store}/internal/parse.d.ts +15 -10
- package/dist/cjs/store/internal/parse.js +180 -0
- package/dist/{store → cjs/store}/internal/rows.d.ts +38 -34
- package/dist/cjs/store/internal/rows.js +166 -0
- package/dist/{store → cjs/store}/internal/semantic-search.d.ts +2 -2
- package/dist/cjs/store/internal/semantic-search.js +211 -0
- package/dist/{store → cjs/store}/internal/setup.d.ts +10 -15
- package/dist/cjs/store/internal/setup.js +103 -0
- package/dist/{store → cjs/store}/internal/table-search.d.ts +5 -5
- package/dist/cjs/store/internal/table-search.js +123 -0
- package/dist/{store → cjs/store}/internal/vector-index.d.ts +26 -15
- package/dist/cjs/store/internal/vector-index.js +269 -0
- package/dist/{store → cjs/store}/store.d.ts +82 -39
- package/dist/cjs/store/store.js +97 -0
- package/dist/{store → cjs/store}/types.d.ts +25 -10
- package/dist/cjs/store/types.js +2 -0
- package/dist/cjs/store/vector-backend.js +4 -0
- package/dist/esm/backfill/backfill.d.ts +171 -0
- package/dist/esm/backfill/backfill.js +170 -0
- package/dist/{checkpointer/actions/delete-thread.js → esm/checkpointer/actions/delete-thread.d.ts} +4 -26
- package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
- package/dist/{checkpointer/actions/get-tuple.js → esm/checkpointer/actions/get-tuple.d.ts} +7 -24
- package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
- package/dist/esm/checkpointer/actions/list.d.ts +55 -0
- package/dist/esm/checkpointer/actions/list.js +67 -0
- package/dist/{checkpointer/actions/put-writes.js → esm/checkpointer/actions/put-writes.d.ts} +10 -37
- package/dist/esm/checkpointer/actions/put-writes.js +18 -0
- package/dist/esm/checkpointer/actions/put.d.ts +95 -0
- package/dist/esm/checkpointer/actions/put.js +75 -0
- package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/esm/checkpointer/internal/delta-history.js +126 -0
- package/dist/{checkpointer/internal/listing.js → esm/checkpointer/internal/listing.d.ts} +22 -118
- package/dist/esm/checkpointer/internal/listing.js +95 -0
- package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
- package/dist/esm/checkpointer/internal/parse.js +169 -0
- package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
- package/dist/esm/checkpointer/internal/read.d.ts +135 -0
- package/dist/esm/checkpointer/internal/read.js +125 -0
- package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
- package/dist/esm/checkpointer/internal/rows.js +323 -0
- package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
- package/dist/esm/checkpointer/internal/setup.js +21 -0
- package/dist/{checkpointer/saver.js → esm/checkpointer/saver.d.ts} +84 -87
- package/dist/esm/checkpointer/saver.js +52 -0
- package/dist/esm/checkpointer/types.d.ts +51 -0
- package/dist/esm/checkpointer/types.js +1 -0
- package/dist/esm/factory/factory.d.ts +154 -0
- package/dist/esm/factory/factory.js +133 -0
- package/dist/esm/factory/types.d.ts +76 -0
- package/dist/esm/factory/types.js +1 -0
- package/dist/{history/actions/add-messages.js → esm/history/actions/add-messages.d.ts} +20 -26
- package/dist/esm/history/actions/add-messages.js +14 -0
- package/dist/{history/actions/clear.js → esm/history/actions/clear.d.ts} +4 -35
- package/dist/esm/history/actions/clear.js +26 -0
- package/dist/esm/history/actions/get-messages.d.ts +60 -0
- package/dist/esm/history/actions/get-messages.js +55 -0
- package/dist/esm/history/actions/list-sessions.d.ts +55 -0
- package/dist/esm/history/actions/list-sessions.js +64 -0
- package/dist/{history/actions/reconcile-count.js → esm/history/actions/reconcile-count.d.ts} +14 -16
- package/dist/esm/history/actions/reconcile-count.js +5 -0
- package/dist/{history/chat-message-history.js → esm/history/chat-message-history.d.ts} +76 -87
- package/dist/esm/history/chat-message-history.js +57 -0
- package/dist/esm/history/internal/append.d.ts +244 -0
- package/dist/esm/history/internal/append.js +259 -0
- package/dist/esm/history/internal/message-read.d.ts +84 -0
- package/dist/esm/history/internal/message-read.js +89 -0
- package/dist/esm/history/internal/parse.d.ts +153 -0
- package/dist/esm/history/internal/parse.js +105 -0
- package/dist/{history/internal/rows.js → esm/history/internal/rows.d.ts} +58 -112
- package/dist/esm/history/internal/rows.js +83 -0
- package/dist/esm/history/internal/session.d.ts +350 -0
- package/dist/esm/history/internal/session.js +285 -0
- package/dist/esm/history/internal/setup.d.ts +64 -0
- package/dist/esm/history/internal/setup.js +56 -0
- package/dist/{history/session-adapter.js → esm/history/session-adapter.d.ts} +25 -39
- package/dist/esm/history/session-adapter.js +34 -0
- package/dist/esm/history/types.d.ts +102 -0
- package/dist/esm/history/types.js +1 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/shared/adapter.d.ts +146 -0
- package/dist/esm/shared/adapter.js +65 -0
- package/dist/{shared/clock.js → esm/shared/clock.d.ts} +3 -14
- package/dist/esm/shared/clock.js +9 -0
- package/dist/esm/shared/codec/codec.d.ts +336 -0
- package/dist/esm/shared/codec/codec.js +150 -0
- package/dist/esm/shared/codec/compression.d.ts +66 -0
- package/dist/esm/shared/codec/compression.js +40 -0
- package/dist/esm/shared/codec/json-serde.d.ts +80 -0
- package/dist/esm/shared/codec/json-serde.js +54 -0
- package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
- package/dist/esm/shared/codec/s3/client-types.js +3 -0
- package/dist/esm/shared/codec/s3/client.d.ts +63 -0
- package/dist/esm/shared/codec/s3/client.js +40 -0
- package/dist/{shared/codec/s3/config.js → esm/shared/codec/s3/config.d.ts} +45 -93
- package/dist/esm/shared/codec/s3/config.js +79 -0
- package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
- package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/esm/shared/codec/s3/offloader.js +278 -0
- package/dist/{shared/concurrency.js → esm/shared/concurrency.d.ts} +2 -37
- package/dist/esm/shared/concurrency.js +27 -0
- package/dist/{shared/dynamodb/abort.js → esm/shared/dynamodb/abort.d.ts} +4 -16
- package/dist/esm/shared/dynamodb/abort.js +12 -0
- package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/esm/shared/dynamodb/batch-write.js +74 -0
- package/dist/{shared/dynamodb/cancellation.js → esm/shared/dynamodb/cancellation.d.ts} +25 -53
- package/dist/esm/shared/dynamodb/cancellation.js +30 -0
- package/dist/{shared/dynamodb/client.js → esm/shared/dynamodb/client.d.ts} +74 -64
- package/dist/esm/shared/dynamodb/client.js +35 -0
- package/dist/{shared/dynamodb/idempotent-write.js → esm/shared/dynamodb/idempotent-write.d.ts} +172 -169
- package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
- package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/esm/shared/dynamodb/paginate.js +84 -0
- package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
- package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/esm/shared/dynamodb/recency-index.js +136 -0
- package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
- package/dist/esm/shared/dynamodb/retry.js +180 -0
- package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/esm/shared/dynamodb/row-size.js +26 -0
- package/dist/{shared/dynamodb/table-schema.js → esm/shared/dynamodb/table-schema.d.ts} +57 -67
- package/dist/esm/shared/dynamodb/table-schema.js +43 -0
- package/dist/esm/shared/errors/base-error.d.ts +231 -0
- package/dist/esm/shared/errors/base-error.js +64 -0
- package/dist/esm/shared/errors/boundary.d.ts +86 -0
- package/dist/esm/shared/errors/boundary.js +54 -0
- package/dist/esm/shared/errors/classify.d.ts +206 -0
- package/dist/esm/shared/errors/classify.js +220 -0
- package/dist/{shared/errors/error-code.js → esm/shared/errors/error-code.d.ts} +39 -43
- package/dist/esm/shared/errors/error-code.js +24 -0
- package/dist/{shared/errors/errors.js → esm/shared/errors/errors.d.ts} +92 -98
- package/dist/esm/shared/errors/errors.js +110 -0
- package/dist/{shared/logging/logger.js → esm/shared/logging/logger.d.ts} +22 -52
- package/dist/esm/shared/logging/logger.js +25 -0
- package/dist/esm/shared/logging/redaction.d.ts +123 -0
- package/dist/esm/shared/logging/redaction.js +140 -0
- package/dist/{shared/logging/secret-patterns.js → esm/shared/logging/secret-patterns.d.ts} +46 -87
- package/dist/esm/shared/logging/secret-patterns.js +83 -0
- package/dist/{shared/logging/truncate.js → esm/shared/logging/truncate.d.ts} +6 -40
- package/dist/esm/shared/logging/truncate.js +25 -0
- package/dist/esm/shared/options.d.ts +100 -0
- package/dist/esm/shared/options.js +1 -0
- package/dist/{shared/ulid.js → esm/shared/ulid.d.ts} +4 -84
- package/dist/esm/shared/ulid.js +77 -0
- package/dist/{shared/validation/collaborators.js → esm/shared/validation/collaborators.d.ts} +37 -65
- package/dist/esm/shared/validation/collaborators.js +70 -0
- package/dist/{shared/validation/option-shape.js → esm/shared/validation/option-shape.d.ts} +14 -36
- package/dist/esm/shared/validation/option-shape.js +24 -0
- package/dist/esm/shared/validation/options.d.ts +145 -0
- package/dist/esm/shared/validation/options.js +156 -0
- package/dist/{shared/validation/primitives.js → esm/shared/validation/primitives.d.ts} +30 -125
- package/dist/esm/shared/validation/primitives.js +100 -0
- package/dist/esm/shared/validation/ttl.d.ts +94 -0
- package/dist/esm/shared/validation/ttl.js +46 -0
- package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
- package/dist/esm/store/actions/list-namespaces.js +86 -0
- package/dist/esm/store/actions/put.d.ts +43 -0
- package/dist/esm/store/actions/put.js +46 -0
- package/dist/{store/actions/reconcile-vector-index.js → esm/store/actions/reconcile-vector-index.d.ts} +8 -16
- package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
- package/dist/esm/store/actions/search.d.ts +38 -0
- package/dist/esm/store/actions/search.js +23 -0
- package/dist/esm/store/internal/batch-plan.d.ts +56 -0
- package/dist/esm/store/internal/batch-plan.js +28 -0
- package/dist/esm/store/internal/filter.d.ts +43 -0
- package/dist/esm/store/internal/filter.js +60 -0
- package/dist/esm/store/internal/get-item.d.ts +77 -0
- package/dist/esm/store/internal/get-item.js +54 -0
- package/dist/esm/store/internal/item-write.d.ts +270 -0
- package/dist/esm/store/internal/item-write.js +173 -0
- package/dist/esm/store/internal/parse.d.ts +230 -0
- package/dist/esm/store/internal/parse.js +169 -0
- package/dist/{store/internal/rows.js → esm/store/internal/rows.d.ts} +111 -199
- package/dist/esm/store/internal/rows.js +147 -0
- package/dist/esm/store/internal/semantic-search.d.ts +168 -0
- package/dist/esm/store/internal/semantic-search.js +200 -0
- package/dist/esm/store/internal/setup.d.ts +96 -0
- package/dist/esm/store/internal/setup.js +98 -0
- package/dist/esm/store/internal/table-search.d.ts +100 -0
- package/dist/esm/store/internal/table-search.js +119 -0
- package/dist/esm/store/internal/vector-index.d.ts +258 -0
- package/dist/esm/store/internal/vector-index.js +256 -0
- package/dist/{store/store.js → esm/store/store.d.ts} +99 -133
- package/dist/esm/store/store.js +93 -0
- package/dist/esm/store/types.d.ts +111 -0
- package/dist/esm/store/types.js +1 -0
- package/dist/esm/store/vector-backend.d.ts +104 -0
- package/dist/esm/store/vector-backend.js +1 -0
- package/package.json +50 -44
- package/dist/backfill/backfill.js +0 -393
- package/dist/checkpointer/actions/list.js +0 -142
- package/dist/checkpointer/actions/put.js +0 -195
- package/dist/checkpointer/internal/delta-history.js +0 -252
- package/dist/checkpointer/internal/parse.js +0 -372
- package/dist/checkpointer/internal/pending-writes.js +0 -588
- package/dist/checkpointer/internal/read.js +0 -264
- package/dist/checkpointer/internal/rows.js +0 -834
- package/dist/checkpointer/internal/setup.js +0 -72
- package/dist/checkpointer/types.js +0 -12
- package/dist/factory/factory.js +0 -266
- package/dist/factory/types.js +0 -10
- package/dist/history/actions/get-messages.js +0 -141
- package/dist/history/actions/list-sessions.js +0 -156
- package/dist/history/internal/append.js +0 -500
- package/dist/history/internal/message-read.js +0 -204
- package/dist/history/internal/parse.js +0 -252
- package/dist/history/internal/session.js +0 -628
- package/dist/history/internal/setup.js +0 -106
- package/dist/history/types.js +0 -12
- package/dist/index.js +0 -51
- package/dist/shared/adapter.js +0 -143
- package/dist/shared/codec/codec.js +0 -441
- package/dist/shared/codec/compression.js +0 -89
- package/dist/shared/codec/json-serde.js +0 -191
- package/dist/shared/codec/s3/client-types.js +0 -26
- package/dist/shared/codec/s3/client.js +0 -97
- package/dist/shared/codec/s3/lifecycle.js +0 -355
- package/dist/shared/codec/s3/offloader.js +0 -658
- package/dist/shared/dynamodb/batch-write.js +0 -173
- package/dist/shared/dynamodb/paginate.js +0 -188
- package/dist/shared/dynamodb/partition-delete.js +0 -340
- package/dist/shared/dynamodb/recency-index.js +0 -377
- package/dist/shared/dynamodb/retry.js +0 -463
- package/dist/shared/errors/base-error.js +0 -174
- package/dist/shared/errors/boundary.js +0 -143
- package/dist/shared/errors/classify.d.ts +0 -97
- package/dist/shared/errors/classify.js +0 -257
- package/dist/shared/logging/redaction.js +0 -316
- package/dist/shared/options.js +0 -11
- package/dist/shared/validation/options.js +0 -328
- package/dist/shared/validation/ttl.js +0 -132
- package/dist/store/actions/list-namespaces.js +0 -197
- package/dist/store/actions/put.js +0 -78
- package/dist/store/actions/search.js +0 -66
- package/dist/store/internal/batch-plan.d.ts +0 -26
- package/dist/store/internal/batch-plan.js +0 -109
- package/dist/store/internal/filter.js +0 -137
- package/dist/store/internal/get-item.d.ts +0 -45
- package/dist/store/internal/get-item.js +0 -115
- package/dist/store/internal/item-write.js +0 -463
- package/dist/store/internal/parse.js +0 -350
- package/dist/store/internal/semantic-search.js +0 -389
- package/dist/store/internal/setup.js +0 -223
- package/dist/store/internal/table-search.js +0 -213
- package/dist/store/internal/vector-index.js +0 -546
- package/dist/store/types.js +0 -15
- package/dist/store/vector-backend.js +0 -17
- /package/dist/{shared → cjs/shared}/clock.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/codec/json-serde.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/concurrency.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/dynamodb/cancellation.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/logging/logger.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/logging/truncate.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/ulid.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/validation/primitives.d.ts +0 -0
- /package/dist/{store → cjs/store}/vector-backend.d.ts +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Hides how a sortable, unique id is made from the clock and random bytes.
|
|
4
3
|
*
|
|
@@ -10,25 +9,12 @@
|
|
|
10
9
|
* wrapping it, so a caller building a bound from a raw millisecond cannot be
|
|
11
10
|
* handed a silently wrong one.
|
|
12
11
|
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.ULID_TIME_RANGE_MS = void 0;
|
|
15
|
-
exports.secureRng = secureRng;
|
|
16
|
-
exports.ulidTimePrefix = ulidTimePrefix;
|
|
17
|
-
exports.createUlidFactory = createUlidFactory;
|
|
18
|
-
const node_crypto_1 = require("node:crypto");
|
|
19
|
-
const errors_1 = require("./errors/errors");
|
|
20
|
-
const ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
|
21
|
-
const ENCODING_LEN = 32;
|
|
22
|
-
const TIME_CHARS = 10;
|
|
23
|
-
const RANDOM_CHARS = 16;
|
|
24
12
|
/**
|
|
25
13
|
* One past the last millisecond ten base-32 characters can hold: `32^10`,
|
|
26
14
|
* which is `2^50`, and lands in the year 37648. Derived rather than written
|
|
27
15
|
* down, so widening {@link TIME_CHARS} moves the rule with it.
|
|
28
16
|
*/
|
|
29
|
-
|
|
30
|
-
/** Bytes drawn per refill of the {@link secureRng} pool: 16 ids per syscall. */
|
|
31
|
-
const RNG_POOL_BYTES = 256;
|
|
17
|
+
export declare const ULID_TIME_RANGE_MS: number;
|
|
32
18
|
/**
|
|
33
19
|
* A CSPRNG-backed `rng` seam.
|
|
34
20
|
*
|
|
@@ -45,28 +31,7 @@ const RNG_POOL_BYTES = 256;
|
|
|
45
31
|
* would order and disambiguate just as well but is not a cryptographically
|
|
46
32
|
* secure source, which the ULID spec asks for in identifier generation.
|
|
47
33
|
*/
|
|
48
|
-
function secureRng()
|
|
49
|
-
let pool = Buffer.alloc(0);
|
|
50
|
-
let offset = 0;
|
|
51
|
-
return () => {
|
|
52
|
-
if (offset >= pool.length) {
|
|
53
|
-
pool = (0, node_crypto_1.randomBytes)(RNG_POOL_BYTES);
|
|
54
|
-
offset = 0;
|
|
55
|
-
}
|
|
56
|
-
const byte = pool[offset];
|
|
57
|
-
offset += 1;
|
|
58
|
-
return byte / 256;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function encodeTime(timeMs) {
|
|
62
|
-
let remaining = Math.floor(timeMs);
|
|
63
|
-
let out = '';
|
|
64
|
-
for (let i = 0; i < TIME_CHARS; i++) {
|
|
65
|
-
out = ENCODING[remaining % ENCODING_LEN] + out;
|
|
66
|
-
remaining = Math.floor(remaining / ENCODING_LEN);
|
|
67
|
-
}
|
|
68
|
-
return out;
|
|
69
|
-
}
|
|
34
|
+
export declare function secureRng(): () => number;
|
|
70
35
|
/**
|
|
71
36
|
* The 10 time characters every ULID generated at `timeMs` starts with.
|
|
72
37
|
*
|
|
@@ -92,31 +57,7 @@ function encodeTime(timeMs) {
|
|
|
92
57
|
* clamped: clamping would hand back the same wrong page under a different
|
|
93
58
|
* name.
|
|
94
59
|
*/
|
|
95
|
-
function ulidTimePrefix(timeMs)
|
|
96
|
-
if (!(timeMs >= 0 && timeMs < exports.ULID_TIME_RANGE_MS)) {
|
|
97
|
-
throw (0, errors_1.validationError)(`a ULID time prefix covers epoch milliseconds 0 to ${exports.ULID_TIME_RANGE_MS - 1} (the year ` +
|
|
98
|
-
`37648); ${timeMs} is outside it and has no ten-character encoding`);
|
|
99
|
-
}
|
|
100
|
-
return encodeTime(timeMs);
|
|
101
|
-
}
|
|
102
|
-
function randomDigits(rng) {
|
|
103
|
-
const digits = [];
|
|
104
|
-
for (let i = 0; i < RANDOM_CHARS; i++) {
|
|
105
|
-
digits.push(Math.floor(rng() * ENCODING_LEN));
|
|
106
|
-
}
|
|
107
|
-
return digits;
|
|
108
|
-
}
|
|
109
|
-
function incrementDigits(digits) {
|
|
110
|
-
const next = [...digits];
|
|
111
|
-
for (let i = RANDOM_CHARS - 1; i >= 0; i--) {
|
|
112
|
-
if (next[i] < ENCODING_LEN - 1) {
|
|
113
|
-
next[i] += 1;
|
|
114
|
-
return { digits: next, overflowed: false };
|
|
115
|
-
}
|
|
116
|
-
next[i] = 0;
|
|
117
|
-
}
|
|
118
|
-
return { digits: next, overflowed: true };
|
|
119
|
-
}
|
|
60
|
+
export declare function ulidTimePrefix(timeMs: number): string;
|
|
120
61
|
/**
|
|
121
62
|
* A monotonic ULID generator.
|
|
122
63
|
*
|
|
@@ -136,25 +77,4 @@ function incrementDigits(digits) {
|
|
|
136
77
|
* order only by their wall clocks at millisecond precision, so a lagging clock
|
|
137
78
|
* can sort a later id before an earlier one.
|
|
138
79
|
*/
|
|
139
|
-
function createUlidFactory(now
|
|
140
|
-
let lastTime = -1;
|
|
141
|
-
let lastRandom = [];
|
|
142
|
-
return () => {
|
|
143
|
-
const time = now();
|
|
144
|
-
if (time > lastTime) {
|
|
145
|
-
lastTime = time;
|
|
146
|
-
lastRandom = randomDigits(rng);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
const result = incrementDigits(lastRandom);
|
|
150
|
-
if (result.overflowed) {
|
|
151
|
-
lastTime += 1;
|
|
152
|
-
lastRandom = randomDigits(rng);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
lastRandom = result.digits;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return encodeTime(lastTime) + lastRandom.map((digit) => ENCODING[digit]).join('');
|
|
159
|
-
};
|
|
160
|
-
}
|
|
80
|
+
export declare function createUlidFactory(now?: () => number, rng?: () => number): () => string;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { validationError } from './errors/errors.js';
|
|
3
|
+
const ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
|
4
|
+
const ENCODING_LEN = 32;
|
|
5
|
+
const TIME_CHARS = 10;
|
|
6
|
+
const RANDOM_CHARS = 16;
|
|
7
|
+
export const ULID_TIME_RANGE_MS = ENCODING_LEN ** TIME_CHARS;
|
|
8
|
+
const RNG_POOL_BYTES = 256;
|
|
9
|
+
export function secureRng() {
|
|
10
|
+
let pool = Buffer.alloc(0);
|
|
11
|
+
let offset = 0;
|
|
12
|
+
return () => {
|
|
13
|
+
if (offset >= pool.length) {
|
|
14
|
+
pool = randomBytes(RNG_POOL_BYTES);
|
|
15
|
+
offset = 0;
|
|
16
|
+
}
|
|
17
|
+
const byte = pool[offset];
|
|
18
|
+
offset += 1;
|
|
19
|
+
return byte / 256;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function encodeTime(timeMs) {
|
|
23
|
+
let remaining = Math.floor(timeMs);
|
|
24
|
+
let out = '';
|
|
25
|
+
for (let i = 0; i < TIME_CHARS; i++) {
|
|
26
|
+
out = ENCODING[remaining % ENCODING_LEN] + out;
|
|
27
|
+
remaining = Math.floor(remaining / ENCODING_LEN);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
export function ulidTimePrefix(timeMs) {
|
|
32
|
+
if (!(timeMs >= 0 && timeMs < ULID_TIME_RANGE_MS)) {
|
|
33
|
+
throw validationError(`a ULID time prefix covers epoch milliseconds 0 to ${ULID_TIME_RANGE_MS - 1} (the year ` +
|
|
34
|
+
`37648); ${timeMs} is outside it and has no ten-character encoding`);
|
|
35
|
+
}
|
|
36
|
+
return encodeTime(timeMs);
|
|
37
|
+
}
|
|
38
|
+
function randomDigits(rng) {
|
|
39
|
+
const digits = [];
|
|
40
|
+
for (let i = 0; i < RANDOM_CHARS; i++) {
|
|
41
|
+
digits.push(Math.floor(rng() * ENCODING_LEN));
|
|
42
|
+
}
|
|
43
|
+
return digits;
|
|
44
|
+
}
|
|
45
|
+
function incrementDigits(digits) {
|
|
46
|
+
const next = [...digits];
|
|
47
|
+
for (let i = RANDOM_CHARS - 1; i >= 0; i--) {
|
|
48
|
+
if (next[i] < ENCODING_LEN - 1) {
|
|
49
|
+
next[i] += 1;
|
|
50
|
+
return { digits: next, overflowed: false };
|
|
51
|
+
}
|
|
52
|
+
next[i] = 0;
|
|
53
|
+
}
|
|
54
|
+
return { digits: next, overflowed: true };
|
|
55
|
+
}
|
|
56
|
+
export function createUlidFactory(now = Date.now, rng = secureRng()) {
|
|
57
|
+
let lastTime = -1;
|
|
58
|
+
let lastRandom = [];
|
|
59
|
+
return () => {
|
|
60
|
+
const time = now();
|
|
61
|
+
if (time > lastTime) {
|
|
62
|
+
lastTime = time;
|
|
63
|
+
lastRandom = randomDigits(rng);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const result = incrementDigits(lastRandom);
|
|
67
|
+
if (result.overflowed) {
|
|
68
|
+
lastTime += 1;
|
|
69
|
+
lastRandom = randomDigits(rng);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
lastRandom = result.digits;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return encodeTime(lastTime) + lastRandom.map((digit) => ENCODING[digit]).join('');
|
|
76
|
+
};
|
|
77
|
+
}
|
package/dist/{shared/validation/collaborators.js → esm/shared/validation/collaborators.d.ts}
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Hides what a collaborator a caller hands in must offer.
|
|
4
3
|
*
|
|
@@ -8,32 +7,15 @@
|
|
|
8
7
|
* `AbortSignal` has, so a wrong object fails where it was passed and not at the
|
|
9
8
|
* first call deep inside an operation.
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
|
-
exports.CANCEL_KEYS = exports.ABORT_SIGNAL_MEMBERS = exports.VECTOR_BACKEND_MEMBERS = exports.EMBEDDINGS_MEMBERS = exports.SERDE_MEMBERS = exports.LOGGER_MEMBERS = exports.CLIENT_MEMBERS = void 0;
|
|
13
|
-
exports.assertMembers = assertMembers;
|
|
14
|
-
exports.assertBaseCollaborators = assertBaseCollaborators;
|
|
15
|
-
exports.isAbortSignalLike = isAbortSignalLike;
|
|
16
|
-
exports.assertSignalLike = assertSignalLike;
|
|
17
|
-
exports.assertCancelOptions = assertCancelOptions;
|
|
18
|
-
const errors_1 = require("../errors/errors");
|
|
19
|
-
const option_shape_1 = require("./option-shape");
|
|
10
|
+
import type { CancelOptions } from '../options.js';
|
|
20
11
|
/** The `DynamoDBDocument` methods this package calls on an injected `client`. */
|
|
21
|
-
|
|
22
|
-
'get',
|
|
23
|
-
'put',
|
|
24
|
-
'delete',
|
|
25
|
-
'update',
|
|
26
|
-
'query',
|
|
27
|
-
'scan',
|
|
28
|
-
'batchWrite',
|
|
29
|
-
'transactWrite',
|
|
30
|
-
];
|
|
12
|
+
export declare const CLIENT_MEMBERS: readonly string[];
|
|
31
13
|
/** The `Logger` methods every adapter calls. */
|
|
32
|
-
|
|
14
|
+
export declare const LOGGER_MEMBERS: readonly string[];
|
|
33
15
|
/** The `SerializerProtocol` methods this package calls on `serde`. */
|
|
34
|
-
|
|
16
|
+
export declare const SERDE_MEMBERS: readonly string[];
|
|
35
17
|
/** The `Embeddings` methods this package calls on `index.embeddings`. */
|
|
36
|
-
|
|
18
|
+
export declare const EMBEDDINGS_MEMBERS: readonly string[];
|
|
37
19
|
/**
|
|
38
20
|
* The `VectorBackend` methods this package calls. `listKeys` is deliberately
|
|
39
21
|
* excluded: it is optional on the interface (`store/vector-backend.ts`), and
|
|
@@ -41,7 +23,7 @@ exports.EMBEDDINGS_MEMBERS = ['embedQuery', 'embedDocuments'];
|
|
|
41
23
|
* requiring it — requiring it here would refuse a backend shape this package
|
|
42
24
|
* documents and supports.
|
|
43
25
|
*/
|
|
44
|
-
|
|
26
|
+
export declare const VECTOR_BACKEND_MEMBERS: readonly string[];
|
|
45
27
|
/**
|
|
46
28
|
* Every `AbortSignal` member this package uses on a caller's `signal`, with
|
|
47
29
|
* the `typeof` each must have: `aborted` is read before a request and between
|
|
@@ -49,11 +31,7 @@ exports.VECTOR_BACKEND_MEMBERS = ['upsert', 'query', 'delete'];
|
|
|
49
31
|
* it again from inside its timer. `reason` is only read, which is safe on any
|
|
50
32
|
* object, so it is not required.
|
|
51
33
|
*/
|
|
52
|
-
|
|
53
|
-
aborted: 'boolean',
|
|
54
|
-
addEventListener: 'function',
|
|
55
|
-
removeEventListener: 'function',
|
|
56
|
-
};
|
|
34
|
+
export declare const ABORT_SIGNAL_MEMBERS: Readonly<Record<string, 'boolean' | 'function'>>;
|
|
57
35
|
/**
|
|
58
36
|
* Refuse a collaborator missing a method this package calls.
|
|
59
37
|
*
|
|
@@ -74,16 +52,24 @@ exports.ABORT_SIGNAL_MEMBERS = {
|
|
|
74
52
|
* its first method, which would point the caller at a method instead of at
|
|
75
53
|
* the value.
|
|
76
54
|
*/
|
|
77
|
-
function assertMembers(value, members, field)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
55
|
+
export declare function assertMembers(value: object, members: readonly string[], field: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Refuse an injected client whose document translation changes what this
|
|
58
|
+
* package writes or reads back.
|
|
59
|
+
*
|
|
60
|
+
* Accepts: `client` — the injected document client, or any object standing in
|
|
61
|
+
* for one; one without `config.translateConfig` translates the default way.
|
|
62
|
+
*
|
|
63
|
+
* Returns: nothing: the client is kept under its declared type, and this checks it.
|
|
64
|
+
*
|
|
65
|
+
* Throws: `VALIDATION` naming `client` when its `unmarshallOptions.wrapNumbers`
|
|
66
|
+
* is set — every number this package reads back (a row's format version, a
|
|
67
|
+
* `ttl`, a message count) would arrive wrapped, so a newer row would read as
|
|
68
|
+
* version 0 and a session as malformed — or when its
|
|
69
|
+
* `marshallOptions.convertEmptyValues` is on, which stores the root checkpoint
|
|
70
|
+
* namespace, the empty string, as NULL.
|
|
71
|
+
*/
|
|
72
|
+
export declare function assertClientTranslation(client: object): void;
|
|
87
73
|
/**
|
|
88
74
|
* Validate the collaborators every adapter shares: `client`, `logger` and
|
|
89
75
|
* `serde`. Pulled out of each `setUp*` as one call rather than three inline
|
|
@@ -98,16 +84,15 @@ function assertMembers(value, members, field) {
|
|
|
98
84
|
* and this checks it. A collaborator the caller did not supply is left
|
|
99
85
|
* untouched, so it still reaches its default.
|
|
100
86
|
*
|
|
101
|
-
* Throws: see {@link assertMembers}
|
|
87
|
+
* Throws: see {@link assertMembers} for a collaborator missing a method, and
|
|
88
|
+
* {@link assertClientTranslation} for a `client` whose translation would
|
|
89
|
+
* change how a row reads back.
|
|
102
90
|
*/
|
|
103
|
-
function assertBaseCollaborators(options
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (options.serde !== undefined)
|
|
109
|
-
assertMembers(options.serde, exports.SERDE_MEMBERS, 'serde');
|
|
110
|
-
}
|
|
91
|
+
export declare function assertBaseCollaborators(options: {
|
|
92
|
+
client?: object;
|
|
93
|
+
logger?: object;
|
|
94
|
+
serde?: object;
|
|
95
|
+
}): void;
|
|
111
96
|
/**
|
|
112
97
|
* A value usable as an `AbortSignal`, checked by shape.
|
|
113
98
|
*
|
|
@@ -123,11 +108,7 @@ function assertBaseCollaborators(options) {
|
|
|
123
108
|
*
|
|
124
109
|
* Throws: nothing.
|
|
125
110
|
*/
|
|
126
|
-
function isAbortSignalLike(value)
|
|
127
|
-
if (typeof value !== 'object' || value === null)
|
|
128
|
-
return false;
|
|
129
|
-
return Object.entries(exports.ABORT_SIGNAL_MEMBERS).every(([member, type]) => typeof Reflect.get(value, member) === type);
|
|
130
|
-
}
|
|
111
|
+
export declare function isAbortSignalLike(value: AbortSignal | undefined): boolean;
|
|
131
112
|
/**
|
|
132
113
|
* Throw `VALIDATION` naming `field` unless `value` is absent or
|
|
133
114
|
* {@link isAbortSignalLike}.
|
|
@@ -147,11 +128,7 @@ function isAbortSignalLike(value) {
|
|
|
147
128
|
* and fails there with a raw, unrelated error instead of naming the option
|
|
148
129
|
* that caused it.
|
|
149
130
|
*/
|
|
150
|
-
function assertSignalLike(value, field
|
|
151
|
-
if (value !== undefined && !isAbortSignalLike(value)) {
|
|
152
|
-
throw (0, errors_1.validationError)(`${field} must be an AbortSignal`, field);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
131
|
+
export declare function assertSignalLike(value: AbortSignal | undefined, field?: string): void;
|
|
155
132
|
/**
|
|
156
133
|
* The keys of a cancellation-only option bag, exhaustive in both directions.
|
|
157
134
|
*
|
|
@@ -162,7 +139,7 @@ function assertSignalLike(value, field = 'signal') {
|
|
|
162
139
|
* type it guards: an exhaustive list compiles, omitting or inventing a key
|
|
163
140
|
* does not.
|
|
164
141
|
*/
|
|
165
|
-
|
|
142
|
+
export declare const CANCEL_KEYS: readonly string[];
|
|
166
143
|
/**
|
|
167
144
|
* Reject a `{ signal }` bag carrying a key this package does not read.
|
|
168
145
|
*
|
|
@@ -180,9 +157,4 @@ exports.CANCEL_KEYS = (0, option_shape_1.allKeysOf)({ signal: 'signal' });
|
|
|
180
157
|
* Throws: `VALIDATION` naming `options.<key>` for the first key this
|
|
181
158
|
* package does not read, or `signal` for a value that is not AbortSignal-like.
|
|
182
159
|
*/
|
|
183
|
-
function assertCancelOptions(options)
|
|
184
|
-
if (options === undefined)
|
|
185
|
-
return;
|
|
186
|
-
(0, option_shape_1.assertShape)(options, exports.CANCEL_KEYS, 'options');
|
|
187
|
-
assertSignalLike(options.signal);
|
|
188
|
-
}
|
|
160
|
+
export declare function assertCancelOptions(options: CancelOptions | undefined): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { validationError } from '../errors/errors.js';
|
|
2
|
+
import { allKeysOf, assertShape, isObjectShape } from './option-shape.js';
|
|
3
|
+
export const CLIENT_MEMBERS = [
|
|
4
|
+
'get',
|
|
5
|
+
'put',
|
|
6
|
+
'delete',
|
|
7
|
+
'update',
|
|
8
|
+
'query',
|
|
9
|
+
'scan',
|
|
10
|
+
'batchWrite',
|
|
11
|
+
'transactWrite',
|
|
12
|
+
];
|
|
13
|
+
export const LOGGER_MEMBERS = ['debug', 'info', 'warn', 'error'];
|
|
14
|
+
export const SERDE_MEMBERS = ['dumpsTyped', 'loadsTyped'];
|
|
15
|
+
export const EMBEDDINGS_MEMBERS = ['embedQuery', 'embedDocuments'];
|
|
16
|
+
export const VECTOR_BACKEND_MEMBERS = ['upsert', 'query', 'delete'];
|
|
17
|
+
export const ABORT_SIGNAL_MEMBERS = {
|
|
18
|
+
aborted: 'boolean',
|
|
19
|
+
addEventListener: 'function',
|
|
20
|
+
removeEventListener: 'function',
|
|
21
|
+
};
|
|
22
|
+
export function assertMembers(value, members, field) {
|
|
23
|
+
if (!isObjectShape(value)) {
|
|
24
|
+
throw validationError(`${field} must be an object`, field);
|
|
25
|
+
}
|
|
26
|
+
for (const member of members) {
|
|
27
|
+
if (typeof Reflect.get(value, member) !== 'function') {
|
|
28
|
+
throw validationError(`${field}.${member} must be a function`, `${field}.${member}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function assertClientTranslation(client) {
|
|
33
|
+
const translate = client.config?.translateConfig;
|
|
34
|
+
if (translate?.unmarshallOptions?.wrapNumbers) {
|
|
35
|
+
throw validationError('client reads numbers back wrapped (unmarshallOptions.wrapNumbers), where this package ' +
|
|
36
|
+
'reads a row version, a ttl and a count as numbers; inject a DynamoDBDocument built ' +
|
|
37
|
+
'without it', 'client');
|
|
38
|
+
}
|
|
39
|
+
if (translate?.marshallOptions?.convertEmptyValues === true) {
|
|
40
|
+
throw validationError('client stores an empty string as NULL (marshallOptions.convertEmptyValues), which erases ' +
|
|
41
|
+
'the root checkpoint namespace; inject a DynamoDBDocument built without it', 'client');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function assertBaseCollaborators(options) {
|
|
45
|
+
if (options.client !== undefined) {
|
|
46
|
+
assertMembers(options.client, CLIENT_MEMBERS, 'client');
|
|
47
|
+
assertClientTranslation(options.client);
|
|
48
|
+
}
|
|
49
|
+
if (options.logger !== undefined)
|
|
50
|
+
assertMembers(options.logger, LOGGER_MEMBERS, 'logger');
|
|
51
|
+
if (options.serde !== undefined)
|
|
52
|
+
assertMembers(options.serde, SERDE_MEMBERS, 'serde');
|
|
53
|
+
}
|
|
54
|
+
export function isAbortSignalLike(value) {
|
|
55
|
+
if (typeof value !== 'object' || value === null)
|
|
56
|
+
return false;
|
|
57
|
+
return Object.entries(ABORT_SIGNAL_MEMBERS).every(([member, type]) => typeof Reflect.get(value, member) === type);
|
|
58
|
+
}
|
|
59
|
+
export function assertSignalLike(value, field = 'signal') {
|
|
60
|
+
if (value !== undefined && !isAbortSignalLike(value)) {
|
|
61
|
+
throw validationError(`${field} must be an AbortSignal`, field);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const CANCEL_KEYS = allKeysOf({ signal: 'signal' });
|
|
65
|
+
export function assertCancelOptions(options) {
|
|
66
|
+
if (options === undefined)
|
|
67
|
+
return;
|
|
68
|
+
assertShape(options, CANCEL_KEYS, 'options');
|
|
69
|
+
assertSignalLike(options.signal);
|
|
70
|
+
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Hides how an option object is told apart from a misspelt one.
|
|
4
3
|
*
|
|
5
|
-
* An option type lists its keys once, checked by the
|
|
6
|
-
* type, and an object carrying any other key is refused
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* An option type this package defines lists its keys once, checked by the
|
|
5
|
+
* compiler against the type, and an object carrying any other key is refused
|
|
6
|
+
* naming that key. An option object LangGraph defines is only held to being an
|
|
7
|
+
* object, since a key a later LangGraph adds must not refuse a call LangGraph
|
|
8
|
+
* makes (decision record 28). No caller writes the plain-object test or the
|
|
9
|
+
* unknown-key walk itself, so the message and the field a refusal names are the
|
|
10
|
+
* same for every option object this package reads.
|
|
10
11
|
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.allKeysOf = allKeysOf;
|
|
13
|
-
exports.isObjectShape = isObjectShape;
|
|
14
|
-
exports.assertObjectShape = assertObjectShape;
|
|
15
|
-
exports.assertShape = assertShape;
|
|
16
|
-
exports.parseShape = parseShape;
|
|
17
|
-
const errors_1 = require("../errors/errors");
|
|
18
12
|
/**
|
|
19
13
|
* Every key of `T`, listed once.
|
|
20
14
|
*
|
|
@@ -28,9 +22,9 @@ const errors_1 = require("../errors/errors");
|
|
|
28
22
|
*
|
|
29
23
|
* Throws: nothing.
|
|
30
24
|
*/
|
|
31
|
-
function allKeysOf(keys
|
|
32
|
-
|
|
33
|
-
}
|
|
25
|
+
export declare function allKeysOf<T extends object>(keys: {
|
|
26
|
+
[K in keyof Required<T>]: K;
|
|
27
|
+
}): readonly string[];
|
|
34
28
|
/**
|
|
35
29
|
* Whether a value is a plain object: an object at all, not `null`, and not an
|
|
36
30
|
* array.
|
|
@@ -43,9 +37,7 @@ function allKeysOf(keys) {
|
|
|
43
37
|
*
|
|
44
38
|
* Throws: nothing.
|
|
45
39
|
*/
|
|
46
|
-
function isObjectShape(value)
|
|
47
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
48
|
-
}
|
|
40
|
+
export declare function isObjectShape(value: object | undefined): value is object;
|
|
49
41
|
/**
|
|
50
42
|
* Reject a value that is not a plain object: not an object at all, `null`, or
|
|
51
43
|
* an array.
|
|
@@ -57,11 +49,7 @@ function isObjectShape(value) {
|
|
|
57
49
|
*
|
|
58
50
|
* Throws: `VALIDATION` naming `field`.
|
|
59
51
|
*/
|
|
60
|
-
function assertObjectShape(value, field)
|
|
61
|
-
if (!isObjectShape(value)) {
|
|
62
|
-
throw (0, errors_1.validationError)(`${field} must be an object`, field);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
52
|
+
export declare function assertObjectShape(value: object, field: string): void;
|
|
65
53
|
/**
|
|
66
54
|
* Reject an option object that is not an object, or that carries a key this
|
|
67
55
|
* package does not read.
|
|
@@ -86,14 +74,7 @@ function assertObjectShape(value, field) {
|
|
|
86
74
|
* object — neither row-sourced nor third-party — so the only person who can
|
|
87
75
|
* make it enormous is the person reading the error.
|
|
88
76
|
*/
|
|
89
|
-
function assertShape(value, allowed, field)
|
|
90
|
-
assertObjectShape(value, field);
|
|
91
|
-
for (const key of Object.keys(value)) {
|
|
92
|
-
if (!allowed.includes(key)) {
|
|
93
|
-
throw (0, errors_1.validationError)(`${field}.${key} is not an option this package reads; expected one of ${allowed.join(', ')}`, `${field}.${key}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
77
|
+
export declare function assertShape(value: object, allowed: readonly string[], field: string): void;
|
|
97
78
|
/**
|
|
98
79
|
* {@link assertShape}, returning `value` instead of nothing.
|
|
99
80
|
*
|
|
@@ -107,7 +88,4 @@ function assertShape(value, allowed, field) {
|
|
|
107
88
|
*
|
|
108
89
|
* Throws: the same as {@link assertShape}.
|
|
109
90
|
*/
|
|
110
|
-
function parseShape(value, allowed, field)
|
|
111
|
-
assertShape(value, allowed, field);
|
|
112
|
-
return value;
|
|
113
|
-
}
|
|
91
|
+
export declare function parseShape<T extends object>(value: T, allowed: readonly string[], field: string): T;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { validationError } from '../errors/errors.js';
|
|
2
|
+
export function allKeysOf(keys) {
|
|
3
|
+
return Object.keys(keys);
|
|
4
|
+
}
|
|
5
|
+
export function isObjectShape(value) {
|
|
6
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
export function assertObjectShape(value, field) {
|
|
9
|
+
if (!isObjectShape(value)) {
|
|
10
|
+
throw validationError(`${field} must be an object`, field);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function assertShape(value, allowed, field) {
|
|
14
|
+
assertObjectShape(value, field);
|
|
15
|
+
for (const key of Object.keys(value)) {
|
|
16
|
+
if (!allowed.includes(key)) {
|
|
17
|
+
throw validationError(`${field}.${key} is not an option this package reads; expected one of ${allowed.join(', ')}`, `${field}.${key}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function parseShape(value, allowed, field) {
|
|
22
|
+
assertShape(value, allowed, field);
|
|
23
|
+
return value;
|
|
24
|
+
}
|