@uwdata/mosaic-sql 0.16.2 → 0.17.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 (97) hide show
  1. package/package.json +5 -9
  2. package/src/ast/aggregate.js +50 -8
  3. package/src/ast/collate.js +33 -0
  4. package/src/ast/from.js +13 -4
  5. package/src/ast/node.js +13 -0
  6. package/src/ast/query.js +54 -22
  7. package/src/ast/sample.js +3 -3
  8. package/src/ast/subquery.js +23 -0
  9. package/src/ast/verbatim.js +8 -1
  10. package/src/ast/window-frame.js +107 -0
  11. package/src/ast/window.js +65 -99
  12. package/src/constants.js +5 -6
  13. package/src/functions/collate.js +16 -0
  14. package/src/functions/datetime.js +1 -11
  15. package/src/functions/interval.js +83 -0
  16. package/src/functions/literal.js +3 -2
  17. package/src/functions/window-frame.js +61 -0
  18. package/src/index.js +12 -4
  19. package/src/load/load.js +1 -1
  20. package/src/transforms/bin-date.js +2 -1
  21. package/src/transforms/filter-query.js +44 -0
  22. package/src/types.ts +9 -0
  23. package/src/visit/clone.js +53 -0
  24. package/src/visit/recurse.js +17 -5
  25. package/src/visit/rewrite.js +3 -11
  26. package/src/visit/walk.js +0 -1
  27. package/tsconfig.json +3 -7
  28. package/LICENSE +0 -47
  29. package/dist/types/ast/aggregate.d.ts +0 -71
  30. package/dist/types/ast/between-op.d.ts +0 -46
  31. package/dist/types/ast/binary-op.d.ts +0 -28
  32. package/dist/types/ast/case.d.ts +0 -67
  33. package/dist/types/ast/cast.d.ts +0 -21
  34. package/dist/types/ast/column-param.d.ts +0 -23
  35. package/dist/types/ast/column-ref.d.ts +0 -40
  36. package/dist/types/ast/fragment.d.ts +0 -14
  37. package/dist/types/ast/from.d.ts +0 -21
  38. package/dist/types/ast/function.d.ts +0 -21
  39. package/dist/types/ast/in-op.d.ts +0 -21
  40. package/dist/types/ast/interval.d.ts +0 -21
  41. package/dist/types/ast/literal.d.ts +0 -15
  42. package/dist/types/ast/logical-op.d.ts +0 -46
  43. package/dist/types/ast/node.d.ts +0 -24
  44. package/dist/types/ast/order-by.d.ts +0 -29
  45. package/dist/types/ast/param.d.ts +0 -20
  46. package/dist/types/ast/query.d.ts +0 -320
  47. package/dist/types/ast/sample.d.ts +0 -42
  48. package/dist/types/ast/select.d.ts +0 -22
  49. package/dist/types/ast/table-ref.d.ts +0 -25
  50. package/dist/types/ast/unary-op.d.ts +0 -39
  51. package/dist/types/ast/verbatim.d.ts +0 -9
  52. package/dist/types/ast/window.d.ts +0 -180
  53. package/dist/types/ast/with.d.ts +0 -32
  54. package/dist/types/constants.d.ts +0 -38
  55. package/dist/types/functions/aggregate.d.ts +0 -236
  56. package/dist/types/functions/case.d.ts +0 -13
  57. package/dist/types/functions/cast.d.ts +0 -26
  58. package/dist/types/functions/column.d.ts +0 -11
  59. package/dist/types/functions/cte.d.ts +0 -13
  60. package/dist/types/functions/datetime.d.ts +0 -45
  61. package/dist/types/functions/literal.d.ts +0 -16
  62. package/dist/types/functions/numeric.d.ts +0 -95
  63. package/dist/types/functions/operators.d.ts +0 -200
  64. package/dist/types/functions/order-by.d.ts +0 -18
  65. package/dist/types/functions/spatial.d.ts +0 -38
  66. package/dist/types/functions/sql-template-tag.d.ts +0 -15
  67. package/dist/types/functions/string.d.ts +0 -57
  68. package/dist/types/functions/table-ref.d.ts +0 -9
  69. package/dist/types/functions/util.d.ts +0 -8
  70. package/dist/types/functions/window.d.ts +0 -89
  71. package/dist/types/index-types.d.ts +0 -2
  72. package/dist/types/index.d.ts +0 -59
  73. package/dist/types/load/create.d.ts +0 -8
  74. package/dist/types/load/extension.d.ts +0 -1
  75. package/dist/types/load/load.d.ts +0 -12
  76. package/dist/types/load/sql-from.d.ts +0 -11
  77. package/dist/types/transforms/bin-1d.d.ts +0 -15
  78. package/dist/types/transforms/bin-2d.d.ts +0 -19
  79. package/dist/types/transforms/bin-date.d.ts +0 -44
  80. package/dist/types/transforms/bin-histogram.d.ts +0 -51
  81. package/dist/types/transforms/bin-linear-1d.d.ts +0 -12
  82. package/dist/types/transforms/bin-linear-2d.d.ts +0 -19
  83. package/dist/types/transforms/line-density.d.ts +0 -24
  84. package/dist/types/transforms/m4.d.ts +0 -21
  85. package/dist/types/transforms/scales.d.ts +0 -1
  86. package/dist/types/transforms/util/bin-step.d.ts +0 -61
  87. package/dist/types/transforms/util/time-interval.d.ts +0 -13
  88. package/dist/types/types.d.ts +0 -62
  89. package/dist/types/util/ast.d.ts +0 -61
  90. package/dist/types/util/function.d.ts +0 -56
  91. package/dist/types/util/string.d.ts +0 -3
  92. package/dist/types/util/type-check.d.ts +0 -22
  93. package/dist/types/visit/recurse.d.ts +0 -28
  94. package/dist/types/visit/rewrite.d.ts +0 -10
  95. package/dist/types/visit/visitors.d.ts +0 -34
  96. package/dist/types/visit/walk.d.ts +0 -10
  97. package/jsconfig.json +0 -11
