@nongt/visql 0.10.1 → 0.12.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 (42) hide show
  1. package/dist/{MuiTimePicker-DRqT6ByZ.js → MuiTimePicker-CROJXSCL.js} +1 -1
  2. package/dist/{PipelineEditor-CGTZGbmf.js → PipelineEditor-DHfbOSzT.js} +4342 -4039
  3. package/dist/core.js +163 -136
  4. package/dist/explain.js +3 -3
  5. package/dist/fixtures.js +3 -3
  6. package/dist/index.js +102 -110
  7. package/dist/issueLocation-DY-vvgFF.js +1155 -0
  8. package/dist/mui-date-pickers-host.js +1 -1
  9. package/dist/mui-date-pickers.js +1 -1
  10. package/dist/mui.js +2 -2
  11. package/dist/{params-DkVFbMQn.js → params-Btjlj45_.js} +255 -226
  12. package/dist/{schema-CgL10bid.js → schema-DsMO9oFE.js} +327 -245
  13. package/dist/sql-import.js +829 -786
  14. package/dist/sqlGen-DGXVba3D.js +941 -0
  15. package/dist/{tokens-DV5rTGMj.js → tokens-3SURLAkL.js} +15 -14
  16. package/dist/types/core/FunctionsContext.d.ts +8 -2
  17. package/dist/types/core/absolutePath.d.ts +3 -0
  18. package/dist/types/core/ast.d.ts +24 -2
  19. package/dist/types/core/components/expression/ExpressionTypeSelector.d.ts +1 -1
  20. package/dist/types/core/components/flow/CalculationFlowNode.d.ts +5 -0
  21. package/dist/types/core/components/flow/WindowKeys.d.ts +10 -0
  22. package/dist/types/core/expressionFlow.d.ts +48 -5
  23. package/dist/types/core/formula.d.ts +4 -1
  24. package/dist/types/core/functionRegistry.d.ts +15 -2
  25. package/dist/types/core/grouping.d.ts +6 -1
  26. package/dist/types/core/i18n/defaultMessages.d.ts +23 -0
  27. package/dist/types/core/i18n/messages.d.ts +17 -0
  28. package/dist/types/core/issueLocation.d.ts +6 -1
  29. package/dist/types/core/queryHelpers.d.ts +12 -1
  30. package/dist/types/core/queryValidation.d.ts +11 -1
  31. package/dist/types/core/sqlGen.d.ts +12 -0
  32. package/dist/types/core/storedQuery.d.ts +1 -1
  33. package/dist/types/core/theme/appearance.d.ts +4 -1
  34. package/dist/types/core/theme/looks.d.ts +6 -5
  35. package/dist/types/core/theme/tokens.d.ts +6 -3
  36. package/dist/types/core/valueTypes.d.ts +2 -2
  37. package/dist/types/core-api.d.ts +2 -2
  38. package/dist/types/sqlImport/context.d.ts +2 -2
  39. package/dist/types/sqlImport/syntax.d.ts +11 -2
  40. package/package.json +1 -1
  41. package/dist/issueLocation-BlQ280IE.js +0 -1108
  42. package/dist/sqlGen-C1kZwvWI.js +0 -903
@@ -6,9 +6,10 @@ export interface Look {
6
6
  theme: QueryBuilderTheme;
7
7
  appearance: Appearance;
8
8
  }
