@_linked/core 1.2.1 → 2.0.0-next.20260310082533

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 (169) hide show
  1. package/CHANGELOG.md +117 -6
  2. package/README.md +209 -14
  3. package/lib/cjs/index.d.ts +10 -2
  4. package/lib/cjs/index.js +33 -8
  5. package/lib/cjs/index.js.map +1 -1
  6. package/lib/cjs/interfaces/IQuadStore.d.ts +1 -1
  7. package/lib/cjs/package.d.ts +1 -1
  8. package/lib/cjs/queries/CreateBuilder.d.ts +38 -0
  9. package/lib/cjs/queries/CreateBuilder.js +100 -0
  10. package/lib/cjs/queries/CreateBuilder.js.map +1 -0
  11. package/lib/cjs/queries/CreateQuery.d.ts +3 -3
  12. package/lib/cjs/queries/CreateQuery.js.map +1 -1
  13. package/lib/cjs/queries/DeleteBuilder.d.ts +39 -0
  14. package/lib/cjs/queries/DeleteBuilder.js +85 -0
  15. package/lib/cjs/queries/DeleteBuilder.js.map +1 -0
  16. package/lib/cjs/queries/DeleteQuery.d.ts +3 -3
  17. package/lib/cjs/queries/DeleteQuery.js.map +1 -1
  18. package/lib/cjs/queries/FieldSet.d.ts +203 -0
  19. package/lib/cjs/queries/FieldSet.js +533 -0
  20. package/lib/cjs/queries/FieldSet.js.map +1 -0
  21. package/lib/cjs/queries/IRDesugar.d.ts +13 -8
  22. package/lib/cjs/queries/IRDesugar.js +143 -132
  23. package/lib/cjs/queries/IRDesugar.js.map +1 -1
  24. package/lib/cjs/queries/IRLower.js +1 -0
  25. package/lib/cjs/queries/IRLower.js.map +1 -1
  26. package/lib/cjs/queries/IntermediateRepresentation.d.ts +1 -0
  27. package/lib/cjs/queries/MutationQuery.d.ts +1 -1
  28. package/lib/cjs/queries/MutationQuery.js +1 -6
  29. package/lib/cjs/queries/MutationQuery.js.map +1 -1
  30. package/lib/cjs/queries/PropertyPath.d.ts +38 -0
  31. package/lib/cjs/queries/PropertyPath.js +82 -0
  32. package/lib/cjs/queries/PropertyPath.js.map +1 -0
  33. package/lib/cjs/queries/ProxiedPathBuilder.d.ts +14 -0
  34. package/lib/cjs/queries/ProxiedPathBuilder.js +29 -0
  35. package/lib/cjs/queries/ProxiedPathBuilder.js.map +1 -0
  36. package/lib/cjs/queries/QueryBuilder.d.ts +141 -0
  37. package/lib/cjs/queries/QueryBuilder.js +334 -0
  38. package/lib/cjs/queries/QueryBuilder.js.map +1 -0
  39. package/lib/cjs/queries/SelectQuery.d.ts +60 -134
  40. package/lib/cjs/queries/SelectQuery.js +67 -526
  41. package/lib/cjs/queries/SelectQuery.js.map +1 -1
  42. package/lib/cjs/queries/UpdateBuilder.d.ts +37 -0
  43. package/lib/cjs/queries/UpdateBuilder.js +84 -0
  44. package/lib/cjs/queries/UpdateBuilder.js.map +1 -0
  45. package/lib/cjs/queries/UpdateQuery.d.ts +3 -3
  46. package/lib/cjs/queries/UpdateQuery.js.map +1 -1
  47. package/lib/cjs/queries/WhereCondition.d.ts +18 -0
  48. package/lib/cjs/queries/WhereCondition.js +3 -0
  49. package/lib/cjs/queries/WhereCondition.js.map +1 -0
  50. package/lib/cjs/queries/queryDispatch.d.ts +20 -0
  51. package/lib/cjs/queries/queryDispatch.js +15 -0
  52. package/lib/cjs/queries/queryDispatch.js.map +1 -0
  53. package/lib/cjs/queries/resolveShape.d.ts +10 -0
  54. package/lib/cjs/queries/resolveShape.js +23 -0
  55. package/lib/cjs/queries/resolveShape.js.map +1 -0
  56. package/lib/cjs/shapes/SHACL.js +7 -5
  57. package/lib/cjs/shapes/SHACL.js.map +1 -1
  58. package/lib/cjs/shapes/Shape.d.ts +33 -52
  59. package/lib/cjs/shapes/Shape.js +36 -50
  60. package/lib/cjs/shapes/Shape.js.map +1 -1
  61. package/lib/cjs/sparql/SparqlAlgebra.d.ts +6 -1
  62. package/lib/cjs/sparql/algebraToString.js +10 -0
  63. package/lib/cjs/sparql/algebraToString.js.map +1 -1
  64. package/lib/cjs/sparql/irToAlgebra.js +6 -2
  65. package/lib/cjs/sparql/irToAlgebra.js.map +1 -1
  66. package/lib/cjs/test-helpers/query-capture-store.d.ts +8 -2
  67. package/lib/cjs/test-helpers/query-capture-store.js +80 -34
  68. package/lib/cjs/test-helpers/query-capture-store.js.map +1 -1
  69. package/lib/cjs/test-helpers/query-fixtures.d.ts +564 -3045
  70. package/lib/cjs/test-helpers/query-fixtures.js +59 -18
  71. package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
  72. package/lib/cjs/test-helpers/test-utils.d.ts +18 -0
  73. package/lib/cjs/test-helpers/test-utils.js +47 -0
  74. package/lib/cjs/test-helpers/test-utils.js.map +1 -0
  75. package/lib/cjs/utils/LinkedStorage.d.ts +3 -4
  76. package/lib/cjs/utils/LinkedStorage.js +12 -6
  77. package/lib/cjs/utils/LinkedStorage.js.map +1 -1
  78. package/lib/cjs/utils/Package.d.ts +8 -8
  79. package/lib/cjs/utils/Package.js.map +1 -1
  80. package/lib/cjs/utils/ShapeClass.d.ts +2 -2
  81. package/lib/cjs/utils/ShapeClass.js +4 -22
  82. package/lib/cjs/utils/ShapeClass.js.map +1 -1
  83. package/lib/esm/index.d.ts +10 -2
  84. package/lib/esm/index.js +25 -4
  85. package/lib/esm/index.js.map +1 -1
  86. package/lib/esm/interfaces/IQuadStore.d.ts +1 -1
  87. package/lib/esm/package.d.ts +1 -1
  88. package/lib/esm/queries/CreateBuilder.d.ts +38 -0
  89. package/lib/esm/queries/CreateBuilder.js +96 -0
  90. package/lib/esm/queries/CreateBuilder.js.map +1 -0
  91. package/lib/esm/queries/CreateQuery.d.ts +3 -3
  92. package/lib/esm/queries/CreateQuery.js.map +1 -1
  93. package/lib/esm/queries/DeleteBuilder.d.ts +39 -0
  94. package/lib/esm/queries/DeleteBuilder.js +81 -0
  95. package/lib/esm/queries/DeleteBuilder.js.map +1 -0
  96. package/lib/esm/queries/DeleteQuery.d.ts +3 -3
  97. package/lib/esm/queries/DeleteQuery.js.map +1 -1
  98. package/lib/esm/queries/FieldSet.d.ts +203 -0
  99. package/lib/esm/queries/FieldSet.js +529 -0
  100. package/lib/esm/queries/FieldSet.js.map +1 -0
  101. package/lib/esm/queries/IRDesugar.d.ts +13 -8
  102. package/lib/esm/queries/IRDesugar.js +143 -132
  103. package/lib/esm/queries/IRDesugar.js.map +1 -1
  104. package/lib/esm/queries/IRLower.js +1 -0
  105. package/lib/esm/queries/IRLower.js.map +1 -1
  106. package/lib/esm/queries/IntermediateRepresentation.d.ts +1 -0
  107. package/lib/esm/queries/MutationQuery.d.ts +1 -1
  108. package/lib/esm/queries/MutationQuery.js +1 -6
  109. package/lib/esm/queries/MutationQuery.js.map +1 -1
  110. package/lib/esm/queries/PropertyPath.d.ts +38 -0
  111. package/lib/esm/queries/PropertyPath.js +77 -0
  112. package/lib/esm/queries/PropertyPath.js.map +1 -0
  113. package/lib/esm/queries/ProxiedPathBuilder.d.ts +14 -0
  114. package/lib/esm/queries/ProxiedPathBuilder.js +26 -0
  115. package/lib/esm/queries/ProxiedPathBuilder.js.map +1 -0
  116. package/lib/esm/queries/QueryBuilder.d.ts +141 -0
  117. package/lib/esm/queries/QueryBuilder.js +330 -0
  118. package/lib/esm/queries/QueryBuilder.js.map +1 -0
  119. package/lib/esm/queries/SelectQuery.d.ts +60 -134
  120. package/lib/esm/queries/SelectQuery.js +61 -515
  121. package/lib/esm/queries/SelectQuery.js.map +1 -1
  122. package/lib/esm/queries/UpdateBuilder.d.ts +37 -0
  123. package/lib/esm/queries/UpdateBuilder.js +80 -0
  124. package/lib/esm/queries/UpdateBuilder.js.map +1 -0
  125. package/lib/esm/queries/UpdateQuery.d.ts +3 -3
  126. package/lib/esm/queries/UpdateQuery.js.map +1 -1
  127. package/lib/esm/queries/WhereCondition.d.ts +18 -0
  128. package/lib/esm/queries/WhereCondition.js +2 -0
  129. package/lib/esm/queries/WhereCondition.js.map +1 -0
  130. package/lib/esm/queries/queryDispatch.d.ts +20 -0
  131. package/lib/esm/queries/queryDispatch.js +11 -0
  132. package/lib/esm/queries/queryDispatch.js.map +1 -0
  133. package/lib/esm/queries/resolveShape.d.ts +10 -0
  134. package/lib/esm/queries/resolveShape.js +20 -0
  135. package/lib/esm/queries/resolveShape.js.map +1 -0
  136. package/lib/esm/shapes/SHACL.js +7 -5
  137. package/lib/esm/shapes/SHACL.js.map +1 -1
  138. package/lib/esm/shapes/Shape.d.ts +33 -52
  139. package/lib/esm/shapes/Shape.js +36 -47
  140. package/lib/esm/shapes/Shape.js.map +1 -1
  141. package/lib/esm/sparql/SparqlAlgebra.d.ts +6 -1
  142. package/lib/esm/sparql/algebraToString.js +10 -0
  143. package/lib/esm/sparql/algebraToString.js.map +1 -1
  144. package/lib/esm/sparql/irToAlgebra.js +6 -2
  145. package/lib/esm/sparql/irToAlgebra.js.map +1 -1
  146. package/lib/esm/test-helpers/query-capture-store.d.ts +8 -2
  147. package/lib/esm/test-helpers/query-capture-store.js +45 -33
  148. package/lib/esm/test-helpers/query-capture-store.js.map +1 -1
  149. package/lib/esm/test-helpers/query-fixtures.d.ts +564 -3045
  150. package/lib/esm/test-helpers/query-fixtures.js +59 -18
  151. package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
  152. package/lib/esm/test-helpers/test-utils.d.ts +18 -0
  153. package/lib/esm/test-helpers/test-utils.js +41 -0
  154. package/lib/esm/test-helpers/test-utils.js.map +1 -0
  155. package/lib/esm/utils/LinkedStorage.d.ts +3 -4
  156. package/lib/esm/utils/LinkedStorage.js +12 -6
  157. package/lib/esm/utils/LinkedStorage.js.map +1 -1
  158. package/lib/esm/utils/Package.d.ts +8 -8
  159. package/lib/esm/utils/Package.js.map +1 -1
  160. package/lib/esm/utils/ShapeClass.d.ts +2 -2
  161. package/lib/esm/utils/ShapeClass.js +4 -22
  162. package/lib/esm/utils/ShapeClass.js.map +1 -1
  163. package/package.json +1 -1
  164. package/lib/cjs/queries/QueryParser.d.ts +0 -17
  165. package/lib/cjs/queries/QueryParser.js +0 -55
  166. package/lib/cjs/queries/QueryParser.js.map +0 -1
  167. package/lib/esm/queries/QueryParser.d.ts +0 -17
  168. package/lib/esm/queries/QueryParser.js +0 -51
  169. package/lib/esm/queries/QueryParser.js.map +0 -1
