@uwdata/mosaic-sql 0.16.2 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (469) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +0 -2
  3. package/dist/src/ast/aggregate.d.ts +82 -0
  4. package/dist/src/ast/aggregate.d.ts.map +1 -0
  5. package/dist/src/ast/aggregate.js +180 -0
  6. package/dist/src/ast/aggregate.js.map +1 -0
  7. package/dist/src/ast/between-op.d.ts +46 -0
  8. package/dist/src/ast/between-op.d.ts.map +1 -0
  9. package/dist/src/ast/between-op.js +60 -0
  10. package/dist/src/ast/between-op.js.map +1 -0
  11. package/dist/src/ast/binary-op.d.ts +21 -0
  12. package/dist/src/ast/binary-op.d.ts.map +1 -0
  13. package/dist/src/ast/binary-op.js +29 -0
  14. package/dist/src/ast/binary-op.js.map +1 -0
  15. package/dist/src/ast/case.d.ts +53 -0
  16. package/dist/src/ast/case.d.ts.map +1 -0
  17. package/dist/src/ast/case.js +75 -0
  18. package/dist/src/ast/case.js.map +1 -0
  19. package/dist/src/ast/cast.d.ts +18 -0
  20. package/dist/src/ast/cast.d.ts.map +1 -0
  21. package/dist/src/ast/cast.js +26 -0
  22. package/dist/src/ast/cast.js.map +1 -0
  23. package/dist/src/ast/collate.d.ts +18 -0
  24. package/dist/src/ast/collate.d.ts.map +1 -0
  25. package/dist/src/ast/collate.js +25 -0
  26. package/dist/src/ast/collate.js.map +1 -0
  27. package/dist/src/ast/column-param.d.ts +23 -0
  28. package/dist/src/ast/column-param.d.ts.map +1 -0
  29. package/dist/src/ast/column-param.js +29 -0
  30. package/dist/src/ast/column-param.js.map +1 -0
  31. package/dist/src/ast/column-ref.d.ts +40 -0
  32. package/dist/src/ast/column-ref.d.ts.map +1 -0
  33. package/dist/src/ast/column-ref.js +58 -0
  34. package/dist/src/ast/column-ref.js.map +1 -0
  35. package/dist/src/ast/fragment.d.ts +20 -0
  36. package/dist/src/ast/fragment.d.ts.map +1 -0
  37. package/dist/src/ast/fragment.js +26 -0
  38. package/dist/src/ast/fragment.js.map +1 -0
  39. package/dist/src/ast/from.d.ts +22 -0
  40. package/dist/src/ast/from.d.ts.map +1 -0
  41. package/dist/src/ast/from.js +37 -0
  42. package/dist/src/ast/from.js.map +1 -0
  43. package/dist/src/ast/function.d.ts +18 -0
  44. package/dist/src/ast/function.d.ts.map +1 -0
  45. package/dist/src/ast/function.js +26 -0
  46. package/dist/src/ast/function.js.map +1 -0
  47. package/dist/src/ast/in-op.d.ts +18 -0
  48. package/dist/src/ast/in-op.d.ts.map +1 -0
  49. package/dist/src/ast/in-op.js +25 -0
  50. package/dist/src/ast/in-op.js.map +1 -0
  51. package/dist/src/ast/interval.d.ts +18 -0
  52. package/dist/src/ast/interval.d.ts.map +1 -0
  53. package/dist/src/ast/interval.js +25 -0
  54. package/dist/src/ast/interval.js.map +1 -0
  55. package/dist/src/ast/literal.d.ts +16 -0
  56. package/dist/src/ast/literal.d.ts.map +1 -0
  57. package/dist/src/ast/literal.js +53 -0
  58. package/dist/src/ast/literal.js.map +1 -0
  59. package/dist/src/ast/logical-op.d.ts +32 -0
  60. package/dist/src/ast/logical-op.d.ts.map +1 -0
  61. package/dist/src/ast/logical-op.js +46 -0
  62. package/dist/src/ast/logical-op.js.map +1 -0
  63. package/dist/src/ast/node.d.ts +25 -0
  64. package/dist/src/ast/node.d.ts.map +1 -0
  65. package/dist/src/ast/node.js +36 -0
  66. package/dist/src/ast/node.js.map +1 -0
  67. package/dist/src/ast/order-by.d.ts +21 -0
  68. package/dist/src/ast/order-by.d.ts.map +1 -0
  69. package/dist/src/ast/order-by.js +36 -0
  70. package/dist/src/ast/order-by.js.map +1 -0
  71. package/dist/{types → src}/ast/param.d.ts +11 -11
  72. package/dist/src/ast/param.d.ts.map +1 -0
  73. package/dist/src/ast/param.js +28 -0
  74. package/dist/src/ast/param.js.map +1 -0
  75. package/dist/src/ast/query.d.ts +294 -0
  76. package/dist/src/ast/query.d.ts.map +1 -0
  77. package/dist/src/ast/query.js +584 -0
  78. package/dist/src/ast/query.js.map +1 -0
  79. package/dist/src/ast/sample.d.ts +27 -0
  80. package/dist/src/ast/sample.d.ts.map +1 -0
  81. package/dist/src/ast/sample.js +38 -0
  82. package/dist/src/ast/sample.js.map +1 -0
  83. package/dist/src/ast/select.d.ts +19 -0
  84. package/dist/src/ast/select.d.ts.map +1 -0
  85. package/dist/src/ast/select.js +35 -0
  86. package/dist/src/ast/select.js.map +1 -0
  87. package/dist/src/ast/subquery.d.ts +16 -0
  88. package/dist/src/ast/subquery.d.ts.map +1 -0
  89. package/dist/src/ast/subquery.js +21 -0
  90. package/dist/src/ast/subquery.js.map +1 -0
  91. package/dist/src/ast/table-ref.d.ts +24 -0
  92. package/dist/src/ast/table-ref.d.ts.map +1 -0
  93. package/dist/src/ast/table-ref.js +35 -0
  94. package/dist/src/ast/table-ref.js.map +1 -0
  95. package/dist/src/ast/unary-op.d.ts +40 -0
  96. package/dist/src/ast/unary-op.d.ts.map +1 -0
  97. package/dist/src/ast/unary-op.js +52 -0
  98. package/dist/src/ast/unary-op.js.map +1 -0
  99. package/dist/src/ast/verbatim.d.ts +18 -0
  100. package/dist/src/ast/verbatim.d.ts.map +1 -0
  101. package/dist/src/ast/verbatim.js +25 -0
  102. package/dist/src/ast/verbatim.js.map +1 -0
  103. package/dist/src/ast/window-frame.d.ts +54 -0
  104. package/dist/src/ast/window-frame.d.ts.map +1 -0
  105. package/dist/src/ast/window-frame.js +79 -0
  106. package/dist/src/ast/window-frame.js.map +1 -0
  107. package/dist/src/ast/window.d.ts +128 -0
  108. package/dist/src/ast/window.d.ts.map +1 -0
  109. package/dist/src/ast/window.js +194 -0
  110. package/dist/src/ast/window.js.map +1 -0
  111. package/dist/{types → src}/ast/with.d.ts +15 -22
  112. package/dist/src/ast/with.d.ts.map +1 -0
  113. package/dist/src/ast/with.js +36 -0
  114. package/dist/src/ast/with.js.map +1 -0
  115. package/dist/src/constants.d.ts +38 -0
  116. package/dist/src/constants.d.ts.map +1 -0
  117. package/dist/src/constants.js +38 -0
  118. package/dist/src/constants.js.map +1 -0
  119. package/dist/src/functions/aggregate.d.ts +236 -0
  120. package/dist/src/functions/aggregate.d.ts.map +1 -0
  121. package/dist/src/functions/aggregate.js +308 -0
  122. package/dist/src/functions/aggregate.js.map +1 -0
  123. package/dist/{types → src}/functions/case.d.ts +7 -7
  124. package/dist/src/functions/case.d.ts.map +1 -0
  125. package/dist/src/functions/case.js +17 -0
  126. package/dist/src/functions/case.js.map +1 -0
  127. package/dist/src/functions/cast.d.ts +23 -0
  128. package/dist/src/functions/cast.d.ts.map +1 -0
  129. package/dist/src/functions/cast.js +32 -0
  130. package/dist/src/functions/cast.js.map +1 -0
  131. package/dist/src/functions/collate.d.ts +10 -0
  132. package/dist/src/functions/collate.d.ts.map +1 -0
  133. package/dist/src/functions/collate.js +12 -0
  134. package/dist/src/functions/collate.js.map +1 -0
  135. package/dist/src/functions/column.d.ts +10 -0
  136. package/dist/src/functions/column.d.ts.map +1 -0
  137. package/dist/src/functions/column.js +17 -0
  138. package/dist/src/functions/column.js.map +1 -0
  139. package/dist/{types → src}/functions/cte.d.ts +7 -7
  140. package/dist/src/functions/cte.d.ts.map +1 -0
  141. package/dist/src/functions/cte.js +14 -0
  142. package/dist/src/functions/cte.js.map +1 -0
  143. package/dist/src/functions/datetime.d.ts +32 -0
  144. package/dist/src/functions/datetime.d.ts.map +1 -0
  145. package/dist/src/functions/datetime.js +45 -0
  146. package/dist/src/functions/datetime.js.map +1 -0
  147. package/dist/src/functions/interval.d.ts +48 -0
  148. package/dist/src/functions/interval.d.ts.map +1 -0
  149. package/dist/src/functions/interval.js +66 -0
  150. package/dist/src/functions/interval.js.map +1 -0
  151. package/dist/{types → src}/functions/literal.d.ts +8 -8
  152. package/dist/src/functions/literal.d.ts.map +1 -0
  153. package/dist/src/functions/literal.js +20 -0
  154. package/dist/src/functions/literal.js.map +1 -0
  155. package/dist/src/functions/numeric.d.ts +80 -0
  156. package/dist/src/functions/numeric.d.ts.map +1 -0
  157. package/dist/src/functions/numeric.js +110 -0
  158. package/dist/src/functions/numeric.js.map +1 -0
  159. package/dist/src/functions/operators.d.ts +169 -0
  160. package/dist/src/functions/operators.d.ts.map +1 -0
  161. package/dist/src/functions/operators.js +235 -0
  162. package/dist/src/functions/operators.js.map +1 -0
  163. package/dist/src/functions/order-by.d.ts +15 -0
  164. package/dist/src/functions/order-by.d.ts.map +1 -0
  165. package/dist/src/functions/order-by.js +19 -0
  166. package/dist/src/functions/order-by.js.map +1 -0
  167. package/dist/src/functions/spatial.d.ts +32 -0
  168. package/dist/src/functions/spatial.d.ts.map +1 -0
  169. package/dist/src/functions/spatial.js +44 -0
  170. package/dist/src/functions/spatial.js.map +1 -0
  171. package/dist/{types → src}/functions/sql-template-tag.d.ts +8 -10
  172. package/dist/src/functions/sql-template-tag.d.ts.map +1 -0
  173. package/dist/src/functions/sql-template-tag.js +44 -0
  174. package/dist/src/functions/sql-template-tag.js.map +1 -0
  175. package/dist/src/functions/string.d.ts +49 -0
  176. package/dist/src/functions/string.d.ts.map +1 -0
  177. package/dist/src/functions/string.js +67 -0
  178. package/dist/src/functions/string.js.map +1 -0
  179. package/dist/src/functions/table-ref.d.ts +10 -0
  180. package/dist/src/functions/table-ref.d.ts.map +1 -0
  181. package/dist/src/functions/table-ref.js +13 -0
  182. package/dist/src/functions/table-ref.js.map +1 -0
  183. package/dist/src/functions/util.d.ts +7 -0
  184. package/dist/src/functions/util.d.ts.map +1 -0
  185. package/dist/src/functions/util.js +9 -0
  186. package/dist/src/functions/util.js.map +1 -0
  187. package/dist/src/functions/window-frame.d.ts +41 -0
  188. package/dist/src/functions/window-frame.d.ts.map +1 -0
  189. package/dist/src/functions/window-frame.js +52 -0
  190. package/dist/src/functions/window-frame.js.map +1 -0
  191. package/dist/{types → src}/functions/window.d.ts +24 -39
  192. package/dist/src/functions/window.d.ts.map +1 -0
  193. package/dist/src/functions/window.js +96 -0
  194. package/dist/src/functions/window.js.map +1 -0
  195. package/dist/src/index.d.ts +69 -0
  196. package/dist/src/index.d.ts.map +1 -0
  197. package/{src → dist/src}/index.js +16 -12
  198. package/dist/src/index.js.map +1 -0
  199. package/dist/src/load/create.d.ts +10 -0
  200. package/dist/src/load/create.d.ts.map +1 -0
  201. package/dist/src/load/create.js +14 -0
  202. package/dist/src/load/create.js.map +1 -0
  203. package/dist/src/load/extension.d.ts +2 -0
  204. package/dist/src/load/extension.d.ts.map +1 -0
  205. package/dist/src/load/extension.js +4 -0
  206. package/dist/src/load/extension.js.map +1 -0
  207. package/dist/src/load/load.d.ts +18 -0
  208. package/dist/src/load/load.d.ts.map +1 -0
  209. package/dist/src/load/load.js +80 -0
  210. package/dist/src/load/load.js.map +1 -0
  211. package/dist/src/load/sql-from.d.ts +14 -0
  212. package/dist/src/load/sql-from.d.ts.map +1 -0
  213. package/dist/src/load/sql-from.js +29 -0
  214. package/dist/src/load/sql-from.js.map +1 -0
  215. package/dist/src/transforms/bin-1d.d.ts +16 -0
  216. package/dist/src/transforms/bin-1d.d.ts.map +1 -0
  217. package/dist/src/transforms/bin-1d.js +21 -0
  218. package/dist/src/transforms/bin-1d.js.map +1 -0
  219. package/dist/src/transforms/bin-2d.d.ts +19 -0
  220. package/dist/src/transforms/bin-2d.d.ts.map +1 -0
  221. package/dist/src/transforms/bin-2d.js +27 -0
  222. package/dist/src/transforms/bin-2d.js.map +1 -0
  223. package/dist/src/transforms/bin-date.d.ts +31 -0
  224. package/dist/src/transforms/bin-date.d.ts.map +1 -0
  225. package/dist/src/transforms/bin-date.js +20 -0
  226. package/dist/src/transforms/bin-date.js.map +1 -0
  227. package/dist/src/transforms/bin-histogram.d.ts +37 -0
  228. package/dist/src/transforms/bin-histogram.d.ts.map +1 -0
  229. package/dist/src/transforms/bin-histogram.js +32 -0
  230. package/dist/src/transforms/bin-histogram.js.map +1 -0
  231. package/dist/src/transforms/bin-linear-1d.d.ts +11 -0
  232. package/dist/src/transforms/bin-linear-1d.d.ts.map +1 -0
  233. package/dist/src/transforms/bin-linear-1d.js +25 -0
  234. package/dist/src/transforms/bin-linear-1d.js.map +1 -0
  235. package/dist/src/transforms/bin-linear-2d.d.ts +20 -0
  236. package/dist/src/transforms/bin-linear-2d.d.ts.map +1 -0
  237. package/dist/src/transforms/bin-linear-2d.js +49 -0
  238. package/dist/src/transforms/bin-linear-2d.js.map +1 -0
  239. package/dist/src/transforms/filter-query.d.ts +12 -0
  240. package/dist/src/transforms/filter-query.d.ts.map +1 -0
  241. package/dist/src/transforms/filter-query.js +39 -0
  242. package/dist/src/transforms/filter-query.js.map +1 -0
  243. package/dist/src/transforms/line-density.d.ts +24 -0
  244. package/dist/src/transforms/line-density.d.ts.map +1 -0
  245. package/dist/src/transforms/line-density.js +98 -0
  246. package/dist/src/transforms/line-density.js.map +1 -0
  247. package/dist/src/transforms/m4.d.ts +19 -0
  248. package/dist/src/transforms/m4.d.ts.map +1 -0
  249. package/dist/src/transforms/m4.js +38 -0
  250. package/dist/src/transforms/m4.js.map +1 -0
  251. package/dist/src/transforms/scales.d.ts +30 -0
  252. package/dist/src/transforms/scales.d.ts.map +1 -0
  253. package/dist/src/transforms/scales.js +103 -0
  254. package/dist/src/transforms/scales.js.map +1 -0
  255. package/dist/src/transforms/util/bin-step.d.ts +50 -0
  256. package/dist/src/transforms/util/bin-step.d.ts.map +1 -0
  257. package/dist/src/transforms/util/bin-step.js +53 -0
  258. package/dist/src/transforms/util/bin-step.js.map +1 -0
  259. package/dist/src/transforms/util/time-interval.d.ts +14 -0
  260. package/dist/src/transforms/util/time-interval.d.ts.map +1 -0
  261. package/dist/src/transforms/util/time-interval.js +88 -0
  262. package/dist/src/transforms/util/time-interval.js.map +1 -0
  263. package/dist/{types → src}/types.d.ts +6 -19
  264. package/dist/src/types.d.ts.map +1 -0
  265. package/dist/src/types.js +2 -0
  266. package/dist/src/types.js.map +1 -0
  267. package/dist/{types → src}/util/ast.d.ts +26 -25
  268. package/dist/src/util/ast.d.ts.map +1 -0
  269. package/{src → dist/src}/util/ast.js +36 -41
  270. package/dist/src/util/ast.js.map +1 -0
  271. package/dist/src/util/function.d.ts +56 -0
  272. package/dist/src/util/function.d.ts.map +1 -0
  273. package/dist/src/util/function.js +73 -0
  274. package/dist/src/util/function.js.map +1 -0
  275. package/dist/src/util/identity.d.ts +6 -0
  276. package/dist/src/util/identity.d.ts.map +1 -0
  277. package/dist/src/util/identity.js +8 -0
  278. package/dist/src/util/identity.js.map +1 -0
  279. package/dist/src/util/string.d.ts +4 -0
  280. package/dist/src/util/string.d.ts.map +1 -0
  281. package/dist/src/util/string.js +14 -0
  282. package/dist/src/util/string.js.map +1 -0
  283. package/dist/src/util/type-check.d.ts +17 -0
  284. package/dist/src/util/type-check.d.ts.map +1 -0
  285. package/dist/src/util/type-check.js +28 -0
  286. package/dist/src/util/type-check.js.map +1 -0
  287. package/dist/src/visit/clone.d.ts +7 -0
  288. package/dist/src/visit/clone.d.ts.map +1 -0
  289. package/dist/src/visit/clone.js +52 -0
  290. package/dist/src/visit/clone.js.map +1 -0
  291. package/dist/src/visit/recurse.d.ts +2 -0
  292. package/dist/src/visit/recurse.d.ts.map +1 -0
  293. package/dist/src/visit/recurse.js +36 -0
  294. package/dist/src/visit/recurse.js.map +1 -0
  295. package/dist/src/visit/rewrite.d.ts +9 -0
  296. package/dist/src/visit/rewrite.d.ts.map +1 -0
  297. package/dist/src/visit/rewrite.js +39 -0
  298. package/dist/src/visit/rewrite.js.map +1 -0
  299. package/dist/{types → src}/visit/visitors.d.ts +14 -16
  300. package/dist/src/visit/visitors.d.ts.map +1 -0
  301. package/dist/src/visit/visitors.js +95 -0
  302. package/dist/src/visit/visitors.js.map +1 -0
  303. package/dist/src/visit/walk.d.ts +21 -0
  304. package/dist/src/visit/walk.d.ts.map +1 -0
  305. package/dist/src/visit/walk.js +32 -0
  306. package/dist/src/visit/walk.js.map +1 -0
  307. package/package.json +12 -10
  308. package/src/ast/aggregate.ts +198 -0
  309. package/src/ast/{between-op.js → between-op.ts} +19 -26
  310. package/src/ast/binary-op.ts +31 -0
  311. package/src/ast/{case.js → case.ts} +29 -44
  312. package/src/ast/{cast.js → cast.ts} +8 -14
  313. package/src/ast/collate.ts +27 -0
  314. package/src/ast/column-param.ts +34 -0
  315. package/src/ast/{column-ref.js → column-ref.ts} +16 -25
  316. package/src/ast/fragment.ts +28 -0
  317. package/src/ast/from.ts +40 -0
  318. package/src/ast/{function.js → function.ts} +8 -14
  319. package/src/ast/{in-op.js → in-op.ts} +8 -14
  320. package/src/ast/{interval.js → interval.ts} +8 -14
  321. package/src/ast/{literal.js → literal.ts} +6 -9
  322. package/src/ast/logical-op.ts +50 -0
  323. package/src/ast/node.ts +39 -0
  324. package/src/ast/order-by.ts +38 -0
  325. package/src/ast/{param.js → param.ts} +6 -12
  326. package/src/ast/{query.js → query.ts} +193 -205
  327. package/src/ast/sample.ts +47 -0
  328. package/src/ast/{select.js → select.ts} +10 -16
  329. package/src/ast/subquery.ts +24 -0
  330. package/src/ast/{table-ref.js → table-ref.ts} +7 -12
  331. package/src/ast/{unary-op.js → unary-op.ts} +16 -23
  332. package/src/ast/{verbatim.js → verbatim.ts} +9 -8
  333. package/src/ast/window-frame.ts +97 -0
  334. package/src/ast/window.ts +246 -0
  335. package/src/ast/{with.js → with.ts} +19 -20
  336. package/src/{constants.js → constants.ts} +5 -6
  337. package/src/functions/aggregate.ts +344 -0
  338. package/src/functions/{case.js → case.ts} +5 -8
  339. package/src/functions/{cast.js → cast.ts} +9 -13
  340. package/src/functions/collate.ts +13 -0
  341. package/src/functions/{column.js → column.ts} +9 -10
  342. package/src/functions/{cte.js → cte.ts} +9 -6
  343. package/src/functions/datetime.ts +50 -0
  344. package/src/functions/interval.ts +74 -0
  345. package/src/functions/{literal.js → literal.ts} +6 -7
  346. package/src/functions/numeric.ts +125 -0
  347. package/src/functions/operators.ts +272 -0
  348. package/src/functions/order-by.ts +21 -0
  349. package/src/functions/spatial.ts +50 -0
  350. package/src/functions/{sql-template-tag.js → sql-template-tag.ts} +16 -13
  351. package/src/functions/string.ts +79 -0
  352. package/src/functions/{table-ref.js → table-ref.ts} +4 -4
  353. package/src/functions/util.ts +10 -0
  354. package/src/functions/window-frame.ts +58 -0
  355. package/src/functions/{window.js → window.ts} +18 -35
  356. package/src/index.ts +75 -0
  357. package/src/load/{create.js → create.ts} +9 -3
  358. package/src/load/extension.ts +3 -0
  359. package/src/load/{load.js → load.ts} +26 -11
  360. package/src/load/{sql-from.js → sql-from.ts} +14 -7
  361. package/src/transforms/{bin-1d.js → bin-1d.ts} +13 -9
  362. package/src/transforms/{bin-2d.js → bin-2d.ts} +17 -13
  363. package/src/transforms/bin-date.ts +48 -0
  364. package/src/transforms/bin-histogram.ts +61 -0
  365. package/src/transforms/{bin-linear-1d.js → bin-linear-1d.ts} +16 -11
  366. package/src/transforms/{bin-linear-2d.js → bin-linear-2d.ts} +23 -35
  367. package/src/transforms/filter-query.ts +40 -0
  368. package/src/transforms/{line-density.js → line-density.ts} +19 -17
  369. package/src/transforms/{m4.js → m4.ts} +17 -14
  370. package/src/transforms/{scales.js → scales.ts} +57 -14
  371. package/src/transforms/util/bin-step.ts +100 -0
  372. package/src/transforms/util/{time-interval.js → time-interval.ts} +32 -21
  373. package/src/types.ts +5 -30
  374. package/src/util/ast.ts +104 -0
  375. package/src/util/{function.js → function.ts} +40 -31
  376. package/src/util/identity.ts +7 -0
  377. package/src/util/{string.js → string.ts} +4 -4
  378. package/src/util/type-check.ts +31 -0
  379. package/src/visit/clone.ts +53 -0
  380. package/src/visit/{recurse.js → recurse.ts} +18 -6
  381. package/src/visit/{rewrite.js → rewrite.ts} +10 -18
  382. package/src/visit/{visitors.js → visitors.ts} +22 -30
  383. package/src/visit/walk.ts +46 -0
  384. package/dist/types/ast/aggregate.d.ts +0 -71
  385. package/dist/types/ast/between-op.d.ts +0 -46
  386. package/dist/types/ast/binary-op.d.ts +0 -28
  387. package/dist/types/ast/case.d.ts +0 -67
  388. package/dist/types/ast/cast.d.ts +0 -21
  389. package/dist/types/ast/column-param.d.ts +0 -23
  390. package/dist/types/ast/column-ref.d.ts +0 -40
  391. package/dist/types/ast/fragment.d.ts +0 -14
  392. package/dist/types/ast/from.d.ts +0 -21
  393. package/dist/types/ast/function.d.ts +0 -21
  394. package/dist/types/ast/in-op.d.ts +0 -21
  395. package/dist/types/ast/interval.d.ts +0 -21
  396. package/dist/types/ast/literal.d.ts +0 -15
  397. package/dist/types/ast/logical-op.d.ts +0 -46
  398. package/dist/types/ast/node.d.ts +0 -24
  399. package/dist/types/ast/order-by.d.ts +0 -29
  400. package/dist/types/ast/query.d.ts +0 -320
  401. package/dist/types/ast/sample.d.ts +0 -42
  402. package/dist/types/ast/select.d.ts +0 -22
  403. package/dist/types/ast/table-ref.d.ts +0 -25
  404. package/dist/types/ast/unary-op.d.ts +0 -39
  405. package/dist/types/ast/verbatim.d.ts +0 -9
  406. package/dist/types/ast/window.d.ts +0 -180
  407. package/dist/types/constants.d.ts +0 -38
  408. package/dist/types/functions/aggregate.d.ts +0 -236
  409. package/dist/types/functions/cast.d.ts +0 -26
  410. package/dist/types/functions/column.d.ts +0 -11
  411. package/dist/types/functions/datetime.d.ts +0 -45
  412. package/dist/types/functions/numeric.d.ts +0 -95
  413. package/dist/types/functions/operators.d.ts +0 -200
  414. package/dist/types/functions/order-by.d.ts +0 -18
  415. package/dist/types/functions/spatial.d.ts +0 -38
  416. package/dist/types/functions/string.d.ts +0 -57
  417. package/dist/types/functions/table-ref.d.ts +0 -9
  418. package/dist/types/functions/util.d.ts +0 -8
  419. package/dist/types/index-types.d.ts +0 -2
  420. package/dist/types/index.d.ts +0 -59
  421. package/dist/types/load/create.d.ts +0 -8
  422. package/dist/types/load/extension.d.ts +0 -1
  423. package/dist/types/load/load.d.ts +0 -12
  424. package/dist/types/load/sql-from.d.ts +0 -11
  425. package/dist/types/transforms/bin-1d.d.ts +0 -15
  426. package/dist/types/transforms/bin-2d.d.ts +0 -19
  427. package/dist/types/transforms/bin-date.d.ts +0 -44
  428. package/dist/types/transforms/bin-histogram.d.ts +0 -51
  429. package/dist/types/transforms/bin-linear-1d.d.ts +0 -12
  430. package/dist/types/transforms/bin-linear-2d.d.ts +0 -19
  431. package/dist/types/transforms/line-density.d.ts +0 -24
  432. package/dist/types/transforms/m4.d.ts +0 -21
  433. package/dist/types/transforms/scales.d.ts +0 -1
  434. package/dist/types/transforms/util/bin-step.d.ts +0 -61
  435. package/dist/types/transforms/util/time-interval.d.ts +0 -13
  436. package/dist/types/util/function.d.ts +0 -56
  437. package/dist/types/util/string.d.ts +0 -3
  438. package/dist/types/util/type-check.d.ts +0 -22
  439. package/dist/types/visit/recurse.d.ts +0 -28
  440. package/dist/types/visit/rewrite.d.ts +0 -10
  441. package/dist/types/visit/walk.d.ts +0 -10
  442. package/jsconfig.json +0 -11
  443. package/src/ast/aggregate.js +0 -167
  444. package/src/ast/binary-op.js +0 -40
  445. package/src/ast/column-param.js +0 -40
  446. package/src/ast/fragment.js +0 -26
  447. package/src/ast/from.js +0 -40
  448. package/src/ast/logical-op.js +0 -67
  449. package/src/ast/node.js +0 -29
  450. package/src/ast/order-by.js +0 -48
  451. package/src/ast/sample.js +0 -53
  452. package/src/ast/window.js +0 -294
  453. package/src/functions/aggregate.js +0 -347
  454. package/src/functions/datetime.js +0 -68
  455. package/src/functions/numeric.js +0 -143
  456. package/src/functions/operators.js +0 -301
  457. package/src/functions/order-by.js +0 -27
  458. package/src/functions/spatial.js +0 -59
  459. package/src/functions/string.js +0 -85
  460. package/src/functions/util.js +0 -14
  461. package/src/index-types.ts +0 -2
  462. package/src/load/extension.js +0 -3
  463. package/src/transforms/bin-date.js +0 -37
  464. package/src/transforms/bin-histogram.js +0 -52
  465. package/src/transforms/util/bin-step.js +0 -79
  466. package/src/util/type-check.js +0 -33
  467. package/src/visit/walk.js +0 -35
  468. package/tsconfig.json +0 -12
  469. package/vitest.config.ts +0 -3
