@_linked/core 2.8.0 → 2.9.0-next.20260627070559
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 +27 -0
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/shapes/syncShapes.d.ts +16 -0
- package/lib/cjs/shapes/syncShapes.js +51 -4
- package/lib/cjs/shapes/syncShapes.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/shapes/syncShapes.d.ts +16 -0
- package/lib/esm/shapes/syncShapes.js +51 -5
- package/lib/esm/shapes/syncShapes.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109](https://github.com/linked-cm/core/pull/109) [`1ed833d`](https://github.com/linked-cm/core/commit/1ed833d4a655e2202fbe2087456f6a95012c0152) Thanks [@flyon](https://github.com/flyon)! - Add `syncShape(target)` — a scoped, single-shape counterpart to `syncShapes()`.
|
|
8
|
+
|
|
9
|
+
Materializes **one** code-registered NodeShape into the store (delete → recreate, so the delete
|
|
10
|
+
cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them) and does
|
|
11
|
+
**not** run the store-wide orphan sweep, so other shapes in the store are untouched. Useful when an
|
|
12
|
+
app/package wants to bind a single reused shape into a dataset without reconciling (or pruning) the
|
|
13
|
+
whole shape set.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { syncShape } from "@_linked/core";
|
|
17
|
+
|
|
18
|
+
await syncShape(Person)(); // by shape class
|
|
19
|
+
await syncShape(Person.shape.id)(); // or by NodeShape IRI
|
|
20
|
+
// composes with itself / syncShapes (each returns one unexecuted thunk):
|
|
21
|
+
await Promise.all(
|
|
22
|
+
[syncShape(Person), syncShape(Address)].map((run) => run())
|
|
23
|
+
);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Accepts a shape class or its NodeShape IRI string; throws for framework/meta shapes and
|
|
27
|
+
unregistered IRIs. The per-shape sync thunk is now rebuilt fresh on each invocation, so a thunk
|
|
28
|
+
can be safely re-run (idempotent). See `docs/reports/016-shacl-rdf-serialization.md`.
|
|
29
|
+
|
|
3
30
|
## 2.8.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { syncShapes } from './shapes/syncShapes.js';
|
|
1
|
+
export { syncShapes, syncShape } from './shapes/syncShapes.js';
|
|
2
2
|
export { rdfList } from './shapes/List.js';
|
|
3
3
|
export { serializePathToNodeData } from './shapes/serializePathToNodeData.js';
|
|
4
4
|
export { QueryBuilder } from './queries/QueryBuilder.js';
|
package/lib/cjs/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Expr = exports.ExpressionNode = exports.DeleteBuilder = exports.UpdateBuilder = exports.CreateBuilder = exports.FieldSet = exports.walkPropertyPath = exports.PropertyPath = exports.QueryBuilder = exports.serializePathToNodeData = exports.rdfList = exports.syncShapes = void 0;
|
|
36
|
+
exports.Expr = exports.ExpressionNode = exports.DeleteBuilder = exports.UpdateBuilder = exports.CreateBuilder = exports.FieldSet = exports.walkPropertyPath = exports.PropertyPath = exports.QueryBuilder = exports.serializePathToNodeData = exports.rdfList = exports.syncShape = exports.syncShapes = void 0;
|
|
37
37
|
exports.initModularApp = initModularApp;
|
|
38
38
|
/*
|
|
39
39
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -66,6 +66,7 @@ const List = __importStar(require("./shapes/List.js"));
|
|
|
66
66
|
const PathNode = __importStar(require("./shapes/PathNode.js"));
|
|
67
67
|
var syncShapes_js_1 = require("./shapes/syncShapes.js");
|
|
68
68
|
Object.defineProperty(exports, "syncShapes", { enumerable: true, get: function () { return syncShapes_js_1.syncShapes; } });
|
|
69
|
+
Object.defineProperty(exports, "syncShape", { enumerable: true, get: function () { return syncShapes_js_1.syncShape; } });
|
|
69
70
|
var List_js_1 = require("./shapes/List.js");
|
|
70
71
|
Object.defineProperty(exports, "rdfList", { enumerable: true, get: function () { return List_js_1.rdfList; } });
|
|
71
72
|
var serializePathToNodeData_js_1 = require("./shapes/serializePathToNodeData.js");
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,wCAyDC;AA7ID;;;;GAIG;AACH,4DAA8C;AAC9C,kFAAoE;AACpE,gFAAkE;AAClE,wEAA0D;AAC1D,kEAAoD;AACpD,kEAAoD;AACpD,yDAA2C;AAC3C,+DAAiD;AACjD,oEAAsD;AACtD,0DAA4C;AAC5C,oDAAsC;AACtC,sEAAwD;AACxD,sEAAwD;AACxD,0EAA4D;AAC5D,sEAAwD;AACxD,sEAAwD;AACxD,0EAA4D;AAC5D,wEAA0D;AAC1D,oGAAsF;AACtF,gEAAkD;AAClD,kEAAoD;AACpD,0DAA4C;AAC5C,uDAAyC;AACzC,+DAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,wCAyDC;AA7ID;;;;GAIG;AACH,4DAA8C;AAC9C,kFAAoE;AACpE,gFAAkE;AAClE,wEAA0D;AAC1D,kEAAoD;AACpD,kEAAoD;AACpD,yDAA2C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AQ;QACR,MAAM;QACN,SAAS;QACT,MAAM;QACN,GAAG;QACH,UAAU;QACV,IAAI;QACJ,QAAQ;QACR,aAAa;QACb,UAAU;QACV,QAAQ;QACR,WAAW;QACX,WAAW;QACX,aAAa;QACb,WAAW;QACX,WAAW;QACX,aAAa;QACb,YAAY;QACZ,0BAA0B;QAC1B,WAAW;QACX,GAAG;QACH,IAAI;QACJ,GAAG;QACH,KAAK;QACL,YAAY;QACZ,GAAG;QACH,GAAG;QACH,MAAM;QACN,kBAAkB;QAClB,kBAAkB;QAClB,oBAAoB;QACpB,cAAc;QACd,mBAAmB;QACnB,mBAAmB;QACnB,mBAAmB;KACpB,CAAC;IACF,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,KAAK,IAAI,SAAS,IAAI,eAAe,EAAE,CAAC;YACtC,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Shape } from './Shape.js';
|
|
1
2
|
/**
|
|
2
3
|
* Plan an idempotent sync of all code-registered (non-framework) NodeShapes into the store as
|
|
3
4
|
* SHACL data — the forward (code → graph) materialization of arch-05 "code is canonical".
|
|
@@ -12,3 +13,18 @@
|
|
|
12
13
|
* cascades too). Reads existing shape IRIs via the global query dispatch for orphan detection.
|
|
13
14
|
*/
|
|
14
15
|
export declare function syncShapes(): Promise<Array<() => Promise<void>>>;
|
|
16
|
+
/**
|
|
17
|
+
* Plan an idempotent sync of ONE code-registered NodeShape into the store as SHACL data.
|
|
18
|
+
*
|
|
19
|
+
* Scoped counterpart to {@link syncShapes}: materializes a single shape (delete → recreate, so the
|
|
20
|
+
* delete cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them)
|
|
21
|
+
* and does NOT run the store-wide orphan sweep — other shapes in the store are untouched.
|
|
22
|
+
*
|
|
23
|
+
* @param target a shape class (e.g. `Person`) or its NodeShape IRI string. An IRI is resolved to
|
|
24
|
+
* its registered class via `getShapeClass`; the shape must be code-registered.
|
|
25
|
+
* @returns a single unexecuted thunk (consistent with {@link syncShapes}), so callers can batch
|
|
26
|
+
* several together — e.g. a shape plus its referenced object-property shapes:
|
|
27
|
+
* `await Promise.all([syncShape(Person), syncShape(Address)].map((run) => run()))`.
|
|
28
|
+
* @throws if `target` is a framework/meta shape, is not registered, or has no `.shape`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function syncShape(target: typeof Shape | string): () => Promise<void>;
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.syncShapes = syncShapes;
|
|
13
|
+
exports.syncShape = syncShape;
|
|
13
14
|
/*
|
|
14
15
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
15
16
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -90,6 +91,20 @@ function buildNodeShapeData(nodeShape, shapeIri) {
|
|
|
90
91
|
.map((ps) => buildPropertyShapeData(ps, shapeIri));
|
|
91
92
|
return d;
|
|
92
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The per-shape `delete → create` thunk shared by `syncShapes()` and `syncShape()`. The delete
|
|
96
|
+
* cascade-cleans the shape's old property-shape / list / path subtrees; the create rebuilds them.
|
|
97
|
+
*/
|
|
98
|
+
function buildSyncThunk(nodeShape, iri) {
|
|
99
|
+
return () => {
|
|
100
|
+
// Build the data fresh on each invocation: the create pipeline mutates the node-data
|
|
101
|
+
// (it strips nested `shape` keys), so a shared object can't be re-used across runs.
|
|
102
|
+
const data = buildNodeShapeData(nodeShape, iri);
|
|
103
|
+
return DeleteBuilder_js_1.DeleteBuilder.from(SHACL_js_1.NodeShape, { id: iri }).exec()
|
|
104
|
+
.then(() => SHACL_js_1.NodeShape.create(data).withId(iri).exec())
|
|
105
|
+
.then(() => undefined);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
93
108
|
/**
|
|
94
109
|
* Plan an idempotent sync of all code-registered (non-framework) NodeShapes into the store as
|
|
95
110
|
* SHACL data — the forward (code → graph) materialization of arch-05 "code is canonical".
|
|
@@ -124,10 +139,7 @@ function syncShapes() {
|
|
|
124
139
|
const thunks = [];
|
|
125
140
|
// 3. Per in-code shape: delete (cascade) then recreate.
|
|
126
141
|
for (const { iri, nodeShape } of userShapes) {
|
|
127
|
-
|
|
128
|
-
thunks.push(() => DeleteBuilder_js_1.DeleteBuilder.from(SHACL_js_1.NodeShape, { id: iri }).exec()
|
|
129
|
-
.then(() => (SHACL_js_1.NodeShape.create(data).withId(iri).exec()))
|
|
130
|
-
.then(() => undefined));
|
|
142
|
+
thunks.push(buildSyncThunk(nodeShape, iri));
|
|
131
143
|
}
|
|
132
144
|
// 4. Orphan shapes (in store, not in code) → delete (cascade cleans their owned subtree).
|
|
133
145
|
for (const iri of existingShapeIris) {
|
|
@@ -138,4 +150,39 @@ function syncShapes() {
|
|
|
138
150
|
return thunks;
|
|
139
151
|
});
|
|
140
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Plan an idempotent sync of ONE code-registered NodeShape into the store as SHACL data.
|
|
155
|
+
*
|
|
156
|
+
* Scoped counterpart to {@link syncShapes}: materializes a single shape (delete → recreate, so the
|
|
157
|
+
* delete cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them)
|
|
158
|
+
* and does NOT run the store-wide orphan sweep — other shapes in the store are untouched.
|
|
159
|
+
*
|
|
160
|
+
* @param target a shape class (e.g. `Person`) or its NodeShape IRI string. An IRI is resolved to
|
|
161
|
+
* its registered class via `getShapeClass`; the shape must be code-registered.
|
|
162
|
+
* @returns a single unexecuted thunk (consistent with {@link syncShapes}), so callers can batch
|
|
163
|
+
* several together — e.g. a shape plus its referenced object-property shapes:
|
|
164
|
+
* `await Promise.all([syncShape(Person), syncShape(Address)].map((run) => run()))`.
|
|
165
|
+
* @throws if `target` is a framework/meta shape, is not registered, or has no `.shape`.
|
|
166
|
+
*/
|
|
167
|
+
function syncShape(target) {
|
|
168
|
+
// Normalize target → its registered shape class.
|
|
169
|
+
const cls = typeof target === 'string' ? (0, ShapeClass_js_1.getShapeClass)(target) : target;
|
|
170
|
+
if (typeof target === 'string' && !cls) {
|
|
171
|
+
throw new Error(`syncShape: no registered shape for IRI ${target}`);
|
|
172
|
+
}
|
|
173
|
+
const nodeShape = cls === null || cls === void 0 ? void 0 : cls.shape;
|
|
174
|
+
if (!nodeShape) {
|
|
175
|
+
throw new Error(typeof target === 'string'
|
|
176
|
+
? `syncShape: no registered shape for IRI ${target}`
|
|
177
|
+
: `syncShape: shape class has no static .shape`);
|
|
178
|
+
}
|
|
179
|
+
const iri = nodeShape.id;
|
|
180
|
+
// Never materialize a framework/meta shape as user data — same invariant syncShapes() enforces
|
|
181
|
+
// by skipping (the base Shape carries no packageName).
|
|
182
|
+
const pkg = cls.packageName;
|
|
183
|
+
if (!pkg || pkg === FRAMEWORK_PACKAGE) {
|
|
184
|
+
throw new Error(`syncShape: refusing to sync framework/meta shape ${iri}`);
|
|
185
|
+
}
|
|
186
|
+
return buildSyncThunk(nodeShape, iri);
|
|
187
|
+
}
|
|
141
188
|
//# sourceMappingURL=syncShapes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncShapes.js","sourceRo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Shape } from './shapes/syncShapes.js';
|
|
2
2
|
export { rdfList } from './shapes/List.js';
|
|
3
3
|
export { serializePathToNodeData } from './shapes/serializePathToNodeData.js';
|
|
4
4
|
export { QueryBuilder } from './queries/QueryBuilder.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import * as ShapeClass from './utils/ShapeClass.js';
|
|
|
27
27
|
import * as cached from './utils/cached.js';
|
|
28
28
|
import * as List from './shapes/List.js';
|
|
29
29
|
import * as PathNode from './shapes/PathNode.js';
|
|
30
|
-
export { syncShapes } from './shapes/syncShapes.js';
|
|
30
|
+
export { syncShapes, syncShape } from './shapes/syncShapes.js';
|
|
31
31
|
export { rdfList } from './shapes/List.js';
|
|
32
32
|
export { serializePathToNodeData } from './shapes/serializePathToNodeData.js';
|
|
33
33
|
import * as ICoreIterable from './interfaces/ICoreIterable.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,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,W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ClB,kBAAkB;QAClB,oBAAoB;QACpB,cAAc;QACd,mBAAmB;QACnB,mBAAmB;QACnB,mBAAmB;KACpB,CAAC;IACF,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,KAAK,IAAI,SAAS,IAAI,eAAe,EAAE,CAAC;YACtC,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Shape } from './Shape.js';
|
|
1
2
|
/**
|
|
2
3
|
* Plan an idempotent sync of all code-registered (non-framework) NodeShapes into the store as
|
|
3
4
|
* SHACL data — the forward (code → graph) materialization of arch-05 "code is canonical".
|
|
@@ -12,3 +13,18 @@
|
|
|
12
13
|
* cascades too). Reads existing shape IRIs via the global query dispatch for orphan detection.
|
|
13
14
|
*/
|
|
14
15
|
export declare function syncShapes(): Promise<Array<() => Promise<void>>>;
|
|
16
|
+
/**
|
|
17
|
+
* Plan an idempotent sync of ONE code-registered NodeShape into the store as SHACL data.
|
|
18
|
+
*
|
|
19
|
+
* Scoped counterpart to {@link syncShapes}: materializes a single shape (delete → recreate, so the
|
|
20
|
+
* delete cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them)
|
|
21
|
+
* and does NOT run the store-wide orphan sweep — other shapes in the store are untouched.
|
|
22
|
+
*
|
|
23
|
+
* @param target a shape class (e.g. `Person`) or its NodeShape IRI string. An IRI is resolved to
|
|
24
|
+
* its registered class via `getShapeClass`; the shape must be code-registered.
|
|
25
|
+
* @returns a single unexecuted thunk (consistent with {@link syncShapes}), so callers can batch
|
|
26
|
+
* several together — e.g. a shape plus its referenced object-property shapes:
|
|
27
|
+
* `await Promise.all([syncShape(Person), syncShape(Address)].map((run) => run()))`.
|
|
28
|
+
* @throws if `target` is a framework/meta shape, is not registered, or has no `.shape`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function syncShape(target: typeof Shape | string): () => Promise<void>;
|
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
13
13
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
14
14
|
*/
|
|
15
|
-
import { getAllShapeClasses } from '../utils/ShapeClass.js';
|
|
15
|
+
import { getAllShapeClasses, getShapeClass } from '../utils/ShapeClass.js';
|
|
16
16
|
import { NodeShape } from './SHACL.js';
|
|
17
17
|
import { DeleteBuilder } from '../queries/DeleteBuilder.js';
|
|
18
18
|
import { rdfList } from './List.js';
|
|
@@ -87,6 +87,20 @@ function buildNodeShapeData(nodeShape, shapeIri) {
|
|
|
87
87
|
.map((ps) => buildPropertyShapeData(ps, shapeIri));
|
|
88
88
|
return d;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The per-shape `delete → create` thunk shared by `syncShapes()` and `syncShape()`. The delete
|
|
92
|
+
* cascade-cleans the shape's old property-shape / list / path subtrees; the create rebuilds them.
|
|
93
|
+
*/
|
|
94
|
+
function buildSyncThunk(nodeShape, iri) {
|
|
95
|
+
return () => {
|
|
96
|
+
// Build the data fresh on each invocation: the create pipeline mutates the node-data
|
|
97
|
+
// (it strips nested `shape` keys), so a shared object can't be re-used across runs.
|
|
98
|
+
const data = buildNodeShapeData(nodeShape, iri);
|
|
99
|
+
return DeleteBuilder.from(NodeShape, { id: iri }).exec()
|
|
100
|
+
.then(() => NodeShape.create(data).withId(iri).exec())
|
|
101
|
+
.then(() => undefined);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
90
104
|
/**
|
|
91
105
|
* Plan an idempotent sync of all code-registered (non-framework) NodeShapes into the store as
|
|
92
106
|
* SHACL data — the forward (code → graph) materialization of arch-05 "code is canonical".
|
|
@@ -121,10 +135,7 @@ export function syncShapes() {
|
|
|
121
135
|
const thunks = [];
|
|
122
136
|
// 3. Per in-code shape: delete (cascade) then recreate.
|
|
123
137
|
for (const { iri, nodeShape } of userShapes) {
|
|
124
|
-
|
|
125
|
-
thunks.push(() => DeleteBuilder.from(NodeShape, { id: iri }).exec()
|
|
126
|
-
.then(() => (NodeShape.create(data).withId(iri).exec()))
|
|
127
|
-
.then(() => undefined));
|
|
138
|
+
thunks.push(buildSyncThunk(nodeShape, iri));
|
|
128
139
|
}
|
|
129
140
|
// 4. Orphan shapes (in store, not in code) → delete (cascade cleans their owned subtree).
|
|
130
141
|
for (const iri of existingShapeIris) {
|
|
@@ -135,4 +146,39 @@ export function syncShapes() {
|
|
|
135
146
|
return thunks;
|
|
136
147
|
});
|
|
137
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Plan an idempotent sync of ONE code-registered NodeShape into the store as SHACL data.
|
|
151
|
+
*
|
|
152
|
+
* Scoped counterpart to {@link syncShapes}: materializes a single shape (delete → recreate, so the
|
|
153
|
+
* delete cascade-cleans the old property-shape / list / path subtrees and the create rebuilds them)
|
|
154
|
+
* and does NOT run the store-wide orphan sweep — other shapes in the store are untouched.
|
|
155
|
+
*
|
|
156
|
+
* @param target a shape class (e.g. `Person`) or its NodeShape IRI string. An IRI is resolved to
|
|
157
|
+
* its registered class via `getShapeClass`; the shape must be code-registered.
|
|
158
|
+
* @returns a single unexecuted thunk (consistent with {@link syncShapes}), so callers can batch
|
|
159
|
+
* several together — e.g. a shape plus its referenced object-property shapes:
|
|
160
|
+
* `await Promise.all([syncShape(Person), syncShape(Address)].map((run) => run()))`.
|
|
161
|
+
* @throws if `target` is a framework/meta shape, is not registered, or has no `.shape`.
|
|
162
|
+
*/
|
|
163
|
+
export function syncShape(target) {
|
|
164
|
+
// Normalize target → its registered shape class.
|
|
165
|
+
const cls = typeof target === 'string' ? getShapeClass(target) : target;
|
|
166
|
+
if (typeof target === 'string' && !cls) {
|
|
167
|
+
throw new Error(`syncShape: no registered shape for IRI ${target}`);
|
|
168
|
+
}
|
|
169
|
+
const nodeShape = cls === null || cls === void 0 ? void 0 : cls.shape;
|
|
170
|
+
if (!nodeShape) {
|
|
171
|
+
throw new Error(typeof target === 'string'
|
|
172
|
+
? `syncShape: no registered shape for IRI ${target}`
|
|
173
|
+
: `syncShape: shape class has no static .shape`);
|
|
174
|
+
}
|
|
175
|
+
const iri = nodeShape.id;
|
|
176
|
+
// Never materialize a framework/meta shape as user data — same invariant syncShapes() enforces
|
|
177
|
+
// by skipping (the base Shape carries no packageName).
|
|
178
|
+
const pkg = cls.packageName;
|
|
179
|
+
if (!pkg || pkg === FRAMEWORK_PACKAGE) {
|
|
180
|
+
throw new Error(`syncShape: refusing to sync framework/meta shape ${iri}`);
|
|
181
|
+
}
|
|
182
|
+
return buildSyncThunk(nodeShape, iri);
|
|
183
|
+
}
|
|
138
184
|
//# sourceMappingURL=syncShapes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncShapes.js","sourceRoot":"","sources":["../../../src/shapes/syncShapes.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;
|
|
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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