@farukada/aws-langgraph-dynamodb-ts 0.9.0 → 1.0.0-rc.2
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 +1720 -154
- package/dist/backfill/backfill.d.ts +168 -0
- package/dist/backfill/backfill.js +393 -0
- package/dist/checkpointer/actions/delete-thread.d.ts +47 -6
- package/dist/checkpointer/actions/delete-thread.js +58 -21
- package/dist/checkpointer/actions/get-tuple.d.ts +29 -4
- package/dist/checkpointer/actions/get-tuple.js +44 -10
- package/dist/checkpointer/actions/list.d.ts +46 -4
- package/dist/checkpointer/actions/list.js +121 -66
- package/dist/checkpointer/actions/put-writes.d.ts +41 -9
- package/dist/checkpointer/actions/put-writes.js +62 -77
- package/dist/checkpointer/actions/put.d.ts +83 -4
- package/dist/checkpointer/actions/put.js +177 -25
- package/dist/checkpointer/internal/delta-history.d.ts +112 -0
- package/dist/checkpointer/internal/delta-history.js +252 -0
- package/dist/checkpointer/internal/listing.d.ts +149 -0
- package/dist/checkpointer/internal/listing.js +245 -0
- package/dist/checkpointer/internal/parse.d.ts +262 -0
- package/dist/checkpointer/internal/parse.js +372 -0
- package/dist/checkpointer/internal/pending-writes.d.ts +275 -0
- package/dist/checkpointer/internal/pending-writes.js +588 -0
- package/dist/checkpointer/internal/read.d.ts +130 -0
- package/dist/checkpointer/internal/read.js +264 -0
- package/dist/checkpointer/internal/rows.d.ts +571 -0
- package/dist/checkpointer/internal/rows.js +834 -0
- package/dist/checkpointer/internal/setup.d.ts +42 -19
- package/dist/checkpointer/internal/setup.js +65 -29
- package/dist/checkpointer/saver.d.ts +256 -16
- package/dist/checkpointer/saver.js +275 -29
- package/dist/checkpointer/types.d.ts +39 -39
- package/dist/checkpointer/types.js +10 -1
- package/dist/factory/factory.d.ts +134 -28
- package/dist/factory/factory.js +240 -21
- package/dist/factory/types.d.ts +76 -0
- package/dist/factory/types.js +10 -0
- package/dist/history/actions/add-messages.d.ts +31 -4
- package/dist/history/actions/add-messages.js +38 -58
- package/dist/history/actions/clear.d.ts +49 -6
- package/dist/history/actions/clear.js +66 -14
- package/dist/history/actions/get-messages.d.ts +54 -6
- package/dist/history/actions/get-messages.js +126 -43
- package/dist/history/actions/list-sessions.d.ts +52 -10
- package/dist/history/actions/list-sessions.js +139 -40
- package/dist/history/actions/reconcile-count.d.ts +42 -10
- package/dist/history/actions/reconcile-count.js +45 -45
- package/dist/history/chat-message-history.d.ts +220 -33
- package/dist/history/chat-message-history.js +240 -43
- package/dist/history/internal/append.d.ts +212 -0
- package/dist/history/internal/append.js +500 -0
- package/dist/history/internal/message-read.d.ts +84 -0
- package/dist/history/internal/message-read.js +204 -0
- package/dist/history/internal/parse.d.ts +153 -0
- package/dist/history/internal/parse.js +252 -0
- package/dist/history/internal/rows.d.ts +195 -0
- package/dist/history/internal/rows.js +250 -0
- package/dist/history/internal/session.d.ts +331 -0
- package/dist/history/internal/session.js +628 -0
- package/dist/history/internal/setup.d.ts +52 -17
- package/dist/history/internal/setup.js +92 -21
- package/dist/history/session-adapter.d.ts +102 -7
- package/dist/history/session-adapter.js +103 -9
- package/dist/history/types.d.ts +80 -29
- package/dist/history/types.js +10 -1
- package/dist/index.d.ts +42 -11
- package/dist/index.js +33 -12
- package/dist/shared/adapter.d.ts +135 -0
- package/dist/shared/adapter.js +143 -0
- package/dist/shared/clock.d.ts +51 -2
- package/dist/shared/clock.js +57 -2
- package/dist/shared/codec/codec.d.ts +288 -13
- package/dist/shared/codec/codec.js +416 -19
- package/dist/shared/codec/compression.d.ts +43 -7
- package/dist/shared/codec/compression.js +53 -13
- package/dist/shared/codec/json-serde.d.ts +76 -4
- package/dist/shared/codec/json-serde.js +181 -8
- package/dist/shared/codec/s3/client-types.d.ts +53 -0
- package/dist/shared/codec/s3/client-types.js +26 -0
- package/dist/shared/codec/s3/client.d.ts +43 -10
- package/dist/shared/codec/s3/client.js +82 -9
- package/dist/shared/codec/s3/config.d.ts +242 -11
- package/dist/shared/codec/s3/config.js +293 -11
- package/dist/shared/codec/s3/lifecycle.d.ts +164 -6
- package/dist/shared/codec/s3/lifecycle.js +335 -27
- package/dist/shared/codec/s3/offloader.d.ts +393 -18
- package/dist/shared/codec/s3/offloader.js +595 -37
- package/dist/shared/concurrency.d.ts +43 -0
- package/dist/shared/concurrency.js +78 -0
- package/dist/shared/dynamodb/abort.d.ts +47 -0
- package/dist/shared/dynamodb/abort.js +59 -0
- package/dist/shared/dynamodb/batch-write.d.ts +77 -14
- package/dist/shared/dynamodb/batch-write.js +146 -27
- package/dist/shared/dynamodb/cancellation.d.ts +121 -4
- package/dist/shared/dynamodb/cancellation.js +147 -3
- package/dist/shared/dynamodb/client.d.ts +162 -8
- package/dist/shared/dynamodb/client.js +153 -5
- package/dist/shared/dynamodb/idempotent-write.d.ts +551 -0
- package/dist/shared/dynamodb/idempotent-write.js +593 -0
- package/dist/shared/dynamodb/paginate.d.ts +105 -9
- package/dist/shared/dynamodb/paginate.js +175 -7
- package/dist/shared/dynamodb/partition-delete.d.ts +185 -14
- package/dist/shared/dynamodb/partition-delete.js +314 -44
- package/dist/shared/dynamodb/recency-index.d.ts +231 -0
- package/dist/shared/dynamodb/recency-index.js +377 -0
- package/dist/shared/dynamodb/retry.d.ts +276 -8
- package/dist/shared/dynamodb/retry.js +433 -23
- package/dist/shared/dynamodb/table-schema.d.ts +190 -0
- package/dist/shared/dynamodb/table-schema.js +209 -0
- package/dist/shared/errors/base-error.d.ts +184 -10
- package/dist/shared/errors/base-error.js +160 -14
- package/dist/shared/errors/boundary.d.ts +71 -0
- package/dist/shared/errors/boundary.js +143 -0
- package/dist/shared/errors/classify.d.ts +97 -0
- package/dist/shared/errors/classify.js +257 -0
- package/dist/shared/errors/error-code.d.ts +77 -2
- package/dist/shared/errors/error-code.js +83 -1
- package/dist/shared/errors/errors.d.ts +158 -59
- package/dist/shared/errors/errors.js +219 -92
- package/dist/shared/logging/logger.d.ts +69 -3
- package/dist/shared/logging/logger.js +97 -3
- package/dist/shared/logging/redaction.d.ts +92 -8
- package/dist/shared/logging/redaction.js +273 -17
- package/dist/shared/logging/secret-patterns.d.ts +149 -19
- package/dist/shared/logging/secret-patterns.js +188 -27
- package/dist/shared/logging/truncate.d.ts +197 -0
- package/dist/shared/logging/truncate.js +231 -0
- package/dist/shared/options.d.ts +59 -7
- package/dist/shared/options.js +9 -1
- package/dist/shared/ulid.d.ts +77 -7
- package/dist/shared/ulid.js +103 -8
- package/dist/shared/validation/collaborators.d.ts +141 -0
- package/dist/shared/validation/collaborators.js +188 -0
- package/dist/shared/validation/option-shape.d.ts +89 -0
- package/dist/shared/validation/option-shape.js +113 -0
- package/dist/shared/validation/options.d.ts +145 -0
- package/dist/shared/validation/options.js +328 -0
- package/dist/shared/validation/primitives.d.ts +288 -21
- package/dist/shared/validation/primitives.js +353 -50
- package/dist/shared/validation/ttl.d.ts +66 -10
- package/dist/shared/validation/ttl.js +113 -15
- package/dist/store/actions/list-namespaces.d.ts +76 -6
- package/dist/store/actions/list-namespaces.js +166 -24
- package/dist/store/actions/put.d.ts +33 -8
- package/dist/store/actions/put.js +53 -60
- package/dist/store/actions/reconcile-vector-index.d.ts +31 -10
- package/dist/store/actions/reconcile-vector-index.js +34 -15
- package/dist/store/actions/search.d.ts +34 -6
- package/dist/store/actions/search.js +56 -51
- package/dist/store/internal/batch-plan.d.ts +26 -0
- package/dist/store/internal/batch-plan.js +109 -0
- package/dist/store/internal/filter.d.ts +36 -3
- package/dist/store/internal/filter.js +66 -15
- package/dist/store/internal/get-item.d.ts +45 -0
- package/dist/store/internal/get-item.js +115 -0
- package/dist/store/internal/item-write.d.ts +230 -0
- package/dist/store/internal/item-write.js +463 -0
- package/dist/store/internal/parse.d.ts +225 -0
- package/dist/store/internal/parse.js +350 -0
- package/dist/store/internal/rows.d.ts +355 -0
- package/dist/store/internal/rows.js +447 -0
- package/dist/store/internal/semantic-search.d.ts +161 -6
- package/dist/store/internal/semantic-search.js +360 -18
- package/dist/store/internal/setup.d.ts +77 -20
- package/dist/store/internal/setup.js +178 -47
- package/dist/store/internal/table-search.d.ts +100 -0
- package/dist/store/internal/table-search.js +213 -0
- package/dist/store/internal/vector-index.d.ts +247 -0
- package/dist/store/internal/vector-index.js +546 -0
- package/dist/store/store.d.ts +270 -17
- package/dist/store/store.js +329 -38
- package/dist/store/types.d.ts +76 -26
- package/dist/store/types.js +13 -1
- package/dist/store/vector-backend.d.ts +64 -4
- package/dist/store/vector-backend.js +15 -1
- package/package.json +58 -36
- package/dist/checkpointer/actions/delete-thread.d.ts.map +0 -1
- package/dist/checkpointer/actions/delete-thread.js.map +0 -1
- package/dist/checkpointer/actions/get-tuple.d.ts.map +0 -1
- package/dist/checkpointer/actions/get-tuple.js.map +0 -1
- package/dist/checkpointer/actions/list.d.ts.map +0 -1
- package/dist/checkpointer/actions/list.js.map +0 -1
- package/dist/checkpointer/actions/put-writes.d.ts.map +0 -1
- package/dist/checkpointer/actions/put-writes.js.map +0 -1
- package/dist/checkpointer/actions/put.d.ts.map +0 -1
- package/dist/checkpointer/actions/put.js.map +0 -1
- package/dist/checkpointer/internal/assemble.d.ts +0 -10
- package/dist/checkpointer/internal/assemble.d.ts.map +0 -1
- package/dist/checkpointer/internal/assemble.js +0 -37
- package/dist/checkpointer/internal/assemble.js.map +0 -1
- package/dist/checkpointer/internal/configurable.d.ts +0 -13
- package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
- package/dist/checkpointer/internal/configurable.js +0 -23
- package/dist/checkpointer/internal/configurable.js.map +0 -1
- package/dist/checkpointer/internal/fetch.d.ts +0 -10
- package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
- package/dist/checkpointer/internal/fetch.js +0 -46
- package/dist/checkpointer/internal/fetch.js.map +0 -1
- package/dist/checkpointer/internal/filter-match.d.ts +0 -12
- package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
- package/dist/checkpointer/internal/filter-match.js +0 -14
- package/dist/checkpointer/internal/filter-match.js.map +0 -1
- package/dist/checkpointer/internal/item-reader.d.ts +0 -55
- package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-reader.js +0 -88
- package/dist/checkpointer/internal/item-reader.js.map +0 -1
- package/dist/checkpointer/internal/item-writer.d.ts +0 -26
- package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-writer.js +0 -92
- package/dist/checkpointer/internal/item-writer.js.map +0 -1
- package/dist/checkpointer/internal/keys.d.ts +0 -31
- package/dist/checkpointer/internal/keys.d.ts.map +0 -1
- package/dist/checkpointer/internal/keys.js +0 -87
- package/dist/checkpointer/internal/keys.js.map +0 -1
- package/dist/checkpointer/internal/query.d.ts +0 -20
- package/dist/checkpointer/internal/query.d.ts.map +0 -1
- package/dist/checkpointer/internal/query.js +0 -36
- package/dist/checkpointer/internal/query.js.map +0 -1
- package/dist/checkpointer/internal/setup.d.ts.map +0 -1
- package/dist/checkpointer/internal/setup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.d.ts +0 -30
- package/dist/checkpointer/internal/special-write-cas.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cas.js +0 -104
- package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -24
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.js +0 -47
- package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -54
- package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-verify.js +0 -65
- package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
- package/dist/checkpointer/internal/validation.d.ts +0 -13
- package/dist/checkpointer/internal/validation.d.ts.map +0 -1
- package/dist/checkpointer/internal/validation.js +0 -30
- package/dist/checkpointer/internal/validation.js.map +0 -1
- package/dist/checkpointer/internal/write-guard.d.ts +0 -13
- package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-guard.js +0 -39
- package/dist/checkpointer/internal/write-guard.js.map +0 -1
- package/dist/checkpointer/internal/write-index.d.ts +0 -37
- package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-index.js +0 -42
- package/dist/checkpointer/internal/write-index.js.map +0 -1
- package/dist/checkpointer/saver.d.ts.map +0 -1
- package/dist/checkpointer/saver.js.map +0 -1
- package/dist/checkpointer/types.d.ts.map +0 -1
- package/dist/checkpointer/types.js.map +0 -1
- package/dist/factory/factory.d.ts.map +0 -1
- package/dist/factory/factory.js.map +0 -1
- package/dist/history/actions/add-messages.d.ts.map +0 -1
- package/dist/history/actions/add-messages.js.map +0 -1
- package/dist/history/actions/clear.d.ts.map +0 -1
- package/dist/history/actions/clear.js.map +0 -1
- package/dist/history/actions/get-messages.d.ts.map +0 -1
- package/dist/history/actions/get-messages.js.map +0 -1
- package/dist/history/actions/list-sessions.d.ts.map +0 -1
- package/dist/history/actions/list-sessions.js.map +0 -1
- package/dist/history/actions/reconcile-count.d.ts.map +0 -1
- package/dist/history/actions/reconcile-count.js.map +0 -1
- package/dist/history/chat-message-history.d.ts.map +0 -1
- package/dist/history/chat-message-history.js.map +0 -1
- package/dist/history/internal/append-saga.d.ts +0 -20
- package/dist/history/internal/append-saga.d.ts.map +0 -1
- package/dist/history/internal/append-saga.js +0 -35
- package/dist/history/internal/append-saga.js.map +0 -1
- package/dist/history/internal/compensation.d.ts +0 -21
- package/dist/history/internal/compensation.d.ts.map +0 -1
- package/dist/history/internal/compensation.js +0 -84
- package/dist/history/internal/compensation.js.map +0 -1
- package/dist/history/internal/item-mapper.d.ts +0 -12
- package/dist/history/internal/item-mapper.d.ts.map +0 -1
- package/dist/history/internal/item-mapper.js +0 -33
- package/dist/history/internal/item-mapper.js.map +0 -1
- package/dist/history/internal/keys.d.ts +0 -17
- package/dist/history/internal/keys.d.ts.map +0 -1
- package/dist/history/internal/keys.js +0 -49
- package/dist/history/internal/keys.js.map +0 -1
- package/dist/history/internal/message-chunker.d.ts +0 -14
- package/dist/history/internal/message-chunker.d.ts.map +0 -1
- package/dist/history/internal/message-chunker.js +0 -68
- package/dist/history/internal/message-chunker.js.map +0 -1
- package/dist/history/internal/message-transaction.d.ts +0 -26
- package/dist/history/internal/message-transaction.d.ts.map +0 -1
- package/dist/history/internal/message-transaction.js +0 -60
- package/dist/history/internal/message-transaction.js.map +0 -1
- package/dist/history/internal/query.d.ts +0 -10
- package/dist/history/internal/query.d.ts.map +0 -1
- package/dist/history/internal/query.js +0 -31
- package/dist/history/internal/query.js.map +0 -1
- package/dist/history/internal/session-count.d.ts +0 -41
- package/dist/history/internal/session-count.d.ts.map +0 -1
- package/dist/history/internal/session-count.js +0 -109
- package/dist/history/internal/session-count.js.map +0 -1
- package/dist/history/internal/session-title.d.ts +0 -20
- package/dist/history/internal/session-title.d.ts.map +0 -1
- package/dist/history/internal/session-title.js +0 -44
- package/dist/history/internal/session-title.js.map +0 -1
- package/dist/history/internal/session-update.d.ts +0 -28
- package/dist/history/internal/session-update.d.ts.map +0 -1
- package/dist/history/internal/session-update.js +0 -70
- package/dist/history/internal/session-update.js.map +0 -1
- package/dist/history/internal/setup.d.ts.map +0 -1
- package/dist/history/internal/setup.js.map +0 -1
- package/dist/history/internal/title-generator.d.ts +0 -13
- package/dist/history/internal/title-generator.d.ts.map +0 -1
- package/dist/history/internal/title-generator.js +0 -25
- package/dist/history/internal/title-generator.js.map +0 -1
- package/dist/history/internal/ttl-anchor.d.ts +0 -25
- package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
- package/dist/history/internal/ttl-anchor.js +0 -38
- package/dist/history/internal/ttl-anchor.js.map +0 -1
- package/dist/history/internal/validation.d.ts +0 -9
- package/dist/history/internal/validation.d.ts.map +0 -1
- package/dist/history/internal/validation.js +0 -16
- package/dist/history/internal/validation.js.map +0 -1
- package/dist/history/session-adapter.d.ts.map +0 -1
- package/dist/history/session-adapter.js.map +0 -1
- package/dist/history/types.d.ts.map +0 -1
- package/dist/history/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/shared/clock.d.ts.map +0 -1
- package/dist/shared/clock.js.map +0 -1
- package/dist/shared/codec/codec.d.ts.map +0 -1
- package/dist/shared/codec/codec.js.map +0 -1
- package/dist/shared/codec/compression.d.ts.map +0 -1
- package/dist/shared/codec/compression.js.map +0 -1
- package/dist/shared/codec/descriptor-keys.d.ts +0 -4
- package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
- package/dist/shared/codec/descriptor-keys.js +0 -14
- package/dist/shared/codec/descriptor-keys.js.map +0 -1
- package/dist/shared/codec/json-serde.d.ts.map +0 -1
- package/dist/shared/codec/json-serde.js.map +0 -1
- package/dist/shared/codec/s3/client.d.ts.map +0 -1
- package/dist/shared/codec/s3/client.js.map +0 -1
- package/dist/shared/codec/s3/config.d.ts.map +0 -1
- package/dist/shared/codec/s3/config.js.map +0 -1
- package/dist/shared/codec/s3/delete.d.ts +0 -8
- package/dist/shared/codec/s3/delete.d.ts.map +0 -1
- package/dist/shared/codec/s3/delete.js +0 -29
- package/dist/shared/codec/s3/delete.js.map +0 -1
- package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
- package/dist/shared/codec/s3/lifecycle.js.map +0 -1
- package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
- package/dist/shared/codec/s3/offloader.js.map +0 -1
- package/dist/shared/codec/s3/orphans.d.ts +0 -18
- package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
- package/dist/shared/codec/s3/orphans.js +0 -58
- package/dist/shared/codec/s3/orphans.js.map +0 -1
- package/dist/shared/codec/s3/read-write.d.ts +0 -14
- package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
- package/dist/shared/codec/s3/read-write.js +0 -43
- package/dist/shared/codec/s3/read-write.js.map +0 -1
- package/dist/shared/codec/s3/retry.d.ts +0 -5
- package/dist/shared/codec/s3/retry.d.ts.map +0 -1
- package/dist/shared/codec/s3/retry.js +0 -25
- package/dist/shared/codec/s3/retry.js.map +0 -1
- package/dist/shared/constants.d.ts +0 -64
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js +0 -67
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/dynamodb/backoff.d.ts +0 -15
- package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
- package/dist/shared/dynamodb/backoff.js +0 -48
- package/dist/shared/dynamodb/backoff.js.map +0 -1
- package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
- package/dist/shared/dynamodb/batch-write.js.map +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
- package/dist/shared/dynamodb/cancellation.js.map +0 -1
- package/dist/shared/dynamodb/client.d.ts.map +0 -1
- package/dist/shared/dynamodb/client.js.map +0 -1
- package/dist/shared/dynamodb/conditional-put.d.ts +0 -51
- package/dist/shared/dynamodb/conditional-put.d.ts.map +0 -1
- package/dist/shared/dynamodb/conditional-put.js +0 -59
- package/dist/shared/dynamodb/conditional-put.js.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -19
- package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.js +0 -44
- package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
- package/dist/shared/dynamodb/paginate-core.d.ts +0 -22
- package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate-core.js +0 -52
- package/dist/shared/dynamodb/paginate-core.js.map +0 -1
- package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate.js.map +0 -1
- package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
- package/dist/shared/dynamodb/partition-delete.js.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.d.ts +0 -9
- package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.js +0 -87
- package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
- package/dist/shared/dynamodb/retry.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry.js.map +0 -1
- package/dist/shared/dynamodb/scan.d.ts +0 -15
- package/dist/shared/dynamodb/scan.d.ts.map +0 -1
- package/dist/shared/dynamodb/scan.js +0 -20
- package/dist/shared/dynamodb/scan.js.map +0 -1
- package/dist/shared/dynamodb/types.d.ts +0 -24
- package/dist/shared/dynamodb/types.d.ts.map +0 -1
- package/dist/shared/dynamodb/types.js +0 -3
- package/dist/shared/dynamodb/types.js.map +0 -1
- package/dist/shared/errors/base-error.d.ts.map +0 -1
- package/dist/shared/errors/base-error.js.map +0 -1
- package/dist/shared/errors/error-code.d.ts.map +0 -1
- package/dist/shared/errors/error-code.js.map +0 -1
- package/dist/shared/errors/errors.d.ts.map +0 -1
- package/dist/shared/errors/errors.js.map +0 -1
- package/dist/shared/errors/wrap-error.d.ts +0 -16
- package/dist/shared/errors/wrap-error.d.ts.map +0 -1
- package/dist/shared/errors/wrap-error.js +0 -30
- package/dist/shared/errors/wrap-error.js.map +0 -1
- package/dist/shared/logging/logger.d.ts.map +0 -1
- package/dist/shared/logging/logger.js.map +0 -1
- package/dist/shared/logging/redaction-walk.d.ts +0 -23
- package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
- package/dist/shared/logging/redaction-walk.js +0 -92
- package/dist/shared/logging/redaction-walk.js.map +0 -1
- package/dist/shared/logging/redaction.d.ts.map +0 -1
- package/dist/shared/logging/redaction.js.map +0 -1
- package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
- package/dist/shared/logging/secret-patterns.js.map +0 -1
- package/dist/shared/options.d.ts.map +0 -1
- package/dist/shared/options.js.map +0 -1
- package/dist/shared/ulid.d.ts.map +0 -1
- package/dist/shared/ulid.js.map +0 -1
- package/dist/shared/validation/primitives.d.ts.map +0 -1
- package/dist/shared/validation/primitives.js.map +0 -1
- package/dist/shared/validation/ttl.d.ts.map +0 -1
- package/dist/shared/validation/ttl.js.map +0 -1
- package/dist/store/actions/get.d.ts +0 -5
- package/dist/store/actions/get.d.ts.map +0 -1
- package/dist/store/actions/get.js +0 -35
- package/dist/store/actions/get.js.map +0 -1
- package/dist/store/actions/list-namespaces.d.ts.map +0 -1
- package/dist/store/actions/list-namespaces.js.map +0 -1
- package/dist/store/actions/put.d.ts.map +0 -1
- package/dist/store/actions/put.js.map +0 -1
- package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
- package/dist/store/actions/reconcile-vector-index.js.map +0 -1
- package/dist/store/actions/search.d.ts.map +0 -1
- package/dist/store/actions/search.js.map +0 -1
- package/dist/store/internal/backend-search.d.ts +0 -5
- package/dist/store/internal/backend-search.d.ts.map +0 -1
- package/dist/store/internal/backend-search.js +0 -68
- package/dist/store/internal/backend-search.js.map +0 -1
- package/dist/store/internal/filter.d.ts.map +0 -1
- package/dist/store/internal/filter.js.map +0 -1
- package/dist/store/internal/index-reconcile.d.ts +0 -22
- package/dist/store/internal/index-reconcile.d.ts.map +0 -1
- package/dist/store/internal/index-reconcile.js +0 -105
- package/dist/store/internal/index-reconcile.js.map +0 -1
- package/dist/store/internal/index-sync.d.ts +0 -11
- package/dist/store/internal/index-sync.d.ts.map +0 -1
- package/dist/store/internal/index-sync.js +0 -26
- package/dist/store/internal/index-sync.js.map +0 -1
- package/dist/store/internal/item-mapper.d.ts +0 -25
- package/dist/store/internal/item-mapper.d.ts.map +0 -1
- package/dist/store/internal/item-mapper.js +0 -53
- package/dist/store/internal/item-mapper.js.map +0 -1
- package/dist/store/internal/keys.d.ts +0 -18
- package/dist/store/internal/keys.d.ts.map +0 -1
- package/dist/store/internal/keys.js +0 -42
- package/dist/store/internal/keys.js.map +0 -1
- package/dist/store/internal/namespace-match.d.ts +0 -12
- package/dist/store/internal/namespace-match.d.ts.map +0 -1
- package/dist/store/internal/namespace-match.js +0 -41
- package/dist/store/internal/namespace-match.js.map +0 -1
- package/dist/store/internal/overwrite-swap.d.ts +0 -33
- package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
- package/dist/store/internal/overwrite-swap.js +0 -62
- package/dist/store/internal/overwrite-swap.js.map +0 -1
- package/dist/store/internal/persist.d.ts +0 -27
- package/dist/store/internal/persist.d.ts.map +0 -1
- package/dist/store/internal/persist.js +0 -59
- package/dist/store/internal/persist.js.map +0 -1
- package/dist/store/internal/query.d.ts +0 -6
- package/dist/store/internal/query.d.ts.map +0 -1
- package/dist/store/internal/query.js +0 -32
- package/dist/store/internal/query.js.map +0 -1
- package/dist/store/internal/ranker.d.ts +0 -13
- package/dist/store/internal/ranker.d.ts.map +0 -1
- package/dist/store/internal/ranker.js +0 -31
- package/dist/store/internal/ranker.js.map +0 -1
- package/dist/store/internal/read-existing.d.ts +0 -19
- package/dist/store/internal/read-existing.d.ts.map +0 -1
- package/dist/store/internal/read-existing.js +0 -29
- package/dist/store/internal/read-existing.js.map +0 -1
- package/dist/store/internal/score-direction.d.ts +0 -32
- package/dist/store/internal/score-direction.d.ts.map +0 -1
- package/dist/store/internal/score-direction.js +0 -39
- package/dist/store/internal/score-direction.js.map +0 -1
- package/dist/store/internal/search-filter.d.ts +0 -4
- package/dist/store/internal/search-filter.d.ts.map +0 -1
- package/dist/store/internal/search-filter.js +0 -11
- package/dist/store/internal/search-filter.js.map +0 -1
- package/dist/store/internal/semantic-search.d.ts.map +0 -1
- package/dist/store/internal/semantic-search.js.map +0 -1
- package/dist/store/internal/setup.d.ts.map +0 -1
- package/dist/store/internal/setup.js.map +0 -1
- package/dist/store/internal/validation.d.ts +0 -13
- package/dist/store/internal/validation.d.ts.map +0 -1
- package/dist/store/internal/validation.js +0 -35
- package/dist/store/internal/validation.js.map +0 -1
- package/dist/store/internal/write-verify.d.ts +0 -37
- package/dist/store/internal/write-verify.d.ts.map +0 -1
- package/dist/store/internal/write-verify.js +0 -68
- package/dist/store/internal/write-verify.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/types.d.ts.map +0 -1
- package/dist/store/types.js.map +0 -1
- package/dist/store/vector-backend.d.ts.map +0 -1
- package/dist/store/vector-backend.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS DynamoDB implementation of LangGraph's checkpoint saver, memory store
|
|
3
|
+
* and chat message history, in TypeScript.
|
|
4
|
+
*
|
|
5
|
+
* Hides where anything lives.
|
|
6
|
+
*
|
|
7
|
+
* This module re-exports and declares nothing of its own, so which module
|
|
8
|
+
* holds an adapter, the factory, the error class, the serializer or a
|
|
9
|
+
* collaborator type is free to change without moving anything a caller
|
|
10
|
+
* imports. What appears here is the whole supported surface; the package's
|
|
11
|
+
* exports map admits no deep import, so nothing else is reachable.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
1
15
|
export { DynamoDBSaver } from './checkpointer/saver';
|
|
2
|
-
export type { DynamoDBSaverOptions } from './checkpointer/types';
|
|
16
|
+
export type { DeltaChannelHistoryOptions, DynamoDBSaverOptions } from './checkpointer/types';
|
|
3
17
|
export { DynamoDBStore } from './store/store';
|
|
4
|
-
export type { DynamoDBStoreOptions } from './store/types';
|
|
5
|
-
export type {
|
|
6
|
-
export type { VectorBackend, VectorMatch, VectorRef } from './store/vector-backend';
|
|
18
|
+
export type { DynamoDBStoreOptions, ListNamespacesOptions, SearchOptions, VectorReconcileResult, } from './store/types';
|
|
19
|
+
export type { VectorBackend, VectorMatch, VectorRef, VectorScoreDirection, } from './store/vector-backend';
|
|
7
20
|
export { DynamoDBChatMessageHistory } from './history/chat-message-history';
|
|
8
21
|
export { DynamoDBSessionChatMessageHistory } from './history/session-adapter';
|
|
9
|
-
export type {
|
|
22
|
+
export type { AdapterWindow, MultiSessionHistory, SessionBackend } from './history/session-adapter';
|
|
23
|
+
export type { CorruptMessagePolicy, DynamoDBChatMessageHistoryOptions, GetMessagesOptions, ListSessionsOptions, SessionPage, MessageWindow, SessionMetadata, } from './history/types';
|
|
24
|
+
/**
|
|
25
|
+
* Operator tool: give rows written before the recency index their index keys.
|
|
26
|
+
* Run it before setting `indexName` on any adapter — see its own documentation
|
|
27
|
+
* for why enabling the index first hides pre-existing rows from the listings.
|
|
28
|
+
*/
|
|
29
|
+
export { backfillRecencyIndex } from './backfill/backfill';
|
|
30
|
+
export type { BackfillOptions, BackfillResult } from './backfill/backfill';
|
|
10
31
|
export { DynamoDBFactory } from './factory/factory';
|
|
11
|
-
export type { CreateAllOptions, CreatedAdapters, FactoryBaseOptions } from './factory/
|
|
12
|
-
|
|
13
|
-
|
|
32
|
+
export type { AdapterSection, CreateAllOptions, CreatedAdapters, FactoryBaseOptions, } from './factory/types';
|
|
33
|
+
/**
|
|
34
|
+
* The plain JSON serializer the store and chat-history adapters use by
|
|
35
|
+
* default, exported so a checkpointer can be given it in place of LangGraph's
|
|
36
|
+
* `JsonPlusSerializer`, whose read path instantiates the class a stored
|
|
37
|
+
* `{"lc": …}` record names. See the README's *Trust boundary* note and
|
|
38
|
+
* `SECURITY.md`.
|
|
39
|
+
*/
|
|
40
|
+
export { JSON_SERDE } from './shared/codec/json-serde';
|
|
41
|
+
export { DynamoDBLangGraphError, isDynamoDBLangGraphError } from './shared/errors/base-error';
|
|
42
|
+
export type { AnyDynamoDBLangGraphError, BatchDrainDetails, BatchPassDetails, BatchWriteIncompleteDetails, CompensationFailedDetails, ErrorContext, ErrorDetailsByCode, ErrorDetailsFor, } from './shared/errors/base-error';
|
|
14
43
|
export { ErrorCode } from './shared/errors/error-code';
|
|
15
|
-
export { AbortError, BatchWriteAllIncompleteError, BatchWriteIncompleteError, CompensationFailedError, ConflictError, ResultTruncatedError, RetryExhaustedError, ValidationError, } from './shared/errors/errors';
|
|
16
44
|
export type { Logger, LogArgument } from './shared/logging/logger';
|
|
17
45
|
export { redactLogger, redactSecrets } from './shared/logging/redaction';
|
|
18
|
-
export type {
|
|
46
|
+
export type { Redactable, RedactLoggerOptions } from './shared/logging/redaction';
|
|
47
|
+
export type { CancelOptions, BaseAdapterOptions, CodecOptions } from './shared/options';
|
|
48
|
+
export type { DynamoDBDocumentLike } from './shared/dynamodb/client';
|
|
49
|
+
export type { RetryAttemptInfo, RetryOptions, RetryPolicy } from './shared/dynamodb/retry';
|
|
19
50
|
export type { TtlOption } from './shared/validation/ttl';
|
|
20
51
|
export type { CompressionConfig } from './shared/codec/compression';
|
|
21
52
|
export type { S3OffloadConfig } from './shared/codec/s3/config';
|
|
22
|
-
|
|
53
|
+
export type { S3ClientConfigLike, S3ClientLike, S3ClientOption, S3ClientOptions, S3CommandLike, S3RegionLike, } from './shared/codec/s3/client-types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AWS DynamoDB implementation of LangGraph's checkpoint saver, memory store
|
|
4
|
+
* and chat message history, in TypeScript.
|
|
5
|
+
*
|
|
6
|
+
* Hides where anything lives.
|
|
7
|
+
*
|
|
8
|
+
* This module re-exports and declares nothing of its own, so which module
|
|
9
|
+
* holds an adapter, the factory, the error class, the serializer or a
|
|
10
|
+
* collaborator type is free to change without moving anything a caller
|
|
11
|
+
* imports. What appears here is the whole supported surface; the package's
|
|
12
|
+
* exports map admits no deep import, so nothing else is reachable.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.redactSecrets = exports.redactLogger = exports.
|
|
17
|
+
exports.redactSecrets = exports.redactLogger = exports.ErrorCode = exports.isDynamoDBLangGraphError = exports.DynamoDBLangGraphError = exports.JSON_SERDE = exports.DynamoDBFactory = exports.backfillRecencyIndex = exports.DynamoDBSessionChatMessageHistory = exports.DynamoDBChatMessageHistory = exports.DynamoDBStore = exports.DynamoDBSaver = void 0;
|
|
4
18
|
var saver_1 = require("./checkpointer/saver");
|
|
5
19
|
Object.defineProperty(exports, "DynamoDBSaver", { enumerable: true, get: function () { return saver_1.DynamoDBSaver; } });
|
|
6
20
|
var store_1 = require("./store/store");
|
|
@@ -9,22 +23,29 @@ var chat_message_history_1 = require("./history/chat-message-history");
|
|
|
9
23
|
Object.defineProperty(exports, "DynamoDBChatMessageHistory", { enumerable: true, get: function () { return chat_message_history_1.DynamoDBChatMessageHistory; } });
|
|
10
24
|
var session_adapter_1 = require("./history/session-adapter");
|
|
11
25
|
Object.defineProperty(exports, "DynamoDBSessionChatMessageHistory", { enumerable: true, get: function () { return session_adapter_1.DynamoDBSessionChatMessageHistory; } });
|
|
26
|
+
/**
|
|
27
|
+
* Operator tool: give rows written before the recency index their index keys.
|
|
28
|
+
* Run it before setting `indexName` on any adapter — see its own documentation
|
|
29
|
+
* for why enabling the index first hides pre-existing rows from the listings.
|
|
30
|
+
*/
|
|
31
|
+
var backfill_1 = require("./backfill/backfill");
|
|
32
|
+
Object.defineProperty(exports, "backfillRecencyIndex", { enumerable: true, get: function () { return backfill_1.backfillRecencyIndex; } });
|
|
12
33
|
var factory_1 = require("./factory/factory");
|
|
13
34
|
Object.defineProperty(exports, "DynamoDBFactory", { enumerable: true, get: function () { return factory_1.DynamoDBFactory; } });
|
|
35
|
+
/**
|
|
36
|
+
* The plain JSON serializer the store and chat-history adapters use by
|
|
37
|
+
* default, exported so a checkpointer can be given it in place of LangGraph's
|
|
38
|
+
* `JsonPlusSerializer`, whose read path instantiates the class a stored
|
|
39
|
+
* `{"lc": …}` record names. See the README's *Trust boundary* note and
|
|
40
|
+
* `SECURITY.md`.
|
|
41
|
+
*/
|
|
42
|
+
var json_serde_1 = require("./shared/codec/json-serde");
|
|
43
|
+
Object.defineProperty(exports, "JSON_SERDE", { enumerable: true, get: function () { return json_serde_1.JSON_SERDE; } });
|
|
14
44
|
var base_error_1 = require("./shared/errors/base-error");
|
|
15
|
-
Object.defineProperty(exports, "
|
|
45
|
+
Object.defineProperty(exports, "DynamoDBLangGraphError", { enumerable: true, get: function () { return base_error_1.DynamoDBLangGraphError; } });
|
|
46
|
+
Object.defineProperty(exports, "isDynamoDBLangGraphError", { enumerable: true, get: function () { return base_error_1.isDynamoDBLangGraphError; } });
|
|
16
47
|
var error_code_1 = require("./shared/errors/error-code");
|
|
17
48
|
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return error_code_1.ErrorCode; } });
|
|
18
|
-
var errors_1 = require("./shared/errors/errors");
|
|
19
|
-
Object.defineProperty(exports, "AbortError", { enumerable: true, get: function () { return errors_1.AbortError; } });
|
|
20
|
-
Object.defineProperty(exports, "BatchWriteAllIncompleteError", { enumerable: true, get: function () { return errors_1.BatchWriteAllIncompleteError; } });
|
|
21
|
-
Object.defineProperty(exports, "BatchWriteIncompleteError", { enumerable: true, get: function () { return errors_1.BatchWriteIncompleteError; } });
|
|
22
|
-
Object.defineProperty(exports, "CompensationFailedError", { enumerable: true, get: function () { return errors_1.CompensationFailedError; } });
|
|
23
|
-
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_1.ConflictError; } });
|
|
24
|
-
Object.defineProperty(exports, "ResultTruncatedError", { enumerable: true, get: function () { return errors_1.ResultTruncatedError; } });
|
|
25
|
-
Object.defineProperty(exports, "RetryExhaustedError", { enumerable: true, get: function () { return errors_1.RetryExhaustedError; } });
|
|
26
|
-
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
27
49
|
var redaction_1 = require("./shared/logging/redaction");
|
|
28
50
|
Object.defineProperty(exports, "redactLogger", { enumerable: true, get: function () { return redaction_1.redactLogger; } });
|
|
29
51
|
Object.defineProperty(exports, "redactSecrets", { enumerable: true, get: function () { return redaction_1.redactSecrets; } });
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hides what an adapter owns for its lifetime, and how it lets go of it.
|
|
3
|
+
*
|
|
4
|
+
* Every adapter resolves the same things from its options — a DynamoDB client
|
|
5
|
+
* it either built, and so must destroy, or was handed, and so must not; an S3
|
|
6
|
+
* offloader when it offloads; a logger; a retry policy; the recency index's
|
|
7
|
+
* settings — releases them the same way, and provisions the same lifecycle
|
|
8
|
+
* rule from its ttl. Whether an adapter owns its client is decided in
|
|
9
|
+
* `dynamodb/client.ts`; this module only reads that decision, to release a
|
|
10
|
+
* client it built and leave an injected one alone.
|
|
11
|
+
*/
|
|
12
|
+
import type { CompressionConfig } from './codec/compression';
|
|
13
|
+
import { type AdapterName } from './codec/s3/config';
|
|
14
|
+
import { S3Offloader } from './codec/s3/offloader';
|
|
15
|
+
import { type DynamoDBDocumentLike } from './dynamodb/client';
|
|
16
|
+
import { type RetryOptions } from './dynamodb/retry';
|
|
17
|
+
import { type Logger } from './logging/logger';
|
|
18
|
+
import type { BaseAdapterOptions, CodecOptions } from './options';
|
|
19
|
+
import { type TtlOption } from './validation/ttl';
|
|
20
|
+
/** Anything an adapter holds open and must hand back when it is torn down. */
|
|
21
|
+
export interface Releasable {
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Release every resource, whatever any one of them does.
|
|
26
|
+
*
|
|
27
|
+
* The hazard is the one `DynamoDBFactory`'s own `release` names: a teardown
|
|
28
|
+
* written as a sequence of statements stops at the first throw, so everything
|
|
29
|
+
* after it is stranded with no reference left to reach it by. Each adapter's
|
|
30
|
+
* `destroy` was exactly that sequence — the S3 offloader, then the DynamoDB
|
|
31
|
+
* client it built — and an S3 client whose sockets are already gone throws from
|
|
32
|
+
* its own `destroy`, so the DynamoDB client leaked for the life of the process.
|
|
33
|
+
*
|
|
34
|
+
* Accepts: `resources` — in the order they should be released; an absent one
|
|
35
|
+
* (an adapter with no offloader, a client the caller injected and therefore
|
|
36
|
+
* owns) is skipped rather than guarded at each call site.
|
|
37
|
+
*
|
|
38
|
+
* Returns: nothing.
|
|
39
|
+
*
|
|
40
|
+
* Throws: the **first** failure, and only after every resource has been
|
|
41
|
+
* offered its release, so nothing is stranded behind it. Raised rather than
|
|
42
|
+
* logged because the default logger discards everything: a caller who never
|
|
43
|
+
* configured one would otherwise be told nowhere at all that a client of theirs
|
|
44
|
+
* is still holding sockets. A later failure is dropped, because a caller can
|
|
45
|
+
* act on one report and the first one names the resource that actually broke.
|
|
46
|
+
* A `throw` that produced something other than an `Error` is normalised, so a
|
|
47
|
+
* caller's `catch` is handed the same shape whatever a client raised.
|
|
48
|
+
*/
|
|
49
|
+
export declare function releaseOwned(resources: readonly (Releasable | undefined)[]): void;
|
|
50
|
+
/** What every adapter resolves from its options and every operation reads. */
|
|
51
|
+
export interface AdapterCore {
|
|
52
|
+
client: DynamoDBDocumentLike;
|
|
53
|
+
tableName: string;
|
|
54
|
+
compression?: CompressionConfig;
|
|
55
|
+
offloader?: S3Offloader;
|
|
56
|
+
ttl?: TtlOption;
|
|
57
|
+
logger: Logger;
|
|
58
|
+
/** Retry budget and backoff for every DynamoDB call, with the retry debug log attached. */
|
|
59
|
+
retry?: RetryOptions;
|
|
60
|
+
/**
|
|
61
|
+
* Index partitions per adapter for the recency index; see `indexKeys`.
|
|
62
|
+
* Absent means the default, which is where it is resolved.
|
|
63
|
+
*/
|
|
64
|
+
indexShards?: number;
|
|
65
|
+
/** Payloads decoded at once by one call; the memory ceiling’s multiplier. */
|
|
66
|
+
readConcurrency?: number;
|
|
67
|
+
/** Name of the recency index, when the table carries one; see `BaseAdapterOptions.indexName`. */
|
|
68
|
+
indexName?: string;
|
|
69
|
+
}
|
|
70
|
+
/** An adapter's hold on what it owns. */
|
|
71
|
+
export interface AdapterShell {
|
|
72
|
+
readonly core: AdapterCore;
|
|
73
|
+
/** Provision the S3 lifecycle rule for the configured ttl; see {@link ensureLifecycleFor}. */
|
|
74
|
+
ensureLifecycleRule(): Promise<void>;
|
|
75
|
+
/** Release the offloader, and the DynamoDB client when the adapter built it; see {@link releaseOwned}. */
|
|
76
|
+
release(): void;
|
|
77
|
+
}
|
|
78
|
+
/** The checks an adapter adds to the shared ones, and where they run. */
|
|
79
|
+
export interface AdapterChecks {
|
|
80
|
+
/** Runs after the shared option checks and before the collaborator checks. */
|
|
81
|
+
options?: () => void;
|
|
82
|
+
/** Runs after the shared collaborator checks, before anything is built. */
|
|
83
|
+
collaborators?: () => void;
|
|
84
|
+
/** The fewest attempts the adapter's own writes need; see `resolveRetryPolicy`. */
|
|
85
|
+
attemptFloor?: number;
|
|
86
|
+
}
|
|
87
|
+
/** The options every adapter takes, with the serializer each may add. */
|
|
88
|
+
export type AdapterOptions = BaseAdapterOptions & CodecOptions & {
|
|
89
|
+
serde?: object;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Provision the S3 lifecycle rule that expires what an adapter offloads, on its
|
|
93
|
+
* ttl, so an offloaded payload does not outlive the DynamoDB item that points
|
|
94
|
+
* at it.
|
|
95
|
+
*
|
|
96
|
+
* The rule is expressed in whole days because that is the only granularity S3
|
|
97
|
+
* lifecycle expiration accepts, while the DynamoDB TTL is in seconds; see
|
|
98
|
+
* `lifecycleExpirationDays` for the rounding, which is always up.
|
|
99
|
+
*
|
|
100
|
+
* Accepts: `core` — the adapter's offloader, ttl and logger.
|
|
101
|
+
*
|
|
102
|
+
* Returns: nothing. Without an offloader there is nothing to rule over, and
|
|
103
|
+
* without a ttl no item expires, so any rule would delete a payload a live row
|
|
104
|
+
* still needs: either absence does nothing. Installing a rule that is already
|
|
105
|
+
* there is a no-op too, so calling this on every deploy is safe.
|
|
106
|
+
*
|
|
107
|
+
* Throws: whatever reading or writing the bucket's lifecycle configuration
|
|
108
|
+
* throws, and `VALIDATION` naming `s3.keyPrefix` when the rule id this
|
|
109
|
+
* prefix would take is already held by a different prefix.
|
|
110
|
+
*
|
|
111
|
+
* Guarantees: needs the bucket-level `s3:GetLifecycleConfiguration` /
|
|
112
|
+
* `s3:PutLifecycleConfiguration` permissions, which are broader than the
|
|
113
|
+
* object-level CRUD the rest of offload uses — so this is a provisioning call,
|
|
114
|
+
* not a per-request one.
|
|
115
|
+
*/
|
|
116
|
+
export declare function ensureLifecycleFor(core: Pick<AdapterCore, 'offloader' | 'ttl' | 'logger'>): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Check an adapter's options and resolve what it will own.
|
|
119
|
+
*
|
|
120
|
+
* Accepts: `options` — the adapter's, already held to its own key list, and
|
|
121
|
+
* checked first, so no half-built adapter exists when one is wrong.
|
|
122
|
+
* `adapter` — which adapter, which names its default S3 key prefix. `checks` —
|
|
123
|
+
* the adapter's own option and collaborator checks, and its retry floor.
|
|
124
|
+
*
|
|
125
|
+
* Returns: the shell: the core every operation reads, with every shared
|
|
126
|
+
* default filled in here and nowhere else, and the adapter's two lifetime
|
|
127
|
+
* operations. A client the caller passed in is never destroyed by `release`.
|
|
128
|
+
*
|
|
129
|
+
* Throws: `VALIDATION` for an option or a collaborator that fails a shared
|
|
130
|
+
* check or one of `checks`, in that order.
|
|
131
|
+
*
|
|
132
|
+
* Guarantees: no I/O. The stacked-retry check is deliberately not awaited: it
|
|
133
|
+
* is a warning about a caller-supplied client, not a precondition.
|
|
134
|
+
*/
|
|
135
|
+
export declare function openAdapter(options: AdapterOptions, adapter: AdapterName, checks?: AdapterChecks): AdapterShell;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides what an adapter owns for its lifetime, and how it lets go of it.
|
|
4
|
+
*
|
|
5
|
+
* Every adapter resolves the same things from its options — a DynamoDB client
|
|
6
|
+
* it either built, and so must destroy, or was handed, and so must not; an S3
|
|
7
|
+
* offloader when it offloads; a logger; a retry policy; the recency index's
|
|
8
|
+
* settings — releases them the same way, and provisions the same lifecycle
|
|
9
|
+
* rule from its ttl. Whether an adapter owns its client is decided in
|
|
10
|
+
* `dynamodb/client.ts`; this module only reads that decision, to release a
|
|
11
|
+
* client it built and leave an injected one alone.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.releaseOwned = releaseOwned;
|
|
15
|
+
exports.ensureLifecycleFor = ensureLifecycleFor;
|
|
16
|
+
exports.openAdapter = openAdapter;
|
|
17
|
+
const config_1 = require("./codec/s3/config");
|
|
18
|
+
const offloader_1 = require("./codec/s3/offloader");
|
|
19
|
+
const concurrency_1 = require("./concurrency");
|
|
20
|
+
const client_1 = require("./dynamodb/client");
|
|
21
|
+
const recency_index_1 = require("./dynamodb/recency-index");
|
|
22
|
+
const retry_1 = require("./dynamodb/retry");
|
|
23
|
+
const base_error_1 = require("./errors/base-error");
|
|
24
|
+
const logger_1 = require("./logging/logger");
|
|
25
|
+
const collaborators_1 = require("./validation/collaborators");
|
|
26
|
+
const options_1 = require("./validation/options");
|
|
27
|
+
const ttl_1 = require("./validation/ttl");
|
|
28
|
+
/**
|
|
29
|
+
* Release every resource, whatever any one of them does.
|
|
30
|
+
*
|
|
31
|
+
* The hazard is the one `DynamoDBFactory`'s own `release` names: a teardown
|
|
32
|
+
* written as a sequence of statements stops at the first throw, so everything
|
|
33
|
+
* after it is stranded with no reference left to reach it by. Each adapter's
|
|
34
|
+
* `destroy` was exactly that sequence — the S3 offloader, then the DynamoDB
|
|
35
|
+
* client it built — and an S3 client whose sockets are already gone throws from
|
|
36
|
+
* its own `destroy`, so the DynamoDB client leaked for the life of the process.
|
|
37
|
+
*
|
|
38
|
+
* Accepts: `resources` — in the order they should be released; an absent one
|
|
39
|
+
* (an adapter with no offloader, a client the caller injected and therefore
|
|
40
|
+
* owns) is skipped rather than guarded at each call site.
|
|
41
|
+
*
|
|
42
|
+
* Returns: nothing.
|
|
43
|
+
*
|
|
44
|
+
* Throws: the **first** failure, and only after every resource has been
|
|
45
|
+
* offered its release, so nothing is stranded behind it. Raised rather than
|
|
46
|
+
* logged because the default logger discards everything: a caller who never
|
|
47
|
+
* configured one would otherwise be told nowhere at all that a client of theirs
|
|
48
|
+
* is still holding sockets. A later failure is dropped, because a caller can
|
|
49
|
+
* act on one report and the first one names the resource that actually broke.
|
|
50
|
+
* A `throw` that produced something other than an `Error` is normalised, so a
|
|
51
|
+
* caller's `catch` is handed the same shape whatever a client raised.
|
|
52
|
+
*/
|
|
53
|
+
function releaseOwned(resources) {
|
|
54
|
+
let first;
|
|
55
|
+
for (const resource of resources) {
|
|
56
|
+
try {
|
|
57
|
+
resource?.destroy();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
first ??= (0, base_error_1.toError)(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (first !== undefined)
|
|
64
|
+
throw first;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Provision the S3 lifecycle rule that expires what an adapter offloads, on its
|
|
68
|
+
* ttl, so an offloaded payload does not outlive the DynamoDB item that points
|
|
69
|
+
* at it.
|
|
70
|
+
*
|
|
71
|
+
* The rule is expressed in whole days because that is the only granularity S3
|
|
72
|
+
* lifecycle expiration accepts, while the DynamoDB TTL is in seconds; see
|
|
73
|
+
* `lifecycleExpirationDays` for the rounding, which is always up.
|
|
74
|
+
*
|
|
75
|
+
* Accepts: `core` — the adapter's offloader, ttl and logger.
|
|
76
|
+
*
|
|
77
|
+
* Returns: nothing. Without an offloader there is nothing to rule over, and
|
|
78
|
+
* without a ttl no item expires, so any rule would delete a payload a live row
|
|
79
|
+
* still needs: either absence does nothing. Installing a rule that is already
|
|
80
|
+
* there is a no-op too, so calling this on every deploy is safe.
|
|
81
|
+
*
|
|
82
|
+
* Throws: whatever reading or writing the bucket's lifecycle configuration
|
|
83
|
+
* throws, and `VALIDATION` naming `s3.keyPrefix` when the rule id this
|
|
84
|
+
* prefix would take is already held by a different prefix.
|
|
85
|
+
*
|
|
86
|
+
* Guarantees: needs the bucket-level `s3:GetLifecycleConfiguration` /
|
|
87
|
+
* `s3:PutLifecycleConfiguration` permissions, which are broader than the
|
|
88
|
+
* object-level CRUD the rest of offload uses — so this is a provisioning call,
|
|
89
|
+
* not a per-request one.
|
|
90
|
+
*/
|
|
91
|
+
async function ensureLifecycleFor(core) {
|
|
92
|
+
if (!core.offloader || !core.ttl)
|
|
93
|
+
return;
|
|
94
|
+
await core.offloader.ensureLifecycleRule((0, ttl_1.lifecycleExpirationDays)(core.ttl), core.logger);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check an adapter's options and resolve what it will own.
|
|
98
|
+
*
|
|
99
|
+
* Accepts: `options` — the adapter's, already held to its own key list, and
|
|
100
|
+
* checked first, so no half-built adapter exists when one is wrong.
|
|
101
|
+
* `adapter` — which adapter, which names its default S3 key prefix. `checks` —
|
|
102
|
+
* the adapter's own option and collaborator checks, and its retry floor.
|
|
103
|
+
*
|
|
104
|
+
* Returns: the shell: the core every operation reads, with every shared
|
|
105
|
+
* default filled in here and nowhere else, and the adapter's two lifetime
|
|
106
|
+
* operations. A client the caller passed in is never destroyed by `release`.
|
|
107
|
+
*
|
|
108
|
+
* Throws: `VALIDATION` for an option or a collaborator that fails a shared
|
|
109
|
+
* check or one of `checks`, in that order.
|
|
110
|
+
*
|
|
111
|
+
* Guarantees: no I/O. The stacked-retry check is deliberately not awaited: it
|
|
112
|
+
* is a warning about a caller-supplied client, not a precondition.
|
|
113
|
+
*/
|
|
114
|
+
function openAdapter(options, adapter, checks = {}) {
|
|
115
|
+
(0, options_1.assertBaseAdapterOptions)(options);
|
|
116
|
+
checks.options?.();
|
|
117
|
+
(0, collaborators_1.assertBaseCollaborators)(options);
|
|
118
|
+
checks.collaborators?.();
|
|
119
|
+
const logger = (0, logger_1.resolveLogger)(options.logger);
|
|
120
|
+
const resolved = (0, client_1.resolveDynamoDBClient)(options);
|
|
121
|
+
if (!resolved.ownsClient)
|
|
122
|
+
void (0, client_1.warnOnStackedRetries)(resolved.client, logger);
|
|
123
|
+
const offloader = options.s3
|
|
124
|
+
? new offloader_1.S3Offloader((0, config_1.offloaderConfigFor)(options.s3, adapter, options.clientConfig))
|
|
125
|
+
: undefined;
|
|
126
|
+
const core = {
|
|
127
|
+
client: resolved.client,
|
|
128
|
+
tableName: options.tableName,
|
|
129
|
+
compression: options.compression,
|
|
130
|
+
offloader,
|
|
131
|
+
ttl: options.ttl,
|
|
132
|
+
logger,
|
|
133
|
+
retry: (0, retry_1.resolveRetryPolicy)(options.retry, logger, checks.attemptFloor),
|
|
134
|
+
indexShards: options.indexShards ?? recency_index_1.DEFAULT_INDEX_SHARDS,
|
|
135
|
+
readConcurrency: options.readConcurrency ?? concurrency_1.DEFAULT_READ_CONCURRENCY,
|
|
136
|
+
indexName: options.indexName,
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
core,
|
|
140
|
+
ensureLifecycleRule: () => ensureLifecycleFor(core),
|
|
141
|
+
release: () => releaseOwned([offloader, resolved.ownsClient ? resolved.ddbClient : undefined]),
|
|
142
|
+
};
|
|
143
|
+
}
|
package/dist/shared/clock.d.ts
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Hides where the current time comes from, and in which unit each reader
|
|
3
|
+
* takes it.
|
|
4
|
+
*
|
|
5
|
+
* Every timestamp, deadline and expiry this package computes through
|
|
6
|
+
* `nowIso`, `nowMs` or `nowSeconds` reads `Date.now` through here, so a test
|
|
7
|
+
* that freezes it freezes all of them at once, and under a skewed clock they
|
|
8
|
+
* agree with each other rather than disagreeing by a second. Two call sites
|
|
9
|
+
* take their own default instead of this seam — `calculateTtlTimestamp`'s
|
|
10
|
+
* `now` parameter and `createUlidFactory`'s `now` parameter, both defaulting
|
|
11
|
+
* to `Date.now` directly — so freezing this module's clock alone does not
|
|
12
|
+
* freeze them. That the ISO form sorts chronologically and that the TTL unit
|
|
13
|
+
* is floored seconds are settled here; a caller asks for the unit it needs.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The current time as an ISO-8601 string.
|
|
17
|
+
*
|
|
18
|
+
* Accepts: nothing; it reads `Date.now`, which the test setup freezes.
|
|
19
|
+
*
|
|
20
|
+
* Returns: UTC, millisecond precision, `Z`-suffixed — the form whose byte order
|
|
21
|
+
* is its chronological order, which is why it can lead a sort key unparsed.
|
|
22
|
+
*
|
|
23
|
+
* Throws: nothing.
|
|
24
|
+
*/
|
|
2
25
|
export declare function nowIso(): string;
|
|
3
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The current time as epoch milliseconds.
|
|
28
|
+
*
|
|
29
|
+
* Accepts: nothing; it reads `Date.now`, which the test setup freezes.
|
|
30
|
+
*
|
|
31
|
+
* Returns: the millisecond, unrounded — the unit a whole-operation deadline is
|
|
32
|
+
* measured in, since a retry budget is bounded far below a second's
|
|
33
|
+
* granularity of error.
|
|
34
|
+
*
|
|
35
|
+
* Throws: nothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function nowMs(): number;
|
|
38
|
+
/**
|
|
39
|
+
* The current time as whole epoch seconds, the unit DynamoDB's TTL uses.
|
|
40
|
+
*
|
|
41
|
+
* Accepts: nothing; it reads `Date.now`, which the test setup freezes.
|
|
42
|
+
*
|
|
43
|
+
* Returns: the second, floored — never a fraction, which DynamoDB would reject
|
|
44
|
+
* on the `ttl` attribute.
|
|
45
|
+
*
|
|
46
|
+
* Throws: nothing.
|
|
47
|
+
*
|
|
48
|
+
* Guarantees: every expiry stamp, expiry filter and ttl-anchor comparison in
|
|
49
|
+
* this package reads this one seam, so they agree with each other under a
|
|
50
|
+
* frozen or skewed clock rather than disagreeing by a second.
|
|
51
|
+
*/
|
|
52
|
+
export declare function nowSeconds(): number;
|
package/dist/shared/clock.js
CHANGED
|
@@ -1,8 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hides where the current time comes from, and in which unit each reader
|
|
4
|
+
* takes it.
|
|
5
|
+
*
|
|
6
|
+
* Every timestamp, deadline and expiry this package computes through
|
|
7
|
+
* `nowIso`, `nowMs` or `nowSeconds` reads `Date.now` through here, so a test
|
|
8
|
+
* that freezes it freezes all of them at once, and under a skewed clock they
|
|
9
|
+
* agree with each other rather than disagreeing by a second. Two call sites
|
|
10
|
+
* take their own default instead of this seam — `calculateTtlTimestamp`'s
|
|
11
|
+
* `now` parameter and `createUlidFactory`'s `now` parameter, both defaulting
|
|
12
|
+
* to `Date.now` directly — so freezing this module's clock alone does not
|
|
13
|
+
* freeze them. That the ISO form sorts chronologically and that the TTL unit
|
|
14
|
+
* is floored seconds are settled here; a caller asks for the unit it needs.
|
|
15
|
+
*/
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.nowIso = nowIso;
|
|
4
|
-
|
|
18
|
+
exports.nowMs = nowMs;
|
|
19
|
+
exports.nowSeconds = nowSeconds;
|
|
20
|
+
/**
|
|
21
|
+
* The current time as an ISO-8601 string.
|
|
22
|
+
*
|
|
23
|
+
* Accepts: nothing; it reads `Date.now`, which the test setup freezes.
|
|
24
|
+
*
|
|
25
|
+
* Returns: UTC, millisecond precision, `Z`-suffixed — the form whose byte order
|
|
26
|
+
* is its chronological order, which is why it can lead a sort key unparsed.
|
|
27
|
+
*
|
|
28
|
+
* Throws: nothing.
|
|
29
|
+
*/
|
|
5
30
|
function nowIso() {
|
|
6
31
|
return new Date(Date.now()).toISOString();
|
|
7
32
|
}
|
|
8
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The current time as epoch milliseconds.
|
|
35
|
+
*
|
|
36
|
+
* Accepts: nothing; it reads `Date.now`, which the test setup freezes.
|
|
37
|
+
*
|
|
38
|
+
* Returns: the millisecond, unrounded — the unit a whole-operation deadline is
|
|
39
|
+
* measured in, since a retry budget is bounded far below a second's
|
|
40
|
+
* granularity of error.
|
|
41
|
+
*
|
|
42
|
+
* Throws: nothing.
|
|
43
|
+
*/
|
|
44
|
+
function nowMs() {
|
|
45
|
+
return Date.now();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The current time as whole epoch seconds, the unit DynamoDB's TTL uses.
|
|
49
|
+
*
|
|
50
|
+
* Accepts: nothing; it reads `Date.now`, which the test setup freezes.
|
|
51
|
+
*
|
|
52
|
+
* Returns: the second, floored — never a fraction, which DynamoDB would reject
|
|
53
|
+
* on the `ttl` attribute.
|
|
54
|
+
*
|
|
55
|
+
* Throws: nothing.
|
|
56
|
+
*
|
|
57
|
+
* Guarantees: every expiry stamp, expiry filter and ttl-anchor comparison in
|
|
58
|
+
* this package reads this one seam, so they agree with each other under a
|
|
59
|
+
* frozen or skewed clock rather than disagreeing by a second.
|
|
60
|
+
*/
|
|
61
|
+
function nowSeconds() {
|
|
62
|
+
return Math.floor(Date.now() / 1000);
|
|
63
|
+
}
|