effect-dynamodb 1.38.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.
Files changed (152) hide show
  1. package/dist/Aggregate.d.ts +119 -15
  2. package/dist/Aggregate.d.ts.map +1 -1
  3. package/dist/Aggregate.js +2286 -670
  4. package/dist/Aggregate.js.map +1 -1
  5. package/dist/Batch.d.ts +9 -5
  6. package/dist/Batch.d.ts.map +1 -1
  7. package/dist/Batch.js +97 -232
  8. package/dist/Batch.js.map +1 -1
  9. package/dist/Collection.d.ts.map +1 -1
  10. package/dist/Collection.js +27 -21
  11. package/dist/Collection.js.map +1 -1
  12. package/dist/ConsumedCapacity.js +1 -1
  13. package/dist/ConsumedCapacity.js.map +1 -1
  14. package/dist/DynamoClient.d.ts +44 -16
  15. package/dist/DynamoClient.d.ts.map +1 -1
  16. package/dist/DynamoClient.js +299 -166
  17. package/dist/DynamoClient.js.map +1 -1
  18. package/dist/Entity.d.ts +94 -104
  19. package/dist/Entity.d.ts.map +1 -1
  20. package/dist/Entity.js +3673 -3022
  21. package/dist/Entity.js.map +1 -1
  22. package/dist/EventStore.d.ts +39 -17
  23. package/dist/EventStore.d.ts.map +1 -1
  24. package/dist/EventStore.js +392 -366
  25. package/dist/EventStore.js.map +1 -1
  26. package/dist/Marshaller.d.ts +39 -9
  27. package/dist/Marshaller.d.ts.map +1 -1
  28. package/dist/Marshaller.js +421 -70
  29. package/dist/Marshaller.js.map +1 -1
  30. package/dist/Query.d.ts +93 -32
  31. package/dist/Query.d.ts.map +1 -1
  32. package/dist/Query.js +550 -83
  33. package/dist/Query.js.map +1 -1
  34. package/dist/StorageEncoding.d.ts +7 -1
  35. package/dist/StorageEncoding.d.ts.map +1 -1
  36. package/dist/StorageEncoding.js +8 -2
  37. package/dist/StorageEncoding.js.map +1 -1
  38. package/dist/Table.d.ts +71 -4
  39. package/dist/Table.d.ts.map +1 -1
  40. package/dist/Table.js +7 -0
  41. package/dist/Table.js.map +1 -1
  42. package/dist/Transaction.d.ts +2 -18
  43. package/dist/Transaction.d.ts.map +1 -1
  44. package/dist/Transaction.js +11 -62
  45. package/dist/Transaction.js.map +1 -1
  46. package/dist/change-feed/ChangeFeed.d.ts +8 -3
  47. package/dist/change-feed/ChangeFeed.d.ts.map +1 -1
  48. package/dist/change-feed/ChangeFeed.js +76 -9
  49. package/dist/change-feed/ChangeFeed.js.map +1 -1
  50. package/dist/change-feed/CheckpointStore.js +1 -1
  51. package/dist/change-feed/CheckpointStore.js.map +1 -1
  52. package/dist/change-feed/DynamoStreamsClient.d.ts +12 -5
  53. package/dist/change-feed/DynamoStreamsClient.d.ts.map +1 -1
  54. package/dist/change-feed/DynamoStreamsClient.js +15 -9
  55. package/dist/change-feed/DynamoStreamsClient.js.map +1 -1
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/internal/BoundCrud.d.ts +40 -32
  61. package/dist/internal/BoundCrud.d.ts.map +1 -1
  62. package/dist/internal/BoundCrud.js.map +1 -1
  63. package/dist/internal/BoundQuery.d.ts +12 -9
  64. package/dist/internal/BoundQuery.d.ts.map +1 -1
  65. package/dist/internal/BoundQuery.js +26 -12
  66. package/dist/internal/BoundQuery.js.map +1 -1
  67. package/dist/internal/BoundVectorQuery.d.ts.map +1 -1
  68. package/dist/internal/BoundVectorQuery.js +2 -1
  69. package/dist/internal/BoundVectorQuery.js.map +1 -1
  70. package/dist/internal/Capacity.d.ts +44 -4
  71. package/dist/internal/Capacity.d.ts.map +1 -1
  72. package/dist/internal/Capacity.js +89 -15
  73. package/dist/internal/Capacity.js.map +1 -1
  74. package/dist/internal/ClientOptions.d.ts +72 -0
  75. package/dist/internal/ClientOptions.d.ts.map +1 -0
  76. package/dist/internal/ClientOptions.js +79 -0
  77. package/dist/internal/ClientOptions.js.map +1 -0
  78. package/dist/internal/Cursor.d.ts +28 -14
  79. package/dist/internal/Cursor.d.ts.map +1 -1
  80. package/dist/internal/Cursor.js +37 -12
  81. package/dist/internal/Cursor.js.map +1 -1
  82. package/dist/internal/EntityCombinators.d.ts +22 -7
  83. package/dist/internal/EntityCombinators.d.ts.map +1 -1
  84. package/dist/internal/EntityCombinators.js +6 -2
  85. package/dist/internal/EntityCombinators.js.map +1 -1
  86. package/dist/internal/EntityOps.d.ts +11 -1
  87. package/dist/internal/EntityOps.d.ts.map +1 -1
  88. package/dist/internal/EntityOps.js.map +1 -1
  89. package/dist/internal/EventProjection.d.ts +15 -3
  90. package/dist/internal/EventProjection.d.ts.map +1 -1
  91. package/dist/internal/EventProjection.js +27 -8
  92. package/dist/internal/EventProjection.js.map +1 -1
  93. package/dist/internal/Expr.d.ts.map +1 -1
  94. package/dist/internal/Expr.js +53 -2
  95. package/dist/internal/Expr.js.map +1 -1
  96. package/dist/internal/ExpressionLimits.d.ts +57 -1
  97. package/dist/internal/ExpressionLimits.d.ts.map +1 -1
  98. package/dist/internal/ExpressionLimits.js +90 -1
  99. package/dist/internal/ExpressionLimits.js.map +1 -1
  100. package/dist/internal/ItemSize.d.ts +108 -4
  101. package/dist/internal/ItemSize.d.ts.map +1 -1
  102. package/dist/internal/ItemSize.js +190 -3
  103. package/dist/internal/ItemSize.js.map +1 -1
  104. package/dist/internal/MultiProjection.d.ts +7 -2
  105. package/dist/internal/MultiProjection.d.ts.map +1 -1
  106. package/dist/internal/MultiProjection.js +9 -3
  107. package/dist/internal/MultiProjection.js.map +1 -1
  108. package/dist/internal/PathBuilder.d.ts +15 -4
  109. package/dist/internal/PathBuilder.d.ts.map +1 -1
  110. package/dist/internal/PathBuilder.js +20 -10
  111. package/dist/internal/PathBuilder.js.map +1 -1
  112. package/dist/internal/ProjectionEngine.d.ts +78 -18
  113. package/dist/internal/ProjectionEngine.d.ts.map +1 -1
  114. package/dist/internal/ProjectionEngine.js +402 -257
  115. package/dist/internal/ProjectionEngine.js.map +1 -1
  116. package/dist/internal/RangePlanner.d.ts +0 -76
  117. package/dist/internal/RangePlanner.d.ts.map +1 -1
  118. package/dist/internal/RangePlanner.js +2 -206
  119. package/dist/internal/RangePlanner.js.map +1 -1
  120. package/dist/internal/Rekey.d.ts +49 -7
  121. package/dist/internal/Rekey.d.ts.map +1 -1
  122. package/dist/internal/Rekey.js +113 -10
  123. package/dist/internal/Rekey.js.map +1 -1
  124. package/dist/internal/RoundTrip.d.ts +36 -0
  125. package/dist/internal/RoundTrip.d.ts.map +1 -0
  126. package/dist/internal/RoundTrip.js +79 -0
  127. package/dist/internal/RoundTrip.js.map +1 -0
  128. package/dist/internal/SentRequest.d.ts +14 -0
  129. package/dist/internal/SentRequest.d.ts.map +1 -0
  130. package/dist/internal/SentRequest.js +31 -0
  131. package/dist/internal/SentRequest.js.map +1 -0
  132. package/dist/internal/ShardMerge.d.ts +83 -0
  133. package/dist/internal/ShardMerge.d.ts.map +1 -0
  134. package/dist/internal/ShardMerge.js +182 -0
  135. package/dist/internal/ShardMerge.js.map +1 -0
  136. package/dist/internal/TransactPlan.d.ts +1 -8
  137. package/dist/internal/TransactPlan.d.ts.map +1 -1
  138. package/dist/internal/TransactPlan.js +2 -9
  139. package/dist/internal/TransactPlan.js.map +1 -1
  140. package/dist/internal/TransactWriteOps.d.ts +75 -24
  141. package/dist/internal/TransactWriteOps.d.ts.map +1 -1
  142. package/dist/internal/TransactWriteOps.js +147 -186
  143. package/dist/internal/TransactWriteOps.js.map +1 -1
  144. package/dist/internal/TransactableOps.d.ts +123 -29
  145. package/dist/internal/TransactableOps.d.ts.map +1 -1
  146. package/dist/internal/TransactableOps.js +255 -87
  147. package/dist/internal/TransactableOps.js.map +1 -1
  148. package/dist/internal/WriteDiagnosis.d.ts +31 -3
  149. package/dist/internal/WriteDiagnosis.d.ts.map +1 -1
  150. package/dist/internal/WriteDiagnosis.js +128 -11
  151. package/dist/internal/WriteDiagnosis.js.map +1 -1
  152. package/package.json +4 -2
