effect-dynamodb 1.32.0 → 1.34.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.
Files changed (36) hide show
  1. package/dist/Entity.d.ts +49 -2
  2. package/dist/Entity.d.ts.map +1 -1
  3. package/dist/Entity.js +291 -55
  4. package/dist/Entity.js.map +1 -1
  5. package/dist/EventStore.d.ts +255 -12
  6. package/dist/EventStore.d.ts.map +1 -1
  7. package/dist/EventStore.js +396 -54
  8. package/dist/EventStore.js.map +1 -1
  9. package/dist/Transaction.d.ts +18 -4
  10. package/dist/Transaction.d.ts.map +1 -1
  11. package/dist/Transaction.js +23 -3
  12. package/dist/Transaction.js.map +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/internal/AttributeValueEquals.d.ts +10 -0
  18. package/dist/internal/AttributeValueEquals.d.ts.map +1 -0
  19. package/dist/internal/AttributeValueEquals.js +47 -0
  20. package/dist/internal/AttributeValueEquals.js.map +1 -0
  21. package/dist/internal/BoundCrud.d.ts +8 -0
  22. package/dist/internal/BoundCrud.d.ts.map +1 -1
  23. package/dist/internal/BoundCrud.js.map +1 -1
  24. package/dist/internal/TransactPlan.d.ts +77 -0
  25. package/dist/internal/TransactPlan.d.ts.map +1 -0
  26. package/dist/internal/TransactPlan.js +135 -0
  27. package/dist/internal/TransactPlan.js.map +1 -0
  28. package/dist/internal/TransactWriteOps.d.ts +140 -15
  29. package/dist/internal/TransactWriteOps.d.ts.map +1 -1
  30. package/dist/internal/TransactWriteOps.js +154 -7
  31. package/dist/internal/TransactWriteOps.js.map +1 -1
  32. package/dist/internal/TransactableOps.d.ts +26 -6
  33. package/dist/internal/TransactableOps.d.ts.map +1 -1
  34. package/dist/internal/TransactableOps.js +33 -7
  35. package/dist/internal/TransactableOps.js.map +1 -1
  36. package/package.json +2 -2
@@ -12,14 +12,15 @@
12
12
  * drift, and support added here (e.g. `EntityUpdate`) lands for both at once.
13
13
  */
14
14
  import type { TransactWriteItem } from "@aws-sdk/client-dynamodb";
15
- import type { ConcurrentModification, OptimisticLockError, UniqueConstraintViolation } from "@effect-dynamodb/schema/Errors.js";
15
+ import type { ConcurrentModification, OptimisticLockError, StreamSealed, UniqueConstraintViolation, VersionConflict } from "@effect-dynamodb/schema/Errors.js";
16
16
  import { ValidationError } from "@effect-dynamodb/schema/Errors.js";
17
17
  import { Effect } from "effect";
18
18
  import type { DynamoClient, DynamoClientError } from "../DynamoClient.js";
19
- import type { Entity, EntityDelete, EntityPut, PutPlan, PutVerdict, WriteCancellationReason } from "../Entity.js";
19
+ import type { Entity, EntityDelete, EntityPut, EntityUpdate, PlanDeleteError, PlanUpdateError, PutVerdict, WriteCancellationReason } from "../Entity.js";
20
20
  import type { ExpressionResult } from "../Expression.js";
21
21
  import { type TableConfig } from "../Table.js";
22
- import type { BoundWriteOp } from "./BoundCrud.js";
22
+ import type { BoundUpdateOp, BoundWriteOp } from "./BoundCrud.js";
23
+ import type { TransactPlan } from "./TransactPlan.js";
23
24
  import { type KeyAttributes, type TransactItemTarget, transactItemTarget } from "./WriteDiagnosis.js";
24
25
  /** @internal */
25
26
  export declare const ConditionCheckTypeId: unique symbol;
