@_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,136 +0,0 @@
1
- "use strict";
2
- /*
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.collectPathUris = collectPathUris;
9
- exports.pathExprToSparql = pathExprToSparql;
10
- const PropertyPathExpr_js_1 = require("./PropertyPathExpr.js");
11
- const sparqlUtils_js_1 = require("../sparql/sparqlUtils.js");
12
- // ---------------------------------------------------------------------------
13
- // Precedence levels (higher = tighter binding)
14
- // ---------------------------------------------------------------------------
15
- const PREC_ALT = 1;
16
- const PREC_SEQ = 2;
17
- const PREC_UNARY = 3;
18
- const PREC_PRIMARY = 4;
19
- function refToSparql(ref) {
20
- if (typeof ref === 'string') {
21
- // If it looks like a full IRI (contains ://), use formatUri for prefix shortening
22
- if (ref.includes('://'))
23
- return (0, sparqlUtils_js_1.formatUri)(ref);
24
- // Otherwise treat as prefixed name (already in prefix:local form)
25
- return ref;
26
- }
27
- // {id} refs always contain full IRIs — use formatUri for prefix shortening
28
- return (0, sparqlUtils_js_1.formatUri)(ref.id);
29
- }
30
- /**
31
- * Collect all full IRIs from a PathExpr AST.
32
- * Returns IRIs that need PREFIX declarations (full URIs from string refs
33
- * containing `://` and from `{id}` refs). Does not collect prefixed-name
34
- * string refs since those are already in prefix:local form.
35
- */
36
- function collectPathUris(expr) {
37
- const uris = [];
38
- walkPathExpr(expr, uris);
39
- return uris;
40
- }
41
- function collectRef(ref, uris) {
42
- if (typeof ref === 'string') {
43
- if (ref.includes('://'))
44
- uris.push(ref);
45
- }
46
- else {
47
- uris.push(ref.id);
48
- }
49
- }
50
- function walkPathExpr(expr, uris) {
51
- if ((0, PropertyPathExpr_js_1.isPathRef)(expr)) {
52
- collectRef(expr, uris);
53
- return;
54
- }
55
- if ('seq' in expr) {
56
- for (const e of expr.seq)
57
- walkPathExpr(e, uris);
58
- return;
59
- }
60
- if ('alt' in expr) {
61
- for (const e of expr.alt)
62
- walkPathExpr(e, uris);
63
- return;
64
- }
65
- if ('inv' in expr) {
66
- walkPathExpr(expr.inv, uris);
67
- return;
68
- }
69
- if ('zeroOrMore' in expr) {
70
- walkPathExpr(expr.zeroOrMore, uris);
71
- return;
72
- }
73
- if ('oneOrMore' in expr) {
74
- walkPathExpr(expr.oneOrMore, uris);
75
- return;
76
- }
77
- if ('zeroOrOne' in expr) {
78
- walkPathExpr(expr.zeroOrOne, uris);
79
- return;
80
- }
81
- if ('negatedPropertySet' in expr) {
82
- for (const item of expr.negatedPropertySet) {
83
- if (typeof item === 'string' || (typeof item === 'object' && 'id' in item && !('inv' in item))) {
84
- collectRef(item, uris);
85
- }
86
- else {
87
- collectRef(item.inv, uris);
88
- }
89
- }
90
- }
91
- }
92
- /**
93
- * Render a PathExpr to SPARQL property path syntax.
94
- * Handles all forms including negatedPropertySet.
95
- * Adds parentheses only when needed for correct precedence.
96
- */
97
- function pathExprToSparql(expr) {
98
- return renderExpr(expr, 0);
99
- }
100
- function renderExpr(expr, parentPrec) {
101
- if ((0, PropertyPathExpr_js_1.isPathRef)(expr)) {
102
- return refToSparql(expr);
103
- }
104
- if ('seq' in expr) {
105
- const inner = expr.seq.map((e) => renderExpr(e, PREC_SEQ)).join('/');
106
- return parentPrec > PREC_SEQ ? `(${inner})` : inner;
107
- }
108
- if ('alt' in expr) {
109
- const inner = expr.alt.map((e) => renderExpr(e, PREC_ALT)).join('|');
110
- return parentPrec > PREC_ALT ? `(${inner})` : inner;
111
- }
112
- if ('inv' in expr) {
113
- return `^${renderExpr(expr.inv, PREC_UNARY)}`;
114
- }
115
- if ('zeroOrMore' in expr) {
116
- return `${renderExpr(expr.zeroOrMore, PREC_PRIMARY)}*`;
117
- }
118
- if ('oneOrMore' in expr) {
119
- return `${renderExpr(expr.oneOrMore, PREC_PRIMARY)}+`;
120
- }
121
- if ('zeroOrOne' in expr) {
122
- return `${renderExpr(expr.zeroOrOne, PREC_PRIMARY)}?`;
123
- }
124
- if ('negatedPropertySet' in expr) {
125
- const items = expr.negatedPropertySet.map((item) => {
126
- if (typeof item === 'string' || (typeof item === 'object' && 'id' in item && !('inv' in item))) {
127
- return refToSparql(item);
128
- }
129
- const invItem = item;
130
- return `^${refToSparql(invItem.inv)}`;
131
- });
132
- return items.length === 1 ? `!${items[0]}` : `!(${items.join('|')})`;
133
- }
134
- throw new Error(`Unknown PathExpr shape: ${JSON.stringify(expr)}`);
135
- }
136
- //# sourceMappingURL=pathExprToSparql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathExprToSparql.js","sourceRoot":"","sources":["../../../src/paths/pathExprToSparql.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA+BH,0CAIC;AAqCD,4CAEC;AAvED,+DAAgD;AAChD,6DAAmD;AAEnD,8EAA8E;AAC9E,+CAA+C;AAC/C,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,YAAY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CAAC;IAED,IAAI,oBAAoB,IAAI,IAAI,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACjD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC/F,OAAO,WAAW,CAAC,IAAe,CAAC,CAAC;YACtC,CAAC;YACD,MAAM,OAAO,GAAG,IAAsB,CAAC;YACvC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACvE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrE,CAAC"}
@@ -1,32 +0,0 @@
1
- /**
2
- * The reserved key that tags a **context reference** in DSL-JSON (`{@ctx: name}`).
3
- *
4
- * It is one of the DSL-JSON system value-tags — the `@`-sigiled vocabulary for
5
- * tagged *values* (`@id`, `@date`, `@list`, `@add`/`@remove`, `@unset`, `@path`,
6
- * `@ctx`). The `@` sigil frees every user property name: a property literally
7
- * named `date`/`id`/`path`/… no longer collides with a tag. (Structural
8
- * node-data keys stay `__id`/`__shape`.) The full tag set is defined by the
9
- * `MutationValueJSON` union (MutationSerialization.ts) + the DSL-JSON codecs and
10
- * documented in `documentation/dsl-json.md`; only `@ctx` needs a named constant
11
- * because it is shared across the select/mutation builders and the IR resolver.
12
- */
13
- export declare const CONTEXT_REF_KEY = "@ctx";
14
- /** The wire shape of a context reference: `{@ctx: "<contextName>"}`. */
15
- export interface ContextRefJSON {
16
- [CONTEXT_REF_KEY]: string;
17
- }
18
- /** Build a context-reference marker for the given context name. */
19
- export declare function encodeContextRef(name: string): ContextRefJSON;
20
- /** Type guard: is this value a `{@ctx: "..."}` context-reference marker? */
21
- export declare function isContextRefJSON(value: unknown): value is ContextRefJSON;
22
- /**
23
- * Resolve a context name to its node id against the current context map.
24
- *
25
- * @param name the context name (e.g. `'user'`)
26
- * @param required when true, throw {@link UnresolvedContextError} if the context
27
- * isn't set (the mutation contract — a mutation must not silently target
28
- * nothing). When false, return `undefined` (the select contract — an
29
- * unresolved subject simply yields no results, and a reactive layer re-runs
30
- * the query once the context lands).
31
- */
32
- export declare function resolveContextId(name: string, required: boolean): string | undefined;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- /*
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.CONTEXT_REF_KEY = void 0;
9
- exports.encodeContextRef = encodeContextRef;
10
- exports.isContextRefJSON = isContextRefJSON;
11
- exports.resolveContextId = resolveContextId;
12
- /**
13
- * The unified wire encoding for a *query-context reference*.
14
- *
15
- * A context reference is a placeholder for a node id that is not known when the
16
- * query is authored — e.g. "the currently authenticated user". Instead of
17
- * resolving it eagerly (which loses the reference and breaks queries built
18
- * before auth completes), the reference is carried on the wire as a tagged
19
- * marker and resolved at lowering time against whatever context map is
20
- * available (client-side React context, server-side auth, …).
21
- *
22
- * The same `{@ctx: "<name>"}` marker is used in *every* position a node id can
23
- * appear: the select subject, the update target, where-clause arguments, and
24
- * mutation field values. One marker, one resolver, everywhere.
25
- */
26
- const QueryContext_js_1 = require("./QueryContext.js");
27
- /**
28
- * The reserved key that tags a **context reference** in DSL-JSON (`{@ctx: name}`).
29
- *
30
- * It is one of the DSL-JSON system value-tags — the `@`-sigiled vocabulary for
31
- * tagged *values* (`@id`, `@date`, `@list`, `@add`/`@remove`, `@unset`, `@path`,
32
- * `@ctx`). The `@` sigil frees every user property name: a property literally
33
- * named `date`/`id`/`path`/… no longer collides with a tag. (Structural
34
- * node-data keys stay `__id`/`__shape`.) The full tag set is defined by the
35
- * `MutationValueJSON` union (MutationSerialization.ts) + the DSL-JSON codecs and
36
- * documented in `documentation/dsl-json.md`; only `@ctx` needs a named constant
37
- * because it is shared across the select/mutation builders and the IR resolver.
38
- */
39
- exports.CONTEXT_REF_KEY = '@ctx';
40
- /** Build a context-reference marker for the given context name. */
41
- function encodeContextRef(name) {
42
- return { [exports.CONTEXT_REF_KEY]: name };
43
- }
44
- /** Type guard: is this value a `{@ctx: "..."}` context-reference marker? */
45
- function isContextRefJSON(value) {
46
- return (!!value &&
47
- typeof value === 'object' &&
48
- typeof value[exports.CONTEXT_REF_KEY] === 'string' &&
49
- Object.keys(value).length === 1);
50
- }
51
- /**
52
- * Resolve a context name to its node id against the current context map.
53
- *
54
- * @param name the context name (e.g. `'user'`)
55
- * @param required when true, throw {@link UnresolvedContextError} if the context
56
- * isn't set (the mutation contract — a mutation must not silently target
57
- * nothing). When false, return `undefined` (the select contract — an
58
- * unresolved subject simply yields no results, and a reactive layer re-runs
59
- * the query once the context lands).
60
- */
61
- function resolveContextId(name, required) {
62
- var _a;
63
- const id = (_a = (0, QueryContext_js_1.getQueryContext)(name)) === null || _a === void 0 ? void 0 : _a.id;
64
- if (!id && required) {
65
- throw new QueryContext_js_1.UnresolvedContextError(name);
66
- }
67
- return id;
68
- }
69
- //# sourceMappingURL=ContextRef.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContextRef.js","sourceRoot":"","sources":["../../../src/queries/ContextRef.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAsCH,4CAEC;AAGD,4CAOC;AAYD,4CASC;AArED;;;;;;;;;;;;;GAaG;AACH,uDAA0E;AAE1E;;;;;;;;;;;GAWG;AACU,QAAA,eAAe,GAAG,MAAM,CAAC;AAOtC,mEAAmE;AACnE,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,OAAO,EAAC,CAAC,uBAAe,CAAC,EAAE,IAAI,EAAC,CAAC;AACnC,CAAC;AAED,4EAA4E;AAC5E,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,OAAO,CACL,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAQ,KAAiC,CAAC,uBAAe,CAAC,KAAK,QAAQ;QACvE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,MAAM,KAAK,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,QAAiB;;IAEjB,MAAM,EAAE,GAAG,MAAA,IAAA,iCAAe,EAAC,IAAI,CAAC,0CAAE,EAAE,CAAC;IACrC,IAAI,CAAC,EAAE,IAAI,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,wCAAsB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -1,59 +0,0 @@
1
- import { Shape, type ShapeConstructor } from '../shapes/Shape.js';
2
- import type { UpdatePartial } from './QueryFactory.js';
3
- import type { CreateResponse } from './CreateQuery.js';
4
- import { MutationThenable } from './MutationThenable.js';
5
- import type { IDataset } from '../interfaces/IDataset.js';
6
- import type { NodeShape } from '../shapes/SHACL.js';
7
- import { type CreateMutationJSON } from './MutationSerialization.js';
8
- import type { CreateLowerSpec } from './mutationLowerSpec.js';
9
- /**
10
- * An immutable, fluent builder for create mutations.
11
- *
12
- * Every mutation method returns a new CreateBuilder — the original is never modified.
13
- *
14
- * Implements PromiseLike so mutations execute on `await`:
15
- * ```ts
16
- * const result = await CreateBuilder.from(Person).set({name: 'Alice'});
17
- * ```
18
- *
19
- * Serialization normalizes through the IR-free factory base; IR is produced by
20
- * the free `lower()` function (the builder itself imports no IR).
21
- */
22
- export declare class CreateBuilder<S extends Shape = Shape, U extends UpdatePartial<S> = UpdatePartial<S>> extends MutationThenable<CreateResponse<U>> {
23
- protected readonly _tag = "CreateBuilder";
24
- private readonly _shape;
25
- private readonly _data?;
26
- private readonly _fixedId?;
27
- private constructor();
28
- private clone;
29
- /**
30
- * Create a CreateBuilder for the given shape.
31
- */
32
- static from<S extends Shape>(shape: ShapeConstructor<S> | string): CreateBuilder<S>;
33
- /** Reconstruct a CreateBuilder from its DSL-JSON (inverse of `toJSON`). */
34
- static fromJSON(json: CreateMutationJSON): CreateBuilder;
35
- /** Set the data for the entity to create. */
36
- set<NewU extends UpdatePartial<S>>(data: NewU): CreateBuilder<S, NewU>;
37
- /** Pre-assign a node ID for the created entity. */
38
- withId(id: string): CreateBuilder<S, U>;
39
- /** Discriminator for the free `lower()` function and dataset routing. */
40
- readonly __queryKind: "create";
41
- /** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
42
- get shape(): NodeShape;
43
- /** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
44
- _lowerSpec(): CreateLowerSpec<S>;
45
- /**
46
- * Serialize this create mutation to lightweight DSL-JSON. Normalizes the create
47
- * data through the IR-free factory base (the same normalization `lower()` runs)
48
- * so the result is concrete and JSON-safe, then encodes the node description.
49
- */
50
- toJSON(): CreateMutationJSON;
51
- /**
52
- * Execute the mutation.
53
- *
54
- * @param target Optional explicit dataset (a store or a router) to run against. Omitted →
55
- * the global query dispatch. A `target` runs on that dataset only; the global router is
56
- * untouched. Rejects if the target dataset doesn't implement create.
57
- */
58
- exec(target?: IDataset): Promise<CreateResponse<U>>;
59
- }
@@ -1,138 +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.CreateBuilder = void 0;
13
- const resolveShape_js_1 = require("./resolveShape.js");
14
- const MutationQuery_js_1 = require("./MutationQuery.js");
15
- const MutationThenable_js_1 = require("./MutationThenable.js");
16
- const queryDispatch_js_1 = require("./queryDispatch.js");
17
- const wireVersion_js_1 = require("./wireVersion.js");
18
- const MutationSerialization_js_1 = require("./MutationSerialization.js");
19
- /**
20
- * An immutable, fluent builder for create mutations.
21
- *
22
- * Every mutation method returns a new CreateBuilder — the original is never modified.
23
- *
24
- * Implements PromiseLike so mutations execute on `await`:
25
- * ```ts
26
- * const result = await CreateBuilder.from(Person).set({name: 'Alice'});
27
- * ```
28
- *
29
- * Serialization normalizes through the IR-free factory base; IR is produced by
30
- * the free `lower()` function (the builder itself imports no IR).
31
- */
32
- class CreateBuilder extends MutationThenable_js_1.MutationThenable {
33
- constructor(init) {
34
- super();
35
- this._tag = 'CreateBuilder';
36
- // ---------------------------------------------------------------------------
37
- // Build & execute
38
- // ---------------------------------------------------------------------------
39
- /** Discriminator for the free `lower()` function and dataset routing. */
40
- this.__queryKind = 'create';
41
- this._shape = init.shape;
42
- this._data = init.data;
43
- this._fixedId = init.fixedId;
44
- }
45
- clone(overrides = {}) {
46
- return new CreateBuilder(Object.assign({ shape: this._shape, data: this._data, fixedId: this._fixedId }, overrides));
47
- }
48
- // ---------------------------------------------------------------------------
49
- // Static constructors
50
- // ---------------------------------------------------------------------------
51
- /**
52
- * Create a CreateBuilder for the given shape.
53
- */
54
- static from(shape) {
55
- const resolved = (0, resolveShape_js_1.resolveShape)(shape);
56
- return new CreateBuilder({ shape: resolved });
57
- }
58
- /** Reconstruct a CreateBuilder from its DSL-JSON (inverse of `toJSON`). */
59
- static fromJSON(json) {
60
- (0, wireVersion_js_1.assertWireVersion)(json.v);
61
- const builder = CreateBuilder.from(json.shape);
62
- return builder.set((0, MutationSerialization_js_1.decodeNodeDataToRaw)(json.data, builder._shape.shape));
63
- }
64
- // ---------------------------------------------------------------------------
65
- // Fluent API
66
- // ---------------------------------------------------------------------------
67
- /** Set the data for the entity to create. */
68
- set(data) {
69
- return this.clone({ data });
70
- }
71
- /** Pre-assign a node ID for the created entity. */
72
- withId(id) {
73
- return this.clone({ fixedId: id });
74
- }
75
- /** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
76
- get shape() {
77
- return this._shape.shape;
78
- }
79
- /** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
80
- _lowerSpec() {
81
- if (!this._data) {
82
- throw new Error('CreateBuilder requires .set(data) before it can be lowered. Specify what to create.');
83
- }
84
- const data = this._data;
85
- // Validate that required properties (minCount >= 1) are present in data
86
- const shapeObj = this._shape.shape;
87
- if (shapeObj) {
88
- const requiredProps = shapeObj
89
- .getUniquePropertyShapes()
90
- .filter((ps) => ps.minCount && ps.minCount >= 1);
91
- const dataKeys = new Set(Object.keys(data));
92
- const missing = requiredProps
93
- .filter((ps) => !dataKeys.has(ps.label))
94
- .map((ps) => ps.label);
95
- if (missing.length > 0) {
96
- throw new Error(`Missing required fields for '${shapeObj.label || shapeObj.id}': ${missing.join(', ')}`);
97
- }
98
- }
99
- // TODO: Full data validation against the shape (type checking, maxCount, nested shapes, etc.)
100
- // Inject __id if fixedId is set
101
- const dataWithId = this._fixedId
102
- ? Object.assign(Object.assign({}, data), { __id: this._fixedId }) : data;
103
- return { shapeClass: this._shape, data: dataWithId };
104
- }
105
- /**
106
- * Serialize this create mutation to lightweight DSL-JSON. Normalizes the create
107
- * data through the IR-free factory base (the same normalization `lower()` runs)
108
- * so the result is concrete and JSON-safe, then encodes the node description.
109
- */
110
- toJSON() {
111
- if (!this._data) {
112
- throw new Error('CreateBuilder requires .set(data) before .toJSON().');
113
- }
114
- const dataWithId = this._fixedId
115
- ? Object.assign(Object.assign({}, this._data), { __id: this._fixedId }) : this._data;
116
- const description = new MutationQuery_js_1.MutationQueryFactory().describe(this._shape.shape, dataWithId, true);
117
- return {
118
- v: wireVersion_js_1.WIRE_VERSION,
119
- op: 'create',
120
- shape: this._shape.shape.id,
121
- data: (0, MutationSerialization_js_1.encodeNodeData)(description, this._shape.shape),
122
- };
123
- }
124
- /**
125
- * Execute the mutation.
126
- *
127
- * @param target Optional explicit dataset (a store or a router) to run against. Omitted →
128
- * the global query dispatch. A `target` runs on that dataset only; the global router is
129
- * untouched. Rejects if the target dataset doesn't implement create.
130
- */
131
- exec(target) {
132
- return __awaiter(this, void 0, void 0, function* () {
133
- return (0, queryDispatch_js_1.resolveMutationDispatch)('create', target).createQuery(this);
134
- });
135
- }
136
- }
137
- exports.CreateBuilder = CreateBuilder;
138
- //# sourceMappingURL=CreateBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CreateBuilder.js","sourceRoot":"","sources":["../../../src/queries/CreateBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uDAA+C;AAG/C,yDAAwD;AACxD,+DAAuD;AACvD,yDAA2D;AAE3D,qDAAiE;AAEjE,yEAAwG;AAYxG;;;;;;;;;;;;GAYG;AACH,MAAa,aACX,SAAQ,sCAAmC;IAO3C,YAAoB,IAA0B;QAC5C,KAAK,EAAE,CAAC;QANS,SAAI,GAAG,eAAe,CAAC;QAsD1C,8EAA8E;QAC9E,kBAAkB;QAClB,8EAA8E;QAE9E,yEAAyE;QAChE,gBAAW,GAAG,QAAiB,CAAC;QApDvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,YAA2C,EAAE;QACzD,OAAO,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AK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ;YAC9B,CAAC,iCAAM,IAAI,CAAC,KAAa,KAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,IAC9C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACf,MAAM,WAAW,GAAG,IAAI,uCAAoB,EAAE,CAAC,QAAQ,CACrD,IAAI,CAAC,MAAM,CAAC,KAAK,EACjB,UAAU,EACV,IAAI,CACL,CAAC;QACF,OAAO;YACL,CAAC,EAAE,6BAAY;YACf,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC3B,IAAI,EAAE,IAAA,yCAAc,EAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;SACrD,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACG,IAAI,CAAC,MAAiB;;YAC1B,OAAO,IAAA,0CAAuB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,IAAI,CAA+B,CAAC;QACnG,CAAC;KAAA;CACF;AA1ID,sCA0IC"}
@@ -1,20 +0,0 @@
1
- import type { AddId } from './QueryFactory.js';
2
- import type { IRCreateMutation } from './IntermediateRepresentation.js';
3
- import type { NodeShape } from '../shapes/SHACL.js';
4
- import type { CreateMutationJSON } from './MutationSerialization.js';
5
- import type { CreateLowerSpec } from './mutationLowerSpec.js';
6
- /**
7
- * The closed, read-only create query a dataset receives (implemented by
8
- * `CreateBuilder`). The IR is `IRCreateQuery`, 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 CreateQuery {
12
- readonly __queryKind: 'create';
13
- readonly shape: NodeShape;
14
- toJSON(): CreateMutationJSON;
15
- /** @internal IR-free lowering spec consumed by `lower()`. */
16
- _lowerSpec(): CreateLowerSpec;
17
- }
18
- /** The lowered IR for a create mutation (what `lower()` produces). */
19
- export type IRCreateQuery = IRCreateMutation;
20
- export type CreateResponse<U> = AddId<U, true>;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=CreateQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CreateQuery.js","sourceRoot":"","sources":["../../../src/queries/CreateQuery.ts"],"names":[],"mappings":""}
@@ -1,56 +0,0 @@
1
- import { Shape, type ShapeConstructor } from '../shapes/Shape.js';
2
- import type { DeleteResponse } from './DeleteQuery.js';
3
- import type { NodeId } from './MutationQuery.js';
4
- import { MutationThenable } from './MutationThenable.js';
5
- import type { IDataset } from '../interfaces/IDataset.js';
6
- import type { NodeShape } from '../shapes/SHACL.js';
7
- import { type WhereClause } from './SelectQuery.js';
8
- import { type DeleteMutationJSON } from './MutationSerialization.js';
9
- import type { DeleteLowerSpec } from './mutationLowerSpec.js';
10
- import { PendingQueryContext } from './QueryContext.js';
11
- /** A node to delete: a concrete id, a `{id}` ref, or a live query-context reference. */
12
- export type DeleteId = NodeId | PendingQueryContext;
13
- /**
14
- * An immutable, fluent builder for delete mutations.
15
- *
16
- * Implements PromiseLike so mutations execute on `await`:
17
- * ```ts
18
- * const result = await DeleteBuilder.from(Person, {id: '...'});
19
- * await DeleteBuilder.from(Person).all(); // returns void
20
- * ```
21
- *
22
- * R is the resolved type: DeleteResponse for ID-based, void for bulk operations.
23
- */
24
- export declare class DeleteBuilder<S extends Shape = Shape, R = DeleteResponse> extends MutationThenable<R> {
25
- protected readonly _tag = "DeleteBuilder";
26
- private readonly _shape;
27
- private readonly _ids?;
28
- private readonly _mode?;
29
- private readonly _whereFn?;
30
- private readonly _where?;
31
- private constructor();
32
- private clone;
33
- static from<S extends Shape>(shape: ShapeConstructor<S> | string, ids?: DeleteId | DeleteId[]): DeleteBuilder<S, DeleteResponse>;
34
- /** Reconstruct a DeleteBuilder from its DSL-JSON (inverse of `toJSON`). */
35
- static fromJSON(json: DeleteMutationJSON): DeleteBuilder;
36
- /** Delete all instances of this shape type. Returns void. */
37
- all(): DeleteBuilder<S, void>;
38
- /** Delete instances matching a condition. Returns void. */
39
- where(fn: WhereClause<S>): DeleteBuilder<S, void>;
40
- /** Discriminator for the free `lower()` function and dataset routing. */
41
- readonly __queryKind: "delete";
42
- /** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
43
- get shape(): NodeShape;
44
- /** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
45
- _lowerSpec(): DeleteLowerSpec<S>;
46
- /** Serialize this delete mutation to lightweight DSL-JSON. */
47
- toJSON(): DeleteMutationJSON;
48
- /**
49
- * Execute the mutation.
50
- *
51
- * @param target Optional explicit dataset (a store or a router) to run against. Omitted →
52
- * the global query dispatch. A `target` runs on that dataset only; the global router is
53
- * untouched. Rejects if the target dataset doesn't implement delete.
54
- */
55
- exec(target?: IDataset): Promise<R>;
56
- }