@uwdata/mosaic-sql 0.13.0 → 0.14.1

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 (73) hide show
  1. package/dist/types/ast/aggregate.d.ts +5 -4
  2. package/dist/types/ast/case.d.ts +6 -7
  3. package/dist/types/ast/column-param.d.ts +7 -7
  4. package/dist/types/ast/column-ref.d.ts +7 -6
  5. package/dist/types/ast/param.d.ts +5 -4
  6. package/dist/types/ast/query.d.ts +46 -39
  7. package/dist/types/ast/window.d.ts +15 -12
  8. package/dist/types/functions/aggregate.d.ts +89 -88
  9. package/dist/types/functions/case.d.ts +6 -8
  10. package/dist/types/functions/column.d.ts +5 -3
  11. package/dist/types/functions/datetime.d.ts +12 -11
  12. package/dist/types/functions/numeric.d.ts +48 -46
  13. package/dist/types/functions/operators.d.ts +80 -78
  14. package/dist/types/functions/order-by.d.ts +5 -4
  15. package/dist/types/functions/spatial.d.ts +14 -13
  16. package/dist/types/functions/sql-template-tag.d.ts +4 -5
  17. package/dist/types/functions/string.d.ts +22 -20
  18. package/dist/types/functions/util.d.ts +8 -0
  19. package/dist/types/functions/window.d.ts +18 -16
  20. package/dist/types/index.d.ts +5 -0
  21. package/dist/types/transforms/bin-1d.d.ts +3 -2
  22. package/dist/types/transforms/bin-2d.d.ts +6 -5
  23. package/dist/types/transforms/bin-date.d.ts +44 -0
  24. package/dist/types/transforms/bin-histogram.d.ts +51 -0
  25. package/dist/types/transforms/bin-linear-1d.d.ts +6 -4
  26. package/dist/types/transforms/bin-linear-2d.d.ts +6 -5
  27. package/dist/types/transforms/line-density.d.ts +5 -4
  28. package/dist/types/transforms/m4.d.ts +7 -4
  29. package/dist/types/transforms/util/bin-step.d.ts +61 -0
  30. package/dist/types/transforms/util/time-interval.d.ts +13 -0
  31. package/dist/types/types.d.ts +1 -0
  32. package/dist/types/util/ast.d.ts +6 -5
  33. package/dist/types/util/function.d.ts +6 -4
  34. package/dist/types/util/type-check.d.ts +6 -2
  35. package/dist/types/visit/visitors.d.ts +3 -2
  36. package/dist/types/visit/walk.d.ts +7 -4
  37. package/package.json +2 -2
  38. package/src/ast/aggregate.js +5 -2
  39. package/src/ast/case.js +6 -5
  40. package/src/ast/column-param.js +7 -5
  41. package/src/ast/column-ref.js +6 -3
  42. package/src/ast/param.js +5 -2
  43. package/src/ast/query.js +23 -19
  44. package/src/ast/window.js +10 -6
  45. package/src/functions/aggregate.js +55 -52
  46. package/src/functions/case.js +7 -7
  47. package/src/functions/column.js +6 -2
  48. package/src/functions/datetime.js +9 -6
  49. package/src/functions/numeric.js +35 -31
  50. package/src/functions/operators.js +53 -50
  51. package/src/functions/order-by.js +5 -2
  52. package/src/functions/spatial.js +10 -7
  53. package/src/functions/sql-template-tag.js +5 -5
  54. package/src/functions/string.js +16 -13
  55. package/src/functions/util.js +14 -0
  56. package/src/functions/window.js +13 -10
  57. package/src/index.js +6 -0
  58. package/src/transforms/bin-1d.js +4 -1
  59. package/src/transforms/bin-2d.js +7 -4
  60. package/src/transforms/bin-date.js +37 -0
  61. package/src/transforms/bin-histogram.js +52 -0
  62. package/src/transforms/bin-linear-1d.js +7 -3
  63. package/src/transforms/bin-linear-2d.js +12 -8
  64. package/src/transforms/line-density.js +7 -3
  65. package/src/transforms/m4.js +7 -3
  66. package/src/transforms/util/bin-step.js +79 -0
  67. package/src/transforms/util/time-interval.js +97 -0
  68. package/src/types.ts +11 -0
  69. package/src/util/ast.js +6 -3
  70. package/src/util/function.js +6 -2
  71. package/src/util/type-check.js +5 -1
  72. package/src/visit/visitors.js +6 -2
  73. package/src/visit/walk.js +8 -3
