@niscorp/vex 0.3.1 → 0.4.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/CHANGELOG.md +27 -0
- package/DESIGN.md +11 -7
- package/DOCS.md +52 -9
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.cjs.map +1 -1
- package/dist/adapters/express/index.d.cts +3 -2
- package/dist/adapters/express/index.d.ts +3 -2
- package/dist/adapters/express/index.js +3 -2
- package/dist/adapters/express/index.js.map +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.cjs.map +1 -1
- package/dist/adapters/hono/index.d.cts +3 -2
- package/dist/adapters/hono/index.d.ts +3 -2
- package/dist/adapters/hono/index.js +3 -2
- package/dist/adapters/hono/index.js.map +1 -1
- package/dist/agent/index.cjs +144 -21
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +3 -2
- package/dist/agent/index.d.ts +3 -2
- package/dist/agent/index.js +146 -22
- package/dist/agent/index.js.map +1 -1
- package/dist/{chunk-3HORTMZ7.js → chunk-AKR6HU34.js} +9 -5
- package/dist/chunk-AKR6HU34.js.map +1 -0
- package/dist/chunk-F7RDSWYF.js +7 -0
- package/dist/chunk-F7RDSWYF.js.map +1 -0
- package/dist/{chunk-J7JYKCUA.js → chunk-UPQMKAAX.js} +3 -18
- package/dist/chunk-UPQMKAAX.js.map +1 -0
- package/dist/chunk-XTOK7YOR.js +18 -0
- package/dist/chunk-XTOK7YOR.js.map +1 -0
- package/dist/{handler-B4NAi4k_.d.cts → handler-CoJxInw-.d.ts} +2 -1
- package/dist/{handler-BRVhWuNk.d.ts → handler-CsFbanZA.d.cts} +2 -1
- package/dist/index.cjs +26 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +30 -20
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.cjs +173 -0
- package/dist/migrations/index.cjs.map +1 -0
- package/dist/migrations/index.d.cts +20 -0
- package/dist/migrations/index.d.ts +20 -0
- package/dist/migrations/index.js +23 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/query.schema-B-LVNfyX.d.cts +461 -0
- package/dist/query.schema-B-LVNfyX.d.ts +461 -0
- package/dist/{types-DUJp5B3o.d.cts → types-B2HEmyNq.d.cts} +11 -463
- package/dist/{types-DUJp5B3o.d.ts → types-DC68ZUuq.d.ts} +11 -463
- package/package.json +12 -1
- package/dist/chunk-3HORTMZ7.js.map +0 -1
- package/dist/chunk-J7JYKCUA.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Filter, F as FieldOrValue, Q as Query, C as ComputeExpression, A as AggregateExpression } from './query.schema-B-LVNfyX.js';
|
|
2
2
|
import { CompiledIr, JsonValue } from '@niscorp/prism';
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
import { Sequence } from '@niscorp/strata';
|
|
4
5
|
|
|
5
6
|
type ScopeValues = Record<string, unknown>;
|
|
@@ -33,464 +34,6 @@ type ScopePolicy = {
|
|
|
33
34
|
entities: Record<string, ScopeEntityRule>;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
declare const ContextRefSchema: z.ZodObject<{
|
|
37
|
-
$context: z.ZodString;
|
|
38
|
-
}, z.core.$strict>;
|
|
39
|
-
declare const ScopeRefSchema: z.ZodObject<{
|
|
40
|
-
$scope: z.ZodString;
|
|
41
|
-
}, z.core.$strict>;
|
|
42
|
-
declare const FieldOrValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
43
|
-
$context: z.ZodString;
|
|
44
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
-
$scope: z.ZodString;
|
|
46
|
-
}, z.core.$strict>]>;
|
|
47
|
-
type ContextRef = z.infer<typeof ContextRefSchema>;
|
|
48
|
-
type ScopeRef = z.infer<typeof ScopeRefSchema>;
|
|
49
|
-
type FieldOrValue = z.infer<typeof FieldOrValueSchema>;
|
|
50
|
-
|
|
51
|
-
type ExistsQuery = {
|
|
52
|
-
from: string[];
|
|
53
|
-
filter?: Filter;
|
|
54
|
-
};
|
|
55
|
-
type Filter = {
|
|
56
|
-
exists: ExistsQuery;
|
|
57
|
-
} | {
|
|
58
|
-
eq: [FieldOrValue, FieldOrValue];
|
|
59
|
-
} | {
|
|
60
|
-
neq: [FieldOrValue, FieldOrValue];
|
|
61
|
-
} | {
|
|
62
|
-
gt: [FieldOrValue, FieldOrValue];
|
|
63
|
-
} | {
|
|
64
|
-
gte: [FieldOrValue, FieldOrValue];
|
|
65
|
-
} | {
|
|
66
|
-
lt: [FieldOrValue, FieldOrValue];
|
|
67
|
-
} | {
|
|
68
|
-
lte: [FieldOrValue, FieldOrValue];
|
|
69
|
-
} | {
|
|
70
|
-
in: [string, FieldOrValue[] | ContextRef | ScopeRef];
|
|
71
|
-
} | {
|
|
72
|
-
notIn: [string, FieldOrValue[] | ContextRef | ScopeRef];
|
|
73
|
-
} | {
|
|
74
|
-
like: [string, FieldOrValue];
|
|
75
|
-
} | {
|
|
76
|
-
ilike: [string, FieldOrValue];
|
|
77
|
-
} | {
|
|
78
|
-
isNull: string;
|
|
79
|
-
} | {
|
|
80
|
-
isNotNull: string;
|
|
81
|
-
} | {
|
|
82
|
-
and: Filter[];
|
|
83
|
-
} | {
|
|
84
|
-
or: Filter[];
|
|
85
|
-
} | {
|
|
86
|
-
not: Filter;
|
|
87
|
-
} | {
|
|
88
|
-
semantic: {
|
|
89
|
-
field: string;
|
|
90
|
-
query: ContextRef | ScopeRef;
|
|
91
|
-
minScore?: number;
|
|
92
|
-
};
|
|
93
|
-
} | {
|
|
94
|
-
fuzzy: {
|
|
95
|
-
field: string;
|
|
96
|
-
query: ContextRef | ScopeRef;
|
|
97
|
-
maxDistance?: number;
|
|
98
|
-
};
|
|
99
|
-
} | {
|
|
100
|
-
optional: {
|
|
101
|
-
key: string | string[];
|
|
102
|
-
then: Filter;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
declare const FilterSchema: z.ZodType<Filter>;
|
|
106
|
-
|
|
107
|
-
declare const ComputeExpressionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
108
|
-
add: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
109
|
-
$context: z.ZodString;
|
|
110
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
-
$scope: z.ZodString;
|
|
112
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
113
|
-
$context: z.ZodString;
|
|
114
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
115
|
-
$scope: z.ZodString;
|
|
116
|
-
}, z.core.$strict>]>], null>;
|
|
117
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
118
|
-
subtract: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
119
|
-
$context: z.ZodString;
|
|
120
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
121
|
-
$scope: z.ZodString;
|
|
122
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
123
|
-
$context: z.ZodString;
|
|
124
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
125
|
-
$scope: z.ZodString;
|
|
126
|
-
}, z.core.$strict>]>], null>;
|
|
127
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
128
|
-
multiply: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
129
|
-
$context: z.ZodString;
|
|
130
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
-
$scope: z.ZodString;
|
|
132
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
133
|
-
$context: z.ZodString;
|
|
134
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
135
|
-
$scope: z.ZodString;
|
|
136
|
-
}, z.core.$strict>]>], null>;
|
|
137
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
138
|
-
divide: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
139
|
-
$context: z.ZodString;
|
|
140
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
141
|
-
$scope: z.ZodString;
|
|
142
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
143
|
-
$context: z.ZodString;
|
|
144
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
145
|
-
$scope: z.ZodString;
|
|
146
|
-
}, z.core.$strict>]>], null>;
|
|
147
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
148
|
-
concat: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
149
|
-
$context: z.ZodString;
|
|
150
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
151
|
-
$scope: z.ZodString;
|
|
152
|
-
}, z.core.$strict>]>>;
|
|
153
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
154
|
-
coalesce: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
155
|
-
$context: z.ZodString;
|
|
156
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
157
|
-
$scope: z.ZodString;
|
|
158
|
-
}, z.core.$strict>]>>;
|
|
159
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
160
|
-
case: z.ZodObject<{
|
|
161
|
-
when: z.ZodArray<z.ZodObject<{
|
|
162
|
-
condition: z.ZodType<Filter, unknown, z.core.$ZodTypeInternals<Filter, unknown>>;
|
|
163
|
-
then: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
164
|
-
$context: z.ZodString;
|
|
165
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
166
|
-
$scope: z.ZodString;
|
|
167
|
-
}, z.core.$strict>]>;
|
|
168
|
-
}, z.core.$strict>>;
|
|
169
|
-
else: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
170
|
-
$context: z.ZodString;
|
|
171
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
172
|
-
$scope: z.ZodString;
|
|
173
|
-
}, z.core.$strict>]>;
|
|
174
|
-
}, z.core.$strict>;
|
|
175
|
-
}, z.core.$strict>]>;
|
|
176
|
-
type ComputeExpression = z.infer<typeof ComputeExpressionSchema>;
|
|
177
|
-
|
|
178
|
-
declare const AggregateExpressionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
179
|
-
count: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"*">]>;
|
|
180
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
-
countDistinct: z.ZodString;
|
|
182
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
183
|
-
sum: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
184
|
-
add: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
185
|
-
$context: z.ZodString;
|
|
186
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
187
|
-
$scope: z.ZodString;
|
|
188
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
189
|
-
$context: z.ZodString;
|
|
190
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
-
$scope: z.ZodString;
|
|
192
|
-
}, z.core.$strict>]>], null>;
|
|
193
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
194
|
-
subtract: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
195
|
-
$context: z.ZodString;
|
|
196
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
197
|
-
$scope: z.ZodString;
|
|
198
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
199
|
-
$context: z.ZodString;
|
|
200
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
201
|
-
$scope: z.ZodString;
|
|
202
|
-
}, z.core.$strict>]>], null>;
|
|
203
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
204
|
-
multiply: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
205
|
-
$context: z.ZodString;
|
|
206
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
207
|
-
$scope: z.ZodString;
|
|
208
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
209
|
-
$context: z.ZodString;
|
|
210
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
211
|
-
$scope: z.ZodString;
|
|
212
|
-
}, z.core.$strict>]>], null>;
|
|
213
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
214
|
-
divide: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
215
|
-
$context: z.ZodString;
|
|
216
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
217
|
-
$scope: z.ZodString;
|
|
218
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
219
|
-
$context: z.ZodString;
|
|
220
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
221
|
-
$scope: z.ZodString;
|
|
222
|
-
}, z.core.$strict>]>], null>;
|
|
223
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
224
|
-
concat: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
225
|
-
$context: z.ZodString;
|
|
226
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
227
|
-
$scope: z.ZodString;
|
|
228
|
-
}, z.core.$strict>]>>;
|
|
229
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
230
|
-
coalesce: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
231
|
-
$context: z.ZodString;
|
|
232
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
233
|
-
$scope: z.ZodString;
|
|
234
|
-
}, z.core.$strict>]>>;
|
|
235
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
236
|
-
case: z.ZodObject<{
|
|
237
|
-
when: z.ZodArray<z.ZodObject<{
|
|
238
|
-
condition: z.ZodType<Filter, unknown, z.core.$ZodTypeInternals<Filter, unknown>>;
|
|
239
|
-
then: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
240
|
-
$context: z.ZodString;
|
|
241
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
-
$scope: z.ZodString;
|
|
243
|
-
}, z.core.$strict>]>;
|
|
244
|
-
}, z.core.$strict>>;
|
|
245
|
-
else: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
246
|
-
$context: z.ZodString;
|
|
247
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
248
|
-
$scope: z.ZodString;
|
|
249
|
-
}, z.core.$strict>]>;
|
|
250
|
-
}, z.core.$strict>;
|
|
251
|
-
}, z.core.$strict>]>]>;
|
|
252
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
253
|
-
avg: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
254
|
-
add: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
255
|
-
$context: z.ZodString;
|
|
256
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
257
|
-
$scope: z.ZodString;
|
|
258
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
259
|
-
$context: z.ZodString;
|
|
260
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
261
|
-
$scope: z.ZodString;
|
|
262
|
-
}, z.core.$strict>]>], null>;
|
|
263
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
264
|
-
subtract: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
265
|
-
$context: z.ZodString;
|
|
266
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
267
|
-
$scope: z.ZodString;
|
|
268
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
269
|
-
$context: z.ZodString;
|
|
270
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
271
|
-
$scope: z.ZodString;
|
|
272
|
-
}, z.core.$strict>]>], null>;
|
|
273
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
274
|
-
multiply: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
275
|
-
$context: z.ZodString;
|
|
276
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
277
|
-
$scope: z.ZodString;
|
|
278
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
279
|
-
$context: z.ZodString;
|
|
280
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
281
|
-
$scope: z.ZodString;
|
|
282
|
-
}, z.core.$strict>]>], null>;
|
|
283
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
284
|
-
divide: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
285
|
-
$context: z.ZodString;
|
|
286
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
287
|
-
$scope: z.ZodString;
|
|
288
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
289
|
-
$context: z.ZodString;
|
|
290
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
291
|
-
$scope: z.ZodString;
|
|
292
|
-
}, z.core.$strict>]>], null>;
|
|
293
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
294
|
-
concat: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
295
|
-
$context: z.ZodString;
|
|
296
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
297
|
-
$scope: z.ZodString;
|
|
298
|
-
}, z.core.$strict>]>>;
|
|
299
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
300
|
-
coalesce: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
301
|
-
$context: z.ZodString;
|
|
302
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
303
|
-
$scope: z.ZodString;
|
|
304
|
-
}, z.core.$strict>]>>;
|
|
305
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
306
|
-
case: z.ZodObject<{
|
|
307
|
-
when: z.ZodArray<z.ZodObject<{
|
|
308
|
-
condition: z.ZodType<Filter, unknown, z.core.$ZodTypeInternals<Filter, unknown>>;
|
|
309
|
-
then: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
310
|
-
$context: z.ZodString;
|
|
311
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
312
|
-
$scope: z.ZodString;
|
|
313
|
-
}, z.core.$strict>]>;
|
|
314
|
-
}, z.core.$strict>>;
|
|
315
|
-
else: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
316
|
-
$context: z.ZodString;
|
|
317
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
318
|
-
$scope: z.ZodString;
|
|
319
|
-
}, z.core.$strict>]>;
|
|
320
|
-
}, z.core.$strict>;
|
|
321
|
-
}, z.core.$strict>]>]>;
|
|
322
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
323
|
-
min: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
324
|
-
add: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
325
|
-
$context: z.ZodString;
|
|
326
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
327
|
-
$scope: z.ZodString;
|
|
328
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
329
|
-
$context: z.ZodString;
|
|
330
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
331
|
-
$scope: z.ZodString;
|
|
332
|
-
}, z.core.$strict>]>], null>;
|
|
333
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
334
|
-
subtract: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
335
|
-
$context: z.ZodString;
|
|
336
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
337
|
-
$scope: z.ZodString;
|
|
338
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
339
|
-
$context: z.ZodString;
|
|
340
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
341
|
-
$scope: z.ZodString;
|
|
342
|
-
}, z.core.$strict>]>], null>;
|
|
343
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
344
|
-
multiply: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
345
|
-
$context: z.ZodString;
|
|
346
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
347
|
-
$scope: z.ZodString;
|
|
348
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
349
|
-
$context: z.ZodString;
|
|
350
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
351
|
-
$scope: z.ZodString;
|
|
352
|
-
}, z.core.$strict>]>], null>;
|
|
353
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
354
|
-
divide: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
355
|
-
$context: z.ZodString;
|
|
356
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
357
|
-
$scope: z.ZodString;
|
|
358
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
359
|
-
$context: z.ZodString;
|
|
360
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
361
|
-
$scope: z.ZodString;
|
|
362
|
-
}, z.core.$strict>]>], null>;
|
|
363
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
364
|
-
concat: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
365
|
-
$context: z.ZodString;
|
|
366
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
367
|
-
$scope: z.ZodString;
|
|
368
|
-
}, z.core.$strict>]>>;
|
|
369
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
370
|
-
coalesce: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
371
|
-
$context: z.ZodString;
|
|
372
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
373
|
-
$scope: z.ZodString;
|
|
374
|
-
}, z.core.$strict>]>>;
|
|
375
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
376
|
-
case: z.ZodObject<{
|
|
377
|
-
when: z.ZodArray<z.ZodObject<{
|
|
378
|
-
condition: z.ZodType<Filter, unknown, z.core.$ZodTypeInternals<Filter, unknown>>;
|
|
379
|
-
then: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
380
|
-
$context: z.ZodString;
|
|
381
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
382
|
-
$scope: z.ZodString;
|
|
383
|
-
}, z.core.$strict>]>;
|
|
384
|
-
}, z.core.$strict>>;
|
|
385
|
-
else: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
386
|
-
$context: z.ZodString;
|
|
387
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
388
|
-
$scope: z.ZodString;
|
|
389
|
-
}, z.core.$strict>]>;
|
|
390
|
-
}, z.core.$strict>;
|
|
391
|
-
}, z.core.$strict>]>]>;
|
|
392
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
393
|
-
max: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
394
|
-
add: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
395
|
-
$context: z.ZodString;
|
|
396
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
397
|
-
$scope: z.ZodString;
|
|
398
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
399
|
-
$context: z.ZodString;
|
|
400
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
401
|
-
$scope: z.ZodString;
|
|
402
|
-
}, z.core.$strict>]>], null>;
|
|
403
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
404
|
-
subtract: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
405
|
-
$context: z.ZodString;
|
|
406
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
407
|
-
$scope: z.ZodString;
|
|
408
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
409
|
-
$context: z.ZodString;
|
|
410
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
411
|
-
$scope: z.ZodString;
|
|
412
|
-
}, z.core.$strict>]>], null>;
|
|
413
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
414
|
-
multiply: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
415
|
-
$context: z.ZodString;
|
|
416
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
417
|
-
$scope: z.ZodString;
|
|
418
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
419
|
-
$context: z.ZodString;
|
|
420
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
421
|
-
$scope: z.ZodString;
|
|
422
|
-
}, z.core.$strict>]>], null>;
|
|
423
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
424
|
-
divide: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
425
|
-
$context: z.ZodString;
|
|
426
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
427
|
-
$scope: z.ZodString;
|
|
428
|
-
}, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
429
|
-
$context: z.ZodString;
|
|
430
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
431
|
-
$scope: z.ZodString;
|
|
432
|
-
}, z.core.$strict>]>], null>;
|
|
433
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
434
|
-
concat: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
435
|
-
$context: z.ZodString;
|
|
436
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
437
|
-
$scope: z.ZodString;
|
|
438
|
-
}, z.core.$strict>]>>;
|
|
439
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
440
|
-
coalesce: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
441
|
-
$context: z.ZodString;
|
|
442
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
443
|
-
$scope: z.ZodString;
|
|
444
|
-
}, z.core.$strict>]>>;
|
|
445
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
446
|
-
case: z.ZodObject<{
|
|
447
|
-
when: z.ZodArray<z.ZodObject<{
|
|
448
|
-
condition: z.ZodType<Filter, unknown, z.core.$ZodTypeInternals<Filter, unknown>>;
|
|
449
|
-
then: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
450
|
-
$context: z.ZodString;
|
|
451
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
452
|
-
$scope: z.ZodString;
|
|
453
|
-
}, z.core.$strict>]>;
|
|
454
|
-
}, z.core.$strict>>;
|
|
455
|
-
else: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
456
|
-
$context: z.ZodString;
|
|
457
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
458
|
-
$scope: z.ZodString;
|
|
459
|
-
}, z.core.$strict>]>;
|
|
460
|
-
}, z.core.$strict>;
|
|
461
|
-
}, z.core.$strict>]>]>;
|
|
462
|
-
}, z.core.$strict>]>;
|
|
463
|
-
type AggregateExpression = z.infer<typeof AggregateExpressionSchema>;
|
|
464
|
-
|
|
465
|
-
declare const SortEntrySchema: z.ZodObject<{
|
|
466
|
-
field: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
467
|
-
dir: z.ZodDefault<z.ZodEnum<{
|
|
468
|
-
asc: "asc";
|
|
469
|
-
desc: "desc";
|
|
470
|
-
}>>;
|
|
471
|
-
}, z.core.$strict>;
|
|
472
|
-
type SortEntry = z.infer<typeof SortEntrySchema>;
|
|
473
|
-
type Source = string | {
|
|
474
|
-
as: string;
|
|
475
|
-
query: Query;
|
|
476
|
-
};
|
|
477
|
-
type FieldRef = string | {
|
|
478
|
-
field: string;
|
|
479
|
-
as: string;
|
|
480
|
-
};
|
|
481
|
-
type Query = {
|
|
482
|
-
from: Source[];
|
|
483
|
-
fields?: FieldRef[];
|
|
484
|
-
filter?: Filter;
|
|
485
|
-
compute?: Record<string, ComputeExpression>;
|
|
486
|
-
aggregate?: Record<string, AggregateExpression>;
|
|
487
|
-
groupBy?: string[];
|
|
488
|
-
sort?: SortEntry[];
|
|
489
|
-
limit?: number;
|
|
490
|
-
distinct?: boolean;
|
|
491
|
-
};
|
|
492
|
-
declare const QuerySchema: z.ZodType<Query>;
|
|
493
|
-
|
|
494
37
|
declare const MutationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
495
38
|
op: z.ZodLiteral<"insert">;
|
|
496
39
|
table: z.ZodString;
|
|
@@ -876,6 +419,7 @@ type OkCacheEntry = CacheEntryMeta & {
|
|
|
876
419
|
kind: 'ok';
|
|
877
420
|
dsl: Query;
|
|
878
421
|
prismIr?: CompiledIr;
|
|
422
|
+
mapping?: unknown;
|
|
879
423
|
/**
|
|
880
424
|
* The scope profile this read is served at, whatever the caller's roles say:
|
|
881
425
|
* roles merge to the widest reach any of them grants, which is wrong for a
|
|
@@ -895,7 +439,7 @@ type MutationCacheEntry = CacheEntryMeta & {
|
|
|
895
439
|
};
|
|
896
440
|
type CacheEntry = OkCacheEntry | UnsatisfiableCacheEntry | MutationCacheEntry;
|
|
897
441
|
type CacheBackend = {
|
|
898
|
-
get: (key: string) => Promise<CacheEntry | undefined>;
|
|
442
|
+
get: (key: string, scope?: ScopeValues) => Promise<CacheEntry | undefined>;
|
|
899
443
|
set: (key: string, entry: CacheEntry) => Promise<void>;
|
|
900
444
|
delete: (key: string) => Promise<void>;
|
|
901
445
|
clear: () => Promise<void>;
|
|
@@ -1361,9 +905,13 @@ type ScopeBinding = {
|
|
|
1361
905
|
key: string;
|
|
1362
906
|
};
|
|
1363
907
|
type GenerateDsl = (request: QueryRequest, schema: DatabaseSchema, caller: GenerationCaller) => Promise<Query>;
|
|
1364
|
-
/**
|
|
1365
|
-
|
|
908
|
+
/**
|
|
909
|
+
* The IR is replayed against an envelope whose `result` is the rows for an array shape, the first row for any other.
|
|
910
|
+
* `config` is the prism config the IR was compiled from: a compiled form cannot be read back, or upgraded when prism changes.
|
|
911
|
+
*/
|
|
912
|
+
type MapToShape = (rows: Row[], shape: unknown, intent?: string) => Promise<{
|
|
1366
913
|
ir: CompiledIr;
|
|
914
|
+
config: unknown;
|
|
1367
915
|
transformed: JsonValue;
|
|
1368
916
|
}>;
|
|
1369
917
|
type QueryEngineConfig = {
|
|
@@ -1419,4 +967,4 @@ type ExecuteOptions = {
|
|
|
1419
967
|
onChange?: (response: QueryResponse) => void;
|
|
1420
968
|
};
|
|
1421
969
|
|
|
1422
|
-
export {
|
|
970
|
+
export { type ResolvedSemantic as $, type AnalysisConfig as A, type BoundParams as B, type CompiledQuery as C, type DatabaseSchema as D, type EntitySchema as E, type FieldSchema as F, type GenerateDsl as G, type QueryErrorResponse as H, type IndexSchema as I, type QueryRequest as J, QueryRequestSchema as K, type LiveRowsConfig as L, type MutationDefinition as M, type NamedScopeBehaviors as N, type OkCacheEntry as O, type ParamSlot as P, type QueryEngineConfig as Q, type ResolvedQuery as R, type ScopePolicy as S, type QueryResponse as T, REFRESH_MODES as U, type RelationSchema as V, type ResolvedField as W, type ResolvedFilter as X, type ResolvedJoin as Y, type ResolvedMutation as Z, type ResolvedOnConflict as _, type QueryEngine as a, type ResolvedSource as a0, type ReturnedRef as a1, SCOPE_VERBS as a2, type ScopeBehaviors as a3, type ScopeBinding as a4, type ScopeEntityRule as a5, type ScopeMatch as a6, type ScopeRule as a7, type ScopeRules as a8, type ScopeSet as a9, type ScopeValues as aa, type TestResult as ab, type UnsatisfiableCacheEntry as ac, type VexEvent as ad, type VexEventHandler as ae, createScopePolicy as af, isRefresh as ag, mergeScopePolicies as ah, scopeBindings as ai, scopeGrants as aj, scopeProfiles as ak, type AnalysisResult as b, type ContextMeta as c, type DatabaseAdapter as d, type Row as e, type ResolvedExists as f, type QueryErrorCode as g, type CacheBackend as h, type CacheEntry as i, type Refresh as j, type ContextContract as k, type AdapterCapabilities as l, type CoreMutation as m, type ExecuteOptions as n, type GenerationCaller as o, type IntrospectOptions as p, type ItemRef as q, type LiveRowsStats as r, type LookupValue as s, type MapToShape as t, type Mutation as u, type MutationCacheEntry as v, MutationDefinitionSchema as w, MutationSchema as x, type MutationValue as y, type NormalizedType as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niscorp/vex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Declarative query synthesis — intent to SQL with caching and scope policies",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -31,6 +31,16 @@
|
|
|
31
31
|
"default": "./dist/agent/index.cjs"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
+
"./migrations": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/migrations/index.d.ts",
|
|
37
|
+
"default": "./dist/migrations/index.js"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/migrations/index.d.cts",
|
|
41
|
+
"default": "./dist/migrations/index.cjs"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
34
44
|
"./hono": {
|
|
35
45
|
"import": {
|
|
36
46
|
"types": "./dist/adapters/hono/index.d.ts",
|
|
@@ -94,6 +104,7 @@
|
|
|
94
104
|
"zod": "^4.6.5",
|
|
95
105
|
"@niscorp/cortex": "^0.1.4",
|
|
96
106
|
"@niscorp/prism": "^0.3.1",
|
|
107
|
+
"@niscorp/signal": "^0.1.5",
|
|
97
108
|
"@niscorp/strata": "^0.1.7"
|
|
98
109
|
},
|
|
99
110
|
"peerDependenciesMeta": {
|