@_linked/core 2.36.0 → 2.36.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.36.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#353](https://github.com/linked-fw/core/pull/353) [`20a88f7`](https://github.com/linked-fw/core/commit/20a88f789a1f11054dca6907ba9e1d09cb0165b9) Thanks [@flyon](https://github.com/flyon)! - Errors for a shape that does not resolve name the scope only while a scoped `ShapeCatalog` is active (`withShapeCatalog`), as `Shape class not found for <Place> (property 'home' of '<Person>' points at it; not among the shapes in scope 'p1#main')`. Against the global registry the message ends after "points at it" (`… (property 'home' of '<Person>' points at it)`), and an error for a query's own shape is just its opening sentence. The opening of each message and the `shapeIri`, `property`, `propertyIri`, `ownerShapeIri` and `catalog` fields are unchanged.
8
+
3
9
  ## 2.36.0
4
10
 
5
11
  ### Minor Changes
@@ -651,9 +651,10 @@ function runChecks(checks, values, propCtx, walk) {
651
651
  */
652
652
  function unresolvedValueShapeMessage(ps, owner) {
653
653
  const label = labelOf(ps);
654
+ const why = ps.valueShape ? describeUnresolved(unresolvedValueShapeDetails(ps, owner)) : '';
654
655
  return ps.valueShape
655
- ? `Cannot validate the value of '${label}': its shape '${ps.valueShape.id}' does not resolve ` +
656
- `(${describeUnresolved(unresolvedValueShapeDetails(ps, owner))}).`
656
+ ? `Cannot validate the value of '${label}': its shape '${ps.valueShape.id}' does not resolve` +
657
+ (why ? ` (${why}).` : '.')
657
658
  : `Cannot validate the value of '${label}' of '${owner.id}': the property declares no shape for its values. ` +
658
659
  `Add a 'shape' to its @objectProperty decorator, or give the value a 'shape' key.`;
659
660
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/shapes/validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;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C,CAAC,iCAAiC,KAAK,SAAS,KAAK,CAAC,EAAE,oDAAoD;YACzG,kFAAkF,CAAC;AAC3F,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CACxB,EAAqB,EACrB,KAAc;;IAEd,MAAM,GAAG,GAAG,MAAC,KAA2C,CAAC,KAAK,0CAAE,KAAK,CAAC;IACtE,IAAI,CAAC,EAAE,CAAC,UAAU;QAAE,OAAO,GAAG,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAA,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,0CAAE,KAAK,CAAC;IAC1D,iFAAiF;IACjF,IAAI,GAAG,IAAI,QAAQ,IAAI,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;QAAE,OAAO,GAAG,CAAC;IAC/D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,IAAI,CAAC,MAAc,EAAE,KAAa;IACzC,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n/**\n * SHACL-aligned validation of plain data objects against a node shape.\n *\n * One entry point — {@link validate} — used by the create and update pipelines\n * (via `MutationQueryFactory.describe()`) and directly by callers that want to\n * know how well an object fits a shape without building a mutation.\n *\n * **Shape of the output.** This library has no triple/Turtle layer and this\n * module does not add one: a {@link ValidationReport} is plain JavaScript. It is\n * however 1-1 with the SHACL vocabulary — one key per SHACL property, named\n * after it, holding a value the mutation pipeline accepts (a literal, or a\n * `{id}` node reference for IRI-valued properties). So a report can be\n * materialized by an ordinary create query as soon as shape classes for\n * `sh:ValidationReport` / `sh:ValidationResult` exist, with no transform step:\n *\n * ```ts\n * const report = validate(Slide, data);\n * await ValidationReport.create(report); // once those shape classes exist\n * ```\n *\n * Two deliberate departures, both documented on the types: `results` is plural\n * where SHACL's repeated property is `sh:result`, and `propertyPath` is a\n * non-SHACL locator. Both map cleanly — a shape class chooses its own labels for\n * SHACL paths, and an extension property is legal on a SHACL report.\n *\n * **Coverage.** Cardinality (`sh:minCount` / `sh:maxCount`), node kind (literal\n * vs relation), undeclared properties (as `sh:closed`), `sh:datatype`, the four\n * `sh:min/maxInclusive/Exclusive` bounds, `sh:min/maxLength`, `sh:pattern` and\n * `sh:in`. Each is one entry in {@link CARDINALITY_CONSTRAINTS} or\n * {@link VALUE_CONSTRAINTS}, so adding another is one function and one test.\n *\n * Not covered: `sh:languageIn` / `sh:uniqueLang` (skipped at serialization time\n * too, so there is no metadata to check against) and `sh:hasValue`.\n */\nimport {getShapeRegistryInstanceCount, getQueryShapeClass} from '../utils/ShapeClass.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {brandLinkedError} from '../utils/linkedError.js';\nimport {xsd} from '../ontologies/xsd.js';\nimport {isNodeReferenceValue, type NodeReferenceValue} from '../utils/NodeReference.js';\nimport {getUniquePropertyShapes} from './nodeShapeData.js';\nimport type {NodeShapeData, PropertyShapeData} from './nodeShapeData.js';\nimport {getNodeShape, getShapeClass, isSubShapeOf} from '../utils/ShapeClass.js';\nimport {isExpressionNode} from '../expressions/ExpressionNode.js';\nimport {asContextRef} from '../queries/QueryContext.js';\nimport {describeUnresolved, unresolvedValueShapeDetails} from '../utils/unresolvedShape.js';\n\n/**\n * Which constraints apply to the data being validated.\n *\n * - `complete` — the object describes a whole node (a create, or a standalone\n * object being checked for fit). Properties absent from the data are genuinely\n * absent, so `sh:minCount` presence is checkable.\n * - `partial` — the object describes a change to an existing node (an update).\n * The store holds whatever the payload does not mention, so presence is\n * unknowable; only the values actually provided are checked.\n */\nexport type ValidationMode = 'complete' | 'partial';\n\n/**\n * A single constraint violation — an `sh:ValidationResult`.\n *\n * Every key is the local name of the SHACL property it carries, and every value\n * is in a form the create pipeline accepts (a literal, or a `{id}` node\n * reference for IRI-valued properties). A shape class declaring these\n * properties therefore materializes a result with no transform step:\n * `ValidationResult.create(result)`. The one non-SHACL key is `propertyPath`;\n * see {@link ValidationReport}.\n */\nexport interface ValidationResult {\n /** `sh:focusNode` — the node the violation is about, when its id is known. */\n focusNode?: NodeReferenceValue;\n /** `sh:resultPath` — the IRI of the property the violation is about. */\n resultPath?: NodeReferenceValue;\n /**\n * `sh:value` — the offending value, present only when it is an RDF term (a\n * literal or a node reference). Cardinality violations are about the property\n * rather than any one value, so they carry none.\n */\n value?: LiteralTerm | NodeReferenceValue;\n /** `sh:sourceShape` — the node or property shape carrying the constraint. */\n sourceShape?: NodeReferenceValue;\n /** `sh:sourceConstraintComponent` — which SHACL constraint failed. */\n sourceConstraintComponent: NodeReferenceValue;\n /** `sh:resultSeverity` — `sh:Violation`, `sh:Warning` or `sh:Info`. */\n resultSeverity: NodeReferenceValue;\n /** `sh:resultMessage` — human-readable explanation. */\n resultMessage: string;\n /**\n * **Not SHACL.** The property's label, dot-joined through nested shapes\n * (`author.fullName`) — the locator a caller needs to point at a field in the\n * object they passed in, which `sh:resultPath` alone cannot give (it names the\n * property, not where the nesting reached it). Materializes like any other\n * property once a shape class declares it; drop it for a pure-SHACL result.\n */\n propertyPath?: string;\n}\n\n/**\n * The outcome of a validation run — an `sh:ValidationReport`.\n *\n * Plain objects, 1-1 with the SHACL vocabulary, so a report can later be\n * materialized through an ordinary create query against shape classes for\n * `sh:ValidationReport` / `sh:ValidationResult` — whether or not this library\n * ever ships those classes. `results` is the sole plural rename (SHACL's\n * property is `sh:result`, repeated); a shape class maps it with\n * `@objectProperty({path: shacl.result, …}) get results()`.\n */\nexport interface ValidationReport {\n /** `sh:conforms` — true when there are no `sh:Violation`-severity results. */\n conforms: boolean;\n /** `sh:result` — every violation found, in deterministic order. */\n results: ValidationResult[];\n}\n\n/** The literal types the mutation pipeline accepts as a value. */\ntype LiteralTerm = string | number | boolean | Date;\n\nexport interface ValidateOptions {\n /** Defaults to `complete`. */\n mode?: ValidationMode;\n /** How deep to descend into nested node descriptions. Defaults to 10. */\n maxDepth?: number;\n}\n\n/** Thrown by {@link assertValid} — carries the full report, not just the first violation. */\nexport class ShapeValidationError extends Error {\n readonly report: ValidationReport;\n constructor(report: ValidationReport) {\n super(report.results.map((r) => r.resultMessage).join('\\n'));\n this.name = 'ShapeValidationError';\n this.report = report;\n }\n}\nbrandLinkedError(ShapeValidationError, '@_linked/core', 'ShapeValidationError');\n\n/**\n * Keys that carry metadata about the node rather than a property value: `id` /\n * `__id` name it, and `shape` names the shape of a nested value when the\n * property shape itself doesn't declare one (see `convertUpdateValue`).\n */\nconst RESERVED_KEYS = new Set(['id', '__id', 'shape']);\n\n/**\n * The message for an undeclared property key. Shared with the normalization path\n * in `MutationQuery`, which needs the same guard to build a field at all.\n */\nexport function undeclaredPropertyMessage(key: string, shape: NodeShapeData): string {\n const shapeName = shape.label || shape.id?.split('/').pop();\n const base =\n `Invalid property key: ${key}. The shape ${shapeName} does not have a registered ` +\n `property with this name. Make sure the get/set method exists, and that it uses a ` +\n `@objectProperty or @literalProperty decorator.`;\n\n // If more than one copy of the shape registry module has evaluated, this message is\n // very probably lying: the property IS declared, on a copy this code cannot see.\n // Saying so here is the whole point — the previous version of this error accused\n // correct application code, and finding the real cause took a day of eliminating\n // innocent suspects. See docs/reports/043-module-identity-in-the-backend.md.\n const copies = getShapeRegistryInstanceCount();\n if (copies > 1) {\n return (\n `${base}\\n\\n` +\n `NOTE: ${copies} copies of the shape registry have loaded in this process. If this ` +\n `property is declared, it almost certainly registered on a different copy than the ` +\n `one validating here, and the declaration is not the problem. This happens when part ` +\n `of the app resolves a framework package to its source and part to its built output.`\n );\n }\n return base;\n}\n\n// ---------------------------------------------------------------------------\n// Constraint components\n// ---------------------------------------------------------------------------\n\n/** What a constraint check needs to know about the property it is checking. */\ninterface PropertyContext {\n shape: NodeShapeData;\n propertyShape: PropertyShapeData;\n /** Dot-joined label path from the root of the validated object. */\n property: string;\n focusNode?: string;\n mode: ValidationMode;\n}\n\n/**\n * A constraint check. Receives the property's values already normalized to an\n * array (a single value becomes a one-element array) and returns any violations.\n */\ntype ConstraintCheck = (values: unknown[], ctx: PropertyContext) => ValidationResult[];\n\n/**\n * `sh:value` must be an RDF term. A literal or a node reference is one; a plain\n * object, array or function is not, so it is left off rather than emitted as\n * something no store could materialize — the message still names it.\n */\nfunction asTerm(value: unknown): LiteralTerm | NodeReferenceValue | undefined {\n if (isScalarValue(value)) return value as LiteralTerm;\n if (isNodeReference(value)) return {id: (value as NodeReferenceValue).id};\n return undefined;\n}\n\n/**\n * A violation about the node itself rather than one of its property shapes —\n * `sh:sourceShape` is the node shape, and there is no `sh:resultPath` (an\n * undeclared key has no property IRI to point at).\n */\nfunction nodeViolation(\n shape: NodeShapeData,\n ctx: {focusNode?: string},\n component: NodeReferenceValue,\n message: string,\n propertyPath?: string,\n value?: unknown,\n): ValidationResult {\n const result: ValidationResult = {\n sourceConstraintComponent: component,\n resultSeverity: shacl.Violation,\n resultMessage: message,\n };\n if (ctx.focusNode) result.focusNode = {id: ctx.focusNode};\n if (propertyPath) result.propertyPath = propertyPath;\n const term = asTerm(value);\n if (term !== undefined) result.value = term;\n if (shape.id) result.sourceShape = {id: shape.id};\n return result;\n}\n\n/**\n * Build a result, omitting absent keys entirely — an `undefined` value is not a\n * property the create pipeline should see.\n */\nfunction violation(\n ctx: PropertyContext,\n component: NodeReferenceValue,\n message: string,\n value?: unknown,\n): ValidationResult {\n const result: ValidationResult = {\n sourceConstraintComponent: component,\n resultSeverity: shacl.Violation,\n resultMessage: message,\n };\n if (ctx.focusNode) result.focusNode = {id: ctx.focusNode};\n const path = ctx.propertyShape.path as NodeReferenceValue | undefined;\n if (path?.id) result.resultPath = {id: path.id};\n if (ctx.property) result.propertyPath = ctx.property;\n const term = asTerm(value);\n if (term !== undefined) result.value = term;\n const sourceShape = ctx.propertyShape.id || ctx.shape.id;\n if (sourceShape) result.sourceShape = {id: sourceShape};\n return result;\n}\n\n/** The label used in messages — the property's own label, not its nested path. */\nfunction labelOf(ps: PropertyShapeData): string {\n return ps.label || ps.id;\n}\n\n/** `sh:maxCount` — no more values than the shape allows. */\nconst maxCountCheck: ConstraintCheck = (values, ctx) => {\n const {maxCount} = ctx.propertyShape;\n if (typeof maxCount !== 'number' || values.length <= maxCount) return [];\n return [\n violation(\n ctx,\n shacl.MaxCountConstraintComponent,\n `Property '${labelOf(ctx.propertyShape)}' allows at most ${maxCount} value(s), but ${values.length} were provided.`,\n ),\n ];\n};\n\n/** `sh:minCount` — at least as many values as the shape requires. */\nconst minCountCheck: ConstraintCheck = (values, ctx) => {\n const {minCount} = ctx.propertyShape;\n if (typeof minCount !== 'number' || minCount <= 0 || values.length >= minCount) return [];\n return [\n violation(\n ctx,\n shacl.MinCountConstraintComponent,\n `Property '${labelOf(ctx.propertyShape)}' requires at least ${minCount} value(s), but ${values.length} were provided.`,\n ),\n ];\n};\n\n/** True when the property clearly accepts only literal values. */\nfunction expectsLiteral(ps: PropertyShapeData): boolean {\n if (ps.nodeKind) return ps.nodeKind.id === shacl.Literal.id;\n return !!ps.datatype && !ps.valueShape && !ps.class;\n}\n\n/**\n * True when the property clearly accepts only nodes (IRIs/blank nodes). `sh:class` counts\n * as much as `sh:node`: a value that is an instance of a class is a node, whether or not\n * the property names a shape for it.\n */\nfunction expectsNode(ps: PropertyShapeData): boolean {\n if (ps.nodeKind) {\n return (\n ps.nodeKind.id === shacl.IRI.id ||\n ps.nodeKind.id === shacl.BlankNode.id ||\n ps.nodeKind.id === shacl.BlankNodeOrIRI.id\n );\n }\n return !!(ps.valueShape || ps.class);\n}\n\nfunction isScalarValue(value: unknown): boolean {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value instanceof Date\n );\n}\n\n/**\n * `sh:nodeKind` — literal properties reject nodes/objects, relation properties\n * reject bare scalars. Ambiguous kinds (`sh:IRIOrLiteral`, or no `nodeKind` and\n * no `datatype`/`valueShape`/`class` to infer from) are not enforced.\n */\nconst nodeKindCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n const literalExpected = expectsLiteral(ps);\n const nodeExpected = expectsNode(ps);\n if (!literalExpected && !nodeExpected) return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el)) continue;\n const scalar = isScalarValue(el);\n if (literalExpected && !scalar) {\n results.push(\n violation(\n ctx,\n shacl.NodeKindConstraintComponent,\n `Property '${labelOf(ps)}' is a literal property but was given a ${typeof el === 'object' ? 'node/object' : typeof el} value.`,\n el,\n ),\n );\n } else if (nodeExpected && scalar) {\n results.push(\n violation(\n ctx,\n shacl.NodeKindConstraintComponent,\n `Property '${labelOf(ps)}' is a relation (object) property but was given a literal (${typeof el}). Provide a {id} reference or a nested object.`,\n el,\n ),\n );\n }\n }\n return results;\n};\n\n/**\n * An element worth checking: a concrete value rather than something whose final\n * form is decided elsewhere (an expression, a context ref, an absent value).\n */\nfunction isCheckableElement(el: unknown): boolean {\n return el !== null && el !== undefined && !isExpressionNode(el) && !asContextRef(el);\n}\n\nconst XSD_BASE = xsd.string.id.slice(0, -'string'.length);\n\n/** `xsd:integer` rather than the full IRI, when the datatype is an XSD one. */\nfunction datatypeLabel(datatype: NodeReferenceValue): string {\n return datatype.id.startsWith(XSD_BASE)\n ? `xsd:${datatype.id.slice(XSD_BASE.length)}`\n : datatype.id;\n}\n\n/** How a value reads in a message — its JS kind, which is what went wrong. */\nfunction describeValue(value: unknown): string {\n if (value instanceof Date) return 'a Date';\n if (Array.isArray(value)) return 'an array';\n if (typeof value === 'number') return Number.isInteger(value) ? 'a whole number' : 'a decimal number';\n if (typeof value === 'object') return 'a node/object';\n return `a ${typeof value}`;\n}\n\nconst isFiniteNumber = (v: unknown) => typeof v === 'number' && Number.isFinite(v);\n\n/**\n * What each XSD datatype accepts as a JavaScript value.\n *\n * This matters more than a normal type check: mutation literals are typed from\n * the *JavaScript* type when they reach SPARQL (`irToAlgebra`), not from the\n * declared datatype — a number becomes `xsd:integer`/`xsd:double`, a boolean\n * `xsd:boolean`, a `Date` `xsd:dateTime`, and a string an untyped literal. So a\n * string handed to an `xsd:integer` property does not merely skip a check, it\n * writes the wrong RDF term. Rejecting it is a correctness fix.\n *\n * `xsd:date` and `xsd:dateTime` take a `Date` and nothing else — one representation for a point\n * in time, rather than a JS object and a hand-written lexical string that behave differently.\n * The serializer derives the right lexical form from the declared datatype\n * (`irToAlgebra.dateToTerm`), so an `xsd:date` property gets `\"2020-06-15\"^^xsd:date` from the\n * same `Date` an `xsd:dateTime` property gets a full timestamp from.\n *\n * `xsd:time` is the exception, and takes a STRING. A `Date` cannot express a time of day without\n * inventing a date to carry it: the date half is meaningless, has to be discarded on\n * serialization, and makes two identical clock times on different days compare unequal. JS has\n * no time-only type — `Temporal.PlainTime` is the right answer and is not available yet — so the\n * lexical form is the honest representation. It is pattern-checked here, and `irToAlgebra` types\n * it from the declared datatype so it is written `\"10:30:00\"^^xsd:time` rather than as a plain\n * literal.\n *\n * Datatypes with no obvious JS counterpart (`xsd:duration`, `xsd:gYear`,\n * `xsd:Bytes`) are not checked.\n */\n/**\n * `HH:MM:SS` with optional milliseconds and optional timezone.\n *\n * Ranges are enforced by the pattern rather than parsed: hours 00-23, minutes and seconds 00-59,\n * so \"25:00:00\" is rejected where a looser `\\d{2}` would let it through and write a malformed\n * literal. The optional `Z`/offset is included because it is valid `xsd:time` — rejecting\n * \"14:30:00Z\" would make this stricter than the datatype it validates.\n */\nconst XSD_TIME_PATTERN = /^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d{1,3})?(Z|[+-]([01]\\d|2[0-3]):[0-5]\\d)?$/;\n\nconst DATATYPE_RULES: Record<string, {accepts: (v: unknown) => boolean; expected: string}> = {\n [xsd.string.id]: {accepts: (v) => typeof v === 'string', expected: 'a string'},\n [xsd.boolean.id]: {accepts: (v) => typeof v === 'boolean', expected: 'a boolean'},\n [xsd.integer.id]: {accepts: (v) => isFiniteNumber(v) && Number.isInteger(v), expected: 'a whole number'},\n [xsd.long.id]: {accepts: (v) => isFiniteNumber(v) && Number.isInteger(v), expected: 'a whole number'},\n [xsd.decimal.id]: {accepts: isFiniteNumber, expected: 'a number'},\n [xsd.float.id]: {accepts: isFiniteNumber, expected: 'a number'},\n [xsd.double.id]: {accepts: isFiniteNumber, expected: 'a number'},\n [xsd.date.id]: {accepts: (v) => v instanceof Date, expected: 'a Date'},\n [xsd.dateTime.id]: {accepts: (v) => v instanceof Date, expected: 'a Date'},\n [xsd.time.id]: {\n accepts: (v) => typeof v === 'string' && XSD_TIME_PATTERN.test(v),\n expected: 'a time string like \"14:30:00\", \"14:30:00.250\" or \"14:30:00Z\"',\n },\n};\n\n/** `sh:datatype` — the value's JavaScript type must match the declared datatype. */\nconst datatypeCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (!ps.datatype) return [];\n const rule = DATATYPE_RULES[ps.datatype.id];\n if (!rule) return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n // A node reference is a node-kind problem, not a datatype one — one\n // violation per mistake, reported by the check that owns it.\n if (!isCheckableElement(el) || isNodeReference(el) || rule.accepts(el)) continue;\n results.push(\n violation(\n ctx,\n shacl.DatatypeConstraintComponent,\n `Property '${labelOf(ps)}' expects ${datatypeLabel(ps.datatype)} (${rule.expected}), but was given ${describeValue(el)}.`,\n el,\n ),\n );\n }\n return results;\n};\n\n/** The four `sh:min/maxInclusive/Exclusive` range constraints, on numbers. */\nconst rangeCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n const bounds: {\n limit: unknown;\n component: NodeReferenceValue;\n ok: (v: number, limit: number) => boolean;\n phrase: string;\n }[] = [\n {limit: ps.minInclusive, component: shacl.MinInclusiveConstraintComponent, ok: (v, l) => v >= l, phrase: 'at least'},\n {limit: ps.maxInclusive, component: shacl.MaxInclusiveConstraintComponent, ok: (v, l) => v <= l, phrase: 'at most'},\n {limit: ps.minExclusive, component: shacl.MinExclusiveConstraintComponent, ok: (v, l) => v > l, phrase: 'greater than'},\n {limit: ps.maxExclusive, component: shacl.MaxExclusiveConstraintComponent, ok: (v, l) => v < l, phrase: 'less than'},\n ];\n const active = bounds.filter((b) => typeof b.limit === 'number');\n if (!active.length) return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n // Non-numbers are the datatype check's business.\n if (!isCheckableElement(el) || typeof el !== 'number') continue;\n for (const bound of active) {\n if (bound.ok(el, bound.limit as number)) continue;\n results.push(\n violation(\n ctx,\n bound.component,\n `Property '${labelOf(ps)}' must be ${bound.phrase} ${bound.limit}, but was given ${el}.`,\n el,\n ),\n );\n }\n }\n return results;\n};\n\n/** `sh:minLength` / `sh:maxLength`, on strings. */\nconst lengthCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (typeof ps.minLength !== 'number' && typeof ps.maxLength !== 'number') return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el) || typeof el !== 'string') continue;\n if (typeof ps.minLength === 'number' && el.length < ps.minLength) {\n results.push(\n violation(\n ctx,\n shacl.MinLengthConstraintComponent,\n `Property '${labelOf(ps)}' must be at least ${ps.minLength} character(s), but was given ${el.length}.`,\n el,\n ),\n );\n }\n if (typeof ps.maxLength === 'number' && el.length > ps.maxLength) {\n results.push(\n violation(\n ctx,\n shacl.MaxLengthConstraintComponent,\n `Property '${labelOf(ps)}' must be at most ${ps.maxLength} character(s), but was given ${el.length}.`,\n el,\n ),\n );\n }\n }\n return results;\n};\n\n/** `sh:pattern` — the string form of the value must match the shape's regex. */\nconst patternCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (!ps.pattern) return [];\n // Rebuild without `g`/`y`: those carry `lastIndex` between calls, so a shared\n // shape regex would match every other value.\n const regex = new RegExp(ps.pattern.source, ps.pattern.flags.replace(/[gy]/g, ''));\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el) || typeof el !== 'string') continue;\n if (regex.test(el)) continue;\n results.push(\n violation(\n ctx,\n shacl.PatternConstraintComponent,\n `Property '${labelOf(ps)}' must match ${String(ps.pattern)}, but was given \"${el}\".`,\n el,\n ),\n );\n }\n return results;\n};\n\n/** `sh:in` — the value must be one of the shape's allowed values. */\nconst inCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (!ps.in?.length) return [];\n const allowed = ps.in;\n const matches = (el: unknown) =>\n allowed.some((a) =>\n isNodeReferenceValue(a)\n ? isNodeReference(el) && (el as NodeReferenceValue).id === a.id\n : a === el,\n );\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el) || matches(el)) continue;\n const rendered = allowed\n .map((a) => (isNodeReferenceValue(a) ? a.id : JSON.stringify(a)))\n .join(', ');\n results.push(\n violation(\n ctx,\n shacl.InConstraintComponent,\n `Property '${labelOf(ps)}' must be one of [${rendered}].`,\n el,\n ),\n );\n }\n return results;\n};\n\n/**\n * The registry. Every property-level constraint the library enforces lives here;\n * adding another SHACL component is one more entry plus its test.\n *\n * Split by what each kind of check needs to see. **Cardinality** needs the\n * property's whole value set, so it cannot run against a set modification —\n * `{add: […]}` changes a count that lives in the store. **Value** checks need\n * only the value in hand, so they run everywhere a concrete value appears,\n * including inside `add`.\n *\n * Cardinality runs first when it runs at all: a count problem explains itself\n * better than the per-value violations that would follow it.\n */\nconst CARDINALITY_CONSTRAINTS: ConstraintCheck[] = [maxCountCheck, minCountCheck];\n\nconst VALUE_CONSTRAINTS: ConstraintCheck[] = [\n nodeKindCheck,\n datatypeCheck,\n rangeCheck,\n lengthCheck,\n patternCheck,\n inCheck,\n];\n\nconst PROPERTY_CONSTRAINTS: ConstraintCheck[] = [\n ...CARDINALITY_CONSTRAINTS,\n ...VALUE_CONSTRAINTS,\n];\n\n// ---------------------------------------------------------------------------\n// Value classification\n// ---------------------------------------------------------------------------\n\n/**\n * A `{add, remove}` set modification. The resulting value count depends on the\n * node's current state, so cardinality and kind are unknowable here.\n */\nfunction isSetModification(value: unknown): boolean {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as Record<string, unknown>;\n const expected = (obj.add ? 1 : 0) + (obj.remove ? 1 : 0);\n return expected > 0 && Object.getOwnPropertyNames(obj).length === expected;\n}\n\n/** An object carrying only an `id` — a reference to an existing node, not a description. */\nfunction isNodeReference(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'id' in value &&\n Object.keys(value).length === 1\n );\n}\n\n/**\n * A value that stands for something resolved later — an expression, a query\n * context reference, a callback, or nothing at all.\n *\n * Must be ruled out *before* anything reads properties off the value: a resolved\n * context ref is a query proxy that throws on any undecorated key, so probing it\n * for `.add` is not a safe way to ask what it is.\n */\nfunction isDeferredValue(value: unknown): boolean {\n return (\n value === undefined ||\n typeof value === 'function' ||\n isExpressionNode(value) ||\n !!asContextRef(value)\n );\n}\n\n/** Values whose final shape isn't knowable without the store or a lowering pass. */\nfunction isOpaqueValue(value: unknown): boolean {\n return isDeferredValue(value) || isSetModification(value);\n}\n\n/** A nested node description — an object to descend into, rather than a leaf value. */\nfunction isNodeDescription(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n !isNodeReference(value) &&\n !isOpaqueValue(value)\n );\n}\n\n// ---------------------------------------------------------------------------\n// Entry points\n// ---------------------------------------------------------------------------\n\n/**\n * What can be validated against: a shape class (`Person`) or the plain\n * `NodeShapeData` the decorators generate (`Person.shape`, or the same object\n * obtained anywhere else). The two are interchangeable — the class is unwrapped\n * to its `shape` and nothing else about it is read.\n */\nexport type ValidatableShape = NodeShapeData | {shape: NodeShapeData};\n\nfunction resolveShapeData(shape: ValidatableShape): NodeShapeData {\n const resolved = 'propertyShapes' in shape ? shape : (shape as {shape: NodeShapeData}).shape;\n if (!resolved) {\n throw new Error(\n 'validate() requires a node shape or a shape class with a static `shape`. ' +\n 'Did you pass an unregistered class (missing @linkedShape)?',\n );\n }\n return resolved as NodeShapeData;\n}\n\n/**\n * Validate a plain data object against a node shape.\n *\n * Never throws for invalid *data* — a violation is a result, not an exception.\n * (It does throw when the *shape* argument itself is unusable.)\n *\n * ```ts\n * const report = validate(Person, {name: ['a', 'b']});\n * report.conforms; // false\n * report.results[0].sourceConstraintComponent.id; // …shacl#MaxCountConstraintComponent\n * ```\n *\n * **A shape class is optional.** The plain `NodeShapeData` the decorators\n * generate validates identically, so a caller that only ever holds shape\n * objects needs no class reference:\n *\n * ```ts\n * validate(Person, data); // ≡\n * validate(Person.shape, data); // same report\n * ```\n *\n * That holds even though a shape object carries neither its inherited property\n * shapes (a subclass's `propertyShapes` holds only its own) nor its nested\n * shapes (`valueShape` is a bare `{id}`): both are resolved through the shape\n * registry by id. A shape whose id is not registered therefore cannot be fully\n * checked, and says so — see {@link unresolvedValueShapeMessage} and the\n * inherited-properties check in `validateNode` — rather than reporting a node\n * as conforming on the strength of a branch it could not look at.\n */\nexport function validate(\n shape: ValidatableShape,\n data: unknown,\n options: ValidateOptions = {},\n): ValidationReport {\n const {mode = 'complete', maxDepth = 10} = options;\n const results = validateNode(resolveShapeData(shape), data, {\n mode,\n maxDepth,\n depth: 0,\n prefix: '',\n });\n return {\n conforms: !results.some((r) => r.resultSeverity.id === shacl.Violation.id),\n results,\n };\n}\n\n/** {@link validate}, but throws a {@link ShapeValidationError} when the data doesn't conform. */\nexport function assertValid(\n shape: ValidatableShape,\n data: unknown,\n options: ValidateOptions = {},\n): void {\n const report = validate(shape, data, options);\n if (!report.conforms) throw new ShapeValidationError(report);\n}\n\n// ---------------------------------------------------------------------------\n// Walk\n// ---------------------------------------------------------------------------\n\ninterface WalkContext {\n mode: ValidationMode;\n maxDepth: number;\n depth: number;\n /** Dot-joined label path of the node being validated (`''` at the root). */\n prefix: string;\n focusNode?: string;\n}\n\nfunction validateNode(\n shape: NodeShapeData,\n data: unknown,\n ctx: WalkContext,\n): ValidationResult[] {\n if (typeof data !== 'object' || data === null || Array.isArray(data)) {\n return [\n nodeViolation(\n shape,\n ctx,\n shacl.NodeConstraintComponent,\n `Expected an object describing '${shape.label || shape.id}', but got ${data === null ? 'null' : typeof data}.`,\n ctx.prefix,\n data,\n ),\n ];\n }\n\n const obj = data as Record<string, unknown>;\n const propertyShapes = getUniquePropertyShapes(shape);\n const byLabel = new Map(propertyShapes.map((ps) => [ps.label, ps]));\n const focusNode =\n typeof obj.__id === 'string'\n ? obj.__id\n : typeof obj.id === 'string'\n ? obj.id\n : ctx.focusNode;\n const results: ValidationResult[] = [];\n\n // A shape declaring a superclass carries only its *own* property shapes; the\n // inherited ones are resolved through the registry by id. If this shape's id\n // is not registered, that resolution quietly yields half a shape — required\n // inherited properties go unchecked, and any that *are* supplied look\n // undeclared. Report it rather than let a partial shape pass as a clean bill.\n //\n // \"Registered\" means present in EITHER registry. Checking only for a class rejected\n // exactly the shapes the metamodel work exists to support: a data-only child is\n // registered, its parent resolves, and its inherited properties are checked — it simply\n // has no class, which is not a defect.\n if (shape.extends?.id && !getShapeClass(shape.id) && !getNodeShape(shape.id)) {\n results.push(\n nodeViolation(\n shape,\n {focusNode},\n shacl.NodeConstraintComponent,\n `Cannot resolve the properties '${shape.label || shape.id}' inherits from '${shape.extends.id}': shape '${shape.id}' is not registered, so only its own properties could be checked.`,\n ctx.prefix,\n ),\n );\n }\n\n // Presence of required properties — only decidable for a complete description.\n if (ctx.mode === 'complete') {\n for (const ps of propertyShapes) {\n if (typeof ps.minCount !== 'number' || ps.minCount <= 0) continue;\n if (ps.label in obj) continue;\n results.push(\n violation(\n {shape, propertyShape: ps, property: join(ctx.prefix, ps.label), focusNode, mode: ctx.mode},\n shacl.MinCountConstraintComponent,\n `Property '${labelOf(ps)}' requires at least ${ps.minCount} value(s), but none were provided.`,\n ),\n );\n }\n }\n\n // The values actually provided.\n for (const [key, value] of Object.entries(obj)) {\n if (RESERVED_KEYS.has(key)) continue;\n const propertyShape = byLabel.get(key);\n if (!propertyShape) {\n results.push(\n nodeViolation(\n shape,\n {...ctx, focusNode},\n shacl.ClosedConstraintComponent,\n undeclaredPropertyMessage(key, shape),\n join(ctx.prefix, key),\n value,\n ),\n );\n continue;\n }\n results.push(\n ...validateProperty(value, {\n shape,\n propertyShape,\n property: join(ctx.prefix, key),\n focusNode,\n mode: ctx.mode,\n }, ctx),\n );\n }\n\n return results;\n}\n\nfunction validateProperty(\n value: unknown,\n propCtx: PropertyContext,\n walk: WalkContext,\n): ValidationResult[] {\n const ps = propCtx.propertyShape;\n\n // `null` clears the property — the same as providing zero values, so clearing\n // a required one is a cardinality violation (both spellings behave alike).\n if (value === null) {\n if (typeof ps.minCount === 'number' && ps.minCount > 0) {\n return [\n violation(\n propCtx,\n shacl.MinCountConstraintComponent,\n `Property '${labelOf(ps)}' requires at least ${ps.minCount} value(s) and cannot be cleared.`,\n ),\n ];\n }\n return [];\n }\n\n // Ruled out first: reading `.add` off a resolved context proxy would throw.\n if (isDeferredValue(value)) return [];\n\n // A set modification adds to and removes from what the store already holds,\n // so the resulting *count* is unknowable here — but each added value is as\n // checkable as any other, and skipping them let mistyped literals through the\n // one door the rest of this module closes. `remove` takes `{id}` references\n // only, which normalization enforces on its own.\n if (isSetModification(value)) {\n const {add} = value as {add?: unknown};\n if (add === undefined) return [];\n return runChecks(VALUE_CONSTRAINTS, toValues(add), propCtx, walk);\n }\n\n return runChecks(PROPERTY_CONSTRAINTS, toValues(value), propCtx, walk);\n}\n\n/** A property's value(s) as an array — a single value becomes a one-element one. */\nfunction toValues(value: unknown): unknown[] {\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Run a set of constraint checks over a property's values, then descend into any\n * nested node descriptions among them (`sh:node`-style recursion). A bare `{id}`\n * is a reference to an existing node and has nothing to validate; an object with\n * an id *and* data is a nested create with a predefined id.\n */\nfunction runChecks(\n checks: ConstraintCheck[],\n values: unknown[],\n propCtx: PropertyContext,\n walk: WalkContext,\n): ValidationResult[] {\n const results: ValidationResult[] = [];\n for (const check of checks) {\n results.push(...check(values, propCtx));\n }\n\n if (walk.depth < walk.maxDepth) {\n for (const el of values) {\n if (!isNodeDescription(el)) continue;\n const nestedShape = resolveValueShape(propCtx.propertyShape, el);\n if (!nestedShape) {\n // The value is a node description we have no shape for, so nothing about\n // it can be checked. Silently skipping would report the whole node as\n // conforming on the strength of a branch never looked at.\n results.push(\n violation(\n propCtx,\n shacl.NodeConstraintComponent,\n unresolvedValueShapeMessage(propCtx.propertyShape, propCtx.shape),\n ),\n );\n continue;\n }\n results.push(\n ...validateNode(nestedShape, el, {\n ...walk,\n depth: walk.depth + 1,\n prefix: propCtx.property,\n focusNode: undefined,\n }),\n );\n }\n }\n\n return results;\n}\n\n/**\n * Why a nested value could not be resolved to a shape — the property named one\n * that is not registered, or named none and the value did not carry one either.\n * Both are actionable, and they are fixed differently.\n */\nfunction unresolvedValueShapeMessage(ps: PropertyShapeData, owner: NodeShapeData): string {\n const label = labelOf(ps);\n return ps.valueShape\n ? `Cannot validate the value of '${label}': its shape '${ps.valueShape.id}' does not resolve ` +\n `(${describeUnresolved(unresolvedValueShapeDetails(ps, owner))}).`\n : `Cannot validate the value of '${label}' of '${owner.id}': the property declares no shape for its values. ` +\n `Add a 'shape' to its @objectProperty decorator, or give the value a 'shape' key.`;\n}\n\n/**\n * The shape a nested value should be validated against: the shape class carried\n * in the value's reserved `shape` key when the property declares no `valueShape`\n * or the key names a subclass of it, otherwise the declared `valueShape`. Mirrors\n * `convertUpdateValue`; returns undefined when neither is available.\n */\nfunction resolveValueShape(\n ps: PropertyShapeData,\n value: unknown,\n): NodeShapeData | undefined {\n const own = (value as {shape?: {shape?: NodeShapeData}}).shape?.shape;\n if (!ps.valueShape) return own;\n const declared = getQueryShapeClass(ps.valueShape)?.shape;\n // A value naming a subclass of the declared shape is validated as that subclass.\n if (own && declared && isSubShapeOf(own, declared)) return own;\n return declared;\n}\n\nfunction join(prefix: string, label: string): string {\n return prefix ? `${prefix}.${label}` : label;\n}\n"]}
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../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CAAC,CAAC,CAAC,EAAE,CAAC;IAC5F,OAAO,EAAE,CAAC,UAAU;QAClB,CAAC,CAAC,iCAAiC,KAAK,iBAAiB,EAAE,CAAC,UAAU,CAAC,EAAE,oBAAoB;YACzF,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QAC9B,CAAC,CAAC,iCAAiC,KAAK,SAAS,KAAK,CAAC,EAAE,oDAAoD;YACzG,kFAAkF,CAAC;AAC3F,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CACxB,EAAqB,EACrB,KAAc;;IAEd,MAAM,GAAG,GAAG,MAAC,KAA2C,CAAC,KAAK,0CAAE,KAAK,CAAC;IACtE,IAAI,CAAC,EAAE,CAAC,UAAU;QAAE,OAAO,GAAG,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAA,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,0CAAE,KAAK,CAAC;IAC1D,iFAAiF;IACjF,IAAI,GAAG,IAAI,QAAQ,IAAI,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;QAAE,OAAO,GAAG,CAAC;IAC/D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,IAAI,CAAC,MAAc,EAAE,KAAa;IACzC,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n/**\n * SHACL-aligned validation of plain data objects against a node shape.\n *\n * One entry point — {@link validate} — used by the create and update pipelines\n * (via `MutationQueryFactory.describe()`) and directly by callers that want to\n * know how well an object fits a shape without building a mutation.\n *\n * **Shape of the output.** This library has no triple/Turtle layer and this\n * module does not add one: a {@link ValidationReport} is plain JavaScript. It is\n * however 1-1 with the SHACL vocabulary — one key per SHACL property, named\n * after it, holding a value the mutation pipeline accepts (a literal, or a\n * `{id}` node reference for IRI-valued properties). So a report can be\n * materialized by an ordinary create query as soon as shape classes for\n * `sh:ValidationReport` / `sh:ValidationResult` exist, with no transform step:\n *\n * ```ts\n * const report = validate(Slide, data);\n * await ValidationReport.create(report); // once those shape classes exist\n * ```\n *\n * Two deliberate departures, both documented on the types: `results` is plural\n * where SHACL's repeated property is `sh:result`, and `propertyPath` is a\n * non-SHACL locator. Both map cleanly — a shape class chooses its own labels for\n * SHACL paths, and an extension property is legal on a SHACL report.\n *\n * **Coverage.** Cardinality (`sh:minCount` / `sh:maxCount`), node kind (literal\n * vs relation), undeclared properties (as `sh:closed`), `sh:datatype`, the four\n * `sh:min/maxInclusive/Exclusive` bounds, `sh:min/maxLength`, `sh:pattern` and\n * `sh:in`. Each is one entry in {@link CARDINALITY_CONSTRAINTS} or\n * {@link VALUE_CONSTRAINTS}, so adding another is one function and one test.\n *\n * Not covered: `sh:languageIn` / `sh:uniqueLang` (skipped at serialization time\n * too, so there is no metadata to check against) and `sh:hasValue`.\n */\nimport {getShapeRegistryInstanceCount, getQueryShapeClass} from '../utils/ShapeClass.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {brandLinkedError} from '../utils/linkedError.js';\nimport {xsd} from '../ontologies/xsd.js';\nimport {isNodeReferenceValue, type NodeReferenceValue} from '../utils/NodeReference.js';\nimport {getUniquePropertyShapes} from './nodeShapeData.js';\nimport type {NodeShapeData, PropertyShapeData} from './nodeShapeData.js';\nimport {getNodeShape, getShapeClass, isSubShapeOf} from '../utils/ShapeClass.js';\nimport {isExpressionNode} from '../expressions/ExpressionNode.js';\nimport {asContextRef} from '../queries/QueryContext.js';\nimport {describeUnresolved, unresolvedValueShapeDetails} from '../utils/unresolvedShape.js';\n\n/**\n * Which constraints apply to the data being validated.\n *\n * - `complete` — the object describes a whole node (a create, or a standalone\n * object being checked for fit). Properties absent from the data are genuinely\n * absent, so `sh:minCount` presence is checkable.\n * - `partial` — the object describes a change to an existing node (an update).\n * The store holds whatever the payload does not mention, so presence is\n * unknowable; only the values actually provided are checked.\n */\nexport type ValidationMode = 'complete' | 'partial';\n\n/**\n * A single constraint violation — an `sh:ValidationResult`.\n *\n * Every key is the local name of the SHACL property it carries, and every value\n * is in a form the create pipeline accepts (a literal, or a `{id}` node\n * reference for IRI-valued properties). A shape class declaring these\n * properties therefore materializes a result with no transform step:\n * `ValidationResult.create(result)`. The one non-SHACL key is `propertyPath`;\n * see {@link ValidationReport}.\n */\nexport interface ValidationResult {\n /** `sh:focusNode` — the node the violation is about, when its id is known. */\n focusNode?: NodeReferenceValue;\n /** `sh:resultPath` — the IRI of the property the violation is about. */\n resultPath?: NodeReferenceValue;\n /**\n * `sh:value` — the offending value, present only when it is an RDF term (a\n * literal or a node reference). Cardinality violations are about the property\n * rather than any one value, so they carry none.\n */\n value?: LiteralTerm | NodeReferenceValue;\n /** `sh:sourceShape` — the node or property shape carrying the constraint. */\n sourceShape?: NodeReferenceValue;\n /** `sh:sourceConstraintComponent` — which SHACL constraint failed. */\n sourceConstraintComponent: NodeReferenceValue;\n /** `sh:resultSeverity` — `sh:Violation`, `sh:Warning` or `sh:Info`. */\n resultSeverity: NodeReferenceValue;\n /** `sh:resultMessage` — human-readable explanation. */\n resultMessage: string;\n /**\n * **Not SHACL.** The property's label, dot-joined through nested shapes\n * (`author.fullName`) — the locator a caller needs to point at a field in the\n * object they passed in, which `sh:resultPath` alone cannot give (it names the\n * property, not where the nesting reached it). Materializes like any other\n * property once a shape class declares it; drop it for a pure-SHACL result.\n */\n propertyPath?: string;\n}\n\n/**\n * The outcome of a validation run — an `sh:ValidationReport`.\n *\n * Plain objects, 1-1 with the SHACL vocabulary, so a report can later be\n * materialized through an ordinary create query against shape classes for\n * `sh:ValidationReport` / `sh:ValidationResult` — whether or not this library\n * ever ships those classes. `results` is the sole plural rename (SHACL's\n * property is `sh:result`, repeated); a shape class maps it with\n * `@objectProperty({path: shacl.result, …}) get results()`.\n */\nexport interface ValidationReport {\n /** `sh:conforms` — true when there are no `sh:Violation`-severity results. */\n conforms: boolean;\n /** `sh:result` — every violation found, in deterministic order. */\n results: ValidationResult[];\n}\n\n/** The literal types the mutation pipeline accepts as a value. */\ntype LiteralTerm = string | number | boolean | Date;\n\nexport interface ValidateOptions {\n /** Defaults to `complete`. */\n mode?: ValidationMode;\n /** How deep to descend into nested node descriptions. Defaults to 10. */\n maxDepth?: number;\n}\n\n/** Thrown by {@link assertValid} — carries the full report, not just the first violation. */\nexport class ShapeValidationError extends Error {\n readonly report: ValidationReport;\n constructor(report: ValidationReport) {\n super(report.results.map((r) => r.resultMessage).join('\\n'));\n this.name = 'ShapeValidationError';\n this.report = report;\n }\n}\nbrandLinkedError(ShapeValidationError, '@_linked/core', 'ShapeValidationError');\n\n/**\n * Keys that carry metadata about the node rather than a property value: `id` /\n * `__id` name it, and `shape` names the shape of a nested value when the\n * property shape itself doesn't declare one (see `convertUpdateValue`).\n */\nconst RESERVED_KEYS = new Set(['id', '__id', 'shape']);\n\n/**\n * The message for an undeclared property key. Shared with the normalization path\n * in `MutationQuery`, which needs the same guard to build a field at all.\n */\nexport function undeclaredPropertyMessage(key: string, shape: NodeShapeData): string {\n const shapeName = shape.label || shape.id?.split('/').pop();\n const base =\n `Invalid property key: ${key}. The shape ${shapeName} does not have a registered ` +\n `property with this name. Make sure the get/set method exists, and that it uses a ` +\n `@objectProperty or @literalProperty decorator.`;\n\n // If more than one copy of the shape registry module has evaluated, this message is\n // very probably lying: the property IS declared, on a copy this code cannot see.\n // Saying so here is the whole point — the previous version of this error accused\n // correct application code, and finding the real cause took a day of eliminating\n // innocent suspects. See docs/reports/043-module-identity-in-the-backend.md.\n const copies = getShapeRegistryInstanceCount();\n if (copies > 1) {\n return (\n `${base}\\n\\n` +\n `NOTE: ${copies} copies of the shape registry have loaded in this process. If this ` +\n `property is declared, it almost certainly registered on a different copy than the ` +\n `one validating here, and the declaration is not the problem. This happens when part ` +\n `of the app resolves a framework package to its source and part to its built output.`\n );\n }\n return base;\n}\n\n// ---------------------------------------------------------------------------\n// Constraint components\n// ---------------------------------------------------------------------------\n\n/** What a constraint check needs to know about the property it is checking. */\ninterface PropertyContext {\n shape: NodeShapeData;\n propertyShape: PropertyShapeData;\n /** Dot-joined label path from the root of the validated object. */\n property: string;\n focusNode?: string;\n mode: ValidationMode;\n}\n\n/**\n * A constraint check. Receives the property's values already normalized to an\n * array (a single value becomes a one-element array) and returns any violations.\n */\ntype ConstraintCheck = (values: unknown[], ctx: PropertyContext) => ValidationResult[];\n\n/**\n * `sh:value` must be an RDF term. A literal or a node reference is one; a plain\n * object, array or function is not, so it is left off rather than emitted as\n * something no store could materialize — the message still names it.\n */\nfunction asTerm(value: unknown): LiteralTerm | NodeReferenceValue | undefined {\n if (isScalarValue(value)) return value as LiteralTerm;\n if (isNodeReference(value)) return {id: (value as NodeReferenceValue).id};\n return undefined;\n}\n\n/**\n * A violation about the node itself rather than one of its property shapes —\n * `sh:sourceShape` is the node shape, and there is no `sh:resultPath` (an\n * undeclared key has no property IRI to point at).\n */\nfunction nodeViolation(\n shape: NodeShapeData,\n ctx: {focusNode?: string},\n component: NodeReferenceValue,\n message: string,\n propertyPath?: string,\n value?: unknown,\n): ValidationResult {\n const result: ValidationResult = {\n sourceConstraintComponent: component,\n resultSeverity: shacl.Violation,\n resultMessage: message,\n };\n if (ctx.focusNode) result.focusNode = {id: ctx.focusNode};\n if (propertyPath) result.propertyPath = propertyPath;\n const term = asTerm(value);\n if (term !== undefined) result.value = term;\n if (shape.id) result.sourceShape = {id: shape.id};\n return result;\n}\n\n/**\n * Build a result, omitting absent keys entirely — an `undefined` value is not a\n * property the create pipeline should see.\n */\nfunction violation(\n ctx: PropertyContext,\n component: NodeReferenceValue,\n message: string,\n value?: unknown,\n): ValidationResult {\n const result: ValidationResult = {\n sourceConstraintComponent: component,\n resultSeverity: shacl.Violation,\n resultMessage: message,\n };\n if (ctx.focusNode) result.focusNode = {id: ctx.focusNode};\n const path = ctx.propertyShape.path as NodeReferenceValue | undefined;\n if (path?.id) result.resultPath = {id: path.id};\n if (ctx.property) result.propertyPath = ctx.property;\n const term = asTerm(value);\n if (term !== undefined) result.value = term;\n const sourceShape = ctx.propertyShape.id || ctx.shape.id;\n if (sourceShape) result.sourceShape = {id: sourceShape};\n return result;\n}\n\n/** The label used in messages — the property's own label, not its nested path. */\nfunction labelOf(ps: PropertyShapeData): string {\n return ps.label || ps.id;\n}\n\n/** `sh:maxCount` — no more values than the shape allows. */\nconst maxCountCheck: ConstraintCheck = (values, ctx) => {\n const {maxCount} = ctx.propertyShape;\n if (typeof maxCount !== 'number' || values.length <= maxCount) return [];\n return [\n violation(\n ctx,\n shacl.MaxCountConstraintComponent,\n `Property '${labelOf(ctx.propertyShape)}' allows at most ${maxCount} value(s), but ${values.length} were provided.`,\n ),\n ];\n};\n\n/** `sh:minCount` — at least as many values as the shape requires. */\nconst minCountCheck: ConstraintCheck = (values, ctx) => {\n const {minCount} = ctx.propertyShape;\n if (typeof minCount !== 'number' || minCount <= 0 || values.length >= minCount) return [];\n return [\n violation(\n ctx,\n shacl.MinCountConstraintComponent,\n `Property '${labelOf(ctx.propertyShape)}' requires at least ${minCount} value(s), but ${values.length} were provided.`,\n ),\n ];\n};\n\n/** True when the property clearly accepts only literal values. */\nfunction expectsLiteral(ps: PropertyShapeData): boolean {\n if (ps.nodeKind) return ps.nodeKind.id === shacl.Literal.id;\n return !!ps.datatype && !ps.valueShape && !ps.class;\n}\n\n/**\n * True when the property clearly accepts only nodes (IRIs/blank nodes). `sh:class` counts\n * as much as `sh:node`: a value that is an instance of a class is a node, whether or not\n * the property names a shape for it.\n */\nfunction expectsNode(ps: PropertyShapeData): boolean {\n if (ps.nodeKind) {\n return (\n ps.nodeKind.id === shacl.IRI.id ||\n ps.nodeKind.id === shacl.BlankNode.id ||\n ps.nodeKind.id === shacl.BlankNodeOrIRI.id\n );\n }\n return !!(ps.valueShape || ps.class);\n}\n\nfunction isScalarValue(value: unknown): boolean {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value instanceof Date\n );\n}\n\n/**\n * `sh:nodeKind` — literal properties reject nodes/objects, relation properties\n * reject bare scalars. Ambiguous kinds (`sh:IRIOrLiteral`, or no `nodeKind` and\n * no `datatype`/`valueShape`/`class` to infer from) are not enforced.\n */\nconst nodeKindCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n const literalExpected = expectsLiteral(ps);\n const nodeExpected = expectsNode(ps);\n if (!literalExpected && !nodeExpected) return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el)) continue;\n const scalar = isScalarValue(el);\n if (literalExpected && !scalar) {\n results.push(\n violation(\n ctx,\n shacl.NodeKindConstraintComponent,\n `Property '${labelOf(ps)}' is a literal property but was given a ${typeof el === 'object' ? 'node/object' : typeof el} value.`,\n el,\n ),\n );\n } else if (nodeExpected && scalar) {\n results.push(\n violation(\n ctx,\n shacl.NodeKindConstraintComponent,\n `Property '${labelOf(ps)}' is a relation (object) property but was given a literal (${typeof el}). Provide a {id} reference or a nested object.`,\n el,\n ),\n );\n }\n }\n return results;\n};\n\n/**\n * An element worth checking: a concrete value rather than something whose final\n * form is decided elsewhere (an expression, a context ref, an absent value).\n */\nfunction isCheckableElement(el: unknown): boolean {\n return el !== null && el !== undefined && !isExpressionNode(el) && !asContextRef(el);\n}\n\nconst XSD_BASE = xsd.string.id.slice(0, -'string'.length);\n\n/** `xsd:integer` rather than the full IRI, when the datatype is an XSD one. */\nfunction datatypeLabel(datatype: NodeReferenceValue): string {\n return datatype.id.startsWith(XSD_BASE)\n ? `xsd:${datatype.id.slice(XSD_BASE.length)}`\n : datatype.id;\n}\n\n/** How a value reads in a message — its JS kind, which is what went wrong. */\nfunction describeValue(value: unknown): string {\n if (value instanceof Date) return 'a Date';\n if (Array.isArray(value)) return 'an array';\n if (typeof value === 'number') return Number.isInteger(value) ? 'a whole number' : 'a decimal number';\n if (typeof value === 'object') return 'a node/object';\n return `a ${typeof value}`;\n}\n\nconst isFiniteNumber = (v: unknown) => typeof v === 'number' && Number.isFinite(v);\n\n/**\n * What each XSD datatype accepts as a JavaScript value.\n *\n * This matters more than a normal type check: mutation literals are typed from\n * the *JavaScript* type when they reach SPARQL (`irToAlgebra`), not from the\n * declared datatype — a number becomes `xsd:integer`/`xsd:double`, a boolean\n * `xsd:boolean`, a `Date` `xsd:dateTime`, and a string an untyped literal. So a\n * string handed to an `xsd:integer` property does not merely skip a check, it\n * writes the wrong RDF term. Rejecting it is a correctness fix.\n *\n * `xsd:date` and `xsd:dateTime` take a `Date` and nothing else — one representation for a point\n * in time, rather than a JS object and a hand-written lexical string that behave differently.\n * The serializer derives the right lexical form from the declared datatype\n * (`irToAlgebra.dateToTerm`), so an `xsd:date` property gets `\"2020-06-15\"^^xsd:date` from the\n * same `Date` an `xsd:dateTime` property gets a full timestamp from.\n *\n * `xsd:time` is the exception, and takes a STRING. A `Date` cannot express a time of day without\n * inventing a date to carry it: the date half is meaningless, has to be discarded on\n * serialization, and makes two identical clock times on different days compare unequal. JS has\n * no time-only type — `Temporal.PlainTime` is the right answer and is not available yet — so the\n * lexical form is the honest representation. It is pattern-checked here, and `irToAlgebra` types\n * it from the declared datatype so it is written `\"10:30:00\"^^xsd:time` rather than as a plain\n * literal.\n *\n * Datatypes with no obvious JS counterpart (`xsd:duration`, `xsd:gYear`,\n * `xsd:Bytes`) are not checked.\n */\n/**\n * `HH:MM:SS` with optional milliseconds and optional timezone.\n *\n * Ranges are enforced by the pattern rather than parsed: hours 00-23, minutes and seconds 00-59,\n * so \"25:00:00\" is rejected where a looser `\\d{2}` would let it through and write a malformed\n * literal. The optional `Z`/offset is included because it is valid `xsd:time` — rejecting\n * \"14:30:00Z\" would make this stricter than the datatype it validates.\n */\nconst XSD_TIME_PATTERN = /^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d{1,3})?(Z|[+-]([01]\\d|2[0-3]):[0-5]\\d)?$/;\n\nconst DATATYPE_RULES: Record<string, {accepts: (v: unknown) => boolean; expected: string}> = {\n [xsd.string.id]: {accepts: (v) => typeof v === 'string', expected: 'a string'},\n [xsd.boolean.id]: {accepts: (v) => typeof v === 'boolean', expected: 'a boolean'},\n [xsd.integer.id]: {accepts: (v) => isFiniteNumber(v) && Number.isInteger(v), expected: 'a whole number'},\n [xsd.long.id]: {accepts: (v) => isFiniteNumber(v) && Number.isInteger(v), expected: 'a whole number'},\n [xsd.decimal.id]: {accepts: isFiniteNumber, expected: 'a number'},\n [xsd.float.id]: {accepts: isFiniteNumber, expected: 'a number'},\n [xsd.double.id]: {accepts: isFiniteNumber, expected: 'a number'},\n [xsd.date.id]: {accepts: (v) => v instanceof Date, expected: 'a Date'},\n [xsd.dateTime.id]: {accepts: (v) => v instanceof Date, expected: 'a Date'},\n [xsd.time.id]: {\n accepts: (v) => typeof v === 'string' && XSD_TIME_PATTERN.test(v),\n expected: 'a time string like \"14:30:00\", \"14:30:00.250\" or \"14:30:00Z\"',\n },\n};\n\n/** `sh:datatype` — the value's JavaScript type must match the declared datatype. */\nconst datatypeCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (!ps.datatype) return [];\n const rule = DATATYPE_RULES[ps.datatype.id];\n if (!rule) return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n // A node reference is a node-kind problem, not a datatype one — one\n // violation per mistake, reported by the check that owns it.\n if (!isCheckableElement(el) || isNodeReference(el) || rule.accepts(el)) continue;\n results.push(\n violation(\n ctx,\n shacl.DatatypeConstraintComponent,\n `Property '${labelOf(ps)}' expects ${datatypeLabel(ps.datatype)} (${rule.expected}), but was given ${describeValue(el)}.`,\n el,\n ),\n );\n }\n return results;\n};\n\n/** The four `sh:min/maxInclusive/Exclusive` range constraints, on numbers. */\nconst rangeCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n const bounds: {\n limit: unknown;\n component: NodeReferenceValue;\n ok: (v: number, limit: number) => boolean;\n phrase: string;\n }[] = [\n {limit: ps.minInclusive, component: shacl.MinInclusiveConstraintComponent, ok: (v, l) => v >= l, phrase: 'at least'},\n {limit: ps.maxInclusive, component: shacl.MaxInclusiveConstraintComponent, ok: (v, l) => v <= l, phrase: 'at most'},\n {limit: ps.minExclusive, component: shacl.MinExclusiveConstraintComponent, ok: (v, l) => v > l, phrase: 'greater than'},\n {limit: ps.maxExclusive, component: shacl.MaxExclusiveConstraintComponent, ok: (v, l) => v < l, phrase: 'less than'},\n ];\n const active = bounds.filter((b) => typeof b.limit === 'number');\n if (!active.length) return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n // Non-numbers are the datatype check's business.\n if (!isCheckableElement(el) || typeof el !== 'number') continue;\n for (const bound of active) {\n if (bound.ok(el, bound.limit as number)) continue;\n results.push(\n violation(\n ctx,\n bound.component,\n `Property '${labelOf(ps)}' must be ${bound.phrase} ${bound.limit}, but was given ${el}.`,\n el,\n ),\n );\n }\n }\n return results;\n};\n\n/** `sh:minLength` / `sh:maxLength`, on strings. */\nconst lengthCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (typeof ps.minLength !== 'number' && typeof ps.maxLength !== 'number') return [];\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el) || typeof el !== 'string') continue;\n if (typeof ps.minLength === 'number' && el.length < ps.minLength) {\n results.push(\n violation(\n ctx,\n shacl.MinLengthConstraintComponent,\n `Property '${labelOf(ps)}' must be at least ${ps.minLength} character(s), but was given ${el.length}.`,\n el,\n ),\n );\n }\n if (typeof ps.maxLength === 'number' && el.length > ps.maxLength) {\n results.push(\n violation(\n ctx,\n shacl.MaxLengthConstraintComponent,\n `Property '${labelOf(ps)}' must be at most ${ps.maxLength} character(s), but was given ${el.length}.`,\n el,\n ),\n );\n }\n }\n return results;\n};\n\n/** `sh:pattern` — the string form of the value must match the shape's regex. */\nconst patternCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (!ps.pattern) return [];\n // Rebuild without `g`/`y`: those carry `lastIndex` between calls, so a shared\n // shape regex would match every other value.\n const regex = new RegExp(ps.pattern.source, ps.pattern.flags.replace(/[gy]/g, ''));\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el) || typeof el !== 'string') continue;\n if (regex.test(el)) continue;\n results.push(\n violation(\n ctx,\n shacl.PatternConstraintComponent,\n `Property '${labelOf(ps)}' must match ${String(ps.pattern)}, but was given \"${el}\".`,\n el,\n ),\n );\n }\n return results;\n};\n\n/** `sh:in` — the value must be one of the shape's allowed values. */\nconst inCheck: ConstraintCheck = (values, ctx) => {\n const ps = ctx.propertyShape;\n if (!ps.in?.length) return [];\n const allowed = ps.in;\n const matches = (el: unknown) =>\n allowed.some((a) =>\n isNodeReferenceValue(a)\n ? isNodeReference(el) && (el as NodeReferenceValue).id === a.id\n : a === el,\n );\n\n const results: ValidationResult[] = [];\n for (const el of values) {\n if (!isCheckableElement(el) || matches(el)) continue;\n const rendered = allowed\n .map((a) => (isNodeReferenceValue(a) ? a.id : JSON.stringify(a)))\n .join(', ');\n results.push(\n violation(\n ctx,\n shacl.InConstraintComponent,\n `Property '${labelOf(ps)}' must be one of [${rendered}].`,\n el,\n ),\n );\n }\n return results;\n};\n\n/**\n * The registry. Every property-level constraint the library enforces lives here;\n * adding another SHACL component is one more entry plus its test.\n *\n * Split by what each kind of check needs to see. **Cardinality** needs the\n * property's whole value set, so it cannot run against a set modification —\n * `{add: […]}` changes a count that lives in the store. **Value** checks need\n * only the value in hand, so they run everywhere a concrete value appears,\n * including inside `add`.\n *\n * Cardinality runs first when it runs at all: a count problem explains itself\n * better than the per-value violations that would follow it.\n */\nconst CARDINALITY_CONSTRAINTS: ConstraintCheck[] = [maxCountCheck, minCountCheck];\n\nconst VALUE_CONSTRAINTS: ConstraintCheck[] = [\n nodeKindCheck,\n datatypeCheck,\n rangeCheck,\n lengthCheck,\n patternCheck,\n inCheck,\n];\n\nconst PROPERTY_CONSTRAINTS: ConstraintCheck[] = [\n ...CARDINALITY_CONSTRAINTS,\n ...VALUE_CONSTRAINTS,\n];\n\n// ---------------------------------------------------------------------------\n// Value classification\n// ---------------------------------------------------------------------------\n\n/**\n * A `{add, remove}` set modification. The resulting value count depends on the\n * node's current state, so cardinality and kind are unknowable here.\n */\nfunction isSetModification(value: unknown): boolean {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as Record<string, unknown>;\n const expected = (obj.add ? 1 : 0) + (obj.remove ? 1 : 0);\n return expected > 0 && Object.getOwnPropertyNames(obj).length === expected;\n}\n\n/** An object carrying only an `id` — a reference to an existing node, not a description. */\nfunction isNodeReference(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'id' in value &&\n Object.keys(value).length === 1\n );\n}\n\n/**\n * A value that stands for something resolved later — an expression, a query\n * context reference, a callback, or nothing at all.\n *\n * Must be ruled out *before* anything reads properties off the value: a resolved\n * context ref is a query proxy that throws on any undecorated key, so probing it\n * for `.add` is not a safe way to ask what it is.\n */\nfunction isDeferredValue(value: unknown): boolean {\n return (\n value === undefined ||\n typeof value === 'function' ||\n isExpressionNode(value) ||\n !!asContextRef(value)\n );\n}\n\n/** Values whose final shape isn't knowable without the store or a lowering pass. */\nfunction isOpaqueValue(value: unknown): boolean {\n return isDeferredValue(value) || isSetModification(value);\n}\n\n/** A nested node description — an object to descend into, rather than a leaf value. */\nfunction isNodeDescription(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n !isNodeReference(value) &&\n !isOpaqueValue(value)\n );\n}\n\n// ---------------------------------------------------------------------------\n// Entry points\n// ---------------------------------------------------------------------------\n\n/**\n * What can be validated against: a shape class (`Person`) or the plain\n * `NodeShapeData` the decorators generate (`Person.shape`, or the same object\n * obtained anywhere else). The two are interchangeable — the class is unwrapped\n * to its `shape` and nothing else about it is read.\n */\nexport type ValidatableShape = NodeShapeData | {shape: NodeShapeData};\n\nfunction resolveShapeData(shape: ValidatableShape): NodeShapeData {\n const resolved = 'propertyShapes' in shape ? shape : (shape as {shape: NodeShapeData}).shape;\n if (!resolved) {\n throw new Error(\n 'validate() requires a node shape or a shape class with a static `shape`. ' +\n 'Did you pass an unregistered class (missing @linkedShape)?',\n );\n }\n return resolved as NodeShapeData;\n}\n\n/**\n * Validate a plain data object against a node shape.\n *\n * Never throws for invalid *data* — a violation is a result, not an exception.\n * (It does throw when the *shape* argument itself is unusable.)\n *\n * ```ts\n * const report = validate(Person, {name: ['a', 'b']});\n * report.conforms; // false\n * report.results[0].sourceConstraintComponent.id; // …shacl#MaxCountConstraintComponent\n * ```\n *\n * **A shape class is optional.** The plain `NodeShapeData` the decorators\n * generate validates identically, so a caller that only ever holds shape\n * objects needs no class reference:\n *\n * ```ts\n * validate(Person, data); // ≡\n * validate(Person.shape, data); // same report\n * ```\n *\n * That holds even though a shape object carries neither its inherited property\n * shapes (a subclass's `propertyShapes` holds only its own) nor its nested\n * shapes (`valueShape` is a bare `{id}`): both are resolved through the shape\n * registry by id. A shape whose id is not registered therefore cannot be fully\n * checked, and says so — see {@link unresolvedValueShapeMessage} and the\n * inherited-properties check in `validateNode` — rather than reporting a node\n * as conforming on the strength of a branch it could not look at.\n */\nexport function validate(\n shape: ValidatableShape,\n data: unknown,\n options: ValidateOptions = {},\n): ValidationReport {\n const {mode = 'complete', maxDepth = 10} = options;\n const results = validateNode(resolveShapeData(shape), data, {\n mode,\n maxDepth,\n depth: 0,\n prefix: '',\n });\n return {\n conforms: !results.some((r) => r.resultSeverity.id === shacl.Violation.id),\n results,\n };\n}\n\n/** {@link validate}, but throws a {@link ShapeValidationError} when the data doesn't conform. */\nexport function assertValid(\n shape: ValidatableShape,\n data: unknown,\n options: ValidateOptions = {},\n): void {\n const report = validate(shape, data, options);\n if (!report.conforms) throw new ShapeValidationError(report);\n}\n\n// ---------------------------------------------------------------------------\n// Walk\n// ---------------------------------------------------------------------------\n\ninterface WalkContext {\n mode: ValidationMode;\n maxDepth: number;\n depth: number;\n /** Dot-joined label path of the node being validated (`''` at the root). */\n prefix: string;\n focusNode?: string;\n}\n\nfunction validateNode(\n shape: NodeShapeData,\n data: unknown,\n ctx: WalkContext,\n): ValidationResult[] {\n if (typeof data !== 'object' || data === null || Array.isArray(data)) {\n return [\n nodeViolation(\n shape,\n ctx,\n shacl.NodeConstraintComponent,\n `Expected an object describing '${shape.label || shape.id}', but got ${data === null ? 'null' : typeof data}.`,\n ctx.prefix,\n data,\n ),\n ];\n }\n\n const obj = data as Record<string, unknown>;\n const propertyShapes = getUniquePropertyShapes(shape);\n const byLabel = new Map(propertyShapes.map((ps) => [ps.label, ps]));\n const focusNode =\n typeof obj.__id === 'string'\n ? obj.__id\n : typeof obj.id === 'string'\n ? obj.id\n : ctx.focusNode;\n const results: ValidationResult[] = [];\n\n // A shape declaring a superclass carries only its *own* property shapes; the\n // inherited ones are resolved through the registry by id. If this shape's id\n // is not registered, that resolution quietly yields half a shape — required\n // inherited properties go unchecked, and any that *are* supplied look\n // undeclared. Report it rather than let a partial shape pass as a clean bill.\n //\n // \"Registered\" means present in EITHER registry. Checking only for a class rejected\n // exactly the shapes the metamodel work exists to support: a data-only child is\n // registered, its parent resolves, and its inherited properties are checked — it simply\n // has no class, which is not a defect.\n if (shape.extends?.id && !getShapeClass(shape.id) && !getNodeShape(shape.id)) {\n results.push(\n nodeViolation(\n shape,\n {focusNode},\n shacl.NodeConstraintComponent,\n `Cannot resolve the properties '${shape.label || shape.id}' inherits from '${shape.extends.id}': shape '${shape.id}' is not registered, so only its own properties could be checked.`,\n ctx.prefix,\n ),\n );\n }\n\n // Presence of required properties — only decidable for a complete description.\n if (ctx.mode === 'complete') {\n for (const ps of propertyShapes) {\n if (typeof ps.minCount !== 'number' || ps.minCount <= 0) continue;\n if (ps.label in obj) continue;\n results.push(\n violation(\n {shape, propertyShape: ps, property: join(ctx.prefix, ps.label), focusNode, mode: ctx.mode},\n shacl.MinCountConstraintComponent,\n `Property '${labelOf(ps)}' requires at least ${ps.minCount} value(s), but none were provided.`,\n ),\n );\n }\n }\n\n // The values actually provided.\n for (const [key, value] of Object.entries(obj)) {\n if (RESERVED_KEYS.has(key)) continue;\n const propertyShape = byLabel.get(key);\n if (!propertyShape) {\n results.push(\n nodeViolation(\n shape,\n {...ctx, focusNode},\n shacl.ClosedConstraintComponent,\n undeclaredPropertyMessage(key, shape),\n join(ctx.prefix, key),\n value,\n ),\n );\n continue;\n }\n results.push(\n ...validateProperty(value, {\n shape,\n propertyShape,\n property: join(ctx.prefix, key),\n focusNode,\n mode: ctx.mode,\n }, ctx),\n );\n }\n\n return results;\n}\n\nfunction validateProperty(\n value: unknown,\n propCtx: PropertyContext,\n walk: WalkContext,\n): ValidationResult[] {\n const ps = propCtx.propertyShape;\n\n // `null` clears the property — the same as providing zero values, so clearing\n // a required one is a cardinality violation (both spellings behave alike).\n if (value === null) {\n if (typeof ps.minCount === 'number' && ps.minCount > 0) {\n return [\n violation(\n propCtx,\n shacl.MinCountConstraintComponent,\n `Property '${labelOf(ps)}' requires at least ${ps.minCount} value(s) and cannot be cleared.`,\n ),\n ];\n }\n return [];\n }\n\n // Ruled out first: reading `.add` off a resolved context proxy would throw.\n if (isDeferredValue(value)) return [];\n\n // A set modification adds to and removes from what the store already holds,\n // so the resulting *count* is unknowable here — but each added value is as\n // checkable as any other, and skipping them let mistyped literals through the\n // one door the rest of this module closes. `remove` takes `{id}` references\n // only, which normalization enforces on its own.\n if (isSetModification(value)) {\n const {add} = value as {add?: unknown};\n if (add === undefined) return [];\n return runChecks(VALUE_CONSTRAINTS, toValues(add), propCtx, walk);\n }\n\n return runChecks(PROPERTY_CONSTRAINTS, toValues(value), propCtx, walk);\n}\n\n/** A property's value(s) as an array — a single value becomes a one-element one. */\nfunction toValues(value: unknown): unknown[] {\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Run a set of constraint checks over a property's values, then descend into any\n * nested node descriptions among them (`sh:node`-style recursion). A bare `{id}`\n * is a reference to an existing node and has nothing to validate; an object with\n * an id *and* data is a nested create with a predefined id.\n */\nfunction runChecks(\n checks: ConstraintCheck[],\n values: unknown[],\n propCtx: PropertyContext,\n walk: WalkContext,\n): ValidationResult[] {\n const results: ValidationResult[] = [];\n for (const check of checks) {\n results.push(...check(values, propCtx));\n }\n\n if (walk.depth < walk.maxDepth) {\n for (const el of values) {\n if (!isNodeDescription(el)) continue;\n const nestedShape = resolveValueShape(propCtx.propertyShape, el);\n if (!nestedShape) {\n // The value is a node description we have no shape for, so nothing about\n // it can be checked. Silently skipping would report the whole node as\n // conforming on the strength of a branch never looked at.\n results.push(\n violation(\n propCtx,\n shacl.NodeConstraintComponent,\n unresolvedValueShapeMessage(propCtx.propertyShape, propCtx.shape),\n ),\n );\n continue;\n }\n results.push(\n ...validateNode(nestedShape, el, {\n ...walk,\n depth: walk.depth + 1,\n prefix: propCtx.property,\n focusNode: undefined,\n }),\n );\n }\n }\n\n return results;\n}\n\n/**\n * Why a nested value could not be resolved to a shape — the property named one\n * that is not registered, or named none and the value did not carry one either.\n * Both are actionable, and they are fixed differently.\n */\nfunction unresolvedValueShapeMessage(ps: PropertyShapeData, owner: NodeShapeData): string {\n const label = labelOf(ps);\n const why = ps.valueShape ? describeUnresolved(unresolvedValueShapeDetails(ps, owner)) : '';\n return ps.valueShape\n ? `Cannot validate the value of '${label}': its shape '${ps.valueShape.id}' does not resolve` +\n (why ? ` (${why}).` : '.')\n : `Cannot validate the value of '${label}' of '${owner.id}': the property declares no shape for its values. ` +\n `Add a 'shape' to its @objectProperty decorator, or give the value a 'shape' key.`;\n}\n\n/**\n * The shape a nested value should be validated against: the shape class carried\n * in the value's reserved `shape` key when the property declares no `valueShape`\n * or the key names a subclass of it, otherwise the declared `valueShape`. Mirrors\n * `convertUpdateValue`; returns undefined when neither is available.\n */\nfunction resolveValueShape(\n ps: PropertyShapeData,\n value: unknown,\n): NodeShapeData | undefined {\n const own = (value as {shape?: {shape?: NodeShapeData}}).shape?.shape;\n if (!ps.valueShape) return own;\n const declared = getQueryShapeClass(ps.valueShape)?.shape;\n // A value naming a subclass of the declared shape is validated as that subclass.\n if (own && declared && isSubShapeOf(own, declared)) return own;\n return declared;\n}\n\nfunction join(prefix: string, label: string): string {\n return prefix ? `${prefix}.${label}` : label;\n}\n"]}
@@ -32,11 +32,13 @@ export declare function unresolvedValueShapeDetails(ps: PropertyShapeData, owner
32
32
  /** The details for a shape named directly (a query's or mutation's own shape). */
33
33
  export declare function topLevelDetails(shapeIri: string): UnresolvedShapeDetails;
34
34
  /**
35
- * Why the shape is missing, in words: `property 'home' of '<owner>' points at it; catalog
36
- * 'p1#main' does not hold it`. Each error keeps its own leading sentence and appends this.
35
+ * Why the shape is missing, in words: `property 'home' of '<owner>' points at it; not among the
36
+ * shapes in scope 'p1#main'`. The scope is named only while a scoped `ShapeCatalog` is active
37
+ * (`withShapeCatalog`); against the global registry the text ends after "points at it". Each
38
+ * error keeps its own leading sentence and appends this; empty when there is nothing to add.
37
39
  */
38
40
  export declare function describeUnresolved(details: UnresolvedShapeDetails): string;
39
- /** `<prefix> (<why>)` as an {@link UnresolvedShapeError}. */
41
+ /** `<prefix> (<why>)` as an {@link UnresolvedShapeError}; just `<prefix>` when there is no why. */
40
42
  export declare function unresolvedShapeError(prefix: string, details: UnresolvedShapeDetails): UnresolvedShapeError;
41
43
  /** The error for a property whose `valueShape` does not resolve. */
42
44
  export declare function unresolvedValueShapeError(prefix: string, ps: PropertyShapeData, owner?: NodeShapeData): UnresolvedShapeError;
@@ -37,8 +37,10 @@ export function topLevelDetails(shapeIri) {
37
37
  return Object.assign({ shapeIri }, (catalog !== undefined ? { catalog } : {}));
38
38
  }
39
39
  /**
40
- * Why the shape is missing, in words: `property 'home' of '<owner>' points at it; catalog
41
- * 'p1#main' does not hold it`. Each error keeps its own leading sentence and appends this.
40
+ * Why the shape is missing, in words: `property 'home' of '<owner>' points at it; not among the
41
+ * shapes in scope 'p1#main'`. The scope is named only while a scoped `ShapeCatalog` is active
42
+ * (`withShapeCatalog`); against the global registry the text ends after "points at it". Each
43
+ * error keeps its own leading sentence and appends this; empty when there is nothing to add.
42
44
  */
43
45
  export function describeUnresolved(details) {
44
46
  const parts = [];
@@ -49,17 +51,15 @@ export function describeUnresolved(details) {
49
51
  }
50
52
  if (getActiveShapeCatalog() !== undefined) {
51
53
  parts.push(details.catalog !== undefined
52
- ? `catalog '${details.catalog}' does not hold it`
53
- : 'the active catalog does not hold it');
54
- }
55
- else {
56
- parts.push('it is not registered');
54
+ ? `not among the shapes in scope '${details.catalog}'`
55
+ : 'not among the shapes in scope');
57
56
  }
58
57
  return parts.join('; ');
59
58
  }
60
- /** `<prefix> (<why>)` as an {@link UnresolvedShapeError}. */
59
+ /** `<prefix> (<why>)` as an {@link UnresolvedShapeError}; just `<prefix>` when there is no why. */
61
60
  export function unresolvedShapeError(prefix, details) {
62
- return new UnresolvedShapeError(`${prefix} (${describeUnresolved(details)})`, details);
61
+ const why = describeUnresolved(details);
62
+ return new UnresolvedShapeError(why ? `${prefix} (${why})` : prefix, details);
63
63
  }
64
64
  /** The error for a property whose `valueShape` does not resolve. */
65
65
  export function unresolvedValueShapeError(prefix, ps, owner) {
@@ -1 +1 @@
1
- {"version":3,"file":"unresolvedShape.js","sourceRoot":"","sources":["../../../src/utils/unresolvedShape.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AAetD;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAO7C,YAAY,OAAe,EAAE,OAA+B;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACrE,IAAI,OAAO,CAAC,WAAW,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the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport type {NodeShapeData, PropertyShapeData} from '../shapes/nodeShapeData.js';\nimport {getActiveShapeCatalog} from './ShapeClass.js';\n\n/**\n * Where an unresolved shape was met: the shape IRI that could not be resolved and, when a\n * property pointed at it, that property and the shape that declares it. `catalog` is the\n * active catalog's `name`, absent in the global registry or for an unnamed catalog.\n */\nexport interface UnresolvedShapeDetails {\n shapeIri: string;\n property?: string;\n propertyIri?: string;\n ownerShapeIri?: string;\n catalog?: string;\n}\n\n/**\n * The error core throws when a shape IRI does not resolve, carrying the IRIs as fields so a\n * host can map it without parsing the message. It stays a plain `Error` (`name` is\n * `'Error'`): only the message and the fields are added.\n */\nexport class UnresolvedShapeError extends Error implements UnresolvedShapeDetails {\n readonly shapeIri: string;\n readonly property?: string;\n readonly propertyIri?: string;\n readonly ownerShapeIri?: string;\n readonly catalog?: string;\n\n constructor(message: string, details: UnresolvedShapeDetails) {\n super(message);\n this.shapeIri = details.shapeIri;\n if (details.property !== undefined) this.property = details.property;\n if (details.propertyIri !== undefined) this.propertyIri = details.propertyIri;\n if (details.ownerShapeIri !== undefined) this.ownerShapeIri = details.ownerShapeIri;\n if (details.catalog !== undefined) this.catalog = details.catalog;\n }\n}\n\n/**\n * The details for a property whose value shape does not resolve. The owner is the property's\n * `parentNodeShape`, or `owner` when the caller knows it better (a path walk).\n */\nexport function unresolvedValueShapeDetails(\n ps: PropertyShapeData,\n owner?: NodeShapeData,\n): UnresolvedShapeDetails {\n const ownerShapeIri = owner?.id ?? ps.parentNodeShape?.id;\n const catalog = getActiveShapeCatalog()?.name;\n return {\n shapeIri: ps.valueShape?.id ?? '',\n property: ps.label,\n ...(ps.path && typeof ps.path === 'object' && 'id' in ps.path && typeof ps.path.id === 'string'\n ? {propertyIri: ps.path.id}\n : {}),\n ...(ownerShapeIri ? {ownerShapeIri} : {}),\n ...(catalog !== undefined ? {catalog} : {}),\n };\n}\n\n/** The details for a shape named directly (a query's or mutation's own shape). */\nexport function topLevelDetails(shapeIri: string): UnresolvedShapeDetails {\n const catalog = getActiveShapeCatalog()?.name;\n return {shapeIri, ...(catalog !== undefined ? {catalog} : {})};\n}\n\n/**\n * Why the shape is missing, in words: `property 'home' of '<owner>' points at it; catalog\n * 'p1#main' does not hold it`. Each error keeps its own leading sentence and appends this.\n */\nexport function describeUnresolved(details: UnresolvedShapeDetails): string {\n const parts: string[] = [];\n if (details.property !== undefined) {\n parts.push(\n details.ownerShapeIri\n ? `property '${details.property}' of '${details.ownerShapeIri}' points at it`\n : `property '${details.property}' points at it`,\n );\n }\n if (getActiveShapeCatalog() !== undefined) {\n parts.push(\n details.catalog !== undefined\n ? `catalog '${details.catalog}' does not hold it`\n : 'the active catalog does not hold it',\n );\n } else {\n parts.push('it is not registered');\n }\n return parts.join('; ');\n}\n\n/** `<prefix> (<why>)` as an {@link UnresolvedShapeError}. */\nexport function unresolvedShapeError(\n prefix: string,\n details: UnresolvedShapeDetails,\n): UnresolvedShapeError {\n return new UnresolvedShapeError(`${prefix} (${describeUnresolved(details)})`, details);\n}\n\n/** The error for a property whose `valueShape` does not resolve. */\nexport function unresolvedValueShapeError(\n prefix: string,\n ps: PropertyShapeData,\n owner?: NodeShapeData,\n): UnresolvedShapeError {\n return unresolvedShapeError(prefix, unresolvedValueShapeDetails(ps, owner));\n}\n"]}
1
+ {"version":3,"file":"unresolvedShape.js","sourceRoot":"","sources":["../../../src/utils/unresolvedShape.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AAetD;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAO7C,YAAY,OAAe,EAAE,OAA+B;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,OAAO,CAAC,QAAQ,KAA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,MAAM,EAAE,2BAA2B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport type {NodeShapeData, PropertyShapeData} from '../shapes/nodeShapeData.js';\nimport {getActiveShapeCatalog} from './ShapeClass.js';\n\n/**\n * Where an unresolved shape was met: the shape IRI that could not be resolved and, when a\n * property pointed at it, that property and the shape that declares it. `catalog` is the\n * active catalog's `name`, absent in the global registry or for an unnamed catalog.\n */\nexport interface UnresolvedShapeDetails {\n shapeIri: string;\n property?: string;\n propertyIri?: string;\n ownerShapeIri?: string;\n catalog?: string;\n}\n\n/**\n * The error core throws when a shape IRI does not resolve, carrying the IRIs as fields so a\n * host can map it without parsing the message. It stays a plain `Error` (`name` is\n * `'Error'`): only the message and the fields are added.\n */\nexport class UnresolvedShapeError extends Error implements UnresolvedShapeDetails {\n readonly shapeIri: string;\n readonly property?: string;\n readonly propertyIri?: string;\n readonly ownerShapeIri?: string;\n readonly catalog?: string;\n\n constructor(message: string, details: UnresolvedShapeDetails) {\n super(message);\n this.shapeIri = details.shapeIri;\n if (details.property !== undefined) this.property = details.property;\n if (details.propertyIri !== undefined) this.propertyIri = details.propertyIri;\n if (details.ownerShapeIri !== undefined) this.ownerShapeIri = details.ownerShapeIri;\n if (details.catalog !== undefined) this.catalog = details.catalog;\n }\n}\n\n/**\n * The details for a property whose value shape does not resolve. The owner is the property's\n * `parentNodeShape`, or `owner` when the caller knows it better (a path walk).\n */\nexport function unresolvedValueShapeDetails(\n ps: PropertyShapeData,\n owner?: NodeShapeData,\n): UnresolvedShapeDetails {\n const ownerShapeIri = owner?.id ?? ps.parentNodeShape?.id;\n const catalog = getActiveShapeCatalog()?.name;\n return {\n shapeIri: ps.valueShape?.id ?? '',\n property: ps.label,\n ...(ps.path && typeof ps.path === 'object' && 'id' in ps.path && typeof ps.path.id === 'string'\n ? {propertyIri: ps.path.id}\n : {}),\n ...(ownerShapeIri ? {ownerShapeIri} : {}),\n ...(catalog !== undefined ? {catalog} : {}),\n };\n}\n\n/** The details for a shape named directly (a query's or mutation's own shape). */\nexport function topLevelDetails(shapeIri: string): UnresolvedShapeDetails {\n const catalog = getActiveShapeCatalog()?.name;\n return {shapeIri, ...(catalog !== undefined ? {catalog} : {})};\n}\n\n/**\n * Why the shape is missing, in words: `property 'home' of '<owner>' points at it; not among the\n * shapes in scope 'p1#main'`. The scope is named only while a scoped `ShapeCatalog` is active\n * (`withShapeCatalog`); against the global registry the text ends after \"points at it\". Each\n * error keeps its own leading sentence and appends this; empty when there is nothing to add.\n */\nexport function describeUnresolved(details: UnresolvedShapeDetails): string {\n const parts: string[] = [];\n if (details.property !== undefined) {\n parts.push(\n details.ownerShapeIri\n ? `property '${details.property}' of '${details.ownerShapeIri}' points at it`\n : `property '${details.property}' points at it`,\n );\n }\n if (getActiveShapeCatalog() !== undefined) {\n parts.push(\n details.catalog !== undefined\n ? `not among the shapes in scope '${details.catalog}'`\n : 'not among the shapes in scope',\n );\n }\n return parts.join('; ');\n}\n\n/** `<prefix> (<why>)` as an {@link UnresolvedShapeError}; just `<prefix>` when there is no why. */\nexport function unresolvedShapeError(\n prefix: string,\n details: UnresolvedShapeDetails,\n): UnresolvedShapeError {\n const why = describeUnresolved(details);\n return new UnresolvedShapeError(why ? `${prefix} (${why})` : prefix, details);\n}\n\n/** The error for a property whose `valueShape` does not resolve. */\nexport function unresolvedValueShapeError(\n prefix: string,\n ps: PropertyShapeData,\n owner?: NodeShapeData,\n): UnresolvedShapeError {\n return unresolvedShapeError(prefix, unresolvedValueShapeDetails(ps, owner));\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_linked/core",
3
- "version": "2.36.0",
3
+ "version": "2.36.1",
4
4
  "packageManager": "npm@12.2.0",
5
5
  "license": "MIT",
6
6
  "linkedPackage": true,