@_linked/core 2.22.9 → 2.24.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 +41 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/shapes/List.class.d.ts +20 -0
- package/lib/esm/shapes/List.class.js +44 -0
- package/lib/esm/shapes/List.class.js.map +1 -0
- package/lib/esm/shapes/List.d.ts +3 -14
- package/lib/esm/shapes/List.js +5 -35
- package/lib/esm/shapes/List.js.map +1 -1
- package/lib/esm/shapes/PathNode.js +4 -1
- package/lib/esm/shapes/PathNode.js.map +1 -1
- package/lib/esm/shapes/index.d.ts +3 -0
- package/lib/esm/shapes/index.js +14 -0
- package/lib/esm/shapes/index.js.map +1 -0
- package/lib/esm/shapes/syncShapes.d.ts +28 -14
- package/lib/esm/shapes/syncShapes.js +17 -8
- package/lib/esm/shapes/syncShapes.js.map +1 -1
- package/lib/esm/utils/Package.js +14 -1
- package/lib/esm/utils/Package.js.map +1 -1
- package/package.json +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#285](https://github.com/linked-fw/core/pull/285) [`1ed3af6`](https://github.com/linked-fw/core/commit/1ed3af6e396929845092128702d03e31fa7fef50) Thanks [@flyon](https://github.com/flyon)! - `syncShapes()` no longer deletes store shapes it did not register, unless asked to.
|
|
8
|
+
|
|
9
|
+
The default `orphanScope` is now `'none'`: a sync delete→recreates the shapes registered in the
|
|
10
|
+
current process and leaves every other NodeShape in the dataset alone. Previously it defaulted to
|
|
11
|
+
`'all'` and treated every store shape not registered in the process as an orphan to cascade-delete.
|
|
12
|
+
|
|
13
|
+
That made partial loading destructive. Shapes are deep-importable one file at a time, and an
|
|
14
|
+
app-data dataset also holds shapes other writers put there, so "not registered here" does not mean
|
|
15
|
+
"removed from code". Measured on a dataset holding the 36 `@_linked/schema` shapes: a process that
|
|
16
|
+
imported only `@_linked/schema/shapes/Thing` (11 registered) deleted the other 25, under both
|
|
17
|
+
`'all'` and `'ownedNamespaces'`; a process that imported no shapes deleted all 36.
|
|
18
|
+
|
|
19
|
+
**Migrating:** a caller that relies on the sync removing shapes deleted from code must now pass
|
|
20
|
+
`{orphanScope: 'all'}` (sole writer, every shape loaded) or `{orphanScope: 'ownedNamespaces'}`
|
|
21
|
+
explicitly: `await syncShapes(ds, {orphanScope: 'all'})`.
|
|
22
|
+
|
|
23
|
+
## 2.23.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- [#282](https://github.com/linked-fw/core/pull/282) [`32834ea`](https://github.com/linked-fw/core/commit/32834ea450a2bd7ae98e77758ccbca322d94a4d3) Thanks [@flyon](https://github.com/flyon)! - Every core shape is now registered by whatever loads it, including under a bundler.
|
|
28
|
+
|
|
29
|
+
- `PropertyShape.in` (sh:in) refers to `List` by value instead of by name, and `List` is
|
|
30
|
+
registered from `utils/Package.ts` next to `NodeShape` and `PropertyShape`. Loading the SHACL
|
|
31
|
+
metamodel (`package.js` + `shapes/SHACL.js`) is now enough to query or create `in`; before,
|
|
32
|
+
that threw `Shape class not found for https://linked.cm/shape/core/List` unless something
|
|
33
|
+
else had loaded `shapes/List`.
|
|
34
|
+
- New `@_linked/core/shapes/index`: a side-effect-only module that loads every shape core
|
|
35
|
+
defines. The package entry imports it.
|
|
36
|
+
- `sideEffects` now includes `shapes/*` and the package entry. Before, a bundler dropped a bare
|
|
37
|
+
`import '@_linked/core/shapes/List'`, and `import {validate} from '@_linked/core'` registered
|
|
38
|
+
no core shape at all. A consumer of the entry now bundles the SHACL metamodel with it
|
|
39
|
+
(measured: +40 kB unminified in a Vite build that imports only `validate`).
|
|
40
|
+
- `PathNode`, `NodeShape` and `PropertyShape` have explicit shape names. Bundled, `PathNode`
|
|
41
|
+
collided with the ontology term `coreOntology.PathNode` and was renamed `PathNode2`, which
|
|
42
|
+
registered it under the wrong IRI. Their IRIs are unchanged.
|
|
43
|
+
|
|
3
44
|
## 2.22.9
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
4
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
+
// Registers every shape core defines (side effects only).
|
|
7
|
+
import './shapes/index.js';
|
|
6
8
|
export { syncShapes, syncShape } from './shapes/syncShapes.js';
|
|
7
9
|
export { rdfList } from './shapes/List.js';
|
|
8
10
|
export { serializePathToNodeData } from './shapes/serializePathToNodeData.js';
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,sEAAsE;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,kEAAkE;AAClE,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAQnF,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,2CAA2C;AAC3C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAEzE,sBAAsB;AACtB,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAM/C,+BAA+B;AAC/B,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAGzD,8CAA8C;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAe3C,sEAAsE;AACtE,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,iBAAiB,GAClB,MAAM,gCAAgC,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 */\nexport {syncShapes, syncShape} from './shapes/syncShapes.js';\nexport {rdfList} from './shapes/List.js';\nexport {serializePathToNodeData} from './shapes/serializePathToNodeData.js';\n// Core public API surface (documented as root imports in the README).\nexport {Shape} from './shapes/Shape.js';\n// SHACL-aligned validation of plain data objects against a shape.\nexport {validate, assertValid, ShapeValidationError} from './shapes/validation.js';\nexport type {\n ValidationReport,\n ValidationResult,\n ValidationMode,\n ValidateOptions,\n ValidatableShape,\n} from './shapes/validation.js';\nexport {LinkedStorage} from './utils/LinkedStorage.js';\n// New dynamic query building API (Phase 2)\nexport {SelectBuilder, QueryBuilder} from './queries/QueryBuilder.js';\nexport {lower} from './queries/lower.js';\nexport type {LowerableQuery} from './queries/lower.js';\nexport {fromJSON} from './queries/fromJSON.js';\nexport type {QueryJSON} from './queries/fromJSON.js';\nexport {\n getQueryContext,\n setQueryContext,\n subscribeQueryContext,\n PendingQueryContext,\n UnresolvedContextError,\n} from './queries/QueryContext.js';\nexport {\n CONTEXT_REF_KEY,\n encodeContextRef,\n isContextRefJSON,\n resolveContextId,\n} from './queries/ContextRef.js';\nexport type {ContextRefJSON} from './queries/ContextRef.js';\nexport {PropertyPath, walkPropertyPath} from './queries/PropertyPath.js';\n\n// Phase 3a — FieldSet\nexport {FieldSet} from './queries/FieldSet.js';\nexport type {FieldSetEntry, FieldSetInput, FieldSetJSON, FieldSetFieldJSON} from './queries/FieldSet.js';\n\n// Phase 4 — Serialization types\nexport type {QueryBuilderJSON} from './queries/QueryBuilder.js';\n\n// Phase 3b — Mutation builders\nexport {AskBuilder, isAskQuery} from './queries/AskBuilder.js';\nexport type {AskSpec} from './queries/AskBuilder.js';\nexport type {AskQuery, AskQueryJSON, RawAskInput} from './queries/AskQuery.js';\nexport {CountBuilder, isCountQuery} from './queries/CountBuilder.js';\nexport type {CountSpec} from './queries/CountBuilder.js';\nexport type {CountQuery, CountQueryJSON, RawCountInput} from './queries/CountQuery.js';\nexport {CreateBuilder} from './queries/CreateBuilder.js';\nexport {UpdateBuilder} from './queries/UpdateBuilder.js';\nexport {DeleteBuilder} from './queries/DeleteBuilder.js';\nexport type {DeleteId} from './queries/DeleteBuilder.js';\n\n// Expressions — computed fields and functions\nexport {ExpressionNode} from './expressions/ExpressionNode.js';\nexport type {ExpressionInput, PropertyRefMap} from './expressions/ExpressionNode.js';\nexport {Expr} from './expressions/Expr.js';\nexport type {\n ExpressionUpdateProxy,\n ExpressionUpdateResult,\n BaseExpressionMethods,\n NumericExpressionMethods,\n StringExpressionMethods,\n DateExpressionMethods,\n BooleanExpressionMethods,\n} from './expressions/ExpressionMethods.js';\n\n// Phase 5 — Component query integration\nexport type {LinkedComponentInterface, QueryComponentLike} from './queries/SelectQuery.js';\n\n\n// Mutation DSL-JSON serialization (create/update/delete to/from JSON)\nexport {\n encodeNodeData,\n encodeValue,\n} from './queries/MutationSerialization.js';\nexport {\n decodeNodeData,\n lowerMutationJSON,\n} from './queries/lowerMutationJSON.js';\nexport type {\n MutationJSON,\n CreateMutationJSON,\n UpdateMutationJSON,\n DeleteMutationJSON,\n MutationValueJSON,\n MutationNodeDataJSON,\n} from './queries/MutationSerialization.js';\n\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0DAA0D;AAC1D,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,sEAAsE;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,kEAAkE;AAClE,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAQnF,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,2CAA2C;AAC3C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAEzE,sBAAsB;AACtB,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAM/C,+BAA+B;AAC/B,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAGzD,8CAA8C;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAe3C,sEAAsE;AACtE,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,iBAAiB,GAClB,MAAM,gCAAgC,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n// Registers every shape core defines (side effects only).\nimport './shapes/index.js';\nexport {syncShapes, syncShape} from './shapes/syncShapes.js';\nexport {rdfList} from './shapes/List.js';\nexport {serializePathToNodeData} from './shapes/serializePathToNodeData.js';\n// Core public API surface (documented as root imports in the README).\nexport {Shape} from './shapes/Shape.js';\n// SHACL-aligned validation of plain data objects against a shape.\nexport {validate, assertValid, ShapeValidationError} from './shapes/validation.js';\nexport type {\n ValidationReport,\n ValidationResult,\n ValidationMode,\n ValidateOptions,\n ValidatableShape,\n} from './shapes/validation.js';\nexport {LinkedStorage} from './utils/LinkedStorage.js';\n// New dynamic query building API (Phase 2)\nexport {SelectBuilder, QueryBuilder} from './queries/QueryBuilder.js';\nexport {lower} from './queries/lower.js';\nexport type {LowerableQuery} from './queries/lower.js';\nexport {fromJSON} from './queries/fromJSON.js';\nexport type {QueryJSON} from './queries/fromJSON.js';\nexport {\n getQueryContext,\n setQueryContext,\n subscribeQueryContext,\n PendingQueryContext,\n UnresolvedContextError,\n} from './queries/QueryContext.js';\nexport {\n CONTEXT_REF_KEY,\n encodeContextRef,\n isContextRefJSON,\n resolveContextId,\n} from './queries/ContextRef.js';\nexport type {ContextRefJSON} from './queries/ContextRef.js';\nexport {PropertyPath, walkPropertyPath} from './queries/PropertyPath.js';\n\n// Phase 3a — FieldSet\nexport {FieldSet} from './queries/FieldSet.js';\nexport type {FieldSetEntry, FieldSetInput, FieldSetJSON, FieldSetFieldJSON} from './queries/FieldSet.js';\n\n// Phase 4 — Serialization types\nexport type {QueryBuilderJSON} from './queries/QueryBuilder.js';\n\n// Phase 3b — Mutation builders\nexport {AskBuilder, isAskQuery} from './queries/AskBuilder.js';\nexport type {AskSpec} from './queries/AskBuilder.js';\nexport type {AskQuery, AskQueryJSON, RawAskInput} from './queries/AskQuery.js';\nexport {CountBuilder, isCountQuery} from './queries/CountBuilder.js';\nexport type {CountSpec} from './queries/CountBuilder.js';\nexport type {CountQuery, CountQueryJSON, RawCountInput} from './queries/CountQuery.js';\nexport {CreateBuilder} from './queries/CreateBuilder.js';\nexport {UpdateBuilder} from './queries/UpdateBuilder.js';\nexport {DeleteBuilder} from './queries/DeleteBuilder.js';\nexport type {DeleteId} from './queries/DeleteBuilder.js';\n\n// Expressions — computed fields and functions\nexport {ExpressionNode} from './expressions/ExpressionNode.js';\nexport type {ExpressionInput, PropertyRefMap} from './expressions/ExpressionNode.js';\nexport {Expr} from './expressions/Expr.js';\nexport type {\n ExpressionUpdateProxy,\n ExpressionUpdateResult,\n BaseExpressionMethods,\n NumericExpressionMethods,\n StringExpressionMethods,\n DateExpressionMethods,\n BooleanExpressionMethods,\n} from './expressions/ExpressionMethods.js';\n\n// Phase 5 — Component query integration\nexport type {LinkedComponentInterface, QueryComponentLike} from './queries/SelectQuery.js';\n\n\n// Mutation DSL-JSON serialization (create/update/delete to/from JSON)\nexport {\n encodeNodeData,\n encodeValue,\n} from './queries/MutationSerialization.js';\nexport {\n decodeNodeData,\n lowerMutationJSON,\n} from './queries/lowerMutationJSON.js';\nexport type {\n MutationJSON,\n CreateMutationJSON,\n UpdateMutationJSON,\n DeleteMutationJSON,\n MutationValueJSON,\n MutationNodeDataJSON,\n} from './queries/MutationSerialization.js';\n\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Shape } from './Shape.js';
|
|
2
|
+
/**
|
|
3
|
+
* SHACL/RDF ordered-list cell shape (`rdf:List`).
|
|
4
|
+
*
|
|
5
|
+
* A list is a chain of cells: `first` holds the value, `rest` points to the next cell
|
|
6
|
+
* (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is
|
|
7
|
+
* a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while
|
|
8
|
+
* `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.
|
|
9
|
+
*
|
|
10
|
+
* This module holds the class only, and must never import `package.js`: `utils/Package.ts`
|
|
11
|
+
* imports it to register `List` by value (as it does NodeShape and PropertyShape) and to use
|
|
12
|
+
* it as the value shape of `PropertyShape.in`. Importing `package.js` from here would be a
|
|
13
|
+
* cycle, with `corePackage` still uninitialised when this module evaluates. The public module
|
|
14
|
+
* is `List.ts`, which loads the registration.
|
|
15
|
+
*/
|
|
16
|
+
export declare class List<T = unknown> extends Shape {
|
|
17
|
+
static targetClass: import("../utils/NodeReference.js").NodeReferenceValue;
|
|
18
|
+
get first(): T;
|
|
19
|
+
get rest(): List<T>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/*
|
|
8
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
9
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
10
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
11
|
+
*/
|
|
12
|
+
import { Shape } from './Shape.js';
|
|
13
|
+
import { linkedProperty, objectProperty } from './SHACL.js';
|
|
14
|
+
import { rdf } from '../ontologies/rdf.js';
|
|
15
|
+
/**
|
|
16
|
+
* SHACL/RDF ordered-list cell shape (`rdf:List`).
|
|
17
|
+
*
|
|
18
|
+
* A list is a chain of cells: `first` holds the value, `rest` points to the next cell
|
|
19
|
+
* (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is
|
|
20
|
+
* a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while
|
|
21
|
+
* `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.
|
|
22
|
+
*
|
|
23
|
+
* This module holds the class only, and must never import `package.js`: `utils/Package.ts`
|
|
24
|
+
* imports it to register `List` by value (as it does NodeShape and PropertyShape) and to use
|
|
25
|
+
* it as the value shape of `PropertyShape.in`. Importing `package.js` from here would be a
|
|
26
|
+
* cycle, with `corePackage` still uninitialised when this module evaluates. The public module
|
|
27
|
+
* is `List.ts`, which loads the registration.
|
|
28
|
+
*/
|
|
29
|
+
export class List extends Shape {
|
|
30
|
+
get first() {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
get rest() {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
List.targetClass = rdf.List;
|
|
38
|
+
__decorate([
|
|
39
|
+
linkedProperty({ path: rdf.first, maxCount: 1 })
|
|
40
|
+
], List.prototype, "first", null);
|
|
41
|
+
__decorate([
|
|
42
|
+
objectProperty({ path: rdf.rest, maxCount: 1, shape: List, contains: true })
|
|
43
|
+
], List.prototype, "rest", null);
|
|
44
|
+
//# sourceMappingURL=List.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.class.js","sourceRoot":"","sources":["../../../src/shapes/List.class.ts"],"names":[],"mappings":";;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,IAAkB,SAAQ,KAAK;IAI1C,IAAI,KAAK;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAGD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC;IACd,CAAC;;AAVM,gBAAW,GAAG,GAAG,CAAC,IAAI,CAAC;AAG9B;IADC,cAAc,CAAC,EAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAC,CAAC;iCAG9C;AAGD;IADC,cAAc,CAAC,EAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;gCAG1E","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 {Shape} from './Shape.js';\nimport {linkedProperty, objectProperty} from './SHACL.js';\nimport {rdf} from '../ontologies/rdf.js';\n\n/**\n * SHACL/RDF ordered-list cell shape (`rdf:List`).\n *\n * A list is a chain of cells: `first` holds the value, `rest` points to the next cell\n * (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is\n * a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while\n * `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.\n *\n * This module holds the class only, and must never import `package.js`: `utils/Package.ts`\n * imports it to register `List` by value (as it does NodeShape and PropertyShape) and to use\n * it as the value shape of `PropertyShape.in`. Importing `package.js` from here would be a\n * cycle, with `corePackage` still uninitialised when this module evaluates. The public module\n * is `List.ts`, which loads the registration.\n */\nexport class List<T = unknown> extends Shape {\n static targetClass = rdf.List;\n\n @linkedProperty({path: rdf.first, maxCount: 1})\n get first(): T {\n return null;\n }\n\n @objectProperty({path: rdf.rest, maxCount: 1, shape: List, contains: true})\n get rest(): List<T> {\n return null;\n }\n}\n"]}
|
package/lib/esm/shapes/List.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* A list is a chain of cells: `first` holds the value, `rest` points to the next cell
|
|
6
|
-
* (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is
|
|
7
|
-
* a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while
|
|
8
|
-
* `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.
|
|
9
|
-
*/
|
|
10
|
-
export declare class List<T = unknown> extends Shape {
|
|
11
|
-
static targetClass: import("../utils/NodeReference.js").NodeReferenceValue;
|
|
12
|
-
get first(): T;
|
|
13
|
-
get rest(): List<T>;
|
|
14
|
-
}
|
|
1
|
+
import '../utils/Package.js';
|
|
2
|
+
import { List } from './List.class.js';
|
|
3
|
+
export { List };
|
|
15
4
|
/**
|
|
16
5
|
* Node-data for a single cell / the `rdf:nil` terminal. Accepted by the create pipeline.
|
|
17
6
|
*/
|
package/lib/esm/shapes/List.js
CHANGED
|
@@ -1,44 +1,14 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
1
|
/*
|
|
8
2
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
9
3
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
10
4
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
11
5
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
// Registers List (together with the rest of the SHACL metamodel), so importing this module
|
|
7
|
+
// on its own is enough to make List resolvable. The class lives in List.class.ts because
|
|
8
|
+
// utils/Package.ts needs it by value and cannot import this module's registration path.
|
|
9
|
+
import '../utils/Package.js';
|
|
10
|
+
import { List } from './List.class.js';
|
|
15
11
|
import { rdf } from '../ontologies/rdf.js';
|
|
16
|
-
/**
|
|
17
|
-
* SHACL/RDF ordered-list cell shape (`rdf:List`).
|
|
18
|
-
*
|
|
19
|
-
* A list is a chain of cells: `first` holds the value, `rest` points to the next cell
|
|
20
|
-
* (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is
|
|
21
|
-
* a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while
|
|
22
|
-
* `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.
|
|
23
|
-
*/
|
|
24
|
-
let List = class List extends Shape {
|
|
25
|
-
get first() {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
get rest() {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
List.targetClass = rdf.List;
|
|
33
|
-
__decorate([
|
|
34
|
-
linkedProperty({ path: rdf.first, maxCount: 1 })
|
|
35
|
-
], List.prototype, "first", null);
|
|
36
|
-
__decorate([
|
|
37
|
-
objectProperty({ path: rdf.rest, maxCount: 1, shape: List, contains: true })
|
|
38
|
-
], List.prototype, "rest", null);
|
|
39
|
-
List = __decorate([
|
|
40
|
-
linkedShape({ dependent: true })
|
|
41
|
-
], List);
|
|
42
12
|
export { List };
|
|
43
13
|
/**
|
|
44
14
|
* Build the nested `List` node-data chain for an ordered `rdf:List`, terminating at `rdf:nil`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/shapes/List.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/shapes/List.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,2FAA2F;AAC3F,yFAAyF;AACzF,wFAAwF;AACxF,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAC;AAEzC,OAAO,EAAC,IAAI,EAAC,CAAC;AASd;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CACrB,KAAU,EACV,IAAsB;IAEtB,MAAM,IAAI,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,CAAC,CAAS,EAAmB,EAAE;QAC3C,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACtB,OAAO,EAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAC,CAAC;QAC1B,CAAC;QACD,MAAM,IAAI,GAAoB;YAC5B,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YACf,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;SACnB,CAAC;QACF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n// Registers List (together with the rest of the SHACL metamodel), so importing this module\n// on its own is enough to make List resolvable. The class lives in List.class.ts because\n// utils/Package.ts needs it by value and cannot import this module's registration path.\nimport '../utils/Package.js';\nimport {List} from './List.class.js';\nimport {rdf} from '../ontologies/rdf.js';\n\nexport {List};\n\n/**\n * Node-data for a single cell / the `rdf:nil` terminal. Accepted by the create pipeline.\n */\nexport type RdfListNodeData =\n | {id: string}\n | {shape: typeof List; first: unknown; rest: RdfListNodeData; __id?: string};\n\n/**\n * Build the nested `List` node-data chain for an ordered `rdf:List`, terminating at `rdf:nil`.\n * Pass `opts.base` to mint deterministic cell ids (`{base}/0`, `{base}/1`, …); otherwise the\n * create pipeline mints ids. The empty list serializes to `rdf:nil`.\n *\n * @example Playlist.create({ tracks: rdfList([t1, t2, t3]) })\n */\nexport function rdfList<T>(\n items: T[],\n opts?: {base?: string},\n): RdfListNodeData {\n const base = opts?.base;\n const build = (i: number): RdfListNodeData => {\n if (i >= items.length) {\n return {id: rdf.nil.id};\n }\n const cell: RdfListNodeData = {\n shape: List,\n first: items[i],\n rest: build(i + 1),\n };\n if (base !== undefined) {\n cell.__id = `${base}/${i}`;\n }\n return cell;\n };\n return build(0);\n}\n"]}
|
|
@@ -25,6 +25,9 @@ import { List } from './List.js';
|
|
|
25
25
|
* Operands are polymorphic (a predicate IRI, a nested `PathNode`, or a `List`), so no fixed
|
|
26
26
|
* `valueShape` is declared except for `alternativePath`, which is always an `rdf:List`.
|
|
27
27
|
*/
|
|
28
|
+
// Named explicitly: the class shares its name with the ontology term coreOntology.PathNode,
|
|
29
|
+
// and a bundler resolving that collision renames the class (PathNode2), which would change
|
|
30
|
+
// the shape's IRI.
|
|
28
31
|
let PathNode = class PathNode extends Shape {
|
|
29
32
|
get inversePath() {
|
|
30
33
|
return null;
|
|
@@ -59,7 +62,7 @@ __decorate([
|
|
|
59
62
|
objectProperty({ path: shacl.zeroOrOnePath, maxCount: 1, contains: true })
|
|
60
63
|
], PathNode.prototype, "zeroOrOnePath", null);
|
|
61
64
|
PathNode = __decorate([
|
|
62
|
-
linkedShape({ dependent: true })
|
|
65
|
+
linkedShape({ name: 'PathNode', dependent: true })
|
|
63
66
|
], PathNode);
|
|
64
67
|
export { PathNode };
|
|
65
68
|
//# sourceMappingURL=PathNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathNode.js","sourceRoot":"","sources":["../../../src/shapes/PathNode.ts"],"names":[],"mappings":";;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"PathNode.js","sourceRoot":"","sources":["../../../src/shapes/PathNode.ts"],"names":[],"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a,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;6CAGxE;AAGD;IADC,cAAc,CAAC,EAAC,IAAI,EAAE,KAAK,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;6CAGxE;AA1BU,QAAQ;IADpB,WAAW,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC;GACpC,QAAQ,CA2BpB","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 {linkedShape} from '../package.js';\nimport {Shape} from './Shape.js';\nimport {objectProperty} from './SHACL.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {coreOntology} from '../ontologies/linked-core.js';\nimport {List} from './List.js';\n\n/**\n * Operator node for SHACL property paths that are NOT a simple predicate or a sequence:\n * inverse (`sh:inversePath`), alternative (`sh:alternativePath` → an `rdf:List`), and the\n * cardinality forms (`sh:zeroOrMorePath`/`sh:oneOrMorePath`/`sh:zeroOrOnePath`).\n *\n * Each operator edge is `contains` (the operand subtree is owned), and the node itself is\n * `dependent`, so a property-shape's complex `sh:path` cascade-cleans on delete/replace.\n * Operands are polymorphic (a predicate IRI, a nested `PathNode`, or a `List`), so no fixed\n * `valueShape` is declared except for `alternativePath`, which is always an `rdf:List`.\n */\n// Named explicitly: the class shares its name with the ontology term coreOntology.PathNode,\n// and a bundler resolving that collision renames the class (PathNode2), which would change\n// the shape's IRI.\n@linkedShape({name: 'PathNode', dependent: true})\nexport class PathNode extends Shape {\n static targetClass = coreOntology.PathNode;\n\n @objectProperty({path: shacl.inversePath, maxCount: 1, contains: true})\n get inversePath(): unknown {\n return null;\n }\n\n @objectProperty({path: shacl.alternativePath, maxCount: 1, shape: List, contains: true})\n get alternativePath(): List {\n return null;\n }\n\n @objectProperty({path: shacl.zeroOrMorePath, maxCount: 1, contains: true})\n get zeroOrMorePath(): unknown {\n return null;\n }\n\n @objectProperty({path: shacl.oneOrMorePath, maxCount: 1, contains: true})\n get oneOrMorePath(): unknown {\n return null;\n }\n\n @objectProperty({path: shacl.zeroOrOnePath, maxCount: 1, contains: true})\n get zeroOrOnePath(): unknown {\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
// Loads every shape @_linked/core defines, for their registration side effects only.
|
|
7
|
+
// Consumers: `import '@_linked/core/shapes/index'`. Nothing is exported from here.
|
|
8
|
+
//
|
|
9
|
+
// Shape, NodeShape, PropertyShape and List are registered by utils/Package.ts, because the
|
|
10
|
+
// SHACL metamodel cannot decorate itself. List.js loads it; SHACL.js alone does not.
|
|
11
|
+
import './SHACL.js';
|
|
12
|
+
import './List.js';
|
|
13
|
+
import './PathNode.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shapes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qFAAqF;AACrF,mFAAmF;AACnF,EAAE;AACF,2FAA2F;AAC3F,qFAAqF;AACrF,OAAO,YAAY,CAAC;AACpB,OAAO,WAAW,CAAC;AACnB,OAAO,eAAe,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n// Loads every shape @_linked/core defines, for their registration side effects only.\n// Consumers: `import '@_linked/core/shapes/index'`. Nothing is exported from here.\n//\n// Shape, NodeShape, PropertyShape and List are registered by utils/Package.ts, because the\n// SHACL metamodel cannot decorate itself. List.js loads it; SHACL.js alone does not.\nimport './SHACL.js';\nimport './List.js';\nimport './PathNode.js';\n"]}
|
|
@@ -11,15 +11,20 @@ export declare function buildPropertyShapeData(ps: PropertyShapeData, shapeIri:
|
|
|
11
11
|
export interface SyncShapesOptions {
|
|
12
12
|
/**
|
|
13
13
|
* How to treat NodeShapes present in the store but not in the current process's code:
|
|
14
|
-
* - `'
|
|
15
|
-
*
|
|
14
|
+
* - `'none'` (default) — never prune; purely additive (delete→recreate the code shapes, touch
|
|
15
|
+
* nothing else). The only mode that is safe when the process has loaded a *subset* of the
|
|
16
|
+
* shapes in the dataset, or when the dataset has more than one writer.
|
|
17
|
+
* - `'all'` — prune every store-only shape as an orphan. Only correct when this process has
|
|
18
|
+
* loaded **every** shape the dataset should hold and is its **only** writer; "not registered
|
|
19
|
+
* here" is then taken to mean "deleted from code".
|
|
16
20
|
* - `'ownedNamespaces'` — prune a store-only shape ONLY if its IRI falls within a namespace
|
|
17
21
|
* this process actually writes (the package-namespace of one of its code-registered shapes,
|
|
18
|
-
* i.e. the IRI prefix up to the last `/` or `#`).
|
|
19
|
-
* one app-data dataset, several writers)
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* i.e. the IRI prefix up to the last `/` or `#`). Protects other writers' packages (arch-04:
|
|
23
|
+
* one app-data dataset, several writers), but NOT the rest of a package the process only
|
|
24
|
+
* partially loaded — the namespace is the whole package, so a deep import of one shape file
|
|
25
|
+
* still claims all of it.
|
|
26
|
+
*
|
|
27
|
+
* `'all'` and `'ownedNamespaces'` are destructive and must be requested explicitly.
|
|
23
28
|
*/
|
|
24
29
|
orphanScope?: 'all' | 'ownedNamespaces' | 'none';
|
|
25
30
|
}
|
|
@@ -33,17 +38,26 @@ export interface SyncShapesOptions {
|
|
|
33
38
|
* ```
|
|
34
39
|
* Each in-code shape's thunk runs `delete → create` in order (the delete cascade-cleans the old
|
|
35
40
|
* property shapes / list / path subtrees via the containment cascade, the create rebuilds them).
|
|
36
|
-
*
|
|
37
|
-
*
|
|
41
|
+
*
|
|
42
|
+
* **Shapes in the store but not registered in this process are left alone by default**
|
|
43
|
+
* (`orphanScope: 'none'`). The registry only holds what this process happened to import, and
|
|
44
|
+
* that is routinely a subset of what the dataset holds: shapes are deep-importable one file at a
|
|
45
|
+
* time, and an app-data dataset also holds shapes other writers materialized (CN's
|
|
46
|
+
* `bindShape` / `enableCapability`). "Not registered here" therefore does not mean "deleted from
|
|
47
|
+
* code". Measured against a dataset holding the 36 `@_linked/schema` shapes: a process that
|
|
48
|
+
* imported only `@_linked/schema/shapes/Thing` (11 shapes registered) deleted the other 25 under
|
|
49
|
+
* both `'all'` and `'ownedNamespaces'`, and a process that imported no shapes deleted all 36.
|
|
50
|
+
*
|
|
51
|
+
* Pruning is opt-in via `options.orphanScope` (see {@link SyncShapesOptions}): pass `'all'` only
|
|
52
|
+
* from a process that has loaded every shape the dataset should hold and is its sole writer, and
|
|
53
|
+
* `'ownedNamespaces'` only when it has loaded every shape of each package it registers. Pruned
|
|
54
|
+
* orphans are deleted with their owned subtree. Pruning reads the existing shape IRIs first;
|
|
55
|
+
* with `'none'` no read is made.
|
|
38
56
|
*
|
|
39
57
|
* `ds` (optional) targets an explicit dataset instead of the global router. It is a **plan-time**
|
|
40
58
|
* parameter: it feeds both the orphan-detection read (so orphans are computed against the same
|
|
41
|
-
* store they'll be pruned from) and every delete/create thunk. Omitted →
|
|
59
|
+
* store they'll be pruned from) and every delete/create thunk. Omitted → the global router;
|
|
42
60
|
* the returned thunks stay nullary either way.
|
|
43
|
-
*
|
|
44
|
-
* `options.orphanScope` (default `'all'`) scopes the orphan sweep — see {@link SyncShapesOptions}.
|
|
45
|
-
* Multi-writer datasets (an app materializing on boot next to CN's capability shapes) MUST pass
|
|
46
|
-
* `'ownedNamespaces'` so the sweep never clobbers another writer's shapes.
|
|
47
61
|
*/
|
|
48
62
|
export declare function syncShapes(ds?: IDataset, options?: SyncShapesOptions): Promise<Array<() => Promise<void>>>;
|
|
49
63
|
/**
|
|
@@ -154,22 +154,31 @@ function shapeNamespace(iri) {
|
|
|
154
154
|
* ```
|
|
155
155
|
* Each in-code shape's thunk runs `delete → create` in order (the delete cascade-cleans the old
|
|
156
156
|
* property shapes / list / path subtrees via the containment cascade, the create rebuilds them).
|
|
157
|
-
*
|
|
158
|
-
*
|
|
157
|
+
*
|
|
158
|
+
* **Shapes in the store but not registered in this process are left alone by default**
|
|
159
|
+
* (`orphanScope: 'none'`). The registry only holds what this process happened to import, and
|
|
160
|
+
* that is routinely a subset of what the dataset holds: shapes are deep-importable one file at a
|
|
161
|
+
* time, and an app-data dataset also holds shapes other writers materialized (CN's
|
|
162
|
+
* `bindShape` / `enableCapability`). "Not registered here" therefore does not mean "deleted from
|
|
163
|
+
* code". Measured against a dataset holding the 36 `@_linked/schema` shapes: a process that
|
|
164
|
+
* imported only `@_linked/schema/shapes/Thing` (11 shapes registered) deleted the other 25 under
|
|
165
|
+
* both `'all'` and `'ownedNamespaces'`, and a process that imported no shapes deleted all 36.
|
|
166
|
+
*
|
|
167
|
+
* Pruning is opt-in via `options.orphanScope` (see {@link SyncShapesOptions}): pass `'all'` only
|
|
168
|
+
* from a process that has loaded every shape the dataset should hold and is its sole writer, and
|
|
169
|
+
* `'ownedNamespaces'` only when it has loaded every shape of each package it registers. Pruned
|
|
170
|
+
* orphans are deleted with their owned subtree. Pruning reads the existing shape IRIs first;
|
|
171
|
+
* with `'none'` no read is made.
|
|
159
172
|
*
|
|
160
173
|
* `ds` (optional) targets an explicit dataset instead of the global router. It is a **plan-time**
|
|
161
174
|
* parameter: it feeds both the orphan-detection read (so orphans are computed against the same
|
|
162
|
-
* store they'll be pruned from) and every delete/create thunk. Omitted →
|
|
175
|
+
* store they'll be pruned from) and every delete/create thunk. Omitted → the global router;
|
|
163
176
|
* the returned thunks stay nullary either way.
|
|
164
|
-
*
|
|
165
|
-
* `options.orphanScope` (default `'all'`) scopes the orphan sweep — see {@link SyncShapesOptions}.
|
|
166
|
-
* Multi-writer datasets (an app materializing on boot next to CN's capability shapes) MUST pass
|
|
167
|
-
* `'ownedNamespaces'` so the sweep never clobbers another writer's shapes.
|
|
168
177
|
*/
|
|
169
178
|
export function syncShapes(ds, options) {
|
|
170
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
171
180
|
var _a;
|
|
172
|
-
const orphanScope = (_a = options === null || options === void 0 ? void 0 : options.orphanScope) !== null && _a !== void 0 ? _a : '
|
|
181
|
+
const orphanScope = (_a = options === null || options === void 0 ? void 0 : options.orphanScope) !== null && _a !== void 0 ? _a : 'none';
|
|
173
182
|
// 1. Enumerate code-registered user shapes (exclude framework/meta shapes).
|
|
174
183
|
const userShapes = [];
|
|
175
184
|
for (const [iri, shapeClass] of getAllShapeClasses()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncShapes.js","sourceRoot":"","sources":["../../../src/shapes/syncShapes.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAErE;;;GAGG;AACH,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAqB,EAAE,QAAgB;IAC5E,MAAM,KAAK,GAAG,GAAG,QAAQ,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;IACxC,MAAM,CAAC,GAA4B;QACjC,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,uBAAuB,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AC,CAAC;IAC7E,CAAC;IAED,OAAO,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAC5C,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 {getAllShapeClasses, getShapeClass} from '../utils/ShapeClass.js';\nimport {NodeShape} from './SHACL.js';\nimport {\n getUniquePropertyShapes,\n type NodeShapeData,\n type PropertyShapeData,\n} from './nodeShapeData.js';\nimport {Shape} from './Shape.js';\nimport {DeleteBuilder} from '../queries/DeleteBuilder.js';\nimport type {IDataset} from '../interfaces/IDataset.js';\nimport {rdfList} from './List.js';\nimport {serializePathToNodeData} from './serializePathToNodeData.js';\n\n/**\n * The npm scope of framework shapes (NodeShape/PropertyShape/List/PathNode/Shape) that\n * describe the meta-model itself and must never be synced as user data.\n */\nconst FRAMEWORK_PACKAGE = '@_linked/core';\n\n/**\n * Build the create-pipeline data object for a single PropertyShape (flattened under shapeIri).\n *\n * @internal Exported for tests only — not part of the public API.\n */\nexport function buildPropertyShapeData(ps: PropertyShapeData, shapeIri: string): Record<string, unknown> {\n const psIri = `${shapeIri}/${ps.label}`;\n const d: Record<string, unknown> = {\n __id: psIri,\n path: serializePathToNodeData(ps.path, psIri),\n };\n // `rdfs:label` — the DSL label, i.e. the accessor name the property is reached\n // by in code (`person.memberships`). It is NOT `sh:name`, written below, which\n // is a human-readable display string.\n //\n // Without this the label is only ever implied by `psIri`, and a reader has to\n // re-derive one from the path's local part. That works right up until the two\n // differ — `@_linked/org` declares `memberships` on the path `org:hasMembership`\n // — at which point the catalog reports `hasMembership`, the query proxy indexes\n // the shape with it, and the class (which only knows `memberships`) throws.\n // Readers already prefer a stored label and fall back to the path, so writing it\n // is the whole fix; old catalogs keep working via that fallback.\n if (ps.label) d.label = ps.label;\n if (ps.nodeKind) d.nodeKind = ps.nodeKind;\n if (ps.datatype) d.datatype = ps.datatype;\n if (typeof ps.minCount === 'number') d.minCount = ps.minCount;\n if (typeof ps.maxCount === 'number') d.maxCount = ps.maxCount;\n if (ps.name) d.name = ps.name;\n if (ps.description) d.description = ps.description;\n if (typeof ps.order === 'number') d.order = ps.order;\n if (ps.group) d.group = ps.group;\n if (typeof ps.displayRank === 'number') d.displayRank = ps.displayRank;\n if (ps.displayHidden !== undefined) d.displayHidden = ps.displayHidden;\n if (ps.class) d.class = ps.class;\n if (ps.in) d.in = rdfList(ps.in, {base: `${psIri}/in`});\n if (ps.equalsConstraint) d.equalsConstraint = ps.equalsConstraint;\n if (ps.disjoint) d.disjoint = ps.disjoint;\n if (ps.lessThan) d.lessThan = ps.lessThan;\n if (ps.lessThanOrEquals) d.lessThanOrEquals = ps.lessThanOrEquals;\n if (ps.minInclusive !== undefined) d.minInclusive = ps.minInclusive;\n if (ps.maxInclusive !== undefined) d.maxInclusive = ps.maxInclusive;\n if (ps.minExclusive !== undefined) d.minExclusive = ps.minExclusive;\n if (ps.maxExclusive !== undefined) d.maxExclusive = ps.maxExclusive;\n if (typeof ps.minLength === 'number') d.minLength = ps.minLength;\n if (typeof ps.maxLength === 'number') d.maxLength = ps.maxLength;\n // sh:pattern is serialized as its regex source string.\n if (ps.pattern) d.pattern = ps.pattern.source;\n if (ps.hasValueConstraint !== undefined) d.hasValue = ps.hasValueConstraint;\n if (ps.valueShape) d.valueShape = ps.valueShape;\n if (ps.contains) d.contains = true;\n return d;\n}\n\n/** Build the create-pipeline data object for a NodeShape and its (flattened) property shapes. */\nfunction buildNodeShapeData(nodeShape: NodeShapeData, shapeIri: string): Record<string, unknown> {\n const d: Record<string, unknown> = {};\n if (nodeShape.targetClass) d.targetClass = nodeShape.targetClass;\n if (nodeShape.description) d.description = nodeShape.description;\n if (nodeShape.extends) d.extends = nodeShape.extends;\n if (nodeShape.dependent) d.dependent = true;\n if (nodeShape.closed !== undefined) d.closed = nodeShape.closed;\n if (nodeShape.ignoredProperties && nodeShape.ignoredProperties.length) {\n d.ignoredProperties = nodeShape.ignoredProperties;\n }\n // Flatten: emit own + inherited property shapes (deduped by label) under this shape.\n d.properties = getUniquePropertyShapes(nodeShape).map((ps) =>\n buildPropertyShapeData(ps, shapeIri),\n );\n return d;\n}\n\n/**\n * The per-shape `delete → create` thunk shared by `syncShapes()` and `syncShape()`. The delete\n * cascade-cleans the shape's old property-shape / list / path subtrees; the create rebuilds them.\n *\n * `ds` (optional) targets an explicit dataset — both the delete and the create run against it\n * instead of the global router. Omitted → today's global behavior.\n */\nfunction buildSyncThunk(nodeShape: NodeShapeData, iri: string, ds?: IDataset): () => Promise<void> {\n return () => {\n // Build the data fresh on each invocation: the create pipeline mutates the node-data\n // (it strips nested `shape` keys), so a shared object can't be re-used across runs.\n const data = buildNodeShapeData(nodeShape, iri);\n return (DeleteBuilder.from(NodeShape, {id: iri}).exec(ds) as Promise<unknown>)\n .then(() =>\n (NodeShape.create(data as never).withId(iri) as unknown as {\n exec: (target?: IDataset) => Promise<unknown>;\n }).exec(ds),\n )\n .then(() => undefined);\n };\n}\n\n/** Options controlling how {@link syncShapes} treats store shapes that are not in code. */\nexport interface SyncShapesOptions {\n /**\n * How to treat NodeShapes present in the store but not in the current process's code:\n * - `'all'` (default) — prune every store-only shape as an orphan. Correct for a\n * **single-writer** dataset (CN's own storage sync, tests), where \"not in code\" ⇒ deleted.\n * - `'ownedNamespaces'` — prune a store-only shape ONLY if its IRI falls within a namespace\n * this process actually writes (the package-namespace of one of its code-registered shapes,\n * i.e. the IRI prefix up to the last `/` or `#`). This is the **multi-writer** rule (arch-04:\n * one app-data dataset, several writers): an app booting `syncShapesOnBoot` must not delete\n * shapes another writer (e.g. CN's `enableCapability`) materialized into the same dataset in a\n * package the app never registers. Renames/removals WITHIN the app's own package still prune.\n * - `'none'` — never prune; purely additive (delete→recreate the code shapes, touch nothing else).\n */\n orphanScope?: 'all' | 'ownedNamespaces' | 'none';\n}\n\n/** The owning namespace of a shape IRI — everything up to and including the last `/` or `#`. */\nfunction shapeNamespace(iri: string): string {\n const cut = Math.max(iri.lastIndexOf('/'), iri.lastIndexOf('#'));\n return cut >= 0 ? iri.slice(0, cut + 1) : iri;\n}\n\n/**\n * Plan an idempotent sync of all code-registered (non-framework) NodeShapes into the store as\n * SHACL data — the forward (code → graph) materialization of arch-05 \"code is canonical\".\n *\n * Returns built-but-unexecuted thunks; the caller controls execution and batching:\n * ```ts\n * await Promise.all((await syncShapes()).map((run) => run()));\n * ```\n * Each in-code shape's thunk runs `delete → create` in order (the delete cascade-cleans the old\n * property shapes / list / path subtrees via the containment cascade, the create rebuilds them).\n * Shapes present in the store but no longer in code are deleted as orphans (their owned subtree\n * cascades too) — subject to `options.orphanScope`. Reads existing shape IRIs for orphan detection.\n *\n * `ds` (optional) targets an explicit dataset instead of the global router. It is a **plan-time**\n * parameter: it feeds both the orphan-detection read (so orphans are computed against the same\n * store they'll be pruned from) and every delete/create thunk. Omitted → today's global behavior;\n * the returned thunks stay nullary either way.\n *\n * `options.orphanScope` (default `'all'`) scopes the orphan sweep — see {@link SyncShapesOptions}.\n * Multi-writer datasets (an app materializing on boot next to CN's capability shapes) MUST pass\n * `'ownedNamespaces'` so the sweep never clobbers another writer's shapes.\n */\nexport async function syncShapes(\n ds?: IDataset,\n options?: SyncShapesOptions,\n): Promise<Array<() => Promise<void>>> {\n const orphanScope = options?.orphanScope ?? 'all';\n // 1. Enumerate code-registered user shapes (exclude framework/meta shapes).\n const userShapes: Array<{iri: string; nodeShape: NodeShapeData}> = [];\n for (const [iri, shapeClass] of getAllShapeClasses()) {\n if (!shapeClass?.shape) continue;\n const pkg = (shapeClass as {packageName?: string}).packageName;\n // Skip framework/meta shapes: the core package, and the base `Shape` which is registered\n // directly (no applyLinkedShape) and therefore carries no packageName.\n if (!pkg || pkg === FRAMEWORK_PACKAGE) continue;\n userShapes.push({iri, nodeShape: shapeClass.shape});\n }\n const localShapeIris = new Set(userShapes.map((s) => s.iri));\n // Namespaces this process actually writes — the ownership scope for `'ownedNamespaces'` pruning.\n const ownedNamespaces = new Set(userShapes.map((s) => shapeNamespace(s.iri)));\n\n const thunks: Array<() => Promise<void>> = [];\n\n // 2. Per in-code shape: delete (cascade) then recreate.\n for (const {iri, nodeShape} of userShapes) {\n thunks.push(buildSyncThunk(nodeShape, iri, ds));\n }\n\n // 3. Orphan sweep (unless disabled). Identity-read existing NodeShape IRIs (ids only). Must hit\n // the same `ds` the thunks target, or orphans get computed against the wrong store.\n if (orphanScope !== 'none') {\n const existingRows = (await (NodeShape as unknown as {\n select: () => {exec: (target?: IDataset) => Promise<Array<{id: string}>>};\n }).select().exec(ds)) as Array<{id: string}>;\n\n // Orphan shapes (in store, not in code) → delete (cascade cleans their owned subtree). In\n // `'ownedNamespaces'` mode, only shapes within a namespace this process writes are eligible —\n // other writers' shapes (different package namespace) are left untouched.\n for (const {id: iri} of existingRows) {\n if (localShapeIris.has(iri)) continue;\n if (orphanScope === 'ownedNamespaces' && !ownedNamespaces.has(shapeNamespace(iri))) {\n continue;\n }\n thunks.push(() =>\n (DeleteBuilder.from(NodeShape, {id: iri}).exec(ds) as Promise<unknown>).then(\n () => undefined,\n ),\n );\n }\n }\n\n return thunks;\n}\n\n/**\n * Plan an idempotent sync of ONE code-registered NodeShape into the store as SHACL data.\n *\n * Scoped counterpart to {@link syncShapes}: materializes a single shape (delete → recreate, so the\n * delete cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them)\n * and does NOT run the store-wide orphan sweep — other shapes in the store are untouched.\n *\n * @param target a shape class (e.g. `Person`) or its NodeShape IRI string. An IRI is resolved to\n * its registered class via `getShapeClass`; the shape must be code-registered.\n * @param ds optional explicit dataset to materialize into (a store or a router) — both the delete\n * and the create run against it instead of the global router. Omitted → global behavior.\n * @returns a single unexecuted thunk (consistent with {@link syncShapes}), so callers can batch\n * several together — e.g. a shape plus its referenced object-property shapes:\n * `await Promise.all([syncShape(Person), syncShape(Address)].map((run) => run()))`.\n * @throws if `target` is a framework/meta shape, is not registered, or has no `.shape`.\n */\nexport function syncShape(target: typeof Shape | string, ds?: IDataset): () => Promise<void> {\n // Normalize target → its registered shape class.\n const cls =\n typeof target === 'string' ? getShapeClass(target) : (target as typeof Shape);\n if (typeof target === 'string' && !cls) {\n throw new Error(`syncShape: no registered shape for IRI ${target}`);\n }\n const nodeShape = cls?.shape;\n if (!nodeShape) {\n throw new Error(\n typeof target === 'string'\n ? `syncShape: no registered shape for IRI ${target}`\n : `syncShape: shape class has no static .shape`,\n );\n }\n const iri = nodeShape.id;\n\n // Never materialize a framework/meta shape as user data — same invariant syncShapes() enforces\n // by skipping (the base Shape carries no packageName).\n const pkg = (cls as {packageName?: string}).packageName;\n if (!pkg || pkg === FRAMEWORK_PACKAGE) {\n throw new Error(`syncShape: refusing to sync framework/meta shape ${iri}`);\n }\n\n return buildSyncThunk(nodeShape, iri, ds);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"syncShapes.js","sourceRoot":"","sources":["../../../src/shapes/syncShapes.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAErE;;;GAGG;AACH,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAqB,EAAE,QAAgB;IAC5E,MAAM,KAAK,GAAG,GAAG,QAAQ,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;IACxC,MAAM,CAAC,GAA4B;QACjC,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,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AoD,GAAG,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAC5C,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 {getAllShapeClasses, getShapeClass} from '../utils/ShapeClass.js';\nimport {NodeShape} from './SHACL.js';\nimport {\n getUniquePropertyShapes,\n type NodeShapeData,\n type PropertyShapeData,\n} from './nodeShapeData.js';\nimport {Shape} from './Shape.js';\nimport {DeleteBuilder} from '../queries/DeleteBuilder.js';\nimport type {IDataset} from '../interfaces/IDataset.js';\nimport {rdfList} from './List.js';\nimport {serializePathToNodeData} from './serializePathToNodeData.js';\n\n/**\n * The npm scope of framework shapes (NodeShape/PropertyShape/List/PathNode/Shape) that\n * describe the meta-model itself and must never be synced as user data.\n */\nconst FRAMEWORK_PACKAGE = '@_linked/core';\n\n/**\n * Build the create-pipeline data object for a single PropertyShape (flattened under shapeIri).\n *\n * @internal Exported for tests only — not part of the public API.\n */\nexport function buildPropertyShapeData(ps: PropertyShapeData, shapeIri: string): Record<string, unknown> {\n const psIri = `${shapeIri}/${ps.label}`;\n const d: Record<string, unknown> = {\n __id: psIri,\n path: serializePathToNodeData(ps.path, psIri),\n };\n // `rdfs:label` — the DSL label, i.e. the accessor name the property is reached\n // by in code (`person.memberships`). It is NOT `sh:name`, written below, which\n // is a human-readable display string.\n //\n // Without this the label is only ever implied by `psIri`, and a reader has to\n // re-derive one from the path's local part. That works right up until the two\n // differ — `@_linked/org` declares `memberships` on the path `org:hasMembership`\n // — at which point the catalog reports `hasMembership`, the query proxy indexes\n // the shape with it, and the class (which only knows `memberships`) throws.\n // Readers already prefer a stored label and fall back to the path, so writing it\n // is the whole fix; old catalogs keep working via that fallback.\n if (ps.label) d.label = ps.label;\n if (ps.nodeKind) d.nodeKind = ps.nodeKind;\n if (ps.datatype) d.datatype = ps.datatype;\n if (typeof ps.minCount === 'number') d.minCount = ps.minCount;\n if (typeof ps.maxCount === 'number') d.maxCount = ps.maxCount;\n if (ps.name) d.name = ps.name;\n if (ps.description) d.description = ps.description;\n if (typeof ps.order === 'number') d.order = ps.order;\n if (ps.group) d.group = ps.group;\n if (typeof ps.displayRank === 'number') d.displayRank = ps.displayRank;\n if (ps.displayHidden !== undefined) d.displayHidden = ps.displayHidden;\n if (ps.class) d.class = ps.class;\n if (ps.in) d.in = rdfList(ps.in, {base: `${psIri}/in`});\n if (ps.equalsConstraint) d.equalsConstraint = ps.equalsConstraint;\n if (ps.disjoint) d.disjoint = ps.disjoint;\n if (ps.lessThan) d.lessThan = ps.lessThan;\n if (ps.lessThanOrEquals) d.lessThanOrEquals = ps.lessThanOrEquals;\n if (ps.minInclusive !== undefined) d.minInclusive = ps.minInclusive;\n if (ps.maxInclusive !== undefined) d.maxInclusive = ps.maxInclusive;\n if (ps.minExclusive !== undefined) d.minExclusive = ps.minExclusive;\n if (ps.maxExclusive !== undefined) d.maxExclusive = ps.maxExclusive;\n if (typeof ps.minLength === 'number') d.minLength = ps.minLength;\n if (typeof ps.maxLength === 'number') d.maxLength = ps.maxLength;\n // sh:pattern is serialized as its regex source string.\n if (ps.pattern) d.pattern = ps.pattern.source;\n if (ps.hasValueConstraint !== undefined) d.hasValue = ps.hasValueConstraint;\n if (ps.valueShape) d.valueShape = ps.valueShape;\n if (ps.contains) d.contains = true;\n return d;\n}\n\n/** Build the create-pipeline data object for a NodeShape and its (flattened) property shapes. */\nfunction buildNodeShapeData(nodeShape: NodeShapeData, shapeIri: string): Record<string, unknown> {\n const d: Record<string, unknown> = {};\n if (nodeShape.targetClass) d.targetClass = nodeShape.targetClass;\n if (nodeShape.description) d.description = nodeShape.description;\n if (nodeShape.extends) d.extends = nodeShape.extends;\n if (nodeShape.dependent) d.dependent = true;\n if (nodeShape.closed !== undefined) d.closed = nodeShape.closed;\n if (nodeShape.ignoredProperties && nodeShape.ignoredProperties.length) {\n d.ignoredProperties = nodeShape.ignoredProperties;\n }\n // Flatten: emit own + inherited property shapes (deduped by label) under this shape.\n d.properties = getUniquePropertyShapes(nodeShape).map((ps) =>\n buildPropertyShapeData(ps, shapeIri),\n );\n return d;\n}\n\n/**\n * The per-shape `delete → create` thunk shared by `syncShapes()` and `syncShape()`. The delete\n * cascade-cleans the shape's old property-shape / list / path subtrees; the create rebuilds them.\n *\n * `ds` (optional) targets an explicit dataset — both the delete and the create run against it\n * instead of the global router. Omitted → today's global behavior.\n */\nfunction buildSyncThunk(nodeShape: NodeShapeData, iri: string, ds?: IDataset): () => Promise<void> {\n return () => {\n // Build the data fresh on each invocation: the create pipeline mutates the node-data\n // (it strips nested `shape` keys), so a shared object can't be re-used across runs.\n const data = buildNodeShapeData(nodeShape, iri);\n return (DeleteBuilder.from(NodeShape, {id: iri}).exec(ds) as Promise<unknown>)\n .then(() =>\n (NodeShape.create(data as never).withId(iri) as unknown as {\n exec: (target?: IDataset) => Promise<unknown>;\n }).exec(ds),\n )\n .then(() => undefined);\n };\n}\n\n/** Options controlling how {@link syncShapes} treats store shapes that are not in code. */\nexport interface SyncShapesOptions {\n /**\n * How to treat NodeShapes present in the store but not in the current process's code:\n * - `'none'` (default) — never prune; purely additive (delete→recreate the code shapes, touch\n * nothing else). The only mode that is safe when the process has loaded a *subset* of the\n * shapes in the dataset, or when the dataset has more than one writer.\n * - `'all'` — prune every store-only shape as an orphan. Only correct when this process has\n * loaded **every** shape the dataset should hold and is its **only** writer; \"not registered\n * here\" is then taken to mean \"deleted from code\".\n * - `'ownedNamespaces'` — prune a store-only shape ONLY if its IRI falls within a namespace\n * this process actually writes (the package-namespace of one of its code-registered shapes,\n * i.e. the IRI prefix up to the last `/` or `#`). Protects other writers' packages (arch-04:\n * one app-data dataset, several writers), but NOT the rest of a package the process only\n * partially loaded — the namespace is the whole package, so a deep import of one shape file\n * still claims all of it.\n *\n * `'all'` and `'ownedNamespaces'` are destructive and must be requested explicitly.\n */\n orphanScope?: 'all' | 'ownedNamespaces' | 'none';\n}\n\n/** The owning namespace of a shape IRI — everything up to and including the last `/` or `#`. */\nfunction shapeNamespace(iri: string): string {\n const cut = Math.max(iri.lastIndexOf('/'), iri.lastIndexOf('#'));\n return cut >= 0 ? iri.slice(0, cut + 1) : iri;\n}\n\n/**\n * Plan an idempotent sync of all code-registered (non-framework) NodeShapes into the store as\n * SHACL data — the forward (code → graph) materialization of arch-05 \"code is canonical\".\n *\n * Returns built-but-unexecuted thunks; the caller controls execution and batching:\n * ```ts\n * await Promise.all((await syncShapes()).map((run) => run()));\n * ```\n * Each in-code shape's thunk runs `delete → create` in order (the delete cascade-cleans the old\n * property shapes / list / path subtrees via the containment cascade, the create rebuilds them).\n *\n * **Shapes in the store but not registered in this process are left alone by default**\n * (`orphanScope: 'none'`). The registry only holds what this process happened to import, and\n * that is routinely a subset of what the dataset holds: shapes are deep-importable one file at a\n * time, and an app-data dataset also holds shapes other writers materialized (CN's\n * `bindShape` / `enableCapability`). \"Not registered here\" therefore does not mean \"deleted from\n * code\". Measured against a dataset holding the 36 `@_linked/schema` shapes: a process that\n * imported only `@_linked/schema/shapes/Thing` (11 shapes registered) deleted the other 25 under\n * both `'all'` and `'ownedNamespaces'`, and a process that imported no shapes deleted all 36.\n *\n * Pruning is opt-in via `options.orphanScope` (see {@link SyncShapesOptions}): pass `'all'` only\n * from a process that has loaded every shape the dataset should hold and is its sole writer, and\n * `'ownedNamespaces'` only when it has loaded every shape of each package it registers. Pruned\n * orphans are deleted with their owned subtree. Pruning reads the existing shape IRIs first;\n * with `'none'` no read is made.\n *\n * `ds` (optional) targets an explicit dataset instead of the global router. It is a **plan-time**\n * parameter: it feeds both the orphan-detection read (so orphans are computed against the same\n * store they'll be pruned from) and every delete/create thunk. Omitted → the global router;\n * the returned thunks stay nullary either way.\n */\nexport async function syncShapes(\n ds?: IDataset,\n options?: SyncShapesOptions,\n): Promise<Array<() => Promise<void>>> {\n const orphanScope = options?.orphanScope ?? 'none';\n // 1. Enumerate code-registered user shapes (exclude framework/meta shapes).\n const userShapes: Array<{iri: string; nodeShape: NodeShapeData}> = [];\n for (const [iri, shapeClass] of getAllShapeClasses()) {\n if (!shapeClass?.shape) continue;\n const pkg = (shapeClass as {packageName?: string}).packageName;\n // Skip framework/meta shapes: the core package, and the base `Shape` which is registered\n // directly (no applyLinkedShape) and therefore carries no packageName.\n if (!pkg || pkg === FRAMEWORK_PACKAGE) continue;\n userShapes.push({iri, nodeShape: shapeClass.shape});\n }\n const localShapeIris = new Set(userShapes.map((s) => s.iri));\n // Namespaces this process actually writes — the ownership scope for `'ownedNamespaces'` pruning.\n const ownedNamespaces = new Set(userShapes.map((s) => shapeNamespace(s.iri)));\n\n const thunks: Array<() => Promise<void>> = [];\n\n // 2. Per in-code shape: delete (cascade) then recreate.\n for (const {iri, nodeShape} of userShapes) {\n thunks.push(buildSyncThunk(nodeShape, iri, ds));\n }\n\n // 3. Orphan sweep (unless disabled). Identity-read existing NodeShape IRIs (ids only). Must hit\n // the same `ds` the thunks target, or orphans get computed against the wrong store.\n if (orphanScope !== 'none') {\n const existingRows = (await (NodeShape as unknown as {\n select: () => {exec: (target?: IDataset) => Promise<Array<{id: string}>>};\n }).select().exec(ds)) as Array<{id: string}>;\n\n // Orphan shapes (in store, not in code) → delete (cascade cleans their owned subtree). In\n // `'ownedNamespaces'` mode, only shapes within a namespace this process writes are eligible —\n // other writers' shapes (different package namespace) are left untouched.\n for (const {id: iri} of existingRows) {\n if (localShapeIris.has(iri)) continue;\n if (orphanScope === 'ownedNamespaces' && !ownedNamespaces.has(shapeNamespace(iri))) {\n continue;\n }\n thunks.push(() =>\n (DeleteBuilder.from(NodeShape, {id: iri}).exec(ds) as Promise<unknown>).then(\n () => undefined,\n ),\n );\n }\n }\n\n return thunks;\n}\n\n/**\n * Plan an idempotent sync of ONE code-registered NodeShape into the store as SHACL data.\n *\n * Scoped counterpart to {@link syncShapes}: materializes a single shape (delete → recreate, so the\n * delete cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them)\n * and does NOT run the store-wide orphan sweep — other shapes in the store are untouched.\n *\n * @param target a shape class (e.g. `Person`) or its NodeShape IRI string. An IRI is resolved to\n * its registered class via `getShapeClass`; the shape must be code-registered.\n * @param ds optional explicit dataset to materialize into (a store or a router) — both the delete\n * and the create run against it instead of the global router. Omitted → global behavior.\n * @returns a single unexecuted thunk (consistent with {@link syncShapes}), so callers can batch\n * several together — e.g. a shape plus its referenced object-property shapes:\n * `await Promise.all([syncShape(Person), syncShape(Address)].map((run) => run()))`.\n * @throws if `target` is a framework/meta shape, is not registered, or has no `.shape`.\n */\nexport function syncShape(target: typeof Shape | string, ds?: IDataset): () => Promise<void> {\n // Normalize target → its registered shape class.\n const cls =\n typeof target === 'string' ? getShapeClass(target) : (target as typeof Shape);\n if (typeof target === 'string' && !cls) {\n throw new Error(`syncShape: no registered shape for IRI ${target}`);\n }\n const nodeShape = cls?.shape;\n if (!nodeShape) {\n throw new Error(\n typeof target === 'string'\n ? `syncShape: no registered shape for IRI ${target}`\n : `syncShape: shape class has no static .shape`,\n );\n }\n const iri = nodeShape.id;\n\n // Never materialize a framework/meta shape as user data — same invariant syncShapes() enforces\n // by skipping (the base Shape carries no packageName).\n const pkg = (cls as {packageName?: string}).packageName;\n if (!pkg || pkg === FRAMEWORK_PACKAGE) {\n throw new Error(`syncShape: refusing to sync framework/meta shape ${iri}`);\n }\n\n return buildSyncThunk(nodeShape, iri, ds);\n}\n"]}
|
package/lib/esm/utils/Package.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { createPropertyShape, getAndClearCallbacks, getNodeShapeUri, getPackageUri, setPackagePublishConfig, NodeShape, PropertyShape, } from '../shapes/SHACL.js';
|
|
7
7
|
import { createNodeShapeData } from '../shapes/nodeShapeData.js';
|
|
8
8
|
import { Shape } from '../shapes/Shape.js';
|
|
9
|
+
import { List } from '../shapes/List.class.js';
|
|
9
10
|
import { Prefix } from './Prefix.js';
|
|
10
11
|
import { coreOntology } from '../ontologies/linked-core.js';
|
|
11
12
|
import { rdf } from '../ontologies/rdf.js';
|
|
@@ -288,15 +289,27 @@ export function initTree() {
|
|
|
288
289
|
initTree();
|
|
289
290
|
//now that this file is set up, we can link linked shapes in the core module itself
|
|
290
291
|
export const corePackage = linkedPackage('@_linked/core');
|
|
292
|
+
// NodeShape, PropertyShape and List share their names with ontology terms (shacl.NodeShape,
|
|
293
|
+
// shacl.PropertyShape, rdf.List), so a bundler may rename the classes. Explicit names keep
|
|
294
|
+
// their IRIs independent of that.
|
|
291
295
|
corePackage.linkedShape({
|
|
296
|
+
name: 'NodeShape',
|
|
292
297
|
description: 'Represents a SHACL NodeShape; defines constraints for a class of RDF nodes. Links to multiple PropertyShapes. (schema, constraint, class validation)',
|
|
293
298
|
})(NodeShape);
|
|
294
299
|
corePackage.linkedShape({
|
|
300
|
+
name: 'PropertyShape',
|
|
295
301
|
description: 'Represents a SHACL PropertyShape; specifies rules for one property of a NodeShape (path, datatype, cardinality). (validation rule, property constraint)',
|
|
296
302
|
// A property shape has no independent existence — it is owned by its NodeShape via the
|
|
297
303
|
// `contains` sh:property edge, so deleting the NodeShape cascade-deletes it.
|
|
298
304
|
dependent: true,
|
|
299
305
|
})(PropertyShape);
|
|
306
|
+
// List is registered here, by value, because PropertyShape.in below uses it as its value
|
|
307
|
+
// shape. Naming it by string instead would leave it unregistered for anyone who loads the
|
|
308
|
+
// SHACL metamodel without importing shapes/List (backlog 045).
|
|
309
|
+
corePackage.linkedShape({
|
|
310
|
+
name: 'List',
|
|
311
|
+
dependent: true,
|
|
312
|
+
})(List);
|
|
300
313
|
// ValidationReport / ValidationResult removed in core metadata rewrite
|
|
301
314
|
//ALL the following is to support Shape having get/set methods with property shapes
|
|
302
315
|
//and Shape itself having a nodeShape
|
|
@@ -398,7 +411,7 @@ createPropertyShape({
|
|
|
398
411
|
// PropertyShape.class
|
|
399
412
|
createPropertyShape({ path: shacl.class, shape: Shape, maxCount: 1 }, 'class', shacl.IRI, PropertyShape);
|
|
400
413
|
// PropertyShape.in → an rdf:List (owned)
|
|
401
|
-
createPropertyShape({ path: shacl.in, shape:
|
|
414
|
+
createPropertyShape({ path: shacl.in, shape: List, maxCount: 1, contains: true }, 'in', shacl.IRI, PropertyShape);
|
|
402
415
|
// PropertyShape pair constraints (values are property IRIs)
|
|
403
416
|
// Labelled `equalsConstraint`, not `equals`: `equals` is a query-builder method, so a
|
|
404
417
|
// property under that label is unreachable through the DSL (backlog 041). The name also
|
|
@@ -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,EAAwB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAC,wBAAwB,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAC,KAAK,EAAC,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAC;AASzC,kEAAkE;AAClE,kDAAkD;AAClD,IAAI,UAAU,GAAa,IAAI,GAAG,EAAE,CAAC;AACrC,IAAI,qBAAqB,GAAG,KAAK,CAAC;AA8KlC,MAAM,CAAC,IAAI,aAAa,GAAG,EAAE,CAAC;AAE9B,MAAM,UAAU,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AAC/E,kFAAkF;AAClF,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACpE,aAAa,EACb,KAAK,CAAC,OAAO,EACb,aAAa,CACd,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,aAAa,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACtE,eAAe,EACf,KAAK,CAAC,OAAO,EACb,aAAa,CACd,CAAC;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 {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');\ncorePackage.linkedShape({\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 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// 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: ['@_linked/core', '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,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EAAE,CAAC,EAAC,EACtE,eAAe,EACf,KAAK,CAAC,OAAO,EACb,aAAa,CACd,CAAC;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"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_linked/core",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"packageManager": "npm@11.
|
|
3
|
+
"version": "2.24.0",
|
|
4
|
+
"packageManager": "npm@11.20.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"linkedPackage": true,
|
|
7
7
|
"type": "module",
|
|
@@ -16,7 +16,13 @@
|
|
|
16
16
|
"**/ontologies/*.js",
|
|
17
17
|
"**/ontologies/*.ts",
|
|
18
18
|
"**/utils/Package.js",
|
|
19
|
-
"**/utils/Package.ts"
|
|
19
|
+
"**/utils/Package.ts",
|
|
20
|
+
"**/lib/esm/index.js",
|
|
21
|
+
"**/src/index.ts",
|
|
22
|
+
"**/shapes/index.js",
|
|
23
|
+
"**/shapes/index.ts",
|
|
24
|
+
"**/shapes/*.js",
|
|
25
|
+
"**/shapes/*.ts"
|
|
20
26
|
],
|
|
21
27
|
"exports": {
|
|
22
28
|
".": {
|
|
@@ -52,8 +58,8 @@
|
|
|
52
58
|
"test:fuseki": "docker compose -f src/tests/docker-compose.test.yml up -d --wait && NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.cjs --runInBand --testPathPattern='sparql-fuseki' --verbose; EXIT=$?; docker compose -f src/tests/docker-compose.test.yml down; exit $EXIT"
|
|
53
59
|
},
|
|
54
60
|
"devDependencies": {
|
|
55
|
-
"@changesets/changelog-github": "^0.
|
|
56
|
-
"@changesets/cli": "^
|
|
61
|
+
"@changesets/changelog-github": "^1.0.0",
|
|
62
|
+
"@changesets/cli": "^3.0.0",
|
|
57
63
|
"@jest/globals": "^29.7.0",
|
|
58
64
|
"@types/jest": "^29.5.12",
|
|
59
65
|
"@types/node": "^20.12.7",
|