sof-mssql 1.0.1 → 2.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/README.md +175 -35
- package/dist/fhirpath/transpiler.d.ts +40 -2
- package/dist/fhirpath/transpiler.d.ts.map +1 -1
- package/dist/fhirpath/transpiler.js +85 -15
- package/dist/fhirpath/transpiler.js.map +1 -1
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +3 -0
- package/dist/load.js.map +1 -1
- package/dist/loader/connection.d.ts.map +1 -1
- package/dist/loader/connection.js +6 -0
- package/dist/loader/connection.js.map +1 -1
- package/dist/loader/tables.d.ts.map +1 -1
- package/dist/loader/tables.js +7 -0
- package/dist/loader/tables.js.map +1 -1
- package/dist/loader/types.d.ts +2 -0
- package/dist/loader/types.d.ts.map +1 -1
- package/dist/parser.d.ts +22 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +101 -10
- package/dist/parser.js.map +1 -1
- package/dist/queryGenerator/RepeatProcessor.d.ts +177 -0
- package/dist/queryGenerator/RepeatProcessor.d.ts.map +1 -0
- package/dist/queryGenerator/RepeatProcessor.js +336 -0
- package/dist/queryGenerator/RepeatProcessor.js.map +1 -0
- package/dist/queryGenerator/SelectClauseBuilder.d.ts +45 -0
- package/dist/queryGenerator/SelectClauseBuilder.d.ts.map +1 -1
- package/dist/queryGenerator/SelectClauseBuilder.js +150 -0
- package/dist/queryGenerator/SelectClauseBuilder.js.map +1 -1
- package/dist/queryGenerator/WhereClauseBuilder.d.ts +1 -0
- package/dist/queryGenerator/WhereClauseBuilder.d.ts.map +1 -1
- package/dist/queryGenerator/WhereClauseBuilder.js +6 -2
- package/dist/queryGenerator/WhereClauseBuilder.js.map +1 -1
- package/dist/queryGenerator/index.d.ts +1 -0
- package/dist/queryGenerator/index.d.ts.map +1 -1
- package/dist/queryGenerator/index.js +3 -1
- package/dist/queryGenerator/index.js.map +1 -1
- package/dist/queryGenerator.d.ts +61 -1
- package/dist/queryGenerator.d.ts.map +1 -1
- package/dist/queryGenerator.js +176 -13
- package/dist/queryGenerator.js.map +1 -1
- package/dist/tests/utils/generator.js +11 -11
- package/dist/tests/utils/generator.js.map +1 -1
- package/dist/tests/utils/sqlOnFhir.d.ts.map +1 -1
- package/dist/tests/utils/sqlOnFhir.js +39 -4
- package/dist/tests/utils/sqlOnFhir.js.map +1 -1
- package/dist/tests/utils/testContext.d.ts +3 -6
- package/dist/tests/utils/testContext.d.ts.map +1 -1
- package/dist/tests/utils/testContext.js +5 -9
- package/dist/tests/utils/testContext.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts +66 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +449 -0
- package/dist/validation.js.map +1 -0
- package/package.json +3 -2
package/dist/parser.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export declare class ViewDefinitionParser {
|
|
|
15
15
|
* Validate and narrow a ViewDefinition structure using type predicate.
|
|
16
16
|
*/
|
|
17
17
|
private static isValidViewDefinition;
|
|
18
|
+
/**
|
|
19
|
+
* Validate constant names match SQL on FHIR specification.
|
|
20
|
+
*/
|
|
21
|
+
private static validateConstants;
|
|
18
22
|
/**
|
|
19
23
|
* Validate select element using type predicate.
|
|
20
24
|
*/
|
|
@@ -24,9 +28,18 @@ export declare class ViewDefinitionParser {
|
|
|
24
28
|
*/
|
|
25
29
|
private static validateSelectStructure;
|
|
26
30
|
/**
|
|
27
|
-
* Validate forEach and
|
|
31
|
+
* Validate forEach, forEachOrNull, and repeat expressions.
|
|
32
|
+
* Ensures mutual exclusivity between these iteration directives.
|
|
28
33
|
*/
|
|
29
34
|
private static validateSelectExpressions;
|
|
35
|
+
/**
|
|
36
|
+
* Validate that repeat is an array of non-empty strings.
|
|
37
|
+
*/
|
|
38
|
+
private static validateRepeatExpression;
|
|
39
|
+
/**
|
|
40
|
+
* Enforce mutual exclusivity: only one of forEach, forEachOrNull, or repeat.
|
|
41
|
+
*/
|
|
42
|
+
private static validateIterationDirectiveMutualExclusivity;
|
|
30
43
|
/**
|
|
31
44
|
* Validate columns in a select element.
|
|
32
45
|
*/
|
|
@@ -43,6 +56,14 @@ export declare class ViewDefinitionParser {
|
|
|
43
56
|
* Validate column using type predicate.
|
|
44
57
|
*/
|
|
45
58
|
private static isValidColumn;
|
|
59
|
+
/**
|
|
60
|
+
* Validate column tag structure.
|
|
61
|
+
*/
|
|
62
|
+
private static validateColumnTags;
|
|
63
|
+
/**
|
|
64
|
+
* Validate a single tag object.
|
|
65
|
+
*/
|
|
66
|
+
private static validateSingleTag;
|
|
46
67
|
/**
|
|
47
68
|
* Validate collection property constraints.
|
|
48
69
|
*/
|
package/dist/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,SAAS,EAIT,cAAc,EAGf,MAAM,YAAY,CAAC;AAEpB,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc;IAWjE;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,SAAS,EAIT,cAAc,EAGf,MAAM,YAAY,CAAC;AAEpB,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc;IAWjE;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAqCpC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqBhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAa5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAexC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAgBvC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,2CAA2C;IAkB1D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAWpC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAWpC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAY/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IA6B5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAcjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA0BhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAiC5C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IA0CtC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;CA+BxC"}
|
package/dist/parser.js
CHANGED
|
@@ -30,12 +30,12 @@ class ViewDefinitionParser {
|
|
|
30
30
|
*/
|
|
31
31
|
static isValidViewDefinition(data) {
|
|
32
32
|
if (!data.resource || typeof data.resource !== "string") {
|
|
33
|
-
throw new
|
|
33
|
+
throw new TypeError("ViewDefinition must specify a resource type.");
|
|
34
34
|
}
|
|
35
35
|
if (!data.select ||
|
|
36
36
|
!Array.isArray(data.select) ||
|
|
37
37
|
data.select.length === 0) {
|
|
38
|
-
throw new
|
|
38
|
+
throw new TypeError("ViewDefinition must have at least one select element.");
|
|
39
39
|
}
|
|
40
40
|
// Status is optional for test cases, but recommended for production use
|
|
41
41
|
// The SQL-on-FHIR spec requires status, but test cases may omit it
|
|
@@ -47,8 +47,30 @@ class ViewDefinitionParser {
|
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
// Validate constants if present
|
|
51
|
+
if (data.constant) {
|
|
52
|
+
this.validateConstants(data.constant);
|
|
53
|
+
}
|
|
50
54
|
return true;
|
|
51
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Validate constant names match SQL on FHIR specification.
|
|
58
|
+
*/
|
|
59
|
+
static validateConstants(constants) {
|
|
60
|
+
for (const constant of constants) {
|
|
61
|
+
if (!constant ||
|
|
62
|
+
typeof constant !== "object" ||
|
|
63
|
+
!("name" in constant) ||
|
|
64
|
+
typeof constant.name !== "string") {
|
|
65
|
+
throw new TypeError("Constant must have a valid name.");
|
|
66
|
+
}
|
|
67
|
+
// Validate constant name matches SQL on FHIR specification pattern
|
|
68
|
+
// Pattern: must start with a letter, followed by letters, digits, or underscores
|
|
69
|
+
if (!/^[A-Za-z]\w*$/.test(constant.name)) {
|
|
70
|
+
throw new Error(`Constant name '${constant.name}' does not match SQL on FHIR specification. Must start with a letter, followed by letters, digits, or underscores.`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
52
74
|
/**
|
|
53
75
|
* Validate select element using type predicate.
|
|
54
76
|
*/
|
|
@@ -68,14 +90,48 @@ class ViewDefinitionParser {
|
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
/**
|
|
71
|
-
* Validate forEach and
|
|
93
|
+
* Validate forEach, forEachOrNull, and repeat expressions.
|
|
94
|
+
* Ensures mutual exclusivity between these iteration directives.
|
|
72
95
|
*/
|
|
73
96
|
static validateSelectExpressions(select) {
|
|
74
97
|
if (select.forEach && typeof select.forEach !== "string") {
|
|
75
|
-
throw new
|
|
98
|
+
throw new TypeError("forEach must be a string FHIRPath expression.");
|
|
76
99
|
}
|
|
77
100
|
if (select.forEachOrNull && typeof select.forEachOrNull !== "string") {
|
|
78
|
-
throw new
|
|
101
|
+
throw new TypeError("forEachOrNull must be a string FHIRPath expression.");
|
|
102
|
+
}
|
|
103
|
+
this.validateRepeatExpression(select.repeat);
|
|
104
|
+
this.validateIterationDirectiveMutualExclusivity(select);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Validate that repeat is an array of non-empty strings.
|
|
108
|
+
*/
|
|
109
|
+
static validateRepeatExpression(repeat) {
|
|
110
|
+
if (repeat === undefined) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!Array.isArray(repeat)) {
|
|
114
|
+
throw new TypeError("repeat must be an array of FHIRPath expressions.");
|
|
115
|
+
}
|
|
116
|
+
for (const path of repeat) {
|
|
117
|
+
if (typeof path !== "string" || path.trim().length === 0) {
|
|
118
|
+
throw new TypeError("Each repeat path must be a non-empty string FHIRPath expression.");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Enforce mutual exclusivity: only one of forEach, forEachOrNull, or repeat.
|
|
124
|
+
*/
|
|
125
|
+
static validateIterationDirectiveMutualExclusivity(select) {
|
|
126
|
+
const directiveCount = [
|
|
127
|
+
select.forEach,
|
|
128
|
+
select.forEachOrNull,
|
|
129
|
+
select.repeat,
|
|
130
|
+
].filter((d) => d !== undefined).length;
|
|
131
|
+
if (directiveCount > 1) {
|
|
132
|
+
throw new Error("A select element cannot have multiple iteration directives " +
|
|
133
|
+
"(forEach, forEachOrNull, repeat) at the same level. " +
|
|
134
|
+
"Use nested select to combine them.");
|
|
79
135
|
}
|
|
80
136
|
}
|
|
81
137
|
/**
|
|
@@ -123,19 +179,54 @@ class ViewDefinitionParser {
|
|
|
123
179
|
*/
|
|
124
180
|
static isValidColumn(column, selectContext) {
|
|
125
181
|
if (!column.name || typeof column.name !== "string") {
|
|
126
|
-
throw new
|
|
182
|
+
throw new TypeError("Column must have a valid name.");
|
|
127
183
|
}
|
|
128
184
|
if (!column.path || typeof column.path !== "string") {
|
|
129
|
-
throw new
|
|
185
|
+
throw new TypeError("Column must have a valid FHIRPath expression.");
|
|
130
186
|
}
|
|
131
|
-
// Validate column name
|
|
132
|
-
|
|
133
|
-
|
|
187
|
+
// Validate column name matches SQL on FHIR specification pattern
|
|
188
|
+
// Pattern: must start with a letter, followed by letters, digits, or underscores
|
|
189
|
+
if (!/^[A-Za-z]\w*$/.test(column.name)) {
|
|
190
|
+
throw new Error(`Column name '${column.name}' does not match SQL on FHIR specification. Must start with a letter, followed by letters, digits, or underscores.`);
|
|
134
191
|
}
|
|
135
192
|
// Validate collection constraints
|
|
136
193
|
this.validateCollectionConstraints(column, selectContext);
|
|
194
|
+
// Validate tag structure if present
|
|
195
|
+
this.validateColumnTags(column);
|
|
137
196
|
return true;
|
|
138
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Validate column tag structure.
|
|
200
|
+
*/
|
|
201
|
+
static validateColumnTags(column) {
|
|
202
|
+
if (column.tag === undefined) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (!Array.isArray(column.tag)) {
|
|
206
|
+
throw new TypeError(`Column '${column.name}' tag must be an array.`);
|
|
207
|
+
}
|
|
208
|
+
for (const tag of column.tag) {
|
|
209
|
+
this.validateSingleTag(column.name, tag);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Validate a single tag object.
|
|
214
|
+
*/
|
|
215
|
+
static validateSingleTag(columnName, tag) {
|
|
216
|
+
if (typeof tag !== "object" || tag === null) {
|
|
217
|
+
throw new TypeError(`Column '${columnName}' tag entry must be an object.`);
|
|
218
|
+
}
|
|
219
|
+
if (!("name" in tag) ||
|
|
220
|
+
typeof tag.name !== "string" ||
|
|
221
|
+
tag.name.trim().length === 0) {
|
|
222
|
+
throw new TypeError(`Column '${columnName}' tag must have a non-empty 'name' string.`);
|
|
223
|
+
}
|
|
224
|
+
if (!("value" in tag) ||
|
|
225
|
+
typeof tag.value !== "string" ||
|
|
226
|
+
tag.value.trim().length === 0) {
|
|
227
|
+
throw new TypeError(`Column '${columnName}' tag must have a non-empty 'value' string.`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
139
230
|
/**
|
|
140
231
|
* Validate collection property constraints.
|
|
141
232
|
*/
|
package/dist/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAYH,MAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAqB;QAC9C,MAAM,IAAI,GACR,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAErD,IAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAqB;QACzC,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEhE,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,IAAiB,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,qBAAqB,CAClC,IAA+B;QAE/B,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACxD,MAAM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,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/ZD,oDA+ZC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processes repeat operations and generates recursive CTEs.
|
|
3
|
+
*
|
|
4
|
+
* The repeat directive recursively traverses a tree structure by following
|
|
5
|
+
* one or more FHIRPath expressions at each level. This is implemented using
|
|
6
|
+
* SQL Server recursive Common Table Expressions (CTEs).
|
|
7
|
+
*
|
|
8
|
+
* @author John Grimes
|
|
9
|
+
*/
|
|
10
|
+
import type { TranspilerContext } from "../fhirpath/transpiler.js";
|
|
11
|
+
import { ViewDefinitionSelect } from "../types.js";
|
|
12
|
+
import { SelectCombination } from "./SelectCombinationExpander.js";
|
|
13
|
+
/**
|
|
14
|
+
* Counter state for generating unique repeat CTE aliases.
|
|
15
|
+
*/
|
|
16
|
+
interface CounterState {
|
|
17
|
+
value: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Context specific to a repeat operation.
|
|
21
|
+
*/
|
|
22
|
+
export interface RepeatContext {
|
|
23
|
+
/** Unique alias for the CTE (e.g., "repeat_0"). */
|
|
24
|
+
cteAlias: string;
|
|
25
|
+
/** FHIRPath expressions to follow recursively. */
|
|
26
|
+
paths: string[];
|
|
27
|
+
/** JSON source expression for the anchor member. */
|
|
28
|
+
sourceExpression: string;
|
|
29
|
+
/** The transpiler context for columns within this repeat. */
|
|
30
|
+
transpilerContext: TranspilerContext;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of building repeat context map.
|
|
34
|
+
*/
|
|
35
|
+
export interface RepeatContextMapResult {
|
|
36
|
+
repeatContextMap: Map<ViewDefinitionSelect, RepeatContext>;
|
|
37
|
+
topLevelRepeat: ViewDefinitionSelect[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Handles all repeat-related processing and recursive CTE generation.
|
|
41
|
+
*
|
|
42
|
+
* The repeat directive works similarly to forEach but traverses tree structures
|
|
43
|
+
* of arbitrary depth. For example, `repeat: ["item"]` follows the `item` array
|
|
44
|
+
* at each level until no more items exist.
|
|
45
|
+
*
|
|
46
|
+
* Multiple paths can be specified (e.g., `["item", "answer.item"]`) to follow
|
|
47
|
+
* different traversal patterns at each level, with results unioned together.
|
|
48
|
+
*/
|
|
49
|
+
export declare class RepeatProcessor {
|
|
50
|
+
/**
|
|
51
|
+
* Check if a specific combination has repeat operations.
|
|
52
|
+
*
|
|
53
|
+
* @param combination - The select combination to check.
|
|
54
|
+
* @returns True if any select in the combination has repeat.
|
|
55
|
+
*/
|
|
56
|
+
combinationHasRepeat(combination: SelectCombination): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a single select has repeat operations (including nested).
|
|
59
|
+
*
|
|
60
|
+
* @param select - The select element to check.
|
|
61
|
+
* @returns True if the select or any nested select has repeat.
|
|
62
|
+
*/
|
|
63
|
+
selectHasRepeat(select: ViewDefinitionSelect): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Check if any select in the array has repeat operations.
|
|
66
|
+
*/
|
|
67
|
+
private hasRepeatInSelects;
|
|
68
|
+
/**
|
|
69
|
+
* Check if any unionAll option has repeat operations.
|
|
70
|
+
*/
|
|
71
|
+
private unionAllHasRepeat;
|
|
72
|
+
/**
|
|
73
|
+
* Check if a select is a repeat select.
|
|
74
|
+
*/
|
|
75
|
+
isRepeatSelect(select: ViewDefinitionSelect): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Build the repeat context map by generating contexts for all repeat operations.
|
|
78
|
+
*
|
|
79
|
+
* @param selects - The top-level select elements.
|
|
80
|
+
* @param context - The base transpiler context.
|
|
81
|
+
* @param combination - Optional combination for unionAll handling.
|
|
82
|
+
* @param externalCounter - Optional external counter for shared CTE aliases across combinations.
|
|
83
|
+
* @returns Map of repeat selects to their contexts and list of top-level repeats.
|
|
84
|
+
*/
|
|
85
|
+
buildRepeatContextMap(selects: ViewDefinitionSelect[], context: TranspilerContext, combination?: SelectCombination, externalCounter?: CounterState): RepeatContextMapResult;
|
|
86
|
+
/**
|
|
87
|
+
* Collect all repeat selects that should be treated as top-level.
|
|
88
|
+
*/
|
|
89
|
+
private collectTopLevelRepeat;
|
|
90
|
+
/**
|
|
91
|
+
* Process a select for repeat, handling both direct repeat and nested selects.
|
|
92
|
+
*/
|
|
93
|
+
private processSelectRepeat;
|
|
94
|
+
/**
|
|
95
|
+
* Process a select with a unionAll choice from a combination.
|
|
96
|
+
*/
|
|
97
|
+
private processUnionAllChoice;
|
|
98
|
+
/**
|
|
99
|
+
* Add repeat selects from a select array to the topLevelRepeat list.
|
|
100
|
+
*/
|
|
101
|
+
private addRepeatFromSelectArray;
|
|
102
|
+
/**
|
|
103
|
+
* Generate repeat context for a single repeat select.
|
|
104
|
+
*/
|
|
105
|
+
private generateRepeatContext;
|
|
106
|
+
/**
|
|
107
|
+
* Generate CTE definitions as an array for repeat operations.
|
|
108
|
+
*
|
|
109
|
+
* This method returns the CTE definitions without the WITH keyword,
|
|
110
|
+
* allowing them to be consolidated when multiple unionAll branches
|
|
111
|
+
* each have their own repeat CTEs.
|
|
112
|
+
*
|
|
113
|
+
* @param repeatContextMap - Map of repeat selects to their contexts.
|
|
114
|
+
* @param topLevelRepeat - List of top-level repeat selects.
|
|
115
|
+
* @param resourceAlias - The alias for the resource table (e.g., "r").
|
|
116
|
+
* @param resourceType - The FHIR resource type.
|
|
117
|
+
* @param testId - Optional test ID for filtering.
|
|
118
|
+
* @param tableName - The fully qualified table name (e.g., "[dbo].[fhir_resources]").
|
|
119
|
+
* @returns Array of CTE definition strings (without WITH keyword).
|
|
120
|
+
*/
|
|
121
|
+
buildRepeatCteDefinitions(repeatContextMap: Map<ViewDefinitionSelect, RepeatContext>, topLevelRepeat: ViewDefinitionSelect[], resourceAlias: string, resourceType: string, testId?: string, tableName?: string): string[];
|
|
122
|
+
/**
|
|
123
|
+
* Generate a single recursive CTE definition.
|
|
124
|
+
*
|
|
125
|
+
* The CTE has the following structure:
|
|
126
|
+
* - Anchor member: Selects initial items using the FIRST path from the root.
|
|
127
|
+
* Only the first path is used for the anchor because subsequent paths
|
|
128
|
+
* (like `answer.item`) represent traversal patterns that should only be
|
|
129
|
+
* followed during recursion, not at the root level.
|
|
130
|
+
* - Recursive member: For each path in repeat, follows that path from the
|
|
131
|
+
* current level and unions all results.
|
|
132
|
+
*
|
|
133
|
+
* The CTE columns are:
|
|
134
|
+
* - resource_id: Links back to the source resource.
|
|
135
|
+
* - item_json: The JSON content of the current item (used for column extraction).
|
|
136
|
+
* - depth: Recursion depth (used to prevent infinite loops).
|
|
137
|
+
*/
|
|
138
|
+
private generateSingleCte;
|
|
139
|
+
/**
|
|
140
|
+
* Build a recursive member for a single path.
|
|
141
|
+
*
|
|
142
|
+
* Multi-segment paths like "answer.item" require nested CROSS APPLY clauses
|
|
143
|
+
* to traverse through each array. For example, "answer.item" means:
|
|
144
|
+
* 1. Iterate over the `answer` array
|
|
145
|
+
* 2. For each answer, iterate over the `item` array within it
|
|
146
|
+
*
|
|
147
|
+
* @param path - The FHIRPath expression (e.g., "item" or "answer.item").
|
|
148
|
+
* @param cteAlias - The alias of the recursive CTE.
|
|
149
|
+
* @param index - Index of this path for alias generation.
|
|
150
|
+
* @returns SQL fragment for the recursive member.
|
|
151
|
+
*/
|
|
152
|
+
private buildRecursiveMember;
|
|
153
|
+
/**
|
|
154
|
+
* Build a JSON path from a FHIRPath expression.
|
|
155
|
+
* Handles simple paths and dot-separated paths like "answer.item".
|
|
156
|
+
*/
|
|
157
|
+
private buildJsonPath;
|
|
158
|
+
/**
|
|
159
|
+
* Build the test ID condition for filtering test data.
|
|
160
|
+
*
|
|
161
|
+
* @param resourceAlias - The alias for the resource table.
|
|
162
|
+
* @param testId - Optional test ID for filtering.
|
|
163
|
+
* @returns SQL condition string or empty string if no testId.
|
|
164
|
+
*/
|
|
165
|
+
private buildTestIdCondition;
|
|
166
|
+
/**
|
|
167
|
+
* Build CROSS APPLY clause to join CTE results to the main query.
|
|
168
|
+
*
|
|
169
|
+
* @param repeatContextMap - Map of repeat selects to their contexts.
|
|
170
|
+
* @param topLevelRepeat - List of top-level repeat selects.
|
|
171
|
+
* @param resourceAlias - The alias for the resource table.
|
|
172
|
+
* @returns The CROSS APPLY clause(s) for joining CTE results.
|
|
173
|
+
*/
|
|
174
|
+
buildRepeatApplyClauses(repeatContextMap: Map<ViewDefinitionSelect, RepeatContext>, topLevelRepeat: ViewDefinitionSelect[], resourceAlias: string): string;
|
|
175
|
+
}
|
|
176
|
+
export {};
|
|
177
|
+
//# sourceMappingURL=RepeatProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeatProcessor.d.ts","sourceRoot":"","sources":["../../src/queryGenerator/RepeatProcessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;GAEG;AACH,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,GAAG,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC;IAC3D,cAAc,EAAE,oBAAoB,EAAE,CAAC;CACxC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