@@ -7,11 +7,11 @@
7
7
  import { ValidationError } from "@effect-dynamodb/schema/Errors.js";
8
8
  import { makeDefaultCrypto } from "@effect-dynamodb/schema/internal/DefaultCrypto.js";
9
9
  import { resolveUniqueFields } from "@effect-dynamodb/schema/internal/EntitySchemas.js";
10
- import { isKeyValueError } from "@effect-dynamodb/schema/internal/NumericKey.js";
11
- import { isZOrderValueError } from "@effect-dynamodb/schema/internal/ZOrderCurve.js";
12
10
  import * as KeyComposer from "@effect-dynamodb/schema/KeyComposer.js";
13
11
  import { DateTime, Effect, Option, Schema } from "effect";
14
- import { fromAttributeMap, toAttributeMap } from "../Marshaller.js";
12
+ import { fromAttributeMap, isUnstorableValue, toAttributeMap } from "../Marshaller.js";
13
+ import { resolveTtlAttributeName } from "../Table.js";
14
+ import { isRefusedValue } from "./Capacity.js";
15
15
  /**
16
16
  * @internal Hidden per-incarnation token of a versioned entity (#133): set
17
17
  * when an item is created, it tells an item apart from a deleted-and-recreated
@@ -19,23 +19,133 @@ import { fromAttributeMap, toAttributeMap } from "../Marshaller.js";
19
19
  * `__edd_e__` so it cannot collide with a model field; never decoded.
20
20
  */
