@uwdata/mosaic-sql 0.17.0 → 0.19.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 (429) hide show
  1. package/LICENSE +47 -0
  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/list.d.ts +15 -0
  56. package/dist/src/ast/list.d.ts.map +1 -0
  57. package/dist/src/ast/list.js +21 -0
  58. package/dist/src/ast/list.js.map +1 -0
  59. package/dist/src/ast/literal.d.ts +16 -0
  60. package/dist/src/ast/literal.d.ts.map +1 -0
  61. package/dist/src/ast/literal.js +53 -0
  62. package/dist/src/ast/literal.js.map +1 -0
  63. package/dist/src/ast/logical-op.d.ts +32 -0
  64. package/dist/src/ast/logical-op.d.ts.map +1 -0
  65. package/dist/src/ast/logical-op.js +46 -0
  66. package/dist/src/ast/logical-op.js.map +1 -0
  67. package/dist/src/ast/node.d.ts +25 -0
  68. package/dist/src/ast/node.d.ts.map +1 -0
  69. package/dist/src/ast/node.js +36 -0
  70. package/dist/src/ast/node.js.map +1 -0
  71. package/dist/src/ast/order-by.d.ts +21 -0
  72. package/dist/src/ast/order-by.d.ts.map +1 -0
  73. package/dist/src/ast/order-by.js +36 -0
  74. package/dist/src/ast/order-by.js.map +1 -0
  75. package/dist/src/ast/param.d.ts +20 -0
  76. package/dist/src/ast/param.d.ts.map +1 -0
  77. package/dist/src/ast/param.js +28 -0
  78. package/dist/src/ast/param.js.map +1 -0
  79. package/dist/src/ast/query.d.ts +334 -0
  80. package/dist/src/ast/query.d.ts.map +1 -0
  81. package/dist/src/ast/query.js +640 -0
  82. package/dist/src/ast/query.js.map +1 -0
  83. package/dist/src/ast/sample.d.ts +27 -0
  84. package/dist/src/ast/sample.d.ts.map +1 -0
  85. package/dist/src/ast/sample.js +38 -0
  86. package/dist/src/ast/sample.js.map +1 -0
  87. package/dist/src/ast/select.d.ts +19 -0
  88. package/dist/src/ast/select.d.ts.map +1 -0
  89. package/dist/src/ast/select.js +35 -0
  90. package/dist/src/ast/select.js.map +1 -0
  91. package/dist/src/ast/subquery.d.ts +16 -0
  92. package/dist/src/ast/subquery.d.ts.map +1 -0
  93. package/dist/src/ast/subquery.js +21 -0
  94. package/dist/src/ast/subquery.js.map +1 -0
  95. package/dist/src/ast/table-ref.d.ts +24 -0
  96. package/dist/src/ast/table-ref.d.ts.map +1 -0
  97. package/dist/src/ast/table-ref.js +35 -0
  98. package/dist/src/ast/table-ref.js.map +1 -0
  99. package/dist/src/ast/unary-op.d.ts +40 -0
  100. package/dist/src/ast/unary-op.d.ts.map +1 -0
  101. package/dist/src/ast/unary-op.js +52 -0
  102. package/dist/src/ast/unary-op.js.map +1 -0
  103. package/dist/src/ast/unnest.d.ts +19 -0
  104. package/dist/src/ast/unnest.d.ts.map +1 -0
  105. package/dist/src/ast/unnest.js +29 -0
  106. package/dist/src/ast/unnest.js.map +1 -0
  107. package/dist/src/ast/verbatim.d.ts +18 -0
  108. package/dist/src/ast/verbatim.d.ts.map +1 -0
  109. package/dist/src/ast/verbatim.js +25 -0
  110. package/dist/src/ast/verbatim.js.map +1 -0
  111. package/dist/src/ast/window-frame.d.ts +54 -0
  112. package/dist/src/ast/window-frame.d.ts.map +1 -0
  113. package/dist/src/ast/window-frame.js +79 -0
  114. package/dist/src/ast/window-frame.js.map +1 -0
  115. package/dist/src/ast/window.d.ts +128 -0
  116. package/dist/src/ast/window.d.ts.map +1 -0
  117. package/dist/src/ast/window.js +194 -0
  118. package/dist/src/ast/window.js.map +1 -0
  119. package/dist/src/ast/with.d.ts +25 -0
  120. package/dist/src/ast/with.d.ts.map +1 -0
  121. package/dist/src/ast/with.js +36 -0
  122. package/dist/src/ast/with.js.map +1 -0
  123. package/dist/src/constants.d.ts +40 -0
  124. package/dist/src/constants.d.ts.map +1 -0
  125. package/dist/src/constants.js +40 -0
  126. package/dist/src/constants.js.map +1 -0
  127. package/dist/src/functions/aggregate.d.ts +236 -0
  128. package/dist/src/functions/aggregate.d.ts.map +1 -0
  129. package/dist/src/functions/aggregate.js +308 -0
  130. package/dist/src/functions/aggregate.js.map +1 -0
  131. package/dist/src/functions/case.d.ts +13 -0
  132. package/dist/src/functions/case.d.ts.map +1 -0
  133. package/dist/src/functions/case.js +17 -0
  134. package/dist/src/functions/case.js.map +1 -0
  135. package/dist/src/functions/cast.d.ts +23 -0
  136. package/dist/src/functions/cast.d.ts.map +1 -0
  137. package/dist/src/functions/cast.js +32 -0
  138. package/dist/src/functions/cast.js.map +1 -0
  139. package/dist/src/functions/collate.d.ts +10 -0
  140. package/dist/src/functions/collate.d.ts.map +1 -0
  141. package/dist/src/functions/collate.js +12 -0
  142. package/dist/src/functions/collate.js.map +1 -0
  143. package/dist/src/functions/column.d.ts +10 -0
  144. package/dist/src/functions/column.d.ts.map +1 -0
  145. package/dist/src/functions/column.js +17 -0
  146. package/dist/src/functions/column.js.map +1 -0
  147. package/dist/src/functions/cte.d.ts +13 -0
  148. package/dist/src/functions/cte.d.ts.map +1 -0
  149. package/dist/src/functions/cte.js +14 -0
  150. package/dist/src/functions/cte.js.map +1 -0
  151. package/dist/src/functions/datetime.d.ts +32 -0
  152. package/dist/src/functions/datetime.d.ts.map +1 -0
  153. package/dist/src/functions/datetime.js +45 -0
  154. package/dist/src/functions/datetime.js.map +1 -0
  155. package/dist/src/functions/interval.d.ts +48 -0
  156. package/dist/src/functions/interval.d.ts.map +1 -0
  157. package/dist/src/functions/interval.js +66 -0
  158. package/dist/src/functions/interval.js.map +1 -0
  159. package/dist/src/functions/list.d.ts +31 -0
  160. package/dist/src/functions/list.d.ts.map +1 -0
  161. package/dist/src/functions/list.js +49 -0
  162. package/dist/src/functions/list.js.map +1 -0
  163. package/dist/src/functions/literal.d.ts +16 -0
  164. package/dist/src/functions/literal.d.ts.map +1 -0
  165. package/dist/src/functions/literal.js +20 -0
  166. package/dist/src/functions/literal.js.map +1 -0
  167. package/dist/src/functions/numeric.d.ts +80 -0
  168. package/dist/src/functions/numeric.d.ts.map +1 -0
  169. package/dist/src/functions/numeric.js +110 -0
  170. package/dist/src/functions/numeric.js.map +1 -0
  171. package/dist/src/functions/operators.d.ts +169 -0
  172. package/dist/src/functions/operators.d.ts.map +1 -0
  173. package/dist/src/functions/operators.js +235 -0
  174. package/dist/src/functions/operators.js.map +1 -0
  175. package/dist/src/functions/order-by.d.ts +15 -0
  176. package/dist/src/functions/order-by.d.ts.map +1 -0
  177. package/dist/src/functions/order-by.js +19 -0
  178. package/dist/src/functions/order-by.js.map +1 -0
  179. package/dist/src/functions/spatial.d.ts +32 -0
  180. package/dist/src/functions/spatial.d.ts.map +1 -0
  181. package/dist/src/functions/spatial.js +44 -0
  182. package/dist/src/functions/spatial.js.map +1 -0
  183. package/dist/src/functions/sql-template-tag.d.ts +13 -0
  184. package/dist/src/functions/sql-template-tag.d.ts.map +1 -0
  185. package/dist/src/functions/sql-template-tag.js +44 -0
  186. package/dist/src/functions/sql-template-tag.js.map +1 -0
  187. package/dist/src/functions/string.d.ts +49 -0
  188. package/dist/src/functions/string.d.ts.map +1 -0
  189. package/dist/src/functions/string.js +67 -0
  190. package/dist/src/functions/string.js.map +1 -0
  191. package/dist/src/functions/table-ref.d.ts +10 -0
  192. package/dist/src/functions/table-ref.d.ts.map +1 -0
  193. package/dist/src/functions/table-ref.js +13 -0
  194. package/dist/src/functions/table-ref.js.map +1 -0
  195. package/dist/src/functions/unnest.d.ts +10 -0
  196. package/dist/src/functions/unnest.d.ts.map +1 -0
  197. package/dist/src/functions/unnest.js +12 -0
  198. package/dist/src/functions/unnest.js.map +1 -0
  199. package/dist/src/functions/util.d.ts +7 -0
  200. package/dist/src/functions/util.d.ts.map +1 -0
  201. package/dist/src/functions/util.js +9 -0
  202. package/dist/src/functions/util.js.map +1 -0
  203. package/dist/src/functions/window-frame.d.ts +41 -0
  204. package/dist/src/functions/window-frame.d.ts.map +1 -0
  205. package/dist/src/functions/window-frame.js +52 -0
  206. package/dist/src/functions/window-frame.js.map +1 -0
  207. package/dist/src/functions/window.d.ts +74 -0
  208. package/dist/src/functions/window.d.ts.map +1 -0
  209. package/dist/src/functions/window.js +96 -0
  210. package/dist/src/functions/window.js.map +1 -0
  211. package/dist/src/index.d.ts +73 -0
  212. package/dist/src/index.d.ts.map +1 -0
  213. package/{src → dist/src}/index.js +8 -8
  214. package/dist/src/index.js.map +1 -0
  215. package/dist/src/load/create.d.ts +10 -0
  216. package/dist/src/load/create.d.ts.map +1 -0
  217. package/dist/src/load/create.js +14 -0
  218. package/dist/src/load/create.js.map +1 -0
  219. package/dist/src/load/extension.d.ts +2 -0
  220. package/dist/src/load/extension.d.ts.map +1 -0
  221. package/dist/src/load/extension.js +4 -0
  222. package/dist/src/load/extension.js.map +1 -0
  223. package/dist/src/load/load.d.ts +18 -0
  224. package/dist/src/load/load.d.ts.map +1 -0
  225. package/dist/src/load/load.js +80 -0
  226. package/dist/src/load/load.js.map +1 -0
  227. package/dist/src/load/sql-from.d.ts +14 -0
  228. package/dist/src/load/sql-from.d.ts.map +1 -0
  229. package/dist/src/load/sql-from.js +29 -0
  230. package/dist/src/load/sql-from.js.map +1 -0
  231. package/dist/src/transforms/bin-1d.d.ts +16 -0
  232. package/dist/src/transforms/bin-1d.d.ts.map +1 -0
  233. package/dist/src/transforms/bin-1d.js +21 -0
  234. package/dist/src/transforms/bin-1d.js.map +1 -0
  235. package/dist/src/transforms/bin-2d.d.ts +19 -0
  236. package/dist/src/transforms/bin-2d.d.ts.map +1 -0
  237. package/dist/src/transforms/bin-2d.js +27 -0
  238. package/dist/src/transforms/bin-2d.js.map +1 -0
  239. package/dist/src/transforms/bin-date.d.ts +31 -0
  240. package/dist/src/transforms/bin-date.d.ts.map +1 -0
  241. package/dist/src/transforms/bin-date.js +20 -0
  242. package/dist/src/transforms/bin-date.js.map +1 -0
  243. package/dist/src/transforms/bin-histogram.d.ts +37 -0
  244. package/dist/src/transforms/bin-histogram.d.ts.map +1 -0
  245. package/dist/src/transforms/bin-histogram.js +32 -0
  246. package/dist/src/transforms/bin-histogram.js.map +1 -0
  247. package/dist/src/transforms/bin-linear-1d.d.ts +11 -0
  248. package/dist/src/transforms/bin-linear-1d.d.ts.map +1 -0
  249. package/dist/src/transforms/bin-linear-1d.js +25 -0
  250. package/dist/src/transforms/bin-linear-1d.js.map +1 -0
  251. package/dist/src/transforms/bin-linear-2d.d.ts +20 -0
  252. package/dist/src/transforms/bin-linear-2d.d.ts.map +1 -0
  253. package/dist/src/transforms/bin-linear-2d.js +49 -0
  254. package/dist/src/transforms/bin-linear-2d.js.map +1 -0
  255. package/dist/src/transforms/filter-query.d.ts +12 -0
  256. package/dist/src/transforms/filter-query.d.ts.map +1 -0
  257. package/dist/src/transforms/filter-query.js +39 -0
  258. package/dist/src/transforms/filter-query.js.map +1 -0
  259. package/dist/src/transforms/line-density.d.ts +24 -0
  260. package/dist/src/transforms/line-density.d.ts.map +1 -0
  261. package/dist/src/transforms/line-density.js +98 -0
  262. package/dist/src/transforms/line-density.js.map +1 -0
  263. package/dist/src/transforms/m4.d.ts +19 -0
  264. package/dist/src/transforms/m4.d.ts.map +1 -0
  265. package/dist/src/transforms/m4.js +38 -0
  266. package/dist/src/transforms/m4.js.map +1 -0
  267. package/dist/src/transforms/scales.d.ts +30 -0
  268. package/dist/src/transforms/scales.d.ts.map +1 -0
  269. package/dist/src/transforms/scales.js +103 -0
  270. package/dist/src/transforms/scales.js.map +1 -0
  271. package/dist/src/transforms/util/bin-step.d.ts +50 -0
  272. package/dist/src/transforms/util/bin-step.d.ts.map +1 -0
  273. package/dist/src/transforms/util/bin-step.js +53 -0
  274. package/dist/src/transforms/util/bin-step.js.map +1 -0
  275. package/dist/src/transforms/util/time-interval.d.ts +14 -0
  276. package/dist/src/transforms/util/time-interval.d.ts.map +1 -0
  277. package/dist/src/transforms/util/time-interval.js +88 -0
  278. package/dist/src/transforms/util/time-interval.js.map +1 -0
  279. package/dist/src/types.d.ts +49 -0
  280. package/dist/src/types.d.ts.map +1 -0
  281. package/dist/src/types.js +2 -0
  282. package/dist/src/types.js.map +1 -0
  283. package/dist/src/util/ast.d.ts +62 -0
  284. package/dist/src/util/ast.d.ts.map +1 -0
  285. package/{src → dist/src}/util/ast.js +36 -41
  286. package/dist/src/util/ast.js.map +1 -0
  287. package/dist/src/util/function.d.ts +56 -0
  288. package/dist/src/util/function.d.ts.map +1 -0
  289. package/dist/src/util/function.js +73 -0
  290. package/dist/src/util/function.js.map +1 -0
  291. package/dist/src/util/identity.d.ts +6 -0
  292. package/dist/src/util/identity.d.ts.map +1 -0
  293. package/dist/src/util/identity.js +8 -0
  294. package/dist/src/util/identity.js.map +1 -0
  295. package/dist/src/util/string.d.ts +4 -0
  296. package/dist/src/util/string.d.ts.map +1 -0
  297. package/dist/src/util/string.js +14 -0
  298. package/dist/src/util/string.js.map +1 -0
  299. package/dist/src/util/type-check.d.ts +17 -0
  300. package/dist/src/util/type-check.d.ts.map +1 -0
  301. package/dist/src/util/type-check.js +28 -0
  302. package/dist/src/util/type-check.js.map +1 -0
  303. package/dist/src/visit/clone.d.ts +7 -0
  304. package/dist/src/visit/clone.d.ts.map +1 -0
  305. package/dist/src/visit/clone.js +52 -0
  306. package/dist/src/visit/clone.js.map +1 -0
  307. package/dist/src/visit/recurse.d.ts +2 -0
  308. package/dist/src/visit/recurse.d.ts.map +1 -0
  309. package/dist/src/visit/recurse.js +37 -0
  310. package/dist/src/visit/recurse.js.map +1 -0
  311. package/dist/src/visit/rewrite.d.ts +9 -0
  312. package/dist/src/visit/rewrite.d.ts.map +1 -0
  313. package/dist/src/visit/rewrite.js +39 -0
  314. package/dist/src/visit/rewrite.js.map +1 -0
  315. package/dist/src/visit/visitors.d.ts +32 -0
  316. package/dist/src/visit/visitors.d.ts.map +1 -0
  317. package/dist/src/visit/visitors.js +95 -0
  318. package/dist/src/visit/visitors.js.map +1 -0
  319. package/dist/src/visit/walk.d.ts +21 -0
  320. package/dist/src/visit/walk.d.ts.map +1 -0
  321. package/dist/src/visit/walk.js +32 -0
  322. package/dist/src/visit/walk.js.map +1 -0
  323. package/package.json +13 -7
  324. package/src/ast/{aggregate.js → aggregate.ts} +49 -60
  325. package/src/ast/{between-op.js → between-op.ts} +19 -26
  326. package/src/ast/binary-op.ts +31 -0
  327. package/src/ast/{case.js → case.ts} +29 -44
  328. package/src/ast/{cast.js → cast.ts} +8 -14
  329. package/src/ast/{collate.js → collate.ts} +8 -14
  330. package/src/ast/column-param.ts +34 -0
  331. package/src/ast/{column-ref.js → column-ref.ts} +16 -25
  332. package/src/ast/fragment.ts +28 -0
  333. package/src/ast/{from.js → from.ts} +12 -21
  334. package/src/ast/{function.js → function.ts} +8 -14
  335. package/src/ast/{in-op.js → in-op.ts} +8 -14
  336. package/src/ast/{interval.js → interval.ts} +8 -14
  337. package/src/ast/list.ts +23 -0
  338. package/src/ast/{literal.js → literal.ts} +6 -9
  339. package/src/ast/logical-op.ts +50 -0
  340. package/src/ast/{node.js → node.ts} +10 -13
  341. package/src/ast/order-by.ts +38 -0
  342. package/src/ast/{param.js → param.ts} +6 -12
  343. package/src/ast/{query.js → query.ts} +224 -204
  344. package/src/ast/sample.ts +47 -0
  345. package/src/ast/{select.js → select.ts} +10 -16
  346. package/src/ast/{subquery.js → subquery.ts} +9 -8
  347. package/src/ast/{table-ref.js → table-ref.ts} +7 -12
  348. package/src/ast/{unary-op.js → unary-op.ts} +16 -23
  349. package/src/ast/unnest.ts +31 -0
  350. package/src/ast/verbatim.ts +27 -0
  351. package/src/ast/{window-frame.js → window-frame.ts} +37 -47
  352. package/src/ast/window.ts +246 -0
  353. package/src/ast/{with.js → with.ts} +19 -20
  354. package/src/{constants.js → constants.ts} +2 -0
  355. package/src/functions/aggregate.ts +344 -0
  356. package/src/functions/{case.js → case.ts} +5 -8
  357. package/src/functions/{cast.js → cast.ts} +9 -13
  358. package/src/functions/{collate.js → collate.ts} +4 -7
  359. package/src/functions/{column.js → column.ts} +9 -10
  360. package/src/functions/{cte.js → cte.ts} +9 -6
  361. package/src/functions/{datetime.js → datetime.ts} +12 -20
  362. package/src/functions/interval.ts +74 -0
  363. package/src/functions/list.ts +63 -0
  364. package/src/functions/{literal.js → literal.ts} +5 -7
  365. package/src/functions/numeric.ts +125 -0
  366. package/src/functions/operators.ts +272 -0
  367. package/src/functions/order-by.ts +21 -0
  368. package/src/functions/spatial.ts +50 -0
  369. package/src/functions/{sql-template-tag.js → sql-template-tag.ts} +16 -13
  370. package/src/functions/string.ts +79 -0
  371. package/src/functions/{table-ref.js → table-ref.ts} +4 -4
  372. package/src/functions/unnest.ts +13 -0
  373. package/src/functions/util.ts +10 -0
  374. package/src/functions/window-frame.ts +58 -0
  375. package/src/functions/{window.js → window.ts} +18 -35
  376. package/src/index.ts +79 -0
  377. package/src/load/{create.js → create.ts} +9 -3
  378. package/src/load/extension.ts +3 -0
  379. package/src/load/{load.js → load.ts} +25 -10
  380. package/src/load/{sql-from.js → sql-from.ts} +14 -7
  381. package/src/transforms/{bin-1d.js → bin-1d.ts} +13 -9
  382. package/src/transforms/{bin-2d.js → bin-2d.ts} +17 -13
  383. package/src/transforms/bin-date.ts +48 -0
  384. package/src/transforms/bin-histogram.ts +61 -0
  385. package/src/transforms/{bin-linear-1d.js → bin-linear-1d.ts} +16 -11
  386. package/src/transforms/{bin-linear-2d.js → bin-linear-2d.ts} +23 -35
  387. package/src/transforms/{filter-query.js → filter-query.ts} +10 -14
  388. package/src/transforms/{line-density.js → line-density.ts} +19 -17
  389. package/src/transforms/{m4.js → m4.ts} +17 -14
  390. package/src/transforms/{scales.js → scales.ts} +57 -14
  391. package/src/transforms/util/bin-step.ts +100 -0
  392. package/src/transforms/util/{time-interval.js → time-interval.ts} +32 -21
  393. package/src/types.ts +5 -39
  394. package/src/util/ast.ts +104 -0
  395. package/src/util/{function.js → function.ts} +40 -31
  396. package/src/util/identity.ts +7 -0
  397. package/src/util/{string.js → string.ts} +4 -4
  398. package/src/util/type-check.ts +31 -0
  399. package/src/visit/{clone.js → clone.ts} +10 -10
  400. package/src/visit/{recurse.js → recurse.ts} +3 -1
  401. package/src/visit/{rewrite.js → rewrite.ts} +7 -7
  402. package/src/visit/{visitors.js → visitors.ts} +22 -30
  403. package/src/visit/walk.ts +46 -0
  404. package/src/ast/binary-op.js +0 -40
  405. package/src/ast/column-param.js +0 -40
  406. package/src/ast/fragment.js +0 -26
  407. package/src/ast/logical-op.js +0 -67
  408. package/src/ast/order-by.js +0 -48
  409. package/src/ast/sample.js +0 -53
  410. package/src/ast/verbatim.js +0 -33
  411. package/src/ast/window.js +0 -260
  412. package/src/functions/aggregate.js +0 -347
  413. package/src/functions/interval.js +0 -83
  414. package/src/functions/numeric.js +0 -143
  415. package/src/functions/operators.js +0 -301
  416. package/src/functions/order-by.js +0 -27
  417. package/src/functions/spatial.js +0 -59
  418. package/src/functions/string.js +0 -85
  419. package/src/functions/util.js +0 -14
  420. package/src/functions/window-frame.js +0 -61
  421. package/src/index-types.ts +0 -2
  422. package/src/load/extension.js +0 -3
  423. package/src/transforms/bin-date.js +0 -38
  424. package/src/transforms/bin-histogram.js +0 -52
  425. package/src/transforms/util/bin-step.js +0 -79
  426. package/src/util/type-check.js +0 -33
  427. package/src/visit/walk.js +0 -34
  428. package/tsconfig.json +0 -8
  429. package/vitest.config.ts +0 -3
