rawsql-ts 0.26.1 → 0.28.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 (34) hide show
  1. package/dist/esm/index.d.ts +1 -0
  2. package/dist/esm/index.js.map +1 -1
  3. package/dist/esm/index.min.js +1 -1
  4. package/dist/esm/index.min.js.map +3 -3
  5. package/dist/esm/transformers/ConditionOptimization.d.ts +5 -0
  6. package/dist/esm/transformers/ConditionOptimization.js +125 -67
  7. package/dist/esm/transformers/ConditionOptimization.js.map +1 -1
  8. package/dist/esm/transformers/ParameterConditionPlacementOptimizer.d.ts +26 -7
  9. package/dist/esm/transformers/ParameterConditionPlacementOptimizer.js +408 -138
  10. package/dist/esm/transformers/ParameterConditionPlacementOptimizer.js.map +1 -1
  11. package/dist/esm/transformers/SqlComponentFormatter.d.ts +9 -1
  12. package/dist/esm/transformers/SqlComponentFormatter.js +10 -1
  13. package/dist/esm/transformers/SqlComponentFormatter.js.map +1 -1
  14. package/dist/esm/transformers/StaticPredicatePlacementOptimizer.d.ts +22 -4
  15. package/dist/esm/transformers/StaticPredicatePlacementOptimizer.js +332 -95
  16. package/dist/esm/transformers/StaticPredicatePlacementOptimizer.js.map +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.min.js +1 -1
  19. package/dist/index.min.js.map +3 -3
  20. package/dist/src/index.d.ts +1 -0
  21. package/dist/src/transformers/ConditionOptimization.d.ts +5 -0
  22. package/dist/src/transformers/ParameterConditionPlacementOptimizer.d.ts +26 -7
  23. package/dist/src/transformers/SqlComponentFormatter.d.ts +9 -1
  24. package/dist/src/transformers/StaticPredicatePlacementOptimizer.d.ts +22 -4
  25. package/dist/transformers/ConditionOptimization.js +135 -62
  26. package/dist/transformers/ConditionOptimization.js.map +1 -1
  27. package/dist/transformers/ParameterConditionPlacementOptimizer.js +406 -136
  28. package/dist/transformers/ParameterConditionPlacementOptimizer.js.map +1 -1
  29. package/dist/transformers/SqlComponentFormatter.js +12 -2
  30. package/dist/transformers/SqlComponentFormatter.js.map +1 -1
  31. package/dist/transformers/StaticPredicatePlacementOptimizer.js +330 -93
  32. package/dist/transformers/StaticPredicatePlacementOptimizer.js.map +1 -1
  33. package/dist/tsconfig.browser.tsbuildinfo +1 -1
  34. package/package.json +1 -1
@@ -77,6 +77,7 @@ export * from './transformers/FilterableItemCollector';
77
77
  export { FixtureCteBuilder, FixtureTableDefinition, FixtureColumnDefinition } from './transformers/FixtureCteBuilder';
78
78
  export * from './transformers/DynamicQueryBuilder';
79
79
  export * from './transformers/SSSQLFilterBuilder';
80
+ export type { FormattableSqlComponent, SqlComponentFormatter, SqlComponentFormatOptions } from './transformers/SqlComponentFormatter';
80
81
  export * from './transformers/ConditionOptimization';
81
82
  export * from './transformers/ParameterConditionPlacementOptimizer';
82
83
  export * from './transformers/StaticPredicatePlacementOptimizer';
@@ -19,6 +19,7 @@ export interface ConditionOptimizationPhaseSummary {
19
19
  warningCount: number;
20
20
  errorCount: number;
21
21
  }
