@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,172 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://jarenjs.dev/schemas/geojson",
|
|
4
|
+
"title": "GeoJSON (RFC 7946)",
|
|
5
|
+
"description": "Structural grammar of GeoJSON objects per RFC 7946. This artifact is deliberately PORTABLE: it uses only plain draft-neutral JSON Schema keywords and no Jaren extension, so any validator can consume it. It therefore stops exactly where JSON Schema stops - it CANNOT express that a linear ring is closed (first position equal to last) or that rings follow the right-hand rule (exterior counter-clockwise, holes clockwise), because neither is a structural property. Those two invariants are among the commonest defects in real GeoJSON, and geojson.jaren.schema.json adds them through the $query keyword. Coordinates are longitude, latitude, in that order, in WGS 84 decimal degrees: RFC 7946 removed alternative coordinate reference systems, so there is no crs member to validate.",
|
|
6
|
+
"allOf": [
|
|
7
|
+
{ "$ref": "#/$defs/geoJsonObject" }
|
|
8
|
+
],
|
|
9
|
+
"$defs": {
|
|
10
|
+
"geoJsonObject": {
|
|
11
|
+
"description": "Any GeoJSON object: a geometry, a Feature, or a FeatureCollection.",
|
|
12
|
+
"oneOf": [
|
|
13
|
+
{ "$ref": "#/$defs/geometry" },
|
|
14
|
+
{ "$ref": "#/$defs/feature" },
|
|
15
|
+
{ "$ref": "#/$defs/featureCollection" }
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"geometry": {
|
|
19
|
+
"description": "One of the seven geometry types of RFC 7946 section 3.1.",
|
|
20
|
+
"oneOf": [
|
|
21
|
+
{ "$ref": "#/$defs/point" },
|
|
22
|
+
{ "$ref": "#/$defs/multiPoint" },
|
|
23
|
+
{ "$ref": "#/$defs/lineString" },
|
|
24
|
+
{ "$ref": "#/$defs/multiLineString" },
|
|
25
|
+
{ "$ref": "#/$defs/polygon" },
|
|
26
|
+
{ "$ref": "#/$defs/multiPolygon" },
|
|
27
|
+
{ "$ref": "#/$defs/geometryCollection" }
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"position": {
|
|
31
|
+
"description": "A position: longitude, latitude, and optionally altitude, in that order (RFC 7946 section 3.1.1). Longitude and latitude are bounded because the coordinate reference system is fixed to WGS 84.",
|
|
32
|
+
"type": "array",
|
|
33
|
+
"minItems": 2,
|
|
34
|
+
"maxItems": 3,
|
|
35
|
+
"prefixItems": [
|
|
36
|
+
{ "type": "number", "minimum": -180, "maximum": 180 },
|
|
37
|
+
{ "type": "number", "minimum": -90, "maximum": 90 }
|
|
38
|
+
],
|
|
39
|
+
"items": { "type": "number" }
|
|
40
|
+
},
|
|
41
|
+
"linearRing": {
|
|
42
|
+
"description": "A closed LineString of four or more positions. JSON Schema can require the count but NOT that the first and last positions are equal, which is why this artifact alone cannot fully validate a polygon.",
|
|
43
|
+
"type": "array",
|
|
44
|
+
"minItems": 4,
|
|
45
|
+
"items": { "$ref": "#/$defs/position" }
|
|
46
|
+
},
|
|
47
|
+
"bbox": {
|
|
48
|
+
"description": "All axes of the most south-westerly position followed by all axes of the more north-easterly one (RFC 7946 section 5): four numbers in two dimensions, six in three.",
|
|
49
|
+
"type": "array",
|
|
50
|
+
"oneOf": [
|
|
51
|
+
{ "minItems": 4, "maxItems": 4 },
|
|
52
|
+
{ "minItems": 6, "maxItems": 6 }
|
|
53
|
+
],
|
|
54
|
+
"items": { "type": "number" }
|
|
55
|
+
},
|
|
56
|
+
"point": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {
|
|
59
|
+
"type": { "const": "Point" },
|
|
60
|
+
"coordinates": { "$ref": "#/$defs/position" },
|
|
61
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
62
|
+
},
|
|
63
|
+
"required": ["type", "coordinates"],
|
|
64
|
+
"additionalProperties": false
|
|
65
|
+
},
|
|
66
|
+
"multiPoint": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"type": { "const": "MultiPoint" },
|
|
70
|
+
"coordinates": { "type": "array", "items": { "$ref": "#/$defs/position" } },
|
|
71
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
72
|
+
},
|
|
73
|
+
"required": ["type", "coordinates"],
|
|
74
|
+
"additionalProperties": false
|
|
75
|
+
},
|
|
76
|
+
"lineString": {
|
|
77
|
+
"description": "Two or more positions (RFC 7946 section 3.1.4).",
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"type": { "const": "LineString" },
|
|
81
|
+
"coordinates": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"minItems": 2,
|
|
84
|
+
"items": { "$ref": "#/$defs/position" }
|
|
85
|
+
},
|
|
86
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
87
|
+
},
|
|
88
|
+
"required": ["type", "coordinates"],
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
},
|
|
91
|
+
"multiLineString": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"properties": {
|
|
94
|
+
"type": { "const": "MultiLineString" },
|
|
95
|
+
"coordinates": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"minItems": 2,
|
|
100
|
+
"items": { "$ref": "#/$defs/position" }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
104
|
+
},
|
|
105
|
+
"required": ["type", "coordinates"],
|
|
106
|
+
"additionalProperties": false
|
|
107
|
+
},
|
|
108
|
+
"polygon": {
|
|
109
|
+
"description": "An array of linear rings: the exterior ring first, then holes (RFC 7946 section 3.1.6). Ring closure and the right-hand rule are NOT checked here - see this schema's description.",
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"type": { "const": "Polygon" },
|
|
113
|
+
"coordinates": { "type": "array", "items": { "$ref": "#/$defs/linearRing" } },
|
|
114
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
115
|
+
},
|
|
116
|
+
"required": ["type", "coordinates"],
|
|
117
|
+
"additionalProperties": false
|
|
118
|
+
},
|
|
119
|
+
"multiPolygon": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {
|
|
122
|
+
"type": { "const": "MultiPolygon" },
|
|
123
|
+
"coordinates": {
|
|
124
|
+
"type": "array",
|
|
125
|
+
"items": { "type": "array", "items": { "$ref": "#/$defs/linearRing" } }
|
|
126
|
+
},
|
|
127
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
128
|
+
},
|
|
129
|
+
"required": ["type", "coordinates"],
|
|
130
|
+
"additionalProperties": false
|
|
131
|
+
},
|
|
132
|
+
"geometryCollection": {
|
|
133
|
+
"description": "A heterogeneous collection of geometries. RFC 7946 section 3.1.8 advises against nesting one inside another.",
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"type": { "const": "GeometryCollection" },
|
|
137
|
+
"geometries": { "type": "array", "items": { "$ref": "#/$defs/geometry" } },
|
|
138
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
139
|
+
},
|
|
140
|
+
"required": ["type", "geometries"],
|
|
141
|
+
"additionalProperties": false
|
|
142
|
+
},
|
|
143
|
+
"feature": {
|
|
144
|
+
"description": "A geometry with properties. Both members are REQUIRED and both are nullable (RFC 7946 section 3.2).",
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {
|
|
147
|
+
"type": { "const": "Feature" },
|
|
148
|
+
"geometry": {
|
|
149
|
+
"oneOf": [
|
|
150
|
+
{ "type": "null" },
|
|
151
|
+
{ "$ref": "#/$defs/geometry" }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"properties": { "type": ["object", "null"] },
|
|
155
|
+
"id": { "type": ["string", "number"] },
|
|
156
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
157
|
+
},
|
|
158
|
+
"required": ["type", "geometry", "properties"],
|
|
159
|
+
"additionalProperties": false
|
|
160
|
+
},
|
|
161
|
+
"featureCollection": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"properties": {
|
|
164
|
+
"type": { "const": "FeatureCollection" },
|
|
165
|
+
"features": { "type": "array", "items": { "$ref": "#/$defs/feature" } },
|
|
166
|
+
"bbox": { "$ref": "#/$defs/bbox" }
|
|
167
|
+
},
|
|
168
|
+
"required": ["type", "features"],
|
|
169
|
+
"additionalProperties": false
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://jarenjs.dev/schemas/jaren-jslt/0.1/authoring",
|
|
4
|
+
"title": "Jaren JSLT format 0.1 (authoring profile)",
|
|
5
|
+
"description": "Authoring profile of the canonical grammar: the document SHAPE only, with queryDocument left open. Constrains decoding on small models, where the full grammar does not decode at all. It is deliberately WEAKER than the canonical schema - a document valid here may be nonsense - so the engine compiler is the gate that makes it safe, and generated documents must be compiled before use.",
|
|
6
|
+
"allOf": [
|
|
7
|
+
{
|
|
8
|
+
"$ref": "#/$defs/stylesheetDocument"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"$defs": {
|
|
12
|
+
"stylesheetDocument": {
|
|
13
|
+
"description": "A JSLT stylesheet is either a bare array of rules or the versioned envelope object.",
|
|
14
|
+
"anyOf": [
|
|
15
|
+
{
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"$ref": "#/$defs/rule"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"$ref": "#/$defs/stylesheetEnvelope"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"stylesheetEnvelope": {
|
|
27
|
+
"description": "Versioned stylesheet envelope. Unknown members are rejected; per-mode declarations only override unmatched disposition.",
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"$jslt": {
|
|
31
|
+
"const": "0.1"
|
|
32
|
+
},
|
|
33
|
+
"rules": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": {
|
|
36
|
+
"$ref": "#/$defs/rule"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"unmatched": {
|
|
40
|
+
"$ref": "#/$defs/dispositionValue"
|
|
41
|
+
},
|
|
42
|
+
"modes": {
|
|
43
|
+
"$ref": "#/$defs/modesMap"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"$jslt",
|
|
48
|
+
"rules"
|
|
49
|
+
],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
},
|
|
52
|
+
"rule": {
|
|
53
|
+
"description": "One closed template rule. The compiler is authoritative for rank ordering, reserved external bindings, hook availability, and body runtime semantics (JT0xxx/JT2xxx).",
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"match": {
|
|
57
|
+
"$ref": "#/$defs/matchSpec"
|
|
58
|
+
},
|
|
59
|
+
"mode": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"priority": {
|
|
63
|
+
"type": "number"
|
|
64
|
+
},
|
|
65
|
+
"body": {
|
|
66
|
+
"$ref": "#/$defs/queryDocument"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": [
|
|
70
|
+
"body"
|
|
71
|
+
],
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
},
|
|
74
|
+
"matchSpec": {
|
|
75
|
+
"description": "A positional RFC 9535 JSONPath match, a shape match using an annotation-only JSON Schema literal, or both conditions in one closed object.",
|
|
76
|
+
"anyOf": [
|
|
77
|
+
{
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "(LLM profile: the 'json-path' format assertion is relaxed here; the canonical schema enforces it)"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"path": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "(LLM profile: the 'json-path' format assertion is relaxed here; the canonical schema enforces it)"
|
|
87
|
+
},
|
|
88
|
+
"schema": {
|
|
89
|
+
"$ref": "#/$defs/schemaLiteral"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"anyOf": [
|
|
93
|
+
{
|
|
94
|
+
"required": [
|
|
95
|
+
"path"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"required": [
|
|
100
|
+
"schema"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"additionalProperties": false
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"dispositionValue": {
|
|
109
|
+
"description": "Built-in behavior for unmatched values: share unchanged subtrees, rebuild fresh containers, or raise JT2003.",
|
|
110
|
+
"enum": [
|
|
111
|
+
"share",
|
|
112
|
+
"fresh",
|
|
113
|
+
"error"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"modesMap": {
|
|
117
|
+
"description": "Mode name to unmatched-disposition override. Modes need not otherwise be declared.",
|
|
118
|
+
"type": "object",
|
|
119
|
+
"additionalProperties": {
|
|
120
|
+
"$ref": "#/$defs/modeConfig"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"modeConfig": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"properties": {
|
|
126
|
+
"unmatched": {
|
|
127
|
+
"$ref": "#/$defs/dispositionValue"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"required": [
|
|
131
|
+
"unmatched"
|
|
132
|
+
],
|
|
133
|
+
"additionalProperties": false
|
|
134
|
+
},
|
|
135
|
+
"queryDocument": {
|
|
136
|
+
"description": "A jaren-query expression: a JSONPath string starting with \"$\", a literal, or a one-member operator object such as {\"$sum\": \"$.prices[*]\"} or {\"$sub\": [\"$a\", \"$b\"]}. Any JSON value decodes here; the engine compiler is the authority for whether it is a legal expression."
|
|
137
|
+
},
|
|
138
|
+
"schemaLiteral": {
|
|
139
|
+
"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)."
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -220,9 +220,10 @@
|
|
|
220
220
|
"format": "json-path"
|
|
221
221
|
},
|
|
222
222
|
"variablePathString": {
|
|
223
|
-
"description": "A variable-rooted path: '$name' with name matching [A-Za-z_][A-Za-z0-9_]*, optionally followed by RFC 9535 segments.
|
|
223
|
+
"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).",
|
|
224
224
|
"type": "string",
|
|
225
|
-
"pattern": "^\\$[A-Za-z_][A-Za-z0-9_]*($|[.\\[])"
|
|
225
|
+
"pattern": "^\\$[A-Za-z_][A-Za-z0-9_]*($|[.\\[])",
|
|
226
|
+
"format": "json-path-segments"
|
|
226
227
|
},
|
|
227
228
|
"arrayConstructor": {
|
|
228
229
|
"description": "An array in expression position constructs an array; element results are concatenated per XQuery sequence flattening.",
|
|
@@ -243,6 +244,9 @@
|
|
|
243
244
|
{
|
|
244
245
|
"$ref": "#/definitions/mapPhrase"
|
|
245
246
|
},
|
|
247
|
+
{
|
|
248
|
+
"$ref": "#/definitions/callPhrase"
|
|
249
|
+
},
|
|
246
250
|
{
|
|
247
251
|
"$ref": "#/definitions/flworPhrase"
|
|
248
252
|
},
|
|
@@ -270,6 +274,12 @@
|
|
|
270
274
|
{
|
|
271
275
|
"$ref": "#/definitions/stringJoinPhrase"
|
|
272
276
|
},
|
|
277
|
+
{
|
|
278
|
+
"$ref": "#/definitions/geohashPhrase"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"$ref": "#/definitions/ternaryOperatorPhrase"
|
|
282
|
+
},
|
|
273
283
|
{
|
|
274
284
|
"$ref": "#/definitions/replacePhrase"
|
|
275
285
|
},
|
|
@@ -328,9 +338,12 @@
|
|
|
328
338
|
"maxItems": 2
|
|
329
339
|
},
|
|
330
340
|
"flworPhrase": {
|
|
331
|
-
"description": "FLWOR phrase. Clauses apply in the fixed semantic order $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 $for/$let.",
|
|
341
|
+
"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.",
|
|
332
342
|
"type": "object",
|
|
333
343
|
"properties": {
|
|
344
|
+
"$fold": {
|
|
345
|
+
"$ref": "#/definitions/foldBinding"
|
|
346
|
+
},
|
|
334
347
|
"$for": {
|
|
335
348
|
"$ref": "#/definitions/forBindings"
|
|
336
349
|
},
|
|
@@ -369,6 +382,11 @@
|
|
|
369
382
|
"required": [
|
|
370
383
|
"$let"
|
|
371
384
|
]
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"required": [
|
|
388
|
+
"$fold"
|
|
389
|
+
]
|
|
372
390
|
}
|
|
373
391
|
],
|
|
374
392
|
"additionalProperties": false
|
|
@@ -378,7 +396,7 @@
|
|
|
378
396
|
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
379
397
|
},
|
|
380
398
|
"forBindings": {
|
|
381
|
-
"description": "Iteration bindings: variable name to source expression or extended
|
|
399
|
+
"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.",
|
|
382
400
|
"type": "object",
|
|
383
401
|
"minProperties": 1,
|
|
384
402
|
"propertyNames": {
|
|
@@ -399,7 +417,7 @@
|
|
|
399
417
|
]
|
|
400
418
|
},
|
|
401
419
|
"extendedForBinding": {
|
|
402
|
-
"description": "Extended $for binding
|
|
420
|
+
"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).",
|
|
403
421
|
"type": "object",
|
|
404
422
|
"properties": {
|
|
405
423
|
"$in": {
|
|
@@ -407,11 +425,27 @@
|
|
|
407
425
|
},
|
|
408
426
|
"$at": {
|
|
409
427
|
"$ref": "#/definitions/variableName"
|
|
428
|
+
},
|
|
429
|
+
"$allowing-empty": {
|
|
430
|
+
"type": "boolean"
|
|
431
|
+
},
|
|
432
|
+
"$window": {
|
|
433
|
+
"enum": [
|
|
434
|
+
"tumbling",
|
|
435
|
+
"sliding"
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
"$size": {
|
|
439
|
+
"type": "integer",
|
|
440
|
+
"minimum": 1
|
|
441
|
+
},
|
|
442
|
+
"$step": {
|
|
443
|
+
"type": "integer",
|
|
444
|
+
"minimum": 1
|
|
410
445
|
}
|
|
411
446
|
},
|
|
412
447
|
"required": [
|
|
413
|
-
"$in"
|
|
414
|
-
"$at"
|
|
448
|
+
"$in"
|
|
415
449
|
],
|
|
416
450
|
"additionalProperties": false
|
|
417
451
|
},
|
|
@@ -469,7 +503,7 @@
|
|
|
469
503
|
]
|
|
470
504
|
},
|
|
471
505
|
"orderByKeySpec": {
|
|
472
|
-
"description": "Explicit order key: direction defaults to 'asc', empty-sequence placement to 'least'.",
|
|
506
|
+
"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.",
|
|
473
507
|
"type": "object",
|
|
474
508
|
"properties": {
|
|
475
509
|
"$key": {
|
|
@@ -486,6 +520,10 @@
|
|
|
486
520
|
"least",
|
|
487
521
|
"greatest"
|
|
488
522
|
]
|
|
523
|
+
},
|
|
524
|
+
"$collation": {
|
|
525
|
+
"type": "string",
|
|
526
|
+
"minLength": 1
|
|
489
527
|
}
|
|
490
528
|
},
|
|
491
529
|
"required": [
|
|
@@ -548,6 +586,8 @@
|
|
|
548
586
|
"$sort",
|
|
549
587
|
"$head",
|
|
550
588
|
"$tail",
|
|
589
|
+
"$entries",
|
|
590
|
+
"$from-entries",
|
|
551
591
|
"$upper",
|
|
552
592
|
"$lower",
|
|
553
593
|
"$string-length",
|
|
@@ -560,7 +600,28 @@
|
|
|
560
600
|
"$is-boolean",
|
|
561
601
|
"$is-null",
|
|
562
602
|
"$is-array",
|
|
563
|
-
"$is-object"
|
|
603
|
+
"$is-object",
|
|
604
|
+
"$is-date",
|
|
605
|
+
"$is-time",
|
|
606
|
+
"$is-datetime",
|
|
607
|
+
"$is-duration",
|
|
608
|
+
"$year",
|
|
609
|
+
"$month",
|
|
610
|
+
"$day",
|
|
611
|
+
"$hours",
|
|
612
|
+
"$minutes",
|
|
613
|
+
"$seconds",
|
|
614
|
+
"$offset",
|
|
615
|
+
"$epoch",
|
|
616
|
+
"$datetime",
|
|
617
|
+
"$week",
|
|
618
|
+
"$week-year",
|
|
619
|
+
"$quarter",
|
|
620
|
+
"$weekday",
|
|
621
|
+
"$bbox",
|
|
622
|
+
"$area",
|
|
623
|
+
"$length",
|
|
624
|
+
"$centroid"
|
|
564
625
|
]
|
|
565
626
|
},
|
|
566
627
|
"additionalProperties": {
|
|
@@ -594,6 +655,12 @@
|
|
|
594
655
|
"$index-of",
|
|
595
656
|
"$range",
|
|
596
657
|
"$get",
|
|
658
|
+
"$start-of",
|
|
659
|
+
"$end-of",
|
|
660
|
+
"$date-format",
|
|
661
|
+
"$distance",
|
|
662
|
+
"$within",
|
|
663
|
+
"$bbox-intersects",
|
|
597
664
|
"$default"
|
|
598
665
|
]
|
|
599
666
|
},
|
|
@@ -645,7 +712,7 @@
|
|
|
645
712
|
}
|
|
646
713
|
},
|
|
647
714
|
"conditionalArityOperatorPhrase": {
|
|
648
|
-
"description": "Operators taking two or three operand expressions: $if [cond, then, else?], $substring [str, start, len?], $subsequence [seq, start, len?].",
|
|
715
|
+
"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].",
|
|
649
716
|
"type": "object",
|
|
650
717
|
"minProperties": 1,
|
|
651
718
|
"maxProperties": 1,
|
|
@@ -653,7 +720,9 @@
|
|
|
653
720
|
"enum": [
|
|
654
721
|
"$if",
|
|
655
722
|
"$substring",
|
|
656
|
-
"$subsequence"
|
|
723
|
+
"$subsequence",
|
|
724
|
+
"$date-add",
|
|
725
|
+
"$date-sub"
|
|
657
726
|
]
|
|
658
727
|
},
|
|
659
728
|
"additionalProperties": {
|
|
@@ -771,6 +840,78 @@
|
|
|
771
840
|
"$apply"
|
|
772
841
|
],
|
|
773
842
|
"additionalProperties": false
|
|
843
|
+
},
|
|
844
|
+
"callPhrase": {
|
|
845
|
+
"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.",
|
|
846
|
+
"type": "object",
|
|
847
|
+
"properties": {
|
|
848
|
+
"$call": {
|
|
849
|
+
"type": "array",
|
|
850
|
+
"minItems": 1,
|
|
851
|
+
"items": [
|
|
852
|
+
{
|
|
853
|
+
"type": "string",
|
|
854
|
+
"minLength": 1
|
|
855
|
+
}
|
|
856
|
+
],
|
|
857
|
+
"additionalItems": {
|
|
858
|
+
"$ref": "#/definitions/expression"
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
"required": [
|
|
863
|
+
"$call"
|
|
864
|
+
],
|
|
865
|
+
"additionalProperties": false
|
|
866
|
+
},
|
|
867
|
+
"foldBinding": {
|
|
868
|
+
"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.",
|
|
869
|
+
"type": "object",
|
|
870
|
+
"minProperties": 1,
|
|
871
|
+
"maxProperties": 1,
|
|
872
|
+
"propertyNames": {
|
|
873
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
874
|
+
},
|
|
875
|
+
"additionalProperties": {
|
|
876
|
+
"$ref": "#/definitions/expression"
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
"ternaryOperatorPhrase": {
|
|
880
|
+
"description": "Operators whose value is an array of exactly three operand expressions: $date-diff [from, to, unit].",
|
|
881
|
+
"type": "object",
|
|
882
|
+
"minProperties": 1,
|
|
883
|
+
"maxProperties": 1,
|
|
884
|
+
"propertyNames": {
|
|
885
|
+
"enum": [
|
|
886
|
+
"$date-diff"
|
|
887
|
+
]
|
|
888
|
+
},
|
|
889
|
+
"additionalProperties": {
|
|
890
|
+
"type": "array",
|
|
891
|
+
"items": {
|
|
892
|
+
"$ref": "#/definitions/expression"
|
|
893
|
+
},
|
|
894
|
+
"minItems": 3,
|
|
895
|
+
"maxItems": 3
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
"geohashPhrase": {
|
|
899
|
+
"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.",
|
|
900
|
+
"type": "object",
|
|
901
|
+
"properties": {
|
|
902
|
+
"$geohash": {
|
|
903
|
+
"type": "array",
|
|
904
|
+
"items": {
|
|
905
|
+
"$ref": "#/definitions/expression"
|
|
906
|
+
},
|
|
907
|
+
"minItems": 1,
|
|
908
|
+
"maxItems": 2
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
"required": [
|
|
912
|
+
"$geohash"
|
|
913
|
+
],
|
|
914
|
+
"additionalProperties": false
|
|
774
915
|
}
|
|
775
916
|
}
|
|
776
917
|
}
|