@@ -1,39 +1,38 @@
1
- /** @import { Query } from './query.js' */
1
+ import type { Query } from './query.js';
2
2
  import { WITH_CLAUSE } from '../constants.js';
3
3
  import { SQLNode } from './node.js';
4
4
 
5
5
  export class WithClauseNode extends SQLNode {
6
+ /** The common table expression (CTE) name. */
7
+ readonly name: string;
8
+ /** The common table expression (CTE) query. */
9
+ readonly query: Query;
10
+ /** The common table expression (CTE) materialization flag. */
11
+ readonly materialized: boolean | null;
12
+
6
13
  /**
7
14
  * Instantiate a with clause node for a common table expression (CTE).
8
- * @param {string} name The common table expression (CTE) name.
9
- * @param {Query} query The common table expression (CTE) query.
10
- * @param {boolean | null} [materialized] The common table expression (CTE)
15
+ * @param name The common table expression (CTE) name.
16
+ * @param query The common table expression (CTE) query.
17
+ * @param materialized The common table expression (CTE)
11
18
  * materialization flag. If `true`, forces materialization of the CTE.
12
19
  * If `false`, materialization is not performed. Otherwise (for example, if
13
20
  * `undefined` or `null`), materialization is decided by the database.
14
21
  */
15
- constructor(name, query, materialized = undefined) {
22
+ constructor(
23
+ name: string,
24
+ query: Query,
25
+ materialized: boolean | null = null
26
+ ) {
16
27
  super(WITH_CLAUSE);
17
- /**
18
- * The common table expression (CTE) name.
19
- * @type {string}
20
- * @readonly
21
- */
22
28
  this.name = name;
23
- /**
24
- * The common table expression (CTE) query.
25
- * @type {Query}
26
- * @readonly
27
- */
28
29
  this.query = query;
29
- /**
30
- * The common table expression (CTE) materialization flag.
31
- * @type {boolean | null}
32
- * @readonly
33
- */
34
30
  this.materialized = materialized;
35
31
  }
36
32
 
33
+ /**
34
+ * Generate a SQL query string for this node.
35
+ */
37
36
  toString() {
38
37
  const flag = this.materialized;
39
38
  const mat = flag === true ? ' MATERIALIZED'
@@ -3,6 +3,8 @@ export const COLUMN_PARAM = 'COLUMN_PARAM';
3
3
  export const TABLE_REF = 'TABLE_REF';
4
4
  export const LITERAL = 'LITERAL';
5
5
  export const INTERVAL = 'INTERVAL';
6
+ export const LIST = 'LIST';
7
+ export const UNNEST = 'UNNEST';
6
8
 
7
9
  export const ORDER_BY = 'ORDER_BY';
8
10
  export const CAST = 'CAST';
@@ -0,0 +1,344 @@
1
+ import type { ExprValue } from '../types.js';
2
+ import { aggFn } from '../util/function.js';
3
+
4
+ /**
5
+ * Compute an arg_max aggregate.
6
+ * @param y The argument to return.
7
+ * @param x The expression to maximize.
8
+ * @returns A SQL aggregate function call.
9
+ */
10
+ export function argmax(y: ExprValue, x: ExprValue) {
11
+ return aggFn('arg_max', y, x);
12
+ }
13
+
14
+ /**
15
+ * Compute an arg_min aggregate.
16
+ * @param y The argument to return.
17
+ * @param x The expression to minimize.
18
+ * @returns A SQL aggregate function call.
19
+ */
20
+ export function argmin(y: ExprValue, x: ExprValue) {
21
+ return aggFn('arg_min', y, x);
22
+ }
23
+
24
+ /**
25
+ * Compute an array aggregation.
26
+ * @param expr The expression to aggregate.
27
+ * @returns A SQL aggregate function call.
28
+ */
29
+ export function arrayAgg(expr: ExprValue) {
30
+ return aggFn('array_agg', expr);
31
+ }
32
+
33
+ /**
34
+ * Compute an average aggregate.
35
+ * @param expr The expression to aggregate.
36
+ * @returns A SQL aggregate function call.
37
+ */
38
+ export function avg(expr: ExprValue) {
39
+ return aggFn('avg', expr);
40
+ }
41
+
42
+ /**
43
+ * Compute a correlation aggregate.
44
+ * @param x The x expression to aggregate.
45
+ * @param y The y expression to aggregate.
46
+ * @returns A SQL aggregate function call.
47
+ */
48
+ export function corr(x: ExprValue, y: ExprValue) {
49
+ return aggFn('corr', x, y);
50
+ }
51
+
52
+ /**
53
+ * Compute a count aggregate.
54
+ * @param [expr] An optional expression
55
+ * to count. If specified, only non-null expression values are counted.
56
+ * If omitted, all rows within a group are counted.
57
+ * @returns A SQL aggregate function call.
58
+ */
59
+ export function count(expr?: ExprValue) {
60
+ return aggFn('count', expr);
61
+ }
62
+
63
+ /**
64
+ * Compute a sample covariance aggregate.
65
+ * @param x The x expression to aggregate.
66
+ * @param y The y expression to aggregate.
67
+ * @returns A SQL aggregate function call.
68
+ */
69
+ export function covariance(x: ExprValue, y: ExprValue) {
70
+ return aggFn('covar_samp', x, y);
71
+ }
72
+
73
+ /**
74
+ * Compute a population covariance aggregate.
75
+ * @param x The x expression to aggregate.
76
+ * @param y The y expression to aggregate.
77
+ * @returns A SQL aggregate function call.
78
+ */
79
+ export function covarPop(x: ExprValue, y: ExprValue) {
80
+ return aggFn('covar_pop', x, y);
81
+ }
82
+
83
+ /**
84
+ * Compute an entropy aggregate.
85
+ * @param expr The expression to aggregate.
86
+ * @returns A SQL aggregate function call.
87
+ */
88
+ export function entropy(expr: ExprValue) {
89
+ return aggFn('entropy', expr);
90
+ }
91
+
92
+ /**
93
+ * Compute a first aggregate.
94
+ * @param expr The expression to aggregate.
95
+ * @returns A SQL aggregate function call.
96
+ */
97
+ export function first(expr: ExprValue) {
98
+ return aggFn('first', expr);
99
+ }
100
+
101
+ /**
102
+ * Compute a geomean aggregate.
103
+ * @param expr The expression to aggregate.
104
+ * @returns A SQL aggregate function call.
105
+ */
106
+ export function geomean(expr: ExprValue) {
107
+ return aggFn('geomean', expr);
108
+ }
109
+
110
+ /**
111
+ * Compute a sample kurtosis aggregate.
112
+ * @param expr The expression to aggregate.
113
+ * @returns A SQL aggregate function call.
114
+ */
115
+ export function kurtosis(expr: ExprValue) {
116
+ return aggFn('kurtosis', expr);
117
+ }
118
+
119
+ /**
120
+ * Compute a median absolute deviation (MAD) aggregate.
121
+ * @param expr The expression to aggregate.
122
+ * @returns A SQL aggregate function call.
123
+ */
124
+ export function mad(expr: ExprValue) {
125
+ return aggFn('mad', expr);
126
+ }
127
+
128
+ /**
129
+ * Compute a maximum aggregate.
130
+ * @param expr The expression to aggregate.
131
+ * @returns A SQL aggregate function call.
132
+ */
133
+ export function max(expr: ExprValue) {
134
+ return aggFn('max', expr);
135
+ }
136
+
137
+ /**
138
+ * Compute a median aggregate.
139
+ * @param expr The expression to aggregate.
140
+ * @returns A SQL aggregate function call.
141
+ */
142
+ export function median(expr: ExprValue) {
143
+ return aggFn('median', expr);
144
+ }
145
+
146
+ /**
147
+ * Compute a minimum aggregate.
148
+ * @param expr The expression to aggregate.
149
+ * @returns A SQL aggregate function call.
150
+ */
151
+ export function min(expr: ExprValue) {
152
+ return aggFn('min', expr);
153
+ }
154
+
155
+ /**
156
+ * Compute a mode aggregate.
157
+ * @param expr The expression to aggregate.
158
+ * @returns A SQL aggregate function call.
159
+ */
160
+ export function mode(expr: ExprValue) {
161
+ return aggFn('mode', expr);
162
+ }
163
+
164
+ /**
165
+ * Compute a last aggregate.
166
+ * @param expr The expression to aggregate.
167
+ * @returns A SQL aggregate function call.
168
+ */
169
+ export function last(expr: ExprValue) {
170
+ return aggFn('last', expr);
171
+ }
172
+
173
+ /**
174
+ * Compute a product aggregate.
175
+ * @param expr The expression to aggregate.
176
+ * @returns A SQL aggregate function call.
177
+ */
178
+ export function product(expr: ExprValue) {
179
+ return aggFn('product', expr);
180
+ }
181
+
182
+ /**
183
+ * Compute a quantile aggregate.
184
+ * @param expr The expression to aggregate.
185
+ * @param p The quantile value.
186
+ * @returns A SQL aggregate function call.
187
+ */
188
+ export function quantile(expr: ExprValue, p: ExprValue) {
189
+ return aggFn('quantile', expr, p);
190
+ }
191
+
192
+ /**
193
+ * Compute a linear regression reg_avgX aggregate.
194
+ * @param x The x expression to aggregate.
195
+ * @param y The y expression to aggregate.
196
+ * @returns A SQL aggregate function call.
197
+ */
198
+ export function regrAvgX(x: ExprValue, y: ExprValue) {
199
+ return aggFn('regr_avgx', x, y);
200
+ }
201
+
202
+ /**
203
+ * Compute a linear regression reg_avgY aggregate.
204
+ * @param x The x expression to aggregate.
205
+ * @param y The y expression to aggregate.
206
+ * @returns A SQL aggregate function call.
207
+ */
208
+ export function regrAvgY(x: ExprValue, y: ExprValue) {
209
+ return aggFn('regr_avgy', x, y);
210
+ }
211
+
212
+ /**
213
+ * Compute a linear regression count aggregate.
214
+ * This returns the count of rows where both x and y are non-null.
215
+ * @param x The x expression to aggregate.
216
+ * @param y The y expression to aggregate.
217
+ * @returns A SQL aggregate function call.
218
+ */
219
+ export function regrCount(x: ExprValue, y: ExprValue) {
220
+ return aggFn('regr_count', x, y);
221
+ }
222
+
223
+ /**
224
+ * Compute a linear regression intercept aggregate.
225
+ * @param x The x expression to aggregate.
226
+ * @param y The y expression to aggregate.
227
+ * @returns A SQL aggregate function call.
228
+ */
229
+ export function regrIntercept(x: ExprValue, y: ExprValue) {
230
+ return aggFn('regr_intercept', x, y);
231
+ }
232
+
233
+ /**
234
+ * Compute a linear regression R^2 aggregate.
235
+ * @param x The x expression to aggregate.
236
+ * @param y The y expression to aggregate.
237
+ * @returns A SQL aggregate function call.
238
+ */
239
+ export function regrR2(x: ExprValue, y: ExprValue) {
240
+ return aggFn('regr_r2', x, y);
241
+ }
242
+
243
+ /**
244
+ * Compute a linear regression regr_sxx aggregate.
245
+ * @param x The x expression to aggregate.
246
+ * @param y The y expression to aggregate.
247
+ * @returns A SQL aggregate function call.
248
+ */
249
+ export function regrSXX(x: ExprValue, y: ExprValue) {
250
+ return aggFn('regr_sxx', x, y);
251
+ }
252
+
253
+ /**
254
+ * Compute a linear regression regr_sxy aggregate.
255
+ * @param x The x expression to aggregate.
256
+ * @param y The y expression to aggregate.
257
+ * @returns A SQL aggregate function call.
258
+ */
259
+ export function regrSXY(x: ExprValue, y: ExprValue) {
260
+ return aggFn('regr_sxy', x, y);
261
+ }
262
+
263
+ /**
264
+ * Compute a linear regression regr_syy aggregate.
265
+ * @param x The x expression to aggregate.
266
+ * @param y The y expression to aggregate.
267
+ * @returns A SQL aggregate function call.
268
+ */
269
+ export function regrSYY(x: ExprValue, y: ExprValue) {
270
+ return aggFn('regr_syy', x, y);
271
+ }
272
+
273
+ /**
274
+ * Compute a linear regression slope aggregate.
275
+ * @param x The x expression to aggregate.
276
+ * @param y The y expression to aggregate.
277
+ * @returns A SQL aggregate function call.
278
+ */
279
+ export function regrSlope(x: ExprValue, y: ExprValue) {
280
+ return aggFn('regr_slope', x, y);
281
+ }
282
+
283
+ /**
284
+ * Compute a skewness aggregate.
285
+ * @param expr The expression to aggregate.
286
+ * @returns A SQL aggregate function call.
287
+ */
288
+ export function skewness(expr: ExprValue) {
289
+ return aggFn('skewness', expr);
290
+ }
291
+
292
+ /**
293
+ * Compute a sample standard deviation aggregate.
294
+ * @param expr The expression to aggregate.
295
+ * @returns A SQL aggregate function call.
296
+ */
297
+ export function stddev(expr: ExprValue) {
298
+ return aggFn('stddev', expr);
299
+ }
300
+
301
+ /**
302
+ * Compute a population standard deviation aggregate.
303
+ * @param expr The expression to aggregate.
304
+ * @returns A SQL aggregate function call.
305
+ */
306
+ export function stddevPop(expr: ExprValue) {
307
+ return aggFn('stddev_pop', expr);
308
+ }
309
+
310
+ /**
311
+ * Compute a string aggregation.
312
+ * @param expr The expression to aggregate.
313
+ * @returns A SQL aggregate function call.
314
+ */
315
+ export function stringAgg(expr: ExprValue) {
316
+ return aggFn('string_agg', expr);
317
+ }
318
+
319
+ /**
320
+ * Compute a sum aggregate.
321
+ * @param expr The expression to aggregate.
322
+ * @returns A SQL aggregate function call.
323
+ */
324
+ export function sum(expr: ExprValue) {
325
+ return aggFn('sum', expr);
326
+ }
327
+
328
+ /**
329
+ * Compute a sample variance aggregate.
330
+ * @param expr The expression to aggregate.
331
+ * @returns A SQL aggregate function call.
332
+ */
333
+ export function variance(expr: ExprValue) {
334
+ return aggFn('var_samp', expr);
335
+ }
336
+
337
+ /**
338
+ * Compute a population variance aggregate.
339
+ * @param expr The expression to aggregate.
340
+ * @returns A SQL aggregate function call.
341
+ */
342
+ export function varPop(expr: ExprValue) {
343
+ return aggFn('var_pop', expr);
344
+ }
@@ -1,6 +1,4 @@
1
- /**
2
- * @import { ExprValue } from '../types.js'
3
- */
1
+ import type { ExprValue } from '../types.js';
4
2
  import { CaseNode, WhenNode } from '../ast/case.js';
5
3
  import { asNode } from '../util/ast.js';
6
4
 
@@ -9,12 +7,11 @@ import { asNode } from '../util/ast.js';
9
7
  * acts like a ternary conditional (if, then, else). If no arguments are
10
8
  * provided, the chained `when` and `else` methods can be used to to complete
11
9
  * a conditional statement with WHEN/THEN and ELSE expressions.
12
- * @param {ExprValue} [when] A conditional WHEN expression.
13
- * @param {ExprValue} [then] A THEN value expression.
14
- * @param {ExprValue} [other] An ELSE expression.
15
- * @returns {CaseNode}
10
+ * @param when A conditional WHEN expression.
11
+ * @param then A THEN value expression.
12
+ * @param other An ELSE expression.
16
13
  */
17
- export function cond(when, then, other) {
14
+ export function cond(when?: ExprValue, then?: ExprValue, other?: ExprValue) {
18
15
  return when
19
16
  ? new CaseNode(undefined, [new WhenNode(asNode(when), asNode(then))], asNode(other))
20
17
  : new CaseNode();
@@ -3,37 +3,33 @@ import { asNode } from '../util/ast.js';
3
3
 
4
4
  /**
5
5
  * Perform a type cast.
6
- * @param {*} expr The expression to type cast.
7
- * @param {string} type The type to cast to.
8
- * @returns {CastNode}
6
+ * @param expr The expression to type cast.
7
+ * @param type The type to cast to.
9
8
  */
10
- export function cast(expr, type) {
9
+ export function cast(expr: unknown, type: string) {
11
10
  return new CastNode(asNode(expr), type);
12
11
  }
13
12
 
14
13
  /**
15
14
  * Cast an expression to a 32-bit integer type.
16
- * @param {*} expr The expression to type cast.
17
- * @returns {CastNode}
15
+ * @param expr The expression to type cast.
18
16
  */
19
- export function int32(expr) {
17
+ export function int32(expr: unknown) {
20
18
  return cast(expr, 'INTEGER');
21
19
  }
22
20
 
23
21
  /**
24
22
  * Cast an expression to a 32-bit floating point number type.
25
- * @param {*} expr The expression to type cast.
26
- * @returns {CastNode}
23
+ * @param expr The expression to type cast.
27
24
  */
28
- export function float32(expr) {
25
+ export function float32(expr: unknown) {
29
26
  return cast(expr, 'FLOAT');
30
27
  }
31
28
 
32
29
  /**
33
30
  * Cast an expression to a 64-bit floating point number type.
34
- * @param {*} expr The expression to type cast.
35
- * @returns {CastNode}
31
+ * @param expr The expression to type cast.
36
32
  */
37
- export function float64(expr) {
33
+ export function float64(expr: unknown) {
38
34
  return cast(expr, 'DOUBLE');
39
35
  }
@@ -1,16 +1,13 @@
1
- /**
2
- * @import { ExprValue } from '../types.js'
3
- */
1
+ import type { ExprValue } from '../types.js';
4
2
  import { CollateNode } from '../ast/collate.js';
5
3
  import { asNode } from '../util/ast.js';
6
4
 
7
5
  /**
8
6
  * Indicate ascending sort order for an expression.
9
- * @param {ExprValue} expr The expression to collate.
10
- * @param {string} collation The collation type, such as
7
+ * @param expr The expression to collate.
8
+ * @param collation The collation type, such as
11
9
  * 'NOCASE', 'NOACCENT', 'NFC', or locale-specific collations.
12
- * @returns {CollateNode}
13
10
  */
14
- export function collate(expr, collation) {
11
+ export function collate(expr: ExprValue, collation: string) {
15
12
  return new CollateNode(asNode(expr), collation);
16
13
  }
@@ -1,8 +1,6 @@
1
- /**
2
- * @import { ColumnRefNode } from '../ast/column-ref.js'
3
- * @import { TableRefNode } from '../ast/table-ref.js'
4
- * @import { ParamLike } from '../types.js'
5
- */
1
+ import type { ColumnRefNode } from '../ast/column-ref.js';
2
+ import type { TableRefNode } from '../ast/table-ref.js';
3
+ import type { ParamLike } from '../types.js';
6
4
  import { ColumnParamNode } from '../ast/column-param.js';
7
5
  import { ColumnNameRefNode } from '../ast/column-ref.js';
8
6
  import { ParamNode } from '../ast/param.js';
@@ -11,12 +9,13 @@ import { isParamLike } from '../util/type-check.js';
11
9
 
12
10
  /**
13
11
  * Create a column reference.
14
- * @param {string | ParamLike} name The column name,
15
- * as a string or as a dynamic parameter.
16
- * @param {string | string[] | TableRefNode} [table] The table reference.
17
- * @returns {ColumnRefNode}
12
+ * @param name The column name, as a string or as a dynamic parameter.
13
+ * @param table The table reference.
18
14
  */
19
- export function column(name, table) {
15
+ export function column(
16
+ name: string | ParamLike,
17
+ table?: string | string[] | TableRefNode
18
+ ): ColumnRefNode {
20
19
  const tref = asTableRef(table);
21
20
  return isParamLike(name)
22
21
  ? new ColumnParamNode(new ParamNode(name), tref)
@@ -1,16 +1,19 @@
1
- /** @import { Query } from '../ast/query.js' */
1
+ import type { Query } from '../ast/query.js';
2
2
  import { WithClauseNode } from '../ast/with.js';
3
3
 
4
4
  /**
5
5
  * Create a common table expression (CTE) to include within a WITH clause.
6
- * @param {string} name The common table expression (CTE) name.
7
- * @param {Query} query The common table expression (CTE) query.
8
- * @param {boolean | null} [materialized] The common table expression (CTE)
6
+ * @param name The common table expression (CTE) name.
7
+ * @param query The common table expression (CTE) query.
8
+ * @param materialized The common table expression (CTE)
9
9
  * materialization flag. If `true`, forces materialization of the CTE.
10
10
  * If `false`, materialization is not performed. Otherwise (for example, if
11
11
  * `undefined` or `null`), materialization is decided by the database.
12
- * @returns {WithClauseNode}
13
12
  */
14
- export function cte(name, query, materialized) {
13
+ export function cte(
14
+ name: string,
15
+ query: Query,
16
+ materialized: boolean | null = null
17
+ ) {
15
18
  return new WithClauseNode(name, query, materialized);
16
19
  }
@@ -1,7 +1,4 @@
1
- /**
2
- * @import { FunctionNode } from '../ast/function.js'
3
- * @import { ExprValue } from '../types.js'
4
- */
1
+ import type { ExprValue } from '../types.js';
5
2
  import { asNode } from '../util/ast.js';
6
3
  import { fn } from '../util/function.js';
7
4
  import { interval } from './interval.js';
@@ -9,40 +6,36 @@ import { interval } from './interval.js';
9
6
  /**
10
7
  * Given a date/time value, return the milliseconds since the UNIX epoch.
11
8
  * @param {ExprValue} expr The date/time expression.
12
- * @returns {FunctionNode}
13
9
  */
14
- export function epoch_ms(expr) {
10
+ export function epoch_ms(expr: ExprValue) {
15
11
  return fn('epoch_ms', expr);
16
12
  }
17
13
 
18
14
  /**
19
15
  * Perform data binning according to the provided interval unit and steps.
20
- * @param {ExprValue} expr The date/time expression to bin.
21
- * @param {string} unit The datetime interval unit to bin by.
22
- * @param {number} [steps=1] The number of interval steps.
23
- * @returns {FunctionNode}
16
+ * @param expr The date/time expression to bin.
17
+ * @param unit The datetime interval unit to bin by.
18
+ * @param steps The number of interval steps.
24
19
  */
25
- export function dateBin(expr, unit, steps = 1) {
20
+ export function dateBin(expr: ExprValue, unit: string, steps: number = 1) {
26
21
  return fn('time_bucket', interval(unit, steps), expr);
27
22
  }
28
23
 
29
24
  /**
30
25
  * Map date/times to a month value, all within the same year for comparison.
31
26
  * The resulting value is still date-typed.
32
- * @param {ExprValue} expr The date/time expression.
33
- * @returns {FunctionNode}
27
+ * @param expr The date/time expression.
34
28
  */
35
- export function dateMonth(expr) {
29
+ export function dateMonth(expr: ExprValue) {
36
30
  return fn('make_date', 2012, fn('month', expr), 1);
37
31
  }
38
32
 
39
33
  /**
40
34
  * Map date/times to a month and day value, all within the same year for
41
35
  * comparison. The resulting value is still date-typed.
42
- * @param {ExprValue} expr The date/time expression.
43
- * @returns {FunctionNode}
36
+ * @param expr The date/time expression.
44
37
  */
45
- export function dateMonthDay(expr) {
38
+ export function dateMonthDay(expr: ExprValue) {
46
39
  const d = asNode(expr);
47
40
  return fn('make_date', 2012, fn('month', d), fn('day', d));
48
41
  }
@@ -50,9 +43,8 @@ export function dateMonthDay(expr) {
50
43
  /**
51
44
  * Map date/times to a day of the month value, all within the same year and month
52
45
  * for comparison. The resulting value is still date-typed.
53
- * @param {ExprValue} expr The date/time expression.
54
- * @returns {FunctionNode}
46
+ * @param expr The date/time expression.
55
47
  */
56
- export function dateDay(expr) {
48
+ export function dateDay(expr: ExprValue) {
57
49
  return fn('make_date', 2012, 1, fn('day', expr));
58
50
  }