@_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.
- package/CHANGELOG.md +4 -12
- package/README.md +40 -186
- package/lib/cjs/index.js +0 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/IQuadStore.d.ts +7 -19
- package/lib/cjs/interfaces/IQueryParser.d.ts +13 -0
- package/lib/cjs/interfaces/IQueryParser.js +10 -0
- package/lib/cjs/interfaces/IQueryParser.js.map +1 -0
- package/lib/cjs/queries/CreateQuery.d.ts +8 -7
- package/lib/cjs/queries/CreateQuery.js +4 -4
- package/lib/cjs/queries/CreateQuery.js.map +1 -1
- package/lib/cjs/queries/DeleteQuery.d.ts +8 -7
- package/lib/cjs/queries/DeleteQuery.js +4 -4
- package/lib/cjs/queries/DeleteQuery.js.map +1 -1
- package/lib/cjs/queries/QueryFactory.d.ts +2 -0
- package/lib/cjs/queries/QueryFactory.js +3 -0
- package/lib/cjs/queries/QueryFactory.js.map +1 -1
- package/lib/cjs/queries/QueryParser.d.ts +1 -6
- package/lib/cjs/queries/QueryParser.js +22 -14
- package/lib/cjs/queries/QueryParser.js.map +1 -1
- package/lib/cjs/queries/SelectQuery.d.ts +27 -18
- package/lib/cjs/queries/SelectQuery.js +45 -54
- package/lib/cjs/queries/SelectQuery.js.map +1 -1
- package/lib/cjs/queries/UpdateQuery.d.ts +9 -8
- package/lib/cjs/queries/UpdateQuery.js +4 -4
- package/lib/cjs/queries/UpdateQuery.js.map +1 -1
- package/lib/cjs/shapes/SHACL.d.ts +0 -1
- package/lib/cjs/shapes/SHACL.js +2 -82
- package/lib/cjs/shapes/SHACL.js.map +1 -1
- package/lib/cjs/shapes/Shape.d.ts +10 -11
- package/lib/cjs/shapes/Shape.js +5 -11
- package/lib/cjs/shapes/Shape.js.map +1 -1
- package/lib/cjs/test-helpers/query-fixtures.d.ts +88 -671
- package/lib/cjs/test-helpers/query-fixtures.js +1 -39
- package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
- package/lib/cjs/utils/LinkedStorage.d.ts +7 -7
- package/lib/cjs/utils/LinkedStorage.js +3 -4
- package/lib/cjs/utils/LinkedStorage.js.map +1 -1
- package/lib/esm/index.js +0 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/IQuadStore.d.ts +7 -19
- package/lib/esm/interfaces/IQueryParser.d.ts +13 -0
- package/lib/esm/interfaces/IQueryParser.js +7 -0
- package/lib/esm/interfaces/IQueryParser.js.map +1 -0
- package/lib/esm/queries/CreateQuery.d.ts +8 -7
- package/lib/esm/queries/CreateQuery.js +4 -4
- package/lib/esm/queries/CreateQuery.js.map +1 -1
- package/lib/esm/queries/DeleteQuery.d.ts +8 -7
- package/lib/esm/queries/DeleteQuery.js +4 -4
- package/lib/esm/queries/DeleteQuery.js.map +1 -1
- package/lib/esm/queries/QueryFactory.d.ts +2 -0
- package/lib/esm/queries/QueryFactory.js +3 -0
- package/lib/esm/queries/QueryFactory.js.map +1 -1
- package/lib/esm/queries/QueryParser.d.ts +1 -6
- package/lib/esm/queries/QueryParser.js +23 -14
- package/lib/esm/queries/QueryParser.js.map +1 -1
- package/lib/esm/queries/SelectQuery.d.ts +27 -18
- package/lib/esm/queries/SelectQuery.js +45 -54
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/queries/UpdateQuery.d.ts +9 -8
- package/lib/esm/queries/UpdateQuery.js +4 -4
- package/lib/esm/queries/UpdateQuery.js.map +1 -1
- package/lib/esm/shapes/SHACL.d.ts +0 -1
- package/lib/esm/shapes/SHACL.js +2 -82
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/Shape.d.ts +10 -11
- package/lib/esm/shapes/Shape.js +5 -11
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/test-helpers/query-fixtures.d.ts +88 -671
- package/lib/esm/test-helpers/query-fixtures.js +0 -38
- package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
- package/lib/esm/utils/LinkedStorage.d.ts +7 -7
- package/lib/esm/utils/LinkedStorage.js +3 -4
- package/lib/esm/utils/LinkedStorage.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
- package/lib/cjs/queries/IRAliasScope.js +0 -52
- package/lib/cjs/queries/IRAliasScope.js.map +0 -1
- package/lib/cjs/queries/IRCanonicalize.d.ts +0 -36
- package/lib/cjs/queries/IRCanonicalize.js +0 -112
- package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
- package/lib/cjs/queries/IRDesugar.d.ts +0 -98
- package/lib/cjs/queries/IRDesugar.js +0 -244
- package/lib/cjs/queries/IRDesugar.js.map +0 -1
- package/lib/cjs/queries/IRLower.d.ts +0 -8
- package/lib/cjs/queries/IRLower.js +0 -238
- package/lib/cjs/queries/IRLower.js.map +0 -1
- package/lib/cjs/queries/IRMutation.d.ts +0 -23
- package/lib/cjs/queries/IRMutation.js +0 -77
- package/lib/cjs/queries/IRMutation.js.map +0 -1
- package/lib/cjs/queries/IRPipeline.d.ts +0 -8
- package/lib/cjs/queries/IRPipeline.js +0 -25
- package/lib/cjs/queries/IRPipeline.js.map +0 -1
- package/lib/cjs/queries/IRProjection.d.ts +0 -27
- package/lib/cjs/queries/IRProjection.js +0 -84
- package/lib/cjs/queries/IRProjection.js.map +0 -1
- package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -200
- package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
- package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
- package/lib/cjs/test-helpers/query-capture-store.d.ts +0 -5
- package/lib/cjs/test-helpers/query-capture-store.js +0 -59
- package/lib/cjs/test-helpers/query-capture-store.js.map +0 -1
- package/lib/esm/queries/IRAliasScope.d.ts +0 -20
- package/lib/esm/queries/IRAliasScope.js +0 -47
- package/lib/esm/queries/IRAliasScope.js.map +0 -1
- package/lib/esm/queries/IRCanonicalize.d.ts +0 -36
- package/lib/esm/queries/IRCanonicalize.js +0 -107
- package/lib/esm/queries/IRCanonicalize.js.map +0 -1
- package/lib/esm/queries/IRDesugar.d.ts +0 -98
- package/lib/esm/queries/IRDesugar.js +0 -240
- package/lib/esm/queries/IRDesugar.js.map +0 -1
- package/lib/esm/queries/IRLower.d.ts +0 -8
- package/lib/esm/queries/IRLower.js +0 -234
- package/lib/esm/queries/IRLower.js.map +0 -1
- package/lib/esm/queries/IRMutation.d.ts +0 -23
- package/lib/esm/queries/IRMutation.js +0 -71
- package/lib/esm/queries/IRMutation.js.map +0 -1
- package/lib/esm/queries/IRPipeline.d.ts +0 -8
- package/lib/esm/queries/IRPipeline.js +0 -21
- package/lib/esm/queries/IRPipeline.js.map +0 -1
- package/lib/esm/queries/IRProjection.d.ts +0 -27
- package/lib/esm/queries/IRProjection.js +0 -78
- package/lib/esm/queries/IRProjection.js.map +0 -1
- package/lib/esm/queries/IntermediateRepresentation.d.ts +0 -200
- package/lib/esm/queries/IntermediateRepresentation.js +0 -2
- package/lib/esm/queries/IntermediateRepresentation.js.map +0 -1
- package/lib/esm/test-helpers/query-capture-store.d.ts +0 -5
- package/lib/esm/test-helpers/query-capture-store.js +0 -55
- package/lib/esm/test-helpers/query-capture-store.js.map +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { JSNonNullPrimitive, SelectPath, SortByPath, WhereMethods, WherePath } from './SelectQuery.js';
|
|
2
|
-
import { NodeReferenceValue, ShapeReferenceValue } from './QueryFactory.js';
|
|
3
|
-
/**
|
|
4
|
-
* Internal pipeline input type — captures exactly what the desugar pass
|
|
5
|
-
* needs from a select query factory. Replaces the old LegacySelectQuery
|
|
6
|
-
* as the pipeline entry point.
|
|
7
|
-
*/
|
|
8
|
-
export type RawSelectInput = {
|
|
9
|
-
select: SelectPath;
|
|
10
|
-
where?: WherePath;
|
|
11
|
-
sortBy?: SortByPath;
|
|
12
|
-
subject?: unknown;
|
|
13
|
-
shape?: unknown;
|
|
14
|
-
limit?: number;
|
|
15
|
-
offset?: number;
|
|
16
|
-
singleResult?: boolean;
|
|
17
|
-
};
|
|
18
|
-
export type DesugaredPropertyStep = {
|
|
19
|
-
kind: 'property_step';
|
|
20
|
-
propertyShapeId: string;
|
|
21
|
-
where?: DesugaredWhere;
|
|
22
|
-
};
|
|
23
|
-
export type DesugaredCountStep = {
|
|
24
|
-
kind: 'count_step';
|
|
25
|
-
path: DesugaredPropertyStep[];
|
|
26
|
-
label?: string;
|
|
27
|
-
};
|
|
28
|
-
export type DesugaredTypeCastStep = {
|
|
29
|
-
kind: 'type_cast_step';
|
|
30
|
-
shapeId: string;
|
|
31
|
-
};
|
|
32
|
-
export type DesugaredStep = DesugaredPropertyStep | DesugaredCountStep | DesugaredTypeCastStep;
|
|
33
|
-
export type DesugaredSelectionPath = {
|
|
34
|
-
kind: 'selection_path';
|
|
35
|
-
steps: DesugaredStep[];
|
|
36
|
-
};
|
|
37
|
-
export type DesugaredSubSelect = {
|
|
38
|
-
kind: 'sub_select';
|
|
39
|
-
parentPath: DesugaredStep[];
|
|
40
|
-
selections: DesugaredSelection;
|
|
41
|
-
};
|
|
42
|
-
export type DesugaredCustomObjectSelect = {
|
|
43
|
-
kind: 'custom_object_select';
|
|
44
|
-
entries: DesugaredCustomObjectEntry[];
|
|
45
|
-
};
|
|
46
|
-
export type DesugaredCustomObjectEntry = {
|
|
47
|
-
key: string;
|
|
48
|
-
value: DesugaredSelection;
|
|
49
|
-
};
|
|
50
|
-
export type DesugaredEvaluationSelect = {
|
|
51
|
-
kind: 'evaluation_select';
|
|
52
|
-
where: DesugaredWhere;
|
|
53
|
-
};
|
|
54
|
-
export type DesugaredMultiSelection = {
|
|
55
|
-
kind: 'multi_selection';
|
|
56
|
-
selections: DesugaredSelectionPath[];
|
|
57
|
-
};
|
|
58
|
-
export type DesugaredSelection = DesugaredSelectionPath | DesugaredSubSelect | DesugaredCustomObjectSelect | DesugaredEvaluationSelect | DesugaredMultiSelection;
|
|
59
|
-
export type DesugaredWhereComparison = {
|
|
60
|
-
kind: 'where_comparison';
|
|
61
|
-
operator: WhereMethods;
|
|
62
|
-
left: DesugaredSelectionPath;
|
|
63
|
-
right: DesugaredWhereArg[];
|
|
64
|
-
};
|
|
65
|
-
export type DesugaredWhereBoolean = {
|
|
66
|
-
kind: 'where_boolean';
|
|
67
|
-
first: DesugaredWhereComparison;
|
|
68
|
-
andOr: Array<{
|
|
69
|
-
and?: DesugaredWhere;
|
|
70
|
-
or?: DesugaredWhere;
|
|
71
|
-
}>;
|
|
72
|
-
};
|
|
73
|
-
export type DesugaredWhere = DesugaredWhereComparison | DesugaredWhereBoolean;
|
|
74
|
-
export type DesugaredSortBy = {
|
|
75
|
-
direction: 'ASC' | 'DESC';
|
|
76
|
-
paths: DesugaredSelectionPath[];
|
|
77
|
-
};
|
|
78
|
-
export type DesugaredWhereArg = JSNonNullPrimitive | NodeReferenceValue | ShapeReferenceValue | {
|
|
79
|
-
kind: 'arg_path';
|
|
80
|
-
subject?: ShapeReferenceValue;
|
|
81
|
-
path: DesugaredSelectionPath;
|
|
82
|
-
} | DesugaredWhere;
|
|
83
|
-
export type DesugaredSelectQuery = {
|
|
84
|
-
kind: 'desugared_select';
|
|
85
|
-
shapeId?: string;
|
|
86
|
-
subjectId?: string;
|
|
87
|
-
singleResult?: boolean;
|
|
88
|
-
limit?: number;
|
|
89
|
-
offset?: number;
|
|
90
|
-
selections: DesugaredSelection[];
|
|
91
|
-
sortBy?: DesugaredSortBy;
|
|
92
|
-
where?: DesugaredWhere;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Converts a RawSelectInput (DSL-level query) into a flat DesugaredSelectQuery
|
|
96
|
-
* by walking proxy-traced select/where/sortBy paths and extracting property steps.
|
|
97
|
-
*/
|
|
98
|
-
export declare const desugarSelectQuery: (query: RawSelectInput) => DesugaredSelectQuery;
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { isWhereEvaluationPath, } from './SelectQuery.js';
|
|
2
|
-
const isPropertyQueryStep = (step) => {
|
|
3
|
-
var _a;
|
|
4
|
-
return !!step && typeof step === 'object' && 'property' in step &&
|
|
5
|
-
!!((_a = step.property) === null || _a === void 0 ? void 0 : _a.id);
|
|
6
|
-
};
|
|
7
|
-
const isSizeStep = (step) => {
|
|
8
|
-
return !!step && typeof step === 'object' && 'count' in step;
|
|
9
|
-
};
|
|
10
|
-
const isShapeRef = (value) => !!value && typeof value === 'object' && 'id' in value && 'shape' in value;
|
|
11
|
-
const isNodeRef = (value) => typeof value === 'object' && value !== null && 'id' in value;
|
|
12
|
-
const isCustomQueryObject = (value) => !!value && typeof value === 'object' && !Array.isArray(value) &&
|
|
13
|
-
!('property' in value) && !('count' in value) && !('id' in value) &&
|
|
14
|
-
!('args' in value) && !('firstPath' in value) && !('method' in value);
|
|
15
|
-
const toStep = (step) => {
|
|
16
|
-
if (isSizeStep(step)) {
|
|
17
|
-
return {
|
|
18
|
-
kind: 'count_step',
|
|
19
|
-
path: step.count.map((s) => toPropertyStepOnly(s)),
|
|
20
|
-
label: step.label,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (isShapeRef(step)) {
|
|
24
|
-
return {
|
|
25
|
-
kind: 'type_cast_step',
|
|
26
|
-
shapeId: step.id,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
if (isPropertyQueryStep(step)) {
|
|
30
|
-
const result = {
|
|
31
|
-
kind: 'property_step',
|
|
32
|
-
propertyShapeId: step.property.id,
|
|
33
|
-
};
|
|
34
|
-
if (step.where) {
|
|
35
|
-
result.where = toWhere(step.where);
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
// CustomQueryObject step — this appears in preload and sub-select paths
|
|
40
|
-
if (isCustomQueryObject(step)) {
|
|
41
|
-
// Return a property_step placeholder; the parent path handler will pick up sub-selects
|
|
42
|
-
// This is an edge case for preload where the sub-query object is pushed into the path
|
|
43
|
-
return {
|
|
44
|
-
kind: 'property_step',
|
|
45
|
-
propertyShapeId: '__sub_query',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
throw new Error('Unsupported query step in desugar pass: ' + JSON.stringify(step));
|
|
49
|
-
};
|
|
50
|
-
const toPropertyStepOnly = (step) => {
|
|
51
|
-
if (isPropertyQueryStep(step)) {
|
|
52
|
-
return {
|
|
53
|
-
kind: 'property_step',
|
|
54
|
-
propertyShapeId: step.property.id,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
throw new Error('Expected property step in count path');
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Converts a SelectPath (QueryPath[] or CustomQueryObject) to desugared selections.
|
|
61
|
-
*/
|
|
62
|
-
const toSelections = (select) => {
|
|
63
|
-
if (Array.isArray(select)) {
|
|
64
|
-
return select.map((path) => toSelection(path));
|
|
65
|
-
}
|
|
66
|
-
// CustomQueryObject at top level
|
|
67
|
-
return [toCustomObjectSelect(select)];
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Converts a single QueryPath to a DesugaredSelection.
|
|
71
|
-
* A QueryPath can be:
|
|
72
|
-
* - (QueryStep | SubQueryPaths)[] — a flat or nested array of steps
|
|
73
|
-
* - WherePath — a where evaluation used as a selection (e.g. p.bestFriend.equals(...))
|
|
74
|
-
*/
|
|
75
|
-
const toSelection = (path) => {
|
|
76
|
-
// WherePath used as a selection (e.g. customResultEqualsBoolean)
|
|
77
|
-
if (!Array.isArray(path)) {
|
|
78
|
-
if (isWhereEvaluationPath(path) || 'firstPath' in path) {
|
|
79
|
-
return {
|
|
80
|
-
kind: 'evaluation_select',
|
|
81
|
-
where: toWhere(path),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
throw new Error('Unsupported non-array path in desugar selection pass');
|
|
85
|
-
}
|
|
86
|
-
// Check if the last element is a sub-query (nested array or custom object)
|
|
87
|
-
const lastElement = path[path.length - 1];
|
|
88
|
-
if (Array.isArray(lastElement)) {
|
|
89
|
-
// Sub-select: parent path steps + nested selections
|
|
90
|
-
const parentSteps = path.slice(0, -1).map((step) => toStep(step));
|
|
91
|
-
const nestedSelect = lastElement;
|
|
92
|
-
return {
|
|
93
|
-
kind: 'sub_select',
|
|
94
|
-
parentPath: parentSteps,
|
|
95
|
-
selections: toSubSelections(nestedSelect),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (lastElement && typeof lastElement === 'object' && isCustomQueryObject(lastElement)) {
|
|
99
|
-
// Sub-select with custom object: parent path steps + custom object selections
|
|
100
|
-
const parentSteps = path.slice(0, -1).map((step) => toStep(step));
|
|
101
|
-
return {
|
|
102
|
-
kind: 'sub_select',
|
|
103
|
-
parentPath: parentSteps,
|
|
104
|
-
selections: toCustomObjectSelect(lastElement),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
// Flat selection path
|
|
108
|
-
return {
|
|
109
|
-
kind: 'selection_path',
|
|
110
|
-
steps: path.map((step) => toStep(step)),
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Converts sub-select contents (which can be QueryPath[] or CustomQueryObject).
|
|
115
|
-
*/
|
|
116
|
-
const toSubSelections = (select) => {
|
|
117
|
-
if (Array.isArray(select)) {
|
|
118
|
-
// Array of paths — could be a single path or multiple paths
|
|
119
|
-
if (select.length === 0) {
|
|
120
|
-
return { kind: 'selection_path', steps: [] };
|
|
121
|
-
}
|
|
122
|
-
const selections = select.map((path) => toSelection(path));
|
|
123
|
-
if (selections.length === 1) {
|
|
124
|
-
return selections[0];
|
|
125
|
-
}
|
|
126
|
-
// Multiple selections in a sub-select
|
|
127
|
-
return {
|
|
128
|
-
kind: 'multi_selection',
|
|
129
|
-
selections: selections.filter((s) => s.kind === 'selection_path'),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return toCustomObjectSelect(select);
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Converts a CustomQueryObject to a DesugaredCustomObjectSelect.
|
|
136
|
-
*/
|
|
137
|
-
const toCustomObjectSelect = (obj) => {
|
|
138
|
-
const entries = Object.keys(obj).map((key) => ({
|
|
139
|
-
key,
|
|
140
|
-
value: toSelection(obj[key]),
|
|
141
|
-
}));
|
|
142
|
-
return {
|
|
143
|
-
kind: 'custom_object_select',
|
|
144
|
-
entries,
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
const toSelectionPath = (path) => {
|
|
148
|
-
if (!Array.isArray(path)) {
|
|
149
|
-
throw new Error('Unsupported non-array path in desugar selection pass');
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
kind: 'selection_path',
|
|
153
|
-
steps: path.map((step) => toStep(step)),
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
const toWhereArg = (arg) => {
|
|
157
|
-
if (typeof arg === 'string' ||
|
|
158
|
-
typeof arg === 'number' ||
|
|
159
|
-
typeof arg === 'boolean' ||
|
|
160
|
-
arg instanceof Date) {
|
|
161
|
-
return arg;
|
|
162
|
-
}
|
|
163
|
-
if (isShapeRef(arg)) {
|
|
164
|
-
return arg;
|
|
165
|
-
}
|
|
166
|
-
if (isNodeRef(arg)) {
|
|
167
|
-
return arg;
|
|
168
|
-
}
|
|
169
|
-
if (arg && typeof arg === 'object') {
|
|
170
|
-
if (isWhereEvaluationPath(arg) || 'firstPath' in arg) {
|
|
171
|
-
return toWhere(arg);
|
|
172
|
-
}
|
|
173
|
-
if ('path' in arg) {
|
|
174
|
-
const pathArg = arg;
|
|
175
|
-
return {
|
|
176
|
-
kind: 'arg_path',
|
|
177
|
-
subject: pathArg.subject,
|
|
178
|
-
path: toSelectionPath(pathArg.path),
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
throw new Error('Unsupported where argument in desugar pass');
|
|
183
|
-
};
|
|
184
|
-
const toWhereComparison = (path) => {
|
|
185
|
-
if (!isWhereEvaluationPath(path)) {
|
|
186
|
-
throw new Error('Expected where evaluation path');
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
kind: 'where_comparison',
|
|
190
|
-
operator: path.method,
|
|
191
|
-
left: toSelectionPath(path.path),
|
|
192
|
-
right: (path.args || []).map(toWhereArg),
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
const toWhere = (path) => {
|
|
196
|
-
if (path.firstPath) {
|
|
197
|
-
const grouped = path;
|
|
198
|
-
return {
|
|
199
|
-
kind: 'where_boolean',
|
|
200
|
-
first: toWhereComparison(grouped.firstPath),
|
|
201
|
-
andOr: grouped.andOr.map((token) => ({
|
|
202
|
-
and: token.and ? toWhere(token.and) : undefined,
|
|
203
|
-
or: token.or ? toWhere(token.or) : undefined,
|
|
204
|
-
})),
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
return toWhereComparison(path);
|
|
208
|
-
};
|
|
209
|
-
const toSortBy = (query) => {
|
|
210
|
-
if (!query.sortBy) {
|
|
211
|
-
return undefined;
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
direction: query.sortBy.direction,
|
|
215
|
-
paths: query.sortBy.paths.map((path) => toSelectionPath(path)),
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* Converts a RawSelectInput (DSL-level query) into a flat DesugaredSelectQuery
|
|
220
|
-
* by walking proxy-traced select/where/sortBy paths and extracting property steps.
|
|
221
|
-
*/
|
|
222
|
-
export const desugarSelectQuery = (query) => {
|
|
223
|
-
var _a, _b, _c;
|
|
224
|
-
const selections = toSelections(query.select);
|
|
225
|
-
const subjectId = query.subject && typeof query.subject === 'object' && 'id' in query.subject
|
|
226
|
-
? query.subject.id
|
|
227
|
-
: undefined;
|
|
228
|
-
return {
|
|
229
|
-
kind: 'desugared_select',
|
|
230
|
-
shapeId: ((_b = (_a = query.shape) === null || _a === void 0 ? void 0 : _a.shape) === null || _b === void 0 ? void 0 : _b.id) || ((_c = query.shape) === null || _c === void 0 ? void 0 : _c.id),
|
|
231
|
-
subjectId,
|
|
232
|
-
singleResult: query.singleResult,
|
|
233
|
-
limit: query.limit,
|
|
234
|
-
offset: query.offset,
|
|
235
|
-
selections,
|
|
236
|
-
sortBy: toSortBy(query),
|
|
237
|
-
where: query.where ? toWhere(query.where) : undefined,
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
//# sourceMappingURL=IRDesugar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IRDesugar.js","sourceRoot":"","sources":["../../../src/queries/IRDesugar.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,GAUtB,MAAM,kBAAkB,CAAC;AA6H1B,MAAM,mBAAmB,GAAG,CAAC,IAAa,EAAuD,EAAE;;IACjG,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,UAAU,IAAI,IAAI;QAC7D,CAAC,CAAC,CAAA,MAAC,IAAyB,CAAC,QAAQ,0CAAE,EAAE,CAAA,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,IAAa,EAAoB,EAAE;IACrD,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,IAAI,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAc,EAAgC,EAAE,CAClE,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC;AAE5E,MAAM,SAAS,GAAG,CAAC,KAAc,EAA+B,EAAE,CAChE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;AAE/D,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAA8B,EAAE,CACzE,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IAC7D,CAAC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,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO;QACzE,CAAC,CAAE,KAAK,CAAC,OAA8B,CAAC,EAAE;QAC1C,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,CAAA,MAAA,MAAC,KAAK,CAAC,KAAa,0CAAE,KAAK,0CAAE,EAAE,MAAI,MAAC,KAAK,CAAC,KAAa,0CAAE,EAAE,CAAA;QACpE,SAAS;QACT,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU;QACV,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;KACtD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CanonicalDesugaredSelectQuery } from './IRCanonicalize.js';
|
|
2
|
-
import { IRSelectQuery } from './IntermediateRepresentation.js';
|
|
3
|
-
/**
|
|
4
|
-
* Lowers a canonical desugared select query into the final IRSelectQuery.
|
|
5
|
-
* Introduces aliases, graph patterns (shape scans, traversals), and
|
|
6
|
-
* converts selection paths and where-clauses into IR expressions.
|
|
7
|
-
*/
|
|
8
|
-
export declare const lowerSelectQuery: (canonical: CanonicalDesugaredSelectQuery) => IRSelectQuery;
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { canonicalizeWhere } from './IRCanonicalize.js';
|
|
2
|
-
import { lowerSelectionPathExpression, projectionKeyFromPath } from './IRProjection.js';
|
|
3
|
-
import { IRAliasScope } from './IRAliasScope.js';
|
|
4
|
-
class LoweringContext {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.counter = 0;
|
|
7
|
-
this.patterns = [];
|
|
8
|
-
this.traverseMap = new Map();
|
|
9
|
-
this.rootAlias = this.nextAlias();
|
|
10
|
-
}
|
|
11
|
-
nextAlias() {
|
|
12
|
-
return `a${this.counter++}`;
|
|
13
|
-
}
|
|
14
|
-
getOrCreateTraversal(fromAlias, propertyShapeId) {
|
|
15
|
-
const key = `${fromAlias}:${propertyShapeId}`;
|
|
16
|
-
const existing = this.traverseMap.get(key);
|
|
17
|
-
if (existing)
|
|
18
|
-
return existing;
|
|
19
|
-
const toAlias = this.nextAlias();
|
|
20
|
-
this.patterns.push({
|
|
21
|
-
kind: 'traverse',
|
|
22
|
-
from: fromAlias,
|
|
23
|
-
to: toAlias,
|
|
24
|
-
property: propertyShapeId,
|
|
25
|
-
});
|
|
26
|
-
this.traverseMap.set(key, toAlias);
|
|
27
|
-
return toAlias;
|
|
28
|
-
}
|
|
29
|
-
generateAlias() {
|
|
30
|
-
return this.nextAlias();
|
|
31
|
-
}
|
|
32
|
-
getPatterns() {
|
|
33
|
-
return [...this.patterns];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const isShapeRef = (value) => !!value && typeof value === 'object' && 'id' in value && 'shape' in value;
|
|
37
|
-
const isNodeRef = (value) => typeof value === 'object' && value !== null && 'id' in value;
|
|
38
|
-
const lowerPath = (path, options) => lowerSelectionPathExpression(path, options);
|
|
39
|
-
const lowerWhereArg = (arg, ctx, options) => {
|
|
40
|
-
if (typeof arg === 'string' || typeof arg === 'number' || typeof arg === 'boolean') {
|
|
41
|
-
return { kind: 'literal_expr', value: arg };
|
|
42
|
-
}
|
|
43
|
-
if (arg instanceof Date) {
|
|
44
|
-
return { kind: 'literal_expr', value: arg.toISOString() };
|
|
45
|
-
}
|
|
46
|
-
if (arg && typeof arg === 'object') {
|
|
47
|
-
if ('kind' in arg && arg.kind === 'arg_path') {
|
|
48
|
-
const argPath = arg;
|
|
49
|
-
return lowerPath(argPath.path, options);
|
|
50
|
-
}
|
|
51
|
-
if (isShapeRef(arg)) {
|
|
52
|
-
return { kind: 'literal_expr', value: arg.id };
|
|
53
|
-
}
|
|
54
|
-
if (isNodeRef(arg)) {
|
|
55
|
-
return { kind: 'literal_expr', value: arg.id };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return { kind: 'literal_expr', value: null };
|
|
59
|
-
};
|
|
60
|
-
const lowerWhere = (where, ctx, options) => {
|
|
61
|
-
switch (where.kind) {
|
|
62
|
-
case 'where_binary': {
|
|
63
|
-
const comp = where;
|
|
64
|
-
return {
|
|
65
|
-
kind: 'binary_expr',
|
|
66
|
-
operator: comp.operator,
|
|
67
|
-
left: lowerPath(comp.left, options),
|
|
68
|
-
right: comp.right.length > 0
|
|
69
|
-
? lowerWhereArg(comp.right[0], ctx, options)
|
|
70
|
-
: { kind: 'literal_expr', value: null },
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
case 'where_logical': {
|
|
74
|
-
const logical = where;
|
|
75
|
-
return {
|
|
76
|
-
kind: 'logical_expr',
|
|
77
|
-
operator: logical.operator,
|
|
78
|
-
expressions: logical.expressions.map((expr) => lowerWhere(expr, ctx, options)),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
case 'where_exists': {
|
|
82
|
-
const exists = where;
|
|
83
|
-
const traversals = [];
|
|
84
|
-
const localTraversalMap = new Map();
|
|
85
|
-
const existsResolveTraversal = (fromAlias, propertyShapeId) => {
|
|
86
|
-
const key = `${fromAlias}:${propertyShapeId}`;
|
|
87
|
-
const existing = localTraversalMap.get(key);
|
|
88
|
-
if (existing)
|
|
89
|
-
return existing;
|
|
90
|
-
const toAlias = ctx.generateAlias();
|
|
91
|
-
traversals.push({
|
|
92
|
-
kind: 'traverse',
|
|
93
|
-
from: fromAlias,
|
|
94
|
-
to: toAlias,
|
|
95
|
-
property: propertyShapeId,
|
|
96
|
-
});
|
|
97
|
-
localTraversalMap.set(key, toAlias);
|
|
98
|
-
return toAlias;
|
|
99
|
-
};
|
|
100
|
-
let existsRootAlias = options.rootAlias;
|
|
101
|
-
for (const step of exists.path.steps) {
|
|
102
|
-
if (step.kind === 'property_step') {
|
|
103
|
-
existsRootAlias = existsResolveTraversal(existsRootAlias, step.propertyShapeId);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const filter = lowerWhere(exists.predicate, ctx, {
|
|
107
|
-
rootAlias: existsRootAlias,
|
|
108
|
-
resolveTraversal: existsResolveTraversal,
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
kind: 'exists_expr',
|
|
112
|
-
pattern: traversals.length === 1
|
|
113
|
-
? traversals[0]
|
|
114
|
-
: { kind: 'join', patterns: traversals },
|
|
115
|
-
filter,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
case 'where_not': {
|
|
119
|
-
const not = where;
|
|
120
|
-
return {
|
|
121
|
-
kind: 'not_expr',
|
|
122
|
-
expression: lowerWhere(not.expression, ctx, options),
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
default:
|
|
126
|
-
throw new Error(`Unknown canonical where kind: ${where.kind}`);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const combineWithParentPath = (parentPath, path) => ({
|
|
130
|
-
kind: 'selection_path',
|
|
131
|
-
steps: [...parentPath, ...path.steps],
|
|
132
|
-
});
|
|
133
|
-
/**
|
|
134
|
-
* Lowers a canonical desugared select query into the final IRSelectQuery.
|
|
135
|
-
* Introduces aliases, graph patterns (shape scans, traversals), and
|
|
136
|
-
* converts selection paths and where-clauses into IR expressions.
|
|
137
|
-
*/
|
|
138
|
-
export const lowerSelectQuery = (canonical) => {
|
|
139
|
-
const ctx = new LoweringContext();
|
|
140
|
-
const pathOptions = {
|
|
141
|
-
rootAlias: ctx.rootAlias,
|
|
142
|
-
resolveTraversal: (fromAlias, propertyShapeId) => ctx.getOrCreateTraversal(fromAlias, propertyShapeId),
|
|
143
|
-
};
|
|
144
|
-
const root = {
|
|
145
|
-
kind: 'shape_scan',
|
|
146
|
-
shape: canonical.shapeId || '',
|
|
147
|
-
alias: ctx.rootAlias,
|
|
148
|
-
};
|
|
149
|
-
const aliasAfterPath = (steps) => {
|
|
150
|
-
let currentAlias = pathOptions.rootAlias;
|
|
151
|
-
for (const step of steps) {
|
|
152
|
-
if (step.kind === 'property_step') {
|
|
153
|
-
currentAlias = pathOptions.resolveTraversal(currentAlias, step.propertyShapeId);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return currentAlias;
|
|
157
|
-
};
|
|
158
|
-
const collectProjectionSeeds = (selection, key, parentPath = []) => {
|
|
159
|
-
if (selection.kind === 'selection_path') {
|
|
160
|
-
return [{
|
|
161
|
-
kind: 'path',
|
|
162
|
-
path: combineWithParentPath(parentPath, selection),
|
|
163
|
-
key,
|
|
164
|
-
}];
|
|
165
|
-
}
|
|
166
|
-
if (selection.kind === 'sub_select') {
|
|
167
|
-
return collectProjectionSeeds(selection.selections, key, [...parentPath, ...selection.parentPath]);
|
|
168
|
-
}
|
|
169
|
-
if (selection.kind === 'custom_object_select') {
|
|
170
|
-
return selection.entries.flatMap((entry) => collectProjectionSeeds(entry.value, entry.key, parentPath));
|
|
171
|
-
}
|
|
172
|
-
if (selection.kind === 'multi_selection') {
|
|
173
|
-
return selection.selections.map((path) => ({
|
|
174
|
-
kind: 'path',
|
|
175
|
-
path: combineWithParentPath(parentPath, path),
|
|
176
|
-
key,
|
|
177
|
-
}));
|
|
178
|
-
}
|
|
179
|
-
if (selection.kind === 'evaluation_select') {
|
|
180
|
-
const canonicalWhere = canonicalizeWhere(selection.where);
|
|
181
|
-
return [{
|
|
182
|
-
kind: 'expression',
|
|
183
|
-
key: key || 'value',
|
|
184
|
-
expression: lowerWhere(canonicalWhere, ctx, {
|
|
185
|
-
rootAlias: aliasAfterPath(parentPath),
|
|
186
|
-
resolveTraversal: pathOptions.resolveTraversal,
|
|
187
|
-
}),
|
|
188
|
-
}];
|
|
189
|
-
}
|
|
190
|
-
return [];
|
|
191
|
-
};
|
|
192
|
-
const projectionSeeds = canonical.selections.flatMap((selection) => collectProjectionSeeds(selection));
|
|
193
|
-
const projectionScope = new IRAliasScope('projection');
|
|
194
|
-
projectionScope.registerAlias(ctx.rootAlias, 'root');
|
|
195
|
-
const projection = [];
|
|
196
|
-
const resultMapEntries = [];
|
|
197
|
-
for (const seed of projectionSeeds) {
|
|
198
|
-
const key = seed.kind === 'path'
|
|
199
|
-
? (seed.key || projectionKeyFromPath(seed.path))
|
|
200
|
-
: seed.key;
|
|
201
|
-
const alias = projectionScope.generateAlias(key).alias;
|
|
202
|
-
projection.push({
|
|
203
|
-
alias,
|
|
204
|
-
expression: seed.kind === 'path'
|
|
205
|
-
? lowerSelectionPathExpression(seed.path, pathOptions)
|
|
206
|
-
: seed.expression,
|
|
207
|
-
});
|
|
208
|
-
resultMapEntries.push({
|
|
209
|
-
key,
|
|
210
|
-
alias,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
const where = canonical.where ? lowerWhere(canonical.where, ctx, pathOptions) : undefined;
|
|
214
|
-
const orderBy = canonical.sortBy
|
|
215
|
-
? canonical.sortBy.paths.map((path) => ({
|
|
216
|
-
expression: lowerPath(path, pathOptions),
|
|
217
|
-
direction: canonical.sortBy.direction,
|
|
218
|
-
}))
|
|
219
|
-
: undefined;
|
|
220
|
-
return {
|
|
221
|
-
kind: 'select',
|
|
222
|
-
root,
|
|
223
|
-
patterns: ctx.getPatterns(),
|
|
224
|
-
projection,
|
|
225
|
-
where,
|
|
226
|
-
orderBy,
|
|
227
|
-
limit: canonical.limit,
|
|
228
|
-
offset: canonical.offset,
|
|
229
|
-
subjectId: canonical.subjectId,
|
|
230
|
-
singleResult: canonical.singleResult,
|
|
231
|
-
resultMap: resultMapEntries,
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
//# sourceMappingURL=IRLower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IRLower.js","sourceRoot":"","sources":["../../../src/queries/IRLower.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAC,iB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,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1F,MAAM,OAAO,GAAgC,SAAS,CAAC,MAAM;QAC3D,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpC,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;YACxC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS;SACtC,CAAC,CAAC;QACL,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,IAAI;QACJ,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE;QAC3B,UAAU;QACV,KAAK;QACL,OAAO;QACP,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,SAAS,EAAE,gBAAgB;KAC5B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { NodeShape } from '../shapes/SHACL.js';
|
|
2
|
-
import { NodeDescriptionValue, NodeReferenceValue } from './QueryFactory.js';
|
|
3
|
-
import { IRCreateMutation, IRDeleteMutation, IRUpdateMutation } from './IntermediateRepresentation.js';
|
|
4
|
-
type CreateMutationInput = {
|
|
5
|
-
shape: NodeShape;
|
|
6
|
-
description: NodeDescriptionValue;
|
|
7
|
-
};
|
|
8
|
-
type UpdateMutationInput = {
|
|
9
|
-
id: string;
|
|
10
|
-
shape: NodeShape;
|
|
11
|
-
updates: NodeDescriptionValue;
|
|
12
|
-
};
|
|
13
|
-
type DeleteMutationInput = {
|
|
14
|
-
shape: NodeShape;
|
|
15
|
-
ids: NodeReferenceValue[];
|
|
16
|
-
};
|
|
17
|
-
/** Builds an IRCreateMutation from a create factory's internal description. */
|
|
18
|
-
export declare const buildCanonicalCreateMutationIR: (query: CreateMutationInput) => IRCreateMutation;
|
|
19
|
-
/** Builds an IRUpdateMutation from an update factory's internal description. */
|
|
20
|
-
export declare const buildCanonicalUpdateMutationIR: (query: UpdateMutationInput) => IRUpdateMutation;
|
|
21
|
-
/** Builds an IRDeleteMutation from a delete factory's internal description. */
|
|
22
|
-
export declare const buildCanonicalDeleteMutationIR: (query: DeleteMutationInput) => IRDeleteMutation;
|
|
23
|
-
export {};
|