@memberjunction/sql-parser 6.2.0-edge.6 → 6.2.0-edge.8

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 (286) hide show
  1. package/README.md +392 -0
  2. package/dist/aggregateExpression.d.ts +5 -1
  3. package/dist/aggregateExpression.d.ts.map +1 -1
  4. package/dist/aggregateExpression.js +7 -420
  5. package/dist/aggregateExpression.js.map +1 -1
  6. package/dist/common/analysis.d.ts +48 -0
  7. package/dist/common/analysis.d.ts.map +1 -0
  8. package/dist/common/analysis.js +17 -0
  9. package/dist/common/analysis.js.map +1 -0
  10. package/dist/common/diagnosticCodes.d.ts +96 -0
  11. package/dist/common/diagnosticCodes.d.ts.map +1 -0
  12. package/dist/common/diagnosticCodes.js +99 -0
  13. package/dist/common/diagnosticCodes.js.map +1 -0
  14. package/dist/edit/clauseTransforms.d.ts +40 -0
  15. package/dist/edit/clauseTransforms.d.ts.map +1 -0
  16. package/dist/edit/clauseTransforms.js +161 -0
  17. package/dist/edit/clauseTransforms.js.map +1 -0
  18. package/dist/edit/cteTransforms.d.ts +68 -0
  19. package/dist/edit/cteTransforms.d.ts.map +1 -0
  20. package/dist/edit/cteTransforms.js +127 -0
  21. package/dist/edit/cteTransforms.js.map +1 -0
  22. package/dist/edit/editSet.d.ts +83 -0
  23. package/dist/edit/editSet.d.ts.map +1 -0
  24. package/dist/edit/editSet.js +185 -0
  25. package/dist/edit/editSet.js.map +1 -0
  26. package/dist/edit/transformSupport.d.ts +53 -0
  27. package/dist/edit/transformSupport.d.ts.map +1 -0
  28. package/dist/edit/transformSupport.js +67 -0
  29. package/dist/edit/transformSupport.js.map +1 -0
  30. package/dist/index.d.ts +49 -3
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +24 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/legacy/cteParenScan.d.ts +13 -0
  35. package/dist/legacy/cteParenScan.d.ts.map +1 -0
  36. package/dist/legacy/cteParenScan.js +120 -0
  37. package/dist/legacy/cteParenScan.js.map +1 -0
  38. package/dist/legacy/dialectResolution.d.ts +22 -0
  39. package/dist/legacy/dialectResolution.d.ts.map +1 -0
  40. package/dist/legacy/dialectResolution.js +55 -0
  41. package/dist/legacy/dialectResolution.js.map +1 -0
  42. package/dist/legacy/frozenCTEExtraction.d.ts +10 -0
  43. package/dist/legacy/frozenCTEExtraction.d.ts.map +1 -0
  44. package/dist/legacy/frozenCTEExtraction.js +38 -0
  45. package/dist/legacy/frozenCTEExtraction.js.map +1 -0
  46. package/dist/legacy/legacyExtractors.d.ts +54 -0
  47. package/dist/legacy/legacyExtractors.d.ts.map +1 -0
  48. package/dist/legacy/legacyExtractors.js +245 -0
  49. package/dist/legacy/legacyExtractors.js.map +1 -0
  50. package/dist/legacy/legacyTagContent.d.ts +29 -0
  51. package/dist/legacy/legacyTagContent.d.ts.map +1 -0
  52. package/dist/legacy/legacyTagContent.js +283 -0
  53. package/dist/legacy/legacyTagContent.js.map +1 -0
  54. package/dist/legacy/legacyTemplateExtractors.d.ts +31 -0
  55. package/dist/legacy/legacyTemplateExtractors.d.ts.map +1 -0
  56. package/dist/legacy/legacyTemplateExtractors.js +201 -0
  57. package/dist/legacy/legacyTemplateExtractors.js.map +1 -0
  58. package/dist/legacy/legacyTemplateTokens.d.ts +16 -0
  59. package/dist/legacy/legacyTemplateTokens.d.ts.map +1 -0
  60. package/dist/legacy/legacyTemplateTokens.js +80 -0
  61. package/dist/legacy/legacyTemplateTokens.js.map +1 -0
  62. package/dist/legacy/nodeSqlParserCore.d.ts +34 -0
  63. package/dist/legacy/nodeSqlParserCore.d.ts.map +1 -0
  64. package/dist/legacy/nodeSqlParserCore.js +251 -0
  65. package/dist/legacy/nodeSqlParserCore.js.map +1 -0
  66. package/dist/legacy/nodeSqlRowCap.d.ts +46 -0
  67. package/dist/legacy/nodeSqlRowCap.d.ts.map +1 -0
  68. package/dist/legacy/nodeSqlRowCap.js +72 -0
  69. package/dist/legacy/nodeSqlRowCap.js.map +1 -0
  70. package/dist/legacy/nonQueryReads.d.ts +28 -0
  71. package/dist/legacy/nonQueryReads.d.ts.map +1 -0
  72. package/dist/legacy/nonQueryReads.js +112 -0
  73. package/dist/legacy/nonQueryReads.js.map +1 -0
  74. package/dist/legacy/templateSqlViews.d.ts +32 -0
  75. package/dist/legacy/templateSqlViews.d.ts.map +1 -0
  76. package/dist/legacy/templateSqlViews.js +176 -0
  77. package/dist/legacy/templateSqlViews.js.map +1 -0
  78. package/dist/lexer/sqlTokenTypes.d.ts +67 -0
  79. package/dist/lexer/sqlTokenTypes.d.ts.map +1 -0
  80. package/dist/lexer/sqlTokenTypes.js +2 -0
  81. package/dist/lexer/sqlTokenTypes.js.map +1 -0
  82. package/dist/lexer/sqlTokens.d.ts +53 -0
  83. package/dist/lexer/sqlTokens.d.ts.map +1 -0
  84. package/dist/lexer/sqlTokens.js +267 -0
  85. package/dist/lexer/sqlTokens.js.map +1 -0
  86. package/dist/lexer/templateTagScanner.d.ts +32 -0
  87. package/dist/lexer/templateTagScanner.d.ts.map +1 -0
  88. package/dist/lexer/templateTagScanner.js +69 -0
  89. package/dist/lexer/templateTagScanner.js.map +1 -0
  90. package/dist/orderByAnalyzer.d.ts +5 -0
  91. package/dist/orderByAnalyzer.d.ts.map +1 -1
  92. package/dist/orderByAnalyzer.js +5 -0
  93. package/dist/orderByAnalyzer.js.map +1 -1
  94. package/dist/pagingShape.d.ts +4 -1
  95. package/dist/pagingShape.d.ts.map +1 -1
  96. package/dist/pagingShape.js +4 -1
  97. package/dist/pagingShape.js.map +1 -1
  98. package/dist/sql/analyses/analysisTypes.d.ts +124 -0
  99. package/dist/sql/analyses/analysisTypes.d.ts.map +1 -0
  100. package/dist/sql/analyses/analysisTypes.js +2 -0
  101. package/dist/sql/analyses/analysisTypes.js.map +1 -0
  102. package/dist/sql/analyses/columnAnalyses.d.ts +18 -0
  103. package/dist/sql/analyses/columnAnalyses.d.ts.map +1 -0
  104. package/dist/sql/analyses/columnAnalyses.js +138 -0
  105. package/dist/sql/analyses/columnAnalyses.js.map +1 -0
  106. package/dist/sql/analyses/structureAnalyses.d.ts +31 -0
  107. package/dist/sql/analyses/structureAnalyses.d.ts.map +1 -0
  108. package/dist/sql/analyses/structureAnalyses.js +201 -0
  109. package/dist/sql/analyses/structureAnalyses.js.map +1 -0
  110. package/dist/sql/parser/fromParser.d.ts +45 -0
  111. package/dist/sql/parser/fromParser.d.ts.map +1 -0
  112. package/dist/sql/parser/fromParser.js +342 -0
  113. package/dist/sql/parser/fromParser.js.map +1 -0
  114. package/dist/sql/parser/parseContext.d.ts +72 -0
  115. package/dist/sql/parser/parseContext.d.ts.map +1 -0
  116. package/dist/sql/parser/parseContext.js +197 -0
  117. package/dist/sql/parser/parseContext.js.map +1 -0
  118. package/dist/sql/parser/queryParser.d.ts +45 -0
  119. package/dist/sql/parser/queryParser.d.ts.map +1 -0
  120. package/dist/sql/parser/queryParser.js +267 -0
  121. package/dist/sql/parser/queryParser.js.map +1 -0
  122. package/dist/sql/parser/selectParser.d.ts +47 -0
  123. package/dist/sql/parser/selectParser.d.ts.map +1 -0
  124. package/dist/sql/parser/selectParser.js +353 -0
  125. package/dist/sql/parser/selectParser.js.map +1 -0
  126. package/dist/sql/parser/tailParser.d.ts +25 -0
  127. package/dist/sql/parser/tailParser.d.ts.map +1 -0
  128. package/dist/sql/parser/tailParser.js +180 -0
  129. package/dist/sql/parser/tailParser.js.map +1 -0
  130. package/dist/sql/sqlDiagnosticCodes.d.ts +27 -0
  131. package/dist/sql/sqlDiagnosticCodes.d.ts.map +1 -0
  132. package/dist/sql/sqlDiagnosticCodes.js +25 -0
  133. package/dist/sql/sqlDiagnosticCodes.js.map +1 -0
  134. package/dist/sql/sqlDocument.d.ts +103 -0
  135. package/dist/sql/sqlDocument.d.ts.map +1 -0
  136. package/dist/sql/sqlDocument.js +178 -0
  137. package/dist/sql/sqlDocument.js.map +1 -0
  138. package/dist/sql/sqlExpression.d.ts +74 -0
  139. package/dist/sql/sqlExpression.d.ts.map +1 -0
  140. package/dist/sql/sqlExpression.js +313 -0
  141. package/dist/sql/sqlExpression.js.map +1 -0
  142. package/dist/sql/sqlKeywords.d.ts +38 -0
  143. package/dist/sql/sqlKeywords.d.ts.map +1 -0
  144. package/dist/sql/sqlKeywords.js +85 -0
  145. package/dist/sql/sqlKeywords.js.map +1 -0
  146. package/dist/sql/sqlNodes.d.ts +360 -0
  147. package/dist/sql/sqlNodes.d.ts.map +1 -0
  148. package/dist/sql/sqlNodes.js +2 -0
  149. package/dist/sql/sqlNodes.js.map +1 -0
  150. package/dist/sql/sqlScope.d.ts +108 -0
  151. package/dist/sql/sqlScope.d.ts.map +1 -0
  152. package/dist/sql/sqlScope.js +307 -0
  153. package/dist/sql/sqlScope.js.map +1 -0
  154. package/dist/sql/sqlWalker.d.ts +17 -0
  155. package/dist/sql/sqlWalker.d.ts.map +1 -0
  156. package/dist/sql/sqlWalker.js +113 -0
  157. package/dist/sql/sqlWalker.js.map +1 -0
  158. package/dist/sql/tokenTable.d.ts +58 -0
  159. package/dist/sql/tokenTable.d.ts.map +1 -0
  160. package/dist/sql/tokenTable.js +158 -0
  161. package/dist/sql/tokenTable.js.map +1 -0
  162. package/dist/sql-parser.d.ts +146 -194
  163. package/dist/sql-parser.d.ts.map +1 -1
  164. package/dist/sql-parser.js +173 -1272
  165. package/dist/sql-parser.js.map +1 -1
  166. package/dist/sqlLexer.d.ts +18 -13
  167. package/dist/sqlLexer.d.ts.map +1 -1
  168. package/dist/sqlLexer.js +152 -50
  169. package/dist/sqlLexer.js.map +1 -1
  170. package/dist/sqlShape.d.ts +11 -2
  171. package/dist/sqlShape.d.ts.map +1 -1
  172. package/dist/sqlShape.js +64 -8
  173. package/dist/sqlShape.js.map +1 -1
  174. package/dist/strict/aggregateRenderer.d.ts +28 -0
  175. package/dist/strict/aggregateRenderer.d.ts.map +1 -0
  176. package/dist/strict/aggregateRenderer.js +451 -0
  177. package/dist/strict/aggregateRenderer.js.map +1 -0
  178. package/dist/strict/statementReads.d.ts +34 -0
  179. package/dist/strict/statementReads.d.ts.map +1 -0
  180. package/dist/strict/statementReads.js +252 -0
  181. package/dist/strict/statementReads.js.map +1 -0
  182. package/dist/strict/strictDialect.d.ts +12 -0
  183. package/dist/strict/strictDialect.d.ts.map +1 -0
  184. package/dist/strict/strictDialect.js +37 -0
  185. package/dist/strict/strictDialect.js.map +1 -0
  186. package/dist/strict/strictFragmentValidator.d.ts +68 -0
  187. package/dist/strict/strictFragmentValidator.d.ts.map +1 -0
  188. package/dist/strict/strictFragmentValidator.js +156 -0
  189. package/dist/strict/strictFragmentValidator.js.map +1 -0
  190. package/dist/strict/strictTypes.d.ts +116 -0
  191. package/dist/strict/strictTypes.d.ts.map +1 -0
  192. package/dist/strict/strictTypes.js +2 -0
  193. package/dist/strict/strictTypes.js.map +1 -0
  194. package/dist/strict/treeFacts.d.ts +28 -0
  195. package/dist/strict/treeFacts.d.ts.map +1 -0
  196. package/dist/strict/treeFacts.js +162 -0
  197. package/dist/strict/treeFacts.js.map +1 -0
  198. package/dist/structuralParser.d.ts +2 -0
  199. package/dist/structuralParser.d.ts.map +1 -1
  200. package/dist/structuralParser.js +6 -4
  201. package/dist/structuralParser.js.map +1 -1
  202. package/dist/template/branchEvaluator.d.ts +51 -0
  203. package/dist/template/branchEvaluator.d.ts.map +1 -0
  204. package/dist/template/branchEvaluator.js +194 -0
  205. package/dist/template/branchEvaluator.js.map +1 -0
  206. package/dist/template/branchVariants.d.ts +79 -0
  207. package/dist/template/branchVariants.d.ts.map +1 -0
  208. package/dist/template/branchVariants.js +273 -0
  209. package/dist/template/branchVariants.js.map +1 -0
  210. package/dist/template/compositionParser.d.ts +18 -0
  211. package/dist/template/compositionParser.d.ts.map +1 -0
  212. package/dist/template/compositionParser.js +131 -0
  213. package/dist/template/compositionParser.js.map +1 -0
  214. package/dist/template/compositionPathMatch.d.ts +46 -0
  215. package/dist/template/compositionPathMatch.d.ts.map +1 -0
  216. package/dist/template/compositionPathMatch.js +50 -0
  217. package/dist/template/compositionPathMatch.js.map +1 -0
  218. package/dist/template/compositionReferences.d.ts +26 -0
  219. package/dist/template/compositionReferences.d.ts.map +1 -0
  220. package/dist/template/compositionReferences.js +21 -0
  221. package/dist/template/compositionReferences.js.map +1 -0
  222. package/dist/template/compositionRules.d.ts +42 -0
  223. package/dist/template/compositionRules.d.ts.map +1 -0
  224. package/dist/template/compositionRules.js +132 -0
  225. package/dist/template/compositionRules.js.map +1 -0
  226. package/dist/template/docComments.d.ts +45 -0
  227. package/dist/template/docComments.d.ts.map +1 -0
  228. package/dist/template/docComments.js +115 -0
  229. package/dist/template/docComments.js.map +1 -0
  230. package/dist/template/expressionLexer.d.ts +28 -0
  231. package/dist/template/expressionLexer.d.ts.map +1 -0
  232. package/dist/template/expressionLexer.js +85 -0
  233. package/dist/template/expressionLexer.js.map +1 -0
  234. package/dist/template/expressionParser.d.ts +106 -0
  235. package/dist/template/expressionParser.d.ts.map +1 -0
  236. package/dist/template/expressionParser.js +419 -0
  237. package/dist/template/expressionParser.js.map +1 -0
  238. package/dist/template/expressionTypes.d.ts +111 -0
  239. package/dist/template/expressionTypes.d.ts.map +1 -0
  240. package/dist/template/expressionTypes.js +25 -0
  241. package/dist/template/expressionTypes.js.map +1 -0
  242. package/dist/template/parameterAnalysis.d.ts +81 -0
  243. package/dist/template/parameterAnalysis.d.ts.map +1 -0
  244. package/dist/template/parameterAnalysis.js +130 -0
  245. package/dist/template/parameterAnalysis.js.map +1 -0
  246. package/dist/template/queryLanguage.d.ts +33 -0
  247. package/dist/template/queryLanguage.d.ts.map +1 -0
  248. package/dist/template/queryLanguage.js +56 -0
  249. package/dist/template/queryLanguage.js.map +1 -0
  250. package/dist/template/queryTemplate.d.ts +72 -0
  251. package/dist/template/queryTemplate.d.ts.map +1 -0
  252. package/dist/template/queryTemplate.js +147 -0
  253. package/dist/template/queryTemplate.js.map +1 -0
  254. package/dist/template/sqlPosition.d.ts +24 -0
  255. package/dist/template/sqlPosition.d.ts.map +1 -0
  256. package/dist/template/sqlPosition.js +93 -0
  257. package/dist/template/sqlPosition.js.map +1 -0
  258. package/dist/template/templateNodes.d.ts +114 -0
  259. package/dist/template/templateNodes.d.ts.map +1 -0
  260. package/dist/template/templateNodes.js +38 -0
  261. package/dist/template/templateNodes.js.map +1 -0
  262. package/dist/template/templateTreeBuilder.d.ts +56 -0
  263. package/dist/template/templateTreeBuilder.d.ts.map +1 -0
  264. package/dist/template/templateTreeBuilder.js +302 -0
  265. package/dist/template/templateTreeBuilder.js.map +1 -0
  266. package/dist/template/templateWalker.d.ts +62 -0
  267. package/dist/template/templateWalker.d.ts.map +1 -0
  268. package/dist/template/templateWalker.js +122 -0
  269. package/dist/template/templateWalker.js.map +1 -0
  270. package/dist/template/trailingDocComments.d.ts +35 -0
  271. package/dist/template/trailingDocComments.d.ts.map +1 -0
  272. package/dist/template/trailingDocComments.js +146 -0
  273. package/dist/template/trailingDocComments.js.map +1 -0
  274. package/dist/template/validationTypes.d.ts +77 -0
  275. package/dist/template/validationTypes.d.ts.map +1 -0
  276. package/dist/template/validationTypes.js +2 -0
  277. package/dist/template/validationTypes.js.map +1 -0
  278. package/dist/template/valueRules.d.ts +55 -0
  279. package/dist/template/valueRules.d.ts.map +1 -0
  280. package/dist/template/valueRules.js +238 -0
  281. package/dist/template/valueRules.js.map +1 -0
  282. package/package.json +2 -2
  283. package/dist/ASTDialectAdapter.d.ts +0 -60
  284. package/dist/ASTDialectAdapter.d.ts.map +0 -1
  285. package/dist/ASTDialectAdapter.js +0 -117
  286. package/dist/ASTDialectAdapter.js.map +0 -1
