@nongt/visql-core 0.13.0 → 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/core.js +6 -6
- package/dist/explain.js +3 -3
- package/dist/fixtures.js +1 -1
- package/dist/{issueLocation-CVgAkXMQ.js → issueLocation-DYnJQgvr.js} +2 -2
- package/dist/{params-fC03h7rg.js → params-CXRW5B8V.js} +821 -803
- package/dist/{schema-DsMO9oFE.js → schema-C-CgG78X.js} +178 -168
- package/dist/sql-import.js +1 -1
- package/dist/{sqlGen-Czxwqv0E.js → sqlGen-BSHDYdHB.js} +2 -2
- package/dist/types/core/schema.d.ts +22 -4
- package/package.json +1 -1
|
@@ -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
|
package/package.json
CHANGED