@_linked/core 2.24.1 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/lib/esm/ontologies/linked-core.js +10 -3
- package/lib/esm/ontologies/linked-core.js.map +1 -1
- package/lib/esm/shapes/SHACL.d.ts +2 -2
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/nodeShapeData.d.ts +2 -2
- package/lib/esm/shapes/nodeShapeData.js.map +1 -1
- package/lib/esm/utils/Package.js +2 -2
- package/lib/esm/utils/Package.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#299](https://github.com/linked-fw/core/pull/299) [`d51089a`](https://github.com/linked-fw/core/commit/d51089a532fbc458b2df51d362c460e4a3700203) Thanks [@flyon](https://github.com/flyon)! - The framework vocabulary now lives at `https://linked.cm/ont/core/` with the prefix `core`
|
|
8
|
+
(previously `https://linked.cm/ont/linked-core/`, prefix `linked_core`).
|
|
9
|
+
|
|
10
|
+
This follows the public ontology namespace rule, `https://linked.cm/ont/{ontologySlug}/{localName}`,
|
|
11
|
+
where the ontology slug defaults to the package's public slug (`@_linked/core` -> `core`) and the
|
|
12
|
+
prefix label equals that slug. The old `linked-core` segment was a leftover of a slug derivation
|
|
13
|
+
that has since been reverted. Every term moves: `core:displayRank`, `core:displayHidden`,
|
|
14
|
+
`core:contains`, `core:dependent`, `core:PathNode`, `core:Package` and the rest.
|
|
15
|
+
|
|
16
|
+
The `linked_core` prefix is deprecated but still registered as an alias, so prefixed names such as
|
|
17
|
+
`linked_core:displayRank` keep resolving — to the new IRIs. Compaction always emits `core:`. The
|
|
18
|
+
alias does not make the old full IRIs match.
|
|
19
|
+
|
|
20
|
+
Stored data under the old IRIs is not migrated. Triples such as
|
|
21
|
+
`https://linked.cm/ont/linked-core/displayRank` on synced shapes stay as they are; clear dev
|
|
22
|
+
datasets and resync shapes from code.
|
|
23
|
+
|
|
24
|
+
Released as a minor rather than a major: the previous move of this vocabulary (from
|
|
25
|
+
`purl.org/on/lincd` to `linked.cm`, [#91](https://github.com/Semantu/linked/issues/91)) shipped as a minor in 2.8.0; these terms appear only in
|
|
26
|
+
code-derived shape and package metadata that shape sync rewrites from code; there is no real data
|
|
27
|
+
using them; and a core major would force every `@_linked` package to move its peer range.
|
|
28
|
+
|
|
3
29
|
## 2.24.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { createNameSpace } from '../utils/NameSpace.js';
|
|
2
2
|
import { Prefix } from '../utils/Prefix.js';
|
|
3
|
-
// The @_linked/core framework vocabulary.
|
|
4
|
-
//
|
|
3
|
+
// The @_linked/core framework vocabulary. First-party ontology IRIs follow Create Now
|
|
4
|
+
// arch-02 §"Public ontology namespace":
|
|
5
5
|
// https://linked.cm/ont/{ontologySlug}/{localName}
|
|
6
|
-
|
|
6
|
+
// where ontologySlug defaults to the owning package's publicSlug (`@_linked/core` -> `core`)
|
|
7
|
+
// and the prefix label equals the ontologySlug. Previously `https://linked.cm/ont/linked-core/`
|
|
8
|
+
// (prefix `linked_core`), a leftover of a reverted slug derivation.
|
|
9
|
+
export const ns = createNameSpace('https://linked.cm/ont/core/');
|
|
7
10
|
export const _self = ns('');
|
|
11
|
+
// @deprecated prefix alias: keeps `linked_core:` prefixed names resolving (to the NEW IRIs).
|
|
12
|
+
// It does not make the old full IRIs match. Registered BEFORE `core` because the last add
|
|
13
|
+
// wins for IRI -> prefix compaction, so output always uses `core:`.
|
|
8
14
|
Prefix.add('linked_core', _self.id);
|
|
15
|
+
Prefix.add('core', _self.id);
|
|
9
16
|
const Package = ns('Package');
|
|
10
17
|
const ShapeClass = ns('ShapeClass');
|
|
11
18
|
const definesShape = ns('definesShape');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-core.js","sourceRoot":"","sources":["../../../src/ontologies/linked-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"linked-core.js","sourceRoot":"","sources":["../../../src/ontologies/linked-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE1C,sFAAsF;AACtF,wCAAwC;AACxC,qDAAqD;AACrD,6FAA6F;AAC7F,gGAAgG;AAChG,oEAAoE;AACpE,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,6BAA6B,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,KAAK,GAAuB,EAAE,CAAC,EAAE,CAAC,CAAC;AAChD,6FAA6F;AAC7F,0FAA0F;AAC1F,oEAAoE;AACpE,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AACpC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AAE7B,MAAM,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC9B,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;AACpC,MAAM,YAAY,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;AACxC,MAAM,cAAc,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AACpC,MAAM,cAAc,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;AACpC,MAAM,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;AAEtC,sCAAsC;AACtC,sFAAsF;AACtF,mGAAmG;AACnG,iGAAiG;AACjG,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,SAAS,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;AAClC,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAEhC,oFAAoF;AACpF,oFAAoF;AACpF,mFAAmF;AACnF,oFAAoF;AACpF,mFAAmF;AACnF,0EAA0E;AAC1E,EAAE;AACF,mFAAmF;AACnF,kFAAkF;AAClF,qFAAqF;AACrF,MAAM,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO;IACP,UAAU;IACV,YAAY;IACZ,MAAM,EAAE,cAAc;IACtB,cAAc;IACd,UAAU;IACV,WAAW;IACX,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,WAAW;IACX,aAAa;CACd,CAAC","sourcesContent":["import type {NodeReferenceValue} from '../utils/NodeReference.js';\nimport {createNameSpace} from '../utils/NameSpace.js';\nimport {Prefix} from '../utils/Prefix.js';\n\n// The @_linked/core framework vocabulary. First-party ontology IRIs follow Create Now\n// arch-02 §\"Public ontology namespace\":\n// https://linked.cm/ont/{ontologySlug}/{localName}\n// where ontologySlug defaults to the owning package's publicSlug (`@_linked/core` -> `core`)\n// and the prefix label equals the ontologySlug. Previously `https://linked.cm/ont/linked-core/`\n// (prefix `linked_core`), a leftover of a reverted slug derivation.\nexport const ns = createNameSpace('https://linked.cm/ont/core/');\nexport const _self: NodeReferenceValue = ns('');\n// @deprecated prefix alias: keeps `linked_core:` prefixed names resolving (to the NEW IRIs).\n// It does not make the old full IRIs match. Registered BEFORE `core` because the last add\n// wins for IRI -> prefix compaction, so output always uses `core:`.\nPrefix.add('linked_core', _self.id);\nPrefix.add('core', _self.id);\n\nconst Package = ns('Package');\nconst ShapeClass = ns('ShapeClass');\nconst definesShape = ns('definesShape');\nconst moduleProperty = ns('module');\nconst usesShapeClass = ns('usesShapeClass');\nconst editInline = ns('editInline');\nconst isExtending = ns('isExtending');\n\n// Containment / lifecycle vocabulary.\n// contains — property characteristic: the cascade follows this edge (composition).\n// dependent — shape characteristic: instances may be deleted when reached via a `contains` edge.\n// PathNode — class for SHACL property-path operator nodes (sh:inversePath/alternativePath/…).\nconst contains = ns('contains');\nconst dependent = ns('dependent');\nconst PathNode = ns('PathNode');\n\n// Display vocabulary. SHACL has `sh:order` and `sh:group`, which say how properties\n// are arranged; it has no way to say how *important* a property is, which is what a\n// renderer needs when it can only show one, three or six of them. `displayRank` is\n// that: a single linear rank per property, lower = more important, from which every\n// truncated context (\"show the top 3\") derives. `displayHidden` removes a property\n// from generic rendering without changing its cardinality or its meaning.\n//\n// Placement is deliberate (backlog-029): this is an ecosystem SHACL extension that\n// materializes onto the pure `sh:NodeShape` and therefore travels with an ejected\n// app — NOT the CN-proprietary `code:` vocab, which describes source-code structure.\nconst displayRank = ns('displayRank');\nconst displayHidden = ns('displayHidden');\n\nexport const coreOntology = {\n Package,\n ShapeClass,\n definesShape,\n module: moduleProperty,\n usesShapeClass,\n editInline,\n isExtending,\n contains,\n dependent,\n PathNode,\n displayRank,\n displayHidden,\n};\n"]}
|
|
@@ -175,11 +175,11 @@ export interface PropertyShapeConfig {
|
|
|
175
175
|
order?: number;
|
|
176
176
|
group?: string;
|
|
177
177
|
/**
|
|
178
|
-
* Display importance, lower = more important (`
|
|
178
|
+
* Display importance, lower = more important (`core:displayRank`).
|
|
179
179
|
* A renderer that can show only N properties shows the N lowest ranks.
|
|
180
180
|
*/
|
|
181
181
|
displayRank?: number;
|
|
182
|
-
/** Omit this property from generic rendering (`
|
|
182
|
+
/** Omit this property from generic rendering (`core:displayHidden`). */
|
|
183
183
|
displayHidden?: boolean;
|
|
184
184
|
/**
|
|
185
185
|
* should correlate to the given datatype or class
|
|
@@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,EACnB,QAAwC,EACxC,EAAE;IACF,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QACzC,kBAAkB,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACrD,CAAC,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 NodeReferenceValue, toNodeReference} from '../utils/NodeReference.js';\nimport {Shape, type ShapeConstructor} from './Shape.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {warnOnReservedPropertyLabel} from '../queries/reservedQueryNames.js';\nimport {getShapeClass} from '../utils/ShapeClass.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\nimport {normalizePropertyPath, type PropertyPathDecoratorInput} from '../paths/normalizePropertyPath.js';\nimport {\n createPropertyShapeData,\n getPropertyShape as getPropertyShapeData,\n addPropertyShape as addPropertyShapeData,\n clonePropertyShape,\n type NodeShapeData,\n type PropertyShapeData,\n} from './nodeShapeData.js';\n\n// Metadata types now live in nodeShapeData.js (plain objects); re-exported here for\n// existing importers of `NodeShape`/`PropertyShape`-adjacent types.\nexport type {NodeShapeData, PropertyShapeData, PropertyShapeResult} from './nodeShapeData.js';\n// Metadata operations (formerly NodeShape/PropertyShape instance methods).\nexport {\n getPropertyShapes,\n getUniquePropertyShapes,\n getPropertyShape,\n addPropertyShape,\n clonePropertyShape,\n propertyShapeToResult,\n nodeShapeEquals,\n createNodeShapeData,\n createPropertyShapeData,\n} from './nodeShapeData.js';\n\n/**\n * Default identity root for shape & package IRIs. Public/first-party packages\n * publish under `linked.cm` (arch-02 §Domains). Packages may override per-package\n * via `linkedPackage(name, { baseUri })` — CN injects a workspace-scoped root\n * (`{workspaceSlug}.id.create.now`) for private packages; first-party packages\n * keep this default.\n */\nexport const LINKED_DATA_ROOT: string = 'https://linked.cm/';\n\n/**\n * Derive the public package slug — the npm package **basename** with the\n * `@scope/` dropped, kebab-cased (arch-02 §Slug rules: `^[a-z0-9]+(?:-[a-z0-9]+)*$`).\n * The package name is the single source of truth; there is no separate slug.\n * `@_linked/core` → `core`, `@linked.cm/blog` → `blog`, `mypkg` → `mypkg`.\n *\n * Both first-party (`@_linked`) and community (`@linked.cm`) packages publish into\n * the one `linked.cm/{shape,pkg}` space, so the basename must be globally unique —\n * enforced by the registry, which reserves the (handful of) first-party names.\n */\nexport function packageNameToSlug(packageName: string): string {\n return packageName\n .replace(/^@[^/]+\\//, '') // drop the npm scope (@scope/), keep the basename\n .replace(/[^a-zA-Z0-9]+/g, '-') // any run of non-alphanumerics → single hyphen\n .replace(/^-+|-+$/g, '') // trim stray hyphens\n .toLowerCase();\n}\n\n/**\n * Where each package publishes its IRIs (the identity root). The slug is always\n * derived from the package name; only the root is configurable — `linkedPackage`\n * defaults it to `LINKED_DATA_ROOT` (linked.cm), and CN injects a workspace-scoped\n * root (`{workspaceSlug}.id.create.now`) for private packages.\n */\nconst packageBaseUri = new Map<string, string>();\n\n/** Record a package's publish root. Called by `linkedPackage()`. */\nexport function setPackagePublishConfig(\n packageName: string,\n config?: {baseUri?: string},\n): void {\n packageBaseUri.set(packageName, config?.baseUri ?? LINKED_DATA_ROOT);\n}\n\n/** Resolve a package's publish root, defaulting to linked.cm if undeclared. */\nfunction resolveBaseUri(packageName: string): string {\n return packageBaseUri.get(packageName) ?? LINKED_DATA_ROOT;\n}\n\n/** Public/first-party package IRI — arch-02: `{baseUri}pkg/{slug}`. */\nexport function getPackageUri(packageName: string): string {\n return `${resolveBaseUri(packageName)}pkg/${packageNameToSlug(packageName)}`;\n}\n\ntype NodeKindConfig = NodeReferenceValue | NodeReferenceValue[];\n\nexport type PropertyPathInput = PropertyPathDecoratorInput;\nexport type PropertyPathInputList = PropertyPathDecoratorInput;\n\nconst normalizeNodeKind = (\n nodeKind?: NodeKindConfig,\n defaultNodeKind?: NodeReferenceValue,\n): NodeReferenceValue | undefined => {\n if (!nodeKind) {\n return defaultNodeKind;\n }\n if (Array.isArray(nodeKind)) {\n const ids = nodeKind.map((entry) => entry?.id);\n const includesBlank = ids.includes(shacl.BlankNode.id);\n const includesNamed = ids.includes(shacl.IRI.id);\n const includesLiteral = ids.includes(shacl.Literal.id);\n if (includesBlank && includesNamed) {\n return shacl.BlankNodeOrIRI;\n }\n if (includesLiteral && includesNamed) {\n return shacl.IRIOrLiteral;\n }\n if (includesLiteral && includesBlank) {\n return shacl.BlankNodeOrLiteral;\n }\n return nodeKind[0];\n }\n return nodeKind;\n};\n\nexport interface NodeShapeConfig {\n /**\n * Set to true to close the shape. This means any target node of this shape\n * that has properties outside the defined properties of this shape is invalid.\n */\n closed?: boolean;\n /**\n * Optional list of properties that are also permitted in addition to those explicitly listed by this shape.\n */\n ignoredProperties?: NodeReferenceValue[];\n}\n\nexport interface LiteralPropertyShapeConfig extends PropertyShapeConfig {\n nodeKind?: NodeReferenceValue;\n /**\n * Values of the configured property must be less than the values of this 'lessThan' property.\n * Value is always a property IRI (pair constraint).\n */\n lessThan?: NodeReferenceValue;\n /**\n * Values of the configured property must be less than or equal the values of this 'lessThanOrEquals' property.\n * Value is always a property IRI (pair constraint).\n */\n lessThanOrEquals?: NodeReferenceValue;\n /**\n * All values of this property must be higher than this number\n */\n minExclusive?: number | string;\n /**\n * All values of this property must be higher than or equal this number\n */\n minInclusive?: number;\n /**\n * All values of this property must be lower than this number\n */\n maxExclusive?: number;\n /**\n * All values of this property must be lower than or equal this number\n */\n maxInclusive?: number;\n /**\n * All literal values of this property must at least be this long\n */\n minLength?: number;\n /**\n * All literal values of this property must at most be this long\n */\n maxLength?: number;\n /**\n * All literal values of this property must match this regular expression\n */\n pattern?: RegExp;\n /**\n * All literal values of this property must have one of these languages as their language tag\n */\n languageIn?: string[];\n /**\n * No pair of values may use the same language tag.\n */\n uniqueLang?: boolean;\n /**\n * Each literal value of this property must use this datatype\n */\n datatype?: NodeReferenceValue;\n /**\n * Each value of the property must occur in this set.\n * Use {id: '...'} for IRI nodes, or plain strings/numbers/booleans for literal values.\n */\n in?: (NodeReferenceValue | string | number | boolean)[];\n}\n\nexport interface ObjectPropertyShapeConfig extends PropertyShapeConfig {\n nodeKind?: NodeReferenceValue;\n /**\n * Each value of this property must have this class as its rdf:type\n */\n class?: NodeReferenceValue;\n /**\n * The shape that values of this property path need to confirm to.\n * You need to provide a class that extends Shape.\n */\n shape?: typeof Shape | [string, string];\n /**\n * Marks this property as *containment* (composition): the value(s) are owned by the subject\n * and the delete/update cascade removes the owned subtree.\n */\n contains?: boolean;\n}\n\nexport interface PropertyShapeConfig {\n /**\n * The property path of this property shape.\n *\n * Four accepted forms, all equivalent where they overlap:\n *\n * - **An ontology term** — `documents.confidence`. The idiom for real shapes: it reuses the\n * ontology, so a namespace changes in one place. `createNameSpace` returns a `{id}` ref, so\n * the term IS the second form and is passed DIRECTLY — never `documents.confidence.id`,\n * which unwraps it back to a bare string.\n * - **A node reference** — `{id: 'https://example.org/vocab#startsAt'}`. What the first form\n * produces. Convenient in tests, or wherever an ontology module would be overkill.\n * - **A bare IRI or prefixed name** — `'https://example.org/vocab#startsAt'`, `'ex:startsAt'`.\n * - **A path expression** — `'ex:a/ex:b'`, `{seq: [...]}`, `{inv: ...}`, and the other\n * operators. An array is read as a sequence.\n *\n * A string is parsed as an expression only when it is not a bare absolute IRI: `ex:a/ex:b` is\n * a sequence, while the `/` inside `https://example.org/vocab#x` belongs to the IRI.\n */\n path: PropertyPathInputList;\n /**\n * Indicates that this property must exist.\n * Shorthand for minCount=1\n */\n required?: boolean;\n /**\n * Each value must be of this node type.\n */\n nodeKind?: NodeKindConfig;\n /**\n * Minimum number of values required\n */\n minCount?: number;\n /**\n * Maximum number of values allowed\n */\n maxCount?: number;\n /**\n * Values of the configured property must equal the values of this 'equals' property.\n * Value is always a property IRI (pair constraint).\n */\n equals?: NodeReferenceValue;\n /**\n * Values of the configured property must differ from the values of this 'disjoint' property.\n * Value is always a property IRI (pair constraint).\n */\n disjoint?: NodeReferenceValue;\n /**\n * At least one value of this property must equal the given value.\n * Use {id: '...'} for IRI nodes, or a plain string for literal values.\n */\n hasValue?: NodeReferenceValue | string | number | boolean;\n name?: string;\n description?: string;\n order?: number;\n group?: string;\n /**\n * Display importance, lower = more important (`linked_core:displayRank`).\n * A renderer that can show only N properties shows the N lowest ranks.\n */\n displayRank?: number;\n /** Omit this property from generic rendering (`linked_core:displayHidden`). */\n displayHidden?: boolean;\n /**\n * should correlate to the given datatype or class\n */\n defaultValue?: unknown;\n /**\n * Each value of the property must occur in this set.\n * Use {id: '...'} for IRI nodes, or plain strings for literal values.\n *\n * @example\n * in: ['ACTIVE', 'PENDING', 'CLOSED']\n * in: [{id: 'http://example.org/StatusA'}, {id: 'http://example.org/StatusB'}]\n */\n in?: (NodeReferenceValue | string | number | boolean)[];\n /**\n * Values of the configured property path are sorted by the values of this property path.\n */\n sortBy?: PropertyPathInputList;\n}\n\nconst EXPLICIT_NODE_KIND_SYMBOL = Symbol('explicitNodeKind');\nconst EXPLICIT_MIN_COUNT_SYMBOL = Symbol('explicitMinCount');\nconst EXPLICIT_MAX_COUNT_SYMBOL = Symbol('explicitMaxCount');\n\n/** Internal symbol-keyed flags on a PropertyShapeData object to track which fields were explicitly configured. */\ninterface ExplicitFlags {\n [EXPLICIT_NODE_KIND_SYMBOL]?: boolean;\n [EXPLICIT_MIN_COUNT_SYMBOL]?: boolean;\n [EXPLICIT_MAX_COUNT_SYMBOL]?: boolean;\n}\n\nexport interface ParameterConfig {\n optional?: number;\n}\n\n/**\n * Static-only DSL handle for the SHACL `sh:NodeShape` meta-shape.\n *\n * Never instantiated — a shape's metadata is a plain {@link NodeShapeData} object\n * (see nodeShapeData.js), and the instance methods that used to live here are now\n * free functions in that module. This class exists only to carry the meta-shape's\n * static `.shape` self-description and to serve as the DSL entry point for reading\n * and writing node-shape SHACL data (`NodeShape.create/select/delete`).\n */\nexport class NodeShape extends Shape {\n static targetClass = shacl.NodeShape;\n}\n\n/**\n * Static-only DSL handle for the SHACL `sh:PropertyShape` meta-shape.\n *\n * Never instantiated — property-shape metadata is a plain {@link PropertyShapeData}\n * object (see nodeShapeData.js). Exists only for its static `.shape` self-description\n * and as a DSL entry point (`PropertyShape.create/select`).\n */\nexport class PropertyShape extends Shape {\n static targetClass = shacl.PropertyShape;\n}\n\nconst connectValueShape = <\n Config extends LiteralPropertyShapeConfig | ObjectPropertyShapeConfig,\n>(\n config: Config,\n propertyKey: string,\n property: PropertyShapeData,\n) => {\n if ((config as ObjectPropertyShapeConfig).shape) {\n const shapeConfig = (config as ObjectPropertyShapeConfig).shape;\n\n if (Array.isArray(shapeConfig)) {\n const [packageName, shapeName] = shapeConfig;\n const nodeShapeUri = getNodeShapeUri(packageName, shapeName);\n property.valueShape = {id: nodeShapeUri};\n } else {\n const shapeClass = shapeConfig as typeof Shape;\n if (shapeClass.shape) {\n property.valueShape = {id: shapeClass.shape.id};\n } else {\n onShapeSetup(\n shapeConfig,\n (nodeShape: NodeShapeData) => {\n property.valueShape = {id: nodeShape.id};\n },\n propertyKey,\n );\n }\n }\n }\n};\n\n/**\n * The DSL-JSON where-clause combinators. A property may not be named after one,\n * because a condition key in those positions has no `{path}` escape (the key is a\n * bare string). See documentation/dsl-json.md (Reserved words).\n */\nconst RESERVED_PROPERTY_LABELS = new Set(['and', 'or', 'not']);\n\nexport function registerPropertyShape(\n shape: NodeShapeData,\n propertyShape: PropertyShapeData,\n) {\n if (RESERVED_PROPERTY_LABELS.has(propertyShape.label)) {\n throw new Error(\n `Property label '${propertyShape.label}' is reserved (a DSL-JSON boolean combinator) ` +\n `and cannot be used as a property name. See documentation/dsl-json.md (Reserved words).`,\n );\n }\n // Not fatal, but the author needs to hear it here rather than from the field tracer.\n warnOnReservedPropertyLabel(propertyShape.label, shape.label, shape.id);\n const inherited = getPropertyShapeData(shape, propertyShape.label, true);\n const existing = getPropertyShapeData(shape, propertyShape.label, false);\n if (!existing && inherited) {\n if (!(propertyShape as unknown as ExplicitFlags)[EXPLICIT_MIN_COUNT_SYMBOL]) {\n propertyShape.minCount = inherited.minCount;\n }\n if (!(propertyShape as unknown as ExplicitFlags)[EXPLICIT_MAX_COUNT_SYMBOL]) {\n propertyShape.maxCount = inherited.maxCount;\n }\n if (!(propertyShape as unknown as ExplicitFlags)[EXPLICIT_NODE_KIND_SYMBOL]) {\n propertyShape.nodeKind = inherited.nodeKind;\n }\n validateOverrideTightening(shape, inherited, propertyShape);\n }\n if (existing) {\n Object.assign(existing, propertyShape);\n return existing;\n }\n propertyShape.id = `${shape.id}/${propertyShape.label}`;\n addPropertyShapeData(shape, propertyShape);\n return propertyShape;\n}\n\nconst ATOMIC_NODE_KINDS = [\n shacl.BlankNode.id,\n shacl.IRI.id,\n shacl.Literal.id,\n];\n\nconst nodeKindToAtomics = (nodeKind?: NodeReferenceValue): Set<string> => {\n if (!nodeKind?.id) {\n return new Set();\n }\n switch (nodeKind.id) {\n case shacl.BlankNode.id:\n case shacl.IRI.id:\n case shacl.Literal.id:\n return new Set([nodeKind.id]);\n case shacl.BlankNodeOrIRI.id:\n return new Set([shacl.BlankNode.id, shacl.IRI.id]);\n case shacl.IRIOrLiteral.id:\n return new Set([shacl.IRI.id, shacl.Literal.id]);\n case shacl.BlankNodeOrLiteral.id:\n return new Set([shacl.BlankNode.id, shacl.Literal.id]);\n default:\n return new Set(ATOMIC_NODE_KINDS);\n }\n};\n\nconst throwOverrideError = (\n shape: NodeShapeData,\n propertyShape: PropertyShapeData,\n message: string,\n) => {\n throw new Error(\n `Invalid override for ${shape.label}.${propertyShape.label}: ${message}`,\n );\n};\n\nconst validateOverrideTightening = (\n shape: NodeShapeData,\n base: PropertyShapeData,\n override: PropertyShapeData,\n) => {\n if (\n typeof base.minCount === 'number' &&\n typeof override.minCount === 'number' &&\n override.minCount < base.minCount\n ) {\n throwOverrideError(\n shape,\n override,\n `minCount cannot be lowered (${base.minCount} -> ${override.minCount}).`,\n );\n }\n\n if (\n typeof base.maxCount === 'number' &&\n typeof override.maxCount === 'number' &&\n override.maxCount > base.maxCount\n ) {\n throwOverrideError(\n shape,\n override,\n `maxCount cannot be increased (${base.maxCount} -> ${override.maxCount}).`,\n );\n }\n\n if (base.nodeKind && override.nodeKind) {\n const baseKinds = nodeKindToAtomics(base.nodeKind);\n const overrideKinds = nodeKindToAtomics(override.nodeKind);\n const widensNodeKind = [...overrideKinds].some((kind) => !baseKinds.has(kind));\n if (widensNodeKind) {\n throwOverrideError(\n shape,\n override,\n `nodeKind cannot be widened (${base.nodeKind.id} -> ${override.nodeKind.id}).`,\n );\n }\n }\n};\n\nexport function createPropertyShape<\n Config extends LiteralPropertyShapeConfig | ObjectPropertyShapeConfig,\n>(\n config: Config,\n propertyKey: string,\n defaultNodeKind: NodeReferenceValue = null,\n shapeClass: typeof Shape | [string, string] = null,\n) {\n const propertyShape = createPropertyShapeData();\n propertyShape.path = normalizePropertyPath(config.path);\n propertyShape.label = propertyKey;\n\n if (config.name) {\n propertyShape.name = config.name;\n }\n if (config.description) {\n propertyShape.description = config.description;\n }\n\n if (config.required) {\n propertyShape.minCount = 1;\n } else if (config.minCount !== undefined) {\n propertyShape.minCount = config.minCount;\n }\n (propertyShape as unknown as ExplicitFlags)[EXPLICIT_MIN_COUNT_SYMBOL] =\n config.required === true || config.minCount !== undefined;\n\n if (config.maxCount !== undefined) {\n propertyShape.maxCount = config.maxCount;\n }\n (propertyShape as unknown as ExplicitFlags)[EXPLICIT_MAX_COUNT_SYMBOL] =\n config.maxCount !== undefined;\n if ((config as LiteralPropertyShapeConfig).datatype) {\n propertyShape.datatype = toNodeReference(\n (config as LiteralPropertyShapeConfig).datatype,\n );\n }\n\n if ((config as ObjectPropertyShapeConfig).class) {\n propertyShape.class = toNodeReference(\n (config as ObjectPropertyShapeConfig).class,\n );\n }\n\n if ((config as ObjectPropertyShapeConfig).contains) {\n propertyShape.contains = true;\n }\n\n if (config.equals) {\n propertyShape.equalsConstraint = toNodeReference(config.equals);\n }\n if (config.disjoint) {\n propertyShape.disjoint = toNodeReference(config.disjoint);\n }\n if ((config as LiteralPropertyShapeConfig).lessThan) {\n propertyShape.lessThan = toNodeReference((config as LiteralPropertyShapeConfig).lessThan);\n }\n if ((config as LiteralPropertyShapeConfig).lessThanOrEquals) {\n propertyShape.lessThanOrEquals = toNodeReference((config as LiteralPropertyShapeConfig).lessThanOrEquals);\n }\n // Value-range / string-length / pattern constraints (report 021 §3, G5). These are\n // recorded on the shape and serialized to SHACL; there is no DSL-side runtime\n // enforcement — they describe the shape for validators / introspection.\n {\n const lit = config as LiteralPropertyShapeConfig;\n if (lit.minInclusive !== undefined) propertyShape.minInclusive = lit.minInclusive;\n if (lit.maxInclusive !== undefined) propertyShape.maxInclusive = lit.maxInclusive;\n if (lit.minExclusive !== undefined) propertyShape.minExclusive = lit.minExclusive;\n if (lit.maxExclusive !== undefined) propertyShape.maxExclusive = lit.maxExclusive;\n if (lit.minLength !== undefined) propertyShape.minLength = lit.minLength;\n if (lit.maxLength !== undefined) propertyShape.maxLength = lit.maxLength;\n if (lit.pattern !== undefined) propertyShape.pattern = lit.pattern;\n }\n if (config.hasValue !== undefined) {\n const v = config.hasValue;\n propertyShape.hasValueConstraint = typeof v === 'object' && v !== null ? toNodeReference(v) : v;\n }\n if (config.defaultValue !== undefined) {\n propertyShape.defaultValue = config.defaultValue;\n }\n if (config.in) {\n propertyShape.in = config.in.map((entry) =>\n typeof entry === 'object' && entry !== null ? toNodeReference(entry) : entry,\n );\n }\n if (config.sortBy) {\n propertyShape.sortBy = normalizePropertyPath(config.sortBy);\n }\n // Arrangement + display metadata. `order` and `group` were declared on the config\n // but never copied onto the property shape, so a declared `sh:order` was silently\n // dropped and every renderer fell back to array position. Carried now, alongside\n // the two display terms.\n if (config.order !== undefined) propertyShape.order = config.order;\n if (config.group !== undefined) propertyShape.group = config.group;\n if (config.displayRank !== undefined) propertyShape.displayRank = config.displayRank;\n if (config.displayHidden !== undefined)\n propertyShape.displayHidden = config.displayHidden;\n\n propertyShape.nodeKind = normalizeNodeKind(config.nodeKind, defaultNodeKind);\n (propertyShape as unknown as ExplicitFlags)[EXPLICIT_NODE_KIND_SYMBOL] =\n config.nodeKind !== undefined;\n\n if (shapeClass) {\n onShapeSetup(shapeClass, (shape: NodeShapeData) => {\n connectValueShape(config, propertyKey, propertyShape);\n registerPropertyShape(shape, propertyShape);\n });\n }\n\n return propertyShape;\n}\n\nexport function onShapeSetup(\n shapeClass: typeof Shape | [string, string],\n callback: (shape: NodeShapeData) => void,\n propertyName?: string,\n waitForSuperShapes?: boolean,\n) {\n const cb = waitForSuperShapes\n ? (shape: NodeShapeData) => {\n const superClass = Object.getPrototypeOf(shapeClass) as typeof Shape;\n if (superClass.name === 'Shape') {\n callback(shape);\n return;\n }\n if (superClass.name === '') {\n console.error(\n `Shape ${shape.label} does not extend base class lincd/shapes/Shape. Make sure it extends Shape.`,\n );\n return;\n }\n onShapeSetup(\n superClass,\n () => {\n callback(shape);\n },\n propertyName,\n waitForSuperShapes,\n );\n }\n : callback;\n\n const safeCallback = (\n targetShapeClass: typeof Shape,\n innerCallback: (shape: NodeShapeData) => void,\n ) => {\n if (targetShapeClass.hasOwnProperty('shape')) {\n innerCallback((targetShapeClass as typeof Shape).shape);\n } else {\n if (!targetShapeClass['shapeCallbacks']) {\n targetShapeClass['shapeCallbacks'] = [];\n }\n targetShapeClass['shapeCallbacks'].push(innerCallback);\n }\n };\n\n if (Array.isArray(shapeClass)) {\n const [packageName, shapeName] = shapeClass;\n const nodeShapeId = getNodeShapeUri(packageName, shapeName);\n if (typeof document !== 'undefined') {\n window.addEventListener('load', () => {\n const resolved = getShapeClass(nodeShapeId);\n if (!resolved) {\n console.warn(\n `Could not find value shape (${packageName}/${shapeName}) for accessor get ${propertyName}(). Likely because it is not bundled.`,\n );\n return;\n }\n safeCallback(resolved as unknown as typeof Shape, cb);\n });\n } else {\n addNodeShapeCallback(nodeShapeId, cb);\n }\n } else {\n safeCallback(shapeClass, cb);\n }\n}\n\nconst _linkedProperty = <\n Config extends ObjectPropertyShapeConfig | LiteralPropertyShapeConfig,\n>(\n config: Config,\n defaultNodeKind: NodeReferenceValue = null,\n) => {\n return function (\n target: any,\n propertyKey: string,\n _descriptor: PropertyDescriptor,\n ) {\n createPropertyShape(config, propertyKey, defaultNodeKind, target.constructor);\n };\n};\n\nexport const literalProperty = (config: LiteralPropertyShapeConfig) => {\n return _linkedProperty<LiteralPropertyShapeConfig>(config, shacl.Literal);\n};\n\nexport const objectProperty = (config: ObjectPropertyShapeConfig) => {\n return _linkedProperty<ObjectPropertyShapeConfig>(config, shacl.IRI);\n};\n\nexport const linkedProperty = (\n config: ObjectPropertyShapeConfig | LiteralPropertyShapeConfig,\n) => {\n return _linkedProperty(config);\n};\n\nexport function disallowProperty(\n target: any,\n propertyKey: string,\n _descriptor: PropertyDescriptor,\n) {\n onShapeSetup(\n target.constructor,\n (shape: NodeShapeData) => {\n const superClass = Object.getPrototypeOf(target.constructor) as typeof Shape;\n const superNodeShape = superClass.shape;\n const superPropertyShape = getPropertyShapeData(\n superNodeShape,\n propertyKey,\n true,\n );\n if (!superPropertyShape) {\n console.warn(\n `Property ${propertyKey} not found in super class ${superClass.name} or any of its super classes. Does it have a property decorator? Cannot disallow property ${target.constructor.name}.${propertyKey}`,\n );\n return;\n }\n const clonedPropertyShape = clonePropertyShape(superPropertyShape);\n clonedPropertyShape.maxCount = 0;\n registerPropertyShape(shape, clonedPropertyShape);\n },\n '',\n true,\n );\n}\n\nexport function getNodeShapeUri(packageName: string, shapeName: string): string {\n // arch-02: `{baseUri}shape/{packageSlug}/{ShapeName}` — ShapeName kept PascalCase\n // (it is a class name, already URI-safe), packageSlug derived from the name.\n return `${resolveBaseUri(packageName)}shape/${packageNameToSlug(packageName)}/${shapeName}`;\n}\n\nconst nodeShapeCallbacks = new Map<string, ((shape: NodeShapeData) => void)[]>();\nexport function getAndClearCallbacks(\n nodeShapeId: string,\n): ((shape: NodeShapeData) => void)[] {\n const callbacks = nodeShapeCallbacks.get(nodeShapeId);\n nodeShapeCallbacks.delete(nodeShapeId);\n return callbacks;\n}\nexport const addNodeShapeCallback = (\n nodeShapeId: string,\n callback: (shape: NodeShapeData) => void,\n) => {\n if (!nodeShapeCallbacks.has(nodeShapeId)) {\n nodeShapeCallbacks.set(nodeShapeId, []);\n }\n nodeShapeCallbacks.get(nodeShapeId).push(callback);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SHACL.js","sourceRoot":"","sources":["../../../src/shapes/SHACL.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA0B,eAAe,EAAC,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAC,KAAK,EAAwB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAC,KAAK,EAAC,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAC,qBAAqB,EAAkC,MAAM,mCAAmC,CAAC;AACzG,OAAO,EACL,uBAAuB,EACvB,gBAAgB,IAAI,oBAAoB,EACxC,gBAAgB,IAAI,oBAAoB,EACxC,kBAAkB,GAGnB,MAAM,oBAAoB,CAAC;AAK5B,2EAA2E;AAC3E,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAW,oBAAoB,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,OAAO,WAAW;SACf,OAAO,CAAC,WAAW,EAAE,EAAE,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AE,CAAC;AAC9F,CAAC;AAED,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAA8C,CAAC;AACjF,MAAM,UAAU,oBAAoB,CAClC,WAAmB;IAEnB,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACtD,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,WAAmB,EACnB,QAAwC,EACxC,EAAE;IACF,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QACzC,kBAAkB,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACrD,CAAC,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 NodeReferenceValue, toNodeReference} from '../utils/NodeReference.js';\nimport {Shape, type ShapeConstructor} from './Shape.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {warnOnReservedPropertyLabel} from '../queries/reservedQueryNames.js';\nimport {getShapeClass} from '../utils/ShapeClass.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\nimport {normalizePropertyPath, type PropertyPathDecoratorInput} from '../paths/normalizePropertyPath.js';\nimport {\n createPropertyShapeData,\n getPropertyShape as getPropertyShapeData,\n addPropertyShape as addPropertyShapeData,\n clonePropertyShape,\n type NodeShapeData,\n type PropertyShapeData,\n} from './nodeShapeData.js';\n\n// Metadata types now live in nodeShapeData.js (plain objects); re-exported here for\n// existing importers of `NodeShape`/`PropertyShape`-adjacent types.\nexport type {NodeShapeData, PropertyShapeData, PropertyShapeResult} from './nodeShapeData.js';\n// Metadata operations (formerly NodeShape/PropertyShape instance methods).\nexport {\n getPropertyShapes,\n getUniquePropertyShapes,\n getPropertyShape,\n addPropertyShape,\n clonePropertyShape,\n propertyShapeToResult,\n nodeShapeEquals,\n createNodeShapeData,\n createPropertyShapeData,\n} from './nodeShapeData.js';\n\n/**\n * Default identity root for shape & package IRIs. Public/first-party packages\n * publish under `linked.cm` (arch-02 §Domains). Packages may override per-package\n * via `linkedPackage(name, { baseUri })` — CN injects a workspace-scoped root\n * (`{workspaceSlug}.id.create.now`) for private packages; first-party packages\n * keep this default.\n */\nexport const LINKED_DATA_ROOT: string = 'https://linked.cm/';\n\n/**\n * Derive the public package slug — the npm package **basename** with the\n * `@scope/` dropped, kebab-cased (arch-02 §Slug rules: `^[a-z0-9]+(?:-[a-z0-9]+)*$`).\n * The package name is the single source of truth; there is no separate slug.\n * `@_linked/core` → `core`, `@linked.cm/blog` → `blog`, `mypkg` → `mypkg`.\n *\n * Both first-party (`@_linked`) and community (`@linked.cm`) packages publish into\n * the one `linked.cm/{shape,pkg}` space, so the basename must be globally unique —\n * enforced by the registry, which reserves the (handful of) first-party names.\n */\nexport function packageNameToSlug(packageName: string): string {\n return packageName\n .replace(/^@[^/]+\\//, '') // drop the npm scope (@scope/), keep the basename\n .replace(/[^a-zA-Z0-9]+/g, '-') // any run of non-alphanumerics → single hyphen\n .replace(/^-+|-+$/g, '') // trim stray hyphens\n .toLowerCase();\n}\n\n/**\n * Where each package publishes its IRIs (the identity root). The slug is always\n * derived from the package name; only the root is configurable — `linkedPackage`\n * defaults it to `LINKED_DATA_ROOT` (linked.cm), and CN injects a workspace-scoped\n * root (`{workspaceSlug}.id.create.now`) for private packages.\n */\nconst packageBaseUri = new Map<string, string>();\n\n/** Record a package's publish root. Called by `linkedPackage()`. */\nexport function setPackagePublishConfig(\n packageName: string,\n config?: {baseUri?: string},\n): void {\n packageBaseUri.set(packageName, config?.baseUri ?? LINKED_DATA_ROOT);\n}\n\n/** Resolve a package's publish root, defaulting to linked.cm if undeclared. */\nfunction resolveBaseUri(packageName: string): string {\n return packageBaseUri.get(packageName) ?? LINKED_DATA_ROOT;\n}\n\n/** Public/first-party package IRI — arch-02: `{baseUri}pkg/{slug}`. */\nexport function getPackageUri(packageName: string): string {\n return `${resolveBaseUri(packageName)}pkg/${packageNameToSlug(packageName)}`;\n}\n\ntype NodeKindConfig = NodeReferenceValue | NodeReferenceValue[];\n\nexport type PropertyPathInput = PropertyPathDecoratorInput;\nexport type PropertyPathInputList = PropertyPathDecoratorInput;\n\nconst normalizeNodeKind = (\n nodeKind?: NodeKindConfig,\n defaultNodeKind?: NodeReferenceValue,\n): NodeReferenceValue | undefined => {\n if (!nodeKind) {\n return defaultNodeKind;\n }\n if (Array.isArray(nodeKind)) {\n const ids = nodeKind.map((entry) => entry?.id);\n const includesBlank = ids.includes(shacl.BlankNode.id);\n const includesNamed = ids.includes(shacl.IRI.id);\n const includesLiteral = ids.includes(shacl.Literal.id);\n if (includesBlank && includesNamed) {\n return shacl.BlankNodeOrIRI;\n }\n if (includesLiteral && includesNamed) {\n return shacl.IRIOrLiteral;\n }\n if (includesLiteral && includesBlank) {\n return shacl.BlankNodeOrLiteral;\n }\n return nodeKind[0];\n }\n return nodeKind;\n};\n\nexport interface NodeShapeConfig {\n /**\n * Set to true to close the shape. This means any target node of this shape\n * that has properties outside the defined properties of this shape is invalid.\n */\n closed?: boolean;\n /**\n * Optional list of properties that are also permitted in addition to those explicitly listed by this shape.\n */\n ignoredProperties?: NodeReferenceValue[];\n}\n\nexport interface LiteralPropertyShapeConfig extends PropertyShapeConfig {\n nodeKind?: NodeReferenceValue;\n /**\n * Values of the configured property must be less than the values of this 'lessThan' property.\n * Value is always a property IRI (pair constraint).\n */\n lessThan?: NodeReferenceValue;\n /**\n * Values of the configured property must be less than or equal the values of this 'lessThanOrEquals' property.\n * Value is always a property IRI (pair constraint).\n */\n lessThanOrEquals?: NodeReferenceValue;\n /**\n * All values of this property must be higher than this number\n */\n minExclusive?: number | string;\n /**\n * All values of this property must be higher than or equal this number\n */\n minInclusive?: number;\n /**\n * All values of this property must be lower than this number\n */\n maxExclusive?: number;\n /**\n * All values of this property must be lower than or equal this number\n */\n maxInclusive?: number;\n /**\n * All literal values of this property must at least be this long\n */\n minLength?: number;\n /**\n * All literal values of this property must at most be this long\n */\n maxLength?: number;\n /**\n * All literal values of this property must match this regular expression\n */\n pattern?: RegExp;\n /**\n * All literal values of this property must have one of these languages as their language tag\n */\n languageIn?: string[];\n /**\n * No pair of values may use the same language tag.\n */\n uniqueLang?: boolean;\n /**\n * Each literal value of this property must use this datatype\n */\n datatype?: NodeReferenceValue;\n /**\n * Each value of the property must occur in this set.\n * Use {id: '...'} for IRI nodes, or plain strings/numbers/booleans for literal values.\n */\n in?: (NodeReferenceValue | string | number | boolean)[];\n}\n\nexport interface ObjectPropertyShapeConfig extends PropertyShapeConfig {\n nodeKind?: NodeReferenceValue;\n /**\n * Each value of this property must have this class as its rdf:type\n */\n class?: NodeReferenceValue;\n /**\n * The shape that values of this property path need to confirm to.\n * You need to provide a class that extends Shape.\n */\n shape?: typeof Shape | [string, string];\n /**\n * Marks this property as *containment* (composition): the value(s) are owned by the subject\n * and the delete/update cascade removes the owned subtree.\n */\n contains?: boolean;\n}\n\nexport interface PropertyShapeConfig {\n /**\n * The property path of this property shape.\n *\n * Four accepted forms, all equivalent where they overlap:\n *\n * - **An ontology term** — `documents.confidence`. The idiom for real shapes: it reuses the\n * ontology, so a namespace changes in one place. `createNameSpace` returns a `{id}` ref, so\n * the term IS the second form and is passed DIRECTLY — never `documents.confidence.id`,\n * which unwraps it back to a bare string.\n * - **A node reference** — `{id: 'https://example.org/vocab#startsAt'}`. What the first form\n * produces. Convenient in tests, or wherever an ontology module would be overkill.\n * - **A bare IRI or prefixed name** — `'https://example.org/vocab#startsAt'`, `'ex:startsAt'`.\n * - **A path expression** — `'ex:a/ex:b'`, `{seq: [...]}`, `{inv: ...}`, and the other\n * operators. An array is read as a sequence.\n *\n * A string is parsed as an expression only when it is not a bare absolute IRI: `ex:a/ex:b` is\n * a sequence, while the `/` inside `https://example.org/vocab#x` belongs to the IRI.\n */\n path: PropertyPathInputList;\n /**\n * Indicates that this property must exist.\n * Shorthand for minCount=1\n */\n required?: boolean;\n /**\n * Each value must be of this node type.\n */\n nodeKind?: NodeKindConfig;\n /**\n * Minimum number of values required\n */\n minCount?: number;\n /**\n * Maximum number of values allowed\n */\n maxCount?: number;\n /**\n * Values of the configured property must equal the values of this 'equals' property.\n * Value is always a property IRI (pair constraint).\n */\n equals?: NodeReferenceValue;\n /**\n * Values of the configured property must differ from the values of this 'disjoint' property.\n * Value is always a property IRI (pair constraint).\n */\n disjoint?: NodeReferenceValue;\n /**\n * At least one value of this property must equal the given value.\n * Use {id: '...'} for IRI nodes, or a plain string for literal values.\n */\n hasValue?: NodeReferenceValue | string | number | boolean;\n name?: string;\n description?: string;\n order?: number;\n group?: string;\n /**\n * Display importance, lower = more important (`core:displayRank`).\n * A renderer that can show only N properties shows the N lowest ranks.\n */\n displayRank?: number;\n /** Omit this property from generic rendering (`core:displayHidden`). */\n displayHidden?: boolean;\n /**\n * should correlate to the given datatype or class\n */\n defaultValue?: unknown;\n /**\n * Each value of the property must occur in this set.\n * Use {id: '...'} for IRI nodes, or plain strings for literal values.\n *\n * @example\n * in: ['ACTIVE', 'PENDING', 'CLOSED']\n * in: [{id: 'http://example.org/StatusA'}, {id: 'http://example.org/StatusB'}]\n */\n in?: (NodeReferenceValue | string | number | boolean)[];\n /**\n * Values of the configured property path are sorted by the values of this property path.\n */\n sortBy?: PropertyPathInputList;\n}\n\nconst EXPLICIT_NODE_KIND_SYMBOL = Symbol('explicitNodeKind');\nconst EXPLICIT_MIN_COUNT_SYMBOL = Symbol('explicitMinCount');\nconst EXPLICIT_MAX_COUNT_SYMBOL = Symbol('explicitMaxCount');\n\n/** Internal symbol-keyed flags on a PropertyShapeData object to track which fields were explicitly configured. */\ninterface ExplicitFlags {\n [EXPLICIT_NODE_KIND_SYMBOL]?: boolean;\n [EXPLICIT_MIN_COUNT_SYMBOL]?: boolean;\n [EXPLICIT_MAX_COUNT_SYMBOL]?: boolean;\n}\n\nexport interface ParameterConfig {\n optional?: number;\n}\n\n/**\n * Static-only DSL handle for the SHACL `sh:NodeShape` meta-shape.\n *\n * Never instantiated — a shape's metadata is a plain {@link NodeShapeData} object\n * (see nodeShapeData.js), and the instance methods that used to live here are now\n * free functions in that module. This class exists only to carry the meta-shape's\n * static `.shape` self-description and to serve as the DSL entry point for reading\n * and writing node-shape SHACL data (`NodeShape.create/select/delete`).\n */\nexport class NodeShape extends Shape {\n static targetClass = shacl.NodeShape;\n}\n\n/**\n * Static-only DSL handle for the SHACL `sh:PropertyShape` meta-shape.\n *\n * Never instantiated — property-shape metadata is a plain {@link PropertyShapeData}\n * object (see nodeShapeData.js). Exists only for its static `.shape` self-description\n * and as a DSL entry point (`PropertyShape.create/select`).\n */\nexport class PropertyShape extends Shape {\n static targetClass = shacl.PropertyShape;\n}\n\nconst connectValueShape = <\n Config extends LiteralPropertyShapeConfig | ObjectPropertyShapeConfig,\n>(\n config: Config,\n propertyKey: string,\n property: PropertyShapeData,\n) => {\n if ((config as ObjectPropertyShapeConfig).shape) {\n const shapeConfig = (config as ObjectPropertyShapeConfig).shape;\n\n if (Array.isArray(shapeConfig)) {\n const [packageName, shapeName] = shapeConfig;\n const nodeShapeUri = getNodeShapeUri(packageName, shapeName);\n property.valueShape = {id: nodeShapeUri};\n } else {\n const shapeClass = shapeConfig as typeof Shape;\n if (shapeClass.shape) {\n property.valueShape = {id: shapeClass.shape.id};\n } else {\n onShapeSetup(\n shapeConfig,\n (nodeShape: NodeShapeData) => {\n property.valueShape = {id: nodeShape.id};\n },\n propertyKey,\n );\n }\n }\n }\n};\n\n/**\n * The DSL-JSON where-clause combinators. A property may not be named after one,\n * because a condition key in those positions has no `{path}` escape (the key is a\n * bare string). See documentation/dsl-json.md (Reserved words).\n */\nconst RESERVED_PROPERTY_LABELS = new Set(['and', 'or', 'not']);\n\nexport function registerPropertyShape(\n shape: NodeShapeData,\n propertyShape: PropertyShapeData,\n) {\n if (RESERVED_PROPERTY_LABELS.has(propertyShape.label)) {\n throw new Error(\n `Property label '${propertyShape.label}' is reserved (a DSL-JSON boolean combinator) ` +\n `and cannot be used as a property name. See documentation/dsl-json.md (Reserved words).`,\n );\n }\n // Not fatal, but the author needs to hear it here rather than from the field tracer.\n warnOnReservedPropertyLabel(propertyShape.label, shape.label, shape.id);\n const inherited = getPropertyShapeData(shape, propertyShape.label, true);\n const existing = getPropertyShapeData(shape, propertyShape.label, false);\n if (!existing && inherited) {\n if (!(propertyShape as unknown as ExplicitFlags)[EXPLICIT_MIN_COUNT_SYMBOL]) {\n propertyShape.minCount = inherited.minCount;\n }\n if (!(propertyShape as unknown as ExplicitFlags)[EXPLICIT_MAX_COUNT_SYMBOL]) {\n propertyShape.maxCount = inherited.maxCount;\n }\n if (!(propertyShape as unknown as ExplicitFlags)[EXPLICIT_NODE_KIND_SYMBOL]) {\n propertyShape.nodeKind = inherited.nodeKind;\n }\n validateOverrideTightening(shape, inherited, propertyShape);\n }\n if (existing) {\n Object.assign(existing, propertyShape);\n return existing;\n }\n propertyShape.id = `${shape.id}/${propertyShape.label}`;\n addPropertyShapeData(shape, propertyShape);\n return propertyShape;\n}\n\nconst ATOMIC_NODE_KINDS = [\n shacl.BlankNode.id,\n shacl.IRI.id,\n shacl.Literal.id,\n];\n\nconst nodeKindToAtomics = (nodeKind?: NodeReferenceValue): Set<string> => {\n if (!nodeKind?.id) {\n return new Set();\n }\n switch (nodeKind.id) {\n case shacl.BlankNode.id:\n case shacl.IRI.id:\n case shacl.Literal.id:\n return new Set([nodeKind.id]);\n case shacl.BlankNodeOrIRI.id:\n return new Set([shacl.BlankNode.id, shacl.IRI.id]);\n case shacl.IRIOrLiteral.id:\n return new Set([shacl.IRI.id, shacl.Literal.id]);\n case shacl.BlankNodeOrLiteral.id:\n return new Set([shacl.BlankNode.id, shacl.Literal.id]);\n default:\n return new Set(ATOMIC_NODE_KINDS);\n }\n};\n\nconst throwOverrideError = (\n shape: NodeShapeData,\n propertyShape: PropertyShapeData,\n message: string,\n) => {\n throw new Error(\n `Invalid override for ${shape.label}.${propertyShape.label}: ${message}`,\n );\n};\n\nconst validateOverrideTightening = (\n shape: NodeShapeData,\n base: PropertyShapeData,\n override: PropertyShapeData,\n) => {\n if (\n typeof base.minCount === 'number' &&\n typeof override.minCount === 'number' &&\n override.minCount < base.minCount\n ) {\n throwOverrideError(\n shape,\n override,\n `minCount cannot be lowered (${base.minCount} -> ${override.minCount}).`,\n );\n }\n\n if (\n typeof base.maxCount === 'number' &&\n typeof override.maxCount === 'number' &&\n override.maxCount > base.maxCount\n ) {\n throwOverrideError(\n shape,\n override,\n `maxCount cannot be increased (${base.maxCount} -> ${override.maxCount}).`,\n );\n }\n\n if (base.nodeKind && override.nodeKind) {\n const baseKinds = nodeKindToAtomics(base.nodeKind);\n const overrideKinds = nodeKindToAtomics(override.nodeKind);\n const widensNodeKind = [...overrideKinds].some((kind) => !baseKinds.has(kind));\n if (widensNodeKind) {\n throwOverrideError(\n shape,\n override,\n `nodeKind cannot be widened (${base.nodeKind.id} -> ${override.nodeKind.id}).`,\n );\n }\n }\n};\n\nexport function createPropertyShape<\n Config extends LiteralPropertyShapeConfig | ObjectPropertyShapeConfig,\n>(\n config: Config,\n propertyKey: string,\n defaultNodeKind: NodeReferenceValue = null,\n shapeClass: typeof Shape | [string, string] = null,\n) {\n const propertyShape = createPropertyShapeData();\n propertyShape.path = normalizePropertyPath(config.path);\n propertyShape.label = propertyKey;\n\n if (config.name) {\n propertyShape.name = config.name;\n }\n if (config.description) {\n propertyShape.description = config.description;\n }\n\n if (config.required) {\n propertyShape.minCount = 1;\n } else if (config.minCount !== undefined) {\n propertyShape.minCount = config.minCount;\n }\n (propertyShape as unknown as ExplicitFlags)[EXPLICIT_MIN_COUNT_SYMBOL] =\n config.required === true || config.minCount !== undefined;\n\n if (config.maxCount !== undefined) {\n propertyShape.maxCount = config.maxCount;\n }\n (propertyShape as unknown as ExplicitFlags)[EXPLICIT_MAX_COUNT_SYMBOL] =\n config.maxCount !== undefined;\n if ((config as LiteralPropertyShapeConfig).datatype) {\n propertyShape.datatype = toNodeReference(\n (config as LiteralPropertyShapeConfig).datatype,\n );\n }\n\n if ((config as ObjectPropertyShapeConfig).class) {\n propertyShape.class = toNodeReference(\n (config as ObjectPropertyShapeConfig).class,\n );\n }\n\n if ((config as ObjectPropertyShapeConfig).contains) {\n propertyShape.contains = true;\n }\n\n if (config.equals) {\n propertyShape.equalsConstraint = toNodeReference(config.equals);\n }\n if (config.disjoint) {\n propertyShape.disjoint = toNodeReference(config.disjoint);\n }\n if ((config as LiteralPropertyShapeConfig).lessThan) {\n propertyShape.lessThan = toNodeReference((config as LiteralPropertyShapeConfig).lessThan);\n }\n if ((config as LiteralPropertyShapeConfig).lessThanOrEquals) {\n propertyShape.lessThanOrEquals = toNodeReference((config as LiteralPropertyShapeConfig).lessThanOrEquals);\n }\n // Value-range / string-length / pattern constraints (report 021 §3, G5). These are\n // recorded on the shape and serialized to SHACL; there is no DSL-side runtime\n // enforcement — they describe the shape for validators / introspection.\n {\n const lit = config as LiteralPropertyShapeConfig;\n if (lit.minInclusive !== undefined) propertyShape.minInclusive = lit.minInclusive;\n if (lit.maxInclusive !== undefined) propertyShape.maxInclusive = lit.maxInclusive;\n if (lit.minExclusive !== undefined) propertyShape.minExclusive = lit.minExclusive;\n if (lit.maxExclusive !== undefined) propertyShape.maxExclusive = lit.maxExclusive;\n if (lit.minLength !== undefined) propertyShape.minLength = lit.minLength;\n if (lit.maxLength !== undefined) propertyShape.maxLength = lit.maxLength;\n if (lit.pattern !== undefined) propertyShape.pattern = lit.pattern;\n }\n if (config.hasValue !== undefined) {\n const v = config.hasValue;\n propertyShape.hasValueConstraint = typeof v === 'object' && v !== null ? toNodeReference(v) : v;\n }\n if (config.defaultValue !== undefined) {\n propertyShape.defaultValue = config.defaultValue;\n }\n if (config.in) {\n propertyShape.in = config.in.map((entry) =>\n typeof entry === 'object' && entry !== null ? toNodeReference(entry) : entry,\n );\n }\n if (config.sortBy) {\n propertyShape.sortBy = normalizePropertyPath(config.sortBy);\n }\n // Arrangement + display metadata. `order` and `group` were declared on the config\n // but never copied onto the property shape, so a declared `sh:order` was silently\n // dropped and every renderer fell back to array position. Carried now, alongside\n // the two display terms.\n if (config.order !== undefined) propertyShape.order = config.order;\n if (config.group !== undefined) propertyShape.group = config.group;\n if (config.displayRank !== undefined) propertyShape.displayRank = config.displayRank;\n if (config.displayHidden !== undefined)\n propertyShape.displayHidden = config.displayHidden;\n\n propertyShape.nodeKind = normalizeNodeKind(config.nodeKind, defaultNodeKind);\n (propertyShape as unknown as ExplicitFlags)[EXPLICIT_NODE_KIND_SYMBOL] =\n config.nodeKind !== undefined;\n\n if (shapeClass) {\n onShapeSetup(shapeClass, (shape: NodeShapeData) => {\n connectValueShape(config, propertyKey, propertyShape);\n registerPropertyShape(shape, propertyShape);\n });\n }\n\n return propertyShape;\n}\n\nexport function onShapeSetup(\n shapeClass: typeof Shape | [string, string],\n callback: (shape: NodeShapeData) => void,\n propertyName?: string,\n waitForSuperShapes?: boolean,\n) {\n const cb = waitForSuperShapes\n ? (shape: NodeShapeData) => {\n const superClass = Object.getPrototypeOf(shapeClass) as typeof Shape;\n if (superClass.name === 'Shape') {\n callback(shape);\n return;\n }\n if (superClass.name === '') {\n console.error(\n `Shape ${shape.label} does not extend base class lincd/shapes/Shape. Make sure it extends Shape.`,\n );\n return;\n }\n onShapeSetup(\n superClass,\n () => {\n callback(shape);\n },\n propertyName,\n waitForSuperShapes,\n );\n }\n : callback;\n\n const safeCallback = (\n targetShapeClass: typeof Shape,\n innerCallback: (shape: NodeShapeData) => void,\n ) => {\n if (targetShapeClass.hasOwnProperty('shape')) {\n innerCallback((targetShapeClass as typeof Shape).shape);\n } else {\n if (!targetShapeClass['shapeCallbacks']) {\n targetShapeClass['shapeCallbacks'] = [];\n }\n targetShapeClass['shapeCallbacks'].push(innerCallback);\n }\n };\n\n if (Array.isArray(shapeClass)) {\n const [packageName, shapeName] = shapeClass;\n const nodeShapeId = getNodeShapeUri(packageName, shapeName);\n if (typeof document !== 'undefined') {\n window.addEventListener('load', () => {\n const resolved = getShapeClass(nodeShapeId);\n if (!resolved) {\n console.warn(\n `Could not find value shape (${packageName}/${shapeName}) for accessor get ${propertyName}(). Likely because it is not bundled.`,\n );\n return;\n }\n safeCallback(resolved as unknown as typeof Shape, cb);\n });\n } else {\n addNodeShapeCallback(nodeShapeId, cb);\n }\n } else {\n safeCallback(shapeClass, cb);\n }\n}\n\nconst _linkedProperty = <\n Config extends ObjectPropertyShapeConfig | LiteralPropertyShapeConfig,\n>(\n config: Config,\n defaultNodeKind: NodeReferenceValue = null,\n) => {\n return function (\n target: any,\n propertyKey: string,\n _descriptor: PropertyDescriptor,\n ) {\n createPropertyShape(config, propertyKey, defaultNodeKind, target.constructor);\n };\n};\n\nexport const literalProperty = (config: LiteralPropertyShapeConfig) => {\n return _linkedProperty<LiteralPropertyShapeConfig>(config, shacl.Literal);\n};\n\nexport const objectProperty = (config: ObjectPropertyShapeConfig) => {\n return _linkedProperty<ObjectPropertyShapeConfig>(config, shacl.IRI);\n};\n\nexport const linkedProperty = (\n config: ObjectPropertyShapeConfig | LiteralPropertyShapeConfig,\n) => {\n return _linkedProperty(config);\n};\n\nexport function disallowProperty(\n target: any,\n propertyKey: string,\n _descriptor: PropertyDescriptor,\n) {\n onShapeSetup(\n target.constructor,\n (shape: NodeShapeData) => {\n const superClass = Object.getPrototypeOf(target.constructor) as typeof Shape;\n const superNodeShape = superClass.shape;\n const superPropertyShape = getPropertyShapeData(\n superNodeShape,\n propertyKey,\n true,\n );\n if (!superPropertyShape) {\n console.warn(\n `Property ${propertyKey} not found in super class ${superClass.name} or any of its super classes. Does it have a property decorator? Cannot disallow property ${target.constructor.name}.${propertyKey}`,\n );\n return;\n }\n const clonedPropertyShape = clonePropertyShape(superPropertyShape);\n clonedPropertyShape.maxCount = 0;\n registerPropertyShape(shape, clonedPropertyShape);\n },\n '',\n true,\n );\n}\n\nexport function getNodeShapeUri(packageName: string, shapeName: string): string {\n // arch-02: `{baseUri}shape/{packageSlug}/{ShapeName}` — ShapeName kept PascalCase\n // (it is a class name, already URI-safe), packageSlug derived from the name.\n return `${resolveBaseUri(packageName)}shape/${packageNameToSlug(packageName)}/${shapeName}`;\n}\n\nconst nodeShapeCallbacks = new Map<string, ((shape: NodeShapeData) => void)[]>();\nexport function getAndClearCallbacks(\n nodeShapeId: string,\n): ((shape: NodeShapeData) => void)[] {\n const callbacks = nodeShapeCallbacks.get(nodeShapeId);\n nodeShapeCallbacks.delete(nodeShapeId);\n return callbacks;\n}\nexport const addNodeShapeCallback = (\n nodeShapeId: string,\n callback: (shape: NodeShapeData) => void,\n) => {\n if (!nodeShapeCallbacks.has(nodeShapeId)) {\n nodeShapeCallbacks.set(nodeShapeId, []);\n }\n nodeShapeCallbacks.get(nodeShapeId).push(callback);\n};\n"]}
|
|
@@ -20,12 +20,12 @@ export interface PropertyShapeData {
|
|
|
20
20
|
order?: number;
|
|
21
21
|
group?: string;
|
|
22
22
|
/**
|
|
23
|
-
* `
|
|
23
|
+
* `core:displayRank` — a single linear importance rank, lower = more
|
|
24
24
|
* important. Truncated display contexts ("the top 3 properties") derive from it.
|
|
25
25
|
* Distinct from `order`, which is arrangement rather than importance.
|
|
26
26
|
*/
|
|
27
27
|
displayRank?: number;
|
|
28
|
-
/** `
|
|
28
|
+
/** `core:displayHidden` — omit from generic rendering. */
|
|
29
29
|
displayHidden?: boolean;
|
|
30
30
|
class?: NodeReferenceValue;
|
|
31
31
|
in?: (NodeReferenceValue | string | number | boolean)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeShapeData.js","sourceRoot":"","sources":["../../../src/shapes/nodeShapeData.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,C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,SAAS;QAAE,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;IACzE,IAAI,EAAE,CAAC,YAAY,KAAK,SAAS;QAAE,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;IACzE,IAAI,OAAO,EAAE,CAAC,SAAS,KAAK,QAAQ;QAAE,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;IACtE,IAAI,OAAO,EAAE,CAAC,SAAS,KAAK,QAAQ;QAAE,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;IACtE,IAAI,EAAE,CAAC,OAAO;QAAE,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,kBAAkB,KAAK,SAAS;QAAE,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC,kBAAkB,CAAC;IACjF,IAAI,EAAE,CAAC,YAAY,KAAK,SAAS;QAAE,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;IACzE,IAAI,EAAE,CAAC,MAAM;QAAE,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,UAAU;QAAE,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;IACrD,OAAO,MAA6B,CAAC;AACvC,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 {NodeReferenceValue} from '../utils/NodeReference.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\nimport {getSuperShapes} from '../utils/ShapeClass.js';\n\n/**\n * Plain-object SHACL metadata — the QResult-like shape of a `sh:PropertyShape`.\n *\n * Shapes are metadata, not data: a shape class's `.shape` and its property shapes\n * are plain objects (no class instance, no methods). Operations that used to be\n * instance methods now live as free functions in this module.\n */\nexport interface PropertyShapeData {\n id: string;\n label: string;\n path: PathExpr;\n nodeKind?: NodeReferenceValue;\n datatype?: NodeReferenceValue;\n minCount?: number;\n maxCount?: number;\n name?: string;\n description?: string;\n order?: number;\n group?: string;\n /**\n * `linked_core:displayRank` — a single linear importance rank, lower = more\n * important. Truncated display contexts (\"the top 3 properties\") derive from it.\n * Distinct from `order`, which is arrangement rather than importance.\n */\n displayRank?: number;\n /** `linked_core:displayHidden` — omit from generic rendering. */\n displayHidden?: boolean;\n class?: NodeReferenceValue;\n in?: (NodeReferenceValue | string | number | boolean)[];\n equalsConstraint?: NodeReferenceValue;\n disjoint?: NodeReferenceValue;\n lessThan?: NodeReferenceValue;\n lessThanOrEquals?: NodeReferenceValue;\n /** Value-range constraints (sh:minInclusive / sh:maxInclusive / sh:minExclusive / sh:maxExclusive). */\n minInclusive?: number;\n maxInclusive?: number;\n minExclusive?: number | string;\n maxExclusive?: number;\n /** String-length constraints (sh:minLength / sh:maxLength). */\n minLength?: number;\n maxLength?: number;\n /** Regex constraint (sh:pattern); serialized as its source string. */\n pattern?: RegExp;\n hasValueConstraint?: NodeReferenceValue | string | number | boolean;\n defaultValue?: unknown;\n sortBy?: PathExpr;\n valueShape?: NodeReferenceValue;\n /** Composition marker: the value(s) of this property are owned by the subject. */\n contains?: boolean;\n parentNodeShape?: NodeShapeData;\n}\n\n/**\n * Plain-object SHACL metadata — the QResult-like shape of a `sh:NodeShape`.\n */\nexport interface NodeShapeData {\n id: string;\n label?: string;\n description?: string;\n targetClass?: NodeReferenceValue;\n extends?: NodeReferenceValue;\n /** Composition marker: instances are dependent (cascade-deletable via `contains`). */\n dependent?: boolean;\n /** sh:closed — target nodes with undeclared properties are invalid. */\n closed?: boolean;\n /** sh:ignoredProperties — extra properties permitted when the shape is closed. */\n ignoredProperties?: NodeReferenceValue[];\n propertyShapes: PropertyShapeData[];\n}\n\n/**\n * Result object produced by `propertyShapeToResult()` (SHACL projection).\n * @deprecated No production callers remain (the `NodeShape.properties` getter and\n * `PropertyShape.getResult()` were removed with the plain-object conversion). Read\n * the plain `PropertyShapeData` fields directly. Scheduled for removal.\n */\nexport interface PropertyShapeResult {\n id: string;\n label: string;\n path: PathExpr;\n nodeKind?: NodeReferenceValue;\n datatype?: NodeReferenceValue;\n minCount?: number;\n maxCount?: number;\n name?: string;\n description?: string;\n order?: number;\n group?: string;\n class?: NodeReferenceValue;\n in?: (NodeReferenceValue | string | number | boolean)[];\n equals?: NodeReferenceValue;\n disjoint?: NodeReferenceValue;\n lessThan?: NodeReferenceValue;\n lessThanOrEquals?: NodeReferenceValue;\n hasValue?: NodeReferenceValue | string | number | boolean;\n defaultValue?: unknown;\n sortBy?: PathExpr;\n valueShape?: NodeReferenceValue;\n}\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\n/** Create an empty NodeShape metadata object for the given shape IRI. */\nexport function createNodeShapeData(id: string): NodeShapeData {\n return {id, propertyShapes: []};\n}\n\n/** Create a blank PropertyShape metadata object (fields filled in by the caller). */\nexport function createPropertyShapeData(): PropertyShapeData {\n return {id: '', label: '', path: null as unknown as PathExpr};\n}\n\n// ---------------------------------------------------------------------------\n// Free functions (formerly NodeShape/PropertyShape instance methods)\n// ---------------------------------------------------------------------------\n\n/** One-time warning keys for shapes whose `propertyShapes` is missing/invalid. */\nconst warnedMissingPropertyShapes = new Set<string>();\n\n/**\n * Read a node shape's own property shapes, tolerating a missing/invalid array.\n *\n * A non-array `propertyShapes` almost always means a duplicate `@_linked/core`\n * install or a non-normalized static shape on a superclass; warn once per shape id\n * (diagnostic parity with the former `NodeShape.listPropertyShapesSafe`) and treat\n * it as empty.\n */\nfunction ownPropertyShapes(nodeShape: NodeShapeData): PropertyShapeData[] {\n const own = (nodeShape as {propertyShapes?: PropertyShapeData[]}).propertyShapes;\n if (Array.isArray(own)) {\n return own;\n }\n const id = (nodeShape as {id?: string}).id ?? '';\n if (!warnedMissingPropertyShapes.has(id)) {\n warnedMissingPropertyShapes.add(id);\n console.warn(\n `[@_linked/core] static shape ${id ? `'${id}'` : '(unknown id)'} has missing ` +\n `or invalid propertyShapes. Treating as []. Often caused by duplicate ` +\n `@_linked/core installs or a non-normalized static shape on a superclass.`,\n );\n }\n return [];\n}\n\n/**\n * Property shapes declared on this NodeShape. With `includeSuperClasses`, walks the\n * inheritance chain via `getSuperShapes` and concatenates each ancestor's own property\n * shapes — the prototype chain for a class-backed shape, `extends` for one known only\n * as data.\n */\nexport function getPropertyShapes(\n nodeShape: NodeShapeData,\n includeSuperClasses: boolean = false,\n): PropertyShapeData[] {\n if (!includeSuperClasses) {\n return [...ownPropertyShapes(nodeShape)];\n }\n // One inheritance walk, shared with getSuperShapes: the prototype chain for a\n // class-backed shape (which includes the framework `Shape` root and its `label` /\n // `type` properties), or `extends` through the registry for a shape that exists only\n // as data. Previously this walked the prototype chain directly and returned ONLY own\n // properties when no class existed — so a project-authored shape silently lost\n // everything it inherited.\n const res: PropertyShapeData[] = [...ownPropertyShapes(nodeShape)];\n for (const superShape of getSuperShapes(nodeShape)) {\n res.push(...ownPropertyShapes(superShape));\n }\n return res;\n}\n\n/** Property shapes across the inheritance chain, deduped by label (most specific wins). */\nexport function getUniquePropertyShapes(\n nodeShape: NodeShapeData,\n): PropertyShapeData[] {\n const unique: PropertyShapeData[] = [];\n const seen = new Set<string>();\n for (const ps of getPropertyShapes(nodeShape, true)) {\n if (!seen.has(ps.label)) {\n seen.add(ps.label);\n unique.push(ps);\n }\n }\n return unique;\n}\n\n/**\n * Find a property shape by label. With `checkSubShapes` (default true), ascends the\n * inheritance chain if the label isn't found locally.\n *\n * Shares `getSuperShapes` with {@link getPropertyShapes}, so the singular and plural\n * lookups can never disagree about what a shape inherits — and so a shape registered\n * from data resolves inherited properties through `extends` rather than stopping at its\n * own. This is what `getPropertyShapeByLabel` delegates to (PR #211), so closing the gap\n * here closes it for the query proxies too. See docs/backlog/040.\n */\nexport function getPropertyShape(\n nodeShape: NodeShapeData,\n label: string,\n checkSubShapes: boolean = true,\n): PropertyShapeData | undefined {\n const own = ownPropertyShapes(nodeShape).find((ps) => ps.label === label);\n if (own || !checkSubShapes) return own;\n for (const superShape of getSuperShapes(nodeShape)) {\n const inherited = ownPropertyShapes(superShape).find(\n (ps) => ps.label === label,\n );\n if (inherited) return inherited;\n }\n return undefined;\n}\n\n/** Two node shapes are equal when they share the same IRI. */\nexport function nodeShapeEquals(a: NodeShapeData, b?: NodeShapeData): boolean {\n return !!b && a?.id === b.id;\n}\n\n/** Append a property shape to a node shape, wiring the back-reference. */\nexport function addPropertyShape(\n nodeShape: NodeShapeData,\n propertyShape: PropertyShapeData,\n): void {\n propertyShape.parentNodeShape = nodeShape;\n if (!Array.isArray(nodeShape.propertyShapes)) {\n nodeShape.propertyShapes = [];\n }\n nodeShape.propertyShapes.push(propertyShape);\n}\n\n/** Shallow-clone a property shape (used by property override / disallow). */\nexport function clonePropertyShape(\n propertyShape: PropertyShapeData,\n): PropertyShapeData {\n return {...propertyShape};\n}\n\n/**\n * Project a property shape to its SHACL result object.\n * @deprecated No production callers remain. Read the plain `PropertyShapeData`\n * fields directly (note this projection renames `equalsConstraint`→`equals`,\n * `hasValueConstraint`→`hasValue`, and serializes `pattern` to its source string).\n * Scheduled for removal.\n */\nexport function propertyShapeToResult(ps: PropertyShapeData): PropertyShapeResult {\n const result: Record<string, unknown> & {id: string; label: string; path: PathExpr} = {\n id: ps.id,\n label: ps.label,\n path: ps.path,\n };\n if (ps.nodeKind) result.nodeKind = ps.nodeKind;\n if (ps.datatype) result.datatype = ps.datatype;\n if (typeof ps.minCount === 'number') result.minCount = ps.minCount;\n if (typeof ps.maxCount === 'number') result.maxCount = ps.maxCount;\n if (ps.name) result.name = ps.name;\n if (ps.description) result.description = ps.description;\n if (typeof ps.order === 'number') result.order = ps.order;\n if (ps.group) result.group = ps.group;\n if (ps.class) result.class = ps.class;\n if (ps.in) result.in = ps.in;\n if (ps.equalsConstraint) result.equals = ps.equalsConstraint;\n if (ps.disjoint) result.disjoint = ps.disjoint;\n if (ps.lessThan) result.lessThan = ps.lessThan;\n if (ps.lessThanOrEquals) result.lessThanOrEquals = ps.lessThanOrEquals;\n if (ps.minInclusive !== undefined) result.minInclusive = ps.minInclusive;\n if (ps.maxInclusive !== undefined) result.maxInclusive = ps.maxInclusive;\n if (ps.minExclusive !== undefined) result.minExclusive = ps.minExclusive;\n if (ps.maxExclusive !== undefined) result.maxExclusive = ps.maxExclusive;\n if (typeof ps.minLength === 'number') result.minLength = ps.minLength;\n if (typeof ps.maxLength === 'number') result.maxLength = ps.maxLength;\n if (ps.pattern) result.pattern = ps.pattern.source;\n if (ps.hasValueConstraint !== undefined) result.hasValue = ps.hasValueConstraint;\n if (ps.defaultValue !== undefined) result.defaultValue = ps.defaultValue;\n if (ps.sortBy) result.sortBy = ps.sortBy;\n if (ps.valueShape) result.valueShape = ps.valueShape;\n return result as PropertyShapeResult;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeShapeData.js","sourceRoot":"","sources":["../../../src/shapes/nodeShapeData.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAsGtD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,yEAAyE;AACzE,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,OAAO,EAAC,EAAE,EAAE,cAAc,EAAE,EAAE,EAAC,CAAC;AAClC,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,uBAAuB;IACrC,OAAO,EAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,IAA2B,EAAC,CAAC;AAChE,CAAC;AAED,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAE9E,kFAAkF;AAClF,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAU,CAAC;AAEtD;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,SAAwB;;IACjD,MAAM,GAAG,GAAI,SAAoD,CAAC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AQ,GAAG,EAAE,CAAC,kBAAkB,CAAC;IACjF,IAAI,EAAE,CAAC,YAAY,KAAK,SAAS;QAAE,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;IACzE,IAAI,EAAE,CAAC,MAAM;QAAE,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,UAAU;QAAE,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;IACrD,OAAO,MAA6B,CAAC;AACvC,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 {NodeReferenceValue} from '../utils/NodeReference.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\nimport {getSuperShapes} from '../utils/ShapeClass.js';\n\n/**\n * Plain-object SHACL metadata — the QResult-like shape of a `sh:PropertyShape`.\n *\n * Shapes are metadata, not data: a shape class's `.shape` and its property shapes\n * are plain objects (no class instance, no methods). Operations that used to be\n * instance methods now live as free functions in this module.\n */\nexport interface PropertyShapeData {\n id: string;\n label: string;\n path: PathExpr;\n nodeKind?: NodeReferenceValue;\n datatype?: NodeReferenceValue;\n minCount?: number;\n maxCount?: number;\n name?: string;\n description?: string;\n order?: number;\n group?: string;\n /**\n * `core:displayRank` — a single linear importance rank, lower = more\n * important. Truncated display contexts (\"the top 3 properties\") derive from it.\n * Distinct from `order`, which is arrangement rather than importance.\n */\n displayRank?: number;\n /** `core:displayHidden` — omit from generic rendering. */\n displayHidden?: boolean;\n class?: NodeReferenceValue;\n in?: (NodeReferenceValue | string | number | boolean)[];\n equalsConstraint?: NodeReferenceValue;\n disjoint?: NodeReferenceValue;\n lessThan?: NodeReferenceValue;\n lessThanOrEquals?: NodeReferenceValue;\n /** Value-range constraints (sh:minInclusive / sh:maxInclusive / sh:minExclusive / sh:maxExclusive). */\n minInclusive?: number;\n maxInclusive?: number;\n minExclusive?: number | string;\n maxExclusive?: number;\n /** String-length constraints (sh:minLength / sh:maxLength). */\n minLength?: number;\n maxLength?: number;\n /** Regex constraint (sh:pattern); serialized as its source string. */\n pattern?: RegExp;\n hasValueConstraint?: NodeReferenceValue | string | number | boolean;\n defaultValue?: unknown;\n sortBy?: PathExpr;\n valueShape?: NodeReferenceValue;\n /** Composition marker: the value(s) of this property are owned by the subject. */\n contains?: boolean;\n parentNodeShape?: NodeShapeData;\n}\n\n/**\n * Plain-object SHACL metadata — the QResult-like shape of a `sh:NodeShape`.\n */\nexport interface NodeShapeData {\n id: string;\n label?: string;\n description?: string;\n targetClass?: NodeReferenceValue;\n extends?: NodeReferenceValue;\n /** Composition marker: instances are dependent (cascade-deletable via `contains`). */\n dependent?: boolean;\n /** sh:closed — target nodes with undeclared properties are invalid. */\n closed?: boolean;\n /** sh:ignoredProperties — extra properties permitted when the shape is closed. */\n ignoredProperties?: NodeReferenceValue[];\n propertyShapes: PropertyShapeData[];\n}\n\n/**\n * Result object produced by `propertyShapeToResult()` (SHACL projection).\n * @deprecated No production callers remain (the `NodeShape.properties` getter and\n * `PropertyShape.getResult()` were removed with the plain-object conversion). Read\n * the plain `PropertyShapeData` fields directly. Scheduled for removal.\n */\nexport interface PropertyShapeResult {\n id: string;\n label: string;\n path: PathExpr;\n nodeKind?: NodeReferenceValue;\n datatype?: NodeReferenceValue;\n minCount?: number;\n maxCount?: number;\n name?: string;\n description?: string;\n order?: number;\n group?: string;\n class?: NodeReferenceValue;\n in?: (NodeReferenceValue | string | number | boolean)[];\n equals?: NodeReferenceValue;\n disjoint?: NodeReferenceValue;\n lessThan?: NodeReferenceValue;\n lessThanOrEquals?: NodeReferenceValue;\n hasValue?: NodeReferenceValue | string | number | boolean;\n defaultValue?: unknown;\n sortBy?: PathExpr;\n valueShape?: NodeReferenceValue;\n}\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\n/** Create an empty NodeShape metadata object for the given shape IRI. */\nexport function createNodeShapeData(id: string): NodeShapeData {\n return {id, propertyShapes: []};\n}\n\n/** Create a blank PropertyShape metadata object (fields filled in by the caller). */\nexport function createPropertyShapeData(): PropertyShapeData {\n return {id: '', label: '', path: null as unknown as PathExpr};\n}\n\n// ---------------------------------------------------------------------------\n// Free functions (formerly NodeShape/PropertyShape instance methods)\n// ---------------------------------------------------------------------------\n\n/** One-time warning keys for shapes whose `propertyShapes` is missing/invalid. */\nconst warnedMissingPropertyShapes = new Set<string>();\n\n/**\n * Read a node shape's own property shapes, tolerating a missing/invalid array.\n *\n * A non-array `propertyShapes` almost always means a duplicate `@_linked/core`\n * install or a non-normalized static shape on a superclass; warn once per shape id\n * (diagnostic parity with the former `NodeShape.listPropertyShapesSafe`) and treat\n * it as empty.\n */\nfunction ownPropertyShapes(nodeShape: NodeShapeData): PropertyShapeData[] {\n const own = (nodeShape as {propertyShapes?: PropertyShapeData[]}).propertyShapes;\n if (Array.isArray(own)) {\n return own;\n }\n const id = (nodeShape as {id?: string}).id ?? '';\n if (!warnedMissingPropertyShapes.has(id)) {\n warnedMissingPropertyShapes.add(id);\n console.warn(\n `[@_linked/core] static shape ${id ? `'${id}'` : '(unknown id)'} has missing ` +\n `or invalid propertyShapes. Treating as []. Often caused by duplicate ` +\n `@_linked/core installs or a non-normalized static shape on a superclass.`,\n );\n }\n return [];\n}\n\n/**\n * Property shapes declared on this NodeShape. With `includeSuperClasses`, walks the\n * inheritance chain via `getSuperShapes` and concatenates each ancestor's own property\n * shapes — the prototype chain for a class-backed shape, `extends` for one known only\n * as data.\n */\nexport function getPropertyShapes(\n nodeShape: NodeShapeData,\n includeSuperClasses: boolean = false,\n): PropertyShapeData[] {\n if (!includeSuperClasses) {\n return [...ownPropertyShapes(nodeShape)];\n }\n // One inheritance walk, shared with getSuperShapes: the prototype chain for a\n // class-backed shape (which includes the framework `Shape` root and its `label` /\n // `type` properties), or `extends` through the registry for a shape that exists only\n // as data. Previously this walked the prototype chain directly and returned ONLY own\n // properties when no class existed — so a project-authored shape silently lost\n // everything it inherited.\n const res: PropertyShapeData[] = [...ownPropertyShapes(nodeShape)];\n for (const superShape of getSuperShapes(nodeShape)) {\n res.push(...ownPropertyShapes(superShape));\n }\n return res;\n}\n\n/** Property shapes across the inheritance chain, deduped by label (most specific wins). */\nexport function getUniquePropertyShapes(\n nodeShape: NodeShapeData,\n): PropertyShapeData[] {\n const unique: PropertyShapeData[] = [];\n const seen = new Set<string>();\n for (const ps of getPropertyShapes(nodeShape, true)) {\n if (!seen.has(ps.label)) {\n seen.add(ps.label);\n unique.push(ps);\n }\n }\n return unique;\n}\n\n/**\n * Find a property shape by label. With `checkSubShapes` (default true), ascends the\n * inheritance chain if the label isn't found locally.\n *\n * Shares `getSuperShapes` with {@link getPropertyShapes}, so the singular and plural\n * lookups can never disagree about what a shape inherits — and so a shape registered\n * from data resolves inherited properties through `extends` rather than stopping at its\n * own. This is what `getPropertyShapeByLabel` delegates to (PR #211), so closing the gap\n * here closes it for the query proxies too. See docs/backlog/040.\n */\nexport function getPropertyShape(\n nodeShape: NodeShapeData,\n label: string,\n checkSubShapes: boolean = true,\n): PropertyShapeData | undefined {\n const own = ownPropertyShapes(nodeShape).find((ps) => ps.label === label);\n if (own || !checkSubShapes) return own;\n for (const superShape of getSuperShapes(nodeShape)) {\n const inherited = ownPropertyShapes(superShape).find(\n (ps) => ps.label === label,\n );\n if (inherited) return inherited;\n }\n return undefined;\n}\n\n/** Two node shapes are equal when they share the same IRI. */\nexport function nodeShapeEquals(a: NodeShapeData, b?: NodeShapeData): boolean {\n return !!b && a?.id === b.id;\n}\n\n/** Append a property shape to a node shape, wiring the back-reference. */\nexport function addPropertyShape(\n nodeShape: NodeShapeData,\n propertyShape: PropertyShapeData,\n): void {\n propertyShape.parentNodeShape = nodeShape;\n if (!Array.isArray(nodeShape.propertyShapes)) {\n nodeShape.propertyShapes = [];\n }\n nodeShape.propertyShapes.push(propertyShape);\n}\n\n/** Shallow-clone a property shape (used by property override / disallow). */\nexport function clonePropertyShape(\n propertyShape: PropertyShapeData,\n): PropertyShapeData {\n return {...propertyShape};\n}\n\n/**\n * Project a property shape to its SHACL result object.\n * @deprecated No production callers remain. Read the plain `PropertyShapeData`\n * fields directly (note this projection renames `equalsConstraint`→`equals`,\n * `hasValueConstraint`→`hasValue`, and serializes `pattern` to its source string).\n * Scheduled for removal.\n */\nexport function propertyShapeToResult(ps: PropertyShapeData): PropertyShapeResult {\n const result: Record<string, unknown> & {id: string; label: string; path: PathExpr} = {\n id: ps.id,\n label: ps.label,\n path: ps.path,\n };\n if (ps.nodeKind) result.nodeKind = ps.nodeKind;\n if (ps.datatype) result.datatype = ps.datatype;\n if (typeof ps.minCount === 'number') result.minCount = ps.minCount;\n if (typeof ps.maxCount === 'number') result.maxCount = ps.maxCount;\n if (ps.name) result.name = ps.name;\n if (ps.description) result.description = ps.description;\n if (typeof ps.order === 'number') result.order = ps.order;\n if (ps.group) result.group = ps.group;\n if (ps.class) result.class = ps.class;\n if (ps.in) result.in = ps.in;\n if (ps.equalsConstraint) result.equals = ps.equalsConstraint;\n if (ps.disjoint) result.disjoint = ps.disjoint;\n if (ps.lessThan) result.lessThan = ps.lessThan;\n if (ps.lessThanOrEquals) result.lessThanOrEquals = ps.lessThanOrEquals;\n if (ps.minInclusive !== undefined) result.minInclusive = ps.minInclusive;\n if (ps.maxInclusive !== undefined) result.maxInclusive = ps.maxInclusive;\n if (ps.minExclusive !== undefined) result.minExclusive = ps.minExclusive;\n if (ps.maxExclusive !== undefined) result.maxExclusive = ps.maxExclusive;\n if (typeof ps.minLength === 'number') result.minLength = ps.minLength;\n if (typeof ps.maxLength === 'number') result.maxLength = ps.maxLength;\n if (ps.pattern) result.pattern = ps.pattern.source;\n if (ps.hasValueConstraint !== undefined) result.hasValue = ps.hasValueConstraint;\n if (ps.defaultValue !== undefined) result.defaultValue = ps.defaultValue;\n if (ps.sortBy) result.sortBy = ps.sortBy;\n if (ps.valueShape) result.valueShape = ps.valueShape;\n return result as PropertyShapeResult;\n}\n"]}
|
package/lib/esm/utils/Package.js
CHANGED
|
@@ -440,11 +440,11 @@ createPropertyShape({ path: shacl.pattern, datatype: xsd.string, maxCount: 1 },
|
|
|
440
440
|
// PropertyShape.order / group
|
|
441
441
|
createPropertyShape({ path: shacl.order, datatype: xsd.integer, maxCount: 1 }, 'order', shacl.Literal, PropertyShape);
|
|
442
442
|
createPropertyShape({ path: shacl.group, maxCount: 1 }, 'group', shacl.Literal, PropertyShape);
|
|
443
|
-
// PropertyShape.displayRank / displayHidden (
|
|
443
|
+
// PropertyShape.displayRank / displayHidden (core: display vocabulary).
|
|
444
444
|
// These materialize onto the pure sh:NodeShape and so travel with an ejected app.
|
|
445
445
|
createPropertyShape({ path: coreOntology.displayRank, datatype: xsd.integer, maxCount: 1 }, 'displayRank', shacl.Literal, PropertyShape);
|
|
446
446
|
createPropertyShape({ path: coreOntology.displayHidden, datatype: xsd.boolean, maxCount: 1 }, 'displayHidden', shacl.Literal, PropertyShape);
|
|
447
|
-
// PropertyShape.contains (
|
|
447
|
+
// PropertyShape.contains (core:contains — persists the composition flag)
|
|
448
448
|
createPropertyShape({ path: coreOntology.contains, datatype: xsd.boolean, maxCount: 1 }, 'contains', shacl.Literal, PropertyShape);
|
|
449
449
|
// NodeShape.closed / ignoredProperties / dependent
|
|
450
450
|
createPropertyShape({ path: shacl.closed, datatype: xsd.boolean, maxCount: 1 }, 'closed', shacl.Literal, NodeShape);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Package.js","sourceRoot":"","sources":["../../../src/utils/Package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,mBAAmB,EAAqB,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAC,KAAK,EAAw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AC;AAEF,gFAAgF;AAChF,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACjE,UAAU,EACV,KAAK,CAAC,OAAO,EACb,aAAa,CACd,CAAC;AAEF,mDAAmD;AACnD,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACxD,QAAQ,EACR,KAAK,CAAC,OAAO,EACb,SAAS,CACV,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAC,EAC7C,mBAAmB,EACnB,KAAK,CAAC,GAAG,EACT,SAAS,CACV,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EAClE,WAAW,EACX,KAAK,CAAC,OAAO,EACb,SAAS,CACV,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 {\n createPropertyShape,\n getAndClearCallbacks,\n getNodeShapeUri,\n getPackageUri,\n setPackagePublishConfig,\n NodeShape,\n PropertyShape,\n} from '../shapes/SHACL.js';\nimport {createNodeShapeData, type NodeShapeData} from '../shapes/nodeShapeData.js';\nimport {Shape, type ShapeConstructor} from '../shapes/Shape.js';\nimport {List} from '../shapes/List.class.js';\nimport {Prefix} from './Prefix.js';\nimport {coreOntology} from '../ontologies/linked-core.js';\nimport {rdf} from '../ontologies/rdf.js';\nimport {addNodeShapeToShapeClass,getShapeClass} from './ShapeClass.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {rdfs} from '../ontologies/rdfs.js';\nimport {xsd} from '../ontologies/xsd.js';\nimport type {NodeReferenceValue} from './NodeReference.js';\n\n//global tree\ndeclare var _linked: any;\ndeclare var window;\ndeclare var global;\n\n\n// var packageParsePromises: Map<string,Promise<any>> = new Map();\n// var loadedPackages: Set<NamedNode> = new Set();\nlet ontologies: Set<any> = new Set();\nlet _autoLoadOntologyData = false;\n/**\n * a map of requested property shapes for specific nodes\n * The value is a promise if it's still loading, or true if it is fully loaded\n */\n// type ClassDecorator = <T extends {new (...args: any[]): {}}>(\n// constructor: T,\n// ) => T;\n\nexport type ShapeConfig = {\n /**\n * The name this shape is identified by, overriding the class name.\n *\n * A shape's IRI is `<baseUri>shape/<package>/<name>`, and `Server.call`\n * routes on it — so the name is persisted data, not a label. Taking it from\n * `constructor.name` couples that data to how the code was compiled: a\n * minifier renames the class, and so does a plain name collision, because a\n * shape and the ontology term it targets deliberately share a name. Either\n * one silently changes what the shape *is*.\n *\n * Optional, and defaults to `constructor.name`, so existing shapes are\n * unaffected. Set it where the identity has to outlive the build.\n */\n name?: string;\n /**\n * A short description of the shape, what it represents and what it is used for.\n * will be stored as rdfs:comment on the shape node\n */\n description?: string;\n /**\n * Marks this shape's instances as *dependent* (composition / no independent existence):\n * they may be cascade-deleted when reached through a `contains` property.\n */\n dependent?: boolean;\n /**\n * Close the shape (sh:closed): target nodes with properties outside this shape are invalid.\n */\n closed?: boolean;\n /**\n * Properties permitted in addition to the declared ones when the shape is closed\n * (sh:ignoredProperties).\n */\n ignoredProperties?: NodeReferenceValue[];\n};\n\nexport type PackageMetadata = {\n id: string;\n packageName: string;\n type: NodeReferenceValue;\n};\n\n/**\n * This object, returned by [linkedPackage()](/docs/lincd.js/modules/utils_Module#linkedPackage),\n * contains the decorators to link different parts of a LINCD module.\n */\nexport interface LinkedPackageObject\n{\n /**\n * Links a typescript class to a SHACL shape.\n * This decorator creates a SHACL shape and looks at the static property [targetClass](/docs/lincd.js/classes/shapes_Shape.Shape#targetclass)\n * The rest of the shape is typically 'shaped' by methods that use [property decorators](/docs/lincd.js/modules/utils_ShapeDecorators).\n *\n * @example\n * Example of a typescript class using the \\@linkedShape decorator:\n * ```tsx\n * @linkedShape\n * export class Person extends Shape { ... }\n * ```\n * Or with options:\n * ```tsx\n * @linkedShape({ description: \"...\" })\n * export class Person extends Shape { ... }\n * ```\n */\n linkedShape: {\n <T extends typeof Shape>(constructor: T): void;\n <T extends typeof Shape>(config?: ShapeConfig): (constructor: T) => void;\n };\n /**\n * Use this decorator to make any other classes or functions available on demand to other LINCD modules.\n * It does not change the object it is applied on.\n * This is specifically required for their use in an open-ended LINCD application.\n *\n * @example\n * An example helper utility using the \\@linkedUtil decorator:\n * ```tsx\n * @linkedUtil\n * export class Sort {\n * static byName(persons:Person[]) {\n * return persons.sort((p1,p2) => p1.name < p2.name ? -1 : 1)\n * }\n * ```\n */\n linkedUtil: (constructor: any) => any;\n /**\n * Used to notify LINCD.js of an ontology.\n * See also the [Ontology guides](/docs/guides/linked-code/ontologies).\n *\n * @param allFileExports - all the objects that are exported by the ontology file (use `import * as _this from \"./path-to-this-file\")`)\n * @param nameSpace - the result of [createNameSpace](/docs/lincd.js/modules/utils_NameSpace#createnamespace). This allows consumers to generate NamedNodes that may not be listed in this ontology if needed\n * @param prefixAndFileName - a suggested prefix chosen by you. Make sure the suggestedPrefix matches the file name and the name of the exported object that groups all entities together\n * @param loadDataFunction - a method that loads _and parses_ the raw ontology data. This means the ontology will be loaded into the local graph. The returned result is mostly a JSONLDParsePromise (from lincd-jsonld/JSONLD, not bundled in LINCD.js)\n * @param dataSource - the relative path to the raw data of the ontology\n * @example\n * Example of an Ontology File that used linkedOntology()\n * ```tsx\n * import {NamedNode} from 'lincd/models';\n * import {JSONLD} from 'lincd-jsonld/JSONLD';\n * import {createNameSpace} from 'lincd/utils/NameSpace';\n * import {linkedOntology} from '../package.js';\n * import * as _this from './my.js-ontology';\n *\n * let dataFile = '../data/my.js-ontology.json';\n * export var loadData = () => JSONLD.parsePromise(import(dataFile));\n *\n * export var ns = createNameSpace('http://www.my-ontology.com/');\n *\n * export var _self: NamedNode = ns('');\n *\n * // Classes\n * export var ExampleClass: NamedNode = ns('ExampleClass');\n *\n * // Properties\n * export var exampleProperty: NamedNode = ns('exampleProperty');\n *\n * export const myOntology = {\n * ExampleClass,\n * exampleProperty,\n * };\n *\n * linkedOntology(_this, ns, 'myOntology', loadData, dataFile);\n * ```\n */\n linkedOntology: (\n allFileExports,\n nameSpace: (term: string) => NodeReferenceValue,\n suggestedPrefixAndFileName: string,\n loadDataFunction?: () => Promise<any>,\n dataSource?: string | string[],\n ) => void;\n /**\n * Low level method used by other decorators to write to the modules' object in the LINCD tree.\n * You should typically not need this.\n * @param exportFileName - the file name that this exported object is available under. Needs to be unique across the module.\n * @param exportedObject - the exported object (the class, constant, function, etc)\n */\n registerPackageExport: (exportedObject: any) => void;\n\n /**\n * Get a Shape subclass registered in this package by name.\n * Returns undefined if the shape is not registered or bundled.\n *\n * Useful for avoiding circular dependencies between shapes.\n * E.g. `getOneAs(..., getPackageShape('ImageObject'))` in Thing.ts\n * avoids importing ImageObject (which extends Thing).\n */\n getPackageShape: (name: string) => ShapeConstructor | undefined;\n /**\n * A reference to the modules' object in the LINCD tree.\n * Contains all linked components of the module.\n */\n packageExports: any;\n packageName: string;\n packageMetadata: PackageMetadata;\n\n /**\n * Register a file (a javascript module) and all its exported objects.\n * Specifically helpful for registering multiple functional components if you declare them without a function name\n * @param _this\n * @param _module\n */\n registerPackageModule(_module): void;\n}\n\nexport var DEFAULT_LIMIT = 12;\n\nexport function setDefaultPageLimit(limit: number)\n{\n DEFAULT_LIMIT = limit;\n}\n\nexport function autoLoadOntologyData(value: boolean)\n{\n _autoLoadOntologyData = value;\n //this may be set to true after some ontologies have already indexed,\n if (_autoLoadOntologyData)\n {\n // so in that case we load all data of ontologies that are already indexed\n ontologies.forEach((ontologyExport) => {\n //see linkedOntology() where we store the data loading method under the _load key\n if (ontologyExport['_load'])\n {\n ontologyExport['_load']();\n }\n });\n }\n}\n\n\nexport function linkedPackage(\n packageName: string,\n options?: {baseUri?: string},\n): LinkedPackageObject\n{\n // Declare the package's publish root before any shape/metadata IRI is built.\n // The slug is derived from `packageName`; only `baseUri` is configurable — CN\n // injects a workspace-scoped root for private packages, first-party packages\n // default to linked.cm.\n setPackagePublishConfig(packageName, options);\n let packageMetadata = registerPackageMetadata(packageName);\n let packageTreeObject = registerPackageInTree(packageName);\n\n //#Create declarators for this module\n let registerPackageExport = function(object) {\n // Plan-011 §I2 interim — \"Key X was already defined\" warning silenced\n // until the duplicate-instance root cause is investigated. With Vite\n // SSR resolving workspace packages from src/, package.ts evaluates\n // twice and every export key trips this warning. The overwrite is\n // safe because the second registration is the same class.\n packageTreeObject[object.name] = object;\n };\n\n let registerInPackageTree = function(exportName,exportedObject) {\n packageTreeObject[exportName] = exportedObject;\n };\n\n function registerPackageModule(_module): void\n {\n for (var key in _module.exports)\n {\n //if the exported object itself is not named or its name is _wrappedComponent\n //then we give it the same name as it's export name.\n if (\n !_module.exports[key].name ||\n _module.exports[key].name === '_wrappedComponent'\n )\n {\n Object.defineProperty(_module.exports[key],'name',{value: key});\n //manual 'hack' to set the name of the original function\n if (\n _module.exports[key]['original'] &&\n !_module.exports[key]['original']['name']\n )\n {\n Object.defineProperty(_module.exports[key]['original'],'name',{\n value: key + '_implementation',\n });\n }\n }\n registerInPackageTree(key,_module.exports[key]);\n }\n }\n\n //create a declarator function which Components of this module can use register themselves and add themselves to the global tree\n let linkedUtil = function(constructor) {\n //add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n //return the original class without modifications\n return constructor;\n };\n\n // helper that contains the previous body; applies the decorator work to a given constructor\n function applyLinkedShape<T extends typeof Shape>(\n constructor: T,\n options?: ShapeConfig,\n ): void\n {\n if(!constructor) {\n throw new Error('Constructor is undefined, skipping registration: '+constructor?.toString().substring(0,100)+' '+JSON.stringify(options));\n return;\n }\n // add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n // register the component and its shape\n Shape.registerByType(constructor);\n\n // Track the un-sanitized package name on the constructor so consumers\n // (e.g. LincdServerProxy) can route backend calls using the real module\n // specifier (e.g. '@_linked/server'), not the lossy URI-sanitized form\n // ('-_linked-server' — non-recoverable via decodeURIComponent).\n if (!Object.getOwnPropertyNames(constructor).includes('packageName')) {\n (constructor as any).packageName = packageName;\n }\n\n // if no shape object has been attached to the constructor\n if (!Object.getOwnPropertyNames(constructor).includes('shape'))\n {\n // The shape's identity. An explicit name wins; otherwise the class name,\n // which is what every existing shape relies on.\n const shapeName = options?.name ?? constructor.name;\n\n // A class name ending in a digit, with no explicit name given, is almost\n // always a bundler disambiguating a collision — `BackendAPIStore2` when\n // the ontology term of the same name took the binding first. The shape\n // then registers under an IRI the rest of the system will never ask for,\n // and the only symptom is a 501 several layers away. Say so here, where\n // it is cheap and early.\n if (!options?.name && /\\d$/.test(constructor.name)) {\n console.warn(\n `[linked] Shape '${constructor.name}' in '${packageName}' has a name ending in a digit, ` +\n `which usually means a bundler renamed it to avoid a collision — often with the ` +\n `ontology term it targets. Its IRI will not match what consumers ask for. ` +\n `Pass an explicit name: @linkedShape({name: '...'}).`,\n );\n }\n\n // create a new node shape (plain metadata object) for this shapeClass\n const nodeShape: NodeShapeData = createNodeShapeData(\n getNodeShapeUri(packageName, shapeName),\n );\n // connect the typescript class to its NodeShape\n constructor.shape = nodeShape;\n // set the name\n nodeShape.label = shapeName;\n\n if (options)\n {\n if (options.description)\n {\n nodeShape.description = options.description;\n }\n if (options.dependent)\n {\n nodeShape.dependent = true;\n }\n if (options.closed !== undefined)\n {\n nodeShape.closed = options.closed;\n }\n if (options.ignoredProperties)\n {\n nodeShape.ignoredProperties = options.ignoredProperties;\n }\n }\n\n // also keep track of the reverse: nodeShape to typescript class\n addNodeShapeToShapeClass(nodeShape,constructor);\n\n //track what extends what (nodeShape level)\n const extendingShapeClass = Object.getPrototypeOf(\n constructor,\n ) as typeof Shape;\n const extendingShape = extendingShapeClass.shape;\n //if this shape class is extending something other then Shape\n if (extendingShape && !(extendingShapeClass === Shape)) {\n //store which nodeShape this nodeShape extends\n nodeShape.extends = {id: extendingShape.id};\n }\n \n\n // run deferred callbacks from property decorators\n if (constructor['shapeCallbacks'])\n {\n constructor['shapeCallbacks'].forEach((callback) => {\n callback(nodeShape);\n });\n const nodeCallbacks = getAndClearCallbacks(nodeShape.id);\n if(nodeCallbacks) {\n nodeCallbacks.forEach((callback) => {\n callback(nodeShape);\n });\n }\n delete constructor['shapeCallbacks'];\n }\n }\n else\n {\n console.warn('This ShapeClass already has a shape: ',constructor.shape);\n }\n\n if (constructor.targetClass)\n {\n (constructor.shape as NodeShapeData).targetClass = constructor.targetClass;\n }\n\n // return the original class without modifications\n // return constructor;\n }\n\n // Overloaded signatures to support both usages\n function linkedShape<T extends typeof Shape>(constructor: T): void;\n function linkedShape<T extends typeof Shape>(\n options?: ShapeConfig,\n ): (constructor: T) => void;\n function linkedShape(arg?: any): void | ((constructor: any) => void)\n {\n // usage as @linkedShape\n if (typeof arg === 'function')\n {\n applyLinkedShape(arg);\n return;\n }\n // usage as @linkedShape({...}) or @linkedShape()\n const options: ShapeConfig | undefined = arg;\n return function <T extends typeof Shape>(constructor: T): void {\n applyLinkedShape(constructor,options);\n };\n }\n\n /**\n *\n * @param exports all exports of the file, simply provide \"this\" as value!\n * @param dataSource the path leading to the ontology's data file\n * @param nameSpace the base URI of the ontology\n * @param prefixAndFileName the file name MUST match the prefix for this ontology\n */\n let linkedOntology = function(\n exports,\n nameSpace: (term: string) => NodeReferenceValue,\n prefixAndFileName: string,\n loadData?,\n dataSource?: string | string[],\n ) {\n let exportsCopy = {...exports};\n //store specifics in exports. And make sure we can detect this as an ontology later\n exportsCopy['_ns'] = nameSpace;\n exportsCopy['_prefix'] = prefixAndFileName;\n exportsCopy['_load'] = loadData;\n exportsCopy['_data'] = dataSource;\n\n //register the prefix here (so just calling linkedOntology with a prefix will automatically register that prefix)\n if (prefixAndFileName)\n {\n //run the namespace without any term name, this will give back a named node with just the namespace as URI, then get that URI to provide it as full URI\n Prefix.add(prefixAndFileName,nameSpace('').id);\n }\n\n ontologies.add(exportsCopy);\n //register all the exports under the prefix. NOTE: this means the file name HAS to match the prefix\n registerInPackageTree(prefixAndFileName,exportsCopy);\n // });\n\n if (_autoLoadOntologyData)\n {\n loadData().catch((err) => {\n console.warn(\n 'Could not load ontology data. Do you need to rebuild the module of the ' +\n prefixAndFileName +\n ' ontology?',\n err,\n );\n });\n }\n };\n\n /**\n * This method is used to get a shape class in this package by its name.\n * This can be used to avoid circular dependencies between shapes.\n * @param name\n */\n let getPackageShape = (name: string): ShapeConstructor | undefined => {\n //get the named node of the node shape first,\n //then get the shape class that defines this node shape\n return getShapeClass(\n getNodeShapeUri(packageName, name),\n );\n };\n\n //return the declarators so the module can use them\n return {\n linkedShape,\n linkedUtil,\n linkedOntology,\n registerPackageExport,\n registerPackageModule,\n getPackageShape,\n packageExports: packageTreeObject,\n packageName: packageName,\n packageMetadata,\n } as LinkedPackageObject;\n}\n\nfunction registerPackageInTree(packageName,packageExports?)\n{\n //if something with this name already registered in the global tree\n if (packageName in _linked._modules)\n {\n // Plan-011 §I2 interim — silenced until the duplicate-Linked-instance\n // root cause is investigated. Vite SSR resolving workspace packages\n // from src/ for HMR causes each package.ts to evaluate twice, so this\n // warning fired ~80x per boot. Same package, same exports — the\n // Object.assign below preserves the registry correctly.\n Object.assign(_linked._modules[packageName],packageExports);\n }\n else\n {\n //initiate an empty object for this module in the global tree\n _linked._modules[packageName] = packageExports || {};\n }\n return _linked._modules[packageName];\n}\n\nfunction registerPackageMetadata(packageName: string): PackageMetadata\n{\n if (!_linked._packages)\n {\n _linked._packages = {};\n }\n if (packageName in _linked._packages)\n {\n return _linked._packages[packageName];\n }\n const packageMetadata: PackageMetadata = {\n id: getPackageUri(packageName),\n packageName,\n type: coreOntology.Package,\n };\n _linked._packages[packageName] = packageMetadata;\n return packageMetadata;\n}\n\n\nexport function initTree()\n{\n let globalObject =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : undefined;\n // Idempotent: if the global tree is already set up (by another copy of\n // this Package.ts in the same Node process — structural under Vite SSR,\n // which evaluates the file once for its own SSR transform AND once via\n // Node's resolver when a non-Vite import path reaches @_linked/core),\n // attach to it instead of throwing. Both instances write the same\n // _modules / _packages registry shape.\n //\n // Legacy `lincd` package's Package.ts (separate file) still throws on\n // dup — that throw signals a REAL problem (legacy `lincd` should never\n // load in a clean post-eradication state).\n if (!('_linked' in globalObject))\n {\n globalObject['_linked'] = {_modules: {}, _packages: {}};\n }\n}\n\n//when this file is used, make sure the tree is initialized\ninitTree();\n\n//now that this file is set up, we can link linked shapes in the core module itself\nexport const corePackage = linkedPackage('@_linked/core');\n// NodeShape, PropertyShape and List share their names with ontology terms (shacl.NodeShape,\n// shacl.PropertyShape, rdf.List), so a bundler may rename the classes. Explicit names keep\n// their IRIs independent of that.\ncorePackage.linkedShape({\n name: 'NodeShape',\n description:\n 'Represents a SHACL NodeShape; defines constraints for a class of RDF nodes. Links to multiple PropertyShapes. (schema, constraint, class validation)',\n})(NodeShape);\ncorePackage.linkedShape({\n name: 'PropertyShape',\n description:\n 'Represents a SHACL PropertyShape; specifies rules for one property of a NodeShape (path, datatype, cardinality). (validation rule, property constraint)',\n // A property shape has no independent existence — it is owned by its NodeShape via the\n // `contains` sh:property edge, so deleting the NodeShape cascade-deletes it.\n dependent: true,\n})(PropertyShape);\n// List is registered here, by value, because PropertyShape.in below uses it as its value\n// shape. Naming it by string instead would leave it unregistered for anyone who loads the\n// SHACL metamodel without importing shapes/List (backlog 045).\ncorePackage.linkedShape({\n name: 'List',\n dependent: true,\n})(List);\n// ValidationReport / ValidationResult removed in core metadata rewrite\n\n//ALL the following is to support Shape having get/set methods with property shapes\n//and Shape itself having a nodeShape\n//if we dont need Shape to have get/set methods (like label and type) then this can be removed\n// Base Shape IRI follows the same scheme as every other core shape:\n// https://linked.cm/shape/core/Shape (corePackage above declared slug 'core').\nShape.shape = createNodeShapeData(\n getNodeShapeUri('@_linked/core', 'Shape'),\n);\naddNodeShapeToShapeClass(Shape.shape,Shape);\n\n//Here we can register the properties of the Shape class itself\n//We can't do that inside of Shape because it would cause circular dependencies\ncreatePropertyShape({\n path: rdfs.label,\n //TODO: multiple labels should be possible\n maxCount: 1,//currently get label is implemented to return a single value\n },\n 'label',\n shacl.Literal,\n Shape,\n);\ncreatePropertyShape(\n {\n path: rdf.type,\n shape: Shape,\n },\n 'type',\n shacl.IRI,\n Shape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.property,\n shape: PropertyShape,\n contains: true, // a NodeShape owns its property shapes (cascade on delete)\n },\n 'properties',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: rdfs.comment,\n maxCount: 1,\n },'description',shacl.Literal, NodeShape);\n\ncreatePropertyShape({\n path: rdf.type,\n maxCount: 1,\n shape: Shape,\n},'type',shacl.IRI, NodeShape);\n\ncreatePropertyShape(\n {\n path: shacl.targetClass,\n shape: Shape, //should be rdfs Class, but that's currently not available in LINCD. So queries currently cannot continue after accessing targetClass\n maxCount: 1,\n },\n 'targetClass',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: shacl.targetNode,\n shape: Shape,//actually returns a NamedNode... is this correct then? Should we define or use a rdfs Class that matches the potential values?\n},'targetNode',shacl.IRI, NodeShape);\n\ncreatePropertyShape({\n path: coreOntology.isExtending,\n shape: NodeShape,\n},'extends',shacl.IRI, NodeShape);\n\n//currently path accepts multiple values, so its a multi-value property\n//these values will be consequent properties that follow each other. Other property paths are not supported yet.\ncreatePropertyShape(\n {\n // No fixed valueShape: sh:path is polymorphic (a predicate IRI, an rdf:List for a\n // sequence, or a PathNode for inverse/alt/cardinality). Omitting valueShape lets the\n // create pipeline use each value's own shape. Simple paths are passed as\n // {id} node references, complex paths as List/PathNode node-data.\n path: shacl.path,\n contains: true, // a property shape owns its complex path structure (List/PathNode)\n },\n 'path',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.node,\n shape: NodeShape,\n maxCount: 1,\n },\n 'valueShape',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n maxCount: 1,\n path: shacl.nodeKind,\n shape: Shape, //actually returns a NamedNode. Queries currently cannot continue after accessing nodeKind\n },\n 'nodeKind',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.datatype,\n shape: Shape,\n maxCount: 1,\n },\n 'datatype',\n shacl.IRI,\n PropertyShape,\n);\n\n//PropertyShape.maxCount\ncreatePropertyShape(\n {\n path: shacl.maxCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'maxCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.minCount\ncreatePropertyShape(\n {\n path: shacl.minCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'minCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.name\ncreatePropertyShape(\n {\n path: shacl.name,\n maxCount: 1,\n },\n 'name',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.description\ncreatePropertyShape(\n {\n path: shacl.description,\n maxCount: 1,\n },\n 'description',\n shacl.Literal,\n PropertyShape,\n);\n\n// ---------------------------------------------------------------------------\n// Remaining SHACL meta-model accessors for shape serialization.\n// Labels match the PropertyShapeData / NodeShapeData fields so syncShapes() can\n// build the create-pipeline data directly. `sh:in` is owned (contains, valueShape List).\n// ---------------------------------------------------------------------------\n\n// PropertyShape.class\ncreatePropertyShape(\n {path: shacl.class, shape: Shape, maxCount: 1},\n 'class',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.in → an rdf:List (owned)\ncreatePropertyShape(\n {path: shacl.in, shape: List, maxCount: 1, contains: true},\n 'in',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape pair constraints (values are property IRIs)\n// Labelled `equalsConstraint`, not `equals`: `equals` is a query-builder method, so a\n// property under that label is unreachable through the DSL (backlog 041). The name also\n// matches the `PropertyShapeData` field. The predicate stays sh:equals.\ncreatePropertyShape({path: shacl.equals, shape: Shape, maxCount: 1}, 'equalsConstraint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.disjoint, shape: Shape, maxCount: 1}, 'disjoint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.lessThan, shape: Shape, maxCount: 1}, 'lessThan', shacl.IRI, PropertyShape);\ncreatePropertyShape(\n {path: shacl.lessThanOrEquals, shape: Shape, maxCount: 1},\n 'lessThanOrEquals',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.hasValue (literal or IRI — generic)\ncreatePropertyShape({path: shacl.hasValue, maxCount: 1}, 'hasValue', null, PropertyShape);\n\n// PropertyShape.defaultValue (literal or IRI — generic, mirrors hasValue).\n// getResult() already emits `defaultValue`, but without this registration the\n// property is not queryable and a query referencing it throws before executing.\ncreatePropertyShape({path: shacl.defaultValue, maxCount: 1}, 'defaultValue', null, PropertyShape);\n\n// PropertyShape value-range / string-length / pattern constraints (report 021 §3, G5).\n// The range constraints carry no fixed datatype — the literal is typed from the JS value\n// (integer/double), mirroring the constrained property's own datatype. Length is an integer;\n// pattern is the regex source string.\ncreatePropertyShape({path: shacl.minInclusive, maxCount: 1}, 'minInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxInclusive, maxCount: 1}, 'maxInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.minExclusive, maxCount: 1}, 'minExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxExclusive, maxCount: 1}, 'maxExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape(\n {path: shacl.minLength, datatype: xsd.integer, maxCount: 1},\n 'minLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.maxLength, datatype: xsd.integer, maxCount: 1},\n 'maxLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.pattern, datatype: xsd.string, maxCount: 1},\n 'pattern',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.order / group\ncreatePropertyShape(\n {path: shacl.order, datatype: xsd.integer, maxCount: 1},\n 'order',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape({path: shacl.group, maxCount: 1}, 'group', shacl.Literal, PropertyShape);\n\n// PropertyShape.displayRank / displayHidden (linked_core: display vocabulary).\n// These materialize onto the pure sh:NodeShape and so travel with an ejected app.\ncreatePropertyShape(\n {path: coreOntology.displayRank, datatype: xsd.integer, maxCount: 1},\n 'displayRank',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: coreOntology.displayHidden, datatype: xsd.boolean, maxCount: 1},\n 'displayHidden',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.contains (linked_core:contains — persists the composition flag)\ncreatePropertyShape(\n {path: coreOntology.contains, datatype: xsd.boolean, maxCount: 1},\n 'contains',\n shacl.Literal,\n PropertyShape,\n);\n\n// NodeShape.closed / ignoredProperties / dependent\ncreatePropertyShape(\n {path: shacl.closed, datatype: xsd.boolean, maxCount: 1},\n 'closed',\n shacl.Literal,\n NodeShape,\n);\ncreatePropertyShape(\n {path: shacl.ignoredProperties, shape: Shape},\n 'ignoredProperties',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.dependent, datatype: xsd.boolean, maxCount: 1},\n 'dependent',\n shacl.Literal,\n NodeShape,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"Package.js","sourceRoot":"","sources":["../../../src/utils/Package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,mBAAmB,EAAqB,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAC,KAAK,EAAwB,MAAM,oBA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AyE;AACzE,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACjE,UAAU,EACV,KAAK,CAAC,OAAO,EACb,aAAa,CACd,CAAC;AAEF,mDAAmD;AACnD,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACxD,QAAQ,EACR,KAAK,CAAC,OAAO,EACb,SAAS,CACV,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAC,EAC7C,mBAAmB,EACnB,KAAK,CAAC,GAAG,EACT,SAAS,CACV,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EAClE,WAAW,EACX,KAAK,CAAC,OAAO,EACb,SAAS,CACV,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 {\n createPropertyShape,\n getAndClearCallbacks,\n getNodeShapeUri,\n getPackageUri,\n setPackagePublishConfig,\n NodeShape,\n PropertyShape,\n} from '../shapes/SHACL.js';\nimport {createNodeShapeData, type NodeShapeData} from '../shapes/nodeShapeData.js';\nimport {Shape, type ShapeConstructor} from '../shapes/Shape.js';\nimport {List} from '../shapes/List.class.js';\nimport {Prefix} from './Prefix.js';\nimport {coreOntology} from '../ontologies/linked-core.js';\nimport {rdf} from '../ontologies/rdf.js';\nimport {addNodeShapeToShapeClass,getShapeClass} from './ShapeClass.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {rdfs} from '../ontologies/rdfs.js';\nimport {xsd} from '../ontologies/xsd.js';\nimport type {NodeReferenceValue} from './NodeReference.js';\n\n//global tree\ndeclare var _linked: any;\ndeclare var window;\ndeclare var global;\n\n\n// var packageParsePromises: Map<string,Promise<any>> = new Map();\n// var loadedPackages: Set<NamedNode> = new Set();\nlet ontologies: Set<any> = new Set();\nlet _autoLoadOntologyData = false;\n/**\n * a map of requested property shapes for specific nodes\n * The value is a promise if it's still loading, or true if it is fully loaded\n */\n// type ClassDecorator = <T extends {new (...args: any[]): {}}>(\n// constructor: T,\n// ) => T;\n\nexport type ShapeConfig = {\n /**\n * The name this shape is identified by, overriding the class name.\n *\n * A shape's IRI is `<baseUri>shape/<package>/<name>`, and `Server.call`\n * routes on it — so the name is persisted data, not a label. Taking it from\n * `constructor.name` couples that data to how the code was compiled: a\n * minifier renames the class, and so does a plain name collision, because a\n * shape and the ontology term it targets deliberately share a name. Either\n * one silently changes what the shape *is*.\n *\n * Optional, and defaults to `constructor.name`, so existing shapes are\n * unaffected. Set it where the identity has to outlive the build.\n */\n name?: string;\n /**\n * A short description of the shape, what it represents and what it is used for.\n * will be stored as rdfs:comment on the shape node\n */\n description?: string;\n /**\n * Marks this shape's instances as *dependent* (composition / no independent existence):\n * they may be cascade-deleted when reached through a `contains` property.\n */\n dependent?: boolean;\n /**\n * Close the shape (sh:closed): target nodes with properties outside this shape are invalid.\n */\n closed?: boolean;\n /**\n * Properties permitted in addition to the declared ones when the shape is closed\n * (sh:ignoredProperties).\n */\n ignoredProperties?: NodeReferenceValue[];\n};\n\nexport type PackageMetadata = {\n id: string;\n packageName: string;\n type: NodeReferenceValue;\n};\n\n/**\n * This object, returned by [linkedPackage()](/docs/lincd.js/modules/utils_Module#linkedPackage),\n * contains the decorators to link different parts of a LINCD module.\n */\nexport interface LinkedPackageObject\n{\n /**\n * Links a typescript class to a SHACL shape.\n * This decorator creates a SHACL shape and looks at the static property [targetClass](/docs/lincd.js/classes/shapes_Shape.Shape#targetclass)\n * The rest of the shape is typically 'shaped' by methods that use [property decorators](/docs/lincd.js/modules/utils_ShapeDecorators).\n *\n * @example\n * Example of a typescript class using the \\@linkedShape decorator:\n * ```tsx\n * @linkedShape\n * export class Person extends Shape { ... }\n * ```\n * Or with options:\n * ```tsx\n * @linkedShape({ description: \"...\" })\n * export class Person extends Shape { ... }\n * ```\n */\n linkedShape: {\n <T extends typeof Shape>(constructor: T): void;\n <T extends typeof Shape>(config?: ShapeConfig): (constructor: T) => void;\n };\n /**\n * Use this decorator to make any other classes or functions available on demand to other LINCD modules.\n * It does not change the object it is applied on.\n * This is specifically required for their use in an open-ended LINCD application.\n *\n * @example\n * An example helper utility using the \\@linkedUtil decorator:\n * ```tsx\n * @linkedUtil\n * export class Sort {\n * static byName(persons:Person[]) {\n * return persons.sort((p1,p2) => p1.name < p2.name ? -1 : 1)\n * }\n * ```\n */\n linkedUtil: (constructor: any) => any;\n /**\n * Used to notify LINCD.js of an ontology.\n * See also the [Ontology guides](/docs/guides/linked-code/ontologies).\n *\n * @param allFileExports - all the objects that are exported by the ontology file (use `import * as _this from \"./path-to-this-file\")`)\n * @param nameSpace - the result of [createNameSpace](/docs/lincd.js/modules/utils_NameSpace#createnamespace). This allows consumers to generate NamedNodes that may not be listed in this ontology if needed\n * @param prefixAndFileName - a suggested prefix chosen by you. Make sure the suggestedPrefix matches the file name and the name of the exported object that groups all entities together\n * @param loadDataFunction - a method that loads _and parses_ the raw ontology data. This means the ontology will be loaded into the local graph. The returned result is mostly a JSONLDParsePromise (from lincd-jsonld/JSONLD, not bundled in LINCD.js)\n * @param dataSource - the relative path to the raw data of the ontology\n * @example\n * Example of an Ontology File that used linkedOntology()\n * ```tsx\n * import {NamedNode} from 'lincd/models';\n * import {JSONLD} from 'lincd-jsonld/JSONLD';\n * import {createNameSpace} from 'lincd/utils/NameSpace';\n * import {linkedOntology} from '../package.js';\n * import * as _this from './my.js-ontology';\n *\n * let dataFile = '../data/my.js-ontology.json';\n * export var loadData = () => JSONLD.parsePromise(import(dataFile));\n *\n * export var ns = createNameSpace('http://www.my-ontology.com/');\n *\n * export var _self: NamedNode = ns('');\n *\n * // Classes\n * export var ExampleClass: NamedNode = ns('ExampleClass');\n *\n * // Properties\n * export var exampleProperty: NamedNode = ns('exampleProperty');\n *\n * export const myOntology = {\n * ExampleClass,\n * exampleProperty,\n * };\n *\n * linkedOntology(_this, ns, 'myOntology', loadData, dataFile);\n * ```\n */\n linkedOntology: (\n allFileExports,\n nameSpace: (term: string) => NodeReferenceValue,\n suggestedPrefixAndFileName: string,\n loadDataFunction?: () => Promise<any>,\n dataSource?: string | string[],\n ) => void;\n /**\n * Low level method used by other decorators to write to the modules' object in the LINCD tree.\n * You should typically not need this.\n * @param exportFileName - the file name that this exported object is available under. Needs to be unique across the module.\n * @param exportedObject - the exported object (the class, constant, function, etc)\n */\n registerPackageExport: (exportedObject: any) => void;\n\n /**\n * Get a Shape subclass registered in this package by name.\n * Returns undefined if the shape is not registered or bundled.\n *\n * Useful for avoiding circular dependencies between shapes.\n * E.g. `getOneAs(..., getPackageShape('ImageObject'))` in Thing.ts\n * avoids importing ImageObject (which extends Thing).\n */\n getPackageShape: (name: string) => ShapeConstructor | undefined;\n /**\n * A reference to the modules' object in the LINCD tree.\n * Contains all linked components of the module.\n */\n packageExports: any;\n packageName: string;\n packageMetadata: PackageMetadata;\n\n /**\n * Register a file (a javascript module) and all its exported objects.\n * Specifically helpful for registering multiple functional components if you declare them without a function name\n * @param _this\n * @param _module\n */\n registerPackageModule(_module): void;\n}\n\nexport var DEFAULT_LIMIT = 12;\n\nexport function setDefaultPageLimit(limit: number)\n{\n DEFAULT_LIMIT = limit;\n}\n\nexport function autoLoadOntologyData(value: boolean)\n{\n _autoLoadOntologyData = value;\n //this may be set to true after some ontologies have already indexed,\n if (_autoLoadOntologyData)\n {\n // so in that case we load all data of ontologies that are already indexed\n ontologies.forEach((ontologyExport) => {\n //see linkedOntology() where we store the data loading method under the _load key\n if (ontologyExport['_load'])\n {\n ontologyExport['_load']();\n }\n });\n }\n}\n\n\nexport function linkedPackage(\n packageName: string,\n options?: {baseUri?: string},\n): LinkedPackageObject\n{\n // Declare the package's publish root before any shape/metadata IRI is built.\n // The slug is derived from `packageName`; only `baseUri` is configurable — CN\n // injects a workspace-scoped root for private packages, first-party packages\n // default to linked.cm.\n setPackagePublishConfig(packageName, options);\n let packageMetadata = registerPackageMetadata(packageName);\n let packageTreeObject = registerPackageInTree(packageName);\n\n //#Create declarators for this module\n let registerPackageExport = function(object) {\n // Plan-011 §I2 interim — \"Key X was already defined\" warning silenced\n // until the duplicate-instance root cause is investigated. With Vite\n // SSR resolving workspace packages from src/, package.ts evaluates\n // twice and every export key trips this warning. The overwrite is\n // safe because the second registration is the same class.\n packageTreeObject[object.name] = object;\n };\n\n let registerInPackageTree = function(exportName,exportedObject) {\n packageTreeObject[exportName] = exportedObject;\n };\n\n function registerPackageModule(_module): void\n {\n for (var key in _module.exports)\n {\n //if the exported object itself is not named or its name is _wrappedComponent\n //then we give it the same name as it's export name.\n if (\n !_module.exports[key].name ||\n _module.exports[key].name === '_wrappedComponent'\n )\n {\n Object.defineProperty(_module.exports[key],'name',{value: key});\n //manual 'hack' to set the name of the original function\n if (\n _module.exports[key]['original'] &&\n !_module.exports[key]['original']['name']\n )\n {\n Object.defineProperty(_module.exports[key]['original'],'name',{\n value: key + '_implementation',\n });\n }\n }\n registerInPackageTree(key,_module.exports[key]);\n }\n }\n\n //create a declarator function which Components of this module can use register themselves and add themselves to the global tree\n let linkedUtil = function(constructor) {\n //add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n //return the original class without modifications\n return constructor;\n };\n\n // helper that contains the previous body; applies the decorator work to a given constructor\n function applyLinkedShape<T extends typeof Shape>(\n constructor: T,\n options?: ShapeConfig,\n ): void\n {\n if(!constructor) {\n throw new Error('Constructor is undefined, skipping registration: '+constructor?.toString().substring(0,100)+' '+JSON.stringify(options));\n return;\n }\n // add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n // register the component and its shape\n Shape.registerByType(constructor);\n\n // Track the un-sanitized package name on the constructor so consumers\n // (e.g. LincdServerProxy) can route backend calls using the real module\n // specifier (e.g. '@_linked/server'), not the lossy URI-sanitized form\n // ('-_linked-server' — non-recoverable via decodeURIComponent).\n if (!Object.getOwnPropertyNames(constructor).includes('packageName')) {\n (constructor as any).packageName = packageName;\n }\n\n // if no shape object has been attached to the constructor\n if (!Object.getOwnPropertyNames(constructor).includes('shape'))\n {\n // The shape's identity. An explicit name wins; otherwise the class name,\n // which is what every existing shape relies on.\n const shapeName = options?.name ?? constructor.name;\n\n // A class name ending in a digit, with no explicit name given, is almost\n // always a bundler disambiguating a collision — `BackendAPIStore2` when\n // the ontology term of the same name took the binding first. The shape\n // then registers under an IRI the rest of the system will never ask for,\n // and the only symptom is a 501 several layers away. Say so here, where\n // it is cheap and early.\n if (!options?.name && /\\d$/.test(constructor.name)) {\n console.warn(\n `[linked] Shape '${constructor.name}' in '${packageName}' has a name ending in a digit, ` +\n `which usually means a bundler renamed it to avoid a collision — often with the ` +\n `ontology term it targets. Its IRI will not match what consumers ask for. ` +\n `Pass an explicit name: @linkedShape({name: '...'}).`,\n );\n }\n\n // create a new node shape (plain metadata object) for this shapeClass\n const nodeShape: NodeShapeData = createNodeShapeData(\n getNodeShapeUri(packageName, shapeName),\n );\n // connect the typescript class to its NodeShape\n constructor.shape = nodeShape;\n // set the name\n nodeShape.label = shapeName;\n\n if (options)\n {\n if (options.description)\n {\n nodeShape.description = options.description;\n }\n if (options.dependent)\n {\n nodeShape.dependent = true;\n }\n if (options.closed !== undefined)\n {\n nodeShape.closed = options.closed;\n }\n if (options.ignoredProperties)\n {\n nodeShape.ignoredProperties = options.ignoredProperties;\n }\n }\n\n // also keep track of the reverse: nodeShape to typescript class\n addNodeShapeToShapeClass(nodeShape,constructor);\n\n //track what extends what (nodeShape level)\n const extendingShapeClass = Object.getPrototypeOf(\n constructor,\n ) as typeof Shape;\n const extendingShape = extendingShapeClass.shape;\n //if this shape class is extending something other then Shape\n if (extendingShape && !(extendingShapeClass === Shape)) {\n //store which nodeShape this nodeShape extends\n nodeShape.extends = {id: extendingShape.id};\n }\n \n\n // run deferred callbacks from property decorators\n if (constructor['shapeCallbacks'])\n {\n constructor['shapeCallbacks'].forEach((callback) => {\n callback(nodeShape);\n });\n const nodeCallbacks = getAndClearCallbacks(nodeShape.id);\n if(nodeCallbacks) {\n nodeCallbacks.forEach((callback) => {\n callback(nodeShape);\n });\n }\n delete constructor['shapeCallbacks'];\n }\n }\n else\n {\n console.warn('This ShapeClass already has a shape: ',constructor.shape);\n }\n\n if (constructor.targetClass)\n {\n (constructor.shape as NodeShapeData).targetClass = constructor.targetClass;\n }\n\n // return the original class without modifications\n // return constructor;\n }\n\n // Overloaded signatures to support both usages\n function linkedShape<T extends typeof Shape>(constructor: T): void;\n function linkedShape<T extends typeof Shape>(\n options?: ShapeConfig,\n ): (constructor: T) => void;\n function linkedShape(arg?: any): void | ((constructor: any) => void)\n {\n // usage as @linkedShape\n if (typeof arg === 'function')\n {\n applyLinkedShape(arg);\n return;\n }\n // usage as @linkedShape({...}) or @linkedShape()\n const options: ShapeConfig | undefined = arg;\n return function <T extends typeof Shape>(constructor: T): void {\n applyLinkedShape(constructor,options);\n };\n }\n\n /**\n *\n * @param exports all exports of the file, simply provide \"this\" as value!\n * @param dataSource the path leading to the ontology's data file\n * @param nameSpace the base URI of the ontology\n * @param prefixAndFileName the file name MUST match the prefix for this ontology\n */\n let linkedOntology = function(\n exports,\n nameSpace: (term: string) => NodeReferenceValue,\n prefixAndFileName: string,\n loadData?,\n dataSource?: string | string[],\n ) {\n let exportsCopy = {...exports};\n //store specifics in exports. And make sure we can detect this as an ontology later\n exportsCopy['_ns'] = nameSpace;\n exportsCopy['_prefix'] = prefixAndFileName;\n exportsCopy['_load'] = loadData;\n exportsCopy['_data'] = dataSource;\n\n //register the prefix here (so just calling linkedOntology with a prefix will automatically register that prefix)\n if (prefixAndFileName)\n {\n //run the namespace without any term name, this will give back a named node with just the namespace as URI, then get that URI to provide it as full URI\n Prefix.add(prefixAndFileName,nameSpace('').id);\n }\n\n ontologies.add(exportsCopy);\n //register all the exports under the prefix. NOTE: this means the file name HAS to match the prefix\n registerInPackageTree(prefixAndFileName,exportsCopy);\n // });\n\n if (_autoLoadOntologyData)\n {\n loadData().catch((err) => {\n console.warn(\n 'Could not load ontology data. Do you need to rebuild the module of the ' +\n prefixAndFileName +\n ' ontology?',\n err,\n );\n });\n }\n };\n\n /**\n * This method is used to get a shape class in this package by its name.\n * This can be used to avoid circular dependencies between shapes.\n * @param name\n */\n let getPackageShape = (name: string): ShapeConstructor | undefined => {\n //get the named node of the node shape first,\n //then get the shape class that defines this node shape\n return getShapeClass(\n getNodeShapeUri(packageName, name),\n );\n };\n\n //return the declarators so the module can use them\n return {\n linkedShape,\n linkedUtil,\n linkedOntology,\n registerPackageExport,\n registerPackageModule,\n getPackageShape,\n packageExports: packageTreeObject,\n packageName: packageName,\n packageMetadata,\n } as LinkedPackageObject;\n}\n\nfunction registerPackageInTree(packageName,packageExports?)\n{\n //if something with this name already registered in the global tree\n if (packageName in _linked._modules)\n {\n // Plan-011 §I2 interim — silenced until the duplicate-Linked-instance\n // root cause is investigated. Vite SSR resolving workspace packages\n // from src/ for HMR causes each package.ts to evaluate twice, so this\n // warning fired ~80x per boot. Same package, same exports — the\n // Object.assign below preserves the registry correctly.\n Object.assign(_linked._modules[packageName],packageExports);\n }\n else\n {\n //initiate an empty object for this module in the global tree\n _linked._modules[packageName] = packageExports || {};\n }\n return _linked._modules[packageName];\n}\n\nfunction registerPackageMetadata(packageName: string): PackageMetadata\n{\n if (!_linked._packages)\n {\n _linked._packages = {};\n }\n if (packageName in _linked._packages)\n {\n return _linked._packages[packageName];\n }\n const packageMetadata: PackageMetadata = {\n id: getPackageUri(packageName),\n packageName,\n type: coreOntology.Package,\n };\n _linked._packages[packageName] = packageMetadata;\n return packageMetadata;\n}\n\n\nexport function initTree()\n{\n let globalObject =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : undefined;\n // Idempotent: if the global tree is already set up (by another copy of\n // this Package.ts in the same Node process — structural under Vite SSR,\n // which evaluates the file once for its own SSR transform AND once via\n // Node's resolver when a non-Vite import path reaches @_linked/core),\n // attach to it instead of throwing. Both instances write the same\n // _modules / _packages registry shape.\n //\n // Legacy `lincd` package's Package.ts (separate file) still throws on\n // dup — that throw signals a REAL problem (legacy `lincd` should never\n // load in a clean post-eradication state).\n if (!('_linked' in globalObject))\n {\n globalObject['_linked'] = {_modules: {}, _packages: {}};\n }\n}\n\n//when this file is used, make sure the tree is initialized\ninitTree();\n\n//now that this file is set up, we can link linked shapes in the core module itself\nexport const corePackage = linkedPackage('@_linked/core');\n// NodeShape, PropertyShape and List share their names with ontology terms (shacl.NodeShape,\n// shacl.PropertyShape, rdf.List), so a bundler may rename the classes. Explicit names keep\n// their IRIs independent of that.\ncorePackage.linkedShape({\n name: 'NodeShape',\n description:\n 'Represents a SHACL NodeShape; defines constraints for a class of RDF nodes. Links to multiple PropertyShapes. (schema, constraint, class validation)',\n})(NodeShape);\ncorePackage.linkedShape({\n name: 'PropertyShape',\n description:\n 'Represents a SHACL PropertyShape; specifies rules for one property of a NodeShape (path, datatype, cardinality). (validation rule, property constraint)',\n // A property shape has no independent existence — it is owned by its NodeShape via the\n // `contains` sh:property edge, so deleting the NodeShape cascade-deletes it.\n dependent: true,\n})(PropertyShape);\n// List is registered here, by value, because PropertyShape.in below uses it as its value\n// shape. Naming it by string instead would leave it unregistered for anyone who loads the\n// SHACL metamodel without importing shapes/List (backlog 045).\ncorePackage.linkedShape({\n name: 'List',\n dependent: true,\n})(List);\n// ValidationReport / ValidationResult removed in core metadata rewrite\n\n//ALL the following is to support Shape having get/set methods with property shapes\n//and Shape itself having a nodeShape\n//if we dont need Shape to have get/set methods (like label and type) then this can be removed\n// Base Shape IRI follows the same scheme as every other core shape:\n// https://linked.cm/shape/core/Shape (corePackage above declared slug 'core').\nShape.shape = createNodeShapeData(\n getNodeShapeUri('@_linked/core', 'Shape'),\n);\naddNodeShapeToShapeClass(Shape.shape,Shape);\n\n//Here we can register the properties of the Shape class itself\n//We can't do that inside of Shape because it would cause circular dependencies\ncreatePropertyShape({\n path: rdfs.label,\n //TODO: multiple labels should be possible\n maxCount: 1,//currently get label is implemented to return a single value\n },\n 'label',\n shacl.Literal,\n Shape,\n);\ncreatePropertyShape(\n {\n path: rdf.type,\n shape: Shape,\n },\n 'type',\n shacl.IRI,\n Shape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.property,\n shape: PropertyShape,\n contains: true, // a NodeShape owns its property shapes (cascade on delete)\n },\n 'properties',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: rdfs.comment,\n maxCount: 1,\n },'description',shacl.Literal, NodeShape);\n\ncreatePropertyShape({\n path: rdf.type,\n maxCount: 1,\n shape: Shape,\n},'type',shacl.IRI, NodeShape);\n\ncreatePropertyShape(\n {\n path: shacl.targetClass,\n shape: Shape, //should be rdfs Class, but that's currently not available in LINCD. So queries currently cannot continue after accessing targetClass\n maxCount: 1,\n },\n 'targetClass',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: shacl.targetNode,\n shape: Shape,//actually returns a NamedNode... is this correct then? Should we define or use a rdfs Class that matches the potential values?\n},'targetNode',shacl.IRI, NodeShape);\n\ncreatePropertyShape({\n path: coreOntology.isExtending,\n shape: NodeShape,\n},'extends',shacl.IRI, NodeShape);\n\n//currently path accepts multiple values, so its a multi-value property\n//these values will be consequent properties that follow each other. Other property paths are not supported yet.\ncreatePropertyShape(\n {\n // No fixed valueShape: sh:path is polymorphic (a predicate IRI, an rdf:List for a\n // sequence, or a PathNode for inverse/alt/cardinality). Omitting valueShape lets the\n // create pipeline use each value's own shape. Simple paths are passed as\n // {id} node references, complex paths as List/PathNode node-data.\n path: shacl.path,\n contains: true, // a property shape owns its complex path structure (List/PathNode)\n },\n 'path',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.node,\n shape: NodeShape,\n maxCount: 1,\n },\n 'valueShape',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n maxCount: 1,\n path: shacl.nodeKind,\n shape: Shape, //actually returns a NamedNode. Queries currently cannot continue after accessing nodeKind\n },\n 'nodeKind',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.datatype,\n shape: Shape,\n maxCount: 1,\n },\n 'datatype',\n shacl.IRI,\n PropertyShape,\n);\n\n//PropertyShape.maxCount\ncreatePropertyShape(\n {\n path: shacl.maxCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'maxCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.minCount\ncreatePropertyShape(\n {\n path: shacl.minCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'minCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.name\ncreatePropertyShape(\n {\n path: shacl.name,\n maxCount: 1,\n },\n 'name',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.description\ncreatePropertyShape(\n {\n path: shacl.description,\n maxCount: 1,\n },\n 'description',\n shacl.Literal,\n PropertyShape,\n);\n\n// ---------------------------------------------------------------------------\n// Remaining SHACL meta-model accessors for shape serialization.\n// Labels match the PropertyShapeData / NodeShapeData fields so syncShapes() can\n// build the create-pipeline data directly. `sh:in` is owned (contains, valueShape List).\n// ---------------------------------------------------------------------------\n\n// PropertyShape.class\ncreatePropertyShape(\n {path: shacl.class, shape: Shape, maxCount: 1},\n 'class',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.in → an rdf:List (owned)\ncreatePropertyShape(\n {path: shacl.in, shape: List, maxCount: 1, contains: true},\n 'in',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape pair constraints (values are property IRIs)\n// Labelled `equalsConstraint`, not `equals`: `equals` is a query-builder method, so a\n// property under that label is unreachable through the DSL (backlog 041). The name also\n// matches the `PropertyShapeData` field. The predicate stays sh:equals.\ncreatePropertyShape({path: shacl.equals, shape: Shape, maxCount: 1}, 'equalsConstraint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.disjoint, shape: Shape, maxCount: 1}, 'disjoint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.lessThan, shape: Shape, maxCount: 1}, 'lessThan', shacl.IRI, PropertyShape);\ncreatePropertyShape(\n {path: shacl.lessThanOrEquals, shape: Shape, maxCount: 1},\n 'lessThanOrEquals',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.hasValue (literal or IRI — generic)\ncreatePropertyShape({path: shacl.hasValue, maxCount: 1}, 'hasValue', null, PropertyShape);\n\n// PropertyShape.defaultValue (literal or IRI — generic, mirrors hasValue).\n// getResult() already emits `defaultValue`, but without this registration the\n// property is not queryable and a query referencing it throws before executing.\ncreatePropertyShape({path: shacl.defaultValue, maxCount: 1}, 'defaultValue', null, PropertyShape);\n\n// PropertyShape value-range / string-length / pattern constraints (report 021 §3, G5).\n// The range constraints carry no fixed datatype — the literal is typed from the JS value\n// (integer/double), mirroring the constrained property's own datatype. Length is an integer;\n// pattern is the regex source string.\ncreatePropertyShape({path: shacl.minInclusive, maxCount: 1}, 'minInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxInclusive, maxCount: 1}, 'maxInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.minExclusive, maxCount: 1}, 'minExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxExclusive, maxCount: 1}, 'maxExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape(\n {path: shacl.minLength, datatype: xsd.integer, maxCount: 1},\n 'minLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.maxLength, datatype: xsd.integer, maxCount: 1},\n 'maxLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.pattern, datatype: xsd.string, maxCount: 1},\n 'pattern',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.order / group\ncreatePropertyShape(\n {path: shacl.order, datatype: xsd.integer, maxCount: 1},\n 'order',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape({path: shacl.group, maxCount: 1}, 'group', shacl.Literal, PropertyShape);\n\n// PropertyShape.displayRank / displayHidden (core: display vocabulary).\n// These materialize onto the pure sh:NodeShape and so travel with an ejected app.\ncreatePropertyShape(\n {path: coreOntology.displayRank, datatype: xsd.integer, maxCount: 1},\n 'displayRank',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: coreOntology.displayHidden, datatype: xsd.boolean, maxCount: 1},\n 'displayHidden',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.contains (core:contains — persists the composition flag)\ncreatePropertyShape(\n {path: coreOntology.contains, datatype: xsd.boolean, maxCount: 1},\n 'contains',\n shacl.Literal,\n PropertyShape,\n);\n\n// NodeShape.closed / ignoredProperties / dependent\ncreatePropertyShape(\n {path: shacl.closed, datatype: xsd.boolean, maxCount: 1},\n 'closed',\n shacl.Literal,\n NodeShape,\n);\ncreatePropertyShape(\n {path: shacl.ignoredProperties, shape: Shape},\n 'ignoredProperties',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.dependent, datatype: xsd.boolean, maxCount: 1},\n 'dependent',\n shacl.Literal,\n NodeShape,\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_linked/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"packageManager": "npm@11.20.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"linkedPackage": true,
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@changesets/changelog-github": "^1.0.0",
|
|
66
66
|
"@changesets/cli": "^3.0.0",
|
|
67
|
-
"@jest/globals": "^
|
|
68
|
-
"@types/jest": "^
|
|
69
|
-
"@types/node": "^
|
|
70
|
-
"jest": "^
|
|
71
|
-
"rimraf": "^
|
|
67
|
+
"@jest/globals": "^30.0.0",
|
|
68
|
+
"@types/jest": "^30.0.0",
|
|
69
|
+
"@types/node": "^24.0.0",
|
|
70
|
+
"jest": "^30.0.0",
|
|
71
|
+
"rimraf": "^6.0.0",
|
|
72
72
|
"ts-jest": "^29.1.2",
|
|
73
73
|
"typescript": "^5.7.3"
|
|
74
74
|
},
|