effect-dynamodb 1.39.0 → 1.40.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/dist/Aggregate.d.ts +119 -15
- package/dist/Aggregate.d.ts.map +1 -1
- package/dist/Aggregate.js +2021 -379
- package/dist/Aggregate.js.map +1 -1
- package/dist/Batch.d.ts +9 -5
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +28 -44
- package/dist/Batch.js.map +1 -1
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +12 -5
- package/dist/Collection.js.map +1 -1
- package/dist/ConsumedCapacity.js +1 -1
- package/dist/ConsumedCapacity.js.map +1 -1
- package/dist/DynamoClient.d.ts +22 -8
- package/dist/DynamoClient.d.ts.map +1 -1
- package/dist/DynamoClient.js +243 -87
- package/dist/DynamoClient.js.map +1 -1
- package/dist/Entity.d.ts +87 -22
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +2750 -514
- package/dist/Entity.js.map +1 -1
- package/dist/EventStore.d.ts +37 -15
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +215 -79
- package/dist/EventStore.js.map +1 -1
- package/dist/Marshaller.d.ts +39 -9
- package/dist/Marshaller.d.ts.map +1 -1
- package/dist/Marshaller.js +421 -70
- package/dist/Marshaller.js.map +1 -1
- package/dist/Query.d.ts +23 -0
- package/dist/Query.d.ts.map +1 -1
- package/dist/Query.js +49 -3
- package/dist/Query.js.map +1 -1
- package/dist/StorageEncoding.d.ts +7 -1
- package/dist/StorageEncoding.d.ts.map +1 -1
- package/dist/StorageEncoding.js +8 -2
- package/dist/StorageEncoding.js.map +1 -1
- package/dist/Table.d.ts +69 -8
- package/dist/Table.d.ts.map +1 -1
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +10 -4
- package/dist/Transaction.js.map +1 -1
- package/dist/change-feed/ChangeFeed.d.ts +8 -3
- package/dist/change-feed/ChangeFeed.d.ts.map +1 -1
- package/dist/change-feed/ChangeFeed.js +76 -9
- package/dist/change-feed/ChangeFeed.js.map +1 -1
- package/dist/change-feed/CheckpointStore.js +1 -1
- package/dist/change-feed/CheckpointStore.js.map +1 -1
- package/dist/change-feed/DynamoStreamsClient.d.ts +12 -5
- package/dist/change-feed/DynamoStreamsClient.d.ts.map +1 -1
- package/dist/change-feed/DynamoStreamsClient.js +15 -9
- package/dist/change-feed/DynamoStreamsClient.js.map +1 -1
- package/dist/internal/BoundCrud.d.ts +40 -32
- package/dist/internal/BoundCrud.d.ts.map +1 -1
- package/dist/internal/BoundCrud.js.map +1 -1
- package/dist/internal/BoundQuery.d.ts +1 -1
- package/dist/internal/BoundQuery.d.ts.map +1 -1
- package/dist/internal/BoundQuery.js +22 -12
- package/dist/internal/BoundQuery.js.map +1 -1
- package/dist/internal/BoundVectorQuery.d.ts.map +1 -1
- package/dist/internal/BoundVectorQuery.js +2 -1
- package/dist/internal/BoundVectorQuery.js.map +1 -1
- package/dist/internal/Capacity.d.ts +44 -4
- package/dist/internal/Capacity.d.ts.map +1 -1
- package/dist/internal/Capacity.js +89 -15
- package/dist/internal/Capacity.js.map +1 -1
- package/dist/internal/ClientOptions.d.ts +72 -0
- package/dist/internal/ClientOptions.d.ts.map +1 -0
- package/dist/internal/ClientOptions.js +79 -0
- package/dist/internal/ClientOptions.js.map +1 -0
- package/dist/internal/Cursor.d.ts +19 -10
- package/dist/internal/Cursor.d.ts.map +1 -1
- package/dist/internal/Cursor.js +25 -10
- package/dist/internal/Cursor.js.map +1 -1
- package/dist/internal/EntityCombinators.d.ts +22 -7
- package/dist/internal/EntityCombinators.d.ts.map +1 -1
- package/dist/internal/EntityCombinators.js +6 -2
- package/dist/internal/EntityCombinators.js.map +1 -1
- package/dist/internal/EntityOps.d.ts +11 -1
- package/dist/internal/EntityOps.d.ts.map +1 -1
- package/dist/internal/EntityOps.js.map +1 -1
- package/dist/internal/EventProjection.d.ts +15 -3
- package/dist/internal/EventProjection.d.ts.map +1 -1
- package/dist/internal/EventProjection.js +27 -8
- package/dist/internal/EventProjection.js.map +1 -1
- package/dist/internal/Expr.d.ts.map +1 -1
- package/dist/internal/Expr.js +53 -2
- package/dist/internal/Expr.js.map +1 -1
- package/dist/internal/ExpressionLimits.d.ts +57 -1
- package/dist/internal/ExpressionLimits.d.ts.map +1 -1
- package/dist/internal/ExpressionLimits.js +90 -1
- package/dist/internal/ExpressionLimits.js.map +1 -1
- package/dist/internal/ItemSize.d.ts +108 -4
- package/dist/internal/ItemSize.d.ts.map +1 -1
- package/dist/internal/ItemSize.js +190 -3
- package/dist/internal/ItemSize.js.map +1 -1
- package/dist/internal/MultiProjection.d.ts +7 -2
- package/dist/internal/MultiProjection.d.ts.map +1 -1
- package/dist/internal/MultiProjection.js +9 -3
- package/dist/internal/MultiProjection.js.map +1 -1
- package/dist/internal/PathBuilder.d.ts +15 -4
- package/dist/internal/PathBuilder.d.ts.map +1 -1
- package/dist/internal/PathBuilder.js +20 -10
- package/dist/internal/PathBuilder.js.map +1 -1
- package/dist/internal/ProjectionEngine.d.ts +76 -2
- package/dist/internal/ProjectionEngine.d.ts.map +1 -1
- package/dist/internal/ProjectionEngine.js +358 -28
- package/dist/internal/ProjectionEngine.js.map +1 -1
- package/dist/internal/Rekey.d.ts +21 -1
- package/dist/internal/Rekey.d.ts.map +1 -1
- package/dist/internal/Rekey.js +67 -0
- package/dist/internal/Rekey.js.map +1 -1
- package/dist/internal/RoundTrip.d.ts +36 -0
- package/dist/internal/RoundTrip.d.ts.map +1 -0
- package/dist/internal/RoundTrip.js +79 -0
- package/dist/internal/RoundTrip.js.map +1 -0
- package/dist/internal/SentRequest.d.ts +14 -0
- package/dist/internal/SentRequest.d.ts.map +1 -0
- package/dist/internal/SentRequest.js +31 -0
- package/dist/internal/SentRequest.js.map +1 -0
- package/dist/internal/TransactWriteOps.d.ts +69 -15
- package/dist/internal/TransactWriteOps.d.ts.map +1 -1
- package/dist/internal/TransactWriteOps.js +144 -107
- package/dist/internal/TransactWriteOps.js.map +1 -1
- package/dist/internal/TransactableOps.d.ts +115 -23
- package/dist/internal/TransactableOps.d.ts.map +1 -1
- package/dist/internal/TransactableOps.js +244 -80
- package/dist/internal/TransactableOps.js.map +1 -1
- package/dist/internal/WriteDiagnosis.d.ts +31 -3
- package/dist/internal/WriteDiagnosis.d.ts.map +1 -1
- package/dist/internal/WriteDiagnosis.js +128 -11
- package/dist/internal/WriteDiagnosis.js.map +1 -1
- package/package.json +2 -2
package/dist/DynamoClient.js
CHANGED
|
@@ -12,22 +12,24 @@ import { Compression, make as makeCompressionRegistry, } from "@effect-dynamodb/
|
|
|
12
12
|
import * as DynamoSchema from "@effect-dynamodb/schema/DynamoSchema.js";
|
|
13
13
|
import { Embedder } from "@effect-dynamodb/schema/Embedder.js";
|
|
14
14
|
import { DynamoError, DynamoValidationError, InternalServerError, isAwsInternalServerError, isAwsResourceNotFound, isAwsThrottling, isAwsValidationError, ResourceNotFoundError, ThrottlingError, ValidationError, } from "@effect-dynamodb/schema/Errors.js";
|
|
15
|
-
import { compositeKeyFormKind, keyFormValueKind, makeCompositeKeyForm, toCompositeKeyRecord, } from "@effect-dynamodb/schema/internal/CompositeCodec.js";
|
|
15
|
+
import { compositeKeyFormKind, keyFormValueKind, keyFormValueKindOf, makeCompositeDomainKeyForm, makeCompositeKeyForm, refuseInexact, toCompositeKeyRecord, } from "@effect-dynamodb/schema/internal/CompositeCodec.js";
|
|
16
16
|
import { makeDefaultCrypto } from "@effect-dynamodb/schema/internal/DefaultCrypto.js";
|
|
17
17
|
import { getSchemaFields } from "@effect-dynamodb/schema/internal/SchemaAccessors.js";
|
|
18
18
|
import * as ZOrderCurve from "@effect-dynamodb/schema/internal/ZOrderCurve.js";
|
|
19
19
|
import * as KeyComposer from "@effect-dynamodb/schema/KeyComposer.js";
|
|
20
20
|
import { Config, Context, DateTime, Duration, Effect, Layer, Option, SchemaAST, } from "effect";
|
|
21
21
|
import { SecureRandom } from "effect/crypto";
|
|
22
|
-
import { bind as aggregateBind } from "./Aggregate.js";
|
|
22
|
+
import { bind as aggregateBind, ownershipConflict } from "./Aggregate.js";
|
|
23
23
|
import { bind as entityBind, fromDefinition as entityFromDefinition } from "./Entity.js";
|
|
24
24
|
import { BoundQueryImpl, collectionNaming, entityNaming, } from "./internal/BoundQuery.js";
|
|
25
25
|
import { makeBoundVectorQuery, } from "./internal/BoundVectorQuery.js";
|
|
26
26
|
import * as Capacity from "./internal/Capacity.js";
|
|
27
|
+
import { acquireSdkClient, readClientOptions, } from "./internal/ClientOptions.js";
|
|
27
28
|
import { redactCredentialRefusal } from "./internal/CredentialRefusal.js";
|
|
28
29
|
import { createConditionOps, ExprTag } from "./internal/Expr.js";
|
|
29
30
|
import { codecRequirements, collectionPackedQueryOptions, entityPackedQueryOptions, unregisteredCodecError, } from "./internal/Packed.js";
|
|
30
31
|
import { createPathBuilder } from "./internal/PathBuilder.js";
|
|
32
|
+
import { physicalTableName, refuseSharedOutboxKeySpace, remoteOutboxesOf, sharedOutboxKeySpace, } from "./internal/ProjectionEngine.js";
|
|
31
33
|
import { canonicalJson, compareUtf8, compositePlanner, keyJustBelow, zorderPlanner, } from "./internal/RangePlanner.js";
|
|
32
34
|
import * as Rekey from "./internal/Rekey.js";
|
|
33
35
|
import { diagnoseFailure, explainDiagnosis, withCause, } from "./internal/WriteDiagnosis.js";
|
|
@@ -303,7 +305,7 @@ const combineRowChecks = (checks) => checks.length === 0
|
|
|
303
305
|
* nothing: the query is returned as it is.
|
|
304
306
|
*/
|
|
305
307
|
const planCompositeWithin = (args) => {
|
|
306
|
-
const { entityLike, accessor, indexDef,
|
|
308
|
+
const { entityLike, accessor, indexDef, domainKeyForm, pinnedKeyForm } = args;
|
|
307
309
|
const sk = indexDef.sk.composite;
|
|
308
310
|
const n = sk.length;
|
|
309
311
|
const p = sk.findIndex((attr) => pinnedKeyForm[attr] === undefined);
|
|
@@ -360,8 +362,8 @@ const planCompositeWithin = (args) => {
|
|
|
360
362
|
}
|
|
361
363
|
const expected = kindOf(field);
|
|
362
364
|
const keyForm = (value) => {
|
|
363
|
-
const converted =
|
|
364
|
-
if (expected !== undefined &&
|
|
365
|
+
const converted = domainKeyForm(field, value);
|
|
366
|
+
if (expected !== undefined && keyFormValueKindOf(converted) !== expected) {
|
|
365
367
|
return refuse(`the bound on "${field}" is ${JSON.stringify(String(value))} (${typeof value}), but ` +
|
|
366
368
|
`the composite's key form is a ${expected}.`);
|
|
367
369
|
}
|
|
@@ -641,13 +643,14 @@ const withinEnds = (value, lower, upper, compare) => {
|
|
|
641
643
|
* where it doesn't (numbers stored as strings, zoned dates, a `literals`
|
|
642
644
|
* selection too large for `IN`) and for hashed prefix values (collisions).
|
|
643
645
|
*
|
|
644
|
-
* Throws `[EDD-9093]` for misuse from untyped code
|
|
645
|
-
* that doesn't reach key form
|
|
646
|
-
*
|
|
647
|
-
*
|
|
646
|
+
* Throws `[EDD-9093]` for misuse from untyped code and `[EDD-9050]` for a value
|
|
647
|
+
* that doesn't reach key form, at `.within()`, so every terminal (and `explain`)
|
|
648
|
+
* has a valid box. A value no level holds throws `ZOrderValueError` (`[EDD-9092]`),
|
|
649
|
+
* which `.within()` turns into the query's `ValidationError`. `{}` plans nothing:
|
|
650
|
+
* the query is returned as it is.
|
|
648
651
|
*/
|
|
649
652
|
const planZOrderWithin = (args) => {
|
|
650
|
-
const { entityLike, accessor, indexDef,
|
|
653
|
+
const { entityLike, accessor, indexDef, domainKeyForm } = args;
|
|
651
654
|
const refuse = (why) => {
|
|
652
655
|
throw new Error(`[EDD-9093] .within() on index "${accessor}" of entity "${entityLike.entityType}": ${why}`);
|
|
653
656
|
};
|
|
@@ -664,10 +667,10 @@ const planZOrderWithin = (args) => {
|
|
|
664
667
|
const fields = getSchemaFields(args.encoderSource);
|
|
665
668
|
/** `value` in the field's key form: `[EDD-9050]` from the encoder, `[EDD-9093]` for the wrong type. */
|
|
666
669
|
const keyForm = (field, value) => {
|
|
667
|
-
const converted =
|
|
670
|
+
const converted = domainKeyForm(field, value);
|
|
668
671
|
const schema = fields?.[field];
|
|
669
672
|
const expected = schema === undefined ? undefined : keyFormValueKind(schema);
|
|
670
|
-
if (expected !== undefined &&
|
|
673
|
+
if (expected !== undefined && keyFormValueKindOf(converted) !== expected) {
|
|
671
674
|
return refuse(`the bound on "${field}" is ${JSON.stringify(String(value))} (${typeof value}), but ` +
|
|
672
675
|
`the field's key form is a ${expected}.`);
|
|
673
676
|
}
|
|
@@ -802,22 +805,14 @@ const planZOrderWithin = (args) => {
|
|
|
802
805
|
return Array.from({ length: Math.max(0, hi - lo + 1) }, (_, i) => lo + i);
|
|
803
806
|
};
|
|
804
807
|
const { box, selections } = (() => {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
return { box: none ? "empty" : quantized, selections: selected };
|
|
814
|
-
}
|
|
815
|
-
catch (error) {
|
|
816
|
-
// A value that reaches key form but no level (§3.3): thrown, like EDD-9050.
|
|
817
|
-
if (ZOrderCurve.isZOrderValueError(error))
|
|
818
|
-
throw new Error(error.message);
|
|
819
|
-
throw error;
|
|
820
|
-
}
|
|
808
|
+
const quantized = ZOrderCurve.quantizeBounds(layout, Object.fromEntries(dimensions
|
|
809
|
+
.filter((dim) => bounded.has(dim.field))
|
|
810
|
+
.map((dim) => [dim.field, quantizable(dim)])));
|
|
811
|
+
const selected = new Map(dimensions
|
|
812
|
+
.filter((dim) => dim.spec.kind === "literals" && bounded.has(dim.field))
|
|
813
|
+
.map((dim) => [dim.field, literalSelection(dim, bounded.get(dim.field).keyForm)]));
|
|
814
|
+
const none = [...selected.values()].some((members) => members.length === 0);
|
|
815
|
+
return { box: none ? "empty" : quantized, selections: selected };
|
|
821
816
|
})();
|
|
822
817
|
// -- exact bounds (§11): a FilterExpression where DynamoDB's order agrees, else row checks --
|
|
823
818
|
const path = (field) => ({ _tag: "path", segments: [field] });
|
|
@@ -996,14 +991,17 @@ const planZOrderWithin = (args) => {
|
|
|
996
991
|
});
|
|
997
992
|
};
|
|
998
993
|
/**
|
|
999
|
-
* The
|
|
1000
|
-
* `
|
|
994
|
+
* The key form of a caller's DOMAIN record for an arbitrary entity-like value —
|
|
995
|
+
* the key `put` wrote for those values (`internal/CompositeCodec.ts`,
|
|
996
|
+
* `makeCompositeDomainKeyForm`), as `Entity._domainKeyForm` composes it.
|
|
1001
997
|
*/
|
|
1002
|
-
const
|
|
998
|
+
const entityDomainKeyForm = (entityLike, record) => {
|
|
1003
999
|
const source = (entityLike.schemas?.inputSchema ?? entityLike.model);
|
|
1004
1000
|
if (source === undefined)
|
|
1005
1001
|
return record;
|
|
1006
|
-
const form =
|
|
1002
|
+
const form = makeCompositeDomainKeyForm(source, (attr, value, reason) => {
|
|
1003
|
+
if (reason !== undefined)
|
|
1004
|
+
return refuseInexact(`Composite "${attr}"`, value, reason);
|
|
1007
1005
|
throw new Error(`[EDD-9050] Composite "${attr}" could not be put into its key form: ` +
|
|
1008
1006
|
`${JSON.stringify(String(value))} resolves under neither encode nor decode->encode.`);
|
|
1009
1007
|
});
|
|
@@ -1070,6 +1068,13 @@ export class DynamoClient extends Context.Service()("@effect-dynamodb/DynamoClie
|
|
|
1070
1068
|
* @param config.region - AWS region
|
|
1071
1069
|
* @param config.endpoint - Optional endpoint override (e.g., for DynamoDB Local)
|
|
1072
1070
|
* @param config.credentials - Optional static credentials
|
|
1071
|
+
* @param config.requestHandler - Optional HTTP handler, or the options of the
|
|
1072
|
+
* runtime's handler (`{ socketTimeout: 5000 }`), passed to the SDK client.
|
|
1073
|
+
* None is set by default, so without one a connection that stays open and
|
|
1074
|
+
* never answers keeps a call waiting until it is interrupted. A handler you
|
|
1075
|
+
* pass is destroyed with the layer.
|
|
1076
|
+
* @param config.maxAttempts - Optional attempts per request, the first
|
|
1077
|
+
* included, passed to the SDK client (its default is 3)
|
|
1073
1078
|
* @param config.compressors - Optional compressors for packed storage
|
|
1074
1079
|
* (`DynamoModel.Packed` with `compression`). When given, the layer also
|
|
1075
1080
|
* provides the `Compression` service built from them. That reaches whatever
|
|
@@ -1090,7 +1095,7 @@ export class DynamoClient extends Context.Service()("@effect-dynamodb/DynamoClie
|
|
|
1090
1095
|
* const live = DynamoClient.layer({ region: "us-east-1", compressors: [ZlibCompression.zstd()] })
|
|
1091
1096
|
* ```
|
|
1092
1097
|
*/
|
|
1093
|
-
static layer = (config) => withCompressors(Layer.effect(DynamoClient, buildService(config.region, config.endpoint, config.credentials)), config.compressors);
|
|
1098
|
+
static layer = (config) => withCompressors(Layer.effect(DynamoClient, buildService(config.region, config.endpoint, config.credentials, config)), config.compressors);
|
|
1094
1099
|
/**
|
|
1095
1100
|
* Create a live Layer that reads configuration from Effect Config providers
|
|
1096
1101
|
* (e.g., environment variables, config files).
|
|
@@ -1098,6 +1103,12 @@ export class DynamoClient extends Context.Service()("@effect-dynamodb/DynamoClie
|
|
|
1098
1103
|
* @param config.region - Config for AWS region
|
|
1099
1104
|
* @param config.endpoint - Optional Config for endpoint override
|
|
1100
1105
|
* @param config.credentials - Optional Config for static credentials
|
|
1106
|
+
* @param config.requestHandler - Optional Config for each of the handler's
|
|
1107
|
+
* timeouts (`connectionTimeout`, `socketTimeout`, `requestTimeout`,
|
|
1108
|
+
* `throwOnRequestTimeout`), which an operator tunes per environment, or an
|
|
1109
|
+
* HTTP handler, which is code and is passed as itself. A timeout missing
|
|
1110
|
+
* from the provider stays unset.
|
|
1111
|
+
* @param config.maxAttempts - Optional Config for the attempts per request
|
|
1101
1112
|
* @param config.compressors - Optional compressors for packed storage; when
|
|
1102
1113
|
* given, the layer also provides the `Compression` service (see {@link layer}
|
|
1103
1114
|
* for why a separate `Compression.layer([...])` is the recommended form).
|
|
@@ -1108,7 +1119,8 @@ export class DynamoClient extends Context.Service()("@effect-dynamodb/DynamoClie
|
|
|
1108
1119
|
const credentials = config.credentials
|
|
1109
1120
|
? yield* Config.option(config.credentials)
|
|
1110
1121
|
: undefined;
|
|
1111
|
-
|
|
1122
|
+
const options = yield* readClientOptions(config);
|
|
1123
|
+
return yield* buildService(region, endpoint && endpoint._tag === "Some" ? endpoint.value : undefined, credentials && credentials._tag === "Some" ? credentials.value : undefined, options);
|
|
1112
1124
|
})), config.compressors);
|
|
1113
1125
|
/**
|
|
1114
1126
|
* Create a typed client gateway from entities, aggregates, and (optionally) tables.
|
|
@@ -1223,6 +1235,15 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1223
1235
|
? Context.add(withEmbedder, Compression, compressionRegistry)
|
|
1224
1236
|
: withEmbedder;
|
|
1225
1237
|
const provide = (effect) => Effect.provide(effect, ctx);
|
|
1238
|
+
// A table's TTL attribute is named by its configuration, so an entity that sets it is checked
|
|
1239
|
+
// here, where the table is bound: a row's reader may not take it as a sparse map's entry
|
|
1240
|
+
// (`[EDD-9140]`, as `Entity.make` checks every name the definition supplies).
|
|
1241
|
+
for (const rawEntity of Object.values(config.entities)) {
|
|
1242
|
+
const entityLike = rawEntity;
|
|
1243
|
+
const tableConfig = Option.getOrUndefined(Context.getOption(baseCtx, entityLike._tableTag));
|
|
1244
|
+
if (tableConfig !== undefined)
|
|
1245
|
+
entityLike._refuseTableAttributes?.(tableConfig);
|
|
1246
|
+
}
|
|
1226
1247
|
// Dimension agreement between the Embedder and every bound vector index is
|
|
1227
1248
|
// a construction-time invariant — a mismatch would otherwise surface as a
|
|
1228
1249
|
// per-write failure long after wiring. See `DESIGN.md §14`.
|
|
@@ -1282,13 +1303,20 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1282
1303
|
// composing keys. The raw model is not equivalent — entity derivation
|
|
1283
1304
|
// substitutes date/Redacted fields with their wire transforms.
|
|
1284
1305
|
const encoderSource = entityLike.schemas.inputSchema ?? entityLike.model;
|
|
1285
|
-
const
|
|
1306
|
+
const unencodable = (attr, value, reason) => {
|
|
1307
|
+
if (reason !== undefined) {
|
|
1308
|
+
return refuseInexact(`Composite "${attr}" on index "${_indexName}" of entity "${entityLike.entityType}"`, value, reason);
|
|
1309
|
+
}
|
|
1286
1310
|
throw new Error(`[EDD-9050] Composite "${attr}" on index "${_indexName}" of entity ` +
|
|
1287
1311
|
`"${entityLike.entityType}" could not be encoded to its stored form. The ` +
|
|
1288
1312
|
`attribute's schema carries an encoding transformation, so the stored key holds ` +
|
|
1289
1313
|
`the ENCODED value, but ${JSON.stringify(String(value))} encodes under neither ` +
|
|
1290
1314
|
`encode nor decode->encode. Supply a value of the attribute's own type.`);
|
|
1291
|
-
}
|
|
1315
|
+
};
|
|
1316
|
+
const compositeKeyForm = makeCompositeKeyForm(encoderSource, unencodable);
|
|
1317
|
+
// The caller's composites and bounds are DOMAIN values: the key `put` wrote for one is
|
|
1318
|
+
// the key form of the value it stores (`Entity._domainKeyForm`).
|
|
1319
|
+
const domainKeyForm = makeCompositeDomainKeyForm(encoderSource, unencodable);
|
|
1292
1320
|
// A Z-order sort key (#171) is a binary address: its prefix composites
|
|
1293
1321
|
// and dimensions are bounded with `.within()`, never pinned by the
|
|
1294
1322
|
// accessor, which takes the partition key composites only.
|
|
@@ -1301,7 +1329,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1301
1329
|
? indexDef.sk.zorderHalf.layout
|
|
1302
1330
|
: undefined;
|
|
1303
1331
|
const zorderPlans = zorderLayout === undefined ? undefined : makeZOrderPlans(zorderLayout);
|
|
1304
|
-
|
|
1332
|
+
const accessor = (rawComposites) => {
|
|
1305
1333
|
if (zorder) {
|
|
1306
1334
|
const misplaced = indexDef.sk.composite.filter((attr) => rawComposites[attr] !== undefined);
|
|
1307
1335
|
if (misplaced.length > 0) {
|
|
@@ -1312,7 +1340,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1312
1340
|
}
|
|
1313
1341
|
}
|
|
1314
1342
|
validateQueryComposites(_indexName, accessorDef, rawComposites);
|
|
1315
|
-
const compositesKeyForm = toCompositeKeyRecord(
|
|
1343
|
+
const compositesKeyForm = toCompositeKeyRecord(domainKeyForm, rawComposites);
|
|
1316
1344
|
// One partition, or a sharded index's several (#183).
|
|
1317
1345
|
const read = KeyComposer.composeReadPartitions(entityLike._schema, entityLike.entityType, indexDef, compositesKeyForm);
|
|
1318
1346
|
const pkValue = read.partitions[0];
|
|
@@ -1456,7 +1484,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1456
1484
|
casing: KeyComposer.effectiveCasing(entityLike._schema, indexDef),
|
|
1457
1485
|
isLast: targetIndex === skComposites.length - 1,
|
|
1458
1486
|
secondary: indexDef.index !== undefined,
|
|
1459
|
-
}, prefixText, targetAttr, mapBound(condition, (value) =>
|
|
1487
|
+
}, prefixText, targetAttr, mapBound(condition, (value) => domainKeyForm(targetAttr, value)), { clampToPrefix: pinnedCount > 0 });
|
|
1460
1488
|
};
|
|
1461
1489
|
const bqConfig = {
|
|
1462
1490
|
pathBuilder,
|
|
@@ -1474,6 +1502,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1474
1502
|
indexDef,
|
|
1475
1503
|
encoderSource,
|
|
1476
1504
|
compositeKeyForm,
|
|
1505
|
+
domainKeyForm,
|
|
1477
1506
|
pkValue,
|
|
1478
1507
|
plans: zorderPlans,
|
|
1479
1508
|
query: q,
|
|
@@ -1488,6 +1517,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1488
1517
|
indexDef,
|
|
1489
1518
|
encoderSource,
|
|
1490
1519
|
compositeKeyForm,
|
|
1520
|
+
domainKeyForm,
|
|
1491
1521
|
pinnedKeyForm: compositesKeyForm,
|
|
1492
1522
|
pkValue,
|
|
1493
1523
|
query: q,
|
|
@@ -1501,6 +1531,20 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1501
1531
|
};
|
|
1502
1532
|
return new BoundQueryImpl(pinnedQuery, bqConfig);
|
|
1503
1533
|
};
|
|
1534
|
+
return (rawComposites) => {
|
|
1535
|
+
const operation = {
|
|
1536
|
+
name: "Entity.query",
|
|
1537
|
+
target: entityLike.entityType,
|
|
1538
|
+
index: _indexName,
|
|
1539
|
+
};
|
|
1540
|
+
return Query.orRefusal(operation, () => accessor(rawComposites), (refusal) => new BoundQueryImpl(Query.refused(indexDef.index, refusal), {
|
|
1541
|
+
pathBuilder: createPathBuilder(),
|
|
1542
|
+
conditionOps: createConditionOps(),
|
|
1543
|
+
provide,
|
|
1544
|
+
...entityNaming(entityLike._resolveDbName),
|
|
1545
|
+
operation,
|
|
1546
|
+
}));
|
|
1547
|
+
};
|
|
1504
1548
|
};
|
|
1505
1549
|
// 2. Bind entities + build entity query accessors
|
|
1506
1550
|
const boundEntities = {};
|
|
@@ -1557,7 +1601,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1557
1601
|
`accessors, \`scan\` and \`reembed\` — rename one of them.`);
|
|
1558
1602
|
}
|
|
1559
1603
|
const vqConfig = {
|
|
1560
|
-
keyForm: (record) =>
|
|
1604
|
+
keyForm: (record) => entityDomainKeyForm(entityLike, record),
|
|
1561
1605
|
entityType: entityLike.entityType,
|
|
1562
1606
|
logicalName,
|
|
1563
1607
|
definition,
|
|
@@ -1608,7 +1652,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1608
1652
|
assertCollectionKeyFormAgreement(collName, members);
|
|
1609
1653
|
KeyComposer.assertCollectionCasingAgreement(collName, members.map((m) => ({ key: m.entityKey, schema: m.entityLike._schema, index: m.indexDef })));
|
|
1610
1654
|
KeyComposer.assertCollectionShardsAgreement(collName, members.map((m) => ({ key: m.entityKey, index: m.indexDef })));
|
|
1611
|
-
|
|
1655
|
+
const collectionAccessor = (composites) => {
|
|
1612
1656
|
// Use the first member for PK composition — verified above to agree
|
|
1613
1657
|
// with every other member.
|
|
1614
1658
|
const firstMember = members[0];
|
|
@@ -1647,7 +1691,7 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1647
1691
|
// different PK from `db.entities.Readings.byWindow({ takenAt })` and
|
|
1648
1692
|
// returned nothing.
|
|
1649
1693
|
// Members share the partitions, whatever each hashes: never pruned (#183).
|
|
1650
|
-
const read = KeyComposer.composeReadPartitions(firstMember.entityLike._schema, firstMember.entityLike.entityType, indexDef,
|
|
1694
|
+
const read = KeyComposer.composeReadPartitions(firstMember.entityLike._schema, firstMember.entityLike.entityType, indexDef, entityDomainKeyForm(firstMember.entityLike, composites), { prune: false });
|
|
1651
1695
|
// Always isolated — begins_with on collection SK prefix
|
|
1652
1696
|
let query = Query.make({
|
|
1653
1697
|
tableName: "",
|
|
@@ -1727,6 +1771,70 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1727
1771
|
};
|
|
1728
1772
|
return new BoundQueryImpl(query, bqConfig);
|
|
1729
1773
|
};
|
|
1774
|
+
boundCollections[collName] = (composites) => {
|
|
1775
|
+
const operation = { name: "Collection.query", target: collName };
|
|
1776
|
+
return Query.orRefusal(operation, () => collectionAccessor(composites), (refusal) => new BoundQueryImpl(Query.refused(members[0].indexDef.index, refusal), {
|
|
1777
|
+
pathBuilder: createPathBuilder(),
|
|
1778
|
+
conditionOps: createConditionOps(),
|
|
1779
|
+
provide,
|
|
1780
|
+
operation,
|
|
1781
|
+
}));
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
// An aggregate declaring `ownsRows` takes every row of its types in its partition. Refused when
|
|
1785
|
+
// another member this client can see can write such a row there (DESIGN.md §7 "Which rows in
|
|
1786
|
+
// its partition are an aggregate's"): those its table declares, those the client binds, and
|
|
1787
|
+
// those of every table the client binds, on the same physical table (by table, or by the
|
|
1788
|
+
// name it resolves to here). A writer it doesn't see, here or in another process, isn't checked.
|
|
1789
|
+
const tableNameOf = (table) => {
|
|
1790
|
+
// A table's tag is a function.
|
|
1791
|
+
if (table === null ||
|
|
1792
|
+
(typeof table !== "object" && typeof table !== "function") ||
|
|
1793
|
+
!("key" in table)) {
|
|
1794
|
+
return undefined;
|
|
1795
|
+
}
|
|
1796
|
+
return Option.getOrUndefined(Context.getOption(baseCtx, table))?.name;
|
|
1797
|
+
};
|
|
1798
|
+
// Every entity the client sees: those it binds, then those of every table it binds, named as a
|
|
1799
|
+
// refusal names them. A member may reach the client only as another bound table's.
|
|
1800
|
+
const visible = [
|
|
1801
|
+
...Object.entries(config.entities),
|
|
1802
|
+
...Object.entries(config.tables ?? {}).flatMap(([tableKey, table]) => Object.entries(table.entities).map(([key, entity]) => [`${tableKey}.${key}`, entity])),
|
|
1803
|
+
];
|
|
1804
|
+
// And every aggregate it sees, the same way.
|
|
1805
|
+
const visibleAggregates = [
|
|
1806
|
+
...Object.entries(config.aggregates ?? {}),
|
|
1807
|
+
...Object.entries(config.tables ?? {}).flatMap(([tableKey, table]) => Object.entries(table.aggregates ?? {}).map(([key, aggregate]) => [`${tableKey}.${key}`, aggregate])),
|
|
1808
|
+
];
|
|
1809
|
+
const visibleMembers = [...visible, ...visibleAggregates].map(([name, member]) => ({
|
|
1810
|
+
name,
|
|
1811
|
+
member,
|
|
1812
|
+
}));
|
|
1813
|
+
// The owners checked are the aggregates it sees, from the same list: `rekey` runs the handler of
|
|
1814
|
+
// a table's aggregate the client doesn't bind itself. Each once, by the first name it has.
|
|
1815
|
+
const checked = new Set();
|
|
1816
|
+
for (const [key, aggregate] of visibleAggregates) {
|
|
1817
|
+
if (aggregate._ownsRows !== true)
|
|
1818
|
+
continue;
|
|
1819
|
+
if (checked.has(aggregate))
|
|
1820
|
+
continue;
|
|
1821
|
+
checked.add(aggregate);
|
|
1822
|
+
const own = aggregate._tableTag;
|
|
1823
|
+
const ownName = tableNameOf(own);
|
|
1824
|
+
const conflict = ownershipConflict(aggregate, visibleMembers, (table) => {
|
|
1825
|
+
if (table === own)
|
|
1826
|
+
return true;
|
|
1827
|
+
const keyOf = (t) => t?.key;
|
|
1828
|
+
if (keyOf(table) !== undefined && keyOf(table) === keyOf(own))
|
|
1829
|
+
return true;
|
|
1830
|
+
return ownName !== undefined && tableNameOf(table) === ownName;
|
|
1831
|
+
});
|
|
1832
|
+
if (conflict !== undefined) {
|
|
1833
|
+
throw new Error(`[EDD-9130] Aggregate "${key}" declares \`ownsRows\`, but "${conflict.member}" can write ` +
|
|
1834
|
+
`a row of type "${conflict.type}" into its partition (${conflict.channel}). ` +
|
|
1835
|
+
`\`ownsRows\` would take that row for the aggregate's: leave it off, or keep ` +
|
|
1836
|
+
`"${conflict.member}"'s rows out of the aggregate's partition.`);
|
|
1837
|
+
}
|
|
1730
1838
|
}
|
|
1731
1839
|
// 4. Bind aggregates
|
|
1732
1840
|
const boundAggregates = {};
|
|
@@ -1740,39 +1848,83 @@ const makeFromConfig = (config) => Effect.gen(function* () {
|
|
|
1740
1848
|
// 5. Build table operations
|
|
1741
1849
|
const client = yield* DynamoClient;
|
|
1742
1850
|
const tables = {};
|
|
1851
|
+
// The entities the client sees (`visible`) are where `rekey` finds the outboxes of their
|
|
1852
|
+
// projections. `entities` comes first, so the read models it found before keep their order.
|
|
1853
|
+
const visibleEntities = visible.map(([, entity]) => entity);
|
|
1854
|
+
const named = visible.map(([name, entity]) => [`"${name}"`, entity]);
|
|
1855
|
+
yield* refuseSharedOutboxKeySpace("DynamoClient.make", named);
|
|
1743
1856
|
// `rekey` (#171) hands each row to the member owning it: the table's
|
|
1744
1857
|
// entities and aggregates, those the client binds on the same table, and
|
|
1745
1858
|
// the streams the caller passes (`DynamoClient.make` binds no streams).
|
|
1746
|
-
const rekeyFor = (tableName, tagKey, registered) => (options) => {
|
|
1747
|
-
const onTable = (member) => member._tableTag?.key ===
|
|
1859
|
+
const rekeyFor = (tableName, tagKey, registered) => (options) => provide(Effect.gen(function* () {
|
|
1860
|
+
const onTable = (member) => member._tableTag?.key ===
|
|
1861
|
+
tagKey;
|
|
1748
1862
|
const handlers = new Set();
|
|
1749
|
-
|
|
1863
|
+
const tableMembers = [
|
|
1750
1864
|
...registered,
|
|
1751
1865
|
...Object.values(config.entities).filter(onTable),
|
|
1752
1866
|
...Object.values(config.aggregates ?? {}).filter(onTable),
|
|
1753
|
-
|
|
1754
|
-
]) {
|
|
1867
|
+
];
|
|
1868
|
+
for (const member of [...tableMembers, ...(options?.streams ?? [])]) {
|
|
1755
1869
|
const handler = Rekey.handlerOf(member);
|
|
1756
1870
|
if (handler !== undefined)
|
|
1757
1871
|
handlers.add(handler);
|
|
1758
1872
|
}
|
|
1759
|
-
//
|
|
1873
|
+
// The read models whose outboxes are on this table are checked before anything is
|
|
1874
|
+
// sent: `rekey` reads an item's key back by its key space, so two whose keys could be
|
|
1875
|
+
// read as each other's are refused here, where `DynamoClient.make` refuses only those
|
|
1876
|
+
// whose items would overwrite each other in normal operation, and so is a member of
|
|
1877
|
+
// this table that would read a read model's items as its own. Projections are defined
|
|
1878
|
+
// when the program runs them, so one defined after the client was made has its outbox
|
|
1879
|
+
// recorded only now. A run's refusal is the run's `ValidationError`.
|
|
1880
|
+
const shared = yield* sharedOutboxKeySpace("rekey", named, {
|
|
1881
|
+
key: tagKey,
|
|
1882
|
+
name: tableName,
|
|
1883
|
+
members: [...new Set(tableMembers)].map((member) => [
|
|
1884
|
+
named.find(([, entity]) => entity === member)?.[0] ??
|
|
1885
|
+
`"${member.entityType}"`,
|
|
1886
|
+
member,
|
|
1887
|
+
]),
|
|
1888
|
+
});
|
|
1889
|
+
if (shared !== undefined) {
|
|
1890
|
+
return yield* new ValidationError({
|
|
1891
|
+
entityType: "Table",
|
|
1892
|
+
operation: "rekey",
|
|
1893
|
+
cause: shared,
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
// The outboxes on this table of a read model on another (#171): every projection's, so
|
|
1897
|
+
// a second projection of one read model doesn't hide the first's items, named by this
|
|
1898
|
+
// table's service or by another handle on the same physical table. A read model's
|
|
1899
|
+
// projections may have one each, on tables of their own.
|
|
1760
1900
|
const outboxOf = new Set();
|
|
1761
|
-
for (const entity of [...registered, ...
|
|
1762
|
-
|
|
1763
|
-
if (outbox === undefined || outbox.table.Tag.key !== tagKey || outboxOf.has(entity)) {
|
|
1901
|
+
for (const entity of [...registered, ...visibleEntities]) {
|
|
1902
|
+
if (outboxOf.has(entity))
|
|
1764
1903
|
continue;
|
|
1765
|
-
}
|
|
1766
1904
|
outboxOf.add(entity);
|
|
1905
|
+
// Their key attributes, once each.
|
|
1906
|
+
const layouts = new Map();
|
|
1907
|
+
for (const outbox of remoteOutboxesOf(entity)) {
|
|
1908
|
+
if (outbox.table.Tag.key !== tagKey &&
|
|
1909
|
+
(yield* physicalTableName(outbox.table.Tag)) !== tableName) {
|
|
1910
|
+
continue;
|
|
1911
|
+
}
|
|
1912
|
+
layouts.set(`${outbox.pk}\u0000${outbox.sk}`, { pk: outbox.pk, sk: outbox.sk });
|
|
1913
|
+
}
|
|
1914
|
+
if (layouts.size === 0)
|
|
1915
|
+
continue;
|
|
1916
|
+
const keys = [...layouts.values()];
|
|
1767
1917
|
const readModel = entity;
|
|
1768
1918
|
handlers.add({
|
|
1769
1919
|
name: readModel.entityType,
|
|
1770
1920
|
types: [`${readModel.entityType}#outbox`],
|
|
1771
|
-
|
|
1921
|
+
// A table has one key schema, so its items are under the layout whose attributes
|
|
1922
|
+
// they hold.
|
|
1923
|
+
row: (row, ctx) => readModel._rekeyProjectionRow(row, ctx, keys.find((key) => row[key.pk]?.S !== undefined && row[key.sk]?.S !== undefined) ?? keys[0]),
|
|
1772
1924
|
});
|
|
1773
1925
|
}
|
|
1774
|
-
return
|
|
1775
|
-
};
|
|
1926
|
+
return yield* Rekey.run({ tableName, members: [...handlers], options });
|
|
1927
|
+
}));
|
|
1776
1928
|
if (config.tables) {
|
|
1777
1929
|
for (const [tableKey, table] of Object.entries(config.tables)) {
|
|
1778
1930
|
const tableConfig = yield* table.Tag;
|
|
@@ -2106,138 +2258,142 @@ export const classifyError = (operation) => (thrown) => {
|
|
|
2106
2258
|
return new DynamoError({ operation, cause });
|
|
2107
2259
|
};
|
|
2108
2260
|
/** @internal Build the DynamoClient service implementation from resolved config values. */
|
|
2109
|
-
const buildService = (region, endpoint, credentials) => Effect.gen(function* () {
|
|
2261
|
+
const buildService = (region, endpoint, credentials, options) => Effect.gen(function* () {
|
|
2110
2262
|
const clientConfig = { region };
|
|
2111
2263
|
if (endpoint !== undefined)
|
|
2112
2264
|
clientConfig.endpoint = endpoint;
|
|
2113
2265
|
if (credentials !== undefined)
|
|
2114
2266
|
clientConfig.credentials = credentials;
|
|
2115
|
-
|
|
2267
|
+
if (options.requestHandler !== undefined)
|
|
2268
|
+
clientConfig.requestHandler = options.requestHandler;
|
|
2269
|
+
if (options.maxAttempts !== undefined)
|
|
2270
|
+
clientConfig.maxAttempts = options.maxAttempts;
|
|
2271
|
+
const client = yield* acquireSdkClient(() => new DynamoDBClient(clientConfig));
|
|
2116
2272
|
return {
|
|
2117
2273
|
createTable: (input) => Effect.tryPromise({
|
|
2118
|
-
try: () => client.send(new CreateTableCommand(input)),
|
|
2274
|
+
try: (signal) => client.send(new CreateTableCommand(input), { abortSignal: signal }),
|
|
2119
2275
|
catch: classifyError("CreateTable"),
|
|
2120
2276
|
}),
|
|
2121
2277
|
deleteTable: (input) => Effect.tryPromise({
|
|
2122
|
-
try: () => client.send(new DeleteTableCommand(input)),
|
|
2278
|
+
try: (signal) => client.send(new DeleteTableCommand(input), { abortSignal: signal }),
|
|
2123
2279
|
catch: classifyError("DeleteTable"),
|
|
2124
2280
|
}),
|
|
2125
2281
|
describeTable: (input) => Effect.tryPromise({
|
|
2126
|
-
try: () => client.send(new DescribeTableCommand(input)),
|
|
2282
|
+
try: (signal) => client.send(new DescribeTableCommand(input), { abortSignal: signal }),
|
|
2127
2283
|
catch: classifyError("DescribeTable"),
|
|
2128
2284
|
}),
|
|
2129
2285
|
putItem: (input) => Effect.tryPromise({
|
|
2130
|
-
try: () => client.send(new PutItemCommand(input)),
|
|
2286
|
+
try: (signal) => client.send(new PutItemCommand(input), { abortSignal: signal }),
|
|
2131
2287
|
catch: classifyError("PutItem"),
|
|
2132
2288
|
}),
|
|
2133
2289
|
getItem: (input) => Effect.tryPromise({
|
|
2134
|
-
try: () => client.send(new GetItemCommand(input)),
|
|
2290
|
+
try: (signal) => client.send(new GetItemCommand(input), { abortSignal: signal }),
|
|
2135
2291
|
catch: classifyError("GetItem"),
|
|
2136
2292
|
}),
|
|
2137
2293
|
deleteItem: (input) => Effect.tryPromise({
|
|
2138
|
-
try: () => client.send(new DeleteItemCommand(input)),
|
|
2294
|
+
try: (signal) => client.send(new DeleteItemCommand(input), { abortSignal: signal }),
|
|
2139
2295
|
catch: classifyError("DeleteItem"),
|
|
2140
2296
|
}),
|
|
2141
2297
|
updateItem: (input) => Effect.tryPromise({
|
|
2142
|
-
try: () => client.send(new UpdateItemCommand(input)),
|
|
2298
|
+
try: (signal) => client.send(new UpdateItemCommand(input), { abortSignal: signal }),
|
|
2143
2299
|
catch: classifyError("UpdateItem"),
|
|
2144
2300
|
}),
|
|
2145
2301
|
query: (input) => Effect.tryPromise({
|
|
2146
|
-
try: () => client.send(new QueryCommand(input)),
|
|
2302
|
+
try: (signal) => client.send(new QueryCommand(input), { abortSignal: signal }),
|
|
2147
2303
|
catch: classifyError("Query"),
|
|
2148
2304
|
}),
|
|
2149
2305
|
scan: (input) => Effect.tryPromise({
|
|
2150
|
-
try: () => client.send(new ScanCommand(input)),
|
|
2306
|
+
try: (signal) => client.send(new ScanCommand(input), { abortSignal: signal }),
|
|
2151
2307
|
catch: classifyError("Scan"),
|
|
2152
2308
|
}),
|
|
2153
2309
|
searchVectors: (input) => Effect.tryPromise({
|
|
2154
|
-
try: () => client.send(new SearchVectorsCommand(input)),
|
|
2310
|
+
try: (signal) => client.send(new SearchVectorsCommand(input), { abortSignal: signal }),
|
|
2155
2311
|
catch: classifyError("SearchVectors"),
|
|
2156
2312
|
}),
|
|
2157
2313
|
batchGetItem: (input) => Effect.tryPromise({
|
|
2158
|
-
try: () => client.send(new BatchGetItemCommand(input)),
|
|
2314
|
+
try: (signal) => client.send(new BatchGetItemCommand(input), { abortSignal: signal }),
|
|
2159
2315
|
catch: classifyError("BatchGetItem"),
|
|
2160
2316
|
}),
|
|
2161
2317
|
batchWriteItem: (input) => Effect.tryPromise({
|
|
2162
|
-
try: () => client.send(new BatchWriteItemCommand(input)),
|
|
2318
|
+
try: (signal) => client.send(new BatchWriteItemCommand(input), { abortSignal: signal }),
|
|
2163
2319
|
catch: classifyError("BatchWriteItem"),
|
|
2164
2320
|
}),
|
|
2165
2321
|
transactGetItems: (input) => Effect.tryPromise({
|
|
2166
|
-
try: () => client.send(new TransactGetItemsCommand(input)),
|
|
2322
|
+
try: (signal) => client.send(new TransactGetItemsCommand(input), { abortSignal: signal }),
|
|
2167
2323
|
catch: classifyError("TransactGetItems"),
|
|
2168
2324
|
}),
|
|
2169
2325
|
transactWriteItems: (input) => Effect.tryPromise({
|
|
2170
|
-
try: () => client.send(new TransactWriteItemsCommand(input)),
|
|
2326
|
+
try: (signal) => client.send(new TransactWriteItemsCommand(input), { abortSignal: signal }),
|
|
2171
2327
|
catch: classifyError("TransactWriteItems"),
|
|
2172
2328
|
}),
|
|
2173
2329
|
// --- Table management ---
|
|
2174
2330
|
updateTable: (input) => Effect.tryPromise({
|
|
2175
|
-
try: () => client.send(new UpdateTableCommand(input)),
|
|
2331
|
+
try: (signal) => client.send(new UpdateTableCommand(input), { abortSignal: signal }),
|
|
2176
2332
|
catch: classifyError("UpdateTable"),
|
|
2177
2333
|
}),
|
|
2178
2334
|
listTables: (input) => Effect.tryPromise({
|
|
2179
|
-
try: () => client.send(new ListTablesCommand(input)),
|
|
2335
|
+
try: (signal) => client.send(new ListTablesCommand(input), { abortSignal: signal }),
|
|
2180
2336
|
catch: classifyError("ListTables"),
|
|
2181
2337
|
}),
|
|
2182
2338
|
// --- Backup ---
|
|
2183
2339
|
createBackup: (input) => Effect.tryPromise({
|
|
2184
|
-
try: () => client.send(new CreateBackupCommand(input)),
|
|
2340
|
+
try: (signal) => client.send(new CreateBackupCommand(input), { abortSignal: signal }),
|
|
2185
2341
|
catch: classifyError("CreateBackup"),
|
|
2186
2342
|
}),
|
|
2187
2343
|
deleteBackup: (input) => Effect.tryPromise({
|
|
2188
|
-
try: () => client.send(new DeleteBackupCommand(input)),
|
|
2344
|
+
try: (signal) => client.send(new DeleteBackupCommand(input), { abortSignal: signal }),
|
|
2189
2345
|
catch: classifyError("DeleteBackup"),
|
|
2190
2346
|
}),
|
|
2191
2347
|
listBackups: (input) => Effect.tryPromise({
|
|
2192
|
-
try: () => client.send(new ListBackupsCommand(input)),
|
|
2348
|
+
try: (signal) => client.send(new ListBackupsCommand(input), { abortSignal: signal }),
|
|
2193
2349
|
catch: classifyError("ListBackups"),
|
|
2194
2350
|
}),
|
|
2195
2351
|
restoreTableFromBackup: (input) => Effect.tryPromise({
|
|
2196
|
-
try: () => client.send(new RestoreTableFromBackupCommand(input)),
|
|
2352
|
+
try: (signal) => client.send(new RestoreTableFromBackupCommand(input), { abortSignal: signal }),
|
|
2197
2353
|
catch: classifyError("RestoreTableFromBackup"),
|
|
2198
2354
|
}),
|
|
2199
2355
|
// --- PITR ---
|
|
2200
2356
|
describeContinuousBackups: (input) => Effect.tryPromise({
|
|
2201
|
-
try: () => client.send(new DescribeContinuousBackupsCommand(input)),
|
|
2357
|
+
try: (signal) => client.send(new DescribeContinuousBackupsCommand(input), { abortSignal: signal }),
|
|
2202
2358
|
catch: classifyError("DescribeContinuousBackups"),
|
|
2203
2359
|
}),
|
|
2204
2360
|
updateContinuousBackups: (input) => Effect.tryPromise({
|
|
2205
|
-
try: () => client.send(new UpdateContinuousBackupsCommand(input)),
|
|
2361
|
+
try: (signal) => client.send(new UpdateContinuousBackupsCommand(input), { abortSignal: signal }),
|
|
2206
2362
|
catch: classifyError("UpdateContinuousBackups"),
|
|
2207
2363
|
}),
|
|
2208
2364
|
restoreTableToPointInTime: (input) => Effect.tryPromise({
|
|
2209
|
-
try: () => client.send(new RestoreTableToPointInTimeCommand(input)),
|
|
2365
|
+
try: (signal) => client.send(new RestoreTableToPointInTimeCommand(input), { abortSignal: signal }),
|
|
2210
2366
|
catch: classifyError("RestoreTableToPointInTime"),
|
|
2211
2367
|
}),
|
|
2212
2368
|
// --- Export ---
|
|
2213
2369
|
exportTableToPointInTime: (input) => Effect.tryPromise({
|
|
2214
|
-
try: () => client.send(new ExportTableToPointInTimeCommand(input)),
|
|
2370
|
+
try: (signal) => client.send(new ExportTableToPointInTimeCommand(input), { abortSignal: signal }),
|
|
2215
2371
|
catch: classifyError("ExportTableToPointInTime"),
|
|
2216
2372
|
}),
|
|
2217
2373
|
describeExport: (input) => Effect.tryPromise({
|
|
2218
|
-
try: () => client.send(new DescribeExportCommand(input)),
|
|
2374
|
+
try: (signal) => client.send(new DescribeExportCommand(input), { abortSignal: signal }),
|
|
2219
2375
|
catch: classifyError("DescribeExport"),
|
|
2220
2376
|
}),
|
|
2221
2377
|
// --- TTL ---
|
|
2222
2378
|
updateTimeToLive: (input) => Effect.tryPromise({
|
|
2223
|
-
try: () => client.send(new UpdateTimeToLiveCommand(input)),
|
|
2379
|
+
try: (signal) => client.send(new UpdateTimeToLiveCommand(input), { abortSignal: signal }),
|
|
2224
2380
|
catch: classifyError("UpdateTimeToLive"),
|
|
2225
2381
|
}),
|
|
2226
2382
|
describeTimeToLive: (input) => Effect.tryPromise({
|
|
2227
|
-
try: () => client.send(new DescribeTimeToLiveCommand(input)),
|
|
2383
|
+
try: (signal) => client.send(new DescribeTimeToLiveCommand(input), { abortSignal: signal }),
|
|
2228
2384
|
catch: classifyError("DescribeTimeToLive"),
|
|
2229
2385
|
}),
|
|
2230
2386
|
// --- Tags ---
|
|
2231
2387
|
tagResource: (input) => Effect.tryPromise({
|
|
2232
|
-
try: () => client.send(new TagResourceCommand(input)),
|
|
2388
|
+
try: (signal) => client.send(new TagResourceCommand(input), { abortSignal: signal }),
|
|
2233
2389
|
catch: classifyError("TagResource"),
|
|
2234
2390
|
}),
|
|
2235
2391
|
untagResource: (input) => Effect.tryPromise({
|
|
2236
|
-
try: () => client.send(new UntagResourceCommand(input)),
|
|
2392
|
+
try: (signal) => client.send(new UntagResourceCommand(input), { abortSignal: signal }),
|
|
2237
2393
|
catch: classifyError("UntagResource"),
|
|
2238
2394
|
}),
|
|
2239
2395
|
listTagsOfResource: (input) => Effect.tryPromise({
|
|
2240
|
-
try: () => client.send(new ListTagsOfResourceCommand(input)),
|
|
2396
|
+
try: (signal) => client.send(new ListTagsOfResourceCommand(input), { abortSignal: signal }),
|
|
2241
2397
|
catch: classifyError("ListTagsOfResource"),
|
|
2242
2398
|
}),
|
|
2243
2399
|
};
|