@@ -0,0 +1,46 @@
1
+ import { LOGICAL_OPERATOR } from '../constants.js';
2
+ import { ExprNode } from './node.js';
3
+ export class LogicalOpNode extends ExprNode {
4
+ /** The logical operator */
5
+ op;
6
+ /** The clause expressions. */
7
+ clauses;
8
+ /**
9
+ * Instantiate a logical operator node.
10
+ * @param op The logical operation.
11
+ * @param clauses The input clause expressions.
12
+ */
13
+ constructor(op, clauses) {
14
+ super(LOGICAL_OPERATOR);
15
+ this.op = op;
16
+ this.clauses = clauses;
17
+ }
18
+ /**
19
+ * Generate a SQL query string for this node.
20
+ */
21
+ toString() {
22
+ const c = this.clauses;
23
+ return c.length === 0 ? ''
24
+ : c.length === 1 ? `${c[0]}`
25
+ : `(${c.join(` ${this.op} `)})`;
26
+ }
27
+ }
28
+ export class AndNode extends LogicalOpNode {
29
+ /**
30
+ * Instantiate a logical AND operator node.
31
+ * @param clauses The input clause expressions.
32
+ */
33
+ constructor(clauses) {
34
+ super('AND', clauses);
35
+ }
36
+ }
37
+ export class OrNode extends LogicalOpNode {
38
+ /**
39
+ * Instantiate a logical OR operator node.
40
+ * @param clauses The input clause expressions.
41
+ */
42
+ constructor(clauses) {
43
+ super('OR', clauses);
44
+ }
45
+ }
46
+ //# sourceMappingURL=logical-op.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logical-op.js","sourceRoot":"","sources":["../../../src/ast/logical-op.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,OAAO,aAAkC,SAAQ,QAAQ;IAC7D,2BAA2B;IAClB,EAAE,CAAS;IACpB,8BAA8B;IACrB,OAAO,CAAM;IAEtB;;;;OAIG;IACH,YAAY,EAAU,EAAE,OAAY;QAClC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACxB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC5B,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,OAA4B,SAAQ,aAAgB;IAC/D;;;OAGG;IACH,YAAY,OAAY;QACtB,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxB,CAAC;CACF;AAED,MAAM,OAAO,MAA2B,SAAQ,aAAgB;IAC9D;;;OAGG;IACH,YAAY,OAAY;QACtB,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Check if a value is a SQL AST node.
3
+ * @param value The value to check.
4
+ */
5
+ export declare function isNode(value: unknown): value is SQLNode;
6
+ export declare class SQLNode {
7
+ /** The SQL AST node type. */
8
+ readonly type: string;
9
+ /**
10
+ * Instantiate a SQL AST node.
11
+ * @param type The SQL AST node type.
12
+ */
13
+ constructor(type: string);
14
+ /**
15
+ * Create a shallow clone of this SQL AST node.
16
+ * @returns The shallow clone node.
17
+ */
18
+ clone(): this;
19
+ }
20
+ /**
21
+ * AST node corresponding to an individual expression.
22
+ */
23
+ export declare class ExprNode extends SQLNode {
24
+ }
25
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ast/node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAEvD;AAED,qBAAa,OAAO;IAClB,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;gBACS,IAAI,EAAE,MAAM;IAIxB;;;OAGG;IACH,KAAK,IAAI,IAAI;CAQd;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,OAAO;CACpC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Check if a value is a SQL AST node.
3
+ * @param value The value to check.
4
+ */
5
+ export function isNode(value) {
6
+ return value instanceof SQLNode;
7
+ }
8
+ export class SQLNode {
9
+ /** The SQL AST node type. */
10
+ type;
11
+ /**
12
+ * Instantiate a SQL AST node.
13
+ * @param type The SQL AST node type.
14
+ */
15
+ constructor(type) {
16
+ this.type = type;
17
+ }
18
+ /**
19
+ * Create a shallow clone of this SQL AST node.
20
+ * @returns The shallow clone node.
21
+ */
22
+ clone() {
23
+ // @ts-expect-error use constructor
24
+ const clone = new this.constructor();
25
+ for (const key in this) {
26
+ clone[key] = this[key];
27
+ }
28
+ return clone;
29
+ }
30
+ }
31
+ /**
32
+ * AST node corresponding to an individual expression.
33
+ */
34
+ export class ExprNode extends SQLNode {
35
+ }
36
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/ast/node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,OAAO,CAAC;AAClC,CAAC;AAED,MAAM,OAAO,OAAO;IAClB,6BAA6B;IACpB,IAAI,CAAS;IAEtB;;;OAGG;IACH,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,mCAAmC;QACnC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,OAAO;CACpC"}
@@ -0,0 +1,21 @@
1
+ import { ExprNode } from './node.js';
2
+ export declare class OrderByNode extends ExprNode {
3
+ /** The expression to order by. */
4
+ readonly expr: ExprNode;
5
+ /** Flag indicating descending order. */
6
+ readonly desc?: boolean;
7
+ /** Flag indicating if null values should be sorted first. */
8
+ readonly nullsFirst?: boolean;
9
+ /**
10
+ * Instantiate an order by entry node.
11
+ * @param expr The expression to order by.
12
+ * @param desc Flag indicating descending order.
13
+ * @param nullsFirst Flag indicating if null values should be sorted first.
14
+ */
15
+ constructor(expr: ExprNode, desc?: boolean, nullsFirst?: boolean);
16
+ /**
17
+ * Generate a SQL query string for this node.
18
+ */
19
+ toString(): string;
20
+ }
21
+ //# sourceMappingURL=order-by.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/ast/order-by.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,qBAAa,WAAY,SAAQ,QAAQ;IACvC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;OAKG;gBACS,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO;IAOhE;;OAEG;IACH,QAAQ;CAUT"}
@@ -0,0 +1,36 @@
1
+ import { ORDER_BY } from '../constants.js';
2
+ import { ExprNode } from './node.js';
3
+ export class OrderByNode extends ExprNode {
4
+ /** The expression to order by. */
5
+ expr;
6
+ /** Flag indicating descending order. */
7
+ desc;
8
+ /** Flag indicating if null values should be sorted first. */
9
+ nullsFirst;
10
+ /**
11
+ * Instantiate an order by entry node.
12
+ * @param expr The expression to order by.
13
+ * @param desc Flag indicating descending order.
14
+ * @param nullsFirst Flag indicating if null values should be sorted first.
15
+ */
16
+ constructor(expr, desc, nullsFirst) {
17
+ super(ORDER_BY);
18
+ this.expr = expr;
19
+ this.desc = desc;
20
+ this.nullsFirst = nullsFirst;
21
+ }
22
+ /**
23
+ * Generate a SQL query string for this node.
24
+ */
25
+ toString() {
26
+ const { expr, desc, nullsFirst } = this;
27
+ const dir = desc ? ' DESC'
28
+ : desc === false ? ' ASC'
29
+ : '';
30
+ const nf = nullsFirst ? ' NULLS FIRST'
31
+ : nullsFirst === false ? ' NULLS LAST'
32
+ : '';
33
+ return `${expr}${dir}${nf}`;
34
+ }
35
+ }
36
+ //# sourceMappingURL=order-by.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/ast/order-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,OAAO,WAAY,SAAQ,QAAQ;IACvC,kCAAkC;IACzB,IAAI,CAAW;IACxB,wCAAwC;IAC/B,IAAI,CAAW;IACxB,6DAA6D;IACpD,UAAU,CAAW;IAE9B;;;;;OAKG;IACH,YAAY,IAAc,EAAE,IAAc,EAAE,UAAoB;QAC9D,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO;YACxB,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM;gBACzB,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,cAAc;YACpC,CAAC,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,aAAa;gBACtC,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,GAAG,IAAI,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC;IAC9B,CAAC;CACF"}
@@ -1,20 +1,20 @@
1
- export class ParamNode extends ExprNode {
1
+ import type { ParamLike } from '../types.js';
2
+ import { ExprNode } from './node.js';
3
+ export declare class ParamNode extends ExprNode {
4
+ /** The dynamic parameter. */
5
+ readonly param: ParamLike;
2
6
  /**
3
7
  * Instantiate a param node with a dynamic parameter.
4
- * @param {ParamLike} param The dynamic parameter.
8
+ * @param param The dynamic parameter.
5
9
  */
6
10
  constructor(param: ParamLike);
7
11
  /**
8
- * The dynamic parameter.
9
- * @type {ParamLike}
10
- * @readonly
12
+ * Returns the current parameter value.
11
13
  */
12
- readonly param: ParamLike;
14
+ get value(): unknown;
13
15
  /**
14
- * Returns the current parameter value.
15
- * @returns {*}
16
+ * Generate a SQL query string for this node.
16
17
  */
17
- get value(): any;
18
+ toString(): string;
18
19
  }
19
- import { ExprNode } from './node.js';
20
- import type { ParamLike } from '../types.js';
20
+ //# sourceMappingURL=param.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../../src/ast/param.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,qBAAa,SAAU,SAAQ,QAAQ;IACrC,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAE1B;;;OAGG;gBACS,KAAK,EAAE,SAAS;IAK5B;;OAEG;IACH,IAAI,KAAK,YAER;IAED;;OAEG;IACH,QAAQ;CAGT"}
@@ -0,0 +1,28 @@
1
+ import { PARAM } from '../constants.js';
2
+ import { literalToSQL } from './literal.js';
3
+ import { ExprNode } from './node.js';
4
+ export class ParamNode extends ExprNode {
5
+ /** The dynamic parameter. */
6
+ param;
7
+ /**
8
+ * Instantiate a param node with a dynamic parameter.
9
+ * @param param The dynamic parameter.
10
+ */
11
+ constructor(param) {
12
+ super(PARAM);
13
+ this.param = param;
14
+ }
15
+ /**
16
+ * Returns the current parameter value.
17
+ */
18
+ get value() {
19
+ return this.param.value;
20
+ }
21
+ /**
22
+ * Generate a SQL query string for this node.
23
+ */
24
+ toString() {
25
+ return literalToSQL(this.value);
26
+ }
27
+ }
28
+ //# sourceMappingURL=param.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"param.js","sourceRoot":"","sources":["../../../src/ast/param.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,OAAO,SAAU,SAAQ,QAAQ;IACrC,6BAA6B;IACpB,KAAK,CAAY;IAE1B;;;OAGG;IACH,YAAY,KAAgB;QAC1B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,294 @@
1
+ import type { FilterExpr, FromExpr, GroupByExpr, MaybeArray, OrderByExpr, SelectExpr, WithExpr } from '../types.js';
2
+ import type { SampleMethod } from './sample.js';
3
+ import { FromClauseNode } from './from.js';
4
+ import { ExprNode, SQLNode } from './node.js';
5
+ import { SampleClauseNode } from './sample.js';
6
+ import { SelectClauseNode } from './select.js';
7
+ import { WindowClauseNode, type WindowDefNode } from './window.js';
8
+ import { WithClauseNode } from './with.js';
9
+ /**
10
+ * Check if a value is a selection query or set operation.
11
+ * @param value The value to check.
12
+ */
13
+ export declare function isQuery(value: unknown): value is Query;
14
+ /**
15
+ * Check if a value is a selection query.
16
+ * @param value The value to check.
17
+ */
18
+ export declare function isSelectQuery(value: unknown): value is SelectQuery;
19
+ /**
20
+ * Check if a value is a describe query.
21
+ * @param value The value to check.
22
+ */
23
+ export declare function isDescribeQuery(value: unknown): value is DescribeQuery;
24
+ export declare class Query extends ExprNode {
25
+ /**
26
+ * Create a new WITH clause with the given CTE queries.
27
+ * @param expr The WITH CTE queries.
28
+ */
29
+ static with(...expr: WithExpr[]): WithClause;
30
+ /**
31
+ * Create a new select query with the given SELECT expressions.
32
+ * @param expr The SELECT expressions.
33
+ */
34
+ static select(...expr: SelectExpr[]): SelectQuery;
35
+ /**
36
+ * Create a new select query with the given FROM expressions.
37
+ * @param expr The FROM expressions.
38
+ */
39
+ static from(...expr: FromExpr[]): SelectQuery;
40
+ /**
41
+ * Create a new UNION set operation over the given queries.
42
+ * @param queries The queries.
43
+ */
44
+ static union(...queries: MaybeArray<Query>[]): SetOperation;
45
+ /**
46
+ * Create a new UNION ALL set operation over the given queries.
47
+ * @param queries The queries.
48
+ */
49
+ static unionAll(...queries: MaybeArray<Query>[]): SetOperation;
50
+ /**
51
+ * Create a new INTERSECT set operation over the given queries.
52
+ * @param queries The queries.
53
+ */
54
+ static intersect(...queries: MaybeArray<Query>[]): SetOperation;
55
+ /**
56
+ * Create a new EXCEPT set operation over the given queries.
57
+ * @param queries The queries.
58
+ */
59
+ static except(...queries: MaybeArray<Query>[]): SetOperation;
60
+ /**
61
+ * Create a new describe query for the given input query.
62
+ * @param query The query to describe.
63
+ */
64
+ static describe(query: Query): DescribeQuery;
65
+ _with: WithClauseNode[];
66
+ _orderby: ExprNode[];
67
+ _limitPerc: boolean;
68
+ _limit?: ExprNode;
69
+ _offset?: ExprNode;
70
+ cteFor?: Query | null;
71
+ /**
72
+ * Instantiate a new query.
73
+ */
74
+ constructor(type: string);
75
+ /**
76
+ * Return a list of subqueries.
77
+ */
78
+ get subqueries(): Query[];
79
+ /**
80
+ * Clone this query.
81
+ */
82
+ clone(): this;
83
+ /**
84
+ * Add a pointer to the query for which this query is a CTE.
85
+ * @param query The query for which this query is a CTE.
86
+ */
87
+ setCteFor(query: Query | null): void;
88
+ /**
89
+ * Add WITH common table expressions (CTEs).
90
+ * @param expr Expressions to add.
91
+ */
92
+ with(...expr: WithExpr[]): this;
93
+ /**
94
+ * Add ORDER BY expressions.
95
+ * @param expr Expressions to add.
96
+ */
97
+ orderby(...expr: OrderByExpr[]): this;
98
+ /**
99
+ * Set the query result LIMIT as a percentage value.
100
+ * @param value The limit percentage value.
101
+ */
102
+ limitPercent(value: number | ExprNode): this;
103
+ /**
104
+ * Set the query result LIMIT.
105
+ * @param value The limit value.
106
+ */
107
+ limit(value: number | ExprNode): this;
108
+ /**
109
+ * Set the query result OFFSET.
110
+ * @param value The offset value.
111
+ */
112
+ offset(value: number | ExprNode): this;
113
+ }
114
+ export declare class SelectQuery extends Query {
115
+ _select: SelectClauseNode[];
116
+ _from: FromClauseNode[];
117
+ _where: ExprNode[];
118
+ _sample?: SampleClauseNode;
119
+ _groupby: ExprNode[];
120
+ _having: ExprNode[];
121
+ _window: WindowClauseNode[];
122
+ _qualify: ExprNode[];
123
+ _distinct: boolean;
124
+ /**
125
+ * Instantiate a new select query.
126
+ */
127
+ constructor();
128
+ /**
129
+ * Return a list of subqueries.
130
+ */
131
+ get subqueries(): Query[];
132
+ /**
133
+ * Clone this query.
134
+ */
135
+ clone(): this;
136
+ /**
137
+ * Add SELECT expressions.
138
+ * @param expr Expressions to add.
139
+ */
140
+ select(...expr: SelectExpr[]): this;
141
+ /**
142
+ * Set SELECT expressions, replacing any prior expressions.
143
+ * @param expr Expressions to add.
144
+ */
145
+ setSelect(...expr: SelectExpr[]): this;
146
+ /**
147
+ * Indicate if this query should retrieve distinct values only.
148
+ * @param value The distinct flag
149
+ */
150
+ distinct(value?: boolean): this;
151
+ /**
152
+ * Add table FROM expressions.
153
+ * @param expr Expressions to add.
154
+ */
155
+ from(...expr: FromExpr[]): this;
156
+ /**
157
+ * Set FROM expressions, replacing any prior expressions.
158
+ * @param expr Expressions to add.
159
+ */
160
+ setFrom(...expr: FromExpr[]): this;
161
+ /**
162
+ * Set SAMPLE settings.
163
+ * @param value Either a sample clause node or the sample size as either
164
+ * a row count or percentage.
165
+ * @param method The sampling method to use.
166
+ * @param seed The random seed.
167
+ */
168
+ sample(value: number | SampleClauseNode, method?: SampleMethod, seed?: number): this;
169
+ /**
170
+ * Add WHERE expressions.
171
+ * @param expr Expressions to add.
172
+ */
173
+ where(...expr: FilterExpr[]): this;
174
+ /**
175
+ * Set WHERE expressions, replacing any prior expressions.
176
+ * @param expr Expressions to add.
177
+ */
178
+ setWhere(...expr: FilterExpr[]): this;
179
+ /**
180
+ * Add GROUP BY expressions.
181
+ * @param expr Expressions to add.
182
+ */
183
+ groupby(...expr: GroupByExpr[]): this;
184
+ /**
185
+ * Set GROUP BY expressions, replacing any prior expressions.
186
+ * @param expr Expressions to add.
187
+ */
188
+ setGroupby(...expr: GroupByExpr[]): this;
189
+ /**
190
+ * Add HAVING expressions.
191
+ * @param expr Expressions to add.
192
+ */
193
+ having(...expr: FilterExpr[]): this;
194
+ /**
195
+ * Add WINDOW definitions.
196
+ * @param expr Window definitions to add.
197
+ */
198
+ window(...expr: (Record<string, WindowDefNode> | null)[]): this;
199
+ /**
200
+ * Add QUALIFY expressions.
201
+ * @param expr Expressions to add.
202
+ */
203
+ qualify(...expr: FilterExpr[]): this;
204
+ /**
205
+ * Generate a SQL query string.
206
+ */
207
+ toString(): string;
208
+ }
209
+ export declare class DescribeQuery extends SQLNode {
210
+ readonly query: Query;
211
+ /**
212
+ * Instantiate a describe query.
213
+ * @param query The query to describe.
214
+ */
215
+ constructor(query: Query);
216
+ /**
217
+ * Clone this describe query.
218
+ */
219
+ clone(): this;
220
+ /**
221
+ * Generate a SQL query string.
222
+ */
223
+ toString(): string;
224
+ }
225
+ export declare class SetOperation extends Query {
226
+ /** The set operation to perform. */
227
+ readonly op: string;
228
+ /** The input queries to the set operation. */
229
+ readonly queries: Query[];
230
+ /**
231
+ * Instantiate a new set operation instance.
232
+ * @param op The set operation.
233
+ * @param queries The subqueries.
234
+ */
235
+ constructor(op: string, queries: Query[]);
236
+ /**
237
+ * Add a pointer to the query for which this query is a CTE.
238
+ * @param query The query for which this query is a CTE.
239
+ */
240
+ setCteFor(query: Query | null): void;
241
+ /**
242
+ * Return a list of subqueries.
243
+ */
244
+ get subqueries(): Query[];
245
+ /**
246
+ * Clone this set operation.
247
+ */
248
+ clone(): this;
249
+ /**
250
+ * Generate a SQL query string.
251
+ */
252
+ toString(): string;
253
+ }
254
+ declare class WithClause {
255
+ /** The common table expressions (CTE). */
256
+ readonly _with: WithExpr[];
257
+ /**
258
+ * Instantiate a new WITH clause instance.
259
+ * @param expr The WITH CTE queries.
260
+ */
261
+ constructor(...expr: WithExpr[]);
262
+ /**
263
+ * Create a new select query with the given SELECT expressions.
264
+ * @param expr The SELECT expressions.
265
+ */
266
+ select(...expr: SelectExpr[]): SelectQuery;
267
+ /**
268
+ * Create a new select query with the given FROM expressions.
269
+ * @param expr The FROM expressions.
270
+ */
271
+ from(...expr: FromExpr[]): SelectQuery;
272
+ /**
273
+ * Create a new UNION set operation over the given queries.
274
+ * @param queries The queries.
275
+ */
276
+ union(...queries: Query[]): SetOperation;
277
+ /**
278
+ * Create a new UNION ALL set operation over the given queries.
279
+ * @param queries The queries.
280
+ */
281
+ unionAll(...queries: Query[]): SetOperation;
282
+ /**
283
+ * Create a new INTERSECT set operation over the given queries.
284
+ * @param queries The queries.
285
+ */
286
+ intersect(...queries: Query[]): SetOperation;
287
+ /**
288
+ * Create a new EXCEPT set operation over the given queries.
289
+ * @param queries The queries.
290
+ */
291
+ except(...queries: Query[]): SetOperation;
292
+ }
293
+ export {};
294
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/ast/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED,qBAAa,KAAM,SAAQ,QAAQ;IACjC;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE;IAI/B;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,IA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