@grafctory/blue 0.0.0-stage → 0.16.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/LICENSE +201 -0
- package/README.md +524 -2
- package/dist/boolean/assembler.d.ts +53 -0
- package/dist/boolean/assembler.d.ts.map +1 -0
- package/dist/boolean/assembler.js +78 -0
- package/dist/boolean/assembler.js.map +1 -0
- package/dist/boolean/index.d.ts +86 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +99 -0
- package/dist/boolean/index.js.map +1 -0
- package/dist/boolean/validator.d.ts +30 -0
- package/dist/boolean/validator.d.ts.map +1 -0
- package/dist/boolean/validator.js +68 -0
- package/dist/boolean/validator.js.map +1 -0
- package/dist/dictionary/assembler.d.ts +70 -0
- package/dist/dictionary/assembler.d.ts.map +1 -0
- package/dist/dictionary/assembler.js +178 -0
- package/dist/dictionary/assembler.js.map +1 -0
- package/dist/dictionary/index.d.ts +237 -0
- package/dist/dictionary/index.d.ts.map +1 -0
- package/dist/dictionary/index.js +43 -0
- package/dist/dictionary/index.js.map +1 -0
- package/dist/dictionary/inference.d.ts +42 -0
- package/dist/dictionary/inference.d.ts.map +1 -0
- package/dist/dictionary/inference.js +17 -0
- package/dist/dictionary/inference.js.map +1 -0
- package/dist/dictionary/validator.d.ts +37 -0
- package/dist/dictionary/validator.d.ts.map +1 -0
- package/dist/dictionary/validator.js +106 -0
- package/dist/dictionary/validator.js.map +1 -0
- package/dist/index.core.d.ts +33 -0
- package/dist/index.core.d.ts.map +1 -0
- package/dist/index.core.js +149 -0
- package/dist/index.core.js.map +1 -0
- package/dist/index.d.ts +333 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +378 -0
- package/dist/index.js.map +1 -0
- package/dist/number/assembler.d.ts +70 -0
- package/dist/number/assembler.d.ts.map +1 -0
- package/dist/number/assembler.js +188 -0
- package/dist/number/assembler.js.map +1 -0
- package/dist/number/index.d.ts +329 -0
- package/dist/number/index.d.ts.map +1 -0
- package/dist/number/index.js +312 -0
- package/dist/number/index.js.map +1 -0
- package/dist/number/validator.d.ts +31 -0
- package/dist/number/validator.d.ts.map +1 -0
- package/dist/number/validator.js +57 -0
- package/dist/number/validator.js.map +1 -0
- package/dist/reference/accessors.d.ts +29 -0
- package/dist/reference/accessors.d.ts.map +1 -0
- package/dist/reference/accessors.js +38 -0
- package/dist/reference/accessors.js.map +1 -0
- package/dist/reference/assembler.d.ts +63 -0
- package/dist/reference/assembler.d.ts.map +1 -0
- package/dist/reference/assembler.js +127 -0
- package/dist/reference/assembler.js.map +1 -0
- package/dist/reference/index.d.ts +108 -0
- package/dist/reference/index.d.ts.map +1 -0
- package/dist/reference/index.js +40 -0
- package/dist/reference/index.js.map +1 -0
- package/dist/reference/validator.d.ts +33 -0
- package/dist/reference/validator.d.ts.map +1 -0
- package/dist/reference/validator.js +56 -0
- package/dist/reference/validator.js.map +1 -0
- package/dist/resource/accessors.d.ts +140 -0
- package/dist/resource/accessors.d.ts.map +1 -0
- package/dist/resource/accessors.js +173 -0
- package/dist/resource/accessors.js.map +1 -0
- package/dist/resource/assembler.d.ts +265 -0
- package/dist/resource/assembler.d.ts.map +1 -0
- package/dist/resource/assembler.js +816 -0
- package/dist/resource/assembler.js.map +1 -0
- package/dist/resource/index.d.ts +903 -0
- package/dist/resource/index.d.ts.map +1 -0
- package/dist/resource/index.js +160 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource/inference.d.ts +310 -0
- package/dist/resource/inference.d.ts.map +1 -0
- package/dist/resource/inference.js +17 -0
- package/dist/resource/inference.js.map +1 -0
- package/dist/resource/validator.d.ts +158 -0
- package/dist/resource/validator.d.ts.map +1 -0
- package/dist/resource/validator.js +1013 -0
- package/dist/resource/validator.js.map +1 -0
- package/dist/string/assembler.d.ts +69 -0
- package/dist/string/assembler.d.ts.map +1 -0
- package/dist/string/assembler.js +143 -0
- package/dist/string/assembler.js.map +1 -0
- package/dist/string/index.d.ts +431 -0
- package/dist/string/index.d.ts.map +1 -0
- package/dist/string/index.js +528 -0
- package/dist/string/index.js.map +1 -0
- package/dist/string/validator.d.ts +30 -0
- package/dist/string/validator.d.ts.map +1 -0
- package/dist/string/validator.js +69 -0
- package/dist/string/validator.js.map +1 -0
- package/dist/union/accessors.d.ts +137 -0
- package/dist/union/accessors.d.ts.map +1 -0
- package/dist/union/accessors.js +253 -0
- package/dist/union/accessors.js.map +1 -0
- package/dist/union/assembler.d.ts +56 -0
- package/dist/union/assembler.d.ts.map +1 -0
- package/dist/union/assembler.js +140 -0
- package/dist/union/assembler.js.map +1 -0
- package/dist/union/index.d.ts +172 -0
- package/dist/union/index.d.ts.map +1 -0
- package/dist/union/index.js +45 -0
- package/dist/union/index.js.map +1 -0
- package/dist/union/inference.d.ts +30 -0
- package/dist/union/inference.d.ts.map +1 -0
- package/dist/union/inference.js +17 -0
- package/dist/union/inference.js.map +1 -0
- package/dist/union/validator.d.ts +94 -0
- package/dist/union/validator.d.ts.map +1 -0
- package/dist/union/validator.js +171 -0
- package/dist/union/validator.js.map +1 -0
- package/dist/value/accessors.d.ts +151 -0
- package/dist/value/accessors.d.ts.map +1 -0
- package/dist/value/accessors.js +468 -0
- package/dist/value/accessors.js.map +1 -0
- package/dist/value/assembler.d.ts +129 -0
- package/dist/value/assembler.d.ts.map +1 -0
- package/dist/value/assembler.js +248 -0
- package/dist/value/assembler.js.map +1 -0
- package/dist/value/index.d.ts +309 -0
- package/dist/value/index.d.ts.map +1 -0
- package/dist/value/index.js +26 -0
- package/dist/value/index.js.map +1 -0
- package/dist/value/inference.d.ts +292 -0
- package/dist/value/inference.d.ts.map +1 -0
- package/dist/value/inference.js +17 -0
- package/dist/value/inference.js.map +1 -0
- package/dist/value/validator.d.ts +76 -0
- package/dist/value/validator.d.ts.map +1 -0
- package/dist/value/validator.js +111 -0
- package/dist/value/validator.js.map +1 -0
- package/package.json +95 -4
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2025-2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Retrieval policy enforcement.
|
|
18
|
+
*
|
|
19
|
+
* Holds a validated template to what the service will actually serve: {@link enforce} rewrites the template where a
|
|
20
|
+
* policy requires it and leaves it as it stands everywhere else.
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { isIdentifier, isObject } from "@grafctory/core";
|
|
25
|
+
import { decodeProbe, isBinding, isBranch, isUnion } from "@grafctory/qest/model";
|
|
26
|
+
import { getShapeTarget } from "./reference/index.js";
|
|
27
|
+
import { getShapeBranches } from "./union/index.js";
|
|
28
|
+
import { effective } from "./value/index.js";
|
|
29
|
+
/**
|
|
30
|
+
* Applies retrieval policies to a validated template.
|
|
31
|
+
*
|
|
32
|
+
* Returns the template the server will actually honour, so that a caller may hold a request to what the service
|
|
33
|
+
* guarantees rather than to what the client happened to ask for. The template is rewritten where a policy requires it
|
|
34
|
+
* and returned unchanged everywhere else, keeping what the client asked for intact; a template stating no policy at
|
|
35
|
+
* all comes back as it went in.
|
|
36
|
+
*
|
|
37
|
+
* **Default paging**
|
|
38
|
+
*
|
|
39
|
+
* A collection left unpaged is given the largest page the service serves, so that a client omitting `#` is handed a
|
|
40
|
+
* bounded set rather than the whole of it. A collection already stating a page of its own is left alone, as is a
|
|
41
|
+
* single-valued or localised slot, which nothing pages, and a projection column, which holds one value per row and so
|
|
42
|
+
* reaches no collection of its own.
|
|
43
|
+
*
|
|
44
|
+
* The template is expected to have been validated against the shape: a malformed one is returned as it stands rather
|
|
45
|
+
* than reported.
|
|
46
|
+
*
|
|
47
|
+
* @param value The validated template to enforce
|
|
48
|
+
* @param shape The shape the template was validated against
|
|
49
|
+
* @param opts Enforcement options, each applied on its own
|
|
50
|
+
* @param opts.limit The page every unpaged collection is held to; omitted, or `0`, leaves paging to the client
|
|
51
|
+
*
|
|
52
|
+
* @returns A template structurally equivalent to `value`, rewritten where a policy requires it
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link @grafctory/core!TraceError | TraceError} Where `shape` reaches itself through a cycle no link
|
|
55
|
+
* breaks, or where a union it reaches declares a shared member name inconsistently across its branches
|
|
56
|
+
*/
|
|
57
|
+
export function enforce(value, shape, { limit } = {}) {
|
|
58
|
+
return limit ? template(value, shape) : value; // an omitted or `0` page leaves the set unbounded
|
|
59
|
+
/**
|
|
60
|
+
* Walks the slots of a template, resolving each to what the shape says it reaches.
|
|
61
|
+
*/
|
|
62
|
+
function template(value, shape) {
|
|
63
|
+
if (!isObject(value)) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
return Object.fromEntries(Object.entries(value).map(([name, asked]) => {
|
|
67
|
+
const range = resolve(shape, name);
|
|
68
|
+
// a path the shape cannot resolve leaves the slot as it stands
|
|
69
|
+
return [name, range !== undefined ? slot(asked, range, !isBinding(name)) : asked];
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolves a template key to the range the shape gives it, if the shape declares it.
|
|
74
|
+
*/
|
|
75
|
+
function resolve(shape, name) {
|
|
76
|
+
// a projection column carries its own path, while a plain member names the single step it is
|
|
77
|
+
const probe = isBinding(name) ? decodeProbe(name)
|
|
78
|
+
: isIdentifier(name) ? { target: name, pipe: [], path: [name] }
|
|
79
|
+
: undefined;
|
|
80
|
+
const range = probe && effective(shape, probe);
|
|
81
|
+
return isObject(range) ? range : undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Walks what a slot asks for, under the cardinality and the form the shape gives it.
|
|
85
|
+
*
|
|
86
|
+
* @param value The slot to walk
|
|
87
|
+
* @param range The range the shape gives the slot
|
|
88
|
+
* @param paged Whether the slot reaches a collection of its own, which a projection column never does, holding
|
|
89
|
+
* one value per row
|
|
90
|
+
*/
|
|
91
|
+
function slot(value, range, paged) {
|
|
92
|
+
const branches = getShapeBranches(range.shape);
|
|
93
|
+
const [branch] = branches;
|
|
94
|
+
const collection = paged && range.maxCount !== 1;
|
|
95
|
+
return branches.length > 1 ? model(value, branches, collection)
|
|
96
|
+
: branch.kind === "dictionary" ? value // nothing pages a localised value
|
|
97
|
+
: collection ? page(placeholder(value, branch))
|
|
98
|
+
: placeholder(value, branch);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Walks what a single value asks for, descending into the template behind a resource.
|
|
102
|
+
*/
|
|
103
|
+
function placeholder(value, branch) {
|
|
104
|
+
// a union of one flattens away, so its branch map arrives here rather than through `model`
|
|
105
|
+
const target = isObject(value) ? getShapeTarget(branch) : undefined;
|
|
106
|
+
return isUnion(value) ? indexed(value, [branch])
|
|
107
|
+
: target !== undefined ? template(value, target)
|
|
108
|
+
: value;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Walks what a polymorphic slot asks for, paging the collection it reaches.
|
|
112
|
+
*/
|
|
113
|
+
function model(value, branches, collection) {
|
|
114
|
+
return collection ? page(indexed(value, branches)) : indexed(value, branches);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Walks each alternative of a branch map under every branch it fits, its opaque key naming none.
|
|
118
|
+
*/
|
|
119
|
+
function indexed(value, branches) {
|
|
120
|
+
if (!isObject(value)) {
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
return Object.fromEntries(Object.entries(value).map(([key, asked]) => [key, isBranch(key)
|
|
124
|
+
? branches
|
|
125
|
+
.filter(branch => fits(asked, branch))
|
|
126
|
+
.reduce((walked, branch) => placeholder(walked, branch), asked)
|
|
127
|
+
: asked
|
|
128
|
+
]));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Checks whether an alternative fits a branch by form alone.
|
|
132
|
+
*
|
|
133
|
+
* A template fits only the resources declaring every member it asks for.
|
|
134
|
+
*/
|
|
135
|
+
function fits(asked, branch) {
|
|
136
|
+
const target = getShapeTarget(branch);
|
|
137
|
+
return target === undefined || !isObject(asked)
|
|
138
|
+
|| Object.keys(asked).every(name => resolve(target, name) !== undefined);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Holds a collection to the largest page the service serves, leaving a stated one alone.
|
|
142
|
+
*/
|
|
143
|
+
function page(node) {
|
|
144
|
+
return !isObject(node) ? node // a malformed slot is left as it stands
|
|
145
|
+
: "#" in node ? node
|
|
146
|
+
: { ...node, "#": limit };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=index.core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.core.js","sourceRoot":"","sources":["../src/index.core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAA0B,MAAM,kBAAkB,CAAC;AAGrE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,KAAoB,EAAE,EAE7D,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,IAAI;gBACnB,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAE7B,CAAC;AAEF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linked data validation.
|
|
3
|
+
*
|
|
4
|
+
* Provides shape-based validation for the values, retrieval templates and retrieved data crossing a service boundary.
|
|
5
|
+
* The {@link schema} function describes the payloads a shape admits as a JSON Schema, and the {@link validate}
|
|
6
|
+
* function returns either the value, typed as the shape describes it, or a trace of every violation found. A shape
|
|
7
|
+
* states once what a service accepts, so the description and the checks stay in one place instead of being restated
|
|
8
|
+
* across the interfaces and entry points that exchange data with clients.
|
|
9
|
+
*
|
|
10
|
+
* Shapes are stated with the per-kind modules {@link value! | value} gathers:
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { boolean } from '@grafctory/blue/boolean';
|
|
14
|
+
* import { integer } from '@grafctory/blue/number';
|
|
15
|
+
* import { id, multiple, optional, required, resource } from '@grafctory/blue/resource';
|
|
16
|
+
* import { date, string } from '@grafctory/blue/string';
|
|
17
|
+
*
|
|
18
|
+
* const Product = resource({
|
|
19
|
+
* id: id(),
|
|
20
|
+
* name: required(string({ minLength: 1, maxLength: 100 })),
|
|
21
|
+
* price: required(integer({ minInclusive: 0 })),
|
|
22
|
+
* available: optional(boolean()),
|
|
23
|
+
* tags: multiple(string()),
|
|
24
|
+
* released: optional(date())
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* **Describing a shape as JSON Schema**
|
|
29
|
+
*
|
|
30
|
+
* A shape also declares schema-driven consumers, such as API descriptions, language model tool interfaces and
|
|
31
|
+
* structured output formats, without a hand-written schema restating it. The {@link schema} function describes the
|
|
32
|
+
* payloads a resource shape admits as a JSON Schema (draft 2020-12). Its strict variant keeps to the subset of JSON
|
|
33
|
+
* Schema accepted by structured output generators, which reject the keywords and formats outside it:
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { schema } from '@grafctory/blue';
|
|
37
|
+
*
|
|
38
|
+
* schema(Product); // the payloads Product admits
|
|
39
|
+
* schema(Product, { strict: true }); // the same, for strict structured output generators
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* **Collecting entry shapes and their dependencies**
|
|
43
|
+
*
|
|
44
|
+
* Model-wide encodings, such as vocabularies, schemas and documentation, cover every shape a set of entry shapes
|
|
45
|
+
* depends on rather than only the entry shapes themselves. The {@link model} function collects the entry shapes and
|
|
46
|
+
* the shapes they extend, link to or embed, each once and in a stable order, ready to be encoded as a whole:
|
|
47
|
+
*
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { model } from '@grafctory/blue';
|
|
50
|
+
* import { id, optional, resource } from '@grafctory/blue/resource';
|
|
51
|
+
* import { reference } from '@grafctory/blue/reference';
|
|
52
|
+
*
|
|
53
|
+
* const Vendor = resource({
|
|
54
|
+
* id: id()
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* const Offer = resource({
|
|
58
|
+
* id: id(),
|
|
59
|
+
* vendor: optional(reference(Vendor))
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* model(Offer); // [Offer, Vendor]
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* **Matching a value against a shape**
|
|
66
|
+
*
|
|
67
|
+
* The same shape answers three questions; the `model` option settles which is being asked:
|
|
68
|
+
*
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { validate } from '@grafctory/blue';
|
|
71
|
+
*
|
|
72
|
+
* validate(product, { shape: Product })({ // a resource in its own right
|
|
73
|
+
* value: product => console.log(product.name),
|
|
74
|
+
* trace: trace => console.error(trace)
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* validate(response, { shape: Product, model: { name: {} } }); // a retrieval, narrowed by what was asked for
|
|
78
|
+
* validate(request, { shape: Product, model: true }); // a retrieval template, before it is issued
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* - omitted, or `false`, matches `value` against the shape as a resource in its own right
|
|
82
|
+
* - a template matches `value` against the members that template asked for, and types what comes back accordingly
|
|
83
|
+
* - `true` matches `value` against the shape as a template, asking whether the shape can serve what it requests
|
|
84
|
+
*
|
|
85
|
+
* > [!CAUTION]
|
|
86
|
+
* > A template may draw on the full query language, including aggregate transforms and nested expansion. Hold an
|
|
87
|
+
* > untrusted caller to what the service will serve: `plain` refuses the aggregate transforms, `depth` caps the
|
|
88
|
+
* > nesting, and `limit` caps the page.
|
|
89
|
+
*
|
|
90
|
+
* @module index
|
|
91
|
+
*
|
|
92
|
+
* @see {@link https://json-schema.org/draft/2020-12/json-schema-core JSON Schema Core (draft 2020-12)}
|
|
93
|
+
* @see {@link https://www.w3.org/TR/shacl/ SHACL - Shapes Constraint Language}
|
|
94
|
+
*/
|
|
95
|
+
import { type Lazy, type Optional } from "@grafctory/core";
|
|
96
|
+
import { type Some } from "@grafctory/core/arrays";
|
|
97
|
+
import { type Relay } from "@grafctory/core/relay";
|
|
98
|
+
import { type Trace } from "@grafctory/core/trace";
|
|
99
|
+
import type { Template } from "@grafctory/qest/model";
|
|
100
|
+
import type { Reference } from "@grafctory/qest/state";
|
|
101
|
+
import type { JSONSchema } from "json-schema-typed";
|
|
102
|
+
import type { ResourceShape } from "./resource/index.js";
|
|
103
|
+
import { type Match, type State } from "./value/index.js";
|
|
104
|
+
/**
|
|
105
|
+
* Converts a resource shape into a JSON Schema.
|
|
106
|
+
*
|
|
107
|
+
* A resource is described as an object with one property per member. Like the shape, the object is closed and admits
|
|
108
|
+
* no other property. Members requiring at least one value are required, and a member admitting more than one value is
|
|
109
|
+
* described as an array of its range. Identifier and class members are left out, as they name the resource rather than
|
|
110
|
+
* describe it, so a payload stating them is rejected. A {@link reference!reference | reference} is described as the
|
|
111
|
+
* IRI it carries, and an embedded resource as a nested object. A {@link union!union | union} is described as the
|
|
112
|
+
* alternatives it admits, so the schema accepts a value conforming to any one of its branches.
|
|
113
|
+
*
|
|
114
|
+
* Value constraints are carried through: the bounds of a number and whether it is an integer, and the values, length
|
|
115
|
+
* bounds and lexical pattern of a string. A string in a well-known lexical form also carries the matching `format`, a
|
|
116
|
+
* hint for the consumers that recognise it about the kind of value expected and how to present or check it:
|
|
117
|
+
*
|
|
118
|
+
* - {@link string!url | url} as `uri`, {@link string!iri | iri} as `iri-reference`
|
|
119
|
+
* - {@link string!email | email} as `email`
|
|
120
|
+
* - {@link string!date | date} as `date`, {@link string!time | time} as `time`
|
|
121
|
+
* - {@link string!instant | instant} and {@link string!timestamp | timestamp} as `date-time`
|
|
122
|
+
*
|
|
123
|
+
* Values are still held to the pattern alone: a validator asserting formats may reject values the shape admits, such
|
|
124
|
+
* as a time with no zone offset, so formats are best read as annotations rather than as constraints.
|
|
125
|
+
*
|
|
126
|
+
* The name and description of a resource and of each member are carried as `title` and `description`. A member
|
|
127
|
+
* admitting more than one value annotates the array rather than its items. Localised names and descriptions are
|
|
128
|
+
* carried in English, and are left out if they are stated in no English, as a schema has room for one language only.
|
|
129
|
+
*
|
|
130
|
+
* A strict schema keeps to the subset of JSON Schema accepted by strict structured output generators. Every member is
|
|
131
|
+
* required. An optional single-valued member also admits `null` for an absent value, and an absent multi-valued member
|
|
132
|
+
* is stated as an empty array. A payload generated under a strict schema therefore conforms to the shape only once its
|
|
133
|
+
* `null` members are dropped. No string carries the `uri` or `iri-reference` format: IRI strings are held to their
|
|
134
|
+
* pattern, and references only to being strings, as strict generators reject both formats.
|
|
135
|
+
*
|
|
136
|
+
* The returned schema is deeply immutable. Conversions are cached, so converting the same shape again with the same
|
|
137
|
+
* options returns the same schema at no cost, whether the shape is passed as is or deferred. Cached schemas are kept
|
|
138
|
+
* for the lifetime of the module, so shapes are best declared once rather than built anew on each conversion.
|
|
139
|
+
*
|
|
140
|
+
* @param shape The resource shape to convert, possibly deferred
|
|
141
|
+
* @param options The conversion options
|
|
142
|
+
*
|
|
143
|
+
* @returns The JSON Schema describing the values `shape` admits
|
|
144
|
+
*
|
|
145
|
+
* @throws {@link @grafctory/core!TraceError | TraceError} Where `shape` is malformed, as where it embeds itself with no
|
|
146
|
+
* link to break the cycle and so admits no finite payload a schema could describe
|
|
147
|
+
* @throws {@link !RangeError RangeError} If `shape` admits a {@link dictionary!dictionary | localised} value range at
|
|
148
|
+
* any depth, as a JSON Schema has no way to name the language tags keying each localised value it describes
|
|
149
|
+
*
|
|
150
|
+
* @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#section-7.3 JSON Schema § 7.3 Defined Formats}
|
|
151
|
+
*/
|
|
152
|
+
export declare function schema(shape: Lazy<ResourceShape>, { strict }?: {
|
|
153
|
+
/**
|
|
154
|
+
* Whether to produce a strict schema for structured output generators.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue false
|
|
157
|
+
*/
|
|
158
|
+
readonly strict?: boolean;
|
|
159
|
+
}): JSONSchema.Interface;
|
|
160
|
+
/**
|
|
161
|
+
* Collects entry shapes and their dependencies.
|
|
162
|
+
*
|
|
163
|
+
* A shape depends on the shapes it extends and on the shapes its properties link to or embed, directly or through
|
|
164
|
+
* other shapes. Dependencies include the targets of {@link resource!PropertyConstraints.foreign | foreign} properties
|
|
165
|
+
* and the resource alternatives of {@link union!union | unions}, so the listing covers the whole connected model.
|
|
166
|
+
*
|
|
167
|
+
* Each shape is listed once, even where shapes link to each other in a cycle. The entry shapes come first, in the
|
|
168
|
+
* order given, followed by their dependencies, nearest first. Shapes at the same distance follow the order of the
|
|
169
|
+
* shapes reaching them, each contributing its parents before its property targets, in declaration order.
|
|
170
|
+
*
|
|
171
|
+
* Shapes are compared by reference, so a merged shape is listed alongside the shapes it merges. A property embedding
|
|
172
|
+
* different shapes along different inheritance paths, or re-pointed at a narrower embedded shape, ranges over a new
|
|
173
|
+
* shape stating the class of the narrowest, and the listing may then hold two shapes of that class. A shape embedded
|
|
174
|
+
* alike along every path is listed once, provided the shared definition is passed as its factory, as in
|
|
175
|
+
* `optional(Image)`, rather than built by separate calls to it, which return distinct shapes.
|
|
176
|
+
*
|
|
177
|
+
* @param shapes The entry shape or shapes, possibly deferred
|
|
178
|
+
*
|
|
179
|
+
* @returns The entry shapes followed by their dependencies; empty if `shapes` is empty
|
|
180
|
+
*
|
|
181
|
+
* @see {@link https://www.w3.org/TR/shacl/#shapes-graph SHACL § 3.1 Shapes Graph}
|
|
182
|
+
*/
|
|
183
|
+
export declare function model(shapes: Some<Lazy<ResourceShape>>): readonly ResourceShape[];
|
|
184
|
+
/**
|
|
185
|
+
* Validates a resource against a shape.
|
|
186
|
+
*
|
|
187
|
+
* Reports what a resource states wrongly, so that a caller may refuse it before it reaches the store holding it, and
|
|
188
|
+
* hands back the resource itself where it passes, typed as the shape describes it. Every member the shape declares is
|
|
189
|
+
* held to it and one it doesn't declare is rejected, the shape being closed; a member the shape admits no value for
|
|
190
|
+
* may be left out.
|
|
191
|
+
*
|
|
192
|
+
* > [!CAUTION]
|
|
193
|
+
* > A captive member is expanded to whatever depth it reaches. Where a caller must be held to bare links, state
|
|
194
|
+
* > `depth` as `0` to refuse every expansion, or as the nesting it may ask for.
|
|
195
|
+
*
|
|
196
|
+
* > [!TIP]
|
|
197
|
+
* > Revalidating a value costs nothing where the second call asks for no more than the first: the earlier verdict is
|
|
198
|
+
* > read off the value itself, so a caller may validate defensively wherever it is unsure.
|
|
199
|
+
*
|
|
200
|
+
* @typeParam S The shape the resource is matched against
|
|
201
|
+
*
|
|
202
|
+
* @param value The value to validate as a resource
|
|
203
|
+
* @param opts Validation options
|
|
204
|
+
* @param opts.shape The shape the resource is matched against, possibly deferred to break definition cycles
|
|
205
|
+
* @param opts.model Omitted, or `false`, to validate `value` as a resource in its own right
|
|
206
|
+
* @param opts.entry The identifier the resource is expected to be named by, where it states one at all
|
|
207
|
+
* @param opts.depth The nesting a captive member may be expanded to, counting each resource it descends into; `0`
|
|
208
|
+
* refuses every expansion while still admitting the identifier naming the resource
|
|
209
|
+
*
|
|
210
|
+
* @returns A {@link Relay} carrying the resource where it passes and a trace of the violations where it doesn't
|
|
211
|
+
*
|
|
212
|
+
* @throws {@link @grafctory/core!TraceError | TraceError} Where `shape` is malformed
|
|
213
|
+
*/
|
|
214
|
+
export declare function validate<S extends Lazy<ResourceShape>>(value: unknown, opts: {
|
|
215
|
+
readonly shape: S;
|
|
216
|
+
readonly model?: false;
|
|
217
|
+
readonly entry?: Reference;
|
|
218
|
+
readonly depth?: number;
|
|
219
|
+
}): Relay<{
|
|
220
|
+
/**
|
|
221
|
+
* The resource as it stands, typed as the shape describes it; relayed where it passes.
|
|
222
|
+
*/
|
|
223
|
+
readonly value: State<S>;
|
|
224
|
+
/**
|
|
225
|
+
* The violations the resource states, keyed by the member at fault; relayed where it doesn't pass.
|
|
226
|
+
*/
|
|
227
|
+
readonly trace: Optional<Trace>;
|
|
228
|
+
}>;
|
|
229
|
+
/**
|
|
230
|
+
* Validates a retrieved resource against a shape, narrowed by the template that requested it.
|
|
231
|
+
*
|
|
232
|
+
* Reports what a retrieval brought back wrongly, so that a caller may refuse a malformed response before reading it,
|
|
233
|
+
* and hands back the resource typed as the template asked for it. Only the members the template names are held to the
|
|
234
|
+
* shape, so a partial retrieval passes on its own terms, and a member the template didn't ask for is rejected, the
|
|
235
|
+
* caller having nowhere to put it. Reach for this where the shape fixes what may be asked for and the template varies
|
|
236
|
+
* from one request to the next.
|
|
237
|
+
*
|
|
238
|
+
* > [!IMPORTANT]
|
|
239
|
+
* > The custom {@link ResourceShape.validators | checks} a shape states never run against a retrieved resource, even
|
|
240
|
+
* > one the template asked for whole: they run only where a whole resource is validated in its own right.
|
|
241
|
+
*
|
|
242
|
+
* > [!NOTE]
|
|
243
|
+
* > The template states which values are wanted and no longer what they are, so every type comes from the shape: the
|
|
244
|
+
* > resource comes back as {@link Match} resolves it, keyed down to the members the template named. A polymorphic
|
|
245
|
+
* > member, a projection column and a localised member come back as wide as the shape describes them.
|
|
246
|
+
*
|
|
247
|
+
* > [!TIP]
|
|
248
|
+
* > Revalidating a value against the same shape and template costs nothing, as
|
|
249
|
+
* > {@link validate | validating a resource} explains.
|
|
250
|
+
*
|
|
251
|
+
* @typeParam S The shape the resource is matched against
|
|
252
|
+
* @typeParam M The template the resource was requested by
|
|
253
|
+
*
|
|
254
|
+
* @param value The value to validate as a retrieved resource
|
|
255
|
+
* @param opts Validation options
|
|
256
|
+
* @param opts.shape The shape the resource is matched against, possibly deferred to break definition cycles
|
|
257
|
+
* @param opts.model The template that requested it, narrowing both what is checked and what comes back
|
|
258
|
+
* @param opts.entry The identifier the resource is expected to be named by, where it states one at all
|
|
259
|
+
*
|
|
260
|
+
* @returns A {@link Relay} carrying the resource where it passes and a trace of the violations where it doesn't
|
|
261
|
+
*
|
|
262
|
+
* @throws {@link @grafctory/core!TraceError | TraceError} Where `shape` is malformed
|
|
263
|
+
*/
|
|
264
|
+
export declare function validate<S extends Lazy<ResourceShape>, M extends Template>(value: unknown, opts: {
|
|
265
|
+
readonly shape: S;
|
|
266
|
+
readonly model: M;
|
|
267
|
+
readonly entry?: Reference;
|
|
268
|
+
}): Relay<{
|
|
269
|
+
/**
|
|
270
|
+
* The resource as it stands, typed as the template asked for it; relayed where it passes.
|
|
271
|
+
*/
|
|
272
|
+
readonly value: Match<S, M>;
|
|
273
|
+
/**
|
|
274
|
+
* The violations the retrieval brought back, keyed by the member at fault; relayed where it doesn't pass.
|
|
275
|
+
*/
|
|
276
|
+
readonly trace: Optional<Trace>;
|
|
277
|
+
}>;
|
|
278
|
+
/**
|
|
279
|
+
* Validates a retrieval template against a shape.
|
|
280
|
+
*
|
|
281
|
+
* Reports each slot of a template that asks for something the shape cannot give, so that a caller may refuse a
|
|
282
|
+
* request before issuing it, and hands back the template itself where it passes, held to what the service
|
|
283
|
+
* guarantees. A template describes what to retrieve rather than what is held, so the value-domain constraints are
|
|
284
|
+
* left alone and a slot the template omits is simply not asked for.
|
|
285
|
+
*
|
|
286
|
+
* > [!CAUTION]
|
|
287
|
+
* > A template may draw on the full query language, including aggregate transforms and nested expansion. Hold an
|
|
288
|
+
* > untrusted caller to what the service will serve: `plain` refuses the aggregate transforms, `depth` caps the
|
|
289
|
+
* > nesting, and `limit` caps the page.
|
|
290
|
+
*
|
|
291
|
+
* > [!TIP]
|
|
292
|
+
* > A member reaching a standalone resource may be asked for as the identifier naming it or as a template standing for
|
|
293
|
+
* > the resource behind it; an embedded one, having no identifier of its own, only as a template. Stating `depth` as
|
|
294
|
+
* > `0` thus leaves a link retrievable while refusing the resource behind it.
|
|
295
|
+
*
|
|
296
|
+
* > [!TIP]
|
|
297
|
+
* > Revalidating a value costs nothing where the second call asks for no more than the first, as
|
|
298
|
+
* > {@link validate | validating a resource} explains.
|
|
299
|
+
*
|
|
300
|
+
* @typeParam T The template the shape admits
|
|
301
|
+
*
|
|
302
|
+
* @param value The value to validate as a retrieval template
|
|
303
|
+
* @param opts Validation options
|
|
304
|
+
* @param opts.shape The shape the template is matched against, possibly deferred to break definition cycles
|
|
305
|
+
* @param opts.model Must be `true` to validate `value` as a template rather than as a resource
|
|
306
|
+
* @param opts.plain Whether to refuse the transforms combining several values into one, leaving a template that
|
|
307
|
+
* retrieves rather than computes
|
|
308
|
+
* @param opts.depth The nesting a template may ask for, counting each resource it descends into; `0` refuses every
|
|
309
|
+
* nested template while still admitting the identifier naming the resource
|
|
310
|
+
* @param opts.limit The largest page a template may ask for; a collection asking for none is held to it, and one
|
|
311
|
+
* asking for more is refused. `0`, like omitting it, leaves the page to the caller
|
|
312
|
+
*
|
|
313
|
+
* @returns A {@link Relay} carrying the template where it passes and a trace of the violations where it doesn't
|
|
314
|
+
*
|
|
315
|
+
* @throws {@link @grafctory/core!TraceError | TraceError} Where `shape` is malformed
|
|
316
|
+
*/
|
|
317
|
+
export declare function validate<T extends Template>(value: unknown, opts: {
|
|
318
|
+
readonly shape: Lazy<ResourceShape>;
|
|
319
|
+
readonly model: true;
|
|
320
|
+
readonly plain?: boolean;
|
|
321
|
+
readonly depth?: number;
|
|
322
|
+
readonly limit?: number;
|
|
323
|
+
}): Relay<{
|
|
324
|
+
/**
|
|
325
|
+
* The template, held to what the service guarantees; relayed where it passes.
|
|
326
|
+
*/
|
|
327
|
+
readonly value: T;
|
|
328
|
+
/**
|
|
329
|
+
* The violations the template states, keyed by the slot at fault; relayed where it doesn't pass.
|
|
330
|
+
*/
|
|
331
|
+
readonly trace: Optional<Trace>;
|
|
332
|
+
}>;
|
|
333
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAEH,OAAO,EAAY,KAAK,IAAI,EAAkB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGnE,OAAO,EAAS,KAAK,KAAK,EAAc,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA6M7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,EAElD,MAAc,EAE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