@@ -49,6 +50,66 @@ export { type TransactItemTarget, transactItemTarget };
49
50
  * AWS-free `@effect-dynamodb/schema` `Entity.make` (#100).
50
51
  */
51
52
  export type TransactWriteOp = EntityPut<any, any, any, any> | EntityDelete<any, any> | BoundWriteOp | ConditionCheckOp;
53
+ /** @internal */
54
+ export declare const StreamAppendTypeId: unique symbol;
55
+ export type StreamAppendTypeId = typeof StreamAppendTypeId;
56
+ /**
57
+ * @internal The items of a {@link StreamAppendOp}, built by the inner
58
+ * stream's own append builder: its version-contiguity check (0 or 1), its
59
+ * event puts and its inline snapshot, in that order.
60
+ */
61
+ export interface BuiltStreamAppend {
62
+ readonly items: ReadonlyArray<TransactWriteItem>;
63
+ /** The event marker of the inner stream, for provenance. */
64
+ readonly entityType: string;
65
+ /** Parallel to `items`: what names each one in a diagnosed rejection. */
66
+ readonly targets: () => ReadonlyArray<TransactItemTarget>;
67
+ /** The key attributes the inner stream's items write. */
68
+ readonly keys: () => KeyAttributes;
69
+ /**
70
+ * What a cancellation means for the nested append, from the reasons of its
71
+ * own items only (a slice parallel to `items`): `StreamSealed` when a check
72
+ * returned a sealed item, `VersionConflict` for any other failure of its
73
+ * contiguity check or event puts, `undefined` otherwise.
74
+ */
75
+ readonly verdict: (reasons: ReadonlyArray<WriteCancellationReason | undefined>) => StreamSealed | VersionConflict | undefined;
76
+ }
77
+ /**
78
+ * An append of one event stream, carried as a transact item of ANOTHER
79
+ * stream's append (`EventStream.append`'s `additionalItems`, or a
80
+ * `commandHandler`'s): it commits if and only if that append does. Built by
81
+ * `EventStream.appendOp` (or the bound stream's).
82
+ *
83
+ * Accepted only there — `Transaction.transactWrite` refuses it (its type does
84
+ * not admit it, and at runtime it fails with `ValidationError`).
85
+ */
86
+ export interface StreamAppendOp {
87
+ readonly [StreamAppendTypeId]: StreamAppendTypeId;
88
+ /** The inner stream's name. */
89
+ readonly streamName: string;
90
+ /**
91
+ * @internal Build the nested append's items. `source` names the op in a
92
+ * diagnosed rejection (`"operation 0"`).
93
+ */
94
+ readonly _build: (source: string) => Effect.Effect<BuiltStreamAppend, ValidationError, TableConfig | DynamoClient>;
95
+ }
96
+ /** @internal Whether `op` is a {@link StreamAppendOp}. */
97
+ export declare const isStreamAppendOp: (op: unknown) => op is StreamAppendOp;
98
+ /**
99
+ * The ops an `EventStore` append's `additionalItems` accept: every
100
+ * {@link TransactWriteOp}, plus another stream's append ({@link StreamAppendOp}).
101
+ * Accepted by `EventStream.append` and `commandHandler`, nowhere else.
102
+ */
103
+ export type AppendWriteOp = TransactWriteOp | StreamAppendOp;
104
+ /**
105
+ * An `update` — accepted by `Transaction.transactWrite` alone.
106
+ *
107
+ * Kept out of {@link TransactWriteOp} because compiling an update reads, in
108
+ * {@link planTransactWriteOps}. `transactWrite` runs that pre-pass;
109
+ * `EventStore.append({ additionalItems })` does not, and `Batch.write` cannot
110
+ * express an update at all, so neither accepts one at the type level.
111
+ */
112
+ export type TransactWriteUpdateOp = EntityUpdate<any, any, any, any, any> | BoundUpdateOp;
52
113
  /**
53
114
  * What an emitted transact item was produced by, so a positional cancellation
54
115
  * reason can be attributed back to the caller op that caused it.
@@ -63,24 +124,49 @@ export interface ItemProvenance {
63
124
  readonly opIndex: number;
64
125
  /**
65
126
  * `"main"`: the op's own item. `"guarded"`: one of the items of a guarded put
66
- * — see {@link GuardedPut}, which reads their cancellation reasons.
127
+ * or of a planned update or delete — see {@link GuardedWrite}, which reads
128
+ * their cancellation reasons. `"stream"`: one of the items of a nested
129
+ * stream append — see {@link NestedStreamAppend}.
130
+ */
131
+ readonly kind: "main" | "guarded" | "stream";
132
+ /**
133
+ * The entity the op targeted (a nested stream append: its event marker), so
134
+ * consumers can name it in an error.
67
135
  */
68
- readonly kind: "main" | "guarded";
69
- /** The entity the op targeted, so consumers can name it in an error. */
70
136
  readonly entityType: string;
71
137
  }
72
138
  /**
73
- * A put of a versioned or unique-constrained entity, planned from a fresh read
74
- * of its item (#133) exactly as the entity's own `put` plans it: the item
75
- * continued (or created past any retained history), its sentinels rotated —
76
- * releasing only those it owns — and its retain snapshot.
139
+ * A write planned from a fresh read, exactly as the entity's own op plans it:
140
+ *
141
+ * - a put of a versioned or unique-constrained entity (#133): the item
142
+ * continued (or created past any retained history), its sentinels rotated —
143
+ * releasing only those it owns — and its retain snapshot;
144
+ * - an update, or a delete of a `unique` / `retain` / `softDelete` entity
145
+ * (`Transaction.transactWrite` only): the op itself, run with its write
146
+ * recorded instead of sent (`internal/TransactPlan.planWrite`).
77
147
  */