9
- /** The default: charcoal panels, white field cards, curved edges on dots,
10
- * buttons beside each node. */
11
- export declare const CHARCOAL: Look;
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 CHARCOAL's (looks.ts).
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
- export declare const DEFAULT_THEME: {
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 DEFAULT_THEME;
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";
@@ -17,8 +17,8 @@ export declare function sqlTypeValueType(name: string): ValueType | undefined;
17
17
  export declare function literalValueType(literal: LiteralNode): ValueType | undefined;
18
18
  /** The type of `node`'s value, when it's known: a field's column (by
19
19
  * `fieldType`, which knows the query's tables), a function's result (by
20
- * its signature's `returns`), IF/CASE by their branches, a literal by
21
- * itself. Undefined when nothing says (a param, a field with no column,
20
+ * its signature's `returns`), IF/CASE by their branches, a calculation a
21
+ * number, a literal by itself. Undefined when nothing says (a param, a field with no column,
22
22
  * an unknown function). */
23
23
  export declare function expressionType(node: ExpressionNode | undefined, fieldType: (field: FieldNode) => ValueType | undefined, registry: FunctionRegistry): ValueType | undefined;
24
24
  /** The type a literal in a comparison holds: what it's compared with, when
@@ -3,7 +3,7 @@ export { MAX_NUMBER_DIGITS, MAX_TEXT_LENGTH, MAX_TYPE_NAME_LENGTH } from './core
3
3
  export { calendarDay, fromIsoDay, isoDay } from './core/calendarDate.js';
4
4
  export { createEmptyQuery } from './core/pipelineFlow.js';
5
5
  export { addMeasure, keepMeasuresInStep, measureFacts, type MeasureFact, type MeasureSpec, } from './core/measures.js';
6
- export type { BinaryNode, BinaryOperator, CaseNode, ExistsNode, ExistsQuery, ExpressionNode, FieldNode, FunctionCallNode, FunctionSortKey, IfNode, LiteralNode, LiteralValue, LogicalNode, LogicalOperator, NotNode, ParamNode, RelativeDate, ListNode, SubqueryNode, } from './core/ast.js';
6
+ export type { ArithmeticNode, ArithmeticOperator, BinaryNode, BinaryOperator, CaseNode, ExistsNode, ExistsQuery, ExpressionNode, FieldNode, FunctionCallNode, FunctionSortKey, IfNode, LiteralNode, LiteralValue, LogicalNode, LogicalOperator, NotNode, ParamNode, RelativeDate, ListNode, SubqueryNode, } from './core/ast.js';
7
7
  export { addUnionBranch, addUnionJoin, addUnionTable, createUnion, removeUnionTable, renameUnionColumn, setUnionAll, unwrapUnion, unionName, unionWithQuery, unionableTables, unionTableColumns, type UnionTableOptions, type UnionTableColumn, type UnionTableColumnKind, type UnionTableSpec, } from './core/unionTables.js';
8
8
  export { SharedBaseError, addSharedQuery, joinSharedQuery, makeShared, makeSubQuery, removeSharedQuery, renameSharedQuery, setSharedBase, sharedQueryName, sharedUses, } from './core/sharedQueries.js';
9
9
  export { joinMultiplicity, repeatedReads, repeatedTables, rowsPerBase, type JoinMultiplicity, } from './core/fanOut.js';
@@ -13,7 +13,7 @@ export { queryParams, type ParamColumn, type QueryParam } from './core/params.js
13
13
  export { relativeDateLabel } from './core/relativeDates.js';
14
14
  export { QUERY_FORMAT_VERSION, QueryFormatError, loadQuery, saveQuery, type StoredQuery, } from './core/storedQuery.js';
15
15
  export type { ResolveName } from './core/resolveNames.js';
16
- export { astToParameterizedSql, astToSql, DIALECTS, DIALECT_LABELS, type NullSafeEqual, type ParameterizedSql, type ParameterizedSqlOptions, type SqlDialect, } from './core/sqlGen.js';
16
+ export { astToParameterizedSql, astToSql, DIALECTS, DIALECT_LABELS, type Division, type NullSafeEqual, type ParameterizedSql, type ParameterizedSqlOptions, type SqlDialect, } from './core/sqlGen.js';
17
17
  export { EMPTY_SCHEMA, filterSchema, validateSchema, type DatabaseColumnType, type DatabaseSchema, type ColumnOption, type Relation, findJoinPath, reachableTables, suggestJoin, type JoinPathOptions, type JoinSuggestion, type SuggestJoinOptions, type SchemaIssue, type SchemaIssueKind, type Table, type TableColumn, type TableGroup, } from './core/schema.js';
18
18
  export { QUERY_ISSUE_KINDS, QUERY_WARNING_KINDS, validateQuery, type QueryIssue, type QueryIssueKind, type QueryWarningKind, type QueryIssueSeverity, type ValidateQueryOptions, } from './core/queryValidation.js';
19
19
  export type { OnExplain, PlanFinding, PlanFindingKind } from './core/planFindings.js';
@@ -7,8 +7,8 @@ import type { SqlQuery, SqlSpan } from './syntax.js';
7
7
  import { type SqlPosition } from './tokenize.js';
8
8
  /** What can stop SQL from being imported:
9
9
  * - `syntax`: SQL that can't be read at all.
10
- * - `unsupported`: SQL the query can't hold (UNION at the top, WITH,
11
- * arithmetic, a window function, …).
10
+ * - `unsupported`: SQL the query can't hold (a window frame, RECURSIVE,
11
+ * `||`, …).
12
12
  * - `unknownTable`, `unknownColumn`: a name the schema doesn't have.
13
13
  * - `ambiguousColumn`: a column name more than one table has.
14
14
  * - `duplicateTable`: two tables of one query by the same name.
@@ -111,8 +111,16 @@ export interface SqlBetween {
111
111
  high: SqlExpr;
112
112
  span: SqlSpan;
113
113
  }
114
- /** A function call, with what aggregates take besides arguments. A window
115
- * (`OVER …`) and PostgreSQL's FILTER are only marked: the AST has neither. */
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nongt/visql",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "A visual SQL query editor for React: build a whole query on a node canvas, store it as JSON, turn it into SQL.",
5
5
  "keywords": [
6
6
  "sql",