@nongt/visql-core 0.6.0 → 0.7.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.
@@ -1,8 +1,8 @@
1
1
  var qt = Object.defineProperty;
2
2
  var Ut = (t, e, r) => e in t ? qt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var M = (t, e, r) => Ut(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { q as U, g as B, F as vt, G as Bt, o as K, d as nt, t as ft, h as jt, w as lt, H as _t, k as Ht, b as Yt, i as Pt } from "./schema-z95dxLxu.js";
5
- import { ag as R, aA as k, aB as Gt, aC as xt, aD as kt, aj as Qt, V as Xt, ap as Vt, aE as A, al as Wt, a7 as Jt, aF as Kt, aG as $t, $ as zt } from "./issueLocation-CD9XckYv.js";
4
+ import { q as U, g as B, F as vt, G as Bt, o as K, d as nt, t as ft, h as jt, w as lt, H as _t, k as Ht, b as Yt, i as Pt } from "./schema-DFC26AhZ.js";
5
+ import { aj as R, aD as k, aE as Gt, aF as xt, aG as kt, am as Qt, V as Xt, as as Jt, aH as A, ao as Vt, a8 as Wt, aI as Kt, aJ as $t, $ as zt } from "./issueLocation-732-e0B8.js";
6
6
  import { s as Et } from "./calendarDate-CYlr9TvX.js";
7
7
  class Zt extends Error {
8
8
  constructor(r, n, s, o) {
@@ -269,7 +269,7 @@ function se(t, e, r, n = {}) {
269
269
  }
270
270
  const a = n.operator ?? "AND", { where: i } = e;
271
271
  let c;
272
- return i ? i.type === "logical" && i.operator === a ? c = { ...i, operands: [...i.operands, r] } : c = { type: "logical", operator: a, operands: [i, r] } : c = r, R(t, e, Vt(t, e, c));
272
+ return i ? i.type === "logical" && i.operator === a ? c = { ...i, operands: [...i.operands, r] } : c = { type: "logical", operator: a, operands: [i, r] } : c = r, R(t, e, Jt(t, e, c));
273
273
  }
274
274
  function Ye(t, e, r, n) {
275
275
  const s = A(t, e, { type: "addSelectItem" }), o = s.select[s.select.length - 1].id, a = A(t, s, {
@@ -288,7 +288,7 @@ function Pe(t, e, r) {
288
288
  return R(t, e, o);
289
289
  }
290
290
  function Ge(t, e, r) {
291
- return R(t, e, Wt(t, e, r));
291
+ return R(t, e, Vt(t, e, r));
292
292
  }
293
293
  function xe(t, e, r, n = "asc") {
294
294
  const s = A(t, e, { type: "addOrderByItem" }), { id: o } = s.orderBy[s.orderBy.length - 1], a = A(t, s, {
@@ -377,13 +377,13 @@ function $e(t) {
377
377
  }
378
378
  return { ...r, value: s };
379
379
  }
380
- function Ve(t) {
380
+ function Je(t) {
381
381
  return {
382
382
  version: X,
383
383
  query: _(t, le)
384
384
  };
385
385
  }
386
- function We(t) {
386
+ function Ve(t) {
387
387
  if (!q(t))
388
388
  throw new w("invalid", "a stored query is an object");
389
389
  const { version: e } = t;
@@ -399,7 +399,7 @@ function We(t) {
399
399
  throw new w("invalid", "a stored query has a query with a string id");
400
400
  return _(r, $e);
401
401
  }
402
- function V(t, e) {
402
+ function J(t, e) {
403
403
  const r = new Map(e == null ? void 0 : e.tableOf), n = new Set(e == null ? void 0 : e.aliases), s = new Set(e == null ? void 0 : e.derived);
404
404
  return t.forEach(({ table: o, alias: a }) => {
405
405
  if (o === void 0) {
@@ -429,7 +429,7 @@ function F(t, e, r) {
429
429
  }
430
430
  if (t.type === "subquery") return { ...t, query: Y(t.query, r) };
431
431
  if (t.type === "exists") {
432
- const { query: n } = t, s = [n.from, ...n.joins], o = V(s), a = V(s, e);
432
+ const { query: n } = t, s = [n.from, ...n.joins], o = J(s), a = J(s, e);
433
433
  return {
434
434
  ...t,
435
435
  link: F(t.link, a, r),
@@ -444,7 +444,7 @@ function F(t, e, r) {
444
444
  return K(t, (n) => F(n, e, r));
445
445
  }
446
446
  function Y(t, e) {
447
- const r = V([t.from, ...t.joins]), n = lt(
447
+ const r = J([t.from, ...t.joins]), n = lt(
448
448
  t,
449
449
  (s) => F(s, r, e),
450
450
  (s) => Y(s, e)
@@ -455,11 +455,11 @@ function Y(t, e) {
455
455
  joins: n.joins.map((s) => s.table === void 0 ? s : { ...s, table: e(s.table) })
456
456
  };
457
457
  }
458
- function W(t, e) {
459
- if (Array.isArray(t)) return t.map((s) => W(s, e));
458
+ function V(t, e) {
459
+ if (Array.isArray(t)) return t.map((s) => V(s, e));
460
460
  if (typeof t != "object" || t === null || t instanceof Date) return t;
461
461
  const r = Object.fromEntries(Object.entries(t).map(
462
- ([s, o]) => [s, W(o, e)]
462
+ ([s, o]) => [s, V(o, e)]
463
463
  ));
464
464
  if (!("from" in r) || !Array.isArray(r.joins)) return r;
465
465
  const n = (s) => s.table !== void 0 && !s.alias && e(s.table) !== s.table ? { ...s, alias: s.table } : s;
@@ -470,7 +470,7 @@ function W(t, e) {
470
470
  };
471
471
  }
472
472
  function ye(t, e) {
473
- return Y(W(t, e), e);
473
+ return Y(V(t, e), e);
474
474
  }
475
475
  const pe = /^(\d{2}):(\d{2})(?::(\d{2}))?$/, ut = /YYYY|MM|DD|HH|mm|ss/g, C = (t, e = 2) => String(t).padStart(e, "0");
476
476
  function ht(t, e) {
@@ -479,7 +479,7 @@ function ht(t, e) {
479
479
  if (n)
480
480
  r = { HH: n[1], mm: n[2], ss: n[3] ?? "00" };
481
481
  else {
482
- const a = typeof t == "string" ? Jt(t, "dateTime") : t;
482
+ const a = typeof t == "string" ? Wt(t, "dateTime") : t;
483
483
  a instanceof Date && (r = {
484
484
  YYYY: C(a.getUTCFullYear(), 4),
485
485
  MM: C(a.getUTCMonth() + 1),
@@ -527,7 +527,7 @@ function Ot(t, e) {
527
527
  };
528
528
  return { query: n(t), params: r };
529
529
  }
530
- const Je = ["mysql", "mssql", "postgres"], Ke = {
530
+ const We = ["mysql", "mssql", "postgres"], Ke = {
531
531
  mysql: "MySQL",
532
532
  mssql: "SQL Server",
533
533
  postgres: "PostgreSQL"
@@ -1048,10 +1048,10 @@ function Ce(t, e, r, n) {
1048
1048
  ${t.map((o) => T(o, () => `${E(n(o.expression), e, 1, r)} ${o.direction === "desc" ? "DESC" : "ASC"}`)).join(`,
1049
1049
  `)}`;
1050
1050
  }
1051
- const J = (t) => t !== void 0 && Number.isInteger(t) && t >= 0 ? t : void 0;
1051
+ const W = (t) => t !== void 0 && Number.isInteger(t) && t >= 0 ? t : void 0;
1052
1052
  function Mt(t, e) {
1053
1053
  const r = e.resolveName ? ye(t, e.resolveName) : t;
1054
- return e.defaultLimit !== void 0 && J(r.limit) === void 0 ? { ...r, limit: e.defaultLimit } : r;
1054
+ return e.defaultLimit !== void 0 && W(r.limit) === void 0 ? { ...r, limit: e.defaultLimit } : r;
1055
1055
  }
1056
1056
  const we = "18446744073709551615";
1057
1057
  function z(t, e, r, n = `SELECT${t.distinct ? " DISTINCT" : ""}`) {
@@ -1070,7 +1070,7 @@ function z(t, e, r, n = `SELECT${t.distinct ? " DISTINCT" : ""}`) {
1070
1070
  }
1071
1071
  function dt(t, e, r) {
1072
1072
  I && (I.writing = [{ value: t, path: [] }]), Rt = new Map((t.shared ?? []).map((f) => [f.id, f.name]));
1073
- const n = Se(t.shared ?? [], e, r), s = J(t.limit), o = J(t.offset) || void 0, a = t.orderBy ?? [], i = e === "mssql" && s !== void 0 && o === void 0, c = `SELECT${t.distinct ? " DISTINCT" : ""}${i ? ` ${T("limit", () => `TOP (${s})`)}` : ""}`, u = z(t, e, r, c);
1073
+ const n = Se(t.shared ?? [], e, r), s = W(t.limit), o = W(t.offset) || void 0, a = t.orderBy ?? [], i = e === "mssql" && s !== void 0 && o === void 0, c = `SELECT${t.distinct ? " DISTINCT" : ""}${i ? ` ${T("limit", () => `TOP (${s})`)}` : ""}`, u = z(t, e, r, c);
1074
1074
  if (a.length > 0 && u.push(Ce(a, e, r, (f) => e === "mysql" ? $t(f, t) : f)), e === "mssql") {
1075
1075
  if (o !== void 0) {
1076
1076
  a.length === 0 && u.push("ORDER BY (SELECT NULL)");
@@ -1114,7 +1114,7 @@ function tr(t, e, r = {}) {
1114
1114
  }), params: i };
1115
1115
  }
1116
1116
  export {
1117
- Je as D,
1117
+ We as D,
1118
1118
  X as Q,
1119
1119
  Zt as S,
1120
1120
  tr as a,
@@ -1131,8 +1131,8 @@ export {
1131
1131
  Ge as l,
1132
1132
  ke as m,
1133
1133
  w as n,
1134
- We as o,
1135
- Ve as p,
1134
+ Ve as o,
1135
+ Je as p,
1136
1136
  Ke as q,
1137
1137
  He as r,
1138
1138
  ve as s,
package/dist/core.js CHANGED
@@ -1,7 +1,7 @@
1
- import { D as e, E as r, M as o, b as n, f as i, a as d, h as t, i as u, v as l } from "./schema-z95dxLxu.js";
2
- import { M as m, a as E, b as T, Q as y, I as c, S as h, d as p, p as Q, e as _, f as U, g as b, c as A, h as M, K as N, B as D, q as I, k as B, t as f, v, m as L, G as C, H as R, w as F, r as G, x as q, i as x, C as H, E as P, F as g, y as k, s as O, z as X, A as Y, j, o as J, l as w, n as K, u as z, J as W } from "./issueLocation-CD9XckYv.js";
1
+ import { D as e, E as r, M as o, b as n, f as i, a as d, h as t, i as u, v as l } from "./schema-DFC26AhZ.js";
2
+ import { M as m, a as E, b as T, Q as y, I as c, S as h, d as p, p as Q, e as _, f as U, g as b, c as A, h as M, K as N, B as D, q as I, k as B, t as f, v, m as L, G as C, H as R, w as F, r as G, x as q, i as x, C as H, E as P, F as g, y as k, s as O, z as X, A as Y, j, o as J, l as w, n as K, u as z, J as W } from "./issueLocation-732-e0B8.js";
3
3
  import { c as Z, f as $, i as aa } from "./calendarDate-CYlr9TvX.js";
4
- import { D as ea, q as ra, Q as oa, n as na, S as ia, c as da, d as ta, e as ua, f as la, g as Sa, a as ma, b as Ea, h as Ta, o as ya, r as ca, i as ha, p as pa, s as Qa, j as _a, k as Ua, l as ba, m as Aa, u as Ma } from "./core-api-Bg_I2ak0.js";
4
+ import { D as ea, q as ra, Q as oa, n as na, S as ia, c as da, d as ta, e as ua, f as la, g as Sa, a as ma, b as Ea, h as Ta, o as ya, r as ca, i as ha, p as pa, s as Qa, j as _a, k as Ua, l as ba, m as Aa, u as Ma } from "./core-api-BsEMnDQ1.js";
5
5
  export {
6
6
  e as DEFAULT_FUNCTIONS,
7
7
  ea as DIALECTS,