@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
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @typedef {object} BinDateOptions
3
+ * @property {TimeUnit} [interval] A string indicating a time interval
4
+ * unit, such as 'year', 'day', or 'hour'.
5
+ * @property {number} [step] The number of time interval steps to
6
+ * take, such as 2 years or 3 months.
7
+ * @property {number} [offset] The number of bin steps (default 0) by
8
+ * which to offset the result.
9
+ * @property {number} [steps] The desired number of binning steps.
10
+ * This value is a hint, it does not guarantee an exact number of steps.
11
+ */
12
+ /**
13
+ * Return a SQL expression for date/time bins.
14
+ * @param {ExprValue} field The column or expression to bin.
15
+ * @param {[Date|number, Date|number]} extent The min/max extent over which to bin.
16
+ * @param {BinDateOptions} [options] Datetime binning options.
17
+ * @returns {ExprNode}
18
+ */
19
+ export function binDate(field: ExprValue, extent: [Date | number, Date | number], options?: BinDateOptions): ExprNode;
20
+ export type BinDateOptions = {
21
+ /**
22
+ * A string indicating a time interval
23
+ * unit, such as 'year', 'day', or 'hour'.
24
+ */
25
+ interval?: TimeUnit;
26
+ /**
27
+ * The number of time interval steps to
28
+ * take, such as 2 years or 3 months.
29
+ */
30
+ step?: number;
31
+ /**
32
+ * The number of bin steps (default 0) by
33
+ * which to offset the result.
34
+ */
35
+ offset?: number;
36
+ /**
37
+ * The desired number of binning steps.
38
+ * This value is a hint, it does not guarantee an exact number of steps.
39
+ */
40
+ steps?: number;
41
+ };
42
+ import type { ExprValue } from '../types.js';
43
+ import type { ExprNode } from '../ast/node.js';
44
+ import type { TimeUnit } from '../types.js';
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @typedef {object} BinHistogramOptions
3
+ * @property {number} [step] An exact binning step to use.
4
+ * @property {number} [steps] The desired number of binning steps.
5
+ * This value is a hint, it does not guarantee an exact number of steps.
6
+ * @property {number} [minstep] A minimum binning step value. No generated
7
+ * step can be less than this value.
8
+ * @property {boolean} [nice] A boolean flag (default true) indicating if bin
9
+ * extents should be snapped to "nice" numbers such as multiples of 5 or 10.
10
+ * @property {number} [offset] The number of bin steps (default 0) by
11
+ * which to offset the result.
12
+ */
13
+ /**
14
+ * Return a SQL expression for histogram bins.
15
+ * @param {ExprValue} field The column or expression to bin.
16
+ * @param {[number, number]} extent The min/max extent over which to bin.
17
+ * @param {BinHistogramOptions} [options] Binning options.
18
+ * @param {ReturnType<typeof scaleTransform>} [transform] Scale transforms to
19
+ * apply to create (potentially non-linear) binning intervals.
20
+ * @returns {ExprNode} The resulting SQL expression
21
+ */
22
+ export function binHistogram(field: ExprValue, extent: [number, number], options?: BinHistogramOptions, transform?: ReturnType<typeof scaleTransform>): ExprNode;
23
+ export type BinHistogramOptions = {
24
+ /**
25
+ * An exact binning step to use.
26
+ */
27
+ step?: number;
28
+ /**
29
+ * The desired number of binning steps.
30
+ * This value is a hint, it does not guarantee an exact number of steps.
31
+ */
32
+ steps?: number;
33
+ /**
34
+ * A minimum binning step value. No generated
35
+ * step can be less than this value.
36
+ */
37
+ minstep?: number;
38
+ /**
39
+ * A boolean flag (default true) indicating if bin
40
+ * extents should be snapped to "nice" numbers such as multiples of 5 or 10.
41
+ */
42
+ nice?: boolean;
43
+ /**
44
+ * The number of bin steps (default 0) by
45
+ * which to offset the result.
46
+ */
47
+ offset?: number;
48
+ };
49
+ import type { ExprValue } from '../types.js';
50
+ import { scaleTransform } from './scales.js';
51
+ import type { ExprNode } from '../ast/node.js';
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Perform linear binning in one dimension.
3
- * @param {import('../ast/query.js').SelectQuery} query The base query to bin.
4
- * @param {import('../types.js').ExprValue} x The expression to bin.
5
- * @param {import('../types.js').ExprValue} [weight] The expression to weight by.
3
+ * @param {SelectQuery} query The base query to bin.
4
+ * @param {ExprValue} x The expression to bin.
5
+ * @param {ExprValue} [weight] The expression to weight by.
6
6
  * @param {string[]} [groupby] Group by expressions.