21
21
  export const INCARNATION_TOKEN = "__edd_i__";
22
- /** @internal */
23
- export const projectionTombstonesOf = (entity) => entity._projectionTombstones;
24
22
  /**
25
- * @internal `create` over a projection tombstone (#154): read the key, and
26
- * when it holds the entity's tombstone, carry the projection's kept fields
27
- * over into `item` (stored names, wire values) — its checkpoints, so a late
28
- * redelivery is still recognised — with the revision one higher, and return
29
- * the guard naming that very tombstone. `None` when there is no tombstone:
30
- * `create`'s own guard applies.
23
+ * @internal The layout of every projection defined on the read model, one entry per distinct
24
+ * layout; `undefined` when none is.
31
25
  */
32
- export const overTombstone = (entity, client, tableName, item) => Effect.gen(function* () {
33
- const layout = projectionTombstonesOf(entity);
34
- if (layout === undefined)
26
+ export const projectionLayoutsOf = (entity) => entity._projectionLayouts;
27
+ /**
28
+ * @internal Whether a projection defined on the read model has `removal`: its rows may be
29
+ * tombstones, which `create` takes the place of (`overTombstone`), so `create` reads first.
30
+ */
31
+ export const hasProjectionTombstones = (entity) => entity._projectionTombstones === true;
32
+ /** A domain field's stored attribute name on `entity`. */
33
+ const storedName = (entity, field) => {
34
+ const probe = { [field]: 1 };
35
+ entity._renameToDynamo(probe);
36
+ return Object.keys(probe)[0] ?? field;
37
+ };
38
+ /**
39
+ * `[EDD-9133]` among `layouts`: a stored attribute one projection names in two roles. The problem,
40
+ * or `undefined`. `current` is the layout being defined, named "this projection". Two projections
41
+ * may name one attribute in different roles: each writes its own, so two that never write one
42
+ * row (rows of disjoint keys) work as on 1.39.0. Two that share rows and swap names can't be told
43
+ * apart from them, and are as broken as on 1.39.0.
44
+ */
45
+ const roleConflict = (entity, layouts, current) => {
46
+ const whose = (layout) => layout === current ? "this projection's" : `${layout.label}'s`;
47
+ const as = (field, stored) => field === stored ? `"${field}"` : `"${field}" (stored as "${stored}")`;
48
+ for (const layout of layouts) {
49
+ const first = new Map();
50
+ for (const [field, role] of layout.roles) {
51
+ const stored = storedName(entity, field);
52
+ const held = first.get(stored);
53
+ if (held === undefined) {
54
+ first.set(stored, { layout, field, role });
55
+ continue;
56
+ }
57
+ if (held.role === role)
58
+ continue;
59
+ const second = held.field === field ? `its ${role}` : `${as(field, stored)} its ${role}`;
60
+ return (`[EDD-9133] ${current.label}: on read model "${entity.entityType}", ` +
61
+ `${as(held.field, stored)} is ${whose(held.layout)} ${held.role}, and ${second}. A ` +
62
+ "projection of the read model has `removal`, and a tombstone carries a checkpoint as it " +
63
+ "is and raises a revision: an attribute holds one role in a projection. Give each its " +
64
+ "own field.");
65
+ }
66
+ }
67
+ return undefined;
68
+ };
69
+ /**
70
+ * @internal Record a projection's layout on its read model, beside those of the other projections
71
+ * defined on it, and whether it has `removal`. On a read model one of whose projections has
72
+ * `removal`, a stored attribute one projection names in two roles is refused (`[EDD-9133]`), before
73
+ * anything is recorded: its tombstone carries a checkpoint as it is and raises a revision, so the
74
+ * two would overwrite each other's values. The refusal comes at whichever definition completes the
75
+ * conflict (the projection's own, or the first `removal`), so the order projections are defined in
76
+ * doesn't decide it. Without `removal` nothing is refused: rows are never tombstones. Two
77
+ * projections naming one attribute in different roles are not refused (`roleConflict`). A layout
78
+ * already there moves to the end rather than being added again, so a projection defined over and
79
+ * over (in a function, say) doesn't grow the list.
80
+ */
81
+ export const addProjectionLayout = (entity, layout) => {
82
+ const holder = entity;
83
+ const same = (other) => other.removal === layout.removal &&
84
+ other.ttl === layout.ttl &&
85
+ other.roles.length === layout.roles.length &&
86
+ other.roles.every(([field, role], i) => {
87
+ const [f, r] = layout.roles[i];
88
+ return field === f && role === r;
89
+ });
90
+ const layouts = [...(holder._projectionLayouts ?? []).filter((other) => !same(other)), layout];
91
+ if (layout.removal || hasProjectionTombstones(entity)) {
92
+ const problem = roleConflict(entity, layouts, layout);
93
+ if (problem !== undefined)
94
+ throw new Error(problem);
95
+ }
96
+ holder._projectionLayouts = layouts;
97
+ if (layout.removal)
98
+ holder._projectionTombstones = true;
99
+ };
100
+ /**
101
+ * @internal Whether the read model's TTL attribute must be checked against the attributes its
102
+ * projections keep (`projectionTtlConflict`): a projection's tombstones set it (`removal.ttl`).
103
+ * Only then is the table resolved for it.
104
+ */
105
+ export const projectionTtlChecked = (entity) => hasProjectionTombstones(entity) &&
106
+ (projectionLayoutsOf(entity) ?? []).some((layout) => layout.ttl);
107
+ /**
108
+ * @internal `[EDD-9133]` at run time, once the table's TTL attribute is known: an attribute a
109
+ * projection keeps on the read model's rows that is stored as the TTL attribute, which another's
110
+ * tombstones set (`removal.ttl`). The problem, or `undefined` when there is none. Like the
111
+ * definition's refusal, only on a read model one of whose projections has `removal`.
112
+ */
113
+ export const projectionTtlConflict = (entity, ttlAttribute) => {
114
+ if (!projectionTtlChecked(entity))
115
+ return undefined;
116
+ for (const layout of projectionLayoutsOf(entity) ?? []) {
117
+ for (const [field, role] of layout.roles) {
118
+ if (storedName(entity, field) === ttlAttribute) {
119
+ return (`[EDD-9133] "${field}" is a projection's ${role} on read model "${entity.entityType}", ` +
120
+ `stored as "${ttlAttribute}", the table's TTL attribute, which a projection's ` +
121
+ "tombstones set (`removal.ttl`). An attribute holds one role: give the " +
122
+ `${role} its own field.`);
123
+ }
124
+ }
125
+ }
126
+ return undefined;
127
+ };
128
+ /**
129
+ * @internal `create` over a projection tombstone (#154): read the key, and when it holds the
130
+ * entity's tombstone, carry what the projections with `removal` keep on one over into `item`
131
+ * (stored names, wire values), and return the guard naming that very tombstone. `None` when there
132
+ * is no tombstone: `create`'s own guard applies. A tombstone holds the attributes of the projection
133
+ * that wrote it, which may be any of those with `removal`: each one's checkpoints (and map, and
134
+ * owners) the tombstone holds are carried as they are, so a late redelivery is still recognised,
135
+ * and its revision one higher. An attribute two of them name is taken in the role the one defined
136
+ * last gives it, as 1.39.0 took every attribute from that one. A projection without `removal`
137
+ * writes no tombstone, and isn't consulted. When a projection's tombstones set the table's TTL
138
+ * attribute, it is never carried, so the row doesn't expire with the tombstone: a projection
139
+ * naming it is refused when it writes (`projectionTtlConflict`), and one defined after a tombstone
140
+ * was written would otherwise carry its expiry onto the row.
141
+ */
142
+ export const overTombstone = (entity, client, table, item) => Effect.gen(function* () {
143
+ if (!hasProjectionTombstones(entity))
35
144
  return Option.none();
145
+ const layouts = projectionLayoutsOf(entity) ?? [];
36
146
  const primary = entity.indexes.primary;
37
147
  const { Item } = yield* client.getItem({
38
- TableName: tableName,
148
+ TableName: table.name,
39
149
  Key: toAttributeMap({
40
150
  [primary.pk.field]: item[primary.pk.field],
41
151
  [primary.sk.field]: item[primary.sk.field],
@@ -45,35 +155,58 @@ export const overTombstone = (entity, client, tableName, item) => Effect.gen(fun
45
155
  if (Item === undefined || !isProjectionTombstone(Item, entity.entityType))
46
156
  return Option.none();
47
157
  const tomb = fromAttributeMap(Item);
48
- const dbName = (field) => {
49
- const probe = { [field]: 1 };
50
- entity._renameToDynamo(probe);
51
- return Object.keys(probe)[0] ?? field;
52
- };
53
- for (const field of layout.kept) {
54
- const name = dbName(field);
55
- if (tomb[name] !== undefined)
56
- item[name] = tomb[name];
57
- }
58
- if (layout.revision !== undefined) {
59
- const name = dbName(layout.revision);
60
- if (tomb[name] !== undefined)
61
- item[name] = Number(tomb[name]) + 1;
158
+ const ttl = layouts.some((layout) => layout.ttl) ? resolveTtlAttributeName(table) : undefined;
159
+ // An attribute is the tombstone's own, never a member it inherits.
160
+ const held = (name) => (Object.hasOwn(tomb, name) ? tomb[name] : undefined);
161
+ // The projections with `removal`, the one defined last first. Each attribute once, in the role
162
+ // of the first that names it: its checkpoints, then its revision, as with one layout.
163
+ const taken = new Set();
164
+ for (const layout of [...layouts].reverse()) {
165
+ if (!layout.removal)
166
+ continue;
167
+ const mine = layout.roles
168
+ .map(([field, role]) => [storedName(entity, field), role])
169
+ .filter(([name]) => name !== ttl && !taken.has(name));
170
+ for (const [name, role] of mine) {
171
+ taken.add(name);
172
+ if (role !== "revision" && held(name) !== undefined)
173
+ item[name] = held(name);
174
+ }
175
+ for (const [name, role] of mine) {
176
+ if (role === "revision" && held(name) !== undefined)
177
+ item[name] = Number(held(name)) + 1;
178
+ }
62
179
  }
63
180
  return Option.some({
64
181
  eq: { __edd_e__: `${entity.entityType}#tombstone`, __edd_removed__: tomb.__edd_removed__ },
65
182
  });
66
183
  });
184
+ /**
185
+ * @internal Flatten `entity`'s sparse-map fields on `item` (stored names) into per-entry
186
+ * attributes, refusing a key it can't store with a `ValidationError` for `operation`. The
187
+ * transactional put and a projection's tombstone (on a copy) go through it, and `Entity.put`
188
+ * refuses through the same `_serializeSparseFields`, so each refuses the same key the same way,
189
+ * before sending anything.
190
+ */
191
+ export const serializeSparseOrFail = (entity, item, operation) => Effect.try({
192
+ try: () => entity._serializeSparseFields(item),
193
+ catch: (e) => new ValidationError({
194
+ entityType: entity.entityType,
195
+ operation,
196
+ cause: e instanceof Error ? e.message : String(e),
197
+ }),
198
+ });
67
199
  /**
68
200
  * A projection tombstone (#154) of `entityType` — written at a removed row's
69
201
  * own key to keep its checkpoints. Every read by key reports it as absent.
70
202
  */
71
203
  export const isProjectionTombstone = (item, entityType) => item?.__edd_e__?.S === `${entityType}#tombstone`;
72
204
  /**
73
- * Marks a projection's row tombstone or outbox item written under the key
74
- * text 1.37 composes (#171). They hold no values to tell whose key they are
75
- * at, and `foo bar`'s current key is `foo%20bar`'s 1.36 key: one without the
76
- * mark is 1.36's, the row its key reads back as.
205
+ * Marks a projection's row tombstone or outbox item with the key text it's
206
+ * under (#171, #183). They hold no values to tell whose key they are at, and
207
+ * `foo bar`'s escaped key is `foo%20bar`'s unescaped one, so `rekey` reads the
208
+ * key back by the mark (`KeyText136.formOfMark`): none is the text 1.36
209
+ * composed, which `escapeKeys` off composes too.
77
210
  */
78
211
  export const KEY_TEXT = "__edd_kt__";
79
212
  /** The read-model row an outbox item was written for: its key attributes' text. */
@@ -310,38 +443,67 @@ export const resolveTableNames = (infos) => Effect.gen(function* () {
310
443
  * `ValidationError` for `operation`: a Z-order value (`[EDD-9092]`,
311
444
  * `ZOrderValueError`: `NaN`, an unparseable date, a value outside a `literals`
312
445
  * list — #171), or a composite with no key text (`[EDD-9096]`,
313
- * `KeyValueError`: `NaN`, a bigint past 1,000 digits). Every write path that
314
- * composes an item's keys goes through this, so the failure is typed instead
446
+ * `KeyValueError`: `NaN`, a bigint past 1,000 digits), or a sharded index's
447
+ * missing shard source (`[EDD-9100]`, `ShardSourceError`, #183). Every write path
448
+ * that composes an item's keys goes through this, so the failure is typed instead
315
449
  * of a defect. Any other throw stays a defect.
316
450
  */
317
- export const composeKeysOrFail = (entityType, operation, compose) => Effect.try({ try: compose, catch: (error) => error }).pipe(Effect.catch((error) => isZOrderValueError(error) || isKeyValueError(error)
451
+ export const composeKeysOrFail = (entityType, operation, compose) => Effect.try({ try: compose, catch: (error) => error }).pipe(Effect.catch((error) => isRefusedValue(error)
318
452
  ? Effect.fail(new ValidationError({ entityType, operation, cause: error }))
319
453
  : Effect.die(error)));
320
454
  /**
321
- * Compose the primary key for an entity item.
455
+ * Marshal an item holding a caller's values. A value DynamoDB can't store (an
456
+ * empty set in a list, `NaN`, a number past `Number.MAX_SAFE_INTEGER`, …) fails with
457
+ * a `ValidationError` naming the field; `fieldOf` names a stored attribute by its
458
+ * model field. So does a value it composes into a key and can't place, as
459
+ * {@link composeKeysOrFail} says. Any other throw stays a defect.
322
460
  */
323
- export const composePrimaryKey = (entity, key) => {
461
+ export const marshalOrFail = (entityType, operation, marshal, options = {}) => Effect.try({ try: marshal, catch: (error) => error }).pipe(Effect.catch((error) => isUnstorableValue(error)
462
+ ? Effect.fail(new ValidationError({
463
+ entityType,
464
+ operation,
465
+ cause: `${error.describe(options.fieldOf)} ${options.outcome ?? "Nothing was written."}`,
466
+ }))
467
+ : isRefusedValue(error)
468
+ ? Effect.fail(new ValidationError({ entityType, operation, cause: error }))
469
+ : Effect.die(error)));
470
+ /** An entity item's primary key, from a record already in the composite key form. */
471
+ const primaryKeyOf = (entity, recordKeyForm) => {
324
472
  const primary = entity.indexes.primary;
325
473
  const schema = entity._schema;
326
- // The caller's key is a DOMAIN record (`{ takenAt: DateTime }`), and every
327
- // `KeyComposer` input must first go through the composite key-form rule or it
328
- // composes a different string than `Entity.put` wrote — a `DateEpochMs` PK
329
- // composite made `Batch.get` return null and `Batch.write(delete)` report
330
- // success against a row it never touched (#111).
331
- const recordKeyForm = entity._keyForm(key);
332
474
  return {
333
475
  [primary.pk.field]: KeyComposer.composePk(schema, entity.entityType, primary, recordKeyForm),
334
476
  [primary.sk.field]: KeyComposer.composeSk(schema, entity.entityType, 1, primary, recordKeyForm),
335
477
  };
336
478
  };
337
479
  /**
338
- * {@link composePrimaryKey}, failing with a `ValidationError` for `operation`
339
- * where a composite has no key text (`NaN`, `[EDD-9096]`) — the key-taking
340
- * multi-item ops (`Batch.get`, `Batch.write` deletes, `transactGet`,
341
- * `transactWrite` deletes and condition checks), as an entity's own `get` and
342
- * `delete` do.
480
+ * The primary key of the row a caller's DOMAIN key record names: the key
481
+ * `Entity.put` wrote for it (`_domainKeyForm`). The projection engine reads a
482
+ * read-model row, writes its tombstone and keys its outbox items through this,
483
+ * as the row itself is written by the read model's own `put`.
484
+ */
485
+ export const composePrimaryKey = (entity, key) =>
486
+ // Every `KeyComposer` input must first go through the composite key-form rule
487
+ // or it composes a different string than `Entity.put` wrote — a `DateEpochMs`
488
+ // PK composite made `Batch.get` return null and `Batch.write(delete)` report
489
+ // success against a row it never touched (#111).
490
+ primaryKeyOf(entity, entity._domainKeyForm(key));
491
+ /**
492
+ * The primary key of the item a caller's key names, failing with a
493
+ * `ValidationError` for `operation` where a composite has no key text (`NaN`,
494
+ * `[EDD-9096]`) — the key-taking multi-item ops (`Batch.get`, `Batch.write`
495
+ * deletes, `transactGet`, `transactWrite` deletes and condition checks), as an
496
+ * entity's own `get` and `delete` do.
497
+ *
498
+ * The caller's key is a DOMAIN record (`{ takenAt: DateTime }`), as an entity's
499
+ * own `get` takes it, so it goes through `_domainKeyForm`: the key `Entity.put`
500
+ * wrote for it, the key that `get` composes. For a codec `encode` takes on its
501
+ * own output (`x:` prepended), that is the key of the stored text: a domain
502
+ * value that is also such a text (`"x:MiX"`) is encoded first, as `put` does.
503
+ * It sends the key it sent on 1.39.0, whose `put` keyed the stored text encoded
504
+ * once more, so it found nothing there.
343
505
  */
344
- export const composePrimaryKeyOrFail = (entity, key, operation) => composeKeysOrFail(entity.entityType, operation, () => composePrimaryKey(entity, key));
506
+ export const composePrimaryKeyOrFail = (entity, key, operation) => composeKeysOrFail(entity.entityType, operation, () => primaryKeyOf(entity, entity._domainKeyForm(key)));
345
507
  /**
346
508
  * Validate input, compose all keys, and build a marshalled put item.
347
509
  *
@@ -355,9 +517,10 @@ export const composePrimaryKeyOrFail = (entity, key, operation) => composeKeysOr
355
517
  * `createdAt`. `Entity._planPut` needs them to derive uniqueness sentinels and
356
518
  * the retain snapshot from the same values that were written (#113), and to
357
519
  * keep a replaced item's `createdAt` (#133); re-deriving `now` there would risk
358
- * a skew between an item's `createdAt` and its snapshot's TTL.
520
+ * a skew between an item's `createdAt` and its snapshot's TTL. `options.createdAt`
521
+ * is the `createdAt` of a row being rewritten, which no input supplies.
359
522
  */
360
- export const validateAndBuildPutItem = (entity, input, operation) => Effect.gen(function* () {
523
+ export const validateAndBuildPutItem = (entity, input, operation, options) => Effect.gen(function* () {
361
524
  // Clock-backed time source resolved once per op; threaded into the sync
362
525
  // timestamp builder so the value is deterministic under `TestClock`.
363
526
  const now = yield* DateTime.now;
@@ -371,16 +534,46 @@ export const validateAndBuildPutItem = (entity, input, operation) => Effect.gen(
371
534
  operation,
372
535
  cause,
373
536
  })));
537
+ yield* entity._refuseNotReadBack(encoded, operation);
374
538
  const item = { ...encoded };
375
539
  item.__edd_e__ = entity.entityType;
376
540
  if (unsentineled.length > 0)
377
541
  item[UNSENTINELED_DEFAULTS] = new Set(unsentineled);
542
+ // System fields (collision-aware), stamped before the keys are composed,
543
+ // as `Entity.put` does: an index may be composed from one. When a
544
+ // timestamp field collides with a model-declared field, the user may have
545
+ // supplied their own value (already encoded to wire by `Schema.encode`);
546
+ // else generate a wire primitive directly. They are placed in the item
547
+ // after the keys, where 1.39.0 placed them, so the request is the same.
548
+ const sf = entity.systemFields;
549
+ const createdAtSupplied = sf.createdAt !== null && item[sf.createdAt] !== undefined;
550
+ const stamps = {};
551
+ if (sf.createdAt) {
552
+ if (options?.createdAt !== undefined) {
553
+ stamps[sf.createdAt] = generateTimestampPrimitive(options.createdAt, sf.createdAtEncoding);
554
+ }
555
+ else if (item[sf.createdAt] === undefined) {
556
+ stamps[sf.createdAt] = generateTimestampPrimitive(now, sf.createdAtEncoding);
557
+ }
558
+ }
559
+ if (sf.updatedAt) {
560
+ if (item[sf.updatedAt] === undefined) {
561
+ stamps[sf.updatedAt] = generateTimestampPrimitive(now, sf.updatedAtEncoding);
562
+ }
563
+ }
564
+ if (sf.version)
565
+ stamps[sf.version] = 1;
378
566
  // Same normalisation `Entity.put` applies. Without it a `BigIntFromString`
379
567
  // composite composed `txn_420` here and `txn_000…0420` there, so the two
380
568
  // APIs wrote two different rows for the same logical item and neither
381
569
  // accessor could read the transact-written one (#111).
382
- const keys = yield* composeKeysOrFail(entity.entityType, operation, () => KeyComposer.composeAllKeys(entity._schema, entity.entityType, 1, entity.indexes, entity._keyForm(encoded)));
383
- Object.assign(item, keys);
570
+ const composed = { ...encoded };
571
+ for (const field of [sf.createdAt, sf.updatedAt, sf.version]) {
572
+ if (field)
573
+ composed[field] = Object.hasOwn(stamps, field) ? stamps[field] : item[field];
574
+ }
575
+ const composeKeys = (carried) => composeKeysOrFail(entity.entityType, operation, () => KeyComposer.composeAllKeys(entity._schema, entity.entityType, 1, entity.indexes, entity._keyForm({ ...composed, ...carried })));
576
+ Object.assign(item, yield* composeKeys({}));
384
577
  // A unique field's sentinel key is composed from its value later, on the
385
578
  // guarded path, after this item is marshalled. One with no key text
386
579
  // (`NaN`, `[EDD-9096]`) is refused here, as `Entity.put` refuses it, not
@@ -389,29 +582,13 @@ export const validateAndBuildPutItem = (entity, input, operation) => Effect.gen(
389
582
  for (const def of Object.values(entity.unique ?? {})) {
390
583
  for (const field of resolveUniqueFields(def)) {
391
584
  const value = encoded[field];
392
- if (value !== undefined && value !== null)
393
- KeyComposer.serializeValue(value);
585
+ if (value !== undefined && value !== null) {
586
+ KeyComposer.compositeText(entity._schema, value);
587
+ }
394
588
  }
395
589
  }
396
590
  });
397
- // System fields (collision-aware). When a timestamp field collides with a
398
- // model-declared field, the user may have supplied their own value
399
- // (already encoded to wire by `Schema.encode`); else generate a wire
400
- // primitive directly.
401
- const sf = entity.systemFields;
402
- const createdAtSupplied = sf.createdAt !== null && item[sf.createdAt] !== undefined;
403
- if (sf.createdAt) {
404
- if (item[sf.createdAt] === undefined) {
405
- item[sf.createdAt] = generateTimestampPrimitive(now, sf.createdAtEncoding);
406
- }
407
- }
408
- if (sf.updatedAt) {
409
- if (item[sf.updatedAt] === undefined) {
410
- item[sf.updatedAt] = generateTimestampPrimitive(now, sf.updatedAtEncoding);
411
- }
412
- }
413
- if (sf.version)
414
- item[sf.version] = 1;
591
+ Object.assign(item, stamps);
415
592
  if (entity._incarnationToken)
416
593
  item[INCARNATION_TOKEN] = yield* freshIncarnationToken;
417
594
  // Rename domain fields to their stored attribute names, in the same
@@ -421,20 +598,11 @@ export const validateAndBuildPutItem = (entity, input, operation) => Effect.gen(
421
598
  // `_planPut` derives the retain snapshot from this same item,
422
599
  // so the snapshot inherited the wrong shape too (#111).
423
600
  entity._renameToDynamo(item);
424
- // Flatten sparse-map fields into per-entry top-level attributes. Throws
425
- // on invalid keys; surface as ValidationError at the entity boundary.
426
- try {
427
- entity._serializeSparseFields(item);
428
- }
429
- catch (e) {
430
- return yield* new ValidationError({
431
- entityType: entity.entityType,
432
- operation,
433
- cause: e instanceof Error ? e.message : String(e),
434
- });
435
- }
601
+ // Flatten sparse-map fields into per-entry top-level attributes.
602
+ yield* serializeSparseOrFail(entity, item, operation);
436
603
  // Pack `storedAs: DynamoModel.Packed` fields, as `Entity.put` does (#147).
437
604
  yield* entity._packFields(item, operation);
438
- return { item, marshalled: toAttributeMap(item), now, createdAtSupplied };
605
+ const marshalled = yield* marshalOrFail(entity.entityType, operation, () => toAttributeMap(item), { fieldOf: entity._fieldOfAttribute });
606
+ return { item, marshalled, now, createdAtSupplied, composeKeys };
439
607
  });
440
608
  //# sourceMappingURL=TransactableOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactableOps.js","sourceRoot":"","sources":["../../src/internal/TransactableOps.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAA;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAA;AACpF,OAAO,KAAK,WAAW,MAAM,wCAAwC,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IAAI,EAAE,CAAC;oBAC1C,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;gBAClD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC3B,IAAI,MAAM,CAAC,iBAAiB;QAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,CAAC,qBAAqB,CAAA;IAEpF,oEAAoE;IACpE,wEAAwE;IACxE,wEAAwE;IACxE,2EAA2E;IAC3E,8DAA8D;IAC9D,wDAAwD;IACxD,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IAE5B,iEAAiE;IACjE,KAAK,CAAC,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAErD,2EAA2E;IAC3E,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAE1C,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,aAAa,CACrC,MAAM,CAAC,UAAU,EACjB,SAAS,EACT,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAC1B,EAAE,OAAO,EAAE,MAAM,CAAC,iBAAiB,EAAE,CACtC,CAAA;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAA;AAClE,CAAC,CAAC,CAAA"}
@@ -2,7 +2,9 @@
2
2
  * @internal Failure-time diagnosis of DynamoDB's rejections (#144).
3
3
  *
4
4
  * The library does not pre-check limits or request rules DynamoDB enforces
5
- * itself — the 400 KB item, the 4 MB and 100-item transaction, the 2048-byte
5
+ * itself — the 400 KB item, the 4 MB and 100-item transaction, the 16 MB
6
+ * request body (on a caller's own request; the library splits its own
7
+ * batches to fit, `ItemSize.packRequests`), the 2048-byte
6
8
  * partition key and 1024-byte sort key, one operation per item, the limits on
7
9
  * one expression, an `IN ()` with no operands, an empty key value, a reversed
8
10
  * `BETWEEN`, a consistent read of a GSI, a table's vector index limits, a
@@ -12,13 +14,14 @@
12
14
  * 1. **recognises** the rejection by a stable fragment of its message (a
13
15
  * request-wide `ValidationException` or `LimitExceededException`, or a
14
16
  * `TransactionCanceledException` whose positional reason carries
15
- * `Code: "ValidationError"`);
17
+ * `Code: "ValidationError"`), or a request body over 16 MB by its HTTP 413;
16
18
  * 2. **confirms** it against the request the site sent — an item count, a
17
19
  * key's UTF-8 bytes, an expression's length or operators, two entries
18
20
  * naming one item, an empty key value, the order of two bounds (each
19
21
  * confirmed only when the request breaks the rule), or, for item and
20
22
  * transaction sizes, by checking the request holds something the message
21
- * can apply to and measuring it exactly (`ItemSize.ts`);
23
+ * can apply to and measuring it exactly (`ItemSize.ts`), and for a request
24
+ * body, by measuring the body over its limit;
22
25
  * 3. **attributes** it to the culprit, using the targets the site built.
23
26
  *
24
27
  * A site turns the {@link Diagnosis} into its own tagged error with
@@ -72,21 +75,28 @@ export declare const transactItemTarget: (item: TransactWriteItem | TransactGetI
72
75
  * `callerCondition` is the caller's own `.condition()` on the entry at an
73
76
  * index (the rest of its `ConditionExpression` is the library's guard), to
74
77
  * say how much of an expression rejected for its size is the caller's.
78
+ *
79
+ * `input` is the request input as sent: the object the client received,
80
+ * after `Capacity` added `ReturnConsumedCapacity`. {@link diagnoseFailure}
81
+ * fills it from the failure (`SentRequest`); a site leaves it out.
75
82
  */
76
83
  export type SentWrite = {
77
84
  readonly _tag: "Item";
78
85
  readonly item: TransactWriteItem;
79
86
  readonly target: () => TransactItemTarget;
80
87
  readonly callerCondition?: (() => string | undefined) | undefined;
88
+ readonly input?: Readonly<Record<string, unknown>> | undefined;
81
89
  } | {
82
90
  readonly _tag: "Transaction";
83
91
  readonly items: ReadonlyArray<TransactWriteItem>;
84
92
  readonly targets: () => ReadonlyArray<TransactItemTarget>;
85
93
  readonly callerCondition?: ((index: number) => string | undefined) | undefined;
94
+ readonly input?: Readonly<Record<string, unknown>> | undefined;
86
95
  } | {
87
96
  readonly _tag: "Batch";
88
97
  readonly items: ReadonlyArray<TransactWriteItem>;
89
98
  readonly targets: () => ReadonlyArray<TransactItemTarget>;
99
+ readonly input?: Readonly<Record<string, unknown>> | undefined;
90
100
  } | {
91
101
  readonly _tag: "TransactGet";
92
102
  readonly count: number;
@@ -173,6 +183,24 @@ export type Diagnosis = {
173
183
  readonly target: TransactItemTarget;
174
184
  readonly bytes: number;
175
185
  }>;
186
+ } | {
187
+ /** A request whose body is over DynamoDB's 16 MB, by the JSON sent. */
188
+ readonly _tag: "RequestTooLarge";
189
+ /** What was sent: a transaction, a batch request, or a single-item write. */
190
+ readonly request: "TransactWriteItems" | "BatchWriteItem" | "item";
191
+ /**
192
+ * The request's body by the library's measure (`ItemSize.jsonBytes`):
193
+ * what the site sent, before any field the client adds (at most a few
194
+ * dozen bytes), so always over the limit here.
195
+ */
196
+ readonly measured: number;
197
+ /** The same request by item size — the measure of the 400 KB and 4 MB limits. */
198
+ readonly itemSize: number;
199
+ /** The largest entries by body bytes, largest first (at most three). */
200
+ readonly largest: ReadonlyArray<{
201
+ readonly target: TransactItemTarget;
202
+ readonly bytes: number;
203
+ }>;
176
204
  } | {
177
205
  /** A key value over its limit: 2048 bytes for a partition key, 1024 for a sort key. */
178
206
  readonly _tag: "KeyTooLong";