@jarenjs/json 0.9.2 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +86 -13
- package/README.md +248 -23
- package/dist/types/canonical.d.ts +37 -0
- package/dist/types/cow.d.ts +28 -0
- package/dist/types/errors.d.ts +45 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/jslt/errors.d.ts +15 -8
- package/dist/types/jslt/index.d.ts +22 -0
- package/dist/types/jslt/packs/finance.d.ts +119 -0
- package/dist/types/jslt/packs/index.d.ts +310 -0
- package/dist/types/jslt/packs/math.d.ts +159 -0
- package/dist/types/jslt/packs/stats.d.ts +48 -0
- package/dist/types/jslt/registry.d.ts +65 -0
- package/dist/types/jtlt/errors.d.ts +3 -6
- package/dist/types/option-variants.d.ts +29 -0
- package/dist/types/patch.d.ts +214 -0
- package/dist/types/path.d.ts +139 -9
- package/dist/types/pointer.d.ts +100 -9
- package/dist/types/query/compile.d.ts +12 -0
- package/dist/types/query/errors.d.ts +72 -8
- package/dist/types/query/index.d.ts +317 -25
- package/dist/types/query/normalize.d.ts +24 -0
- package/dist/types/query/operators.d.ts +241 -1
- package/dist/types/query/runtime.d.ts +5 -8
- package/dist/types/query/types.d.ts +34 -0
- package/dist/types/segments.d.ts +31 -0
- package/dist/types/write.d.ts +204 -0
- package/dist/types/xquery/parse.d.ts +2 -3
- package/docs/JSLT-FORMAT.md +74 -3
- package/docs/JSLT-PRELUDE.md +1 -1
- package/docs/QUERY-FORMAT.md +695 -33
- package/package.json +18 -4
- package/schemas/geojson.draft-07.schema.json +323 -0
- package/schemas/geojson.jaren.schema.json +863 -0
- package/schemas/geojson.schema.json +172 -0
- package/schemas/jaren-jslt.authoring.schema.json +142 -0
- package/schemas/jaren-jslt.draft-07.schema.json +152 -11
- package/schemas/jaren-jslt.llm-profile.schema.json +782 -0
- package/schemas/jaren-jslt.schema.json +152 -11
- package/schemas/jaren-query.draft-07.schema.json +152 -11
- package/schemas/jaren-query.llm-profile.schema.json +619 -0
- package/schemas/jaren-query.schema.json +82 -15
- package/src/basic.js +1 -1
- package/src/canonical.js +170 -0
- package/src/cow.js +106 -0
- package/src/errors.js +68 -0
- package/src/index.js +3 -0
- package/src/jslt/dispatch.js +178 -28
- package/src/jslt/errors.js +19 -14
- package/src/jslt/index.js +37 -29
- package/src/jslt/packs/finance.js +49 -0
- package/src/jslt/packs/index.js +18 -0
- package/src/jslt/packs/math.js +46 -0
- package/src/jslt/packs/stats.js +65 -0
- package/src/jslt/registry.js +200 -0
- package/src/jslt/stylesheet.js +14 -23
- package/src/jtlt/desugar.js +2 -3
- package/src/jtlt/errors.js +6 -12
- package/src/jtlt/index.js +12 -29
- package/src/jtlt/template.js +9 -18
- package/src/option-variants.js +54 -0
- package/src/patch.js +1052 -0
- package/src/path.js +319 -52
- package/src/pointer.js +225 -44
- package/src/query/compile.js +790 -75
- package/src/query/errors.js +72 -12
- package/src/query/index.js +274 -42
- package/src/query/normalize.js +489 -78
- package/src/query/operators.js +620 -23
- package/src/query/runtime.js +5 -19
- package/src/query/types.js +213 -0
- package/src/segments.js +409 -64
- package/src/write.js +660 -0
- package/src/xquery/parse.js +37 -53
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://jarenjs.dev/schemas/jaren-query/0.1/llm-profile",
|
|
4
|
+
"title": "Jaren JSON Query format 0.1 (LLM profile)",
|
|
5
|
+
"description": "LLM-profile relaxation of the canonical grammar for provider structured-output subsets that do not enforce patternProperties, propertyNames or asserted formats. Every canonical-valid document validates here; the reverse is NOT guaranteed - always validate generated documents against the canonical schema locally before compiling. Structural grammar of Jaren JSON Query documents (see packages/json/docs/QUERY-FORMAT.md). This schema is structural validation only: the compiler remains authoritative for semantic rules it cannot express - FLWOR clause keys apply in the fixed semantic order $for, $let, $as, $where, $groupby, $orderby, $count, $return regardless of JSON key order; variable scoping, duplicate-binding detection, external-parameter collection and $as name binding are compiler rules (JQ0005/JQ0007); variable-rooted path strings are only head-checked here (full RFC 9535 segment grammar is JQ0004); embedded JSON Schema literals are taken verbatim and never meta-validated here (the type-test compiler is authoritative, JQ0008/JQ0009); per-argument runtime typing is JQ2xxx. Authored in a draft-neutral keyword subset; the draft-07 twin is a mechanical derivation.",
|
|
6
|
+
"allOf": [
|
|
7
|
+
{
|
|
8
|
+
"$ref": "#/$defs/queryDocument"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"$defs": {
|
|
12
|
+
"queryDocument": {
|
|
13
|
+
"description": "A query document is either the version envelope or a bare expression (a bare RFC 9535 JSONPath string is the degenerate query).",
|
|
14
|
+
"anyOf": [
|
|
15
|
+
{
|
|
16
|
+
"$ref": "#/$defs/versionEnvelope"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"$ref": "#/$defs/expression"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"versionEnvelope": {
|
|
24
|
+
"description": "Top-level version envelope. Only recognized at the top level of a query document.",
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"$query": {
|
|
28
|
+
"const": "0.1"
|
|
29
|
+
},
|
|
30
|
+
"$expr": {
|
|
31
|
+
"$ref": "#/$defs/expression"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"$query",
|
|
36
|
+
"$expr"
|
|
37
|
+
],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"expression": {
|
|
41
|
+
"description": "Any expression per the encoding rules: scalars are literals, strings split on the leading '$', arrays are array constructors, objects partition into map constructors (no $-prefixed key) and operator phrases (all keys $-prefixed).",
|
|
42
|
+
"anyOf": [
|
|
43
|
+
{
|
|
44
|
+
"$ref": "#/$defs/scalarLiteral"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"$ref": "#/$defs/stringExpression"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"$ref": "#/$defs/arrayConstructor"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"$ref": "#/$defs/objectExpression"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"scalarLiteral": {
|
|
58
|
+
"description": "Numbers, booleans and null are literal items.",
|
|
59
|
+
"type": [
|
|
60
|
+
"null",
|
|
61
|
+
"boolean",
|
|
62
|
+
"number"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"stringExpression": {
|
|
66
|
+
"description": "Rule 2: a string starting with '$' is a query expression ('$$' escapes a literal); any other string is a literal.",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"anyOf": [
|
|
69
|
+
{
|
|
70
|
+
"$ref": "#/$defs/literalString"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"$ref": "#/$defs/escapedStringLiteral"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"$ref": "#/$defs/absolutePathString"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"$ref": "#/$defs/variablePathString"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"literalString": {
|
|
84
|
+
"description": "A string that does not start with '$' denotes itself.",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"pattern": "^([^$]|$)"
|
|
87
|
+
},
|
|
88
|
+
"escapedStringLiteral": {
|
|
89
|
+
"description": "A string starting with '$$' denotes the literal string with one leading '$' dropped.",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"pattern": "^\\$\\$"
|
|
92
|
+
},
|
|
93
|
+
"absolutePathString": {
|
|
94
|
+
"description": "An absolute RFC 9535 JSONPath query rooted at the input document: '$' alone or starting '$.', '$[' or '$..'. The json-path format asserts the full RFC 9535 grammar where format assertion is enabled (format is annotation-only by default from draft 2020-12). (LLM profile: the 'json-path' format assertion is relaxed here; the canonical schema enforces it)",
|
|
95
|
+
"type": "string",
|
|
96
|
+
"pattern": "^\\$($|[.\\[])"
|
|
97
|
+
},
|
|
98
|
+
"variablePathString": {
|
|
99
|
+
"description": "A variable-rooted path: '$name' with name matching [A-Za-z_][A-Za-z0-9_]*, optionally followed by RFC 9535 segments. The pattern checks the head; the json-path-segments format asserts the full segment grammar where format assertion is enabled (the compiler enforces it either way, JQ0004). (LLM profile: the 'json-path-segments' format assertion is relaxed here; the canonical schema enforces it)",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"pattern": "^\\$[A-Za-z_][A-Za-z0-9_]*($|[.\\[])"
|
|
102
|
+
},
|
|
103
|
+
"arrayConstructor": {
|
|
104
|
+
"description": "An array in expression position constructs an array; element results are concatenated per XQuery sequence flattening.",
|
|
105
|
+
"type": "array",
|
|
106
|
+
"items": {
|
|
107
|
+
"$ref": "#/$defs/expression"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"objectExpression": {
|
|
111
|
+
"description": "Rule 1: objects partition by $-prefixed keys. A mixed object matches neither branch and is invalid (JQ0001).",
|
|
112
|
+
"anyOf": [
|
|
113
|
+
{
|
|
114
|
+
"$ref": "#/$defs/mapConstructor"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"$ref": "#/$defs/constPhrase"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"$ref": "#/$defs/mapPhrase"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"$ref": "#/$defs/callPhrase"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"$ref": "#/$defs/flworPhrase"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"$ref": "#/$defs/somePhrase"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"$ref": "#/$defs/everyPhrase"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"$ref": "#/$defs/unaryOperatorPhrase"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"$ref": "#/$defs/binaryOperatorPhrase"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"$ref": "#/$defs/variadicOperatorPhrase"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"$ref": "#/$defs/nonEmptyVariadicOperatorPhrase"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"$ref": "#/$defs/conditionalArityOperatorPhrase"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"$ref": "#/$defs/stringJoinPhrase"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"$ref": "#/$defs/geohashPhrase"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"$ref": "#/$defs/ternaryOperatorPhrase"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"$ref": "#/$defs/replacePhrase"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"$ref": "#/$defs/schemaOperatorPhrase"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
"mapConstructor": {
|
|
167
|
+
"description": "An object with no $-prefixed key: keys are literal member names, values are expressions. Use $map or $const for member names that start with '$'. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
168
|
+
"type": "object",
|
|
169
|
+
"additionalProperties": {
|
|
170
|
+
"$ref": "#/$defs/expression"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"constPhrase": {
|
|
174
|
+
"description": "Quote: the value is returned verbatim, nothing inside is evaluated.",
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"$const": true
|
|
178
|
+
},
|
|
179
|
+
"required": [
|
|
180
|
+
"$const"
|
|
181
|
+
],
|
|
182
|
+
"additionalProperties": false
|
|
183
|
+
},
|
|
184
|
+
"mapPhrase": {
|
|
185
|
+
"description": "General map constructor for computed keys or keys starting with '$'. Each entry is a [keyExpr, valueExpr] pair; keyExpr must evaluate to a single string at runtime (JQ2004); later pairs win on duplicate keys.",
|
|
186
|
+
"type": "object",
|
|
187
|
+
"properties": {
|
|
188
|
+
"$map": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": {
|
|
191
|
+
"$ref": "#/$defs/mapEntry"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"required": [
|
|
196
|
+
"$map"
|
|
197
|
+
],
|
|
198
|
+
"additionalProperties": false
|
|
199
|
+
},
|
|
200
|
+
"mapEntry": {
|
|
201
|
+
"description": "One [keyExpr, valueExpr] pair of a $map phrase.",
|
|
202
|
+
"type": "array",
|
|
203
|
+
"items": {
|
|
204
|
+
"$ref": "#/$defs/expression"
|
|
205
|
+
},
|
|
206
|
+
"minItems": 2,
|
|
207
|
+
"maxItems": 2
|
|
208
|
+
},
|
|
209
|
+
"callPhrase": {
|
|
210
|
+
"description": "A registered trusted host function call: ['name', ...argument expressions]. The name must be registered at compile time (options.functions, JQ0010); sequences cross the boundary as arrays, a returned undefined is the empty sequence, a throwing function is JQ2010.",
|
|
211
|
+
"type": "object",
|
|
212
|
+
"properties": {
|
|
213
|
+
"$call": {
|
|
214
|
+
"type": "array",
|
|
215
|
+
"minItems": 1,
|
|
216
|
+
"prefixItems": [
|
|
217
|
+
{
|
|
218
|
+
"type": "string",
|
|
219
|
+
"minLength": 1
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"items": {
|
|
223
|
+
"$ref": "#/$defs/expression"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"required": [
|
|
228
|
+
"$call"
|
|
229
|
+
],
|
|
230
|
+
"additionalProperties": false
|
|
231
|
+
},
|
|
232
|
+
"flworPhrase": {
|
|
233
|
+
"description": "FLWOR phrase. Clauses apply in the fixed semantic order $fold, $for, $let, $as, $where, $groupby, $orderby, $count, $return regardless of JSON key order (D7); interleavings are expressed by nesting phrases. $return is required, plus at least one of $fold/$for/$let. With $fold the phrase evaluates to the final accumulator instead of the collected $return sequence.",
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"$fold": {
|
|
237
|
+
"$ref": "#/$defs/foldBinding"
|
|
238
|
+
},
|
|
239
|
+
"$for": {
|
|
240
|
+
"$ref": "#/$defs/forBindings"
|
|
241
|
+
},
|
|
242
|
+
"$let": {
|
|
243
|
+
"$ref": "#/$defs/bindingMap"
|
|
244
|
+
},
|
|
245
|
+
"$as": {
|
|
246
|
+
"$ref": "#/$defs/asClause"
|
|
247
|
+
},
|
|
248
|
+
"$where": {
|
|
249
|
+
"$ref": "#/$defs/expression"
|
|
250
|
+
},
|
|
251
|
+
"$groupby": {
|
|
252
|
+
"$ref": "#/$defs/bindingMap"
|
|
253
|
+
},
|
|
254
|
+
"$orderby": {
|
|
255
|
+
"$ref": "#/$defs/orderBySpec"
|
|
256
|
+
},
|
|
257
|
+
"$count": {
|
|
258
|
+
"$ref": "#/$defs/variableName"
|
|
259
|
+
},
|
|
260
|
+
"$return": {
|
|
261
|
+
"$ref": "#/$defs/expression"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"required": [
|
|
265
|
+
"$return"
|
|
266
|
+
],
|
|
267
|
+
"anyOf": [
|
|
268
|
+
{
|
|
269
|
+
"required": [
|
|
270
|
+
"$for"
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"required": [
|
|
275
|
+
"$let"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"required": [
|
|
280
|
+
"$fold"
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"additionalProperties": false
|
|
285
|
+
},
|
|
286
|
+
"foldBinding": {
|
|
287
|
+
"description": "The $fold accumulator: exactly one variable name mapped to the accumulator's initial value, evaluated once in the enclosing scope before the tuple stream starts. $return then names the accumulator's next value per surviving tuple. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
288
|
+
"type": "object",
|
|
289
|
+
"minProperties": 1,
|
|
290
|
+
"maxProperties": 1,
|
|
291
|
+
"additionalProperties": {
|
|
292
|
+
"$ref": "#/$defs/expression"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"variableName": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
298
|
+
},
|
|
299
|
+
"forBindings": {
|
|
300
|
+
"description": "Iteration bindings: variable name to source expression or extended $in binding. Bindings nest left-to-right in document key order and may be correlated; key-order-hostile producers should nest phrases instead. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
301
|
+
"type": "object",
|
|
302
|
+
"minProperties": 1,
|
|
303
|
+
"additionalProperties": {
|
|
304
|
+
"$ref": "#/$defs/forSource"
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"forSource": {
|
|
308
|
+
"anyOf": [
|
|
309
|
+
{
|
|
310
|
+
"$ref": "#/$defs/expression"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"$ref": "#/$defs/extendedForBinding"
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
"extendedForBinding": {
|
|
318
|
+
"description": "Extended $for binding. $in is the source; $at binds the 0-based (D6) position variable; $allowing-empty emits one tuple with the variable bound to the empty sequence (position -1) when the source yields no tuple; $window with $size, and optionally $step, iterates tumbling or sliding windows instead of items. Only $in is structurally required: the compiler rejects $size/$step without $window, and $window without $size (JQ0003).",
|
|
319
|
+
"type": "object",
|
|
320
|
+
"properties": {
|
|
321
|
+
"$in": {
|
|
322
|
+
"$ref": "#/$defs/expression"
|
|
323
|
+
},
|
|
324
|
+
"$at": {
|
|
325
|
+
"$ref": "#/$defs/variableName"
|
|
326
|
+
},
|
|
327
|
+
"$allowing-empty": {
|
|
328
|
+
"type": "boolean"
|
|
329
|
+
},
|
|
330
|
+
"$window": {
|
|
331
|
+
"enum": [
|
|
332
|
+
"tumbling",
|
|
333
|
+
"sliding"
|
|
334
|
+
]
|
|
335
|
+
},
|
|
336
|
+
"$size": {
|
|
337
|
+
"type": "integer",
|
|
338
|
+
"minimum": 1
|
|
339
|
+
},
|
|
340
|
+
"$step": {
|
|
341
|
+
"type": "integer",
|
|
342
|
+
"minimum": 1
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"required": [
|
|
346
|
+
"$in"
|
|
347
|
+
],
|
|
348
|
+
"additionalProperties": false
|
|
349
|
+
},
|
|
350
|
+
"bindingMap": {
|
|
351
|
+
"description": "Variable name to expression map, used by $let, $groupby and quantifier bindings. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
352
|
+
"type": "object",
|
|
353
|
+
"minProperties": 1,
|
|
354
|
+
"additionalProperties": {
|
|
355
|
+
"$ref": "#/$defs/expression"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"orderBySpec": {
|
|
359
|
+
"description": "A single key spec or a major-to-minor list of key specs. An array value is by specification ALWAYS a list of key specs, so the single form excludes arrays; write a single array-constructor key as {\"$key\": [...]}.",
|
|
360
|
+
"anyOf": [
|
|
361
|
+
{
|
|
362
|
+
"$ref": "#/$defs/singleOrderByKey"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"type": "array",
|
|
366
|
+
"items": {
|
|
367
|
+
"$ref": "#/$defs/orderByKey"
|
|
368
|
+
},
|
|
369
|
+
"minItems": 1
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
"singleOrderByKey": {
|
|
374
|
+
"description": "A key spec in non-list position: any non-array expression, or the explicit {$key, $dir, $empty} form.",
|
|
375
|
+
"anyOf": [
|
|
376
|
+
{
|
|
377
|
+
"$ref": "#/$defs/scalarLiteral"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"$ref": "#/$defs/stringExpression"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"$ref": "#/$defs/objectExpression"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"$ref": "#/$defs/orderByKeySpec"
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
"orderByKey": {
|
|
391
|
+
"anyOf": [
|
|
392
|
+
{
|
|
393
|
+
"$ref": "#/$defs/expression"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"$ref": "#/$defs/orderByKeySpec"
|
|
397
|
+
}
|
|
398
|
+
]
|
|
399
|
+
},
|
|
400
|
+
"orderByKeySpec": {
|
|
401
|
+
"description": "Explicit order key: direction defaults to 'asc', empty-sequence placement to 'least'. A $collation names a registered pure compare function (options.collations, JQ0010) applied to string keys; the default stays code-point order.",
|
|
402
|
+
"type": "object",
|
|
403
|
+
"properties": {
|
|
404
|
+
"$key": {
|
|
405
|
+
"$ref": "#/$defs/expression"
|
|
406
|
+
},
|
|
407
|
+
"$dir": {
|
|
408
|
+
"enum": [
|
|
409
|
+
"asc",
|
|
410
|
+
"desc"
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
"$empty": {
|
|
414
|
+
"enum": [
|
|
415
|
+
"least",
|
|
416
|
+
"greatest"
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
"$collation": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"minLength": 1
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"required": [
|
|
425
|
+
"$key"
|
|
426
|
+
],
|
|
427
|
+
"additionalProperties": false
|
|
428
|
+
},
|
|
429
|
+
"somePhrase": {
|
|
430
|
+
"description": "Existential quantifier: true iff some binding tuple satisfies the EBV of $satisfies; short-circuits.",
|
|
431
|
+
"type": "object",
|
|
432
|
+
"properties": {
|
|
433
|
+
"$some": {
|
|
434
|
+
"$ref": "#/$defs/bindingMap"
|
|
435
|
+
},
|
|
436
|
+
"$satisfies": {
|
|
437
|
+
"$ref": "#/$defs/expression"
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"required": [
|
|
441
|
+
"$some",
|
|
442
|
+
"$satisfies"
|
|
443
|
+
],
|
|
444
|
+
"additionalProperties": false
|
|
445
|
+
},
|
|
446
|
+
"everyPhrase": {
|
|
447
|
+
"description": "Universal quantifier: true iff every binding tuple satisfies the EBV of $satisfies; short-circuits.",
|
|
448
|
+
"type": "object",
|
|
449
|
+
"properties": {
|
|
450
|
+
"$every": {
|
|
451
|
+
"$ref": "#/$defs/bindingMap"
|
|
452
|
+
},
|
|
453
|
+
"$satisfies": {
|
|
454
|
+
"$ref": "#/$defs/expression"
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
"required": [
|
|
458
|
+
"$every",
|
|
459
|
+
"$satisfies"
|
|
460
|
+
],
|
|
461
|
+
"additionalProperties": false
|
|
462
|
+
},
|
|
463
|
+
"unaryOperatorPhrase": {
|
|
464
|
+
"description": "Operators whose value is a single operand expression. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
465
|
+
"type": "object",
|
|
466
|
+
"minProperties": 1,
|
|
467
|
+
"maxProperties": 1,
|
|
468
|
+
"additionalProperties": {
|
|
469
|
+
"$ref": "#/$defs/expression"
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
"binaryOperatorPhrase": {
|
|
473
|
+
"description": "Operators whose value is an array of exactly two operand expressions. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
474
|
+
"type": "object",
|
|
475
|
+
"minProperties": 1,
|
|
476
|
+
"maxProperties": 1,
|
|
477
|
+
"additionalProperties": {
|
|
478
|
+
"type": "array",
|
|
479
|
+
"items": {
|
|
480
|
+
"$ref": "#/$defs/expression"
|
|
481
|
+
},
|
|
482
|
+
"minItems": 2,
|
|
483
|
+
"maxItems": 2
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
"variadicOperatorPhrase": {
|
|
487
|
+
"description": "Variadic operators accepting zero or more operand expressions. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
488
|
+
"type": "object",
|
|
489
|
+
"minProperties": 1,
|
|
490
|
+
"maxProperties": 1,
|
|
491
|
+
"additionalProperties": {
|
|
492
|
+
"type": "array",
|
|
493
|
+
"items": {
|
|
494
|
+
"$ref": "#/$defs/expression"
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
"nonEmptyVariadicOperatorPhrase": {
|
|
499
|
+
"description": "Variadic operators requiring at least one operand expression. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
500
|
+
"type": "object",
|
|
501
|
+
"minProperties": 1,
|
|
502
|
+
"maxProperties": 1,
|
|
503
|
+
"additionalProperties": {
|
|
504
|
+
"type": "array",
|
|
505
|
+
"items": {
|
|
506
|
+
"$ref": "#/$defs/expression"
|
|
507
|
+
},
|
|
508
|
+
"minItems": 1
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
"conditionalArityOperatorPhrase": {
|
|
512
|
+
"description": "Operators taking two or three operand expressions: $if [cond, then, else?], $substring [str, start, len?], $subsequence [seq, start, len?], $date-add / $date-sub [date, duration] or [date, amount, unit]. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
513
|
+
"type": "object",
|
|
514
|
+
"minProperties": 1,
|
|
515
|
+
"maxProperties": 1,
|
|
516
|
+
"additionalProperties": {
|
|
517
|
+
"type": "array",
|
|
518
|
+
"items": {
|
|
519
|
+
"$ref": "#/$defs/expression"
|
|
520
|
+
},
|
|
521
|
+
"minItems": 2,
|
|
522
|
+
"maxItems": 3
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
"geohashPhrase": {
|
|
526
|
+
"description": "$geohash [value] or [value, precision]: a GeoJSON value as a base-32 cell string. Precision is an integer from 1 to 12 (default 9); a value that is not a bare position is represented by its centroid.",
|
|
527
|
+
"type": "object",
|
|
528
|
+
"properties": {
|
|
529
|
+
"$geohash": {
|
|
530
|
+
"type": "array",
|
|
531
|
+
"items": {
|
|
532
|
+
"$ref": "#/$defs/expression"
|
|
533
|
+
},
|
|
534
|
+
"minItems": 1,
|
|
535
|
+
"maxItems": 2
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
"required": [
|
|
539
|
+
"$geohash"
|
|
540
|
+
],
|
|
541
|
+
"additionalProperties": false
|
|
542
|
+
},
|
|
543
|
+
"stringJoinPhrase": {
|
|
544
|
+
"description": "$string-join [seq, separator?]: one or two operand expressions.",
|
|
545
|
+
"type": "object",
|
|
546
|
+
"properties": {
|
|
547
|
+
"$string-join": {
|
|
548
|
+
"type": "array",
|
|
549
|
+
"items": {
|
|
550
|
+
"$ref": "#/$defs/expression"
|
|
551
|
+
},
|
|
552
|
+
"minItems": 1,
|
|
553
|
+
"maxItems": 2
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
"required": [
|
|
557
|
+
"$string-join"
|
|
558
|
+
],
|
|
559
|
+
"additionalProperties": false
|
|
560
|
+
},
|
|
561
|
+
"ternaryOperatorPhrase": {
|
|
562
|
+
"description": "Operators whose value is an array of exactly three operand expressions: $date-diff [from, to, unit]. (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
563
|
+
"type": "object",
|
|
564
|
+
"minProperties": 1,
|
|
565
|
+
"maxProperties": 1,
|
|
566
|
+
"additionalProperties": {
|
|
567
|
+
"type": "array",
|
|
568
|
+
"items": {
|
|
569
|
+
"$ref": "#/$defs/expression"
|
|
570
|
+
},
|
|
571
|
+
"minItems": 3,
|
|
572
|
+
"maxItems": 3
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
"replacePhrase": {
|
|
576
|
+
"description": "$replace [input, pattern, replacement]: exactly three operand expressions (I-Regexp has no flags argument, D5).",
|
|
577
|
+
"type": "object",
|
|
578
|
+
"properties": {
|
|
579
|
+
"$replace": {
|
|
580
|
+
"type": "array",
|
|
581
|
+
"items": {
|
|
582
|
+
"$ref": "#/$defs/expression"
|
|
583
|
+
},
|
|
584
|
+
"minItems": 3,
|
|
585
|
+
"maxItems": 3
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
"required": [
|
|
589
|
+
"$replace"
|
|
590
|
+
],
|
|
591
|
+
"additionalProperties": false
|
|
592
|
+
},
|
|
593
|
+
"schemaLiteral": {
|
|
594
|
+
"description": "A JSON Schema literal, taken verbatim - never interpreted as a query expression, so JSON Schema's $-prefixed keywords ($ref, $defs, ...) do not collide with Rule 1. Deliberately unconstrained (a true schema is draft-neutral by definition): embedded schemas are not meta-validated by this artifact; the consumer's type-test compiler is authoritative (JQ0009)."
|
|
595
|
+
},
|
|
596
|
+
"schemaOperatorPhrase": {
|
|
597
|
+
"description": "Schema operators $valid/$assert: [expr, schema] - exactly two elements, an operand expression and a verbatim JSON Schema literal. Tuple validation is outside the draft-neutral subset, so both positions validate uniformly as schema literals here; the operand position is normalized as an ordinary expression by the compiler (JQ0xxx). (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
598
|
+
"type": "object",
|
|
599
|
+
"minProperties": 1,
|
|
600
|
+
"maxProperties": 1,
|
|
601
|
+
"additionalProperties": {
|
|
602
|
+
"type": "array",
|
|
603
|
+
"items": {
|
|
604
|
+
"$ref": "#/$defs/schemaLiteral"
|
|
605
|
+
},
|
|
606
|
+
"minItems": 2,
|
|
607
|
+
"maxItems": 2
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
"asClause": {
|
|
611
|
+
"description": "The $as clause: variable-name to JSON Schema literal members, applied per tuple after $for/$let binding and before $where. Each name must be bound by the same phrase's $for (including $at names) or $let - a compiler rule (JQ0005); each binding validates per item at runtime (JQ2008). (LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)",
|
|
612
|
+
"type": "object",
|
|
613
|
+
"minProperties": 1,
|
|
614
|
+
"additionalProperties": {
|
|
615
|
+
"$ref": "#/$defs/schemaLiteral"
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|