@_linked/core 2.12.0 → 2.13.0-next.20260706164859
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 +6 -0
- package/lib/esm/queries/IRPipeline.d.ts +7 -1
- package/lib/esm/queries/IRPipeline.js +20 -6
- package/lib/esm/queries/IRPipeline.js.map +1 -1
- package/lib/esm/queries/queryDispatch.js +12 -2
- package/lib/esm/queries/queryDispatch.js.map +1 -1
- package/package.json +10 -13
- package/lib/cjs/collections/CoreSet.d.ts +0 -47
- package/lib/cjs/collections/CoreSet.js +0 -136
- package/lib/cjs/collections/CoreSet.js.map +0 -1
- package/lib/cjs/collections/ShapeSet.d.ts +0 -6
- package/lib/cjs/collections/ShapeSet.js +0 -20
- package/lib/cjs/collections/ShapeSet.js.map +0 -1
- package/lib/cjs/expressions/Expr.d.ts +0 -29
- package/lib/cjs/expressions/Expr.js +0 -80
- package/lib/cjs/expressions/Expr.js.map +0 -1
- package/lib/cjs/expressions/ExpressionMethods.d.ts +0 -85
- package/lib/cjs/expressions/ExpressionMethods.js +0 -3
- package/lib/cjs/expressions/ExpressionMethods.js.map +0 -1
- package/lib/cjs/expressions/ExpressionNode.d.ts +0 -144
- package/lib/cjs/expressions/ExpressionNode.js +0 -432
- package/lib/cjs/expressions/ExpressionNode.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -29
- package/lib/cjs/index.js +0 -65
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/ICoreIterable.d.ts +0 -14
- package/lib/cjs/interfaces/ICoreIterable.js +0 -3
- package/lib/cjs/interfaces/ICoreIterable.js.map +0 -1
- package/lib/cjs/interfaces/IDataset.d.ts +0 -26
- package/lib/cjs/interfaces/IDataset.js +0 -3
- package/lib/cjs/interfaces/IDataset.js.map +0 -1
- package/lib/cjs/interfaces/IFileStore.d.ts +0 -16
- package/lib/cjs/interfaces/IFileStore.js +0 -3
- package/lib/cjs/interfaces/IFileStore.js.map +0 -1
- package/lib/cjs/ontologies/linked-core.d.ts +0 -15
- package/lib/cjs/ontologies/linked-core.js +0 -38
- package/lib/cjs/ontologies/linked-core.js.map +0 -1
- package/lib/cjs/ontologies/npm.d.ts +0 -6
- package/lib/cjs/ontologies/npm.js +0 -15
- package/lib/cjs/ontologies/npm.js.map +0 -1
- package/lib/cjs/ontologies/owl.d.ts +0 -14
- package/lib/cjs/ontologies/owl.js +0 -21
- package/lib/cjs/ontologies/owl.js.map +0 -1
- package/lib/cjs/ontologies/rdf.d.ts +0 -13
- package/lib/cjs/ontologies/rdf.js +0 -27
- package/lib/cjs/ontologies/rdf.js.map +0 -1
- package/lib/cjs/ontologies/rdfs.d.ts +0 -16
- package/lib/cjs/ontologies/rdfs.js +0 -33
- package/lib/cjs/ontologies/rdfs.js.map +0 -1
- package/lib/cjs/ontologies/shacl.d.ts +0 -103
- package/lib/cjs/ontologies/shacl.js +0 -152
- package/lib/cjs/ontologies/shacl.js.map +0 -1
- package/lib/cjs/ontologies/xsd.d.ts +0 -19
- package/lib/cjs/ontologies/xsd.js +0 -41
- package/lib/cjs/ontologies/xsd.js.map +0 -1
- package/lib/cjs/package.d.ts +0 -4
- package/lib/cjs/package.js +0 -6
- package/lib/cjs/package.js.map +0 -1
- package/lib/cjs/package.json +0 -9
- package/lib/cjs/paths/PropertyPathExpr.d.ts +0 -38
- package/lib/cjs/paths/PropertyPathExpr.js +0 -221
- package/lib/cjs/paths/PropertyPathExpr.js.map +0 -1
- package/lib/cjs/paths/normalizePropertyPath.d.ts +0 -23
- package/lib/cjs/paths/normalizePropertyPath.js +0 -75
- package/lib/cjs/paths/normalizePropertyPath.js.map +0 -1
- package/lib/cjs/paths/pathExprToSparql.d.ts +0 -14
- package/lib/cjs/paths/pathExprToSparql.js +0 -136
- package/lib/cjs/paths/pathExprToSparql.js.map +0 -1
- package/lib/cjs/queries/ContextRef.d.ts +0 -32
- package/lib/cjs/queries/ContextRef.js +0 -69
- package/lib/cjs/queries/ContextRef.js.map +0 -1
- package/lib/cjs/queries/CreateBuilder.d.ts +0 -59
- package/lib/cjs/queries/CreateBuilder.js +0 -138
- package/lib/cjs/queries/CreateBuilder.js.map +0 -1
- package/lib/cjs/queries/CreateQuery.d.ts +0 -20
- package/lib/cjs/queries/CreateQuery.js +0 -3
- package/lib/cjs/queries/CreateQuery.js.map +0 -1
- package/lib/cjs/queries/DeleteBuilder.d.ts +0 -56
- package/lib/cjs/queries/DeleteBuilder.js +0 -172
- package/lib/cjs/queries/DeleteBuilder.js.map +0 -1
- package/lib/cjs/queries/DeleteQuery.d.ts +0 -37
- package/lib/cjs/queries/DeleteQuery.js +0 -3
- package/lib/cjs/queries/DeleteQuery.js.map +0 -1
- package/lib/cjs/queries/DslJsonExpression.d.ts +0 -68
- package/lib/cjs/queries/DslJsonExpression.js +0 -427
- package/lib/cjs/queries/DslJsonExpression.js.map +0 -1
- package/lib/cjs/queries/FieldSet.d.ts +0 -310
- package/lib/cjs/queries/FieldSet.js +0 -802
- package/lib/cjs/queries/FieldSet.js.map +0 -1
- package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
- package/lib/cjs/queries/IRAliasScope.js +0 -52
- package/lib/cjs/queries/IRAliasScope.js.map +0 -1
- package/lib/cjs/queries/IRCanonicalize.d.ts +0 -19
- package/lib/cjs/queries/IRCanonicalize.js +0 -19
- package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
- package/lib/cjs/queries/IRDesugar.d.ts +0 -123
- package/lib/cjs/queries/IRDesugar.js +0 -261
- package/lib/cjs/queries/IRDesugar.js.map +0 -1
- package/lib/cjs/queries/IRLower.d.ts +0 -25
- package/lib/cjs/queries/IRLower.js +0 -398
- package/lib/cjs/queries/IRLower.js.map +0 -1
- package/lib/cjs/queries/IRMutation.d.ts +0 -53
- package/lib/cjs/queries/IRMutation.js +0 -130
- package/lib/cjs/queries/IRMutation.js.map +0 -1
- package/lib/cjs/queries/IRPipeline.d.ts +0 -8
- package/lib/cjs/queries/IRPipeline.js +0 -25
- package/lib/cjs/queries/IRPipeline.js.map +0 -1
- package/lib/cjs/queries/IRProjection.d.ts +0 -39
- package/lib/cjs/queries/IRProjection.js +0 -105
- package/lib/cjs/queries/IRProjection.js.map +0 -1
- package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -282
- package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
- package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
- package/lib/cjs/queries/MutationQuery.d.ts +0 -50
- package/lib/cjs/queries/MutationQuery.js +0 -334
- package/lib/cjs/queries/MutationQuery.js.map +0 -1
- package/lib/cjs/queries/MutationSerialization.d.ts +0 -102
- package/lib/cjs/queries/MutationSerialization.js +0 -207
- package/lib/cjs/queries/MutationSerialization.js.map +0 -1
- package/lib/cjs/queries/MutationThenable.d.ts +0 -18
- package/lib/cjs/queries/MutationThenable.js +0 -32
- package/lib/cjs/queries/MutationThenable.js.map +0 -1
- package/lib/cjs/queries/PropertyPath.d.ts +0 -38
- package/lib/cjs/queries/PropertyPath.js +0 -82
- package/lib/cjs/queries/PropertyPath.js.map +0 -1
- package/lib/cjs/queries/ProxiedPathBuilder.d.ts +0 -14
- package/lib/cjs/queries/ProxiedPathBuilder.js +0 -29
- package/lib/cjs/queries/ProxiedPathBuilder.js.map +0 -1
- package/lib/cjs/queries/QueryBuilder.d.ts +0 -193
- package/lib/cjs/queries/QueryBuilder.js +0 -519
- package/lib/cjs/queries/QueryBuilder.js.map +0 -1
- package/lib/cjs/queries/QueryBuilderSerialization.d.ts +0 -31
- package/lib/cjs/queries/QueryBuilderSerialization.js +0 -68
- package/lib/cjs/queries/QueryBuilderSerialization.js.map +0 -1
- package/lib/cjs/queries/QueryContext.d.ts +0 -50
- package/lib/cjs/queries/QueryContext.js +0 -147
- package/lib/cjs/queries/QueryContext.js.map +0 -1
- package/lib/cjs/queries/QueryFactory.d.ts +0 -80
- package/lib/cjs/queries/QueryFactory.js +0 -21
- package/lib/cjs/queries/QueryFactory.js.map +0 -1
- package/lib/cjs/queries/SelectQuery.d.ts +0 -302
- package/lib/cjs/queries/SelectQuery.js +0 -761
- package/lib/cjs/queries/SelectQuery.js.map +0 -1
- package/lib/cjs/queries/UpdateBuilder.d.ts +0 -69
- package/lib/cjs/queries/UpdateBuilder.js +0 -199
- package/lib/cjs/queries/UpdateBuilder.js.map +0 -1
- package/lib/cjs/queries/UpdateQuery.d.ts +0 -18
- package/lib/cjs/queries/UpdateQuery.js +0 -3
- package/lib/cjs/queries/UpdateQuery.js.map +0 -1
- package/lib/cjs/queries/fromJSON.d.ts +0 -16
- package/lib/cjs/queries/fromJSON.js +0 -41
- package/lib/cjs/queries/fromJSON.js.map +0 -1
- package/lib/cjs/queries/lower.d.ts +0 -28
- package/lib/cjs/queries/lower.js +0 -114
- package/lib/cjs/queries/lower.js.map +0 -1
- package/lib/cjs/queries/lowerMutationJSON.d.ts +0 -25
- package/lib/cjs/queries/lowerMutationJSON.js +0 -173
- package/lib/cjs/queries/lowerMutationJSON.js.map +0 -1
- package/lib/cjs/queries/mutationLowerSpec.d.ts +0 -32
- package/lib/cjs/queries/mutationLowerSpec.js +0 -8
- package/lib/cjs/queries/mutationLowerSpec.js.map +0 -1
- package/lib/cjs/queries/queryDispatch.d.ts +0 -33
- package/lib/cjs/queries/queryDispatch.js +0 -33
- package/lib/cjs/queries/queryDispatch.js.map +0 -1
- package/lib/cjs/queries/resolveShape.d.ts +0 -10
- package/lib/cjs/queries/resolveShape.js +0 -23
- package/lib/cjs/queries/resolveShape.js.map +0 -1
- package/lib/cjs/queries/wireVersion.d.ts +0 -7
- package/lib/cjs/queries/wireVersion.js +0 -25
- package/lib/cjs/queries/wireVersion.js.map +0 -1
- package/lib/cjs/shapes/List.d.ts +0 -35
- package/lib/cjs/shapes/List.js +0 -72
- package/lib/cjs/shapes/List.js.map +0 -1
- package/lib/cjs/shapes/PathNode.d.ts +0 -20
- package/lib/cjs/shapes/PathNode.js +0 -68
- package/lib/cjs/shapes/PathNode.js.map +0 -1
- package/lib/cjs/shapes/SHACL.d.ts +0 -300
- package/lib/cjs/shapes/SHACL.js +0 -612
- package/lib/cjs/shapes/SHACL.js.map +0 -1
- package/lib/cjs/shapes/Shape.d.ts +0 -74
- package/lib/cjs/shapes/Shape.js +0 -124
- package/lib/cjs/shapes/Shape.js.map +0 -1
- package/lib/cjs/shapes/serializePathToNodeData.d.ts +0 -24
- package/lib/cjs/shapes/serializePathToNodeData.js +0 -67
- package/lib/cjs/shapes/serializePathToNodeData.js.map +0 -1
- package/lib/cjs/shapes/syncShapes.d.ts +0 -38
- package/lib/cjs/shapes/syncShapes.js +0 -214
- package/lib/cjs/shapes/syncShapes.js.map +0 -1
- package/lib/cjs/sparql/SparqlAlgebra.d.ts +0 -190
- package/lib/cjs/sparql/SparqlAlgebra.js +0 -4
- package/lib/cjs/sparql/SparqlAlgebra.js.map +0 -1
- package/lib/cjs/sparql/SparqlDataset.d.ts +0 -60
- package/lib/cjs/sparql/SparqlDataset.js +0 -117
- package/lib/cjs/sparql/SparqlDataset.js.map +0 -1
- package/lib/cjs/sparql/algebraToString.d.ts +0 -13
- package/lib/cjs/sparql/algebraToString.js +0 -385
- package/lib/cjs/sparql/algebraToString.js.map +0 -1
- package/lib/cjs/sparql/index.d.ts +0 -9
- package/lib/cjs/sparql/index.js +0 -41
- package/lib/cjs/sparql/index.js.map +0 -1
- package/lib/cjs/sparql/irToAlgebra.d.ts +0 -79
- package/lib/cjs/sparql/irToAlgebra.js +0 -2042
- package/lib/cjs/sparql/irToAlgebra.js.map +0 -1
- package/lib/cjs/sparql/resultMapping.d.ts +0 -36
- package/lib/cjs/sparql/resultMapping.js +0 -563
- package/lib/cjs/sparql/resultMapping.js.map +0 -1
- package/lib/cjs/sparql/sparqlUtils.d.ts +0 -53
- package/lib/cjs/sparql/sparqlUtils.js +0 -154
- package/lib/cjs/sparql/sparqlUtils.js.map +0 -1
- package/lib/cjs/utils/LinkedErrorLogging.d.ts +0 -13
- package/lib/cjs/utils/LinkedErrorLogging.js +0 -22
- package/lib/cjs/utils/LinkedErrorLogging.js.map +0 -1
- package/lib/cjs/utils/LinkedFileStorage.d.ts +0 -23
- package/lib/cjs/utils/LinkedFileStorage.js +0 -62
- package/lib/cjs/utils/LinkedFileStorage.js.map +0 -1
- package/lib/cjs/utils/LinkedStorage.d.ts +0 -40
- package/lib/cjs/utils/LinkedStorage.js +0 -148
- package/lib/cjs/utils/LinkedStorage.js.map +0 -1
- package/lib/cjs/utils/NameSpace.d.ts +0 -2
- package/lib/cjs/utils/NameSpace.js +0 -8
- package/lib/cjs/utils/NameSpace.js.map +0 -1
- package/lib/cjs/utils/NodeReference.d.ts +0 -30
- package/lib/cjs/utils/NodeReference.js +0 -54
- package/lib/cjs/utils/NodeReference.js.map +0 -1
- package/lib/cjs/utils/Package.d.ts +0 -153
- package/lib/cjs/utils/Package.js +0 -419
- package/lib/cjs/utils/Package.js.map +0 -1
- package/lib/cjs/utils/Prefix.d.ts +0 -22
- package/lib/cjs/utils/Prefix.js +0 -104
- package/lib/cjs/utils/Prefix.js.map +0 -1
- package/lib/cjs/utils/ShapeClass.d.ts +0 -30
- package/lib/cjs/utils/ShapeClass.js +0 -180
- package/lib/cjs/utils/ShapeClass.js.map +0 -1
- package/lib/cjs/utils/URI.d.ts +0 -18
- package/lib/cjs/utils/URI.js +0 -42
- package/lib/cjs/utils/URI.js.map +0 -1
- package/lib/cjs/utils/cached.d.ts +0 -14
- package/lib/cjs/utils/cached.js +0 -71
- package/lib/cjs/utils/cached.js.map +0 -1
- package/lib/cjs/utils/loadStores.d.ts +0 -34
- package/lib/cjs/utils/loadStores.js +0 -105
- package/lib/cjs/utils/loadStores.js.map +0 -1
- package/lib/cjs/utils/parseDatasetsConfig.d.ts +0 -49
- package/lib/cjs/utils/parseDatasetsConfig.js +0 -110
- package/lib/cjs/utils/parseDatasetsConfig.js.map +0 -1
- package/lib/esm/package.json +0 -9
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DeleteBuilder = void 0;
|
|
13
|
-
const resolveShape_js_1 = require("./resolveShape.js");
|
|
14
|
-
const MutationThenable_js_1 = require("./MutationThenable.js");
|
|
15
|
-
const queryDispatch_js_1 = require("./queryDispatch.js");
|
|
16
|
-
const wireVersion_js_1 = require("./wireVersion.js");
|
|
17
|
-
const SelectQuery_js_1 = require("./SelectQuery.js");
|
|
18
|
-
const QueryBuilderSerialization_js_1 = require("./QueryBuilderSerialization.js");
|
|
19
|
-
const QueryContext_js_1 = require("./QueryContext.js");
|
|
20
|
-
const ContextRef_js_1 = require("./ContextRef.js");
|
|
21
|
-
/**
|
|
22
|
-
* An immutable, fluent builder for delete mutations.
|
|
23
|
-
*
|
|
24
|
-
* Implements PromiseLike so mutations execute on `await`:
|
|
25
|
-
* ```ts
|
|
26
|
-
* const result = await DeleteBuilder.from(Person, {id: '...'});
|
|
27
|
-
* await DeleteBuilder.from(Person).all(); // returns void
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* R is the resolved type: DeleteResponse for ID-based, void for bulk operations.
|
|
31
|
-
*/
|
|
32
|
-
class DeleteBuilder extends MutationThenable_js_1.MutationThenable {
|
|
33
|
-
constructor(init) {
|
|
34
|
-
super();
|
|
35
|
-
this._tag = 'DeleteBuilder';
|
|
36
|
-
// ---------------------------------------------------------------------------
|
|
37
|
-
// Build & execute
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
/** Discriminator for the free `lower()` function and dataset routing. */
|
|
40
|
-
this.__queryKind = 'delete';
|
|
41
|
-
this._shape = init.shape;
|
|
42
|
-
this._ids = init.ids;
|
|
43
|
-
this._mode = init.mode;
|
|
44
|
-
this._whereFn = init.whereFn;
|
|
45
|
-
this._where = init.where;
|
|
46
|
-
}
|
|
47
|
-
clone(overrides = {}) {
|
|
48
|
-
return new DeleteBuilder(Object.assign({ shape: this._shape, ids: this._ids, mode: this._mode, whereFn: this._whereFn, where: this._where }, overrides));
|
|
49
|
-
}
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// Static constructors
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
static from(shape, ids) {
|
|
54
|
-
const resolved = (0, resolveShape_js_1.resolveShape)(shape);
|
|
55
|
-
if (ids !== undefined) {
|
|
56
|
-
// Normalize any context reference (unset PendingQueryContext or a resolved
|
|
57
|
-
// context shape) to a {@ctx} marker so set/unset behave identically.
|
|
58
|
-
const idsArray = (Array.isArray(ids) ? ids : [ids]).map((id) => { var _a; return (_a = (0, QueryContext_js_1.asContextRef)(id)) !== null && _a !== void 0 ? _a : id; });
|
|
59
|
-
return new DeleteBuilder({ shape: resolved, ids: idsArray, mode: 'ids' });
|
|
60
|
-
}
|
|
61
|
-
return new DeleteBuilder({ shape: resolved });
|
|
62
|
-
}
|
|
63
|
-
/** Reconstruct a DeleteBuilder from its DSL-JSON (inverse of `toJSON`). */
|
|
64
|
-
static fromJSON(json) {
|
|
65
|
-
(0, wireVersion_js_1.assertWireVersion)(json.v);
|
|
66
|
-
const resolved = (0, resolveShape_js_1.resolveShape)(json.shape);
|
|
67
|
-
if (json.mode === 'ids') {
|
|
68
|
-
// A `{@ctx}` id rehydrates as a live context ref (resolved at lower).
|
|
69
|
-
const ids = json.ids.map((id) => (0, ContextRef_js_1.isContextRefJSON)(id) ? new QueryContext_js_1.PendingQueryContext(id['@ctx']) : { id });
|
|
70
|
-
return new DeleteBuilder({ shape: resolved, ids, mode: 'ids' });
|
|
71
|
-
}
|
|
72
|
-
if (json.mode === 'all') {
|
|
73
|
-
return new DeleteBuilder({ shape: resolved, mode: 'all' });
|
|
74
|
-
}
|
|
75
|
-
const where = (0, QueryBuilderSerialization_js_1.deserializeWherePath)(resolved.shape, json.where);
|
|
76
|
-
return new DeleteBuilder({ shape: resolved, mode: 'where', where });
|
|
77
|
-
}
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
|
-
// Fluent API
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
/** Delete all instances of this shape type. Returns void. */
|
|
82
|
-
all() {
|
|
83
|
-
return this.clone({ mode: 'all', ids: undefined, whereFn: undefined });
|
|
84
|
-
}
|
|
85
|
-
/** Delete instances matching a condition. Returns void. */
|
|
86
|
-
where(fn) {
|
|
87
|
-
return this.clone({ mode: 'where', whereFn: fn, ids: undefined });
|
|
88
|
-
}
|
|
89
|
-
/** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
|
|
90
|
-
get shape() {
|
|
91
|
-
return this._shape.shape;
|
|
92
|
-
}
|
|
93
|
-
/** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
|
|
94
|
-
_lowerSpec() {
|
|
95
|
-
var _a;
|
|
96
|
-
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
97
|
-
if (mode === 'all') {
|
|
98
|
-
return { shapeClass: this._shape, mode: 'all' };
|
|
99
|
-
}
|
|
100
|
-
if (mode === 'where') {
|
|
101
|
-
const wherePath = (_a = this._where) !== null && _a !== void 0 ? _a : (this._whereFn ? (0, SelectQuery_js_1.processWhereClause)(this._whereFn, this._shape) : undefined);
|
|
102
|
-
if (!wherePath) {
|
|
103
|
-
throw new Error('DeleteBuilder.where() requires a condition callback.');
|
|
104
|
-
}
|
|
105
|
-
return { shapeClass: this._shape, mode: 'where', wherePath };
|
|
106
|
-
}
|
|
107
|
-
// Default: ID-based delete
|
|
108
|
-
if (!this._ids || this._ids.length === 0) {
|
|
109
|
-
throw new Error('DeleteBuilder requires at least one ID to delete. Use DeleteBuilder.from(shape, ids), .all(), or .where().');
|
|
110
|
-
}
|
|
111
|
-
return { shapeClass: this._shape, mode: 'ids', ids: this._ids };
|
|
112
|
-
}
|
|
113
|
-
/** Serialize this delete mutation to lightweight DSL-JSON. */
|
|
114
|
-
toJSON() {
|
|
115
|
-
var _a;
|
|
116
|
-
const shape = this._shape.shape.id;
|
|
117
|
-
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
118
|
-
if (mode === 'all') {
|
|
119
|
-
return { v: wireVersion_js_1.WIRE_VERSION, op: 'delete', shape, mode: 'all' };
|
|
120
|
-
}
|
|
121
|
-
if (mode === 'where') {
|
|
122
|
-
const wherePath = (_a = this._where) !== null && _a !== void 0 ? _a : (this._whereFn ? (0, SelectQuery_js_1.processWhereClause)(this._whereFn, this._shape) : undefined);
|
|
123
|
-
if (!wherePath) {
|
|
124
|
-
throw new Error('DeleteBuilder.where() requires a condition callback.');
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
v: wireVersion_js_1.WIRE_VERSION,
|
|
128
|
-
op: 'delete',
|
|
129
|
-
shape,
|
|
130
|
-
mode: 'where',
|
|
131
|
-
where: (0, QueryBuilderSerialization_js_1.serializeWherePath)(wherePath, this._shape.shape),
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
if (!this._ids || this._ids.length === 0) {
|
|
135
|
-
throw new Error('DeleteBuilder requires at least one ID, .all(), or .where() before .toJSON().');
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
v: wireVersion_js_1.WIRE_VERSION,
|
|
139
|
-
op: 'delete',
|
|
140
|
-
shape,
|
|
141
|
-
mode: 'ids',
|
|
142
|
-
ids: this._ids.map((id) =>
|
|
143
|
-
// An unresolved context ref travels as a `{@ctx}` marker; a concrete id
|
|
144
|
-
// (string or `{id}`, incl. a resolved context shape) as a plain string.
|
|
145
|
-
id instanceof QueryContext_js_1.PendingQueryContext
|
|
146
|
-
? (0, ContextRef_js_1.encodeContextRef)(id.contextName)
|
|
147
|
-
: typeof id === 'string'
|
|
148
|
-
? id
|
|
149
|
-
: id.id),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Execute the mutation.
|
|
154
|
-
*
|
|
155
|
-
* @param target Optional explicit dataset (a store or a router) to run against. Omitted →
|
|
156
|
-
* the global query dispatch. A `target` runs on that dataset only; the global router is
|
|
157
|
-
* untouched. Rejects if the target dataset doesn't implement delete.
|
|
158
|
-
*/
|
|
159
|
-
exec(target) {
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
162
|
-
const result = (0, queryDispatch_js_1.resolveMutationDispatch)('delete', target).deleteQuery(this);
|
|
163
|
-
// Bulk (all/where) resolves to void; id-based resolves to the DeleteResponse.
|
|
164
|
-
if (mode === 'all' || mode === 'where') {
|
|
165
|
-
return result.then(() => undefined);
|
|
166
|
-
}
|
|
167
|
-
return result;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
exports.DeleteBuilder = DeleteBuilder;
|
|
172
|
-
//# sourceMappingURL=DeleteBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteBuilder.js","sourceRoot":"","sources":["../../../src/queries/DeleteBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uDAA+C;AAG/C,+DAAuD;AACvD,yDAA2D;AAE3D,qDAAiE;AAEjE,qDAAsF;AAEtF,iFAAwF;AAExF,uDAAoE;AACpE,mDAAmE;AAmBnE;;;;;;;;;;GAUG;AACH,MAAa,aACX,SAAQ,sCAAmB;IAS3B,YAAoB,IAA0B;QAC5C,KAAK,EAAE,CAAC;QARS,SAAI,G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AAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;QACJ,CAAC;QACD,OAAO;YACL,CAAC,EAAE,6BAAY;YACf,EAAE,EAAE,QAAQ;YACZ,KAAK;YACL,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YACxB,wEAAwE;YACxE,wEAAwE;YACxE,EAAE,YAAY,qCAAmB;gBAC/B,CAAC,CAAC,IAAA,gCAAgB,EAAC,EAAE,CAAC,WAAW,CAAC;gBAClC,CAAC,CAAC,OAAO,EAAE,KAAK,QAAQ;oBACtB,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,CAAC,EAAE,CACZ;SACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACG,IAAI,CAAC,MAAiB;;YAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC3D,MAAM,MAAM,GAAG,IAAA,0CAAuB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC3E,8EAA8E;YAC9E,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACvC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAe,CAAC;YACpD,CAAC;YACD,OAAO,MAAoB,CAAC;QAC9B,CAAC;KAAA;CAEF;AAnLD,sCAmLC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { NodeReferenceValue } from './QueryFactory.js';
|
|
2
|
-
import type { IRDeleteMutation, IRDeleteAllMutation, IRDeleteWhereMutation } from './IntermediateRepresentation.js';
|
|
3
|
-
import type { NodeShape } from '../shapes/SHACL.js';
|
|
4
|
-
import type { DeleteMutationJSON } from './MutationSerialization.js';
|
|
5
|
-
import type { DeleteLowerSpec } from './mutationLowerSpec.js';
|
|
6
|
-
/**
|
|
7
|
-
* The closed, read-only delete query a dataset receives (implemented by
|
|
8
|
-
* `DeleteBuilder`). The IR is `IRDeleteQuery`, produced by `lower(query)` — the
|
|
9
|
-
* IR construction lives in the IR tier, not here, so this module stays IR-free.
|
|
10
|
-
*/
|
|
11
|
-
export interface DeleteQuery {
|
|
12
|
-
readonly __queryKind: 'delete';
|
|
13
|
-
readonly shape: NodeShape;
|
|
14
|
-
toJSON(): DeleteMutationJSON;
|
|
15
|
-
/** @internal IR-free lowering spec consumed by `lower()`. */
|
|
16
|
-
_lowerSpec(): DeleteLowerSpec;
|
|
17
|
-
}
|
|
18
|
-
/** The lowered IR for a delete mutation (what `lower()` produces). */
|
|
19
|
-
export type IRDeleteQuery = IRDeleteMutation | IRDeleteAllMutation | IRDeleteWhereMutation;
|
|
20
|
-
export type DeleteResponse = {
|
|
21
|
-
/**
|
|
22
|
-
* The IDs of the items that were successfully deleted.
|
|
23
|
-
*/
|
|
24
|
-
deleted: NodeReferenceValue[];
|
|
25
|
-
/**
|
|
26
|
-
* The number of successfully deleted items.
|
|
27
|
-
*/
|
|
28
|
-
count: number;
|
|
29
|
-
/**
|
|
30
|
-
* The IDs of the items that couldn't be deleted.
|
|
31
|
-
*/
|
|
32
|
-
failed?: NodeReferenceValue[];
|
|
33
|
-
/**
|
|
34
|
-
* A mapping of IDs to error messages for the items that couldn't be deleted.
|
|
35
|
-
*/
|
|
36
|
-
errors?: Record<string, string>;
|
|
37
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":""}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DSL-JSON expression codec — the bidirectional bridge between the runtime
|
|
3
|
-
* expression IR (`ExpressionNode` = `{ir, refs}`, `ExistsCondition`) and the
|
|
4
|
-
* DSL-JSON wire grammar (documentation/dsl-json.md).
|
|
5
|
-
*
|
|
6
|
-
* Two tiers:
|
|
7
|
-
* - VALUE (`encodeValueExpr`/`decodeValueExpr`): a computed value or an
|
|
8
|
-
* operand — bare scalar, `{@path}`, `{@id}`, `{@ctx}`, `{@date}`,
|
|
9
|
-
* `{@list}`, or an S-expr array `["op", …]`.
|
|
10
|
-
* - CONDITION (`encodeCondition`/`decodeCondition`): a boolean where-clause —
|
|
11
|
-
* path-keyed object (implicit equals / operator map / quantifier),
|
|
12
|
-
* `{and|or|not}`, or an S-expr array fallback.
|
|
13
|
-
*
|
|
14
|
-
* The codec is pure and shape-aware: it resolves property labels against the
|
|
15
|
-
* supplied `NodeShape`, and never touches builder internals. Function and
|
|
16
|
-
* aggregate names are kept verbatim from the IR (e.g. `STRLEN`, `count`) — no
|
|
17
|
-
* name map, lossless round-trip. Round-trip-through-`lower` is the contract.
|
|
18
|
-
*/
|
|
19
|
-
import type { IRExpression } from './IntermediateRepresentation.js';
|
|
20
|
-
import { ExpressionNode, ExistsCondition, type PropertyRefMap } from '../expressions/ExpressionNode.js';
|
|
21
|
-
import type { NodeShape } from '../shapes/SHACL.js';
|
|
22
|
-
import type { WherePath } from './SelectQuery.js';
|
|
23
|
-
export type DslJsonScalar = string | number | boolean | null;
|
|
24
|
-
export type DslJsonRef = {
|
|
25
|
-
'@id': string;
|
|
26
|
-
};
|
|
27
|
-
export type DslJsonCtx = {
|
|
28
|
-
'@ctx': string;
|
|
29
|
-
'@path'?: string;
|
|
30
|
-
};
|
|
31
|
-
export type DslJsonDate = {
|
|
32
|
-
'@date': string;
|
|
33
|
-
};
|
|
34
|
-
export type DslJsonList = {
|
|
35
|
-
'@list': DslJsonValue[];
|
|
36
|
-
};
|
|
37
|
-
export type DslJsonPath = {
|
|
38
|
-
'@path': string;
|
|
39
|
-
};
|
|
40
|
-
export type DslJsonSExpr = [string, ...DslJsonValue[]];
|
|
41
|
-
export type DslJsonValue = DslJsonScalar | DslJsonRef | DslJsonCtx | DslJsonDate | DslJsonList | DslJsonPath | DslJsonSExpr;
|
|
42
|
-
export type DslJsonOpMap = {
|
|
43
|
-
[op: string]: DslJsonValue;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* A DSL-JSON condition: an S-expr array, or a keyed object whose keys are property
|
|
47
|
-
* paths (→ value / operator-map), quantifier keys like `rel.some` (→ a nested
|
|
48
|
-
* condition), or combinators `and`/`or` (→ a condition array) / `not` (→ a
|
|
49
|
-
* condition). The permissive index reflects the structural wire shape.
|
|
50
|
-
*/
|
|
51
|
-
export type DslJsonCondition = DslJsonSExpr | {
|
|
52
|
-
[key: string]: DslJsonValue | DslJsonOpMap | DslJsonCondition | DslJsonCondition[];
|
|
53
|
-
};
|
|
54
|
-
/** Property-shape IRIs → a dotted label path. */
|
|
55
|
-
export declare function segmentsToPath(segmentIds: readonly string[]): string;
|
|
56
|
-
/** A dotted label path → its property-shape IRIs, resolved against `shape`. */
|
|
57
|
-
export declare function pathToSegmentIds(shape: NodeShape, path: string): string[];
|
|
58
|
-
/** Encode an IR expression used as a value/operand into a DSL-JSON value. */
|
|
59
|
-
export declare function encodeValueExpr(ir: IRExpression, refs: PropertyRefMap): DslJsonValue;
|
|
60
|
-
/** Decode a DSL-JSON value back into an IR expression + its placeholder refs. */
|
|
61
|
-
export declare function decodeValueExpr(json: DslJsonValue, shape: NodeShape): {
|
|
62
|
-
ir: IRExpression;
|
|
63
|
-
refs: PropertyRefMap;
|
|
64
|
-
};
|
|
65
|
-
/** Encode a where-clause node (boolean) into a DSL-JSON condition. */
|
|
66
|
-
export declare function encodeCondition(node: ExpressionNode | ExistsCondition, shape: NodeShape): DslJsonCondition;
|
|
67
|
-
/** Decode a DSL-JSON condition into a runtime WherePath (`{expressionNode}` | `{existsCondition}`). */
|
|
68
|
-
export declare function decodeCondition(json: DslJsonCondition, shape: NodeShape): WherePath;
|