@@ -4,6 +4,7 @@ import {
4
4
  BINARY_OPERATOR,
5
5
  CASE,
6
6
  CAST,
7
+ COLLATE,
7
8
  COLUMN_PARAM,
8
9
  COLUMN_REF,
9
10
  DESCRIBE_QUERY,
@@ -16,23 +17,29 @@ import {
16
17
  NOT_BETWEEN_OPERATOR,
17
18
  ORDER_BY,
18
19
  PARAM,
20
+ SCALAR_SUBQUERY,
19
21
  SELECT_CLAUSE,
20
22
  SELECT_QUERY,
21
23
  SET_OPERATION,
22
24
  UNARY_OPERATOR,
25
+ UNARY_POSTFIX_OPERATOR,
23
26
  WHEN,
24
27
  WINDOW,
25
28
  WINDOW_CLAUSE,
26
29
  WINDOW_DEF,
27
- WINDOW_FRAME
30
+ WINDOW_EXTENT_EXPR,
31
+ WINDOW_FRAME,
32
+ WINDOW_FUNCTION,
33
+ WITH_CLAUSE
28
34
  } from '../constants.js';
29
35
 
30
36
  export const recurse = {
31
- [AGGREGATE]: ['args', 'filter'],
37
+ [AGGREGATE]: ['args', 'order', 'filter'],
32
38
  [BETWEEN_OPERATOR]: ['expr', 'extent'],
33
39
  [BINARY_OPERATOR]: ['left', 'right'],
34
40
  [CASE]: ['expr', '_when', '_else'],
35
41
  [CAST]: ['expr'],
42
+ [COLLATE]: ['expr'],
36
43
  [COLUMN_PARAM]: ['param', 'table'],
37
44
  [COLUMN_REF]: ['table'],
38
45
  [DESCRIBE_QUERY]: ['query'],
@@ -45,13 +52,18 @@ export const recurse = {
45
52
  [NOT_BETWEEN_OPERATOR]: ['expr', 'extent'],
46
53
  [ORDER_BY]: ['expr'],
47
54
  [PARAM]: ['value'],
55
+ [SCALAR_SUBQUERY]: ['subquery'],
48
56
  [SELECT_CLAUSE]: ['expr'],
49
57
  [SELECT_QUERY]: ['_with', '_select', '_from', '_where', '_sample', '_groupby', '_having', '_window', '_qualify', '_orderby'],
50
- [SET_OPERATION]: ['subqueries', '_orderby'],
58
+ [SET_OPERATION]: ['queries', '_orderby'],
51
59
  [UNARY_OPERATOR]: ['expr'],
60
+ [UNARY_POSTFIX_OPERATOR]: ['expr'],
52
61
  [WHEN]: ['when', 'then'],
53
62
  [WINDOW]: ['func', 'def'],
54
63
  [WINDOW_CLAUSE]: ['def'],
55
- [WINDOW_DEF]: ['partition', 'order', 'frame'],
56
- [WINDOW_FRAME]: ['extent']
64
+ [WINDOW_DEF]: ['partition', 'order', 'framedef'],
65
+ [WINDOW_EXTENT_EXPR]: ['expr'],
66
+ [WINDOW_FRAME]: ['extent'],
67
+ [WINDOW_FUNCTION]: ['args'],
68
+ [WITH_CLAUSE]: ['query']
57
69
  };
@@ -17,14 +17,15 @@ export function rewrite(node, map) {
17
17
  const props = recurse[node.type];
18
18
  const n = props?.length ?? 0;
19
19
  if (n > 0) {
20
- node = cloneNode(node);
20
+ node = node.clone();
21
21
  for (let i = 0; i < n; ++i) {
22
22
  const prop = props[i];
23
23
  const child = node[prop];
24
24
  if (Array.isArray(child)) {
25
+ const a = (node[prop] = child.slice());
25
26
  const m = child.length;
26
27
  for (let j = 0; j < m; ++j) {
27
- child[j] = rewrite(child[j], map);
28
+ a[j] = rewrite(child[j], map);
28
29
  }
29
30
  } else if (child) {
30
31
  node[prop] = rewrite(child, map);
@@ -34,12 +35,3 @@ export function rewrite(node, map) {
34
35
  }
35
36
  return node;
36
37
  }
37
-
38
- // TODO: consider typed node.clone() methods
39
- function cloneNode(node) {
40
- const clone = new node.constructor();
41
- for (const key in node) {
42
- clone[key] = node[key];
43
- }
44
- return clone;
45
- }
package/src/visit/walk.js CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * @import { SQLNode } from '../ast/node.js'
3
3
  * @import { VisitorCallback, VisitorResult } from '../types.js'
4
-
5
4
  */
6
5
  import { isNode } from '../ast/node.js';
7
6
  import { recurse } from './recurse.js';
package/tsconfig.json CHANGED
@@ -1,12 +1,8 @@
1
1
  {
2
- "include": ["src/index-types.ts"],
2
+ "extends": "../../tsconfig.base.json",
3
+ "include": ["src/**/*"],
3
4
  "compilerOptions": {
4
- "allowJs": true,
5
- "declaration": true,
6
5
  "emitDeclarationOnly": true,
7
- "outDir": "dist/types",
8
- "module": "node16",
9
- "skipLibCheck": true,
10
- "types": []
6
+ "outDir": "dist"
11
7
  }
12
8
  }
package/LICENSE DELETED
@@ -1,47 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2023, UW Interactive Data Lab
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
-
30
- ---
31
-
32
- Portions of this software are derived from Observable Plot, which is released
33
- under the ISC license.
34
-
35
- Copyright 2020-2023 Observable, Inc.
36
-
37
- Permission to use, copy, modify, and/or distribute this software for any purpose
38
- with or without fee is hereby granted, provided that the above copyright notice
39
- and this permission notice appear in all copies.
40
-
41
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
42
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
43
- FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
44
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
45
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
46
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
47
- THIS SOFTWARE.
@@ -1,71 +0,0 @@
1
- export class AggregateNode extends ExprNode {
2
- /**
3
- * Instantiate an aggregate function node.
4
- * @param {string} name The aggregate function name.
5
- * @param {ExprNode[]} args The aggregate function arguments.
6
- * @param {boolean} [distinct] The distinct flag.
7
- * @param {ExprNode} [filter] Filter expression.
8
- */
9
- constructor(name: string, args: ExprNode[], distinct?: boolean, filter?: ExprNode);
10
- /**
11
- * The aggregate function name.
12
- * @type {string}
13
- * @readonly
14
- */
15
- readonly name: string;
16
- /**
17
- * The aggregate function arguments.
18
- * @type {ExprNode[]}
19
- * @readonly
20
- */
21
- readonly args: ExprNode[];
22
- /**
23
- * The distinct flag.
24
- * @type {boolean}
25
- * @readonly
26
- */
27
- readonly isDistinct: boolean;
28
- /**
29
- * Filter criteria.
30
- * @type {ExprNode}
31
- * @readonly
32
- */
33
- readonly filter: ExprNode;
34
- /**
35
- * Return a new derived aggregate over distinct values.
36
- * @param {boolean} [isDistinct=true] The distinct flag.
37
- * @returns {AggregateNode} A new aggregate node.
38
- */
39
- distinct(isDistinct?: boolean): AggregateNode;
40
- /**
41
- * Return a new derived aggregate function that filters values.
42
- * @param {ExprNode | string} filter The filter expression.
43
- * @returns {AggregateNode} A new aggregate node.
44
- */
45
- where(filter: ExprNode | string): AggregateNode;
46
- /**
47
- * Return a new window function over this aggregate.
48
- * @returns {WindowNode} A new window node.
49
- */
50
- window(): WindowNode;
51
- /**
52
- * Return a new window function over this aggregate with the given partitions.
53
- * @param {...ExprVarArgs} expr The partition by criteria.
54
- * @returns {WindowNode} A new window node.
55
- */
56
- partitionby(...expr: ExprVarArgs[]): WindowNode;
57
- /**
58
- * Return a new window function over this aggregate with the given ordering.
59
- * @param {...ExprVarArgs} expr The order by criteria.
60
- * @returns {WindowNode} A new window node.
61
- */
62
- orderby(...expr: ExprVarArgs[]): WindowNode;
63
- }
64
- /**
65
- * An array of known aggregate function names.
66
- * From https://duckdb.org/docs/sql/functions/aggregates.html.
67
- */
68
- export const aggregateNames: string[];
69
- import { ExprNode } from './node.js';
70
- import { WindowNode } from './window.js';
71
- import type { ExprVarArgs } from '../types.js';
@@ -1,46 +0,0 @@
1
- export class BetweenOpNode extends AbstractBetweenOpNode {
2
- /**
3
- * Instantiate a between operator node.
4
- * @param {ExprNode} expr The input expression.
5
- * @param {[ExprNode, ExprNode]} extent
6
- * The range extent.
7
- */
8
- constructor(expr: ExprNode, extent: [ExprNode, ExprNode]);
9
- }
10
- export class NotBetweenOpNode extends AbstractBetweenOpNode {
11
- /**
12
- * Instantiate a not between operator node.
13
- * @param {ExprNode} expr The input expression.
14
- * @param {[ExprNode, ExprNode]} extent
15
- * The range extent.
16
- */
17
- constructor(expr: ExprNode, extent: [ExprNode, ExprNode]);
18
- }
19
- declare class AbstractBetweenOpNode extends ExprNode {
20
- /**
21
- * Instantiate an abstract between operator node.
22
- * @param {string} type The node type.
23
- * @param {ExprNode} expr The input expression.
24
- * @param {[ExprNode, ExprNode]} extent The range extent.
25
- */
26
- constructor(type: string, expr: ExprNode, extent: [ExprNode, ExprNode]);
27
- /**
28
- * The input expression.
29
- * @type {ExprNode}
30
- * @readonly
31
- */
32
- readonly expr: ExprNode;
33
- /**
34
- * The range extent.
35
- * @type {[ExprNode, ExprNode]}
36
- * @readonly
37
- */
38
- readonly extent: [ExprNode, ExprNode];
39
- /**
40
- * Generate a SQL query string for this node.
41
- * @returns {string}
42
- */
43
- toSQL(op: any): string;
44
- }
45
- import { ExprNode } from './node.js';
46
- export {};
@@ -1,28 +0,0 @@
1
- export class BinaryOpNode extends ExprNode {
2
- /**
3
- * Instantiate a binary operator node.
4
- * @param {string} op The operator type.
5
- * @param {ExprNode} left The left input expression.
6
- * @param {ExprNode} right The right input expression.
7
- */
8
- constructor(op: string, left: ExprNode, right: ExprNode);
9
- /**
10
- * The operator type.
11
- * @type {string}
12
- * @readonly
13
- */
14
- readonly op: string;
15
- /**
16
- * The left input expression.
17
- * @type {ExprNode}
18
- * @readonly
19
- */
20
- readonly left: ExprNode;
21
- /**
22
- * The right input expression.
23
- * @type {ExprNode}
24
- * @readonly
25
- */
26
- readonly right: ExprNode;
27
- }
28
- import { ExprNode } from './node.js';
@@ -1,67 +0,0 @@
1
- export class CaseNode extends ExprNode {
2
- /**
3
- * Instantiate a case node.
4
- * @param {ExprNode} [expr] An optional base expression, that comes
5
- * immediately after the CASE keyword. If specified, this case statement
6
- * acts like a switch statement, with WHEN expressions as values to
7
- * match against the switch value rather than boolean conditions.
8
- * @param {WhenNode[]} [when] An array of WHEN/THEN expression nodes.
9
- * @param {ExprNode} [elseExpr] An ELSE expression.
10
- */
11
- constructor(expr?: ExprNode, when?: WhenNode[], elseExpr?: ExprNode);
12
- /**
13
- * The optional base expression.
14
- * @type {ExprNode}
15
- * @readonly
16
- */
17
- readonly expr: ExprNode;
18
- /**
19
- * An array of WHEN/THEN expression nodes.
20
- * @type {WhenNode[]}
21
- * @readonly
22
- */
23
- readonly _when: WhenNode[];
24
- /**
25
- * An ELSE expression.
26
- * @type {ExprNode}
27
- * @readonly
28
- */
29
- readonly _else: ExprNode;
30
- /**
31
- * Return a new case node with the given conditional added as
32
- * the last WHEN / THEN pair.
33
- * @param {ExprValue} cond The WHEN condition expression.
34
- * @param {ExprValue} value The THEN value expression.
35
- * @returns {CaseNode}
36
- */
37
- when(cond: ExprValue, value: ExprValue): CaseNode;
38
- /**
39
- * Return a new case node with the given ELSE expression.
40
- * @param {ExprValue} expr The ELSE expression.
41
- * @returns {CaseNode}
42
- */
43
- else(expr: ExprValue): CaseNode;
44
- }
45
- export class WhenNode extends SQLNode {
46
- /**
47
- * Instantiate a case node.
48
- * @param {ExprNode} when The WHEN condition expression.
49
- * @param {ExprNode} then The THEN value expression.
50
- */
51
- constructor(when: ExprNode, then: ExprNode);
52
- /**
53
- * The condition expression.
54
- * @type {ExprNode}
55
- * @readonly
56
- */
57
- readonly when: ExprNode;
58
- /**
59
- * The value expression.
60
- * @type {ExprNode}
61
- * @readonly
62
- */
63
- readonly then: ExprNode;
64
- }
65
- import { ExprNode } from './node.js';
66
- import type { ExprValue } from '../types.js';
67
- import { SQLNode } from './node.js';
@@ -1,21 +0,0 @@
1
- export class CastNode extends ExprNode {
2
- /**
3
- * Instantiate a cast node.
4
- * @param {ExprNode} expr The expression to type cast.
5
- * @param {string} type The type to cast to.
6
- */
7
- constructor(expr: ExprNode, type: string);
8
- /**
9
- * The expression to type cast.
10
- * @type {ExprNode}
11
- * @readonly
12
- */
13
- readonly expr: ExprNode;
14
- /**
15
- * The type to cast to.
16
- * @type {string}
17
- * @readonly
18
- */
19
- readonly cast: string;
20
- }
21
- import { ExprNode } from './node.js';
@@ -1,23 +0,0 @@
1
- /**
2
- * Check if a value is a dynamic column reference node.
3
- * @param {*} value The value to check.
4
- * @returns {value is ColumnParamNode}
5
- */
6
- export function isColumnParam(value: any): value is ColumnParamNode;
7
- export class ColumnParamNode extends ColumnRefNode {
8
- /**
9
- * Instantiate a column param node.
10
- * @param {ParamNode} param The column name as a parameter node.
11
- * @param {TableRefNode} [table] The table reference.
12
- */
13
- constructor(param: ParamNode, table?: TableRefNode);
14
- /**
15
- * The column name as a parameter node.
16
- * @type {ParamNode}
17
- * @readonly
18
- */
19
- readonly param: ParamNode;
20
- }
21
- import { ColumnRefNode } from './column-ref.js';
22
- import type { ParamNode } from './param.js';
23
- import type { TableRefNode } from './table-ref.js';
@@ -1,40 +0,0 @@
1
- /**
2
- * Check if a value is a column reference node.
3
- * @param {*} value The value to check.
4
- * @returns {value is ColumnRefNode}
5
- */
6
- export function isColumnRef(value: any): value is ColumnRefNode;
7
- export class ColumnRefNode extends ExprNode {
8
- /**
9
- * Instantiate a column reference node.
10
- * @param {TableRefNode} [table] The table reference.
11
- */
12
- constructor(type: any, table?: TableRefNode);
13
- /**
14
- * The table reference.
15
- * @type {TableRefNode}
16
- * @readonly
17
- */
18
- readonly table: TableRefNode;
19
- /**
20
- * Returns the column name.
21
- * @returns {string}
22
- */
23
- get column(): string;
24
- }
25
- export class ColumnNameRefNode extends ColumnRefNode {
26
- /**
27
- * Instantiate a column reference node.
28
- * @param {string} name The column name.
29
- * @param {TableRefNode} [table] The table reference.
30
- */
31
- constructor(name: string, table?: TableRefNode);
32
- /**
33
- * The column name.
34
- * @type {string}
35
- * @readonly
36
- */
37
- readonly name: string;
38
- }
39
- import { ExprNode } from './node.js';
40
- import type { TableRefNode } from './table-ref.js';
@@ -1,14 +0,0 @@
1
- export class FragmentNode extends ExprNode {
2
- /**
3
- * Instantiate a fragment node with arbitrary content.
4
- * @param {ExprNode[]} spans The consecutive parts making up the fragment.
5
- */
6
- constructor(spans: ExprNode[]);
7
- /**
8
- * The consecutive parts making up the fragment.
9
- * @type {ExprNode[]}
10
- * @readonly
11
- */
12
- readonly spans: ExprNode[];
13
- }
14
- import { ExprNode } from './node.js';
@@ -1,21 +0,0 @@
1
- export class FromClauseNode extends SQLNode {
2
- /**
3
- * Instantiate a from node.
4
- * @param {SQLNode} expr The from expression.
5
- * @param {string} alias The output name.
6
- */
7
- constructor(expr: SQLNode, alias: string);
8
- /**
9
- * The from expression.
10
- * @type {SQLNode}
11
- * @readonly
12
- */
13
- readonly expr: SQLNode;
14
- /**
15
- * The output name.
16
- * @type {string}
17
- * @readonly
18
- */
19
- readonly alias: string;
20
- }
21
- import { SQLNode } from './node.js';
@@ -1,21 +0,0 @@
1
- export class FunctionNode extends ExprNode {
2
- /**
3
- * Instantiate a function node.
4
- * @param {string} name The function name.
5
- * @param {ExprNode[]} [args=[]] The function arguments.
6
- */
7
- constructor(name: string, args?: ExprNode[]);
8
- /**
9
- * The function name.
10
- * @type {string}
11
- * @readonly
12
- */
13
- readonly name: string;
14
- /**
15
- * The function arguments.
16
- * @type {ExprNode[]}
17
- * @readonly
18
- */
19
- readonly args: ExprNode[];
20
- }
21
- import { ExprNode } from './node.js';
@@ -1,21 +0,0 @@
1
- export class InOpNode extends ExprNode {
2
- /**
3
- * Instantiate an in operator node.
4
- * @param {ExprNode} expr The input expression.
5
- * @param {ExprNode[]} values The value set.
6
- */
7
- constructor(expr: ExprNode, values: ExprNode[]);
8
- /**
9
- * The input expression.
10
- * @type {ExprNode}
11
- * @readonly
12
- */
13
- readonly expr: ExprNode;
14
- /**
15
- * The value set.
16
- * @type {ExprNode[]}
17
- * @readonly
18
- */
19
- readonly values: ExprNode[];
20
- }
21
- import { ExprNode } from './node.js';
@@ -1,21 +0,0 @@
1
- export class IntervalNode extends ExprNode {
2
- /**
3
- * Instantiate an interval node.
4
- * @param {string} name The interval name.
5
- * @param {number} [steps=1] The interval steps.
6
- */
7
- constructor(name: string, steps?: number);
8
- /**
9
- * The interval name.
10
- * @type {string}
11
- * @readonly
12
- */
13
- readonly name: string;
14
- /**
15
- * The interval steps.
16
- * @type {number}
17
- * @readonly
18
- */
19
- readonly steps: number;
20
- }
21
- import { ExprNode } from './node.js';
@@ -1,15 +0,0 @@
1
- export function literalToSQL(value: any): string;
2
- export class LiteralNode extends ExprNode {
3
- /**
4
- * Instantiate an literal node.
5
- * @param {*} value The literal value.
6
- */
7
- constructor(value: any);
8
- /**
9
- * The literal value.
10
- * @type {any}
11
- * @readonly
12
- */
13
- readonly value: any;
14
- }
15
- import { ExprNode } from './node.js';
@@ -1,46 +0,0 @@
1
- /**
2
- * @template {ExprNode} T
3
- */
4
- export class LogicalOpNode<T extends ExprNode> extends ExprNode {
5
- /**
6
- * Instantiate a logical operator node.
7
- * @param {string} op The logical operation.
8
- * @param {T[]} clauses The input clause expressions.
9
- */
10
- constructor(op: string, clauses: T[]);
11
- /**
12
- * The logical operator.
13
- * @type {string}
14
- * @readonly
15
- */
16
- readonly op: string;
17
- /**
18
- * The input clause expressions.
19
- * @type {T[]}
20
- * @readonly
21
- */
22
- readonly clauses: T[];
23
- }
24
- /**
25
- * @template {ExprNode} T
26
- * @extends {LogicalOpNode<T>}
27
- */
28
- export class AndNode<T extends ExprNode> extends LogicalOpNode<T> {
29
- /**
30
- * Instantiate a logical AND operator node.
31
- * @param {T[]} clauses The input clause expressions.
32
- */
33
- constructor(clauses: T[]);
34
- }
35
- /**
36
- * @template {ExprNode} T
37
- * @extends {LogicalOpNode<T>}
38
- */
39
- export class OrNode<T extends ExprNode> extends LogicalOpNode<T> {
40
- /**
41
- * Instantiate a logical OR operator node.
42
- * @param {T[]} clauses The input clause expressions.
43
- */
44
- constructor(clauses: T[]);
45
- }
46
- import { ExprNode } from './node.js';
@@ -1,24 +0,0 @@
1
- /**
2
- * Check if a value is a SQL AST node.
3
- * @param {*} value The value to check.
4
- * @returns {value is SQLNode}
5
- */
6
- export function isNode(value: any): value is SQLNode;
7
- export class SQLNode {
8
- /**
9
- * Instantiate a SQL AST node.
10
- * @param {string} type The SQL AST node type.
11
- */
12
- constructor(type: string);
13
- /**
14
- * The SQL AST node type.
15
- * @type {string}
16
- * @readonly
17
- */
18
- readonly type: string;
19
- }
20
- /**
21
- * AST node corresponding to an individual expression.
22
- */
23
- export class ExprNode extends SQLNode {
24
- }