@ypanagidis/joqi 0.0.1
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/README.md +444 -0
- package/dist/effect.d.ts +2 -0
- package/dist/effect.js +3 -0
- package/dist/index-w8tJonRi.d.ts +1213 -0
- package/dist/index-w8tJonRi.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/src-DGGMT7nT.js +1298 -0
- package/dist/src-DGGMT7nT.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,1213 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region src/specs/query.d.ts
|
|
5
|
+
declare const QueryVersionSchema: z.ZodLiteral<"v1">;
|
|
6
|
+
declare const QuerySortDirectionSchema: z.ZodEnum<{
|
|
7
|
+
asc: "asc";
|
|
8
|
+
desc: "desc";
|
|
9
|
+
}>;
|
|
10
|
+
declare const QueryFilterOperatorSchema: z.ZodEnum<{
|
|
11
|
+
eq: "eq";
|
|
12
|
+
neq: "neq";
|
|
13
|
+
gt: "gt";
|
|
14
|
+
gte: "gte";
|
|
15
|
+
lt: "lt";
|
|
16
|
+
lte: "lte";
|
|
17
|
+
in: "in";
|
|
18
|
+
contains: "contains";
|
|
19
|
+
startsWith: "startsWith";
|
|
20
|
+
endsWith: "endsWith";
|
|
21
|
+
isNull: "isNull";
|
|
22
|
+
isNotNull: "isNotNull";
|
|
23
|
+
}>;
|
|
24
|
+
declare const QueryParamRefSchema: z.ZodObject<{
|
|
25
|
+
$param: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
28
|
+
[key: string]: JsonValue;
|
|
29
|
+
};
|
|
30
|
+
declare const JsonValueSchema: z.ZodType<JsonValue>;
|
|
31
|
+
type QueryParamRef = z.infer<typeof QueryParamRefSchema>;
|
|
32
|
+
type QueryValue = JsonValue | QueryParamRef;
|
|
33
|
+
type QueryParams = Record<string, JsonValue>;
|
|
34
|
+
type QueryLimitValue = number | QueryParamRef;
|
|
35
|
+
declare const QueryParamsSchema: z.ZodType<QueryParams>;
|
|
36
|
+
type QueryFilter = {
|
|
37
|
+
and: QueryFilter[];
|
|
38
|
+
} | {
|
|
39
|
+
or: QueryFilter[];
|
|
40
|
+
} | {
|
|
41
|
+
field: string;
|
|
42
|
+
op: z.infer<typeof QueryFilterOperatorSchema>;
|
|
43
|
+
value?: QueryValue | undefined;
|
|
44
|
+
};
|
|
45
|
+
declare const QueryFilterSchema: z.ZodType<QueryFilter>;
|
|
46
|
+
declare const QueryOrderBySchema: z.ZodObject<{
|
|
47
|
+
field: z.ZodString;
|
|
48
|
+
direction: z.ZodEnum<{
|
|
49
|
+
asc: "asc";
|
|
50
|
+
desc: "desc";
|
|
51
|
+
}>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
declare const QuerySpecSchema: z.ZodObject<{
|
|
54
|
+
version: z.ZodLiteral<"v1">;
|
|
55
|
+
source: z.ZodString;
|
|
56
|
+
select: z.ZodArray<z.ZodString>;
|
|
57
|
+
where: z.ZodOptional<z.ZodType<QueryFilter, unknown, z.core.$ZodTypeInternals<QueryFilter, unknown>>>;
|
|
58
|
+
groupBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
|
+
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
60
|
+
field: z.ZodString;
|
|
61
|
+
direction: z.ZodEnum<{
|
|
62
|
+
asc: "asc";
|
|
63
|
+
desc: "desc";
|
|
64
|
+
}>;
|
|
65
|
+
}, z.core.$strip>>>;
|
|
66
|
+
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
67
|
+
$param: z.ZodString;
|
|
68
|
+
}, z.core.$strict>]>>;
|
|
69
|
+
offset: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
70
|
+
$param: z.ZodString;
|
|
71
|
+
}, z.core.$strict>]>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
type QuerySpec = z.infer<typeof QuerySpecSchema>;
|
|
74
|
+
type QueryOrderBy = z.infer<typeof QueryOrderBySchema>;
|
|
75
|
+
type QueryFilterOperator = z.infer<typeof QueryFilterOperatorSchema>;
|
|
76
|
+
type QuerySortDirection = z.infer<typeof QuerySortDirectionSchema>;
|
|
77
|
+
declare const parseQuerySpec: (input: unknown) => QuerySpec;
|
|
78
|
+
declare const safeParseQuerySpec: (input: unknown) => z.ZodSafeParseResult<{
|
|
79
|
+
version: "v1";
|
|
80
|
+
source: string;
|
|
81
|
+
select: string[];
|
|
82
|
+
where?: QueryFilter | undefined;
|
|
83
|
+
groupBy?: string[] | undefined;
|
|
84
|
+
orderBy?: {
|
|
85
|
+
field: string;
|
|
86
|
+
direction: "asc" | "desc";
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
limit?: number | {
|
|
89
|
+
$param: string;
|
|
90
|
+
} | undefined;
|
|
91
|
+
offset?: number | {
|
|
92
|
+
$param: string;
|
|
93
|
+
} | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/specs/registries.d.ts
|
|
97
|
+
declare const RegistryVersionSchema: z.ZodLiteral<"v1">;
|
|
98
|
+
declare const FieldTypeSchema: z.ZodEnum<{
|
|
99
|
+
string: "string";
|
|
100
|
+
number: "number";
|
|
101
|
+
boolean: "boolean";
|
|
102
|
+
unknown: "unknown";
|
|
103
|
+
date: "date";
|
|
104
|
+
enum: "enum";
|
|
105
|
+
datetime: "datetime";
|
|
106
|
+
json: "json";
|
|
107
|
+
}>;
|
|
108
|
+
declare const PhysicalSourceKindSchema: z.ZodEnum<{
|
|
109
|
+
table: "table";
|
|
110
|
+
view: "view";
|
|
111
|
+
model: "model";
|
|
112
|
+
}>;
|
|
113
|
+
declare const RelationKindSchema: z.ZodEnum<{
|
|
114
|
+
one: "one";
|
|
115
|
+
many: "many";
|
|
116
|
+
}>;
|
|
117
|
+
declare const AggregationSchema: z.ZodEnum<{
|
|
118
|
+
count: "count";
|
|
119
|
+
sum: "sum";
|
|
120
|
+
avg: "avg";
|
|
121
|
+
min: "min";
|
|
122
|
+
max: "max";
|
|
123
|
+
}>;
|
|
124
|
+
declare const ExposureModeSchema: z.ZodEnum<{
|
|
125
|
+
"deny-by-default": "deny-by-default";
|
|
126
|
+
"allow-by-default": "allow-by-default";
|
|
127
|
+
}>;
|
|
128
|
+
declare const AdapterMetaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
129
|
+
declare const PhysicalFieldSchema: z.ZodObject<{
|
|
130
|
+
type: z.ZodEnum<{
|
|
131
|
+
string: "string";
|
|
132
|
+
number: "number";
|
|
133
|
+
boolean: "boolean";
|
|
134
|
+
unknown: "unknown";
|
|
135
|
+
date: "date";
|
|
136
|
+
enum: "enum";
|
|
137
|
+
datetime: "datetime";
|
|
138
|
+
json: "json";
|
|
139
|
+
}>;
|
|
140
|
+
nullable: z.ZodBoolean;
|
|
141
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
142
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
declare const PhysicalRelationSchema: z.ZodObject<{
|
|
145
|
+
kind: z.ZodEnum<{
|
|
146
|
+
one: "one";
|
|
147
|
+
many: "many";
|
|
148
|
+
}>;
|
|
149
|
+
target: z.ZodString;
|
|
150
|
+
localFields: z.ZodArray<z.ZodString>;
|
|
151
|
+
foreignFields: z.ZodArray<z.ZodString>;
|
|
152
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
declare const PhysicalSourceSchema: z.ZodObject<{
|
|
156
|
+
kind: z.ZodEnum<{
|
|
157
|
+
table: "table";
|
|
158
|
+
view: "view";
|
|
159
|
+
model: "model";
|
|
160
|
+
}>;
|
|
161
|
+
name: z.ZodString;
|
|
162
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
163
|
+
primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
165
|
+
type: z.ZodEnum<{
|
|
166
|
+
string: "string";
|
|
167
|
+
number: "number";
|
|
168
|
+
boolean: "boolean";
|
|
169
|
+
unknown: "unknown";
|
|
170
|
+
date: "date";
|
|
171
|
+
enum: "enum";
|
|
172
|
+
datetime: "datetime";
|
|
173
|
+
json: "json";
|
|
174
|
+
}>;
|
|
175
|
+
nullable: z.ZodBoolean;
|
|
176
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
177
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
180
|
+
kind: z.ZodEnum<{
|
|
181
|
+
one: "one";
|
|
182
|
+
many: "many";
|
|
183
|
+
}>;
|
|
184
|
+
target: z.ZodString;
|
|
185
|
+
localFields: z.ZodArray<z.ZodString>;
|
|
186
|
+
foreignFields: z.ZodArray<z.ZodString>;
|
|
187
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
189
|
+
}, z.core.$strip>>>;
|
|
190
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
declare const PhysicalRegistrySchema: z.ZodObject<{
|
|
193
|
+
version: z.ZodLiteral<"v1">;
|
|
194
|
+
sources: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
195
|
+
kind: z.ZodEnum<{
|
|
196
|
+
table: "table";
|
|
197
|
+
view: "view";
|
|
198
|
+
model: "model";
|
|
199
|
+
}>;
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
202
|
+
primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
203
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
204
|
+
type: z.ZodEnum<{
|
|
205
|
+
string: "string";
|
|
206
|
+
number: "number";
|
|
207
|
+
boolean: "boolean";
|
|
208
|
+
unknown: "unknown";
|
|
209
|
+
date: "date";
|
|
210
|
+
enum: "enum";
|
|
211
|
+
datetime: "datetime";
|
|
212
|
+
json: "json";
|
|
213
|
+
}>;
|
|
214
|
+
nullable: z.ZodBoolean;
|
|
215
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
217
|
+
}, z.core.$strip>>;
|
|
218
|
+
relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
219
|
+
kind: z.ZodEnum<{
|
|
220
|
+
one: "one";
|
|
221
|
+
many: "many";
|
|
222
|
+
}>;
|
|
223
|
+
target: z.ZodString;
|
|
224
|
+
localFields: z.ZodArray<z.ZodString>;
|
|
225
|
+
foreignFields: z.ZodArray<z.ZodString>;
|
|
226
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
228
|
+
}, z.core.$strip>>>;
|
|
229
|
+
adapterMeta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
230
|
+
}, z.core.$strip>>;
|
|
231
|
+
}, z.core.$strip>;
|
|
232
|
+
declare const FieldPolicySchema: z.ZodObject<{
|
|
233
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
235
|
+
label: z.ZodOptional<z.ZodString>;
|
|
236
|
+
description: z.ZodOptional<z.ZodString>;
|
|
237
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
238
|
+
string: "string";
|
|
239
|
+
number: "number";
|
|
240
|
+
boolean: "boolean";
|
|
241
|
+
date: "date";
|
|
242
|
+
enum: "enum";
|
|
243
|
+
datetime: "datetime";
|
|
244
|
+
json: "json";
|
|
245
|
+
}>>;
|
|
246
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
247
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
groupable: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
operators: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
251
|
+
eq: "eq";
|
|
252
|
+
neq: "neq";
|
|
253
|
+
gt: "gt";
|
|
254
|
+
gte: "gte";
|
|
255
|
+
lt: "lt";
|
|
256
|
+
lte: "lte";
|
|
257
|
+
in: "in";
|
|
258
|
+
contains: "contains";
|
|
259
|
+
startsWith: "startsWith";
|
|
260
|
+
endsWith: "endsWith";
|
|
261
|
+
isNull: "isNull";
|
|
262
|
+
isNotNull: "isNotNull";
|
|
263
|
+
}>>>;
|
|
264
|
+
aggregations: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
265
|
+
count: "count";
|
|
266
|
+
sum: "sum";
|
|
267
|
+
avg: "avg";
|
|
268
|
+
min: "min";
|
|
269
|
+
max: "max";
|
|
270
|
+
}>>>;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
declare const RelationPolicySchema: z.ZodObject<{
|
|
273
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
275
|
+
target: z.ZodOptional<z.ZodString>;
|
|
276
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
278
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
declare const SourcePolicySchema: z.ZodObject<{
|
|
281
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
282
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
283
|
+
label: z.ZodOptional<z.ZodString>;
|
|
284
|
+
description: z.ZodOptional<z.ZodString>;
|
|
285
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
286
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
287
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
289
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
290
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
291
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
292
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
293
|
+
label: z.ZodOptional<z.ZodString>;
|
|
294
|
+
description: z.ZodOptional<z.ZodString>;
|
|
295
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
296
|
+
string: "string";
|
|
297
|
+
number: "number";
|
|
298
|
+
boolean: "boolean";
|
|
299
|
+
date: "date";
|
|
300
|
+
enum: "enum";
|
|
301
|
+
datetime: "datetime";
|
|
302
|
+
json: "json";
|
|
303
|
+
}>>;
|
|
304
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
305
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
306
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
307
|
+
groupable: z.ZodOptional<z.ZodBoolean>;
|
|
308
|
+
operators: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
309
|
+
eq: "eq";
|
|
310
|
+
neq: "neq";
|
|
311
|
+
gt: "gt";
|
|
312
|
+
gte: "gte";
|
|
313
|
+
lt: "lt";
|
|
314
|
+
lte: "lte";
|
|
315
|
+
in: "in";
|
|
316
|
+
contains: "contains";
|
|
317
|
+
startsWith: "startsWith";
|
|
318
|
+
endsWith: "endsWith";
|
|
319
|
+
isNull: "isNull";
|
|
320
|
+
isNotNull: "isNotNull";
|
|
321
|
+
}>>>;
|
|
322
|
+
aggregations: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
323
|
+
count: "count";
|
|
324
|
+
sum: "sum";
|
|
325
|
+
avg: "avg";
|
|
326
|
+
min: "min";
|
|
327
|
+
max: "max";
|
|
328
|
+
}>>>;
|
|
329
|
+
}, z.core.$strip>>>;
|
|
330
|
+
relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
331
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
332
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
333
|
+
target: z.ZodOptional<z.ZodString>;
|
|
334
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
335
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
336
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
337
|
+
}, z.core.$strip>>>;
|
|
338
|
+
}, z.core.$strip>;
|
|
339
|
+
declare const RegistryPolicySchema: z.ZodObject<{
|
|
340
|
+
version: z.ZodLiteral<"v1">;
|
|
341
|
+
sources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
342
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
343
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
344
|
+
label: z.ZodOptional<z.ZodString>;
|
|
345
|
+
description: z.ZodOptional<z.ZodString>;
|
|
346
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
347
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
348
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
349
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
350
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
351
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
352
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
353
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
354
|
+
label: z.ZodOptional<z.ZodString>;
|
|
355
|
+
description: z.ZodOptional<z.ZodString>;
|
|
356
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
357
|
+
string: "string";
|
|
358
|
+
number: "number";
|
|
359
|
+
boolean: "boolean";
|
|
360
|
+
date: "date";
|
|
361
|
+
enum: "enum";
|
|
362
|
+
datetime: "datetime";
|
|
363
|
+
json: "json";
|
|
364
|
+
}>>;
|
|
365
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
366
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
368
|
+
groupable: z.ZodOptional<z.ZodBoolean>;
|
|
369
|
+
operators: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
370
|
+
eq: "eq";
|
|
371
|
+
neq: "neq";
|
|
372
|
+
gt: "gt";
|
|
373
|
+
gte: "gte";
|
|
374
|
+
lt: "lt";
|
|
375
|
+
lte: "lte";
|
|
376
|
+
in: "in";
|
|
377
|
+
contains: "contains";
|
|
378
|
+
startsWith: "startsWith";
|
|
379
|
+
endsWith: "endsWith";
|
|
380
|
+
isNull: "isNull";
|
|
381
|
+
isNotNull: "isNotNull";
|
|
382
|
+
}>>>;
|
|
383
|
+
aggregations: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
384
|
+
count: "count";
|
|
385
|
+
sum: "sum";
|
|
386
|
+
avg: "avg";
|
|
387
|
+
min: "min";
|
|
388
|
+
max: "max";
|
|
389
|
+
}>>>;
|
|
390
|
+
}, z.core.$strip>>>;
|
|
391
|
+
relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
392
|
+
expose: z.ZodOptional<z.ZodBoolean>;
|
|
393
|
+
exposeAs: z.ZodOptional<z.ZodString>;
|
|
394
|
+
target: z.ZodOptional<z.ZodString>;
|
|
395
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
396
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
397
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
398
|
+
}, z.core.$strip>>>;
|
|
399
|
+
}, z.core.$strip>>>;
|
|
400
|
+
}, z.core.$strip>;
|
|
401
|
+
declare const SourceDefaultsSchema: z.ZodObject<{
|
|
402
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
404
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
405
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
406
|
+
}, z.core.$strip>;
|
|
407
|
+
declare const FieldDefaultsSchema: z.ZodObject<{
|
|
408
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
409
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
410
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
411
|
+
groupable: z.ZodOptional<z.ZodBoolean>;
|
|
412
|
+
operators: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"byType">, z.ZodArray<z.ZodEnum<{
|
|
413
|
+
eq: "eq";
|
|
414
|
+
neq: "neq";
|
|
415
|
+
gt: "gt";
|
|
416
|
+
gte: "gte";
|
|
417
|
+
lt: "lt";
|
|
418
|
+
lte: "lte";
|
|
419
|
+
in: "in";
|
|
420
|
+
contains: "contains";
|
|
421
|
+
startsWith: "startsWith";
|
|
422
|
+
endsWith: "endsWith";
|
|
423
|
+
isNull: "isNull";
|
|
424
|
+
isNotNull: "isNotNull";
|
|
425
|
+
}>>]>>;
|
|
426
|
+
}, z.core.$strip>;
|
|
427
|
+
declare const RelationDefaultsSchema: z.ZodObject<{
|
|
428
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
429
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
430
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
431
|
+
}, z.core.$strip>;
|
|
432
|
+
declare const RegistryDefaultsSchema: z.ZodObject<{
|
|
433
|
+
exposure: z.ZodDefault<z.ZodEnum<{
|
|
434
|
+
"deny-by-default": "deny-by-default";
|
|
435
|
+
"allow-by-default": "allow-by-default";
|
|
436
|
+
}>>;
|
|
437
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
438
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
439
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
440
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
441
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
442
|
+
}, z.core.$strip>>;
|
|
443
|
+
field: z.ZodOptional<z.ZodObject<{
|
|
444
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
445
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
446
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
447
|
+
groupable: z.ZodOptional<z.ZodBoolean>;
|
|
448
|
+
operators: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"byType">, z.ZodArray<z.ZodEnum<{
|
|
449
|
+
eq: "eq";
|
|
450
|
+
neq: "neq";
|
|
451
|
+
gt: "gt";
|
|
452
|
+
gte: "gte";
|
|
453
|
+
lt: "lt";
|
|
454
|
+
lte: "lte";
|
|
455
|
+
in: "in";
|
|
456
|
+
contains: "contains";
|
|
457
|
+
startsWith: "startsWith";
|
|
458
|
+
endsWith: "endsWith";
|
|
459
|
+
isNull: "isNull";
|
|
460
|
+
isNotNull: "isNotNull";
|
|
461
|
+
}>>]>>;
|
|
462
|
+
}, z.core.$strip>>;
|
|
463
|
+
relation: z.ZodOptional<z.ZodObject<{
|
|
464
|
+
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
465
|
+
filterable: z.ZodOptional<z.ZodBoolean>;
|
|
466
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
467
|
+
}, z.core.$strip>>;
|
|
468
|
+
}, z.core.$strip>;
|
|
469
|
+
declare const ResolvedFieldSchema: z.ZodObject<{
|
|
470
|
+
physicalSource: z.ZodString;
|
|
471
|
+
physicalField: z.ZodString;
|
|
472
|
+
publicName: z.ZodString;
|
|
473
|
+
type: z.ZodEnum<{
|
|
474
|
+
string: "string";
|
|
475
|
+
number: "number";
|
|
476
|
+
boolean: "boolean";
|
|
477
|
+
unknown: "unknown";
|
|
478
|
+
date: "date";
|
|
479
|
+
enum: "enum";
|
|
480
|
+
datetime: "datetime";
|
|
481
|
+
json: "json";
|
|
482
|
+
}>;
|
|
483
|
+
nullable: z.ZodBoolean;
|
|
484
|
+
label: z.ZodOptional<z.ZodString>;
|
|
485
|
+
description: z.ZodOptional<z.ZodString>;
|
|
486
|
+
selectable: z.ZodBoolean;
|
|
487
|
+
filterable: z.ZodBoolean;
|
|
488
|
+
sortable: z.ZodBoolean;
|
|
489
|
+
groupable: z.ZodBoolean;
|
|
490
|
+
operators: z.ZodArray<z.ZodEnum<{
|
|
491
|
+
eq: "eq";
|
|
492
|
+
neq: "neq";
|
|
493
|
+
gt: "gt";
|
|
494
|
+
gte: "gte";
|
|
495
|
+
lt: "lt";
|
|
496
|
+
lte: "lte";
|
|
497
|
+
in: "in";
|
|
498
|
+
contains: "contains";
|
|
499
|
+
startsWith: "startsWith";
|
|
500
|
+
endsWith: "endsWith";
|
|
501
|
+
isNull: "isNull";
|
|
502
|
+
isNotNull: "isNotNull";
|
|
503
|
+
}>>;
|
|
504
|
+
aggregations: z.ZodArray<z.ZodEnum<{
|
|
505
|
+
count: "count";
|
|
506
|
+
sum: "sum";
|
|
507
|
+
avg: "avg";
|
|
508
|
+
min: "min";
|
|
509
|
+
max: "max";
|
|
510
|
+
}>>;
|
|
511
|
+
}, z.core.$strip>;
|
|
512
|
+
declare const ResolvedRelationSchema: z.ZodObject<{
|
|
513
|
+
physicalSource: z.ZodString;
|
|
514
|
+
physicalRelation: z.ZodString;
|
|
515
|
+
publicName: z.ZodString;
|
|
516
|
+
target: z.ZodString;
|
|
517
|
+
kind: z.ZodEnum<{
|
|
518
|
+
one: "one";
|
|
519
|
+
many: "many";
|
|
520
|
+
}>;
|
|
521
|
+
localFields: z.ZodArray<z.ZodString>;
|
|
522
|
+
foreignFields: z.ZodArray<z.ZodString>;
|
|
523
|
+
selectable: z.ZodBoolean;
|
|
524
|
+
filterable: z.ZodBoolean;
|
|
525
|
+
maxDepth: z.ZodNumber;
|
|
526
|
+
}, z.core.$strip>;
|
|
527
|
+
declare const ResolvedSourceSchema: z.ZodObject<{
|
|
528
|
+
physicalSource: z.ZodString;
|
|
529
|
+
publicName: z.ZodString;
|
|
530
|
+
label: z.ZodOptional<z.ZodString>;
|
|
531
|
+
description: z.ZodOptional<z.ZodString>;
|
|
532
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
533
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
534
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
535
|
+
physicalSource: z.ZodString;
|
|
536
|
+
physicalField: z.ZodString;
|
|
537
|
+
publicName: z.ZodString;
|
|
538
|
+
type: z.ZodEnum<{
|
|
539
|
+
string: "string";
|
|
540
|
+
number: "number";
|
|
541
|
+
boolean: "boolean";
|
|
542
|
+
unknown: "unknown";
|
|
543
|
+
date: "date";
|
|
544
|
+
enum: "enum";
|
|
545
|
+
datetime: "datetime";
|
|
546
|
+
json: "json";
|
|
547
|
+
}>;
|
|
548
|
+
nullable: z.ZodBoolean;
|
|
549
|
+
label: z.ZodOptional<z.ZodString>;
|
|
550
|
+
description: z.ZodOptional<z.ZodString>;
|
|
551
|
+
selectable: z.ZodBoolean;
|
|
552
|
+
filterable: z.ZodBoolean;
|
|
553
|
+
sortable: z.ZodBoolean;
|
|
554
|
+
groupable: z.ZodBoolean;
|
|
555
|
+
operators: z.ZodArray<z.ZodEnum<{
|
|
556
|
+
eq: "eq";
|
|
557
|
+
neq: "neq";
|
|
558
|
+
gt: "gt";
|
|
559
|
+
gte: "gte";
|
|
560
|
+
lt: "lt";
|
|
561
|
+
lte: "lte";
|
|
562
|
+
in: "in";
|
|
563
|
+
contains: "contains";
|
|
564
|
+
startsWith: "startsWith";
|
|
565
|
+
endsWith: "endsWith";
|
|
566
|
+
isNull: "isNull";
|
|
567
|
+
isNotNull: "isNotNull";
|
|
568
|
+
}>>;
|
|
569
|
+
aggregations: z.ZodArray<z.ZodEnum<{
|
|
570
|
+
count: "count";
|
|
571
|
+
sum: "sum";
|
|
572
|
+
avg: "avg";
|
|
573
|
+
min: "min";
|
|
574
|
+
max: "max";
|
|
575
|
+
}>>;
|
|
576
|
+
}, z.core.$strip>>;
|
|
577
|
+
relations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
578
|
+
physicalSource: z.ZodString;
|
|
579
|
+
physicalRelation: z.ZodString;
|
|
580
|
+
publicName: z.ZodString;
|
|
581
|
+
target: z.ZodString;
|
|
582
|
+
kind: z.ZodEnum<{
|
|
583
|
+
one: "one";
|
|
584
|
+
many: "many";
|
|
585
|
+
}>;
|
|
586
|
+
localFields: z.ZodArray<z.ZodString>;
|
|
587
|
+
foreignFields: z.ZodArray<z.ZodString>;
|
|
588
|
+
selectable: z.ZodBoolean;
|
|
589
|
+
filterable: z.ZodBoolean;
|
|
590
|
+
maxDepth: z.ZodNumber;
|
|
591
|
+
}, z.core.$strip>>;
|
|
592
|
+
}, z.core.$strip>;
|
|
593
|
+
declare const ResolvedRegistrySchema: z.ZodObject<{
|
|
594
|
+
version: z.ZodLiteral<"v1">;
|
|
595
|
+
sources: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
596
|
+
physicalSource: z.ZodString;
|
|
597
|
+
publicName: z.ZodString;
|
|
598
|
+
label: z.ZodOptional<z.ZodString>;
|
|
599
|
+
description: z.ZodOptional<z.ZodString>;
|
|
600
|
+
maxLimit: z.ZodOptional<z.ZodNumber>;
|
|
601
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
602
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
603
|
+
physicalSource: z.ZodString;
|
|
604
|
+
physicalField: z.ZodString;
|
|
605
|
+
publicName: z.ZodString;
|
|
606
|
+
type: z.ZodEnum<{
|
|
607
|
+
string: "string";
|
|
608
|
+
number: "number";
|
|
609
|
+
boolean: "boolean";
|
|
610
|
+
unknown: "unknown";
|
|
611
|
+
date: "date";
|
|
612
|
+
enum: "enum";
|
|
613
|
+
datetime: "datetime";
|
|
614
|
+
json: "json";
|
|
615
|
+
}>;
|
|
616
|
+
nullable: z.ZodBoolean;
|
|
617
|
+
label: z.ZodOptional<z.ZodString>;
|
|
618
|
+
description: z.ZodOptional<z.ZodString>;
|
|
619
|
+
selectable: z.ZodBoolean;
|
|
620
|
+
filterable: z.ZodBoolean;
|
|
621
|
+
sortable: z.ZodBoolean;
|
|
622
|
+
groupable: z.ZodBoolean;
|
|
623
|
+
operators: z.ZodArray<z.ZodEnum<{
|
|
624
|
+
eq: "eq";
|
|
625
|
+
neq: "neq";
|
|
626
|
+
gt: "gt";
|
|
627
|
+
gte: "gte";
|
|
628
|
+
lt: "lt";
|
|
629
|
+
lte: "lte";
|
|
630
|
+
in: "in";
|
|
631
|
+
contains: "contains";
|
|
632
|
+
startsWith: "startsWith";
|
|
633
|
+
endsWith: "endsWith";
|
|
634
|
+
isNull: "isNull";
|
|
635
|
+
isNotNull: "isNotNull";
|
|
636
|
+
}>>;
|
|
637
|
+
aggregations: z.ZodArray<z.ZodEnum<{
|
|
638
|
+
count: "count";
|
|
639
|
+
sum: "sum";
|
|
640
|
+
avg: "avg";
|
|
641
|
+
min: "min";
|
|
642
|
+
max: "max";
|
|
643
|
+
}>>;
|
|
644
|
+
}, z.core.$strip>>;
|
|
645
|
+
relations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
646
|
+
physicalSource: z.ZodString;
|
|
647
|
+
physicalRelation: z.ZodString;
|
|
648
|
+
publicName: z.ZodString;
|
|
649
|
+
target: z.ZodString;
|
|
650
|
+
kind: z.ZodEnum<{
|
|
651
|
+
one: "one";
|
|
652
|
+
many: "many";
|
|
653
|
+
}>;
|
|
654
|
+
localFields: z.ZodArray<z.ZodString>;
|
|
655
|
+
foreignFields: z.ZodArray<z.ZodString>;
|
|
656
|
+
selectable: z.ZodBoolean;
|
|
657
|
+
filterable: z.ZodBoolean;
|
|
658
|
+
maxDepth: z.ZodNumber;
|
|
659
|
+
}, z.core.$strip>>;
|
|
660
|
+
}, z.core.$strip>>;
|
|
661
|
+
}, z.core.$strip>;
|
|
662
|
+
type FieldType = z.infer<typeof FieldTypeSchema>;
|
|
663
|
+
type Aggregation = z.infer<typeof AggregationSchema>;
|
|
664
|
+
type PhysicalRegistry = z.infer<typeof PhysicalRegistrySchema>;
|
|
665
|
+
type PhysicalSource = z.infer<typeof PhysicalSourceSchema>;
|
|
666
|
+
type PhysicalField = z.infer<typeof PhysicalFieldSchema>;
|
|
667
|
+
type PhysicalRelation = z.infer<typeof PhysicalRelationSchema>;
|
|
668
|
+
type RelationKind = z.infer<typeof RelationKindSchema>;
|
|
669
|
+
type RegistryPolicy = z.infer<typeof RegistryPolicySchema>;
|
|
670
|
+
type SourcePolicy = z.infer<typeof SourcePolicySchema>;
|
|
671
|
+
type FieldPolicy = z.infer<typeof FieldPolicySchema>;
|
|
672
|
+
type RelationPolicy = z.infer<typeof RelationPolicySchema>;
|
|
673
|
+
type RegistryDefaults = z.infer<typeof RegistryDefaultsSchema>;
|
|
674
|
+
type ResolvedRegistry = z.infer<typeof ResolvedRegistrySchema>;
|
|
675
|
+
type ResolvedSource = z.infer<typeof ResolvedSourceSchema>;
|
|
676
|
+
type ResolvedField = z.infer<typeof ResolvedFieldSchema>;
|
|
677
|
+
type ResolvedRelation = z.infer<typeof ResolvedRelationSchema>;
|
|
678
|
+
type PhysicalRegistryLike = {
|
|
679
|
+
readonly sources: Readonly<Record<string, PhysicalSourceLike>>;
|
|
680
|
+
};
|
|
681
|
+
type PhysicalSourceLike = {
|
|
682
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
683
|
+
readonly relations?: Readonly<Record<string, unknown>> | undefined;
|
|
684
|
+
};
|
|
685
|
+
type Policy<TPhysical extends PhysicalRegistryLike> = Omit<RegistryPolicy, "sources"> & {
|
|
686
|
+
readonly sources?: { readonly [SourceName in StringKeyOf<TPhysical["sources"]>]?: PolicySource<TPhysical["sources"][SourceName]> };
|
|
687
|
+
};
|
|
688
|
+
type PolicySource<TSource extends PhysicalSourceLike> = Omit<SourcePolicy, "fields" | "relations"> & {
|
|
689
|
+
readonly fields?: { readonly [FieldName in StringKeyOf<TSource["fields"]>]?: FieldPolicy };
|
|
690
|
+
readonly relations?: PolicyRelations<TSource>;
|
|
691
|
+
};
|
|
692
|
+
type PolicyRelations<TSource extends PhysicalSourceLike> = TSource extends {
|
|
693
|
+
readonly relations?: infer Relations;
|
|
694
|
+
} ? NonNullable<Relations> extends Readonly<Record<string, unknown>> ? { readonly [RelationName in StringKeyOf<NonNullable<Relations>>]?: RelationPolicy } : never : never;
|
|
695
|
+
type StringKeyOf<Value> = Extract<keyof Value, string>;
|
|
696
|
+
declare const parsePhysicalRegistry: (input: unknown) => PhysicalRegistry;
|
|
697
|
+
declare const parseRegistryPolicy: (input: unknown) => RegistryPolicy;
|
|
698
|
+
declare const parseRegistryDefaults: (input: unknown) => RegistryDefaults;
|
|
699
|
+
declare const parseResolvedRegistry: (input: unknown) => ResolvedRegistry;
|
|
700
|
+
declare const safeParsePhysicalRegistry: (input: unknown) => z.ZodSafeParseResult<{
|
|
701
|
+
version: "v1";
|
|
702
|
+
sources: Record<string, {
|
|
703
|
+
kind: "table" | "view" | "model";
|
|
704
|
+
name: string;
|
|
705
|
+
fields: Record<string, {
|
|
706
|
+
type: "string" | "number" | "boolean" | "unknown" | "date" | "enum" | "datetime" | "json";
|
|
707
|
+
nullable: boolean;
|
|
708
|
+
enumValues?: string[] | undefined;
|
|
709
|
+
adapterMeta?: Record<string, unknown> | undefined;
|
|
710
|
+
}>;
|
|
711
|
+
schema?: string | undefined;
|
|
712
|
+
primaryKey?: string[] | undefined;
|
|
713
|
+
relations?: Record<string, {
|
|
714
|
+
kind: "one" | "many";
|
|
715
|
+
target: string;
|
|
716
|
+
localFields: string[];
|
|
717
|
+
foreignFields: string[];
|
|
718
|
+
nullable?: boolean | undefined;
|
|
719
|
+
adapterMeta?: Record<string, unknown> | undefined;
|
|
720
|
+
}> | undefined;
|
|
721
|
+
adapterMeta?: Record<string, unknown> | undefined;
|
|
722
|
+
}>;
|
|
723
|
+
}>;
|
|
724
|
+
declare const safeParseRegistryPolicy: (input: unknown) => z.ZodSafeParseResult<{
|
|
725
|
+
version: "v1";
|
|
726
|
+
sources?: Record<string, {
|
|
727
|
+
expose?: boolean | undefined;
|
|
728
|
+
exposeAs?: string | undefined;
|
|
729
|
+
label?: string | undefined;
|
|
730
|
+
description?: string | undefined;
|
|
731
|
+
selectable?: boolean | undefined;
|
|
732
|
+
filterable?: boolean | undefined;
|
|
733
|
+
sortable?: boolean | undefined;
|
|
734
|
+
maxLimit?: number | undefined;
|
|
735
|
+
defaultLimit?: number | undefined;
|
|
736
|
+
fields?: Record<string, {
|
|
737
|
+
expose?: boolean | undefined;
|
|
738
|
+
exposeAs?: string | undefined;
|
|
739
|
+
label?: string | undefined;
|
|
740
|
+
description?: string | undefined;
|
|
741
|
+
type?: "string" | "number" | "boolean" | "date" | "enum" | "datetime" | "json" | undefined;
|
|
742
|
+
selectable?: boolean | undefined;
|
|
743
|
+
filterable?: boolean | undefined;
|
|
744
|
+
sortable?: boolean | undefined;
|
|
745
|
+
groupable?: boolean | undefined;
|
|
746
|
+
operators?: ("eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "startsWith" | "endsWith" | "isNull" | "isNotNull")[] | undefined;
|
|
747
|
+
aggregations?: ("count" | "sum" | "avg" | "min" | "max")[] | undefined;
|
|
748
|
+
}> | undefined;
|
|
749
|
+
relations?: Record<string, {
|
|
750
|
+
expose?: boolean | undefined;
|
|
751
|
+
exposeAs?: string | undefined;
|
|
752
|
+
target?: string | undefined;
|
|
753
|
+
selectable?: boolean | undefined;
|
|
754
|
+
filterable?: boolean | undefined;
|
|
755
|
+
maxDepth?: number | undefined;
|
|
756
|
+
}> | undefined;
|
|
757
|
+
}> | undefined;
|
|
758
|
+
}>;
|
|
759
|
+
declare const safeParseRegistryDefaults: (input: unknown) => z.ZodSafeParseResult<{
|
|
760
|
+
exposure: "deny-by-default" | "allow-by-default";
|
|
761
|
+
source?: {
|
|
762
|
+
selectable?: boolean | undefined;
|
|
763
|
+
filterable?: boolean | undefined;
|
|
764
|
+
sortable?: boolean | undefined;
|
|
765
|
+
maxLimit?: number | undefined;
|
|
766
|
+
} | undefined;
|
|
767
|
+
field?: {
|
|
768
|
+
selectable?: boolean | undefined;
|
|
769
|
+
filterable?: boolean | undefined;
|
|
770
|
+
sortable?: boolean | undefined;
|
|
771
|
+
groupable?: boolean | undefined;
|
|
772
|
+
operators?: ("eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "startsWith" | "endsWith" | "isNull" | "isNotNull")[] | "byType" | undefined;
|
|
773
|
+
} | undefined;
|
|
774
|
+
relation?: {
|
|
775
|
+
selectable?: boolean | undefined;
|
|
776
|
+
filterable?: boolean | undefined;
|
|
777
|
+
maxDepth?: number | undefined;
|
|
778
|
+
} | undefined;
|
|
779
|
+
}>;
|
|
780
|
+
declare const safeParseResolvedRegistry: (input: unknown) => z.ZodSafeParseResult<{
|
|
781
|
+
version: "v1";
|
|
782
|
+
sources: Record<string, {
|
|
783
|
+
physicalSource: string;
|
|
784
|
+
publicName: string;
|
|
785
|
+
fields: Record<string, {
|
|
786
|
+
physicalSource: string;
|
|
787
|
+
physicalField: string;
|
|
788
|
+
publicName: string;
|
|
789
|
+
type: "string" | "number" | "boolean" | "unknown" | "date" | "enum" | "datetime" | "json";
|
|
790
|
+
nullable: boolean;
|
|
791
|
+
selectable: boolean;
|
|
792
|
+
filterable: boolean;
|
|
793
|
+
sortable: boolean;
|
|
794
|
+
groupable: boolean;
|
|
795
|
+
operators: ("eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "startsWith" | "endsWith" | "isNull" | "isNotNull")[];
|
|
796
|
+
aggregations: ("count" | "sum" | "avg" | "min" | "max")[];
|
|
797
|
+
label?: string | undefined;
|
|
798
|
+
description?: string | undefined;
|
|
799
|
+
}>;
|
|
800
|
+
relations: Record<string, {
|
|
801
|
+
physicalSource: string;
|
|
802
|
+
physicalRelation: string;
|
|
803
|
+
publicName: string;
|
|
804
|
+
target: string;
|
|
805
|
+
kind: "one" | "many";
|
|
806
|
+
localFields: string[];
|
|
807
|
+
foreignFields: string[];
|
|
808
|
+
selectable: boolean;
|
|
809
|
+
filterable: boolean;
|
|
810
|
+
maxDepth: number;
|
|
811
|
+
}>;
|
|
812
|
+
label?: string | undefined;
|
|
813
|
+
description?: string | undefined;
|
|
814
|
+
maxLimit?: number | undefined;
|
|
815
|
+
defaultLimit?: number | undefined;
|
|
816
|
+
}>;
|
|
817
|
+
}>;
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region src/registry/resolve.d.ts
|
|
820
|
+
type ResolveRegistryInput = {
|
|
821
|
+
physical: unknown;
|
|
822
|
+
defaults?: unknown;
|
|
823
|
+
policy?: unknown;
|
|
824
|
+
policies?: readonly unknown[];
|
|
825
|
+
};
|
|
826
|
+
declare const RegistryResolutionIssueSchema: Schema.Union<[Schema.Struct<{
|
|
827
|
+
code: Schema.Literal<["unknown_source"]>;
|
|
828
|
+
source: typeof Schema.String;
|
|
829
|
+
}>, Schema.Struct<{
|
|
830
|
+
code: Schema.Literal<["unknown_field"]>;
|
|
831
|
+
source: typeof Schema.String;
|
|
832
|
+
field: typeof Schema.String;
|
|
833
|
+
}>, Schema.Struct<{
|
|
834
|
+
code: Schema.Literal<["unknown_relation"]>;
|
|
835
|
+
source: typeof Schema.String;
|
|
836
|
+
relation: typeof Schema.String;
|
|
837
|
+
}>, Schema.Struct<{
|
|
838
|
+
code: Schema.Literal<["duplicate_public_source"]>;
|
|
839
|
+
publicName: typeof Schema.String;
|
|
840
|
+
sources: Schema.Array$<typeof Schema.String>;
|
|
841
|
+
}>, Schema.Struct<{
|
|
842
|
+
code: Schema.Literal<["duplicate_public_field"]>;
|
|
843
|
+
source: typeof Schema.String;
|
|
844
|
+
publicName: typeof Schema.String;
|
|
845
|
+
fields: Schema.Array$<typeof Schema.String>;
|
|
846
|
+
}>, Schema.Struct<{
|
|
847
|
+
code: Schema.Literal<["duplicate_public_relation"]>;
|
|
848
|
+
source: typeof Schema.String;
|
|
849
|
+
publicName: typeof Schema.String;
|
|
850
|
+
relations: Schema.Array$<typeof Schema.String>;
|
|
851
|
+
}>, Schema.Struct<{
|
|
852
|
+
code: Schema.Literal<["source_has_no_fields"]>;
|
|
853
|
+
source: typeof Schema.String;
|
|
854
|
+
publicName: typeof Schema.String;
|
|
855
|
+
}>, Schema.Struct<{
|
|
856
|
+
code: Schema.Literal<["invalid_default_limit"]>;
|
|
857
|
+
source: typeof Schema.String;
|
|
858
|
+
defaultLimit: typeof Schema.Number;
|
|
859
|
+
maxLimit: typeof Schema.Number;
|
|
860
|
+
}>, Schema.Struct<{
|
|
861
|
+
code: Schema.Literal<["unknown_relation_target"]>;
|
|
862
|
+
source: typeof Schema.String;
|
|
863
|
+
relation: typeof Schema.String;
|
|
864
|
+
target: typeof Schema.String;
|
|
865
|
+
}>, Schema.Struct<{
|
|
866
|
+
code: Schema.Literal<["invalid_operator_for_field_type"]>;
|
|
867
|
+
source: typeof Schema.String;
|
|
868
|
+
field: typeof Schema.String;
|
|
869
|
+
type: Schema.Literal<["string", "number", "boolean", "date", "datetime", "json", "enum", "unknown"]>;
|
|
870
|
+
operator: Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "endsWith", "isNull", "isNotNull"]>;
|
|
871
|
+
}>]>;
|
|
872
|
+
type RegistryResolutionIssue = typeof RegistryResolutionIssueSchema.Type;
|
|
873
|
+
declare const RegistryResolutionError_base: Schema.TaggedErrorClass<RegistryResolutionError, "RegistryResolutionError", {
|
|
874
|
+
readonly _tag: Schema.tag<"RegistryResolutionError">;
|
|
875
|
+
} & {
|
|
876
|
+
issues: Schema.Array$<Schema.Union<[Schema.Struct<{
|
|
877
|
+
code: Schema.Literal<["unknown_source"]>;
|
|
878
|
+
source: typeof Schema.String;
|
|
879
|
+
}>, Schema.Struct<{
|
|
880
|
+
code: Schema.Literal<["unknown_field"]>;
|
|
881
|
+
source: typeof Schema.String;
|
|
882
|
+
field: typeof Schema.String;
|
|
883
|
+
}>, Schema.Struct<{
|
|
884
|
+
code: Schema.Literal<["unknown_relation"]>;
|
|
885
|
+
source: typeof Schema.String;
|
|
886
|
+
relation: typeof Schema.String;
|
|
887
|
+
}>, Schema.Struct<{
|
|
888
|
+
code: Schema.Literal<["duplicate_public_source"]>;
|
|
889
|
+
publicName: typeof Schema.String;
|
|
890
|
+
sources: Schema.Array$<typeof Schema.String>;
|
|
891
|
+
}>, Schema.Struct<{
|
|
892
|
+
code: Schema.Literal<["duplicate_public_field"]>;
|
|
893
|
+
source: typeof Schema.String;
|
|
894
|
+
publicName: typeof Schema.String;
|
|
895
|
+
fields: Schema.Array$<typeof Schema.String>;
|
|
896
|
+
}>, Schema.Struct<{
|
|
897
|
+
code: Schema.Literal<["duplicate_public_relation"]>;
|
|
898
|
+
source: typeof Schema.String;
|
|
899
|
+
publicName: typeof Schema.String;
|
|
900
|
+
relations: Schema.Array$<typeof Schema.String>;
|
|
901
|
+
}>, Schema.Struct<{
|
|
902
|
+
code: Schema.Literal<["source_has_no_fields"]>;
|
|
903
|
+
source: typeof Schema.String;
|
|
904
|
+
publicName: typeof Schema.String;
|
|
905
|
+
}>, Schema.Struct<{
|
|
906
|
+
code: Schema.Literal<["invalid_default_limit"]>;
|
|
907
|
+
source: typeof Schema.String;
|
|
908
|
+
defaultLimit: typeof Schema.Number;
|
|
909
|
+
maxLimit: typeof Schema.Number;
|
|
910
|
+
}>, Schema.Struct<{
|
|
911
|
+
code: Schema.Literal<["unknown_relation_target"]>;
|
|
912
|
+
source: typeof Schema.String;
|
|
913
|
+
relation: typeof Schema.String;
|
|
914
|
+
target: typeof Schema.String;
|
|
915
|
+
}>, Schema.Struct<{
|
|
916
|
+
code: Schema.Literal<["invalid_operator_for_field_type"]>;
|
|
917
|
+
source: typeof Schema.String;
|
|
918
|
+
field: typeof Schema.String;
|
|
919
|
+
type: Schema.Literal<["string", "number", "boolean", "date", "datetime", "json", "enum", "unknown"]>;
|
|
920
|
+
operator: Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "endsWith", "isNull", "isNotNull"]>;
|
|
921
|
+
}>]>>;
|
|
922
|
+
}>;
|
|
923
|
+
declare class RegistryResolutionError extends RegistryResolutionError_base {}
|
|
924
|
+
declare const RegistryParseError_base: Schema.TaggedErrorClass<RegistryParseError, "RegistryParseError", {
|
|
925
|
+
readonly _tag: Schema.tag<"RegistryParseError">;
|
|
926
|
+
} & {
|
|
927
|
+
error: typeof Schema.Defect;
|
|
928
|
+
}>;
|
|
929
|
+
declare class RegistryParseError extends RegistryParseError_base {}
|
|
930
|
+
type ResolveRegistryError = RegistryParseError | RegistryResolutionError;
|
|
931
|
+
declare const resolveRegistryEffect: (input: ResolveRegistryInput) => Effect.Effect<ResolvedRegistry, ResolveRegistryError>;
|
|
932
|
+
declare const resolveRegistry: (input: ResolveRegistryInput) => ResolvedRegistry;
|
|
933
|
+
declare const resolveRegistryPromise: (input: ResolveRegistryInput) => Promise<ResolvedRegistry>;
|
|
934
|
+
//#endregion
|
|
935
|
+
//#region src/query/validate.d.ts
|
|
936
|
+
type ValidateQuerySpecInput = {
|
|
937
|
+
readonly query: unknown;
|
|
938
|
+
readonly registry: unknown;
|
|
939
|
+
readonly params?: unknown;
|
|
940
|
+
};
|
|
941
|
+
type BoundQueryFilter = {
|
|
942
|
+
readonly and: readonly BoundQueryFilter[];
|
|
943
|
+
} | {
|
|
944
|
+
readonly or: readonly BoundQueryFilter[];
|
|
945
|
+
} | {
|
|
946
|
+
readonly field: string;
|
|
947
|
+
readonly op: QueryFilterOperator;
|
|
948
|
+
readonly value?: JsonValue | undefined;
|
|
949
|
+
};
|
|
950
|
+
type ValidatedQuerySpec = Omit<QuerySpec, "where" | "limit" | "offset"> & {
|
|
951
|
+
readonly where?: BoundQueryFilter | undefined;
|
|
952
|
+
readonly limit?: number | undefined;
|
|
953
|
+
readonly offset?: number | undefined;
|
|
954
|
+
};
|
|
955
|
+
declare const QueryValidationIssueSchema: Schema.Union<[Schema.Struct<{
|
|
956
|
+
code: Schema.Literal<["unknown_source"]>;
|
|
957
|
+
source: typeof Schema.String;
|
|
958
|
+
}>, Schema.Struct<{
|
|
959
|
+
code: Schema.Literal<["unknown_field"]>;
|
|
960
|
+
source: typeof Schema.String;
|
|
961
|
+
path: typeof Schema.String;
|
|
962
|
+
field: typeof Schema.String;
|
|
963
|
+
}>, Schema.Struct<{
|
|
964
|
+
code: Schema.Literal<["unknown_relation"]>;
|
|
965
|
+
source: typeof Schema.String;
|
|
966
|
+
path: typeof Schema.String;
|
|
967
|
+
relation: typeof Schema.String;
|
|
968
|
+
}>, Schema.Struct<{
|
|
969
|
+
code: Schema.Literal<["field_not_selectable", "field_not_filterable", "field_not_sortable", "field_not_groupable"]>;
|
|
970
|
+
source: typeof Schema.String;
|
|
971
|
+
path: typeof Schema.String;
|
|
972
|
+
field: typeof Schema.String;
|
|
973
|
+
}>, Schema.Struct<{
|
|
974
|
+
code: Schema.Literal<["relation_not_selectable", "relation_not_filterable"]>;
|
|
975
|
+
source: typeof Schema.String;
|
|
976
|
+
path: typeof Schema.String;
|
|
977
|
+
relation: typeof Schema.String;
|
|
978
|
+
}>, Schema.Struct<{
|
|
979
|
+
code: Schema.Literal<["relation_depth_exceeded"]>;
|
|
980
|
+
source: typeof Schema.String;
|
|
981
|
+
path: typeof Schema.String;
|
|
982
|
+
relation: typeof Schema.String;
|
|
983
|
+
requestedDepth: typeof Schema.Number;
|
|
984
|
+
maxDepth: typeof Schema.Number;
|
|
985
|
+
}>, Schema.Struct<{
|
|
986
|
+
code: Schema.Literal<["operator_not_allowed"]>;
|
|
987
|
+
source: typeof Schema.String;
|
|
988
|
+
path: typeof Schema.String;
|
|
989
|
+
field: typeof Schema.String;
|
|
990
|
+
operator: Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "endsWith", "isNull", "isNotNull"]>;
|
|
991
|
+
allowedOperators: Schema.Array$<Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "endsWith", "isNull", "isNotNull"]>>;
|
|
992
|
+
}>, Schema.Struct<{
|
|
993
|
+
code: Schema.Literal<["limit_exceeds_max"]>;
|
|
994
|
+
source: typeof Schema.String;
|
|
995
|
+
limit: typeof Schema.Number;
|
|
996
|
+
maxLimit: typeof Schema.Number;
|
|
997
|
+
}>, Schema.Struct<{
|
|
998
|
+
code: Schema.Literal<["missing_param"]>;
|
|
999
|
+
param: typeof Schema.String;
|
|
1000
|
+
path: typeof Schema.String;
|
|
1001
|
+
}>, Schema.Struct<{
|
|
1002
|
+
code: Schema.Literal<["invalid_param_value"]>;
|
|
1003
|
+
param: typeof Schema.String;
|
|
1004
|
+
path: typeof Schema.String;
|
|
1005
|
+
expected: typeof Schema.String;
|
|
1006
|
+
}>]>;
|
|
1007
|
+
type QueryValidationIssue = typeof QueryValidationIssueSchema.Type;
|
|
1008
|
+
declare const QueryParseError_base: Schema.TaggedErrorClass<QueryParseError, "QueryParseError", {
|
|
1009
|
+
readonly _tag: Schema.tag<"QueryParseError">;
|
|
1010
|
+
} & {
|
|
1011
|
+
input: Schema.Literal<["query", "registry", "params"]>;
|
|
1012
|
+
error: typeof Schema.Defect;
|
|
1013
|
+
}>;
|
|
1014
|
+
declare class QueryParseError extends QueryParseError_base {}
|
|
1015
|
+
declare const QueryValidationError_base: Schema.TaggedErrorClass<QueryValidationError, "QueryValidationError", {
|
|
1016
|
+
readonly _tag: Schema.tag<"QueryValidationError">;
|
|
1017
|
+
} & {
|
|
1018
|
+
issues: Schema.Array$<Schema.Union<[Schema.Struct<{
|
|
1019
|
+
code: Schema.Literal<["unknown_source"]>;
|
|
1020
|
+
source: typeof Schema.String;
|
|
1021
|
+
}>, Schema.Struct<{
|
|
1022
|
+
code: Schema.Literal<["unknown_field"]>;
|
|
1023
|
+
source: typeof Schema.String;
|
|
1024
|
+
path: typeof Schema.String;
|
|
1025
|
+
field: typeof Schema.String;
|
|
1026
|
+
}>, Schema.Struct<{
|
|
1027
|
+
code: Schema.Literal<["unknown_relation"]>;
|
|
1028
|
+
source: typeof Schema.String;
|
|
1029
|
+
path: typeof Schema.String;
|
|
1030
|
+
relation: typeof Schema.String;
|
|
1031
|
+
}>, Schema.Struct<{
|
|
1032
|
+
code: Schema.Literal<["field_not_selectable", "field_not_filterable", "field_not_sortable", "field_not_groupable"]>;
|
|
1033
|
+
source: typeof Schema.String;
|
|
1034
|
+
path: typeof Schema.String;
|
|
1035
|
+
field: typeof Schema.String;
|
|
1036
|
+
}>, Schema.Struct<{
|
|
1037
|
+
code: Schema.Literal<["relation_not_selectable", "relation_not_filterable"]>;
|
|
1038
|
+
source: typeof Schema.String;
|
|
1039
|
+
path: typeof Schema.String;
|
|
1040
|
+
relation: typeof Schema.String;
|
|
1041
|
+
}>, Schema.Struct<{
|
|
1042
|
+
code: Schema.Literal<["relation_depth_exceeded"]>;
|
|
1043
|
+
source: typeof Schema.String;
|
|
1044
|
+
path: typeof Schema.String;
|
|
1045
|
+
relation: typeof Schema.String;
|
|
1046
|
+
requestedDepth: typeof Schema.Number;
|
|
1047
|
+
maxDepth: typeof Schema.Number;
|
|
1048
|
+
}>, Schema.Struct<{
|
|
1049
|
+
code: Schema.Literal<["operator_not_allowed"]>;
|
|
1050
|
+
source: typeof Schema.String;
|
|
1051
|
+
path: typeof Schema.String;
|
|
1052
|
+
field: typeof Schema.String;
|
|
1053
|
+
operator: Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "endsWith", "isNull", "isNotNull"]>;
|
|
1054
|
+
allowedOperators: Schema.Array$<Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "startsWith", "endsWith", "isNull", "isNotNull"]>>;
|
|
1055
|
+
}>, Schema.Struct<{
|
|
1056
|
+
code: Schema.Literal<["limit_exceeds_max"]>;
|
|
1057
|
+
source: typeof Schema.String;
|
|
1058
|
+
limit: typeof Schema.Number;
|
|
1059
|
+
maxLimit: typeof Schema.Number;
|
|
1060
|
+
}>, Schema.Struct<{
|
|
1061
|
+
code: Schema.Literal<["missing_param"]>;
|
|
1062
|
+
param: typeof Schema.String;
|
|
1063
|
+
path: typeof Schema.String;
|
|
1064
|
+
}>, Schema.Struct<{
|
|
1065
|
+
code: Schema.Literal<["invalid_param_value"]>;
|
|
1066
|
+
param: typeof Schema.String;
|
|
1067
|
+
path: typeof Schema.String;
|
|
1068
|
+
expected: typeof Schema.String;
|
|
1069
|
+
}>]>>;
|
|
1070
|
+
}>;
|
|
1071
|
+
declare class QueryValidationError extends QueryValidationError_base {}
|
|
1072
|
+
type ValidateQuerySpecError = QueryParseError | QueryValidationError;
|
|
1073
|
+
declare const validateQuerySpecEffect: (input: ValidateQuerySpecInput) => Effect.Effect<ValidatedQuerySpec, ValidateQuerySpecError>;
|
|
1074
|
+
declare const validateQuerySpec: (input: ValidateQuerySpecInput) => ValidatedQuerySpec;
|
|
1075
|
+
declare const validateQuerySpecPromise: (input: ValidateQuerySpecInput) => Promise<ValidatedQuerySpec>;
|
|
1076
|
+
//#endregion
|
|
1077
|
+
//#region src/query/lower.d.ts
|
|
1078
|
+
type LowerQuerySpecInput = ValidateQuerySpecInput;
|
|
1079
|
+
type LowerQuerySpecError = ValidateQuerySpecError;
|
|
1080
|
+
type QueryIR = {
|
|
1081
|
+
readonly kind: "select";
|
|
1082
|
+
readonly source: QueryIRSourceRef;
|
|
1083
|
+
readonly select: readonly QueryIRFieldRef[];
|
|
1084
|
+
readonly joins: readonly QueryIRJoin[];
|
|
1085
|
+
readonly where?: QueryIRFilter | undefined;
|
|
1086
|
+
readonly groupBy: readonly QueryIRFieldRef[];
|
|
1087
|
+
readonly orderBy: readonly QueryIROrderBy[];
|
|
1088
|
+
readonly limit?: number | undefined;
|
|
1089
|
+
readonly offset?: number | undefined;
|
|
1090
|
+
};
|
|
1091
|
+
type QueryIRSourceRef = {
|
|
1092
|
+
readonly publicName: string;
|
|
1093
|
+
readonly physicalSource: string;
|
|
1094
|
+
};
|
|
1095
|
+
type QueryIRFieldRef = {
|
|
1096
|
+
readonly path: string;
|
|
1097
|
+
readonly source: QueryIRSourceRef;
|
|
1098
|
+
readonly field: {
|
|
1099
|
+
readonly publicName: string;
|
|
1100
|
+
readonly physicalField: string;
|
|
1101
|
+
};
|
|
1102
|
+
readonly type: FieldType;
|
|
1103
|
+
readonly nullable: boolean;
|
|
1104
|
+
};
|
|
1105
|
+
type QueryIRJoin = {
|
|
1106
|
+
readonly path: string;
|
|
1107
|
+
readonly relation: {
|
|
1108
|
+
readonly publicName: string;
|
|
1109
|
+
readonly physicalRelation: string;
|
|
1110
|
+
};
|
|
1111
|
+
readonly kind: RelationKind;
|
|
1112
|
+
readonly from: QueryIRSourceRef;
|
|
1113
|
+
readonly to: QueryIRSourceRef;
|
|
1114
|
+
readonly localFields: readonly string[];
|
|
1115
|
+
readonly foreignFields: readonly string[];
|
|
1116
|
+
};
|
|
1117
|
+
type QueryIRFilter = {
|
|
1118
|
+
readonly and: readonly QueryIRFilter[];
|
|
1119
|
+
} | {
|
|
1120
|
+
readonly or: readonly QueryIRFilter[];
|
|
1121
|
+
} | {
|
|
1122
|
+
readonly field: QueryIRFieldRef;
|
|
1123
|
+
readonly op: QueryFilterOperator;
|
|
1124
|
+
readonly value?: JsonValue | undefined;
|
|
1125
|
+
};
|
|
1126
|
+
type QueryIROrderBy = {
|
|
1127
|
+
readonly field: QueryIRFieldRef;
|
|
1128
|
+
readonly direction: QuerySortDirection;
|
|
1129
|
+
};
|
|
1130
|
+
declare const lowerQuerySpecToIREffect: (input: LowerQuerySpecInput) => Effect.Effect<QueryIR, LowerQuerySpecError>;
|
|
1131
|
+
declare const lowerQuerySpecToIR: (input: LowerQuerySpecInput) => QueryIR;
|
|
1132
|
+
declare const lowerQuerySpecToIRPromise: (input: LowerQuerySpecInput) => Promise<QueryIR>;
|
|
1133
|
+
//#endregion
|
|
1134
|
+
//#region src/compiler/sql/types.d.ts
|
|
1135
|
+
type SQLDialect = "mysql" | "postgres" | "sqlite";
|
|
1136
|
+
type SQLPlan = {
|
|
1137
|
+
readonly dialect: SQLDialect;
|
|
1138
|
+
readonly sql: string;
|
|
1139
|
+
readonly params: readonly JsonValue[];
|
|
1140
|
+
};
|
|
1141
|
+
//#endregion
|
|
1142
|
+
//#region src/compiler/sql/index.d.ts
|
|
1143
|
+
type CompileQuerySpecToSQLInput = LowerQuerySpecInput & {
|
|
1144
|
+
readonly dialect?: SQLDialect;
|
|
1145
|
+
};
|
|
1146
|
+
type CompileQuerySpecToSQLError = LowerQuerySpecError;
|
|
1147
|
+
declare const compileQuerySpecToSQLEffect: (input: CompileQuerySpecToSQLInput) => Effect.Effect<SQLPlan, CompileQuerySpecToSQLError>;
|
|
1148
|
+
declare const compileQuerySpecToSQL: (input: CompileQuerySpecToSQLInput) => SQLPlan;
|
|
1149
|
+
declare const compileQuerySpecToSQLPromise: (input: CompileQuerySpecToSQLInput) => Promise<SQLPlan>;
|
|
1150
|
+
//#endregion
|
|
1151
|
+
//#region src/results/schema.d.ts
|
|
1152
|
+
type QueryResultRow = Record<string, unknown>;
|
|
1153
|
+
type QueryResultRows = readonly QueryResultRow[];
|
|
1154
|
+
declare const buildQueryIRRowSchema: (ir: QueryIR) => z.ZodObject<{
|
|
1155
|
+
[x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
1156
|
+
}, z.core.$strict>;
|
|
1157
|
+
declare const buildQueryIRResultSchema: (ir: QueryIR) => z.ZodArray<z.ZodObject<{
|
|
1158
|
+
[x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
1159
|
+
}, z.core.$strict>>;
|
|
1160
|
+
declare const parseQueryIRResultRows: (ir: QueryIR, rows: unknown) => QueryResultRows;
|
|
1161
|
+
declare const safeParseQueryIRResultRows: (ir: QueryIR, rows: unknown) => z.ZodSafeParseResult<Record<string, unknown>[]>;
|
|
1162
|
+
//#endregion
|
|
1163
|
+
//#region src/runtime.d.ts
|
|
1164
|
+
type QueryRuntimeExecutor<TDb, TResult = unknown> = (input: {
|
|
1165
|
+
readonly db: TDb;
|
|
1166
|
+
readonly plan: SQLPlan;
|
|
1167
|
+
}) => TResult | Promise<TResult>;
|
|
1168
|
+
type CreateQueryRuntimeInput<TDb, TResult = unknown> = {
|
|
1169
|
+
readonly db: TDb;
|
|
1170
|
+
readonly physicalRegistry: unknown;
|
|
1171
|
+
readonly defaults?: unknown;
|
|
1172
|
+
readonly policy?: unknown;
|
|
1173
|
+
readonly policies?: readonly unknown[] | undefined;
|
|
1174
|
+
readonly dialect?: SQLDialect | undefined;
|
|
1175
|
+
readonly executor: QueryRuntimeExecutor<TDb, TResult>;
|
|
1176
|
+
};
|
|
1177
|
+
type QueryRuntimeRunInputBase = {
|
|
1178
|
+
readonly spec: unknown;
|
|
1179
|
+
readonly params?: QueryParams | undefined;
|
|
1180
|
+
};
|
|
1181
|
+
type QueryRuntimeRunInput = QueryRuntimeRunInputBase & {
|
|
1182
|
+
readonly explain?: boolean | undefined;
|
|
1183
|
+
};
|
|
1184
|
+
type QueryRuntimeRunInputWithExplain = QueryRuntimeRunInputBase & {
|
|
1185
|
+
readonly explain: true;
|
|
1186
|
+
};
|
|
1187
|
+
type QueryRuntimeRunInputWithoutExplain = QueryRuntimeRunInputBase & {
|
|
1188
|
+
readonly explain?: false | undefined;
|
|
1189
|
+
};
|
|
1190
|
+
type QueryRuntimeExplain = {
|
|
1191
|
+
readonly registry: ResolvedRegistry;
|
|
1192
|
+
readonly ir: QueryIR;
|
|
1193
|
+
readonly sqlPlan: SQLPlan;
|
|
1194
|
+
};
|
|
1195
|
+
type QueryRuntimeResult = {
|
|
1196
|
+
readonly rows: QueryResultRows;
|
|
1197
|
+
};
|
|
1198
|
+
type QueryRuntimeResultWithExplain = QueryRuntimeResult & {
|
|
1199
|
+
readonly explain: QueryRuntimeExplain;
|
|
1200
|
+
};
|
|
1201
|
+
type QueryRuntimeRunError = ResolveRegistryError | CompileQuerySpecToSQLError;
|
|
1202
|
+
type QueryRuntime = {
|
|
1203
|
+
run(input: QueryRuntimeRunInputWithExplain): Promise<QueryRuntimeResultWithExplain>;
|
|
1204
|
+
run(input: QueryRuntimeRunInputWithoutExplain): Promise<QueryRuntimeResult>;
|
|
1205
|
+
run(input: QueryRuntimeRunInput): Promise<QueryRuntimeResult | QueryRuntimeResultWithExplain>;
|
|
1206
|
+
};
|
|
1207
|
+
declare const createQueryRuntime: <TDb, TResult = unknown>(input: CreateQueryRuntimeInput<TDb, TResult>) => QueryRuntime;
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/index.d.ts
|
|
1210
|
+
declare const queryKitVersion = "0.0.2-alpha.0";
|
|
1211
|
+
//#endregion
|
|
1212
|
+
export { ResolveRegistryInput as $, JsonValue as $t, QueryIRFieldRef as A, RelationDefaultsSchema as At, QueryValidationIssue as B, ResolvedSource as Bt, compileQuerySpecToSQLEffect as C, Policy as Ct, LowerQuerySpecError as D, RegistryPolicy as Dt, SQLPlan as E, RegistryDefaultsSchema as Et, lowerQuerySpecToIR as F, ResolvedFieldSchema as Ft, validateQuerySpec as G, parsePhysicalRegistry as Gt, ValidateQuerySpecError as H, SourceDefaultsSchema as Ht, lowerQuerySpecToIREffect as I, ResolvedRegistry as It, RegistryParseError as J, parseResolvedRegistry as Jt, validateQuerySpecEffect as K, parseRegistryDefaults as Kt, lowerQuerySpecToIRPromise as L, ResolvedRegistrySchema as Lt, QueryIRJoin as M, RelationPolicy as Mt, QueryIROrderBy as N, RelationPolicySchema as Nt, LowerQuerySpecInput as O, RegistryPolicySchema as Ot, QueryIRSourceRef as P, ResolvedField as Pt, ResolveRegistryError as Q, safeParseResolvedRegistry as Qt, QueryParseError as R, ResolvedRelation as Rt, compileQuerySpecToSQL as S, PhysicalSourceSchema as St, SQLDialect as T, RegistryDefaults as Tt, ValidateQuerySpecInput as U, SourcePolicy as Ut, QueryValidationIssueSchema as V, ResolvedSourceSchema as Vt, ValidatedQuerySpec as W, SourcePolicySchema as Wt, RegistryResolutionIssue as X, safeParseRegistryDefaults as Xt, RegistryResolutionError as Y, safeParsePhysicalRegistry as Yt, RegistryResolutionIssueSchema as Z, safeParseRegistryPolicy as Zt, buildQueryIRRowSchema as _, QueryVersionSchema as _n, PhysicalRelation as _t, QueryRuntimeExplain as a, QueryLimitValue as an, AggregationSchema as at, CompileQuerySpecToSQLError as b, PhysicalSourceKindSchema as bt, QueryRuntimeRunError as c, QueryParamRef as cn, FieldPolicy as ct, QueryRuntimeRunInputWithExplain as d, QueryParamsSchema as dn, FieldTypeSchema as dt, JsonValueSchema as en, resolveRegistry as et, QueryRuntimeRunInputWithoutExplain as f, QuerySortDirection as fn, PhysicalField as ft, buildQueryIRResultSchema as g, QueryValue as gn, PhysicalRegistrySchema as gt, QueryResultRows as h, QuerySpecSchema as hn, PhysicalRegistryLike as ht, QueryRuntimeExecutor as i, QueryFilterSchema as in, Aggregation as it, QueryIRFilter as j, RelationKindSchema as jt, QueryIR as k, RegistryVersionSchema as kt, QueryRuntimeRunInput as l, QueryParamRefSchema as ln, FieldPolicySchema as lt, QueryResultRow as m, QuerySpec as mn, PhysicalRegistry as mt, CreateQueryRuntimeInput as n, QueryFilterOperator as nn, resolveRegistryPromise as nt, QueryRuntimeResult as o, QueryOrderBy as on, ExposureModeSchema as ot, createQueryRuntime as p, QuerySortDirectionSchema as pn, PhysicalFieldSchema as pt, validateQuerySpecPromise as q, parseRegistryPolicy as qt, QueryRuntime as r, QueryFilterOperatorSchema as rn, AdapterMetaSchema as rt, QueryRuntimeResultWithExplain as s, QueryOrderBySchema as sn, FieldDefaultsSchema as st, queryKitVersion as t, QueryFilter as tn, resolveRegistryEffect as tt, QueryRuntimeRunInputBase as u, QueryParams as un, FieldType as ut, parseQueryIRResultRows as v, parseQuerySpec as vn, PhysicalRelationSchema as vt, compileQuerySpecToSQLPromise as w, PolicySource as wt, CompileQuerySpecToSQLInput as x, PhysicalSourceLike as xt, safeParseQueryIRResultRows as y, safeParseQuerySpec as yn, PhysicalSource as yt, QueryValidationError as z, ResolvedRelationSchema as zt };
|
|
1213
|
+
//# sourceMappingURL=index-w8tJonRi.d.ts.map
|