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,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal BoundQuery — Fluent query builder with pre-resolved services.
|
|
3
3
|
*
|
|
4
|
-
* `BoundQuery<Model, SkRemaining, A>` wraps a `Query<A>` with a pre-resolved
|
|
4
|
+
* `BoundQuery<Model, SkRemaining, A, W>` wraps a `Query<A>` with a pre-resolved
|
|
5
5
|
* `provide` function so all terminals return `Effect` with `R = never`.
|
|
6
6
|
*
|
|
7
7
|
* - Combinators return a new `BoundQuery` (immutable).
|
|
8
|
-
* - `where` consumes `SkRemaining` → `BoundQuery<Model, never, A>`.
|
|
8
|
+
* - `where` consumes `SkRemaining` → `BoundQuery<Model, never, A, never>`.
|
|
9
9
|
* - `where` is only available when `SkRemaining` is not `never`.
|
|
10
|
-
* -
|
|
10
|
+
* - `within` (#171) bounds the sort key composites `W` names; it and `where`
|
|
11
|
+
* exclude each other. On a Z-order accessor it bounds the dimensions and
|
|
12
|
+
* prefix composites, and `zorder` chooses how the box is read.
|
|
13
|
+
* - Terminals: `fetch`, `collect`, `paginate`, `count`; `explain` describes
|
|
14
|
+
* the plan without sending anything.
|
|
11
15
|
*/
|
|
12
16
|
import type { ValidationError } from "@effect-dynamodb/schema/Errors.js";
|
|
13
17
|
import { Effect, Stream } from "effect";
|
|
@@ -23,13 +27,13 @@ import type { PackedPath, Path, PathBuilder } from "./PathBuilder.js";
|
|
|
23
27
|
* `"todo" | "done"`) widen to `string`, so open bounds and `beginsWith`
|
|
24
28
|
* prefixes that are not themselves valid values still typecheck.
|
|
25
29
|
* - **Every other composite** keeps its own type. That is the point of
|
|
26
|
-
* issue #114: `serializeValue`
|
|
27
|
-
*
|
|
28
|
-
* `"
|
|
29
|
-
* mismatch. Requiring the composite's own type also lets the
|
|
30
|
-
* through the composite's own codec, which is what makes a
|
|
31
|
-
* composite (`Schema.BigIntFromString`) compare against the
|
|
32
|
-
* actually stored.
|
|
30
|
+
* issue #114: `serializeValue` encodes numbers and bigints in numeric order
|
|
31
|
+
* on the write path (`42` as `"0000000000000042"`), so a stringly-typed
|
|
32
|
+
* `"42"` compares against that text and sorts *after* every stored value —
|
|
33
|
+
* a silent mismatch. Requiring the composite's own type also lets the
|
|
34
|
+
* operand run through the composite's own codec, which is what makes a
|
|
35
|
+
* transformed composite (`Schema.BigIntFromString`) compare against the
|
|
36
|
+
* value that was actually stored.
|
|
33
37
|
*/
|
|
34
38
|
export type SkOperand<V> = [V] extends [string] ? string : V;
|
|
35
39
|
/**
|
|
@@ -71,11 +75,11 @@ export interface SkConditionOps<SK = Record<string, unknown>> {
|
|
|
71
75
|
readonly between: <V extends SK[keyof SK]>(field: V, low: SkOperand<V>, high: SkOperand<V>) => RawSortKeyCondition;
|
|
72
76
|
readonly beginsWith: <V extends SK[keyof SK]>(field: V, prefix: SkOperand<V>) => RawSortKeyCondition;
|
|
73
77
|
}
|
|
74
|
-
export interface BoundQueryBase<Model, SkRemaining, A> {
|
|
78
|
+
export interface BoundQueryBase<Model, SkRemaining, A, W extends WithinSpec<any, WithinKind> = never> {
|
|
75
79
|
/** Add a filter expression (post-read). Callback or shorthand. */
|
|
76
80
|
readonly filter: {
|
|
77
|
-
(fn: (t: PathBuilder<Model, Model, never>, ops: ConditionOps<Model>) => Expr): BoundQuery<Model, SkRemaining, A>;
|
|
78
|
-
(shorthand: ConditionShorthand): BoundQuery<Model, SkRemaining, A>;
|
|
81
|
+
(fn: (t: PathBuilder<Model, Model, never>, ops: ConditionOps<Model>) => Expr): BoundQuery<Model, SkRemaining, A, W>;
|
|
82
|
+
(shorthand: ConditionShorthand): BoundQuery<Model, SkRemaining, A, W>;
|
|
79
83
|
};
|
|
80
84
|
/**
|
|
81
85
|
* Add a **client-side** predicate, evaluated on the decoded item inside the
|
|
@@ -97,37 +101,58 @@ export interface BoundQueryBase<Model, SkRemaining, A> {
|
|
|
97
101
|
*
|
|
98
102
|
* Cannot be combined with `.select()` — see EDD-9054.
|
|
99
103
|
*/
|
|
100
|
-
readonly filterBy: (predicate: (item: A) => boolean) => BoundQuery<Model, SkRemaining, A>;
|
|
104
|
+
readonly filterBy: (predicate: (item: A) => boolean) => BoundQuery<Model, SkRemaining, A, W>;
|
|
101
105
|
/** Select specific attributes (projection). Callback or string array. */
|
|
102
106
|
readonly select: {
|
|
103
|
-
(fn: (t: PathBuilder<Model, Model, never>) => ReadonlyArray<Path<Model, any, any> | PackedPath<Model, any, any>>): BoundQuery<Model, SkRemaining, Record<string, unknown
|
|
104
|
-
(attributes: ReadonlyArray<string>): BoundQuery<Model, SkRemaining, Record<string, unknown
|
|
107
|
+
(fn: (t: PathBuilder<Model, Model, never>) => ReadonlyArray<Path<Model, any, any> | PackedPath<Model, any, any>>): BoundQuery<Model, SkRemaining, Record<string, unknown>, W>;
|
|
108
|
+
(attributes: ReadonlyArray<string>): BoundQuery<Model, SkRemaining, Record<string, unknown>, W>;
|
|
105
109
|
};
|
|
106
110
|
/**
|
|
107
111
|
* Return at most `n` items — a contract on results. The query accumulates
|
|
108
112
|
* across as many requests as it takes, which is what makes it work under a
|
|
109
|
-
* `.filter()
|
|
113
|
+
* `.filter()`, sizing each request from the pass rate the earlier ones
|
|
114
|
+
* showed. Use `.pageSize()` to size the requests themselves, or
|
|
115
|
+
* `.pageSize("natural")` for 1.36's sizing; a query with `.maxPages()` keeps
|
|
116
|
+
* 1.36's sizing too.
|
|
110
117
|
*/
|
|
111
|
-
readonly limit: (n: number) => BoundQuery<Model, SkRemaining, A>;
|
|
118
|
+
readonly limit: (n: number) => BoundQuery<Model, SkRemaining, A, W>;
|
|
112
119
|
/**
|
|
113
120
|
* Fetch in batches of `n` — sets DynamoDB's `Limit` (rows examined per
|
|
114
|
-
* request). A contract on round trips, not on what comes back.
|
|
121
|
+
* request). A contract on round trips, not on what comes back. `"natural"`
|
|
122
|
+
* sizes requests exactly as 1.36 did (natural 1 MB pages under a filter);
|
|
123
|
+
* any other string throws `[EDD-9095]`.
|
|
115
124
|
*/
|
|
116
|
-
readonly pageSize: (
|
|
125
|
+
readonly pageSize: (size: number | "natural") => BoundQuery<Model, SkRemaining, A, W>;
|
|
126
|
+
/**
|
|
127
|
+
* Run `observer` after every request a terminal sends, with the `Limit` sent
|
|
128
|
+
* and the rows DynamoDB examined, the filter kept and the query accepted
|
|
129
|
+
* (`Query.QueryRequestEvent`). Its failure is a defect; DynamoDB calls it
|
|
130
|
+
* makes are not charged to the query's consumed capacity.
|
|
131
|
+
*/
|
|
132
|
+
readonly onRequest: (observer: (event: Query.QueryRequestEvent) => Effect.Effect<void>) => BoundQuery<Model, SkRemaining, A, W>;
|
|
117
133
|
/** Set the maximum number of DynamoDB pages to fetch. */
|
|
118
|
-
readonly maxPages: (n: number) => BoundQuery<Model, SkRemaining, A>;
|
|
134
|
+
readonly maxPages: (n: number) => BoundQuery<Model, SkRemaining, A, W>;
|
|
119
135
|
/** Reverse the sort order (ScanIndexForward = false). */
|
|
120
|
-
readonly reverse: () => BoundQuery<Model, SkRemaining, A>;
|
|
121
|
-
/**
|
|
122
|
-
|
|
136
|
+
readonly reverse: () => BoundQuery<Model, SkRemaining, A, W>;
|
|
137
|
+
/**
|
|
138
|
+
* Resume pagination from an opaque cursor. The cursor is decoded when a
|
|
139
|
+
* terminal runs: a malformed one fails it with a `ValidationError`
|
|
140
|
+
* (`[EDD-9094]`), as does a `.within()` cursor on a query without
|
|
141
|
+
* `.within()`. A `.within()` query also refuses one from another plan
|
|
142
|
+
* (other bounds, partition, direction or index declaration) or positioned
|
|
143
|
+
* outside its own. A query without `.within()` can't recognise another
|
|
144
|
+
* query's well-formed cursor: DynamoDB may reject it
|
|
145
|
+
* (`DynamoValidationError`) or the query resumes from it.
|
|
146
|
+
*/
|
|
147
|
+
readonly startFrom: (cursor: string) => BoundQuery<Model, SkRemaining, A, W>;
|
|
123
148
|
/**
|
|
124
149
|
* Enable consistent reads. DynamoDB rejects them on a GSI, which it reads
|
|
125
150
|
* only eventually consistently: the query then fails with a
|
|
126
151
|
* `ValidationError` naming the index.
|
|
127
152
|
*/
|
|
128
|
-
readonly consistentRead: () => BoundQuery<Model, SkRemaining, A>;
|
|
153
|
+
readonly consistentRead: () => BoundQuery<Model, SkRemaining, A, W>;
|
|
129
154
|
/** Skip the __edd_e__ entity type filter. */
|
|
130
|
-
readonly ignoreOwnership: () => BoundQuery<Model, SkRemaining, A>;
|
|
155
|
+
readonly ignoreOwnership: () => BoundQuery<Model, SkRemaining, A, W>;
|
|
131
156
|
/** Execute a single page. Returns items + opaque cursor. */
|
|
132
157
|
readonly fetch: () => Effect.Effect<Query.Page<A>, DynamoClientError | ValidationError, never>;
|
|
133
158
|
/** Execute and collect all pages into a single array. */
|
|
@@ -143,6 +168,14 @@ export interface BoundQueryBase<Model, SkRemaining, A> {
|
|
|
143
168
|
* that is why the error channel carries `ValidationError` (decode can fail).
|
|
144
169
|
*/
|
|
145
170
|
readonly count: () => Effect.Effect<number, DynamoClientError | ValidationError, never>;
|
|
171
|
+
/**
|
|
172
|
+
* Describe what the terminals would send — the plan (`key`, `skip-scan`,
|
|
173
|
+
* `filter`, or a Z-order `naive` / `jump` / `precise` / `empty`), why it
|
|
174
|
+
* was chosen, the key ranges known up front, the fields
|
|
175
|
+
* checked per row and how requests are sized — without sending anything.
|
|
176
|
+
* A `startFrom` cursor is not read: the plan is described from its start.
|
|
177
|
+
*/
|
|
178
|
+
readonly explain: () => Effect.Effect<Query.QueryExplain, never, never>;
|
|
146
179
|
}
|
|
147
180
|
export interface BoundQueryWithWhere<Model, SkRemaining, A> {
|
|
148
181
|
/**
|
|
@@ -154,9 +187,143 @@ export interface BoundQueryWithWhere<Model, SkRemaining, A> {
|
|
|
154
187
|
* .where((t, { eq }) => eq(t.status, "done"))
|
|
155
188
|
* ```
|
|
156
189
|
*/
|
|
157
|
-
readonly where: (fn: (t: SkRemaining, ops: SkConditionOps<SkRemaining>) => RawSortKeyCondition) => BoundQuery<Model, never, A>;
|
|
190
|
+
readonly where: (fn: (t: SkRemaining, ops: SkConditionOps<SkRemaining>) => RawSortKeyCondition) => BoundQuery<Model, never, A, never>;
|
|
158
191
|
}
|
|
159
|
-
|
|
192
|
+
/** Which accessor a `.within()` belongs to. */
|
|
193
|
+
export type WithinKind = "composite" | "zorder";
|
|
194
|
+
/** What `.within()` accepts on an accessor (`bounds`), and the kind of accessor. */
|
|
195
|
+
export interface WithinSpec<B, K extends WithinKind> {
|
|
196
|
+
readonly bounds: B;
|
|
197
|
+
readonly kind: K;
|
|
198
|
+
}
|
|
199
|
+
/** `.within()` consumed on a Z-order accessor: `.zorder()` stays available. */
|
|
200
|
+
export type ZOrderApplied = WithinSpec<never, "zorder">;
|
|
201
|
+
type BoundOperator = "eq" | "between" | "gt" | "gte" | "lt" | "lte" | "in";
|
|
202
|
+
/**
|
|
203
|
+
* `T`, every other operator ruled out — so `{ eq, gte }` or `{ lt, lte }` is
|
|
204
|
+
* a type error rather than a union member that excess property checks pass.
|
|
205
|
+
*/
|
|
206
|
+
type Only<T> = T & {
|
|
207
|
+
readonly [K in Exclude<BoundOperator, keyof T>]?: never;
|
|
208
|
+
};
|
|
209
|
+
/** A lower bound: `gt` or `gte`, not both. */
|
|
210
|
+
export type LowerBound<V> = Only<{
|
|
211
|
+
readonly gt: V;
|
|
212
|
+
}> | Only<{
|
|
213
|
+
readonly gte: V;
|
|
214
|
+
}>;
|
|
215
|
+
/** An upper bound: `lt` or `lte`, not both. */
|
|
216
|
+
export type UpperBound<V> = Only<{
|
|
217
|
+
readonly lt: V;
|
|
218
|
+
}> | Only<{
|
|
219
|
+
readonly lte: V;
|
|
220
|
+
}>;
|
|
221
|
+
/**
|
|
222
|
+
* A `.within()` bound on one field: a value, an inclusive pair, or one or two
|
|
223
|
+
* open ends. Bounds are compared in key form — the value composed into the
|
|
224
|
+
* sort key (numbers padded, dates as stored, strings cased).
|
|
225
|
+
*/
|
|
226
|
+
export type RangeBound<V> = Only<{
|
|
227
|
+
readonly eq: V;
|
|
228
|
+
}> | Only<{
|
|
229
|
+
readonly between: readonly [V, V];
|
|
230
|
+
}> | LowerBound<V> | UpperBound<V> | Only<{
|
|
231
|
+
readonly gt: V;
|
|
232
|
+
readonly lt: V;
|
|
233
|
+
}> | Only<{
|
|
234
|
+
readonly gt: V;
|
|
235
|
+
readonly lte: V;
|
|
236
|
+
}> | Only<{
|
|
237
|
+
readonly gte: V;
|
|
238
|
+
readonly lt: V;
|
|
239
|
+
}> | Only<{
|
|
240
|
+
readonly gte: V;
|
|
241
|
+
readonly lte: V;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* The members of a literals dimension entry `D` over a field of type `V`: its
|
|
245
|
+
* declared `values`, else the field's members. `never` for any other entry (a
|
|
246
|
+
* range, a date-time window, a byte width).
|
|
247
|
+
*/
|
|
248
|
+
type LiteralsEntryMembers<D, V> = D extends string ? Exclude<V, undefined> : D extends {
|
|
249
|
+
readonly min: unknown;
|
|
250
|
+
} | {
|
|
251
|
+
readonly max: unknown;
|
|
252
|
+
} | {
|
|
253
|
+
readonly from: unknown;
|
|
254
|
+
} | {
|
|
255
|
+
readonly unit: unknown;
|
|
256
|
+
} | {
|
|
257
|
+
readonly bytes: unknown;
|
|
258
|
+
} ? never : D extends {
|
|
259
|
+
readonly values: ReadonlyArray<infer L>;
|
|
260
|
+
} ? L : Exclude<V, undefined>;
|
|
261
|
+
/**
|
|
262
|
+
* A `.within()` bound on one dimension of a Z-order sort key (#171), declared
|
|
263
|
+
* as entry `D` over a field of type `V`: a {@link RangeBound} in the field's
|
|
264
|
+
* own type — for a literals dimension by its members' order — and, for a
|
|
265
|
+
* literals dimension only, a set of members.
|
|
266
|
+
*/
|
|
267
|
+
export type DimensionBound<D, V> = [LiteralsEntryMembers<D, V>] extends [never] ? RangeBound<V> : RangeBound<LiteralsEntryMembers<D, V>> | Only<{
|
|
268
|
+
readonly in: ReadonlyArray<LiteralsEntryMembers<D, V>>;
|
|
269
|
+
}>;
|
|
270
|
+
export interface WithinOptions {
|
|
271
|
+
/**
|
|
272
|
+
* Skip-scan probe budget per terminal call. After this many probes, the
|
|
273
|
+
* rest of the range is read once with the bounds checked per row. `0`
|
|
274
|
+
* never skips. Default 32.
|
|
275
|
+
*/
|
|
276
|
+
readonly maxSkips?: number | undefined;
|
|
277
|
+
}
|
|
278
|
+
export interface BoundQueryWithin<Model, A, W extends WithinSpec<any, WithinKind>> {
|
|
279
|
+
/**
|
|
280
|
+
* Bound the sort key composites the accessor left open — any of them, not
|
|
281
|
+
* only the leading one:
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* db.entities.Listings.byCategory({ category: "bikes" })
|
|
285
|
+
* .within({ price: { gte: 100, lte: 500 } })
|
|
286
|
+
* .collect()
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* The bounds the key condition can reach are read by key. When open
|
|
290
|
+
* composites lie before the first bound, the query *skip-scans*: a one-row
|
|
291
|
+
* probe finds each distinct value of them (a *tuple*), and only that tuple's
|
|
292
|
+
* matching range is read — results come back in sort key order. Bounds the
|
|
293
|
+
* key condition can't express are checked on each row. A free-form string
|
|
294
|
+
* composite before the bound, or an index that also holds history rows,
|
|
295
|
+
* can't be skipped soundly: the range is read once with every bound checked
|
|
296
|
+
* per row (`explain()` says which plan runs, and why).
|
|
297
|
+
*
|
|
298
|
+
* On a Z-order accessor (#171), the dimensions bound a box — any of them, in
|
|
299
|
+
* the fields' own types (`in` for a `literals` dimension) — and the prefix
|
|
300
|
+
* composites take one exact value each. The box is read as address ranges
|
|
301
|
+
* (`.zorder()` picks how); a prefix composite left out is skip-scanned.
|
|
302
|
+
* Every bound is exact: a `FilterExpression` where DynamoDB's comparison
|
|
303
|
+
* agrees with the dimension's order, a per-row check where it doesn't.
|
|
304
|
+
*
|
|
305
|
+
* Excludes `.where()`. Values are the composites' own types.
|
|
306
|
+
*/
|
|
307
|
+
readonly within: (bounds: W["bounds"], options?: WithinOptions) => BoundQuery<Model, never, A, W["kind"] extends "zorder" ? ZOrderApplied : never>;
|
|
308
|
+
}
|
|
309
|
+
export interface BoundQueryZOrder<Model, SkRemaining, A, W extends WithinSpec<any, WithinKind>> {
|
|
310
|
+
/**
|
|
311
|
+
* How the box `.within()` bounds is read — before or after `.within()`;
|
|
312
|
+
* later calls merge over earlier ones:
|
|
313
|
+
*
|
|
314
|
+
* ```ts
|
|
315
|
+
* db.entities.Listings.byFacets({ region: "north" })
|
|
316
|
+
* .within({ price: { lte: 500_000 }, bedrooms: { gte: 3 } })
|
|
317
|
+
* .zorder({ strategy: "precise", maxRanges: 32 })
|
|
318
|
+
* .collect()
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* An unknown `strategy`, or a `maxRanges` / `concurrency` that isn't a
|
|
322
|
+
* positive integer, throws `[EDD-9095]`.
|
|
323
|
+
*/
|
|
324
|
+
readonly zorder: (options: Query.ZOrderOptions) => BoundQuery<Model, SkRemaining, A, W>;
|
|
325
|
+
}
|
|
326
|
+
export type BoundQuery<Model, SkRemaining, A, W extends WithinSpec<any, WithinKind> = never> = BoundQueryBase<Model, SkRemaining, A, W> & ([SkRemaining] extends [never] ? {} : BoundQueryWithWhere<Model, SkRemaining, A>) & ([W] extends [never] ? {} : [W["bounds"]] extends [never] ? {} : BoundQueryWithin<Model, A, W>) & ([W] extends [never] ? {} : W["kind"] extends "zorder" ? BoundQueryZOrder<Model, SkRemaining, A, W> : {});
|
|
160
327
|
/** @internal */
|
|
161
328
|
export interface BoundQueryConfig<Model> {
|
|
162
329
|
readonly pathBuilder: PathBuilder<Model, Model, never>;
|
|
@@ -180,9 +347,26 @@ export interface BoundQueryConfig<Model> {
|
|
|
180
347
|
*
|
|
181
348
|
* `field` is the SK composite name the caller targeted (`t.status` →
|
|
182
349
|
* `"status"`), or `undefined` when the callback did not go through the sk
|
|
183
|
-
* accessor.
|
|
350
|
+
* accessor. `undefined` when no stored key satisfies the condition: the
|
|
351
|
+
* query plans `empty` and sends nothing (#171).
|
|
352
|
+
*/
|
|
353
|
+
readonly composeSkCondition?: (condition: RawSortKeyCondition, field: string | undefined) => Query.SortKeyCondition | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* Optional: the 1.36 key `.where()`'s condition also reads (#171) — for an
|
|
356
|
+
* `eq` / `beginsWith` that extends an accessor's pins, the key 1.36
|
|
357
|
+
* composed for them. Called after {@link composeSkCondition} accepted the
|
|
358
|
+
* condition; `undefined` reads only the current key.
|
|
359
|
+
*/
|
|
360
|
+
readonly where136?: (condition: RawSortKeyCondition, field: string | undefined) => Query.KeyPass | undefined;
|
|
361
|
+
/**
|
|
362
|
+
* Optional: plan `.within(bounds)` on the query (#171) — an accessor's own
|
|
363
|
+
* composites and encoders turn the bounds into key ranges and row checks.
|
|
364
|
+
* Throws `[EDD-9093]` / `[EDD-9050]` for bounds it can't use. Without it,
|
|
365
|
+
* `.within()` is refused (collections, scans).
|
|
184
366
|
*/
|
|
185
|
-
readonly
|
|
367
|
+
readonly planWithin?: <X>(query: Query.Query<X>, bounds: Record<string, unknown>, options: WithinOptions | undefined) => Query.Query<X>;
|
|
368
|
+
/** Optional: the accessor reads a Z-order sort key, so `.zorder()` applies (#171). */
|
|
369
|
+
readonly zorder?: boolean | undefined;
|
|
186
370
|
/**
|
|
187
371
|
* Optional: how `collect()` shapes the items — a collection groups them by
|
|
188
372
|
* member. Carried through every combinator, so `.filter().collect()` groups
|
|
@@ -230,13 +414,20 @@ export declare const collectionNaming: (members: ReadonlyArray<{
|
|
|
230
414
|
export declare class BoundQueryImpl<Model, SkRemaining, A> {
|
|
231
415
|
readonly _query: Query.Query<A>;
|
|
232
416
|
readonly _config: BoundQueryConfig<Model>;
|
|
233
|
-
|
|
417
|
+
/** The sort key constraint already applied: `.where()` and `.within()` exclude each other. */
|
|
418
|
+
readonly _applied?: "where" | "within" | undefined;
|
|
419
|
+
constructor(_query: Query.Query<A>, _config: BoundQueryConfig<Model>,
|
|
420
|
+
/** The sort key constraint already applied: `.where()` and `.within()` exclude each other. */
|
|
421
|
+
_applied?: "where" | "within" | undefined);
|
|
234
422
|
where(fn: (t: SkRemaining, ops: SkConditionOps<SkRemaining>) => RawSortKeyCondition): BoundQueryImpl<Model, never, A>;
|
|
423
|
+
within(bounds: Record<string, unknown>, options?: WithinOptions): BoundQueryImpl<Model, never, A>;
|
|
424
|
+
zorder(options: Query.ZOrderOptions): BoundQueryImpl<Model, SkRemaining, A>;
|
|
235
425
|
filter(fnOrShorthand: ((t: PathBuilder<Model, Model, never>, ops: ConditionOps<Model>) => Expr) | ConditionShorthand): BoundQueryImpl<Model, SkRemaining, A>;
|
|
236
426
|
filterBy(predicate: (item: A) => boolean): BoundQueryImpl<Model, SkRemaining, A>;
|
|
237
427
|
select(fnOrAttrs: ((t: PathBuilder<Model, Model, never>) => ReadonlyArray<Path<Model, any, any> | PackedPath<Model, any, any>>) | ReadonlyArray<string>): BoundQueryImpl<Model, SkRemaining, Record<string, unknown>>;
|
|
238
428
|
limit(n: number): BoundQueryImpl<Model, SkRemaining, A>;
|
|
239
|
-
pageSize(
|
|
429
|
+
pageSize(size: number | "natural"): BoundQueryImpl<Model, SkRemaining, A>;
|
|
430
|
+
onRequest(observer: (event: Query.QueryRequestEvent) => Effect.Effect<void>): BoundQueryImpl<Model, SkRemaining, A>;
|
|
240
431
|
maxPages(n: number): BoundQueryImpl<Model, SkRemaining, A>;
|
|
241
432
|
reverse(): BoundQueryImpl<Model, SkRemaining, A>;
|
|
242
433
|
startFrom(cursor: string): BoundQueryImpl<Model, SkRemaining, A>;
|
|
@@ -252,9 +443,12 @@ export declare class BoundQueryImpl<Model, SkRemaining, A> {
|
|
|
252
443
|
collect(): Effect.Effect<Array<A>, DynamoClientError | ValidationError, never>;
|
|
253
444
|
paginate(): Stream.Stream<A, DynamoClientError | ValidationError, never>;
|
|
254
445
|
count(): Effect.Effect<number, DynamoClientError | ValidationError, never>;
|
|
446
|
+
/** No I/O, so no operation, span or client: the plan is described from the query alone. */
|
|
447
|
+
explain(): Effect.Effect<Query.QueryExplain, never, never>;
|
|
255
448
|
}
|
|
256
449
|
/**
|
|
257
450
|
* @internal Create a BoundQuery wrapping a Query with pre-resolved config.
|
|
258
451
|
*/
|
|
259
452
|
export declare const makeBoundQuery: <Model, SkRemaining, A>(query: Query.Query<A>, config: BoundQueryConfig<Model>) => BoundQuery<Model, SkRemaining, A>;
|
|
453
|
+
export {};
|
|
260
454
|
//# sourceMappingURL=BoundQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoundQuery.d.ts","sourceRoot":"","sources":["../../src/internal/BoundQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAyBrE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,OAAO,EAAE,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e,EAAE,KAAK,CAAC;IAkBxE,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAAE,KAAK,CAAC;IAI1E,2FAA2F;IAC3F,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC;CAG3D;AAMD;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,EAAE,WAAW,EAAE,CAAC,EAClD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EACrB,QAAQ,gBAAgB,CAAC,KAAK,CAAC,KAC9B,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAC4D,CAAA"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal BoundQuery — Fluent query builder with pre-resolved services.
|
|
3
3
|
*
|
|
4
|
-
* `BoundQuery<Model, SkRemaining, A>` wraps a `Query<A>` with a pre-resolved
|
|
4
|
+
* `BoundQuery<Model, SkRemaining, A, W>` wraps a `Query<A>` with a pre-resolved
|
|
5
5
|
* `provide` function so all terminals return `Effect` with `R = never`.
|
|
6
6
|
*
|
|
7
7
|
* - Combinators return a new `BoundQuery` (immutable).
|
|
8
|
-
* - `where` consumes `SkRemaining` → `BoundQuery<Model, never, A>`.
|
|
8
|
+
* - `where` consumes `SkRemaining` → `BoundQuery<Model, never, A, never>`.
|
|
9
9
|
* - `where` is only available when `SkRemaining` is not `never`.
|
|
10
|
-
* -
|
|
10
|
+
* - `within` (#171) bounds the sort key composites `W` names; it and `where`
|
|
11
|
+
* exclude each other. On a Z-order accessor it bounds the dimensions and
|
|
12
|
+
* prefix composites, and `zorder` chooses how the box is read.
|
|
13
|
+
* - Terminals: `fetch`, `collect`, `paginate`, `count`; `explain` describes
|
|
14
|
+
* the plan without sending anything.
|
|
11
15
|
*/
|
|
12
16
|
import * as KeyComposer from "@effect-dynamodb/schema/KeyComposer.js";
|
|
13
17
|
import { Effect, Stream } from "effect";
|
|
@@ -50,8 +54,8 @@ const renamePaths = (node, resolve) => {
|
|
|
50
54
|
* composing keys — and then composes, so both sides of the comparison come out
|
|
51
55
|
* of one pipeline (issues #114 and the encoded/decoded gap it exposed).
|
|
52
56
|
* Without a hook there is no model to consult, so `KeyComposer.serializeValue`
|
|
53
|
-
* is applied directly: the same
|
|
54
|
-
* uses. Casing is never applied here — it belongs to key composition.
|
|
57
|
+
* is applied directly: the same numeric encoding / ISO formatting the write
|
|
58
|
+
* path uses. Casing is never applied here — it belongs to key composition.
|
|
55
59
|
*
|
|
56
60
|
* The callback is invoked synchronously and exactly once, so a closed-over
|
|
57
61
|
* mutable slot is safe here.
|
|
@@ -252,23 +256,90 @@ const ABSENT_ATTRIBUTE = "__edd_absent__";
|
|
|
252
256
|
// ---------------------------------------------------------------------------
|
|
253
257
|
// BoundQuery implementation
|
|
254
258
|
// ---------------------------------------------------------------------------
|
|
259
|
+
/** `[EDD-9093]`: `.where()` and `.within()` exclude each other, and `.within()` applies once. */
|
|
260
|
+
const refuseWithin = (what) => {
|
|
261
|
+
throw new Error(`[EDD-9093] .${what}: a query takes one sort key constraint — either .where() on the ` +
|
|
262
|
+
`next open composite, or one .within() bounding any of them.`);
|
|
263
|
+
};
|
|
264
|
+
const ZORDER_STRATEGIES = new Set(["auto", "naive", "jump", "precise"]);
|
|
265
|
+
/**
|
|
266
|
+
* `.zorder(options)`'s options (#171), the ones given: library options that
|
|
267
|
+
* can't be honoured throw `[EDD-9095]`; `pageSize` is DynamoDB's `Limit`,
|
|
268
|
+
* passed on unchecked as `pageSize(n)`'s number is.
|
|
269
|
+
*/
|
|
270
|
+
const zorderOptions = (options) => {
|
|
271
|
+
const refuse = (what) => {
|
|
272
|
+
throw new Error(`[EDD-9095] .zorder() ${what}`);
|
|
273
|
+
};
|
|
274
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) {
|
|
275
|
+
return refuse("takes an object of options: { strategy, pageSize, maxRanges, concurrency }.");
|
|
276
|
+
}
|
|
277
|
+
const given = Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
|
|
278
|
+
const unknown = Object.keys(given).filter((key) => !["strategy", "pageSize", "maxRanges", "concurrency"].includes(key));
|
|
279
|
+
if (unknown.length > 0) {
|
|
280
|
+
return refuse(`has no option ${unknown.map((key) => JSON.stringify(key)).join(", ")}.`);
|
|
281
|
+
}
|
|
282
|
+
if (given.strategy !== undefined && !ZORDER_STRATEGIES.has(given.strategy)) {
|
|
283
|
+
return refuse(`strategy ${JSON.stringify(given.strategy)} is not one of "auto", "naive", "jump", "precise".`);
|
|
284
|
+
}
|
|
285
|
+
for (const key of ["maxRanges", "concurrency"]) {
|
|
286
|
+
const value = given[key];
|
|
287
|
+
if (value !== undefined && !(Number.isInteger(value) && value > 0)) {
|
|
288
|
+
return refuse(`${key} ${JSON.stringify(value)} is not a positive integer.`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return given;
|
|
292
|
+
};
|
|
255
293
|
/** @internal */
|
|
256
294
|
export class BoundQueryImpl {
|
|
257
295
|
_query;
|
|
258
296
|
_config;
|
|
259
|
-
|
|
297
|
+
_applied;
|
|
298
|
+
constructor(_query, _config,
|
|
299
|
+
/** The sort key constraint already applied: `.where()` and `.within()` exclude each other. */
|
|
300
|
+
_applied) {
|
|
260
301
|
this._query = _query;
|
|
261
302
|
this._config = _config;
|
|
303
|
+
this._applied = _applied;
|
|
262
304
|
}
|
|
263
305
|
// --- where ---
|
|
264
306
|
where(fn) {
|
|
307
|
+
if (this._applied === "within")
|
|
308
|
+
refuseWithin("where() after .within()");
|
|
265
309
|
const skAccessor = (this._config.skFields ? buildSkAccessor(this._config.skFields) : {});
|
|
266
310
|
const { ops, targetField } = makeSkConditionOps();
|
|
267
311
|
const condition = fn(skAccessor, ops);
|
|
268
312
|
const finalCondition = this._config.composeSkCondition
|
|
269
313
|
? this._config.composeSkCondition(condition, targetField())
|
|
270
314
|
: serializeRawCondition(condition);
|
|
271
|
-
|
|
315
|
+
if (finalCondition === undefined) {
|
|
316
|
+
return new BoundQueryImpl(Query.planEmpty(this._query), this._config, "where");
|
|
317
|
+
}
|
|
318
|
+
const key136 = this._config.where136?.(condition, targetField());
|
|
319
|
+
return new BoundQueryImpl(Query.alsoRead136(Query.where(this._query, finalCondition), key136), this._config, "where");
|
|
320
|
+
}
|
|
321
|
+
// --- within ---
|
|
322
|
+
within(bounds, options) {
|
|
323
|
+
if (this._applied !== undefined) {
|
|
324
|
+
refuseWithin(this._applied === "where" ? "within() after .where()" : "a second .within()");
|
|
325
|
+
}
|
|
326
|
+
const maxSkips = options?.maxSkips;
|
|
327
|
+
if (maxSkips !== undefined && !(Number.isInteger(maxSkips) && maxSkips >= 0)) {
|
|
328
|
+
throw new Error(`[EDD-9095] .within() maxSkips ${JSON.stringify(maxSkips)} is not a probe budget: ` +
|
|
329
|
+
`pass a non-negative integer (0 never skips; the default is 32).`);
|
|
330
|
+
}
|
|
331
|
+
const plan = this._config.planWithin;
|
|
332
|
+
if (plan === undefined)
|
|
333
|
+
refuseWithin("within() on a query without sort key composites to bound");
|
|
334
|
+
return new BoundQueryImpl(plan(this._query, bounds, options), this._config, "within");
|
|
335
|
+
}
|
|
336
|
+
// --- zorder ---
|
|
337
|
+
zorder(options) {
|
|
338
|
+
if (this._config.zorder !== true) {
|
|
339
|
+
throw new Error(`[EDD-9095] .zorder() applies only to a Z-order index accessor: this query's index ` +
|
|
340
|
+
`has no Z-order sort key.`);
|
|
341
|
+
}
|
|
342
|
+
return new BoundQueryImpl(Query.plan(this._query, { zorder: zorderOptions(options) }), this._config, this._applied);
|
|
272
343
|
}
|
|
273
344
|
// --- filter ---
|
|
274
345
|
filter(fnOrShorthand) {
|
|
@@ -278,11 +349,11 @@ export class BoundQueryImpl {
|
|
|
278
349
|
parseSimpleShorthand(fnOrShorthand);
|
|
279
350
|
// Paths name the stored attributes of renamed fields.
|
|
280
351
|
const stored = this._config.renameExpr === undefined ? expr : this._config.renameExpr(expr);
|
|
281
|
-
return new BoundQueryImpl(Query.filterExpr(this._query, stored), this._config);
|
|
352
|
+
return new BoundQueryImpl(Query.filterExpr(this._query, stored), this._config, this._applied);
|
|
282
353
|
}
|
|
283
354
|
// --- filterBy ---
|
|
284
355
|
filterBy(predicate) {
|
|
285
|
-
return new BoundQueryImpl(Query.filterBy(this._query, predicate), this._config);
|
|
356
|
+
return new BoundQueryImpl(Query.filterBy(this._query, predicate), this._config, this._applied);
|
|
286
357
|
}
|
|
287
358
|
// --- select ---
|
|
288
359
|
select(fnOrAttrs) {
|
|
@@ -293,30 +364,33 @@ export class BoundQueryImpl {
|
|
|
293
364
|
]
|
|
294
365
|
: [fnOrAttrs.map((attr) => [attr]), "attributes"];
|
|
295
366
|
const select = this._config.selectAs ?? plainSelect;
|
|
296
|
-
return new BoundQueryImpl(select(this._query, paths, form), this._config);
|
|
367
|
+
return new BoundQueryImpl(select(this._query, paths, form), this._config, this._applied);
|
|
297
368
|
}
|
|
298
369
|
// --- pagination & ordering ---
|
|
299
370
|
limit(n) {
|
|
300
|
-
return new BoundQueryImpl(Query.limit(this._query, n), this._config);
|
|
371
|
+
return new BoundQueryImpl(Query.limit(this._query, n), this._config, this._applied);
|
|
301
372
|
}
|
|
302
|
-
pageSize(
|
|
303
|
-
return new BoundQueryImpl(Query.pageSize(this._query,
|
|
373
|
+
pageSize(size) {
|
|
374
|
+
return new BoundQueryImpl(Query.pageSize(this._query, size), this._config, this._applied);
|
|
375
|
+
}
|
|
376
|
+
onRequest(observer) {
|
|
377
|
+
return new BoundQueryImpl(Query.onRequest(this._query, observer), this._config, this._applied);
|
|
304
378
|
}
|
|
305
379
|
maxPages(n) {
|
|
306
|
-
return new BoundQueryImpl(Query.maxPages(this._query, n), this._config);
|
|
380
|
+
return new BoundQueryImpl(Query.maxPages(this._query, n), this._config, this._applied);
|
|
307
381
|
}
|
|
308
382
|
reverse() {
|
|
309
|
-
return new BoundQueryImpl(Query.reverse(this._query), this._config);
|
|
383
|
+
return new BoundQueryImpl(Query.reverse(this._query), this._config, this._applied);
|
|
310
384
|
}
|
|
311
385
|
startFrom(cursor) {
|
|
312
|
-
return new BoundQueryImpl(Query.startFrom(this._query, cursor), this._config);
|
|
386
|
+
return new BoundQueryImpl(Query.startFrom(this._query, cursor), this._config, this._applied);
|
|
313
387
|
}
|
|
314
388
|
// --- read options ---
|
|
315
389
|
consistentRead() {
|
|
316
|
-
return new BoundQueryImpl(Query.consistentRead(this._query), this._config);
|
|
390
|
+
return new BoundQueryImpl(Query.consistentRead(this._query), this._config, this._applied);
|
|
317
391
|
}
|
|
318
392
|
ignoreOwnership() {
|
|
319
|
-
return new BoundQueryImpl(Query.ignoreOwnership(this._query), this._config);
|
|
393
|
+
return new BoundQueryImpl(Query.ignoreOwnership(this._query), this._config, this._applied);
|
|
320
394
|
}
|
|
321
395
|
// --- terminals ---
|
|
322
396
|
/**
|
|
@@ -359,6 +433,10 @@ export class BoundQueryImpl {
|
|
|
359
433
|
count() {
|
|
360
434
|
return this._run(Query.count(this._query));
|
|
361
435
|
}
|
|
436
|
+
/** No I/O, so no operation, span or client: the plan is described from the query alone. */
|
|
437
|
+
explain() {
|
|
438
|
+
return Query.explain(this._query);
|
|
439
|
+
}
|
|
362
440
|
}
|
|
363
441
|
// ---------------------------------------------------------------------------
|
|
364
442
|
// Factory functions
|