@malloydata/render 0.0.247-dev250321153536 → 0.0.247
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/module/index.mjs +26 -18
- package/dist/module/index.umd.js +94 -94
- package/dist/register/register.mjs +604 -596
- package/dist/register/register.umd.js +3 -3
- package/dist/webcomponent/malloy-render.mjs +604 -596
- package/dist/webcomponent/malloy-render.umd.js +3 -3
- package/package.json +5 -5
package/dist/module/index.mjs
CHANGED
|
@@ -122257,16 +122257,30 @@ class PXe {
|
|
|
122257
122257
|
constructor(e, r, i = "timestamp") {
|
|
122258
122258
|
this.expr = e, this.timetype = i, this.d = r;
|
|
122259
122259
|
}
|
|
122260
|
+
time(e) {
|
|
122261
|
+
return this.timetype === "timestamp" ? e : this.d.sqlCast({}, {
|
|
122262
|
+
node: "cast",
|
|
122263
|
+
e: {
|
|
122264
|
+
node: "genericSQLExpr",
|
|
122265
|
+
src: ["", e],
|
|
122266
|
+
kids: { args: [] },
|
|
122267
|
+
sql: e
|
|
122268
|
+
},
|
|
122269
|
+
srcType: { type: "timestamp" },
|
|
122270
|
+
dstType: { type: "date" },
|
|
122271
|
+
safe: !1
|
|
122272
|
+
});
|
|
122273
|
+
}
|
|
122260
122274
|
compile(e) {
|
|
122261
122275
|
const r = this.expr;
|
|
122262
122276
|
switch (e.operator) {
|
|
122263
122277
|
case "after":
|
|
122264
|
-
return `${r} ${e.not ? "<" : ">="} ${this.moment(e.after).end}`;
|
|
122278
|
+
return `${r} ${e.not ? "<" : ">="} ${this.time(this.moment(e.after).end)}`;
|
|
122265
122279
|
case "before":
|
|
122266
|
-
return `${r} ${e.not ? ">=" : "<"} ${this.moment(e.before).begin}`;
|
|
122280
|
+
return `${r} ${e.not ? ">=" : "<"} ${this.time(this.moment(e.before).begin.sql)}`;
|
|
122267
122281
|
case "in": {
|
|
122268
122282
|
const i = this.moment(e.in);
|
|
122269
|
-
return this.isIn(e.not, i.begin.sql, i.end);
|
|
122283
|
+
return i.begin.sql === i.end ? e.not ? `${r} != ${this.time(i.end)} OR ${r} IS NULL` : `${r} = ${this.time(i.end)}` : this.isIn(e.not, i.begin.sql, i.end);
|
|
122270
122284
|
}
|
|
122271
122285
|
case "for": {
|
|
122272
122286
|
const i = this.moment(e.begin), s = this.delta(i.begin, "+", e.n, e.units);
|
|
@@ -122278,7 +122292,7 @@ class PXe {
|
|
|
122278
122292
|
}
|
|
122279
122293
|
case "to": {
|
|
122280
122294
|
const i = this.moment(e.fromMoment), s = this.moment(e.toMoment);
|
|
122281
|
-
return this.isIn(e.not, i.begin.sql, s.
|
|
122295
|
+
return this.isIn(e.not, i.begin.sql, s.begin.sql);
|
|
122282
122296
|
}
|
|
122283
122297
|
case "last": {
|
|
122284
122298
|
const i = this.nowDot(e.units), s = this.delta(i, "-", e.n, e.units);
|
|
@@ -122408,16 +122422,10 @@ class PXe {
|
|
|
122408
122422
|
return this.expandLiteral(e);
|
|
122409
122423
|
case "ago":
|
|
122410
122424
|
case "from_now": {
|
|
122411
|
-
const r =
|
|
122412
|
-
node: "trunc",
|
|
122413
|
-
e: this.nowExpr(),
|
|
122414
|
-
units: e.units
|
|
122415
|
-
};
|
|
122416
|
-
r.sql = this.d.sqlTruncExpr({}, r);
|
|
122417
|
-
const i = (0, WO.mkTemporal)(r, "timestamp"), s = this.delta(i, e.moment === "ago" ? "-" : "+", e.n, e.units);
|
|
122425
|
+
const r = this.nowDot(e.units), i = (0, WO.mkTemporal)(r, "timestamp"), s = this.delta(i, e.moment === "ago" ? "-" : "+", e.n, e.units);
|
|
122418
122426
|
if (e.moment === "ago" && e.n === "1")
|
|
122419
122427
|
return { begin: s, end: r.sql };
|
|
122420
|
-
const o = Number(e.n) + e.moment === "ago" ? -1 : 1, u = {
|
|
122428
|
+
const o = Number(e.n) + (e.moment === "ago" ? -1 : 1), u = {
|
|
122421
122429
|
...s,
|
|
122422
122430
|
kids: { base: i, delta: this.n(o.toString()) }
|
|
122423
122431
|
};
|
|
@@ -122462,7 +122470,7 @@ class PXe {
|
|
|
122462
122470
|
}
|
|
122463
122471
|
isIn(e, r, i) {
|
|
122464
122472
|
let s = ">=", o = "<", u = "AND";
|
|
122465
|
-
return e && (u = "OR", s = "<", o = ">="), `${this.expr} ${s} ${r} ${u} ${this.expr} ${o} ${i}`;
|
|
122473
|
+
return e && (u = "OR", s = "<", o = ">="), r = this.time(r), i = this.time(i), `${this.expr} ${s} ${r} ${u} ${this.expr} ${o} ${i}`;
|
|
122466
122474
|
}
|
|
122467
122475
|
}
|
|
122468
122476
|
dT.TemporalFilterCompiler = PXe;
|
|
@@ -122488,7 +122496,7 @@ dT.TemporalFilterCompiler = PXe;
|
|
|
122488
122496
|
if (u === "boolean" && (0, e.isBooleanFilter)(a))
|
|
122489
122497
|
return t.FilterCompilers.booleanCompile(a, l, c);
|
|
122490
122498
|
if ((u === "date" || u === "timestamp") && (0, e.isTemporalFilter)(a))
|
|
122491
|
-
return t.FilterCompilers.temporalCompile(a, l, c);
|
|
122499
|
+
return t.FilterCompilers.temporalCompile(a, l, c, u);
|
|
122492
122500
|
throw new Error("INTERNAL ERROR: No filter compiler for " + u);
|
|
122493
122501
|
},
|
|
122494
122502
|
numberCompile(u, a, l) {
|
|
@@ -122603,8 +122611,8 @@ dT.TemporalFilterCompiler = PXe;
|
|
|
122603
122611
|
}
|
|
122604
122612
|
},
|
|
122605
122613
|
// mtoy todo figure out what to do about dates
|
|
122606
|
-
temporalCompile(u, a, l) {
|
|
122607
|
-
return new r.TemporalFilterCompiler(a, l).compile(u);
|
|
122614
|
+
temporalCompile(u, a, l, c) {
|
|
122615
|
+
return new r.TemporalFilterCompiler(a, l, c).compile(u);
|
|
122608
122616
|
}
|
|
122609
122617
|
};
|
|
122610
122618
|
})(Yle);
|
|
@@ -123116,7 +123124,7 @@ let lk = class extends VXe {
|
|
|
123116
123124
|
case "filterMatch":
|
|
123117
123125
|
if ((a.dataType === "string" || a.dataType === "number" || a.dataType === "date" || a.dataType === "timestamp" || a.dataType === "boolean") && (0, zXe.isFilterExpression)(a.filter))
|
|
123118
123126
|
return HXe.FilterCompilers.compile(a.dataType, a.filter, a.e.sql || "", this.parent.dialect);
|
|
123119
|
-
throw new Error(`Internal Error: Filter Compiler Undefined
|
|
123127
|
+
throw new Error(`Internal Error: Filter Compiler Undefined Type '${a.dataType}'`);
|
|
123120
123128
|
default:
|
|
123121
123129
|
throw new Error(`Internal Error: Unknown expression node '${a.node}' ${JSON.stringify(a, void 0, 2)}`);
|
|
123122
123130
|
}
|
|
@@ -130478,7 +130486,7 @@ class $ut extends Iut.ExpressionDef {
|
|
|
130478
130486
|
}
|
|
130479
130487
|
if (a.log.length > 0)
|
|
130480
130488
|
for (const c of a.log)
|
|
130481
|
-
return this.loggedErrorExpr("filter-expression-
|
|
130489
|
+
return this.loggedErrorExpr("filter-expression-error", `Filter parse error: ${c.message}`);
|
|
130482
130490
|
if (!a.parsed)
|
|
130483
130491
|
return this.loggedErrorExpr("filter-expression-type", "FJKLD:JDKSL: expression parsed to null");
|
|
130484
130492
|
const l = {
|