@jarenjs/json 0.9.2 → 0.34.2
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,204 @@
|
|
|
1
|
+
import { CodedError } from '@jarenjs/core/errors';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when a write target is malformed (`JW0001`) or a write
|
|
4
|
+
* fails to apply (`JW2xxx`). `dataPath` is the write target as given
|
|
5
|
+
* (a JSON Pointer or JSONPath), or the normalized path of the failing
|
|
6
|
+
* location for query-selected writes — rendered `in data <path>` per
|
|
7
|
+
* the `@jarenjs/core` coded contract, because it locates *data*, not a
|
|
8
|
+
* document.
|
|
9
|
+
*/
|
|
10
|
+
export declare class JsonWriteError extends CodedError {
|
|
11
|
+
constructor(code: any, reason: any, dataPath: any);
|
|
12
|
+
}
|
|
13
|
+
export type JsonWriteOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* - Apply in place instead of copy-on-write.
|
|
16
|
+
*/
|
|
17
|
+
mutate?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* - What a missing spine means
|
|
20
|
+
* for setters and inserters: `'reject'` (default) raises `JW2001`;
|
|
21
|
+
* `'create'` grows fresh containers along the way — an array when the
|
|
22
|
+
* following step is index-shaped (`-`, a typed index, or a numeric
|
|
23
|
+
* token), an object otherwise — and REPLACES a scalar or `null` found
|
|
24
|
+
* on the spine. The schema-less form-data discipline (@jarenjs/forms
|
|
25
|
+
* `setValueAtPointer` is this option plus undefined-deletes).
|
|
26
|
+
*/
|
|
27
|
+
parents?: 'reject' | 'create';
|
|
28
|
+
/**
|
|
29
|
+
* Custom JSONPath function extensions, for the JSONPath-addressed
|
|
30
|
+
* writers only. A pointer-addressed target is a singular query, which
|
|
31
|
+
* has no filters and so no function calls.
|
|
32
|
+
*/
|
|
33
|
+
pathFunctions?: Record<string, import('./path.js').JSONPathFunction>;
|
|
34
|
+
};
|
|
35
|
+
export type JsonWriter = (root: any, value: any) => any;
|
|
36
|
+
export type JsonRemover = (root: any) => any;
|
|
37
|
+
/**
|
|
38
|
+
* Options for the compiled write operations.
|
|
39
|
+
* @typedef {Object} JsonWriteOptions
|
|
40
|
+
* @property {boolean} [mutate] - Apply in place instead of copy-on-write.
|
|
41
|
+
* @property {'reject'|'create'} [parents] - What a missing spine means
|
|
42
|
+
* for setters and inserters: `'reject'` (default) raises `JW2001`;
|
|
43
|
+
* `'create'` grows fresh containers along the way — an array when the
|
|
44
|
+
* following step is index-shaped (`-`, a typed index, or a numeric
|
|
45
|
+
* token), an object otherwise — and REPLACES a scalar or `null` found
|
|
46
|
+
* on the spine. The schema-less form-data discipline (@jarenjs/forms
|
|
47
|
+
* `setValueAtPointer` is this option plus undefined-deletes).
|
|
48
|
+
* @property {Record<string, import('./path.js').JSONPathFunction>} [pathFunctions]
|
|
49
|
+
* Custom JSONPath function extensions, for the JSONPath-addressed
|
|
50
|
+
* writers only. A pointer-addressed target is a singular query, which
|
|
51
|
+
* has no filters and so no function calls.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* A compiled setter/inserter: applies the write and returns the new
|
|
55
|
+
* document. `value` may be an updater function `(oldValue, location) =>
|
|
56
|
+
* next` for setters.
|
|
57
|
+
* @typedef {(root: any, value: any) => any} JsonWriter
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* A compiled remover: removes the location and returns the new document.
|
|
61
|
+
* @typedef {(root: any) => any} JsonRemover
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* Compile a `set` at a JSON Pointer, a normalized path, or any singular
|
|
65
|
+
* JSONPath query. Set replaces the addressed element or member, creates
|
|
66
|
+
* the member when absent (parents must exist), and extends an array by
|
|
67
|
+
* one at index == length (`/arr/-` appends). `value` may be an updater
|
|
68
|
+
* function `(oldValue, location) => next`.
|
|
69
|
+
*
|
|
70
|
+
* Application is copy-on-write: the input is never mutated and
|
|
71
|
+
* untouched subtrees are shared with the result.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} target - The write target (e.g. `/user/name`, `$['user']['name']`)
|
|
74
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
75
|
+
* @returns {JsonWriter} `(root, value) => newRoot`
|
|
76
|
+
* @throws {JsonWriteError} `JW0001` when the target is not a pointer or
|
|
77
|
+
* singular query
|
|
78
|
+
* @example
|
|
79
|
+
* const setZip = compileJSONPointerSetter('/address/zip');
|
|
80
|
+
* setZip(doc, '10999'); // doc untouched, spine cloned once
|
|
81
|
+
*/
|
|
82
|
+
export declare function compileJSONPointerSetter(target: string, options?: JsonWriteOptions): JsonWriter;
|
|
83
|
+
/**
|
|
84
|
+
* Compile an `insert` at a JSON Pointer, a normalized path, or any
|
|
85
|
+
* singular JSONPath query - RFC 6902 `add` semantics: array elements
|
|
86
|
+
* shift right (`/arr/-` appends), object members are set-or-created.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} target - The write target
|
|
89
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
90
|
+
* @returns {JsonWriter} `(root, value) => newRoot`
|
|
91
|
+
* @throws {JsonWriteError} `JW0001` when the target is not a pointer or
|
|
92
|
+
* singular query
|
|
93
|
+
*/
|
|
94
|
+
export declare function compileJSONPointerInserter(target: string, options?: JsonWriteOptions): JsonWriter;
|
|
95
|
+
/**
|
|
96
|
+
* Compile a `remove` at a JSON Pointer, a normalized path, or any
|
|
97
|
+
* singular JSONPath query. The location must exist (`JW2001`); array
|
|
98
|
+
* elements shift left.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} target - The write target
|
|
101
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
102
|
+
* @returns {JsonRemover} `(root) => newRoot`
|
|
103
|
+
* @throws {JsonWriteError} `JW0001` when the target is not a pointer or
|
|
104
|
+
* singular query
|
|
105
|
+
*/
|
|
106
|
+
export declare function compileJSONPointerRemover(target: string, options?: JsonWriteOptions): JsonRemover;
|
|
107
|
+
/**
|
|
108
|
+
* One-shot `set` at a pointer / normalized path / singular query. On hot
|
|
109
|
+
* paths prefer `compileJSONPointerSetter` and reuse the writer.
|
|
110
|
+
* @param {any} root - The document (never mutated unless `options.mutate`)
|
|
111
|
+
* @param {string} target - The write target
|
|
112
|
+
* @param {any} value - The value, or an updater `(oldValue, location) => next`
|
|
113
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
114
|
+
* @returns {any} The new document
|
|
115
|
+
*/
|
|
116
|
+
export declare function setAtJSONPointer(root: any, target: string, value: any, options?: JsonWriteOptions): any;
|
|
117
|
+
/**
|
|
118
|
+
* One-shot `insert` at a pointer / normalized path / singular query.
|
|
119
|
+
* @param {any} root - The document (never mutated unless `options.mutate`)
|
|
120
|
+
* @param {string} target - The write target
|
|
121
|
+
* @param {any} value - The value to insert
|
|
122
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
123
|
+
* @returns {any} The new document
|
|
124
|
+
*/
|
|
125
|
+
export declare function insertAtJSONPointer(root: any, target: string, value: any, options?: JsonWriteOptions): any;
|
|
126
|
+
/**
|
|
127
|
+
* One-shot `remove` at a pointer / normalized path / singular query.
|
|
128
|
+
* @param {any} root - The document (never mutated unless `options.mutate`)
|
|
129
|
+
* @param {string} target - The write target
|
|
130
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
131
|
+
* @returns {any} The new document
|
|
132
|
+
*/
|
|
133
|
+
export declare function removeAtJSONPointer(root: any, target: string, options?: JsonWriteOptions): any;
|
|
134
|
+
/**
|
|
135
|
+
* Compile a `set` at every node a JSONPath query selects. Applying runs
|
|
136
|
+
* the query against the document and replaces each matched node; `value`
|
|
137
|
+
* may be an updater function `(oldValue, normalizedPath) => next`.
|
|
138
|
+
* Matching nothing is a no-op. Locations are rewritten in reverse
|
|
139
|
+
* document order, so when matches nest, the ancestor's rewrite wins.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} path - The JSONPath query (e.g. `$..price`)
|
|
142
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
143
|
+
* @returns {JsonWriter} `(root, value) => newRoot`
|
|
144
|
+
* @throws {JSONPathSyntaxError} When the query is not valid RFC 9535
|
|
145
|
+
* @example
|
|
146
|
+
* const addVat = compileJSONPathSetter('$..price');
|
|
147
|
+
* addVat(doc, (price) => price * 1.21);
|
|
148
|
+
*/
|
|
149
|
+
export declare function compileJSONPathSetter(path: string, options?: JsonWriteOptions): JsonWriter;
|
|
150
|
+
/**
|
|
151
|
+
* Compile an `insert` at every node a JSONPath query selects - RFC 6902
|
|
152
|
+
* `add` semantics per location: the value is inserted *before* each
|
|
153
|
+
* matched array element (later siblings shift right), and replaces
|
|
154
|
+
* matched object members. Matching nothing is a no-op.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} path - The JSONPath query (e.g. `$.list[0]`)
|
|
157
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
158
|
+
* @returns {JsonWriter} `(root, value) => newRoot`
|
|
159
|
+
* @throws {JSONPathSyntaxError} When the query is not valid RFC 9535
|
|
160
|
+
*/
|
|
161
|
+
export declare function compileJSONPathInserter(path: string, options?: JsonWriteOptions): JsonWriter;
|
|
162
|
+
/**
|
|
163
|
+
* Compile a `remove` of every node a JSONPath query selects. Array
|
|
164
|
+
* elements are removed with shift; removals apply in reverse document
|
|
165
|
+
* order, so multiple removals from one array (and nested removals)
|
|
166
|
+
* compose correctly. Matching nothing is a no-op; selecting the root
|
|
167
|
+
* raises `JW2003`.
|
|
168
|
+
*
|
|
169
|
+
* @param {string} path - The JSONPath query (e.g. `$.store.book[?@.price > 20]`)
|
|
170
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
171
|
+
* @returns {JsonRemover} `(root) => newRoot`
|
|
172
|
+
* @throws {JSONPathSyntaxError} When the query is not valid RFC 9535
|
|
173
|
+
* @example
|
|
174
|
+
* const dropExpensive = compileJSONPathRemover('$.store.book[?@.price > 20]');
|
|
175
|
+
* dropExpensive(doc); // matched books removed, everything else shared
|
|
176
|
+
*/
|
|
177
|
+
export declare function compileJSONPathRemover(path: string, options?: JsonWriteOptions): JsonRemover;
|
|
178
|
+
/**
|
|
179
|
+
* One-shot `set` at every node a JSONPath query selects. On hot paths
|
|
180
|
+
* prefer `compileJSONPathSetter` and reuse the writer.
|
|
181
|
+
* @param {any} root - The document (never mutated unless `options.mutate`)
|
|
182
|
+
* @param {string} path - The JSONPath query
|
|
183
|
+
* @param {any} value - The value, or an updater `(oldValue, normalizedPath) => next`
|
|
184
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
185
|
+
* @returns {any} The new document
|
|
186
|
+
*/
|
|
187
|
+
export declare function setAtJSONPath(root: any, path: string, value: any, options?: JsonWriteOptions): any;
|
|
188
|
+
/**
|
|
189
|
+
* One-shot `insert` at every node a JSONPath query selects.
|
|
190
|
+
* @param {any} root - The document (never mutated unless `options.mutate`)
|
|
191
|
+
* @param {string} path - The JSONPath query
|
|
192
|
+
* @param {any} value - The value to insert
|
|
193
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
194
|
+
* @returns {any} The new document
|
|
195
|
+
*/
|
|
196
|
+
export declare function insertAtJSONPath(root: any, path: string, value: any, options?: JsonWriteOptions): any;
|
|
197
|
+
/**
|
|
198
|
+
* One-shot `remove` of every node a JSONPath query selects.
|
|
199
|
+
* @param {any} root - The document (never mutated unless `options.mutate`)
|
|
200
|
+
* @param {string} path - The JSONPath query
|
|
201
|
+
* @param {JsonWriteOptions} [options] - Write options
|
|
202
|
+
* @returns {any} The new document
|
|
203
|
+
*/
|
|
204
|
+
export declare function removeAtJSONPath(root: any, path: string, options?: JsonWriteOptions): any;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import { LabeledSyntaxError } from '../errors.js';
|
|
1
2
|
/**
|
|
2
3
|
* Error thrown when XQuery text is not valid for the supported subset -
|
|
3
4
|
* either invalid XQuery 3.1 syntax or a recognized construct outside the
|
|
4
5
|
* subset (mirrors JSONPathSyntaxError: `source` and `position` locate the
|
|
5
6
|
* offending token).
|
|
6
7
|
*/
|
|
7
|
-
export declare class XQuerySyntaxError extends
|
|
8
|
-
source: any;
|
|
9
|
-
position: any;
|
|
8
|
+
export declare class XQuerySyntaxError extends LabeledSyntaxError {
|
|
10
9
|
constructor(message: any, source: any, position: any);
|
|
11
10
|
}
|
|
12
11
|
/**
|
package/docs/JSLT-FORMAT.md
CHANGED
|
@@ -601,6 +601,67 @@ for a singleton, an array of items for a longer sequence. `options` carries
|
|
|
601
601
|
caching compiled stylesheets by document identity and compile-option
|
|
602
602
|
values in a WeakMap.
|
|
603
603
|
|
|
604
|
+
## 13. Registered operators (host opt-in, non-normative)
|
|
605
|
+
|
|
606
|
+
The operator vocabulary (QUERY-FORMAT §8) is **closed** — a document
|
|
607
|
+
using `$npv` fails `JQ0002` exactly as one using `$frobnicate` does. A
|
|
608
|
+
host can EXTEND it, the way `@jarenjs/validate` gains formats from
|
|
609
|
+
`@jarenjs/formats`: compose packs of pure functions into a registry and
|
|
610
|
+
compile against it. The published format is unchanged; the extension
|
|
611
|
+
lives entirely in the caller's compile options.
|
|
612
|
+
|
|
613
|
+
```js
|
|
614
|
+
import { createJsltRegistry, mathPack, financePack, statsPack }
|
|
615
|
+
from '@jarenjs/json/jslt';
|
|
616
|
+
|
|
617
|
+
const jslt = createJsltRegistry().use(mathPack).use(financePack).use(statsPack);
|
|
618
|
+
const transform = jslt.compile(stylesheet); // bound compileJsltStylesheet
|
|
619
|
+
const q = jslt.compileQuery(queryDocument); // bound compileJsonQuery
|
|
620
|
+
jslt.names(); // every registered name
|
|
621
|
+
jslt.toOptions(); // { extensions, functions }
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
`createJsltRegistry()` is **immutable-by-copy**: `.use(pack)` returns a
|
|
625
|
+
new registry (a value, not a mutable singleton), and a name that collides
|
|
626
|
+
with the core vocabulary or a name already registered throws a
|
|
627
|
+
`TypeError` at `.use()` — a host programming error, never a `JQ`
|
|
628
|
+
document error.
|
|
629
|
+
|
|
630
|
+
A **pack** is plain data — `{ name, entries }` — wrapping pure functions,
|
|
631
|
+
free of the operator internals. Each entry declares a **kind**:
|
|
632
|
+
|
|
633
|
+
- **`op`** — a scalar `$`-operator over scalar operands (`$sqrt`,
|
|
634
|
+
`$pow`). An empty operand propagates to an empty result.
|
|
635
|
+
- **`agg`** — an operator whose declared `seq` operands are FOLDED to
|
|
636
|
+
arrays before the call, then the pure function runs and its result is
|
|
637
|
+
wrapped: a number as one item, an array under a `seq<number>` result as
|
|
638
|
+
a SEQUENCE (which packs into a JSON array with `[...]`, the same rule
|
|
639
|
+
`$range` follows). This is core `$sum`'s fold generalized, so
|
|
640
|
+
`{ "$npv": ["$.rate", "$.cashflows[*]"] }` computes the present value
|
|
641
|
+
of a filtered cashflow series. `sum`/`min`/`max`/`avg`/`count` are
|
|
642
|
+
already core operators and are NOT re-registered.
|
|
643
|
+
- **`fn`** — a bare `$call` function, the low-level escape.
|
|
644
|
+
|
|
645
|
+
**Purity is required.** A pack function must be a pure deterministic
|
|
646
|
+
function of its arguments (no clock, randomness, or changing closure) —
|
|
647
|
+
the same discipline `$call` and `$orderby`'s collations demand. A
|
|
648
|
+
throwing function surfaces as the coded runtime error `JQ2010`, never a
|
|
649
|
+
crash; a function returning `NaN`/`null` is the caller's data problem.
|
|
650
|
+
|
|
651
|
+
The built-in packs wrap `@jarenjs/core`: `mathPack` (`$sqrt`, `$pow`,
|
|
652
|
+
`$hypot`, trigonometry, logs — scalar ops), `financePack` (`$npv`,
|
|
653
|
+
`$irr`, `$mirr`, `$fv`/`$pv`/`$pmt`, `$sma`/`$ema`/`$wma`/`$rsi`,
|
|
654
|
+
`$volatility`/`$sharpe`/`$maxDrawdown` — aggregators over a series), and
|
|
655
|
+
`statsPack` (`$mean`, `$median`, `$variance`, `$stddev`, `$percentile`).
|
|
656
|
+
Because a registry compiles both stylesheets and bare query documents,
|
|
657
|
+
registered operators also work through `@jarenjs/linq` over an in-memory
|
|
658
|
+
source. Against `@jarenjs/db` a store opens with `openStore(model, {
|
|
659
|
+
operators })`: every registered operator runs **correctly** in the query
|
|
660
|
+
residual (JS over the fetched rows, named by `explain()`), and the
|
|
661
|
+
`pushable:'scalar'` subset (the math ops) is additionally pushed into
|
|
662
|
+
SQLite as deterministic UDFs where the driver allows (`node:sqlite` yes;
|
|
663
|
+
`bun:sqlite` stays the residual). See MODEL-FORMAT §8.1–8.2.
|
|
664
|
+
|
|
604
665
|
---
|
|
605
666
|
|
|
606
667
|
## Appendix A. Worked examples (normative fixtures)
|
|
@@ -852,9 +913,19 @@ Schema subsets regardless of the draft they advertise. In particular,
|
|
|
852
913
|
recursive references, `patternProperties`, `propertyNames`, `format`, and
|
|
853
914
|
some composition keywords may be restricted or treated as annotations.
|
|
854
915
|
Always validate a generated stylesheet locally against the full artifact
|
|
855
|
-
before calling `compileJsltStylesheet`.
|
|
856
|
-
|
|
857
|
-
|
|
916
|
+
before calling `compileJsltStylesheet`.
|
|
917
|
+
|
|
918
|
+
For those strict subsets a third artifact ships,
|
|
919
|
+
[`../schemas/jaren-jslt.llm-profile.schema.json`](../schemas/jaren-jslt.llm-profile.schema.json)
|
|
920
|
+
(`$id` `https://jarenjs.dev/schemas/jaren-jslt/0.1/llm-profile`): a
|
|
921
|
+
mechanically derived, pure *relaxation* of the canonical artifact.
|
|
922
|
+
`patternProperties`, `propertyNames` and asserted `format`s are removed —
|
|
923
|
+
each restated in the nearest `description`, which the model still reads —
|
|
924
|
+
and every `oneOf` becomes `anyOf`. The guarantee runs one way only: every
|
|
925
|
+
canonical-valid stylesheet validates under the profile, the reverse is
|
|
926
|
+
deliberately *not* guaranteed. The profile is what you hand the provider's
|
|
927
|
+
constrained decoder; the canonical artifact remains the authority, so the
|
|
928
|
+
local validate-then-compile step above stays mandatory.
|
|
858
929
|
|
|
859
930
|
Stylesheets remain ordinary JSON throughout the toolchain: they can be
|
|
860
931
|
function-call arguments, retrieved rule sets, reviewed diffs, audit-log
|
package/docs/JSLT-PRELUDE.md
CHANGED
|
@@ -155,5 +155,5 @@ The intended consumers, in order:
|
|
|
155
155
|
|
|
156
156
|
The groundwork this prelude assumed — schema literals inside query
|
|
157
157
|
documents, the compile-time `compileTypeTest` hook, per-item validation
|
|
158
|
-
semantics — shipped
|
|
158
|
+
semantics — has since shipped in the query engine; the next concrete step
|
|
159
159
|
is the `$apply` dispatch prototype behind a `jslt` module boundary.
|