7
7
  * @returns {Query}
8
8
  */
9
- export function binLinear1d(query: import("../ast/query.js").SelectQuery, x: import("../types.js").ExprValue, weight?: import("../types.js").ExprValue, groupby?: string[]): Query;
9
+ export function binLinear1d(query: SelectQuery, x: ExprValue, weight?: ExprValue, groupby?: string[]): Query;
10
+ import type { SelectQuery } from '../ast/query.js';
11
+ import type { ExprValue } from '../types.js';
10
12
  import { Query } from '../ast/query.js';
@@ -6,13 +6,14 @@
6
6
  * should be in units of grid indices, but can contain fractional components.
7
7
  * @param {SelectQuery} q The input query. The FROM and WHERE clauses should
8
8
  * be added to the query separately, before this method is invoked.
9
- * @param {import('../types.js').ExprValue} xp The x grid bin expression
10
- * @param {import('../types.js').ExprValue} yp The y grid bin expression
11
- * @param {import('../types.js').ExprValue | undefined} weight Point weights.
9
+ * @param {ExprValue} xp The x grid bin expression
10
+ * @param {ExprValue} yp The y grid bin expression
11
+ * @param {ExprValue | undefined} weight Point weights.
12
12
  * @param {number} xn The number of x grid bins.
13
13
  * @param {string[]} [groupby] Group by expressions.
14
14
  * @returns {SelectQuery} A linear binning query for bin `index` and
15
15
  * aggregate `density` columns, in addition to any group by expressions.
16
16
  */
17
- export function binLinear2d(q: SelectQuery, xp: import("../types.js").ExprValue, yp: import("../types.js").ExprValue, weight: import("../types.js").ExprValue | undefined, xn: number, groupby?: string[]): SelectQuery;
18
- import { SelectQuery } from '../ast/query.js';
17
+ export function binLinear2d(q: SelectQuery, xp: ExprValue, yp: ExprValue, weight: ExprValue | undefined, xn: number, groupby?: string[]): SelectQuery;
18
+ import type { SelectQuery } from '../ast/query.js';
19
+ import type { ExprValue } from '../types.js';
@@ -5,9 +5,9 @@
5
5
  * and then sum results for all line series to produce a density map.
6
6
  * Based on Moritz and Fisher's work: https://arxiv.org/abs/1808.06019
7
7
  * @param {SelectQuery} q The base query over the data.
8
- * @param {import('../types.js').ExprValue} x Bin expression for x dimension.
8
+ * @param {ExprValue} x Bin expression for x dimension.
9
9
  * Provides gridded x coordinates, potentially with a fractional component.
10
- * @param {import('../types.js').ExprValue} y Bin expression for x dimension.
10
+ * @param {ExprValue} y Bin expression for x dimension.
11
11
  * Provides gridded y coordinates, potentially with a fractional component.
12
12
  * @param {string[]} z Group by columns that segment data into individual line
13
13
  * series. An empty array indicates there is only a single line series.
@@ -19,5 +19,6 @@
19
19
  * normalization to improve accuracy and reduce artifacts (default `true`).
20
20
  * @returns {SelectQuery}
21
21
  */
22
- export function lineDensity(q: SelectQuery, x: import("../types.js").ExprValue, y: import("../types.js").ExprValue, z: string[], xn: number, yn: number, groupby?: string[], normalize?: boolean): SelectQuery;
23
- import { SelectQuery } from '../ast/query.js';
22
+ export function lineDensity(q: SelectQuery, x: ExprValue, y: ExprValue, z: string[], xn: number, yn: number, groupby?: string[], normalize?: boolean): SelectQuery;
23
+ import type { SelectQuery } from '../ast/query.js';
24
+ import type { ExprValue } from '../types.js';
@@ -5,14 +5,17 @@
5
5
  * argmin and argmax, following https://arxiv.org/pdf/2306.03714.pdf.
6
6
  * This method can bin along either the *x* or *y* dimension, as determined
7
7
  * by the caller-provided *bin* expression.
