rawsql-ts 0.26.1 → 0.27.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 +1 -0
  6. package/dist/esm/transformers/ConditionOptimization.js +97 -57
  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 +1 -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 +107 -54
  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';
@@ -64,6 +64,7 @@ export interface ConditionOptimizationSafety {
64
64
  export interface ConditionOptimizationResult {
65
65
  ok: boolean;
66
66
  sql: string;
67
+ query: SelectQuery | null;
67
68
  phases: readonly ConditionOptimizationPhaseSummary[];
68
69
  applied: readonly ConditionOptimizationApplied[];
69
70
  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,31 +55,31 @@ 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"
@@ -80,11 +89,11 @@ const buildSssqlSkipped = (branch, parameters) => {
80
89
  : "No optional branch parameter value was provided, so the branch remains unchanged."
81
90
  };
82
91
  };
83
- const buildSssqlRefreshSkipped = (branch, code, reason) => {
92
+ const buildSssqlRefreshSkipped = (branch, code, reason, options) => {
84
93
  return {
85
94
  phaseKind: "sssql_optional_condition",
86
95
  kind: "optional_branch_skipped",
87
- conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression),
96
+ conditionSql: (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options),
88
97
  parameterName: branch.parameterName,
89
98
  code,
90
99
  reason
@@ -99,78 +108,94 @@ const buildSssqlRefreshFilters = (branches, parameters) => {
99
108
  }
100
109
  return filters;
101
110
  };
102
- const refreshRemainingSssqlBranches = (sql, parameters) => {
103
- const parsed = parseConditionOptimizationInput(sql);
111
+ const refreshRemainingSssqlBranches = (query, fallbackSql, parameters, options) => {
104
112
  const applied = [];
105
113
  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);
114
+ const beforeBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(query);
117
115
  if (beforeBranches.length === 0) {
118
116
  return {
119
- sql: parsed.sql,
117
+ query,
118
+ sql: fallbackSql,
120
119
  applied,
121
120
  skipped,
122
- warnings: parsed.warnings,
123
- errors: parsed.errors,
124
- formatterGeneratedSource: parsed.formatterGeneratedSource
121
+ warnings: [],
122
+ errors: [],
123
+ formatterGeneratedSource: false
125
124
  };
126
125
  }
127
126
  const beforeBranchSql = new WeakMap();
128
127
  const beforeBranchQuery = new WeakMap();
129
128
  for (const branch of beforeBranches) {
130
- beforeBranchSql.set(branch.expression, (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression));
129
+ beforeBranchSql.set(branch.expression, (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options));
131
130
  beforeBranchQuery.set(branch.expression, branch.query);
132
131
  }
133
132
  try {
134
- new SSSQLFilterBuilder_1.SSSQLFilterBuilder().refresh(parsed.query, buildSssqlRefreshFilters(beforeBranches, parameters));
133
+ new SSSQLFilterBuilder_1.SSSQLFilterBuilder().refresh(query, buildSssqlRefreshFilters(beforeBranches, parameters));
135
134
  }
136
135
  catch (error) {
137
136
  const detail = error instanceof Error ? error.message : String(error);
138
137
  return {
139
- sql,
138
+ query,
139
+ sql: fallbackSql,
140
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
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}`, options)),
142
+ warnings: [],
143
+ errors: [],
144
+ formatterGeneratedSource: false
145
145
  };
146
146
  }
147
- const afterBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
147
+ const afterBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(query);
148
148
  for (const branch of afterBranches) {
149
149
  const previousSql = beforeBranchSql.get(branch.expression);
150
150
  const previousQuery = beforeBranchQuery.get(branch.expression);
151
151
  if (!previousSql || !previousQuery) {
152
- skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", "SSSQL optional branch refresh left an untracked branch unchanged."));
152
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", "SSSQL optional branch refresh left an untracked branch unchanged.", options));
153
153
  continue;
154
154
  }
155
- const refreshedSql = (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression);
155
+ const refreshedSql = (0, SqlComponentFormatter_1.formatSqlComponent)(branch.expression, options);
156
156
  if (previousQuery !== branch.query || previousSql !== refreshedSql) {
157
- applied.push(buildSssqlRefreshApplied(branch, previousSql));
157
+ applied.push(buildSssqlRefreshApplied(branch, previousSql, options));
158
158
  continue;
159
159
  }
160
- skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_NOOP", "SSSQL optional branch refresh found no safe placement change to apply."));
160
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_NOOP", "SSSQL optional branch refresh found no safe placement change to apply.", options));
161
161
  }
162
162
  return {
163
- sql: applied.length > 0 ? (0, SqlComponentFormatter_1.formatSqlComponent)(parsed.query) : sql,
163
+ query,
164
+ sql: applied.length > 0 || (0, SqlComponentFormatter_1.hasSqlComponentFormatOverride)(options)
165
+ ? (0, SqlComponentFormatter_1.formatSqlComponent)(query, options)
166
+ : fallbackSql,
164
167
  applied,
165
168
  skipped,
166
- warnings: parsed.warnings,
167
- errors: parsed.errors,
168
- formatterGeneratedSource: parsed.formatterGeneratedSource
169
+ warnings: [],
170
+ errors: [],
171
+ formatterGeneratedSource: false
172
+ };
173
+ };
174
+ const refreshRemainingSssqlBranchesFromSql = (sql, parameters, options) => {
175
+ const parsed = parseConditionOptimizationInput(sql, options);
176
+ if (!parsed.query) {
177
+ return {
178
+ query: null,
179
+ sql: parsed.sql,
180
+ applied: [],
181
+ skipped: [],
182
+ warnings: parsed.warnings,
183
+ errors: parsed.errors,
184
+ formatterGeneratedSource: parsed.formatterGeneratedSource
185
+ };
186
+ }
187
+ const refreshed = refreshRemainingSssqlBranches(parsed.query, sql, parameters, options);
188
+ return {
189
+ ...refreshed,
190
+ warnings: [...parsed.warnings, ...refreshed.warnings],
191
+ errors: [...parsed.errors, ...refreshed.errors],
192
+ formatterGeneratedSource: parsed.formatterGeneratedSource || refreshed.formatterGeneratedSource
169
193
  };
170
194
  };
171
195
  const runSssqlOptionalConditionPhase = (input, options) => {
172
196
  var _a;
173
- const parsed = parseConditionOptimizationInput(input);
197
+ const reuseOwnedModel = options.cloneInput === false && typeof input !== "string";
198
+ const parsed = parseConditionOptimizationInput(input, options);
174
199
  const warnings = [...parsed.warnings];
175
200
  let errors = [...parsed.errors];
176
201
  const applied = [];
@@ -178,6 +203,7 @@ const runSssqlOptionalConditionPhase = (input, options) => {
178
203
  const optionalConditionParameters = (_a = options.optionalConditionParameters) !== null && _a !== void 0 ? _a : {};
179
204
  if (!parsed.query) {
180
205
  return {
206
+ query: null,
181
207
  sql: parsed.sql,
182
208
  applied,
183
209
  skipped,
@@ -187,14 +213,16 @@ const runSssqlOptionalConditionPhase = (input, options) => {
187
213
  };
188
214
  }
189
215
  let currentSql = parsed.sql;
216
+ let currentQuery = parsed.query;
217
+ let formatterGeneratedSource = parsed.formatterGeneratedSource;
190
218
  const branches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
191
219
  const pruneBranches = branches.filter(branch => hasOwnParameter(optionalConditionParameters, branch.parameterName)
192
220
  && isAbsentOptionalValue(optionalConditionParameters, branch.parameterName));
193
221
  if (pruneBranches.length > 0) {
194
222
  try {
195
223
  (0, PruneOptionalConditionBranches_1.pruneOptionalConditionBranches)(parsed.query, optionalConditionParameters);
196
- currentSql = (0, SqlComponentFormatter_1.formatSqlComponent)(parsed.query);
197
- applied.push(...pruneBranches.map(buildSssqlApplied));
224
+ currentSql = (0, SqlComponentFormatter_1.formatSqlComponent)(parsed.query, options);
225
+ applied.push(...pruneBranches.map(branch => buildSssqlApplied(branch, options)));
198
226
  }
199
227
  catch (error) {
200
228
  errors = [...errors, {
@@ -206,28 +234,33 @@ const runSssqlOptionalConditionPhase = (input, options) => {
206
234
  }
207
235
  }
208
236
  if (errors.length === 0) {
209
- const refreshPhase = refreshRemainingSssqlBranches(currentSql, optionalConditionParameters);
237
+ const refreshPhase = reuseOwnedModel
238
+ ? refreshRemainingSssqlBranches(parsed.query, currentSql, optionalConditionParameters, options)
239
+ : refreshRemainingSssqlBranchesFromSql(currentSql, optionalConditionParameters, options);
210
240
  applied.push(...refreshPhase.applied);
211
241
  skipped.push(...refreshPhase.skipped);
212
242
  warnings.push(...refreshPhase.warnings);
213
243
  errors.push(...refreshPhase.errors);
214
244
  currentSql = refreshPhase.sql;
245
+ currentQuery = refreshPhase.query;
246
+ formatterGeneratedSource = formatterGeneratedSource || refreshPhase.formatterGeneratedSource;
215
247
  }
216
248
  else {
217
249
  for (const branch of branches) {
218
250
  if (pruneBranches.includes(branch)) {
219
251
  continue;
220
252
  }
221
- skipped.push(buildSssqlSkipped(branch, optionalConditionParameters));
253
+ skipped.push(buildSssqlSkipped(branch, optionalConditionParameters, options));
222
254
  }
223
255
  }
224
256
  return {
257
+ query: errors.length === 0 ? currentQuery : null,
225
258
  sql: errors.length === 0 ? currentSql : parsed.sql,
226
259
  applied,
227
260
  skipped,
228
261
  warnings,
229
262
  errors,
230
- formatterGeneratedSource: parsed.formatterGeneratedSource
263
+ formatterGeneratedSource
231
264
  };
232
265
  };
233
266
  const mapParameterWarnings = (warnings) => warnings.map(warning => ({
@@ -270,21 +303,40 @@ const makePhaseSummary = (kind, counts) => ({
270
303
  errorCount: counts.errorCount
271
304
  });
272
305
  const runConditionOptimization = (input, options, defaultDryRun) => {
273
- var _a;
306
+ var _a, _b, _c;
274
307
  const dryRun = (_a = options.dryRun) !== null && _a !== void 0 ? _a : defaultDryRun;
308
+ const reuseOwnedModel = options.cloneInput === false && typeof input !== "string";
275
309
  // Run semantic SSSQL handling before generic placement phases so optional
276
310
  // branches remain owned by SSSQL even if later phases grow broader support.
277
311
  const sssqlPhase = runSssqlOptionalConditionPhase(input, { ...options, dryRun });
312
+ const parameterOptimizer = new ParameterConditionPlacementOptimizer_1.ParameterConditionPlacementOptimizer();
313
+ const parameterInput = reuseOwnedModel
314
+ ? (_b = sssqlPhase.query) !== null && _b !== void 0 ? _b : sssqlPhase.sql
315
+ : sssqlPhase.sql;
316
+ const parameterOptions = {
317
+ ...options,
318
+ dryRun,
319
+ cloneInput: reuseOwnedModel && sssqlPhase.query ? false : options.cloneInput
320
+ };
278
321
  const parameterPhase = dryRun
279
- ? (0, ParameterConditionPlacementOptimizer_1.planParameterConditionOptimization)(sssqlPhase.sql, { dryRun })
280
- : (0, ParameterConditionPlacementOptimizer_1.optimizeParameterConditionPlacement)(sssqlPhase.sql, { dryRun });
322
+ ? parameterOptimizer.plan(parameterInput, parameterOptions)
323
+ : parameterOptimizer.optimize(parameterInput, parameterOptions);
281
324
  const parameterWarnings = mapParameterWarnings(parameterPhase.warnings);
282
325
  const parameterErrors = mapParameterErrors(parameterPhase.errors);
283
326
  const parameterApplied = mapParameterApplied(parameterPhase.applied);
284
327
  const parameterSkipped = mapParameterSkipped(parameterPhase.skipped);
328
+ const staticOptimizer = new StaticPredicatePlacementOptimizer_1.StaticPredicatePlacementOptimizer();
329
+ const staticInput = reuseOwnedModel
330
+ ? (_c = parameterPhase.query) !== null && _c !== void 0 ? _c : parameterPhase.sql
331
+ : parameterPhase.sql;
332
+ const staticOptions = {
333
+ ...options,
334
+ dryRun,
335
+ cloneInput: reuseOwnedModel && parameterPhase.query ? false : options.cloneInput
336
+ };
285
337
  const staticPhase = dryRun
286
- ? (0, StaticPredicatePlacementOptimizer_1.planStaticPredicatePlacement)(parameterPhase.sql, { dryRun })
287
- : (0, StaticPredicatePlacementOptimizer_1.optimizeStaticPredicatePlacement)(parameterPhase.sql, { dryRun });
338
+ ? staticOptimizer.plan(staticInput, staticOptions)
339
+ : staticOptimizer.optimize(staticInput, staticOptions);
288
340
  const staticWarnings = mapStaticWarnings(staticPhase.warnings);
289
341
  const staticErrors = mapStaticErrors(staticPhase.errors);
290
342
  const staticApplied = mapStaticApplied(staticPhase.applied);
@@ -294,6 +346,7 @@ const runConditionOptimization = (input, options, defaultDryRun) => {
294
346
  return {
295
347
  ok: errors.length === 0,
296
348
  sql: staticPhase.sql,
349
+ query: staticPhase.query,
297
350
  phases: [
298
351
  makePhaseSummary("sssql_optional_condition", {
299
352
  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;QAC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