@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,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Hides how a search is served from the table alone.
|
|
4
|
-
*
|
|
5
|
-
* Without a vector backend, a search reads the rows under its prefix within
|
|
6
|
-
* `maxScanItems`, decodes them a batch at a time, keeps the ones its filter
|
|
7
|
-
* passes, and — for a semantic query — ranks them in memory by cosine
|
|
8
|
-
* similarity within `maxSearchCandidates`, an item without an embedding sorting
|
|
9
|
-
* last. How far the read goes before it can stop is decided here.
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.collectCandidates = collectCandidates;
|
|
13
|
-
exports.rankInMemory = rankInMemory;
|
|
14
|
-
const clock_1 = require("../../shared/clock");
|
|
15
|
-
const concurrency_1 = require("../../shared/concurrency");
|
|
16
|
-
const paginate_1 = require("../../shared/dynamodb/paginate");
|
|
17
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
18
|
-
const table_schema_1 = require("../../shared/dynamodb/table-schema");
|
|
19
|
-
const errors_1 = require("../../shared/errors/errors");
|
|
20
|
-
const filter_1 = require("./filter");
|
|
21
|
-
const rows_1 = require("./rows");
|
|
22
|
-
const semantic_search_1 = require("./semantic-search");
|
|
23
|
-
/**
|
|
24
|
-
* The vectors a row carries, whichever shape it was written in: a list of
|
|
25
|
-
* per-path vectors, or the single joined vector of an earlier version read as
|
|
26
|
-
* a one-element list so it ranks as it always did.
|
|
27
|
-
*/
|
|
28
|
-
function storedVectors(record) {
|
|
29
|
-
if (record.embeddings)
|
|
30
|
-
return record.embeddings;
|
|
31
|
-
return record.embedding ? [record.embedding] : undefined;
|
|
32
|
-
}
|
|
33
|
-
function candidateSource(context, search, signal, now) {
|
|
34
|
-
return search.namespacePrefix.length > 0
|
|
35
|
-
? (0, paginate_1.paginateQuery)({
|
|
36
|
-
retry: (0, retry_1.retryFor)(context, signal),
|
|
37
|
-
signal,
|
|
38
|
-
client: context.client,
|
|
39
|
-
params: (0, table_schema_1.withoutExpired)((0, rows_1.scopedQuery)(context.tableName, search.namespacePrefix), now),
|
|
40
|
-
maxItems: context.maxScanItems,
|
|
41
|
-
})
|
|
42
|
-
: (0, paginate_1.paginateScan)({
|
|
43
|
-
retry: (0, retry_1.retryFor)(context, signal),
|
|
44
|
-
signal,
|
|
45
|
-
client: context.client,
|
|
46
|
-
params: (0, table_schema_1.withoutExpired)((0, rows_1.storeScan)(context.tableName), now),
|
|
47
|
-
maxItems: context.maxScanItems,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/** The store record a raw row denotes, or undefined for a foreign, malformed, expired or out-of-prefix row. */
|
|
51
|
-
function liveRow(raw, search, now) {
|
|
52
|
-
const record = (0, rows_1.parseWholeStoreRow)(raw);
|
|
53
|
-
if (!record || (0, table_schema_1.isExpiredRow)(record, now))
|
|
54
|
-
return undefined;
|
|
55
|
-
return (0, rows_1.namespaceMatchesPrefix)(record.namespace, search.namespacePrefix) ? record : undefined;
|
|
56
|
-
}
|
|
57
|
-
/** Decode the pending rows concurrently (each offloaded row is one S3 GET) and keep the ones passing the filter. */
|
|
58
|
-
async function flush(context, search, state, signal) {
|
|
59
|
-
if (state.pending.length === 0)
|
|
60
|
-
return;
|
|
61
|
-
const batch = state.pending;
|
|
62
|
-
state.pending = [];
|
|
63
|
-
const items = await (0, concurrency_1.mapWithConcurrency)(batch, context.readConcurrency ?? concurrency_1.DEFAULT_READ_CONCURRENCY, (record) => (0, rows_1.readStoreItem)(context, record, signal));
|
|
64
|
-
batch.forEach((record, index) => {
|
|
65
|
-
if ((0, filter_1.passesFilter)(items[index], search.filter)) {
|
|
66
|
-
state.collected.push({ item: items[index], embeddings: storedVectors(record) });
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Rows to gather before the next decode. With a filter every batch is a full
|
|
72
|
-
* one, since any row may be dropped; without one every decoded row is a match,
|
|
73
|
-
* so the batch never exceeds what the page still needs.
|
|
74
|
-
*/
|
|
75
|
-
function batchSize(search, need, collected, limit) {
|
|
76
|
-
return search.filter === undefined ? Math.min(limit, need - collected) : limit;
|
|
77
|
-
}
|
|
78
|
-
function tooManyCandidates(count, cap) {
|
|
79
|
-
return (0, errors_1.validationError)(`Semantic search candidate set (${count}) exceeds maxSearchCandidates (${cap}); ` +
|
|
80
|
-
'use a dedicated VectorBackend for large corpora', 'maxSearchCandidates');
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Collect the live rows under the prefix and decode them within `bound`.
|
|
84
|
-
*
|
|
85
|
-
* Accepts: `search.namespacePrefix` — a non-empty prefix is a Query on one
|
|
86
|
-
* partition; an empty one spans every partition and is the Scan this adapter
|
|
87
|
-
* reserves for exactly that (`test/static/guards/scan-sites.ts`). `bound` — a
|
|
88
|
-
* page stops as soon as
|
|
89
|
-
* `need` matching items are in hand; a semantic collection needs every
|
|
90
|
-
* candidate and is refused past `cap`. `search.filter` — applied after decoding,
|
|
91
|
-
* since the filter reads the value.
|
|
92
|
-
*
|
|
93
|
-
* Returns: the matching candidates with the vectors their rows carry, in the
|
|
94
|
-
* order read: sort-key order within a partition, unspecified across partitions.
|
|
95
|
-
* A page therefore pages stably within a namespace, and only there.
|
|
96
|
-
*
|
|
97
|
-
* Throws: `VALIDATION` naming `maxSearchCandidates` before any decode when a
|
|
98
|
-
* semantic collection exceeds `cap`; `RESULT_TRUNCATED` when
|
|
99
|
-
* `maxScanItems` is reached while rows remain — a search never silently answers
|
|
100
|
-
* from part of the table; `ABORTED` when the signal fires between pages;
|
|
101
|
-
* whatever a decode throws for a corrupt or unreadable row.
|
|
102
|
-
*
|
|
103
|
-
* Guarantees: a page closes the paginator as soon as it is full, so a namespace
|
|
104
|
-
* far larger than the page costs neither a full decode nor a truncation error.
|
|
105
|
-
* The bound is tested after a row is in hand, not before one is asked for, so
|
|
106
|
-
* a `need` of 0 would still cost one request; `searchItems` answers that case
|
|
107
|
-
* ahead of this call rather than letting it be paid here.
|
|
108
|
-
* Expired rows, rows of other adapters, rows carrying none of the timestamps a
|
|
109
|
-
* decoded item reports, and rows whose own `namespace` does not match the
|
|
110
|
-
* prefix are all skipped — the last matters because a Scan has no key condition
|
|
111
|
-
* at all, so the prefix is enforced here rather than by DynamoDB, and the one
|
|
112
|
-
* before it because a single such row must not cost a search its other results.
|
|
113
|
-
*/
|
|
114
|
-
async function collectCandidates(context, search, bound, signal) {
|
|
115
|
-
const now = (0, clock_1.nowSeconds)();
|
|
116
|
-
const limit = context.readConcurrency ?? concurrency_1.DEFAULT_READ_CONCURRENCY;
|
|
117
|
-
const state = { pending: [], collected: [] };
|
|
118
|
-
for await (const raw of candidateSource(context, search, signal, now)) {
|
|
119
|
-
const record = liveRow(raw, search, now);
|
|
120
|
-
if (!record)
|
|
121
|
-
continue;
|
|
122
|
-
state.pending.push(record);
|
|
123
|
-
if (bound.kind === 'semantic') {
|
|
124
|
-
if (state.pending.length > bound.cap)
|
|
125
|
-
throw tooManyCandidates(state.pending.length, bound.cap);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
if (state.pending.length < batchSize(search, bound.need, state.collected.length, limit)) {
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
await flush(context, search, state, signal);
|
|
132
|
-
if (state.collected.length >= bound.need)
|
|
133
|
-
return state.collected;
|
|
134
|
-
}
|
|
135
|
-
await flush(context, search, state, signal);
|
|
136
|
-
return state.collected;
|
|
137
|
-
}
|
|
138
|
-
/** Sort weight for an item without an embedding; below the −1 cosine minimum. */
|
|
139
|
-
const UNSCORED_RANK = -2;
|
|
140
|
-
/**
|
|
141
|
-
* The best cosine similarity across an item's vectors, or undefined when none
|
|
142
|
-
* can be compared. Scoring by the *best* passage rather than by an average is
|
|
143
|
-
* what the reference store does, and it is why a long document with one
|
|
144
|
-
* strongly-matching section is found.
|
|
145
|
-
*/
|
|
146
|
-
function bestScore(vectors, queryVector) {
|
|
147
|
-
let best;
|
|
148
|
-
for (const vector of vectors) {
|
|
149
|
-
if (vector.length !== queryVector.length)
|
|
150
|
-
continue;
|
|
151
|
-
const score = (0, semantic_search_1.cosineSimilarity)(queryVector, vector);
|
|
152
|
-
if (best === undefined || score > best)
|
|
153
|
-
best = score;
|
|
154
|
-
}
|
|
155
|
-
return best;
|
|
156
|
-
}
|
|
157
|
-
/** True when the candidate has vectors but none of a comparable length. */
|
|
158
|
-
function isDimensionMismatch(candidate, queryVector) {
|
|
159
|
-
const vectors = candidate.embeddings;
|
|
160
|
-
return (vectors !== undefined &&
|
|
161
|
-
vectors.length > 0 &&
|
|
162
|
-
vectors.every((vector) => vector.length !== queryVector.length));
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Rank candidates by cosine similarity to `queryVector`, descending. Throws a
|
|
166
|
-
* `VALIDATION` when the candidate count exceeds `maxCandidates`
|
|
167
|
-
* (steer large corpora to an external VectorBackend).
|
|
168
|
-
*
|
|
169
|
-
* An item is scored by its best-matching vector, as the reference store scores
|
|
170
|
-
* its per-path embeddings. A stored vector whose length differs from the query
|
|
171
|
-
* vector's cannot be scored — it was written by a different embeddings model —
|
|
172
|
-
* and an item with no comparable vector at all is ranked last with an
|
|
173
|
-
* undefined score. `onDimensionMismatch` is invoked once with how many
|
|
174
|
-
* candidates that affected, so the caller can say so instead of silently
|
|
175
|
-
* returning a ranking that quietly omits them.
|
|
176
|
-
*
|
|
177
|
-
* Accepts: `candidates` — in any order; empty ranks to empty. A candidate with
|
|
178
|
-
* no `embeddings` was never indexed (indexing off at write time, or no
|
|
179
|
-
* indexable text) and one with an empty list is the same thing. `queryVector` —
|
|
180
|
-
* the embedded query; one of a different length than everything stored means
|
|
181
|
-
* the query and the corpus were embedded by different models, and nothing
|
|
182
|
-
* scores.
|
|
183
|
-
*
|
|
184
|
-
* Returns: every candidate, scored and sorted best-first. Nothing is dropped:
|
|
185
|
-
* an unscorable item still belongs to the namespace the caller searched, and
|
|
186
|
-
* dropping it would turn a model mismatch into a silently empty result.
|
|
187
|
-
*
|
|
188
|
-
* Throws: `VALIDATION` naming `maxSearchCandidates` when more candidates
|
|
189
|
-
* arrive than may be ranked in memory — a bound on this process's memory, not
|
|
190
|
-
* on the corpus, which is what a `vectorBackend` is for.
|
|
191
|
-
*
|
|
192
|
-
* Guarantees: ranking reads the vectors only; no item is decoded or fetched
|
|
193
|
-
* again, and `onDimensionMismatch` fires at most once per call.
|
|
194
|
-
*/
|
|
195
|
-
function rankInMemory(candidates, queryVector, maxCandidates, onDimensionMismatch) {
|
|
196
|
-
if (candidates.length > maxCandidates) {
|
|
197
|
-
throw (0, errors_1.validationError)(`Semantic search candidate set (${candidates.length}) exceeds maxSearchCandidates ` +
|
|
198
|
-
`(${maxCandidates}); use a dedicated VectorBackend for large corpora`, 'maxSearchCandidates');
|
|
199
|
-
}
|
|
200
|
-
const mismatched = candidates.filter((candidate) => isDimensionMismatch(candidate, queryVector)).length;
|
|
201
|
-
if (mismatched > 0)
|
|
202
|
-
onDimensionMismatch?.(mismatched);
|
|
203
|
-
return candidates
|
|
204
|
-
.map(({ item, embeddings }) => ({
|
|
205
|
-
...item,
|
|
206
|
-
score: embeddings ? bestScore(embeddings, queryVector) : undefined,
|
|
207
|
-
}))
|
|
208
|
-
.sort((a, b) => rankValue(b) - rankValue(a));
|
|
209
|
-
}
|
|
210
|
-
/** Sort weight: real cosine score, or a value below the cosine minimum for unscored items. */
|
|
211
|
-
function rankValue(item) {
|
|
212
|
-
return item.score ?? UNSCORED_RANK;
|
|
213
|
-
}
|