@@ -1,9 +1,13 @@
1
+ /**
2
+ * @import { FunctionNode } from '../ast/function.js'
3
+ * @import { ExprValue } from '../types.js'
4
+ */
1
5
  import { fn } from '../util/function.js';
2
6
 
3
7
  /**
4
8
  * Return true if the floating point value is not a number, false otherwise.
5
- * @param {import('../types.js').ExprValue} expr The input number.
6
- * @returns {import('../ast/function.js').FunctionNode}
9
+ * @param {ExprValue} expr The input number.
10
+ * @returns {FunctionNode}
7
11
  */
8
12
  export function isNaN(expr) {
9
13
  return fn('isnan', expr);
@@ -11,8 +15,8 @@ export function isNaN(expr) {
11
15
 
12
16
  /**
13
17
  * Return true if the floating point value is finite, false otherwise.
14
- * @param {import('../types.js').ExprValue} expr The input number.
15
- * @returns {import('../ast/function.js').FunctionNode}
18
+ * @param {ExprValue} expr The input number.
19
+ * @returns {FunctionNode}
16
20
  */
17
21
  export function isFinite(expr) {
18
22
  return fn('isfinite', expr);
@@ -20,8 +24,8 @@ export function isFinite(expr) {
20
24
 
21
25
  /**
22
26
  * Return true if the floating point value is infinite, false otherwise.
23
- * @param {import('../types.js').ExprValue} expr The input number.
24
- * @returns {import('../ast/function.js').FunctionNode}
27
+ * @param {ExprValue} expr The input number.
28
+ * @returns {FunctionNode}
25
29
  */
26
30
  export function isInfinite(expr) {
27
31
  return fn('isinf', expr);
@@ -29,8 +33,8 @@ export function isInfinite(expr) {
29
33
 
30
34
  /**
31
35
  * Selects the largest value.
32
- * @param {...import('../types.js').ExprValue} expr The input expressions.
33
- * @returns {import('../ast/function.js').FunctionNode}
36
+ * @param {...ExprValue} expr The input expressions.
37
+ * @returns {FunctionNode}
34
38
  */
35
39
  export function greatest(...expr) {
36
40
  return fn('greatest', ...expr);
@@ -38,8 +42,8 @@ export function greatest(...expr) {
38
42
 
39
43
  /**
40
44
  * Selects the smallest value.
41
- * @param {...import('../types.js').ExprValue} expr The input expressions.
42
- * @returns {import('../ast/function.js').FunctionNode}
45
+ * @param {...ExprValue} expr The input expressions.
46
+ * @returns {FunctionNode}
43
47
  */
44
48
  export function least(...expr) {
45
49
  return fn('least', ...expr);
@@ -47,8 +51,8 @@ export function least(...expr) {
47
51
 
48
52
  /**
49
53
  * Compute the exponentional function `e ** expr`.
50
- * @param {import('../types.js').ExprValue} expr The input number.
51
- * @returns {import('../ast/function.js').FunctionNode}
54
+ * @param {ExprValue} expr The input number.
55
+ * @returns {FunctionNode}
52
56
  */
53
57
  export function exp(expr) {
54
58
  return fn('exp', expr);
@@ -56,8 +60,8 @@ export function exp(expr) {
56
60
 
57
61
  /**
58
62
  * Compute a base 10 logarithm.
59
- * @param {import('../types.js').ExprValue} expr The input number.
60
- * @returns {import('../ast/function.js').FunctionNode}
63
+ * @param {ExprValue} expr The input number.
64
+ * @returns {FunctionNode}
61
65
  */
62
66
  export function log(expr) {
63
67
  return fn('log', expr);
@@ -65,8 +69,8 @@ export function log(expr) {
65
69
 
66
70
  /**
67
71
  * Compute a natural logarithm.
68
- * @param {import('../types.js').ExprValue} expr The input number.
69
- * @returns {import('../ast/function.js').FunctionNode}
72
+ * @param {ExprValue} expr The input number.
73
+ * @returns {FunctionNode}
70
74
  */
71
75
  export function ln(expr) {
72
76
  return fn('ln', expr);
@@ -74,8 +78,8 @@ export function ln(expr) {
74
78
 
75
79
  /**
76
80
  * Compute the sign of a number.
77
- * @param {import('../types.js').ExprValue} expr The input number.
78
- * @returns {import('../ast/function.js').FunctionNode}
81
+ * @param {ExprValue} expr The input number.
82
+ * @returns {FunctionNode}
79
83
  */
80
84
  export function sign(expr) {
81
85
  return fn('sign', expr);
@@ -83,8 +87,8 @@ export function sign(expr) {
83
87
 
84
88
  /**
85
89
  * Compute the absolute value of a number.
86
- * @param {import('../types.js').ExprValue} expr The input number.
87
- * @returns {import('../ast/function.js').FunctionNode}
90
+ * @param {ExprValue} expr The input number.
91
+ * @returns {FunctionNode}
88
92
  */
89
93
  export function abs(expr) {
90
94
  return fn('abs', expr);
@@ -92,8 +96,8 @@ export function abs(expr) {
92
96
 
93
97
  /**
94
98
  * Compute the square root of a number.
95
- * @param {import('../types.js').ExprValue} expr The input number.
96
- * @returns {import('../ast/function.js').FunctionNode}
99
+ * @param {ExprValue} expr The input number.
100
+ * @returns {FunctionNode}
97
101
  */
98
102
  export function sqrt(expr) {
99
103
  return fn('sqrt', expr);
@@ -101,8 +105,8 @@ export function sqrt(expr) {
101
105
 
102
106
  /**
103
107
  * Rounds the number up.
104
- * @param {import('../types.js').ExprValue} expr The input number.
105
- * @returns {import('../ast/function.js').FunctionNode}
108
+ * @param {ExprValue} expr The input number.
109
+ * @returns {FunctionNode}
106
110
  */
107
111
  export function ceil(expr) {
108
112
  return fn('ceil', expr);
@@ -110,8 +114,8 @@ export function ceil(expr) {
110
114
 
111
115
  /**
112
116
  * Rounds the number down.
113
- * @param {import('../types.js').ExprValue} expr The input number.
114
- * @returns {import('../ast/function.js').FunctionNode}
117
+ * @param {ExprValue} expr The input number.
118
+ * @returns {FunctionNode}
115
119
  */
116
120
  export function floor(expr) {
117
121
  return fn('floor', expr);
@@ -119,11 +123,11 @@ export function floor(expr) {
119
123
 
120
124
  /**
121
125
  * Round to the given decimal places.
122
- * @param {import('../types.js').ExprValue} expr The input number.
123
- * @param {import('../types.js').ExprValue} [places] The decimal places.
126
+ * @param {ExprValue} expr The input number.
127
+ * @param {ExprValue} [places] The decimal places.
124
128
  * Negative values are allowed, to round to tens, hundreds, etc.
125
129
  * If unspecified, defaults to zero.
126
- * @returns {import('../ast/function.js').FunctionNode}
130
+ * @returns {FunctionNode}
127
131
  */
128
132
  export function round(expr, places) {
129
133
  return fn('round', expr, places);
@@ -131,8 +135,8 @@ export function round(expr, places) {
131
135
 
132
136
  /**
133
137
  * Truncates the number.
134
- * @param {import('../types.js').ExprValue} expr The input number.
135
- * @returns {import('../ast/function.js').FunctionNode}
138
+ * @param {ExprValue} expr The input number.
139
+ * @returns {FunctionNode}
136
140
  */
137
141
  export function trunc(expr) {
138
142
  return fn('trunc', expr);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { ExprValue, ExprVarArgs } from '../types.js'
3
+ */
1
4
  import { BetweenOpNode, NotBetweenOpNode } from '../ast/between-op.js';
2
5
  import { BinaryOpNode } from '../ast/binary-op.js';
3
6
  import { InOpNode } from '../ast/in-op.js';
@@ -25,7 +28,7 @@ function betweenOp(expr, extent, negate = false) {
25
28
 
26
29
  /**
27
30
  * Logical and (AND) operator.
28
- * @param {...import('../types.js').ExprVarArgs} clauses The input expressions.
31
+ * @param {...ExprVarArgs} clauses The input expressions.
29
32
  * @returns {AndNode}
30
33
  */
31
34
  export function and(...clauses) {
@@ -34,7 +37,7 @@ export function and(...clauses) {
34
37
 
35
38
  /**
36
39
  * Logical or (OR) operator.
37
- * @param {...import('../types.js').ExprVarArgs} clauses The input expressions.
40
+ * @param {...ExprVarArgs} clauses The input expressions.
38
41
  * @returns {OrNode}
39
42
  */
40
43
  export function or(...clauses) {
@@ -43,7 +46,7 @@ export function or(...clauses) {
43
46
 
44
47
  /**
45
48
  * Logical not (NOT) operator.
46
- * @param {import('../types.js').ExprValue} expr The expression to negate.
49
+ * @param {ExprValue} expr The expression to negate.
47
50
  * @returns {UnaryOpNode}
48
51
  */
49
52
  export function not(expr) {
@@ -52,7 +55,7 @@ export function not(expr) {
52
55
 
53
56
  /**
54
57
  * Null check (IS NULL) operator.
55
- * @param {import('../types.js').ExprValue} expr The expression to test.
58
+ * @param {ExprValue} expr The expression to test.
56
59
  * @returns {UnaryPosftixOpNode}
57
60
  */
58
61
  export function isNull(expr) {
@@ -61,7 +64,7 @@ export function isNull(expr) {
61
64
 
62
65
  /**
63
66
  * Non-null check (IS NOT NULL) operator.
64
- * @param {import('../types.js').ExprValue} expr The expression to test.
67
+ * @param {ExprValue} expr The expression to test.
65
68
  * @returns {UnaryPosftixOpNode}
66
69
  */
67
70
  export function isNotNull(expr) {
@@ -70,7 +73,7 @@ export function isNotNull(expr) {
70
73
 
71
74
  /**
72
75
  * Bitwise not (~) operator.
73
- * @param {import('../types.js').ExprValue} expr The input expression.
76
+ * @param {ExprValue} expr The input expression.
74
77
  * @returns {UnaryOpNode}
75
78
  */
76
79
  export function bitNot(expr) {
@@ -79,8 +82,8 @@ export function bitNot(expr) {
79
82
 
80
83
  /**
81
84
  * Bitwise and (&) operator.
82
- * @param {import('../types.js').ExprValue} left The left argument.
83
- * @param {import('../types.js').ExprValue} right The right argument.
85
+ * @param {ExprValue} left The left argument.
86
+ * @param {ExprValue} right The right argument.
84
87
  * @returns {BinaryOpNode}
85
88
  */
86
89
  export function bitAnd(left, right) {
@@ -89,8 +92,8 @@ export function bitAnd(left, right) {
89
92
 
90
93
  /**
91
94
  * Bitwise or (|) operator.
92
- * @param {import('../types.js').ExprValue} left The left argument.
93
- * @param {import('../types.js').ExprValue} right The right argument.
95
+ * @param {ExprValue} left The left argument.
96
+ * @param {ExprValue} right The right argument.
94
97
  * @returns {BinaryOpNode}
95
98
  */
96
99
  export function bitOr(left, right) {
@@ -99,8 +102,8 @@ export function bitOr(left, right) {
99
102
 
100
103
  /**
101
104
  * Bit shift left (<<) operator.
102
- * @param {import('../types.js').ExprValue} left The left argument.
103
- * @param {import('../types.js').ExprValue} right The right argument.
105
+ * @param {ExprValue} left The left argument.
106
+ * @param {ExprValue} right The right argument.
104
107
  * @returns {BinaryOpNode}
105
108
  */
106
109
  export function bitLeft(left, right) {
@@ -109,8 +112,8 @@ export function bitLeft(left, right) {
109
112
 
110
113
  /**
111
114
  * Bit shift right (>>) operator.
112
- * @param {import('../types.js').ExprValue} left The left argument.
113
- * @param {import('../types.js').ExprValue} right The right argument.
115
+ * @param {ExprValue} left The left argument.
116
+ * @param {ExprValue} right The right argument.
114
117
  * @returns {BinaryOpNode}
115
118
  */
116
119
  export function bitRight(left, right) {
@@ -119,8 +122,8 @@ export function bitRight(left, right) {
119
122
 
120
123
  /**
121
124
  * Addition (+) operator.
122
- * @param {import('../types.js').ExprValue} left The left argument.
123
- * @param {import('../types.js').ExprValue} right The right argument.
125
+ * @param {ExprValue} left The left argument.
126
+ * @param {ExprValue} right The right argument.
124
127
  * @returns {BinaryOpNode}
125
128
  */
126
129
  export function add(left, right) {
@@ -129,8 +132,8 @@ export function add(left, right) {
129
132
 
130
133
  /**
131
134
  * Subtraction (-) operator.
132
- * @param {import('../types.js').ExprValue} left The left argument.
133
- * @param {import('../types.js').ExprValue} right The right argument.
135
+ * @param {ExprValue} left The left argument.
136
+ * @param {ExprValue} right The right argument.
134
137
  * @returns {BinaryOpNode}
135
138
  */
136
139
  export function sub(left, right) {
@@ -139,8 +142,8 @@ export function sub(left, right) {
139
142
 
140
143
  /**
141
144
  * Multiplication (*) operator.
142
- * @param {import('../types.js').ExprValue} left The left argument.
143
- * @param {import('../types.js').ExprValue} right The right argument.
145
+ * @param {ExprValue} left The left argument.
146
+ * @param {ExprValue} right The right argument.
144
147
  * @returns {BinaryOpNode}
145
148
  */
146
149
  export function mul(left, right) {
@@ -149,8 +152,8 @@ export function mul(left, right) {
149
152
 
150
153
  /**
151
154
  * Division (/) operator.
152
- * @param {import('../types.js').ExprValue} left The left argument.
153
- * @param {import('../types.js').ExprValue} right The right argument.
155
+ * @param {ExprValue} left The left argument.
156
+ * @param {ExprValue} right The right argument.
154
157
  * @returns {BinaryOpNode}
155
158
  */
156
159
  export function div(left, right) {
@@ -159,8 +162,8 @@ export function div(left, right) {
159
162
 
160
163
  /**
161
164
  * Integer division (//) operator.
162
- * @param {import('../types.js').ExprValue} left The left argument.
163
- * @param {import('../types.js').ExprValue} right The right argument.
165
+ * @param {ExprValue} left The left argument.
166
+ * @param {ExprValue} right The right argument.
164
167
  * @returns {BinaryOpNode}
165
168
  */
166
169
  export function idiv(left, right) {
@@ -169,8 +172,8 @@ export function idiv(left, right) {
169
172
 
170
173
  /**
171
174
  * Modulo (%) operator.
172
- * @param {import('../types.js').ExprValue} left The left argument.
173
- * @param {import('../types.js').ExprValue} right The right argument.
175
+ * @param {ExprValue} left The left argument.
176
+ * @param {ExprValue} right The right argument.
174
177
  * @returns {BinaryOpNode}
175
178
  */
176
179
  export function mod(left, right) {
@@ -179,8 +182,8 @@ export function mod(left, right) {
179
182
 
180
183
  /**
181
184
  * Exponentiation (**) operator.
182
- * @param {import('../types.js').ExprValue} left The left argument.
183
- * @param {import('../types.js').ExprValue} right The right argument.
185
+ * @param {ExprValue} left The left argument.
186
+ * @param {ExprValue} right The right argument.
184
187
  * @returns {BinaryOpNode}
185
188
  */
186
189
  export function pow(left, right) {
@@ -189,8 +192,8 @@ export function pow(left, right) {
189
192
 
190
193
  /**
191
194
  * Equality comparision (=) operator.
192
- * @param {import('../types.js').ExprValue} left The left argument.
193
- * @param {import('../types.js').ExprValue} right The right argument.
195
+ * @param {ExprValue} left The left argument.
196
+ * @param {ExprValue} right The right argument.
194
197
  * @returns {BinaryOpNode}
195
198
  */
196
199
  export function eq(left, right) {
@@ -199,8 +202,8 @@ export function eq(left, right) {
199
202
 
200
203
  /**
201
204
  * Non-equality comparision (<>) operator.
202
- * @param {import('../types.js').ExprValue} left The left argument.
203
- * @param {import('../types.js').ExprValue} right The right argument.
205
+ * @param {ExprValue} left The left argument.
206
+ * @param {ExprValue} right The right argument.
204
207
  * @returns {BinaryOpNode}
205
208
  */
206
209
  export function neq(left, right) {
@@ -209,8 +212,8 @@ export function neq(left, right) {
209
212
 
210
213
  /**
211
214
  * Less-than comparision (<) operator.
212
- * @param {import('../types.js').ExprValue} left The left argument.
213
- * @param {import('../types.js').ExprValue} right The right argument.
215
+ * @param {ExprValue} left The left argument.
216
+ * @param {ExprValue} right The right argument.
214
217
  * @returns {BinaryOpNode}
215
218
  */
216
219
  export function lt(left, right) {
@@ -219,8 +222,8 @@ export function lt(left, right) {
219
222
 
220
223
  /**
221
224
  * Greater-than comparision (>) operator.
222
- * @param {import('../types.js').ExprValue} left The left argument.
223
- * @param {import('../types.js').ExprValue} right The right argument.
225
+ * @param {ExprValue} left The left argument.
226
+ * @param {ExprValue} right The right argument.
224
227
  * @returns {BinaryOpNode}
225
228
  */
226
229
  export function gt(left, right) {
@@ -229,8 +232,8 @@ export function gt(left, right) {
229
232
 
230
233
  /**
231
234
  * Less-than or equal comparision (<=) operator.
232
- * @param {import('../types.js').ExprValue} left The left argument.
233
- * @param {import('../types.js').ExprValue} right The right argument.
235
+ * @param {ExprValue} left The left argument.
236
+ * @param {ExprValue} right The right argument.
234
237
  * @returns {BinaryOpNode}
235
238
  */
236
239
  export function lte(left, right) {
@@ -239,8 +242,8 @@ export function lte(left, right) {
239
242
 
240
243
  /**
241
244
  * Greater-than or equal comparision (>=) operator.
242
- * @param {import('../types.js').ExprValue} left The left argument.
243
- * @param {import('../types.js').ExprValue} right The right argument.
245
+ * @param {ExprValue} left The left argument.
246
+ * @param {ExprValue} right The right argument.
244
247
  * @returns {BinaryOpNode}
245
248
  */
246
249
  export function gte(left, right) {
@@ -249,8 +252,8 @@ export function gte(left, right) {
249
252
 
250
253
  /**
251
254
  * Null-inclusive non-equality (IS DISTINCT FROM) operator.
252
- * @param {import('../types.js').ExprValue} left The left argument.
253
- * @param {import('../types.js').ExprValue} right The right argument.
255
+ * @param {ExprValue} left The left argument.
256
+ * @param {ExprValue} right The right argument.
254
257
  * @returns {BinaryOpNode}
255
258
  */
256
259
  export function isDistinct(left, right) {
@@ -259,8 +262,8 @@ export function isDistinct(left, right) {
259
262
 
260
263
  /**
261
264
  * Null-inclusive equality (IS NOT DISTINCT FROM) operator.
262
- * @param {import('../types.js').ExprValue} left The left argument.
263
- * @param {import('../types.js').ExprValue} right The right argument.
265
+ * @param {ExprValue} left The left argument.
266
+ * @param {ExprValue} right The right argument.
264
267
  * @returns {BinaryOpNode}
265
268
  */
266
269
  export function isNotDistinct(left, right) {
@@ -269,8 +272,8 @@ export function isNotDistinct(left, right) {
269
272
 
270
273
  /**
271
274
  * Range inclusion (BETWEEN) operator.
272
- * @param {import('../types.js').ExprValue} expr The expression to test.
273
- * @param {import('../types.js').ExprValue[]} extent The range extent.
275
+ * @param {ExprValue} expr The expression to test.
276
+ * @param {ExprValue[]} extent The range extent.
274
277
  * @returns {BetweenOpNode}
275
278
  */
276
279
  export function isBetween(expr, extent) {
@@ -279,8 +282,8 @@ export function isBetween(expr, extent) {
279
282
 
280
283
  /**
281
284
  * Range exclusion (NOT BETWEEN) operator.
282
- * @param {import('../types.js').ExprValue} expr The expression to test.
283
- * @param {import('../types.js').ExprValue[]} extent The range extent.
285
+ * @param {ExprValue} expr The expression to test.
286
+ * @param {ExprValue[]} extent The range extent.
284
287
  * @returns {NotBetweenOpNode}
285
288
  */
286
289
  export function isNotBetween(expr, extent) {
@@ -289,8 +292,8 @@ export function isNotBetween(expr, extent) {
289
292
 
290
293
  /**
291
294
  * Set inclusion (IN) operator.
292
- * @param {import('../types.js').ExprValue} expr The expression to test.
293
- * @param {import('../types.js').ExprValue[]} values The included values.
295
+ * @param {ExprValue} expr The expression to test.
296
+ * @param {ExprValue[]} values The included values.
294
297
  * @returns {InOpNode}
295
298
  */
296
299
  export function isIn(expr, values) {
@@ -1,9 +1,12 @@
1
+ /**
2
+ * @import { ExprValue } from '../types.js'
3
+ */
1
4
  import { OrderByNode } from '../ast/order-by.js';
2
5
  import { asNode } from '../util/ast.js';
3
6
 
4
7
  /**
5
8
  * Indicate ascending sort order for an expression.
6
- * @param {import('../types.js').ExprValue} expr An expression to order by.
9
+ * @param {ExprValue} expr An expression to order by.
7
10
  * @param {boolean | undefined} [nullsFirst] Flag indicating if null values
8
11
  * should be sorted first.
9
12
  * @returns {OrderByNode}
@@ -14,7 +17,7 @@ export function asc(expr, nullsFirst) {
14
17
 
15
18
  /**
16
19
  * Indicate descending sort order for an expression.
17
- * @param {import('../types.js').ExprValue} expr An expression to order by.
20
+ * @param {ExprValue} expr An expression to order by.
18
21
  * @param {boolean | undefined} [nullsFirst] Flag indicating if null values
19
22
  * should be sorted first.
20
23
  * @returns {OrderByNode}
@@ -1,9 +1,12 @@
1
- import { FunctionNode } from '../ast/function.js';
1
+ /**
2
+ * @import { FunctionNode } from '../ast/function.js'
3
+ * @import { ExprValue } from '../types.js'
4
+ */
2
5
  import { fn } from '../util/function.js';
3
6
 
4
7
  /**
5
8
  * Function that converts geometry data to GeoJSON format.
6
- * @param {import('../types.js').ExprValue} expr The input expression.
9
+ * @param {ExprValue} expr The input expression.
7
10
  * @returns {FunctionNode}
8
11
  */
9
12
  export function geojson(expr) {
@@ -12,7 +15,7 @@ export function geojson(expr) {
12
15
 
13
16
  /**
14
17
  * Function that returns a spatial x position (using ST_X).
15
- * @param {import('../types.js').ExprValue} expr The input expression.
18
+ * @param {ExprValue} expr The input expression.
16
19
  * @returns {FunctionNode}
17
20
  */
18
21
  export function x(expr) {
@@ -21,7 +24,7 @@ export function x(expr) {
21
24
 
22
25
  /**
23
26
  * Function that returns a spatial y position (using ST_Y).
24
- * @param {import('../types.js').ExprValue} expr The input expression.
27
+ * @param {ExprValue} expr The input expression.
25
28
  * @returns {FunctionNode}
26
29
  */
27
30
  export function y(expr) {
@@ -30,7 +33,7 @@ export function y(expr) {
30
33
 
31
34
  /**
32
35
  * Function that returns the centroid point for geometry data.
33
- * @param {import('../types.js').ExprValue} expr The input expression.
36
+ * @param {ExprValue} expr The input expression.
34
37
  * @returns {FunctionNode}
35
38
  */
36
39
  export function centroid(expr) {
@@ -39,7 +42,7 @@ export function centroid(expr) {
39
42
 
40
43
  /**
41
44
  * Function that returns the centroid x-coordinate for geometry data.
42
- * @param {import('../types.js').ExprValue} expr The input expression.
45
+ * @param {ExprValue} expr The input expression.
43
46
  * @returns {FunctionNode}
44
47
  */
45
48
  export function centroidX(expr) {
@@ -48,7 +51,7 @@ export function centroidX(expr) {
48
51
 
49
52
  /**
50
53
  * Function that returns yhe centroid y-coordinate for geometry data.
51
- * @param {import('../types.js').ExprValue} expr The input expression.
54
+ * @param {ExprValue} expr The input expression.
52
55
  * @returns {FunctionNode}
53
56
  */
54
57
  export function centroidY(expr) {
@@ -1,4 +1,7 @@
1
- /* eslint-disable jsdoc/no-undefined-types */
1
+ /**
2
+ * @import { ExprNode } from '../ast/node.js'
3
+ * @import { ParamLike } from '../types.js'
4
+ */
2
5
  import { FragmentNode } from '../ast/fragment.js';
3
6
  import { isNode } from '../ast/node.js';
4
7
  import { ParamNode } from '../ast/param.js';
@@ -7,10 +10,7 @@ import { isParamLike, isString } from '../util/type-check.js';
7
10
  import { literal } from './literal.js';
8
11
 
9
12
  /**
10
- * @typedef {import('../ast/node.js').ExprNode
11
- * | import('../types.js').ParamLike
12
- * | string | number | boolean | Date
13
- * } TemplateValue
13
+ * @typedef { ExprNode | ParamLike | string | number | boolean | Date } TemplateValue
14
14
  */
15
15
 
16
16
  /**
@@ -1,4 +1,7 @@
1
- import { FunctionNode } from '../ast/function.js';
1
+ /**
2
+ * @import { FunctionNode } from '../ast/function.js'
3
+ * @import { ExprValue, StringValue } from '../types.js'
4
+ */
2
5
  import { asLiteral } from '../util/ast.js';
3
6
  import { argsList, fn } from '../util/function.js';
4
7
 
@@ -9,9 +12,9 @@ function strFn(name, expr, ...args) {
9
12
  /**
10
13
  * Function that returns true if a string contains a regexp pattern,
11
14
  * false otherwise.
12
- * @param {import('../types.js').ExprValue} string The string match against.
13
- * @param {import('../types.js').StringValue} pattern The regular expression pattern to match.
14
- * @param {import('../types.js').StringValue} [options] Regular expression options:
15
+ * @param {ExprValue} string The string match against.
16
+ * @param {StringValue} pattern The regular expression pattern to match.
17
+ * @param {StringValue} [options] Regular expression options:
15
18
  * 'c': case-sensitive matching
16
19
  * 'i': case-insensitive matching
17
20
  * 'l': match literals instead of regular expression tokens
@@ -26,8 +29,8 @@ export function regexp_matches(string, pattern, options) {
26
29
 
27
30
  /**
28
31
  * Function that returns true if search_string is found within string.
29
- * @param {import('../types.js').ExprValue} string The string to match against.
30
- * @param {import('../types.js').StringValue} search_string The substring to search for.
32
+ * @param {ExprValue} string The string to match against.
33
+ * @param {StringValue} search_string The substring to search for.
31
34
  * @returns {FunctionNode}
32
35
  */
33
36
  export function contains(string, search_string) {
@@ -36,8 +39,8 @@ export function contains(string, search_string) {
36
39
 
37
40
  /**
38
41
  * Function that returns true if string begins with search_string.
39
- * @param {import('../types.js').ExprValue} string The string to match against.
40
- * @param {import('../types.js').StringValue} search_string The substring to search for.
42
+ * @param {ExprValue} string The string to match against.
43
+ * @param {StringValue} search_string The substring to search for.
41
44
  * @returns {FunctionNode}
42
45
  */
43
46
  export function prefix(string, search_string) {
@@ -46,8 +49,8 @@ export function prefix(string, search_string) {
46
49
 
47
50
  /**
48
51
  * Function that returns true if string ends with search_string.
49
- * @param {import('../types.js').ExprValue} string The string to match against.
50
- * @param {import('../types.js').StringValue} search_string The substring to search for.
52
+ * @param {ExprValue} string The string to match against.
53
+ * @param {StringValue} search_string The substring to search for.
51
54
  * @returns {FunctionNode}
52
55
  */
53
56
  export function suffix(string, search_string) {
@@ -56,7 +59,7 @@ export function suffix(string, search_string) {
56
59
 
57
60
  /**
58
61
  * Function that converts string to lower case.
59
- * @param {import('../types.js').ExprValue} string The string to convert.
62
+ * @param {ExprValue} string The string to convert.
60
63
  * @returns {FunctionNode}
61
64
  */
62
65
  export function lower(string) {
@@ -65,7 +68,7 @@ export function lower(string) {
65
68
 
66
69
  /**
67
70
  * Function that converts string to upper case.
68
- * @param {import('../types.js').ExprValue} string The string to convert.
71
+ * @param {ExprValue} string The string to convert.
69
72
  * @returns {FunctionNode}
70
73
  */
71
74
  export function upper(string) {
@@ -74,7 +77,7 @@ export function upper(string) {
74
77
 
75
78
  /**
76
79
  * Function that returns the number of characters in string.
77
- * @param {import('../types.js').ExprValue} value The string to measure.
80
+ * @param {ExprValue} value The string to measure.
78
81
  * @returns {FunctionNode}
79
82
  */
80
83
  export function length(value) {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @import { FunctionNode } from '../ast/function.js'
3
+ * @import { ExprValue } from '../types.js'
4
+ */
5
+ import { fn } from '../util/function.js';
6
+
7
+ /**
8
+ * Returns the first non-null argument.
9
+ * @param {...ExprValue} expr The input expressions.
10
+ * @returns {FunctionNode}
11
+ */
12
+ export function coalesce(...expr) {
13
+ return fn('coalesce', ...expr);
14
+ }