@sisense/mcp-server 0.2.2 → 0.2.4
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-hspmgr2c.js → ai-qt2rw4p0.js} +999 -959
- package/dist/{index-29n08mw7.js → index-0rmh0qta.js} +5 -5
- package/dist/{index-er0yspcy.js → index-6vz3bc2n.js} +552 -385
- package/dist/{index-vx54d05h.js → index-7ztxzw1b.js} +9 -9
- package/dist/{index-tqba2rwh.js → index-86j7fyp7.js} +406 -245
- package/dist/{index-p1pxtmwn.js → index-bgbnagw5.js} +18 -20
- package/dist/{index-d6843g0v.js → index-jatbeegy.js} +9 -7
- package/dist/{index-dxfb3krz.js → index-jgdfekw7.js} +375 -539
- package/dist/{index-qdth51hx.js → index-k71wsmah.js} +8 -1
- package/dist/{index-atgbxy7h.js → index-mxkgxy04.js} +28981 -27209
- package/dist/{index-vrapm0b4.js → index-p5hr1cfd.js} +458 -331
- package/dist/{index-dcrjg3fk.js → index-z44fq2x1.js} +3 -2
- package/dist/sse-server-0d83pnkk.js +54 -0
- package/dist/{sse-server-brx9qtyd.js → sse-server-22mq7fhc.js} +880 -757
- package/dist/{sse-server-3e0efmg2.js → sse-server-d3yx2z0r.js} +1845 -1825
- package/dist/{sse-server-4jjec4fz.js → sse-server-gcjj2741.js} +2081 -1695
- package/dist/{sse-server-rr3dp62e.js → sse-server-kpkj0hbc.js} +22749 -22399
- package/dist/{sse-server-36t17nga.js → sse-server-qhqncg7f.js} +3555 -3657
- package/dist/{sse-server-txz5g5t0.js → sse-server-rrtgkg21.js} +414 -177
- package/dist/{sse-server-nwjjjz6x.js → sse-server-wb2h6nz7.js} +3 -52
- package/dist/{sse-server-qj4zxq0f.js → sse-server-zmcz2c17.js} +12 -24
- package/dist/sse-server.js +96 -52
- package/dist/view.html +609 -544
- package/dist/{widget-renderer-66ws3xtk.js → widget-renderer-wjrpnwpy.js} +12 -12
- package/package.json +4 -4
- package/dist/sse-server-4b60tg0c.js +0 -136
|
@@ -1,72 +1,74 @@
|
|
|
1
1
|
import {
|
|
2
|
-
$r,
|
|
3
2
|
Bi,
|
|
3
|
+
C,
|
|
4
4
|
Cd,
|
|
5
|
-
|
|
6
|
-
Ct,
|
|
5
|
+
Dr,
|
|
7
6
|
E,
|
|
7
|
+
Ed,
|
|
8
8
|
Fi,
|
|
9
9
|
Gh,
|
|
10
|
-
|
|
10
|
+
Hh,
|
|
11
|
+
Ii,
|
|
11
12
|
Jh,
|
|
12
13
|
Kh,
|
|
13
|
-
L,
|
|
14
|
-
Ld,
|
|
15
|
-
Md,
|
|
16
14
|
Nd,
|
|
15
|
+
Ni,
|
|
17
16
|
Nr,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Od,
|
|
18
|
+
Oe,
|
|
19
|
+
Or,
|
|
20
20
|
Qh,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Ri,
|
|
24
|
-
Se,
|
|
25
|
-
Sh,
|
|
21
|
+
Ui,
|
|
22
|
+
Ve,
|
|
26
23
|
Vh,
|
|
24
|
+
Vt,
|
|
27
25
|
Wh,
|
|
28
26
|
Xh,
|
|
29
27
|
Y,
|
|
30
28
|
Yh,
|
|
31
29
|
Z,
|
|
32
30
|
Zh,
|
|
33
|
-
|
|
34
|
-
_r,
|
|
31
|
+
_d,
|
|
35
32
|
ap,
|
|
36
33
|
be,
|
|
34
|
+
bh,
|
|
37
35
|
bp,
|
|
36
|
+
br,
|
|
38
37
|
dp,
|
|
39
38
|
ep,
|
|
39
|
+
fp,
|
|
40
|
+
ft,
|
|
40
41
|
g,
|
|
41
|
-
gp,
|
|
42
|
-
gt,
|
|
43
42
|
h1 as h,
|
|
44
43
|
ip,
|
|
45
44
|
ji,
|
|
46
45
|
kh,
|
|
47
46
|
m,
|
|
47
|
+
me,
|
|
48
48
|
mp,
|
|
49
49
|
ne,
|
|
50
|
-
|
|
50
|
+
pp,
|
|
51
51
|
qh,
|
|
52
52
|
rp,
|
|
53
53
|
tp,
|
|
54
|
-
vs,
|
|
55
54
|
wd,
|
|
55
|
+
wr,
|
|
56
|
+
wt,
|
|
56
57
|
xd,
|
|
58
|
+
xt,
|
|
57
59
|
ye,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} from "./sse-server-
|
|
60
|
+
ys,
|
|
61
|
+
zh
|
|
62
|
+
} from "./sse-server-d3yx2z0r.js";
|
|
61
63
|
|
|
62
|
-
// node_modules/@sisense/sdk-ui/dist/dimensions-
|
|
63
|
-
class c extends
|
|
64
|
+
// node_modules/@sisense/sdk-ui/dist/dimensions-BiLyFpCg.js
|
|
65
|
+
class c extends br {
|
|
64
66
|
constructor(e, t, s, r, u, m2, l, d, y, a) {
|
|
65
|
-
if (super(e, u || E.Dimension, m2, d, y), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort =
|
|
66
|
-
const { table: g2, column: b } =
|
|
67
|
-
this.composeCode = `${
|
|
67
|
+
if (super(e, u || E.Dimension, m2, d, y), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = C.None, !y && t) {
|
|
68
|
+
const { table: g2, column: b } = Oe(t);
|
|
69
|
+
this.composeCode = `${Ni}.${ft(g2)}.${ft(b)}`;
|
|
68
70
|
}
|
|
69
|
-
this._sort = l ||
|
|
71
|
+
this._sort = l || C.None, this._expression = t, this.setDimensions(r || []), this.setAttributes(s), a && (this.defaultAttribute = a);
|
|
70
72
|
}
|
|
71
73
|
static parseType(e) {
|
|
72
74
|
switch (e) {
|
|
@@ -84,21 +86,21 @@ class c extends yr {
|
|
|
84
86
|
}
|
|
85
87
|
getAttachedName(e, t) {
|
|
86
88
|
let s = e;
|
|
87
|
-
const r =
|
|
89
|
+
const r = me(e);
|
|
88
90
|
return (r === "id" || r === "name" || Object.getOwnPropertyDescriptor(this, r) !== undefined || this[r] !== undefined) && (s = t), s;
|
|
89
91
|
}
|
|
90
92
|
setDimensions(e) {
|
|
91
93
|
this._dimensions = e;
|
|
92
94
|
for (let t = 0;t < e.length; t++) {
|
|
93
95
|
const s = this.getAttachedName(e[t].name, e[t].attributes[0].expression);
|
|
94
|
-
this[
|
|
96
|
+
this[me(s)] = e[t], s != e[t].name && (e[t].name = s);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
setAttributes(e) {
|
|
98
100
|
this._attributes = e || [];
|
|
99
101
|
for (let t = 0;t < e.length; t++) {
|
|
100
102
|
const s = this.getAttachedName(e[t].name, e[t].expression);
|
|
101
|
-
this[
|
|
103
|
+
this[me(s)] = e[t], e[t].name != s && (e[t].name = s);
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
get id() {
|
|
@@ -132,10 +134,10 @@ class c extends yr {
|
|
|
132
134
|
jaql: {
|
|
133
135
|
title: this.name,
|
|
134
136
|
dim: this.expression,
|
|
135
|
-
datatype:
|
|
137
|
+
datatype: ys(this.type)
|
|
136
138
|
}
|
|
137
139
|
};
|
|
138
|
-
return this._sort !=
|
|
140
|
+
return this._sort != C.None && (t.jaql.sort = this._sort == C.Ascending ? "asc" : "desc"), e === true ? t.jaql : t;
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
var z = (i) => i && i.__serializable === "DimensionalDimension";
|
|
@@ -190,9 +192,9 @@ function R(i) {
|
|
|
190
192
|
if (i.attributes) {
|
|
191
193
|
let a;
|
|
192
194
|
for (let g2 = 0;g2 < i.attributes.length; g2++)
|
|
193
|
-
a = i.attributes[g2], l.push(new
|
|
195
|
+
a = i.attributes[g2], l.push(new Ve(a.name, a.expression, a.type, a.description, a.sort, a.dataSource));
|
|
194
196
|
} else
|
|
195
|
-
s && l.push(new
|
|
197
|
+
s && l.push(new Ve(e, s, r, t, u, m2));
|
|
196
198
|
const d = Object.getOwnPropertyNames(i).map((a) => i[a]).filter((a) => E.isDimension(a == null ? undefined : a.type));
|
|
197
199
|
if (d.length == 0 && i.dimensions)
|
|
198
200
|
for (let a = 0;a < i.dimensions.length; a++)
|
|
@@ -206,24 +208,24 @@ function x(i) {
|
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
// node_modules/@sisense/sdk-ui/dist/analytics-composer/node.js
|
|
209
|
-
var
|
|
210
|
-
var
|
|
211
|
-
var
|
|
212
|
-
var
|
|
213
|
-
var
|
|
214
|
-
var
|
|
215
|
-
var
|
|
216
|
-
var
|
|
211
|
+
var er = Object.defineProperty;
|
|
212
|
+
var rr = Object.defineProperties;
|
|
213
|
+
var tr = Object.getOwnPropertyDescriptors;
|
|
214
|
+
var ye2 = Object.getOwnPropertySymbols;
|
|
215
|
+
var sr = Object.prototype.hasOwnProperty;
|
|
216
|
+
var nr = Object.prototype.propertyIsEnumerable;
|
|
217
|
+
var ge = (e, r, t) => (r in e) ? er(e, r, { enumerable: true, configurable: true, writable: true, value: t }) : e[r] = t;
|
|
218
|
+
var g2 = (e, r) => {
|
|
217
219
|
for (var t in r || (r = {}))
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
for (var t of
|
|
221
|
-
|
|
220
|
+
sr.call(r, t) && ge(e, t, r[t]);
|
|
221
|
+
if (ye2)
|
|
222
|
+
for (var t of ye2(r))
|
|
223
|
+
nr.call(r, t) && ge(e, t, r[t]);
|
|
222
224
|
return e;
|
|
223
225
|
};
|
|
224
|
-
var
|
|
226
|
+
var h2 = (e, r) => rr(e, tr(r));
|
|
225
227
|
|
|
226
|
-
class
|
|
228
|
+
class st {
|
|
227
229
|
constructor() {
|
|
228
230
|
this.keyToValue = /* @__PURE__ */ new Map, this.valueToKey = /* @__PURE__ */ new Map;
|
|
229
231
|
}
|
|
@@ -241,9 +243,9 @@ class Gr {
|
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
|
|
244
|
-
class
|
|
246
|
+
class De {
|
|
245
247
|
constructor(r) {
|
|
246
|
-
this.generateIdentifier = r, this.kv = new
|
|
248
|
+
this.generateIdentifier = r, this.kv = new st;
|
|
247
249
|
}
|
|
248
250
|
register(r, t) {
|
|
249
251
|
this.kv.getByValue(r) || (t || (t = this.generateIdentifier(r)), this.kv.set(t, r));
|
|
@@ -259,7 +261,7 @@ class Ee {
|
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
|
|
262
|
-
class
|
|
264
|
+
class nt extends De {
|
|
263
265
|
constructor() {
|
|
264
266
|
super((r) => r.name), this.classToAllowedProps = /* @__PURE__ */ new Map;
|
|
265
267
|
}
|
|
@@ -270,7 +272,7 @@ class Xr extends Ee {
|
|
|
270
272
|
return this.classToAllowedProps.get(r);
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
|
-
function
|
|
275
|
+
function it(e) {
|
|
274
276
|
if ("values" in Object)
|
|
275
277
|
return Object.values(e);
|
|
276
278
|
const r = [];
|
|
@@ -278,24 +280,24 @@ function vr(e) {
|
|
|
278
280
|
e.hasOwnProperty(t) && r.push(e[t]);
|
|
279
281
|
return r;
|
|
280
282
|
}
|
|
281
|
-
function
|
|
282
|
-
const t =
|
|
283
|
+
function ot(e, r) {
|
|
284
|
+
const t = it(e);
|
|
283
285
|
if ("find" in t)
|
|
284
286
|
return t.find(r);
|
|
285
287
|
const s = t;
|
|
286
288
|
for (let n = 0;n < s.length; n++) {
|
|
287
|
-
const
|
|
288
|
-
if (r(
|
|
289
|
-
return
|
|
289
|
+
const o = s[n];
|
|
290
|
+
if (r(o))
|
|
291
|
+
return o;
|
|
290
292
|
}
|
|
291
293
|
}
|
|
292
|
-
function
|
|
294
|
+
function z2(e, r) {
|
|
293
295
|
Object.entries(e).forEach(([t, s]) => r(s, t));
|
|
294
296
|
}
|
|
295
|
-
function
|
|
297
|
+
function j2(e, r) {
|
|
296
298
|
return e.indexOf(r) !== -1;
|
|
297
299
|
}
|
|
298
|
-
function
|
|
300
|
+
function be2(e, r) {
|
|
299
301
|
for (let t = 0;t < e.length; t++) {
|
|
300
302
|
const s = e[t];
|
|
301
303
|
if (r(s))
|
|
@@ -303,7 +305,7 @@ function he(e, r) {
|
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
307
|
|
|
306
|
-
class
|
|
308
|
+
class at {
|
|
307
309
|
constructor() {
|
|
308
310
|
this.transfomers = {};
|
|
309
311
|
}
|
|
@@ -311,54 +313,54 @@ class rt {
|
|
|
311
313
|
this.transfomers[r.name] = r;
|
|
312
314
|
}
|
|
313
315
|
findApplicable(r) {
|
|
314
|
-
return
|
|
316
|
+
return ot(this.transfomers, (t) => t.isApplicable(r));
|
|
315
317
|
}
|
|
316
318
|
findByName(r) {
|
|
317
319
|
return this.transfomers[r];
|
|
318
320
|
}
|
|
319
321
|
}
|
|
320
|
-
var
|
|
321
|
-
var
|
|
322
|
-
var
|
|
322
|
+
var ut = (e) => Object.prototype.toString.call(e).slice(8, -1);
|
|
323
|
+
var Me = (e) => typeof e == "undefined";
|
|
324
|
+
var ct = (e) => e === null;
|
|
323
325
|
var k = (e) => typeof e != "object" || e === null || e === Object.prototype ? false : Object.getPrototypeOf(e) === null ? true : Object.getPrototypeOf(e) === Object.prototype;
|
|
324
|
-
var
|
|
325
|
-
var
|
|
326
|
-
var
|
|
327
|
-
var
|
|
328
|
-
var
|
|
329
|
-
var
|
|
330
|
-
var
|
|
331
|
-
var
|
|
332
|
-
var
|
|
333
|
-
var
|
|
334
|
-
var
|
|
335
|
-
var
|
|
336
|
-
var
|
|
337
|
-
var
|
|
338
|
-
var
|
|
339
|
-
var
|
|
340
|
-
var
|
|
341
|
-
var
|
|
342
|
-
var Y2 = (e) => e.map(String).map(
|
|
326
|
+
var X = (e) => k(e) && Object.keys(e).length === 0;
|
|
327
|
+
var S = (e) => Array.isArray(e);
|
|
328
|
+
var lt = (e) => typeof e == "string";
|
|
329
|
+
var ft2 = (e) => typeof e == "number" && !isNaN(e);
|
|
330
|
+
var dt = (e) => typeof e == "boolean";
|
|
331
|
+
var mt = (e) => e instanceof RegExp;
|
|
332
|
+
var L = (e) => e instanceof Map;
|
|
333
|
+
var V = (e) => e instanceof Set;
|
|
334
|
+
var Se = (e) => ut(e) === "Symbol";
|
|
335
|
+
var pt = (e) => e instanceof Date && !isNaN(e.valueOf());
|
|
336
|
+
var yt = (e) => e instanceof Error;
|
|
337
|
+
var Fe = (e) => typeof e == "number" && isNaN(e);
|
|
338
|
+
var gt = (e) => dt(e) || ct(e) || Me(e) || ft2(e) || lt(e) || Se(e);
|
|
339
|
+
var ht = (e) => typeof e == "bigint";
|
|
340
|
+
var bt = (e) => e === 1 / 0 || e === -1 / 0;
|
|
341
|
+
var Ft = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
342
|
+
var wt2 = (e) => e instanceof URL;
|
|
343
|
+
var Te = (e) => e.replace(/\./g, "\\.");
|
|
344
|
+
var Y2 = (e) => e.map(String).map(Te).join(".");
|
|
343
345
|
var P = (e) => {
|
|
344
346
|
const r = [];
|
|
345
347
|
let t = "";
|
|
346
348
|
for (let n = 0;n < e.length; n++) {
|
|
347
|
-
let
|
|
348
|
-
if (
|
|
349
|
+
let o = e.charAt(n);
|
|
350
|
+
if (o === "\\" && e.charAt(n + 1) === ".") {
|
|
349
351
|
t += ".", n++;
|
|
350
352
|
continue;
|
|
351
353
|
}
|
|
352
|
-
if (
|
|
354
|
+
if (o === ".") {
|
|
353
355
|
r.push(t), t = "";
|
|
354
356
|
continue;
|
|
355
357
|
}
|
|
356
|
-
t +=
|
|
358
|
+
t += o;
|
|
357
359
|
}
|
|
358
360
|
const s = t;
|
|
359
361
|
return r.push(s), r;
|
|
360
362
|
};
|
|
361
|
-
function
|
|
363
|
+
function A(e, r, t, s) {
|
|
362
364
|
return {
|
|
363
365
|
isApplicable: e,
|
|
364
366
|
annotation: r,
|
|
@@ -366,11 +368,11 @@ function $(e, r, t, s) {
|
|
|
366
368
|
untransform: s
|
|
367
369
|
};
|
|
368
370
|
}
|
|
369
|
-
var
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
var Ne = [
|
|
372
|
+
A(Me, "undefined", () => null, () => {}),
|
|
373
|
+
A(ht, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
374
|
+
A(pt, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
375
|
+
A(yt, "Error", (e, r) => {
|
|
374
376
|
const t = {
|
|
375
377
|
name: e.name,
|
|
376
378
|
message: e.message
|
|
@@ -384,17 +386,17 @@ var Ae = [
|
|
|
384
386
|
t[s] = e[s];
|
|
385
387
|
}), t;
|
|
386
388
|
}),
|
|
387
|
-
|
|
389
|
+
A(mt, "regexp", (e) => "" + e, (e) => {
|
|
388
390
|
const r = e.slice(1, e.lastIndexOf("/")), t = e.slice(e.lastIndexOf("/") + 1);
|
|
389
391
|
return new RegExp(r, t);
|
|
390
392
|
}),
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
A(V, "set", (e) => [...e.values()], (e) => new Set(e)),
|
|
394
|
+
A(L, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
395
|
+
A((e) => Fe(e) || bt(e), "number", (e) => Fe(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
396
|
+
A((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
397
|
+
A(wt2, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
396
398
|
];
|
|
397
|
-
function
|
|
399
|
+
function J(e, r, t, s) {
|
|
398
400
|
return {
|
|
399
401
|
isApplicable: e,
|
|
400
402
|
annotation: r,
|
|
@@ -402,13 +404,13 @@ function j2(e, r, t, s) {
|
|
|
402
404
|
untransform: s
|
|
403
405
|
};
|
|
404
406
|
}
|
|
405
|
-
var
|
|
407
|
+
var Re = J((e, r) => Se(e) ? !!r.symbolRegistry.getIdentifier(e) : false, (e, r) => ["symbol", r.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, r, t) => {
|
|
406
408
|
const s = t.symbolRegistry.getValue(r[1]);
|
|
407
409
|
if (!s)
|
|
408
410
|
throw new Error("Trying to deserialize unknown symbol");
|
|
409
411
|
return s;
|
|
410
412
|
});
|
|
411
|
-
var
|
|
413
|
+
var qt = [
|
|
412
414
|
Int8Array,
|
|
413
415
|
Uint8Array,
|
|
414
416
|
Int16Array,
|
|
@@ -419,19 +421,19 @@ var yt = [
|
|
|
419
421
|
Float64Array,
|
|
420
422
|
Uint8ClampedArray
|
|
421
423
|
].reduce((e, r) => (e[r.name] = r, e), {});
|
|
422
|
-
var
|
|
423
|
-
const t =
|
|
424
|
+
var Oe2 = J(Ft, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, r) => {
|
|
425
|
+
const t = qt[r[1]];
|
|
424
426
|
if (!t)
|
|
425
427
|
throw new Error("Trying to deserialize unknown typed array");
|
|
426
428
|
return new t(e);
|
|
427
429
|
});
|
|
428
|
-
function
|
|
430
|
+
function Ie(e, r) {
|
|
429
431
|
return e != null && e.constructor ? !!r.classRegistry.getIdentifier(e.constructor) : false;
|
|
430
432
|
}
|
|
431
|
-
var
|
|
433
|
+
var ze = J(Ie, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor)], (e, r) => {
|
|
432
434
|
const t = r.classRegistry.getAllowedProps(e.constructor);
|
|
433
435
|
if (!t)
|
|
434
|
-
return
|
|
436
|
+
return g2({}, e);
|
|
435
437
|
const s = {};
|
|
436
438
|
return t.forEach((n) => {
|
|
437
439
|
s[n] = e[n];
|
|
@@ -442,53 +444,53 @@ var Re = j2(Ne, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor)
|
|
|
442
444
|
throw new Error(`Trying to deserialize unknown class '${r[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
443
445
|
return Object.assign(Object.create(s.prototype), e);
|
|
444
446
|
});
|
|
445
|
-
var
|
|
447
|
+
var Be = J((e, r) => !!r.customTransformerRegistry.findApplicable(e), (e, r) => ["custom", r.customTransformerRegistry.findApplicable(e).name], (e, r) => r.customTransformerRegistry.findApplicable(e).serialize(e), (e, r, t) => {
|
|
446
448
|
const s = t.customTransformerRegistry.findByName(r[1]);
|
|
447
449
|
if (!s)
|
|
448
450
|
throw new Error("Trying to deserialize unknown custom value");
|
|
449
451
|
return s.deserialize(e);
|
|
450
452
|
});
|
|
451
|
-
var
|
|
452
|
-
var
|
|
453
|
-
const t =
|
|
453
|
+
var Et = [ze, Re, Be, Oe2];
|
|
454
|
+
var we = (e, r) => {
|
|
455
|
+
const t = be2(Et, (n) => n.isApplicable(e, r));
|
|
454
456
|
if (t)
|
|
455
457
|
return {
|
|
456
458
|
value: t.transform(e, r),
|
|
457
459
|
type: t.annotation(e, r)
|
|
458
460
|
};
|
|
459
|
-
const s =
|
|
461
|
+
const s = be2(Ne, (n) => n.isApplicable(e, r));
|
|
460
462
|
if (s)
|
|
461
463
|
return {
|
|
462
464
|
value: s.transform(e, r),
|
|
463
465
|
type: s.annotation
|
|
464
466
|
};
|
|
465
467
|
};
|
|
466
|
-
var
|
|
467
|
-
|
|
468
|
-
|
|
468
|
+
var Pe = {};
|
|
469
|
+
Ne.forEach((e) => {
|
|
470
|
+
Pe[e.annotation] = e;
|
|
469
471
|
});
|
|
470
|
-
var
|
|
471
|
-
if (
|
|
472
|
+
var Ct = (e, r, t) => {
|
|
473
|
+
if (S(r))
|
|
472
474
|
switch (r[0]) {
|
|
473
475
|
case "symbol":
|
|
474
|
-
return De.untransform(e, r, t);
|
|
475
|
-
case "class":
|
|
476
476
|
return Re.untransform(e, r, t);
|
|
477
|
+
case "class":
|
|
478
|
+
return ze.untransform(e, r, t);
|
|
477
479
|
case "custom":
|
|
478
|
-
return
|
|
480
|
+
return Be.untransform(e, r, t);
|
|
479
481
|
case "typed-array":
|
|
480
|
-
return
|
|
482
|
+
return Oe2.untransform(e, r, t);
|
|
481
483
|
default:
|
|
482
484
|
throw new Error("Unknown transformation: " + r);
|
|
483
485
|
}
|
|
484
486
|
else {
|
|
485
|
-
const s =
|
|
487
|
+
const s = Pe[r];
|
|
486
488
|
if (!s)
|
|
487
489
|
throw new Error("Unknown transformation: " + r);
|
|
488
490
|
return s.untransform(e, t);
|
|
489
491
|
}
|
|
490
492
|
};
|
|
491
|
-
var
|
|
493
|
+
var O = (e, r) => {
|
|
492
494
|
if (r > e.size)
|
|
493
495
|
throw new Error("index out of bounds");
|
|
494
496
|
const t = e.keys();
|
|
@@ -496,23 +498,23 @@ var I = (e, r) => {
|
|
|
496
498
|
t.next(), r--;
|
|
497
499
|
return t.next().value;
|
|
498
500
|
};
|
|
499
|
-
function
|
|
500
|
-
if (
|
|
501
|
+
function ke(e) {
|
|
502
|
+
if (j2(e, "__proto__"))
|
|
501
503
|
throw new Error("__proto__ is not allowed as a property");
|
|
502
|
-
if (
|
|
504
|
+
if (j2(e, "prototype"))
|
|
503
505
|
throw new Error("prototype is not allowed as a property");
|
|
504
|
-
if (
|
|
506
|
+
if (j2(e, "constructor"))
|
|
505
507
|
throw new Error("constructor is not allowed as a property");
|
|
506
508
|
}
|
|
507
|
-
var
|
|
508
|
-
|
|
509
|
+
var $t = (e, r) => {
|
|
510
|
+
ke(r);
|
|
509
511
|
for (let t = 0;t < r.length; t++) {
|
|
510
512
|
const s = r[t];
|
|
511
|
-
if (
|
|
512
|
-
e =
|
|
513
|
-
else if (
|
|
514
|
-
const n = +s,
|
|
515
|
-
switch (
|
|
513
|
+
if (V(e))
|
|
514
|
+
e = O(e, +s);
|
|
515
|
+
else if (L(e)) {
|
|
516
|
+
const n = +s, o = +r[++t] == 0 ? "key" : "value", i = O(e, n);
|
|
517
|
+
switch (o) {
|
|
516
518
|
case "key":
|
|
517
519
|
e = i;
|
|
518
520
|
break;
|
|
@@ -525,25 +527,25 @@ var bt = (e, r) => {
|
|
|
525
527
|
}
|
|
526
528
|
return e;
|
|
527
529
|
};
|
|
528
|
-
var
|
|
529
|
-
if (
|
|
530
|
+
var v = (e, r, t) => {
|
|
531
|
+
if (ke(r), r.length === 0)
|
|
530
532
|
return t(e);
|
|
531
533
|
let s = e;
|
|
532
|
-
for (let
|
|
533
|
-
const i = r[
|
|
534
|
-
if (
|
|
535
|
-
const
|
|
536
|
-
s = s[
|
|
534
|
+
for (let o = 0;o < r.length - 1; o++) {
|
|
535
|
+
const i = r[o];
|
|
536
|
+
if (S(s)) {
|
|
537
|
+
const a = +i;
|
|
538
|
+
s = s[a];
|
|
537
539
|
} else if (k(s))
|
|
538
540
|
s = s[i];
|
|
539
|
-
else if (
|
|
540
|
-
const
|
|
541
|
-
s =
|
|
542
|
-
} else if (
|
|
543
|
-
if (
|
|
541
|
+
else if (V(s)) {
|
|
542
|
+
const a = +i;
|
|
543
|
+
s = O(s, a);
|
|
544
|
+
} else if (L(s)) {
|
|
545
|
+
if (o === r.length - 2)
|
|
544
546
|
break;
|
|
545
|
-
const u = +i,
|
|
546
|
-
switch (
|
|
547
|
+
const u = +i, c2 = +r[++o] == 0 ? "key" : "value", p2 = O(s, u);
|
|
548
|
+
switch (c2) {
|
|
547
549
|
case "key":
|
|
548
550
|
s = p2;
|
|
549
551
|
break;
|
|
@@ -554,12 +556,12 @@ var X = (e, r, t) => {
|
|
|
554
556
|
}
|
|
555
557
|
}
|
|
556
558
|
const n = r[r.length - 1];
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
|
|
559
|
+
if (S(s) ? s[+n] = t(s[+n]) : k(s) && (s[n] = t(s[n])), V(s)) {
|
|
560
|
+
const o = O(s, +n), i = t(o);
|
|
561
|
+
o !== i && (s.delete(o), s.add(i));
|
|
560
562
|
}
|
|
561
|
-
if (
|
|
562
|
-
const
|
|
563
|
+
if (L(s)) {
|
|
564
|
+
const o = +r[r.length - 2], i = O(s, o);
|
|
563
565
|
switch (+n == 0 ? "key" : "value") {
|
|
564
566
|
case "key": {
|
|
565
567
|
const u = t(i);
|
|
@@ -574,155 +576,155 @@ var X = (e, r, t) => {
|
|
|
574
576
|
}
|
|
575
577
|
return e;
|
|
576
578
|
};
|
|
577
|
-
function
|
|
579
|
+
function ee(e, r, t = []) {
|
|
578
580
|
if (!e)
|
|
579
581
|
return;
|
|
580
|
-
if (!
|
|
581
|
-
|
|
582
|
+
if (!S(e)) {
|
|
583
|
+
z2(e, (o, i) => ee(o, r, [...t, ...P(i)]));
|
|
582
584
|
return;
|
|
583
585
|
}
|
|
584
586
|
const [s, n] = e;
|
|
585
|
-
n &&
|
|
586
|
-
|
|
587
|
+
n && z2(n, (o, i) => {
|
|
588
|
+
ee(o, r, [...t, ...P(i)]);
|
|
587
589
|
}), r(s, t);
|
|
588
590
|
}
|
|
589
|
-
function
|
|
590
|
-
return
|
|
591
|
-
e =
|
|
591
|
+
function At(e, r, t) {
|
|
592
|
+
return ee(r, (s, n) => {
|
|
593
|
+
e = v(e, n, (o) => Ct(o, s, t));
|
|
592
594
|
}), e;
|
|
593
595
|
}
|
|
594
|
-
function
|
|
596
|
+
function xt2(e, r) {
|
|
595
597
|
function t(s, n) {
|
|
596
|
-
const
|
|
598
|
+
const o = $t(e, P(n));
|
|
597
599
|
s.map(P).forEach((i) => {
|
|
598
|
-
e =
|
|
600
|
+
e = v(e, i, () => o);
|
|
599
601
|
});
|
|
600
602
|
}
|
|
601
|
-
if (
|
|
603
|
+
if (S(r)) {
|
|
602
604
|
const [s, n] = r;
|
|
603
|
-
s.forEach((
|
|
604
|
-
e =
|
|
605
|
-
}), n &&
|
|
605
|
+
s.forEach((o) => {
|
|
606
|
+
e = v(e, P(o), () => e);
|
|
607
|
+
}), n && z2(n, t);
|
|
606
608
|
} else
|
|
607
|
-
|
|
609
|
+
z2(r, t);
|
|
608
610
|
return e;
|
|
609
611
|
}
|
|
610
|
-
var
|
|
611
|
-
function
|
|
612
|
+
var Dt = (e, r) => k(e) || S(e) || L(e) || V(e) || Ie(e, r);
|
|
613
|
+
function Mt(e, r, t) {
|
|
612
614
|
const s = t.get(e);
|
|
613
615
|
s ? s.push(r) : t.set(e, [r]);
|
|
614
616
|
}
|
|
615
|
-
function
|
|
617
|
+
function St(e, r) {
|
|
616
618
|
const t = {};
|
|
617
619
|
let s;
|
|
618
620
|
return e.forEach((n) => {
|
|
619
621
|
if (n.length <= 1)
|
|
620
622
|
return;
|
|
621
|
-
r || (n = n.map((
|
|
622
|
-
const [
|
|
623
|
-
|
|
624
|
-
}), s ?
|
|
625
|
-
}
|
|
626
|
-
var
|
|
627
|
-
var
|
|
628
|
-
const
|
|
629
|
-
if (!
|
|
630
|
-
|
|
631
|
-
const
|
|
632
|
-
if (
|
|
623
|
+
r || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
|
|
624
|
+
const [o, ...i] = n;
|
|
625
|
+
o.length === 0 ? s = i.map(Y2) : t[Y2(o)] = i.map(Y2);
|
|
626
|
+
}), s ? X(t) ? [s] : [s, t] : X(t) ? undefined : t;
|
|
627
|
+
}
|
|
628
|
+
var Le = (e, r, t, s, n = [], o = [], i = /* @__PURE__ */ new Map) => {
|
|
629
|
+
var x2;
|
|
630
|
+
const a = gt(e);
|
|
631
|
+
if (!a) {
|
|
632
|
+
Mt(e, n, r);
|
|
633
|
+
const f2 = i.get(e);
|
|
634
|
+
if (f2)
|
|
633
635
|
return s ? {
|
|
634
636
|
transformedValue: null
|
|
635
|
-
} :
|
|
637
|
+
} : f2;
|
|
636
638
|
}
|
|
637
|
-
if (!
|
|
638
|
-
const
|
|
639
|
-
transformedValue:
|
|
640
|
-
annotations: [
|
|
639
|
+
if (!Dt(e, t)) {
|
|
640
|
+
const f2 = we(e, t), d = f2 ? {
|
|
641
|
+
transformedValue: f2.value,
|
|
642
|
+
annotations: [f2.type]
|
|
641
643
|
} : {
|
|
642
644
|
transformedValue: e
|
|
643
645
|
};
|
|
644
|
-
return
|
|
646
|
+
return a || i.set(e, d), d;
|
|
645
647
|
}
|
|
646
|
-
if (
|
|
648
|
+
if (j2(o, e))
|
|
647
649
|
return {
|
|
648
650
|
transformedValue: null
|
|
649
651
|
};
|
|
650
|
-
const u =
|
|
651
|
-
|
|
652
|
-
if (
|
|
653
|
-
throw new Error(`Detected property ${
|
|
654
|
-
const w =
|
|
655
|
-
p2[
|
|
656
|
-
m2[
|
|
652
|
+
const u = we(e, t), c2 = (x2 = u == null ? undefined : u.value) != null ? x2 : e, p2 = S(c2) ? [] : {}, m2 = {};
|
|
653
|
+
z2(c2, (f2, d) => {
|
|
654
|
+
if (d === "__proto__" || d === "constructor" || d === "prototype")
|
|
655
|
+
throw new Error(`Detected property ${d}. This is a prototype pollution risk, please remove it from your object.`);
|
|
656
|
+
const w = Le(f2, r, t, s, [...n, d], [...o, e], i);
|
|
657
|
+
p2[d] = w.transformedValue, S(w.annotations) ? m2[d] = w.annotations : k(w.annotations) && z2(w.annotations, ($, D) => {
|
|
658
|
+
m2[Te(d) + "." + D] = $;
|
|
657
659
|
});
|
|
658
660
|
});
|
|
659
|
-
const y =
|
|
661
|
+
const y = X(m2) ? {
|
|
660
662
|
transformedValue: p2,
|
|
661
663
|
annotations: u ? [u.type] : undefined
|
|
662
664
|
} : {
|
|
663
665
|
transformedValue: p2,
|
|
664
666
|
annotations: u ? [u.type, m2] : m2
|
|
665
667
|
};
|
|
666
|
-
return
|
|
668
|
+
return a || i.set(e, y), y;
|
|
667
669
|
};
|
|
668
|
-
function
|
|
670
|
+
function Ve2(e) {
|
|
669
671
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
670
672
|
}
|
|
671
|
-
function
|
|
672
|
-
return
|
|
673
|
+
function qe(e) {
|
|
674
|
+
return Ve2(e) === "Array";
|
|
673
675
|
}
|
|
674
|
-
function
|
|
675
|
-
if (
|
|
676
|
+
function Tt(e) {
|
|
677
|
+
if (Ve2(e) !== "Object")
|
|
676
678
|
return false;
|
|
677
679
|
const r = Object.getPrototypeOf(e);
|
|
678
680
|
return !!r && r.constructor === Object && r === Object.prototype;
|
|
679
681
|
}
|
|
680
|
-
function
|
|
681
|
-
const
|
|
682
|
-
|
|
682
|
+
function Nt(e, r, t, s, n) {
|
|
683
|
+
const o = {}.propertyIsEnumerable.call(s, r) ? "enumerable" : "nonenumerable";
|
|
684
|
+
o === "enumerable" && (e[r] = t), n && o === "nonenumerable" && Object.defineProperty(e, r, {
|
|
683
685
|
value: t,
|
|
684
686
|
enumerable: false,
|
|
685
687
|
writable: true,
|
|
686
688
|
configurable: true
|
|
687
689
|
});
|
|
688
690
|
}
|
|
689
|
-
function
|
|
690
|
-
if (
|
|
691
|
-
return e.map((n) =>
|
|
692
|
-
if (
|
|
691
|
+
function re(e, r = {}) {
|
|
692
|
+
if (qe(e))
|
|
693
|
+
return e.map((n) => re(n, r));
|
|
694
|
+
if (!Tt(e))
|
|
693
695
|
return e;
|
|
694
696
|
const t = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
695
|
-
return [...t, ...s].reduce((n,
|
|
696
|
-
if (
|
|
697
|
+
return [...t, ...s].reduce((n, o) => {
|
|
698
|
+
if (qe(r.props) && !r.props.includes(o))
|
|
697
699
|
return n;
|
|
698
|
-
const i = e[
|
|
699
|
-
return
|
|
700
|
+
const i = e[o], a = re(i, r);
|
|
701
|
+
return Nt(n, o, a, e, r.nonenumerable), n;
|
|
700
702
|
}, {});
|
|
701
703
|
}
|
|
702
704
|
|
|
703
|
-
class
|
|
705
|
+
class l {
|
|
704
706
|
constructor({ dedupe: r = false } = {}) {
|
|
705
|
-
this.classRegistry = new
|
|
707
|
+
this.classRegistry = new nt, this.symbolRegistry = new De((t) => {
|
|
706
708
|
var s;
|
|
707
709
|
return (s = t.description) != null ? s : "";
|
|
708
|
-
}), this.customTransformerRegistry = new
|
|
710
|
+
}), this.customTransformerRegistry = new at, this.allowedErrorProps = [], this.dedupe = r;
|
|
709
711
|
}
|
|
710
712
|
serialize(r) {
|
|
711
|
-
const t = /* @__PURE__ */ new Map, s =
|
|
713
|
+
const t = /* @__PURE__ */ new Map, s = Le(r, t, this, this.dedupe), n = {
|
|
712
714
|
json: s.transformedValue
|
|
713
715
|
};
|
|
714
|
-
s.annotations && (n.meta =
|
|
716
|
+
s.annotations && (n.meta = h2(g2({}, n.meta), {
|
|
715
717
|
values: s.annotations
|
|
716
718
|
}));
|
|
717
|
-
const
|
|
718
|
-
return
|
|
719
|
-
referentialEqualities:
|
|
719
|
+
const o = St(t, this.dedupe);
|
|
720
|
+
return o && (n.meta = h2(g2({}, n.meta), {
|
|
721
|
+
referentialEqualities: o
|
|
720
722
|
})), n;
|
|
721
723
|
}
|
|
722
724
|
deserialize(r) {
|
|
723
725
|
const { json: t, meta: s } = r;
|
|
724
|
-
let n =
|
|
725
|
-
return s != null && s.values && (n =
|
|
726
|
+
let n = re(t);
|
|
727
|
+
return s != null && s.values && (n = At(n, s.values, this)), s != null && s.referentialEqualities && (n = xt2(n, s.referentialEqualities)), n;
|
|
726
728
|
}
|
|
727
729
|
stringify(r) {
|
|
728
730
|
return JSON.stringify(this.serialize(r));
|
|
@@ -737,7 +739,7 @@ class c2 {
|
|
|
737
739
|
this.symbolRegistry.register(r, t);
|
|
738
740
|
}
|
|
739
741
|
registerCustom(r, t) {
|
|
740
|
-
this.customTransformerRegistry.register(
|
|
742
|
+
this.customTransformerRegistry.register(g2({
|
|
741
743
|
name: t
|
|
742
744
|
}, r));
|
|
743
745
|
}
|
|
@@ -745,236 +747,240 @@ class c2 {
|
|
|
745
747
|
this.allowedErrorProps.push(...r);
|
|
746
748
|
}
|
|
747
749
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
var
|
|
758
|
-
var
|
|
759
|
-
var
|
|
760
|
-
var
|
|
750
|
+
l.defaultInstance = new l;
|
|
751
|
+
l.serialize = l.defaultInstance.serialize.bind(l.defaultInstance);
|
|
752
|
+
l.deserialize = l.defaultInstance.deserialize.bind(l.defaultInstance);
|
|
753
|
+
l.stringify = l.defaultInstance.stringify.bind(l.defaultInstance);
|
|
754
|
+
l.parse = l.defaultInstance.parse.bind(l.defaultInstance);
|
|
755
|
+
l.registerClass = l.defaultInstance.registerClass.bind(l.defaultInstance);
|
|
756
|
+
l.registerSymbol = l.defaultInstance.registerSymbol.bind(l.defaultInstance);
|
|
757
|
+
l.registerCustom = l.defaultInstance.registerCustom.bind(l.defaultInstance);
|
|
758
|
+
l.allowErrorProps = l.defaultInstance.allowErrorProps.bind(l.defaultInstance);
|
|
759
|
+
var R2 = (e) => e === undefined ? C.None : e;
|
|
760
|
+
var Rt = (e) => new m(e.metadataItem, e.type);
|
|
761
|
+
var ae = (e) => new Ve(e.name, e.expression, e.type, e.description, R2(e.sort), e.dataSource, e.composeCode);
|
|
762
|
+
var ue = (e) => new Y(e.name, e.expression, e.granularity, e.format, e.description, R2(e.sort), e.dataSource, e.composeCode);
|
|
761
763
|
var q3 = (e) => {
|
|
762
764
|
switch (e.__serializable) {
|
|
763
765
|
case "DimensionalAttribute":
|
|
764
|
-
return ie(e);
|
|
765
|
-
case "DimensionalLevelAttribute":
|
|
766
766
|
return ae(e);
|
|
767
|
+
case "DimensionalLevelAttribute":
|
|
768
|
+
return ue(e);
|
|
767
769
|
default:
|
|
768
770
|
return e;
|
|
769
771
|
}
|
|
770
772
|
};
|
|
771
|
-
var
|
|
772
|
-
var
|
|
773
|
-
var
|
|
773
|
+
var _e = (e) => new c(e.name, e.expression, e.attributes.map(q3), e.dimensions.map(Ot), e.type, e.description, R2(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? q3(e.defaultAttribute) : undefined);
|
|
774
|
+
var Ue = (e) => new p(e.name, e.expression, e.description, R2(e.sort), e.dataSource, e.composeCode);
|
|
775
|
+
var Ot = (e) => {
|
|
774
776
|
switch (e.__serializable) {
|
|
775
777
|
case "DimensionalDimension":
|
|
776
|
-
return
|
|
778
|
+
return _e(e);
|
|
777
779
|
case "DimensionalDateDimension":
|
|
778
|
-
return
|
|
780
|
+
return Ue(e);
|
|
779
781
|
default:
|
|
780
782
|
return e;
|
|
781
783
|
}
|
|
782
784
|
};
|
|
783
|
-
var
|
|
784
|
-
var
|
|
785
|
+
var ce = (e) => new be(e.name, q3(e.attribute), e.aggregation, e.format, e.description, R2(e.sort), e.dataSource, e.composeCode);
|
|
786
|
+
var le = (e) => {
|
|
785
787
|
const r = Object.fromEntries(Object.entries(e.context).map(([t, s]) => {
|
|
786
788
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
787
789
|
switch (s.__serializable) {
|
|
788
790
|
case "DimensionalAttribute":
|
|
789
|
-
return [t, ie(s)];
|
|
790
|
-
case "DimensionalLevelAttribute":
|
|
791
791
|
return [t, ae(s)];
|
|
792
|
+
case "DimensionalLevelAttribute":
|
|
793
|
+
return [t, ue(s)];
|
|
792
794
|
case "DimensionalBaseMeasure":
|
|
793
|
-
return [t,
|
|
795
|
+
return [t, ce(s)];
|
|
794
796
|
case "DimensionalCalculatedMeasure":
|
|
795
|
-
return [t,
|
|
797
|
+
return [t, le(s)];
|
|
796
798
|
default:
|
|
797
799
|
return [t, s];
|
|
798
800
|
}
|
|
799
801
|
return [t, s];
|
|
800
802
|
}));
|
|
801
|
-
return new Z(e.name, e.expression, r, e.format, e.description,
|
|
803
|
+
return new Z(e.name, e.expression, r, e.format, e.description, R2(e.sort), e.dataSource, e.composeCode);
|
|
802
804
|
};
|
|
803
|
-
var
|
|
805
|
+
var We = (e) => new Vt(e.name, q3(e.attribute), e.format, e.description, R2(e.sort), e.dataSource, e.composeCode);
|
|
804
806
|
var H = (e) => {
|
|
805
807
|
switch (e.__serializable) {
|
|
806
808
|
case "DimensionalBaseMeasure":
|
|
807
|
-
return
|
|
809
|
+
return ce(e);
|
|
808
810
|
case "DimensionalCalculatedMeasure":
|
|
809
|
-
return
|
|
811
|
+
return le(e);
|
|
810
812
|
case "DimensionalMeasureTemplate":
|
|
811
|
-
return
|
|
813
|
+
return We(e);
|
|
812
814
|
default:
|
|
813
815
|
return e;
|
|
814
816
|
}
|
|
815
817
|
};
|
|
816
|
-
var
|
|
818
|
+
var b2 = (e) => {
|
|
817
819
|
switch (e.__serializable) {
|
|
818
820
|
case "MembersFilter":
|
|
819
|
-
return new
|
|
821
|
+
return new Ed(q3(e.attribute), e.members, e.config.backgroundFilter ? h2(g2({}, e.config), { backgroundFilter: b2(e.config.backgroundFilter) }) : e.config, e.composeCode);
|
|
820
822
|
case "LogicalAttributeFilter":
|
|
821
|
-
return new
|
|
823
|
+
return new Fi(e.filters.map((t) => b2(t)), e.operator, e.config, e.composeCode);
|
|
822
824
|
case "CascadingFilter":
|
|
823
|
-
return new
|
|
825
|
+
return new Od(e._filters.map((t) => b2(t)), e.config, e.composeCode);
|
|
824
826
|
case "ExcludeFilter":
|
|
825
|
-
return new
|
|
827
|
+
return new _d(b2(e.filter), e.input ? b2(e.input) : undefined, e.config, e.composeCode);
|
|
826
828
|
case "MeasureFilter":
|
|
827
|
-
return new
|
|
829
|
+
return new xd(q3(e.attribute), H(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
828
830
|
case "RankingFilter":
|
|
829
|
-
return new
|
|
831
|
+
return new Ui(q3(e.attribute), H(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
830
832
|
case "MeasureRankingFilter":
|
|
831
|
-
return new
|
|
833
|
+
return new Bi(H(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
832
834
|
case "NumericFilter":
|
|
833
|
-
return new
|
|
835
|
+
return new wd(q3(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
834
836
|
case "TextFilter":
|
|
835
837
|
return new ne(q3(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
|
|
836
838
|
case "DateRangeFilter": {
|
|
837
839
|
const { valueA: t, valueB: s } = e;
|
|
838
|
-
return new
|
|
840
|
+
return new Nd(q3(e.attribute), t, s, e.config, e.composeCode);
|
|
839
841
|
}
|
|
840
842
|
case "RelativeDateFilter":
|
|
841
|
-
return new
|
|
843
|
+
return new Or(q3(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
|
|
842
844
|
case "CustomFilter":
|
|
843
|
-
return new
|
|
845
|
+
return new Cd(q3(e.attribute), e.jaqlExpression, e.config, e.composeCode);
|
|
844
846
|
default:
|
|
845
847
|
return e;
|
|
846
848
|
}
|
|
847
849
|
};
|
|
848
|
-
|
|
850
|
+
l.registerCustom({
|
|
849
851
|
isApplicable: h,
|
|
850
852
|
serialize: (e) => e.serialize(),
|
|
851
|
-
deserialize: (e) =>
|
|
853
|
+
deserialize: (e) => Rt(e)
|
|
852
854
|
}, "JaqlElement");
|
|
853
|
-
|
|
854
|
-
isApplicable:
|
|
855
|
+
l.registerCustom({
|
|
856
|
+
isApplicable: fp,
|
|
855
857
|
serialize: (e) => e.serialize(),
|
|
856
|
-
deserialize: (e) =>
|
|
858
|
+
deserialize: (e) => ae(e)
|
|
857
859
|
}, "DimensionalAttribute");
|
|
858
|
-
|
|
859
|
-
isApplicable:
|
|
860
|
+
l.registerCustom({
|
|
861
|
+
isApplicable: dp,
|
|
860
862
|
serialize: (e) => e.serialize(),
|
|
861
|
-
deserialize: (e) =>
|
|
863
|
+
deserialize: (e) => ue(e)
|
|
862
864
|
}, "DimensionalLevelAttribute");
|
|
863
|
-
|
|
865
|
+
l.registerCustom({
|
|
864
866
|
isApplicable: z,
|
|
865
867
|
serialize: (e) => e.serialize(),
|
|
866
|
-
deserialize: (e) =>
|
|
868
|
+
deserialize: (e) => _e(e)
|
|
867
869
|
}, "DimensionalDimension");
|
|
868
|
-
|
|
870
|
+
l.registerCustom({
|
|
869
871
|
isApplicable: q,
|
|
870
872
|
serialize: (e) => e.serialize(),
|
|
871
|
-
deserialize: (e) =>
|
|
873
|
+
deserialize: (e) => Ue(e)
|
|
872
874
|
}, "DimensionalDateDimension");
|
|
873
|
-
|
|
874
|
-
isApplicable:
|
|
875
|
+
l.registerCustom({
|
|
876
|
+
isApplicable: Ii,
|
|
875
877
|
serialize: (e) => e.serialize(),
|
|
876
|
-
deserialize: (e) =>
|
|
878
|
+
deserialize: (e) => ce(e)
|
|
877
879
|
}, "DimensionalBaseMeasure");
|
|
878
|
-
|
|
879
|
-
isApplicable:
|
|
880
|
+
l.registerCustom({
|
|
881
|
+
isApplicable: Hh,
|
|
880
882
|
serialize: (e) => e.serialize(),
|
|
881
|
-
deserialize: (e) =>
|
|
883
|
+
deserialize: (e) => le(e)
|
|
882
884
|
}, "DimensionalCalculatedMeasure");
|
|
883
|
-
|
|
884
|
-
isApplicable:
|
|
885
|
+
l.registerCustom({
|
|
886
|
+
isApplicable: kh,
|
|
885
887
|
serialize: (e) => e.serialize(),
|
|
886
|
-
deserialize: (e) =>
|
|
888
|
+
deserialize: (e) => We(e)
|
|
887
889
|
}, "DimensionalMeasureTemplate");
|
|
888
|
-
|
|
889
|
-
isApplicable:
|
|
890
|
+
l.registerCustom({
|
|
891
|
+
isApplicable: Wh,
|
|
890
892
|
serialize: (e) => e.serialize(),
|
|
891
|
-
deserialize: (e) =>
|
|
893
|
+
deserialize: (e) => b2(e)
|
|
892
894
|
}, "MembersFilter");
|
|
893
|
-
|
|
894
|
-
isApplicable:
|
|
895
|
+
l.registerCustom({
|
|
896
|
+
isApplicable: Yh,
|
|
895
897
|
serialize: (e) => e.serialize(),
|
|
896
|
-
deserialize: (e) =>
|
|
898
|
+
deserialize: (e) => b2(e)
|
|
897
899
|
}, "LogicalAttributeFilter");
|
|
898
|
-
|
|
899
|
-
isApplicable:
|
|
900
|
+
l.registerCustom({
|
|
901
|
+
isApplicable: xt,
|
|
900
902
|
serialize: (e) => e.serialize(),
|
|
901
|
-
deserialize: (e) =>
|
|
903
|
+
deserialize: (e) => b2(e)
|
|
902
904
|
}, "CascadingFilter");
|
|
903
|
-
|
|
904
|
-
isApplicable:
|
|
905
|
+
l.registerCustom({
|
|
906
|
+
isApplicable: Jh,
|
|
905
907
|
serialize: (e) => e.serialize(),
|
|
906
|
-
deserialize: (e) =>
|
|
908
|
+
deserialize: (e) => b2(e)
|
|
907
909
|
}, "ExcludeFilter");
|
|
908
|
-
|
|
909
|
-
isApplicable:
|
|
910
|
+
l.registerCustom({
|
|
911
|
+
isApplicable: Kh,
|
|
910
912
|
serialize: (e) => e.serialize(),
|
|
911
|
-
deserialize: (e) =>
|
|
913
|
+
deserialize: (e) => b2(e)
|
|
912
914
|
}, "MeasureFilter");
|
|
913
|
-
|
|
914
|
-
isApplicable:
|
|
915
|
+
l.registerCustom({
|
|
916
|
+
isApplicable: Vh,
|
|
915
917
|
serialize: (e) => e.serialize(),
|
|
916
|
-
deserialize: (e) =>
|
|
918
|
+
deserialize: (e) => b2(e)
|
|
917
919
|
}, "RankingFilter");
|
|
918
|
-
|
|
919
|
-
isApplicable:
|
|
920
|
+
l.registerCustom({
|
|
921
|
+
isApplicable: Qh,
|
|
920
922
|
serialize: (e) => e.serialize(),
|
|
921
|
-
deserialize: (e) =>
|
|
923
|
+
deserialize: (e) => b2(e)
|
|
922
924
|
}, "MeasureRankingFilter");
|
|
923
|
-
|
|
924
|
-
isApplicable:
|
|
925
|
+
l.registerCustom({
|
|
926
|
+
isApplicable: Gh,
|
|
925
927
|
serialize: (e) => e.serialize(),
|
|
926
|
-
deserialize: (e) =>
|
|
928
|
+
deserialize: (e) => b2(e)
|
|
927
929
|
}, "NumericFilter");
|
|
928
|
-
|
|
929
|
-
isApplicable:
|
|
930
|
+
l.registerCustom({
|
|
931
|
+
isApplicable: Xh,
|
|
930
932
|
serialize: (e) => e.serialize(),
|
|
931
|
-
deserialize: (e) =>
|
|
933
|
+
deserialize: (e) => b2(e)
|
|
932
934
|
}, "TextFilter");
|
|
933
|
-
|
|
934
|
-
isApplicable:
|
|
935
|
+
l.registerCustom({
|
|
936
|
+
isApplicable: ep,
|
|
935
937
|
serialize: (e) => e.serialize(),
|
|
936
|
-
deserialize: (e) =>
|
|
938
|
+
deserialize: (e) => b2(e)
|
|
937
939
|
}, "DateRangeFilter");
|
|
938
|
-
|
|
939
|
-
isApplicable:
|
|
940
|
+
l.registerCustom({
|
|
941
|
+
isApplicable: Zh,
|
|
940
942
|
serialize: (e) => e.serialize(),
|
|
941
|
-
deserialize: (e) =>
|
|
943
|
+
deserialize: (e) => b2(e)
|
|
942
944
|
}, "RelativeDateFilter");
|
|
943
|
-
|
|
944
|
-
isApplicable:
|
|
945
|
+
l.registerCustom({
|
|
946
|
+
isApplicable: qh,
|
|
945
947
|
serialize: (e) => e.serialize(),
|
|
946
|
-
deserialize: (e) =>
|
|
948
|
+
deserialize: (e) => b2(e)
|
|
947
949
|
}, "CustomFilter");
|
|
948
|
-
var
|
|
949
|
-
var
|
|
950
|
-
function
|
|
950
|
+
var Ps = l;
|
|
951
|
+
var F = "DM.";
|
|
952
|
+
function E3(e) {
|
|
951
953
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
952
954
|
}
|
|
953
|
-
function
|
|
954
|
-
return e.every(
|
|
955
|
+
function je(e) {
|
|
956
|
+
return e.every(E3);
|
|
955
957
|
}
|
|
956
958
|
function K(e) {
|
|
957
959
|
return "attribute" in e && "config" in e;
|
|
958
960
|
}
|
|
959
|
-
function
|
|
961
|
+
function U(e) {
|
|
960
962
|
return "left" in e && "right" in e && "operator" in e;
|
|
961
963
|
}
|
|
962
|
-
function
|
|
963
|
-
return !K(e) && !
|
|
964
|
+
function fe(e) {
|
|
965
|
+
return !K(e) && !U(e);
|
|
966
|
+
}
|
|
967
|
+
function It(e) {
|
|
968
|
+
return typeof e == "object" && e !== null && "column" in e && typeof e.column == "string" && !(("function" in e) && ("args" in e));
|
|
964
969
|
}
|
|
965
|
-
function
|
|
966
|
-
|
|
970
|
+
function zt(e) {
|
|
971
|
+
const r = e;
|
|
972
|
+
return typeof e != "object" || e === null || r === null || !("column" in r) ? false : E3(r.column);
|
|
967
973
|
}
|
|
968
|
-
function
|
|
969
|
-
const r = [...e].sort((
|
|
970
|
-
for (const
|
|
971
|
-
t.set(
|
|
972
|
-
const i = [...
|
|
973
|
-
n.set(
|
|
974
|
-
const
|
|
975
|
-
for (const u of
|
|
976
|
-
|
|
977
|
-
s.set(
|
|
974
|
+
function Bt(e) {
|
|
975
|
+
const r = [...e].sort((o, i) => i.name.length - o.name.length), t = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
|
|
976
|
+
for (const o of e) {
|
|
977
|
+
t.set(o.name, o);
|
|
978
|
+
const i = [...o.columns].sort((u, c2) => c2.name.length - u.name.length);
|
|
979
|
+
n.set(o.name, i);
|
|
980
|
+
const a = /* @__PURE__ */ new Map;
|
|
981
|
+
for (const u of o.columns)
|
|
982
|
+
a.set(u.name, u);
|
|
983
|
+
s.set(o.name, a);
|
|
978
984
|
}
|
|
979
985
|
return {
|
|
980
986
|
sortedTables: r,
|
|
@@ -983,34 +989,34 @@ function Nt2(e) {
|
|
|
983
989
|
columnMap: s
|
|
984
990
|
};
|
|
985
991
|
}
|
|
986
|
-
function
|
|
987
|
-
if (!e.startsWith(
|
|
988
|
-
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
989
|
-
const t = e.slice(
|
|
992
|
+
function Je(e, r) {
|
|
993
|
+
if (!e.startsWith(F))
|
|
994
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`);
|
|
995
|
+
const t = e.slice(F.length);
|
|
990
996
|
if (!t)
|
|
991
|
-
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
997
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`);
|
|
992
998
|
let s, n;
|
|
993
999
|
for (const m2 of r.sortedTables)
|
|
994
1000
|
if (t.startsWith(m2.name + ".")) {
|
|
995
1001
|
const y = t.slice(m2.name.length + 1);
|
|
996
1002
|
if (!y)
|
|
997
|
-
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
1003
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`);
|
|
998
1004
|
s = m2, n = y;
|
|
999
1005
|
break;
|
|
1000
1006
|
}
|
|
1001
1007
|
if (!s) {
|
|
1002
1008
|
const m2 = t.indexOf(".");
|
|
1003
1009
|
if (m2 === -1)
|
|
1004
|
-
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
1010
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`);
|
|
1005
1011
|
const y = t.slice(0, m2);
|
|
1006
1012
|
throw new Error(`Table "${y}" not found in the data model`);
|
|
1007
1013
|
}
|
|
1008
|
-
const
|
|
1009
|
-
if (!
|
|
1014
|
+
const o = r.tableColumnMap.get(s.name);
|
|
1015
|
+
if (!o)
|
|
1010
1016
|
throw new Error(`Table "${s.name}" found but has no columns`);
|
|
1011
|
-
let i,
|
|
1017
|
+
let i, a;
|
|
1012
1018
|
const u = g.all;
|
|
1013
|
-
for (const m2 of
|
|
1019
|
+
for (const m2 of o) {
|
|
1014
1020
|
if (n === m2.name)
|
|
1015
1021
|
return { table: s, column: m2 };
|
|
1016
1022
|
if (!n.startsWith(m2.name + "."))
|
|
@@ -1018,55 +1024,55 @@ function Le(e, r) {
|
|
|
1018
1024
|
const y = n.slice(m2.name.length + 1);
|
|
1019
1025
|
if (!y)
|
|
1020
1026
|
continue;
|
|
1021
|
-
const
|
|
1022
|
-
if (
|
|
1023
|
-
if (
|
|
1027
|
+
const x2 = u.includes(y), f2 = wr(m2.dataType);
|
|
1028
|
+
if (x2) {
|
|
1029
|
+
if (f2)
|
|
1024
1030
|
return { table: s, column: m2, level: y };
|
|
1025
|
-
i || (i = m2,
|
|
1031
|
+
i || (i = m2, a = y);
|
|
1026
1032
|
continue;
|
|
1027
1033
|
}
|
|
1028
|
-
|
|
1034
|
+
f2 && !i && (i = m2, a = y);
|
|
1029
1035
|
}
|
|
1030
|
-
if (i &&
|
|
1031
|
-
throw u.includes(
|
|
1032
|
-
const
|
|
1036
|
+
if (i && a)
|
|
1037
|
+
throw u.includes(a) ? new Error(`Invalid date level "${a}" in dimensional element "${e}". Column "${s.name}.${i.name}" is not a datetime column`) : new Error(`Invalid date level "${a}" in dimensional element "${e}". Valid levels are: ${u.join(", ")}`);
|
|
1038
|
+
const c2 = n.indexOf("."), p2 = c2 === -1 ? n : n.slice(0, c2);
|
|
1033
1039
|
throw new Error(`Column "${p2}" not found in table "${s.name}"`);
|
|
1034
1040
|
}
|
|
1035
|
-
function
|
|
1036
|
-
const { table: t, column: s, level: n } =
|
|
1041
|
+
function Pt(e, r) {
|
|
1042
|
+
const { table: t, column: s, level: n } = Je(e, r);
|
|
1037
1043
|
if (n) {
|
|
1038
|
-
if (!
|
|
1044
|
+
if (!wr(s.dataType))
|
|
1039
1045
|
throw new Error(`Invalid date level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is not a datetime column`);
|
|
1040
|
-
const
|
|
1041
|
-
if (!
|
|
1042
|
-
throw new Error(`Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${
|
|
1046
|
+
const o = g.all;
|
|
1047
|
+
if (!o.includes(n))
|
|
1048
|
+
throw new Error(`Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${o.join(", ")}`);
|
|
1043
1049
|
const i = g.dateOnly;
|
|
1044
1050
|
if (s.dataType === "date" && !i.includes(n))
|
|
1045
1051
|
throw new Error(`Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a date column, not a datetime column`);
|
|
1046
|
-
const
|
|
1047
|
-
if (s.dataType === "time" && !
|
|
1052
|
+
const a = g.timeOnly;
|
|
1053
|
+
if (s.dataType === "time" && !a.includes(n))
|
|
1048
1054
|
throw new Error(`Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a time column, not a date column`);
|
|
1049
1055
|
}
|
|
1050
1056
|
return { column: s, level: n };
|
|
1051
1057
|
}
|
|
1052
|
-
function
|
|
1058
|
+
function Ke(e) {
|
|
1053
1059
|
return e.type === E.TextAttribute;
|
|
1054
1060
|
}
|
|
1055
|
-
function
|
|
1061
|
+
function Ge(e) {
|
|
1056
1062
|
return e.type === E.NumericAttribute;
|
|
1057
1063
|
}
|
|
1058
|
-
function
|
|
1064
|
+
function kt(e) {
|
|
1059
1065
|
return e.type === E.DateLevel;
|
|
1060
1066
|
}
|
|
1061
|
-
function
|
|
1062
|
-
return
|
|
1067
|
+
function Lt(e) {
|
|
1068
|
+
return Ke(e) || Ge(e);
|
|
1063
1069
|
}
|
|
1064
|
-
function
|
|
1070
|
+
function G(e) {
|
|
1065
1071
|
return e.type === E.TextAttribute ? "text" : e.type === E.NumericAttribute ? "numeric" : e.type === E.DateLevel ? "date/datetime" : "unknown";
|
|
1066
1072
|
}
|
|
1067
|
-
function
|
|
1068
|
-
const { column: s, level: n } =
|
|
1069
|
-
return
|
|
1073
|
+
function Q(e, r, t) {
|
|
1074
|
+
const { column: s, level: n } = Pt(e, t);
|
|
1075
|
+
return Nr({
|
|
1070
1076
|
expression: s.expression,
|
|
1071
1077
|
dataType: s.dataType,
|
|
1072
1078
|
granularity: n,
|
|
@@ -1075,11 +1081,11 @@ function ce(e, r, t) {
|
|
|
1075
1081
|
dataSource: r
|
|
1076
1082
|
});
|
|
1077
1083
|
}
|
|
1078
|
-
function
|
|
1079
|
-
const { column: s, level: n } =
|
|
1084
|
+
function Vt2(e, r, t) {
|
|
1085
|
+
const { column: s, level: n } = Je(e, t);
|
|
1080
1086
|
if (n)
|
|
1081
|
-
throw new Error(`Invalid DateDimension name format: "${e}". Expected format: "${
|
|
1082
|
-
if (!
|
|
1087
|
+
throw new Error(`Invalid DateDimension name format: "${e}". Expected format: "${F}TableName.ColumnName"`);
|
|
1088
|
+
if (!wr(s.dataType))
|
|
1083
1089
|
throw new Error(`Invalid DateDimension name "${e}". Column "${s.name}" is not a datetime column (got ${s.dataType}).`);
|
|
1084
1090
|
return x({
|
|
1085
1091
|
name: s.name,
|
|
@@ -1091,11 +1097,31 @@ function M(e, r) {
|
|
|
1091
1097
|
const t = e();
|
|
1092
1098
|
return t.success ? t.data : (r.push(...t.errors), null);
|
|
1093
1099
|
}
|
|
1094
|
-
var
|
|
1100
|
+
var _t = (e, r, t) => {
|
|
1101
|
+
if (!r)
|
|
1102
|
+
return { attribute: e };
|
|
1103
|
+
const s = typeof r == "object" ? r.direction : r;
|
|
1104
|
+
return mp(s) ? { attribute: e.sort(ap(s)) } : {
|
|
1105
|
+
attribute: e,
|
|
1106
|
+
error: h2(g2({}, t), {
|
|
1107
|
+
message: `Invalid sort type. Expected "sortAsc", "sortDesc", or "sortNone". Got: "${s}".`
|
|
1108
|
+
})
|
|
1109
|
+
};
|
|
1110
|
+
};
|
|
1111
|
+
var Ut = (e, r, t, s) => {
|
|
1112
|
+
const n = Q(e.column, r, t);
|
|
1113
|
+
return _t(n, e.sortType, s);
|
|
1114
|
+
};
|
|
1115
|
+
var Wt = (e, r, t, s) => typeof e == "string" ? { attribute: Q(e, r, t) } : It(e) ? Ut(e, r, t, s) : {
|
|
1116
|
+
error: h2(g2({}, s), {
|
|
1117
|
+
message: 'Invalid dimension item. Expected a string (composeCode) or object with "column" and optional "sortType".'
|
|
1118
|
+
})
|
|
1119
|
+
};
|
|
1120
|
+
var jt = (e) => {
|
|
1095
1121
|
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
1096
1122
|
if (!r)
|
|
1097
1123
|
return { success: true, data: [] };
|
|
1098
|
-
if (!
|
|
1124
|
+
if (!Array.isArray(r))
|
|
1099
1125
|
return {
|
|
1100
1126
|
success: false,
|
|
1101
1127
|
errors: [
|
|
@@ -1103,68 +1129,118 @@ var It = (e) => {
|
|
|
1103
1129
|
category: "dimensions",
|
|
1104
1130
|
index: -1,
|
|
1105
1131
|
input: r,
|
|
1106
|
-
message: "Invalid dimensions JSON. Expected an array
|
|
1132
|
+
message: "Invalid dimensions JSON. Expected an array."
|
|
1107
1133
|
}
|
|
1108
1134
|
]
|
|
1109
1135
|
};
|
|
1110
|
-
const n = [],
|
|
1111
|
-
return r.forEach((i,
|
|
1136
|
+
const n = [], o = [];
|
|
1137
|
+
return r.forEach((i, a) => {
|
|
1112
1138
|
const u = {
|
|
1113
1139
|
category: "dimensions",
|
|
1114
|
-
index:
|
|
1140
|
+
index: a,
|
|
1115
1141
|
input: i
|
|
1116
1142
|
};
|
|
1117
1143
|
try {
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1144
|
+
const c2 = Wt(i, t, s, u);
|
|
1145
|
+
if (c2.error) {
|
|
1146
|
+
o.push(c2.error);
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
c2.attribute && n.push(c2.attribute);
|
|
1150
|
+
} catch (c2) {
|
|
1151
|
+
const p2 = c2 instanceof Error ? c2.message : "Unknown error";
|
|
1152
|
+
o.push(h2(g2({}, u), { message: p2 }));
|
|
1123
1153
|
}
|
|
1124
|
-
}),
|
|
1154
|
+
}), o.length > 0 ? { success: false, errors: o } : { success: true, data: n };
|
|
1125
1155
|
};
|
|
1126
|
-
function
|
|
1156
|
+
function de(e, r) {
|
|
1127
1157
|
const t = Reflect.get(e, r);
|
|
1128
1158
|
if (typeof t != "function")
|
|
1129
1159
|
throw new Error(`Function "${r}" not found or is not a function`);
|
|
1130
1160
|
return t;
|
|
1131
1161
|
}
|
|
1132
|
-
function
|
|
1133
|
-
const t = e.replace("measureFactory.", ""), n =
|
|
1134
|
-
if (!
|
|
1162
|
+
function Jt2(e, r) {
|
|
1163
|
+
const t = e.replace("measureFactory.", ""), n = de(zh, t)(...r);
|
|
1164
|
+
if (!fe(n))
|
|
1135
1165
|
throw new Error(`Function "${e}" did not return a valid Measure`);
|
|
1136
1166
|
return n;
|
|
1137
1167
|
}
|
|
1138
|
-
function
|
|
1139
|
-
const t = e.replace("filterFactory.logic.", ""), n =
|
|
1140
|
-
if (!
|
|
1168
|
+
function Kt(e, r) {
|
|
1169
|
+
const t = e.replace("filterFactory.logic.", ""), n = de(ye, t)(...r);
|
|
1170
|
+
if (!U(n))
|
|
1141
1171
|
throw new Error(`Function "${e}" did not return a valid FilterRelations`);
|
|
1142
1172
|
return n;
|
|
1143
1173
|
}
|
|
1144
|
-
function
|
|
1174
|
+
function Gt(e, r) {
|
|
1145
1175
|
if (e.startsWith("filterFactory.logic."))
|
|
1146
|
-
return
|
|
1147
|
-
const t = e.replace("filterFactory.", ""), n =
|
|
1148
|
-
if (!K(n) && !
|
|
1176
|
+
return Kt(e, r);
|
|
1177
|
+
const t = e.replace("filterFactory.", ""), n = de(tp, t)(...r);
|
|
1178
|
+
if (!K(n) && !U(n))
|
|
1149
1179
|
throw new Error(`Function "${e}" did not return a valid Filter or FilterRelations`);
|
|
1150
1180
|
return n;
|
|
1151
1181
|
}
|
|
1152
|
-
function
|
|
1182
|
+
function Qt(e, r) {
|
|
1153
1183
|
const s = e.split(".")[0];
|
|
1154
1184
|
if (s === "measureFactory")
|
|
1155
|
-
return
|
|
1185
|
+
return Jt2(e, r);
|
|
1156
1186
|
if (s === "filterFactory")
|
|
1157
|
-
return
|
|
1187
|
+
return Gt(e, r);
|
|
1158
1188
|
throw new Error(`Unsupported factory: "${s}". Supported factories: measureFactory, filterFactory`);
|
|
1159
1189
|
}
|
|
1160
|
-
var
|
|
1161
|
-
|
|
1190
|
+
var Yt = /\[(\w[\w.-]*)\]/g;
|
|
1191
|
+
var Qe = /* @__PURE__ */ new Set([
|
|
1192
|
+
"AVG",
|
|
1193
|
+
"COUNT",
|
|
1194
|
+
"DUPCOUNT",
|
|
1195
|
+
"LARGEST",
|
|
1196
|
+
"MAX",
|
|
1197
|
+
"MEDIAN",
|
|
1198
|
+
"MIN",
|
|
1199
|
+
"MODE",
|
|
1200
|
+
"SUM",
|
|
1201
|
+
"WTDAVG",
|
|
1202
|
+
"WTDSUM",
|
|
1203
|
+
"MTDAVG",
|
|
1204
|
+
"MTDSUM",
|
|
1205
|
+
"QTDAVG",
|
|
1206
|
+
"QTDSUM",
|
|
1207
|
+
"YTDAVG",
|
|
1208
|
+
"YTDSUM",
|
|
1209
|
+
"CORREL",
|
|
1210
|
+
"COVARP",
|
|
1211
|
+
"COVAR",
|
|
1212
|
+
"SKEWP",
|
|
1213
|
+
"SKEW",
|
|
1214
|
+
"SLOPE"
|
|
1215
|
+
]);
|
|
1216
|
+
var Ht = new RegExp(`\\b(${Array.from(Qe).join("|")})\\s*\\(`, "i");
|
|
1217
|
+
function Zt(e) {
|
|
1218
|
+
return E3(e) ? true : typeof e == "string" && e.startsWith(F) ? false : e && typeof e == "object" && ("kind" in e) ? e.kind === "measure" : true;
|
|
1219
|
+
}
|
|
1220
|
+
function Xt(e) {
|
|
1221
|
+
const r = /\b(\w+)\s*\(/g, t = /* @__PURE__ */ new Set;
|
|
1222
|
+
let s;
|
|
1223
|
+
for (;(s = r.exec(e)) !== null; ) {
|
|
1224
|
+
const n = s[1];
|
|
1225
|
+
Qe.has(n.toUpperCase()) || t.add(n);
|
|
1226
|
+
}
|
|
1227
|
+
return Array.from(t);
|
|
1228
|
+
}
|
|
1229
|
+
function vt(e) {
|
|
1230
|
+
return e.length === 1 ? `[${e[0]}]` : e.map((r) => `[${r}]`).join(", ");
|
|
1231
|
+
}
|
|
1232
|
+
function es(e) {
|
|
1233
|
+
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1234
|
+
}
|
|
1235
|
+
var B = (e) => e.startsWith("[") ? e : `[${e}]`;
|
|
1236
|
+
var Ee = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1237
|
+
function rs(e, r, t = {}) {
|
|
1162
1238
|
const {
|
|
1163
1239
|
warnUnusedContext: s = true,
|
|
1164
1240
|
errorOnUnusedContext: n = true,
|
|
1165
|
-
allowEmptyFormula:
|
|
1241
|
+
allowEmptyFormula: o = false,
|
|
1166
1242
|
errorPrefix: i = "customFormula validation"
|
|
1167
|
-
} = t,
|
|
1243
|
+
} = t, a = {
|
|
1168
1244
|
isValid: true,
|
|
1169
1245
|
errors: [],
|
|
1170
1246
|
warnings: [],
|
|
@@ -1172,138 +1248,140 @@ function Lt(e, r, t = {}) {
|
|
|
1172
1248
|
unusedContextKeys: []
|
|
1173
1249
|
};
|
|
1174
1250
|
if (!e || e.trim().length === 0)
|
|
1175
|
-
return
|
|
1176
|
-
const u = /\b\w+\s*\[/gi,
|
|
1177
|
-
if (
|
|
1178
|
-
const f2 =
|
|
1179
|
-
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1251
|
+
return o || (a.errors.push(`${i}args[1]: Formula cannot be empty`), a.isValid = false), a;
|
|
1252
|
+
const u = /\b\w+\s*\[/gi, c2 = e.match(u);
|
|
1253
|
+
if (c2) {
|
|
1254
|
+
const f2 = c2[0].replace(/\s*\[.*$/, "");
|
|
1255
|
+
a.errors.push(`${i}args[1]: Invalid syntax: '${f2}' - operator cannot be used before bracket reference without parentheses`), a.isValid = false;
|
|
1256
|
+
}
|
|
1257
|
+
a.references = [
|
|
1258
|
+
...new Set([...e.matchAll(new RegExp(Yt.source, "g"))].map((f2) => f2[1]))
|
|
1259
|
+
];
|
|
1260
|
+
const p2 = Object.keys(r);
|
|
1261
|
+
if (a.references.length === 0)
|
|
1262
|
+
return a.warnings.push(`${i}args[1]: No bracket references found in formula - ensure this is intentional`), a;
|
|
1263
|
+
if (p2.length === 0)
|
|
1264
|
+
return a.errors.push(`${i}args[2]: Context cannot be empty - custom formulas require context definitions`), a.isValid = false, a;
|
|
1265
|
+
const m2 = new Set(p2.map(B)), y = a.references.filter((f2) => !m2.has(B(f2)));
|
|
1266
|
+
if (y.length > 0) {
|
|
1267
|
+
a.isValid = false;
|
|
1268
|
+
const f2 = p2.map((d) => `[${Ee(d)}]`).join(", ");
|
|
1269
|
+
y.length === 1 ? a.errors.push(`${i}args[1]: Reference [${y[0]}] not found in context. Available keys: ${f2}`) : a.errors.push(`${i}args[1]: References [${y.join("], [")}] not found in context. Available keys: ${f2}`);
|
|
1270
|
+
}
|
|
1271
|
+
if (!Ht.test(e)) {
|
|
1272
|
+
const f2 = a.references.filter((d) => {
|
|
1273
|
+
var $;
|
|
1274
|
+
const w = ($ = r[B(d)]) != null ? $ : r[d];
|
|
1275
|
+
return w !== undefined && !Zt(w);
|
|
1276
|
+
});
|
|
1277
|
+
f2.length > 0 && (a.errors.push(`${i}args[1]: ${es(Xt(e))}Bracket reference(s) ${vt(f2)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`), a.isValid = false);
|
|
1278
|
+
}
|
|
1279
|
+
if ((s || n) && p2.length > 0) {
|
|
1280
|
+
const f2 = new Set(a.references.map(B)), d = p2.filter((w) => !f2.has(B(w)));
|
|
1281
|
+
if (a.unusedContextKeys = d, d.length > 0) {
|
|
1282
|
+
const w = d.map((D) => `[${Ee(D)}]`).join(", "), $ = `${i}args[2]: Context keys ${w} are defined but not used in formula`;
|
|
1283
|
+
n ? (a.errors.push($), a.isValid = false) : s && a.warnings.push($);
|
|
1206
1284
|
}
|
|
1207
1285
|
}
|
|
1208
|
-
return
|
|
1286
|
+
return a;
|
|
1209
1287
|
}
|
|
1210
|
-
function
|
|
1211
|
-
const s =
|
|
1288
|
+
function ts(e, r, t = {}) {
|
|
1289
|
+
const s = rs(e, r, t);
|
|
1212
1290
|
if (!s.isValid)
|
|
1213
1291
|
throw new Error(s.errors.join("; "));
|
|
1214
1292
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1215
1293
|
}
|
|
1216
|
-
function
|
|
1294
|
+
function ss(e, r) {
|
|
1217
1295
|
if (e.length < 3 || e.length > 5)
|
|
1218
1296
|
throw new Error(`${r.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`);
|
|
1219
1297
|
const t = e[1], s = e[2];
|
|
1220
|
-
|
|
1298
|
+
ts(t, s, {
|
|
1221
1299
|
errorPrefix: `${r.pathPrefix}`,
|
|
1222
1300
|
errorOnUnusedContext: true,
|
|
1223
1301
|
allowEmptyFormula: false
|
|
1224
1302
|
});
|
|
1225
1303
|
const n = {};
|
|
1226
|
-
for (const [
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1229
|
-
n[`${
|
|
1304
|
+
for (const [o, i] of Object.entries(s)) {
|
|
1305
|
+
const a = `args[2].${o}`;
|
|
1306
|
+
if (E3(i))
|
|
1307
|
+
n[`${o}`] = C2({
|
|
1230
1308
|
data: i,
|
|
1231
1309
|
context: {
|
|
1232
1310
|
dataSource: r.dataSource,
|
|
1233
1311
|
schemaIndex: r.schemaIndex,
|
|
1234
|
-
pathPrefix:
|
|
1312
|
+
pathPrefix: a
|
|
1235
1313
|
}
|
|
1236
1314
|
});
|
|
1237
|
-
else if (typeof i == "string" && i.startsWith(
|
|
1315
|
+
else if (typeof i == "string" && i.startsWith(F))
|
|
1238
1316
|
try {
|
|
1239
|
-
n[`${
|
|
1317
|
+
n[`${o}`] = Q(i, r.dataSource, r.schemaIndex);
|
|
1240
1318
|
} catch (u) {
|
|
1241
|
-
const
|
|
1242
|
-
throw new Error(`${
|
|
1319
|
+
const c2 = u instanceof Error ? u.message : "Unknown error";
|
|
1320
|
+
throw new Error(`${a}: ${c2}`);
|
|
1243
1321
|
}
|
|
1244
1322
|
else if (i && typeof i == "object" && "kind" in i)
|
|
1245
|
-
n[`${
|
|
1323
|
+
n[`${o}`] = i;
|
|
1246
1324
|
else
|
|
1247
|
-
throw new Error(`${
|
|
1325
|
+
throw new Error(`${a}: Invalid context value for key '${o}'. Expected a function call or attribute reference (${F}...), but got: ${typeof i}`);
|
|
1248
1326
|
}
|
|
1249
1327
|
e[2] = n;
|
|
1250
1328
|
}
|
|
1251
|
-
function
|
|
1329
|
+
function me2(e, r) {
|
|
1252
1330
|
const t = e[0];
|
|
1253
1331
|
if (!t || typeof t != "object" || !("type" in t))
|
|
1254
1332
|
throw new Error(`${r.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1255
1333
|
return t;
|
|
1256
1334
|
}
|
|
1257
|
-
function
|
|
1258
|
-
const t =
|
|
1259
|
-
if (!
|
|
1260
|
-
throw new Error(`${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${
|
|
1335
|
+
function Ce(e, r) {
|
|
1336
|
+
const t = me2(e, r);
|
|
1337
|
+
if (!Lt(t))
|
|
1338
|
+
throw new Error(`${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${G(t)} attribute`);
|
|
1261
1339
|
}
|
|
1262
|
-
function
|
|
1263
|
-
const t =
|
|
1264
|
-
if (!
|
|
1265
|
-
throw new Error(`${r.pathPrefix}args[0]: Attribute must be numeric type, got ${
|
|
1340
|
+
function T2(e, r) {
|
|
1341
|
+
const t = me2(e, r);
|
|
1342
|
+
if (!Ge(t))
|
|
1343
|
+
throw new Error(`${r.pathPrefix}args[0]: Attribute must be numeric type, got ${G(t)} attribute`);
|
|
1266
1344
|
}
|
|
1267
|
-
function
|
|
1268
|
-
const t =
|
|
1269
|
-
if (!
|
|
1270
|
-
throw new Error(`${r.pathPrefix}args[0]: Attribute must be string type, got ${
|
|
1345
|
+
function N(e, r) {
|
|
1346
|
+
const t = me2(e, r);
|
|
1347
|
+
if (!Ke(t))
|
|
1348
|
+
throw new Error(`${r.pathPrefix}args[0]: Attribute must be string type, got ${G(t)} attribute`);
|
|
1271
1349
|
}
|
|
1272
|
-
function
|
|
1350
|
+
function ns(e, r) {
|
|
1273
1351
|
const t = e[0];
|
|
1274
1352
|
if (!t || typeof t != "object" || !("attribute" in t))
|
|
1275
1353
|
throw new Error(`${r.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1276
1354
|
return t;
|
|
1277
1355
|
}
|
|
1278
|
-
function
|
|
1279
|
-
const t =
|
|
1280
|
-
if (!
|
|
1356
|
+
function is(e, r) {
|
|
1357
|
+
const t = ns(e, r);
|
|
1358
|
+
if (!Wh(t))
|
|
1281
1359
|
throw new Error(`${r.pathPrefix}args[0]: exclude filter only accepts members filter, got ${t.__serializable || "unknown"} filter`);
|
|
1282
1360
|
}
|
|
1283
|
-
var
|
|
1284
|
-
"measureFactory.customFormula":
|
|
1285
|
-
"filterFactory.equals":
|
|
1286
|
-
"filterFactory.doesntEqual":
|
|
1287
|
-
"filterFactory.greaterThan":
|
|
1288
|
-
"filterFactory.greaterThanOrEqual":
|
|
1289
|
-
"filterFactory.lessThan":
|
|
1290
|
-
"filterFactory.lessThanOrEqual":
|
|
1291
|
-
"filterFactory.between":
|
|
1292
|
-
"filterFactory.betweenNotEqual":
|
|
1293
|
-
"filterFactory.numeric":
|
|
1294
|
-
"filterFactory.contains":
|
|
1295
|
-
"filterFactory.doesntContain":
|
|
1296
|
-
"filterFactory.startsWith":
|
|
1297
|
-
"filterFactory.doesntStartWith":
|
|
1298
|
-
"filterFactory.endsWith":
|
|
1299
|
-
"filterFactory.doesntEndWith":
|
|
1300
|
-
"filterFactory.like":
|
|
1301
|
-
"filterFactory.exclude":
|
|
1361
|
+
var os = {
|
|
1362
|
+
"measureFactory.customFormula": ss,
|
|
1363
|
+
"filterFactory.equals": Ce,
|
|
1364
|
+
"filterFactory.doesntEqual": Ce,
|
|
1365
|
+
"filterFactory.greaterThan": T2,
|
|
1366
|
+
"filterFactory.greaterThanOrEqual": T2,
|
|
1367
|
+
"filterFactory.lessThan": T2,
|
|
1368
|
+
"filterFactory.lessThanOrEqual": T2,
|
|
1369
|
+
"filterFactory.between": T2,
|
|
1370
|
+
"filterFactory.betweenNotEqual": T2,
|
|
1371
|
+
"filterFactory.numeric": T2,
|
|
1372
|
+
"filterFactory.contains": N,
|
|
1373
|
+
"filterFactory.doesntContain": N,
|
|
1374
|
+
"filterFactory.startsWith": N,
|
|
1375
|
+
"filterFactory.doesntStartWith": N,
|
|
1376
|
+
"filterFactory.endsWith": N,
|
|
1377
|
+
"filterFactory.doesntEndWith": N,
|
|
1378
|
+
"filterFactory.like": N,
|
|
1379
|
+
"filterFactory.exclude": is
|
|
1302
1380
|
};
|
|
1303
|
-
function
|
|
1304
|
-
return
|
|
1381
|
+
function as(e) {
|
|
1382
|
+
return os[`${e}`];
|
|
1305
1383
|
}
|
|
1306
|
-
var
|
|
1384
|
+
var us = {
|
|
1307
1385
|
"measureFactory.sum": [
|
|
1308
1386
|
{ type: "Attribute", required: true },
|
|
1309
1387
|
{ type: "string", required: false },
|
|
@@ -1722,18 +1800,18 @@ var Qt2 = {
|
|
|
1722
1800
|
{ type: "FilterRelationsNode", required: true }
|
|
1723
1801
|
]
|
|
1724
1802
|
};
|
|
1725
|
-
function
|
|
1726
|
-
return
|
|
1803
|
+
function pe(e) {
|
|
1804
|
+
return us[`${e}`];
|
|
1727
1805
|
}
|
|
1728
|
-
function
|
|
1729
|
-
const r =
|
|
1806
|
+
function cs(e) {
|
|
1807
|
+
const r = pe(e);
|
|
1730
1808
|
return r ? r.filter((t) => t.required).length : 0;
|
|
1731
1809
|
}
|
|
1732
|
-
function
|
|
1733
|
-
const r =
|
|
1810
|
+
function ls(e) {
|
|
1811
|
+
const r = pe(e);
|
|
1734
1812
|
return r ? r.length : 0;
|
|
1735
1813
|
}
|
|
1736
|
-
function
|
|
1814
|
+
function fs(e) {
|
|
1737
1815
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
1738
1816
|
return false;
|
|
1739
1817
|
const t = Date.parse(e);
|
|
@@ -1743,259 +1821,260 @@ function Zt(e) {
|
|
|
1743
1821
|
return !isNaN(s.getTime());
|
|
1744
1822
|
}
|
|
1745
1823
|
function Z2(e, r, t, s) {
|
|
1746
|
-
if (e.startsWith(
|
|
1824
|
+
if (e.startsWith(F))
|
|
1747
1825
|
try {
|
|
1748
|
-
return
|
|
1826
|
+
return Q(e, r, t);
|
|
1749
1827
|
} catch (n) {
|
|
1750
|
-
const
|
|
1751
|
-
throw new Error(`${s}: ${
|
|
1828
|
+
const o = n instanceof Error ? n.message : "Unknown error";
|
|
1829
|
+
throw new Error(`${s}: ${o}`);
|
|
1752
1830
|
}
|
|
1753
|
-
throw new Error(`${s}: Invalid attribute "${e}". Expected format: "${
|
|
1831
|
+
throw new Error(`${s}: Invalid attribute "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`);
|
|
1754
1832
|
}
|
|
1755
|
-
function
|
|
1756
|
-
if (e.startsWith(
|
|
1833
|
+
function ds(e, r, t, s) {
|
|
1834
|
+
if (e.startsWith(F))
|
|
1757
1835
|
try {
|
|
1758
|
-
return
|
|
1836
|
+
return Vt2(e, r, t);
|
|
1759
1837
|
} catch (n) {
|
|
1760
|
-
const
|
|
1761
|
-
throw new Error(`${s}: ${
|
|
1838
|
+
const o = n instanceof Error ? n.message : "Unknown error";
|
|
1839
|
+
throw new Error(`${s}: ${o}`);
|
|
1762
1840
|
}
|
|
1763
|
-
throw new Error(`${s}: Invalid date dimension string "${e}". Expected format: "${
|
|
1841
|
+
throw new Error(`${s}: Invalid date dimension string "${e}". Expected format: "${F}TableName.ColumnName"`);
|
|
1764
1842
|
}
|
|
1765
|
-
function
|
|
1766
|
-
const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix:
|
|
1843
|
+
function ms(e) {
|
|
1844
|
+
const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix: o } = e.context, i = o;
|
|
1767
1845
|
if (r === undefined) {
|
|
1768
1846
|
if (t.required)
|
|
1769
1847
|
throw new Error(`${i}: Required argument is missing (expected ${t.type})`);
|
|
1770
1848
|
return;
|
|
1771
1849
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
case "Measure":
|
|
1810
|
-
case "BaseMeasure":
|
|
1811
|
-
if (!x2(r))
|
|
1812
|
-
throw new Error(`${i}: Expected measure function call, got ${typeof r}. Example: {"function": "measureFactory.sum", "args": ["DM.Commerce.Revenue"]}`);
|
|
1813
|
-
return C({
|
|
1814
|
-
data: r,
|
|
1815
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1816
|
-
});
|
|
1817
|
-
case "Measure[]":
|
|
1818
|
-
if (!Array.isArray(r))
|
|
1819
|
-
throw new Error(`${i}: Expected array of measure function calls, got ${typeof r}`);
|
|
1820
|
-
return r.map((o, u) => {
|
|
1821
|
-
if (!x2(o))
|
|
1822
|
-
throw new Error(`${i}[${u}]: Expected measure function call, got ${typeof o}`);
|
|
1823
|
-
return C({
|
|
1824
|
-
data: o,
|
|
1825
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1850
|
+
if (!(r === null && !t.required))
|
|
1851
|
+
switch (t.type) {
|
|
1852
|
+
case "string":
|
|
1853
|
+
if (typeof r != "string")
|
|
1854
|
+
throw new Error(`${i}: Expected string, got ${typeof r}`);
|
|
1855
|
+
return r;
|
|
1856
|
+
case "number":
|
|
1857
|
+
if (typeof r != "number")
|
|
1858
|
+
throw new Error(`${i}: Expected number, got ${typeof r}`);
|
|
1859
|
+
return r;
|
|
1860
|
+
case "boolean":
|
|
1861
|
+
if (typeof r != "boolean")
|
|
1862
|
+
throw new Error(`${i}: Expected boolean, got ${typeof r}`);
|
|
1863
|
+
return r;
|
|
1864
|
+
case "string[]":
|
|
1865
|
+
if (!Array.isArray(r))
|
|
1866
|
+
throw new Error(`${i}: Expected array of strings, got ${typeof r}. Example: ["value1", "value2"]`);
|
|
1867
|
+
if (!r.every((a) => typeof a == "string"))
|
|
1868
|
+
throw new Error(`${i}: Expected array of strings, but contains non-string values`);
|
|
1869
|
+
return r;
|
|
1870
|
+
case "number[]":
|
|
1871
|
+
if (!Array.isArray(r))
|
|
1872
|
+
throw new Error(`${i}: Expected array of numbers, got ${typeof r}. Example: [10, 20]`);
|
|
1873
|
+
if (!r.every((a) => typeof a == "number"))
|
|
1874
|
+
throw new Error(`${i}: Expected array of numbers, but contains non-number values`);
|
|
1875
|
+
return r;
|
|
1876
|
+
case "Attribute":
|
|
1877
|
+
if (typeof r != "string")
|
|
1878
|
+
throw new Error(`${i}: Expected attribute string, got ${typeof r}. Example: "DM.Commerce.Revenue"`);
|
|
1879
|
+
return Z2(r, s, n, i);
|
|
1880
|
+
case "Attribute[]":
|
|
1881
|
+
if (!Array.isArray(r))
|
|
1882
|
+
throw new Error(`${i}: Expected array of attributes, got ${typeof r}. Example: ["DM.Commerce.AgeRange"]`);
|
|
1883
|
+
return r.map((a, u) => {
|
|
1884
|
+
if (typeof a != "string")
|
|
1885
|
+
throw new Error(`${i}[${u}]: Expected attribute string, got ${typeof a}`);
|
|
1886
|
+
return Z2(a, s, n, `${i}[${u}]`);
|
|
1826
1887
|
});
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
});
|
|
1835
|
-
case "Filter[]":
|
|
1836
|
-
if (!Array.isArray(r))
|
|
1837
|
-
throw new Error(`${i}: Expected array of filter function calls, got ${typeof r}`);
|
|
1838
|
-
return r.map((o, u) => {
|
|
1839
|
-
if (!x2(o))
|
|
1840
|
-
throw new Error(`${i}[${u}]: Expected filter function call, got ${typeof o}`);
|
|
1841
|
-
return C({
|
|
1842
|
-
data: o,
|
|
1843
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1888
|
+
case "Measure":
|
|
1889
|
+
case "BaseMeasure":
|
|
1890
|
+
if (!E3(r))
|
|
1891
|
+
throw new Error(`${i}: Expected measure function call, got ${typeof r}. Example: {"function": "measureFactory.sum", "args": ["DM.Commerce.Revenue"]}`);
|
|
1892
|
+
return C2({
|
|
1893
|
+
data: r,
|
|
1894
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1844
1895
|
});
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
return r.map((
|
|
1849
|
-
if (!
|
|
1850
|
-
throw new Error(`${i}[${u}]: Expected
|
|
1851
|
-
return
|
|
1852
|
-
data:
|
|
1896
|
+
case "Measure[]":
|
|
1897
|
+
if (!Array.isArray(r))
|
|
1898
|
+
throw new Error(`${i}: Expected array of measure function calls, got ${typeof r}`);
|
|
1899
|
+
return r.map((a, u) => {
|
|
1900
|
+
if (!E3(a))
|
|
1901
|
+
throw new Error(`${i}[${u}]: Expected measure function call, got ${typeof a}`);
|
|
1902
|
+
return C2({
|
|
1903
|
+
data: a,
|
|
1853
1904
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1854
1905
|
});
|
|
1855
1906
|
});
|
|
1856
|
-
|
|
1857
|
-
|
|
1907
|
+
case "Filter":
|
|
1908
|
+
if (!E3(r))
|
|
1909
|
+
throw new Error(`${i}: Expected filter function call, got ${typeof r}. Example: {"function": "filterFactory.contains", "args": ["DM.Brand.Brand", "Apple"]}`);
|
|
1910
|
+
return C2({
|
|
1858
1911
|
data: r,
|
|
1859
1912
|
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1860
1913
|
});
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
throw new Error(`${i}: Attribute must be date/datetime type, got ${Q(o)} attribute`);
|
|
1872
|
-
return o;
|
|
1873
|
-
}
|
|
1874
|
-
case "Measure | number":
|
|
1875
|
-
if (typeof r == "number")
|
|
1876
|
-
return r;
|
|
1877
|
-
if (x2(r))
|
|
1878
|
-
return C({
|
|
1879
|
-
data: r,
|
|
1880
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1914
|
+
case "Filter[]":
|
|
1915
|
+
if (!Array.isArray(r))
|
|
1916
|
+
throw new Error(`${i}: Expected array of filter function calls, got ${typeof r}`);
|
|
1917
|
+
return r.map((a, u) => {
|
|
1918
|
+
if (!E3(a))
|
|
1919
|
+
throw new Error(`${i}[${u}]: Expected filter function call, got ${typeof a}`);
|
|
1920
|
+
return C2({
|
|
1921
|
+
data: a,
|
|
1922
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1923
|
+
});
|
|
1881
1924
|
});
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1925
|
+
case "FilterRelationsNode":
|
|
1926
|
+
if (Array.isArray(r))
|
|
1927
|
+
return r.map((a, u) => {
|
|
1928
|
+
if (!E3(a))
|
|
1929
|
+
throw new Error(`${i}[${u}]: Expected filter function call, got ${typeof a}`);
|
|
1930
|
+
return C2({
|
|
1931
|
+
data: a,
|
|
1932
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1933
|
+
});
|
|
1934
|
+
});
|
|
1935
|
+
if (E3(r))
|
|
1936
|
+
return C2({
|
|
1937
|
+
data: r,
|
|
1938
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1939
|
+
});
|
|
1940
|
+
throw new Error(`${i}: Expected filter function call or array of filters, got ${typeof r}`);
|
|
1941
|
+
case "DateDimension":
|
|
1942
|
+
if (typeof r != "string")
|
|
1943
|
+
throw new Error(`${i}: Expected date dimension string, got ${typeof r}. Example: "DM.Commerce.Date"`);
|
|
1944
|
+
return ds(r, s, n, i);
|
|
1945
|
+
case "LevelAttribute": {
|
|
1946
|
+
if (typeof r != "string")
|
|
1947
|
+
throw new Error(`${i}: Expected date attribute string, got ${typeof r}. Example: "DM.Commerce.Date.Years"`);
|
|
1948
|
+
const a = Z2(r, s, n, i);
|
|
1949
|
+
if (!kt(a))
|
|
1950
|
+
throw new Error(`${i}: Attribute must be date/datetime type, got ${G(a)} attribute`);
|
|
1951
|
+
return a;
|
|
1952
|
+
}
|
|
1953
|
+
case "Measure | number":
|
|
1954
|
+
if (typeof r == "number")
|
|
1886
1955
|
return r;
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1956
|
+
if (E3(r))
|
|
1957
|
+
return C2({
|
|
1958
|
+
data: r,
|
|
1959
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1960
|
+
});
|
|
1961
|
+
throw new Error(`${i}: Expected measure function call or number, got ${typeof r}`);
|
|
1962
|
+
case "Date | string":
|
|
1963
|
+
if (typeof r == "string") {
|
|
1964
|
+
if (fs(r))
|
|
1965
|
+
return r;
|
|
1966
|
+
throw new Error(`${i}: Expected valid ISO date string or Date object, got invalid date string "${r}"`);
|
|
1967
|
+
} else {
|
|
1968
|
+
if (r instanceof Date)
|
|
1969
|
+
return r;
|
|
1970
|
+
throw new Error(`${i}: Expected date string or Date object, got ${typeof r}`);
|
|
1971
|
+
}
|
|
1972
|
+
case "string | number":
|
|
1973
|
+
if (typeof r == "string" || typeof r == "number")
|
|
1890
1974
|
return r;
|
|
1891
|
-
throw new Error(`${i}: Expected
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1975
|
+
throw new Error(`${i}: Expected string or number, got ${typeof r}`);
|
|
1976
|
+
case "BaseFilterConfig":
|
|
1977
|
+
case "MembersFilterConfig":
|
|
1978
|
+
case "CustomFormulaContext":
|
|
1979
|
+
case "any":
|
|
1980
|
+
if (r == null && t.required)
|
|
1981
|
+
throw new Error(`${i}: Required argument is null/undefined`);
|
|
1895
1982
|
return r;
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
case "CustomFormulaContext":
|
|
1900
|
-
case "any":
|
|
1901
|
-
if (r == null && t.required)
|
|
1902
|
-
throw new Error(`${i}: Required argument is null/undefined`);
|
|
1903
|
-
return r;
|
|
1904
|
-
default:
|
|
1905
|
-
return r;
|
|
1906
|
-
}
|
|
1983
|
+
default:
|
|
1984
|
+
return r;
|
|
1985
|
+
}
|
|
1907
1986
|
}
|
|
1908
|
-
function
|
|
1909
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function:
|
|
1987
|
+
function C2(e) {
|
|
1988
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function: o, args: i } = r, a = n ? `${n}.` : "", u = pe(o);
|
|
1910
1989
|
if (!u)
|
|
1911
|
-
throw new Error(`${
|
|
1912
|
-
const
|
|
1913
|
-
if (i.length <
|
|
1914
|
-
throw new Error(`${
|
|
1990
|
+
throw new Error(`${a}function: Unknown function "${o}"`);
|
|
1991
|
+
const c2 = cs(o), p2 = ls(o);
|
|
1992
|
+
if (i.length < c2)
|
|
1993
|
+
throw new Error(`${a}function: Expected at least ${c2} arguments, got ${i.length}`);
|
|
1915
1994
|
if (i.length > p2)
|
|
1916
|
-
throw new Error(`${
|
|
1995
|
+
throw new Error(`${a}function: Expected at most ${p2} arguments, got ${i.length}`);
|
|
1917
1996
|
const m2 = [], y = [];
|
|
1918
|
-
for (let
|
|
1919
|
-
const
|
|
1997
|
+
for (let f2 = 0;f2 < Math.max(i.length, u.length); f2++) {
|
|
1998
|
+
const d = u[`${f2}`], w = i[`${f2}`], $ = a ? `${a}args[${f2}]` : `args[${f2}]`;
|
|
1920
1999
|
if (w === undefined) {
|
|
1921
|
-
|
|
2000
|
+
d != null && d.required && y.push(`${$}: Missing required argument (expected ${d.type})`);
|
|
1922
2001
|
continue;
|
|
1923
2002
|
}
|
|
1924
|
-
if (!
|
|
1925
|
-
y.push(`${
|
|
2003
|
+
if (!d) {
|
|
2004
|
+
y.push(`${$}: Unexpected argument`);
|
|
1926
2005
|
continue;
|
|
1927
2006
|
}
|
|
1928
2007
|
try {
|
|
1929
|
-
const
|
|
2008
|
+
const D = ms({
|
|
1930
2009
|
data: w,
|
|
1931
2010
|
context: {
|
|
1932
2011
|
dataSource: t,
|
|
1933
2012
|
schemaIndex: s,
|
|
1934
|
-
pathPrefix:
|
|
1935
|
-
argSchema:
|
|
2013
|
+
pathPrefix: $,
|
|
2014
|
+
argSchema: d
|
|
1936
2015
|
}
|
|
1937
2016
|
});
|
|
1938
|
-
m2.push(
|
|
1939
|
-
} catch (
|
|
1940
|
-
const
|
|
1941
|
-
y.push(
|
|
2017
|
+
m2.push(D);
|
|
2018
|
+
} catch (D) {
|
|
2019
|
+
const ve = D instanceof Error ? D.message : "Unknown error";
|
|
2020
|
+
y.push(ve);
|
|
1942
2021
|
}
|
|
1943
2022
|
}
|
|
1944
2023
|
if (y.length > 0) {
|
|
1945
|
-
const
|
|
1946
|
-
throw new Error(
|
|
2024
|
+
const f2 = y.join("; ");
|
|
2025
|
+
throw new Error(f2);
|
|
1947
2026
|
}
|
|
1948
|
-
const
|
|
1949
|
-
if (
|
|
2027
|
+
const x2 = as(o);
|
|
2028
|
+
if (x2)
|
|
1950
2029
|
try {
|
|
1951
|
-
|
|
2030
|
+
x2(m2, {
|
|
1952
2031
|
dataSource: t,
|
|
1953
2032
|
schemaIndex: s,
|
|
1954
|
-
pathPrefix:
|
|
2033
|
+
pathPrefix: a
|
|
1955
2034
|
});
|
|
1956
|
-
} catch (
|
|
1957
|
-
const
|
|
1958
|
-
throw new Error(
|
|
2035
|
+
} catch (f2) {
|
|
2036
|
+
const d = f2 instanceof Error ? f2.message : "Unknown validation error";
|
|
2037
|
+
throw new Error(d);
|
|
1959
2038
|
}
|
|
1960
|
-
return
|
|
2039
|
+
return Qt(o, m2);
|
|
1961
2040
|
}
|
|
1962
|
-
function
|
|
2041
|
+
function Ye(e) {
|
|
1963
2042
|
const { attribute: r, config: t } = e;
|
|
1964
|
-
if (
|
|
1965
|
-
const { granularity: s } = r, n = e.members.map((
|
|
1966
|
-
return
|
|
2043
|
+
if (Wh(e) && pp(r)) {
|
|
2044
|
+
const { granularity: s } = r, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), o = ji(t), i = Object.keys(o).length === 0 ? undefined : o;
|
|
2045
|
+
return wt(r, n, i);
|
|
1967
2046
|
}
|
|
1968
2047
|
return e;
|
|
1969
2048
|
}
|
|
1970
|
-
function
|
|
2049
|
+
function ps(e) {
|
|
1971
2050
|
let r = [];
|
|
1972
2051
|
for (const t of e)
|
|
1973
|
-
|
|
2052
|
+
U(t) ? r = bp(t, r) : r = bp([Ye(t)], r);
|
|
1974
2053
|
return r != null ? r : [];
|
|
1975
2054
|
}
|
|
1976
|
-
var
|
|
1977
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [],
|
|
1978
|
-
return r.forEach((i,
|
|
2055
|
+
var ys2 = (e) => {
|
|
2056
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], o = [];
|
|
2057
|
+
return r.forEach((i, a) => {
|
|
1979
2058
|
const u = {
|
|
1980
2059
|
category: "filters",
|
|
1981
|
-
index:
|
|
2060
|
+
index: a,
|
|
1982
2061
|
input: i
|
|
1983
2062
|
};
|
|
1984
2063
|
try {
|
|
1985
|
-
const
|
|
2064
|
+
const c2 = C2({
|
|
1986
2065
|
data: i,
|
|
1987
2066
|
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
1988
2067
|
});
|
|
1989
|
-
!
|
|
1990
|
-
} catch (
|
|
1991
|
-
const p2 =
|
|
1992
|
-
|
|
2068
|
+
!U(c2) && !K(c2) ? o.push(h2(g2({}, u), { message: "Invalid filter JSON" })) : n.push(c2);
|
|
2069
|
+
} catch (c2) {
|
|
2070
|
+
const p2 = c2 instanceof Error ? c2.message : "Unknown error";
|
|
2071
|
+
o.push(h2(g2({}, u), { message: p2 }));
|
|
1993
2072
|
}
|
|
1994
|
-
}),
|
|
2073
|
+
}), o.length > 0 ? { success: false, errors: o } : { success: true, data: ps(n) };
|
|
1995
2074
|
};
|
|
1996
|
-
var
|
|
2075
|
+
var gs = (e) => {
|
|
1997
2076
|
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
1998
|
-
return r ?
|
|
2077
|
+
return r ? je(r) ? ys2({
|
|
1999
2078
|
data: r,
|
|
2000
2079
|
context: { dataSource: t, schemaIndex: s }
|
|
2001
2080
|
}) : {
|
|
@@ -2010,29 +2089,29 @@ var rs = (e) => {
|
|
|
2010
2089
|
]
|
|
2011
2090
|
} : { success: true, data: [] };
|
|
2012
2091
|
};
|
|
2013
|
-
var
|
|
2014
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [],
|
|
2015
|
-
return r.forEach((i,
|
|
2092
|
+
var hs = (e) => {
|
|
2093
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], o = [];
|
|
2094
|
+
return r.forEach((i, a) => {
|
|
2016
2095
|
const u = {
|
|
2017
2096
|
category: "highlights",
|
|
2018
|
-
index:
|
|
2097
|
+
index: a,
|
|
2019
2098
|
input: i
|
|
2020
2099
|
};
|
|
2021
2100
|
try {
|
|
2022
|
-
const
|
|
2101
|
+
const c2 = C2({
|
|
2023
2102
|
data: i,
|
|
2024
2103
|
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
2025
2104
|
});
|
|
2026
|
-
K(
|
|
2027
|
-
} catch (
|
|
2028
|
-
const p2 =
|
|
2029
|
-
|
|
2105
|
+
K(c2) ? n.push(Ye(c2)) : o.push(h2(g2({}, u), { message: "Invalid filter JSON" }));
|
|
2106
|
+
} catch (c2) {
|
|
2107
|
+
const p2 = c2 instanceof Error ? c2.message : "Unknown error";
|
|
2108
|
+
o.push(h2(g2({}, u), { message: p2 }));
|
|
2030
2109
|
}
|
|
2031
|
-
}),
|
|
2110
|
+
}), o.length > 0 ? { success: false, errors: o } : { success: true, data: n };
|
|
2032
2111
|
};
|
|
2033
|
-
var
|
|
2112
|
+
var bs = (e) => {
|
|
2034
2113
|
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2035
|
-
return r ?
|
|
2114
|
+
return r ? je(r) ? hs({
|
|
2036
2115
|
data: r,
|
|
2037
2116
|
context: { dataSource: t, schemaIndex: s }
|
|
2038
2117
|
}) : {
|
|
@@ -2047,73 +2126,117 @@ var ss = (e) => {
|
|
|
2047
2126
|
]
|
|
2048
2127
|
} : { success: true, data: [] };
|
|
2049
2128
|
};
|
|
2050
|
-
var
|
|
2051
|
-
const {
|
|
2052
|
-
|
|
2129
|
+
var Fs = (e, r, t) => {
|
|
2130
|
+
const { dataSource: s, schemaIndex: n } = r;
|
|
2131
|
+
try {
|
|
2132
|
+
const o = C2({
|
|
2133
|
+
data: e,
|
|
2134
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2135
|
+
});
|
|
2136
|
+
return fe(o) ? { success: true, data: o } : {
|
|
2137
|
+
success: false,
|
|
2138
|
+
errors: [h2(g2({}, t), { message: "Invalid measure JSON" })]
|
|
2139
|
+
};
|
|
2140
|
+
} catch (o) {
|
|
2141
|
+
const i = o instanceof Error ? o.message : "Unknown error";
|
|
2142
|
+
return {
|
|
2143
|
+
success: false,
|
|
2144
|
+
errors: [h2(g2({}, t), { message: i })]
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
2147
|
+
};
|
|
2148
|
+
var ws = (e, r, t) => r ? mp(r) ? { measure: e.sort(ap(r)) } : {
|
|
2149
|
+
measure: e,
|
|
2150
|
+
error: h2(g2({}, t), {
|
|
2151
|
+
message: `Invalid sort type. Expected "sortAsc", "sortDesc", or "sortNone". Got: "${r}".`
|
|
2152
|
+
})
|
|
2153
|
+
} : { measure: e };
|
|
2154
|
+
var qs = (e, r, t, s) => {
|
|
2155
|
+
const n = C2({
|
|
2156
|
+
data: e.column,
|
|
2157
|
+
context: { dataSource: r, schemaIndex: t, pathPrefix: "" }
|
|
2158
|
+
});
|
|
2159
|
+
return fe(n) ? ws(n, e.sortType, s) : { error: h2(g2({}, s), { message: "Invalid measure JSON" }) };
|
|
2160
|
+
};
|
|
2161
|
+
var Es = (e, r, t, s) => {
|
|
2162
|
+
if (zt(e))
|
|
2163
|
+
return qs(e, r, t, s);
|
|
2164
|
+
if (E3(e)) {
|
|
2165
|
+
const n = Fs(e, { dataSource: r, schemaIndex: t }, s);
|
|
2166
|
+
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2167
|
+
}
|
|
2168
|
+
return {
|
|
2169
|
+
error: h2(g2({}, s), {
|
|
2170
|
+
message: 'Invalid measure item. Expected a function call (function/args) or object with "column" and optional "sortType".'
|
|
2171
|
+
})
|
|
2172
|
+
};
|
|
2173
|
+
};
|
|
2174
|
+
var Cs = (e) => {
|
|
2175
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2176
|
+
if (!r)
|
|
2177
|
+
return { success: true, data: [] };
|
|
2178
|
+
if (!Array.isArray(r))
|
|
2179
|
+
return {
|
|
2180
|
+
success: false,
|
|
2181
|
+
errors: [
|
|
2182
|
+
{
|
|
2183
|
+
category: "measures",
|
|
2184
|
+
index: -1,
|
|
2185
|
+
input: r,
|
|
2186
|
+
message: "Invalid measures JSON. Expected an array."
|
|
2187
|
+
}
|
|
2188
|
+
]
|
|
2189
|
+
};
|
|
2190
|
+
const n = [], o = [];
|
|
2191
|
+
return r.forEach((i, a) => {
|
|
2053
2192
|
const u = {
|
|
2054
2193
|
category: "measures",
|
|
2055
|
-
index:
|
|
2194
|
+
index: a,
|
|
2056
2195
|
input: i
|
|
2057
2196
|
};
|
|
2058
2197
|
try {
|
|
2059
|
-
const
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
_e2(l) ? n.push(l) : a.push(E3(b2({}, u), { message: "Invalid measure JSON" }));
|
|
2064
|
-
} catch (l) {
|
|
2065
|
-
const p2 = l instanceof Error ? l.message : "Unknown error";
|
|
2066
|
-
a.push(E3(b2({}, u), { message: p2 }));
|
|
2067
|
-
}
|
|
2068
|
-
}), a.length > 0 ? { success: false, errors: a } : { success: true, data: n };
|
|
2069
|
-
};
|
|
2070
|
-
var is = (e) => {
|
|
2071
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2072
|
-
return r ? le(r) ? ns({
|
|
2073
|
-
data: r,
|
|
2074
|
-
context: { dataSource: t, schemaIndex: s }
|
|
2075
|
-
}) : {
|
|
2076
|
-
success: false,
|
|
2077
|
-
errors: [
|
|
2078
|
-
{
|
|
2079
|
-
category: "measures",
|
|
2080
|
-
index: -1,
|
|
2081
|
-
input: r,
|
|
2082
|
-
message: 'Invalid measures JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
2198
|
+
const c2 = Es(i, t, s, u);
|
|
2199
|
+
if (c2.error) {
|
|
2200
|
+
o.push(c2.error);
|
|
2201
|
+
return;
|
|
2083
2202
|
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2203
|
+
c2.measure && n.push(c2.measure);
|
|
2204
|
+
} catch (c2) {
|
|
2205
|
+
const p2 = c2 instanceof Error ? c2.message : "Unknown error";
|
|
2206
|
+
o.push(h2(g2({}, u), { message: p2 }));
|
|
2207
|
+
}
|
|
2208
|
+
}), o.length > 0 ? { success: false, errors: o } : { success: true, data: n };
|
|
2086
2209
|
};
|
|
2087
|
-
var
|
|
2088
|
-
const { data: r } = e, { dataSource: t, tables: s } = e.context, n =
|
|
2210
|
+
var ks = (e) => {
|
|
2211
|
+
const { data: r } = e, { dataSource: t, tables: s } = e.context, n = Bt(s), o = [], i = M(() => jt({
|
|
2089
2212
|
data: r.dimensions || [],
|
|
2090
2213
|
context: { dataSource: t, schemaIndex: n }
|
|
2091
|
-
}),
|
|
2214
|
+
}), o), a = M(() => Cs({
|
|
2092
2215
|
data: r.measures || [],
|
|
2093
2216
|
context: { dataSource: t, schemaIndex: n }
|
|
2094
|
-
}),
|
|
2217
|
+
}), o), u = M(() => gs({
|
|
2095
2218
|
data: r.filters || [],
|
|
2096
2219
|
context: { dataSource: t, schemaIndex: n }
|
|
2097
|
-
}),
|
|
2098
|
-
let
|
|
2099
|
-
return r.highlights && (
|
|
2220
|
+
}), o);
|
|
2221
|
+
let c2 = null;
|
|
2222
|
+
return r.highlights && (c2 = M(() => bs({
|
|
2100
2223
|
data: r.highlights || [],
|
|
2101
2224
|
context: { dataSource: t, schemaIndex: n }
|
|
2102
|
-
}),
|
|
2225
|
+
}), o)), o.length > 0 ? {
|
|
2103
2226
|
success: false,
|
|
2104
|
-
errors:
|
|
2227
|
+
errors: o
|
|
2105
2228
|
} : {
|
|
2106
2229
|
success: true,
|
|
2107
|
-
data:
|
|
2108
|
-
dataSource:
|
|
2230
|
+
data: g2({
|
|
2231
|
+
dataSource: ip(t),
|
|
2109
2232
|
dimensions: i || [],
|
|
2110
|
-
measures:
|
|
2233
|
+
measures: a || [],
|
|
2111
2234
|
filters: u || []
|
|
2112
|
-
},
|
|
2235
|
+
}, c2 && { highlights: c2 })
|
|
2113
2236
|
};
|
|
2114
2237
|
};
|
|
2115
|
-
function
|
|
2116
|
-
const { filters: r, relations: t } =
|
|
2238
|
+
function Rs(e) {
|
|
2239
|
+
const { filters: r, relations: t } = rp(e.filters || []);
|
|
2117
2240
|
return {
|
|
2118
2241
|
dataSource: e.dataSource,
|
|
2119
2242
|
dimensions: e.dimensions,
|
|
@@ -2123,9 +2246,9 @@ function ps(e) {
|
|
|
2123
2246
|
highlights: e.highlights
|
|
2124
2247
|
};
|
|
2125
2248
|
}
|
|
2126
|
-
function
|
|
2127
|
-
const s =
|
|
2128
|
-
return
|
|
2249
|
+
function Vs(e, r, t = false) {
|
|
2250
|
+
const s = Rs(e), n = Dr(s, r);
|
|
2251
|
+
return bh(n, t);
|
|
2129
2252
|
}
|
|
2130
2253
|
|
|
2131
|
-
export { c, R, x,
|
|
2254
|
+
export { c, R, x, Ps, ks, Vs };
|