22
+ export type ConditionOptimizationSkipDisposition = "blocked" | "unchanged" | "ignored";
22
23
  export interface SssqlOptionalConditionApplied {
23
24
  phaseKind: "sssql_optional_condition";
24
25
  kind: "prune_optional_branch" | "refresh_optional_branch";
@@ -34,6 +35,7 @@ export interface SssqlOptionalConditionSkipped {
34
35
  parameterName: string;
35
36
  code: string;
36
37
  reason: string;
38
+ skipDisposition: ConditionOptimizationSkipDisposition;
37
39
  }
38
40
  export type ConditionOptimizationApplied = SssqlOptionalConditionApplied | (ParameterConditionMove & {
39
41
  phaseKind: "parameter_condition_placement";
@@ -42,8 +44,10 @@ export type ConditionOptimizationApplied = SssqlOptionalConditionApplied | (Para
42
44
  });
43
45
  export type ConditionOptimizationSkipped = SssqlOptionalConditionSkipped | (ParameterConditionSkipped & {
44
46
  phaseKind: "parameter_condition_placement";
47
+ skipDisposition: ConditionOptimizationSkipDisposition;
45
48
  }) | (StaticPredicateSkipped & {
46
49
  phaseKind: "static_predicate_placement";
50
+ skipDisposition: ConditionOptimizationSkipDisposition;
47
51
  });
48
52
  export type ConditionOptimizationWarning = (ParameterConditionOptimizationWarning & {
49
53
  phaseKind: ConditionOptimizationPhaseKind;
@@ -64,6 +68,7 @@ export interface ConditionOptimizationSafety {
64
68
  export interface ConditionOptimizationResult {
65
69
  ok: boolean;
66
70
  sql: string;
71
+ query: SelectQuery | null;
67
72
  phases: readonly ConditionOptimizationPhaseSummary[];
68
73
  applied: readonly ConditionOptimizationApplied[];
69
74
  skipped: readonly ConditionOptimizationSkipped[];
@@ -1,15 +1,22 @@
1
1
  import { SelectQuery, SimpleSelectQuery } from "../models/SelectQuery";
2
+ import { SqlComponentFormatOptions } from "./SqlComponentFormatter";
2
3
  export type ParameterConditionOptimizationInput = string | SelectQuery | SimpleSelectQuery;
3
4
  /**
4
5
  * First-phase safe-only placement for ordinary parameter predicates.
5
6
  *
6
7
  * The optimizer intentionally handles only root top-level AND predicates and one
7
8
  * CTE/derived-table hop where the destination output is a direct column reference.
8
- * Unsupported boundaries such as OR, UNION, DISTINCT, GROUP BY, WINDOW, OUTER
9
- * JOIN, expression outputs, and function predicates are reported as skipped.
9
+ * Unsupported boundaries such as OR, DISTINCT ON, WINDOW, OUTER JOIN,
10
+ * expression outputs, and function predicates are reported as skipped.
10
11
  */
11
- export interface ParameterConditionOptimizationOptions {
12
+ export interface ParameterConditionOptimizationOptions extends SqlComponentFormatOptions {
12
13
  dryRun?: boolean;
14
+ /**
15
+ * Whether AST/model inputs should be cloned before optimization.
16
+ * Defaults to true for public-call safety. Internal pipelines can pass false
17
+ * when they own the model and want to avoid AST -> SQL -> AST round trips.
18
+ */
19
+ cloneInput?: boolean;
13
20
  }
14
21
  export interface ParameterConditionOptimizationWarning {
15
22
  code: string;
@@ -45,6 +52,7 @@ export interface ParameterConditionOptimizationSafety {
45
52
  export interface ParameterConditionOptimizationResult {
46
53
  ok: boolean;
47
54
  sql: string;
55
+ query: SelectQuery | null;
48
56
  applied: readonly ParameterConditionMove[];
49
57
  skipped: readonly ParameterConditionSkipped[];
50
58
  warnings: readonly ParameterConditionOptimizationWarning[];
@@ -58,21 +66,32 @@ export declare class ParameterConditionPlacementOptimizer {
58
66
  private parseInput;
59
67
  private analyzeCandidate;
60
68
  private findUnsupportedExpression;
69
+ private findUnsupportedParameterPredicateShape;
61
70
  private isSupportedInPredicate;
62
71
  private resolveTarget;
63
- private findCurrentQueryBoundary;
64
- private findTargetQueryBoundary;
72
+ private findRootQueryBoundary;
73
+ private resolveTargetPlacement;
65
74
  private resolveSourceBinding;
66
75
  private resolveUpstreamQuery;
67
- private resolveTargetColumn;
76
+ private resolveUnionTarget;
77
+ private resolveTargetColumns;
78
+ private resolveTargetColumnByOutputIndex;
79
+ private resolveDeepestBranchTarget;
68
80
  private verifyColumnResolvableInQuery;
81
+ private isGroupKeyColumn;
82
+ private sameResolvableColumnInQuery;
83
+ private resolveColumnSourceAlias;
69
84
  private rebaseCondition;
70
85
  private getSourceBindings;
71
86
  private findNullableSideBoundary;
72
87
  private hasOuterJoin;
88
+ private hasDistinctOnBoundary;
89
+ private hasOrdinaryDistinct;
73
90
  private getOutputColumnMatchCount;
91
+ private collectUnionBranches;
92
+ private resolveUnionOutputIndex;
93
+ private collectSelectOutputs;
74
94
  private resolveSourceQueryForColumns;
75
- private getSelectItemOutputName;
76
95
  private findCte;
77
96
  private countTableSourceReferences;
78
97
  private hasWindowUsage;
@@ -1,3 +1,11 @@
1
1
  import { SelectQuery, SimpleSelectQuery } from "../models/SelectQuery";
2
2
  import { ValueComponent } from "../models/ValueComponent";
3
- export declare const formatSqlComponent: (component: SelectQuery | SimpleSelectQuery | ValueComponent) => string;
3
+ import { SqlFormatterOptions } from "./SqlFormatter";
4
+ export type FormattableSqlComponent = SelectQuery | SimpleSelectQuery | ValueComponent;
5
+ export type SqlComponentFormatter = (component: FormattableSqlComponent) => string;
6
+ export interface SqlComponentFormatOptions {
7
+ formatter?: SqlComponentFormatter;
8
+ formatOptions?: SqlFormatterOptions;
9
+ }
10
+ export declare const formatSqlComponent: (component: FormattableSqlComponent, options?: SqlComponentFormatOptions) => string;
11
+ export declare const hasSqlComponentFormatOverride: (options?: SqlComponentFormatOptions) => boolean;
@@ -1,4 +1,5 @@
1
1
  import { SelectQuery, SimpleSelectQuery } from "../models/SelectQuery";
2
+ import { SqlComponentFormatOptions } from "./SqlComponentFormatter";
2
3
  export type StaticPredicatePlacementInput = string | SelectQuery | SimpleSelectQuery;
3
4
  /**
4
5
  * Safe-only placement for parameter-free static predicates.
@@ -7,8 +8,14 @@ export type StaticPredicatePlacementInput = string | SelectQuery | SimpleSelectQ
7
8
  * be mechanically rebased to direct outputs of a single-use simple CTE or
8
9
  * derived table. Unsupported or ambiguous predicates stay in place.
9
10
  */
10
- export interface StaticPredicatePlacementOptions {
11
+ export interface StaticPredicatePlacementOptions extends SqlComponentFormatOptions {
11
12
  dryRun?: boolean;
13
+ /**
14
+ * Whether AST/model inputs should be cloned before optimization.
15
+ * Defaults to true for public-call safety. Internal pipelines can pass false
16
+ * when they own the model and want to avoid AST -> SQL -> AST round trips.
17
+ */
18
+ cloneInput?: boolean;
12
19
  }
13
20
  export interface StaticPredicatePlacementWarning {
14
21
  code: string;
@@ -43,6 +50,7 @@ export interface StaticPredicatePlacementSafety {
43
50
  export interface StaticPredicatePlacementResult {
44
51
  ok: boolean;
45
52
  sql: string;
53
+ query: SelectQuery | null;
46
54
  applied: readonly StaticPredicateMove[];
47
55
  skipped: readonly StaticPredicateSkipped[];
48
56
  warnings: readonly StaticPredicatePlacementWarning[];
@@ -58,20 +66,30 @@ export declare class StaticPredicatePlacementOptimizer {
58
66
  private isExistsPredicate;
59
67
  private findUnsupportedExpression;
60
68
  private resolveTarget;
61
- private findCurrentQueryBoundary;
62
- private findTargetQueryBoundary;
69
+ private findRootQueryBoundary;
70
+ private resolveTargetPlacement;
63
71
  private resolveSourceBinding;
64
72
  private resolveUpstreamQuery;
73
+ private resolveUnionTarget;
65
74
  private resolveTargetColumns;
75
+ private resolveDeepestBranchTarget;
66
76
  private verifyColumnResolvableInQuery;
77
+ private isGroupKeyColumn;
78
+ private sameResolvableColumnInQuery;
79
+ private resolveColumnSourceAlias;
67
80
  private rebasePredicate;
68
81
  private getSourceBindings;
69
82
  private findNullableSideBoundary;
70
83
  private hasLaterJoinThatNullsPriorSources;
71
84
  private hasOuterJoin;
85
+ private hasDistinctOnBoundary;
86
+ private hasOrdinaryDistinct;
72
87
  private getOutputColumnMatchCount;
88
+ private collectUnionBranches;
89
+ private resolveUnionOutputIndex;
90
+ private resolveTargetColumnByOutputIndex;
91
+ private collectSelectOutputs;
73
92
  private resolveSourceQueryForColumns;
74
- private getSelectItemOutputName;
75
93
  private findCte;
76
94
  private countTableSourceReferences;
77
95
  private collectSourceAliases;
@@ -9,11 +9,20 @@ const SSSQLFilterBuilder_1 = require("./SSSQLFilterBuilder");
9
9
  const SqlComponentFormatter_1 = require("./SqlComponentFormatter");
10
10
  const hasOwnParameter = (parameters, parameterName) => Object.prototype.hasOwnProperty.call(parameters, parameterName);
11
11
  const isAbsentOptionalValue = (parameters, parameterName) => parameters[parameterName] === null || parameters[parameterName] === undefined;
12
- const parseConditionOptimizationInput = (input) => {
12
+ const parseConditionOptimizationInput = (input, options) => {
13
13
  const warnings = [];
14
14
  const errors = [];
15
- const sourceSql = typeof input === "string" ? input : (0, SqlComponentFormatter_1.formatSqlComponent)(input);
15
+ const sourceSql = typeof input === "string" ? input : (0, SqlComponentFormatter_1.formatSqlComponent)(input, options);
16
16
  const formatterGeneratedSource = typeof input !== "string";
17
+ if (typeof input !== "string" && options.cloneInput === false) {
18
+ return {
19
+ query: input,
20
+ sql: sourceSql,
21
+ formatterGeneratedSource: false,
22
+ warnings,
23
+ errors
24
+ };
25
+ }
17
26
  if (formatterGeneratedSource) {
18
27
  warnings.push({
19
28
  phaseKind: "sssql_optional_condition",
@@ -46,48 +55,50 @@ const parseConditionOptimizationInput = (input) => {
46
55
  };
47
56
  }
48
57
  };
49
- const buildSssqlApplied = (branch) => {
58
+ const buildSssqlApplied = (branch, options) => {
50
59
  return {
51
60
  phaseKind: "sssql_optional_condition",
52
61
  kind: "prune_optional_branch",
53
- conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression),
62
+ conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options),
54
63
  parameterName: branch.parameterName,
55
64
  reason: "The optional branch parameter is explicitly absent, so the safe-only SSSQL phase pruned the branch."
56
65
  };
57
66
  };
58
- const buildSssqlRefreshApplied = (branch, previousConditionSql) => {
67
+ const buildSssqlRefreshApplied = (branch, previousConditionSql, options) => {
59
68
  return {
60
69
  phaseKind: "sssql_optional_condition",
61
70
  kind: "refresh_optional_branch",
62
- conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression),
71
+ conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options),
63
72
  previousConditionSql,
64
73
  parameterName: branch.parameterName,
65
74
  reason: "The safe-only SSSQL phase refreshed the optional branch placement before ordinary parameter placement."
66
75
  };
67
76
  };
68
- const buildSssqlSkipped = (branch, parameters) => {
77
+ const buildSssqlSkipped = (branch, parameters, options) => {
69
78
  const parameterProvided = hasOwnParameter(parameters, branch.parameterName);
70
79
  return {
71
80
  phaseKind: "sssql_optional_condition",
72
81
  kind: "optional_branch_skipped",
73
- conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression),
82
+ conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options),
74
83
  parameterName: branch.parameterName,
75
84
  code: parameterProvided
76
85
  ? "SSSQL_OPTIONAL_PARAMETER_PRESENT"
77
86
  : "SSSQL_OPTIONAL_PARAMETER_NOT_PROVIDED",
78
87
  reason: parameterProvided
79
88
  ? "The optional branch parameter is present, so the branch remains active."
80
- : "No optional branch parameter value was provided, so the branch remains unchanged."
89
+ : "No optional branch parameter value was provided, so the branch remains unchanged.",
90
+ skipDisposition: parameterProvided ? "unchanged" : "ignored"
81
91
  };
82
92
  };
83
- const buildSssqlRefreshSkipped = (branch, code, reason) => {
93
+ const buildSssqlRefreshSkipped = (branch, code, reason, skipDisposition, options) => {
84
94
  return {
85
95
  phaseKind: "sssql_optional_condition",
86
96
  kind: "optional_branch_skipped",
87
- conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression),
97
+ conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options),
88
98
  parameterName: branch.parameterName,
89
99
  code,
90
- reason
100
+ reason,
101
+ skipDisposition
91
102
  };
92
103
  };
93
104
  const buildSssqlRefreshFilters = (branches, parameters) => {
@@ -99,78 +110,110 @@ const buildSssqlRefreshFilters = (branches, parameters) => {
99
110
  }
100
111
  return filters;
101
112
  };
102
- const refreshRemainingSssqlBranches = (sql, parameters) => {
103
- const parsed = parseConditionOptimizationInput(sql);
113
+ const refreshRemainingSssqlBranches = (query, fallbackSql, parameters, options) => {
114
+ var _a, _b;
104
115
  const applied = [];
105
116
  const skipped = [];
106
- if (!parsed.query) {
107
- return {
108
- sql: parsed.sql,
109
- applied,
110
- skipped,
111
- warnings: parsed.warnings,
112
- errors: parsed.errors,
113
- formatterGeneratedSource: parsed.formatterGeneratedSource
114
- };
115
- }
116
- const beforeBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
117
+ const beforeBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(query);
117
118
  if (beforeBranches.length === 0) {
118
119
  return {
119
- sql: parsed.sql,
120
+ query,
121
+ sql: fallbackSql,
120
122
  applied,
121
123
  skipped,
122
- warnings: parsed.warnings,
123
- errors: parsed.errors,
124
- formatterGeneratedSource: parsed.formatterGeneratedSource
124
+ warnings: [],
125
+ errors: [],
126
+ formatterGeneratedSource: false
125
127
  };
126
128
  }
127
129
  const beforeBranchSql = new WeakMap();
128
130
  const beforeBranchQuery = new WeakMap();
131
+ const parameterCounts = new Map();
129
132
  for (const branch of beforeBranches) {
130
- beforeBranchSql.set(branch.expression, (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression));
133
+ beforeBranchSql.set(branch.expression, (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options));
131
134
  beforeBranchQuery.set(branch.expression, branch.query);
135
+ parameterCounts.set(branch.parameterName, ((_a = parameterCounts.get(branch.parameterName)) !== null && _a !== void 0 ? _a : 0) + 1);
132
136
  }
133
- try {
134
- new SSSQLFilterBuilder_1.SSSQLFilterBuilder().refresh(parsed.query, buildSssqlRefreshFilters(beforeBranches, parameters));
137
+ const alreadyReportedExpressions = new WeakSet();
138
+ const refreshableBranches = [];
139
+ for (const branch of beforeBranches) {
140
+ if (((_b = parameterCounts.get(branch.parameterName)) !== null && _b !== void 0 ? _b : 0) > 1) {
141
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_DUPLICATE_PARAMETER_UNCHANGED", "SSSQL optional branch refresh left this duplicate parameter branch unchanged so each query scope can keep its existing local predicate.", "unchanged", options));
142
+ alreadyReportedExpressions.add(branch.expression);
143
+ continue;
144
+ }
145
+ refreshableBranches.push(branch);
135
146
  }
136
- catch (error) {
137
- const detail = error instanceof Error ? error.message : String(error);
138
- return {
139
- sql,
140
- applied,
141
- skipped: beforeBranches.map(branch => buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", `SSSQL optional branch refresh was skipped because safe refresh could not be proven: ${detail}`)),
142
- warnings: parsed.warnings,
143
- errors: parsed.errors,
144
- formatterGeneratedSource: parsed.formatterGeneratedSource
145
- };
147
+ for (const branch of refreshableBranches) {
148
+ try {
149
+ new SSSQLFilterBuilder_1.SSSQLFilterBuilder().refresh(query, buildSssqlRefreshFilters([branch], parameters));
150
+ }
151
+ catch (error) {
152
+ const detail = error instanceof Error ? error.message : String(error);
153
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", `SSSQL optional branch refresh was skipped because safe refresh could not be proven: ${detail}`, "blocked", options));
154
+ alreadyReportedExpressions.add(branch.expression);
155
+ }
146
156
  }
147
- const afterBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
157
+ const afterBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(query);
148
158
  for (const branch of afterBranches) {
159
+ if (alreadyReportedExpressions.has(branch.expression)) {
160
+ continue;
161
+ }
149
162
  const previousSql = beforeBranchSql.get(branch.expression);
150
163
  const previousQuery = beforeBranchQuery.get(branch.expression);
151
164
  if (!previousSql || !previousQuery) {
152
- skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", "SSSQL optional branch refresh left an untracked branch unchanged."));
165
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", "SSSQL optional branch refresh left an untracked branch unchanged.", "blocked", options));
153
166
  continue;
154
167
  }
155
- const refreshedSql = (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression);
168
+ const refreshedSql = (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options);
156
169
  if (previousQuery !== branch.query || previousSql !== refreshedSql) {
157
- applied.push(buildSssqlRefreshApplied(branch, previousSql));
170
+ applied.push(buildSssqlRefreshApplied(branch, previousSql, options));
158
171
  continue;
159
172
  }
160
- skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_NOOP", "SSSQL optional branch refresh found no safe placement change to apply."));
173
+ const parameterProvided = hasOwnParameter(parameters, branch.parameterName);
174
+ skipped.push(buildSssqlRefreshSkipped(branch, parameterProvided
175
+ ? "SSSQL_OPTIONAL_REFRESH_NOOP"
176
+ : "SSSQL_OPTIONAL_PARAMETER_NOT_PROVIDED", parameterProvided
177
+ ? "SSSQL optional branch refresh found no safe placement change to apply."
178
+ : "No optional branch parameter value was provided, so the branch was not a refresh target.", parameterProvided ? "unchanged" : "ignored", options));
161
179
  }
162
180
  return {
163
- sql: applied.length > 0 ? (0, SqlComponentFormatter_1.formatSqlComponent)(parsed.query) : sql,
181
+ query,
182
+ sql: applied.length > 0 || (0, SqlComponentFormatter_1.hasSqlComponentFormatOverride)(options)
183
+ ? (0, SqlComponentFormatter_1.formatSqlComponent)(query, options)
184
+ : fallbackSql,
164
185
  applied,
165
186
  skipped,
166
- warnings: parsed.warnings,
167
- errors: parsed.errors,
168
- formatterGeneratedSource: parsed.formatterGeneratedSource
187
+ warnings: [],
188
+ errors: [],
189
+ formatterGeneratedSource: false
190
+ };
191
+ };
192
+ const refreshRemainingSssqlBranchesFromSql = (sql, parameters, options) => {
193
+ const parsed = parseConditionOptimizationInput(sql, options);
194
+ if (!parsed.query) {
195
+ return {
196
+ query: null,
197
+ sql: parsed.sql,
198
+ applied: [],
199
+ skipped: [],
200
+ warnings: parsed.warnings,
201
+ errors: parsed.errors,
202
+ formatterGeneratedSource: parsed.formatterGeneratedSource
203
+ };
204
+ }
205
+ const refreshed = refreshRemainingSssqlBranches(parsed.query, sql, parameters, options);
206
+ return {
207
+ ...refreshed,
208
+ warnings: [...parsed.warnings, ...refreshed.warnings],
209
+ errors: [...parsed.errors, ...refreshed.errors],
210
+ formatterGeneratedSource: parsed.formatterGeneratedSource || refreshed.formatterGeneratedSource
169
211
  };
170
212
  };
171
213
  const runSssqlOptionalConditionPhase = (input, options) => {
172
214
  var _a;
173
- const parsed = parseConditionOptimizationInput(input);
215
+ const reuseOwnedModel = options.cloneInput === false && typeof input !== "string";
216
+ const parsed = parseConditionOptimizationInput(input, options);
174
217
  const warnings = [...parsed.warnings];
175
218
  let errors = [...parsed.errors];
176
219
  const applied = [];
@@ -178,6 +221,7 @@ const runSssqlOptionalConditionPhase = (input, options) => {
178
221
  const optionalConditionParameters = (_a = options.optionalConditionParameters) !== null && _a !== void 0 ? _a : {};
179
222
  if (!parsed.query) {
180
223
  return {
224
+ query: null,
181
225
  sql: parsed.sql,
182
226
  applied,
183
227
  skipped,
@@ -187,14 +231,16 @@ const runSssqlOptionalConditionPhase = (input, options) => {
187
231
  };
188
232
  }
189
233
  let currentSql = parsed.sql;
234
+ let currentQuery = parsed.query;
235
+ let formatterGeneratedSource = parsed.formatterGeneratedSource;
190
236
  const branches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
191
237
  const pruneBranches = branches.filter(branch => hasOwnParameter(optionalConditionParameters, branch.parameterName)
192
238
  && isAbsentOptionalValue(optionalConditionParameters, branch.parameterName));
193
239
  if (pruneBranches.length > 0) {
194
240
  try {
195
241
  (0, PruneOptionalConditionBranches_1.pruneOptionalConditionBranches)(parsed.query, optionalConditionParameters);
196
- currentSql = (0, SqlComponentFormatter_1.formatSqlComponent)(parsed.query);
197
- applied.push(...pruneBranches.map(buildSssqlApplied));
242
+ currentSql = (0, SqlComponentFormatter_1.formatSqlComponent)(parsed.query, options);
243
+ applied.push(...pruneBranches.map(branch => buildSssqlApplied(branch, options)));
198
244
  }
199
245
  catch (error) {
200
246
  errors = [...errors, {
@@ -206,28 +252,33 @@ const runSssqlOptionalConditionPhase = (input, options) => {
206
252
  }
207
253
  }
208
254
  if (errors.length === 0) {
209
- const refreshPhase = refreshRemainingSssqlBranches(currentSql, optionalConditionParameters);
255
+ const refreshPhase = reuseOwnedModel
256
+ ? refreshRemainingSssqlBranches(parsed.query, currentSql, optionalConditionParameters, options)
257
+ : refreshRemainingSssqlBranchesFromSql(currentSql, optionalConditionParameters, options);
210
258
  applied.push(...refreshPhase.applied);
211
259
  skipped.push(...refreshPhase.skipped);
212
260
  warnings.push(...refreshPhase.warnings);
213
261
  errors.push(...refreshPhase.errors);
214
262
  currentSql = refreshPhase.sql;
263
+ currentQuery = refreshPhase.query;
264
+ formatterGeneratedSource = formatterGeneratedSource || refreshPhase.formatterGeneratedSource;
215
265
  }
216
266
  else {
217
267
  for (const branch of branches) {
218
268
  if (pruneBranches.includes(branch)) {
219
269
  continue;
220
270
  }
221
- skipped.push(buildSssqlSkipped(branch, optionalConditionParameters));
271
+ skipped.push(buildSssqlSkipped(branch, optionalConditionParameters, options));
222
272
  }
223
273
  }
224
274
  return {
275
+ query: errors.length === 0 ? currentQuery : null,
225
276
  sql: errors.length === 0 ? currentSql : parsed.sql,
226
277
  applied,
227
278
  skipped,
228
279
  warnings,
229
280
  errors,
230
- formatterGeneratedSource: parsed.formatterGeneratedSource
281
+ formatterGeneratedSource
231
282
  };
232
283
  };
233
284
  const mapParameterWarnings = (warnings) => warnings.map(warning => ({
@@ -244,6 +295,7 @@ const mapParameterApplied = (applied) => applied.map(item => ({
244
295
  }));
245
296
  const mapParameterSkipped = (skipped) => skipped.map(item => ({
246
297
  phaseKind: "parameter_condition_placement",
298
+ skipDisposition: "blocked",
247
299
  ...item
248
300
  }));
249
301
  const mapStaticWarnings = (warnings) => warnings.map(warning => ({
@@ -260,6 +312,7 @@ const mapStaticApplied = (applied) => applied.map(item => ({
260
312
  }));
261
313
  const mapStaticSkipped = (skipped) => skipped.map(item => ({
262
314
  phaseKind: "static_predicate_placement",
315
+ skipDisposition: "blocked",
263
316
  ...item
264
317
  }));
265
318
  const makePhaseSummary = (kind, counts) => ({
@@ -270,21 +323,40 @@ const makePhaseSummary = (kind, counts) => ({
270
323
  errorCount: counts.errorCount
271
324
  });
272
325
  const runConditionOptimization = (input, options, defaultDryRun) => {
273
- var _a;
326
+ var _a, _b, _c;
274
327
  const dryRun = (_a = options.dryRun) !== null && _a !== void 0 ? _a : defaultDryRun;
328
+ const reuseOwnedModel = options.cloneInput === false && typeof input !== "string";
275
329
  // Run semantic SSSQL handling before generic placement phases so optional
276
330
  // branches remain owned by SSSQL even if later phases grow broader support.
277
331
  const sssqlPhase = runSssqlOptionalConditionPhase(input, { ...options, dryRun });
332
+ const parameterOptimizer = new ParameterConditionPlacementOptimizer_1.ParameterConditionPlacementOptimizer();
333
+ const parameterInput = reuseOwnedModel
334
+ ? (_b = sssqlPhase.query) !== null && _b !== void 0 ? _b : sssqlPhase.sql
335
+ : sssqlPhase.sql;
336
+ const parameterOptions = {
337
+ ...options,
338
+ dryRun,
339
+ cloneInput: reuseOwnedModel && sssqlPhase.query ? false : options.cloneInput
340
+ };
278
341
  const parameterPhase = dryRun
279
- ? (0, ParameterConditionPlacementOptimizer_1.planParameterConditionOptimization)(sssqlPhase.sql, { dryRun })
280
- : (0, ParameterConditionPlacementOptimizer_1.optimizeParameterConditionPlacement)(sssqlPhase.sql, { dryRun });
342
+ ? parameterOptimizer.plan(parameterInput, parameterOptions)
343
+ : parameterOptimizer.optimize(parameterInput, parameterOptions);
281
344
  const parameterWarnings = mapParameterWarnings(parameterPhase.warnings);
282
345
  const parameterErrors = mapParameterErrors(parameterPhase.errors);
283
346
  const parameterApplied = mapParameterApplied(parameterPhase.applied);
284
347
  const parameterSkipped = mapParameterSkipped(parameterPhase.skipped);
348
+ const staticOptimizer = new StaticPredicatePlacementOptimizer_1.StaticPredicatePlacementOptimizer();
349
+ const staticInput = reuseOwnedModel
350
+ ? (_c = parameterPhase.query) !== null && _c !== void 0 ? _c : parameterPhase.sql
351
+ : parameterPhase.sql;
352
+ const staticOptions = {
353
+ ...options,
354
+ dryRun,
355
+ cloneInput: reuseOwnedModel && parameterPhase.query ? false : options.cloneInput
356
+ };
285
357
  const staticPhase = dryRun
286
- ? (0, StaticPredicatePlacementOptimizer_1.planStaticPredicatePlacement)(parameterPhase.sql, { dryRun })
287
- : (0, StaticPredicatePlacementOptimizer_1.optimizeStaticPredicatePlacement)(parameterPhase.sql, { dryRun });
358
+ ? staticOptimizer.plan(staticInput, staticOptions)
359
+ : staticOptimizer.optimize(staticInput, staticOptions);
288
360
  const staticWarnings = mapStaticWarnings(staticPhase.warnings);
289
361
  const staticErrors = mapStaticErrors(staticPhase.errors);
290
362
  const staticApplied = mapStaticApplied(staticPhase.applied);
@@ -294,6 +366,7 @@ const runConditionOptimization = (input, options, defaultDryRun) => {
294
366
  return {
295
367
  ok: errors.length === 0,
296
368
  sql: staticPhase.sql,
369
+ query: staticPhase.query,
297
370
  phases: [
298
371
  makePhaseSummary("sssql_optional_condition", {
299
372
  appliedCount: sssqlPhase.applied.length,
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionOptimization.js","sourceRoot":"","sources":["../../src/transformers/ConditionOptimization.ts"],"names":[],"mappings":";;;AAEA,oEAAiE;AACjE,iGAQgD;AAChD,2FAO6C;AAC7C,qFAK0C;AAC1C,6DAA0D;AAC1D,mEAA6D;AAgG7D,MAAM,eAAe,GAAG,CACpB,UAA8C,EAC9C,aAAqB,EACd,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE9E,MAAM,qBAAqB,GAAG,CAC1B,UAA8C,EAC9C,aAAqB,EACd,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,IAAI,UAAU,CAAC,aAAa,CAAC,KAAK,SAAS,CAAC;AAE5F,MAAM,+BAA+B,GAAG,CACpC,KAAiC,EACD,EAAE;IAClC,MAAM,QAAQ,GAAmC,EAAE,CAAC;IACpD,MAAM,MAAM,GAAiC,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,0CAAkB,EAAC,KAAK,CAAC,CAAC;IAChF,MAAM,wBAAwB,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC;IAE3D,IAAI,wBAAwB,EAAE,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC;YACV,SAAS,EAAE,0BAA0B;YACrC,IAAI,EAAE,qBAAqB;YAC3B,OAAO,EAAE,wFAAwF;SACpG,CAAC,CAAC;IACP,CAAC;IAED,IAAI,CAAC;QACD,OAAO;YACH,KAAK,EAAE,qCAAiB,CAAC,KAAK,CAAC,SAAS,CAAC;YACzC,GAAG,EAAE,SAAS;YACd,wBAAwB;YACxB,QAAQ;YACR,MAAM;SACT,CAAC;IACN,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