Skip to content

Commit 968fbcb

Browse files
committed
Fix IntelliJ warnings and ESLint errors
- Use barrel import for queryGenerator classes - Rename KNOWN_ARRAY_FIELDS to knownArrayFields for naming convention - Fix prefer-nullish-coalescing in unionAllHasForEach - Remove unused buildApplyWhereClauses method All tests continue to pass (110 passing, 8 experimental failing as expected).
1 parent f69257a commit 968fbcb

File tree

4 files changed

+10
-31
lines changed

4 files changed

+10
-31
lines changed

src/queryGenerator.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import {
1111
ViewDefinitionConstant,
1212
ViewDefinitionSelect,
1313
} from "./types.js";
14-
import { PathParser } from "./queryGenerator/PathParser.js";
1514
import {
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

2424
export interface QueryGeneratorOptions {
2525
tableName?: string;

src/queryGenerator/ForEachProcessor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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
}

src/queryGenerator/PathParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface SegmentIndexingResult {
3232
* Handles parsing and interpretation of FHIRPath expressions.
3333
*/
3434
export 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
}

src/queryGenerator/WhereClauseBuilder.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)