@_linked/core 1.0.0-next.20260224083238 → 1.1.0

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 (129) hide show
  1. package/CHANGELOG.md +4 -12
  2. package/README.md +40 -186
  3. package/lib/cjs/index.js +0 -2
  4. package/lib/cjs/index.js.map +1 -1
  5. package/lib/cjs/interfaces/IQuadStore.d.ts +7 -19
  6. package/lib/cjs/interfaces/IQueryParser.d.ts +13 -0
  7. package/lib/cjs/interfaces/IQueryParser.js +10 -0
  8. package/lib/cjs/interfaces/IQueryParser.js.map +1 -0
  9. package/lib/cjs/queries/CreateQuery.d.ts +8 -7
  10. package/lib/cjs/queries/CreateQuery.js +4 -4
  11. package/lib/cjs/queries/CreateQuery.js.map +1 -1
  12. package/lib/cjs/queries/DeleteQuery.d.ts +8 -7
  13. package/lib/cjs/queries/DeleteQuery.js +4 -4
  14. package/lib/cjs/queries/DeleteQuery.js.map +1 -1
  15. package/lib/cjs/queries/QueryFactory.d.ts +2 -0
  16. package/lib/cjs/queries/QueryFactory.js +3 -0
  17. package/lib/cjs/queries/QueryFactory.js.map +1 -1
  18. package/lib/cjs/queries/QueryParser.d.ts +1 -6
  19. package/lib/cjs/queries/QueryParser.js +22 -14
  20. package/lib/cjs/queries/QueryParser.js.map +1 -1
  21. package/lib/cjs/queries/SelectQuery.d.ts +27 -18
  22. package/lib/cjs/queries/SelectQuery.js +45 -54
  23. package/lib/cjs/queries/SelectQuery.js.map +1 -1
  24. package/lib/cjs/queries/UpdateQuery.d.ts +9 -8
  25. package/lib/cjs/queries/UpdateQuery.js +4 -4
  26. package/lib/cjs/queries/UpdateQuery.js.map +1 -1
  27. package/lib/cjs/shapes/SHACL.d.ts +0 -1
  28. package/lib/cjs/shapes/SHACL.js +2 -82
  29. package/lib/cjs/shapes/SHACL.js.map +1 -1
  30. package/lib/cjs/shapes/Shape.d.ts +10 -11
  31. package/lib/cjs/shapes/Shape.js +5 -11
  32. package/lib/cjs/shapes/Shape.js.map +1 -1
  33. package/lib/cjs/test-helpers/query-fixtures.d.ts +88 -671
  34. package/lib/cjs/test-helpers/query-fixtures.js +1 -39
  35. package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
  36. package/lib/cjs/utils/LinkedStorage.d.ts +7 -7
  37. package/lib/cjs/utils/LinkedStorage.js +3 -4
  38. package/lib/cjs/utils/LinkedStorage.js.map +1 -1
  39. package/lib/esm/index.js +0 -2
  40. package/lib/esm/index.js.map +1 -1
  41. package/lib/esm/interfaces/IQuadStore.d.ts +7 -19
  42. package/lib/esm/interfaces/IQueryParser.d.ts +13 -0
  43. package/lib/esm/interfaces/IQueryParser.js +7 -0
  44. package/lib/esm/interfaces/IQueryParser.js.map +1 -0
  45. package/lib/esm/queries/CreateQuery.d.ts +8 -7
  46. package/lib/esm/queries/CreateQuery.js +4 -4
  47. package/lib/esm/queries/CreateQuery.js.map +1 -1
  48. package/lib/esm/queries/DeleteQuery.d.ts +8 -7
  49. package/lib/esm/queries/DeleteQuery.js +4 -4
  50. package/lib/esm/queries/DeleteQuery.js.map +1 -1
  51. package/lib/esm/queries/QueryFactory.d.ts +2 -0
  52. package/lib/esm/queries/QueryFactory.js +3 -0
  53. package/lib/esm/queries/QueryFactory.js.map +1 -1
  54. package/lib/esm/queries/QueryParser.d.ts +1 -6
  55. package/lib/esm/queries/QueryParser.js +23 -14
  56. package/lib/esm/queries/QueryParser.js.map +1 -1
  57. package/lib/esm/queries/SelectQuery.d.ts +27 -18
  58. package/lib/esm/queries/SelectQuery.js +45 -54
  59. package/lib/esm/queries/SelectQuery.js.map +1 -1
  60. package/lib/esm/queries/UpdateQuery.d.ts +9 -8
  61. package/lib/esm/queries/UpdateQuery.js +4 -4
  62. package/lib/esm/queries/UpdateQuery.js.map +1 -1
  63. package/lib/esm/shapes/SHACL.d.ts +0 -1
  64. package/lib/esm/shapes/SHACL.js +2 -82
  65. package/lib/esm/shapes/SHACL.js.map +1 -1
  66. package/lib/esm/shapes/Shape.d.ts +10 -11
  67. package/lib/esm/shapes/Shape.js +5 -11
  68. package/lib/esm/shapes/Shape.js.map +1 -1
  69. package/lib/esm/test-helpers/query-fixtures.d.ts +88 -671
  70. package/lib/esm/test-helpers/query-fixtures.js +0 -38
  71. package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
  72. package/lib/esm/utils/LinkedStorage.d.ts +7 -7
  73. package/lib/esm/utils/LinkedStorage.js +3 -4
  74. package/lib/esm/utils/LinkedStorage.js.map +1 -1
  75. package/package.json +1 -1
  76. package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
  77. package/lib/cjs/queries/IRAliasScope.js +0 -52
  78. package/lib/cjs/queries/IRAliasScope.js.map +0 -1
  79. package/lib/cjs/queries/IRCanonicalize.d.ts +0 -36
  80. package/lib/cjs/queries/IRCanonicalize.js +0 -112
  81. package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
  82. package/lib/cjs/queries/IRDesugar.d.ts +0 -98
  83. package/lib/cjs/queries/IRDesugar.js +0 -244
  84. package/lib/cjs/queries/IRDesugar.js.map +0 -1
  85. package/lib/cjs/queries/IRLower.d.ts +0 -8
  86. package/lib/cjs/queries/IRLower.js +0 -238
  87. package/lib/cjs/queries/IRLower.js.map +0 -1
  88. package/lib/cjs/queries/IRMutation.d.ts +0 -23
  89. package/lib/cjs/queries/IRMutation.js +0 -77
  90. package/lib/cjs/queries/IRMutation.js.map +0 -1
  91. package/lib/cjs/queries/IRPipeline.d.ts +0 -8
  92. package/lib/cjs/queries/IRPipeline.js +0 -25
  93. package/lib/cjs/queries/IRPipeline.js.map +0 -1
  94. package/lib/cjs/queries/IRProjection.d.ts +0 -27
  95. package/lib/cjs/queries/IRProjection.js +0 -84
  96. package/lib/cjs/queries/IRProjection.js.map +0 -1
  97. package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -200
  98. package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
  99. package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
  100. package/lib/cjs/test-helpers/query-capture-store.d.ts +0 -5
  101. package/lib/cjs/test-helpers/query-capture-store.js +0 -59
  102. package/lib/cjs/test-helpers/query-capture-store.js.map +0 -1
  103. package/lib/esm/queries/IRAliasScope.d.ts +0 -20
  104. package/lib/esm/queries/IRAliasScope.js +0 -47
  105. package/lib/esm/queries/IRAliasScope.js.map +0 -1
  106. package/lib/esm/queries/IRCanonicalize.d.ts +0 -36
  107. package/lib/esm/queries/IRCanonicalize.js +0 -107
  108. package/lib/esm/queries/IRCanonicalize.js.map +0 -1
  109. package/lib/esm/queries/IRDesugar.d.ts +0 -98
  110. package/lib/esm/queries/IRDesugar.js +0 -240
  111. package/lib/esm/queries/IRDesugar.js.map +0 -1
  112. package/lib/esm/queries/IRLower.d.ts +0 -8
  113. package/lib/esm/queries/IRLower.js +0 -234
  114. package/lib/esm/queries/IRLower.js.map +0 -1
  115. package/lib/esm/queries/IRMutation.d.ts +0 -23
  116. package/lib/esm/queries/IRMutation.js +0 -71
  117. package/lib/esm/queries/IRMutation.js.map +0 -1
  118. package/lib/esm/queries/IRPipeline.d.ts +0 -8
  119. package/lib/esm/queries/IRPipeline.js +0 -21
  120. package/lib/esm/queries/IRPipeline.js.map +0 -1
  121. package/lib/esm/queries/IRProjection.d.ts +0 -27
  122. package/lib/esm/queries/IRProjection.js +0 -78
  123. package/lib/esm/queries/IRProjection.js.map +0 -1
  124. package/lib/esm/queries/IntermediateRepresentation.d.ts +0 -200
  125. package/lib/esm/queries/IntermediateRepresentation.js +0 -2
  126. package/lib/esm/queries/IntermediateRepresentation.js.map +0 -1
  127. package/lib/esm/test-helpers/query-capture-store.d.ts +0 -5
  128. package/lib/esm/test-helpers/query-capture-store.js +0 -55
  129. package/lib/esm/test-helpers/query-capture-store.js.map +0 -1
