@_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.
Files changed (246) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/esm/queries/IRPipeline.d.ts +7 -1
  3. package/lib/esm/queries/IRPipeline.js +20 -6
  4. package/lib/esm/queries/IRPipeline.js.map +1 -1
  5. package/lib/esm/queries/queryDispatch.js +12 -2
  6. package/lib/esm/queries/queryDispatch.js.map +1 -1
  7. package/package.json +10 -13
  8. package/lib/cjs/collections/CoreSet.d.ts +0 -47
  9. package/lib/cjs/collections/CoreSet.js +0 -136
  10. package/lib/cjs/collections/CoreSet.js.map +0 -1
  11. package/lib/cjs/collections/ShapeSet.d.ts +0 -6
  12. package/lib/cjs/collections/ShapeSet.js +0 -20
  13. package/lib/cjs/collections/ShapeSet.js.map +0 -1
  14. package/lib/cjs/expressions/Expr.d.ts +0 -29
  15. package/lib/cjs/expressions/Expr.js +0 -80
  16. package/lib/cjs/expressions/Expr.js.map +0 -1
  17. package/lib/cjs/expressions/ExpressionMethods.d.ts +0 -85
  18. package/lib/cjs/expressions/ExpressionMethods.js +0 -3
  19. package/lib/cjs/expressions/ExpressionMethods.js.map +0 -1
  20. package/lib/cjs/expressions/ExpressionNode.d.ts +0 -144
  21. package/lib/cjs/expressions/ExpressionNode.js +0 -432
  22. package/lib/cjs/expressions/ExpressionNode.js.map +0 -1
  23. package/lib/cjs/index.d.ts +0 -29
  24. package/lib/cjs/index.js +0 -65
  25. package/lib/cjs/index.js.map +0 -1
  26. package/lib/cjs/interfaces/ICoreIterable.d.ts +0 -14
  27. package/lib/cjs/interfaces/ICoreIterable.js +0 -3
  28. package/lib/cjs/interfaces/ICoreIterable.js.map +0 -1
  29. package/lib/cjs/interfaces/IDataset.d.ts +0 -26
  30. package/lib/cjs/interfaces/IDataset.js +0 -3
  31. package/lib/cjs/interfaces/IDataset.js.map +0 -1
  32. package/lib/cjs/interfaces/IFileStore.d.ts +0 -16
  33. package/lib/cjs/interfaces/IFileStore.js +0 -3
  34. package/lib/cjs/interfaces/IFileStore.js.map +0 -1
  35. package/lib/cjs/ontologies/linked-core.d.ts +0 -15
  36. package/lib/cjs/ontologies/linked-core.js +0 -38
  37. package/lib/cjs/ontologies/linked-core.js.map +0 -1
  38. package/lib/cjs/ontologies/npm.d.ts +0 -6
  39. package/lib/cjs/ontologies/npm.js +0 -15
  40. package/lib/cjs/ontologies/npm.js.map +0 -1
  41. package/lib/cjs/ontologies/owl.d.ts +0 -14
  42. package/lib/cjs/ontologies/owl.js +0 -21
  43. package/lib/cjs/ontologies/owl.js.map +0 -1
  44. package/lib/cjs/ontologies/rdf.d.ts +0 -13
  45. package/lib/cjs/ontologies/rdf.js +0 -27
  46. package/lib/cjs/ontologies/rdf.js.map +0 -1
  47. package/lib/cjs/ontologies/rdfs.d.ts +0 -16
  48. package/lib/cjs/ontologies/rdfs.js +0 -33
  49. package/lib/cjs/ontologies/rdfs.js.map +0 -1
  50. package/lib/cjs/ontologies/shacl.d.ts +0 -103
  51. package/lib/cjs/ontologies/shacl.js +0 -152
  52. package/lib/cjs/ontologies/shacl.js.map +0 -1
  53. package/lib/cjs/ontologies/xsd.d.ts +0 -19
  54. package/lib/cjs/ontologies/xsd.js +0 -41
  55. package/lib/cjs/ontologies/xsd.js.map +0 -1
  56. package/lib/cjs/package.d.ts +0 -4
  57. package/lib/cjs/package.js +0 -6
  58. package/lib/cjs/package.js.map +0 -1
  59. package/lib/cjs/package.json +0 -9
  60. package/lib/cjs/paths/PropertyPathExpr.d.ts +0 -38
  61. package/lib/cjs/paths/PropertyPathExpr.js +0 -221
  62. package/lib/cjs/paths/PropertyPathExpr.js.map +0 -1
  63. package/lib/cjs/paths/normalizePropertyPath.d.ts +0 -23
  64. package/lib/cjs/paths/normalizePropertyPath.js +0 -75
  65. package/lib/cjs/paths/normalizePropertyPath.js.map +0 -1
  66. package/lib/cjs/paths/pathExprToSparql.d.ts +0 -14
  67. package/lib/cjs/paths/pathExprToSparql.js +0 -136
  68. package/lib/cjs/paths/pathExprToSparql.js.map +0 -1
  69. package/lib/cjs/queries/ContextRef.d.ts +0 -32
  70. package/lib/cjs/queries/ContextRef.js +0 -69
  71. package/lib/cjs/queries/ContextRef.js.map +0 -1
  72. package/lib/cjs/queries/CreateBuilder.d.ts +0 -59
  73. package/lib/cjs/queries/CreateBuilder.js +0 -138
  74. package/lib/cjs/queries/CreateBuilder.js.map +0 -1
  75. package/lib/cjs/queries/CreateQuery.d.ts +0 -20
  76. package/lib/cjs/queries/CreateQuery.js +0 -3
  77. package/lib/cjs/queries/CreateQuery.js.map +0 -1
  78. package/lib/cjs/queries/DeleteBuilder.d.ts +0 -56
  79. package/lib/cjs/queries/DeleteBuilder.js +0 -172
  80. package/lib/cjs/queries/DeleteBuilder.js.map +0 -1
  81. package/lib/cjs/queries/DeleteQuery.d.ts +0 -37
  82. package/lib/cjs/queries/DeleteQuery.js +0 -3
  83. package/lib/cjs/queries/DeleteQuery.js.map +0 -1
  84. package/lib/cjs/queries/DslJsonExpression.d.ts +0 -68
  85. package/lib/cjs/queries/DslJsonExpression.js +0 -427
  86. package/lib/cjs/queries/DslJsonExpression.js.map +0 -1
  87. package/lib/cjs/queries/FieldSet.d.ts +0 -310
  88. package/lib/cjs/queries/FieldSet.js +0 -802
  89. package/lib/cjs/queries/FieldSet.js.map +0 -1
  90. package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
  91. package/lib/cjs/queries/IRAliasScope.js +0 -52
  92. package/lib/cjs/queries/IRAliasScope.js.map +0 -1
  93. package/lib/cjs/queries/IRCanonicalize.d.ts +0 -19
  94. package/lib/cjs/queries/IRCanonicalize.js +0 -19
  95. package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
  96. package/lib/cjs/queries/IRDesugar.d.ts +0 -123
  97. package/lib/cjs/queries/IRDesugar.js +0 -261
  98. package/lib/cjs/queries/IRDesugar.js.map +0 -1
  99. package/lib/cjs/queries/IRLower.d.ts +0 -25
  100. package/lib/cjs/queries/IRLower.js +0 -398
  101. package/lib/cjs/queries/IRLower.js.map +0 -1
  102. package/lib/cjs/queries/IRMutation.d.ts +0 -53
  103. package/lib/cjs/queries/IRMutation.js +0 -130
  104. package/lib/cjs/queries/IRMutation.js.map +0 -1
  105. package/lib/cjs/queries/IRPipeline.d.ts +0 -8
  106. package/lib/cjs/queries/IRPipeline.js +0 -25
  107. package/lib/cjs/queries/IRPipeline.js.map +0 -1
  108. package/lib/cjs/queries/IRProjection.d.ts +0 -39
  109. package/lib/cjs/queries/IRProjection.js +0 -105
  110. package/lib/cjs/queries/IRProjection.js.map +0 -1
  111. package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -282
  112. package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
  113. package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
  114. package/lib/cjs/queries/MutationQuery.d.ts +0 -50
  115. package/lib/cjs/queries/MutationQuery.js +0 -334
  116. package/lib/cjs/queries/MutationQuery.js.map +0 -1
  117. package/lib/cjs/queries/MutationSerialization.d.ts +0 -102
  118. package/lib/cjs/queries/MutationSerialization.js +0 -207
  119. package/lib/cjs/queries/MutationSerialization.js.map +0 -1
  120. package/lib/cjs/queries/MutationThenable.d.ts +0 -18
  121. package/lib/cjs/queries/MutationThenable.js +0 -32
  122. package/lib/cjs/queries/MutationThenable.js.map +0 -1
  123. package/lib/cjs/queries/PropertyPath.d.ts +0 -38
  124. package/lib/cjs/queries/PropertyPath.js +0 -82
  125. package/lib/cjs/queries/PropertyPath.js.map +0 -1
  126. package/lib/cjs/queries/ProxiedPathBuilder.d.ts +0 -14
  127. package/lib/cjs/queries/ProxiedPathBuilder.js +0 -29
  128. package/lib/cjs/queries/ProxiedPathBuilder.js.map +0 -1
  129. package/lib/cjs/queries/QueryBuilder.d.ts +0 -193
  130. package/lib/cjs/queries/QueryBuilder.js +0 -519
  131. package/lib/cjs/queries/QueryBuilder.js.map +0 -1
  132. package/lib/cjs/queries/QueryBuilderSerialization.d.ts +0 -31
  133. package/lib/cjs/queries/QueryBuilderSerialization.js +0 -68
  134. package/lib/cjs/queries/QueryBuilderSerialization.js.map +0 -1
  135. package/lib/cjs/queries/QueryContext.d.ts +0 -50
  136. package/lib/cjs/queries/QueryContext.js +0 -147
  137. package/lib/cjs/queries/QueryContext.js.map +0 -1
  138. package/lib/cjs/queries/QueryFactory.d.ts +0 -80
  139. package/lib/cjs/queries/QueryFactory.js +0 -21
  140. package/lib/cjs/queries/QueryFactory.js.map +0 -1
  141. package/lib/cjs/queries/SelectQuery.d.ts +0 -302
  142. package/lib/cjs/queries/SelectQuery.js +0 -761
  143. package/lib/cjs/queries/SelectQuery.js.map +0 -1
  144. package/lib/cjs/queries/UpdateBuilder.d.ts +0 -69
  145. package/lib/cjs/queries/UpdateBuilder.js +0 -199
  146. package/lib/cjs/queries/UpdateBuilder.js.map +0 -1
  147. package/lib/cjs/queries/UpdateQuery.d.ts +0 -18
  148. package/lib/cjs/queries/UpdateQuery.js +0 -3
  149. package/lib/cjs/queries/UpdateQuery.js.map +0 -1
  150. package/lib/cjs/queries/fromJSON.d.ts +0 -16
  151. package/lib/cjs/queries/fromJSON.js +0 -41
  152. package/lib/cjs/queries/fromJSON.js.map +0 -1
  153. package/lib/cjs/queries/lower.d.ts +0 -28
  154. package/lib/cjs/queries/lower.js +0 -114
  155. package/lib/cjs/queries/lower.js.map +0 -1
  156. package/lib/cjs/queries/lowerMutationJSON.d.ts +0 -25
  157. package/lib/cjs/queries/lowerMutationJSON.js +0 -173
  158. package/lib/cjs/queries/lowerMutationJSON.js.map +0 -1
  159. package/lib/cjs/queries/mutationLowerSpec.d.ts +0 -32
  160. package/lib/cjs/queries/mutationLowerSpec.js +0 -8
  161. package/lib/cjs/queries/mutationLowerSpec.js.map +0 -1
  162. package/lib/cjs/queries/queryDispatch.d.ts +0 -33
  163. package/lib/cjs/queries/queryDispatch.js +0 -33
  164. package/lib/cjs/queries/queryDispatch.js.map +0 -1
  165. package/lib/cjs/queries/resolveShape.d.ts +0 -10
  166. package/lib/cjs/queries/resolveShape.js +0 -23
  167. package/lib/cjs/queries/resolveShape.js.map +0 -1
  168. package/lib/cjs/queries/wireVersion.d.ts +0 -7
  169. package/lib/cjs/queries/wireVersion.js +0 -25
  170. package/lib/cjs/queries/wireVersion.js.map +0 -1
  171. package/lib/cjs/shapes/List.d.ts +0 -35
  172. package/lib/cjs/shapes/List.js +0 -72
  173. package/lib/cjs/shapes/List.js.map +0 -1
  174. package/lib/cjs/shapes/PathNode.d.ts +0 -20
  175. package/lib/cjs/shapes/PathNode.js +0 -68
  176. package/lib/cjs/shapes/PathNode.js.map +0 -1
  177. package/lib/cjs/shapes/SHACL.d.ts +0 -300
  178. package/lib/cjs/shapes/SHACL.js +0 -612
  179. package/lib/cjs/shapes/SHACL.js.map +0 -1
  180. package/lib/cjs/shapes/Shape.d.ts +0 -74
  181. package/lib/cjs/shapes/Shape.js +0 -124
  182. package/lib/cjs/shapes/Shape.js.map +0 -1
  183. package/lib/cjs/shapes/serializePathToNodeData.d.ts +0 -24
  184. package/lib/cjs/shapes/serializePathToNodeData.js +0 -67
  185. package/lib/cjs/shapes/serializePathToNodeData.js.map +0 -1
  186. package/lib/cjs/shapes/syncShapes.d.ts +0 -38
  187. package/lib/cjs/shapes/syncShapes.js +0 -214
  188. package/lib/cjs/shapes/syncShapes.js.map +0 -1
  189. package/lib/cjs/sparql/SparqlAlgebra.d.ts +0 -190
  190. package/lib/cjs/sparql/SparqlAlgebra.js +0 -4
  191. package/lib/cjs/sparql/SparqlAlgebra.js.map +0 -1
  192. package/lib/cjs/sparql/SparqlDataset.d.ts +0 -60
  193. package/lib/cjs/sparql/SparqlDataset.js +0 -117
  194. package/lib/cjs/sparql/SparqlDataset.js.map +0 -1
  195. package/lib/cjs/sparql/algebraToString.d.ts +0 -13
  196. package/lib/cjs/sparql/algebraToString.js +0 -385
  197. package/lib/cjs/sparql/algebraToString.js.map +0 -1
  198. package/lib/cjs/sparql/index.d.ts +0 -9
  199. package/lib/cjs/sparql/index.js +0 -41
  200. package/lib/cjs/sparql/index.js.map +0 -1
  201. package/lib/cjs/sparql/irToAlgebra.d.ts +0 -79
  202. package/lib/cjs/sparql/irToAlgebra.js +0 -2042
  203. package/lib/cjs/sparql/irToAlgebra.js.map +0 -1
  204. package/lib/cjs/sparql/resultMapping.d.ts +0 -36
  205. package/lib/cjs/sparql/resultMapping.js +0 -563
  206. package/lib/cjs/sparql/resultMapping.js.map +0 -1
  207. package/lib/cjs/sparql/sparqlUtils.d.ts +0 -53
  208. package/lib/cjs/sparql/sparqlUtils.js +0 -154
  209. package/lib/cjs/sparql/sparqlUtils.js.map +0 -1
  210. package/lib/cjs/utils/LinkedErrorLogging.d.ts +0 -13
  211. package/lib/cjs/utils/LinkedErrorLogging.js +0 -22
  212. package/lib/cjs/utils/LinkedErrorLogging.js.map +0 -1
  213. package/lib/cjs/utils/LinkedFileStorage.d.ts +0 -23
  214. package/lib/cjs/utils/LinkedFileStorage.js +0 -62
  215. package/lib/cjs/utils/LinkedFileStorage.js.map +0 -1
  216. package/lib/cjs/utils/LinkedStorage.d.ts +0 -40
  217. package/lib/cjs/utils/LinkedStorage.js +0 -148
  218. package/lib/cjs/utils/LinkedStorage.js.map +0 -1
  219. package/lib/cjs/utils/NameSpace.d.ts +0 -2
  220. package/lib/cjs/utils/NameSpace.js +0 -8
  221. package/lib/cjs/utils/NameSpace.js.map +0 -1
  222. package/lib/cjs/utils/NodeReference.d.ts +0 -30
  223. package/lib/cjs/utils/NodeReference.js +0 -54
  224. package/lib/cjs/utils/NodeReference.js.map +0 -1
  225. package/lib/cjs/utils/Package.d.ts +0 -153
  226. package/lib/cjs/utils/Package.js +0 -419
  227. package/lib/cjs/utils/Package.js.map +0 -1
  228. package/lib/cjs/utils/Prefix.d.ts +0 -22
  229. package/lib/cjs/utils/Prefix.js +0 -104
  230. package/lib/cjs/utils/Prefix.js.map +0 -1
  231. package/lib/cjs/utils/ShapeClass.d.ts +0 -30
  232. package/lib/cjs/utils/ShapeClass.js +0 -180
  233. package/lib/cjs/utils/ShapeClass.js.map +0 -1
  234. package/lib/cjs/utils/URI.d.ts +0 -18
  235. package/lib/cjs/utils/URI.js +0 -42
  236. package/lib/cjs/utils/URI.js.map +0 -1
  237. package/lib/cjs/utils/cached.d.ts +0 -14
  238. package/lib/cjs/utils/cached.js +0 -71
  239. package/lib/cjs/utils/cached.js.map +0 -1
  240. package/lib/cjs/utils/loadStores.d.ts +0 -34
  241. package/lib/cjs/utils/loadStores.js +0 -105
  242. package/lib/cjs/utils/loadStores.js.map +0 -1
  243. package/lib/cjs/utils/parseDatasetsConfig.d.ts +0 -49
  244. package/lib/cjs/utils/parseDatasetsConfig.js +0 -110
  245. package/lib/cjs/utils/parseDatasetsConfig.js.map +0 -1
  246. 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
- //# sourceMapp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,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,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=DeleteQuery.js.map
@@ -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;