@@ -14,8 +14,11 @@
14
14
  */
15
15
  import NodeSqlParser from 'node-sql-parser';
16
16
  import type { SQLParserDialect } from '@memberjunction/sql-dialect';
17
- import { type RowCapInfo } from './ASTDialectAdapter.js';
17
+ import { type RowCapInfo } from './legacy/nodeSqlRowCap.js';
18
+ import type { LexDialect } from './sqlLexer.js';
19
+ import type { CheckedColumnReferences, CheckedSelectColumns } from './legacy/legacyExtractors.js';
18
20
  import { MJToken, MJTemplateExpr, MJCompositionRef, MJConditionalBlock, MJFilter, PlaceholderEntry, PlaceholderSubstitutionResult, MJParseResult, MJASTWalkResult } from './mj-ast-types.js';
21
+ export type { CheckedColumnReferences, CheckedSelectColumns } from './legacy/legacyExtractors.js';
19
22
  /** Result of Astify — the full parsed representation of MJ SQL */
20
23
  export interface MJAstifyResult {
21
24
  /** The node-sql-parser AST of the placeholder-substituted SQL (null if parsing failed) */
@@ -117,11 +120,11 @@ export type SQLStatementKind =
117
120
  | 'other';
118
121
  /**
119
122
  * Dialect-neutral description of the outermost row cap on a parsed SELECT.
120
- * Defined in {@link ./ASTDialectAdapter}; re-exported here so consumers can
121
- * import it from `@memberjunction/sql-parser` without referencing the adapter.
123
+ * Defined in `legacy/nodeSqlRowCap`; re-exported here so consumers can
124
+ * import it from `@memberjunction/sql-parser`.
122
125
  * Returned by {@link SQLParser.OuterCap}.
123
126
  */
124
- export type { RowCapInfo } from './ASTDialectAdapter.js';
127
+ export type { RowCapInfo } from './legacy/nodeSqlRowCap.js';
125
128
  /**
126
129
  * Unified parser for MemberJunction's SQL superset.
127
130
  *
@@ -142,7 +145,8 @@ export type { RowCapInfo } from './ASTDialectAdapter.js';
142
145
  export declare class SQLParser {
143
146
  private readonly _sql;
144
147
  private readonly _dialect;
145
- private readonly _adapter;
148
+ /** The AST field the dialect's grammar keeps the row cap on. */
149
+ private readonly _rowCapField;
146
150
  private readonly _ast;
147
151
  /** alias → original bracketed identifier; set when bracket preprocessing was applied */
148
152
  private readonly _aliasMap;
@@ -159,35 +163,44 @@ export declare class SQLParser {
159
163
  * transparently restores both transforms.
160
164
  *
161
165
  * Never throws on unparseable SQL — check {@link IsValid}.
166
+ * @deprecated Use `SqlDocument.Parse(sql, dialect)` to read a statement, and `StrictFragmentValidator` to screen untrusted SQL.
162
167
  */
163
168
  constructor(sql: string, dialect: SQLParserDialect);
164
- /** Whether the SQL parsed into an AST (directly or via preprocessing). */
169
+ /**
170
+ * Whether the SQL parsed into an AST (directly or via preprocessing).
171
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).IsComplete`, or `StrictFragmentValidator` to screen untrusted SQL.
172
+ */
165
173
  get IsValid(): boolean;
166
- /** The raw AST. Prefer the typed accessors; this is an escape hatch. */
174
+ /**
175
+ * The raw AST. Prefer the typed accessors; this is an escape hatch.
176
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
177
+ */
167
178
  get AST(): NodeSqlParser.AST | NodeSqlParser.AST[] | null;
168
179
  /**
169
180
  * The bracket identifiers the fallback parse renamed, as the name in {@link AST} mapped to the
170
181
  * original bracketed text (for example `[My CTE]`). Null when the direct parse succeeded, so
171
182
  * every identifier in the tree is as written. A name in this map is in the tree only where the
172
183
  * fallback put it: no such name occurs in the SQL, and none runs into the text next to it.
184
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
173
185
  */
174
186
  get IdentifierAliases(): ReadonlyMap<string, string> | null;
175
187
  /**
176
188
  * True when `name` has the form of a name the fallback parse gives a renamed bracket
177
189
  * identifier ({@link IdentifierAliases}), ignoring case: `_mjid_<n>`, or `_mjid<k>_<n>` when
178
190
  * the SQL already contains `_mjid_`.
191
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
179
192
  */
180
193
  static IsIdentifierAliasName(name: string): boolean;
181
- /** The dialect supplied at construction. */
194
+ /**
195
+ * The dialect supplied at construction.
196
+ * @deprecated Use `SqlDocument.Dialect`.
197
+ */
182
198
  get Dialect(): SQLParserDialect;
183
- /** The SQL supplied at construction, as written. */
184
- get SQL(): string;
185
199
  /**
186
- * Fixes a known node-sql-parser bug where CAST(x AS NVARCHAR(MAX)) is
187
- * serialized as CAST(x AS NVARCHARmax). Applies to NVARCHAR, VARCHAR,
188
- * and VARBINARY — all SQL Server types that accept (MAX).
200
+ * The SQL supplied at construction, as written.
201
+ * @deprecated Use `SqlDocument.Text()`.
189
202
  */
190
- private static fixMaxTypeSerialization;
203
+ get SQL(): string;
191
204
  /**
192
205
  * Parse MJ SQL into an extended AST.
193
206
  *
@@ -198,6 +211,7 @@ export declare class SQLParser {
198
211
  *
199
212
  * @param sql The MJ SQL string to parse
200
213
  * @param dialect SQL dialect ('TransactSQL' | 'PostgresQL', default: 'TransactSQL')
214
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
201
215
  */
202
216
  static Astify(sql: string, dialect: SQLParserDialect): MJAstifyResult;
203
217
  /**
@@ -205,22 +219,26 @@ export declare class SQLParser {
205
219
  *
206
220
  * For plain SQL: uses node-sql-parser's sqlify for normalized output.
207
221
  * For MJ SQL: reconstructs from tokens, preserving all Nunjucks and composition syntax verbatim.
222
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
208
223
  */
209
224
  static Sqlify(result: MJAstifyResult): string;
210
225
  /**
211
226
  * Parse plain SQL into a node-sql-parser AST.
212
227
  * Handles FOR XML multi-directive workaround automatically.
213
228
  * Returns null if parsing fails.
229
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`. To refuse unparseable caller SQL, use `StrictFragmentValidator`.
214
230
  */
215
231
  static ParseSQL(sql: string, dialect: SQLParserDialect): NodeSqlParser.AST | NodeSqlParser.AST[] | null;
216
232
  /**
217
233
  * Convert a node-sql-parser AST (or array of ASTs) back to a SQL string.
218
234
  * This is a thin wrapper around node-sql-parser's sqlify.
235
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
219
236
  */
220
237
  static SqlifyAST(ast: NodeSqlParser.AST | NodeSqlParser.AST[], dialect: SQLParserDialect): string;
221
238
  /**
222
239
  * High-level classification of the parsed statement:
223
240
  * `'select'` | `'select-into'` | `'set-op'` | `'mutation'` | `'other'`.
241
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).StatementKinds()`.
224
242
  */
225
243
  get StatementKind(): SQLStatementKind;
226
244
  /**
@@ -240,18 +258,21 @@ export declare class SQLParser {
240
258
  * `DECLARE`) and SELECTs are not writes. Matching is on the AST statement
241
259
  * type, so the `REPLACE()` string function inside a SELECT is never
242
260
  * mistaken for a `REPLACE` statement.
261
+ * @deprecated Must not be used to decide whether SQL is safe to run: it returns false whenever node-sql-parser cannot parse the SQL, so a write it cannot read passes. Use `SqlDocument.Parse(sql, dialect).IsReadOnly()` (fails closed) or `StrictFragmentValidator.ValidateReadOnlyStatement`.
243
262
  */
244
263
  get HasWriteStatement(): boolean;
245
264
  /**
246
265
  * The outermost row cap on the parsed SELECT, dialect-neutral, or `null`
247
- * when none is present. Backed by the dialect's ASTDialectAdapter, so the
266
+ * when none is present. Read from the AST field the dialect's grammar uses, so the
248
267
  * caller never needs to know whether the cap was a `TOP` or `LIMIT`.
268
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).RowCaps()` or `AnalyzePagingShape`.
249
269
  */
250
270
  get OuterCap(): RowCapInfo | null;
251
271
  /**
252
- * Sets the outermost row cap. The adapter writes the dialect's form
272
+ * Sets the outermost row cap, in the dialect's form
253
273
  * (`TOP N` on SQL Server, `LIMIT N` elsewhere), preserving any existing
254
274
  * OFFSET. No-op when the root isn't a SELECT.
275
+ * @deprecated Use the `SetRowCap` transform, which edits the SQL text as written.
255
276
  */
256
277
  SetOuterCap(cap: number): void;
257
278
  /**
@@ -262,6 +283,7 @@ export declare class SQLParser {
262
283
  * paged query's count reflects the full set rather than the capped subset.
263
284
  * It clears both forms, so a PostgreSQL count drops an explicit `LIMIT` —
264
285
  * consistent with how SQL Server's `TOP` is dropped.
286
+ * @deprecated Use the `SetRowCap` / `ReplaceSelectList` transforms, which edit the SQL text as written.
265
287
  */
266
288
  ClearOuterCap(): void;
267
289
  /**
@@ -272,6 +294,7 @@ export declare class SQLParser {
272
294
  *
273
295
  * Used by the count-SQL builder: ORDER BY is irrelevant for a COUNT and is
274
296
  * illegal inside a SQL Server CTE without TOP.
297
+ * @deprecated Use the `StripOrderBy` transform, which removes exactly the ORDER BY span.
275
298
  */
276
299
  ClearOrderBy(): void;
277
300
  /**
@@ -280,6 +303,7 @@ export declare class SQLParser {
280
303
  * aliases, then the trailing `OPTION (...)` clause).
281
304
  *
282
305
  * Throws if the SQL was not parseable (check {@link IsValid} first).
306
+ * @deprecated Use `EditSet.Apply()` on the original text; this regenerates the SQL from the node-sql-parser tree.
283
307
  */
284
308
  ToSQL(): string;
285
309
  /**
@@ -297,6 +321,7 @@ export declare class SQLParser {
297
321
  * Only the top level of the statement counts. The same words inside a subquery (a correlated
298
322
  * `(SELECT … FOR JSON PATH)` column), a string literal, a quoted identifier or a comment do
299
323
  * not stop a wrap.
324
+ * @deprecated Use `SqlDocument.Parse(sql, dialect)`: its top-level query exposes the `For` and `Option` tail clauses.
300
325
  */
301
326
  static HasUnwrappableTrailingClause(sql: string, dialect: SQLParserDialect): boolean;
302
327
  /**
@@ -315,8 +340,9 @@ export declare class SQLParser {
315
340
  * DELAY '…'`), which is exactly the stacked-injection class an AST scan
316
341
  * misses (the whole string fails to parse, so the AST is null). A rendered
317
342
  * read query must be a single statement, so any internal `;` is rejected.
343
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).HasStackedStatements()`.
318
344
  */
319
- static HasStackedStatements(sql: string, dialect: SQLParserDialect): boolean;
345
+ static HasStackedStatements(sql: string, dialect: LexDialect): boolean;
320
346
  /**
321
347
  * Strip line and block comments from SQL, preserving content inside string literals and
322
348
  * quoted identifiers. Block comments nest. A block comment is replaced by a space, so two
@@ -325,8 +351,9 @@ export declare class SQLParser {
325
351
  * The dialect determines which literal and identifier forms are recognized: SQL Server
326
352
  * `[…]`, PostgreSQL `E'…'` and dollar-quoted strings (`$$…$$`, `$tag$…$tag$`), MySQL
327
353
  * `` `…` ``. Double-quoted identifiers are honored on every dialect.
354
+ * @deprecated Use `SqlTokens.Lex(sql, dialect)` and keep the tokens that are not comments.
328
355
  */
329
- static StripComments(sql: string, dialect: SQLParserDialect): string;
356
+ static StripComments(sql: string, dialect: LexDialect): string;
330
357
  /**
331
358
  * Convert a single AST expression node to a SQL string.
332
359
  * Useful for extracting ORDER BY terms, column expressions, etc.
@@ -334,17 +361,20 @@ export declare class SQLParser {
334
361
  * node-sql-parser's exprToSQL always produces backtick-quoted identifiers
335
362
  * regardless of dialect. This method converts backticks to the dialect's
336
363
  * native identifier quoting via `dialect.QuoteIdentifier()`.
364
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`.
337
365
  */
338
366
  static ExprToSQL(expr: unknown, dialect: SQLParserDialect): string;
339
367
  /**
340
368
  * Tokenize MJ SQL into an ordered list of tokens.
341
369
  * Returns MJ tokens (template expressions, composition refs, block tags, comments)
342
370
  * interleaved with SQL_TEXT tokens for the plain SQL segments.
371
+ * @deprecated Kept unchanged for callers that splice by its offsets; it reports tags inside SQL comments too. Use `QueryTemplate.Parse(sql, dialect)` (its `Nodes` and `Tokens`).
343
372
  */
344
373
  static Tokenize(sql: string): MJToken[];
345
374
  /**
346
375
  * Tokenize and return a summary with boolean flags.
347
376
  * Useful for quick checks like "does this SQL have MJ extensions?"
377
+ * @deprecated Kept unchanged, paired with `Substitute`. Use `SqlTokens.Lex(sql, dialect).HasTemplate` and `QueryTemplate.Parse(sql, dialect)`.
348
378
  */
349
379
  static Analyze(sql: string): MJParseResult;
350
380
  /**
@@ -353,104 +383,131 @@ export declare class SQLParser {
353
383
  * Context-aware: `sqlString` → string literal, `sqlNumber` → numeric literal,
354
384
  * `sqlIdentifier` → bare identifier. Block tags and comments are stripped.
355
385
  * Returns a position map for reversing the substitution.
386
+ * @deprecated Kept unchanged, paired with `Astify`. Read templates with `QueryTemplate.Parse(sql, dialect)`.
356
387
  */
357
388
  static Substitute(sql: string): PlaceholderSubstitutionResult;
358
389
  /**
359
- * Parse SQL and extract table + column references.
360
- * This is the original SQLParser.Parse() method signature.
361
- * Automatically handles MJ Nunjucks templates via placeholder substitution.
390
+ * Parses SQL and extracts its table and column references. A template is read branch by
391
+ * branch: the result is the union of every branch's references.
392
+ *
393
+ * - `Tables`: as {@link ExtractTableRefs}.
394
+ * - `Columns`: as {@link ExtractColumnRefs} (empty when the SQL could not be read completely).
395
+ * - `UsedASTParsing`: true when every reading of the SQL parsed completely.
362
396
  *
363
- * @param options Parse options, or just a SQL string for backward compatibility
397
+ * @param options Parse options, or just a SQL string
398
+ * @param dialect The dialect, when `options` is a string; SQL Server when omitted
399
+ * @deprecated Use `SqlDocument.Parse(sql, dialect)` and its `TableReferences()` and
400
+ * `ColumnReferences()`, with `QueryTemplate` for templated SQL.
364
401
  */
365
402
  static Parse(options: SQLParseOptions | string, dialect?: SQLParserDialect): SQLParseResult;
366
403
  /**
367
- * Parse SQL with MJ Nunjucks template preprocessing.
368
- * This is the original SQLParser.ParseWithTemplatePreprocessing() signature.
369
- * Now equivalent to Parse() since all methods handle templates automatically.
404
+ * The same as {@link Parse}, which reads templates itself.
370
405
  *
371
- * @param options Parse options, or just a SQL string for backward compatibility
406
+ * @param options Parse options, or just a SQL string
407
+ * @param dialect The dialect, when `options` is a string; SQL Server when omitted
408
+ * @deprecated Use `SqlDocument.Parse(sql, dialect)`, with `QueryTemplate` for templated SQL.
372
409
  */
373
410
  static ParseWithTemplatePreprocessing(options: SQLParseOptions | string, dialect?: SQLParserDialect): SQLParseResult;
374
411
  /**
375
412
  * Extract all table/view references from this instance's SQL.
376
413
  * Convenience delegate to the static overload.
414
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).TableReferences()`.
377
415
  */
378
416
  ExtractTableRefs(): SQLTableReference[];
379
417
  /**
380
- * Extract all table/view references from SQL.
381
- * Handles Nunjucks templates via placeholder substitution before AST parsing.
418
+ * The tables and views the SQL reads, anywhere in the statement (subqueries and CTE bodies
419
+ * included), one entry per schema and table:
420
+ *
421
+ * - a CTE reference, a table-valued function and a derived table are not tables;
422
+ * - names inside comments and string literals are never read, nor are the `FROM` words of
423
+ * `EXTRACT(… FROM …)`, `TRIM(… FROM …)` and `IS DISTINCT FROM`;
424
+ * - an unqualified name gets the dialect's default schema (`dbo` on SQL Server, `public` on
425
+ * PostgreSQL), so `SchemaName` is always set;
426
+ * - a template is read branch by branch, and the tables of every branch are reported; a
427
+ * `{{query:"…"}}` composition is not a table.
428
+ *
429
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).TableReferences()`, which returns `null`
430
+ * for an unwritten schema and marks CTE and function references by `Kind`.
382
431
  */
383
432
  static ExtractTableRefs(sql: string, dialect: SQLParserDialect): SQLTableReference[];
384
433
  /**
385
434
  * Extract all column references from this instance's SQL.
386
435
  * Convenience delegate to the static overload.
436
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).ColumnReferences()`.
387
437
  */
388
438
  ExtractColumnRefs(): SQLColumnReference[];
389
439
  /**
390
- * Extract all column references from SQL.
391
- * Handles Nunjucks templates via placeholder substitution before AST parsing.
440
+ * Every identifier path that can be a column, in every clause (select list, joins, WHERE,
441
+ * GROUP BY, HAVING, ORDER BY, window and `WITHIN GROUP` clauses, subqueries), as
442
+ * `{ ColumnName, TableQualifier }`, one entry per written `qualifier.column`. A template is
443
+ * read branch by branch. Returns `[]` when the SQL cannot be read completely; use
444
+ * {@link ExtractColumnRefsChecked} to tell that apart from SQL with no column references.
445
+ *
446
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).ColumnReferences()`, which also binds each
447
+ * reference to its source.
392
448
  */
393
449
  static ExtractColumnRefs(sql: string, dialect: SQLParserDialect): SQLColumnReference[];
450
+ /**
451
+ * {@link ExtractColumnRefs}, with whether the SQL could be read completely: `Complete: false`
452
+ * (and no columns) means the parse failed, not that the SQL names no column.
453
+ */
454
+ static ExtractColumnRefsChecked(sql: string, dialect: SQLParserDialect): CheckedColumnReferences;
394
455
  /**
395
456
  * Extract SELECT clause columns from this instance's SQL.
396
457
  * Convenience delegate to the static overload.
458
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).OutputItems()`.
397
459
  */
398
460
  ExtractSelectColumns(): SQLSelectColumn[];
399
461
  /**
400
- * Extracts the SELECT clause columns with their output names, source columns, and table qualifiers.
401
- *
402
- * Handles:
462
+ * Extracts the first statement's SELECT columns with their output names, source columns, and
463
+ * table qualifiers (for a set operation, the first branch's):
403
464
  * - Simple columns: `u.Name` → { OutputName: "Name", SourceColumn: "Name", TableQualifier: "u" }
404
- * - AS aliases: `e.Name AS EntityName` → { OutputName: "EntityName", SourceColumn: "Name", TableQualifier: "e" }
405
- * - Expressions: `COUNT(*)` → { OutputName: "COUNT(*)", SourceColumn: "COUNT(*)", IsExpression: true }
406
- * - MJ template tokens are replaced with placeholders before AST parsing.
465
+ * - Aliases (`AS a`, `a = expr` on SQL Server): `e.Name AS EntityName` → { OutputName: "EntityName", SourceColumn: "Name", TableQualifier: "e" }
466
+ * - Expressions: `COUNT(*)` → { OutputName: "COUNT(...)", SourceColumn: "COUNT(...)", IsExpression: true }; other unnamed expressions are `EXPR`
467
+ * - Stars: `*` and `t.*` → OutputName `*`, with `t` as the qualifier
468
+ *
469
+ * A template is read through its base render (every first branch). Returns `[]` when the SQL
470
+ * cannot be read completely; use {@link ExtractSelectColumnsChecked} to tell that apart from a
471
+ * statement with no select list.
472
+ *
473
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).OutputItems()`.
407
474
  */
408
475
  static ExtractSelectColumns(sql: string, dialect: SQLParserDialect): SQLSelectColumn[];
409
476
  /**
410
- * Walks an AST statement node to extract SELECT clause column definitions.
477
+ * {@link ExtractSelectColumns}, with whether the SQL could be read completely: `Complete:
478
+ * false` (and no columns) means the parse failed, not that the statement has no select list.
411
479
  */
412
- private static extractSelectColumnsFromAST;
413
- /**
414
- * Unwraps an AST identifier node to a plain string.
415
- * node-sql-parser represents PostgreSQL double-quoted identifiers as
416
- * `{ expr: { type: 'double_quote_string', value: 'Name' } }` instead
417
- * of a plain string `'Name'`. This helper normalizes both representations.
418
- */
419
- private static unwrapIdentifier;
420
- /**
421
- * Best-effort string representation of an AST expression node (for expression columns).
422
- */
423
- private static exprToString;
480
+ static ExtractSelectColumnsChecked(sql: string, dialect: SQLParserDialect): CheckedSelectColumns;
424
481
  /**
425
482
  * Extract CTE definitions from this instance's SQL.
426
483
  * Convenience delegate to the static overload.
484
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).CTEs()` or `SplitLeadingCTEs`.
427
485
  */
428
486
  ExtractCTEs(): SQLCTEExtraction | null;
429
487
  /**
430
- * Extract CTE definitions from SQL starting with a WITH clause.
488
+ * Splits a statement that starts with a WITH clause (after any leading comments) into its CTE
489
+ * definitions and the main statement, as written.
431
490
  *
432
491
  * Given: `WITH A AS (SELECT 1), B AS (SELECT 2) SELECT A.x, B.y FROM A, B`
433
- * Returns: CTEDefinitions: ["A AS (...)", "B AS (...)"], MainStatement: "SELECT ..."
492
+ * Returns: CTEDefinitions: ["A AS (SELECT 1)", "B AS (SELECT 2)"], MainStatement: "SELECT A.x, B.y FROM A, B"
493
+ *
494
+ * Each definition is the exact text of `name [(columns)] AS (body)`, quoting included. The
495
+ * main statement is the rest of the text, trimmed. `UsedASTParsing` is true when the
496
+ * statement parsed completely. Returns `null` when the SQL does not start with WITH.
434
497
  *
435
- * Uses AST parsing first (produces bracket-quoted identifiers for SQL Server),
436
- * falls back to paren-depth scanning if AST fails (e.g., Nunjucks-templated SQL).
498
+ * @deprecated Use `SqlDocument.Parse(sql, dialect).CTEs()` or `SplitLeadingCTEs`.
437
499
  */
438
500
  static ExtractCTEs(sql: string, dialect: SQLParserDialect): SQLCTEExtraction | null;
439
- /**
440
- * Strips leading whitespace AND SQL comments from a string.
441
- * Handles block comments and line comments (-- ...).
442
- * Returns the remainder starting at the first non-whitespace, non-comment character.
443
- */
444
- private static skipLeadingCommentsAndWhitespace;
445
501
  /**
446
502
  * Renames a template variable throughout the SQL: in every `{{ variable | filters }}`
447
503
  * expression, preserving the filter chain, and in every read of it inside `{% if %}`,
448
504
  * `{% elif %}`, `{% for %}` and `{% set %}` tags.
449
505
  *
450
506
  * Example: `RenameTemplateVariable("WHERE x = {{ region | sqlString }}", "region", "userRegion")`
451
- * → `"WHERE x = {{ userRegion | sqlString }}"`
507
+ * → `"WHERE x = {{userRegion | sqlString}}"`
452
508
  *
453
- * Uses MJLexer for deterministic token identification — no regex guessing.
509
+ * @deprecated Rename through the `QueryTemplate` tree (`Parameters()` gives every use's span)
510
+ * and an `EditSet`.
454
511
  */
455
512
  static RenameTemplateVariable(sql: string, oldName: string, newName: string): string;
456
513
  /**
@@ -465,50 +522,47 @@ export declare class SQLParser {
465
522
  * `{% for %}` and `{% set %}` tags are replaced with it too, so conditions see the value.
466
523
  * It must be a template-language literal (`"West"`, `42`), not a SQL one.
467
524
  *
468
- * Uses MJLexer for deterministic token identification — no regex guessing.
525
+ * @deprecated Substitute through the `QueryTemplate` tree (`Parameters()` gives every use's
526
+ * span) and an `EditSet`.
469
527
  */
470
528
  static SubstituteTemplateVariable(sql: string, variableName: string, literalValue: string, tagLiteral?: string): string;
471
529
  /**
472
- * Replaces a variable's `{{ }}` expressions with `exprText(token)` and, when `tagText` is
473
- * given, its reads inside block tags with `tagText`. Edits apply from the end of the SQL so
474
- * earlier offsets stay valid.
475
- */
476
- private static replaceTemplateVariable;
477
- /**
478
- * Rebuilds a `{{ variable | filter1 | filter2(args) }}` template expression string
479
- * from a variable name and filter chain.
480
- */
481
- private static rebuildTemplateExpr;
482
- /**
483
- * Extract all {{ variable | filter }} expressions from SQL.
484
- * Returns structured info for each expression including variable name and filter chain.
530
+ * Every `{{ variable | filter }}` expression, with its variable name and filter chain. A tag
531
+ * inside a SQL comment is inert and is not reported.
532
+ *
533
+ * @deprecated Use `QueryTemplate.Parse(sql, dialect)`: its `Nodes` hold every expression, and
534
+ * `Parameters()` the names they read.
485
535
  */
486
536
  static ExtractTemplateExpressions(sql: string): MJTemplateExpr[];
487
537
  /**
488
- * Extract all {{query:"..."}} composition references from SQL.
489
- * Returns structured info including category path, query name, and parsed parameters.
538
+ * Every `{{query:"…"}}` composition reference, with its category path, query name and
539
+ * parameters. A reference inside a SQL comment is inert and is not reported.
540
+ *
541
+ * @deprecated Use `QueryTemplate.Parse(sql, dialect).CompositionReferences()`.
490
542
  */
491
543
  static ExtractCompositionRefs(sql: string): MJCompositionRef[];
492
544
  /**
493
- * Extract conditional blocks, pairing if/elif/else/endif into structured trees.
545
+ * The `{% if %}` blocks, each with its if/elif/else branches: the condition text and the
546
+ * branch body's exact source text. A tag inside a SQL comment is inert.
547
+ *
548
+ * @deprecated Use `QueryTemplate.Parse(sql, dialect)`: its `If` nodes hold every branch.
494
549
  */
495
550
  static ExtractConditionalBlocks(sql: string): MJConditionalBlock[];
496
551
  /**
497
- * Extract parameter metadata from template expressions.
552
+ * The parameters a template reads, with the type its SQL filters imply, whether it is
553
+ * required, its default and its filters:
498
554
  *
499
- * Walks tokens with a lexical-scope stack so that loop-local variables
500
- * introduced by `{% for X in Y %}` blocks are NOT registered as query
501
- * parameters (they're rebound on each iteration; callers can't supply
502
- * them). The iterable side of `{% for %}` (`Y`) IS registered as a
503
- * parameter — typically `array` and required, unless wrapped in
504
- * `{% if Y %}` which makes it optional.
555
+ * - required when at least one use sits outside every `{% if %}` block and has no
556
+ * `default(…)`; a name used only inside conditional blocks, or only in `{% if %}`
557
+ * conditions, is optional;
558
+ * - the iterable of a `{% for %}` is an `array` parameter; the loop variable, `loop.*`,
559
+ * `{% set %}` names and `Context.*` tokens are not parameters;
560
+ * - the type comes from the last SQL filter (`sqlString` → string, `sqlNumber` → number, …);
561
+ * a name read only by conditions is a `string`;
562
+ * - the default comes from a `default(…)` filter, or else from a `{% else %}` branch that
563
+ * compares with a single literal.
505
564
  *
506
- * Skip-Brain Bug B: previously this function treated `{{ kw }}` inside
507
- * `{% for kw in OrgKeywords %}` as a required parameter and failed to
508
- * register `OrgKeywords` at all. See `__tests__/extract-parameter-info-loops.test.ts`
509
- * and `SKIP-QUERY-RENDERING-BUGS.md` (Bug B) at the repo root.
510
- *
511
- * Infers type from filters, isRequired from conditional block context.
565
+ * @deprecated Use `QueryTemplate.Parse(sql, dialect).Parameters()`.
512
566
  */
513
567
  static ExtractParameterInfo(sql: string): MJParameterInfo[];
514
568
  /**
@@ -524,6 +578,7 @@ export declare class SQLParser {
524
578
  *
525
579
  * @param result The MJAstifyResult from Astify()
526
580
  * @returns Walk result with annotations, or empty result if AST parsing failed
581
+ * @deprecated Kept unchanged, node-sql-parser AST included, for callers that walk that tree; new code reads SQL with `SqlDocument.Parse(sql, dialect)`. Template positions come from `QueryTemplate.Parse(sql, dialect)`.
527
582
  */
528
583
  static WalkAST(result: MJAstifyResult): MJASTWalkResult;
529
584
  /**
@@ -542,45 +597,6 @@ export declare class SQLParser {
542
597
  * Builds the MJASTWalkResult from a flat list of annotations.
543
598
  */
544
599
  private static buildWalkResult;
545
- /**
546
- * Parse SQL safely, returning null on failure.
547
- *
548
- * Includes a workaround for node-sql-parser's inability to handle multi-directive
549
- * FOR XML clauses (e.g., `FOR XML PATH('M'), ROOT('R')`). The parser handles
550
- * `FOR XML PATH('M')` fine but chokes on the comma-separated directives.
551
- * We strip the extra directives before parsing and restore them on the AST's `for` property.
552
- */
553
- /** Resolves overloaded Parse() args: (string, dialect?) or (options) */
554
- private static resolveParseArgs;
555
- private static parseSQL;
556
- /**
557
- * Parses with node-sql-parser and throws when the result is not a real reading of the SQL.
558
- *
559
- * The T-SQL grammar accepts some statements it cannot parse — notably a CTE with a
560
- * bracket-quoted name, `WITH [x] AS (…) SELECT …` — as a run of bare `name = value`
561
- * assignments (`WITH = [x]`, `AS = (…)`, `SELECT = …`). No real statement has that shape, so
562
- * such a result is treated as a parse failure and callers take their fallback paths instead
563
- * of reading a meaningless tree.
564
- */
565
- private static astifyChecked;
566
- /**
567
- * Rewrites bare `CURRENT_USER`, `SESSION_USER`, and `SYSTEM_USER` keywords (outside strings,
568
- * comments, and quoted identifiers) to `CURRENT_USER()` / `SESSION_USER()` / `SYSTEM_USER()`
569
- * so node-sql-parser's T-SQL and PostgreSQL grammars accept them. Qualified column references
570
- * (`t.current_user`), aliases (`AS current_user`), and calls that already carry `()` are left
571
- * untouched.
572
- */
573
- private static parenthesizeNiladicUserFunctions;
574
- /**
575
- * Removes empty `args` from `CURRENT_USER` / `SESSION_USER` / `SYSTEM_USER` function AST nodes
576
- * produced by {@link parenthesizeNiladicUserFunctions}, matching the AST shape node-sql-parser
577
- * produces for `CURRENT_TIMESTAMP` so `SqlifyAST` emits the standard niladic form without `()`.
578
- */
579
- private static stripNiladicUserFunctionArgs;
580
- /** Extracts the simple function name from a node-sql-parser `function` AST node. */
581
- private static extractFunctionNodeName;
582
- /** Whether any top-level node is a bare assignment wrapper rather than a statement. */
583
- private static isMisreadAsAssignments;
584
600
  /**
585
601
  * Last-resort parse used when a direct parse fails. Rewrites SQL into a
586
602
  * form node-sql-parser accepts:
@@ -645,69 +661,5 @@ export declare class SQLParser {
645
661
  * `` `` ``). Returns the index just past the closing delimiter.
646
662
  */
647
663
  private static skipQuotedFrom;
648
- /**
649
- * Detects FOR XML clauses that node-sql-parser can't handle and simplifies them.
650
- *
651
- * node-sql-parser handles: FOR XML PATH, FOR XML PATH('arg'), FOR XML RAW, FOR XML AUTO
652
- * node-sql-parser fails on: FOR XML RAW('arg'), and any comma-separated directives
653
- *
654
- * Simplifies to a form the parser accepts, preserving the original for restoration.
655
- * Returns null if no problematic FOR XML pattern is found.
656
- */
657
- private static stripForXmlDirectives;
658
- /**
659
- * Restores the original FOR XML clause text on the AST's `for` property.
660
- * This ensures that when the AST is inspected (e.g., for isOrderByLegalInCTE checks),
661
- * the FOR XML presence is correctly detected.
662
- */
663
- private static restoreForXmlOnAST;
664
- /** Get clean SQL (MJ tokens replaced with placeholders) for AST parsing */
665
- private static getCleanSQL;
666
- private static extractTablesViaAST;
667
- private static extractTablesViaRegex;
668
- private static deduplicateTables;
669
- private static buildColumnRefs;
670
- private static extractCTEsViaAST;
671
- private static extractCTEsViaRegex;
672
- private static skipWhitespace;
673
- private static findMatchingCloseParen;
674
- private static walkASTForExtraction;
675
- private static walkFromItem;
676
- private static walkExpression;
677
- private static inferTypeFromFilters;
678
- private static extractDefaultValue;
679
- /**
680
- * Extracts the primary variable name from an {% if %} condition expression.
681
- * Handles patterns like:
682
- * "Status" → "Status"
683
- * "Status and Status.length > 0" → "Status"
684
- * "StartDate and StartDate.length" → "StartDate"
685
- */
686
- private static extractConditionVariable;
687
- /**
688
- * Extracts a SQL literal value from an {% else %} branch body.
689
- * Looks for patterns like:
690
- * `= 'Attended'` → "Attended"
691
- * `= 42` → 42
692
- * `= 3.14` → 3.14
693
- *
694
- * Only returns a value when exactly one literal is found, to avoid
695
- * ambiguity from complex else bodies with multiple conditions.
696
- */
697
- private static extractLiteralFromElseBody;
698
- /**
699
- * Enriches parameters that lack default values by inspecting {% else %} branches
700
- * of conditional blocks. When a block guards a parameter with {% if Var %} and
701
- * the else branch contains a single literal value (e.g., `= 'Attended'`), that
702
- * literal is assigned as the parameter's default.
703
- *
704
- * Only sets defaults on parameters that don't already have one (from a `| default()` filter).
705
- */
706
- private static enrichDefaultsFromElseBranches;
707
- private static findConditionalVariables;
708
- /** Jinja2 keywords that should never be treated as user-defined variables. */
709
- private static readonly JINJA_KEYWORDS;
710
- private static addConditionVariables;
711
- private static addNodeToFragment;
712
664
  }
713
665
  //# sourceMappingURL=sql-parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sql-parser.d.ts","sourceRoot":"","sources":["../src/sql-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAK5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AA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