@rocicorp/zero 0.6.2024111800 → 0.6.2024112000
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/out/{chunk-N4TOAWSH.js → chunk-W4HNSZIF.js} +149 -54
- package/out/chunk-W4HNSZIF.js.map +7 -0
- package/out/shared/src/valita.d.ts.map +1 -1
- package/out/shared/src/valita.js +53 -4
- package/out/shared/src/valita.js.map +1 -1
- package/out/solid.js +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +12 -4
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/db/create.d.ts.map +1 -1
- package/out/zero-cache/src/db/create.js +1 -3
- package/out/zero-cache/src/db/create.js.map +1 -1
- package/out/zero-cache/src/db/pg-to-lite.d.ts.map +1 -1
- package/out/zero-cache/src/db/pg-to-lite.js +12 -3
- package/out/zero-cache/src/db/pg-to-lite.js.map +1 -1
- package/out/zero-cache/src/server/main.js +1 -1
- package/out/zero-cache/src/server/main.js.map +1 -1
- package/out/zero-cache/src/server/syncer.d.ts +1 -1
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +15 -5
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/pg/schema/shard.js +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js +1 -3
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/write-authorizer.js +22 -42
- package/out/zero-cache/src/services/mutagen/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.js +2 -3
- package/out/zero-cache/src/services/replicator/incremental-sync.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +8 -2
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +80 -15
- package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +1 -3
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/workers/replicator.d.ts +1 -0
- package/out/zero-cache/src/workers/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/workers/replicator.js +4 -1
- package/out/zero-cache/src/workers/replicator.js.map +1 -1
- package/out/zero-protocol/src/ast.d.ts +75 -18
- package/out/zero-protocol/src/ast.d.ts.map +1 -1
- package/out/zero-protocol/src/ast.js +36 -13
- package/out/zero-protocol/src/ast.js.map +1 -1
- package/out/zero-protocol/src/change-desired-queries.d.ts +32 -6
- package/out/zero-protocol/src/change-desired-queries.d.ts.map +1 -1
- package/out/zero-protocol/src/connect.d.ts +32 -6
- package/out/zero-protocol/src/connect.d.ts.map +1 -1
- package/out/zero-protocol/src/down.d.ts +32 -6
- package/out/zero-protocol/src/down.d.ts.map +1 -1
- package/out/zero-protocol/src/poke.d.ts +64 -12
- package/out/zero-protocol/src/poke.d.ts.map +1 -1
- package/out/zero-protocol/src/queries-patch.d.ts +48 -9
- package/out/zero-protocol/src/queries-patch.d.ts.map +1 -1
- package/out/zero-protocol/src/up.d.ts +32 -6
- package/out/zero-protocol/src/up.d.ts.map +1 -1
- package/out/zero-schema/src/authorization.d.ts +6 -6
- package/out/zero-schema/src/authorization.d.ts.map +1 -1
- package/out/zero-schema/src/compiled-authorization.d.ts +224 -42
- package/out/zero-schema/src/compiled-authorization.d.ts.map +1 -1
- package/out/zero.js +1 -1
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +10 -12
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/builder/filter.d.ts.map +1 -1
- package/out/zql/src/builder/filter.js +20 -5
- package/out/zql/src/builder/filter.js.map +1 -1
- package/out/zql/src/query/expression.d.ts +4 -2
- package/out/zql/src/query/expression.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zqlite/src/table-source.d.ts +1 -1
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +38 -10
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +1 -1
- package/out/chunk-N4TOAWSH.js.map +0 -7
- package/out/zql/src/builder/error.d.ts +0 -3
- package/out/zql/src/builder/error.d.ts.map +0 -1
- package/out/zql/src/builder/error.js +0 -3
- package/out/zql/src/builder/error.js.map +0 -1
|
@@ -6,12 +6,25 @@ declare const ruleSchema: v.TupleType<[v.Type<"allow">, v.ObjectType<{
|
|
|
6
6
|
where: v.Optional<{
|
|
7
7
|
type: "simple";
|
|
8
8
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
left: {
|
|
10
|
+
type: "literal";
|
|
11
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
12
|
+
} | {
|
|
13
|
+
type: "column";
|
|
14
|
+
name: string;
|
|
15
|
+
} | {
|
|
11
16
|
type: "static";
|
|
12
17
|
anchor: "authData" | "preMutationRow";
|
|
13
18
|
field: string;
|
|
14
|
-
}
|
|
19
|
+
};
|
|
20
|
+
right: {
|
|
21
|
+
type: "literal";
|
|
22
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
23
|
+
} | {
|
|
24
|
+
type: "static";
|
|
25
|
+
anchor: "authData" | "preMutationRow";
|
|
26
|
+
field: string;
|
|
27
|
+
};
|
|
15
28
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
16
29
|
readonly type: "correlatedSubquery";
|
|
17
30
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -33,12 +46,25 @@ declare const policySchema: v.ArrayType<v.TupleType<[v.Type<"allow">, v.ObjectTy
|
|
|
33
46
|
where: v.Optional<{
|
|
34
47
|
type: "simple";
|
|
35
48
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
left: {
|
|
50
|
+
type: "literal";
|
|
51
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
52
|
+
} | {
|
|
53
|
+
type: "column";
|
|
54
|
+
name: string;
|
|
55
|
+
} | {
|
|
38
56
|
type: "static";
|
|
39
57
|
anchor: "authData" | "preMutationRow";
|
|
40
58
|
field: string;
|
|
41
|
-
}
|
|
59
|
+
};
|
|
60
|
+
right: {
|
|
61
|
+
type: "literal";
|
|
62
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
63
|
+
} | {
|
|
64
|
+
type: "static";
|
|
65
|
+
anchor: "authData" | "preMutationRow";
|
|
66
|
+
field: string;
|
|
67
|
+
};
|
|
42
68
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
43
69
|
readonly type: "correlatedSubquery";
|
|
44
70
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -60,12 +86,25 @@ declare const assetSchema: v.ObjectType<{
|
|
|
60
86
|
where?: {
|
|
61
87
|
type: "simple";
|
|
62
88
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
63
|
-
|
|
64
|
-
|
|
89
|
+
left: {
|
|
90
|
+
type: "literal";
|
|
91
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
92
|
+
} | {
|
|
93
|
+
type: "column";
|
|
94
|
+
name: string;
|
|
95
|
+
} | {
|
|
65
96
|
type: "static";
|
|
66
97
|
anchor: "authData" | "preMutationRow";
|
|
67
98
|
field: string;
|
|
68
|
-
}
|
|
99
|
+
};
|
|
100
|
+
right: {
|
|
101
|
+
type: "literal";
|
|
102
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
103
|
+
} | {
|
|
104
|
+
type: "static";
|
|
105
|
+
anchor: "authData" | "preMutationRow";
|
|
106
|
+
field: string;
|
|
107
|
+
};
|
|
69
108
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
70
109
|
readonly type: "correlatedSubquery";
|
|
71
110
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -86,12 +125,25 @@ declare const assetSchema: v.ObjectType<{
|
|
|
86
125
|
where?: {
|
|
87
126
|
type: "simple";
|
|
88
127
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
89
|
-
|
|
90
|
-
|
|
128
|
+
left: {
|
|
129
|
+
type: "literal";
|
|
130
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
131
|
+
} | {
|
|
132
|
+
type: "column";
|
|
133
|
+
name: string;
|
|
134
|
+
} | {
|
|
135
|
+
type: "static";
|
|
136
|
+
anchor: "authData" | "preMutationRow";
|
|
137
|
+
field: string;
|
|
138
|
+
};
|
|
139
|
+
right: {
|
|
140
|
+
type: "literal";
|
|
141
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
142
|
+
} | {
|
|
91
143
|
type: "static";
|
|
92
144
|
anchor: "authData" | "preMutationRow";
|
|
93
145
|
field: string;
|
|
94
|
-
}
|
|
146
|
+
};
|
|
95
147
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
96
148
|
readonly type: "correlatedSubquery";
|
|
97
149
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -112,12 +164,25 @@ declare const assetSchema: v.ObjectType<{
|
|
|
112
164
|
where?: {
|
|
113
165
|
type: "simple";
|
|
114
166
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
115
|
-
|
|
116
|
-
|
|
167
|
+
left: {
|
|
168
|
+
type: "literal";
|
|
169
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
170
|
+
} | {
|
|
171
|
+
type: "column";
|
|
172
|
+
name: string;
|
|
173
|
+
} | {
|
|
174
|
+
type: "static";
|
|
175
|
+
anchor: "authData" | "preMutationRow";
|
|
176
|
+
field: string;
|
|
177
|
+
};
|
|
178
|
+
right: {
|
|
179
|
+
type: "literal";
|
|
180
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
181
|
+
} | {
|
|
117
182
|
type: "static";
|
|
118
183
|
anchor: "authData" | "preMutationRow";
|
|
119
184
|
field: string;
|
|
120
|
-
}
|
|
185
|
+
};
|
|
121
186
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
122
187
|
readonly type: "correlatedSubquery";
|
|
123
188
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -138,12 +203,25 @@ declare const assetSchema: v.ObjectType<{
|
|
|
138
203
|
where?: {
|
|
139
204
|
type: "simple";
|
|
140
205
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
141
|
-
|
|
142
|
-
|
|
206
|
+
left: {
|
|
207
|
+
type: "literal";
|
|
208
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
209
|
+
} | {
|
|
210
|
+
type: "column";
|
|
211
|
+
name: string;
|
|
212
|
+
} | {
|
|
143
213
|
type: "static";
|
|
144
214
|
anchor: "authData" | "preMutationRow";
|
|
145
215
|
field: string;
|
|
146
|
-
}
|
|
216
|
+
};
|
|
217
|
+
right: {
|
|
218
|
+
type: "literal";
|
|
219
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
220
|
+
} | {
|
|
221
|
+
type: "static";
|
|
222
|
+
anchor: "authData" | "preMutationRow";
|
|
223
|
+
field: string;
|
|
224
|
+
};
|
|
147
225
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
148
226
|
readonly type: "correlatedSubquery";
|
|
149
227
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -168,12 +246,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
168
246
|
where?: {
|
|
169
247
|
type: "simple";
|
|
170
248
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
171
|
-
|
|
172
|
-
|
|
249
|
+
left: {
|
|
250
|
+
type: "literal";
|
|
251
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
252
|
+
} | {
|
|
253
|
+
type: "column";
|
|
254
|
+
name: string;
|
|
255
|
+
} | {
|
|
256
|
+
type: "static";
|
|
257
|
+
anchor: "authData" | "preMutationRow";
|
|
258
|
+
field: string;
|
|
259
|
+
};
|
|
260
|
+
right: {
|
|
261
|
+
type: "literal";
|
|
262
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
263
|
+
} | {
|
|
173
264
|
type: "static";
|
|
174
265
|
anchor: "authData" | "preMutationRow";
|
|
175
266
|
field: string;
|
|
176
|
-
}
|
|
267
|
+
};
|
|
177
268
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
178
269
|
readonly type: "correlatedSubquery";
|
|
179
270
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -194,12 +285,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
194
285
|
where?: {
|
|
195
286
|
type: "simple";
|
|
196
287
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
197
|
-
|
|
198
|
-
|
|
288
|
+
left: {
|
|
289
|
+
type: "literal";
|
|
290
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
291
|
+
} | {
|
|
292
|
+
type: "column";
|
|
293
|
+
name: string;
|
|
294
|
+
} | {
|
|
199
295
|
type: "static";
|
|
200
296
|
anchor: "authData" | "preMutationRow";
|
|
201
297
|
field: string;
|
|
202
|
-
}
|
|
298
|
+
};
|
|
299
|
+
right: {
|
|
300
|
+
type: "literal";
|
|
301
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
302
|
+
} | {
|
|
303
|
+
type: "static";
|
|
304
|
+
anchor: "authData" | "preMutationRow";
|
|
305
|
+
field: string;
|
|
306
|
+
};
|
|
203
307
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
204
308
|
readonly type: "correlatedSubquery";
|
|
205
309
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -220,12 +324,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
220
324
|
where?: {
|
|
221
325
|
type: "simple";
|
|
222
326
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
223
|
-
|
|
224
|
-
|
|
327
|
+
left: {
|
|
328
|
+
type: "literal";
|
|
329
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
330
|
+
} | {
|
|
331
|
+
type: "column";
|
|
332
|
+
name: string;
|
|
333
|
+
} | {
|
|
334
|
+
type: "static";
|
|
335
|
+
anchor: "authData" | "preMutationRow";
|
|
336
|
+
field: string;
|
|
337
|
+
};
|
|
338
|
+
right: {
|
|
339
|
+
type: "literal";
|
|
340
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
341
|
+
} | {
|
|
225
342
|
type: "static";
|
|
226
343
|
anchor: "authData" | "preMutationRow";
|
|
227
344
|
field: string;
|
|
228
|
-
}
|
|
345
|
+
};
|
|
229
346
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
230
347
|
readonly type: "correlatedSubquery";
|
|
231
348
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -246,12 +363,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
246
363
|
where?: {
|
|
247
364
|
type: "simple";
|
|
248
365
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
249
|
-
|
|
250
|
-
|
|
366
|
+
left: {
|
|
367
|
+
type: "literal";
|
|
368
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
369
|
+
} | {
|
|
370
|
+
type: "column";
|
|
371
|
+
name: string;
|
|
372
|
+
} | {
|
|
373
|
+
type: "static";
|
|
374
|
+
anchor: "authData" | "preMutationRow";
|
|
375
|
+
field: string;
|
|
376
|
+
};
|
|
377
|
+
right: {
|
|
378
|
+
type: "literal";
|
|
379
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
380
|
+
} | {
|
|
251
381
|
type: "static";
|
|
252
382
|
anchor: "authData" | "preMutationRow";
|
|
253
383
|
field: string;
|
|
254
|
-
}
|
|
384
|
+
};
|
|
255
385
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
256
386
|
readonly type: "correlatedSubquery";
|
|
257
387
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -274,12 +404,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
274
404
|
where?: {
|
|
275
405
|
type: "simple";
|
|
276
406
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
277
|
-
|
|
278
|
-
|
|
407
|
+
left: {
|
|
408
|
+
type: "literal";
|
|
409
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
410
|
+
} | {
|
|
411
|
+
type: "column";
|
|
412
|
+
name: string;
|
|
413
|
+
} | {
|
|
279
414
|
type: "static";
|
|
280
415
|
anchor: "authData" | "preMutationRow";
|
|
281
416
|
field: string;
|
|
282
|
-
}
|
|
417
|
+
};
|
|
418
|
+
right: {
|
|
419
|
+
type: "literal";
|
|
420
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
421
|
+
} | {
|
|
422
|
+
type: "static";
|
|
423
|
+
anchor: "authData" | "preMutationRow";
|
|
424
|
+
field: string;
|
|
425
|
+
};
|
|
283
426
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
284
427
|
readonly type: "correlatedSubquery";
|
|
285
428
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -300,12 +443,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
300
443
|
where?: {
|
|
301
444
|
type: "simple";
|
|
302
445
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
303
|
-
|
|
304
|
-
|
|
446
|
+
left: {
|
|
447
|
+
type: "literal";
|
|
448
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
449
|
+
} | {
|
|
450
|
+
type: "column";
|
|
451
|
+
name: string;
|
|
452
|
+
} | {
|
|
305
453
|
type: "static";
|
|
306
454
|
anchor: "authData" | "preMutationRow";
|
|
307
455
|
field: string;
|
|
308
|
-
}
|
|
456
|
+
};
|
|
457
|
+
right: {
|
|
458
|
+
type: "literal";
|
|
459
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
460
|
+
} | {
|
|
461
|
+
type: "static";
|
|
462
|
+
anchor: "authData" | "preMutationRow";
|
|
463
|
+
field: string;
|
|
464
|
+
};
|
|
309
465
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
310
466
|
readonly type: "correlatedSubquery";
|
|
311
467
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -326,12 +482,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
326
482
|
where?: {
|
|
327
483
|
type: "simple";
|
|
328
484
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
329
|
-
|
|
330
|
-
|
|
485
|
+
left: {
|
|
486
|
+
type: "literal";
|
|
487
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
488
|
+
} | {
|
|
489
|
+
type: "column";
|
|
490
|
+
name: string;
|
|
491
|
+
} | {
|
|
331
492
|
type: "static";
|
|
332
493
|
anchor: "authData" | "preMutationRow";
|
|
333
494
|
field: string;
|
|
334
|
-
}
|
|
495
|
+
};
|
|
496
|
+
right: {
|
|
497
|
+
type: "literal";
|
|
498
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
499
|
+
} | {
|
|
500
|
+
type: "static";
|
|
501
|
+
anchor: "authData" | "preMutationRow";
|
|
502
|
+
field: string;
|
|
503
|
+
};
|
|
335
504
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
336
505
|
readonly type: "correlatedSubquery";
|
|
337
506
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -352,12 +521,25 @@ declare const authorizationConfigSchema: v.Type<Record<string, {
|
|
|
352
521
|
where?: {
|
|
353
522
|
type: "simple";
|
|
354
523
|
op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
|
|
355
|
-
|
|
356
|
-
|
|
524
|
+
left: {
|
|
525
|
+
type: "literal";
|
|
526
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
527
|
+
} | {
|
|
528
|
+
type: "column";
|
|
529
|
+
name: string;
|
|
530
|
+
} | {
|
|
531
|
+
type: "static";
|
|
532
|
+
anchor: "authData" | "preMutationRow";
|
|
533
|
+
field: string;
|
|
534
|
+
};
|
|
535
|
+
right: {
|
|
536
|
+
type: "literal";
|
|
537
|
+
value: string | number | boolean | readonly (string | number | boolean)[] | null;
|
|
538
|
+
} | {
|
|
357
539
|
type: "static";
|
|
358
540
|
anchor: "authData" | "preMutationRow";
|
|
359
541
|
field: string;
|
|
360
|
-
}
|
|
542
|
+
};
|
|
361
543
|
} | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
|
|
362
544
|
readonly type: "correlatedSubquery";
|
|
363
545
|
readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiled-authorization.d.ts","sourceRoot":"","sources":["../../../../zero-schema/src/compiled-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,QAAA,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"compiled-authorization.d.ts","sourceRoot":"","sources":["../../../../zero-schema/src/compiled-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAA2C,CAAC;AAC5D,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAsB,CAAC;AACzC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAKf,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7D,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAK9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
package/out/zero.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../zql/src/builder/builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EACV,GAAG,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../zql/src/builder/builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EACV,GAAG,EAQH,QAAQ,EAIT,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAC5D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2CAA2C,CAAC;AAM1E,OAAO,KAAK,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAI7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAEjD;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,eAAe,EACzB,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,GACvD,KAAK,CAMP;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,GAAG,EACR,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,OA0DzD;AA4KD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,UAAU,GACb,IAAI,CAeN"}
|
|
@@ -7,7 +7,6 @@ import { Filter } from '../ivm/filter.js';
|
|
|
7
7
|
import { Join } from '../ivm/join.js';
|
|
8
8
|
import { Skip } from '../ivm/skip.js';
|
|
9
9
|
import { Take } from '../ivm/take.js';
|
|
10
|
-
import { MissingParameterError } from './error.js';
|
|
11
10
|
import { createPredicate } from './filter.js';
|
|
12
11
|
/**
|
|
13
12
|
* Builds a pipeline from an AST. Caller must provide a delegate to create source
|
|
@@ -54,7 +53,8 @@ export function bindStaticParameters(ast, staticQueryParameters) {
|
|
|
54
53
|
if (condition.type === 'simple') {
|
|
55
54
|
return {
|
|
56
55
|
...condition,
|
|
57
|
-
|
|
56
|
+
left: bindValue(condition.left),
|
|
57
|
+
right: bindValue(condition.right),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
if (condition.type === 'correlatedSubquery') {
|
|
@@ -74,20 +74,18 @@ export function bindStaticParameters(ast, staticQueryParameters) {
|
|
|
74
74
|
const bindValue = (value) => {
|
|
75
75
|
if (isParameter(value)) {
|
|
76
76
|
const anchor = must(staticQueryParameters, 'Static query params do not exist')[value.anchor];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
return resolvedValue;
|
|
77
|
+
const resolvedValue = anchor?.[value.field] ?? null;
|
|
78
|
+
return {
|
|
79
|
+
type: 'literal',
|
|
80
|
+
value: resolvedValue,
|
|
81
|
+
};
|
|
84
82
|
}
|
|
85
83
|
return value;
|
|
86
84
|
};
|
|
87
85
|
return visit(ast);
|
|
88
86
|
}
|
|
89
87
|
function isParameter(value) {
|
|
90
|
-
return
|
|
88
|
+
return value.type === 'static';
|
|
91
89
|
}
|
|
92
90
|
function buildPipelineInternal(ast, delegate, staticQueryParameters, partitionKey) {
|
|
93
91
|
const source = delegate.getSource(ast.table);
|
|
@@ -130,7 +128,7 @@ appliedFilters, delegate) {
|
|
|
130
128
|
return applyOr(input, condition, appliedFilters, delegate);
|
|
131
129
|
case 'correlatedSubquery':
|
|
132
130
|
return applyCorrelatedSubqueryCondition(input, condition, delegate);
|
|
133
|
-
|
|
131
|
+
case 'simple':
|
|
134
132
|
return applySimpleCondition(input, condition, appliedFilters);
|
|
135
133
|
}
|
|
136
134
|
}
|
|
@@ -189,7 +187,7 @@ function gatherCorrelatedSubqueryQueriesFromCondition(condition) {
|
|
|
189
187
|
}
|
|
190
188
|
return csqs;
|
|
191
189
|
}
|
|
192
|
-
const EXISTS_LIMIT =
|
|
190
|
+
const EXISTS_LIMIT = 3;
|
|
193
191
|
export function assertOrderingIncludesPK(ordering, pk) {
|
|
194
192
|
const orderingFields = ordering.map(([field]) => field);
|
|
195
193
|
const missingFields = pk.filter(pkField => !orderingFields.includes(pkField));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../../zql/src/builder/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAEtD,OAAO,EAAC,IAAI,EAAC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../../zql/src/builder/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAEtD,OAAO,EAAC,IAAI,EAAC,MAAM,6BAA6B,CAAC;AAiBjD,OAAO,E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IACD,KAAK;IACL,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YAC9C,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO;QACL,GAAG,GAAG;QACN,KAAK,EAAE;YACL,GAAG,KAAK;YACR,UAAU,EAAE,KAAK;SAClB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../../zql/src/builder/filter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,GAAG,EAAE,KAAK,EAAC,MAAM,oCAAoC,CAAC;AAGnE,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC;AACtD,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC;AAEnE,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../../zql/src/builder/filter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,GAAG,EAAE,KAAK,EAAC,MAAM,oCAAoC,CAAC;AAGnE,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC;AACtD,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC;AAEnE,wBAAgB,eAAe,CAC7B,SAAS,EAAE,eAAe,GACzB,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CA4CvB"}
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import { assert } from '../../../shared/src/asserts.js';
|
|
2
2
|
import { getLikePredicate } from './like.js';
|
|
3
3
|
export function createPredicate(condition) {
|
|
4
|
+
const { left } = condition;
|
|
5
|
+
const { right } = condition;
|
|
6
|
+
assert(right.type !== 'static', 'static values should be resolved before creating predicates');
|
|
7
|
+
assert(left.type !== 'static', 'static values should be resolved before creating predicates');
|
|
4
8
|
switch (condition.op) {
|
|
5
9
|
case 'IS':
|
|
6
10
|
case 'IS NOT': {
|
|
7
|
-
const impl = createIsPredicate(
|
|
8
|
-
|
|
11
|
+
const impl = createIsPredicate(right.value, condition.op);
|
|
12
|
+
if (left.type === 'literal') {
|
|
13
|
+
const result = impl(left.value);
|
|
14
|
+
return () => result;
|
|
15
|
+
}
|
|
16
|
+
return (row) => impl(row[left.name]);
|
|
9
17
|
}
|
|
10
18
|
}
|
|
11
|
-
if (
|
|
19
|
+
if (right.value === null || right.value === undefined) {
|
|
12
20
|
return (_row) => false;
|
|
13
21
|
}
|
|
14
|
-
const impl = createPredicateImpl(
|
|
22
|
+
const impl = createPredicateImpl(right.value, condition.op);
|
|
23
|
+
if (left.type === 'literal') {
|
|
24
|
+
if (left.value === null || left.value === undefined) {
|
|
25
|
+
return (_row) => false;
|
|
26
|
+
}
|
|
27
|
+
const result = impl(left.value);
|
|
28
|
+
return () => result;
|
|
29
|
+
}
|
|
15
30
|
return (row) => {
|
|
16
|
-
const lhs = row[
|
|
31
|
+
const lhs = row[left.name];
|
|
17
32
|
if (lhs === null || lhs === undefined) {
|
|
18
33
|
return false;
|
|
19
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../../zql/src/builder/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAMtD,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAM3C,MAAM,UAAU,eAAe,
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../../zql/src/builder/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAMtD,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAM3C,MAAM,UAAU,eAAe,CAC7B,SAA0B;IAE1B,MAAM,EAAC,IAAI,EAAC,GAAG,SAAS,CAAC;IACzB,MAAM,EAAC,KAAK,EAAC,GAAG,SAAS,CAAC;IAC1B,MAAM,CACJ,KAAK,CAAC,IAAI,KAAK,QAAQ,EACvB,6DAA6D,CAC9D,CAAC;IACF,MAAM,CACJ,IAAI,CAAC,IAAI,KAAK,QAAQ,EACtB,6DAA6D,CAC9D,CAAC;IAEF,QAAQ,SAAS,CAAC,EAAE,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC;QACV,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;YAC1D,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACh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YACd,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YACzB,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;QACD;YACE,QAAwB,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;AACH,CAAC;AAED,SAAS,GAAG,CAAI,CAAsB;IACpC,OAAO,CAAC,GAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Condition,
|
|
1
|
+
import type { Condition, LiteralValue } from '../../../zero-protocol/src/ast.js';
|
|
2
2
|
import type { PullSchemaForRelationship, TableSchema } from '../../../zero-schema/src/table-schema.js';
|
|
3
3
|
import type { DefaultQueryResultRow, GetFieldTypeNoUndefined, NoJsonSelector, Operator, Parameter, Query, QueryType } from './query.js';
|
|
4
|
+
import type { Parameter as ASTParameter } from '../../../zero-protocol/src/ast.js';
|
|
4
5
|
/**
|
|
5
6
|
* A factory function that creates a condition. This is used to create
|
|
6
7
|
* complex conditions that can be passed to the `where` method of a query.
|
|
@@ -26,6 +27,7 @@ export declare class ExpressionBuilder<TSchema extends TableSchema> {
|
|
|
26
27
|
get eb(): this;
|
|
27
28
|
cmp<TSelector extends NoJsonSelector<TSchema>, TOperator extends Operator, TParamAnchor = never, TParamField extends keyof TParamAnchor = never, TParamTypeBound extends GetFieldTypeNoUndefined<TSchema, TSelector, TOperator> = never>(field: TSelector, op: TOperator, value: GetFieldTypeNoUndefined<TSchema, TSelector, TOperator> | Parameter<TParamAnchor, TParamField, TParamTypeBound>): Condition;
|
|
28
29
|
cmp<TSelector extends NoJsonSelector<TSchema>, TParamAnchor = never, TParamField extends keyof TParamAnchor = never, TParamTypeBound extends GetFieldTypeNoUndefined<TSchema, TSelector, '='> = never>(field: TSelector, value: GetFieldTypeNoUndefined<TSchema, TSelector, '='> | Parameter<TParamAnchor, TParamField, TParamTypeBound>): Condition;
|
|
30
|
+
cmpLit(left: ASTParameter | LiteralValue, op: Operator, right: ASTParameter | LiteralValue): Condition;
|
|
29
31
|
and: typeof and;
|
|
30
32
|
or: typeof or;
|
|
31
33
|
not: typeof not;
|
|
@@ -35,7 +37,7 @@ export declare class ExpressionBuilder<TSchema extends TableSchema> {
|
|
|
35
37
|
export declare function and(...conditions: (Condition | undefined)[]): Condition;
|
|
36
38
|
export declare function or(...conditions: (Condition | undefined)[]): Condition;
|
|
37
39
|
export declare function not(expression: Condition): Condition;
|
|
38
|
-
export declare function cmp(field: string, opOrValue: Operator |
|
|
40
|
+
export declare function cmp(field: string, opOrValue: Operator | ASTParameter | LiteralValue, value?: ASTParameter | LiteralValue): Condition;
|
|
39
41
|
export declare const TRUE: Condition;
|
|
40
42
|
export declare function flatten(type: 'and' | 'or', conditions: Condition[]): Condition[];
|
|
41
43
|
//# sourceMappingURL=expression.d.ts.map
|