effect-dynamodb 1.36.1 → 1.37.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 +29 -17
- package/dist/Aggregate.d.ts.map +1 -1
- package/dist/Aggregate.js +795 -173
- package/dist/Aggregate.js.map +1 -1
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +196 -77
- package/dist/Batch.js.map +1 -1
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +11 -2
- package/dist/Collection.js.map +1 -1
- package/dist/Collections.d.ts +15 -6
- package/dist/Collections.d.ts.map +1 -1
- package/dist/Collections.js +2 -1
- package/dist/Collections.js.map +1 -1
- package/dist/DynamoClient.d.ts +117 -10
- package/dist/DynamoClient.d.ts.map +1 -1
- package/dist/DynamoClient.js +1145 -141
- package/dist/DynamoClient.js.map +1 -1
- package/dist/Entity.d.ts +126 -51
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +3477 -539
- package/dist/Entity.js.map +1 -1
- package/dist/EventStore.d.ts +4 -3
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +616 -53
- package/dist/EventStore.js.map +1 -1
- package/dist/Query.d.ts +311 -25
- package/dist/Query.d.ts.map +1 -1
- package/dist/Query.js +1159 -103
- package/dist/Query.js.map +1 -1
- package/dist/Table.d.ts +172 -3
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +85 -4
- package/dist/Table.js.map +1 -1
- package/dist/Transaction.d.ts +18 -2
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +62 -8
- package/dist/Transaction.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/BoundQuery.d.ts +226 -32
- package/dist/internal/BoundQuery.d.ts.map +1 -1
- package/dist/internal/BoundQuery.js +96 -18
- package/dist/internal/BoundQuery.js.map +1 -1
- package/dist/internal/Capacity.d.ts +8 -0
- package/dist/internal/Capacity.d.ts.map +1 -1
- package/dist/internal/Capacity.js +24 -4
- package/dist/internal/Capacity.js.map +1 -1
- package/dist/internal/Cursor.d.ts +90 -0
- package/dist/internal/Cursor.d.ts.map +1 -0
- package/dist/internal/Cursor.js +179 -0
- package/dist/internal/Cursor.js.map +1 -0
- package/dist/internal/ExpressionLimits.d.ts +18 -2
- package/dist/internal/ExpressionLimits.d.ts.map +1 -1
- package/dist/internal/ExpressionLimits.js +35 -2
- package/dist/internal/ExpressionLimits.js.map +1 -1
- package/dist/internal/ProjectionEngine.d.ts +16 -0
- package/dist/internal/ProjectionEngine.d.ts.map +1 -1
- package/dist/internal/ProjectionEngine.js +242 -46
- package/dist/internal/ProjectionEngine.js.map +1 -1
- package/dist/internal/RangePlanner.d.ts +394 -0
- package/dist/internal/RangePlanner.d.ts.map +1 -0
- package/dist/internal/RangePlanner.js +1296 -0
- package/dist/internal/RangePlanner.js.map +1 -0
- package/dist/internal/Rekey.d.ts +78 -0
- package/dist/internal/Rekey.d.ts.map +1 -0
- package/dist/internal/Rekey.js +323 -0
- package/dist/internal/Rekey.js.map +1 -0
- package/dist/internal/TransactPlan.d.ts +8 -1
- package/dist/internal/TransactPlan.d.ts.map +1 -1
- package/dist/internal/TransactPlan.js +9 -2
- package/dist/internal/TransactPlan.js.map +1 -1
- package/dist/internal/TransactWriteOps.d.ts +10 -7
- package/dist/internal/TransactWriteOps.d.ts.map +1 -1
- package/dist/internal/TransactWriteOps.js +82 -6
- package/dist/internal/TransactWriteOps.js.map +1 -1
- package/dist/internal/TransactableOps.d.ts +31 -0
- package/dist/internal/TransactableOps.d.ts.map +1 -1
- package/dist/internal/TransactableOps.js +50 -1
- package/dist/internal/TransactableOps.js.map +1 -1
- package/dist/internal/WriteDiagnosis.d.ts.map +1 -1
- package/dist/internal/WriteDiagnosis.js +10 -7
- package/dist/internal/WriteDiagnosis.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionLimits.d.ts","sourceRoot":"","sources":["../../src/internal/ExpressionLimits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,OAAO,CAAA;AACzC,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAC3C,oDAAoD;AACpD,eAAO,MAAM,eAAe,MAAM,CAAA;AAQlC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,EAAE,MAAM,WAAW,GAAG,QAAQ,KAAG,MAoBjF,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,KAAG,MAQtD,CAAA;AAED,2DAA2D;AAC3D,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,GAAG,SAAS,EAC9B,OAAM,WAAW,GAAG,QAAsB,KACzC;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAGwB,CAAA;AAEhF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,OAAM,WAAW,GAAG,QAAsB,KACzC,OAOF,CAAA"}
|
|
1
|
+
{"version":3,"file":"ExpressionLimits.d.ts","sourceRoot":"","sources":["../../src/internal/ExpressionLimits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,OAAO,CAAA;AACzC,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAC3C,oDAAoD;AACpD,eAAO,MAAM,eAAe,MAAM,CAAA;AAQlC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,EAAE,MAAM,WAAW,GAAG,QAAQ,KAAG,MAoBjF,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,KAAG,MAQtD,CAAA;AAED,2DAA2D;AAC3D,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,GAAG,SAAS,EAC9B,OAAM,WAAW,GAAG,QAAsB,KACzC;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAGwB,CAAA;AAEhF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,OAAM,WAAW,GAAG,QAAsB,KACzC,OAOF,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,EACtC,SAAS,MAAM,EACf,QAAQ,aAAa,CAAC,MAAM,CAAC,EAC7B,SAAQ,aAAa,CAAC,MAAM,CAAM,KACjC;IACD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzD,QAAQ,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CAwBpE,CAAA"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Used two ways, neither of them a pre-check:
|
|
6
6
|
*
|
|
7
7
|
* - by strategies that pick a request that fits — `Entity`'s wide-update split
|
|
8
|
-
* and its strongest-guard fallback ({@link expressionFits})
|
|
9
|
-
* nothing;
|
|
8
|
+
* and its strongest-guard fallback ({@link expressionFits}), the guard on a
|
|
9
|
+
* 1.36 row's move ({@link asReadGuard}) — refusing nothing;
|
|
10
10
|
* - by `WriteDiagnosis.ts`, to confirm DynamoDB's rejection of an expression
|
|
11
11
|
* against the request that was sent and name it.
|
|
12
12
|
*
|
|
@@ -86,4 +86,37 @@ export const expressionFits = (expression, kind = "condition") => {
|
|
|
86
86
|
cost.operators <= EXPRESSION_MAX_OPERATORS &&
|
|
87
87
|
largestInOperands(expression) <= IN_MAX_OPERANDS);
|
|
88
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* The condition that a stored row is still as it was read (#171): it exists,
|
|
91
|
+
* and every attribute but its table key (`pkField`, `sk`) holds the value
|
|
92
|
+
* read — `prefer`'s first (an `updatedAt`), then the rest by name, as many as
|
|
93
|
+
* fit DynamoDB's limits on one expression (all of any row but a very wide
|
|
94
|
+
* one). A Delete of a 1.36 row carries it, so a row a write changed in
|
|
95
|
+
* between cancels the move instead of being lost. `absent` names attributes
|
|
96
|
+
* the read did not have that a write may add without changing any other (an
|
|
97
|
+
* outbox drainer's claim): each must still be absent.
|
|
98
|
+
*/
|
|
99
|
+
export const asReadGuard = (stored, pkField, prefer, absent = []) => {
|
|
100
|
+
const names = { "#gpk": pkField };
|
|
101
|
+
const values = {};
|
|
102
|
+
let expression = "attribute_exists(#gpk)";
|
|
103
|
+
for (const [i, attr] of absent.filter((attr) => stored[attr] === undefined).entries()) {
|
|
104
|
+
names[`#ga${i}`] = attr;
|
|
105
|
+
expression = `${expression} AND attribute_not_exists(#ga${i})`;
|
|
106
|
+
}
|
|
107
|
+
const attrs = [...new Set([...prefer, ...Object.keys(stored).sort()])].filter((attr) => attr !== pkField && attr !== "sk" && stored[attr] !== undefined);
|
|
108
|
+
for (const [i, attr] of attrs.entries()) {
|
|
109
|
+
const clause = `#g${i} = :g${i}`;
|
|
110
|
+
if (!expressionFits(`${expression} AND ${clause}`))
|
|
111
|
+
continue;
|
|
112
|
+
names[`#g${i}`] = attr;
|
|
113
|
+
values[`:g${i}`] = stored[attr];
|
|
114
|
+
expression = `${expression} AND ${clause}`;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
ConditionExpression: expression,
|
|
118
|
+
ExpressionAttributeNames: names,
|
|
119
|
+
...(Object.keys(values).length > 0 && { ExpressionAttributeValues: values }),
|
|
120
|
+
};
|
|
121
|
+
};
|
|
89
122
|
//# sourceMappingURL=ExpressionLimits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionLimits.js","sourceRoot":"","sources":["../../src/internal/ExpressionLimits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"ExpressionLimits.js","sourceRoot":"","sources":["../../src/internal/ExpressionLimits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,kEAAkE;AAClE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AACzC,oEAAoE;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAC3C,oDAAoD;AACpD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC;;;GAGG;AACH,MAAM,gBAAgB,GAAG,sDAAsD,CAAA;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAkB,EAAE,IAA4B,EAAU,EAAE;IACzF,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAA;IACvD,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,QAAQ,GAAG,CAAC,CAAA;IAChB,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QAChC,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAA;QACxE,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,IAAI,UAAU;gBAAE,KAAK,EAAE,CAAA;YACzD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,MAAM,CAC3E,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,CAC1E,CAAA;IACD,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAA;QAChC,IAAI,CAAC,cAAc,CAAC,GAAG,UAAU,QAAQ,MAAM,EAAE,CAAC;YAAE,SAAQ;QAC5D,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;QACtB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAE,CAAA;QAChC,UAAU,GAAG,GAAG,UAAU,QAAQ,MAAM,EAAE,CAAA;IAC5C,CAAC;IACD,OAAO;QACL,mBAAmB,EAAE,UAAU;QAC/B,wBAAwB,EAAE,KAAK;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,CAAC;KAC7E,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
|
+
import type { AttributeValue } from "@aws-sdk/client-dynamodb";
|
|
17
18
|
import { ConcurrentModification, type ConditionalCheckFailed, ValidationError } from "@effect-dynamodb/schema/Errors.js";
|
|
18
19
|
import { type Duration, Effect, Option, Schedule, type Schema } from "effect";
|
|
19
20
|
import type { StreamEvent } from "../EventStore.js";
|
|
@@ -81,6 +82,17 @@ export interface EngineEntity {
|
|
|
81
82
|
readonly _attachPrototype?: ((decoded: any) => any) | undefined;
|
|
82
83
|
readonly _multiItemWriteFeatures?: ReadonlyArray<string> | undefined;
|
|
83
84
|
readonly schemas: any;
|
|
85
|
+
readonly _primaryKey136: (key: Record<string, unknown>, force?: boolean) => Record<string, string> | undefined;
|
|
86
|
+
readonly _ownsRow136: (key: Record<string, unknown>, at: Record<string, unknown>, row: Record<string, AttributeValue>) => boolean;
|
|
87
|
+
readonly _spells136: (key: Record<string, unknown>) => boolean;
|
|
88
|
+
readonly _currentKeyOf136: (stored: Record<string, unknown>, force?: boolean) => {
|
|
89
|
+
readonly current: Record<string, string>;
|
|
90
|
+
} | "same" | undefined;
|
|
91
|
+
readonly _clearAlias136: (key: Record<string, unknown>, operation: string) => Effect.Effect<any, any, any>;
|
|
92
|
+
readonly _displaceValueless136: (tableName: string, keys: {
|
|
93
|
+
readonly pk: string;
|
|
94
|
+
readonly sk: string;
|
|
95
|
+
}, row: Record<string, AttributeValue>, operation: string) => Effect.Effect<boolean, any, any>;
|
|
84
96
|
}
|
|
85
97
|
/** @internal One source a row engine reads. */
|
|
86
98
|
export interface EngineSource {
|
|
@@ -230,6 +242,10 @@ interface Row {
|
|
|
230
242
|
readonly values: Record<string, unknown>;
|
|
231
243
|
readonly tombstone: boolean;
|
|
232
244
|
readonly createdAt: unknown;
|
|
245
|
+
/** The row's 1.36 key, when it was read there (#171): the write moves it. */
|
|
246
|
+
readonly at136?: Record<string, string> | undefined;
|
|
247
|
+
/** The row as stored, when it was read at its 1.36 key: the move deletes it only while it is so. */
|
|
248
|
+
readonly stored?: Record<string, AttributeValue> | undefined;
|
|
233
249
|
}
|
|
234
250
|
/** @internal */
|
|
235
251
|
export declare const makeEngine: (config: EngineConfig) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectionEngine.d.ts","sourceRoot":"","sources":["../../src/internal/ProjectionEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"ProjectionEngine.d.ts","sourceRoot":"","sources":["../../src/internal/ProjectionEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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M,CAAA;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;KAAE,CAAC,CAAA;CACtF;AASD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAGpB,CAAA;AAEzC,wCAAwC;AACxC,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC,GAAG,SAAS,KAC7E,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAKgB,CAAA;AAErD,YAAY,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -23,7 +23,8 @@ import { fromAttributeMap, toAttributeMap } from "../Marshaller.js";
|
|
|
23
23
|
import { resolveTtlAttributeName } from "../Table.js";
|
|
24
24
|
import * as Capacity from "./Capacity.js";
|
|
25
25
|
import { condition as entityCondition } from "./EntityCombinators.js";
|
|
26
|
-
import {
|
|
26
|
+
import { asReadGuard } from "./ExpressionLimits.js";
|
|
27
|
+
import { OUTBOX_CLAIM as CLAIM_TOKEN, OUTBOX_CLAIMED_UNTIL as CLAIMED_UNTIL, composePrimaryKey, generateTimestampPrimitive, KEY_TEXT, OUTBOX_ROW_PK as ROW_PK, OUTBOX_ROW_SK as ROW_SK, validateAndBuildPutItem, } from "./TransactableOps.js";
|
|
27
28
|
// ---------------------------------------------------------------------------
|
|
28
29
|
// Removal (#154)
|
|
29
30
|
// ---------------------------------------------------------------------------
|
|
@@ -59,10 +60,6 @@ export const tombstoneMarker = (entityType) => `${entityType}#tombstone`;
|
|
|
59
60
|
export const outboxMarker = (entityType) => `${entityType}#outbox`;
|
|
60
61
|
/** Attribute names the engine owns on tombstones and outbox items. */
|
|
61
62
|
export const REMOVED_AT = "__edd_removed__";
|
|
62
|
-
const CLAIM_TOKEN = "__edd_claim__";
|
|
63
|
-
const CLAIMED_UNTIL = "__edd_claimed_until__";
|
|
64
|
-
const ROW_PK = "__edd_row_pk__";
|
|
65
|
-
const ROW_SK = "__edd_row_sk__";
|
|
66
63
|
/** The engine's own lost-race signal. */
|
|
67
64
|
class LostRace {
|
|
68
65
|
key;
|
|
@@ -134,19 +131,50 @@ export const makeEngine = (config) => {
|
|
|
134
131
|
revision: config.revision?.field,
|
|
135
132
|
};
|
|
136
133
|
}
|
|
134
|
+
// An outbox on another table: that table's `rekey` moves its items (#171).
|
|
135
|
+
if (config.outbox?.table !== undefined) {
|
|
136
|
+
;
|
|
137
|
+
readModel._projectionOutbox = {
|
|
138
|
+
table: config.outbox.table,
|
|
139
|
+
pk: config.outbox.pk,
|
|
140
|
+
sk: config.outbox.sk,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
137
143
|
const tableName = Effect.suspend(() => Effect.map(readModel._tableTag, (tc) => tc.name));
|
|
138
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* The row, read strongly consistent — raw, so a tombstone reads as one. A
|
|
146
|
+
* row 1.36 wrote under a key whose text changed (#171) is read there when
|
|
147
|
+
* its current key holds none, as the read model's own reads do: judged by
|
|
148
|
+
* its values (`_ownsRow136`; a tombstone, which holds none, by its key and
|
|
149
|
+
* `KEY_TEXT`), another value's 1.36 row at the current key is no row, nor
|
|
150
|
+
* is that value's current row at the 1.36 key. A row found at its 1.36 key
|
|
151
|
+
* carries it (`at136`), so the write moves it.
|
|
152
|
+
*/
|
|
139
153
|
const readRow = (key) => Effect.gen(function* () {
|
|
140
154
|
const client = yield* Capacity.client;
|
|
141
155
|
const TableName = yield* tableName;
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
Key: toAttributeMap(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
156
|
+
const rowKey = key;
|
|
157
|
+
const read = (at) => client
|
|
158
|
+
.getItem({ TableName, Key: toAttributeMap(at), ConsistentRead: true })
|
|
159
|
+
.pipe(Effect.map((result) => result.Item));
|
|
160
|
+
const current = composePrimaryKey(readModel, rowKey);
|
|
161
|
+
let item = yield* read(current);
|
|
162
|
+
if (item !== undefined && !readModel._ownsRow136(rowKey, current, item))
|
|
163
|
+
item = undefined;
|
|
164
|
+
let at136;
|
|
165
|
+
if (item === undefined) {
|
|
166
|
+
const old = readModel._primaryKey136(rowKey);
|
|
167
|
+
if (old !== undefined) {
|
|
168
|
+
const held = yield* read(old);
|
|
169
|
+
if (held !== undefined && readModel._ownsRow136(rowKey, old, held)) {
|
|
170
|
+
item = held;
|
|
171
|
+
at136 = old;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
148
175
|
if (item === undefined)
|
|
149
176
|
return Option.none();
|
|
177
|
+
const moving = at136 === undefined ? {} : { at136, stored: item };
|
|
150
178
|
if (item.__edd_e__?.S === tombstoneMarker(entityType)) {
|
|
151
179
|
const raw = fromAttributeMap(item);
|
|
152
180
|
const values = {};
|
|
@@ -155,7 +183,7 @@ export const makeEngine = (config) => {
|
|
|
155
183
|
if (v !== undefined)
|
|
156
184
|
values[f] = v;
|
|
157
185
|
}
|
|
158
|
-
return Option.some({ values, tombstone: true, createdAt: undefined });
|
|
186
|
+
return Option.some({ values, tombstone: true, createdAt: undefined, ...moving });
|
|
159
187
|
}
|
|
160
188
|
const decoded = (yield* decodeMarshalledItem(readModel, item));
|
|
161
189
|
let values = decoded;
|
|
@@ -169,6 +197,7 @@ export const makeEngine = (config) => {
|
|
|
169
197
|
values: readModel._attachPrototype?.(values) ?? values,
|
|
170
198
|
tombstone: false,
|
|
171
199
|
createdAt: createdAtField === null ? undefined : decoded[createdAtField],
|
|
200
|
+
...moving,
|
|
172
201
|
});
|
|
173
202
|
});
|
|
174
203
|
/**
|
|
@@ -323,7 +352,7 @@ export const makeEngine = (config) => {
|
|
|
323
352
|
? { pk: primary.pk.field, sk: primary.sk.field }
|
|
324
353
|
: { pk: config.outbox.pk, sk: config.outbox.sk };
|
|
325
354
|
const pad = (n, width) => String(n).padStart(width, "0");
|
|
326
|
-
const outboxItems = (rowKey, revision, enqueued) => Effect.forEach(enqueued, (e, i) => Effect.gen(function* () {
|
|
355
|
+
const outboxItems = (rowKey, revision, enqueued, marked) => Effect.forEach(enqueued, (e, i) => Effect.gen(function* () {
|
|
327
356
|
const outbox = config.outbox;
|
|
328
357
|
const encoded = yield* S.encodeUnknownEffect(outbox.schema)(e.effect).pipe(Effect.mapError((cause) => new ValidationError({ entityType, operation: `${config.label}.outbox`, cause })));
|
|
329
358
|
const keys = outboxKeys();
|
|
@@ -341,6 +370,7 @@ export const makeEngine = (config) => {
|
|
|
341
370
|
streamId: e.event.streamId,
|
|
342
371
|
version: e.event.version,
|
|
343
372
|
eventType: e.event.eventType,
|
|
373
|
+
...(marked && { [KEY_TEXT]: 1 }),
|
|
344
374
|
};
|
|
345
375
|
if (outbox.index !== undefined) {
|
|
346
376
|
item[outbox.index.pk] = outboxMarker(entityType);
|
|
@@ -348,13 +378,16 @@ export const makeEngine = (config) => {
|
|
|
348
378
|
}
|
|
349
379
|
return toAttributeMap(item);
|
|
350
380
|
}));
|
|
351
|
-
/**
|
|
381
|
+
/**
|
|
382
|
+
* A lost race, from a single write's or a transaction's failure: the row's
|
|
383
|
+
* Put, or — moving it from its 1.36 key — that row's Delete, cancelled.
|
|
384
|
+
*/
|
|
352
385
|
const lostRaceOf = (error, transaction) => {
|
|
353
386
|
const cause = error?.cause;
|
|
354
387
|
if (!transaction)
|
|
355
388
|
return isAwsConditionalCheckFailed(cause);
|
|
356
389
|
return (isAwsTransactionCancelled(cause) &&
|
|
357
|
-
cause.CancellationReasons
|
|
390
|
+
(cause.CancellationReasons ?? []).some((reason) => reason?.Code === "ConditionalCheckFailed"));
|
|
358
391
|
};
|
|
359
392
|
/** The row (or tombstone) and any outbox items, written as one conditional unit. */
|
|
360
393
|
const writeRow = (key, target, kept, row, enqueued, revision) => Effect.gen(function* () {
|
|
@@ -363,7 +396,15 @@ export const makeEngine = (config) => {
|
|
|
363
396
|
const rowKey = composePrimaryKey(readModel, key);
|
|
364
397
|
const condition = guard(row);
|
|
365
398
|
const createdAt = Option.isSome(row) ? row.value.createdAt : undefined;
|
|
366
|
-
//
|
|
399
|
+
// A tombstone or outbox item holds no values: one under a key whose
|
|
400
|
+
// text differs from 1.36's is marked as written under its current key
|
|
401
|
+
// (#171, `KEY_TEXT`) — whatever the fallback is set to, since `rekey`
|
|
402
|
+
// reads every key — and one under unchanged text is as 1.36 wrote it.
|
|
403
|
+
const marked = readModel._primaryKey136(key, true) !== undefined;
|
|
404
|
+
// The row's item: the entity's own `put` (no outbox), or built for a
|
|
405
|
+
// transaction. A row over a tombstone under a key whose text changed is
|
|
406
|
+
// built too: the entity's `put` would judge the tombstone by values it
|
|
407
|
+
// doesn't hold, and moves it unmarked from its 1.36 key (#171).
|
|
367
408
|
let rowItem;
|
|
368
409
|
if (Option.isNone(target)) {
|
|
369
410
|
// A tombstone: the key, the kept checkpoint fields, the revision.
|
|
@@ -373,6 +414,7 @@ export const makeEngine = (config) => {
|
|
|
373
414
|
...rowKey,
|
|
374
415
|
__edd_e__: tombstoneMarker(entityType),
|
|
375
416
|
[REMOVED_AT]: DateTime.formatIso(now),
|
|
417
|
+
...(marked && { [KEY_TEXT]: 1 }),
|
|
376
418
|
};
|
|
377
419
|
for (const [f, v] of Object.entries(kept))
|
|
378
420
|
tomb[dbName(f)] = v;
|
|
@@ -381,7 +423,10 @@ export const makeEngine = (config) => {
|
|
|
381
423
|
}
|
|
382
424
|
rowItem = toAttributeMap(tomb);
|
|
383
425
|
}
|
|
384
|
-
else if (enqueued.length > 0
|
|
426
|
+
else if (enqueued.length > 0 ||
|
|
427
|
+
(Option.isSome(row) &&
|
|
428
|
+
row.value.tombstone &&
|
|
429
|
+
readModel._primaryKey136(key) !== undefined)) {
|
|
385
430
|
const built = yield* validateAndBuildPutItem(readModel, target.value, `${config.label}.write`);
|
|
386
431
|
const item = { ...built.item };
|
|
387
432
|
if (createdAtField !== null && DateTime.isDateTime(createdAt)) {
|
|
@@ -407,31 +452,89 @@ export const makeEngine = (config) => {
|
|
|
407
452
|
const written = yield* run.pipe(Effect.catchTag("ConditionalCheckFailed", () => Effect.fail(new LostRace(key))));
|
|
408
453
|
return Option.some(written);
|
|
409
454
|
}
|
|
455
|
+
// A row read at its 1.36 key (#171) moves in the same write: put at its
|
|
456
|
+
// current key, where nothing may be, and deleted at its 1.36 key only
|
|
457
|
+
// while it is as read. Another value's 1.36 row at the current key fails
|
|
458
|
+
// a write that expects nothing there: it is moved out of the way, as the
|
|
459
|
+
// entity's own writes move it, and the write is read again. So is
|
|
460
|
+
// another value's outbox item 1.36 left where one of this write's goes:
|
|
461
|
+
// a key that reads back as another value's 1.36 key can hold them, so
|
|
462
|
+
// there each Put requires its key empty.
|
|
463
|
+
const at136 = Option.isSome(row) ? row.value.at136 : undefined;
|
|
464
|
+
const OutboxTable = yield* outboxTable;
|
|
465
|
+
const keys = outboxKeys();
|
|
466
|
+
const sharedKey = typeof readModel._currentKeyOf136(rowKey) === "object";
|
|
467
|
+
const moved = at136 === undefined
|
|
468
|
+
? []
|
|
469
|
+
: [
|
|
470
|
+
{
|
|
471
|
+
Delete: {
|
|
472
|
+
TableName,
|
|
473
|
+
Key: toAttributeMap(at136),
|
|
474
|
+
...asReadGuard(row.value.stored, primary.pk.field, config.revision === undefined ? [] : [dbName(config.revision.field)]),
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
];
|
|
478
|
+
const outboxAt = 1 + moved.length;
|
|
479
|
+
const lostRace = (error, transaction) => lostRaceOf(error, transaction)
|
|
480
|
+
? Effect.gen(function* () {
|
|
481
|
+
if (Option.isNone(row) || at136 !== undefined) {
|
|
482
|
+
yield* readModel._clearAlias136(key, config.label);
|
|
483
|
+
}
|
|
484
|
+
const reasons = transaction
|
|
485
|
+
? (error.cause
|
|
486
|
+
?.CancellationReasons ?? [])
|
|
487
|
+
: [];
|
|
488
|
+
for (const reason of reasons.slice(outboxAt)) {
|
|
489
|
+
if (reason?.Code === "ConditionalCheckFailed" && reason.Item !== undefined) {
|
|
490
|
+
yield* readModel._displaceValueless136(OutboxTable, keys, reason.Item, config.label);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return yield* Effect.fail(new LostRace(key));
|
|
494
|
+
})
|
|
495
|
+
: Effect.fail(error);
|
|
410
496
|
const rowPut = {
|
|
411
497
|
Put: {
|
|
412
498
|
TableName,
|
|
413
499
|
Item: rowItem,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
500
|
+
...(at136 === undefined
|
|
501
|
+
? {
|
|
502
|
+
ConditionExpression: condition.raw.expression,
|
|
503
|
+
ExpressionAttributeNames: condition.raw.names,
|
|
504
|
+
...(Object.keys(condition.raw.values).length > 0
|
|
505
|
+
? { ExpressionAttributeValues: condition.raw.values }
|
|
506
|
+
: {}),
|
|
507
|
+
}
|
|
508
|
+
: {
|
|
509
|
+
ConditionExpression: "attribute_not_exists(#g)",
|
|
510
|
+
ExpressionAttributeNames: { "#g": primary.pk.field },
|
|
511
|
+
}),
|
|
419
512
|
},
|
|
420
513
|
};
|
|
421
|
-
if (enqueued.length === 0) {
|
|
422
|
-
yield* client.putItem(rowPut.Put).pipe(Effect.
|
|
514
|
+
if (enqueued.length === 0 && at136 === undefined) {
|
|
515
|
+
yield* client.putItem(rowPut.Put).pipe(Effect.catch((error) => lostRace(error, false)));
|
|
423
516
|
}
|
|
424
517
|
else {
|
|
425
|
-
const
|
|
426
|
-
const items = yield* outboxItems(rowKey, revision ?? 0, enqueued);
|
|
518
|
+
const items = yield* outboxItems(rowKey, revision ?? 0, enqueued, marked);
|
|
427
519
|
yield* client
|
|
428
520
|
.transactWriteItems({
|
|
429
521
|
TransactItems: [
|
|
430
522
|
rowPut,
|
|
431
|
-
...
|
|
523
|
+
...moved,
|
|
524
|
+
...items.map((Item) => ({
|
|
525
|
+
Put: {
|
|
526
|
+
TableName: OutboxTable,
|
|
527
|
+
Item,
|
|
528
|
+
...(sharedKey && {
|
|
529
|
+
ConditionExpression: "attribute_not_exists(#opk)",
|
|
530
|
+
ExpressionAttributeNames: { "#opk": keys.pk },
|
|
531
|
+
ReturnValuesOnConditionCheckFailure: "ALL_OLD",
|
|
532
|
+
}),
|
|
533
|
+
},
|
|
534
|
+
})),
|
|
432
535
|
],
|
|
433
536
|
})
|
|
434
|
-
.pipe(Effect.
|
|
537
|
+
.pipe(Effect.catch((error) => lostRace(error, true)));
|
|
435
538
|
}
|
|
436
539
|
return target;
|
|
437
540
|
});
|
|
@@ -786,30 +889,65 @@ export const makeEngine = (config) => {
|
|
|
786
889
|
out[f] = target[f];
|
|
787
890
|
return out;
|
|
788
891
|
};
|
|
789
|
-
// -------------------------------------------------------------------------
|
|
790
|
-
// Outbox drain (#155)
|
|
791
|
-
// -------------------------------------------------------------------------
|
|
792
892
|
/**
|
|
793
893
|
* Deliver a row's pending effects in order: claim the head item, deliver it,
|
|
794
894
|
* delete it, repeat. A claim another drainer holds stops the drain; a crash
|
|
795
895
|
* leaves a claim that expires, so the effect is delivered again.
|
|
896
|
+
*
|
|
897
|
+
* `rows` are the keys the row's items are under: its current key, and its
|
|
898
|
+
* 1.36 key when its items can still be there (#171). The head is the first
|
|
899
|
+
* pending item of them all, by revision and position, so a row's effects
|
|
900
|
+
* are delivered in one order wherever they are.
|
|
796
901
|
*/
|
|
797
|
-
const drainRaw = (
|
|
902
|
+
const drainRaw = (rows, deliver) => Effect.gen(function* () {
|
|
798
903
|
const outbox = config.outbox;
|
|
799
904
|
const client = yield* Capacity.client;
|
|
800
905
|
const TableName = yield* outboxTable;
|
|
801
906
|
const keys = outboxKeys();
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
const
|
|
907
|
+
/** The row's first item under `at`. */
|
|
908
|
+
const firstAt = (at) => Effect.gen(function* () {
|
|
909
|
+
const request = {
|
|
805
910
|
TableName,
|
|
806
911
|
KeyConditionExpression: "#pk = :pk AND begins_with(#sk, :sk)",
|
|
807
|
-
ExpressionAttributeNames: {
|
|
808
|
-
|
|
912
|
+
ExpressionAttributeNames: {
|
|
913
|
+
"#pk": keys.pk,
|
|
914
|
+
"#sk": keys.sk,
|
|
915
|
+
...(at.only !== undefined && { "#kt": KEY_TEXT }),
|
|
916
|
+
},
|
|
917
|
+
ExpressionAttributeValues: toAttributeMap({ ":pk": at.pk, ":sk": `${at.sk}#outbox#` }),
|
|
809
918
|
ConsistentRead: true,
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
919
|
+
};
|
|
920
|
+
if (at.only === undefined) {
|
|
921
|
+
return (yield* client.query({ ...request, Limit: 1 })).Items?.[0];
|
|
922
|
+
}
|
|
923
|
+
// Read past another row's items under the same key.
|
|
924
|
+
let start;
|
|
925
|
+
do {
|
|
926
|
+
const page = yield* client.query({
|
|
927
|
+
...request,
|
|
928
|
+
FilterExpression: at.only === "marked" ? "attribute_exists(#kt)" : "attribute_not_exists(#kt)",
|
|
929
|
+
...(start !== undefined && { ExclusiveStartKey: start }),
|
|
930
|
+
});
|
|
931
|
+
const first = page.Items?.[0];
|
|
932
|
+
if (first !== undefined)
|
|
933
|
+
return first;
|
|
934
|
+
start = page.LastEvaluatedKey;
|
|
935
|
+
} while (start !== undefined);
|
|
936
|
+
return undefined;
|
|
937
|
+
});
|
|
938
|
+
let delivered = 0;
|
|
939
|
+
while (true) {
|
|
940
|
+
let head;
|
|
941
|
+
let headAt = "";
|
|
942
|
+
for (const at of rows) {
|
|
943
|
+
const first = yield* firstAt(at);
|
|
944
|
+
// `#outbox#<revision>#<n>`: fixed widths, so text order is delivery order.
|
|
945
|
+
const suffix = first?.[keys.sk]?.S?.slice(at.sk.length) ?? "";
|
|
946
|
+
if (first !== undefined && (head === undefined || suffix < headAt)) {
|
|
947
|
+
head = first;
|
|
948
|
+
headAt = suffix;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
813
951
|
if (head === undefined)
|
|
814
952
|
return { delivered, undelivered: Option.none() };
|
|
815
953
|
const raw = fromAttributeMap(head);
|
|
@@ -868,9 +1006,33 @@ export const makeEngine = (config) => {
|
|
|
868
1006
|
delivered++;
|
|
869
1007
|
}
|
|
870
1008
|
});
|
|
1009
|
+
/**
|
|
1010
|
+
* Drain the row at `key`: under its current key, and — while the fallback is
|
|
1011
|
+
* on (#171) — its 1.36 key, where 1.36 left the items it wrote. A key that
|
|
1012
|
+
* can also hold another value's items is read for the row's own: its
|
|
1013
|
+
* current key when it reads back as another value's 1.36 key (`foo bar`'s
|
|
1014
|
+
* is `foo%20bar`'s) for the marked ones, its 1.36 key when that can be
|
|
1015
|
+
* another value's current key (`_spells136`) for the unmarked ones.
|
|
1016
|
+
*/
|
|
871
1017
|
const drain = (key, deliver) => {
|
|
872
|
-
const
|
|
873
|
-
|
|
1018
|
+
const record = key;
|
|
1019
|
+
const rowKey = composePrimaryKey(readModel, record);
|
|
1020
|
+
const rows = [
|
|
1021
|
+
{
|
|
1022
|
+
pk: String(rowKey[primary.pk.field]),
|
|
1023
|
+
sk: String(rowKey[primary.sk.field]),
|
|
1024
|
+
only: typeof readModel._currentKeyOf136(rowKey) === "object" ? "marked" : undefined,
|
|
1025
|
+
},
|
|
1026
|
+
];
|
|
1027
|
+
const old = readModel._primaryKey136(record);
|
|
1028
|
+
if (old !== undefined) {
|
|
1029
|
+
rows.unshift({
|
|
1030
|
+
pk: old[primary.pk.field],
|
|
1031
|
+
sk: old[primary.sk.field],
|
|
1032
|
+
only: readModel._spells136(record) ? "unmarked" : undefined,
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
return drainRaw(rows, deliver);
|
|
874
1036
|
};
|
|
875
1037
|
/** Every row with pending effects, through the outbox's sparse index, drained. */
|
|
876
1038
|
const drainPending = (deliver) => Effect.gen(function* () {
|
|
@@ -884,6 +1046,7 @@ export const makeEngine = (config) => {
|
|
|
884
1046
|
}
|
|
885
1047
|
const client = yield* Capacity.client;
|
|
886
1048
|
const TableName = yield* outboxTable;
|
|
1049
|
+
/** The row keys items name, and whether marked and unmarked items name each. */
|
|
887
1050
|
const rows = new Map();
|
|
888
1051
|
let start;
|
|
889
1052
|
do {
|
|
@@ -899,14 +1062,47 @@ export const makeEngine = (config) => {
|
|
|
899
1062
|
const raw = fromAttributeMap(item);
|
|
900
1063
|
const pk = String(raw[ROW_PK]);
|
|
901
1064
|
const sk = String(raw[ROW_SK]);
|
|
902
|
-
|
|
1065
|
+
const id = `${pk}\u0000${sk}`;
|
|
1066
|
+
const named = rows.get(id) ?? { pk, sk, marked: false, unmarked: false };
|
|
1067
|
+
if (raw[KEY_TEXT] === undefined)
|
|
1068
|
+
named.unmarked = true;
|
|
1069
|
+
else
|
|
1070
|
+
named.marked = true;
|
|
1071
|
+
rows.set(id, named);
|
|
903
1072
|
}
|
|
904
1073
|
start = page.LastEvaluatedKey;
|
|
905
1074
|
} while (start !== undefined);
|
|
1075
|
+
// A row's items under its 1.36 key (#171) are drained with those under
|
|
1076
|
+
// its current key, in one order: the key an item 1.36 wrote names is
|
|
1077
|
+
// read back as 1.36 text (`_currentKeyOf136`) to find where the row is
|
|
1078
|
+
// now. When that is another row (`foo%20bar`'s 1.36 key is `foo bar`'s
|
|
1079
|
+
// current key), the key's unmarked items are that row's, and its
|
|
1080
|
+
// marked ones the row of the key.
|
|
1081
|
+
const byRow = new Map();
|
|
1082
|
+
const add = (rowPk, rowSk, at) => {
|
|
1083
|
+
const id = `${rowPk}\u0000${rowSk}`;
|
|
1084
|
+
byRow.set(id, [...(byRow.get(id) ?? []), at]);
|
|
1085
|
+
};
|
|
1086
|
+
for (const { pk, sk, marked, unmarked } of rows.values()) {
|
|
1087
|
+
const placed = readModel._currentKeyOf136({
|
|
1088
|
+
[primary.pk.field]: pk,
|
|
1089
|
+
[primary.sk.field]: sk,
|
|
1090
|
+
});
|
|
1091
|
+
if (typeof placed !== "object") {
|
|
1092
|
+
add(pk, sk, { pk, sk });
|
|
1093
|
+
continue;
|
|
1094
|
+
}
|
|
1095
|
+
if (unmarked) {
|
|
1096
|
+
const current = placed.current;
|
|
1097
|
+
add(current[primary.pk.field], current[primary.sk.field], { pk, sk, only: "unmarked" });
|
|
1098
|
+
}
|
|
1099
|
+
if (marked)
|
|
1100
|
+
add(pk, sk, { pk, sk, only: "marked" });
|
|
1101
|
+
}
|
|
906
1102
|
let delivered = 0;
|
|
907
1103
|
const undelivered = [];
|
|
908
|
-
for (const
|
|
909
|
-
const result = yield* drainRaw(
|
|
1104
|
+
for (const keys of byRow.values()) {
|
|
1105
|
+
const result = yield* drainRaw(keys, deliver);
|
|
910
1106
|
delivered += result.delivered;
|
|
911
1107
|
if (Option.isSome(result.undelivered))
|
|
912
1108
|
undelivered.push(result.undelivered.value);
|