@_linked/core 2.15.1 → 2.16.0-next.20260816080201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/ontologies/shacl.d.ts +31 -0
- package/lib/esm/ontologies/shacl.js +31 -0
- package/lib/esm/ontologies/shacl.js.map +1 -1
- package/lib/esm/queries/CreateBuilder.js +3 -16
- package/lib/esm/queries/CreateBuilder.js.map +1 -1
- package/lib/esm/queries/MutationQuery.d.ts +18 -19
- package/lib/esm/queries/MutationQuery.js +20 -83
- package/lib/esm/queries/MutationQuery.js.map +1 -1
- package/lib/esm/queries/UpdateBuilder.js +1 -1
- package/lib/esm/queries/UpdateBuilder.js.map +1 -1
- package/lib/esm/queries/lower.js +5 -2
- package/lib/esm/queries/lower.js.map +1 -1
- package/lib/esm/queries/lowerMutationJSON.d.ts +0 -4
- package/lib/esm/queries/lowerMutationJSON.js +18 -1
- package/lib/esm/queries/lowerMutationJSON.js.map +1 -1
- package/lib/esm/shapes/validation.d.ts +105 -0
- package/lib/esm/shapes/validation.js +586 -0
- package/lib/esm/shapes/validation.js.map +1 -0
- package/lib/esm/sparql/irToAlgebra.js +86 -19
- package/lib/esm/sparql/irToAlgebra.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* SHACL-aligned validation of plain data objects against a node shape.
|
|
8
|
+
*
|
|
9
|
+
* One entry point — {@link validate} — used by the create and update pipelines
|
|
10
|
+
* (via `MutationQueryFactory.describe()`) and directly by callers that want to
|
|
11
|
+
* know how well an object fits a shape without building a mutation.
|
|
12
|
+
*
|
|
13
|
+
* **Shape of the output.** This library has no triple/Turtle layer and this
|
|
14
|
+
* module does not add one: a {@link ValidationReport} is plain JavaScript. It is
|
|
15
|
+
* however 1-1 with the SHACL vocabulary — one key per SHACL property, named
|
|
16
|
+
* after it, holding a value the mutation pipeline accepts (a literal, or a
|
|
17
|
+
* `{id}` node reference for IRI-valued properties). So a report can be
|
|
18
|
+
* materialized by an ordinary create query as soon as shape classes for
|
|
19
|
+
* `sh:ValidationReport` / `sh:ValidationResult` exist, with no transform step:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* const report = validate(Slide, data);
|
|
23
|
+
* await ValidationReport.create(report); // once those shape classes exist
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Two deliberate departures, both documented on the types: `results` is plural
|
|
27
|
+
* where SHACL's repeated property is `sh:result`, and `propertyPath` is a
|
|
28
|
+
* non-SHACL locator. Both map cleanly — a shape class chooses its own labels for
|
|
29
|
+
* SHACL paths, and an extension property is legal on a SHACL report.
|
|
30
|
+
*
|
|
31
|
+
* **Coverage.** Cardinality (`sh:minCount` / `sh:maxCount`), node kind (literal
|
|
32
|
+
* vs relation), undeclared properties (as `sh:closed`), `sh:datatype`, the four
|
|
33
|
+
* `sh:min/maxInclusive/Exclusive` bounds, `sh:min/maxLength`, `sh:pattern` and
|
|
34
|
+
* `sh:in`. Each is one entry in {@link CARDINALITY_CONSTRAINTS} or
|
|
35
|
+
* {@link VALUE_CONSTRAINTS}, so adding another is one function and one test.
|
|
36
|
+
*
|
|
37
|
+
* Not covered: `sh:languageIn` / `sh:uniqueLang` (skipped at serialization time
|
|
38
|
+
* too, so there is no metadata to check against) and `sh:hasValue`.
|
|
39
|
+
*/
|
|
40
|
+
import { shacl } from '../ontologies/shacl.js';
|
|
41
|
+
import { xsd } from '../ontologies/xsd.js';
|
|
42
|
+
import { isNodeReferenceValue } from '../utils/NodeReference.js';
|
|
43
|
+
import { getUniquePropertyShapes } from './nodeShapeData.js';
|
|
44
|
+
import { getShapeClass } from '../utils/ShapeClass.js';
|
|
45
|
+
import { isExpressionNode } from '../expressions/ExpressionNode.js';
|
|
46
|
+
import { asContextRef } from '../queries/QueryContext.js';
|
|
47
|
+
/** Thrown by {@link assertValid} — carries the full report, not just the first violation. */
|
|
48
|
+
export class ShapeValidationError extends Error {
|
|
49
|
+
constructor(report) {
|
|
50
|
+
super(report.results.map((r) => r.resultMessage).join('\n'));
|
|
51
|
+
this.name = 'ShapeValidationError';
|
|
52
|
+
this.report = report;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Keys that carry metadata about the node rather than a property value: `id` /
|
|
57
|
+
* `__id` name it, and `shape` names the shape of a nested value when the
|
|
58
|
+
* property shape itself doesn't declare one (see `convertUpdateValue`).
|
|
59
|
+
*/
|
|
60
|
+
const RESERVED_KEYS = new Set(['id', '__id', 'shape']);
|
|
61
|
+
/**
|
|
62
|
+
* The message for an undeclared property key. Shared with the normalization path
|
|
63
|
+
* in `MutationQuery`, which needs the same guard to build a field at all.
|
|
64
|
+
*/
|
|
65
|
+
export function undeclaredPropertyMessage(key, shape) {
|
|
66
|
+
var _a;
|
|
67
|
+
const shapeName = shape.label || ((_a = shape.id) === null || _a === void 0 ? void 0 : _a.split('/').pop());
|
|
68
|
+
return (`Invalid property key: ${key}. The shape ${shapeName} does not have a registered ` +
|
|
69
|
+
`property with this name. Make sure the get/set method exists, and that it uses a ` +
|
|
70
|
+
`@objectProperty or @literalProperty decorator.`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* `sh:value` must be an RDF term. A literal or a node reference is one; a plain
|
|
74
|
+
* object, array or function is not, so it is left off rather than emitted as
|
|
75
|
+
* something no store could materialize — the message still names it.
|
|
76
|
+
*/
|
|
77
|
+
function asTerm(value) {
|
|
78
|
+
if (isScalarValue(value))
|
|
79
|
+
return value;
|
|
80
|
+
if (isNodeReference(value))
|
|
81
|
+
return { id: value.id };
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A violation about the node itself rather than one of its property shapes —
|
|
86
|
+
* `sh:sourceShape` is the node shape, and there is no `sh:resultPath` (an
|
|
87
|
+
* undeclared key has no property IRI to point at).
|
|
88
|
+
*/
|
|
89
|
+
function nodeViolation(shape, ctx, component, message, propertyPath, value) {
|
|
90
|
+
const result = {
|
|
91
|
+
sourceConstraintComponent: component,
|
|
92
|
+
resultSeverity: shacl.Violation,
|
|
93
|
+
resultMessage: message,
|
|
94
|
+
};
|
|
95
|
+
if (ctx.focusNode)
|
|
96
|
+
result.focusNode = { id: ctx.focusNode };
|
|
97
|
+
if (propertyPath)
|
|
98
|
+
result.propertyPath = propertyPath;
|
|
99
|
+
const term = asTerm(value);
|
|
100
|
+
if (term !== undefined)
|
|
101
|
+
result.value = term;
|
|
102
|
+
if (shape.id)
|
|
103
|
+
result.sourceShape = { id: shape.id };
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Build a result, omitting absent keys entirely — an `undefined` value is not a
|
|
108
|
+
* property the create pipeline should see.
|
|
109
|
+
*/
|
|
110
|
+
function violation(ctx, component, message, value) {
|
|
111
|
+
const result = {
|
|
112
|
+
sourceConstraintComponent: component,
|
|
113
|
+
resultSeverity: shacl.Violation,
|
|
114
|
+
resultMessage: message,
|
|
115
|
+
};
|
|
116
|
+
if (ctx.focusNode)
|
|
117
|
+
result.focusNode = { id: ctx.focusNode };
|
|
118
|
+
const path = ctx.propertyShape.path;
|
|
119
|
+
if (path === null || path === void 0 ? void 0 : path.id)
|
|
120
|
+
result.resultPath = { id: path.id };
|
|
121
|
+
if (ctx.property)
|
|
122
|
+
result.propertyPath = ctx.property;
|
|
123
|
+
const term = asTerm(value);
|
|
124
|
+
if (term !== undefined)
|
|
125
|
+
result.value = term;
|
|
126
|
+
const sourceShape = ctx.propertyShape.id || ctx.shape.id;
|
|
127
|
+
if (sourceShape)
|
|
128
|
+
result.sourceShape = { id: sourceShape };
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
/** The label used in messages — the property's own label, not its nested path. */
|
|
132
|
+
function labelOf(ps) {
|
|
133
|
+
return ps.label || ps.id;
|
|
134
|
+
}
|
|
135
|
+
/** `sh:maxCount` — no more values than the shape allows. */
|
|
136
|
+
const maxCountCheck = (values, ctx) => {
|
|
137
|
+
const { maxCount } = ctx.propertyShape;
|
|
138
|
+
if (typeof maxCount !== 'number' || values.length <= maxCount)
|
|
139
|
+
return [];
|
|
140
|
+
return [
|
|
141
|
+
violation(ctx, shacl.MaxCountConstraintComponent, `Property '${labelOf(ctx.propertyShape)}' allows at most ${maxCount} value(s), but ${values.length} were provided.`),
|
|
142
|
+
];
|
|
143
|
+
};
|
|
144
|
+
/** `sh:minCount` — at least as many values as the shape requires. */
|
|
145
|
+
const minCountCheck = (values, ctx) => {
|
|
146
|
+
const { minCount } = ctx.propertyShape;
|
|
147
|
+
if (typeof minCount !== 'number' || minCount <= 0 || values.length >= minCount)
|
|
148
|
+
return [];
|
|
149
|
+
return [
|
|
150
|
+
violation(ctx, shacl.MinCountConstraintComponent, `Property '${labelOf(ctx.propertyShape)}' requires at least ${minCount} value(s), but ${values.length} were provided.`),
|
|
151
|
+
];
|
|
152
|
+
};
|
|
153
|
+
/** True when the property clearly accepts only literal values. */
|
|
154
|
+
function expectsLiteral(ps) {
|
|
155
|
+
if (ps.nodeKind)
|
|
156
|
+
return ps.nodeKind.id === shacl.Literal.id;
|
|
157
|
+
return !!ps.datatype && !ps.valueShape;
|
|
158
|
+
}
|
|
159
|
+
/** True when the property clearly accepts only nodes (IRIs/blank nodes). */
|
|
160
|
+
function expectsNode(ps) {
|
|
161
|
+
if (ps.nodeKind) {
|
|
162
|
+
return (ps.nodeKind.id === shacl.IRI.id ||
|
|
163
|
+
ps.nodeKind.id === shacl.BlankNode.id ||
|
|
164
|
+
ps.nodeKind.id === shacl.BlankNodeOrIRI.id);
|
|
165
|
+
}
|
|
166
|
+
return !!ps.valueShape;
|
|
167
|
+
}
|
|
168
|
+
function isScalarValue(value) {
|
|
169
|
+
return (typeof value === 'string' ||
|
|
170
|
+
typeof value === 'number' ||
|
|
171
|
+
typeof value === 'boolean' ||
|
|
172
|
+
value instanceof Date);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* `sh:nodeKind` — literal properties reject nodes/objects, relation properties
|
|
176
|
+
* reject bare scalars. Ambiguous kinds (`sh:IRIOrLiteral`, or no `nodeKind` and
|
|
177
|
+
* no `datatype`/`valueShape` to infer from) are not enforced.
|
|
178
|
+
*/
|
|
179
|
+
const nodeKindCheck = (values, ctx) => {
|
|
180
|
+
const ps = ctx.propertyShape;
|
|
181
|
+
const literalExpected = expectsLiteral(ps);
|
|
182
|
+
const nodeExpected = expectsNode(ps);
|
|
183
|
+
if (!literalExpected && !nodeExpected)
|
|
184
|
+
return [];
|
|
185
|
+
const results = [];
|
|
186
|
+
for (const el of values) {
|
|
187
|
+
if (!isCheckableElement(el))
|
|
188
|
+
continue;
|
|
189
|
+
const scalar = isScalarValue(el);
|
|
190
|
+
if (literalExpected && !scalar) {
|
|
191
|
+
results.push(violation(ctx, shacl.NodeKindConstraintComponent, `Property '${labelOf(ps)}' is a literal property but was given a ${typeof el === 'object' ? 'node/object' : typeof el} value.`, el));
|
|
192
|
+
}
|
|
193
|
+
else if (nodeExpected && scalar) {
|
|
194
|
+
results.push(violation(ctx, shacl.NodeKindConstraintComponent, `Property '${labelOf(ps)}' is a relation (object) property but was given a literal (${typeof el}). Provide a {id} reference or a nested object.`, el));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return results;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* An element worth checking: a concrete value rather than something whose final
|
|
201
|
+
* form is decided elsewhere (an expression, a context ref, an absent value).
|
|
202
|
+
*/
|
|
203
|
+
function isCheckableElement(el) {
|
|
204
|
+
return el !== null && el !== undefined && !isExpressionNode(el) && !asContextRef(el);
|
|
205
|
+
}
|
|
206
|
+
const XSD_BASE = xsd.string.id.slice(0, -'string'.length);
|
|
207
|
+
/** `xsd:integer` rather than the full IRI, when the datatype is an XSD one. */
|
|
208
|
+
function datatypeLabel(datatype) {
|
|
209
|
+
return datatype.id.startsWith(XSD_BASE)
|
|
210
|
+
? `xsd:${datatype.id.slice(XSD_BASE.length)}`
|
|
211
|
+
: datatype.id;
|
|
212
|
+
}
|
|
213
|
+
/** How a value reads in a message — its JS kind, which is what went wrong. */
|
|
214
|
+
function describeValue(value) {
|
|
215
|
+
if (value instanceof Date)
|
|
216
|
+
return 'a Date';
|
|
217
|
+
if (Array.isArray(value))
|
|
218
|
+
return 'an array';
|
|
219
|
+
if (typeof value === 'number')
|
|
220
|
+
return Number.isInteger(value) ? 'a whole number' : 'a decimal number';
|
|
221
|
+
if (typeof value === 'object')
|
|
222
|
+
return 'a node/object';
|
|
223
|
+
return `a ${typeof value}`;
|
|
224
|
+
}
|
|
225
|
+
const isFiniteNumber = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
226
|
+
/**
|
|
227
|
+
* What each XSD datatype accepts as a JavaScript value.
|
|
228
|
+
*
|
|
229
|
+
* This matters more than a normal type check: mutation literals are typed from
|
|
230
|
+
* the *JavaScript* type when they reach SPARQL (`irToAlgebra`), not from the
|
|
231
|
+
* declared datatype — a number becomes `xsd:integer`/`xsd:double`, a boolean
|
|
232
|
+
* `xsd:boolean`, a `Date` `xsd:dateTime`, and a string an untyped literal. So a
|
|
233
|
+
* string handed to an `xsd:integer` property does not merely skip a check, it
|
|
234
|
+
* writes the wrong RDF term. Rejecting it is a correctness fix.
|
|
235
|
+
*
|
|
236
|
+
* Temporal properties take a `Date` and nothing else — one representation for a
|
|
237
|
+
* point in time, rather than a JS object and a hand-written lexical string that
|
|
238
|
+
* behave differently. The serializer derives the right lexical form from the
|
|
239
|
+
* declared datatype (`irToAlgebra.dateToTerm`), so an `xsd:date` property gets
|
|
240
|
+
* `"2020-06-15"^^xsd:date` from the same `Date` an `xsd:dateTime` property gets
|
|
241
|
+
* a full timestamp from.
|
|
242
|
+
*
|
|
243
|
+
* Datatypes with no obvious JS counterpart (`xsd:duration`, `xsd:gYear`,
|
|
244
|
+
* `xsd:Bytes`) are not checked.
|
|
245
|
+
*/
|
|
246
|
+
const DATATYPE_RULES = {
|
|
247
|
+
[xsd.string.id]: { accepts: (v) => typeof v === 'string', expected: 'a string' },
|
|
248
|
+
[xsd.boolean.id]: { accepts: (v) => typeof v === 'boolean', expected: 'a boolean' },
|
|
249
|
+
[xsd.integer.id]: { accepts: (v) => isFiniteNumber(v) && Number.isInteger(v), expected: 'a whole number' },
|
|
250
|
+
[xsd.long.id]: { accepts: (v) => isFiniteNumber(v) && Number.isInteger(v), expected: 'a whole number' },
|
|
251
|
+
[xsd.decimal.id]: { accepts: isFiniteNumber, expected: 'a number' },
|
|
252
|
+
[xsd.float.id]: { accepts: isFiniteNumber, expected: 'a number' },
|
|
253
|
+
[xsd.double.id]: { accepts: isFiniteNumber, expected: 'a number' },
|
|
254
|
+
[xsd.date.id]: { accepts: (v) => v instanceof Date, expected: 'a Date' },
|
|
255
|
+
[xsd.dateTime.id]: { accepts: (v) => v instanceof Date, expected: 'a Date' },
|
|
256
|
+
[xsd.time.id]: { accepts: (v) => v instanceof Date, expected: 'a Date' },
|
|
257
|
+
};
|
|
258
|
+
/** `sh:datatype` — the value's JavaScript type must match the declared datatype. */
|
|
259
|
+
const datatypeCheck = (values, ctx) => {
|
|
260
|
+
const ps = ctx.propertyShape;
|
|
261
|
+
if (!ps.datatype)
|
|
262
|
+
return [];
|
|
263
|
+
const rule = DATATYPE_RULES[ps.datatype.id];
|
|
264
|
+
if (!rule)
|
|
265
|
+
return [];
|
|
266
|
+
const results = [];
|
|
267
|
+
for (const el of values) {
|
|
268
|
+
// A node reference is a node-kind problem, not a datatype one — one
|
|
269
|
+
// violation per mistake, reported by the check that owns it.
|
|
270
|
+
if (!isCheckableElement(el) || isNodeReference(el) || rule.accepts(el))
|
|
271
|
+
continue;
|
|
272
|
+
results.push(violation(ctx, shacl.DatatypeConstraintComponent, `Property '${labelOf(ps)}' expects ${datatypeLabel(ps.datatype)} (${rule.expected}), but was given ${describeValue(el)}.`, el));
|
|
273
|
+
}
|
|
274
|
+
return results;
|
|
275
|
+
};
|
|
276
|
+
/** The four `sh:min/maxInclusive/Exclusive` range constraints, on numbers. */
|
|
277
|
+
const rangeCheck = (values, ctx) => {
|
|
278
|
+
const ps = ctx.propertyShape;
|
|
279
|
+
const bounds = [
|
|
280
|
+
{ limit: ps.minInclusive, component: shacl.MinInclusiveConstraintComponent, ok: (v, l) => v >= l, phrase: 'at least' },
|
|
281
|
+
{ limit: ps.maxInclusive, component: shacl.MaxInclusiveConstraintComponent, ok: (v, l) => v <= l, phrase: 'at most' },
|
|
282
|
+
{ limit: ps.minExclusive, component: shacl.MinExclusiveConstraintComponent, ok: (v, l) => v > l, phrase: 'greater than' },
|
|
283
|
+
{ limit: ps.maxExclusive, component: shacl.MaxExclusiveConstraintComponent, ok: (v, l) => v < l, phrase: 'less than' },
|
|
284
|
+
];
|
|
285
|
+
const active = bounds.filter((b) => typeof b.limit === 'number');
|
|
286
|
+
if (!active.length)
|
|
287
|
+
return [];
|
|
288
|
+
const results = [];
|
|
289
|
+
for (const el of values) {
|
|
290
|
+
// Non-numbers are the datatype check's business.
|
|
291
|
+
if (!isCheckableElement(el) || typeof el !== 'number')
|
|
292
|
+
continue;
|
|
293
|
+
for (const bound of active) {
|
|
294
|
+
if (bound.ok(el, bound.limit))
|
|
295
|
+
continue;
|
|
296
|
+
results.push(violation(ctx, bound.component, `Property '${labelOf(ps)}' must be ${bound.phrase} ${bound.limit}, but was given ${el}.`, el));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return results;
|
|
300
|
+
};
|
|
301
|
+
/** `sh:minLength` / `sh:maxLength`, on strings. */
|
|
302
|
+
const lengthCheck = (values, ctx) => {
|
|
303
|
+
const ps = ctx.propertyShape;
|
|
304
|
+
if (typeof ps.minLength !== 'number' && typeof ps.maxLength !== 'number')
|
|
305
|
+
return [];
|
|
306
|
+
const results = [];
|
|
307
|
+
for (const el of values) {
|
|
308
|
+
if (!isCheckableElement(el) || typeof el !== 'string')
|
|
309
|
+
continue;
|
|
310
|
+
if (typeof ps.minLength === 'number' && el.length < ps.minLength) {
|
|
311
|
+
results.push(violation(ctx, shacl.MinLengthConstraintComponent, `Property '${labelOf(ps)}' must be at least ${ps.minLength} character(s), but was given ${el.length}.`, el));
|
|
312
|
+
}
|
|
313
|
+
if (typeof ps.maxLength === 'number' && el.length > ps.maxLength) {
|
|
314
|
+
results.push(violation(ctx, shacl.MaxLengthConstraintComponent, `Property '${labelOf(ps)}' must be at most ${ps.maxLength} character(s), but was given ${el.length}.`, el));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return results;
|
|
318
|
+
};
|
|
319
|
+
/** `sh:pattern` — the string form of the value must match the shape's regex. */
|
|
320
|
+
const patternCheck = (values, ctx) => {
|
|
321
|
+
const ps = ctx.propertyShape;
|
|
322
|
+
if (!ps.pattern)
|
|
323
|
+
return [];
|
|
324
|
+
// Rebuild without `g`/`y`: those carry `lastIndex` between calls, so a shared
|
|
325
|
+
// shape regex would match every other value.
|
|
326
|
+
const regex = new RegExp(ps.pattern.source, ps.pattern.flags.replace(/[gy]/g, ''));
|
|
327
|
+
const results = [];
|
|
328
|
+
for (const el of values) {
|
|
329
|
+
if (!isCheckableElement(el) || typeof el !== 'string')
|
|
330
|
+
continue;
|
|
331
|
+
if (regex.test(el))
|
|
332
|
+
continue;
|
|
333
|
+
results.push(violation(ctx, shacl.PatternConstraintComponent, `Property '${labelOf(ps)}' must match ${String(ps.pattern)}, but was given "${el}".`, el));
|
|
334
|
+
}
|
|
335
|
+
return results;
|
|
336
|
+
};
|
|
337
|
+
/** `sh:in` — the value must be one of the shape's allowed values. */
|
|
338
|
+
const inCheck = (values, ctx) => {
|
|
339
|
+
var _a;
|
|
340
|
+
const ps = ctx.propertyShape;
|
|
341
|
+
if (!((_a = ps.in) === null || _a === void 0 ? void 0 : _a.length))
|
|
342
|
+
return [];
|
|
343
|
+
const allowed = ps.in;
|
|
344
|
+
const matches = (el) => allowed.some((a) => isNodeReferenceValue(a)
|
|
345
|
+
? isNodeReference(el) && el.id === a.id
|
|
346
|
+
: a === el);
|
|
347
|
+
const results = [];
|
|
348
|
+
for (const el of values) {
|
|
349
|
+
if (!isCheckableElement(el) || matches(el))
|
|
350
|
+
continue;
|
|
351
|
+
const rendered = allowed
|
|
352
|
+
.map((a) => (isNodeReferenceValue(a) ? a.id : JSON.stringify(a)))
|
|
353
|
+
.join(', ');
|
|
354
|
+
results.push(violation(ctx, shacl.InConstraintComponent, `Property '${labelOf(ps)}' must be one of [${rendered}].`, el));
|
|
355
|
+
}
|
|
356
|
+
return results;
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* The registry. Every property-level constraint the library enforces lives here;
|
|
360
|
+
* adding another SHACL component is one more entry plus its test.
|
|
361
|
+
*
|
|
362
|
+
* Split by what each kind of check needs to see. **Cardinality** needs the
|
|
363
|
+
* property's whole value set, so it cannot run against a set modification —
|
|
364
|
+
* `{add: […]}` changes a count that lives in the store. **Value** checks need
|
|
365
|
+
* only the value in hand, so they run everywhere a concrete value appears,
|
|
366
|
+
* including inside `add`.
|
|
367
|
+
*
|
|
368
|
+
* Cardinality runs first when it runs at all: a count problem explains itself
|
|
369
|
+
* better than the per-value violations that would follow it.
|
|
370
|
+
*/
|
|
371
|
+
const CARDINALITY_CONSTRAINTS = [maxCountCheck, minCountCheck];
|
|
372
|
+
const VALUE_CONSTRAINTS = [
|
|
373
|
+
nodeKindCheck,
|
|
374
|
+
datatypeCheck,
|
|
375
|
+
rangeCheck,
|
|
376
|
+
lengthCheck,
|
|
377
|
+
patternCheck,
|
|
378
|
+
inCheck,
|
|
379
|
+
];
|
|
380
|
+
const PROPERTY_CONSTRAINTS = [
|
|
381
|
+
...CARDINALITY_CONSTRAINTS,
|
|
382
|
+
...VALUE_CONSTRAINTS,
|
|
383
|
+
];
|
|
384
|
+
// ---------------------------------------------------------------------------
|
|
385
|
+
// Value classification
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
/**
|
|
388
|
+
* A `{add, remove}` set modification. The resulting value count depends on the
|
|
389
|
+
* node's current state, so cardinality and kind are unknowable here.
|
|
390
|
+
*/
|
|
391
|
+
function isSetModification(value) {
|
|
392
|
+
if (typeof value !== 'object' || value === null)
|
|
393
|
+
return false;
|
|
394
|
+
const obj = value;
|
|
395
|
+
const expected = (obj.add ? 1 : 0) + (obj.remove ? 1 : 0);
|
|
396
|
+
return expected > 0 && Object.getOwnPropertyNames(obj).length === expected;
|
|
397
|
+
}
|
|
398
|
+
/** An object carrying only an `id` — a reference to an existing node, not a description. */
|
|
399
|
+
function isNodeReference(value) {
|
|
400
|
+
return (typeof value === 'object' &&
|
|
401
|
+
value !== null &&
|
|
402
|
+
'id' in value &&
|
|
403
|
+
Object.keys(value).length === 1);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* A value that stands for something resolved later — an expression, a query
|
|
407
|
+
* context reference, a callback, or nothing at all.
|
|
408
|
+
*
|
|
409
|
+
* Must be ruled out *before* anything reads properties off the value: a resolved
|
|
410
|
+
* context ref is a query proxy that throws on any undecorated key, so probing it
|
|
411
|
+
* for `.add` is not a safe way to ask what it is.
|
|
412
|
+
*/
|
|
413
|
+
function isDeferredValue(value) {
|
|
414
|
+
return (value === undefined ||
|
|
415
|
+
typeof value === 'function' ||
|
|
416
|
+
isExpressionNode(value) ||
|
|
417
|
+
!!asContextRef(value));
|
|
418
|
+
}
|
|
419
|
+
/** Values whose final shape isn't knowable without the store or a lowering pass. */
|
|
420
|
+
function isOpaqueValue(value) {
|
|
421
|
+
return isDeferredValue(value) || isSetModification(value);
|
|
422
|
+
}
|
|
423
|
+
/** A nested node description — an object to descend into, rather than a leaf value. */
|
|
424
|
+
function isNodeDescription(value) {
|
|
425
|
+
return (typeof value === 'object' &&
|
|
426
|
+
value !== null &&
|
|
427
|
+
!Array.isArray(value) &&
|
|
428
|
+
!(value instanceof Date) &&
|
|
429
|
+
!isNodeReference(value) &&
|
|
430
|
+
!isOpaqueValue(value));
|
|
431
|
+
}
|
|
432
|
+
function resolveShapeData(shape) {
|
|
433
|
+
const resolved = 'propertyShapes' in shape ? shape : shape.shape;
|
|
434
|
+
if (!resolved) {
|
|
435
|
+
throw new Error('validate() requires a node shape or a shape class with a static `shape`. ' +
|
|
436
|
+
'Did you pass an unregistered class (missing @linkedShape)?');
|
|
437
|
+
}
|
|
438
|
+
return resolved;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Validate a plain data object against a node shape.
|
|
442
|
+
*
|
|
443
|
+
* Never throws for invalid *data* — a violation is a result, not an exception.
|
|
444
|
+
* (It does throw when the *shape* argument itself is unusable.)
|
|
445
|
+
*
|
|
446
|
+
* ```ts
|
|
447
|
+
* const report = validate(Person, {name: ['a', 'b']});
|
|
448
|
+
* report.conforms; // false
|
|
449
|
+
* report.results[0].sourceConstraintComponent.id; // …shacl#MaxCountConstraintComponent
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
export function validate(shape, data, options = {}) {
|
|
453
|
+
const { mode = 'complete', maxDepth = 10 } = options;
|
|
454
|
+
const results = validateNode(resolveShapeData(shape), data, {
|
|
455
|
+
mode,
|
|
456
|
+
maxDepth,
|
|
457
|
+
depth: 0,
|
|
458
|
+
prefix: '',
|
|
459
|
+
});
|
|
460
|
+
return {
|
|
461
|
+
conforms: !results.some((r) => r.resultSeverity.id === shacl.Violation.id),
|
|
462
|
+
results,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
/** {@link validate}, but throws a {@link ShapeValidationError} when the data doesn't conform. */
|
|
466
|
+
export function assertValid(shape, data, options = {}) {
|
|
467
|
+
const report = validate(shape, data, options);
|
|
468
|
+
if (!report.conforms)
|
|
469
|
+
throw new ShapeValidationError(report);
|
|
470
|
+
}
|
|
471
|
+
function validateNode(shape, data, ctx) {
|
|
472
|
+
if (typeof data !== 'object' || data === null || Array.isArray(data)) {
|
|
473
|
+
return [
|
|
474
|
+
nodeViolation(shape, ctx, shacl.NodeConstraintComponent, `Expected an object describing '${shape.label || shape.id}', but got ${data === null ? 'null' : typeof data}.`, ctx.prefix, data),
|
|
475
|
+
];
|
|
476
|
+
}
|
|
477
|
+
const obj = data;
|
|
478
|
+
const propertyShapes = getUniquePropertyShapes(shape);
|
|
479
|
+
const byLabel = new Map(propertyShapes.map((ps) => [ps.label, ps]));
|
|
480
|
+
const focusNode = typeof obj.__id === 'string'
|
|
481
|
+
? obj.__id
|
|
482
|
+
: typeof obj.id === 'string'
|
|
483
|
+
? obj.id
|
|
484
|
+
: ctx.focusNode;
|
|
485
|
+
const results = [];
|
|
486
|
+
// Presence of required properties — only decidable for a complete description.
|
|
487
|
+
if (ctx.mode === 'complete') {
|
|
488
|
+
for (const ps of propertyShapes) {
|
|
489
|
+
if (typeof ps.minCount !== 'number' || ps.minCount <= 0)
|
|
490
|
+
continue;
|
|
491
|
+
if (ps.label in obj)
|
|
492
|
+
continue;
|
|
493
|
+
results.push(violation({ shape, propertyShape: ps, property: join(ctx.prefix, ps.label), focusNode, mode: ctx.mode }, shacl.MinCountConstraintComponent, `Property '${labelOf(ps)}' requires at least ${ps.minCount} value(s), but none were provided.`));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// The values actually provided.
|
|
497
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
498
|
+
if (RESERVED_KEYS.has(key))
|
|
499
|
+
continue;
|
|
500
|
+
const propertyShape = byLabel.get(key);
|
|
501
|
+
if (!propertyShape) {
|
|
502
|
+
results.push(nodeViolation(shape, Object.assign(Object.assign({}, ctx), { focusNode }), shacl.ClosedConstraintComponent, undeclaredPropertyMessage(key, shape), join(ctx.prefix, key), value));
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
results.push(...validateProperty(value, {
|
|
506
|
+
shape,
|
|
507
|
+
propertyShape,
|
|
508
|
+
property: join(ctx.prefix, key),
|
|
509
|
+
focusNode,
|
|
510
|
+
mode: ctx.mode,
|
|
511
|
+
}, ctx));
|
|
512
|
+
}
|
|
513
|
+
return results;
|
|
514
|
+
}
|
|
515
|
+
function validateProperty(value, propCtx, walk) {
|
|
516
|
+
const ps = propCtx.propertyShape;
|
|
517
|
+
// `null` clears the property — the same as providing zero values, so clearing
|
|
518
|
+
// a required one is a cardinality violation (both spellings behave alike).
|
|
519
|
+
if (value === null) {
|
|
520
|
+
if (typeof ps.minCount === 'number' && ps.minCount > 0) {
|
|
521
|
+
return [
|
|
522
|
+
violation(propCtx, shacl.MinCountConstraintComponent, `Property '${labelOf(ps)}' requires at least ${ps.minCount} value(s) and cannot be cleared.`),
|
|
523
|
+
];
|
|
524
|
+
}
|
|
525
|
+
return [];
|
|
526
|
+
}
|
|
527
|
+
// Ruled out first: reading `.add` off a resolved context proxy would throw.
|
|
528
|
+
if (isDeferredValue(value))
|
|
529
|
+
return [];
|
|
530
|
+
// A set modification adds to and removes from what the store already holds,
|
|
531
|
+
// so the resulting *count* is unknowable here — but each added value is as
|
|
532
|
+
// checkable as any other, and skipping them let mistyped literals through the
|
|
533
|
+
// one door the rest of this module closes. `remove` takes `{id}` references
|
|
534
|
+
// only, which normalization enforces on its own.
|
|
535
|
+
if (isSetModification(value)) {
|
|
536
|
+
const { add } = value;
|
|
537
|
+
if (add === undefined)
|
|
538
|
+
return [];
|
|
539
|
+
return runChecks(VALUE_CONSTRAINTS, toValues(add), propCtx, walk);
|
|
540
|
+
}
|
|
541
|
+
return runChecks(PROPERTY_CONSTRAINTS, toValues(value), propCtx, walk);
|
|
542
|
+
}
|
|
543
|
+
/** A property's value(s) as an array — a single value becomes a one-element one. */
|
|
544
|
+
function toValues(value) {
|
|
545
|
+
return Array.isArray(value) ? value : [value];
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Run a set of constraint checks over a property's values, then descend into any
|
|
549
|
+
* nested node descriptions among them (`sh:node`-style recursion). A bare `{id}`
|
|
550
|
+
* is a reference to an existing node and has nothing to validate; an object with
|
|
551
|
+
* an id *and* data is a nested create with a predefined id.
|
|
552
|
+
*/
|
|
553
|
+
function runChecks(checks, values, propCtx, walk) {
|
|
554
|
+
const results = [];
|
|
555
|
+
for (const check of checks) {
|
|
556
|
+
results.push(...check(values, propCtx));
|
|
557
|
+
}
|
|
558
|
+
if (walk.depth < walk.maxDepth) {
|
|
559
|
+
for (const el of values) {
|
|
560
|
+
if (!isNodeDescription(el))
|
|
561
|
+
continue;
|
|
562
|
+
const nestedShape = resolveValueShape(propCtx.propertyShape, el);
|
|
563
|
+
if (!nestedShape)
|
|
564
|
+
continue;
|
|
565
|
+
results.push(...validateNode(nestedShape, el, Object.assign(Object.assign({}, walk), { depth: walk.depth + 1, prefix: propCtx.property, focusNode: undefined })));
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return results;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The shape a nested value should be validated against: the property's declared
|
|
572
|
+
* `valueShape`, or — for properties that declare none — the shape class carried
|
|
573
|
+
* in the value's reserved `shape` key. Mirrors `convertUpdateValue`; returns
|
|
574
|
+
* undefined when neither is available (normalization reports that itself).
|
|
575
|
+
*/
|
|
576
|
+
function resolveValueShape(ps, value) {
|
|
577
|
+
var _a;
|
|
578
|
+
if (ps.valueShape)
|
|
579
|
+
return (_a = getShapeClass(ps.valueShape)) === null || _a === void 0 ? void 0 : _a.shape;
|
|
580
|
+
const declared = value.shape;
|
|
581
|
+
return declared === null || declared === void 0 ? void 0 : declared.shape;
|
|
582
|
+
}
|
|
583
|
+
function join(prefix, label) {
|
|
584
|
+
return prefix ? `${prefix}.${label}` : label;
|
|
585
|
+
}
|
|
586
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1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