@@ -1,27 +0,0 @@
1
- import { DesugaredSelectionPath } from './IRDesugar.js';
2
- import { IRAliasScope } from './IRAliasScope.js';
3
- import { IRExpression, IRProjectionItem, IRResultMapEntry } from './IntermediateRepresentation.js';
4
- export type ProjectionPathLoweringOptions = {
5
- rootAlias: string;
6
- resolveTraversal: (fromAlias: string, propertyShapeId: string) => string;
7
- };
8
- export type CanonicalProjectionResult = {
9
- projection: IRProjectionItem[];
10
- resultMap?: IRResultMapEntry[];
11
- };
12
- export type ProjectionPathInput = DesugaredSelectionPath | {
13
- path: DesugaredSelectionPath;
14
- key?: string;
15
- };
16
- /** Derives a result key name from the last step of a selection path. */
17
- export declare const projectionKeyFromPath: (path: DesugaredSelectionPath) => string;
18
- /**
19
- * Lowers a single desugared selection path into an IR expression,
20
- * creating traversal aliases for intermediate property steps.
21
- */
22
- export declare const lowerSelectionPathExpression: (path: DesugaredSelectionPath, options: ProjectionPathLoweringOptions) => IRExpression;
23
- /**
24
- * Builds projection items and a result map from an array of selection paths.
25
- * Each path gets a unique alias and is lowered into an IR expression.
26
- */
27
- export declare const buildCanonicalProjection: (selections: ProjectionPathInput[], options: ProjectionPathLoweringOptions, scope?: IRAliasScope) => CanonicalProjectionResult;
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildCanonicalProjection = exports.lowerSelectionPathExpression = exports.projectionKeyFromPath = void 0;
4
- const IRAliasScope_js_1 = require("./IRAliasScope.js");
5
- /** Derives a result key name from the last step of a selection path. */
6
- const projectionKeyFromPath = (path) => {
7
- if (!path.steps.length)
8
- return 'value';
9
- const lastStep = path.steps[path.steps.length - 1];
10
- if (lastStep.kind === 'property_step')
11
- return lastStep.propertyShapeId;
12
- if (lastStep.kind === 'count_step')
13
- return lastStep.label || 'count';
14
- if (lastStep.kind === 'type_cast_step')
15
- return lastStep.shapeId;
16
- return 'value';
17
- };
18
- exports.projectionKeyFromPath = projectionKeyFromPath;
19
- /**
20
- * Lowers a single desugared selection path into an IR expression,
21
- * creating traversal aliases for intermediate property steps.
22
- */
23
- const lowerSelectionPathExpression = (path, options) => {
24
- if (path.steps.length === 0) {
25
- return { kind: 'alias_expr', alias: options.rootAlias };
26
- }
27
- let currentAlias = options.rootAlias;
28
- for (let i = 0; i < path.steps.length; i++) {
29
- const step = path.steps[i];
30
- const isLast = i === path.steps.length - 1;
31
- if (step.kind === 'property_step') {
32
- if (isLast) {
33
- return {
34
- kind: 'property_expr',
35
- sourceAlias: currentAlias,
36
- property: step.propertyShapeId,
37
- };
38
- }
39
- currentAlias = options.resolveTraversal(currentAlias, step.propertyShapeId);
40
- continue;
41
- }
42
- if (step.kind === 'count_step') {
43
- return {
44
- kind: 'aggregate_expr',
45
- name: 'count',
46
- args: step.path.map((propertyStep) => ({
47
- kind: 'property_expr',
48
- sourceAlias: currentAlias,
49
- property: propertyStep.propertyShapeId,
50
- })),
51
- };
52
- }
53
- }
54
- return { kind: 'alias_expr', alias: currentAlias };
55
- };
56
- exports.lowerSelectionPathExpression = lowerSelectionPathExpression;
57
- /**
58
- * Builds projection items and a result map from an array of selection paths.
59
- * Each path gets a unique alias and is lowered into an IR expression.
60
- */
61
- const buildCanonicalProjection = (selections, options, scope = new IRAliasScope_js_1.IRAliasScope('projection')) => {
62
- const projection = [];
63
- const entries = [];
64
- selections.forEach((selection) => {
65
- const path = 'path' in selection ? selection.path : selection;
66
- const key = 'path' in selection ? selection.key : undefined;
67
- const resultKey = key || (0, exports.projectionKeyFromPath)(path);
68
- const binding = scope.generateAlias(resultKey);
69
- projection.push({
70
- alias: binding.alias,
71
- expression: (0, exports.lowerSelectionPathExpression)(path, options),
72
- });
73
- entries.push({
74
- key: resultKey,
75
- alias: binding.alias,
76
- });
77
- });
78
- return {
79
- projection,
80
- resultMap: entries,
81
- };
82
- };
83
- exports.buildCanonicalProjection = buildCanonicalProjection;
84
- //# sourceMappingURL=IRProjection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRProjection.js","sourceRoot":"","sources":["../../../src/queries/IRProjection.ts"],"names":[],"mappings":";;;AACA,uDAA+C;AAoB/C,wEAAwE;AACjE,MAAM,qBAAqB,GAAG,CAAC,IAA4B,EAAU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SAAS,CAAC,CAAC;QAC/C,UAAU,CAAC,IAAI,CAAC;YACd,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,IAAA,oCAA4B,EAAC,IAAI,EAAE,OAAO,CAAC;SACxD,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC;YACX,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,UAAU;QACV,SAAS,EAAE,OAAO;KACnB,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,wBAAwB,4BA2BnC"}
@@ -1,200 +0,0 @@
1
- import { NodeReferenceValue } from './QueryFactory.js';
2
- export type IRDirection = 'ASC' | 'DESC';
3
- export type IRAlias = string;
4
- export type IRValue = string | number | boolean | null;
5
- export type IRQuery = IRSelectQuery | IRCreateMutation | IRUpdateMutation | IRDeleteMutation;
6
- export type IRSelectQuery = {
7
- kind: 'select';
8
- root: IRShapeScanPattern;
9
- patterns: IRGraphPattern[];
10
- projection: IRProjectionItem[];
11
- where?: IRExpression;
12
- orderBy?: IROrderByItem[];
13
- limit?: number;
14
- offset?: number;
15
- subjectId?: string;
16
- singleResult?: boolean;
17
- resultMap?: IRResultMapEntry[];
18
- };
19
- export type IRProjectionItem = {
20
- alias: IRAlias;
21
- expression: IRExpression;
22
- };
23
- export type IROrderByItem = {
24
- expression: IRExpression;
25
- direction: IRDirection;
26
- };
27
- export type IRResultMapEntry = {
28
- key: string;
29
- alias: IRAlias;
30
- };
31
- export type IRGraphPattern = IRShapeScanPattern | IRTraversePattern | IRJoinPattern | IROptionalPattern | IRUnionPattern | IRExistsPattern;
32
- export type IRShapeScanPattern = {
33
- kind: 'shape_scan';
34
- shape: string;
35
- alias: IRAlias;
36
- };
37
- export type IRTraversePattern = {
38
- kind: 'traverse';
39
- from: IRAlias;
40
- to: IRAlias;
41
- property: string;
42
- };
43
- export type IRJoinPattern = {
44
- kind: 'join';
45
- patterns: IRGraphPattern[];
46
- };
47
- export type IROptionalPattern = {
48
- kind: 'optional';
49
- pattern: IRGraphPattern;
50
- };
51
- export type IRUnionPattern = {
52
- kind: 'union';
53
- branches: IRGraphPattern[];
54
- };
55
- export type IRExistsPattern = {
56
- kind: 'exists';
57
- pattern: IRGraphPattern;
58
- };
59
- export type IRExpression = IRLiteralExpression | IRAliasExpression | IRPropertyExpression | IRBinaryExpression | IRLogicalExpression | IRNotExpression | IRFunctionExpression | IRAggregateExpression | IRExistsExpression;
60
- export type IRLiteralExpression = {
61
- kind: 'literal_expr';
62
- value: IRValue;
63
- };
64
- export type IRAliasExpression = {
65
- kind: 'alias_expr';
66
- alias: IRAlias;
67
- };
68
- export type IRPropertyExpression = {
69
- kind: 'property_expr';
70
- sourceAlias: IRAlias;
71
- property: string;
72
- };
73
- export type IRBinaryOperator = '=' | '!=' | '>' | '>=' | '<' | '<=';
74
- export type IRBinaryExpression = {
75
- kind: 'binary_expr';
76
- operator: IRBinaryOperator;
77
- left: IRExpression;
78
- right: IRExpression;
79
- };
80
- export type IRLogicalOperator = 'and' | 'or';
81
- export type IRLogicalExpression = {
82
- kind: 'logical_expr';
83
- operator: IRLogicalOperator;
84
- expressions: IRExpression[];
85
- };
86
- export type IRNotExpression = {
87
- kind: 'not_expr';
88
- expression: IRExpression;
89
- };
90
- export type IRFunctionExpression = {
91
- kind: 'function_expr';
92
- name: string;
93
- args: IRExpression[];
94
- };
95
- export type IRAggregateExpression = {
96
- kind: 'aggregate_expr';
97
- name: 'count' | 'sum' | 'avg' | 'min' | 'max';
98
- args: IRExpression[];
99
- };
100
- export type IRExistsExpression = {
101
- kind: 'exists_expr';
102
- pattern: IRGraphPattern;
103
- filter?: IRExpression;
104
- };
105
- export type IRCreateMutation = {
106
- kind: 'create';
107
- shape: string;
108
- data: IRNodeData;
109
- };
110
- export type IRUpdateMutation = {
111
- kind: 'update';
112
- shape: string;
113
- id: string;
114
- data: IRNodeData;
115
- };
116
- export type IRDeleteMutation = {
117
- kind: 'delete';
118
- shape: string;
119
- ids: NodeReferenceValue[];
120
- };
121
- export type IRNodeData = {
122
- shape: string;
123
- fields: IRFieldUpdate[];
124
- id?: string;
125
- };
126
- export type IRFieldUpdate = {
127
- property: string;
128
- value: IRFieldValue;
129
- };
130
- export type IRSetModificationValue = {
131
- add?: IRFieldValue[];
132
- remove?: NodeReferenceValue[];
133
- };
134
- export type IRFieldValue = IRValue | Date | NodeReferenceValue | IRNodeData | IRSetModificationValue | IRFieldValue[] | undefined;
135
- /**
136
- * A single result row — an object with a node id and dynamic fields.
137
- * Used in select and create results.
138
- */
139
- export type ResultRow = {
140
- id: string;
141
- [key: string]: ResultFieldValue;
142
- };
143
- /**
144
- * Possible field values in a select or create result row.
145
- */
146
- export type ResultFieldValue = string | number | boolean | Date | null | undefined | ResultRow | ResultRow[];
147
- /**
148
- * What `selectQuery` should return.
149
- *
150
- * - Array of rows for multi-result queries (the default).
151
- * - A single row when `query.singleResult` is true (`.one()` or subject-targeted query).
152
- * - `null` when `singleResult` is true and the target node doesn't exist.
153
- */
154
- export type SelectResult = ResultRow[] | ResultRow | null;
155
- /**
156
- * What `createQuery` should return.
157
- *
158
- * A single row with the generated `id` and the created field values.
159
- * Nested creates appear as nested `ResultRow` objects (with their own ids).
160
- * Array fields (e.g. friends) appear as `ResultRow[]`.
161
- */
162
- export type CreateResult = ResultRow;
163
- /**
164
- * When a set property is fully overwritten, the result contains `updatedTo`
165
- * with the new complete set of values.
166
- */
167
- export type SetOverwriteResult = {
168
- updatedTo: ResultRow[];
169
- };
170
- /**
171
- * When a set property is incrementally modified with `{add, remove}`,
172
- * the result contains the added and removed entries.
173
- */
174
- export type SetModificationResult = {
175
- added: ResultRow[];
176
- removed: ResultRow[];
177
- };
178
- /**
179
- * Possible field values in an update result row.
180
- * Extends `ResultFieldValue` with set modification shapes.
181
- */
182
- export type UpdateFieldValue = ResultFieldValue | SetOverwriteResult | SetModificationResult;
183
- /**
184
- * What `updateQuery` should return.
185
- *
186
- * A single row with the target node's `id` and only the changed fields.
187
- * Fields not included in the update are omitted (not returned).
188
- *
189
- * Field value shapes depend on the type of update:
190
- * - Literal fields: the new value (string, number, boolean, Date).
191
- * - Single object fields: a `ResultRow` with the referenced/created node.
192
- * - Set overwrite (passing an array): `{updatedTo: ResultRow[]}`.
193
- * - Set add/remove (passing `{add, remove}`): `{added: ResultRow[], removed: ResultRow[]}`.
194
- * - Unset single field (passing `undefined` or `null`): field is `undefined`.
195
- * - Unset multi-value field (passing `undefined`): empty array `[]`.
196
- */
197
- export type UpdateResult = {
198
- id: string;
199
- [key: string]: UpdateFieldValue;
200
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IntermediateRepresentation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntermediateRepresentation.js","sourceRoot":"","sources":["../../../src/queries/IntermediateRepresentation.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- /**
2
- * Execute a query-producing callback and return whatever
3
- * the capture intercepted.
4
- */
5
- export declare const captureQuery: (runner: () => Promise<unknown>) => Promise<any>;
@@ -1,59 +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.captureQuery = void 0;
13
- const globals_1 = require("@jest/globals");
14
- const QueryParser_1 = require("../queries/QueryParser");
15
- const UpdateQuery_1 = require("../queries/UpdateQuery");
16
- const CreateQuery_1 = require("../queries/CreateQuery");
17
- const DeleteQuery_1 = require("../queries/DeleteQuery");
18
- /**
19
- * Test utility that intercepts QueryParser methods via jest.spyOn and captures
20
- * the query object for inspection by test assertions.
21
- *
22
- * For select queries, captures the RawSelectInput (pipeline input format).
23
- * For mutations, captures the IR (canonical format).
24
- *
25
- * Import this module and call `captureQuery(runner)` to execute a DSL
26
- * call (e.g. Person.select(...)) and retrieve the captured query.
27
- */
28
- let _lastQuery;
29
- globals_1.jest.spyOn(QueryParser_1.QueryParser, 'selectQuery').mockImplementation((query) => __awaiter(void 0, void 0, void 0, function* () {
30
- _lastQuery = query.toRawInput();
31
- return [];
32
- }));
33
- globals_1.jest.spyOn(QueryParser_1.QueryParser, 'createQuery').mockImplementation((updateObjectOrFn, shapeClass) => __awaiter(void 0, void 0, void 0, function* () {
34
- const factory = new CreateQuery_1.CreateQueryFactory(shapeClass, updateObjectOrFn);
35
- _lastQuery = factory.build();
36
- return {};
37
- }));
38
- globals_1.jest.spyOn(QueryParser_1.QueryParser, 'updateQuery').mockImplementation((id, updateObjectOrFn, shapeClass) => __awaiter(void 0, void 0, void 0, function* () {
39
- const factory = new UpdateQuery_1.UpdateQueryFactory(shapeClass, id, updateObjectOrFn);
40
- _lastQuery = factory.build();
41
- return {};
42
- }));
43
- globals_1.jest.spyOn(QueryParser_1.QueryParser, 'deleteQuery').mockImplementation((id, shapeClass) => __awaiter(void 0, void 0, void 0, function* () {
44
- const ids = (Array.isArray(id) ? id : [id]);
45
- const factory = new DeleteQuery_1.DeleteQueryFactory(shapeClass, ids);
46
- _lastQuery = factory.build();
47
- return { deleted: [], count: 0 };
48
- }));
49
- /**
50
- * Execute a query-producing callback and return whatever
51
- * the capture intercepted.
52
- */
53
- const captureQuery = (runner) => __awaiter(void 0, void 0, void 0, function* () {
54
- _lastQuery = undefined;
55
- yield runner();
56
- return _lastQuery;
57
- });
58
- exports.captureQuery = captureQuery;
59
- //# sourceMappingURL=query-capture-store.js.map
@@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AC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAa,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,gCAAkB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACxD,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAC7B,OAAO,EAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC,CAAA,CACF,CAAC;AAEF;;;GAGG;AACI,MAAM,YAAY,GAAG,CAC1B,MAA8B,EAC9B,EAAE;IACF,UAAU,GAAG,SAAS,CAAC;IACvB,MAAM,MAAM,EAAE,CAAC;IACf,OAAO,UAAU,CAAC;AACpB,CAAC,CAAA,CAAC;AANW,QAAA,YAAY,gBAMvB"}
@@ -1,20 +0,0 @@
1
- /** A named alias binding in a scope, tracking its source and nesting depth. */
2
- export type IRAliasBinding = {
3
- alias: string;
4
- source: string;
5
- scopeDepth: number;
6
- };
7
- export declare class IRAliasScope {
8
- readonly scopeName: string;
9
- private readonly parent?;
10
- private bindings;
11
- private generatedCount;
12
- constructor(scopeName: string, parent?: IRAliasScope);
13
- get depth(): number;
14
- registerAlias(alias: string, source: string): IRAliasBinding;
15
- generateAlias(source: string): IRAliasBinding;
16
- resolveAlias(alias: string): IRAliasBinding;
17
- createChildScope(name: string): IRAliasScope;
18
- }
19
- /** Validates that an alias exists in the current scope chain, throwing if not found. */
20
- export declare const validateAliasReference: (alias: string, currentScope: IRAliasScope) => IRAliasBinding;
@@ -1,47 +0,0 @@
1
- export class IRAliasScope {
2
- constructor(scopeName, parent) {
3
- this.scopeName = scopeName;
4
- this.parent = parent;
5
- this.bindings = new Map();
6
- this.generatedCount = 0;
7
- }
8
- get depth() {
9
- return this.parent ? this.parent.depth + 1 : 0;
10
- }
11
- registerAlias(alias, source) {
12
- if (this.bindings.has(alias)) {
13
- throw new Error(`Alias already exists in scope: ${alias}`);
14
- }
15
- const binding = {
16
- alias,
17
- source,
18
- scopeDepth: this.depth,
19
- };
20
- this.bindings.set(alias, binding);
21
- return binding;
22
- }
23
- generateAlias(source) {
24
- let alias;
25
- do {
26
- alias = `a${this.generatedCount++}`;
27
- } while (this.bindings.has(alias));
28
- return this.registerAlias(alias, source);
29
- }
30
- resolveAlias(alias) {
31
- if (this.bindings.has(alias)) {
32
- return this.bindings.get(alias);
33
- }
34
- if (this.parent) {
35
- return this.parent.resolveAlias(alias);
36
- }
37
- throw new Error(`Alias not found in scope chain: ${alias}`);
38
- }
39
- createChildScope(name) {
40
- return new IRAliasScope(name, this);
41
- }
42
- }
43
- /** Validates that an alias exists in the current scope chain, throwing if not found. */
44
- export const validateAliasReference = (alias, currentScope) => {
45
- return currentScope.resolveAlias(alias);
46
- };
47
- //# sourceMappingURL=IRAliasScope.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRAliasScope.js","sourceRoot":"","sources":["../../../src/queries/IRAliasScope.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,YAAY;IAIvB,YACkB,SAAiB,EAChB,MAAqB;QADtB,cAAS,GAAT,SAAS,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAe;QALhC,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAC7C,mBAAc,GAAG,CAAC,CAAC;IAKxB,CAAC;IAEJ,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,aAAa,CAAC,KAAa,EAAE,MAAc;QACzC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,OAAO,GAAmB;YAC9B,KAAK;YACL,MAAM;YACN,UAAU,EAAE,IAAI,CAAC,KAAK;SACvB,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,aAAa,CAAC,MAAc;QAC1B,IAAI,KAAa,CAAC;QAClB,GAAG,CAAC;YACF,KAAK,GAAG,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACtC,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACnC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,YAAY,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,gBAAgB,CAAC,IAAY;QAC3B,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACF;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAa,EACb,YAA0B,EACV,EAAE;IAClB,OAAO,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -1,36 +0,0 @@
1
- import { DesugaredSelectionPath, DesugaredSelectQuery, DesugaredWhere, DesugaredWhereArg } from './IRDesugar.js';
2
- import { WhereMethods } from './SelectQuery.js';
3
- export type CanonicalWhereComparison = {
4
- kind: 'where_binary';
5
- operator: WhereMethods;
6
- left: DesugaredSelectionPath;
7
- right: DesugaredWhereArg[];
8
- };
9
- export type CanonicalWhereLogical = {
10
- kind: 'where_logical';
11
- operator: 'and' | 'or';
12
- expressions: CanonicalWhereExpression[];
13
- };
14
- export type CanonicalWhereExists = {
15
- kind: 'where_exists';
16
- path: DesugaredSelectionPath;
17
- predicate: CanonicalWhereExpression;
18
- };
19
- export type CanonicalWhereNot = {
20
- kind: 'where_not';
21
- expression: CanonicalWhereExpression;
22
- };
23
- export type CanonicalWhereExpression = CanonicalWhereComparison | CanonicalWhereLogical | CanonicalWhereExists | CanonicalWhereNot;
24
- export type CanonicalDesugaredSelectQuery = Omit<DesugaredSelectQuery, 'where'> & {
25
- where?: CanonicalWhereExpression;
26
- };
27
- /**
28
- * Recursively rewrites a desugared where-clause into canonical form:
29
- * flattens nested AND/OR groups, converts quantifiers (some/every) to exists patterns.
30
- */
31
- export declare const canonicalizeWhere: (where: DesugaredWhere) => CanonicalWhereExpression;
32
- /**
33
- * Canonicalizes a desugared select query by normalizing its where-clause.
34
- * All other fields pass through unchanged.
35
- */
36
- export declare const canonicalizeDesugaredSelectQuery: (query: DesugaredSelectQuery) => CanonicalDesugaredSelectQuery;
@@ -1,107 +0,0 @@
1
- import { WhereMethods } from './SelectQuery.js';
2
- const toComparison = (comparison) => {
3
- return {
4
- kind: 'where_binary',
5
- operator: comparison.operator,
6
- left: comparison.left,
7
- right: comparison.right,
8
- };
9
- };
10
- const isDesugaredWhere = (arg) => {
11
- return (typeof arg === 'object' &&
12
- !!arg &&
13
- 'kind' in arg &&
14
- (arg.kind === 'where_comparison' ||
15
- arg.kind === 'where_boolean'));
16
- };
17
- const toExists = (comparison) => {
18
- const nested = comparison.right.find(isDesugaredWhere);
19
- if (!nested) {
20
- return toComparison(comparison);
21
- }
22
- const nestedExpr = canonicalizeWhere(nested);
23
- if (comparison.operator === WhereMethods.SOME) {
24
- return {
25
- kind: 'where_exists',
26
- path: comparison.left,
27
- predicate: nestedExpr,
28
- };
29
- }
30
- if (comparison.operator === WhereMethods.EVERY) {
31
- return {
32
- kind: 'where_not',
33
- expression: {
34
- kind: 'where_exists',
35
- path: comparison.left,
36
- predicate: {
37
- kind: 'where_not',
38
- expression: nestedExpr,
39
- },
40
- },
41
- };
42
- }
43
- return toComparison(comparison);
44
- };
45
- const flattenLogical = (operator, left, right) => {
46
- const expressions = [];
47
- if (left.kind === 'where_logical' && left.operator === operator) {
48
- expressions.push(...left.expressions);
49
- }
50
- else {
51
- expressions.push(left);
52
- }
53
- if (right.kind === 'where_logical' && right.operator === operator) {
54
- expressions.push(...right.expressions);
55
- }
56
- else {
57
- expressions.push(right);
58
- }
59
- return {
60
- kind: 'where_logical',
61
- operator,
62
- expressions,
63
- };
64
- };
65
- /**
66
- * Recursively rewrites a desugared where-clause into canonical form:
67
- * flattens nested AND/OR groups, converts quantifiers (some/every) to exists patterns.
68
- */
69
- export const canonicalizeWhere = (where) => {
70
- if (where.kind === 'where_comparison') {
71
- if (where.operator === WhereMethods.EQUALS) {
72
- const nestedQuantifier = where.right.find((arg) => isDesugaredWhere(arg) &&
73
- arg.kind === 'where_comparison' &&
74
- (arg.operator === WhereMethods.SOME ||
75
- arg.operator === WhereMethods.EVERY));
76
- if (nestedQuantifier) {
77
- return canonicalizeWhere(nestedQuantifier);
78
- }
79
- }
80
- if (where.operator === WhereMethods.SOME ||
81
- where.operator === WhereMethods.EVERY ||
82
- where.operator === 'some' ||
83
- where.operator === 'every') {
84
- return toExists(where);
85
- }
86
- return toComparison(where);
87
- }
88
- const grouped = where;
89
- let current = toComparison(grouped.first);
90
- grouped.andOr.forEach((token) => {
91
- if (token.and) {
92
- current = flattenLogical('and', current, canonicalizeWhere(token.and));
93
- }
94
- else if (token.or) {
95
- current = flattenLogical('or', current, canonicalizeWhere(token.or));
96
- }
97
- });
98
- return current;
99
- };
100
- /**
101
- * Canonicalizes a desugared select query by normalizing its where-clause.
102
- * All other fields pass through unchanged.
103
- */
104
- export const canonicalizeDesugaredSelectQuery = (query) => {
105
- return Object.assign(Object.assign({}, query), { where: query.where ? canonicalizeWhere(query.where) : undefined });
106
- };
107
- //# sourceMappingURL=IRCanonicalize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRCanonicalize.js","sourceRoot":"","sources":["../../../src/queries/IRCanonicalize.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAoC9C,MAAM,YAAY,GAAG,CACnB,UAAoC,EACV,EAAE;IAC5B,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;KACxB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,GAAsB,EAAyB,EAAE;IACzE,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,CAAC,CAAC,GAAG;QACL,MAAM,IAAI,GAAG;QACb,CAAE,GAAsB,CAAC,IAAI,KAAK,kBAAkB;YACjD,GAAsB,CAAC,IAAI,KAAK,eAAe,CAAC,CACpD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CACf,UAAoC,EACV,EAAE;IAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,QAAQ,KAAK,YAAY,CAAC,IAAI,EAAE,CAAC;QAC9C,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,SAAS,EAAE,UAAU;SACtB,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,KAAK,YAAY,CAAC,KAAK,EA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