@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
@@ -0,0 +1,451 @@
1
+ import { IdentifierMatches } from '@memberjunction/sql-dialect';
2
+ import { SQLParser } from '../sql-parser.js';
3
+ import { LexSQL, SignificantTokens } from '../sqlLexer.js';
4
+ import { StrictGrammarOf, StrictParsingDialect } from './strictDialect.js';
5
+ /** Aggregate functions an aggregate expression may call at its top level. */
6
+ const AGGREGATE_FUNCTIONS = new Set([
7
+ 'COUNT', 'COUNT_BIG', 'SUM', 'AVG', 'MIN', 'MAX', 'STDEV', 'STDEVP', 'VAR', 'VARP', 'STRING_AGG', 'CHECKSUM_AGG',
8
+ ]);
9
+ /** Scalar functions an aggregate expression may call inside its aggregate. Each is pure and reads no table. */
10
+ const SCALAR_FUNCTIONS = new Set([
11
+ 'ISNULL', 'COALESCE', 'NULLIF', 'IIF',
12
+ 'ABS', 'CEILING', 'CEIL', 'FLOOR', 'ROUND', 'POWER', 'SQRT', 'SIGN', 'EXP', 'LOG', 'LOG10',
13
+ 'LEN', 'LENGTH', 'UPPER', 'LOWER', 'LTRIM', 'RTRIM', 'TRIM', 'LEFT', 'RIGHT', 'SUBSTRING', 'CHARINDEX', 'REPLACE', 'CONCAT',
14
+ 'YEAR', 'MONTH', 'DAY', 'DATEPART', 'DATEDIFF', 'DATEADD', 'EOMONTH', 'DATE_PART', 'DATE_TRUNC',
15
+ 'GETDATE', 'GETUTCDATE', 'SYSDATETIME', 'NOW',
16
+ // The parser reads `NOT (x)` as a call to a function named NOT.
17
+ 'NOT',
18
+ ]);
19
+ /** Types a CAST inside an aggregate may convert to. */
20
+ const CAST_TYPES = new Set([
21
+ 'INT', 'INTEGER', 'BIGINT', 'SMALLINT', 'TINYINT', 'BIT', 'DECIMAL', 'NUMERIC', 'MONEY', 'SMALLMONEY', 'FLOAT', 'REAL',
22
+ 'DATE', 'TIME', 'DATETIME', 'DATETIME2', 'DATETIMEOFFSET', 'SMALLDATETIME', 'TIMESTAMP', 'TIMESTAMPTZ',
23
+ 'CHAR', 'VARCHAR', 'NCHAR', 'NVARCHAR', 'TEXT', 'UNIQUEIDENTIFIER', 'UUID', 'BOOLEAN', 'BOOL',
24
+ ]);
25
+ /** SQL Server functions whose first argument is a date-part keyword (`DATEDIFF(day, a, b)`), which the parser reads as a column. */
26
+ const DATE_PART_FUNCTIONS = new Set(['DATEPART', 'DATEDIFF', 'DATEADD']);
27
+ /** The date-part keywords {@link DATE_PART_FUNCTIONS} accept, lower case. */
28
+ const DATE_PARTS = new Set([
29
+ 'year', 'yy', 'yyyy', 'quarter', 'qq', 'q', 'month', 'mm', 'm', 'dayofyear', 'dy', 'y', 'day', 'dd', 'd',
30
+ 'week', 'wk', 'ww', 'weekday', 'dw', 'w', 'hour', 'hh', 'minute', 'mi', 'n', 'second', 'ss', 's',
31
+ 'millisecond', 'ms', 'microsecond', 'mcs', 'nanosecond', 'ns', 'iso_week', 'isowk', 'isoww',
32
+ ]);
33
+ const BINARY_OPERATORS = new Set([
34
+ '+', '-', '*', '/', '%', '||', '=', '<>', '!=', '<', '>', '<=', '>=',
35
+ 'AND', 'OR', 'IS', 'IS NOT', 'LIKE', 'NOT LIKE', 'ILIKE', 'NOT ILIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN',
36
+ ]);
37
+ const UNARY_OPERATORS = new Set(['-', '+', 'NOT']);
38
+ /** A numeric literal the way both databases read one. */
39
+ const NUMBER_TEXT = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
40
+ /**
41
+ * The keys of each node shape that hold a sub-expression the renderer reads. Any other key whose
42
+ * value is an object (a COLLATE, OVER, FILTER or ORDER BY clause, and anything the parser adds
43
+ * later) refuses the expression.
44
+ */
45
+ const AGGREGATE_KEYS = new Set(['name', 'args']);
46
+ const AGGREGATE_ARG_KEYS = new Set(['expr', 'separator']);
47
+ const CALL_KEYS = new Set(['name', 'args']);
48
+ const COLUMN_KEYS = new Set(['column']);
49
+ const BINARY_KEYS = new Set(['left', 'right']);
50
+ const UNARY_KEYS = new Set(['expr']);
51
+ const LIST_KEYS = new Set(['value']);
52
+ const CASE_KEYS = new Set(['expr', 'args']);
53
+ const BRANCH_KEYS = new Set(['cond', 'result']);
54
+ const CAST_KEYS = new Set(['expr', 'target']);
55
+ const SEPARATOR_KEYS = new Set(['delimiter']);
56
+ const TYPE_KEYS = new Set(['suffix']);
57
+ const CONSTANT_KEYS = new Set(['value']);
58
+ /** The only table the expression is parsed against. */
59
+ const SCREEN_TABLE = '__mj_aggregate_screen';
60
+ const SINGLE_CALL = 'it must be a single aggregate function call, with nothing before or after it';
61
+ const BACKSLASH = 'it contains a backslash inside a quoted string or identifier';
62
+ /**
63
+ * Whether `expression` may be placed as one item of an aggregate SELECT list —
64
+ * `SELECT <expression> AS [Agg_0] FROM <entity view> WHERE …` — for an entity whose columns are
65
+ * `columns`, and the SQL to run for it.
66
+ *
67
+ * Allowed: exactly one call to an aggregate function (COUNT, SUM, AVG, MIN, MAX, STDEV, VAR,
68
+ * STRING_AGG, …) with nothing before or after it. Inside the call: the given columns, `*` for
69
+ * COUNT, DISTINCT, constants, arithmetic, comparison and logical operators, CASE, CAST, and a
70
+ * fixed set of pure scalar functions. Everything else is refused: statement separators, comments,
71
+ * backslashes inside quoted strings or identifiers, subqueries, other tables, qualified names,
72
+ * variables, aliases, window clauses, and any shape the parser produces that this check does not
73
+ * read.
74
+ *
75
+ * The caller's text is never run. {@link StrictAggregateResult.SQL} is rebuilt from the
76
+ * checked parse tree: columns come from `columns` and are quoted for the dialect; function names,
77
+ * type names, operators and keywords come from fixed lists; string and number constants are
78
+ * re-quoted or re-checked. So the database runs exactly the expression that was checked, even
79
+ * where the parser and the database would read the caller's text differently.
80
+ *
81
+ * @param expression The caller-supplied aggregate expression
82
+ * @param dialect The dialect the expression runs under
83
+ * @param columns The entity's column names (its base view's columns). A reference matches a column
84
+ * by `IdentifierMatches` from `@memberjunction/sql-dialect`, the field-level security gate's rule.
85
+ */
86
+ export function RenderAggregateExpression(expression, dialect, columns) {
87
+ if (typeof expression !== 'string' || expression.trim().length === 0)
88
+ return refuse('it is empty');
89
+ const tokenProblem = checkTokens(expression, dialect);
90
+ if (tokenProblem)
91
+ return refuse(tokenProblem);
92
+ const call = parseSingleItem(expression, dialect);
93
+ if (typeof call === 'string')
94
+ return refuse(call);
95
+ try {
96
+ return { IsValid: true, Reason: null, SQL: new AggregateRenderer(dialect, columns).RenderCall(call) };
97
+ }
98
+ catch (e) {
99
+ if (e instanceof AggregateRefusal)
100
+ return refuse(e.message);
101
+ throw e;
102
+ }
103
+ }
104
+ function refuse(reason) {
105
+ return { IsValid: false, Reason: reason, SQL: null };
106
+ }
107
+ /** Refuses an expression from inside {@link AggregateRenderer}; {@link RenderAggregateExpression} turns it into a refusal. */
108
+ class AggregateRefusal extends Error {
109
+ }
110
+ function refuseWith(reason) {
111
+ throw new AggregateRefusal(reason);
112
+ }
113
+ /**
114
+ * Refuses comments, statement separators and backslashes inside quoted spans, and requires
115
+ * `name(…)` with nothing outside its parentheses. The parser and the database engines read
116
+ * backslashes inside plain string literals differently, so a quoted span with a backslash is refused.
117
+ */
118
+ function checkTokens(expression, dialect) {
119
+ const tokens = LexSQL(expression, dialect);
120
+ if (tokens.some(t => t.Kind === 'comment'))
121
+ return 'it contains a comment';
122
+ if (tokens.some(t => t.Kind === 'semicolon'))
123
+ return 'it contains a statement separator (;)';
124
+ if (tokens.some(t => (t.Kind === 'string' || t.Kind === 'identifier') && t.Text.includes('\\')))
125
+ return BACKSLASH;
126
+ const significant = SignificantTokens(tokens);
127
+ const last = significant[significant.length - 1];
128
+ const isOneCall = significant.length >= 3 &&
129
+ significant[0].Kind === 'word' &&
130
+ significant[1].Kind === 'open' &&
131
+ last.Kind === 'close' && last.Depth === 0 &&
132
+ significant.slice(2, -1).every(t => t.Depth > 0);
133
+ return isOneCall ? null : SINGLE_CALL;
134
+ }
135
+ /** Parses the expression as the only item of `SELECT … FROM <screen table>`; returns the item's node or why it was refused. */
136
+ function parseSingleItem(expression, dialect) {
137
+ const grammar = StrictGrammarOf(dialect);
138
+ if (grammar === null)
139
+ return 'the dialect has no grammar to check it with';
140
+ const ast = SQLParser.ParseSQL(`SELECT ${expression} FROM ${SCREEN_TABLE}`, StrictParsingDialect(dialect, grammar));
141
+ if (!ast)
142
+ return 'it could not be parsed as SQL';
143
+ const statements = Array.isArray(ast) ? ast : [ast];
144
+ if (statements.length !== 1)
145
+ return 'it contains more than one statement';
146
+ const select = statements[0];
147
+ if (!isNode(select) || select.type !== 'select' || !readsOnlyScreenTable(select.from))
148
+ return SINGLE_CALL;
149
+ const items = select.columns;
150
+ if (!Array.isArray(items) || items.length !== 1)
151
+ return SINGLE_CALL;
152
+ const item = items[0];
153
+ if (!isNode(item) || item.as || !isNode(item.expr))
154
+ return SINGLE_CALL;
155
+ return item.expr;
156
+ }
157
+ function readsOnlyScreenTable(from) {
158
+ if (!Array.isArray(from) || from.length !== 1)
159
+ return false;
160
+ const source = from[0];
161
+ return isNode(source) && typeof source.table === 'string' && source.table.toLowerCase() === SCREEN_TABLE && !source.db && !source.join;
162
+ }
163
+ function isNode(value) {
164
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
165
+ }
166
+ /** Refuses a node that holds an object under a key outside `type` and `read`: a clause the renderer does not read. */
167
+ function assertRead(node, read) {
168
+ for (const [key, value] of Object.entries(node)) {
169
+ if (key !== 'type' && !read.has(key) && typeof value === 'object' && value !== null) {
170
+ refuseWith(`it uses ${key.replace(/_/g, ' ').toUpperCase()}, which aggregate expressions do not allow`);
171
+ }
172
+ }
173
+ }
174
+ /** The name a call node invokes, as written (`SUM`, `dbo.fnX`), or null when the node is not a readable call. */
175
+ function callName(node) {
176
+ if (node.type === 'aggr_func')
177
+ return typeof node.name === 'string' ? node.name : null;
178
+ if (node.type !== 'function' || !isNode(node.name))
179
+ return null;
180
+ const nameParts = node.name.name;
181
+ if (!Array.isArray(nameParts) || nameParts.length === 0)
182
+ return null;
183
+ const parts = node.name.schema ? [node.name.schema, ...nameParts] : [...nameParts];
184
+ const names = parts.map(namePart);
185
+ return names.every((n) => n !== null) ? names.join('.') : null;
186
+ }
187
+ function namePart(part) {
188
+ return isNode(part) && typeof part.value === 'string' ? part.value : null;
189
+ }
190
+ /** The column a `column_ref` names: a plain string on SQL Server, `{ expr: { value } }` on PostgreSQL. */
191
+ function columnName(node) {
192
+ if (typeof node.column === 'string')
193
+ return node.column;
194
+ return isNode(node.column) && isNode(node.column.expr) ? node.column.expr.value : undefined;
195
+ }
196
+ /** The date-part keyword a {@link DATE_PART_FUNCTIONS} call starts with, lower case, or null. */
197
+ function datePartOf(value) {
198
+ if (!isNode(value) || value.type !== 'column_ref' || value.table)
199
+ return null;
200
+ const name = columnName(value);
201
+ return typeof name === 'string' && DATE_PARTS.has(name.toLowerCase()) ? name.toLowerCase() : null;
202
+ }
203
+ function parenthesize(sql, operand) {
204
+ return operand ? `(${sql})` : sql;
205
+ }
206
+ /** The upper-case operator of an operation node, refused unless it is in `allowed`. */
207
+ function operatorOf(node, allowed) {
208
+ const operator = typeof node.operator === 'string' ? node.operator.toUpperCase() : '';
209
+ return allowed.has(operator) ? operator : refuseWith(`it uses the operator "${operator}", which aggregate expressions do not allow`);
210
+ }
211
+ /** Rebuilds a constant: numbers re-checked, strings re-quoted, NULL and booleans as keywords. */
212
+ function renderConstant(node) {
213
+ assertRead(node, CONSTANT_KEYS);
214
+ switch (node.type) {
215
+ case 'number':
216
+ case 'bigint': return renderNumber(node.value);
217
+ case 'single_quote_string': return `'${requote(node.value)}'`;
218
+ case 'var_string': return `N'${requote(node.value)}'`;
219
+ case 'bool': return renderBoolean(node.value);
220
+ case 'null': return 'NULL';
221
+ default: return refuseWith(`it contains an expression of type "${String(node.type)}", which aggregate expressions do not allow`);
222
+ }
223
+ }
224
+ function renderNumber(value) {
225
+ const text = typeof value === 'number' && Number.isFinite(value) ? String(value) : typeof value === 'string' ? value : '';
226
+ return NUMBER_TEXT.test(text) ? text : refuseWith('it contains a number the parser could not read');
227
+ }
228
+ function renderBoolean(value) {
229
+ return typeof value === 'boolean' ? (value ? 'TRUE' : 'FALSE') : refuseWith('it contains a boolean the parser could not read');
230
+ }
231
+ /** A string constant as the inside of a quoted literal: the parser's doubled quotes undone, then every quote doubled. */
232
+ function requote(raw) {
233
+ if (typeof raw !== 'string')
234
+ return refuseWith('it contains a string the parser could not read');
235
+ if (raw.includes('\\'))
236
+ return refuseWith(BACKSLASH);
237
+ return raw.replace(/''/g, "'").replace(/'/g, "''");
238
+ }
239
+ function isStringConstant(value) {
240
+ return isNode(value) && (value.type === 'single_quote_string' || value.type === 'var_string');
241
+ }
242
+ /** The right side of `IS` / `IS NOT`: only NULL, TRUE or FALSE. */
243
+ function renderIsOperand(value) {
244
+ if (isNode(value) && value.type === 'null')
245
+ return 'NULL';
246
+ if (isNode(value) && value.type === 'bool')
247
+ return renderBoolean(value.value);
248
+ return refuseWith('it uses IS with something other than NULL, TRUE or FALSE');
249
+ }
250
+ /** A CAST target: an allowed type name with an optional length and scale. */
251
+ function renderType(target) {
252
+ if (!isNode(target) || typeof target.dataType !== 'string')
253
+ return refuseWith('it casts to a type the parser could not read');
254
+ assertRead(target, TYPE_KEYS);
255
+ const type = target.dataType.toUpperCase();
256
+ if (!CAST_TYPES.has(type))
257
+ return refuseWith(`it casts to ${type}, which aggregate expressions do not allow`);
258
+ const suffix = target.suffix;
259
+ if (suffix !== undefined && suffix !== null && !(Array.isArray(suffix) && suffix.length === 0))
260
+ return refuseWith('it casts with a type suffix');
261
+ if (target.length === undefined || target.length === null) {
262
+ return target.scale === undefined || target.scale === null ? type : refuseWith('it casts with a scale but no length');
263
+ }
264
+ const scale = target.scale === undefined || target.scale === null ? '' : `, ${renderTypeSize(target.scale)}`;
265
+ return `${type}(${renderTypeSize(target.length)}${scale})`;
266
+ }
267
+ function renderTypeSize(value) {
268
+ if (typeof value === 'number' && Number.isInteger(value) && value >= 0)
269
+ return String(value);
270
+ if (typeof value === 'string' && value.toUpperCase() === 'MAX')
271
+ return 'MAX';
272
+ return refuseWith('it casts with a size the parser could not read');
273
+ }
274
+ /** A call's argument nodes; an empty list when it has none. */
275
+ function callArguments(node, upperName) {
276
+ const args = node.args;
277
+ if (args === null || args === undefined)
278
+ return [];
279
+ if (!isNode(args) || args.type !== 'expr_list' || !Array.isArray(args.value)) {
280
+ return refuseWith(`it calls ${upperName} with arguments the parser could not read`);
281
+ }
282
+ assertRead(args, LIST_KEYS);
283
+ return args.value;
284
+ }
285
+ /**
286
+ * Walks one aggregate call, allowing only the node shapes {@link RenderAggregateExpression} documents,
287
+ * and rebuilds its SQL. An operation that is the operand of another operation is parenthesized, so
288
+ * the rebuilt SQL keeps the parse tree's grouping.
289
+ */
290
+ class AggregateRenderer {
291
+ constructor(dialect, columns) {
292
+ this.dialect = dialect;
293
+ this.columns = Array.from(columns, column => column.trim()).filter(column => column.length > 0);
294
+ }
295
+ /** Rebuilds the top-level aggregate call. */
296
+ RenderCall(call) {
297
+ const name = callName(call);
298
+ if (name === null)
299
+ return refuseWith(SINGLE_CALL);
300
+ const upper = name.toUpperCase();
301
+ if (!AGGREGATE_FUNCTIONS.has(upper))
302
+ return refuseWith(`${name} is not an aggregate function`);
303
+ // STDEV, VAR and their siblings parse as plain function calls rather than aggr_func.
304
+ return call.type === 'aggr_func' ? this.renderAggregate(upper, call) : this.renderCall(upper, call);
305
+ }
306
+ renderAggregate(upperName, call) {
307
+ assertRead(call, AGGREGATE_KEYS);
308
+ const args = call.args;
309
+ if (!isNode(args))
310
+ return refuseWith(SINGLE_CALL);
311
+ assertRead(args, AGGREGATE_ARG_KEYS);
312
+ const distinct = this.renderDistinct(args.distinct);
313
+ if ((upperName === 'COUNT' || upperName === 'COUNT_BIG') && !distinct && isNode(args.expr) && args.expr.type === 'star') {
314
+ return `${upperName}(*)`;
315
+ }
316
+ const separator = args.separator === null || args.separator === undefined ? '' : `, ${this.renderSeparator(args.separator)}`;
317
+ return `${upperName}(${distinct}${this.render(args.expr)}${separator})`;
318
+ }
319
+ renderDistinct(value) {
320
+ if (value === null || value === undefined)
321
+ return '';
322
+ return typeof value === 'string' && value.toUpperCase() === 'DISTINCT' ? 'DISTINCT ' : refuseWith(`it uses ${String(value)} inside the aggregate`);
323
+ }
324
+ renderSeparator(separator) {
325
+ if (!isNode(separator))
326
+ return refuseWith('it uses a STRING_AGG separator the parser could not read');
327
+ assertRead(separator, SEPARATOR_KEYS);
328
+ return isStringConstant(separator.delimiter) ? this.render(separator.delimiter) : refuseWith('it uses a STRING_AGG separator that is not a constant');
329
+ }
330
+ /** Rebuilds one expression inside the aggregate call; `operand` parenthesizes an operation. */
331
+ render(node, operand = false) {
332
+ if (!isNode(node))
333
+ return refuseWith('it contains an expression the parser could not read');
334
+ if ('ast' in node)
335
+ return refuseWith('it contains a subquery');
336
+ switch (node.type) {
337
+ case 'column_ref': return this.renderColumn(node);
338
+ // A T-SQL "x" is a quoted identifier.
339
+ case 'double_quote_string':
340
+ assertRead(node, CONSTANT_KEYS);
341
+ return this.renderColumnName(node.value);
342
+ case 'binary_expr': return parenthesize(this.renderBinary(node), operand);
343
+ case 'unary_expr': return parenthesize(this.renderUnary(node), operand);
344
+ case 'case': return this.renderCase(node);
345
+ case 'cast': return this.renderCast(node);
346
+ // The parser reads `NOT (x)` as a call; as an operand it needs its own parentheses.
347
+ case 'function': return parenthesize(this.renderScalarCall(node), operand && callName(node)?.toUpperCase() === 'NOT');
348
+ case 'aggr_func': return refuseWith('aggregate functions cannot be nested');
349
+ default: return renderConstant(node);
350
+ }
351
+ }
352
+ renderColumn(node) {
353
+ assertRead(node, COLUMN_KEYS);
354
+ if (node.table || node.db || node.schema)
355
+ return refuseWith('it uses a qualified column name; name the column alone');
356
+ return this.renderColumnName(columnName(node));
357
+ }
358
+ renderColumnName(name) {
359
+ if (typeof name !== 'string')
360
+ return refuseWith('it contains a column reference the parser could not read');
361
+ return this.dialect.QuoteIdentifier(this.resolveColumn(name));
362
+ }
363
+ /**
364
+ * The entity column `name` refers to. Every column is compared with {@link IdentifierMatches},
365
+ * the rule the field-level security gate reports with, so a reference resolves only to a column
366
+ * the gate reports in the caller's text. An exact spelling only chooses between columns that
367
+ * both match.
368
+ */
369
+ resolveColumn(name) {
370
+ const matches = this.columns.filter(column => IdentifierMatches(name, column));
371
+ if (matches.length === 1)
372
+ return matches[0];
373
+ if (matches.length === 0)
374
+ return refuseWith(`it references "${name}", which is not a column of this entity`);
375
+ const exact = matches.find(column => column === name.trim());
376
+ return exact ?? refuseWith(`it references "${name}", which matches more than one column of this entity`);
377
+ }
378
+ renderBinary(node) {
379
+ const operator = operatorOf(node, BINARY_OPERATORS);
380
+ assertRead(node, BINARY_KEYS);
381
+ const left = this.render(node.left, true);
382
+ if (operator === 'IN' || operator === 'NOT IN')
383
+ return `${left} ${operator} (${this.renderList(node.right).join(', ')})`;
384
+ if (operator === 'BETWEEN' || operator === 'NOT BETWEEN') {
385
+ const bounds = this.renderList(node.right, true);
386
+ return bounds.length === 2 ? `${left} ${operator} ${bounds[0]} AND ${bounds[1]}` : refuseWith(`it uses ${operator} without two bounds`);
387
+ }
388
+ if (operator === 'IS' || operator === 'IS NOT')
389
+ return `${left} ${operator} ${renderIsOperand(node.right)}`;
390
+ return `${left} ${operator} ${this.render(node.right, true)}`;
391
+ }
392
+ renderUnary(node) {
393
+ const operator = operatorOf(node, UNARY_OPERATORS);
394
+ assertRead(node, UNARY_KEYS);
395
+ // The space keeps a minus before a negative number from forming the comment marker `--`.
396
+ return `${operator} ${this.render(node.expr, true)}`;
397
+ }
398
+ renderList(node, operands = false) {
399
+ if (isNode(node) && 'ast' in node)
400
+ return refuseWith('it contains a subquery');
401
+ if (!isNode(node) || node.type !== 'expr_list' || !Array.isArray(node.value))
402
+ return refuseWith('it contains a list the parser could not read');
403
+ assertRead(node, LIST_KEYS);
404
+ return node.value.map((value) => this.render(value, operands));
405
+ }
406
+ renderCase(node) {
407
+ assertRead(node, CASE_KEYS);
408
+ const subject = node.expr === null || node.expr === undefined ? '' : ` ${this.render(node.expr)}`;
409
+ if (!Array.isArray(node.args) || node.args.length === 0)
410
+ return refuseWith('it contains a CASE the parser could not read');
411
+ const branches = node.args.map((branch) => this.renderBranch(branch));
412
+ return `CASE${subject} ${branches.join(' ')} END`;
413
+ }
414
+ renderBranch(branch) {
415
+ if (!isNode(branch) || (branch.type !== 'when' && branch.type !== 'else'))
416
+ return refuseWith('it contains a CASE the parser could not read');
417
+ assertRead(branch, BRANCH_KEYS);
418
+ return branch.type === 'when'
419
+ ? `WHEN ${this.render(branch.cond)} THEN ${this.render(branch.result)}`
420
+ : `ELSE ${this.render(branch.result)}`;
421
+ }
422
+ renderCast(node) {
423
+ assertRead(node, CAST_KEYS);
424
+ if (!Array.isArray(node.target) || node.target.length !== 1)
425
+ return refuseWith('it casts to a type the parser could not read');
426
+ return `CAST(${this.render(node.expr)} AS ${renderType(node.target[0])})`;
427
+ }
428
+ renderScalarCall(node) {
429
+ const name = callName(node);
430
+ if (name === null)
431
+ return refuseWith('it calls a function whose name the parser could not read');
432
+ const upper = name.toUpperCase();
433
+ if (SCALAR_FUNCTIONS.has(upper))
434
+ return this.renderCall(upper, node);
435
+ return refuseWith(AGGREGATE_FUNCTIONS.has(upper) ? 'aggregate functions cannot be nested' : `it calls ${name}(), which aggregate expressions do not allow`);
436
+ }
437
+ /** Rebuilds a function call; a date-part keyword may lead a {@link DATE_PART_FUNCTIONS} call. */
438
+ renderCall(upperName, node) {
439
+ assertRead(node, CALL_KEYS);
440
+ const values = callArguments(node, upperName);
441
+ if (upperName === 'NOT') {
442
+ return values.length === 1 ? `NOT (${this.render(values[0])})` : refuseWith('it uses NOT with more than one operand');
443
+ }
444
+ const datePart = DATE_PART_FUNCTIONS.has(upperName) ? datePartOf(values[0]) : null;
445
+ const rendered = datePart === null
446
+ ? values.map(value => this.render(value))
447
+ : [datePart, ...values.slice(1).map(value => this.render(value))];
448
+ return `${upperName}(${rendered.join(', ')})`;
449
+ }
450
+ }
451
+ //# sourceMappingURL=aggregateRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregateRenderer.js","sourceRoot":"","sources":["../../src/strict/aggregateRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC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ChK,CAAC;IAED,iGAAiG;IACzF,UAAU,CAAC,SAAiB,EAAE,IAAa;QAC/C,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC5B,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,wCAAwC,CAAC,CAAC;QAC1H,CAAC;QACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnF,MAAM,QAAQ,GAAG,QAAQ,KAAK,IAAI;YAC9B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,GAAG,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAClD,CAAC;CACJ"}
@@ -0,0 +1,34 @@
1
+ import type { SQLParserDialect } from '@memberjunction/sql-dialect';
2
+ import type { StrictStatementReads } from './strictTypes.js';
3
+ /**
4
+ * One parse the reads walk reads: its tree, the bracket identifiers a fallback parse renamed
5
+ * (`null` when none were), the dialect it was read with, and its text. A `SQLParser` is one.
6
+ */
7
+ export interface ReadableParse {
8
+ readonly AST: unknown;
9
+ readonly IdentifierAliases: ReadonlyMap<string, string> | null;
10
+ readonly Dialect: SQLParserDialect;
11
+ readonly SQL: string;
12
+ }
13
+ /** The table name a fragment's parse wrapper reads. */
14
+ export declare const CLAUSE_WRAPPER_TABLE = "__mj_clause_screen";
15
+ /**
16
+ * Every FROM item in a parsed statement, and the number of SELECT nodes. The walk visits every
17
+ * property of every node, so it finds a FROM list wherever the grammar puts one: a subquery in a
18
+ * CASE branch, HAVING, a window's ORDER BY or PARTITION BY, a function argument, IN, EXISTS, a
19
+ * set operation or a CTE body. Every FROM item is kept, even when its alias repeats. Names the
20
+ * fallback parse renamed are read back through {@link ReadableParse.IdentifierAliases}, which
21
+ * holds only names the parser put in the tree. `skip` is a FROM item node of the tree to leave out.
22
+ *
23
+ * Each FROM item records whether it reads a CTE in scope there. A WITH covers its own SELECT,
24
+ * everything below it, and the following set-operation branches unless its SELECT is a
25
+ * parenthesized branch. A CTE body sees the CTEs before it, itself on SQL Server, and every CTE of
26
+ * a PostgreSQL WITH RECURSIVE list. Names match by the dialect's identifier rules. The walk keeps a
27
+ * count of the CTEs of each name in scope as it goes, so its time is linear in the tree.
28
+ */
29
+ export declare function CollectReads(parser: ReadableParse, skip?: object): StrictStatementReads;
30
+ /** The FROM item of a fragment's parse wrapper: the root statement's only FROM item, when it is the wrapper table. */
31
+ export declare function WrapperFromItem(ast: unknown): object | undefined;
32
+ /** Removes the bracket, double-quote or backtick quoting around one identifier. */
33
+ export declare function StripIdentifierQuoting(name: string | null | undefined): string;
34
+ //# sourceMappingURL=statementReads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statementReads.d.ts","sourceRoot":"","sources":["../../src/strict/statementReads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,KAAK,EAAkB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACxB;AA2BD,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAYvF;AAED,sHAAsH;AACtH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAUhE;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG9E"}