rawsql-ts 0.24.4 → 0.26.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 (78) hide show
  1. package/dist/esm/index.d.ts +8 -0
  2. package/dist/esm/index.js +8 -0
  3. package/dist/esm/index.js.map +1 -1
  4. package/dist/esm/index.min.js +5 -5
  5. package/dist/esm/index.min.js.map +4 -4
  6. package/dist/esm/parsers/FunctionExpressionParser.d.ts +3 -0
  7. package/dist/esm/parsers/FunctionExpressionParser.js +50 -2
  8. package/dist/esm/parsers/FunctionExpressionParser.js.map +1 -1
  9. package/dist/esm/parsers/SqlPrintTokenParser.d.ts +1 -0
  10. package/dist/esm/parsers/SqlPrintTokenParser.js +11 -1
  11. package/dist/esm/parsers/SqlPrintTokenParser.js.map +1 -1
  12. package/dist/esm/transformers/AstCommentAttachmentExtractor.d.ts +61 -0
  13. package/dist/esm/transformers/AstCommentAttachmentExtractor.js +221 -0
  14. package/dist/esm/transformers/AstCommentAttachmentExtractor.js.map +1 -0
  15. package/dist/esm/transformers/ClauseScopedColumnReferenceCollector.d.ts +47 -0
  16. package/dist/esm/transformers/ClauseScopedColumnReferenceCollector.js +235 -0
  17. package/dist/esm/transformers/ClauseScopedColumnReferenceCollector.js.map +1 -0
  18. package/dist/esm/transformers/ConditionOptimization.d.ts +66 -0
  19. package/dist/esm/transformers/ConditionOptimization.js +294 -0
  20. package/dist/esm/transformers/ConditionOptimization.js.map +1 -0
  21. package/dist/esm/transformers/NamedQueryDefinitionExtractor.d.ts +53 -0
  22. package/dist/esm/transformers/NamedQueryDefinitionExtractor.js +370 -0
  23. package/dist/esm/transformers/NamedQueryDefinitionExtractor.js.map +1 -0
  24. package/dist/esm/transformers/ParameterConditionPlacementOptimizer.d.ts +85 -0
  25. package/dist/esm/transformers/ParameterConditionPlacementOptimizer.js +942 -0
  26. package/dist/esm/transformers/ParameterConditionPlacementOptimizer.js.map +1 -0
  27. package/dist/esm/transformers/SelectBodyExtractor.d.ts +21 -0
  28. package/dist/esm/transformers/SelectBodyExtractor.js +137 -0
  29. package/dist/esm/transformers/SelectBodyExtractor.js.map +1 -0
  30. package/dist/esm/transformers/SelectOutputCollector.d.ts +47 -0
  31. package/dist/esm/transformers/SelectOutputCollector.js +281 -0
  32. package/dist/esm/transformers/SelectOutputCollector.js.map +1 -0
  33. package/dist/esm/transformers/SelectValueCollector.d.ts +9 -1
  34. package/dist/esm/transformers/SelectValueCollector.js +83 -58
  35. package/dist/esm/transformers/SelectValueCollector.js.map +1 -1
  36. package/dist/esm/transformers/WildcardColumnInferenceCollector.d.ts +129 -0
  37. package/dist/esm/transformers/WildcardColumnInferenceCollector.js +373 -0
  38. package/dist/esm/transformers/WildcardColumnInferenceCollector.js.map +1 -0
  39. package/dist/index.js +8 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.min.js +5 -5
  42. package/dist/index.min.js.map +4 -4
  43. package/dist/parsers/FunctionExpressionParser.js +49 -1
  44. package/dist/parsers/FunctionExpressionParser.js.map +1 -1
  45. package/dist/parsers/SqlPrintTokenParser.js +11 -1
  46. package/dist/parsers/SqlPrintTokenParser.js.map +1 -1
  47. package/dist/src/index.d.ts +8 -0
  48. package/dist/src/parsers/FunctionExpressionParser.d.ts +3 -0
  49. package/dist/src/parsers/SqlPrintTokenParser.d.ts +1 -0
  50. package/dist/src/transformers/AstCommentAttachmentExtractor.d.ts +61 -0
  51. package/dist/src/transformers/ClauseScopedColumnReferenceCollector.d.ts +47 -0
  52. package/dist/src/transformers/ConditionOptimization.d.ts +66 -0
  53. package/dist/src/transformers/NamedQueryDefinitionExtractor.d.ts +53 -0
  54. package/dist/src/transformers/ParameterConditionPlacementOptimizer.d.ts +85 -0
  55. package/dist/src/transformers/SelectBodyExtractor.d.ts +21 -0
  56. package/dist/src/transformers/SelectOutputCollector.d.ts +47 -0
  57. package/dist/src/transformers/SelectValueCollector.d.ts +9 -1
  58. package/dist/src/transformers/WildcardColumnInferenceCollector.d.ts +129 -0
  59. package/dist/transformers/AstCommentAttachmentExtractor.js +231 -0
  60. package/dist/transformers/AstCommentAttachmentExtractor.js.map +1 -0
  61. package/dist/transformers/ClauseScopedColumnReferenceCollector.js +239 -0
  62. package/dist/transformers/ClauseScopedColumnReferenceCollector.js.map +1 -0
  63. package/dist/transformers/ConditionOptimization.js +311 -0
  64. package/dist/transformers/ConditionOptimization.js.map +1 -0
  65. package/dist/transformers/NamedQueryDefinitionExtractor.js +374 -0
  66. package/dist/transformers/NamedQueryDefinitionExtractor.js.map +1 -0
  67. package/dist/transformers/ParameterConditionPlacementOptimizer.js +952 -0
  68. package/dist/transformers/ParameterConditionPlacementOptimizer.js.map +1 -0
  69. package/dist/transformers/SelectBodyExtractor.js +141 -0
  70. package/dist/transformers/SelectBodyExtractor.js.map +1 -0
  71. package/dist/transformers/SelectOutputCollector.js +291 -0
  72. package/dist/transformers/SelectOutputCollector.js.map +1 -0
  73. package/dist/transformers/SelectValueCollector.js +83 -58
  74. package/dist/transformers/SelectValueCollector.js.map +1 -1
  75. package/dist/transformers/WildcardColumnInferenceCollector.js +377 -0
  76. package/dist/transformers/WildcardColumnInferenceCollector.js.map +1 -0
  77. package/dist/tsconfig.browser.tsbuildinfo +1 -1
  78. package/package.json +1 -1