@@ -10,7 +10,7 @@ import type { SelectResult, CreateResult, UpdateResult } from '../queries/Interm
10
10
  * (SPARQL endpoint, SQL database, in-memory store, etc.).
11
11
  *
12
12
  * Each method receives a canonical IR query object and returns the result.
13
- * The calling layer (LinkedStorage / QueryParser) threads the precise
13
+ * The calling layer (LinkedStorage via queryDispatch) threads the precise
14
14
  * DSL-level TypeScript result type back to the caller — the store only
15
15
  * needs to produce data that matches the structural result types.
16
16
  */
@@ -1,4 +1,4 @@
1
1
  export declare const linkedShape: {
2
2
  <T extends typeof import("./shapes/Shape.js").Shape>(constructor: T): void;
3
3
  <T extends typeof import("./shapes/Shape.js").Shape>(config?: import("./utils/Package.js").ShapeConfig): (constructor: T) => void;
4
- }, linkedUtil: (constructor: any) => any, linkedOntology: (allFileExports: any, nameSpace: (term: string) => import("./utils/NodeReference.js").NodeReferenceValue, suggestedPrefixAndFileName: string, loadDataFunction?: () => Promise<any>, dataSource?: string | string[]) => void, registerPackageExport: (exportedObject: any) => void, registerPackageModule: (_module: any) => void, packageExports: any, getPackageShape: (name: string) => typeof import("./shapes/Shape.js").Shape;
4
+ }, linkedUtil: (constructor: any) => any, linkedOntology: (allFileExports: any, nameSpace: (term: string) => import("./utils/NodeReference.js").NodeReferenceValue, suggestedPrefixAndFileName: string, loadDataFunction?: () => Promise<any>, dataSource?: string | string[]) => void, registerPackageExport: (exportedObject: any) => void, registerPackageModule: (_module: any) => void, packageExports: any, getPackageShape: (name: string) => import("./shapes/Shape.js").ShapeConstructor | undefined;
@@ -0,0 +1,38 @@
1
+ import { Shape, ShapeConstructor } from '../shapes/Shape.js';
2
+ import { UpdatePartial } from './QueryFactory.js';
3
+ import { CreateQuery, CreateResponse } from './CreateQuery.js';
4
+ /**
5
+ * An immutable, fluent builder for create mutations.
6
+ *
7
+ * Every mutation method returns a new CreateBuilder — the original is never modified.
8
+ *
9
+ * Implements PromiseLike so mutations execute on `await`:
10
+ * ```ts
11
+ * const result = await CreateBuilder.from(Person).set({name: 'Alice'});
12
+ * ```
13
+ *
14
+ * Internally delegates to CreateQueryFactory for IR generation.
15
+ */
16
+ export declare class CreateBuilder<S extends Shape = Shape, U extends UpdatePartial<S> = UpdatePartial<S>> implements PromiseLike<CreateResponse<U>>, Promise<CreateResponse<U>> {
17
+ private readonly _shape;
18
+ private readonly _data?;
19
+ private readonly _fixedId?;
20
+ private constructor();
21
+ private clone;
22
+ /**
23
+ * Create a CreateBuilder for the given shape.
24
+ */
25
+ static from<S extends Shape>(shape: ShapeConstructor<S> | string): CreateBuilder<S>;
26
+ /** Set the data for the entity to create. */
27
+ set<NewU extends UpdatePartial<S>>(data: NewU): CreateBuilder<S, NewU>;
28
+ /** Pre-assign a node ID for the created entity. */
29
+ withId(id: string): CreateBuilder<S, U>;
30
+ /** Build the IR mutation. Throws if no data was set via .set(). */
31
+ build(): CreateQuery;
32
+ /** Execute the mutation. */
33
+ exec(): Promise<CreateResponse<U>>;
34
+ then<TResult1 = CreateResponse<U>, TResult2 = never>(onfulfilled?: ((value: CreateResponse<U>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
35
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<CreateResponse<U> | TResult>;
36
+ finally(onfinally?: (() => void) | null): Promise<CreateResponse<U>>;
37
+ get [Symbol.toStringTag](): string;
38
+ }
@@ -0,0 +1,96 @@
1
+ import { resolveShape } from './resolveShape.js';
2
+ import { CreateQueryFactory } from './CreateQuery.js';
3
+ import { getQueryDispatch } from './queryDispatch.js';
4
+ /**
5
+ * An immutable, fluent builder for create mutations.
6
+ *
7
+ * Every mutation method returns a new CreateBuilder — the original is never modified.
8
+ *
9
+ * Implements PromiseLike so mutations execute on `await`:
10
+ * ```ts
11
+ * const result = await CreateBuilder.from(Person).set({name: 'Alice'});
12
+ * ```
13
+ *
14
+ * Internally delegates to CreateQueryFactory for IR generation.
15
+ */
16
+ export class CreateBuilder {
17
+ constructor(init) {
18
+ this._shape = init.shape;
19
+ this._data = init.data;
20
+ this._fixedId = init.fixedId;
21
+ }
22
+ clone(overrides = {}) {
23
+ return new CreateBuilder(Object.assign({ shape: this._shape, data: this._data, fixedId: this._fixedId }, overrides));
24
+ }
25
+ // ---------------------------------------------------------------------------
26
+ // Static constructors
27
+ // ---------------------------------------------------------------------------
28
+ /**
29
+ * Create a CreateBuilder for the given shape.
30
+ */
31
+ static from(shape) {
32
+ const resolved = resolveShape(shape);
33
+ return new CreateBuilder({ shape: resolved });
34
+ }
35
+ // ---------------------------------------------------------------------------
36
+ // Fluent API
37
+ // ---------------------------------------------------------------------------
38
+ /** Set the data for the entity to create. */
39
+ set(data) {
40
+ return this.clone({ data });
41
+ }
42
+ /** Pre-assign a node ID for the created entity. */
43
+ withId(id) {
44
+ return this.clone({ fixedId: id });
45
+ }
46
+ // ---------------------------------------------------------------------------
47
+ // Build & execute
48
+ // ---------------------------------------------------------------------------
49
+ /** Build the IR mutation. Throws if no data was set via .set(). */
50
+ build() {
51
+ if (!this._data) {
52
+ throw new Error('CreateBuilder requires .set(data) before .build(). Specify what to create.');
53
+ }
54
+ const data = this._data;
55
+ // Validate that required properties (minCount >= 1) are present in data
56
+ const shapeObj = this._shape.shape;
57
+ if (shapeObj) {
58
+ const requiredProps = shapeObj
59
+ .getUniquePropertyShapes()
60
+ .filter((ps) => ps.minCount && ps.minCount >= 1);
61
+ const dataKeys = new Set(Object.keys(data));
62
+ const missing = requiredProps
63
+ .filter((ps) => !dataKeys.has(ps.label))
64
+ .map((ps) => ps.label);
65
+ if (missing.length > 0) {
66
+ throw new Error(`Missing required fields for '${shapeObj.label || shapeObj.id}': ${missing.join(', ')}`);
67
+ }
68
+ }
69
+ // TODO: Full data validation against the shape (type checking, maxCount, nested shapes, etc.)
70
+ // Inject __id if fixedId is set
71
+ const dataWithId = this._fixedId
72
+ ? Object.assign(Object.assign({}, data), { __id: this._fixedId }) : data;
73
+ const factory = new CreateQueryFactory(this._shape, dataWithId);
74
+ return factory.build();
75
+ }
76
+ /** Execute the mutation. */
77
+ exec() {
78
+ return getQueryDispatch().createQuery(this.build());
79
+ }
80
+ // ---------------------------------------------------------------------------
81
+ // Promise interface
82
+ // ---------------------------------------------------------------------------
83
+ then(onfulfilled, onrejected) {
84
+ return this.exec().then(onfulfilled, onrejected);
85
+ }
86
+ catch(onrejected) {
87
+ return this.then().catch(onrejected);
88
+ }
89
+ finally(onfinally) {
90
+ return this.then().finally(onfinally);
91
+ }
92
+ get [Symbol.toStringTag]() {
93
+ return 'CreateBuilder';
94
+ }
95
+ }
96
+ //# sourceMappingURL=CreateBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateBuilder.js","sourceRoot":"","sources":["../../../src/queries/CreateBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAC,kBAAkB,EAA8B,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAWpD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IAOxB,YAAoB,IAA0B;QAC5C,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,IAAI,aAAa,iBACtB,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,OAAO,EAAE,IAAI,CAAC,QAAQ,IACnB,SAAS,EACZ,CAAC;IACL,CAAC;IAED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}
@@ -1,4 +1,4 @@
1
- import { Shape } from '../shapes/Shape.js';
1
+ import { Shape, ShapeConstructor } from '../shapes/Shape.js';
2
2
  import { AddId, NodeDescriptionValue, UpdatePartial } from './QueryFactory.js';
3
3
  import { MutationQueryFactory } from './MutationQuery.js';
4
4
  import { IRCreateMutation } from './IntermediateRepresentation.js';
@@ -9,9 +9,9 @@ import { IRCreateMutation } from './IntermediateRepresentation.js';
9
9
  export type CreateQuery = IRCreateMutation;
10
10
  export type CreateResponse<U> = AddId<U, true>;
11
11
  export declare class CreateQueryFactory<ShapeType extends Shape, U extends UpdatePartial<ShapeType>> extends MutationQueryFactory {
12
- shapeClass: typeof Shape;
12
+ shapeClass: ShapeConstructor<ShapeType>;
13
13
  readonly id: string;
14
14
  readonly description: NodeDescriptionValue;
15
- constructor(shapeClass: typeof Shape, updateObjectOrFn: U);
15
+ constructor(shapeClass: ShapeConstructor<ShapeType>, updateObjectOrFn: U);
16
16
  build(): CreateQuery;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CreateQuery.js","sourceRoot":"","sources":["../../../src/queries/CreateQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAC,8BAA8B,EAAC,MAAM,iBAAiB,CAAC;AAU/D,MAAM,OAAO,kBAGX,SAAQ,oBAAoB;IAI5B,YACS,UAAwB,EAC/B,gBAAmB;QAEnB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAAc;QAI/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CACzC,gBAAgB,EAChB,IAAI,CAAC,UAAU,CAAC,KAAK,EACrB,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK;QACH,OAAO,8BAA8B,CAAC;YACpC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"CreateQuery.js","sourceRoot":"","sources":["../../../src/queries/CreateQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAC,8BAA8B,EAAC,MAAM,iBAAiB,CAAC;AAU/D,MAAM,OAAO,kBAGX,SAAQ,oBAAoB;IAI5B,YACS,UAAuC,EAC9C,gBAAmB;QAEnB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAA6B;QAI9C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CACzC,gBAAgB,EAChB,IAAI,CAAC,UAAU,CAAC,KAAK,EACrB,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK;QACH,OAAO,8BAA8B,CAAC;YACpC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ import { Shape, ShapeConstructor } from '../shapes/Shape.js';
2
+ import { DeleteQuery, DeleteResponse } from './DeleteQuery.js';
3
+ import { NodeId } from './MutationQuery.js';
4
+ /**
5
+ * An immutable, fluent builder for delete mutations.
6
+ *
7
+ * Implements PromiseLike so mutations execute on `await`:
8
+ * ```ts
9
+ * const result = await DeleteBuilder.from(Person).for({id: '...'});
10
+ * ```
11
+ *
12
+ * Internally delegates to DeleteQueryFactory for IR generation.
13
+ */
14
+ export declare class DeleteBuilder<S extends Shape = Shape> implements PromiseLike<DeleteResponse>, Promise<DeleteResponse> {
15
+ private readonly _shape;
16
+ private readonly _ids?;
17
+ private constructor();
18
+ private clone;
19
+ /**
20
+ * Create a DeleteBuilder for the given shape.
21
+ *
22
+ * Optionally accepts IDs inline for backwards compatibility:
23
+ * ```ts
24
+ * DeleteBuilder.from(Person).for({id: '...'}) // preferred
25
+ * DeleteBuilder.from(Person, {id: '...'}) // also supported
26
+ * ```
27
+ */
28
+ static from<S extends Shape>(shape: ShapeConstructor<S> | string, ids?: NodeId | NodeId[]): DeleteBuilder<S>;
29
+ /** Specify the target IDs to delete. */
30
+ for(ids: NodeId | NodeId[]): DeleteBuilder<S>;
31
+ /** Build the IR mutation. Throws if no IDs were specified via .for(). */
32
+ build(): DeleteQuery;
33
+ /** Execute the mutation. */
34
+ exec(): Promise<DeleteResponse>;
35
+ then<TResult1 = DeleteResponse, TResult2 = never>(onfulfilled?: ((value: DeleteResponse) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
36
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<DeleteResponse | TResult>;
37
+ finally(onfinally?: (() => void) | null): Promise<DeleteResponse>;
38
+ get [Symbol.toStringTag](): string;
39
+ }
@@ -0,0 +1,81 @@
1
+ import { resolveShape } from './resolveShape.js';
2
+ import { DeleteQueryFactory } from './DeleteQuery.js';
3
+ import { getQueryDispatch } from './queryDispatch.js';
4
+ /**
5
+ * An immutable, fluent builder for delete mutations.
6
+ *
7
+ * Implements PromiseLike so mutations execute on `await`:
8
+ * ```ts
9
+ * const result = await DeleteBuilder.from(Person).for({id: '...'});
10
+ * ```
11
+ *
12
+ * Internally delegates to DeleteQueryFactory for IR generation.
13
+ */
14
+ export class DeleteBuilder {
15
+ constructor(init) {
16
+ this._shape = init.shape;
17
+ this._ids = init.ids;
18
+ }
19
+ clone(overrides = {}) {
20
+ return new DeleteBuilder(Object.assign({ shape: this._shape, ids: this._ids }, overrides));
21
+ }
22
+ // ---------------------------------------------------------------------------
23
+ // Static constructors
24
+ // ---------------------------------------------------------------------------
25
+ /**
26
+ * Create a DeleteBuilder for the given shape.
27
+ *
28
+ * Optionally accepts IDs inline for backwards compatibility:
29
+ * ```ts
30
+ * DeleteBuilder.from(Person).for({id: '...'}) // preferred
31
+ * DeleteBuilder.from(Person, {id: '...'}) // also supported
32
+ * ```
33
+ */
34
+ static from(shape, ids) {
35
+ const resolved = resolveShape(shape);
36
+ if (ids !== undefined) {
37
+ const idsArray = Array.isArray(ids) ? ids : [ids];
38
+ return new DeleteBuilder({ shape: resolved, ids: idsArray });
39
+ }
40
+ return new DeleteBuilder({ shape: resolved });
41
+ }
42
+ // ---------------------------------------------------------------------------
43
+ // Fluent API
44
+ // ---------------------------------------------------------------------------
45
+ /** Specify the target IDs to delete. */
46
+ for(ids) {
47
+ const idsArray = Array.isArray(ids) ? ids : [ids];
48
+ return this.clone({ ids: idsArray });
49
+ }
50
+ // ---------------------------------------------------------------------------
51
+ // Build & execute
52
+ // ---------------------------------------------------------------------------
53
+ /** Build the IR mutation. Throws if no IDs were specified via .for(). */
54
+ build() {
55
+ if (!this._ids || this._ids.length === 0) {
56
+ throw new Error('DeleteBuilder requires at least one ID to delete. Specify targets with .for(ids).');
57
+ }
58
+ const factory = new DeleteQueryFactory(this._shape, this._ids);
59
+ return factory.build();
60
+ }
61
+ /** Execute the mutation. */
62
+ exec() {
63
+ return getQueryDispatch().deleteQuery(this.build());
64
+ }
65
+ // ---------------------------------------------------------------------------
66
+ // Promise interface
67
+ // ---------------------------------------------------------------------------
68
+ then(onfulfilled, onrejected) {
69
+ return this.exec().then(onfulfilled, onrejected);
70
+ }
71
+ catch(onrejected) {
72
+ return this.then().catch(onrejected);
73
+ }
74
+ finally(onfinally) {
75
+ return this.then().finally(onfinally);
76
+ }
77
+ get [Symbol.toStringTag]() {
78
+ return 'DeleteBuilder';
79
+ }
80
+ }
81
+ //# sourceMappingURL=DeleteBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeleteBuilder.js","sourceRoot":"","sources":["../../../src/queries/DeleteBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,kBAAkB,EAA8B,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAC,gB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C9E,kBAAkB;IAClB,8EAA8E;IAE9E,yEAAyE;IACzE,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,kBAAkB,CACpC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,IAAI,CACV,CAAC;QACF,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,4BAA4B;IAC5B,IAAI;QACF,OAAO,gBAAgB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,8EAA8E;IAC9E,oBAAoB;IACpB,8EAA8E;IAE9E,IAAI,CACF,WAAkF,EAClF,UAAuE;QAEvE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CACH,UAAqE;QAErE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,SAA+B;QACrC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- import { Shape } from '../shapes/Shape.js';
1
+ import { Shape, ShapeConstructor } from '../shapes/Shape.js';
2
2
  import { NodeReferenceValue, UpdatePartial } from './QueryFactory.js';
3
3
  import { MutationQueryFactory, NodeId } from './MutationQuery.js';
4
4
  import { IRDeleteMutation } from './IntermediateRepresentation.js';
@@ -26,9 +26,9 @@ export type DeleteResponse = {
26
26
  errors?: Record<string, string>;
27
27
  };
28
28
  export declare class DeleteQueryFactory<ShapeType extends Shape, U extends UpdatePartial<ShapeType>> extends MutationQueryFactory {
29
- shapeClass: typeof Shape;
29
+ shapeClass: ShapeConstructor<ShapeType>;
30
30
  readonly id: string;
31
31
  readonly ids: NodeReferenceValue[];
32
- constructor(shapeClass: typeof Shape, ids: NodeId[] | NodeId);
32
+ constructor(shapeClass: ShapeConstructor<ShapeType>, ids: NodeId[] | NodeId);
33
33
  build(): DeleteQuery;
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAS,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAC,8BAA8B,EAAC,MAAM,iBAAiB,CAAC;AA2B/D,MAAM,OAAO,kBAGX,SAAQ,oBAAoB;IAI5B,YACS,UAAwB,EAC/B,GAAsB;QAEtB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAAc;QAI/B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACH,OAAO,8BAA8B,CAAC;YACpC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAS,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAC,8BAA8B,EAAC,MAAM,iBAAiB,CAAC;AA2B/D,MAAM,OAAO,kBAGX,SAAQ,oBAAoB;IAI5B,YACS,UAAuC,EAC9C,GAAsB;QAEtB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAA6B;QAI9C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACH,OAAO,8BAA8B,CAAC;YACpC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,203 @@
1
+ import type { NodeShape, PropertyShape } from '../shapes/SHACL.js';
2
+ import type { Shape, ShapeConstructor } from '../shapes/Shape.js';
3
+ import { PropertyPath } from './PropertyPath.js';
4
+ import type { WherePath } from './SelectQuery.js';
5
+ type QueryBuilderObjectLike = {
6
+ property?: PropertyShape;
7
+ subject?: QueryBuilderObjectLike;
8
+ wherePath?: unknown;
9
+ };
10
+ /**
11
+ * A single entry in a FieldSet: a property path with optional alias, scoped filter,
12
+ * sub-selection, aggregation, and custom key.
13
+ */
14
+ export type FieldSetEntry = {
15
+ path: PropertyPath;
16
+ alias?: string;
17
+ scopedFilter?: WherePath;
18
+ /** Nested object selection — the user explicitly selected sub-fields (e.g. `p.friends.select(...)`) */
19
+ subSelect?: FieldSet;
20
+ aggregation?: 'count';
21
+ customKey?: string;
22
+ evaluation?: {
23
+ method: string;
24
+ wherePath: any;
25
+ };
26
+ /** Component preload composition — the FieldSet comes from a linked component's own query,
27
+ * merged in via `preloadFor()`. Distinct from subSelect which is a user-authored nested query. */
28
+ preloadSubSelect?: FieldSet;
29
+ };
30
+ /**
31
+ * Input types accepted by FieldSet construction methods.
32
+ *
33
+ * - `string` — resolved via walkPropertyPath (dot-separated)
34
+ * - `PropertyPath` — used directly
35
+ * - `FieldSet` — merged in
36
+ * - `Record<string, string[] | FieldSet>` — nested fields
37
+ */
38
+ export type FieldSetInput = string | PropertyPath | FieldSet | Record<string, string[] | FieldSet>;
39
+ /** JSON representation of a FieldSet field entry. */
40
+ export type FieldSetFieldJSON = {
41
+ path: string;
42
+ as?: string;
43
+ subSelect?: FieldSetJSON;
44
+ aggregation?: string;
45
+ customKey?: string;
46
+ evaluation?: {
47
+ method: string;
48
+ wherePath: any;
49
+ };
50
+ };
51
+ /** JSON representation of a FieldSet. */
52
+ export type FieldSetJSON = {
53
+ shape: string;
54
+ fields: FieldSetFieldJSON[];
55
+ };
56
+ /**
57
+ * An immutable, composable collection of property paths for a shape.
58
+ *
59
+ * FieldSet describes which properties to select, independent of
60
+ * how the query is built. It integrates with QueryBuilder via
61
+ * `.select(fieldSet)`.
62
+ *
63
+ * Every mutation method returns a new FieldSet — the original is never modified.
64
+ */
65
+ export declare class FieldSet<R = any, Source = any> {
66
+ readonly shape: NodeShape;
67
+ readonly entries: readonly FieldSetEntry[];
68
+ /** Phantom field — carries the callback response type for conditional type inference. */
69
+ readonly __response: R;
70
+ /** Phantom field — carries the source context (QueryShapeSet/QueryShape) for conditional type inference. */
71
+ readonly __source: Source;
72
+ /**
73
+ * For sub-select FieldSets: the raw callback return value (proxy trace objects).
74
+ * Stored so conditional types can extract the response type.
75
+ */
76
+ readonly traceResponse?: R;
77
+ /**
78
+ * For sub-select FieldSets: the parent property segments leading to this sub-select.
79
+ */
80
+ readonly parentSegments?: PropertyShape[];
81
+ /**
82
+ * For sub-select FieldSets: the shape class (ShapeType) of the sub-select's target.
83
+ */
84
+ readonly shapeType?: any;
85
+ private constructor();
86
+ /**
87
+ * Create a FieldSet for the given shape with the specified fields.
88
+ *
89
+ * Accepts a ShapeClass (e.g. Person), NodeShape, or shape IRI string.
90
+ * Fields can be string paths, PropertyPath instances, nested objects,
91
+ * or a callback receiving a proxy for dot-access.
92
+ */
93
+ static for<S extends Shape>(shape: ShapeConstructor<S>, fields: FieldSetInput[]): FieldSet<any>;
94
+ static for<S extends Shape, R>(shape: ShapeConstructor<S>, fn: (p: any) => R): FieldSet<R>;
95
+ static for(shape: NodeShape | string, fields: FieldSetInput[]): FieldSet<any>;
96
+ static for(shape: NodeShape | string, fn: (p: any) => any): FieldSet<any>;
97
+ /**
98
+ * Create a typed FieldSet for a sub-select. Traces the callback through the proxy,
99
+ * stores parentSegments and traceResponse for runtime compatibility, and preserves
100
+ * R and Source generics for conditional type inference.
101
+ */
102
+ static forSubSelect<R, Source>(shapeClass: any, fn: (p: any) => R, parentSegments: PropertyShape[]): FieldSet<R, Source>;
103
+ /**
104
+ * Create a FieldSet containing all decorated properties of the shape.
105
+ *
106
+ * @param opts.depth Controls how deep to include nested shape properties:
107
+ * - `depth=1` (default): this level only — properties of the root shape.
108
+ * - `depth=0`: throws — use a node reference instead.
109
+ * - `depth>1`: recursively includes nested shape properties up to the given depth.
110
+ */
111
+ static all<S extends Shape>(shape: ShapeConstructor<S>, opts?: {
112
+ depth?: number;
113
+ }): FieldSet;
114
+ static all(shape: NodeShape | string, opts?: {
115
+ depth?: number;
116
+ }): FieldSet;
117
+ /**
118
+ * Recursive helper for all(). Tracks visited shape IDs to prevent infinite loops
119
+ * from circular shape references.
120
+ */
121
+ private static allForShape;
122
+ /**
123
+ * Merge multiple FieldSets into one, deduplicating by path equality.
124
+ * All FieldSets must share the same root shape.
125
+ */
126
+ static merge(sets: FieldSet[]): FieldSet;
127
+ /** Returns a new FieldSet with only the given fields. */
128
+ select(fields: FieldSetInput[]): FieldSet;
129
+ /** Returns a new FieldSet with additional entries. */
130
+ add(fields: FieldSetInput[]): FieldSet;
131
+ /** Returns a new FieldSet without entries matching the given labels. */
132
+ remove(labels: string[]): FieldSet;
133
+ /** Synonym for replacing all entries — returns a new FieldSet with only the given fields. */
134
+ set(fields: FieldSetInput[]): FieldSet;
135
+ /** Returns a new FieldSet keeping only entries matching the given labels. */
136
+ pick(labels: string[]): FieldSet;
137
+ /** Returns all PropertyPaths in this FieldSet. */
138
+ paths(): PropertyPath[];
139
+ /** Returns terminal property labels of all entries. */
140
+ labels(): string[];
141
+ /**
142
+ * Serialize this FieldSet to a plain JSON object.
143
+ * Shape is identified by its IRI, paths by dot-separated labels.
144
+ */
145
+ toJSON(): FieldSetJSON;
146
+ /**
147
+ * Reconstruct a FieldSet from a JSON object.
148
+ * Resolves shape IRI via getShapeClass() and paths via walkPropertyPath().
149
+ */
150
+ static fromJSON(json: FieldSetJSON): FieldSet;
151
+ /**
152
+ * Resolves any of the accepted shape input types to a NodeShape and optional ShapeClass.
153
+ * Accepts: ShapeConstructor (class with .shape), NodeShape, or IRI string.
154
+ */
155
+ private static resolveShapeInput;
156
+ /** @deprecated Use resolveShapeInput instead. Kept for fromJSON which only passes NodeShape|string. */
157
+ private static resolveShape;
158
+ private static resolveInputs;
159
+ /**
160
+ * Trace fields using the full ProxiedPathBuilder proxy (createProxiedPathBuilder).
161
+ * Handles nested paths, where conditions, aggregations, and sub-selects.
162
+ */
163
+ private static traceFieldsWithProxy;
164
+ /**
165
+ * Convert a single proxy trace result (QueryBuilderObject, SetSize, or FieldSet sub-select)
166
+ * into a FieldSetEntry.
167
+ */
168
+ private static convertTraceResult;
169
+ /**
170
+ * Walk a QueryBuilderObject-like chain (via .subject) collecting PropertyShape segments
171
+ * from leaf to root, then reverse to get root-to-leaf order.
172
+ */
173
+ static collectPropertySegments(obj: QueryBuilderObjectLike): PropertyShape[];
174
+ /**
175
+ * Extract a FieldSet from a component-like object for preload composition.
176
+ *
177
+ * Supports multiple component interfaces:
178
+ * - `.fields` as a FieldSet directly
179
+ * - `.query` as a FieldSet, QueryBuilder (duck-typed via .fields()), or
180
+ * Record<string, QueryBuilder> (e.g. `{person: PersonQuery}`)
181
+ */
182
+ static extractComponentFieldSet(component: any): FieldSet | undefined;
183
+ /**
184
+ * Internal factory that bypasses the private constructor for use by static methods.
185
+ */
186
+ private static createInternal;
187
+ /**
188
+ * Create a FieldSet from raw entries. Used by QueryBuilder to merge preload entries.
189
+ */
190
+ static createFromEntries(shape: NodeShape, entries: FieldSetEntry[]): FieldSet;
191
+ /**
192
+ * Extract FieldSetEntry[] from a sub-query's traceResponse.
193
+ * Public alias for use by lightweight sub-select wrappers.
194
+ */
195
+ static extractSubSelectEntriesPublic(rootShape: NodeShape, traceResponse: any): FieldSetEntry[];
196
+ /**
197
+ * Extract FieldSetEntry[] from a sub-select's traceResponse.
198
+ * The traceResponse is the result of calling the sub-query callback with a proxy,
199
+ * containing QueryBuilderObjects, arrays, custom objects, etc.
200
+ */
201
+ private static extractSubSelectEntries;
202
+ }
203
+ export {};