@sisense/mcp-server 0.2.8 → 0.2.9
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/{ai-3wz11tv8.js → ai-w2gkxdn7.js} +188 -188
- package/dist/{index-c0zk3ctc.js → index-8027b2t7.js} +16454 -16284
- package/dist/{sse-server-tg36wntb.js → sse-server-f7drtvty.js} +970 -788
- package/dist/{sse-server-dkaznf2x.js → sse-server-n5dmee25.js} +11921 -11695
- package/dist/{sse-server-xfrv5734.js → sse-server-r50cemee.js} +39 -16
- package/dist/sse-server.js +569 -158
- package/dist/view.html +826 -822
- package/dist/{widget-renderer-56n3m26y.js → widget-renderer-9rr9sfh8.js} +4 -4
- package/package.json +5 -5
|
@@ -65,9 +65,9 @@ import {
|
|
|
65
65
|
ye,
|
|
66
66
|
zd,
|
|
67
67
|
zi
|
|
68
|
-
} from "./sse-server-
|
|
68
|
+
} from "./sse-server-r50cemee.js";
|
|
69
69
|
|
|
70
|
-
// node_modules/@sisense/sdk-ui/dist/dimensions-
|
|
70
|
+
// node_modules/@sisense/sdk-ui/dist/dimensions-C1R5YRt-.js
|
|
71
71
|
class y extends vn {
|
|
72
72
|
constructor(t, e, r, o, d, m2, l, c, a, g2) {
|
|
73
73
|
if (super(t, d || E.Dimension, m2, c, a), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = C.None, !a && e) {
|
|
@@ -216,23 +216,23 @@ function q(i) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// node_modules/@sisense/sdk-ui/dist/analytics-composer/node.js
|
|
219
|
-
var
|
|
220
|
-
var
|
|
221
|
-
var
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var
|
|
219
|
+
var Vt = Object.defineProperty;
|
|
220
|
+
var Wt = Object.defineProperties;
|
|
221
|
+
var jt = Object.getOwnPropertyDescriptors;
|
|
222
|
+
var Ue = Object.getOwnPropertySymbols;
|
|
223
|
+
var Kt = Object.prototype.hasOwnProperty;
|
|
224
|
+
var Gt = Object.prototype.propertyIsEnumerable;
|
|
225
|
+
var _e = (e, t, r) => (t in e) ? Vt(e, t, { enumerable: true, configurable: true, writable: true, value: r }) : e[t] = r;
|
|
226
|
+
var y2 = (e, t) => {
|
|
227
227
|
for (var r in t || (t = {}))
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
for (var r of
|
|
231
|
-
|
|
228
|
+
Kt.call(t, r) && _e(e, r, t[r]);
|
|
229
|
+
if (Ue)
|
|
230
|
+
for (var r of Ue(t))
|
|
231
|
+
Gt.call(t, r) && _e(e, r, t[r]);
|
|
232
232
|
return e;
|
|
233
233
|
};
|
|
234
|
-
var F = (e, t) =>
|
|
235
|
-
function
|
|
234
|
+
var F = (e, t) => Wt(e, jt(t));
|
|
235
|
+
function Yr(e, t) {
|
|
236
236
|
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, o) => Array.from({ length: s + 1 }, (a, u) => o === 0 ? u : u === 0 ? o : 0));
|
|
237
237
|
for (let i = 1;i <= r; i++)
|
|
238
238
|
for (let o = 1;o <= s; o++)
|
|
@@ -240,7 +240,7 @@ function jr(e, t) {
|
|
|
240
240
|
return n[r][s];
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
class
|
|
243
|
+
class Jr {
|
|
244
244
|
constructor() {
|
|
245
245
|
this.keyToValue = /* @__PURE__ */ new Map, this.valueToKey = /* @__PURE__ */ new Map;
|
|
246
246
|
}
|
|
@@ -258,9 +258,9 @@ class Vr {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
class
|
|
261
|
+
class ot {
|
|
262
262
|
constructor(t) {
|
|
263
|
-
this.generateIdentifier = t, this.kv = new
|
|
263
|
+
this.generateIdentifier = t, this.kv = new Jr;
|
|
264
264
|
}
|
|
265
265
|
register(t, r) {
|
|
266
266
|
this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
|
|
@@ -276,7 +276,7 @@ class rt {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
class
|
|
279
|
+
class Hr extends ot {
|
|
280
280
|
constructor() {
|
|
281
281
|
super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map;
|
|
282
282
|
}
|
|
@@ -287,7 +287,7 @@ class Wr extends rt {
|
|
|
287
287
|
return this.classToAllowedProps.get(t);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Qr(e) {
|
|
291
291
|
if ("values" in Object)
|
|
292
292
|
return Object.values(e);
|
|
293
293
|
const t = [];
|
|
@@ -295,8 +295,8 @@ function Kr(e) {
|
|
|
295
295
|
e.hasOwnProperty(r) && t.push(e[r]);
|
|
296
296
|
return t;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
299
|
-
const r =
|
|
298
|
+
function Xr(e, t) {
|
|
299
|
+
const r = Qr(e);
|
|
300
300
|
if ("find" in r)
|
|
301
301
|
return r.find(t);
|
|
302
302
|
const s = r;
|
|
@@ -306,13 +306,13 @@ function Jr(e, t) {
|
|
|
306
306
|
return i;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function V(e, t) {
|
|
310
310
|
Object.entries(e).forEach(([r, s]) => t(s, r));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function ee(e, t) {
|
|
313
313
|
return e.indexOf(t) !== -1;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function We(e, t) {
|
|
316
316
|
for (let r = 0;r < e.length; r++) {
|
|
317
317
|
const s = e[r];
|
|
318
318
|
if (t(s))
|
|
@@ -320,7 +320,7 @@ function _e(e, t) {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
class
|
|
323
|
+
class Zr {
|
|
324
324
|
constructor() {
|
|
325
325
|
this.transfomers = {};
|
|
326
326
|
}
|
|
@@ -328,36 +328,36 @@ class Yr {
|
|
|
328
328
|
this.transfomers[t.name] = t;
|
|
329
329
|
}
|
|
330
330
|
findApplicable(t) {
|
|
331
|
-
return
|
|
331
|
+
return Xr(this.transfomers, (r) => r.isApplicable(t));
|
|
332
332
|
}
|
|
333
333
|
findByName(t) {
|
|
334
334
|
return this.transfomers[t];
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
var
|
|
338
|
-
var
|
|
339
|
-
var
|
|
340
|
-
var
|
|
341
|
-
var
|
|
342
|
-
var
|
|
343
|
-
var
|
|
344
|
-
var
|
|
345
|
-
var
|
|
346
|
-
var
|
|
347
|
-
var
|
|
348
|
-
var
|
|
349
|
-
var
|
|
350
|
-
var
|
|
351
|
-
var
|
|
352
|
-
var
|
|
353
|
-
var
|
|
354
|
-
var
|
|
355
|
-
var
|
|
356
|
-
var
|
|
357
|
-
var
|
|
358
|
-
var
|
|
359
|
-
var
|
|
360
|
-
var
|
|
337
|
+
var es = (e) => Object.prototype.toString.call(e).slice(8, -1);
|
|
338
|
+
var at = (e) => typeof e == "undefined";
|
|
339
|
+
var ts = (e) => e === null;
|
|
340
|
+
var G = (e) => typeof e != "object" || e === null || e === Object.prototype ? false : Object.getPrototypeOf(e) === null ? true : Object.getPrototypeOf(e) === Object.prototype;
|
|
341
|
+
var pe = (e) => G(e) && Object.keys(e).length === 0;
|
|
342
|
+
var I = (e) => Array.isArray(e);
|
|
343
|
+
var rs = (e) => typeof e == "string";
|
|
344
|
+
var ss = (e) => typeof e == "number" && !isNaN(e);
|
|
345
|
+
var ns = (e) => typeof e == "boolean";
|
|
346
|
+
var is = (e) => e instanceof RegExp;
|
|
347
|
+
var Y = (e) => e instanceof Map;
|
|
348
|
+
var J2 = (e) => e instanceof Set;
|
|
349
|
+
var ut = (e) => es(e) === "Symbol";
|
|
350
|
+
var os = (e) => e instanceof Date && !isNaN(e.valueOf());
|
|
351
|
+
var as = (e) => e instanceof Error;
|
|
352
|
+
var je = (e) => typeof e == "number" && isNaN(e);
|
|
353
|
+
var us = (e) => ns(e) || ts(e) || at(e) || ss(e) || rs(e) || ut(e);
|
|
354
|
+
var cs = (e) => typeof e == "bigint";
|
|
355
|
+
var ls = (e) => e === 1 / 0 || e === -1 / 0;
|
|
356
|
+
var fs = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
357
|
+
var ds = (e) => e instanceof URL;
|
|
358
|
+
var ct = (e) => e.replace(/\./g, "\\.");
|
|
359
|
+
var ce = (e) => e.map(String).map(ct).join(".");
|
|
360
|
+
var K = (e) => {
|
|
361
361
|
const t = [];
|
|
362
362
|
let r = "";
|
|
363
363
|
for (let n = 0;n < e.length; n++) {
|
|
@@ -383,11 +383,11 @@ function v(e, t, r, s) {
|
|
|
383
383
|
untransform: s
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
|
-
var
|
|
387
|
-
v(
|
|
388
|
-
v(
|
|
389
|
-
v(
|
|
390
|
-
v(
|
|
386
|
+
var lt = [
|
|
387
|
+
v(at, "undefined", () => null, () => {}),
|
|
388
|
+
v(cs, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
389
|
+
v(os, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
390
|
+
v(as, "Error", (e, t) => {
|
|
391
391
|
const r = {
|
|
392
392
|
name: e.name,
|
|
393
393
|
message: e.message
|
|
@@ -401,17 +401,17 @@ var ot = [
|
|
|
401
401
|
r[s] = e[s];
|
|
402
402
|
}), r;
|
|
403
403
|
}),
|
|
404
|
-
v(
|
|
404
|
+
v(is, "regexp", (e) => "" + e, (e) => {
|
|
405
405
|
const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
|
|
406
406
|
return new RegExp(t, r);
|
|
407
407
|
}),
|
|
408
|
-
v(
|
|
409
|
-
v(
|
|
410
|
-
v((e) =>
|
|
408
|
+
v(J2, "set", (e) => [...e.values()], (e) => new Set(e)),
|
|
409
|
+
v(Y, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
410
|
+
v((e) => je(e) || ls(e), "number", (e) => je(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
411
411
|
v((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
412
|
-
v(
|
|
412
|
+
v(ds, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
413
413
|
];
|
|
414
|
-
function
|
|
414
|
+
function ie(e, t, r, s) {
|
|
415
415
|
return {
|
|
416
416
|
isApplicable: e,
|
|
417
417
|
annotation: t,
|
|
@@ -419,13 +419,13 @@ function se(e, t, r, s) {
|
|
|
419
419
|
untransform: s
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
-
var
|
|
422
|
+
var ft = ie((e, t) => ut(e) ? !!t.symbolRegistry.getIdentifier(e) : false, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
|
|
423
423
|
const s = r.symbolRegistry.getValue(t[1]);
|
|
424
424
|
if (!s)
|
|
425
425
|
throw new Error("Trying to deserialize unknown symbol");
|
|
426
426
|
return s;
|
|
427
427
|
});
|
|
428
|
-
var
|
|
428
|
+
var ms = [
|
|
429
429
|
Int8Array,
|
|
430
430
|
Uint8Array,
|
|
431
431
|
Int16Array,
|
|
@@ -436,19 +436,19 @@ var us = [
|
|
|
436
436
|
Float64Array,
|
|
437
437
|
Uint8ClampedArray
|
|
438
438
|
].reduce((e, t) => (e[t.name] = t, e), {});
|
|
439
|
-
var
|
|
440
|
-
const r =
|
|
439
|
+
var dt = ie(fs, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
440
|
+
const r = ms[t[1]];
|
|
441
441
|
if (!r)
|
|
442
442
|
throw new Error("Trying to deserialize unknown typed array");
|
|
443
443
|
return new r(e);
|
|
444
444
|
});
|
|
445
|
-
function
|
|
445
|
+
function mt(e, t) {
|
|
446
446
|
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : false;
|
|
447
447
|
}
|
|
448
|
-
var
|
|
448
|
+
var pt = ie(mt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
449
449
|
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
450
450
|
if (!r)
|
|
451
|
-
return
|
|
451
|
+
return y2({}, e);
|
|
452
452
|
const s = {};
|
|
453
453
|
return r.forEach((n) => {
|
|
454
454
|
s[n] = e[n];
|
|
@@ -459,53 +459,53 @@ var lt = se(ct, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)
|
|
|
459
459
|
throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
460
460
|
return Object.assign(Object.create(s.prototype), e);
|
|
461
461
|
});
|
|
462
|
-
var
|
|
462
|
+
var gt2 = ie((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
|
|
463
463
|
const s = r.customTransformerRegistry.findByName(t[1]);
|
|
464
464
|
if (!s)
|
|
465
465
|
throw new Error("Trying to deserialize unknown custom value");
|
|
466
466
|
return s.deserialize(e);
|
|
467
467
|
});
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
const r =
|
|
468
|
+
var ps = [pt, ft, gt2, dt];
|
|
469
|
+
var Ke2 = (e, t) => {
|
|
470
|
+
const r = We(ps, (n) => n.isApplicable(e, t));
|
|
471
471
|
if (r)
|
|
472
472
|
return {
|
|
473
473
|
value: r.transform(e, t),
|
|
474
474
|
type: r.annotation(e, t)
|
|
475
475
|
};
|
|
476
|
-
const s =
|
|
476
|
+
const s = We(lt, (n) => n.isApplicable(e, t));
|
|
477
477
|
if (s)
|
|
478
478
|
return {
|
|
479
479
|
value: s.transform(e, t),
|
|
480
480
|
type: s.annotation
|
|
481
481
|
};
|
|
482
482
|
};
|
|
483
|
-
var
|
|
484
|
-
|
|
485
|
-
|
|
483
|
+
var yt = {};
|
|
484
|
+
lt.forEach((e) => {
|
|
485
|
+
yt[e.annotation] = e;
|
|
486
486
|
});
|
|
487
|
-
var
|
|
488
|
-
if (
|
|
487
|
+
var gs = (e, t, r) => {
|
|
488
|
+
if (I(t))
|
|
489
489
|
switch (t[0]) {
|
|
490
490
|
case "symbol":
|
|
491
|
-
return
|
|
491
|
+
return ft.untransform(e, t, r);
|
|
492
492
|
case "class":
|
|
493
|
-
return
|
|
493
|
+
return pt.untransform(e, t, r);
|
|
494
494
|
case "custom":
|
|
495
|
-
return
|
|
495
|
+
return gt2.untransform(e, t, r);
|
|
496
496
|
case "typed-array":
|
|
497
|
-
return
|
|
497
|
+
return dt.untransform(e, t, r);
|
|
498
498
|
default:
|
|
499
499
|
throw new Error("Unknown transformation: " + t);
|
|
500
500
|
}
|
|
501
501
|
else {
|
|
502
|
-
const s =
|
|
502
|
+
const s = yt[t];
|
|
503
503
|
if (!s)
|
|
504
504
|
throw new Error("Unknown transformation: " + t);
|
|
505
505
|
return s.untransform(e, r);
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
|
-
var
|
|
508
|
+
var L = (e, t) => {
|
|
509
509
|
if (t > e.size)
|
|
510
510
|
throw new Error("index out of bounds");
|
|
511
511
|
const r = e.keys();
|
|
@@ -513,22 +513,22 @@ var P = (e, t) => {
|
|
|
513
513
|
r.next(), t--;
|
|
514
514
|
return r.next().value;
|
|
515
515
|
};
|
|
516
|
-
function
|
|
517
|
-
if (
|
|
516
|
+
function ht(e) {
|
|
517
|
+
if (ee(e, "__proto__"))
|
|
518
518
|
throw new Error("__proto__ is not allowed as a property");
|
|
519
|
-
if (
|
|
519
|
+
if (ee(e, "prototype"))
|
|
520
520
|
throw new Error("prototype is not allowed as a property");
|
|
521
|
-
if (
|
|
521
|
+
if (ee(e, "constructor"))
|
|
522
522
|
throw new Error("constructor is not allowed as a property");
|
|
523
523
|
}
|
|
524
|
-
var
|
|
525
|
-
|
|
524
|
+
var ys = (e, t) => {
|
|
525
|
+
ht(t);
|
|
526
526
|
for (let r = 0;r < t.length; r++) {
|
|
527
527
|
const s = t[r];
|
|
528
|
-
if (
|
|
529
|
-
e =
|
|
530
|
-
else if (
|
|
531
|
-
const n = +s, i = +t[++r] == 0 ? "key" : "value", o =
|
|
528
|
+
if (J2(e))
|
|
529
|
+
e = L(e, +s);
|
|
530
|
+
else if (Y(e)) {
|
|
531
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", o = L(e, n);
|
|
532
532
|
switch (i) {
|
|
533
533
|
case "key":
|
|
534
534
|
e = o;
|
|
@@ -542,41 +542,41 @@ var fs = (e, t) => {
|
|
|
542
542
|
}
|
|
543
543
|
return e;
|
|
544
544
|
};
|
|
545
|
-
var
|
|
546
|
-
if (
|
|
545
|
+
var ge = (e, t, r) => {
|
|
546
|
+
if (ht(t), t.length === 0)
|
|
547
547
|
return r(e);
|
|
548
548
|
let s = e;
|
|
549
549
|
for (let i = 0;i < t.length - 1; i++) {
|
|
550
550
|
const o = t[i];
|
|
551
|
-
if (
|
|
551
|
+
if (I(s)) {
|
|
552
552
|
const a = +o;
|
|
553
553
|
s = s[a];
|
|
554
|
-
} else if (
|
|
554
|
+
} else if (G(s))
|
|
555
555
|
s = s[o];
|
|
556
|
-
else if (
|
|
556
|
+
else if (J2(s)) {
|
|
557
557
|
const a = +o;
|
|
558
|
-
s =
|
|
559
|
-
} else if (
|
|
558
|
+
s = L(s, a);
|
|
559
|
+
} else if (Y(s)) {
|
|
560
560
|
if (i === t.length - 2)
|
|
561
561
|
break;
|
|
562
|
-
const u = +o, c = +t[++i] == 0 ? "key" : "value",
|
|
562
|
+
const u = +o, c = +t[++i] == 0 ? "key" : "value", p2 = L(s, u);
|
|
563
563
|
switch (c) {
|
|
564
564
|
case "key":
|
|
565
|
-
s =
|
|
565
|
+
s = p2;
|
|
566
566
|
break;
|
|
567
567
|
case "value":
|
|
568
|
-
s = s.get(
|
|
568
|
+
s = s.get(p2);
|
|
569
569
|
break;
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
const n = t[t.length - 1];
|
|
574
|
-
if (
|
|
575
|
-
const i =
|
|
574
|
+
if (I(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J2(s)) {
|
|
575
|
+
const i = L(s, +n), o = r(i);
|
|
576
576
|
i !== o && (s.delete(i), s.add(o));
|
|
577
577
|
}
|
|
578
|
-
if (
|
|
579
|
-
const i = +t[t.length - 2], o =
|
|
578
|
+
if (Y(s)) {
|
|
579
|
+
const i = +t[t.length - 2], o = L(s, i);
|
|
580
580
|
switch (+n == 0 ? "key" : "value") {
|
|
581
581
|
case "key": {
|
|
582
582
|
const u = r(o);
|
|
@@ -591,45 +591,45 @@ var de = (e, t, r) => {
|
|
|
591
591
|
}
|
|
592
592
|
return e;
|
|
593
593
|
};
|
|
594
|
-
function
|
|
594
|
+
function ye2(e, t, r = []) {
|
|
595
595
|
if (!e)
|
|
596
596
|
return;
|
|
597
|
-
if (!
|
|
598
|
-
|
|
597
|
+
if (!I(e)) {
|
|
598
|
+
V(e, (i, o) => ye2(i, t, [...r, ...K(o)]));
|
|
599
599
|
return;
|
|
600
600
|
}
|
|
601
601
|
const [s, n] = e;
|
|
602
|
-
n &&
|
|
603
|
-
|
|
602
|
+
n && V(n, (i, o) => {
|
|
603
|
+
ye2(i, t, [...r, ...K(o)]);
|
|
604
604
|
}), t(s, r);
|
|
605
605
|
}
|
|
606
|
-
function
|
|
607
|
-
return
|
|
608
|
-
e =
|
|
606
|
+
function hs(e, t, r) {
|
|
607
|
+
return ye2(t, (s, n) => {
|
|
608
|
+
e = ge(e, n, (i) => gs(i, s, r));
|
|
609
609
|
}), e;
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function bs(e, t) {
|
|
612
612
|
function r(s, n) {
|
|
613
|
-
const i =
|
|
614
|
-
s.map(
|
|
615
|
-
e =
|
|
613
|
+
const i = ys(e, K(n));
|
|
614
|
+
s.map(K).forEach((o) => {
|
|
615
|
+
e = ge(e, o, () => i);
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
|
-
if (
|
|
618
|
+
if (I(t)) {
|
|
619
619
|
const [s, n] = t;
|
|
620
620
|
s.forEach((i) => {
|
|
621
|
-
e =
|
|
622
|
-
}), n &&
|
|
621
|
+
e = ge(e, K(i), () => e);
|
|
622
|
+
}), n && V(n, r);
|
|
623
623
|
} else
|
|
624
|
-
|
|
624
|
+
V(t, r);
|
|
625
625
|
return e;
|
|
626
626
|
}
|
|
627
|
-
var
|
|
628
|
-
function
|
|
627
|
+
var As = (e, t) => G(e) || I(e) || Y(e) || J2(e) || mt(e, t);
|
|
628
|
+
function Fs(e, t, r) {
|
|
629
629
|
const s = r.get(e);
|
|
630
630
|
s ? s.push(t) : r.set(e, [t]);
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function ws(e, t) {
|
|
633
633
|
const r = {};
|
|
634
634
|
let s;
|
|
635
635
|
return e.forEach((n) => {
|
|
@@ -637,64 +637,64 @@ function gs(e, t) {
|
|
|
637
637
|
return;
|
|
638
638
|
t || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
|
|
639
639
|
const [i, ...o] = n;
|
|
640
|
-
i.length === 0 ? s = o.map(
|
|
641
|
-
}), s ?
|
|
640
|
+
i.length === 0 ? s = o.map(ce) : r[ce(i)] = o.map(ce);
|
|
641
|
+
}), s ? pe(r) ? [s] : [s, r] : pe(r) ? undefined : r;
|
|
642
642
|
}
|
|
643
|
-
var
|
|
644
|
-
var
|
|
645
|
-
const a =
|
|
643
|
+
var bt = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map) => {
|
|
644
|
+
var b2;
|
|
645
|
+
const a = us(e);
|
|
646
646
|
if (!a) {
|
|
647
|
-
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
647
|
+
Fs(e, n, t);
|
|
648
|
+
const g2 = o.get(e);
|
|
649
|
+
if (g2)
|
|
650
650
|
return s ? {
|
|
651
651
|
transformedValue: null
|
|
652
|
-
} :
|
|
652
|
+
} : g2;
|
|
653
653
|
}
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
transformedValue:
|
|
657
|
-
annotations: [
|
|
654
|
+
if (!As(e, r)) {
|
|
655
|
+
const g2 = Ke2(e, r), m2 = g2 ? {
|
|
656
|
+
transformedValue: g2.value,
|
|
657
|
+
annotations: [g2.type]
|
|
658
658
|
} : {
|
|
659
659
|
transformedValue: e
|
|
660
660
|
};
|
|
661
|
-
return a || o.set(e,
|
|
661
|
+
return a || o.set(e, m2), m2;
|
|
662
662
|
}
|
|
663
|
-
if (
|
|
663
|
+
if (ee(i, e))
|
|
664
664
|
return {
|
|
665
665
|
transformedValue: null
|
|
666
666
|
};
|
|
667
|
-
const u =
|
|
668
|
-
|
|
669
|
-
if (
|
|
670
|
-
throw new Error(`Detected property ${
|
|
671
|
-
const
|
|
672
|
-
m2
|
|
673
|
-
l[
|
|
667
|
+
const u = Ke2(e, r), c = (b2 = u == null ? undefined : u.value) != null ? b2 : e, p2 = I(c) ? [] : {}, l = {};
|
|
668
|
+
V(c, (g2, m2) => {
|
|
669
|
+
if (m2 === "__proto__" || m2 === "constructor" || m2 === "prototype")
|
|
670
|
+
throw new Error(`Detected property ${m2}. This is a prototype pollution risk, please remove it from your object.`);
|
|
671
|
+
const A = bt(g2, t, r, s, [...n, m2], [...i, e], o);
|
|
672
|
+
p2[m2] = A.transformedValue, I(A.annotations) ? l[m2] = A.annotations : G(A.annotations) && V(A.annotations, (C2, N2) => {
|
|
673
|
+
l[ct(m2) + "." + N2] = C2;
|
|
674
674
|
});
|
|
675
675
|
});
|
|
676
|
-
const
|
|
677
|
-
transformedValue:
|
|
676
|
+
const d = pe(l) ? {
|
|
677
|
+
transformedValue: p2,
|
|
678
678
|
annotations: u ? [u.type] : undefined
|
|
679
679
|
} : {
|
|
680
|
-
transformedValue:
|
|
680
|
+
transformedValue: p2,
|
|
681
681
|
annotations: u ? [u.type, l] : l
|
|
682
682
|
};
|
|
683
|
-
return a || o.set(e,
|
|
683
|
+
return a || o.set(e, d), d;
|
|
684
684
|
};
|
|
685
|
-
function
|
|
685
|
+
function At(e) {
|
|
686
686
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
688
|
+
function Ge(e) {
|
|
689
|
+
return At(e) === "Array";
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
if (
|
|
691
|
+
function Es(e) {
|
|
692
|
+
if (At(e) !== "Object")
|
|
693
693
|
return false;
|
|
694
694
|
const t = Object.getPrototypeOf(e);
|
|
695
695
|
return !!t && t.constructor === Object && t === Object.prototype;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function Cs(e, t, r, s, n) {
|
|
698
698
|
const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
699
699
|
i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
|
|
700
700
|
value: r,
|
|
@@ -703,43 +703,43 @@ function bs(e, t, r, s, n) {
|
|
|
703
703
|
configurable: true
|
|
704
704
|
});
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
if (
|
|
708
|
-
return e.map((n) =>
|
|
709
|
-
if (!
|
|
706
|
+
function he(e, t = {}) {
|
|
707
|
+
if (Ge(e))
|
|
708
|
+
return e.map((n) => he(n, t));
|
|
709
|
+
if (!Es(e))
|
|
710
710
|
return e;
|
|
711
711
|
const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
712
712
|
return [...r, ...s].reduce((n, i) => {
|
|
713
|
-
if (
|
|
713
|
+
if (Ge(t.props) && !t.props.includes(i))
|
|
714
714
|
return n;
|
|
715
|
-
const o = e[i], a =
|
|
716
|
-
return
|
|
715
|
+
const o = e[i], a = he(o, t);
|
|
716
|
+
return Cs(n, i, a, e, t.nonenumerable), n;
|
|
717
717
|
}, {});
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
-
class
|
|
720
|
+
class h2 {
|
|
721
721
|
constructor({ dedupe: t = false } = {}) {
|
|
722
|
-
this.classRegistry = new
|
|
722
|
+
this.classRegistry = new Hr, this.symbolRegistry = new ot((r) => {
|
|
723
723
|
var s;
|
|
724
724
|
return (s = r.description) != null ? s : "";
|
|
725
|
-
}), this.customTransformerRegistry = new
|
|
725
|
+
}), this.customTransformerRegistry = new Zr, this.allowedErrorProps = [], this.dedupe = t;
|
|
726
726
|
}
|
|
727
727
|
serialize(t) {
|
|
728
|
-
const r = /* @__PURE__ */ new Map, s =
|
|
728
|
+
const r = /* @__PURE__ */ new Map, s = bt(t, r, this, this.dedupe), n = {
|
|
729
729
|
json: s.transformedValue
|
|
730
730
|
};
|
|
731
|
-
s.annotations && (n.meta = F(
|
|
731
|
+
s.annotations && (n.meta = F(y2({}, n.meta), {
|
|
732
732
|
values: s.annotations
|
|
733
733
|
}));
|
|
734
|
-
const i =
|
|
735
|
-
return i && (n.meta = F(
|
|
734
|
+
const i = ws(r, this.dedupe);
|
|
735
|
+
return i && (n.meta = F(y2({}, n.meta), {
|
|
736
736
|
referentialEqualities: i
|
|
737
737
|
})), n;
|
|
738
738
|
}
|
|
739
739
|
deserialize(t) {
|
|
740
740
|
const { json: r, meta: s } = t;
|
|
741
|
-
let n =
|
|
742
|
-
return s != null && s.values && (n =
|
|
741
|
+
let n = he(r);
|
|
742
|
+
return s != null && s.values && (n = hs(n, s.values, this)), s != null && s.referentialEqualities && (n = bs(n, s.referentialEqualities)), n;
|
|
743
743
|
}
|
|
744
744
|
stringify(t) {
|
|
745
745
|
return JSON.stringify(this.serialize(t));
|
|
@@ -754,7 +754,7 @@ class y2 {
|
|
|
754
754
|
this.symbolRegistry.register(t, r);
|
|
755
755
|
}
|
|
756
756
|
registerCustom(t, r) {
|
|
757
|
-
this.customTransformerRegistry.register(
|
|
757
|
+
this.customTransformerRegistry.register(y2({
|
|
758
758
|
name: r
|
|
759
759
|
}, t));
|
|
760
760
|
}
|
|
@@ -762,54 +762,54 @@ class y2 {
|
|
|
762
762
|
this.allowedErrorProps.push(...t);
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
765
|
+
h2.defaultInstance = new h2;
|
|
766
|
+
h2.serialize = h2.defaultInstance.serialize.bind(h2.defaultInstance);
|
|
767
|
+
h2.deserialize = h2.defaultInstance.deserialize.bind(h2.defaultInstance);
|
|
768
|
+
h2.stringify = h2.defaultInstance.stringify.bind(h2.defaultInstance);
|
|
769
|
+
h2.parse = h2.defaultInstance.parse.bind(h2.defaultInstance);
|
|
770
|
+
h2.registerClass = h2.defaultInstance.registerClass.bind(h2.defaultInstance);
|
|
771
|
+
h2.registerSymbol = h2.defaultInstance.registerSymbol.bind(h2.defaultInstance);
|
|
772
|
+
h2.registerCustom = h2.defaultInstance.registerCustom.bind(h2.defaultInstance);
|
|
773
|
+
h2.allowErrorProps = h2.defaultInstance.allowErrorProps.bind(h2.defaultInstance);
|
|
774
774
|
var z2 = (e) => e === undefined ? C.None : e;
|
|
775
|
-
var
|
|
776
|
-
var
|
|
777
|
-
var
|
|
778
|
-
var
|
|
775
|
+
var Ts = (e) => new m(e.metadataItem, e.type);
|
|
776
|
+
var Ee = (e) => new Ke(e.name, e.expression, e.type, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
777
|
+
var Ce = (e) => new J(e.name, e.expression, e.granularity, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
778
|
+
var O = (e) => {
|
|
779
779
|
switch (e.__serializable) {
|
|
780
780
|
case "DimensionalAttribute":
|
|
781
|
-
return
|
|
781
|
+
return Ee(e);
|
|
782
782
|
case "DimensionalLevelAttribute":
|
|
783
|
-
return
|
|
783
|
+
return Ce(e);
|
|
784
784
|
default:
|
|
785
785
|
return e;
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
|
-
var
|
|
789
|
-
var
|
|
790
|
-
var
|
|
788
|
+
var Ft = (e) => new y(e.name, e.expression, e.attributes.map(O), e.dimensions.map(qs), e.type, e.description, z2(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? O(e.defaultAttribute) : undefined);
|
|
789
|
+
var wt = (e) => new p(e.name, e.expression, e.description, z2(e.sort), e.dataSource, e.composeCode, e.indexed, e.merged);
|
|
790
|
+
var qs = (e) => {
|
|
791
791
|
switch (e.__serializable) {
|
|
792
792
|
case "DimensionalDimension":
|
|
793
|
-
return
|
|
793
|
+
return Ft(e);
|
|
794
794
|
case "DimensionalDateDimension":
|
|
795
|
-
return
|
|
795
|
+
return wt(e);
|
|
796
796
|
default:
|
|
797
797
|
return e;
|
|
798
798
|
}
|
|
799
799
|
};
|
|
800
|
-
var
|
|
801
|
-
var
|
|
800
|
+
var Te = (e) => new ye(e.name, O(e.attribute), e.aggregation, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
801
|
+
var qe = (e) => {
|
|
802
802
|
const t = Object.fromEntries(Object.entries(e.context).map(([r, s]) => {
|
|
803
803
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
804
804
|
switch (s.__serializable) {
|
|
805
805
|
case "DimensionalAttribute":
|
|
806
|
-
return [r,
|
|
806
|
+
return [r, Ee(s)];
|
|
807
807
|
case "DimensionalLevelAttribute":
|
|
808
|
-
return [r,
|
|
808
|
+
return [r, Ce(s)];
|
|
809
809
|
case "DimensionalBaseMeasure":
|
|
810
|
-
return [r,
|
|
810
|
+
return [r, Te(s)];
|
|
811
811
|
case "DimensionalCalculatedMeasure":
|
|
812
|
-
return [r,
|
|
812
|
+
return [r, qe(s)];
|
|
813
813
|
default:
|
|
814
814
|
return [r, s];
|
|
815
815
|
}
|
|
@@ -817,189 +817,196 @@ var Ce = (e) => {
|
|
|
817
817
|
}));
|
|
818
818
|
return new X(e.name, e.expression, t, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
819
819
|
};
|
|
820
|
-
var
|
|
821
|
-
var
|
|
820
|
+
var Et = (e) => new Yt(e.name, O(e.attribute), e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
821
|
+
var le = (e) => {
|
|
822
822
|
switch (e.__serializable) {
|
|
823
823
|
case "DimensionalBaseMeasure":
|
|
824
|
-
return
|
|
824
|
+
return Te(e);
|
|
825
825
|
case "DimensionalCalculatedMeasure":
|
|
826
|
-
return
|
|
826
|
+
return qe(e);
|
|
827
827
|
case "DimensionalMeasureTemplate":
|
|
828
|
-
return
|
|
828
|
+
return Et(e);
|
|
829
829
|
default:
|
|
830
830
|
return e;
|
|
831
831
|
}
|
|
832
832
|
};
|
|
833
|
-
var
|
|
833
|
+
var T2 = (e) => {
|
|
834
834
|
switch (e.__serializable) {
|
|
835
835
|
case "MembersFilter":
|
|
836
|
-
return new jd(
|
|
836
|
+
return new jd(O(e.attribute), e.members, e.config.backgroundFilter ? F(y2({}, e.config), { backgroundFilter: T2(e.config.backgroundFilter) }) : e.config, e.composeCode);
|
|
837
837
|
case "LogicalAttributeFilter":
|
|
838
|
-
return new Bi(e.filters.map((r) =>
|
|
838
|
+
return new Bi(e.filters.map((r) => T2(r)), e.operator, e.config, e.composeCode);
|
|
839
839
|
case "CascadingFilter":
|
|
840
|
-
return new Pd(e._filters.map((r) =>
|
|
840
|
+
return new Pd(e._filters.map((r) => T2(r)), e.config, e.composeCode);
|
|
841
841
|
case "ExcludeFilter":
|
|
842
|
-
return new Fd(
|
|
842
|
+
return new Fd(T2(e.filter), e.input ? T2(e.input) : undefined, e.config, e.composeCode);
|
|
843
843
|
case "MeasureFilter":
|
|
844
|
-
return new Ud(
|
|
844
|
+
return new Ud(O(e.attribute), le(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
845
845
|
case "RankingFilter":
|
|
846
|
-
return new zi(
|
|
846
|
+
return new zi(O(e.attribute), le(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
847
847
|
case "MeasureRankingFilter":
|
|
848
|
-
return new Hi(
|
|
848
|
+
return new Hi(le(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
849
849
|
case "NumericFilter":
|
|
850
|
-
return new Bd(
|
|
850
|
+
return new Bd(O(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
851
851
|
case "TextFilter":
|
|
852
|
-
return new re(
|
|
852
|
+
return new re(O(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
|
|
853
853
|
case "DateRangeFilter": {
|
|
854
854
|
const { valueA: r, valueB: s } = e;
|
|
855
|
-
return new zd(
|
|
855
|
+
return new zd(O(e.attribute), r, s, e.config, e.composeCode);
|
|
856
856
|
}
|
|
857
857
|
case "RelativeDateFilter":
|
|
858
|
-
return new wn(
|
|
858
|
+
return new wn(O(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
|
|
859
859
|
case "CustomFilter":
|
|
860
|
-
return new Hd(
|
|
860
|
+
return new Hd(O(e.attribute), e.jaqlExpression, e.config, e.composeCode);
|
|
861
861
|
default:
|
|
862
862
|
return e;
|
|
863
863
|
}
|
|
864
864
|
};
|
|
865
|
-
|
|
865
|
+
h2.registerCustom({
|
|
866
866
|
isApplicable: h,
|
|
867
867
|
serialize: (e) => e.serialize(),
|
|
868
|
-
deserialize: (e) =>
|
|
868
|
+
deserialize: (e) => Ts(e)
|
|
869
869
|
}, "JaqlElement");
|
|
870
|
-
|
|
870
|
+
h2.registerCustom({
|
|
871
871
|
isApplicable: xp,
|
|
872
872
|
serialize: (e) => e.serialize(),
|
|
873
|
-
deserialize: (e) =>
|
|
873
|
+
deserialize: (e) => Ee(e)
|
|
874
874
|
}, "DimensionalAttribute");
|
|
875
|
-
|
|
875
|
+
h2.registerCustom({
|
|
876
876
|
isApplicable: wp,
|
|
877
877
|
serialize: (e) => e.serialize(),
|
|
878
|
-
deserialize: (e) =>
|
|
878
|
+
deserialize: (e) => Ce(e)
|
|
879
879
|
}, "DimensionalLevelAttribute");
|
|
880
|
-
|
|
880
|
+
h2.registerCustom({
|
|
881
881
|
isApplicable: z,
|
|
882
882
|
serialize: (e) => e.serialize(),
|
|
883
|
-
deserialize: (e) =>
|
|
883
|
+
deserialize: (e) => Ft(e)
|
|
884
884
|
}, "DimensionalDimension");
|
|
885
|
-
|
|
885
|
+
h2.registerCustom({
|
|
886
886
|
isApplicable: S,
|
|
887
887
|
serialize: (e) => e.serialize(),
|
|
888
|
-
deserialize: (e) =>
|
|
888
|
+
deserialize: (e) => wt(e)
|
|
889
889
|
}, "DimensionalDateDimension");
|
|
890
|
-
|
|
890
|
+
h2.registerCustom({
|
|
891
891
|
isApplicable: $i,
|
|
892
892
|
serialize: (e) => e.serialize(),
|
|
893
|
-
deserialize: (e) =>
|
|
893
|
+
deserialize: (e) => Te(e)
|
|
894
894
|
}, "DimensionalBaseMeasure");
|
|
895
|
-
|
|
895
|
+
h2.registerCustom({
|
|
896
896
|
isApplicable: ji,
|
|
897
897
|
serialize: (e) => e.serialize(),
|
|
898
|
-
deserialize: (e) =>
|
|
898
|
+
deserialize: (e) => qe(e)
|
|
899
899
|
}, "DimensionalCalculatedMeasure");
|
|
900
|
-
|
|
900
|
+
h2.registerCustom({
|
|
901
901
|
isApplicable: ip,
|
|
902
902
|
serialize: (e) => e.serialize(),
|
|
903
|
-
deserialize: (e) =>
|
|
903
|
+
deserialize: (e) => Et(e)
|
|
904
904
|
}, "DimensionalMeasureTemplate");
|
|
905
|
-
|
|
905
|
+
h2.registerCustom({
|
|
906
906
|
isApplicable: ap,
|
|
907
907
|
serialize: (e) => e.serialize(),
|
|
908
|
-
deserialize: (e) =>
|
|
908
|
+
deserialize: (e) => T2(e)
|
|
909
909
|
}, "MembersFilter");
|
|
910
|
-
|
|
910
|
+
h2.registerCustom({
|
|
911
911
|
isApplicable: dp,
|
|
912
912
|
serialize: (e) => e.serialize(),
|
|
913
|
-
deserialize: (e) =>
|
|
913
|
+
deserialize: (e) => T2(e)
|
|
914
914
|
}, "LogicalAttributeFilter");
|
|
915
|
-
|
|
915
|
+
h2.registerCustom({
|
|
916
916
|
isApplicable: Nt,
|
|
917
917
|
serialize: (e) => e.serialize(),
|
|
918
|
-
deserialize: (e) =>
|
|
918
|
+
deserialize: (e) => T2(e)
|
|
919
919
|
}, "CascadingFilter");
|
|
920
|
-
|
|
920
|
+
h2.registerCustom({
|
|
921
921
|
isApplicable: fp,
|
|
922
922
|
serialize: (e) => e.serialize(),
|
|
923
|
-
deserialize: (e) =>
|
|
923
|
+
deserialize: (e) => T2(e)
|
|
924
924
|
}, "ExcludeFilter");
|
|
925
|
-
|
|
925
|
+
h2.registerCustom({
|
|
926
926
|
isApplicable: lp,
|
|
927
927
|
serialize: (e) => e.serialize(),
|
|
928
|
-
deserialize: (e) =>
|
|
928
|
+
deserialize: (e) => T2(e)
|
|
929
929
|
}, "MeasureFilter");
|
|
930
|
-
|
|
930
|
+
h2.registerCustom({
|
|
931
931
|
isApplicable: up,
|
|
932
932
|
serialize: (e) => e.serialize(),
|
|
933
|
-
deserialize: (e) =>
|
|
933
|
+
deserialize: (e) => T2(e)
|
|
934
934
|
}, "RankingFilter");
|
|
935
|
-
|
|
935
|
+
h2.registerCustom({
|
|
936
936
|
isApplicable: cp,
|
|
937
937
|
serialize: (e) => e.serialize(),
|
|
938
|
-
deserialize: (e) =>
|
|
938
|
+
deserialize: (e) => T2(e)
|
|
939
939
|
}, "MeasureRankingFilter");
|
|
940
|
-
|
|
940
|
+
h2.registerCustom({
|
|
941
941
|
isApplicable: op,
|
|
942
942
|
serialize: (e) => e.serialize(),
|
|
943
|
-
deserialize: (e) =>
|
|
943
|
+
deserialize: (e) => T2(e)
|
|
944
944
|
}, "NumericFilter");
|
|
945
|
-
|
|
945
|
+
h2.registerCustom({
|
|
946
946
|
isApplicable: hp,
|
|
947
947
|
serialize: (e) => e.serialize(),
|
|
948
|
-
deserialize: (e) =>
|
|
948
|
+
deserialize: (e) => T2(e)
|
|
949
949
|
}, "TextFilter");
|
|
950
|
-
|
|
950
|
+
h2.registerCustom({
|
|
951
951
|
isApplicable: pp,
|
|
952
952
|
serialize: (e) => e.serialize(),
|
|
953
|
-
deserialize: (e) =>
|
|
953
|
+
deserialize: (e) => T2(e)
|
|
954
954
|
}, "DateRangeFilter");
|
|
955
|
-
|
|
955
|
+
h2.registerCustom({
|
|
956
956
|
isApplicable: gp,
|
|
957
957
|
serialize: (e) => e.serialize(),
|
|
958
|
-
deserialize: (e) =>
|
|
958
|
+
deserialize: (e) => T2(e)
|
|
959
959
|
}, "RelativeDateFilter");
|
|
960
|
-
|
|
960
|
+
h2.registerCustom({
|
|
961
961
|
isApplicable: sp,
|
|
962
962
|
serialize: (e) => e.serialize(),
|
|
963
|
-
deserialize: (e) =>
|
|
963
|
+
deserialize: (e) => T2(e)
|
|
964
964
|
}, "CustomFilter");
|
|
965
|
-
var
|
|
966
|
-
var
|
|
967
|
-
function
|
|
965
|
+
var ni = h2;
|
|
966
|
+
var E3 = "DM.";
|
|
967
|
+
function S2(e) {
|
|
968
968
|
return typeof e == "object" && e !== null;
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function q3(e) {
|
|
971
971
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
return e.every(
|
|
973
|
+
function Ct2(e) {
|
|
974
|
+
return e.every(q3);
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function oe(e) {
|
|
977
977
|
return "attribute" in e && "config" in e;
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function Z(e) {
|
|
980
980
|
return "left" in e && "right" in e && "operator" in e;
|
|
981
981
|
}
|
|
982
|
-
function
|
|
983
|
-
return !
|
|
982
|
+
function xe(e) {
|
|
983
|
+
return !oe(e) && !Z(e);
|
|
984
984
|
}
|
|
985
|
-
function
|
|
986
|
-
return
|
|
985
|
+
function xs(e) {
|
|
986
|
+
return S2(e) && "column" in e && typeof e.column == "string" && !(("function" in e) && ("args" in e));
|
|
987
987
|
}
|
|
988
|
-
function
|
|
989
|
-
return !
|
|
988
|
+
function $s(e) {
|
|
989
|
+
return !S2(e) || !("column" in e) ? false : q3(e.column);
|
|
990
990
|
}
|
|
991
991
|
var x = 3;
|
|
992
|
-
function
|
|
992
|
+
function R(e, t, r) {
|
|
993
993
|
if (t.length === 0)
|
|
994
994
|
return;
|
|
995
995
|
let s = Number.MAX_SAFE_INTEGER, n;
|
|
996
996
|
for (const i of t) {
|
|
997
|
-
const o = r(i), a =
|
|
997
|
+
const o = r(i), a = Yr(e, o);
|
|
998
998
|
a < s && (s = a, n = i);
|
|
999
999
|
}
|
|
1000
1000
|
return n !== undefined ? { best: n, distance: s } : undefined;
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1002
|
+
var Tt = "en";
|
|
1003
|
+
function fe(e, t) {
|
|
1004
|
+
return e.localeCompare(t, Tt, { sensitivity: "accent" }) === 0;
|
|
1005
|
+
}
|
|
1006
|
+
function Ye(e, t) {
|
|
1007
|
+
return t.length <= e.length && e.slice(0, t.length).localeCompare(t, Tt, { sensitivity: "accent" }) === 0;
|
|
1008
|
+
}
|
|
1009
|
+
function $e(e) {
|
|
1003
1010
|
const t = [...e].sort((i, o) => o.name.length - i.name.length), r = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
|
|
1004
1011
|
for (const i of e) {
|
|
1005
1012
|
r.set(i.name, i);
|
|
@@ -1017,61 +1024,61 @@ function xe(e) {
|
|
|
1017
1024
|
columnMap: s
|
|
1018
1025
|
};
|
|
1019
1026
|
}
|
|
1020
|
-
function
|
|
1021
|
-
if (!e.startsWith(
|
|
1022
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1023
|
-
const r = e.slice(
|
|
1027
|
+
function Se2(e, t) {
|
|
1028
|
+
if (!e.startsWith(E3))
|
|
1029
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
|
|
1030
|
+
const r = e.slice(E3.length);
|
|
1024
1031
|
if (!r)
|
|
1025
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1032
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
|
|
1026
1033
|
let s, n;
|
|
1027
|
-
for (const
|
|
1028
|
-
if (r.
|
|
1029
|
-
const
|
|
1030
|
-
if (!
|
|
1031
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1032
|
-
s =
|
|
1034
|
+
for (const m2 of t.sortedTables)
|
|
1035
|
+
if (Ye(r, m2.name + ".")) {
|
|
1036
|
+
const A = r.slice(m2.name.length + 1);
|
|
1037
|
+
if (!A)
|
|
1038
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
|
|
1039
|
+
s = m2, n = A;
|
|
1033
1040
|
break;
|
|
1034
1041
|
}
|
|
1035
1042
|
if (!s) {
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1039
|
-
const
|
|
1040
|
-
throw new Error(`Table '${
|
|
1043
|
+
const m2 = r.indexOf(".");
|
|
1044
|
+
if (m2 === -1)
|
|
1045
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
|
|
1046
|
+
const A = r.slice(0, m2), C2 = R(A, t.sortedTables, (ue) => ue.name), N2 = C2 && C2.distance <= x ? ` Did you mean '${C2.best.name}'?` : "";
|
|
1047
|
+
throw new Error(`Table '${A}' not found in the data model.${N2}`);
|
|
1041
1048
|
}
|
|
1042
1049
|
const i = t.tableColumnMap.get(s.name);
|
|
1043
1050
|
if (!i)
|
|
1044
1051
|
throw new Error(`Table '${s.name}' found but has no columns`);
|
|
1045
1052
|
let o, a;
|
|
1046
1053
|
const u = g.all;
|
|
1047
|
-
for (const
|
|
1048
|
-
if (n
|
|
1049
|
-
return { table: s, column:
|
|
1050
|
-
if (!n.
|
|
1054
|
+
for (const m2 of i) {
|
|
1055
|
+
if (fe(n, m2.name))
|
|
1056
|
+
return { table: s, column: m2 };
|
|
1057
|
+
if (!Ye(n, m2.name + "."))
|
|
1051
1058
|
continue;
|
|
1052
|
-
const
|
|
1053
|
-
if (!
|
|
1059
|
+
const A = n.slice(m2.name.length + 1);
|
|
1060
|
+
if (!A)
|
|
1054
1061
|
continue;
|
|
1055
|
-
const
|
|
1056
|
-
if (
|
|
1057
|
-
if (
|
|
1058
|
-
return { table: s, column:
|
|
1059
|
-
o || (o =
|
|
1062
|
+
const C2 = u.includes(A), N2 = Rn(m2.dataType);
|
|
1063
|
+
if (C2) {
|
|
1064
|
+
if (N2)
|
|
1065
|
+
return { table: s, column: m2, level: A };
|
|
1066
|
+
o || (o = m2, a = A);
|
|
1060
1067
|
continue;
|
|
1061
1068
|
}
|
|
1062
|
-
|
|
1069
|
+
N2 && !o && (o = m2, a = A);
|
|
1063
1070
|
}
|
|
1064
1071
|
if (o && a) {
|
|
1065
1072
|
if (u.includes(a))
|
|
1066
1073
|
throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Column '${s.name}.${o.name}' is not a datetime column`);
|
|
1067
|
-
const
|
|
1068
|
-
throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(", ")}.${
|
|
1074
|
+
const m2 = R(a, u, (C2) => C2), A = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
|
|
1075
|
+
throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(", ")}.${A}`);
|
|
1069
1076
|
}
|
|
1070
|
-
const c = n.indexOf("."),
|
|
1071
|
-
throw new Error(`Column '${
|
|
1077
|
+
const c = n.indexOf("."), p2 = c === -1 ? n : n.slice(0, c), l = R(n, i, (m2) => m2.name), d = l && l.distance <= x && !fe(l.best.name, p2), b2 = d ? ` Did you mean '${l.best.name}'?` : "", g2 = !d && n.endsWith(".") && l !== undefined && fe(l.best.name, p2) ? ` Use '${p2}' without a trailing dot.` : "";
|
|
1078
|
+
throw new Error(`Column '${p2}' not found in table '${s.name}'.${b2}${g2}`);
|
|
1072
1079
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const { table: r, column: s, level: n } =
|
|
1080
|
+
function Ss(e, t) {
|
|
1081
|
+
const { table: r, column: s, level: n } = Se2(e, t);
|
|
1075
1082
|
if (n) {
|
|
1076
1083
|
if (!Rn(s.dataType))
|
|
1077
1084
|
throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`);
|
|
@@ -1087,19 +1094,19 @@ function Cs(e, t) {
|
|
|
1087
1094
|
}
|
|
1088
1095
|
return { table: r, column: s, level: n };
|
|
1089
1096
|
}
|
|
1090
|
-
function
|
|
1091
|
-
const { table: n, column: i, level: o } =
|
|
1097
|
+
function H(e, t, r, s) {
|
|
1098
|
+
const { table: n, column: i, level: o } = Ss(e, r);
|
|
1092
1099
|
let a = o;
|
|
1093
1100
|
if (Rn(i.dataType) && a === undefined && (s != null && s.inferredDateLevel)) {
|
|
1094
1101
|
const u = s.inferredDateLevel, c = g.all;
|
|
1095
1102
|
if (!c.includes(u))
|
|
1096
1103
|
throw new Error(`Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`);
|
|
1097
|
-
const
|
|
1104
|
+
const p2 = `${e}.${u}`, l = g.dateOnly;
|
|
1098
1105
|
if (i.dataType === "date" && !l.includes(u))
|
|
1099
|
-
throw new Error(`Invalid level '${u}' in dimensional element '${
|
|
1100
|
-
const
|
|
1101
|
-
if (i.dataType === "time" && !
|
|
1102
|
-
throw new Error(`Invalid level '${u}' in dimensional element '${
|
|
1106
|
+
throw new Error(`Invalid level '${u}' in dimensional element '${p2}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`);
|
|
1107
|
+
const d = g.timeOnly;
|
|
1108
|
+
if (i.dataType === "time" && !d.includes(u))
|
|
1109
|
+
throw new Error(`Invalid level '${u}' in dimensional element '${p2}'. Column '${n.name}.${i.name}' is only a time column, not a date column`);
|
|
1103
1110
|
a = u;
|
|
1104
1111
|
}
|
|
1105
1112
|
return Ln({
|
|
@@ -1111,10 +1118,10 @@ function G(e, t, r, s) {
|
|
|
1111
1118
|
dataSource: t
|
|
1112
1119
|
});
|
|
1113
1120
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const { column: s, level: n } =
|
|
1121
|
+
function Os(e, t, r) {
|
|
1122
|
+
const { column: s, level: n } = Se2(e, r);
|
|
1116
1123
|
if (n)
|
|
1117
|
-
throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${
|
|
1124
|
+
throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${E3}TableName.ColumnName'`);
|
|
1118
1125
|
if (!Rn(s.dataType))
|
|
1119
1126
|
throw new Error(`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`);
|
|
1120
1127
|
return q({
|
|
@@ -1123,32 +1130,32 @@ function Es(e, t, r) {
|
|
|
1123
1130
|
dataSource: t
|
|
1124
1131
|
});
|
|
1125
1132
|
}
|
|
1126
|
-
var
|
|
1133
|
+
var Ds = (e, t) => {
|
|
1127
1134
|
if (!e)
|
|
1128
1135
|
return;
|
|
1129
1136
|
const r = typeof e == "object" ? e.direction : e;
|
|
1130
1137
|
if (!Lp(r))
|
|
1131
|
-
return F(
|
|
1138
|
+
return F(y2({}, t), {
|
|
1132
1139
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
|
|
1133
1140
|
});
|
|
1134
1141
|
};
|
|
1135
|
-
var
|
|
1136
|
-
const n =
|
|
1142
|
+
var Ms = (e, t, r, s) => {
|
|
1143
|
+
const n = Ds(e.sortType, s);
|
|
1137
1144
|
if (n)
|
|
1138
1145
|
return {
|
|
1139
|
-
attribute:
|
|
1146
|
+
attribute: H(e.column, t, r),
|
|
1140
1147
|
style: {},
|
|
1141
1148
|
error: n
|
|
1142
1149
|
};
|
|
1143
|
-
const i =
|
|
1150
|
+
const i = H(e.column, t, r), o = ed(e, "column");
|
|
1144
1151
|
return { attribute: i, style: o };
|
|
1145
1152
|
};
|
|
1146
|
-
var
|
|
1147
|
-
error: F(
|
|
1153
|
+
var Ns = (e, t, r, s) => typeof e == "string" ? { attribute: H(e, t, r) } : xs(e) ? Ms(e, t, r, s) : {
|
|
1154
|
+
error: F(y2({}, s), {
|
|
1148
1155
|
message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
|
|
1149
1156
|
})
|
|
1150
1157
|
};
|
|
1151
|
-
var
|
|
1158
|
+
var qt = (e) => {
|
|
1152
1159
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
1153
1160
|
if (!t)
|
|
1154
1161
|
return { success: true, data: [] };
|
|
@@ -1172,110 +1179,341 @@ var wt = (e) => {
|
|
|
1172
1179
|
input: o
|
|
1173
1180
|
};
|
|
1174
1181
|
try {
|
|
1175
|
-
const c =
|
|
1182
|
+
const c = Ns(o, r, s, u);
|
|
1176
1183
|
if (c.error) {
|
|
1177
1184
|
i.push(c.error);
|
|
1178
1185
|
return;
|
|
1179
1186
|
}
|
|
1180
1187
|
c.attribute && n.push(c.style !== undefined ? { attribute: c.attribute, style: c.style } : { attribute: c.attribute });
|
|
1181
1188
|
} catch (c) {
|
|
1182
|
-
const
|
|
1183
|
-
i.push(F(
|
|
1189
|
+
const p2 = c instanceof Error ? c.message : "Unknown error";
|
|
1190
|
+
i.push(F(y2({}, u), { message: p2 }));
|
|
1184
1191
|
}
|
|
1185
1192
|
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
1186
1193
|
};
|
|
1187
|
-
function
|
|
1194
|
+
function Oe2(e, t) {
|
|
1188
1195
|
const r = Reflect.get(e, t);
|
|
1189
1196
|
if (typeof r != "function")
|
|
1190
1197
|
throw new Error(`Function '${t}' not found or is not a function`);
|
|
1191
1198
|
return r;
|
|
1192
1199
|
}
|
|
1193
|
-
function
|
|
1194
|
-
const r = e.replace("measureFactory.", ""), n =
|
|
1195
|
-
if (!
|
|
1200
|
+
function Rs(e, t) {
|
|
1201
|
+
const r = e.replace("measureFactory.", ""), n = Oe2(rp, r)(...t);
|
|
1202
|
+
if (!xe(n))
|
|
1196
1203
|
throw new Error(`Function '${e}' did not return a valid Measure`);
|
|
1197
1204
|
return n;
|
|
1198
1205
|
}
|
|
1199
|
-
function
|
|
1200
|
-
const r = e.replace("filterFactory.logic.", ""), n =
|
|
1201
|
-
if (!
|
|
1206
|
+
function vs2(e, t) {
|
|
1207
|
+
const r = e.replace("filterFactory.logic.", ""), n = Oe2(Se, r)(...t);
|
|
1208
|
+
if (!Z(n))
|
|
1202
1209
|
throw new Error(`Function '${e}' did not return a valid FilterRelations`);
|
|
1203
1210
|
return n;
|
|
1204
1211
|
}
|
|
1205
|
-
function
|
|
1212
|
+
function Is(e, t) {
|
|
1206
1213
|
if (e.startsWith("filterFactory.logic."))
|
|
1207
|
-
return
|
|
1208
|
-
const r = e.replace("filterFactory.", ""), n =
|
|
1209
|
-
if (!
|
|
1214
|
+
return vs2(e, t);
|
|
1215
|
+
const r = e.replace("filterFactory.", ""), n = Oe2(mp, r)(...t);
|
|
1216
|
+
if (!oe(n) && !Z(n))
|
|
1210
1217
|
throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
|
|
1211
1218
|
return n;
|
|
1212
1219
|
}
|
|
1213
|
-
function
|
|
1220
|
+
function Ps(e, t) {
|
|
1214
1221
|
const s = e.split(".")[0];
|
|
1215
1222
|
if (s === "measureFactory")
|
|
1216
|
-
return
|
|
1223
|
+
return Rs(e, t);
|
|
1217
1224
|
if (s === "filterFactory")
|
|
1218
|
-
return
|
|
1225
|
+
return Is(e, t);
|
|
1219
1226
|
throw new Error(`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`);
|
|
1220
1227
|
}
|
|
1221
|
-
var
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1228
|
+
var f2 = (e, t, r, s) => y2({ category: e, minArgs: t, maxArgs: r }, s);
|
|
1229
|
+
var ks = /* @__PURE__ */ new Set([
|
|
1230
|
+
"CORREL",
|
|
1231
|
+
"COVARP",
|
|
1232
|
+
"COVAR",
|
|
1233
|
+
"EXPONDIST",
|
|
1234
|
+
"INTERCEPT",
|
|
1235
|
+
"LARGEST",
|
|
1236
|
+
"NORMDIST",
|
|
1237
|
+
"POISSONDIST",
|
|
1238
|
+
"SKEWP",
|
|
1239
|
+
"SKEW",
|
|
1240
|
+
"SLOPE",
|
|
1241
|
+
"TDIST",
|
|
1242
|
+
"COSH",
|
|
1243
|
+
"SINH",
|
|
1244
|
+
"TANH",
|
|
1245
|
+
"ORDERING",
|
|
1246
|
+
"RDOUBLE",
|
|
1247
|
+
"RINT"
|
|
1248
|
+
]);
|
|
1249
|
+
var te = {
|
|
1250
|
+
SDIFF: f2("xdiff", 2, 2, {
|
|
1225
1251
|
requiredDateLevel: g.Seconds,
|
|
1226
1252
|
argType: "datetime"
|
|
1227
|
-
},
|
|
1228
|
-
MNDIFF: {
|
|
1229
|
-
category: "time-diff",
|
|
1230
|
-
argCount: 2,
|
|
1253
|
+
}),
|
|
1254
|
+
MNDIFF: f2("xdiff", 2, 2, {
|
|
1231
1255
|
requiredDateLevel: g.Minutes,
|
|
1232
1256
|
argType: "datetime"
|
|
1233
|
-
},
|
|
1234
|
-
HDIFF: {
|
|
1235
|
-
category: "time-diff",
|
|
1236
|
-
argCount: 2,
|
|
1257
|
+
}),
|
|
1258
|
+
HDIFF: f2("xdiff", 2, 2, {
|
|
1237
1259
|
requiredDateLevel: g.Hours,
|
|
1238
1260
|
argType: "datetime"
|
|
1239
|
-
},
|
|
1240
|
-
DDIFF: {
|
|
1241
|
-
category: "time-diff",
|
|
1242
|
-
argCount: 2,
|
|
1261
|
+
}),
|
|
1262
|
+
DDIFF: f2("xdiff", 2, 2, {
|
|
1243
1263
|
requiredDateLevel: g.Days,
|
|
1244
1264
|
argType: "datetime"
|
|
1245
|
-
},
|
|
1246
|
-
MDIFF: {
|
|
1247
|
-
category: "time-diff",
|
|
1248
|
-
argCount: 2,
|
|
1265
|
+
}),
|
|
1266
|
+
MDIFF: f2("xdiff", 2, 2, {
|
|
1249
1267
|
requiredDateLevel: g.Months,
|
|
1250
1268
|
argType: "datetime"
|
|
1251
|
-
},
|
|
1252
|
-
QDIFF: {
|
|
1253
|
-
category: "time-diff",
|
|
1254
|
-
argCount: 2,
|
|
1269
|
+
}),
|
|
1270
|
+
QDIFF: f2("xdiff", 2, 2, {
|
|
1255
1271
|
requiredDateLevel: g.Quarters,
|
|
1256
1272
|
argType: "datetime"
|
|
1257
|
-
},
|
|
1258
|
-
YDIFF: {
|
|
1259
|
-
category: "time-diff",
|
|
1260
|
-
argCount: 2,
|
|
1273
|
+
}),
|
|
1274
|
+
YDIFF: f2("xdiff", 2, 2, {
|
|
1261
1275
|
requiredDateLevel: g.Years,
|
|
1262
1276
|
argType: "datetime"
|
|
1263
|
-
}
|
|
1277
|
+
}),
|
|
1278
|
+
ANYVALUE: f2("aggregative", 1, 1),
|
|
1279
|
+
SUM: f2("aggregative", 1, 2),
|
|
1280
|
+
AVG: f2("aggregative", 1, 2),
|
|
1281
|
+
MIN: f2("aggregative", 1, 2),
|
|
1282
|
+
MAX: f2("aggregative", 1, 2),
|
|
1283
|
+
COUNT: f2("aggregative", 1, 2),
|
|
1284
|
+
DUPCOUNT: f2("aggregative", 1, 1),
|
|
1285
|
+
COUNTDUPLICATES: f2("aggregative", 1, 1),
|
|
1286
|
+
STDEV: f2("aggregative", 1, 2),
|
|
1287
|
+
STDEVP: f2("aggregative", 1, 2),
|
|
1288
|
+
VAR: f2("aggregative", 1, 2),
|
|
1289
|
+
VARP: f2("aggregative", 1, 2),
|
|
1290
|
+
MEDIAN: f2("aggregative", 1, 2),
|
|
1291
|
+
QUARTILE: f2("aggregative", 2, 3),
|
|
1292
|
+
PERCENTILE: f2("aggregative", 2, 3),
|
|
1293
|
+
LOWERWHISKERMAX_IQR: f2("aggregative", 1, 1),
|
|
1294
|
+
LOWERWHISKERMAX_STDEVP: f2("aggregative", 1, 1),
|
|
1295
|
+
UPPERWHISKERMIN_IQR: f2("aggregative", 1, 1),
|
|
1296
|
+
UPPERWHISKERMIN_STDEVP: f2("aggregative", 1, 1),
|
|
1297
|
+
OUTLIERSCOUNT_IQR: f2("aggregative", 1, 1),
|
|
1298
|
+
OUTLIERSCOUNT_STDEVP: f2("aggregative", 1, 1),
|
|
1299
|
+
MODE: f2("aggregative", 1, 1),
|
|
1300
|
+
NOAGGFUNCTION: f2("aggregative", 1, 1),
|
|
1301
|
+
RANK: f2("window", 0, Number.POSITIVE_INFINITY),
|
|
1302
|
+
RSUM: f2("window", 1, 2),
|
|
1303
|
+
RAVG: f2("window", 1, 2),
|
|
1304
|
+
YTDSUM: f2("window", 1, 1),
|
|
1305
|
+
QTDSUM: f2("window", 1, 1),
|
|
1306
|
+
MTDSUM: f2("window", 1, 1),
|
|
1307
|
+
WTDSUM: f2("window", 1, 1),
|
|
1308
|
+
YTDAVG: f2("window", 1, 1),
|
|
1309
|
+
QTDAVG: f2("window", 1, 1),
|
|
1310
|
+
MTDAVG: f2("window", 1, 1),
|
|
1311
|
+
WTDAVG: f2("window", 1, 1),
|
|
1312
|
+
CONCAT: f2("string", 2, Number.POSITIVE_INFINITY),
|
|
1313
|
+
LEFT: f2("string", 2, 2),
|
|
1314
|
+
RIGHT: f2("string", 2, 2),
|
|
1315
|
+
ABS: f2("scalar", 1, 1),
|
|
1316
|
+
ACOS: f2("scalar", 1, 1),
|
|
1317
|
+
ASIN: f2("scalar", 1, 1),
|
|
1318
|
+
ATAN: f2("scalar", 1, 1),
|
|
1319
|
+
CEILING: f2("scalar", 1, 1),
|
|
1320
|
+
CONTRIBUTION: f2("scalar", 1, 1),
|
|
1321
|
+
COS: f2("scalar", 1, 1),
|
|
1322
|
+
COT: f2("scalar", 1, 1),
|
|
1323
|
+
DIFFPASTDAY: f2("scalar", 1, 1),
|
|
1324
|
+
DIFFPASTMONTH: f2("scalar", 1, 1),
|
|
1325
|
+
DIFFPASTPERIOD: f2("scalar", 1, 1),
|
|
1326
|
+
DIFFPASTQUARTER: f2("scalar", 1, 1),
|
|
1327
|
+
DIFFPASTWEEK: f2("scalar", 1, 1),
|
|
1328
|
+
DIFFPASTYEAR: f2("scalar", 1, 1),
|
|
1329
|
+
EXP: f2("scalar", 1, 1),
|
|
1330
|
+
FLOOR: f2("scalar", 1, 1),
|
|
1331
|
+
GROWTH: f2("growth", 1, 1),
|
|
1332
|
+
GROWTHPASTMONTH: f2("growth", 1, 1),
|
|
1333
|
+
GROWTHPASTQUARTER: f2("growth", 1, 1),
|
|
1334
|
+
GROWTHPASTWEEK: f2("growth", 1, 1),
|
|
1335
|
+
GROWTHPASTYEAR: f2("growth", 1, 1),
|
|
1336
|
+
GROWTHRATE: f2("growth", 1, 1),
|
|
1337
|
+
LN: f2("scalar", 1, 1),
|
|
1338
|
+
LOG10: f2("scalar", 1, 1),
|
|
1339
|
+
MINUS: f2("scalar", 1, 1),
|
|
1340
|
+
MOD: f2("scalar", 2, 2),
|
|
1341
|
+
QUOTIENT: f2("scalar", 2, 2),
|
|
1342
|
+
PASTDAY: f2("date", 1, 2),
|
|
1343
|
+
PASTMONTH: f2("date", 1, 2),
|
|
1344
|
+
PASTPERIOD: f2("date", 1, 2),
|
|
1345
|
+
PASTQUARTER: f2("date", 1, 2),
|
|
1346
|
+
PASTWEEK: f2("date", 1, 2),
|
|
1347
|
+
PASTYEAR: f2("date", 1, 2),
|
|
1348
|
+
PERCENTILEDISCFORINTERNALUSEONLY: f2("scalar", 1, 1),
|
|
1349
|
+
PERCENTILECONTFORINTERNALUSEONLY: f2("scalar", 1, 1),
|
|
1350
|
+
POWER: f2("scalar", 2, 2),
|
|
1351
|
+
ROUND: f2("scalar", 2, 2),
|
|
1352
|
+
SIN: f2("scalar", 1, 1),
|
|
1353
|
+
SQRT: f2("scalar", 1, 1),
|
|
1354
|
+
TAN: f2("scalar", 1, 1)
|
|
1264
1355
|
};
|
|
1265
|
-
var
|
|
1266
|
-
function
|
|
1267
|
-
return
|
|
1356
|
+
var Bs = Object.keys(te).filter((e) => te[e].category === "xdiff");
|
|
1357
|
+
function xt() {
|
|
1358
|
+
return Bs;
|
|
1268
1359
|
}
|
|
1269
|
-
function
|
|
1270
|
-
const t =
|
|
1360
|
+
function $t(e) {
|
|
1361
|
+
const t = te[e.toUpperCase()];
|
|
1271
1362
|
return t == null ? undefined : t.requiredDateLevel;
|
|
1272
1363
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1364
|
+
function zs(e, t) {
|
|
1365
|
+
return e === t ? e === 1 ? "1 parameter" : `${e} parameters` : t === Number.POSITIVE_INFINITY ? e <= 1 ? "any number of parameters" : `at least ${e} parameters` : `${e} or ${t} parameters`;
|
|
1366
|
+
}
|
|
1367
|
+
function De(e, t) {
|
|
1368
|
+
const r = [];
|
|
1369
|
+
let s = "", n = 0, i = false, o = null;
|
|
1370
|
+
for (let a = 0;a < e.length; a++) {
|
|
1371
|
+
const u = e[a], c = e[a + 1];
|
|
1372
|
+
if (i) {
|
|
1373
|
+
if (u !== o) {
|
|
1374
|
+
s += u;
|
|
1375
|
+
continue;
|
|
1376
|
+
}
|
|
1377
|
+
if (c === o) {
|
|
1378
|
+
s += u + c, a++;
|
|
1379
|
+
continue;
|
|
1380
|
+
}
|
|
1381
|
+
i = false, o = null, s += u;
|
|
1382
|
+
continue;
|
|
1383
|
+
} else {
|
|
1384
|
+
if (u === "'" || u === '"') {
|
|
1385
|
+
i = true, o = u, s += u;
|
|
1386
|
+
continue;
|
|
1387
|
+
}
|
|
1388
|
+
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
|
|
1389
|
+
r.push(s.trim()), s = "";
|
|
1390
|
+
continue;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
s += u;
|
|
1394
|
+
}
|
|
1395
|
+
return s.trim() && r.push(s.trim()), r;
|
|
1396
|
+
}
|
|
1397
|
+
function Ls(e, t) {
|
|
1398
|
+
let r = 0, s = false, n = null;
|
|
1399
|
+
for (let i = 0;i < e.length; i++) {
|
|
1400
|
+
const o = e[i], a = e[i + 1];
|
|
1401
|
+
if (s) {
|
|
1402
|
+
if (o !== n)
|
|
1403
|
+
continue;
|
|
1404
|
+
if (a === n) {
|
|
1405
|
+
i++;
|
|
1406
|
+
continue;
|
|
1407
|
+
}
|
|
1408
|
+
s = false, n = null;
|
|
1409
|
+
} else {
|
|
1410
|
+
if (o === "'" || o === '"') {
|
|
1411
|
+
s = true, n = o;
|
|
1412
|
+
continue;
|
|
1413
|
+
}
|
|
1414
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0)
|
|
1415
|
+
return i;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
return -1;
|
|
1419
|
+
}
|
|
1420
|
+
function Us(e, t) {
|
|
1421
|
+
if (e[t] !== "(")
|
|
1422
|
+
return -1;
|
|
1423
|
+
let r = 1, s = t + 1, n = false, i = null;
|
|
1424
|
+
for (;s < e.length; ) {
|
|
1425
|
+
const o = e[s], a = e[s + 1];
|
|
1426
|
+
if (n) {
|
|
1427
|
+
if (o !== i) {
|
|
1428
|
+
s++;
|
|
1429
|
+
continue;
|
|
1430
|
+
}
|
|
1431
|
+
if (a === i) {
|
|
1432
|
+
s += 2;
|
|
1433
|
+
continue;
|
|
1434
|
+
}
|
|
1435
|
+
n = false, i = null, s++;
|
|
1436
|
+
} else {
|
|
1437
|
+
if (o === "'" || o === '"') {
|
|
1438
|
+
n = true, i = o, s++;
|
|
1439
|
+
continue;
|
|
1440
|
+
}
|
|
1441
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && --r === 0)
|
|
1442
|
+
return s;
|
|
1443
|
+
s++;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
return -1;
|
|
1447
|
+
}
|
|
1448
|
+
function _s(e) {
|
|
1449
|
+
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
1450
|
+
}
|
|
1451
|
+
function W(e) {
|
|
1452
|
+
if (!e || typeof e != "string")
|
|
1453
|
+
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
|
|
1454
|
+
const t = e.trim();
|
|
1455
|
+
if (!t)
|
|
1456
|
+
throw new Error("Invalid composeCode: empty string");
|
|
1457
|
+
const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
1458
|
+
if (!r)
|
|
1459
|
+
throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
|
|
1460
|
+
const s = r[1], n = r[2], i = St(n);
|
|
1461
|
+
return {
|
|
1462
|
+
function: s,
|
|
1463
|
+
args: i
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
function St(e) {
|
|
1467
|
+
return e.trim() ? De(e, ",").map(Ot) : [];
|
|
1468
|
+
}
|
|
1469
|
+
function Ot(e) {
|
|
1470
|
+
if (!e)
|
|
1471
|
+
throw new Error("Cannot parse empty argument value");
|
|
1472
|
+
if (e === "null")
|
|
1473
|
+
return null;
|
|
1474
|
+
if (e === "undefined")
|
|
1475
|
+
return;
|
|
1476
|
+
if (e === "true")
|
|
1477
|
+
return true;
|
|
1478
|
+
if (e === "false")
|
|
1479
|
+
return false;
|
|
1480
|
+
if (e.match(/^-?\d+(\.\d+)?$/))
|
|
1481
|
+
return parseFloat(e);
|
|
1482
|
+
if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
|
|
1483
|
+
const r = e[0];
|
|
1484
|
+
return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
|
|
1485
|
+
}
|
|
1486
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
1487
|
+
const r = e.slice(1, -1).trim();
|
|
1488
|
+
if (!r)
|
|
1489
|
+
return [];
|
|
1490
|
+
const s = St(r);
|
|
1491
|
+
return s.every((n) => typeof n == "string"), s;
|
|
1492
|
+
}
|
|
1493
|
+
if (e.startsWith("{") && e.endsWith("}")) {
|
|
1494
|
+
const r = e.slice(1, -1).trim();
|
|
1495
|
+
return r ? Ws(r) : {};
|
|
1496
|
+
}
|
|
1497
|
+
return e.includes("(") && e.includes(")") ? W(e) : (e.startsWith("DM."), e);
|
|
1498
|
+
}
|
|
1499
|
+
function Vs(e) {
|
|
1500
|
+
const t = Ls(e, ":");
|
|
1501
|
+
if (t === -1)
|
|
1502
|
+
throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
|
|
1503
|
+
const r = _s(e.slice(0, t).trim()), s = Ot(e.slice(t + 1).trim());
|
|
1504
|
+
return [r, s];
|
|
1505
|
+
}
|
|
1506
|
+
function Ws(e) {
|
|
1507
|
+
if (!e.trim())
|
|
1508
|
+
return {};
|
|
1509
|
+
const t = De(e, ",").map(Vs).filter(([, r]) => r !== null);
|
|
1510
|
+
return Object.fromEntries(t);
|
|
1511
|
+
}
|
|
1512
|
+
var js = /\[(\w[\w.-]*)\]/g;
|
|
1513
|
+
var Dt = /* @__PURE__ */ new Set([
|
|
1275
1514
|
"AVG",
|
|
1276
1515
|
"COUNT",
|
|
1277
1516
|
"DUPCOUNT",
|
|
1278
|
-
"LARGEST",
|
|
1279
1517
|
"MAX",
|
|
1280
1518
|
"MEDIAN",
|
|
1281
1519
|
"MIN",
|
|
@@ -1288,36 +1526,30 @@ var Ct2 = /* @__PURE__ */ new Set([
|
|
|
1288
1526
|
"QTDAVG",
|
|
1289
1527
|
"QTDSUM",
|
|
1290
1528
|
"YTDAVG",
|
|
1291
|
-
"YTDSUM"
|
|
1292
|
-
"CORREL",
|
|
1293
|
-
"COVARP",
|
|
1294
|
-
"COVAR",
|
|
1295
|
-
"SKEWP",
|
|
1296
|
-
"SKEW",
|
|
1297
|
-
"SLOPE"
|
|
1529
|
+
"YTDSUM"
|
|
1298
1530
|
]);
|
|
1299
|
-
var
|
|
1300
|
-
function
|
|
1301
|
-
return
|
|
1531
|
+
var Ks = new RegExp(`\\b(${Array.from(Dt).join("|")})\\s*\\(`, "i");
|
|
1532
|
+
function Mt(e) {
|
|
1533
|
+
return q3(e) ? true : typeof e == "string" && e.startsWith(E3) ? false : S2(e) && ("kind" in e) ? e.kind === "measure" : true;
|
|
1302
1534
|
}
|
|
1303
|
-
function
|
|
1535
|
+
function Gs(e) {
|
|
1304
1536
|
const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set;
|
|
1305
1537
|
let s;
|
|
1306
1538
|
for (;(s = t.exec(e)) !== null; ) {
|
|
1307
1539
|
const n = s[1];
|
|
1308
|
-
|
|
1540
|
+
Dt.has(n.toUpperCase()) || r.add(n);
|
|
1309
1541
|
}
|
|
1310
1542
|
return Array.from(r);
|
|
1311
1543
|
}
|
|
1312
|
-
function
|
|
1544
|
+
function Ys(e) {
|
|
1313
1545
|
return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
|
|
1314
1546
|
}
|
|
1315
|
-
function
|
|
1547
|
+
function Js(e) {
|
|
1316
1548
|
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1317
1549
|
}
|
|
1318
1550
|
var j2 = (e) => e.startsWith("[") ? e : `[${e}]`;
|
|
1319
|
-
var
|
|
1320
|
-
function
|
|
1551
|
+
var Nt2 = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1552
|
+
function Rt(e, t) {
|
|
1321
1553
|
if (t.length === 0)
|
|
1322
1554
|
return [];
|
|
1323
1555
|
const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`, "gi");
|
|
@@ -1327,7 +1559,7 @@ function $t(e, t) {
|
|
|
1327
1559
|
ref2: n[3].trim()
|
|
1328
1560
|
}));
|
|
1329
1561
|
}
|
|
1330
|
-
function
|
|
1562
|
+
function Hs(e, t, r) {
|
|
1331
1563
|
var o, a, u;
|
|
1332
1564
|
const s = Object.keys(t), n = ((o = r.errorPrefix) != null ? o : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
|
|
1333
1565
|
return {
|
|
@@ -1342,196 +1574,263 @@ function zs(e, t, r) {
|
|
|
1342
1574
|
result: { isValid: true, errors: [], warnings: [], references: [], unusedContextKeys: [] }
|
|
1343
1575
|
};
|
|
1344
1576
|
}
|
|
1345
|
-
function
|
|
1577
|
+
function M(e, t) {
|
|
1346
1578
|
e.result.errors.push(t), e.result.isValid = false;
|
|
1347
1579
|
}
|
|
1348
|
-
var
|
|
1349
|
-
function
|
|
1350
|
-
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !
|
|
1351
|
-
r &&
|
|
1580
|
+
var Qs = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
|
|
1581
|
+
function Xs(e) {
|
|
1582
|
+
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !Qs.has(s[1].toUpperCase()));
|
|
1583
|
+
r && M(e, `${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`);
|
|
1352
1584
|
}
|
|
1353
|
-
function
|
|
1585
|
+
function Zs(e, t) {
|
|
1586
|
+
const r = e[t];
|
|
1587
|
+
let s = t + 1;
|
|
1588
|
+
for (;s < e.length; ) {
|
|
1589
|
+
const n = e[s], i = e[s + 1];
|
|
1590
|
+
if (n !== r) {
|
|
1591
|
+
s++;
|
|
1592
|
+
continue;
|
|
1593
|
+
}
|
|
1594
|
+
if (i === r) {
|
|
1595
|
+
s += 2;
|
|
1596
|
+
continue;
|
|
1597
|
+
}
|
|
1598
|
+
return s + 1;
|
|
1599
|
+
}
|
|
1600
|
+
return e.length;
|
|
1601
|
+
}
|
|
1602
|
+
function en(e) {
|
|
1603
|
+
return De(e, ",").filter((t) => t.trim().length > 0).length;
|
|
1604
|
+
}
|
|
1605
|
+
function tn(e, t, r, s) {
|
|
1606
|
+
for (;t < e.length && /\s/.test(e[t]); )
|
|
1607
|
+
t++;
|
|
1608
|
+
if (e[t] !== "(")
|
|
1609
|
+
return t;
|
|
1610
|
+
const n = t, i = Us(e, n);
|
|
1611
|
+
if (i === -1)
|
|
1612
|
+
return n + 1;
|
|
1613
|
+
const o = e.slice(n + 1, i);
|
|
1614
|
+
return s.push({ name: r.toUpperCase(), argCount: en(o) }), s.push(...vt(o)), i + 1;
|
|
1615
|
+
}
|
|
1616
|
+
function vt(e) {
|
|
1617
|
+
const t = [];
|
|
1618
|
+
let r = 0;
|
|
1619
|
+
for (;r < e.length; ) {
|
|
1620
|
+
const s = e[r];
|
|
1621
|
+
if (s === "'" || s === '"') {
|
|
1622
|
+
r = Zs(e, r);
|
|
1623
|
+
continue;
|
|
1624
|
+
}
|
|
1625
|
+
if (/[A-Za-z_]/.test(s)) {
|
|
1626
|
+
const n = r;
|
|
1627
|
+
for (r++;r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
|
|
1628
|
+
r++;
|
|
1629
|
+
const i = e.slice(n, r);
|
|
1630
|
+
r = tn(e, r, i, t);
|
|
1631
|
+
continue;
|
|
1632
|
+
}
|
|
1633
|
+
r++;
|
|
1634
|
+
}
|
|
1635
|
+
return t;
|
|
1636
|
+
}
|
|
1637
|
+
function rn(e) {
|
|
1638
|
+
const t = vt(e.formula), r = /* @__PURE__ */ new Set, s = /* @__PURE__ */ new Set;
|
|
1639
|
+
for (const { name: n, argCount: i } of t) {
|
|
1640
|
+
if (ks.has(n)) {
|
|
1641
|
+
r.has(n) || (r.add(n), M(e, `${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`));
|
|
1642
|
+
continue;
|
|
1643
|
+
}
|
|
1644
|
+
const o = te[n];
|
|
1645
|
+
if (o && (i < o.minArgs || i > o.maxArgs) && !s.has(n)) {
|
|
1646
|
+
s.add(n);
|
|
1647
|
+
const a = zs(o.minArgs, o.maxArgs);
|
|
1648
|
+
M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${a}`);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
function sn(e) {
|
|
1354
1653
|
return [
|
|
1355
|
-
...new Set([...e.matchAll(new RegExp(
|
|
1654
|
+
...new Set([...e.matchAll(new RegExp(js.source, "g"))].map((t) => t[1]))
|
|
1356
1655
|
];
|
|
1357
1656
|
}
|
|
1358
|
-
function
|
|
1657
|
+
function nn(e) {
|
|
1359
1658
|
const t = e.result.references.filter((n) => !e.canonicalContextKeys.has(j2(n)));
|
|
1360
1659
|
if (t.length === 0)
|
|
1361
1660
|
return;
|
|
1362
|
-
const r = e.contextKeys.map((n) => `[${
|
|
1363
|
-
|
|
1661
|
+
const r = e.contextKeys.map((n) => `[${Nt2(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
|
|
1662
|
+
M(e, `${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`);
|
|
1364
1663
|
}
|
|
1365
|
-
function
|
|
1366
|
-
if (
|
|
1664
|
+
function on(e) {
|
|
1665
|
+
if (Ks.test(e.formula))
|
|
1367
1666
|
return;
|
|
1368
1667
|
const t = e.result.references.filter((r) => {
|
|
1369
1668
|
var n;
|
|
1370
1669
|
const s = (n = e.context[j2(r)]) != null ? n : e.context[r];
|
|
1371
|
-
return s !== undefined && !
|
|
1670
|
+
return s !== undefined && !Mt(s);
|
|
1372
1671
|
});
|
|
1373
|
-
t.length !== 0 &&
|
|
1672
|
+
t.length !== 0 && M(e, `${e.errorPrefix}args[1]: ${Js(Gs(e.formula))}Bracket reference(s) ${Ys(t)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`);
|
|
1374
1673
|
}
|
|
1375
|
-
function
|
|
1674
|
+
function an(e) {
|
|
1376
1675
|
if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0)
|
|
1377
1676
|
return;
|
|
1378
1677
|
const t = new Set(e.result.references.map(j2)), r = e.contextKeys.filter((i) => !t.has(j2(i)));
|
|
1379
1678
|
if (e.result.unusedContextKeys = r, r.length === 0)
|
|
1380
1679
|
return;
|
|
1381
|
-
const s = r.map((i) => `[${
|
|
1382
|
-
e.errorOnUnusedContext ?
|
|
1680
|
+
const s = r.map((i) => `[${Nt2(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
|
|
1681
|
+
e.errorOnUnusedContext ? M(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
|
|
1383
1682
|
}
|
|
1384
|
-
function
|
|
1683
|
+
function Je(e, t, r, s) {
|
|
1385
1684
|
var o;
|
|
1386
1685
|
const n = (o = s.context[j2(e)]) != null ? o : s.context[e];
|
|
1387
1686
|
if (n === undefined)
|
|
1388
1687
|
return;
|
|
1389
|
-
if (!(typeof n == "string" && n.startsWith(
|
|
1390
|
-
|
|
1688
|
+
if (!(typeof n == "string" && n.startsWith(E3))) {
|
|
1689
|
+
Mt(n) && M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E3}Table.Column.Level).`);
|
|
1391
1690
|
return;
|
|
1392
1691
|
}
|
|
1393
1692
|
if (s.schemaIndex)
|
|
1394
1693
|
try {
|
|
1395
|
-
const a =
|
|
1396
|
-
Rn(a.column.dataType) ? r && a.level && a.level !== r &&
|
|
1694
|
+
const a = Se2(n, s.schemaIndex);
|
|
1695
|
+
Rn(a.column.dataType) ? r && a.level && a.level !== r && M(s, `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${a.level}'.`) : M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${a.column.name}'.`);
|
|
1397
1696
|
} catch (a) {
|
|
1398
1697
|
const u = a instanceof Error ? a.message : "Unknown error";
|
|
1399
|
-
|
|
1698
|
+
M(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
|
|
1400
1699
|
}
|
|
1401
1700
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const t =
|
|
1701
|
+
function un(e) {
|
|
1702
|
+
const t = xt(), r = Rt(e.formula, t);
|
|
1404
1703
|
for (const s of r) {
|
|
1405
|
-
const n =
|
|
1406
|
-
|
|
1704
|
+
const n = $t(s.functionName);
|
|
1705
|
+
Je(s.ref1, s, n, e), Je(s.ref2, s, n, e);
|
|
1407
1706
|
}
|
|
1408
1707
|
}
|
|
1409
|
-
function
|
|
1708
|
+
function cn(e, t, r = {}) {
|
|
1410
1709
|
var n;
|
|
1411
|
-
const s =
|
|
1412
|
-
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n ||
|
|
1710
|
+
const s = Hs(e, t, r);
|
|
1711
|
+
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Xs(s), rn(s), s.result.references = sn(e), s.result.references.length === 0 ? (s.result.warnings.push(`${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`), s.result) : s.contextKeys.length === 0 ? (M(s, `${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`), s.result) : (nn(s), on(s), an(s), un(s), s.result));
|
|
1413
1712
|
}
|
|
1414
|
-
function
|
|
1415
|
-
const s =
|
|
1713
|
+
function ln(e, t, r = {}) {
|
|
1714
|
+
const s = cn(e, t, r);
|
|
1416
1715
|
if (!s.isValid)
|
|
1417
1716
|
throw new Error(s.errors.join("; "));
|
|
1418
1717
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1419
1718
|
}
|
|
1420
|
-
function
|
|
1719
|
+
function fn(e, t) {
|
|
1421
1720
|
if (e.length < 3 || e.length > 5)
|
|
1422
1721
|
throw new Error(`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`);
|
|
1423
1722
|
const r = e[1];
|
|
1424
1723
|
if (typeof r != "string")
|
|
1425
1724
|
throw new Error(`${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`);
|
|
1426
1725
|
const s = r, n = e[2];
|
|
1427
|
-
if (!
|
|
1726
|
+
if (!S2(n))
|
|
1428
1727
|
throw new Error(`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`);
|
|
1429
1728
|
const i = n;
|
|
1430
|
-
|
|
1729
|
+
ln(s, i, {
|
|
1431
1730
|
errorPrefix: `${t.pathPrefix}`,
|
|
1432
1731
|
errorOnUnusedContext: true,
|
|
1433
1732
|
allowEmptyFormula: false,
|
|
1434
1733
|
schemaIndex: t.schemaIndex
|
|
1435
1734
|
});
|
|
1436
|
-
const o =
|
|
1735
|
+
const o = dn(s), a = {};
|
|
1437
1736
|
for (const [u, c] of Object.entries(i)) {
|
|
1438
|
-
const
|
|
1439
|
-
if (
|
|
1440
|
-
a[`${u}`] =
|
|
1737
|
+
const p2 = `args[2].${u}`;
|
|
1738
|
+
if (q3(c))
|
|
1739
|
+
a[`${u}`] = D({
|
|
1441
1740
|
data: c,
|
|
1442
1741
|
context: {
|
|
1443
1742
|
dataSource: t.dataSource,
|
|
1444
1743
|
schemaIndex: t.schemaIndex,
|
|
1445
|
-
pathPrefix:
|
|
1744
|
+
pathPrefix: p2
|
|
1446
1745
|
}
|
|
1447
1746
|
});
|
|
1448
|
-
else if (typeof c == "string" && c.startsWith(
|
|
1449
|
-
const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u,
|
|
1747
|
+
else if (typeof c == "string" && c.startsWith(E3)) {
|
|
1748
|
+
const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = o[l];
|
|
1450
1749
|
try {
|
|
1451
|
-
a[`${u}`] =
|
|
1452
|
-
} catch (
|
|
1453
|
-
const
|
|
1454
|
-
throw new Error(`${
|
|
1750
|
+
a[`${u}`] = H(c, t.dataSource, t.schemaIndex, d !== undefined ? { inferredDateLevel: d } : undefined);
|
|
1751
|
+
} catch (b2) {
|
|
1752
|
+
const g2 = b2 instanceof Error ? b2.message : "Unknown error";
|
|
1753
|
+
throw new Error(`${p2}: ${g2}`);
|
|
1455
1754
|
}
|
|
1456
1755
|
} else if (c && typeof c == "object" && "kind" in c)
|
|
1457
1756
|
a[`${u}`] = c;
|
|
1458
1757
|
else
|
|
1459
|
-
throw new Error(`${
|
|
1758
|
+
throw new Error(`${p2}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E3}...), but got: ${typeof c}`);
|
|
1460
1759
|
}
|
|
1461
1760
|
e[2] = a;
|
|
1462
1761
|
}
|
|
1463
|
-
function
|
|
1464
|
-
const t =
|
|
1762
|
+
function dn(e) {
|
|
1763
|
+
const t = xt(), r = Rt(e, t), s = {};
|
|
1465
1764
|
for (const n of r) {
|
|
1466
|
-
const i =
|
|
1765
|
+
const i = $t(n.functionName);
|
|
1467
1766
|
if (i !== undefined)
|
|
1468
1767
|
for (const o of [n.ref1, n.ref2]) {
|
|
1469
1768
|
const a = s[o];
|
|
1470
1769
|
if (a !== undefined && a !== i)
|
|
1471
|
-
throw new Error(`Reference [${o}] is used in
|
|
1770
|
+
throw new Error(`Reference [${o}] is used in xdiff functions with conflicting date levels ('${a}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`);
|
|
1472
1771
|
s[o] = i;
|
|
1473
1772
|
}
|
|
1474
1773
|
}
|
|
1475
1774
|
return s;
|
|
1476
1775
|
}
|
|
1477
|
-
function
|
|
1776
|
+
function It(e) {
|
|
1478
1777
|
return e.type === E.TextAttribute;
|
|
1479
1778
|
}
|
|
1480
|
-
function
|
|
1779
|
+
function Pt(e) {
|
|
1481
1780
|
return e.type === E.NumericAttribute;
|
|
1482
1781
|
}
|
|
1483
|
-
function
|
|
1782
|
+
function mn(e) {
|
|
1484
1783
|
return e.type === E.DateLevel;
|
|
1485
1784
|
}
|
|
1486
|
-
function
|
|
1487
|
-
return
|
|
1785
|
+
function pn(e) {
|
|
1786
|
+
return It(e) || Pt(e);
|
|
1488
1787
|
}
|
|
1489
|
-
function
|
|
1788
|
+
function ae(e) {
|
|
1490
1789
|
return e.type === E.TextAttribute ? "text" : e.type === E.NumericAttribute ? "numeric" : e.type === E.DateLevel ? "date/datetime" : "unknown";
|
|
1491
1790
|
}
|
|
1492
|
-
function
|
|
1791
|
+
function Me(e, t) {
|
|
1493
1792
|
const r = e[0];
|
|
1494
1793
|
if (!r || typeof r != "object" || !("type" in r))
|
|
1495
1794
|
throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1496
1795
|
return r;
|
|
1497
1796
|
}
|
|
1498
|
-
function
|
|
1499
|
-
const r =
|
|
1500
|
-
if (!
|
|
1501
|
-
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${
|
|
1797
|
+
function He(e, t) {
|
|
1798
|
+
const r = Me(e, t);
|
|
1799
|
+
if (!pn(r))
|
|
1800
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ae(r)} attribute`);
|
|
1502
1801
|
}
|
|
1503
|
-
function
|
|
1504
|
-
const r =
|
|
1505
|
-
if (!
|
|
1506
|
-
throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${
|
|
1802
|
+
function P(e, t) {
|
|
1803
|
+
const r = Me(e, t);
|
|
1804
|
+
if (!Pt(r))
|
|
1805
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ae(r)} attribute`);
|
|
1507
1806
|
}
|
|
1508
1807
|
function k(e, t) {
|
|
1509
|
-
const r =
|
|
1510
|
-
if (!
|
|
1511
|
-
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${
|
|
1808
|
+
const r = Me(e, t);
|
|
1809
|
+
if (!It(r))
|
|
1810
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${ae(r)} attribute`);
|
|
1512
1811
|
}
|
|
1513
|
-
function
|
|
1812
|
+
function gn(e, t) {
|
|
1514
1813
|
const r = e[0];
|
|
1515
1814
|
if (!r || typeof r != "object" || !("attribute" in r))
|
|
1516
1815
|
throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1517
1816
|
return r;
|
|
1518
1817
|
}
|
|
1519
|
-
function
|
|
1520
|
-
const r =
|
|
1818
|
+
function yn(e, t) {
|
|
1819
|
+
const r = gn(e, t);
|
|
1521
1820
|
if (!ap(r))
|
|
1522
1821
|
throw new Error(`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`);
|
|
1523
1822
|
}
|
|
1524
|
-
var
|
|
1525
|
-
"measureFactory.customFormula":
|
|
1526
|
-
"filterFactory.equals":
|
|
1527
|
-
"filterFactory.doesntEqual":
|
|
1528
|
-
"filterFactory.greaterThan":
|
|
1529
|
-
"filterFactory.greaterThanOrEqual":
|
|
1530
|
-
"filterFactory.lessThan":
|
|
1531
|
-
"filterFactory.lessThanOrEqual":
|
|
1532
|
-
"filterFactory.between":
|
|
1533
|
-
"filterFactory.betweenNotEqual":
|
|
1534
|
-
"filterFactory.numeric":
|
|
1823
|
+
var hn = {
|
|
1824
|
+
"measureFactory.customFormula": fn,
|
|
1825
|
+
"filterFactory.equals": He,
|
|
1826
|
+
"filterFactory.doesntEqual": He,
|
|
1827
|
+
"filterFactory.greaterThan": P,
|
|
1828
|
+
"filterFactory.greaterThanOrEqual": P,
|
|
1829
|
+
"filterFactory.lessThan": P,
|
|
1830
|
+
"filterFactory.lessThanOrEqual": P,
|
|
1831
|
+
"filterFactory.between": P,
|
|
1832
|
+
"filterFactory.betweenNotEqual": P,
|
|
1833
|
+
"filterFactory.numeric": P,
|
|
1535
1834
|
"filterFactory.contains": k,
|
|
1536
1835
|
"filterFactory.doesntContain": k,
|
|
1537
1836
|
"filterFactory.startsWith": k,
|
|
@@ -1539,12 +1838,12 @@ var en = {
|
|
|
1539
1838
|
"filterFactory.endsWith": k,
|
|
1540
1839
|
"filterFactory.doesntEndWith": k,
|
|
1541
1840
|
"filterFactory.like": k,
|
|
1542
|
-
"filterFactory.exclude":
|
|
1841
|
+
"filterFactory.exclude": yn
|
|
1543
1842
|
};
|
|
1544
|
-
function
|
|
1545
|
-
return
|
|
1843
|
+
function bn(e) {
|
|
1844
|
+
return hn[`${e}`];
|
|
1546
1845
|
}
|
|
1547
|
-
var
|
|
1846
|
+
var kt = {
|
|
1548
1847
|
"measureFactory.sum": [
|
|
1549
1848
|
{ type: "Attribute", required: true },
|
|
1550
1849
|
{ type: "string", required: false },
|
|
@@ -1963,18 +2262,18 @@ var St = {
|
|
|
1963
2262
|
{ type: "FilterRelationsNode", required: true }
|
|
1964
2263
|
]
|
|
1965
2264
|
};
|
|
1966
|
-
function
|
|
1967
|
-
return
|
|
2265
|
+
function Ne(e) {
|
|
2266
|
+
return kt[`${e}`];
|
|
1968
2267
|
}
|
|
1969
|
-
function
|
|
1970
|
-
const t =
|
|
2268
|
+
function An(e) {
|
|
2269
|
+
const t = Ne(e);
|
|
1971
2270
|
return t ? t.filter((r) => r.required).length : 0;
|
|
1972
2271
|
}
|
|
1973
|
-
function
|
|
1974
|
-
const t =
|
|
2272
|
+
function Fn(e) {
|
|
2273
|
+
const t = Ne(e);
|
|
1975
2274
|
return t ? t.length : 0;
|
|
1976
2275
|
}
|
|
1977
|
-
function
|
|
2276
|
+
function wn2(e) {
|
|
1978
2277
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
1979
2278
|
return false;
|
|
1980
2279
|
const r = Date.parse(e);
|
|
@@ -1983,27 +2282,27 @@ function nn(e) {
|
|
|
1983
2282
|
const s = new Date(e);
|
|
1984
2283
|
return !isNaN(s.getTime());
|
|
1985
2284
|
}
|
|
1986
|
-
function
|
|
1987
|
-
if (e.startsWith(
|
|
2285
|
+
function de(e, t, r, s) {
|
|
2286
|
+
if (e.startsWith(E3))
|
|
1988
2287
|
try {
|
|
1989
|
-
return
|
|
2288
|
+
return H(e, t, r);
|
|
1990
2289
|
} catch (n) {
|
|
1991
2290
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
1992
2291
|
throw new Error(`${s}: ${i}`);
|
|
1993
2292
|
}
|
|
1994
|
-
throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${
|
|
2293
|
+
throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${E3}TableName.ColumnName[.Level]'`);
|
|
1995
2294
|
}
|
|
1996
|
-
function
|
|
1997
|
-
if (e.startsWith(
|
|
2295
|
+
function En(e, t, r, s) {
|
|
2296
|
+
if (e.startsWith(E3))
|
|
1998
2297
|
try {
|
|
1999
|
-
return
|
|
2298
|
+
return Os(e, t, r);
|
|
2000
2299
|
} catch (n) {
|
|
2001
2300
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2002
2301
|
throw new Error(`${s}: ${i}`);
|
|
2003
2302
|
}
|
|
2004
|
-
throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${
|
|
2303
|
+
throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${E3}TableName.ColumnName'`);
|
|
2005
2304
|
}
|
|
2006
|
-
function
|
|
2305
|
+
function Cn(e) {
|
|
2007
2306
|
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, o = i;
|
|
2008
2307
|
if (t === undefined) {
|
|
2009
2308
|
if (r.required)
|
|
@@ -2039,20 +2338,20 @@ function an(e) {
|
|
|
2039
2338
|
case "Attribute":
|
|
2040
2339
|
if (typeof t != "string")
|
|
2041
2340
|
throw new Error(`${o}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`);
|
|
2042
|
-
return
|
|
2341
|
+
return de(t, s, n, o);
|
|
2043
2342
|
case "Attribute[]":
|
|
2044
2343
|
if (!Array.isArray(t))
|
|
2045
2344
|
throw new Error(`${o}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`);
|
|
2046
2345
|
return t.map((a, u) => {
|
|
2047
2346
|
if (typeof a != "string")
|
|
2048
2347
|
throw new Error(`${o}[${u}]: Expected attribute string, got ${typeof a}`);
|
|
2049
|
-
return
|
|
2348
|
+
return de(a, s, n, `${o}[${u}]`);
|
|
2050
2349
|
});
|
|
2051
2350
|
case "Measure":
|
|
2052
2351
|
case "BaseMeasure":
|
|
2053
|
-
if (!
|
|
2352
|
+
if (!q3(t))
|
|
2054
2353
|
throw new Error(`${o}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`);
|
|
2055
|
-
return
|
|
2354
|
+
return D({
|
|
2056
2355
|
data: t,
|
|
2057
2356
|
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2058
2357
|
});
|
|
@@ -2060,17 +2359,17 @@ function an(e) {
|
|
|
2060
2359
|
if (!Array.isArray(t))
|
|
2061
2360
|
throw new Error(`${o}: Expected array of measure function calls, got ${typeof t}`);
|
|
2062
2361
|
return t.map((a, u) => {
|
|
2063
|
-
if (!
|
|
2362
|
+
if (!q3(a))
|
|
2064
2363
|
throw new Error(`${o}[${u}]: Expected measure function call, got ${typeof a}`);
|
|
2065
|
-
return
|
|
2364
|
+
return D({
|
|
2066
2365
|
data: a,
|
|
2067
2366
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2068
2367
|
});
|
|
2069
2368
|
});
|
|
2070
2369
|
case "Filter":
|
|
2071
|
-
if (!
|
|
2370
|
+
if (!q3(t))
|
|
2072
2371
|
throw new Error(`${o}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`);
|
|
2073
|
-
return
|
|
2372
|
+
return D({
|
|
2074
2373
|
data: t,
|
|
2075
2374
|
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2076
2375
|
});
|
|
@@ -2078,9 +2377,9 @@ function an(e) {
|
|
|
2078
2377
|
if (!Array.isArray(t))
|
|
2079
2378
|
throw new Error(`${o}: Expected array of filter function calls, got ${typeof t}`);
|
|
2080
2379
|
return t.map((a, u) => {
|
|
2081
|
-
if (!
|
|
2380
|
+
if (!q3(a))
|
|
2082
2381
|
throw new Error(`${o}[${u}]: Expected filter function call, got ${typeof a}`);
|
|
2083
|
-
return
|
|
2382
|
+
return D({
|
|
2084
2383
|
data: a,
|
|
2085
2384
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2086
2385
|
});
|
|
@@ -2088,15 +2387,15 @@ function an(e) {
|
|
|
2088
2387
|
case "FilterRelationsNode":
|
|
2089
2388
|
if (Array.isArray(t))
|
|
2090
2389
|
return t.map((a, u) => {
|
|
2091
|
-
if (!
|
|
2390
|
+
if (!q3(a))
|
|
2092
2391
|
throw new Error(`${o}[${u}]: Expected filter function call, got ${typeof a}`);
|
|
2093
|
-
return
|
|
2392
|
+
return D({
|
|
2094
2393
|
data: a,
|
|
2095
2394
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2096
2395
|
});
|
|
2097
2396
|
});
|
|
2098
|
-
if (
|
|
2099
|
-
return
|
|
2397
|
+
if (q3(t))
|
|
2398
|
+
return D({
|
|
2100
2399
|
data: t,
|
|
2101
2400
|
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2102
2401
|
});
|
|
@@ -2104,27 +2403,27 @@ function an(e) {
|
|
|
2104
2403
|
case "DateDimension":
|
|
2105
2404
|
if (typeof t != "string")
|
|
2106
2405
|
throw new Error(`${o}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`);
|
|
2107
|
-
return
|
|
2406
|
+
return En(t, s, n, o);
|
|
2108
2407
|
case "LevelAttribute": {
|
|
2109
2408
|
if (typeof t != "string")
|
|
2110
2409
|
throw new Error(`${o}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`);
|
|
2111
|
-
const a =
|
|
2112
|
-
if (!
|
|
2113
|
-
throw new Error(`${o}: Attribute must be date/datetime type, got ${
|
|
2410
|
+
const a = de(t, s, n, o);
|
|
2411
|
+
if (!mn(a))
|
|
2412
|
+
throw new Error(`${o}: Attribute must be date/datetime type, got ${ae(a)} attribute`);
|
|
2114
2413
|
return a;
|
|
2115
2414
|
}
|
|
2116
2415
|
case "Measure | number":
|
|
2117
2416
|
if (typeof t == "number")
|
|
2118
2417
|
return t;
|
|
2119
|
-
if (
|
|
2120
|
-
return
|
|
2418
|
+
if (q3(t))
|
|
2419
|
+
return D({
|
|
2121
2420
|
data: t,
|
|
2122
2421
|
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2123
2422
|
});
|
|
2124
2423
|
throw new Error(`${o}: Expected measure function call or number, got ${typeof t}`);
|
|
2125
2424
|
case "Date | string":
|
|
2126
2425
|
if (typeof t == "string") {
|
|
2127
|
-
if (
|
|
2426
|
+
if (wn2(t))
|
|
2128
2427
|
return t;
|
|
2129
2428
|
throw new Error(`${o}: Expected valid ISO date string or Date object, got invalid date string '${t}'`);
|
|
2130
2429
|
} else {
|
|
@@ -2147,63 +2446,63 @@ function an(e) {
|
|
|
2147
2446
|
return t;
|
|
2148
2447
|
}
|
|
2149
2448
|
}
|
|
2150
|
-
function
|
|
2151
|
-
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u =
|
|
2449
|
+
function D(e) {
|
|
2450
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u = Ne(i);
|
|
2152
2451
|
if (!u) {
|
|
2153
|
-
const
|
|
2154
|
-
throw new Error(`${a}function: Unknown function '${i}'.${
|
|
2452
|
+
const g2 = Object.keys(kt), m2 = R(i, g2, (C2) => C2), A = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
|
|
2453
|
+
throw new Error(`${a}function: Unknown function '${i}'.${A}`);
|
|
2155
2454
|
}
|
|
2156
|
-
const c =
|
|
2455
|
+
const c = An(i), p2 = Fn(i);
|
|
2157
2456
|
if (o.length < c)
|
|
2158
2457
|
throw new Error(`${a}function: Expected at least ${c} arguments, got ${o.length}`);
|
|
2159
|
-
if (o.length >
|
|
2160
|
-
throw new Error(`${a}function: Expected at most ${
|
|
2161
|
-
const l = [],
|
|
2162
|
-
for (let
|
|
2163
|
-
const
|
|
2164
|
-
if (
|
|
2165
|
-
|
|
2458
|
+
if (o.length > p2)
|
|
2459
|
+
throw new Error(`${a}function: Expected at most ${p2} arguments, got ${o.length}`);
|
|
2460
|
+
const l = [], d = [];
|
|
2461
|
+
for (let g2 = 0;g2 < Math.max(o.length, u.length); g2++) {
|
|
2462
|
+
const m2 = u[`${g2}`], A = o[`${g2}`], C2 = a ? `${a}args[${g2}]` : `args[${g2}]`;
|
|
2463
|
+
if (A === undefined) {
|
|
2464
|
+
m2 != null && m2.required && d.push(`${C2}: Missing required argument (expected ${m2.type})`);
|
|
2166
2465
|
continue;
|
|
2167
2466
|
}
|
|
2168
|
-
if (!
|
|
2169
|
-
|
|
2467
|
+
if (!m2) {
|
|
2468
|
+
d.push(`${C2}: Unexpected argument`);
|
|
2170
2469
|
continue;
|
|
2171
2470
|
}
|
|
2172
2471
|
try {
|
|
2173
|
-
const
|
|
2174
|
-
data:
|
|
2472
|
+
const N2 = Cn({
|
|
2473
|
+
data: A,
|
|
2175
2474
|
context: {
|
|
2176
2475
|
dataSource: r,
|
|
2177
2476
|
schemaIndex: s,
|
|
2178
|
-
pathPrefix:
|
|
2179
|
-
argSchema:
|
|
2477
|
+
pathPrefix: C2,
|
|
2478
|
+
argSchema: m2
|
|
2180
2479
|
}
|
|
2181
2480
|
});
|
|
2182
|
-
l.push(
|
|
2183
|
-
} catch (
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2481
|
+
l.push(N2);
|
|
2482
|
+
} catch (N2) {
|
|
2483
|
+
const ue = N2 instanceof Error ? N2.message : "Unknown error";
|
|
2484
|
+
d.push(ue);
|
|
2186
2485
|
}
|
|
2187
2486
|
}
|
|
2188
|
-
if (
|
|
2189
|
-
const
|
|
2190
|
-
throw new Error(
|
|
2487
|
+
if (d.length > 0) {
|
|
2488
|
+
const g2 = d.join("; ");
|
|
2489
|
+
throw new Error(g2);
|
|
2191
2490
|
}
|
|
2192
|
-
const
|
|
2193
|
-
if (
|
|
2491
|
+
const b2 = bn(i);
|
|
2492
|
+
if (b2)
|
|
2194
2493
|
try {
|
|
2195
|
-
|
|
2494
|
+
b2(l, {
|
|
2196
2495
|
dataSource: r,
|
|
2197
2496
|
schemaIndex: s,
|
|
2198
2497
|
pathPrefix: a
|
|
2199
2498
|
});
|
|
2200
|
-
} catch (
|
|
2201
|
-
const
|
|
2202
|
-
throw new Error(
|
|
2499
|
+
} catch (g2) {
|
|
2500
|
+
const m2 = g2 instanceof Error ? g2.message : "Unknown validation error";
|
|
2501
|
+
throw new Error(m2);
|
|
2203
2502
|
}
|
|
2204
|
-
return
|
|
2503
|
+
return Ps(i, l);
|
|
2205
2504
|
}
|
|
2206
|
-
function
|
|
2505
|
+
function Bt(e) {
|
|
2207
2506
|
const { attribute: t, config: r } = e;
|
|
2208
2507
|
if (ap(e) && Rp(t)) {
|
|
2209
2508
|
const { granularity: s } = t, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), i = Fi(r), o = Object.keys(i).length === 0 ? undefined : i;
|
|
@@ -2211,13 +2510,13 @@ function Ot(e) {
|
|
|
2211
2510
|
}
|
|
2212
2511
|
return e;
|
|
2213
2512
|
}
|
|
2214
|
-
function
|
|
2513
|
+
function Tn(e) {
|
|
2215
2514
|
let t = [];
|
|
2216
2515
|
for (const r of e)
|
|
2217
|
-
|
|
2516
|
+
Z(r) ? t = Mp(r, t) : t = Mp([Bt(r)], t);
|
|
2218
2517
|
return t != null ? t : [];
|
|
2219
2518
|
}
|
|
2220
|
-
var
|
|
2519
|
+
var qn = (e) => {
|
|
2221
2520
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2222
2521
|
return t.forEach((o, a) => {
|
|
2223
2522
|
const u = {
|
|
@@ -2226,20 +2525,20 @@ var cn = (e) => {
|
|
|
2226
2525
|
input: o
|
|
2227
2526
|
};
|
|
2228
2527
|
try {
|
|
2229
|
-
const c =
|
|
2528
|
+
const c = D({
|
|
2230
2529
|
data: o,
|
|
2231
2530
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2232
2531
|
});
|
|
2233
|
-
!
|
|
2532
|
+
!Z(c) && !oe(c) ? i.push(F(y2({}, u), { message: "Invalid filter JSON" })) : n.push(c);
|
|
2234
2533
|
} catch (c) {
|
|
2235
|
-
const
|
|
2236
|
-
i.push(F(
|
|
2534
|
+
const p2 = c instanceof Error ? c.message : "Unknown error";
|
|
2535
|
+
i.push(F(y2({}, u), { message: p2 }));
|
|
2237
2536
|
}
|
|
2238
|
-
}), i.length > 0 ? { success: false, errors: i } : { success: true, data:
|
|
2537
|
+
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: Tn(n) };
|
|
2239
2538
|
};
|
|
2240
|
-
var
|
|
2539
|
+
var Re = (e) => {
|
|
2241
2540
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2242
|
-
return t ?
|
|
2541
|
+
return t ? Ct2(t) ? qn({
|
|
2243
2542
|
data: t,
|
|
2244
2543
|
context: { dataSource: r, schemaIndex: s }
|
|
2245
2544
|
}) : {
|
|
@@ -2254,7 +2553,7 @@ var Oe2 = (e) => {
|
|
|
2254
2553
|
]
|
|
2255
2554
|
} : { success: true, data: [] };
|
|
2256
2555
|
};
|
|
2257
|
-
var
|
|
2556
|
+
var xn = (e) => {
|
|
2258
2557
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2259
2558
|
return t.forEach((o, a) => {
|
|
2260
2559
|
const u = {
|
|
@@ -2263,20 +2562,20 @@ var ln = (e) => {
|
|
|
2263
2562
|
input: o
|
|
2264
2563
|
};
|
|
2265
2564
|
try {
|
|
2266
|
-
const c =
|
|
2565
|
+
const c = D({
|
|
2267
2566
|
data: o,
|
|
2268
2567
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2269
2568
|
});
|
|
2270
|
-
|
|
2569
|
+
oe(c) ? n.push(Bt(c)) : i.push(F(y2({}, u), { message: "Invalid filter JSON" }));
|
|
2271
2570
|
} catch (c) {
|
|
2272
|
-
const
|
|
2273
|
-
i.push(F(
|
|
2571
|
+
const p2 = c instanceof Error ? c.message : "Unknown error";
|
|
2572
|
+
i.push(F(y2({}, u), { message: p2 }));
|
|
2274
2573
|
}
|
|
2275
2574
|
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
2276
2575
|
};
|
|
2277
|
-
var
|
|
2576
|
+
var ve = (e) => {
|
|
2278
2577
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2279
|
-
return t ?
|
|
2578
|
+
return t ? Ct2(t) ? xn({
|
|
2280
2579
|
data: t,
|
|
2281
2580
|
context: { dataSource: r, schemaIndex: s }
|
|
2282
2581
|
}) : {
|
|
@@ -2291,42 +2590,42 @@ var Me = (e) => {
|
|
|
2291
2590
|
]
|
|
2292
2591
|
} : { success: true, data: [] };
|
|
2293
2592
|
};
|
|
2294
|
-
var
|
|
2593
|
+
var $n = (e, t) => {
|
|
2295
2594
|
if (e && !Lp(e))
|
|
2296
|
-
return F(
|
|
2595
|
+
return F(y2({}, t), {
|
|
2297
2596
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
|
|
2298
2597
|
});
|
|
2299
2598
|
};
|
|
2300
|
-
var
|
|
2599
|
+
var Sn = (e, t, r) => {
|
|
2301
2600
|
const { dataSource: s, schemaIndex: n } = t;
|
|
2302
2601
|
try {
|
|
2303
|
-
const i =
|
|
2602
|
+
const i = D({
|
|
2304
2603
|
data: e,
|
|
2305
2604
|
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2306
2605
|
});
|
|
2307
|
-
return
|
|
2606
|
+
return xe(i) ? { success: true, data: i } : {
|
|
2308
2607
|
success: false,
|
|
2309
|
-
errors: [F(
|
|
2608
|
+
errors: [F(y2({}, r), { message: "Invalid measure JSON" })]
|
|
2310
2609
|
};
|
|
2311
2610
|
} catch (i) {
|
|
2312
2611
|
const o = i instanceof Error ? i.message : "Unknown error";
|
|
2313
2612
|
return {
|
|
2314
2613
|
success: false,
|
|
2315
|
-
errors: [F(
|
|
2614
|
+
errors: [F(y2({}, r), { message: o })]
|
|
2316
2615
|
};
|
|
2317
2616
|
}
|
|
2318
2617
|
};
|
|
2319
|
-
var
|
|
2320
|
-
const n =
|
|
2618
|
+
var On = (e, t, r, s) => {
|
|
2619
|
+
const n = D({
|
|
2321
2620
|
data: e.column,
|
|
2322
2621
|
context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
|
|
2323
2622
|
});
|
|
2324
|
-
if (!
|
|
2623
|
+
if (!xe(n))
|
|
2325
2624
|
return {
|
|
2326
2625
|
style: {},
|
|
2327
|
-
error: F(
|
|
2626
|
+
error: F(y2({}, s), { message: "Invalid measure JSON" })
|
|
2328
2627
|
};
|
|
2329
|
-
const i =
|
|
2628
|
+
const i = $n(e.sortType, s);
|
|
2330
2629
|
if (i) {
|
|
2331
2630
|
const a = ed(e, "column");
|
|
2332
2631
|
return { measure: n, style: a, error: i };
|
|
@@ -2334,20 +2633,20 @@ var mn = (e, t, r, s) => {
|
|
|
2334
2633
|
const o = ed(e, "column");
|
|
2335
2634
|
return { measure: n, style: o };
|
|
2336
2635
|
};
|
|
2337
|
-
var
|
|
2338
|
-
if (
|
|
2339
|
-
return
|
|
2340
|
-
if (
|
|
2341
|
-
const n =
|
|
2636
|
+
var Dn = (e, t, r, s) => {
|
|
2637
|
+
if ($s(e))
|
|
2638
|
+
return On(e, t, r, s);
|
|
2639
|
+
if (q3(e)) {
|
|
2640
|
+
const n = Sn(e, { dataSource: t, schemaIndex: r }, s);
|
|
2342
2641
|
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2343
2642
|
}
|
|
2344
2643
|
return {
|
|
2345
|
-
error: F(
|
|
2644
|
+
error: F(y2({}, s), {
|
|
2346
2645
|
message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
|
|
2347
2646
|
})
|
|
2348
2647
|
};
|
|
2349
2648
|
};
|
|
2350
|
-
var
|
|
2649
|
+
var zt = (e) => {
|
|
2351
2650
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2352
2651
|
if (!t)
|
|
2353
2652
|
return { success: true, data: [] };
|
|
@@ -2371,15 +2670,15 @@ var Mt = (e) => {
|
|
|
2371
2670
|
input: o
|
|
2372
2671
|
};
|
|
2373
2672
|
try {
|
|
2374
|
-
const c =
|
|
2673
|
+
const c = Dn(o, r, s, u);
|
|
2375
2674
|
if (c.error) {
|
|
2376
2675
|
i.push(c.error);
|
|
2377
2676
|
return;
|
|
2378
2677
|
}
|
|
2379
2678
|
c.measure && n.push(c.style !== undefined ? { measure: c.measure, style: c.style } : { measure: c.measure });
|
|
2380
2679
|
} catch (c) {
|
|
2381
|
-
const
|
|
2382
|
-
i.push(F(
|
|
2680
|
+
const p2 = c instanceof Error ? c.message : "Unknown error";
|
|
2681
|
+
i.push(F(y2({}, u), { message: p2 }));
|
|
2383
2682
|
}
|
|
2384
2683
|
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
2385
2684
|
};
|
|
@@ -2394,9 +2693,9 @@ function w(e, t, r) {
|
|
|
2394
2693
|
}
|
|
2395
2694
|
return s.data;
|
|
2396
2695
|
}
|
|
2397
|
-
var
|
|
2398
|
-
var
|
|
2399
|
-
function
|
|
2696
|
+
var Ie = "$trend";
|
|
2697
|
+
var Pe = "$forecast";
|
|
2698
|
+
function Mn(e) {
|
|
2400
2699
|
return e.map(({ attribute: t, style: r }) => {
|
|
2401
2700
|
const s = r == null ? undefined : r.sortType;
|
|
2402
2701
|
if (!s)
|
|
@@ -2405,36 +2704,36 @@ function yn(e) {
|
|
|
2405
2704
|
return Lp(n) ? t.sort(Ap(n)) : t;
|
|
2406
2705
|
});
|
|
2407
2706
|
}
|
|
2408
|
-
function
|
|
2707
|
+
function Nn(e) {
|
|
2409
2708
|
var t, r;
|
|
2410
2709
|
return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false;
|
|
2411
2710
|
}
|
|
2412
|
-
function
|
|
2711
|
+
function Rn2(e) {
|
|
2413
2712
|
var t, r;
|
|
2414
2713
|
return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false;
|
|
2415
2714
|
}
|
|
2416
|
-
function
|
|
2715
|
+
function vn2(e) {
|
|
2417
2716
|
var r, s;
|
|
2418
2717
|
const t = [];
|
|
2419
2718
|
for (const { measure: n, style: i } of e) {
|
|
2420
2719
|
const o = i == null ? undefined : i.sortType, a = o && Lp(o) ? n.sort(Ap(o)) : n;
|
|
2421
|
-
t.push(a), i != null && i.trend && !
|
|
2720
|
+
t.push(a), i != null && i.trend && !Nn(n) && t.push(Ld(n, `${Ie}_${(r = n.name) != null ? r : "Measure"}`, i.trend)), i != null && i.forecast && !Rn2(n) && t.push(Md(n, `${Pe}_${(s = n.name) != null ? s : "Measure"}`, i.forecast));
|
|
2422
2721
|
}
|
|
2423
2722
|
return t;
|
|
2424
2723
|
}
|
|
2425
|
-
var
|
|
2426
|
-
const { data: t } = e, { dataSource: r, tables: s } = e.context, n =
|
|
2724
|
+
var ii = (e) => {
|
|
2725
|
+
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = $e(s), i = [], o = w(() => qt({
|
|
2427
2726
|
data: t.dimensions || [],
|
|
2428
2727
|
context: { dataSource: r, schemaIndex: n }
|
|
2429
|
-
}), i), a = w(() =>
|
|
2728
|
+
}), i), a = w(() => zt({
|
|
2430
2729
|
data: t.measures || [],
|
|
2431
2730
|
context: { dataSource: r, schemaIndex: n }
|
|
2432
|
-
}), i), u = w(() =>
|
|
2731
|
+
}), i), u = w(() => Re({
|
|
2433
2732
|
data: t.filters || [],
|
|
2434
2733
|
context: { dataSource: r, schemaIndex: n }
|
|
2435
2734
|
}), i);
|
|
2436
2735
|
let c = null;
|
|
2437
|
-
return t.highlights && (c = w(() =>
|
|
2736
|
+
return t.highlights && (c = w(() => ve({
|
|
2438
2737
|
data: t.highlights || [],
|
|
2439
2738
|
context: { dataSource: r, schemaIndex: n }
|
|
2440
2739
|
}), i)), i.length > 0 ? {
|
|
@@ -2442,22 +2741,22 @@ var Jn = (e) => {
|
|
|
2442
2741
|
errors: i
|
|
2443
2742
|
} : {
|
|
2444
2743
|
success: true,
|
|
2445
|
-
data:
|
|
2744
|
+
data: y2({
|
|
2446
2745
|
dataSource: Sp(r),
|
|
2447
|
-
dimensions: o ?
|
|
2448
|
-
measures: a ?
|
|
2746
|
+
dimensions: o ? Mn(o) : [],
|
|
2747
|
+
measures: a ? vn2(a) : [],
|
|
2449
2748
|
filters: u || []
|
|
2450
2749
|
}, c && { highlights: c })
|
|
2451
2750
|
};
|
|
2452
2751
|
};
|
|
2453
|
-
function
|
|
2752
|
+
function Qe(e) {
|
|
2454
2753
|
return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
|
|
2455
2754
|
}
|
|
2456
|
-
function
|
|
2755
|
+
function ke(e) {
|
|
2457
2756
|
const t = [], r = [];
|
|
2458
2757
|
return e.forEach((s, n) => {
|
|
2459
|
-
var l,
|
|
2460
|
-
const i =
|
|
2758
|
+
var l, d, b2;
|
|
2759
|
+
const i = Qe(s) ? s.column : s, o = Qe(s) ? s : undefined, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2461
2760
|
if (!i.composeCode) {
|
|
2462
2761
|
r.push({
|
|
2463
2762
|
category: "dimensions",
|
|
@@ -2467,144 +2766,27 @@ function Re(e) {
|
|
|
2467
2766
|
});
|
|
2468
2767
|
return;
|
|
2469
2768
|
}
|
|
2470
|
-
if (!i.composeCode.startsWith(
|
|
2769
|
+
if (!i.composeCode.startsWith(E3)) {
|
|
2471
2770
|
r.push({
|
|
2472
2771
|
category: "dimensions",
|
|
2473
2772
|
index: n,
|
|
2474
2773
|
input: a(),
|
|
2475
|
-
message: `Expected composeCode to start with '${
|
|
2774
|
+
message: `Expected composeCode to start with '${E3}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
|
|
2476
2775
|
});
|
|
2477
2776
|
return;
|
|
2478
2777
|
}
|
|
2479
|
-
const u = (
|
|
2778
|
+
const u = (b2 = o != null && o.sortType ? Ap(o.sortType) : undefined) != null ? b2 : ((l = i.getSort) == null ? undefined : l.call(i)) !== undefined && ((d = i.getSort) == null ? undefined : d.call(i)) !== C.None ? i.getSort() : undefined, c = o ? ed(o, "column") : {};
|
|
2480
2779
|
if (u !== undefined && u !== C.None || o && Object.keys(c).length > 0) {
|
|
2481
|
-
const
|
|
2780
|
+
const g2 = y2(y2({
|
|
2482
2781
|
column: i.composeCode
|
|
2483
2782
|
}, u !== undefined && u !== C.None && { sortType: Tp(u) }), c);
|
|
2484
|
-
t.push(
|
|
2783
|
+
t.push(g2);
|
|
2485
2784
|
} else
|
|
2486
2785
|
t.push(i.composeCode);
|
|
2487
2786
|
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2488
2787
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
let s = "", n = 0, i = false, o = null;
|
|
2492
|
-
for (let a = 0;a < e.length; a++) {
|
|
2493
|
-
const u = e[a], c = e[a + 1];
|
|
2494
|
-
if (i) {
|
|
2495
|
-
if (u !== o) {
|
|
2496
|
-
s += u;
|
|
2497
|
-
continue;
|
|
2498
|
-
}
|
|
2499
|
-
if (c === o) {
|
|
2500
|
-
s += u + c, a++;
|
|
2501
|
-
continue;
|
|
2502
|
-
}
|
|
2503
|
-
i = false, o = null, s += u;
|
|
2504
|
-
continue;
|
|
2505
|
-
} else {
|
|
2506
|
-
if (u === "'" || u === '"') {
|
|
2507
|
-
i = true, o = u, s += u;
|
|
2508
|
-
continue;
|
|
2509
|
-
}
|
|
2510
|
-
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
|
|
2511
|
-
r.push(s.trim()), s = "";
|
|
2512
|
-
continue;
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
s += u;
|
|
2516
|
-
}
|
|
2517
|
-
return s.trim() && r.push(s.trim()), r;
|
|
2518
|
-
}
|
|
2519
|
-
function Fn(e, t) {
|
|
2520
|
-
let r = 0, s = false, n = null;
|
|
2521
|
-
for (let i = 0;i < e.length; i++) {
|
|
2522
|
-
const o = e[i], a = e[i + 1];
|
|
2523
|
-
if (s) {
|
|
2524
|
-
if (o !== n)
|
|
2525
|
-
continue;
|
|
2526
|
-
if (a === n) {
|
|
2527
|
-
i++;
|
|
2528
|
-
continue;
|
|
2529
|
-
}
|
|
2530
|
-
s = false, n = null;
|
|
2531
|
-
} else {
|
|
2532
|
-
if (o === "'" || o === '"') {
|
|
2533
|
-
s = true, n = o;
|
|
2534
|
-
continue;
|
|
2535
|
-
}
|
|
2536
|
-
if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0)
|
|
2537
|
-
return i;
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
return -1;
|
|
2541
|
-
}
|
|
2542
|
-
function wn2(e) {
|
|
2543
|
-
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
2544
|
-
}
|
|
2545
|
-
function V(e) {
|
|
2546
|
-
if (!e || typeof e != "string")
|
|
2547
|
-
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
|
|
2548
|
-
const t = e.trim();
|
|
2549
|
-
if (!t)
|
|
2550
|
-
throw new Error("Invalid composeCode: empty string");
|
|
2551
|
-
const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
2552
|
-
if (!r)
|
|
2553
|
-
throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
|
|
2554
|
-
const s = r[1], n = r[2], i = Nt2(n);
|
|
2555
|
-
return {
|
|
2556
|
-
function: s,
|
|
2557
|
-
args: i
|
|
2558
|
-
};
|
|
2559
|
-
}
|
|
2560
|
-
function Nt2(e) {
|
|
2561
|
-
return e.trim() ? vt(e, ",").map(Rt) : [];
|
|
2562
|
-
}
|
|
2563
|
-
function Rt(e) {
|
|
2564
|
-
if (!e)
|
|
2565
|
-
throw new Error("Cannot parse empty argument value");
|
|
2566
|
-
if (e === "null")
|
|
2567
|
-
return null;
|
|
2568
|
-
if (e === "undefined")
|
|
2569
|
-
return;
|
|
2570
|
-
if (e === "true")
|
|
2571
|
-
return true;
|
|
2572
|
-
if (e === "false")
|
|
2573
|
-
return false;
|
|
2574
|
-
if (e.match(/^-?\d+(\.\d+)?$/))
|
|
2575
|
-
return parseFloat(e);
|
|
2576
|
-
if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
|
|
2577
|
-
const r = e[0];
|
|
2578
|
-
return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
|
|
2579
|
-
}
|
|
2580
|
-
if (e.startsWith("[") && e.endsWith("]")) {
|
|
2581
|
-
const r = e.slice(1, -1).trim();
|
|
2582
|
-
if (!r)
|
|
2583
|
-
return [];
|
|
2584
|
-
const s = Nt2(r);
|
|
2585
|
-
return s.every((n) => typeof n == "string"), s;
|
|
2586
|
-
}
|
|
2587
|
-
if (e.startsWith("{") && e.endsWith("}")) {
|
|
2588
|
-
const r = e.slice(1, -1).trim();
|
|
2589
|
-
return r ? An(r) : {};
|
|
2590
|
-
}
|
|
2591
|
-
return e.includes("(") && e.includes(")") ? V(e) : (e.startsWith("DM."), e);
|
|
2592
|
-
}
|
|
2593
|
-
function qn(e) {
|
|
2594
|
-
const t = Fn(e, ":");
|
|
2595
|
-
if (t === -1)
|
|
2596
|
-
throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
|
|
2597
|
-
const r = wn2(e.slice(0, t).trim()), s = Rt(e.slice(t + 1).trim());
|
|
2598
|
-
return [r, s];
|
|
2599
|
-
}
|
|
2600
|
-
function An(e) {
|
|
2601
|
-
if (!e.trim())
|
|
2602
|
-
return {};
|
|
2603
|
-
const t = vt(e, ",").map(qn).filter(([, r]) => r !== null);
|
|
2604
|
-
return Object.fromEntries(t);
|
|
2605
|
-
}
|
|
2606
|
-
var ge = "Unknown error";
|
|
2607
|
-
function Ie(e) {
|
|
2788
|
+
var be2 = "Unknown error";
|
|
2789
|
+
function Be(e) {
|
|
2608
2790
|
if (!e)
|
|
2609
2791
|
return { success: true, data: [] };
|
|
2610
2792
|
const t = [];
|
|
@@ -2622,9 +2804,9 @@ function Ie(e) {
|
|
|
2622
2804
|
]
|
|
2623
2805
|
};
|
|
2624
2806
|
try {
|
|
2625
|
-
return { success: true, data: [
|
|
2807
|
+
return { success: true, data: [W(e.composeCode)] };
|
|
2626
2808
|
} catch (s) {
|
|
2627
|
-
const n = s instanceof Error ? s.message :
|
|
2809
|
+
const n = s instanceof Error ? s.message : be2;
|
|
2628
2810
|
return {
|
|
2629
2811
|
success: false,
|
|
2630
2812
|
errors: [
|
|
@@ -2651,10 +2833,10 @@ function Ie(e) {
|
|
|
2651
2833
|
return;
|
|
2652
2834
|
}
|
|
2653
2835
|
try {
|
|
2654
|
-
const o =
|
|
2836
|
+
const o = W(s.composeCode);
|
|
2655
2837
|
r.push(o);
|
|
2656
2838
|
} catch (o) {
|
|
2657
|
-
const a = o instanceof Error ? o.message :
|
|
2839
|
+
const a = o instanceof Error ? o.message : be2;
|
|
2658
2840
|
t.push({
|
|
2659
2841
|
category: "filters",
|
|
2660
2842
|
index: n,
|
|
@@ -2664,7 +2846,7 @@ function Ie(e) {
|
|
|
2664
2846
|
}
|
|
2665
2847
|
}), t.length > 0 ? { success: false, errors: t } : { success: true, data: r };
|
|
2666
2848
|
}
|
|
2667
|
-
function
|
|
2849
|
+
function ze(e) {
|
|
2668
2850
|
if (!e)
|
|
2669
2851
|
return { success: true, data: [] };
|
|
2670
2852
|
const t = [], r = [];
|
|
@@ -2680,10 +2862,10 @@ function ke(e) {
|
|
|
2680
2862
|
return;
|
|
2681
2863
|
}
|
|
2682
2864
|
try {
|
|
2683
|
-
const o =
|
|
2865
|
+
const o = W(s.composeCode);
|
|
2684
2866
|
t.push(o);
|
|
2685
2867
|
} catch (o) {
|
|
2686
|
-
const a = o instanceof Error ? o.message :
|
|
2868
|
+
const a = o instanceof Error ? o.message : be2;
|
|
2687
2869
|
r.push({
|
|
2688
2870
|
category: "highlights",
|
|
2689
2871
|
index: n,
|
|
@@ -2693,14 +2875,14 @@ function ke(e) {
|
|
|
2693
2875
|
}
|
|
2694
2876
|
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2695
2877
|
}
|
|
2696
|
-
function
|
|
2878
|
+
function Xe(e) {
|
|
2697
2879
|
return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
|
|
2698
2880
|
}
|
|
2699
|
-
function
|
|
2881
|
+
function Le(e) {
|
|
2700
2882
|
const t = [], r = [];
|
|
2701
2883
|
return e.forEach((s, n) => {
|
|
2702
|
-
var u, c,
|
|
2703
|
-
const i =
|
|
2884
|
+
var u, c, p2;
|
|
2885
|
+
const i = Xe(s) ? s.column : s, o = Xe(s) ? s : undefined, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2704
2886
|
if (!i.composeCode) {
|
|
2705
2887
|
r.push({
|
|
2706
2888
|
category: "measures",
|
|
@@ -2711,42 +2893,42 @@ function Be(e) {
|
|
|
2711
2893
|
return;
|
|
2712
2894
|
}
|
|
2713
2895
|
try {
|
|
2714
|
-
const l =
|
|
2715
|
-
if (
|
|
2716
|
-
const
|
|
2896
|
+
const l = W(i.composeCode), d = (p2 = o != null && o.sortType ? Ap(o.sortType) : undefined) != null ? p2 : ((u = i.getSort) == null ? undefined : u.call(i)) !== undefined && ((c = i.getSort) == null ? undefined : c.call(i)) !== C.None ? i.getSort() : undefined;
|
|
2897
|
+
if (d !== undefined && d !== C.None || o && Object.keys(ed(o, "column")).length > 0) {
|
|
2898
|
+
const g2 = o ? ed(o, "column") : {}, m2 = y2(y2({
|
|
2717
2899
|
column: l
|
|
2718
|
-
},
|
|
2719
|
-
t.push(
|
|
2900
|
+
}, d !== undefined && d !== C.None && { sortType: Tp(d) }), g2);
|
|
2901
|
+
t.push(m2);
|
|
2720
2902
|
} else
|
|
2721
2903
|
t.push(l);
|
|
2722
2904
|
} catch (l) {
|
|
2723
|
-
const
|
|
2905
|
+
const d = l instanceof Error ? l.message : "Unknown error";
|
|
2724
2906
|
r.push({
|
|
2725
2907
|
category: "measures",
|
|
2726
2908
|
index: n,
|
|
2727
2909
|
input: a(),
|
|
2728
|
-
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${
|
|
2910
|
+
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${d}. ComposeCode: '${i.composeCode}'`
|
|
2729
2911
|
});
|
|
2730
2912
|
}
|
|
2731
2913
|
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2732
2914
|
}
|
|
2733
|
-
function
|
|
2915
|
+
function Ze(e) {
|
|
2734
2916
|
var t, r, s, n;
|
|
2735
|
-
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(
|
|
2917
|
+
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Ie)) != null ? n : false);
|
|
2736
2918
|
}
|
|
2737
|
-
function
|
|
2919
|
+
function et(e) {
|
|
2738
2920
|
var t, r, s, n;
|
|
2739
|
-
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(
|
|
2921
|
+
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Pe)) != null ? n : false);
|
|
2740
2922
|
}
|
|
2741
|
-
function
|
|
2923
|
+
function tt(e) {
|
|
2742
2924
|
try {
|
|
2743
|
-
const t =
|
|
2925
|
+
const t = W(e.trim());
|
|
2744
2926
|
return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : undefined;
|
|
2745
2927
|
} catch (t) {
|
|
2746
2928
|
return;
|
|
2747
2929
|
}
|
|
2748
2930
|
}
|
|
2749
|
-
function
|
|
2931
|
+
function In(e) {
|
|
2750
2932
|
var s, n, i;
|
|
2751
2933
|
if (!(e != null && e.length))
|
|
2752
2934
|
return [];
|
|
@@ -2755,35 +2937,35 @@ function Cn(e) {
|
|
|
2755
2937
|
if (t.has(o))
|
|
2756
2938
|
continue;
|
|
2757
2939
|
const a = e[o];
|
|
2758
|
-
if (
|
|
2940
|
+
if (Ze(a) || et(a)) {
|
|
2759
2941
|
r.push(a);
|
|
2760
2942
|
continue;
|
|
2761
2943
|
}
|
|
2762
|
-
const u = (s = a.name) != null ? s : "Measure", c = `${
|
|
2763
|
-
let l,
|
|
2764
|
-
if (
|
|
2765
|
-
const
|
|
2766
|
-
|
|
2944
|
+
const u = (s = a.name) != null ? s : "Measure", c = `${Ie}_${u}`, p2 = `${Pe}_${u}`;
|
|
2945
|
+
let l, d, b2 = o + 1;
|
|
2946
|
+
if (b2 < e.length && !t.has(b2) && Ze(e[b2]) && e[b2].name === c) {
|
|
2947
|
+
const g2 = (n = e[b2].composeCode) == null ? undefined : n.trim();
|
|
2948
|
+
g2 && (l = tt(g2), t.add(b2), b2++);
|
|
2767
2949
|
}
|
|
2768
|
-
if (
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2950
|
+
if (b2 < e.length && !t.has(b2) && et(e[b2]) && e[b2].name === p2) {
|
|
2951
|
+
const g2 = (i = e[b2].composeCode) == null ? undefined : i.trim();
|
|
2952
|
+
g2 && (d = tt(g2), t.add(b2));
|
|
2771
2953
|
}
|
|
2772
|
-
l !== undefined ||
|
|
2954
|
+
l !== undefined || d !== undefined ? r.push(y2(y2({
|
|
2773
2955
|
column: a
|
|
2774
|
-
}, l && Object.keys(l).length > 0 && { trend: l }),
|
|
2956
|
+
}, l && Object.keys(l).length > 0 && { trend: l }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(a);
|
|
2775
2957
|
}
|
|
2776
2958
|
return r;
|
|
2777
2959
|
}
|
|
2778
|
-
function
|
|
2779
|
-
const t = [], r = w(() =>
|
|
2960
|
+
function oi(e) {
|
|
2961
|
+
const t = [], r = w(() => ke(e.dimensions || []), t), s = In(e.measures || []), n = w(() => Le(s), t), i = w(() => Be(e.filters), t);
|
|
2780
2962
|
let o = null;
|
|
2781
|
-
if (e.highlights && e.highlights.length > 0 && (o = w(() =>
|
|
2963
|
+
if (e.highlights && e.highlights.length > 0 && (o = w(() => ze(e.highlights), t)), t.length > 0)
|
|
2782
2964
|
return {
|
|
2783
2965
|
success: false,
|
|
2784
2966
|
errors: t
|
|
2785
2967
|
};
|
|
2786
|
-
const a =
|
|
2968
|
+
const a = y2({
|
|
2787
2969
|
dimensions: r || [],
|
|
2788
2970
|
measures: n || [],
|
|
2789
2971
|
filters: i || []
|
|
@@ -2793,9 +2975,9 @@ function Yn(e) {
|
|
|
2793
2975
|
data: Q(a)
|
|
2794
2976
|
};
|
|
2795
2977
|
}
|
|
2796
|
-
var
|
|
2797
|
-
var
|
|
2798
|
-
function
|
|
2978
|
+
var Lt = new Set(Xp.filter((e) => e !== "image"));
|
|
2979
|
+
var rt = Object.freeze([...Lt]);
|
|
2980
|
+
function Zn(e) {
|
|
2799
2981
|
const { filters: t, relations: r } = bp(e.filters || []);
|
|
2800
2982
|
return {
|
|
2801
2983
|
dataSource: e.dataSource,
|
|
@@ -2806,9 +2988,9 @@ function _n(e) {
|
|
|
2806
2988
|
highlights: e.highlights
|
|
2807
2989
|
};
|
|
2808
2990
|
}
|
|
2809
|
-
function
|
|
2810
|
-
const s =
|
|
2991
|
+
function fi(e, t, r = false) {
|
|
2992
|
+
const s = Zn(e), n = jn(s, t);
|
|
2811
2993
|
return Dh(n, r);
|
|
2812
2994
|
}
|
|
2813
2995
|
|
|
2814
|
-
export { y, N, q,
|
|
2996
|
+
export { y, N, q, ni, ii, oi, fi };
|