@nongt/visql 0.12.2 → 0.14.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-CROJXSCL.js → MuiTimePicker-CDzORsxO.js} +1 -1
- package/dist/{PipelineEditor-DDN3mL0I.js → PipelineEditor-CkYV-gdB.js} +3321 -3290
- package/dist/core.js +6 -6
- package/dist/explain.js +3 -3
- package/dist/fixtures.js +1 -1
- package/dist/index.js +9 -9
- package/dist/{issueLocation-DY-vvgFF.js → issueLocation-DYnJQgvr.js} +2 -2
- package/dist/mui-date-pickers-host.js +1 -1
- package/dist/mui-date-pickers.js +1 -1
- package/dist/mui.js +26 -26
- package/dist/{params-Btjlj45_.js → params-CXRW5B8V.js} +824 -800
- package/dist/{schema-DsMO9oFE.js → schema-C-CgG78X.js} +178 -168
- package/dist/sql-import.js +1 -1
- package/dist/{sqlGen-BbCX8Ywc.js → sqlGen-BSHDYdHB.js} +2 -2
- package/dist/{tokens-3SURLAkL.js → tokens-D5mWwogd.js} +10 -6
- package/dist/types/core/ast.d.ts +6 -1
- package/dist/types/core/components/expression/ExpressionTypeSelector.d.ts +4 -3
- package/dist/types/core/components/expression/ExpressionView.d.ts +1 -1
- package/dist/types/core/schema.d.ts +22 -4
- package/dist/types/core/theme/tokens.d.ts +1 -0
- package/package.json +1 -1
|
@@ -38,6 +38,8 @@ const u = {
|
|
|
38
38
|
fieldGroupBorder: "#fffbeb",
|
|
39
39
|
// The outline around a field card
|
|
40
40
|
fieldCardBorder: "transparent",
|
|
41
|
+
// The row under the pointer in a picker's list or a menu
|
|
42
|
+
optionHoverBg: "rgba(0, 0, 0, 0.04)",
|
|
41
43
|
// IF / CASE (conditional values)
|
|
42
44
|
conditional: "#fbbf24",
|
|
43
45
|
conditionalOnField: "#d97706",
|
|
@@ -107,6 +109,8 @@ const u = {
|
|
|
107
109
|
fieldGroupBorder: "#2c405f",
|
|
108
110
|
// The outline around a field card
|
|
109
111
|
fieldCardBorder: "#2c405f",
|
|
112
|
+
// The row under the pointer in a picker's list or a menu
|
|
113
|
+
optionHoverBg: "rgba(94, 234, 212, 0.16)",
|
|
110
114
|
// IF / CASE (conditional values)
|
|
111
115
|
conditional: "#c4b5fd",
|
|
112
116
|
conditionalOnField: "#7c3aed",
|
|
@@ -141,23 +145,23 @@ function a(e) {
|
|
|
141
145
|
function s(e) {
|
|
142
146
|
return `var(${a(e)})`;
|
|
143
147
|
}
|
|
144
|
-
const
|
|
148
|
+
const t = Object.keys(g);
|
|
145
149
|
function l() {
|
|
146
|
-
const e =
|
|
150
|
+
const e = t.map((r) => `${a(r)}:${g[r]};`).join("");
|
|
147
151
|
return `:where(.${c}){${e}}`;
|
|
148
152
|
}
|
|
149
153
|
function B(e) {
|
|
150
154
|
const r = {};
|
|
151
|
-
return e &&
|
|
155
|
+
return e && t.forEach((o) => {
|
|
152
156
|
const d = e[o];
|
|
153
157
|
d !== void 0 && (r[a(o)] = d);
|
|
154
158
|
}), r;
|
|
155
159
|
}
|
|
156
160
|
function b(e, r) {
|
|
157
161
|
const o = getComputedStyle(e), d = { ...r };
|
|
158
|
-
return
|
|
159
|
-
const n = o.getPropertyValue(a(
|
|
160
|
-
n && (d[
|
|
162
|
+
return t.forEach((f) => {
|
|
163
|
+
const n = o.getPropertyValue(a(f)).trim();
|
|
164
|
+
n && (d[f] = n);
|
|
161
165
|
}), d;
|
|
162
166
|
}
|
|
163
167
|
export {
|
package/dist/types/core/ast.d.ts
CHANGED
|
@@ -156,7 +156,8 @@ export interface SubqueryNode extends Record<string, unknown> {
|
|
|
156
156
|
}
|
|
157
157
|
/** `x IN (a, b, c)` (issue 130): the right side of IN, its values one
|
|
158
158
|
* item each — literals in the editor, each with the input of what it's
|
|
159
|
-
* compared with
|
|
159
|
+
* compared with, or one param as the whole list (`listParam`); other
|
|
160
|
+
* values from code. IN's other right side
|
|
160
161
|
* is a sub query. Also BETWEEN's right side (issue 169): its two bounds,
|
|
161
162
|
* low then high (`x BETWEEN low AND high`, both included). NOT BETWEEN is
|
|
162
163
|
* a `not` around one, as NOT IN is. */
|
|
@@ -164,6 +165,10 @@ export interface ListNode extends Record<string, unknown> {
|
|
|
164
165
|
type: 'list';
|
|
165
166
|
items: ExpressionNode[];
|
|
166
167
|
}
|
|
168
|
+
/** The param that is all of a list (`x IN (:ids)`), not a relative date:
|
|
169
|
+
* the editor shows such a list as that param, whose values the host
|
|
170
|
+
* gives when the query runs. */
|
|
171
|
+
export declare function listParam(list: ListNode): ParamNode | undefined;
|
|
167
172
|
export interface CaseNode extends Record<string, unknown>, ColumnCopy {
|
|
168
173
|
type: 'case';
|
|
169
174
|
subject?: ExpressionNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExpressionNode } from '../../ast.js';
|
|
2
2
|
import { type MeasureChoice } from './MeasureMenu.js';
|
|
3
3
|
interface Props {
|
|
4
4
|
expression: ExpressionNode;
|
|
@@ -17,8 +17,9 @@ interface Props {
|
|
|
17
17
|
subquery?: {
|
|
18
18
|
onCreate: () => void;
|
|
19
19
|
};
|
|
20
|
-
/** IN's right side (issue 130): its values (a list)
|
|
21
|
-
*
|
|
20
|
+
/** IN's right side (issue 130): its values (a list) or a param for the
|
|
21
|
+
* whole list (issue 41) are offered, and a sub query when `subquery` is
|
|
22
|
+
* given — nothing else. */
|
|
22
23
|
inValues?: boolean;
|
|
23
24
|
/** "Relative date" offered (issue 140): a value compared with a date. */
|
|
24
25
|
relativeDate?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExpressionNode, type ValueType } from '../../ast.js';
|
|
2
2
|
import { type AbsolutePath } from '../../absolutePath.js';
|
|
3
3
|
import type { Table, TableColumn } from '../../schema.js';
|
|
4
4
|
export interface ExpressionViewProps extends Record<string, unknown> {
|
|
@@ -28,6 +28,10 @@ export interface TableColumn {
|
|
|
28
28
|
label: string;
|
|
29
29
|
type: DatabaseColumnType;
|
|
30
30
|
nullable?: boolean;
|
|
31
|
+
/** What the column means, for whoever builds a query: a line under its
|
|
32
|
+
* label in the field picker (search matches it too), and shown on
|
|
33
|
+
* hovering it once picked. E.g. that NULL means "not specified". */
|
|
34
|
+
description?: string;
|
|
31
35
|
/** A fixed set of allowed values (an enum, a status…). Values compared
|
|
32
36
|
* against this column are then picked from a dropdown instead of typed. */
|
|
33
37
|
options?: ColumnOption[];
|
|
@@ -56,14 +60,28 @@ export interface ColumnOption {
|
|
|
56
60
|
* `toTable.toColumn` — so the `from` side is the "many" side (e.g.
|
|
57
61
|
* sale_transaction.product_id → product.id). The reverse direction
|
|
58
62
|
* (product → its sales) is derived wherever it's needed; never declare it as
|
|
59
|
-
* a second entry (validateSchema reports that as a duplicate).
|
|
60
|
-
*
|
|
63
|
+
* a second entry (validateSchema reports that as a duplicate). A key of
|
|
64
|
+
* several columns lists the others in `also`. */
|
|
61
65
|
export interface Relation {
|
|
62
66
|
fromTable: string;
|
|
63
67
|
fromColumn: string;
|
|
64
68
|
toTable: string;
|
|
65
69
|
toColumn: string;
|
|
70
|
+
/** The key's other columns, when it's more than one (issue 44): a sale
|
|
71
|
+
* line referencing its sale by `store_id` and `sale_no`. A join's ON
|
|
72
|
+
* then matches every pair, ANDed. */
|
|
73
|
+
also?: {
|
|
74
|
+
fromColumn: string;
|
|
75
|
+
toColumn: string;
|
|
76
|
+
}[];
|
|
66
77
|
}
|
|
78
|
+
/** Every column pair of a relation's key, `fromColumn`/`toColumn` first. */
|
|
79
|
+
export declare function keyColumns(r: Relation): {
|
|
80
|
+
fromColumn: string;
|
|
81
|
+
toColumn: string;
|
|
82
|
+
}[];
|
|
83
|
+
/** `conditions` ANDed: the one alone, else a group of them. */
|
|
84
|
+
export declare function allOf(conditions: ExpressionNode[]): ExpressionNode;
|
|
67
85
|
/** Everything the builder knows about the database it's building queries for —
|
|
68
86
|
* supplied by the host app (PipelineEditor's `schema` prop, distributed to
|
|
69
87
|
* components via SchemaContext) rather than baked into this package. Every
|
|
@@ -173,8 +191,8 @@ export interface SuggestJoinOptions {
|
|
|
173
191
|
* order (base table first, then join-insertion order) and the first
|
|
174
192
|
* relation found wins, so the result is deterministic. A table with
|
|
175
193
|
* `passThrough: false` is tried only for itself, or when the query has no
|
|
176
|
-
* other table (startsOf). `joinType` is 'left' when the relation's FK
|
|
177
|
-
*
|
|
194
|
+
* other table (startsOf). `joinType` is 'left' when one of the relation's FK
|
|
195
|
+
* columns (`fromColumn`, `also`) is nullable (e.g. sale_transaction.promotion_id:
|
|
178
196
|
* an INNER join there would silently drop unpromoted sales) or the table
|
|
179
197
|
* it's tied to is in `options.leftJoined`, and 'inner' otherwise. Returns
|
|
180
198
|
* undefined if no relation connects `newTable` to anything already
|