@@ -0,0 +1,311 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimizeConditions = exports.planConditionOptimization = void 0;
4
+ const SelectQueryParser_1 = require("../parsers/SelectQueryParser");
5
+ const ParameterConditionPlacementOptimizer_1 = require("./ParameterConditionPlacementOptimizer");
6
+ const PruneOptionalConditionBranches_1 = require("./PruneOptionalConditionBranches");
7
+ const SSSQLFilterBuilder_1 = require("./SSSQLFilterBuilder");
8
+ const SqlFormatter_1 = require("./SqlFormatter");
9
+ const formatSqlComponent = (component) => {
10
+ return new SqlFormatter_1.SqlFormatter().format(component).formattedSql;
11
+ };
12
+ const hasOwnParameter = (parameters, parameterName) => Object.prototype.hasOwnProperty.call(parameters, parameterName);
13
+ const isAbsentOptionalValue = (parameters, parameterName) => parameters[parameterName] === null || parameters[parameterName] === undefined;
14
+ const parseConditionOptimizationInput = (input) => {
15
+ const warnings = [];
16
+ const errors = [];
17
+ const sourceSql = typeof input === "string" ? input : formatSqlComponent(input);
18
+ const formatterGeneratedSource = typeof input !== "string";
19
+ if (formatterGeneratedSource) {
20
+ warnings.push({
21
+ phaseKind: "sssql_optional_condition",
22
+ code: "AST_INPUT_FORMATTED",
23
+ message: "AST input is cloned through formatter output so the caller-owned query is not mutated."
24
+ });
25
+ }
26
+ try {
27
+ return {
28
+ query: SelectQueryParser_1.SelectQueryParser.parse(sourceSql),
29
+ sql: sourceSql,
30
+ formatterGeneratedSource,
31
+ warnings,
32
+ errors
33
+ };
34
+ }
35
+ catch (error) {
36
+ errors.push({
37
+ phaseKind: "sssql_optional_condition",
38
+ code: "PARSE_FAILED",
39
+ message: "SSSQL optional condition optimization could not parse the input SQL.",
40
+ detail: error instanceof Error ? error.message : String(error)
41
+ });
42
+ return {
43
+ query: null,
44
+ sql: sourceSql,
45
+ formatterGeneratedSource,
46
+ warnings,
47
+ errors
48
+ };
49
+ }
50
+ };
51
+ const buildSssqlApplied = (branch) => {
52
+ return {
53
+ phaseKind: "sssql_optional_condition",
54
+ kind: "prune_optional_branch",
55
+ conditionSql: formatSqlComponent(branch.expression),
56
+ parameterName: branch.parameterName,
57
+ reason: "The optional branch parameter is explicitly absent, so the safe-only SSSQL phase pruned the branch."
58
+ };
59
+ };
60
+ const buildSssqlRefreshApplied = (branch, previousConditionSql) => {
61
+ return {
62
+ phaseKind: "sssql_optional_condition",
63
+ kind: "refresh_optional_branch",
64
+ conditionSql: formatSqlComponent(branch.expression),
65
+ previousConditionSql,
66
+ parameterName: branch.parameterName,
67
+ reason: "The safe-only SSSQL phase refreshed the optional branch placement before ordinary parameter placement."
68
+ };
69
+ };
70
+ const buildSssqlSkipped = (branch, parameters) => {
71
+ const parameterProvided = hasOwnParameter(parameters, branch.parameterName);
72
+ return {
73
+ phaseKind: "sssql_optional_condition",
74
+ kind: "optional_branch_skipped",
75
+ conditionSql: formatSqlComponent(branch.expression),
76
+ parameterName: branch.parameterName,
77
+ code: parameterProvided
78
+ ? "SSSQL_OPTIONAL_PARAMETER_PRESENT"
79
+ : "SSSQL_OPTIONAL_PARAMETER_NOT_PROVIDED",
80
+ reason: parameterProvided
81
+ ? "The optional branch parameter is present, so the branch remains active."
82
+ : "No optional branch parameter value was provided, so the branch remains unchanged."
83
+ };
84
+ };
85
+ const buildSssqlRefreshSkipped = (branch, code, reason) => {
86
+ return {
87
+ phaseKind: "sssql_optional_condition",
88
+ kind: "optional_branch_skipped",
89
+ conditionSql: formatSqlComponent(branch.expression),
90
+ parameterName: branch.parameterName,
91
+ code,
92
+ reason
93
+ };
94
+ };
95
+ const buildSssqlRefreshFilters = (branches, parameters) => {
96
+ const filters = {};
97
+ for (const branch of branches) {
98
+ filters[branch.parameterName] = hasOwnParameter(parameters, branch.parameterName)
99
+ ? parameters[branch.parameterName]
100
+ : null;
101
+ }
102
+ return filters;
103
+ };
104
+ const refreshRemainingSssqlBranches = (sql, parameters) => {
105
+ const parsed = parseConditionOptimizationInput(sql);
106
+ const applied = [];
107
+ const skipped = [];
108
+ if (!parsed.query) {
109
+ return {
110
+ sql: parsed.sql,
111
+ applied,
112
+ skipped,
113
+ warnings: parsed.warnings,
114
+ errors: parsed.errors,
115
+ formatterGeneratedSource: parsed.formatterGeneratedSource
116
+ };
117
+ }
118
+ const beforeBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
119
+ if (beforeBranches.length === 0) {
120
+ return {
121
+ sql: parsed.sql,
122
+ applied,
123
+ skipped,
124
+ warnings: parsed.warnings,
125
+ errors: parsed.errors,
126
+ formatterGeneratedSource: parsed.formatterGeneratedSource
127
+ };
128
+ }
129
+ const beforeBranchSql = new WeakMap();
130
+ const beforeBranchQuery = new WeakMap();
131
+ for (const branch of beforeBranches) {
132
+ beforeBranchSql.set(branch.expression, formatSqlComponent(branch.expression));
133
+ beforeBranchQuery.set(branch.expression, branch.query);
134
+ }
135
+ try {
136
+ new SSSQLFilterBuilder_1.SSSQLFilterBuilder().refresh(parsed.query, buildSssqlRefreshFilters(beforeBranches, parameters));
137
+ }
138
+ catch (error) {
139
+ const detail = error instanceof Error ? error.message : String(error);
140
+ return {
141
+ sql,
142
+ applied,
143
+ skipped: beforeBranches.map(branch => buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", `SSSQL optional branch refresh was skipped because safe refresh could not be proven: ${detail}`)),
144
+ warnings: parsed.warnings,
145
+ errors: parsed.errors,
146
+ formatterGeneratedSource: parsed.formatterGeneratedSource
147
+ };
148
+ }
149
+ const afterBranches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
150
+ for (const branch of afterBranches) {
151
+ const previousSql = beforeBranchSql.get(branch.expression);
152
+ const previousQuery = beforeBranchQuery.get(branch.expression);
153
+ if (!previousSql || !previousQuery) {
154
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_UNSUPPORTED", "SSSQL optional branch refresh left an untracked branch unchanged."));
155
+ continue;
156
+ }
157
+ const refreshedSql = formatSqlComponent(branch.expression);
158
+ if (previousQuery !== branch.query || previousSql !== refreshedSql) {
159
+ applied.push(buildSssqlRefreshApplied(branch, previousSql));
160
+ continue;
161
+ }
162
+ skipped.push(buildSssqlRefreshSkipped(branch, "SSSQL_OPTIONAL_REFRESH_NOOP", "SSSQL optional branch refresh found no safe placement change to apply."));
163
+ }
164
+ return {
165
+ sql: applied.length > 0 ? formatSqlComponent(parsed.query) : sql,
166
+ applied,
167
+ skipped,
168
+ warnings: parsed.warnings,
169
+ errors: parsed.errors,
170
+ formatterGeneratedSource: parsed.formatterGeneratedSource
171
+ };
172
+ };
173
+ const runSssqlOptionalConditionPhase = (input, options) => {
174
+ var _a;
175
+ const parsed = parseConditionOptimizationInput(input);
176
+ const warnings = [...parsed.warnings];
177
+ let errors = [...parsed.errors];
178
+ const applied = [];
179
+ const skipped = [];
180
+ const optionalConditionParameters = (_a = options.optionalConditionParameters) !== null && _a !== void 0 ? _a : {};
181
+ if (!parsed.query) {
182
+ return {
183
+ sql: parsed.sql,
184
+ applied,
185
+ skipped,
186
+ warnings,
187
+ errors,
188
+ formatterGeneratedSource: parsed.formatterGeneratedSource
189
+ };
190
+ }
191
+ let currentSql = parsed.sql;
192
+ const branches = (0, PruneOptionalConditionBranches_1.collectSupportedOptionalConditionBranches)(parsed.query);
193
+ const pruneBranches = branches.filter(branch => hasOwnParameter(optionalConditionParameters, branch.parameterName)
194
+ && isAbsentOptionalValue(optionalConditionParameters, branch.parameterName));
195
+ if (pruneBranches.length > 0) {
196
+ try {
197
+ (0, PruneOptionalConditionBranches_1.pruneOptionalConditionBranches)(parsed.query, optionalConditionParameters);
198
+ currentSql = formatSqlComponent(parsed.query);
199
+ applied.push(...pruneBranches.map(buildSssqlApplied));
200
+ }
201
+ catch (error) {
202
+ errors = [...errors, {
203
+ phaseKind: "sssql_optional_condition",
204
+ code: "SSSQL_PRUNE_FAILED",
205
+ message: "SSSQL optional condition optimization could not prune optional branches.",
206
+ detail: error instanceof Error ? error.message : String(error)
207
+ }];
208
+ }
209
+ }
210
+ if (errors.length === 0) {
211
+ const refreshPhase = refreshRemainingSssqlBranches(currentSql, optionalConditionParameters);
212
+ applied.push(...refreshPhase.applied);
213
+ skipped.push(...refreshPhase.skipped);
214
+ warnings.push(...refreshPhase.warnings);
215
+ errors.push(...refreshPhase.errors);
216
+ currentSql = refreshPhase.sql;
217
+ }
218
+ else {
219
+ for (const branch of branches) {
220
+ if (pruneBranches.includes(branch)) {
221
+ continue;
222
+ }
223
+ skipped.push(buildSssqlSkipped(branch, optionalConditionParameters));
224
+ }
225
+ }
226
+ return {
227
+ sql: errors.length === 0 ? currentSql : parsed.sql,
228
+ applied,
229
+ skipped,
230
+ warnings,
231
+ errors,
232
+ formatterGeneratedSource: parsed.formatterGeneratedSource
233
+ };
234
+ };
235
+ const mapParameterWarnings = (warnings) => warnings.map(warning => ({
236
+ phaseKind: "parameter_condition_placement",
237
+ ...warning
238
+ }));
239
+ const mapParameterErrors = (errors) => errors.map(error => ({
240
+ phaseKind: "parameter_condition_placement",
241
+ ...error
242
+ }));
243
+ const mapParameterApplied = (applied) => applied.map(item => ({
244
+ phaseKind: "parameter_condition_placement",
245
+ ...item
246
+ }));
247
+ const mapParameterSkipped = (skipped) => skipped.map(item => ({
248
+ phaseKind: "parameter_condition_placement",
249
+ ...item
250
+ }));
251
+ const makePhaseSummary = (kind, counts) => ({
252
+ kind,
253
+ appliedCount: counts.appliedCount,
254
+ skippedCount: counts.skippedCount,
255
+ warningCount: counts.warningCount,
256
+ errorCount: counts.errorCount
257
+ });
258
+ const runConditionOptimization = (input, options, defaultDryRun) => {
259
+ var _a;
260
+ const dryRun = (_a = options.dryRun) !== null && _a !== void 0 ? _a : defaultDryRun;
261
+ // Run the semantic SSSQL phase before the generic placement phase so
262
+ // optional branches remain owned by SSSQL even if parameter placement grows
263
+ // broader OR-predicate support later.
264
+ const sssqlPhase = runSssqlOptionalConditionPhase(input, { ...options, dryRun });
265
+ const parameterPhase = dryRun
266
+ ? (0, ParameterConditionPlacementOptimizer_1.planParameterConditionOptimization)(sssqlPhase.sql, { dryRun })
267
+ : (0, ParameterConditionPlacementOptimizer_1.optimizeParameterConditionPlacement)(sssqlPhase.sql, { dryRun });
268
+ const parameterWarnings = mapParameterWarnings(parameterPhase.warnings);
269
+ const parameterErrors = mapParameterErrors(parameterPhase.errors);
270
+ const parameterApplied = mapParameterApplied(parameterPhase.applied);
271
+ const parameterSkipped = mapParameterSkipped(parameterPhase.skipped);
272
+ const warnings = [...sssqlPhase.warnings, ...parameterWarnings];
273
+ const errors = [...sssqlPhase.errors, ...parameterErrors];
274
+ return {
275
+ ok: errors.length === 0,
276
+ sql: parameterPhase.sql,
277
+ phases: [
278
+ makePhaseSummary("sssql_optional_condition", {
279
+ appliedCount: sssqlPhase.applied.length,
280
+ skippedCount: sssqlPhase.skipped.length,
281
+ warningCount: sssqlPhase.warnings.length,
282
+ errorCount: sssqlPhase.errors.length
283
+ }),
284
+ makePhaseSummary("parameter_condition_placement", {
285
+ appliedCount: parameterApplied.length,
286
+ skippedCount: parameterSkipped.length,
287
+ warningCount: parameterWarnings.length,
288
+ errorCount: parameterErrors.length
289
+ })
290
+ ],
291
+ applied: [...sssqlPhase.applied, ...parameterApplied],
292
+ skipped: [...sssqlPhase.skipped, ...parameterSkipped],
293
+ warnings,
294
+ errors,
295
+ safety: {
296
+ mode: "safe_only",
297
+ unsafeRewriteApplied: false,
298
+ dryRun,
299
+ formatterGeneratedSource: sssqlPhase.formatterGeneratedSource || parameterPhase.safety.formatterGeneratedSource
300
+ }
301
+ };
302
+ };
303
+ const planConditionOptimization = (input, options = {}) => {
304
+ return runConditionOptimization(input, options, true);
305
+ };
306
+ exports.planConditionOptimization = planConditionOptimization;
307
+ const optimizeConditions = (input, options = {}) => {
308
+ return runConditionOptimization(input, options, false);
309
+ };
310
+ exports.optimizeConditions = optimizeConditions;
311
+ //# sourceMappingURL=ConditionOptimization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConditionOptimization.js","sourceRoot":"","sources":["../../src/transformers/ConditionOptimization.ts"],"names":[],"mappings":";;;AAEA,oEAAiE;AACjE,iGAQgD;AAChD,qFAK0C;AAC1C,6DAA0D;AAC1D,iDAA8C;AAyF9C,MAAM,kBAAkB,GAAG,CAAC,SAA2D,EAAU,EAAE;IAC/F,OAAO,IAAI,2BAAY,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CACpB,UAA8C,EAC9C,aAAqB,EACd,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,C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