@nongt/visql 0.10.1 → 0.11.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.
- package/dist/{MuiTimePicker-DRqT6ByZ.js → MuiTimePicker-CROJXSCL.js} +1 -1
- package/dist/{PipelineEditor-CGTZGbmf.js → PipelineEditor-DEiKHDrr.js} +3646 -3514
- package/dist/core.js +137 -119
- package/dist/explain.js +3 -3
- package/dist/fixtures.js +1 -1
- package/dist/index.js +102 -110
- package/dist/issueLocation-Yn71qJyP.js +1141 -0
- package/dist/mui-date-pickers-host.js +1 -1
- package/dist/mui-date-pickers.js +1 -1
- package/dist/mui.js +2 -2
- package/dist/{params-DkVFbMQn.js → params-DVkfcD6D.js} +245 -229
- package/dist/{schema-CgL10bid.js → schema-CzKt6cN2.js} +230 -152
- package/dist/sql-import.js +855 -821
- package/dist/{sqlGen-C1kZwvWI.js → sqlGen-BoJXaULd.js} +331 -309
- package/dist/{tokens-DV5rTGMj.js → tokens-3SURLAkL.js} +15 -14
- package/dist/types/core/FunctionsContext.d.ts +8 -2
- package/dist/types/core/ast.d.ts +9 -1
- package/dist/types/core/components/flow/WindowKeys.d.ts +10 -0
- package/dist/types/core/expressionFlow.d.ts +8 -0
- package/dist/types/core/functionRegistry.d.ts +15 -2
- package/dist/types/core/grouping.d.ts +6 -1
- package/dist/types/core/i18n/defaultMessages.d.ts +16 -0
- package/dist/types/core/i18n/messages.d.ts +12 -0
- package/dist/types/core/issueLocation.d.ts +5 -0
- package/dist/types/core/queryHelpers.d.ts +9 -1
- package/dist/types/core/queryValidation.d.ts +11 -1
- package/dist/types/core/storedQuery.d.ts +1 -1
- package/dist/types/core/theme/appearance.d.ts +4 -1
- package/dist/types/core/theme/looks.d.ts +6 -5
- package/dist/types/core/theme/tokens.d.ts +6 -3
- package/dist/types/sqlImport/syntax.d.ts +11 -2
- package/package.json +1 -1
- package/dist/issueLocation-BlQ280IE.js +0 -1108
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = {
|
|
2
2
|
// Canvas
|
|
3
3
|
canvasBg: "#242424",
|
|
4
4
|
canvasPattern: "#505050",
|
|
@@ -67,7 +67,7 @@ const g = {
|
|
|
67
67
|
fieldRadius: "0.375rem",
|
|
68
68
|
groupRadius: "0.75rem",
|
|
69
69
|
edgeWidth: "1px"
|
|
70
|
-
},
|
|
70
|
+
}, i = {
|
|
71
71
|
// Canvas
|
|
72
72
|
canvasBg: "#0e1726",
|
|
73
73
|
canvasPattern: "#132036",
|
|
@@ -134,26 +134,26 @@ const g = {
|
|
|
134
134
|
fieldRadius: "0.375rem",
|
|
135
135
|
groupRadius: "0.5rem",
|
|
136
136
|
edgeWidth: "1px"
|
|
137
|
-
}, i = "qb-root";
|
|
137
|
+
}, g = i, c = "qb-root";
|
|
138
138
|
function a(e) {
|
|
139
139
|
return `--qb-${e.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function s(e) {
|
|
142
142
|
return `var(${a(e)})`;
|
|
143
143
|
}
|
|
144
144
|
const f = Object.keys(g);
|
|
145
|
-
function
|
|
145
|
+
function l() {
|
|
146
146
|
const e = f.map((r) => `${a(r)}:${g[r]};`).join("");
|
|
147
|
-
return `:where(.${
|
|
147
|
+
return `:where(.${c}){${e}}`;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function B(e) {
|
|
150
150
|
const r = {};
|
|
151
151
|
return e && f.forEach((o) => {
|
|
152
152
|
const d = e[o];
|
|
153
153
|
d !== void 0 && (r[a(o)] = d);
|
|
154
154
|
}), r;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function b(e, r) {
|
|
157
157
|
const o = getComputedStyle(e), d = { ...r };
|
|
158
158
|
return f.forEach((t) => {
|
|
159
159
|
const n = o.getPropertyValue(a(t)).trim();
|
|
@@ -161,11 +161,12 @@ function B(e, r) {
|
|
|
161
161
|
}), d;
|
|
162
162
|
}
|
|
163
163
|
export {
|
|
164
|
+
u as C,
|
|
164
165
|
g as D,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
i as N,
|
|
167
|
+
c as R,
|
|
168
|
+
B as a,
|
|
169
|
+
l as d,
|
|
170
|
+
b as r,
|
|
171
|
+
s as t
|
|
171
172
|
};
|
|
@@ -7,6 +7,11 @@ declare const FunctionsContext: import("react").Context<FunctionRegistry>;
|
|
|
7
7
|
* SELECT, ORDER BY and HAVING, false elsewhere (WHERE, JOIN ON, GROUP BY),
|
|
8
8
|
* where SQL doesn't allow them. */
|
|
9
9
|
export declare const AggregatesContext: import("react").Context<boolean>;
|
|
10
|
+
/** Whether window functions (LAG, ROW_NUMBER, …, issue 20) may be picked
|
|
11
|
+
* here: true in a SELECT column and a sort key, false elsewhere and
|
|
12
|
+
* inside an aggregate or another window call, where SQL doesn't allow
|
|
13
|
+
* them. */
|
|
14
|
+
export declare const WindowsContext: import("react").Context<boolean>;
|
|
10
15
|
/** Every function, for reading an existing call (its signature, args). */
|
|
11
16
|
export declare function useFunctions(): FunctionRegistry;
|
|
12
17
|
/** The functions a picker offers here — those the database has (see
|
|
@@ -14,8 +19,9 @@ export declare function useFunctions(): FunctionRegistry;
|
|
|
14
19
|
* AggregatesContext). */
|
|
15
20
|
export declare function useFunctionChoices(): FunctionRegistry;
|
|
16
21
|
/** A function picker's names (see useFunctionChoices), and their group:
|
|
17
|
-
* where aggregates are offered, those first,
|
|
18
|
-
* functions — an aggregate groups the rows
|
|
22
|
+
* where aggregates or window functions are offered, those first, each
|
|
23
|
+
* group apart from the other functions — an aggregate groups the rows, a
|
|
24
|
+
* window function looks at the rows around one. Elsewhere one list, no
|
|
19
25
|
* groups. `searchText` finds a function by its other names too. */
|
|
20
26
|
export declare function useFunctionOptions(): {
|
|
21
27
|
names: string[];
|
package/dist/types/core/ast.d.ts
CHANGED
|
@@ -70,8 +70,16 @@ export interface FunctionCallNode extends Record<string, unknown>, ColumnCopy {
|
|
|
70
70
|
/** An aggregate over distinct values only: `COUNT(DISTINCT x)`. */
|
|
71
71
|
distinct?: boolean;
|
|
72
72
|
/** The order an aggregate takes its values in (issue 164): STRING_AGG's
|
|
73
|
-
* text lists them so.
|
|
73
|
+
* text lists them so. A window call's (`over`) is its OVER's ORDER BY.
|
|
74
|
+
* Only STRING_AGG and window calls take one. */
|
|
74
75
|
orderBy?: FunctionSortKey[];
|
|
76
|
+
/** A window function's call (issue 20, `window` in the registry): written
|
|
77
|
+
* with `OVER (PARTITION BY … ORDER BY …)`, over the rows its body
|
|
78
|
+
* returns rather than one value per row or group. */
|
|
79
|
+
over?: boolean;
|
|
80
|
+
/** A window call's PARTITION BY: the rows it looks at for a row are
|
|
81
|
+
* those with the same values. */
|
|
82
|
+
partitionBy?: ExpressionNode[];
|
|
75
83
|
}
|
|
76
84
|
/** One key of a function call's `orderBy`. */
|
|
77
85
|
export interface FunctionSortKey {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExpressionNode, FunctionSortKey } from '../../ast.js';
|
|
2
|
+
/** A window call's OVER (issue 20): the columns its rows are split by
|
|
3
|
+
* (PARTITION BY), then their order (ORDER BY), each list under its name. */
|
|
4
|
+
declare const WindowKeys: ({ partitionBy, orderBy, onPartitionBy, onOrderBy, }: {
|
|
5
|
+
partitionBy: ExpressionNode[];
|
|
6
|
+
orderBy: FunctionSortKey[];
|
|
7
|
+
onPartitionBy: (keys: ExpressionNode[]) => void;
|
|
8
|
+
onOrderBy: (keys: FunctionSortKey[]) => void;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default WindowKeys;
|
|
@@ -364,6 +364,8 @@ export type ExpressionFlowAction =
|
|
|
364
364
|
path: number[];
|
|
365
365
|
name: string;
|
|
366
366
|
args: ExpressionNode[];
|
|
367
|
+
/** A window function's call (issue 20): it starts with OVER. */
|
|
368
|
+
over?: boolean;
|
|
367
369
|
}
|
|
368
370
|
/** Replace the arg at path (path = [...parentFnPath, argIndex]). */
|
|
369
371
|
| {
|
|
@@ -412,6 +414,12 @@ export type ExpressionFlowAction =
|
|
|
412
414
|
type: 'exprSetOrderBy';
|
|
413
415
|
path: number[];
|
|
414
416
|
orderBy: FunctionSortKey[];
|
|
417
|
+
}
|
|
418
|
+
/** The window call at path's PARTITION BY (issue 20); empty removes it. */
|
|
419
|
+
| {
|
|
420
|
+
type: 'exprSetPartitionBy';
|
|
421
|
+
path: number[];
|
|
422
|
+
partitionBy: ExpressionNode[];
|
|
415
423
|
};
|
|
416
424
|
/** What a COUNT counts: every row (`COUNT(*)`, no argument), the rows
|
|
417
425
|
* where a value is set (`COUNT(x)`), or the different values
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExpressionNode, ValueType } from './ast.js';
|
|
1
|
+
import type { ExpressionNode, FunctionCallNode, ValueType } from './ast.js';
|
|
2
2
|
import type { DatabaseColumnType } from './schema.js';
|
|
3
3
|
import type { SqlDialect } from './sqlGen.js';
|
|
4
4
|
/**
|
|
@@ -13,8 +13,11 @@ import type { SqlDialect } from './sqlGen.js';
|
|
|
13
13
|
* fixed-text — a text written into the SQL itself, never a parameter (STRING_AGG's
|
|
14
14
|
* separator: MySQL takes only a literal there), stored as string literal,
|
|
15
15
|
* shown as text input
|
|
16
|
+
* fixed-count — a whole number from 0 written into the SQL itself, never a parameter
|
|
17
|
+
* (LAG's offset: MySQL takes only a literal there), stored as number
|
|
18
|
+
* literal, shown as number input
|
|
16
19
|
*/
|
|
17
|
-
export type ArgKind = 'expr' | 'date-expr' | 'num-expr' | 'str-expr' | 'unit' | 'type-name' | 'fixed-text';
|
|
20
|
+
export type ArgKind = 'expr' | 'date-expr' | 'num-expr' | 'str-expr' | 'unit' | 'type-name' | 'fixed-text' | 'fixed-count';
|
|
18
21
|
/**
|
|
19
22
|
* Maps ArgKind to the column types that should be shown when the arg value is a field.
|
|
20
23
|
* Undefined means no filter (all column types are shown).
|
|
@@ -46,6 +49,10 @@ export interface FunctionSignature {
|
|
|
46
49
|
* SQL allows one — SELECT, HAVING and ORDER BY, not WHERE, JOIN ON or
|
|
47
50
|
* GROUP BY — and what makes a query grouped (see grouping.ts). */
|
|
48
51
|
aggregate?: boolean;
|
|
52
|
+
/** A window function (issue 20: LAG, ROW_NUMBER, …): its call has `over`
|
|
53
|
+
* and an ORDER BY, and goes only in SELECT and ORDER BY, of a body that
|
|
54
|
+
* isn't grouped. */
|
|
55
|
+
window?: boolean;
|
|
49
56
|
/** The type of its result (issue 130), so a value compared with it gets
|
|
50
57
|
* the matching input: `'arg'` for its first argument's (MIN, COALESCE,
|
|
51
58
|
* DATE_ADD). Omitted: not known (the user picks the value's type). */
|
|
@@ -112,6 +119,12 @@ export declare function normalizeRegistry(registry: FunctionRegistry): FunctionR
|
|
|
112
119
|
/** `registry` without its aggregates — what's offered where SQL doesn't
|
|
113
120
|
* allow one (WHERE, JOIN ON, GROUP BY). */
|
|
114
121
|
export declare function withoutAggregates(registry: FunctionRegistry): FunctionRegistry;
|
|
122
|
+
/** A new call to `sig`, as a function picker starts one: its default
|
|
123
|
+
* arguments, and OVER for a window function (issue 20). `name` is what
|
|
124
|
+
* it's stored by. */
|
|
125
|
+
export declare function startCall(sig: FunctionSignature, name: string): FunctionCallNode;
|
|
126
|
+
/** `registry` without its window functions (issue 20). */
|
|
127
|
+
export declare function withoutWindows(registry: FunctionRegistry): FunctionRegistry;
|
|
115
128
|
/** Only the functions available in `dialect` (those with no `dialects` list
|
|
116
129
|
* are available everywhere). */
|
|
117
130
|
export declare function functionsForDialect(registry: FunctionRegistry, dialect: SqlDialect): FunctionRegistry;
|
|
@@ -5,6 +5,10 @@ import type { QueryBody } from './queryAst.js';
|
|
|
5
5
|
export declare function isAggregateCall(node: ExpressionNode, registry: FunctionRegistry): boolean;
|
|
6
6
|
/** Whether `node` has an aggregate call anywhere in it. */
|
|
7
7
|
export declare function containsAggregate(node: ExpressionNode | undefined, registry: FunctionRegistry): boolean;
|
|
8
|
+
/** A window function's call (issue 20): one with OVER. */
|
|
9
|
+
export declare const isWindowCall: (node: ExpressionNode) => boolean;
|
|
10
|
+
/** Whether `node` has a window call anywhere in it. */
|
|
11
|
+
export declare function containsWindow(node: ExpressionNode | undefined): boolean;
|
|
8
12
|
/** A call to a function `registry` doesn't know (issue 137). It may be an
|
|
9
13
|
* aggregate (a database's own, a host's left out of the registry), so
|
|
10
14
|
* it's never made a group key, nor reported as not one — validateQuery
|
|
@@ -51,7 +55,8 @@ export declare function selectsAggregate(query: QueryBody, registry: FunctionReg
|
|
|
51
55
|
* up any more. A key the user added is never touched; a column it
|
|
52
56
|
* already covers needs none. A column mixing an aggregate and a plain
|
|
53
57
|
* column can't be fixed this way (groupingProblems still reports it), and
|
|
54
|
-
* neither is one with a function the registry doesn't know (isUnknownCall)
|
|
58
|
+
* neither is one with a function the registry doesn't know (isUnknownCall), nor
|
|
59
|
+
* one with a window call. ORDER BY
|
|
55
60
|
* keys are never made keys: that would change the grouping unseen. The
|
|
56
61
|
* same object when nothing changes. */
|
|
57
62
|
export declare function groupAutomatically<Q extends QueryBody>(query: Q, registry: FunctionRegistry): Q;
|
|
@@ -94,6 +94,9 @@ export declare const DEFAULT_MESSAGES: {
|
|
|
94
94
|
* (which group the rows) apart from the rest. Kept short: the list is
|
|
95
95
|
* as narrow as the name box. */
|
|
96
96
|
functionGroupAggregate: string;
|
|
97
|
+
/** Window functions (LAG, ROW_NUMBER, …): each looks at the rows around
|
|
98
|
+
* a row. */
|
|
99
|
+
functionGroupWindow: string;
|
|
97
100
|
functionGroupOther: string;
|
|
98
101
|
typeMenuCondition: string;
|
|
99
102
|
/** IN's value as a query of its own (issue 122), when offered: its type,
|
|
@@ -239,6 +242,12 @@ export declare const DEFAULT_MESSAGES: {
|
|
|
239
242
|
addSort: string;
|
|
240
243
|
removeSort: string;
|
|
241
244
|
toggleSortDirection: string;
|
|
245
|
+
/** A window function's OVER (issue 20): the columns its rows are split
|
|
246
|
+
* by, and their order. */
|
|
247
|
+
windowPartitionBy: string;
|
|
248
|
+
windowOrderBy: string;
|
|
249
|
+
addPartition: string;
|
|
250
|
+
removePartition: string;
|
|
242
251
|
/** Opens the row-count inputs. */
|
|
243
252
|
limitRows: string;
|
|
244
253
|
removeLimit: string;
|
|
@@ -300,6 +309,7 @@ export declare const DEFAULT_MESSAGES: {
|
|
|
300
309
|
locationColumn: (n: number) => string;
|
|
301
310
|
locationGroupKey: (n: number) => string;
|
|
302
311
|
locationSortKey: (n: number) => string;
|
|
312
|
+
locationPartitionKey: (n: number) => string;
|
|
303
313
|
locationCondition: (n: number) => string;
|
|
304
314
|
locationLeft: string;
|
|
305
315
|
locationRight: string;
|
|
@@ -343,6 +353,9 @@ export declare const DEFAULT_MESSAGES: {
|
|
|
343
353
|
issueSharedOrder: string;
|
|
344
354
|
issueUnusedShared: string;
|
|
345
355
|
issueJoinOnlyColumn: string;
|
|
356
|
+
issueMisplacedWindow: string;
|
|
357
|
+
issueGroupedWindow: string;
|
|
358
|
+
issueUnorderedWindow: string;
|
|
346
359
|
issueUnknownTableNamed: (table: string) => string;
|
|
347
360
|
issueUnknownColumnNamed: (table: string, column: string) => string;
|
|
348
361
|
issueJoinOnlyColumnNamed: (column: string) => string;
|
|
@@ -370,6 +383,9 @@ export declare const DEFAULT_MESSAGES: {
|
|
|
370
383
|
issueNotGroupedNamed: (column: string) => string;
|
|
371
384
|
issueSelectAllGrouped: string;
|
|
372
385
|
issueMisplacedAggregateNamed: (fn: string) => string;
|
|
386
|
+
issueMisplacedWindowNamed: (fn: string) => string;
|
|
387
|
+
issueGroupedWindowNamed: (fn: string) => string;
|
|
388
|
+
issueUnorderedWindowNamed: (fn: string) => string;
|
|
373
389
|
peekHint: string;
|
|
374
390
|
/** `keys`: its shortcut, as the user's keyboard has it (⌘F, Ctrl+F). */
|
|
375
391
|
find: (keys: string) => string;
|
|
@@ -69,6 +69,7 @@ declare const MessagesContext: import("react").Context<{
|
|
|
69
69
|
paramNamePlaceholder: string;
|
|
70
70
|
typeMenuBasic: string;
|
|
71
71
|
functionGroupAggregate: string;
|
|
72
|
+
functionGroupWindow: string;
|
|
72
73
|
functionGroupOther: string;
|
|
73
74
|
typeMenuCondition: string;
|
|
74
75
|
typeSubquery: string;
|
|
@@ -157,6 +158,10 @@ declare const MessagesContext: import("react").Context<{
|
|
|
157
158
|
addSort: string;
|
|
158
159
|
removeSort: string;
|
|
159
160
|
toggleSortDirection: string;
|
|
161
|
+
windowPartitionBy: string;
|
|
162
|
+
windowOrderBy: string;
|
|
163
|
+
addPartition: string;
|
|
164
|
+
removePartition: string;
|
|
160
165
|
limitRows: string;
|
|
161
166
|
removeLimit: string;
|
|
162
167
|
showRowsBefore: string;
|
|
@@ -201,6 +206,7 @@ declare const MessagesContext: import("react").Context<{
|
|
|
201
206
|
locationColumn: (n: number) => string;
|
|
202
207
|
locationGroupKey: (n: number) => string;
|
|
203
208
|
locationSortKey: (n: number) => string;
|
|
209
|
+
locationPartitionKey: (n: number) => string;
|
|
204
210
|
locationCondition: (n: number) => string;
|
|
205
211
|
locationLeft: string;
|
|
206
212
|
locationRight: string;
|
|
@@ -243,6 +249,9 @@ declare const MessagesContext: import("react").Context<{
|
|
|
243
249
|
issueSharedOrder: string;
|
|
244
250
|
issueUnusedShared: string;
|
|
245
251
|
issueJoinOnlyColumn: string;
|
|
252
|
+
issueMisplacedWindow: string;
|
|
253
|
+
issueGroupedWindow: string;
|
|
254
|
+
issueUnorderedWindow: string;
|
|
246
255
|
issueUnknownTableNamed: (table: string) => string;
|
|
247
256
|
issueUnknownColumnNamed: (table: string, column: string) => string;
|
|
248
257
|
issueJoinOnlyColumnNamed: (column: string) => string;
|
|
@@ -269,6 +278,9 @@ declare const MessagesContext: import("react").Context<{
|
|
|
269
278
|
issueNotGroupedNamed: (column: string) => string;
|
|
270
279
|
issueSelectAllGrouped: string;
|
|
271
280
|
issueMisplacedAggregateNamed: (fn: string) => string;
|
|
281
|
+
issueMisplacedWindowNamed: (fn: string) => string;
|
|
282
|
+
issueGroupedWindowNamed: (fn: string) => string;
|
|
283
|
+
issueUnorderedWindowNamed: (fn: string) => string;
|
|
272
284
|
peekHint: string;
|
|
273
285
|
find: (keys: string) => string;
|
|
274
286
|
findPlaceholder: string;
|
|
@@ -50,6 +50,11 @@ export type IssueLocationStep =
|
|
|
50
50
|
kind: 'sortKey';
|
|
51
51
|
number: number;
|
|
52
52
|
}
|
|
53
|
+
/** One of a window call's PARTITION BY keys (issue 20), from 1. */
|
|
54
|
+
| {
|
|
55
|
+
kind: 'partitionKey';
|
|
56
|
+
number: number;
|
|
57
|
+
}
|
|
53
58
|
/** One of a group's conditions (from 1). */
|
|
54
59
|
| {
|
|
55
60
|
kind: 'condition';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BinaryNode, BinaryOperator, ExistsNode, ExpressionNode, FieldNode, FunctionCallNode, LiteralNode, ListNode, LiteralValue, LogicalNode, LogicalOperator, NotNode, ParamNode, RelativeDate, SubqueryNode } from './ast.js';
|
|
1
|
+
import type { BinaryNode, BinaryOperator, ExistsNode, ExpressionNode, FieldNode, FunctionCallNode, FunctionSortKey, LiteralNode, ListNode, LiteralValue, LogicalNode, LogicalOperator, NotNode, ParamNode, RelativeDate, SubqueryNode } from './ast.js';
|
|
2
2
|
import { type DerivedQuery, type JoinClause, type TableFrom, type JoinType, type QueryPipeline, type QueryValue, type SortDirection } from './queryAst.js';
|
|
3
3
|
import type { DatabaseSchema } from './schema.js';
|
|
4
4
|
export declare const expr: {
|
|
@@ -28,6 +28,14 @@ export declare const expr: {
|
|
|
28
28
|
not: (operand: ExpressionNode) => NotNode;
|
|
29
29
|
/** A function call: `expr.fn('LOWER', expr.field('users', 'email'))`. */
|
|
30
30
|
fn: (name: string, ...args: ExpressionNode[]) => FunctionCallNode;
|
|
31
|
+
/** A window function's call (issue 20), over the rows of its body:
|
|
32
|
+
* `expr.over(expr.fn('LAG', status), { partitionBy: [employee], orderBy:
|
|
33
|
+
* [{ expression: payDate, direction: 'asc' }] })` is `LAG(status) OVER
|
|
34
|
+
* (PARTITION BY employee ORDER BY pay_date ASC)`. */
|
|
35
|
+
over: (call: FunctionCallNode, window: {
|
|
36
|
+
partitionBy?: ExpressionNode[];
|
|
37
|
+
orderBy?: FunctionSortKey[];
|
|
38
|
+
}) => FunctionCallNode;
|
|
31
39
|
/** Whether the outer row has related rows: `EXISTS (SELECT 1 FROM …
|
|
32
40
|
* WHERE <link> AND <where>)`. `link` matches them to the outer row;
|
|
33
41
|
* `where` names the subquery's own tables only. NOT EXISTS:
|
|
@@ -61,6 +61,16 @@ export type QueryIssueKind =
|
|
|
61
61
|
| 'unknownAggregate'
|
|
62
62
|
/** An aggregate where SQL doesn't allow one: WHERE, JOIN ON, GROUP BY. */
|
|
63
63
|
| 'misplacedAggregate'
|
|
64
|
+
/** A window function (issue 20) where SQL doesn't allow one: anywhere but
|
|
65
|
+
* SELECT and ORDER BY (WHERE, JOIN ON, GROUP BY, HAVING, an EXISTS), or
|
|
66
|
+
* inside another window function or an aggregate. */
|
|
67
|
+
| 'misplacedWindow'
|
|
68
|
+
/** A window function in a grouped query (aggregates, GROUP BY or
|
|
69
|
+
* HAVING): work it out in a sub query, and group around it. */
|
|
70
|
+
| 'groupedWindow'
|
|
71
|
+
/** A window function with no ORDER BY: which row comes before which
|
|
72
|
+
* isn't said, and SQL Server refuses it. */
|
|
73
|
+
| 'unorderedWindow'
|
|
64
74
|
/** A param compared against columns of different types (`:x` against a
|
|
65
75
|
* date and a number) — no one value suits both. */
|
|
66
76
|
| 'paramConflict'
|
|
@@ -135,7 +145,7 @@ export type QueryIssueKind =
|
|
|
135
145
|
/** A join-only column (a key, issue 234) used outside a join's ON or an
|
|
136
146
|
* EXISTS's link, and not in a sub query's SELECT or GROUP BY. */
|
|
137
147
|
| 'joinOnlyColumn';
|
|
138
|
-
export declare const QUERY_ISSUE_KINDS: readonly ["invalidStructure", "duplicateId", "unknownTable", "unknownColumn", "tableNotInQuery", "unqualifiedField", "incomplete", "argCount", "ambiguousTable", "duplicateTableName", "derivedColumnName", "unknownFunction", "joinOrder", "distinctSort", "notGrouped", "unknownAggregate", "misplacedAggregate", "paramConflict", "fanOut", "crossJoin", "unlinkedJoin", "drillAcrossOutOfStep", "drillAcrossFilterMixed", "tooLong", "dialectUnsupported", "subqueryColumns", "notInSubquery", "noLimit", "limitTooHigh", "typeMismatch", "invalidPattern", "unionColumns", "unionTypes", "sharedOrder", "unusedShared", "joinOnlyColumn"];
|
|
148
|
+
export declare const QUERY_ISSUE_KINDS: readonly ["invalidStructure", "duplicateId", "unknownTable", "unknownColumn", "tableNotInQuery", "unqualifiedField", "incomplete", "argCount", "ambiguousTable", "duplicateTableName", "derivedColumnName", "unknownFunction", "joinOrder", "distinctSort", "notGrouped", "unknownAggregate", "misplacedAggregate", "paramConflict", "fanOut", "crossJoin", "misplacedWindow", "groupedWindow", "unorderedWindow", "unlinkedJoin", "drillAcrossOutOfStep", "drillAcrossFilterMixed", "tooLong", "dialectUnsupported", "subqueryColumns", "notInSubquery", "noLimit", "limitTooHigh", "typeMismatch", "invalidPattern", "unionColumns", "unionTypes", "sharedOrder", "unusedShared", "joinOnlyColumn"];
|
|
139
149
|
/** The kinds that are warnings: the query can run with them. Only these
|
|
140
150
|
* can be hidden (ValidateQueryOptions' hideWarnings). */
|
|
141
151
|
export declare const QUERY_WARNING_KINDS: readonly ["fanOut", "crossJoin", "unlinkedJoin", "drillAcrossFilterMixed", "notInSubquery", "noLimit", "limitTooHigh", "typeMismatch", "unknownAggregate", "unusedShared"];
|
|
@@ -2,7 +2,7 @@ import type { LiteralValue } from './ast.js';
|
|
|
2
2
|
import type { QueryValue } from './queryAst.js';
|
|
3
3
|
/** The format saveQuery writes. Raised when a change to the query's shape
|
|
4
4
|
* needs older stored queries migrated (see MIGRATIONS). */
|
|
5
|
-
export declare const QUERY_FORMAT_VERSION =
|
|
5
|
+
export declare const QUERY_FORMAT_VERSION = 5;
|
|
6
6
|
/** A query as stored: plain JSON, with the format it's in. */
|
|
7
7
|
export interface StoredQuery {
|
|
8
8
|
version: number;
|
|
@@ -17,7 +17,10 @@ export interface Appearance {
|
|
|
17
17
|
* always beside them. */
|
|
18
18
|
actions: 'hover' | 'always';
|
|
19
19
|
}
|
|
20
|
-
/** CHARCOAL's (looks.ts). */
|
|
20
|
+
/** CHARCOAL's (looks.ts): buttons always beside each node. */
|
|
21
|
+
export declare const CHARCOAL_APPEARANCE: Appearance;
|
|
22
|
+
/** NAVY's (looks.ts), the default: a node's buttons in a toolbar on hover. */
|
|
23
|
+
export declare const NAVY_APPEARANCE: Appearance;
|
|
21
24
|
export declare const DEFAULT_APPEARANCE: Appearance;
|
|
22
25
|
declare const AppearanceContext: import("react").Context<Appearance>;
|
|
23
26
|
export declare function useAppearance(): Appearance;
|
|
@@ -6,9 +6,10 @@ export interface Look {
|
|
|
6
6
|
theme: QueryBuilderTheme;
|
|
7
7
|
appearance: Appearance;
|
|
8
8
|
}
|
|
9
|
-
/** The default:
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
/** Navy panels, dark field cards and mint; smooth-step edges on a line grid,
|
|
13
|
-
* groups as a bar, and a node's buttons in a toolbar shown on hover. */
|
|
9
|
+
/** The default: navy panels, dark field cards and mint; smooth-step edges
|
|
10
|
+
* on a line grid, groups as a bar, and a node's buttons in a toolbar shown
|
|
11
|
+
* on hover. */
|
|
14
12
|
export declare const NAVY: Look;
|
|
13
|
+
/** Charcoal panels, white field cards, curved edges on dots, buttons beside
|
|
14
|
+
* each node. */
|
|
15
|
+
export declare const CHARCOAL: Look;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Every color the editor draws with, named by role rather than by hue so a
|
|
2
2
|
* host can recolor the editor freely (a light theme is just different
|
|
3
3
|
* values for the same roles), and a few shapes (radii, the edges' width).
|
|
4
|
-
* The defaults are
|
|
4
|
+
* The defaults are NAVY's (looks.ts).
|
|
5
5
|
*
|
|
6
6
|
* Each token becomes a CSS custom property on the editor root — `canvasBg`
|
|
7
7
|
* → `--qb-canvas-bg` — which components use through Tailwind utilities
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* `text-qb-text-muted`, ...). Hosts
|
|
10
10
|
* override them either in CSS (`.qb-root { --qb-accent: #e91e63 }`) or with
|
|
11
11
|
* PipelineEditor's `theme` prop. */
|
|
12
|
-
|
|
12
|
+
/** CHARCOAL's colours (`looks.ts`): charcoal panels, white field cards. */
|
|
13
|
+
export declare const CHARCOAL_THEME: {
|
|
13
14
|
canvasBg: string;
|
|
14
15
|
canvasPattern: string;
|
|
15
16
|
edge: string;
|
|
@@ -60,10 +61,12 @@ export declare const DEFAULT_THEME: {
|
|
|
60
61
|
groupRadius: string;
|
|
61
62
|
edgeWidth: string;
|
|
62
63
|
};
|
|
63
|
-
export type ThemeToken = keyof typeof
|
|
64
|
+
export type ThemeToken = keyof typeof CHARCOAL_THEME;
|
|
64
65
|
export type QueryBuilderTheme = Record<ThemeToken, string>;
|
|
65
66
|
/** NAVY's colours (`looks.ts`): navy panels, dark field cards, mint. */
|
|
66
67
|
export declare const NAVY_THEME: QueryBuilderTheme;
|
|
68
|
+
/** Every token's default: NAVY's. */
|
|
69
|
+
export declare const DEFAULT_THEME: QueryBuilderTheme;
|
|
67
70
|
/** Class the editor root carries — tokens are scoped to it, so they never
|
|
68
71
|
* leak into (or read from) the host page outside the editor. */
|
|
69
72
|
export declare const ROOT_CLASS = "qb-root";
|
|
@@ -111,8 +111,16 @@ export interface SqlBetween {
|
|
|
111
111
|
high: SqlExpr;
|
|
112
112
|
span: SqlSpan;
|
|
113
113
|
}
|
|
114
|
-
/** A
|
|
115
|
-
*
|
|
114
|
+
/** A window's `OVER (PARTITION BY … ORDER BY …)`. A frame (`ROWS
|
|
115
|
+
* BETWEEN …`) is only marked: the AST has none. */
|
|
116
|
+
export interface SqlWindow {
|
|
117
|
+
partitionBy: SqlExpr[];
|
|
118
|
+
orderBy?: SqlOrderItem[];
|
|
119
|
+
frame?: SqlSpan;
|
|
120
|
+
}
|
|
121
|
+
/** A function call, with what aggregates take besides arguments. PostgreSQL's
|
|
122
|
+
* FILTER is only marked: the AST has none. `over` is the whole `OVER …`,
|
|
123
|
+
* and `window` what's in it — none for a named window (`OVER w`). */
|
|
116
124
|
export interface SqlCall {
|
|
117
125
|
kind: 'call';
|
|
118
126
|
name: SqlIdent[];
|
|
@@ -126,6 +134,7 @@ export interface SqlCall {
|
|
|
126
134
|
withinGroup?: SqlOrderItem[];
|
|
127
135
|
filter?: SqlSpan;
|
|
128
136
|
over?: SqlSpan;
|
|
137
|
+
window?: SqlWindow;
|
|
129
138
|
span: SqlSpan;
|
|
130
139
|
}
|
|
131
140
|
/** `CAST(x AS type)`, or PostgreSQL's `x::type`. `type` as written, its
|