78
- export interface GuardedPut {
148
+ export interface GuardedWrite {
79
149
  /** Index into the caller's `operations` array. */
80
150
  readonly opIndex: number;
81
151
  /** Where the plan's items start in `items`. */
82
152
  readonly start: number;
83
- readonly plan: PutPlan;
153
+ /**
154
+ * A guarded put's plan (`Entity._planPut`), or a planned update or delete
155
+ * (`Entity._planUpdate` / `_planDelete`): its items and their verdict.
156
+ */
157
+ readonly plan: TransactPlan;
158
+ }
159
+ /**
160
+ * A nested stream append ({@link StreamAppendOp}) among the items: where its
161
+ * items are, and how to read their cancellation reasons.
162
+ */
163
+ export interface NestedStreamAppend {
164
+ /** Index into the caller's `operations` array. */
165
+ readonly opIndex: number;
166
+ /** Where its items start in `items`. */
167
+ readonly start: number;
168
+ readonly count: number;
169
+ readonly verdict: BuiltStreamAppend["verdict"];
84
170
  }
85
171
  /** Compiled items plus the caller-op attribution for each one. */
86
172
  export interface BuiltTransactWriteItems {
@@ -93,11 +179,14 @@ export interface BuiltTransactWriteItems {
93
179
  * oversized item, an over-long sort key. A thunk: needed only on failure.
94
180
  */
95
181
  readonly targets: () => ReadonlyArray<TransactItemTarget>;
96
- readonly guarded: ReadonlyArray<GuardedPut>;
182
+ readonly guarded: ReadonlyArray<GuardedWrite>;
183
+ /** The nested stream appends, in op order (only with `{ streams: true }`). */
184
+ readonly streams: ReadonlyArray<NestedStreamAppend>;
97
185
  /**
98
186
  * The caller ops (indices into `operations`) that carry a condition of
99
187
  * their own — `.condition()`, `create()`'s, `Transaction.check`'s. A
100
188
  * guarded put's read guard is not one: it is the op's, not the caller's.
189
+ * Nor is a nested stream append: its conditions are its stream's.
101
190
  */
102
191
  readonly conditioned: ReadonlySet<number>;
103
192
  /**
@@ -107,6 +196,22 @@ export interface BuiltTransactWriteItems {
107
196
  */
108
197
  readonly keys: () => KeyAttributes;
109
198
  }
199
+ /**
200
+ * The read pre-pass that lets `Transaction.transactWrite` carry the ops the
201
+ * build step below cannot: every `update`, and every `delete` of an entity
202
+ * whose delete writes more than its own row (`unique`, `versioned: { retain:
203
+ * true }`, `softDelete` — EDD-9048). Each is planned by the entity's own op
204
+ * (`Entity._planUpdate` / `_planDelete`): the standalone op itself, run with
205
+ * its write recorded instead of sent, so the transaction writes exactly what
206
+ * the standalone op would have — every read, item and guard included.
207
+ *
208
+ * Ops a planned write cannot carry are refused before anything is read
209
+ * (EDD-9059 – EDD-9061, `rejectUnsupportedOp`). Returns the plans keyed by
210
+ * index into `operations`; ops that need no plan are absent. Run on every
211
+ * attempt, so a transaction cancelled by a lost race is planned again from
212
+ * fresh reads.
213
+ */
214
+ export declare const planTransactWriteOps: (operations: ReadonlyArray<TransactWriteOp | TransactWriteUpdateOp>) => Effect.Effect<ReadonlyMap<number, TransactPlan>, ValidationError | PlanUpdateError | PlanDeleteError, DynamoClient | TableConfig>;
110
215
  /**
111
216
  * Compile a list of Entity write ops into marshalled `TransactWriteItems` entries,
112
217
  * preserving caller order.
@@ -114,7 +219,7 @@ export interface BuiltTransactWriteItems {
114
219
  * **One caller op may emit several items.** A put of a versioned or
115
220
  * unique-constrained entity is a guarded put (#133): it reads the item, and
116
221
  * emits the item guarded on what was read, plus its sentinel reservations and
117
- * releases and its retain snapshot (see {@link GuardedPut}). `provenance`
222
+ * releases and its retain snapshot (see {@link GuardedWrite}). `provenance`
118
223
  * records which caller op each emitted item belongs to; consumers that map
119
224
  * cancellation reasons positionally MUST use it instead of assuming 1:1, and
120
225
  * read a guarded put's reasons through {@link judgeCancellation}.
@@ -127,8 +232,22 @@ export interface BuiltTransactWriteItems {
127
232
  * touching one item included, among them two puts that swap unique values
128
233
  * and so release and claim the same sentinels. A caller adding items of its
129
234
  * own appends their targets to these.
235
+ *
236
+ * A {@link StreamAppendOp} is accepted only with `{ streams: true }` — an
237
+ * `EventStore` append's `additionalItems` — and is refused with
238
+ * `ValidationError` otherwise. Its items are built by the inner stream
239
+ * (provenance `kind: "stream"`), recorded in `streams`, and left out of
240
+ * `conditioned`.
130
241
  */
131
- export declare const buildTransactWriteItems: (operations: ReadonlyArray<TransactWriteOp>, operation: string) => Effect.Effect<BuiltTransactWriteItems, ValidationError | DynamoClientError, TableConfig | DynamoClient>;
242
+ export declare const buildTransactWriteItems: (operations: ReadonlyArray<AppendWriteOp | TransactWriteUpdateOp>, operation: string, options?: {
243
+ readonly streams?: boolean | undefined;
244
+ /**
245
+ * Updates and multi-item deletes, planned by {@link planTransactWriteOps}
246
+ * and keyed by index into `operations`. A caller that runs no pre-pass
247
+ * (`EventStore.append`) passes none, and such ops are refused.
248
+ */
249
+ readonly plans?: ReadonlyMap<number, TransactPlan> | undefined;
250
+ } | undefined) => Effect.Effect<BuiltTransactWriteItems, ValidationError | DynamoClientError, TableConfig | DynamoClient>;
132
251
  /**
133
252
  * Whether caller op `opIndex`'s OWN condition rejected the write, from the
134
253
  * transaction's positional reasons (`offset`: where `built`'s items start). A
@@ -143,6 +262,8 @@ export declare const GUARDED_TRANSACTION_ATTEMPTS = 3;
143
262
  * from its positional reasons (`offset`: where those items start in the
144
263
  * request). In order of precedence:
145
264
  *
265
+ * - `stream` — a nested stream append's verdict (`StreamSealed` or
266
+ * `VersionConflict` naming the inner stream), the first in op order.
146
267
  * - `fail` — a guarded put's final verdict: a unique value is taken
147
268
  * (`UniqueConstraintViolation`) or its history conflicts (`ValidationError`).
148
269
  * Never a caller-condition error: the caller set none.
@@ -155,6 +276,10 @@ export declare const GUARDED_TRANSACTION_ATTEMPTS = 3;
155
276
  * `undefined`: no conditional failure among these items explains it.
156
277
  */
157
278
  export declare const judgeCancellation: (built: BuiltTransactWriteItems, reasons: ReadonlyArray<WriteCancellationReason | undefined>, offset?: number) => {
279
+ readonly _tag: "stream";
280
+ readonly opIndex: number;
281
+ readonly error: StreamSealed | VersionConflict;
282
+ } | {
158
283
  readonly _tag: "fail";
159
284
  readonly opIndex: number;
160
285
  readonly error: UniqueConstraintViolation | ValidationError;
@@ -1 +1 @@
1
- {"version":3,"file":"TransactWriteOps.d.ts","sourceRoot":"","sources":["../../src/internal/TransactWriteOps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EACV,sBA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AAG,eAAe,CAAA;CAC/C,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,yBAAyB,GAAG,eAAe,CAAA;CAC5D,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,GAC1E;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG,sBAAsB,CAAA;IAC5D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;CAC3E,GACD,SA+BH,CAAA"}
@@ -26,6 +26,13 @@ import { keyAttributesOf, mergeKeyAttributes, transactItemTarget, } from "./Writ
26
26
  /** @internal */
27
27
  export const ConditionCheckTypeId = Symbol.for("effect-dynamodb/ConditionCheck");
28
28
  export { transactItemTarget };
29
+ // ---------------------------------------------------------------------------
30
+ // StreamAppendOp — another stream's append, carried in an EventStore append
31
+ // ---------------------------------------------------------------------------
32
+ /** @internal */
33
+ export const StreamAppendTypeId = Symbol.for("effect-dynamodb/StreamAppendOp");
34
+ /** @internal Whether `op` is a {@link StreamAppendOp}. */
35
+ export const isStreamAppendOp = (op) => typeof op === "object" && op !== null && StreamAppendTypeId in op;
29
36
  /**
30
37
  * Compile an op-attached condition (`Entity.create()`'s `attribute_not_exists`,
31
38
  * `.condition(...)`, `Entity.condition(...)`) into a DynamoDB expression.
@@ -68,6 +75,51 @@ const conditionFields = (condition) => condition === undefined
68
75
  ? { ExpressionAttributeValues: condition.values }
69
76
  : {}),
70
77
  };
78
+ /**
79
+ * The read pre-pass that lets `Transaction.transactWrite` carry the ops the
80
+ * build step below cannot: every `update`, and every `delete` of an entity
81
+ * whose delete writes more than its own row (`unique`, `versioned: { retain:
82
+ * true }`, `softDelete` — EDD-9048). Each is planned by the entity's own op
83
+ * (`Entity._planUpdate` / `_planDelete`): the standalone op itself, run with
84
+ * its write recorded instead of sent, so the transaction writes exactly what
85
+ * the standalone op would have — every read, item and guard included.
86
+ *
87
+ * Ops a planned write cannot carry are refused before anything is read
88
+ * (EDD-9059 – EDD-9061, `rejectUnsupportedOp`). Returns the plans keyed by
89
+ * index into `operations`; ops that need no plan are absent. Run on every
90
+ * attempt, so a transaction cancelled by a lost race is planned again from
91
+ * fresh reads.
92
+ */
93
+ export const planTransactWriteOps = (operations) => Effect.gen(function* () {
94
+ const plans = new Map();
95
+ for (let opIndex = 0; opIndex < operations.length; opIndex++) {
96
+ const op = operations[opIndex];
97
+ if (op != null && typeof op === "object" && ConditionCheckTypeId in op)
98
+ continue;
99
+ const info = extractTransactable(op);
100
+ if (info === undefined)
101
+ continue;
102
+ if (info.opType === "update" && info.updateState !== undefined) {
103
+ yield* rejectUnsupportedOp(info.entity, "transactWrite", "update", undefined, undefined, {
104
+ updateState: info.updateState,
105
+ });
106
+ plans.set(opIndex, yield* info.entity._planUpdate(info.key, info.updateState));
107
+ }
108
+ else if (info.opType === "delete" &&
109
+ info.deleteRequest !== undefined &&
110
+ info.entity._multiItemWriteFeatures.length > 0) {
111
+ yield* rejectUnsupportedOp(info.entity, "transactWrite", "delete", undefined, undefined, {
112
+ returnValues: info.deleteRequest.returnValues,
113
+ readsStoredRow: true,
114
+ });
115
+ plans.set(opIndex, yield* info.entity._planDelete(info.key, {
116
+ condition: info.deleteRequest.condition,
117
+ mustExist: info.deleteRequest.mustExist,
118
+ }));
119
+ }
120
+ }
121
+ return plans;
122
+ });
71
123
  /**
72
124
  * Compile a list of Entity write ops into marshalled `TransactWriteItems` entries,
73
125
  * preserving caller order.
@@ -75,7 +127,7 @@ const conditionFields = (condition) => condition === undefined
75
127
  * **One caller op may emit several items.** A put of a versioned or
76
128
  * unique-constrained entity is a guarded put (#133): it reads the item, and
77
129
  * emits the item guarded on what was read, plus its sentinel reservations and
78
- * releases and its retain snapshot (see {@link GuardedPut}). `provenance`
130
+ * releases and its retain snapshot (see {@link GuardedWrite}). `provenance`
79
131
  * records which caller op each emitted item belongs to; consumers that map
80
132
  * cancellation reasons positionally MUST use it instead of assuming 1:1, and
81
133
  * read a guarded put's reasons through {@link judgeCancellation}.
@@ -88,21 +140,44 @@ const conditionFields = (condition) => condition === undefined
88
140
  * touching one item included, among them two puts that swap unique values
89
141
  * and so release and claim the same sentinels. A caller adding items of its
90
142
  * own appends their targets to these.
143
+ *
144
+ * A {@link StreamAppendOp} is accepted only with `{ streams: true }` — an
145
+ * `EventStore` append's `additionalItems` — and is refused with
146
+ * `ValidationError` otherwise. Its items are built by the inner stream
147
+ * (provenance `kind: "stream"`), recorded in `streams`, and left out of
148
+ * `conditioned`.
91
149
  */
92
- export const buildTransactWriteItems = (operations, operation) => Effect.gen(function* () {
150
+ export const buildTransactWriteItems = (operations, operation, options) => Effect.gen(function* () {
93
151
  if (operations.length === 0) {
94
152
  return {
95
153
  items: [],
96
154
  provenance: [],
97
155
  targets: () => [],
98
156
  guarded: [],
157
+ streams: [],
99
158
  conditioned: new Set(),
100
159
  keys: () => mergeKeyAttributes(),
101
160
  };
102
161
  }
103
162
  const opInfos = [];
163
+ /** The nested stream appends, by caller op index. */
164
+ const streamOps = new Map();
104
165
  for (let opIndex = 0; opIndex < operations.length; opIndex++) {
105
166
  const op = operations[opIndex];
167
+ // Another stream's append (#166): only an EventStore append carries it.
168
+ if (isStreamAppendOp(op)) {
169
+ if (options?.streams !== true) {
170
+ return yield* new ValidationError({
171
+ entityType: "unknown",
172
+ operation,
173
+ cause: `${operation}: operation ${opIndex} is a stream append op (appendOp of stream ` +
174
+ `"${op.streamName}"): a stream append op rides only in an EventStore append's ` +
175
+ "additionalItems. Nothing was sent.",
176
+ });
177
+ }
178
+ streamOps.set(opIndex, op);
179
+ continue;
180
+ }
106
181
  // Check for ConditionCheckOp first (has its own TypeId)
107
182
  if (op != null && typeof op === "object" && ConditionCheckTypeId in op) {
108
183
  const checkOp = op;
@@ -132,6 +207,15 @@ export const buildTransactWriteItems = (operations, operation) => Effect.gen(fun
132
207
  cause: `${operation}: unrecognized operation type. Use EntityPut, EntityDelete, or Transaction.check().`,
133
208
  });
134
209
  }
210
+ const plan = options?.plans?.get(opIndex);
211
+ if (plan !== undefined) {
212
+ // No `condition` here, so a planned op is never in `conditioned`, even
213
+ // with a `.condition()` of its own: its verdict reports that as
214
+ // `"Condition"`. Only `EventStore.append` reads `conditioned`, and it
215
+ // plans nothing — if it ever does, add planned ops to it.
216
+ opInfos.push({ type: "planned", entity: info.entity, opIndex, plan });
217
+ continue;
218
+ }
135
219
  if (info.opType === "put") {
136
220
  yield* rejectUnsupportedOp(info.entity, operation, "put", info.putKind, info.input);
137
221
  yield* refuseEmptyParts(info.entity, operation, "put", info.condition);
@@ -146,7 +230,9 @@ export const buildTransactWriteItems = (operations, operation) => Effect.gen(fun
146
230
  });
147
231
  }
148
232
  else if (info.opType === "delete") {
149
- yield* rejectUnsupportedOp(info.entity, operation, "delete", undefined);
233
+ yield* rejectUnsupportedOp(info.entity, operation, "delete", undefined, undefined, {
234
+ returnValues: info.deleteRequest?.returnValues,
235
+ });
150
236
  yield* refuseEmptyParts(info.entity, operation, "delete", info.condition);
151
237
  opInfos.push({
152
238
  type: "delete",
@@ -160,7 +246,11 @@ export const buildTransactWriteItems = (operations, operation) => Effect.gen(fun
160
246
  return yield* new ValidationError({
161
247
  entityType: info.entity.entityType,
162
248
  operation,
163
- cause: `${operation}: unsupported operation type "${info.opType}". Use EntityPut, EntityDelete, or Transaction.check().`,
249
+ cause: info.opType === "update"
250
+ ? `${operation}: update is not supported here — compiling an update reads the ` +
251
+ "stored row, which this path does not do. Transaction.transactWrite accepts " +
252
+ "updates; otherwise run the update as its own operation."
253
+ : `${operation}: unsupported operation type "${info.opType}". Use EntityPut, EntityDelete, or Transaction.check().`,
164
254
  });
165
255
  }
166
256
  }
@@ -170,6 +260,8 @@ export const buildTransactWriteItems = (operations, operation) => Effect.gen(fun
170
260
  // What names each item, kept so its target is built only on failure.
171
261
  const naming = [];
172
262
  const guarded = [];
263
+ const streams = [];
264
+ const streamKeys = [];
173
265
  const conditioned = new Set();
174
266
  for (const op of opInfos) {
175
267
  if (op.condition !== undefined)
@@ -183,10 +275,52 @@ export const buildTransactWriteItems = (operations, operation) => Effect.gen(fun
183
275
  const [table, fields] = [tableName, keyFields];
184
276
  naming.push(() => transactItemTarget(item, table, fields, from.entityType, `operation ${from.opIndex} (${from.entityType}${derived ? ", through a uniqueness sentinel or version snapshot it writes" : ""})`));
185
277
  };
278
+ // The nested stream appends, built by their own streams, are pushed in
279
+ // caller op order between the entity ops' items.
280
+ const pushStreamOp = (opIndex) => Effect.gen(function* () {
281
+ const op = streamOps.get(opIndex);
282
+ const nested = yield* op._build(`operation ${opIndex}`);
283
+ streams.push({
284
+ opIndex,
285
+ start: items.length,
286
+ count: nested.items.length,
287
+ verdict: nested.verdict,
288
+ });
289
+ streamKeys.push(nested.keys);
290
+ // Built once, on failure, then indexed.
291
+ let built;
292
+ const nestedTarget = (i) => {
293
+ if (built === undefined)
294
+ built = nested.targets();
295
+ return built[i];
296
+ };
297
+ for (const [i, item] of nested.items.entries()) {
298
+ items.push(item);
299
+ provenance.push({ opIndex, kind: "stream", entityType: nested.entityType });
300
+ naming.push(() => nestedTarget(i));
301
+ }
302
+ });
303
+ let nextOpIndex = 0;
304
+ const flushStreamOpsBefore = (opIndex) => Effect.gen(function* () {
305
+ for (; nextOpIndex < opIndex; nextOpIndex++) {
306
+ if (streamOps.has(nextOpIndex))
307
+ yield* pushStreamOp(nextOpIndex);
308
+ }
309
+ nextOpIndex = opIndex + 1;
310
+ });
186
311
  for (const op of opInfos) {
312
+ yield* flushStreamOpsBefore(op.opIndex);
187
313
  tableName = tableNames.get(op.entity);
188
314
  const primary = op.entity.indexes.primary;
189
315
  keyFields = [primary.pk.field, primary.sk.field];
316
+ if (op.type === "planned") {
317
+ // Already marshalled and table-resolved; read like a guarded put's.
318
+ guarded.push({ opIndex: op.opIndex, start: items.length, plan: op.plan });
319
+ for (const [i, item] of op.plan.items.entries()) {
320
+ push(item, { opIndex: op.opIndex, kind: "guarded", entityType: op.entity.entityType }, i > 0);
321
+ }
322
+ continue;
323
+ }
190
324
  if (op.type === "put") {
191
325
  const built = yield* validateAndBuildPutItem(op.entity, op.input, `${operation}.put`);
192
326
  if (op.entity._incarnationToken || op.entity._multiItemWriteFeatures.includes("unique")) {
@@ -242,9 +376,10 @@ export const buildTransactWriteItems = (operations, operation) => Effect.gen(fun
242
376
  }, { opIndex: op.opIndex, kind: "main", entityType: op.entity.entityType });
243
377
  }
244
378
  }
245
- const keys = () => mergeKeyAttributes(...opInfos.map((op) => keyAttributesOf(op.entity.indexes)));
379
+ yield* flushStreamOpsBefore(operations.length);
380
+ const keys = () => mergeKeyAttributes(...opInfos.map((op) => keyAttributesOf(op.entity.indexes)), ...streamKeys.map((nested) => nested()));
246
381
  const targets = () => naming.map((name) => name());
247
- return { items, provenance, targets, guarded, conditioned, keys };
382
+ return { items, provenance, targets, guarded, streams, conditioned, keys };
248
383
  });
249
384
  // ---------------------------------------------------------------------------
250
385
  // judgeCancellation
@@ -271,6 +406,8 @@ export const GUARDED_TRANSACTION_ATTEMPTS = 3;
271
406
  * from its positional reasons (`offset`: where those items start in the
272
407
  * request). In order of precedence:
273
408
  *
409
+ * - `stream` — a nested stream append's verdict (`StreamSealed` or
410
+ * `VersionConflict` naming the inner stream), the first in op order.
274
411
  * - `fail` — a guarded put's final verdict: a unique value is taken
275
412
  * (`UniqueConstraintViolation`) or its history conflicts (`ValidationError`).
276
413
  * Never a caller-condition error: the caller set none.
@@ -283,6 +420,16 @@ export const GUARDED_TRANSACTION_ATTEMPTS = 3;
283
420
  * `undefined`: no conditional failure among these items explains it.
284
421
  */
285
422
  export const judgeCancellation = (built, reasons, offset = 0) => {
423
+ // A nested stream append's items are its stream's: they are judged by its
424
+ // own verdict, never as caller conditions.
425
+ const inStream = new Set();
426
+ for (const { opIndex, start, count, verdict } of built.streams) {
427
+ for (let i = 0; i < count; i++)
428
+ inStream.add(start + i);
429
+ const error = verdict(reasons.slice(offset + start, offset + start + count));
430
+ if (error !== undefined)
431
+ return { _tag: "stream", opIndex, error };
432
+ }
286
433
  const conditions = new Set();
287
434
  let retry;
288
435
  const inGuarded = new Set();
@@ -300,7 +447,7 @@ export const judgeCancellation = (built, reasons, offset = 0) => {
300
447
  retry ??= verdict;
301
448
  }
302
449
  for (let i = 0; i < built.items.length; i++) {
303
- if (inGuarded.has(i))
450
+ if (inGuarded.has(i) || inStream.has(i))
304
451
  continue;
305
452
  if (reasons[offset + i]?.Code !== "ConditionalCheckFailed")
306
453
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"TransactWriteOps.js","sourceRoot":"","sources":["../../src/internal/TransactWriteOps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAUvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,uBAAuB,EAAoB,MAAM,aAAa,CAAA;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAa,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC5F,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAEL,eAAe,EACf,kBAAkB,EAElB,kBAAkB,GACnB,MAAM,qBAAqB,CAAA;AAE5B,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O,CAAC,KAAK,EAAE,CAAA;QACnF,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW;YAAE,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;;YACpD,KAAK,KAAK,OAAO,CAAA;IACxB,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,SAAQ;QACjD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,KAAK,wBAAwB;YAAE,SAAQ;QACpE,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAChC,IAAI,IAAI,KAAK,SAAS;YAAE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACtD,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAA;IACjF,CAAC;IACD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAA;IAC3F,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA"}
@@ -11,6 +11,7 @@ import { DateTime, Effect, Option, Schema } from "effect";
11
11
  import type { DynamoClientError, DynamoClientService } from "../DynamoClient.js";
12
12
  import type { Entity } from "../Entity.js";
13
13
  import type { ConditionInput } from "../Expression.js";
14
+ import type { ReturnValuesMode, UpdateState } from "./EntityOps.js";
14
15
  /**
15
16
  * @internal Hidden per-incarnation token of a versioned entity (#133): set
16
17
  * when an item is created, it tells an item apart from a deleted-and-recreated
@@ -138,23 +139,42 @@ export declare const batchRejectReason: (entity: Entity, opType: "put" | "delete
138
139
  * planned exactly as `Entity.put` plans it (#133): the item is read, and the
139
140
  * Put is guarded on what was read, beside its sentinel reservations and
140
141
  * (owned) releases and its retain snapshot (`Entity._planPut`).
141
- * - **delete** — rejected with **EDD-9048**. The sentinel to release is keyed by
142
- * the *stored* item's unique values, a retain snapshot copies the *stored* row,
143
- * and a soft-delete tombstone IS the stored row relocated to a new sort key;
144
- * the transaction path builds a delete from its key alone.
142
+ * - **delete** — the sentinel to release is keyed by the *stored* item's unique
143
+ * values, a retain snapshot copies the *stored* row, and a soft-delete
144
+ * tombstone IS the stored row relocated to a new sort key. `Transaction.
145
+ * transactWrite` plans such a delete from a read (`Entity._planDelete`);
146
+ * a path that builds a delete from its key alone (`EventStore.append`)
147
+ * rejects it with **EDD-9048**.
145
148
  *
146
149
  * `Batch.write` rejects BOTH directions (**EDD-9049**) — see `batchRejectReason`.
147
150
  *
151
+ * **What a planned update or delete cannot carry** (`Transaction.transactWrite`
152
+ * runs the op with its write recorded, so nothing after the write runs): a
153
+ * cascade (**EDD-9059** — a follow-up write after the update commits), a
154
+ * `returnValues` mode that returns an item (**EDD-9060** — a transaction
155
+ * returns no item attributes), and an update of a vector-indexed entity
156
+ * (**EDD-9061** — the embedding needs the `Embedder` service).
157
+ *
148
158
  * `capability` names what the caller would have to give up, so the message can
149
159
  * say why rather than just "unsupported".
150
160
  */
151
- export declare const rejectUnsupportedOp: (entity: Entity, operation: string, opType: "put" | "delete", putKind: "put" | "create" | "upsert" | undefined,
161
+ export declare const rejectUnsupportedOp: (entity: Entity, operation: string, opType: "put" | "update" | "delete", putKind: "put" | "create" | "upsert" | undefined,
152
162
  /**
153
163
  * The op's own input, for the one gate whose dependency the caller can
154
164
  * remove. `undefined` for a delete (which carries a key, not an input) and
155
165
  * for any caller with none to offer — both read as "the field is absent".
156
166
  */
157
- input?: unknown) => Effect.Effect<void, ValidationError>;
167
+ input?: unknown, details?: {
168
+ /** An update's accumulated state (`.cascade()`, `.returnValues()`, …). */
169
+ readonly updateState?: UpdateState | undefined;
170
+ /** A delete's `.returnValues()`. */
171
+ readonly returnValues?: ReturnValuesMode | undefined;
172
+ /**
173
+ * The caller reads the stored row before compiling (`transactWrite`'s
174
+ * pre-pass), so a multi-item delete is buildable and EDD-9048 does not apply.
175
+ */
176
+ readonly readsStoredRow?: boolean | undefined;
177
+ }) => Effect.Effect<void, ValidationError>;
158
178
  /**
159
179
  * Resolve table names for a set of entity infos, deduplicating by entity reference.
160
180
  */