8
- * @param {import('../types.js').FromExpr} input The base query or table.
9
- * @param {import('../types.js').ExprValue} bin An expression that maps
8
+ * @param {FromExpr} input The base query or table.
9
+ * @param {ExprValue} bin An expression that maps
10
10
  * time-series values to fractional pixel positions.
11
11
  * @param {string} x The x dimension column name.
12
12
  * @param {string} y The y dimension column name.
13
- * @param {import('../ast/node.js').ExprNode[]} [groups] Additional
13
+ * @param {ExprNode[]} [groups] Additional
14
14
  * groupby columns, for example for faceted charts.
15
15
  * @returns {Query} The resulting M4 query.
16
16
  */
17
- export function m4(input: import("../types.js").FromExpr, bin: import("../types.js").ExprValue, x: string, y: string, groups?: import("../ast/node.js").ExprNode[]): Query;
17
+ export function m4(input: FromExpr, bin: ExprValue, x: string, y: string, groups?: ExprNode[]): Query;
18
+ import type { FromExpr } from '../types.js';
19
+ import type { ExprValue } from '../types.js';
20
+ import type { ExprNode } from '../ast/node.js';
18
21
  import { Query } from '../ast/query.js';
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @typedef {object} BinOptions
3
+ * @property {number} [step] An exact binning step to use.
4
+ * @property {number} [steps] The desired number of binning steps.
5
+ * This value is a hint, it does not guarantee an exact number of steps.
6
+ * @property {number} [minstep] A minimum binning step value. No generated
7
+ * step can be less than this value.
8
+ * @property {boolean} [nice] A boolean flag (default true) indicating if bin
9
+ * extents should be snapped to "nice" numbers such as multiples of 5 or 10.
10
+ * @property {number} [base] A number indicating the the logarithm base to
11
+ * use for automatic step size determination. Defaults to base 10.
12
+ */
13
+ /**
14
+ * Generate a numeric binning scheme suitable for a histogram.
15
+ * @param {number} min The minimum value of the extent to bin.
16
+ * @param {number} max The maximum value of the extent to bin.
17
+ * @param {BinOptions} options Binning scheme options.
18
+ */
19
+ export function binSpec(min: number, max: number, options: BinOptions): {
20
+ min: number;
21
+ max: number;
22
+ steps: number;
23
+ };
24
+ /**
25
+ * Determine a bin step interval.
26
+ * @param {number} span The span from maximum to minimum value.
27
+ * @param {number} steps The approximate number of desired bins.
28
+ * @param {number} [minstep=0] The minimum acceptable bin step size.
29
+ * @param {number} [logb=Math.LN10] The log base for determining
30
+ * orders of magnitude for step sizes. Defaults to log base 10
31
+ * (`Math.LN10`). For example to use log base 2, provide the
32
+ * argument `Math.LN2` instead.
33
+ * @returns {number} The bin step interval (bin size).
34
+ */
35
+ export function binStep(span: number, steps: number, minstep?: number, logb?: number): number;
36
+ export type BinOptions = {
37
+ /**
38
+ * An exact binning step to use.
39
+ */
40
+ step?: number;
41
+ /**
42
+ * The desired number of binning steps.
43
+ * This value is a hint, it does not guarantee an exact number of steps.
44
+ */
45
+ steps?: number;
46
+ /**
47
+ * A minimum binning step value. No generated
48
+ * step can be less than this value.
49
+ */
50
+ minstep?: number;
51
+ /**
52
+ * A boolean flag (default true) indicating if bin
53
+ * extents should be snapped to "nice" numbers such as multiples of 5 or 10.
54
+ */
55
+ nice?: boolean;
56
+ /**
57
+ * A number indicating the the logarithm base to
58
+ * use for automatic step size determination. Defaults to base 10.
59
+ */
60
+ base?: number;
61
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Determine a time interval for binning based on provided min
3
+ * and max timestamps and approximate step count.
4
+ * @param {Date|number} min The minimum timestamp value.
5
+ * @param {Date|number} max The maximum timestamp value.
6
+ * @param {number} steps The approximate number of bins desired.
7
+ * @returns {{ unit: TimeUnit, step: number }}
8
+ */
9
+ export function timeInterval(min: Date | number, max: Date | number, steps: number): {
10
+ unit: TimeUnit;
11
+ step: number;
12
+ };
13
+ import type { TimeUnit } from '../../types.js';
@@ -59,3 +59,4 @@ export type FromExpr = MaybeArray<FromEntry>;
59
59
  export type FilterExpr = MaybeArray<string | ExprNode>;
60
60
  export type GroupByExpr = MaybeArray<string | ExprNode>;
61
61
  export type OrderByExpr = MaybeArray<string | ExprNode>;
62
+ export type TimeUnit = 'year' | 'quarter' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond' | 'microsecond';
@@ -38,16 +38,16 @@ export function asTableRef(value: string | string[] | TableRefNode): TableRefNod
38
38
  * Parse a string as a column reference, potentially with
39
39
  * dot ('.') delimited table, schema, and database references.
40
40
  * @param {string} ref The column reference string.
41
- * @returns {import('../ast/column-ref.js').ColumnRefNode}
41
+ * @returns {ColumnRefNode}
42
42
  */
43
- export function parseColumnRef(ref: string): import("../ast/column-ref.js").ColumnRefNode;
43
+ export function parseColumnRef(ref: string): ColumnRefNode;
44
44
  /**
45
45
  * Parse a string as a table reference, potentially with
46
46
  * dot ('.') delimited schema and database references.
47
47
  * @param {string} ref The table reference string.
48
- * @returns {import('../ast/table-ref.js').TableRefNode}
48
+ * @returns {TableRefNode}
49
49
  */
50
- export function parseTableRef(ref: string): import("../ast/table-ref.js").TableRefNode;
50
+ export function parseTableRef(ref: string): TableRefNode;
51
51
  /**
52
52
  * Create a new window definition node. The return value is an empty
53
53
  * window definition. Use chained calls such as `partitionby` and `orderby`
@@ -56,5 +56,6 @@ export function parseTableRef(ref: string): import("../ast/table-ref.js").TableR
56
56
  */
57
57
  export function over(): WindowDefNode;
58
58
  import { ExprNode } from '../ast/node.js';
59
- import { TableRefNode } from '../ast/table-ref.js';
59
+ import type { TableRefNode } from '../ast/table-ref.js';
60
+ import type { ColumnRefNode } from '../ast/column-ref.js';
60
61
  import { WindowDefNode } from '../ast/window.js';
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Test if an AST node is a specific function call.
3
- * @param {import('../ast/node.js').SQLNode} node The SQL AST node to test.
3
+ * @param {SQLNode} node The SQL AST node to test.
4
4
  * @param {string} name The function name.
5
5
  * @returns {node is FunctionNode}
6
6
  */
7
- export function isFunctionCall(node: import("../ast/node.js").SQLNode, name: string): node is FunctionNode;
7
+ export function isFunctionCall(node: SQLNode, name: string): node is FunctionNode;
8
8
  /**
9
9
  * Create a new function call AST node.
10
10
  * @param {string} name The function name.
@@ -23,11 +23,11 @@ export function aggFn(name: string, ...args: any[]): AggregateNode;
23
23
  * Create a new window AST node. The output node has an empty window
24
24
  * definition. Use chained calls such as `partitionby` and `orderby`
25
25
  * to specify the window settings.
26
- * @param {import('../types.js').WindowFunctionName} name The function name.
26
+ * @param {WindowFunctionName} name The function name.
27
27
  * @param {...any} args The function arguments.
28
28
  * @returns {WindowNode}
29
29
  */
30
- export function winFn(name: import("../types.js").WindowFunctionName, ...args: any[]): WindowNode;
30
+ export function winFn(name: WindowFunctionName, ...args: any[]): WindowNode;
31
31
  /**
32
32
  * Process a list of expression inputs. Nested arrays are flattened,
33
33
  * null results are removed, and each input is cast (as needed) to
@@ -49,6 +49,8 @@ export function exprList(list: any[], cast?: Function): ReturnType<Function>[];
49
49
  * @returns {T[]} The prepared argument list.
50
50
  */
51
51
  export function argsList<T>(list: T[]): T[];
52
+ import type { SQLNode } from '../ast/node.js';
52
53
  import { FunctionNode } from '../ast/function.js';
53
54
  import { AggregateNode } from '../ast/aggregate.js';
55
+ import type { WindowFunctionName } from '../types.js';
54
56
  import { WindowNode } from '../ast/window.js';
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { ParamLike } from '../types.js'
3
+ */
1
4
  /**
2
5
  * Check if a value is a string.
3
6
  * @param {*} value The value to check.
@@ -13,6 +16,7 @@ export function isArray(value: any): value is any[];
13
16
  /**
14
17
  * Check if a value is a dynamic parameter.
15
18
  * @param {*} value The value to check.
16
- * @returns {value is import('../types.js').ParamLike}
19
+ * @returns {value is ParamLike}
17
20
  */
18
- export function isParamLike(value: any): value is import("../types.js").ParamLike;
21
+ export function isParamLike(value: any): value is ParamLike;
22
+ import type { ParamLike } from '../types.js';
@@ -25,9 +25,10 @@ export function collectColumns(root: SQLNode): ColumnRefNode[];
25
25
  /**
26
26
  * Collect all unique dynamic parameter instances.
27
27
  * @param {SQLNode} root The root of the AST to search.
28
- * @returns {import('../types.js').ParamLike[]}
28
+ * @returns {ParamLike[]}
29
29
  */
30
- export function collectParams(root: SQLNode): import("../types.js").ParamLike[];
30
+ export function collectParams(root: SQLNode): ParamLike[];
31
31
  import { SQLNode } from '../ast/node.js';
32
32
  import { AggregateNode } from '../ast/aggregate.js';
33
33
  import { ColumnRefNode } from '../ast/column-ref.js';
34
+ import type { ParamLike } from '../types.js';
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Perform a traversal of a SQL expression AST.
3
- * @param {import('../ast/node.js').SQLNode} node Root node for AST traversal.
4
- * @param {import('../types.js').VisitorCallback} visit Visitor callback function.
5
- * @return {import('../types.js').VisitorResult}
3
+ * @param {SQLNode} node Root node for AST traversal.
4
+ * @param {VisitorCallback} visit Visitor callback function.
5
+ * @return {VisitorResult}
6
6
  */
7
- export function walk(node: import("../ast/node.js").SQLNode, visit: import("../types.js").VisitorCallback): import("../types.js").VisitorResult;
7
+ export function walk(node: SQLNode, visit: VisitorCallback): VisitorResult;
8
+ import type { SQLNode } from '../ast/node.js';
9
+ import type { VisitorCallback } from '../types.js';
10
+ import type { VisitorResult } from '../types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uwdata/mosaic-sql",
3
- "version": "0.13.0",
3
+ "version": "0.14.1",
4
4
  "description": "SQL query construction and analysis.",
5
5
  "keywords": [
6
6
  "sql",
@@ -27,5 +27,5 @@
27
27
  "tsc": "tsc -p jsconfig.json",
28
28
  "prepublishOnly": "npm run test && npm run lint && npm run build"
29
29
  },
30
- "gitHead": "b5a0e03e200c0f04c46562a288f084ffc9f6ad55"
30
+ "gitHead": "5959cb169e95bd8467e1e5d7a9b98954f09474f3"
31
31
  }
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { ExprVarArgs } from '../types.js'
3
+ */
1
4
  import { AGGREGATE } from '../constants.js';
