File tree Expand file tree Collapse file tree 4 files changed +10
-31
lines changed
Expand file tree Collapse file tree 4 files changed +10
-31
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ import {
1111 ViewDefinitionConstant ,
1212 ViewDefinitionSelect ,
1313} from "./types.js" ;
14- import { PathParser } from "./queryGenerator/PathParser.js" ;
1514import {
15+ PathParser ,
1616 SelectCombination ,
1717 SelectCombinationExpander ,
18- } from "./queryGenerator/SelectCombinationExpander.js" ;
19- import { ForEachProcessor } from "./queryGenerator/ForEachProcessor.js" ;
20- import { SelectClauseBuilder } from "./queryGenerator/SelectClauseBuilder.js" ;
21- import { WhereClauseBuilder } from "./queryGenerator/WhereClauseBuilder.js" ;
22- import { ColumnExpressionGenerator } from "./queryGenerator/ColumnExpressionGenerator .js" ;
18+ ForEachProcessor ,
19+ SelectClauseBuilder ,
20+ WhereClauseBuilder ,
21+ ColumnExpressionGenerator ,
22+ } from "./queryGenerator/index .js" ;
2323
2424export interface QueryGeneratorOptions {
2525 tableName ?: string ;
Original file line number Diff line number Diff line change @@ -83,8 +83,7 @@ export class ForEachProcessor {
8383 private unionAllHasForEach ( unionAllOptions : ViewDefinitionSelect [ ] ) : boolean {
8484 return unionAllOptions . some (
8585 ( unionOption ) =>
86- unionOption . forEach ||
87- unionOption . forEachOrNull ||
86+ ( unionOption . forEach ?? unionOption . forEachOrNull ) !== undefined ||
8887 ( unionOption . select && this . hasForEachInSelects ( unionOption . select ) ) ,
8988 ) ;
9089 }
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export interface SegmentIndexingResult {
3232 * Handles parsing and interpretation of FHIRPath expressions.
3333 */
3434export class PathParser {
35- private static readonly KNOWN_ARRAY_FIELDS = [
35+ private static readonly knownArrayFields = [
3636 "name" ,
3737 "telecom" ,
3838 "address" ,
@@ -106,7 +106,7 @@ export class PathParser {
106106 const indexedPath = segments
107107 . map ( ( seg ) => {
108108 const cleanSeg = seg . replace ( / \[ .* ] / , "" ) ;
109- if ( PathParser . KNOWN_ARRAY_FIELDS . includes ( cleanSeg ) ) {
109+ if ( PathParser . knownArrayFields . includes ( cleanSeg ) ) {
110110 return `${ cleanSeg } [${ arrayIndex } ]` ;
111111 }
112112 return cleanSeg ;
@@ -148,7 +148,7 @@ export class PathParser {
148148 const segment = segments [ i ] ;
149149 const cleanSegment = segment . replace ( / \[ .* ] / , "" ) ;
150150
151- if ( PathParser . KNOWN_ARRAY_FIELDS . includes ( cleanSegment ) ) {
151+ if ( PathParser . knownArrayFields . includes ( cleanSegment ) ) {
152152 arraySegments . push ( segments . slice ( 0 , i + 1 ) . join ( "." ) ) ;
153153 }
154154 }
Original file line number Diff line number Diff line change @@ -84,24 +84,4 @@ export class WhereClauseBuilder {
8484
8585 return `(${ conditions . join ( ") AND (" ) } )` ;
8686 }
87-
88- /**
89- * Build WHERE clause conditions for array filtering in APPLY operations.
90- */
91- buildApplyWhereClauses (
92- arrayIndex : number | null | undefined ,
93- whereCondition : string | null | undefined ,
94- ) : string [ ] {
95- const whereClauses : string [ ] = [ ] ;
96-
97- if ( arrayIndex !== null && arrayIndex !== undefined ) {
98- whereClauses . push ( `[key] = '${ arrayIndex } '` ) ;
99- }
100-
101- if ( whereCondition !== null && whereCondition !== undefined ) {
102- whereClauses . push ( whereCondition ) ;
103- }
104-
105- return whereClauses ;
106- }
10787}
You can’t perform that action at this time.
0 commit comments