@nongt/visql 0.9.0 → 0.10.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/{PipelineEditor-C10lng6j.js → PipelineEditor-Ch_i6OAc.js} +310 -317
- package/dist/core.js +83 -80
- package/dist/explain.js +325 -134
- package/dist/index.js +91 -88
- package/dist/{issueLocation-BOSdd1JX.js → issueLocation-Y1iaP_Cs.js} +176 -174
- package/dist/mui.js +1 -1
- package/dist/{params-MMOdKWnW.js → params-kc6eNrpu.js} +501 -495
- package/dist/{schema-dP_ISylQ.js → schema-KDJ1rpG5.js} +333 -298
- package/dist/sql-import.js +1 -1
- package/dist/{sqlGen-B7-2-i9V.js → sqlGen-Crgheqys.js} +33 -33
- package/dist/types/core/existsMenu.d.ts +4 -3
- package/dist/types/core/pipelineFlow.d.ts +1 -1
- package/dist/types/core/schema.d.ts +51 -22
- package/dist/types/core-api.d.ts +1 -1
- package/dist/types/explain/explainQuery.d.ts +12 -6
- package/dist/types/explain/mySqlPlan.d.ts +4 -0
- package/dist/types/explain/planPlaces.d.ts +27 -0
- package/dist/types/explain/postgresPlan.d.ts +2 -10
- package/dist/types/explain/sqlServerPlan.d.ts +4 -0
- package/dist/types/explain/xml.d.ts +7 -0
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var N = Object.defineProperty;
|
|
2
2
|
var I = (e, t, r) => t in e ? N(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { D as le, E as pe, M as ce, b as
|
|
6
|
-
import { au as D,
|
|
7
|
-
import { M as
|
|
8
|
-
import { c as
|
|
9
|
-
import { Q as
|
|
10
|
-
import { D as
|
|
11
|
-
const q = (e) => typeof e == "object" && e !== null && !(e instanceof Date),
|
|
3
|
+
var E = (e, t, r) => I(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { l as T, q as A, t as B, h as O } from "./schema-KDJ1rpG5.js";
|
|
5
|
+
import { D as le, E as pe, M as ce, b as de, f as ye, a as fe, c as me, i as he, r as be, s as Se, v as we } from "./schema-KDJ1rpG5.js";
|
|
6
|
+
import { au as D, t as L, av as Q, F as M, $ as U, p as d, al as _, aw as i, ah as j } from "./params-kc6eNrpu.js";
|
|
7
|
+
import { M as Ee, a as Te, b as ve, d as Ne, e as Ie, f as Ae, g as Be, c as Oe, h as De, k as Le, m as Qe, q as Me, r as Ue, i as _e, s as je, j as qe, o as xe, l as Ce, n as Re, u as $e } from "./params-kc6eNrpu.js";
|
|
8
|
+
import { c as Ge, f as Je, i as Fe } from "./calendarDate-CYlr9TvX.js";
|
|
9
|
+
import { Q as He, l as Xe, S as Ye, a as We, n as Ke, f as Ve, j as ze, m as Ze, b as et, k as tt, r as rt, c as at, g as nt, h as st, i as it, s as ot, d as ut, e as lt, v as pt } from "./issueLocation-Y1iaP_Cs.js";
|
|
10
|
+
import { D as dt, c as yt, S as ft, a as mt, b as ht, s as bt, u as St } from "./sqlGen-Crgheqys.js";
|
|
11
|
+
const q = (e) => typeof e == "object" && e !== null && !(e instanceof Date), v = {
|
|
12
12
|
/** A column: `expr.field('orders', 'status')`. */
|
|
13
13
|
field: (e, t) => ({ type: "field", table: e, column: t }),
|
|
14
14
|
/** A literal value, written into the SQL (as a bound parameter by
|
|
@@ -75,7 +75,7 @@ const q = (e) => typeof e == "object" && e !== null && !(e instanceof Date), T =
|
|
|
75
75
|
type: "binary",
|
|
76
76
|
operator: "IN",
|
|
77
77
|
left: e,
|
|
78
|
-
right: Array.isArray(t) ?
|
|
78
|
+
right: Array.isArray(t) ? v.list(...t) : t
|
|
79
79
|
}),
|
|
80
80
|
/** `left BETWEEN low AND high` (issue 169), both bounds included: each a
|
|
81
81
|
* value or an expression (a param, a relative date). NOT BETWEEN:
|
|
@@ -84,7 +84,7 @@ const q = (e) => typeof e == "object" && e !== null && !(e instanceof Date), T =
|
|
|
84
84
|
type: "binary",
|
|
85
85
|
operator: "BETWEEN",
|
|
86
86
|
left: e,
|
|
87
|
-
right:
|
|
87
|
+
right: v.list(t, r)
|
|
88
88
|
}),
|
|
89
89
|
/** IN's values: each a value (`expr.list(1, 2)`) or an expression
|
|
90
90
|
* (`expr.list(expr.param('a'), expr.param('b'))`). */
|
|
@@ -99,8 +99,8 @@ const q = (e) => typeof e == "object" && e !== null && !(e instanceof Date), T =
|
|
|
99
99
|
* 'customer_id') }))`. */
|
|
100
100
|
subquery: ({ select: e, ...t }) => ({
|
|
101
101
|
type: "subquery",
|
|
102
|
-
id:
|
|
103
|
-
query: { joins: [], ...t, select: [{ id:
|
|
102
|
+
id: T(),
|
|
103
|
+
query: { joins: [], ...t, select: [{ id: T(), expression: e }] }
|
|
104
104
|
})
|
|
105
105
|
};
|
|
106
106
|
function W(e, t, r) {
|
|
@@ -119,7 +119,7 @@ function x(e, t, r, a = {}) {
|
|
|
119
119
|
if (s.includes(n.alias))
|
|
120
120
|
throw new Error("addCondition: a condition names both the union and tables of its branches: add it in two parts");
|
|
121
121
|
return n.query.union.forEach((l) => {
|
|
122
|
-
const m = l.from.table, h = new Set(A(l).map(B)), b = Q(e, m), w = s.find((
|
|
122
|
+
const m = l.from.table, h = new Set(A(l).map(B)), b = Q(e, m), w = s.find((g) => !h.has(g) && !b.has(g));
|
|
123
123
|
if (w)
|
|
124
124
|
throw new Error(`addCondition: "${w}" can't be reached from "${m}", one of the union's tables: a condition must reach every branch`);
|
|
125
125
|
}), n.query.union.reduce((l, m, h) => M(
|
|
@@ -129,8 +129,8 @@ function x(e, t, r, a = {}) {
|
|
|
129
129
|
), t);
|
|
130
130
|
}
|
|
131
131
|
const u = a.operator ?? "AND", { where: o } = t;
|
|
132
|
-
let
|
|
133
|
-
return o ? o.type === "logical" && o.operator === u ?
|
|
132
|
+
let y;
|
|
133
|
+
return o ? o.type === "logical" && o.operator === u ? y = { ...o, operands: [...o.operands, r] } : y = { type: "logical", operator: u, operands: [o, r] } : y = r, d(e, t, _(e, t, y));
|
|
134
134
|
}
|
|
135
135
|
function z(e, t, r, a) {
|
|
136
136
|
const n = i(e, t, { type: "addSelectItem" }), s = n.select[n.select.length - 1].id, u = i(e, n, {
|
|
@@ -138,7 +138,7 @@ function z(e, t, r, a) {
|
|
|
138
138
|
selectId: s,
|
|
139
139
|
expression: r
|
|
140
140
|
}), o = a === void 0 ? u : i(e, u, { type: "setSelectAlias", selectId: s, alias: a });
|
|
141
|
-
return
|
|
141
|
+
return d(e, t, o);
|
|
142
142
|
}
|
|
143
143
|
function Z(e, t, r) {
|
|
144
144
|
const a = i(e, t, { type: "addGroupByItem" }), { id: n } = a.groupBy[a.groupBy.length - 1], s = i(e, a, {
|
|
@@ -146,10 +146,10 @@ function Z(e, t, r) {
|
|
|
146
146
|
groupById: n,
|
|
147
147
|
expression: r
|
|
148
148
|
});
|
|
149
|
-
return
|
|
149
|
+
return d(e, t, s);
|
|
150
150
|
}
|
|
151
151
|
function ee(e, t, r) {
|
|
152
|
-
return
|
|
152
|
+
return d(e, t, j(e, t, r));
|
|
153
153
|
}
|
|
154
154
|
function te(e, t, r, a = "asc") {
|
|
155
155
|
const n = i(e, t, { type: "addOrderByItem" }), { id: s } = n.orderBy[n.orderBy.length - 1], u = i(e, n, {
|
|
@@ -161,7 +161,7 @@ function te(e, t, r, a = "asc") {
|
|
|
161
161
|
orderById: s,
|
|
162
162
|
direction: a
|
|
163
163
|
});
|
|
164
|
-
return
|
|
164
|
+
return d(e, t, o);
|
|
165
165
|
}
|
|
166
166
|
function re(e, t, r) {
|
|
167
167
|
let a = t;
|
|
@@ -178,7 +178,7 @@ const S = 4;
|
|
|
178
178
|
class p extends Error {
|
|
179
179
|
constructor(r, a) {
|
|
180
180
|
super(a);
|
|
181
|
-
|
|
181
|
+
E(this, "kind");
|
|
182
182
|
this.name = "QueryFormatError", this.kind = r;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -214,13 +214,13 @@ function R(e) {
|
|
|
214
214
|
return t(e);
|
|
215
215
|
}
|
|
216
216
|
const $ = (e) => e, k = (e) => e, G = [R, $, k];
|
|
217
|
-
function
|
|
217
|
+
function J(e, t, r) {
|
|
218
218
|
return r.slice(t - 1).reduce((a, n) => n(a), e);
|
|
219
219
|
}
|
|
220
220
|
function f(e, t) {
|
|
221
221
|
return Array.isArray(e) ? e.map((r) => f(r, t)) : c(e) ? e.type === "literal" ? t(e) : Object.fromEntries(Object.entries(e).map(([r, a]) => [r, f(a, t)])) : e;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function F(e) {
|
|
224
224
|
return e.value instanceof Date ? { ...e, value: e.value.toISOString(), valueType: "date" } : typeof e.value == "bigint" ? { ...e, value: String(e.value), valueType: "bigint" } : e;
|
|
225
225
|
}
|
|
226
226
|
function P(e) {
|
|
@@ -241,7 +241,7 @@ function P(e) {
|
|
|
241
241
|
function se(e) {
|
|
242
242
|
return {
|
|
243
243
|
version: S,
|
|
244
|
-
query: f(e,
|
|
244
|
+
query: f(e, F)
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
function ie(e) {
|
|
@@ -255,84 +255,87 @@ function ie(e) {
|
|
|
255
255
|
"newerVersion",
|
|
256
256
|
`stored in format ${t}; this version reads up to ${S}`
|
|
257
257
|
);
|
|
258
|
-
const r =
|
|
258
|
+
const r = J(e.query, t, G);
|
|
259
259
|
if (!c(r) || typeof r.id != "string")
|
|
260
260
|
throw new p("invalid", "a stored query has a query with a string id");
|
|
261
261
|
return f(r, P);
|
|
262
262
|
}
|
|
263
263
|
export {
|
|
264
264
|
le as DEFAULT_FUNCTIONS,
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
dt as DIALECTS,
|
|
266
|
+
yt as DIALECT_LABELS,
|
|
267
267
|
pe as EMPTY_SCHEMA,
|
|
268
268
|
ce as MAX_NAME_LENGTH,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
Ee as MAX_NUMBER_DIGITS,
|
|
270
|
+
Te as MAX_TEXT_LENGTH,
|
|
271
|
+
ve as MAX_TYPE_NAME_LENGTH,
|
|
272
272
|
S as QUERY_FORMAT_VERSION,
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
He as QUERY_ISSUE_KINDS,
|
|
274
|
+
Xe as QUERY_WARNING_KINDS,
|
|
275
275
|
p as QueryFormatError,
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
ft as ScopeError,
|
|
277
|
+
Ye as SharedBaseError,
|
|
278
278
|
x as addCondition,
|
|
279
279
|
Z as addGroupBy,
|
|
280
280
|
K as addJoin,
|
|
281
|
-
|
|
281
|
+
Ne as addMeasure,
|
|
282
282
|
te as addOrderBy,
|
|
283
283
|
z as addSelectItem,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
284
|
+
We as addSharedQuery,
|
|
285
|
+
Ie as addUnionBranch,
|
|
286
|
+
Ae as addUnionJoin,
|
|
287
|
+
Be as addUnionTable,
|
|
288
|
+
mt as astToParameterizedSql,
|
|
289
|
+
ht as astToSql,
|
|
290
|
+
de as branchesOf,
|
|
291
|
+
Ge as calendarDay,
|
|
292
|
+
Oe as createEmptyQuery,
|
|
293
|
+
De as createUnion,
|
|
294
|
+
v as expr,
|
|
295
|
+
ye as filterSchema,
|
|
296
|
+
fe as findJoinPath,
|
|
297
|
+
Je as fromIsoDay,
|
|
298
|
+
me as functionsForDialect,
|
|
298
299
|
O as hasBaseTable,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
300
|
+
he as isUnion,
|
|
301
|
+
Fe as isoDay,
|
|
302
|
+
Ke as issueLocation,
|
|
303
|
+
Ve as joinMultiplicity,
|
|
304
|
+
ze as joinSharedQuery,
|
|
305
|
+
Le as keepMeasuresInStep,
|
|
305
306
|
ie as loadQuery,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
307
|
+
Ze as makeShared,
|
|
308
|
+
et as makeSubQuery,
|
|
309
|
+
Qe as measureFacts,
|
|
310
|
+
Me as queryParams,
|
|
311
|
+
be as reachableTables,
|
|
312
|
+
tt as relativeDateLabel,
|
|
311
313
|
V as removeJoin,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
314
|
+
rt as removeSharedQuery,
|
|
315
|
+
Ue as removeUnionTable,
|
|
316
|
+
at as renameSharedQuery,
|
|
317
|
+
_e as renameUnionColumn,
|
|
318
|
+
nt as repeatedReads,
|
|
319
|
+
st as repeatedTables,
|
|
318
320
|
ne as requireBaseTable,
|
|
319
|
-
|
|
321
|
+
it as rowsPerBase,
|
|
320
322
|
se as saveQuery,
|
|
321
|
-
|
|
323
|
+
bt as scopeQuery,
|
|
322
324
|
W as setBaseTable,
|
|
323
325
|
ae as setDistinct,
|
|
324
326
|
ee as setHaving,
|
|
325
327
|
re as setPaging,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
328
|
+
ot as setSharedBase,
|
|
329
|
+
je as setUnionAll,
|
|
330
|
+
ut as sharedQueryName,
|
|
331
|
+
lt as sharedUses,
|
|
332
|
+
Se as suggestJoin,
|
|
333
|
+
qe as unionName,
|
|
334
|
+
xe as unionTableColumns,
|
|
335
|
+
Ce as unionWithQuery,
|
|
336
|
+
Re as unionableTables,
|
|
337
|
+
St as unscopedBodies,
|
|
338
|
+
$e as unwrapUnion,
|
|
339
|
+
pt as validateQuery,
|
|
340
|
+
we as validateSchema
|
|
338
341
|
};
|