2
5
  import { asVerbatim } from '../util/ast.js';
3
6
  import { isString } from '../util/type-check.js';
@@ -69,7 +72,7 @@ export class AggregateNode extends ExprNode {
69
72
 
70
73
  /**
71
74
  * Return a new window function over this aggregate with the given partitions.
72
- * @param {...import('../types.js').ExprVarArgs} expr The partition by criteria.
75
+ * @param {...ExprVarArgs} expr The partition by criteria.
73
76
  * @returns {WindowNode} A new window node.
74
77
  */
75
78
  partitionby(...expr) {
@@ -78,7 +81,7 @@ export class AggregateNode extends ExprNode {
78
81
 
79
82
  /**
80
83
  * Return a new window function over this aggregate with the given ordering.
81
- * @param {...import('../types.js').ExprVarArgs} expr The order by criteria.
84
+ * @param {...ExprVarArgs} expr The order by criteria.
82
85
  * @returns {WindowNode} A new window node.
83
86
  */
84
87
  orderby(...expr) {
package/src/ast/case.js CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { ExprValue } from '../types.js'
3
+ */
1
4
  import { CASE, WHEN } from '../constants.js';
2
5
  import { asNode } from '../util/ast.js';
3
6
  import { ExprNode, SQLNode } from './node.js';
@@ -37,10 +40,8 @@ export class CaseNode extends ExprNode {
37
40
  /**
38
41
  * Return a new case node with the given conditional added as
39
42
  * the last WHEN / THEN pair.
40
- * @param {import('../types.js').ExprValue} cond
41
- * The WHEN condition expression.
42
- * @param {import('../types.js').ExprValue} value
43
- * The THEN value expression.
43
+ * @param {ExprValue} cond The WHEN condition expression.
44
+ * @param {ExprValue} value The THEN value expression.
44
45
  * @returns {CaseNode}
45
46
  */
46
47
  when(cond, value) {
@@ -53,7 +54,7 @@ export class CaseNode extends ExprNode {
53
54
 
54
55
  /**
55
56
  * Return a new case node with the given ELSE expression.
56
- * @param {import('../types.js').ExprValue} expr The ELSE expression.
57
+ * @param {ExprValue} expr The ELSE expression.
57
58
  * @returns {CaseNode}
58
59
  */
59
60
  else(expr) {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @import { ParamNode } from './param.js'
3
+ * @import { TableRefNode } from './table-ref.js'
4
+ */
1
5
  import { COLUMN_PARAM } from '../constants.js';
2
6
  import { ColumnRefNode } from './column-ref.js';
3
7
 
@@ -13,16 +17,14 @@ export function isColumnParam(value) {
13
17
  export class ColumnParamNode extends ColumnRefNode {
14
18
  /**
15
19
  * Instantiate a column param node.
16
- * @param {import('./param.js').ParamNode} param The column name as a
17
- * parameter node.
18
- * @param {import('./table-ref.js').TableRefNode} [table] The table
19
- * reference.
20
+ * @param {ParamNode} param The column name as a parameter node.
21
+ * @param {TableRefNode} [table] The table reference.
20
22
  */
21
23
  constructor(param, table) {
22
24
  super(COLUMN_PARAM, table);
23
25
  /**
24
26
  * The column name as a parameter node.
25
- * @type {import('./param.js').ParamNode}
27
+ * @type {ParamNode}
26
28
  * @readonly
27
29
  */
28
30
  this.param = param;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { TableRefNode } from './table-ref.js'
3
+ */
1
4
  import { COLUMN_REF } from '../constants.js';
2
5
  import { quoteIdentifier } from '../util/string.js';
3
6
  import { ExprNode } from './node.js';
@@ -14,13 +17,13 @@ export function isColumnRef(value) {
14
17
  export class ColumnRefNode extends ExprNode {
15
18
  /**
16
19
  * Instantiate a column reference node.
17
- * @param {import('./table-ref.js').TableRefNode} [table] The table reference.
20
+ * @param {TableRefNode} [table] The table reference.
18
21
  */
19
22
  constructor(type, table) {
20
23
  super(type);
21
24
  /**
22
25
  * The table reference.
23
- * @type {import('./table-ref.js').TableRefNode}
26
+ * @type {TableRefNode}
24
27
  * @readonly
25
28
  */
26
29
  this.table = table;
@@ -50,7 +53,7 @@ export class ColumnNameRefNode extends ColumnRefNode {
50
53
  /**
51
54
  * Instantiate a column reference node.
52
55
  * @param {string} name The column name.
53
- * @param {import('./table-ref.js').TableRefNode} [table] The table reference.
56
+ * @param {TableRefNode} [table] The table reference.
54
57
  */
55
58
  constructor(name, table) {
56
59
  super(COLUMN_REF, table);
package/src/ast/param.js CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { ParamLike } from '../types.js'
3
+ */
1
4
  import { PARAM } from '../constants.js';
2
5
  import { literalToSQL } from './literal.js';
3
6
  import { ExprNode } from './node.js';
@@ -5,13 +8,13 @@ import { ExprNode } from './node.js';
5
8
  export class ParamNode extends ExprNode {
6
9
  /**
7
10
  * Instantiate a param node with a dynamic parameter.
8
- * @param {import('../types.js').ParamLike} param The dynamic parameter.
11
+ * @param {ParamLike} param The dynamic parameter.
9
12
  */
10
13
  constructor(param) {
11
14
  super(PARAM);
12
15
  /**
13
16
  * The dynamic parameter.
14
- * @type {import('../types.js').ParamLike}
17
+ * @type {ParamLike}
15
18
  * @readonly
16
19
  */
17
20
  this.param = param;