@sisense/mcp-server 0.2.9 → 0.3.1
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/README.md +16 -0
- package/dist/ai-nvvrv8ss.js +3128 -0
- package/dist/{index-8027b2t7.js → index-n4pxahc5.js} +38685 -42216
- package/dist/{sse-server-r50cemee.js → sse-server-j22b9cb0.js} +1872 -1800
- package/dist/{sse-server-f7drtvty.js → sse-server-vfpbc30x.js} +996 -1040
- package/dist/{sse-server-n5dmee25.js → sse-server-vxxek6gy.js} +39471 -31811
- package/dist/{sse-server-qhqncg7f.js → sse-server-yrjhgg0x.js} +4 -1
- package/dist/sse-server.js +162 -49
- package/dist/view.html +584 -560
- package/dist/{widget-renderer-9rr9sfh8.js → widget-renderer-7exptahz.js} +5 -5
- package/package.json +5 -5
- package/dist/ai-w2gkxdn7.js +0 -3188
|
@@ -1,83 +1,82 @@
|
|
|
1
1
|
import {
|
|
2
|
-
$
|
|
2
|
+
$p,
|
|
3
3
|
Ap,
|
|
4
|
-
Bd,
|
|
5
4
|
Bi,
|
|
6
|
-
C,
|
|
7
|
-
Ci,
|
|
8
5
|
Ct,
|
|
9
|
-
|
|
6
|
+
Dn,
|
|
10
7
|
E,
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
En,
|
|
9
|
+
Ep,
|
|
10
|
+
Fp,
|
|
11
|
+
Gd,
|
|
12
|
+
Gi,
|
|
13
|
+
Gs,
|
|
13
14
|
Hd,
|
|
14
|
-
|
|
15
|
+
Ip,
|
|
15
16
|
J,
|
|
16
17
|
Ke,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Mp,
|
|
22
|
-
Nt,
|
|
18
|
+
Li,
|
|
19
|
+
Lt,
|
|
20
|
+
N,
|
|
21
|
+
Np,
|
|
23
22
|
Oe,
|
|
24
|
-
|
|
23
|
+
Op,
|
|
25
24
|
Rn,
|
|
26
25
|
Rp,
|
|
26
|
+
Rt,
|
|
27
27
|
Se,
|
|
28
28
|
Sp,
|
|
29
29
|
Tp,
|
|
30
|
-
|
|
30
|
+
Up,
|
|
31
|
+
Vd,
|
|
32
|
+
Vi,
|
|
33
|
+
Wd,
|
|
34
|
+
Wi,
|
|
35
|
+
Ws,
|
|
31
36
|
X,
|
|
32
|
-
Xp,
|
|
33
|
-
Yt,
|
|
34
37
|
Zt,
|
|
35
|
-
|
|
38
|
+
_p,
|
|
39
|
+
_s,
|
|
36
40
|
be,
|
|
37
41
|
bp,
|
|
38
|
-
cp,
|
|
39
42
|
dp,
|
|
40
|
-
ed,
|
|
41
|
-
fp,
|
|
42
43
|
g,
|
|
44
|
+
gm,
|
|
43
45
|
gp,
|
|
44
|
-
gt,
|
|
45
46
|
h1 as h,
|
|
47
|
+
hm,
|
|
46
48
|
hp,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
jn,
|
|
51
|
-
lp,
|
|
49
|
+
ht,
|
|
50
|
+
kd,
|
|
51
|
+
ki,
|
|
52
52
|
m,
|
|
53
53
|
mp,
|
|
54
|
-
|
|
54
|
+
nn,
|
|
55
|
+
od,
|
|
55
56
|
pp,
|
|
57
|
+
qd,
|
|
56
58
|
re,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
vs,
|
|
62
|
-
wn,
|
|
63
|
-
wp,
|
|
64
|
-
xp,
|
|
59
|
+
sm,
|
|
60
|
+
vp,
|
|
61
|
+
ws,
|
|
62
|
+
xs,
|
|
65
63
|
ye,
|
|
64
|
+
yp,
|
|
66
65
|
zd,
|
|
67
66
|
zi
|
|
68
|
-
} from "./sse-server-
|
|
67
|
+
} from "./sse-server-j22b9cb0.js";
|
|
69
68
|
|
|
70
|
-
// node_modules/@sisense/sdk-ui/dist/
|
|
71
|
-
class
|
|
72
|
-
constructor(
|
|
73
|
-
if (super(
|
|
74
|
-
const { table:
|
|
75
|
-
this.composeCode = `${
|
|
69
|
+
// node_modules/@sisense/sdk-ui/dist/parse-compose-code-DfZskSng.js
|
|
70
|
+
class g2 extends En {
|
|
71
|
+
constructor(i, e, n, s, r, a, h2, c, d, f) {
|
|
72
|
+
if (super(i, r || E.Dimension, a, c, d), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = N.None, !d && e) {
|
|
73
|
+
const { table: p, column: o } = Oe(e);
|
|
74
|
+
this.composeCode = `${Li}.${ht(p)}.${ht(o)}`;
|
|
76
75
|
}
|
|
77
|
-
this._sort =
|
|
76
|
+
this._sort = h2 || N.None, this._expression = e, this.setDimensions(s || []), this.setAttributes(n), f && (this.defaultAttribute = f);
|
|
78
77
|
}
|
|
79
|
-
static parseType(
|
|
80
|
-
switch (
|
|
78
|
+
static parseType(i) {
|
|
79
|
+
switch (i) {
|
|
81
80
|
case "datetime":
|
|
82
81
|
case E.DateDimension:
|
|
83
82
|
return E.DateDimension;
|
|
@@ -90,23 +89,23 @@ class y extends vn {
|
|
|
90
89
|
}
|
|
91
90
|
return E.TextDimension;
|
|
92
91
|
}
|
|
93
|
-
getAttachedName(
|
|
94
|
-
let
|
|
95
|
-
const
|
|
96
|
-
return (
|
|
92
|
+
getAttachedName(i, e) {
|
|
93
|
+
let n = i;
|
|
94
|
+
const s = be(i);
|
|
95
|
+
return (s === "id" || s === "name" || Object.getOwnPropertyDescriptor(this, s) !== undefined || this[s] !== undefined) && (n = e), n;
|
|
97
96
|
}
|
|
98
|
-
setDimensions(
|
|
99
|
-
this._dimensions =
|
|
100
|
-
for (let e = 0;e <
|
|
101
|
-
const
|
|
102
|
-
this[be(
|
|
97
|
+
setDimensions(i) {
|
|
98
|
+
this._dimensions = i;
|
|
99
|
+
for (let e = 0;e < i.length; e++) {
|
|
100
|
+
const n = this.getAttachedName(i[e].name, i[e].attributes[0].expression);
|
|
101
|
+
this[be(n)] = i[e], n != i[e].name && (i[e].name = n);
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
|
-
setAttributes(
|
|
106
|
-
this._attributes =
|
|
107
|
-
for (let e = 0;e <
|
|
108
|
-
const
|
|
109
|
-
this[be(
|
|
104
|
+
setAttributes(i) {
|
|
105
|
+
this._attributes = i || [];
|
|
106
|
+
for (let e = 0;e < i.length; e++) {
|
|
107
|
+
const n = this.getAttachedName(i[e].name, i[e].expression);
|
|
108
|
+
this[be(n)] = i[e], i[e].name != n && (i[e].name = n);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
get id() {
|
|
@@ -124,35 +123,35 @@ class y extends vn {
|
|
|
124
123
|
getSort() {
|
|
125
124
|
return this._sort;
|
|
126
125
|
}
|
|
127
|
-
sort(
|
|
128
|
-
return new
|
|
126
|
+
sort(i) {
|
|
127
|
+
return new g2(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, i, this.dataSource, this.composeCode, this.defaultAttribute);
|
|
129
128
|
}
|
|
130
129
|
serialize() {
|
|
131
|
-
const
|
|
132
|
-
return
|
|
130
|
+
const i = super.serialize();
|
|
131
|
+
return i.expression = this.expression, this.getSort() !== undefined && (i.sort = this.getSort()), i.attributes = this._attributes.map((e) => e.serialize()), i.dimensions = this._dimensions.map((e) => e.serialize()), this.defaultAttribute && (i.defaultAttribute = this.defaultAttribute.serialize()), i;
|
|
133
132
|
}
|
|
134
|
-
jaql(
|
|
133
|
+
jaql(i) {
|
|
135
134
|
if (this.defaultAttribute)
|
|
136
|
-
return this.defaultAttribute.jaql(
|
|
135
|
+
return this.defaultAttribute.jaql(i);
|
|
137
136
|
if (this.dimensions.length > 0)
|
|
138
|
-
return this.dimensions[0].jaql(
|
|
137
|
+
return this.dimensions[0].jaql(i);
|
|
139
138
|
const e = {
|
|
140
139
|
jaql: {
|
|
141
140
|
title: this.name,
|
|
142
141
|
dim: this.expression,
|
|
143
|
-
datatype:
|
|
142
|
+
datatype: xs(this.type)
|
|
144
143
|
}
|
|
145
144
|
};
|
|
146
|
-
return this._sort !=
|
|
145
|
+
return this._sort != N.None && (e.jaql.sort = this._sort == N.Ascending ? "asc" : "desc"), i === true ? e.jaql : e;
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
|
-
var
|
|
148
|
+
var L = (t) => t && t.__serializable === "DimensionalDimension";
|
|
150
149
|
|
|
151
|
-
class
|
|
152
|
-
constructor(
|
|
153
|
-
super(
|
|
154
|
-
const
|
|
155
|
-
this.defaultLevel = g.Years, this.Years = new J(g.Years, e, g.Years, "yyyy", ...
|
|
150
|
+
class D extends g2 {
|
|
151
|
+
constructor(i, e, n, s, r, a, h2, c) {
|
|
152
|
+
super(i, e, [], [], E.DateDimension, n, s, r, a), this.__serializable = "DimensionalDateDimension";
|
|
153
|
+
const d = [n, s, r, undefined, undefined, h2, c];
|
|
154
|
+
this.defaultLevel = g.Years, this.Years = new J(g.Years, e, g.Years, "yyyy", ...d), this.Quarters = new J(g.Quarters, e, g.Quarters, "Q yyyy", ...d), this.Months = new J(g.Months, e, g.Months, "yyyy-MM", ...d), this.Weeks = new J(g.Weeks, e, g.Weeks, "ww yyyy", ...d), this.Days = new J(g.Days, e, g.Days, "yyyy-MM-dd", ...d), this.Hours = new J(g.Hours, e, g.Hours, "yyyy-MM-dd HH:mm", ...d), this.MinutesRoundTo30 = new J(g.MinutesRoundTo30, e, g.MinutesRoundTo30, "yyyy-MM-dd HH:mm", n, s, r), this.MinutesRoundTo15 = new J(g.MinutesRoundTo15, e, g.MinutesRoundTo15, "yyyy-MM-dd HH:mm", ...d), this.Minutes = new J(g.Minutes, e, g.Minutes, "yyyy-MM-dd HH:mm", ...d), this.Seconds = new J(g.Seconds, e, g.Seconds, "yyyy-MM-dd HH:mm:ss", n, s, r), this.AggHours = new J(g.AggHours, e, g.AggHours, "HH:mm", ...d), this.AggMinutesRoundTo30 = new J(g.AggMinutesRoundTo30, e, g.AggMinutesRoundTo30, "HH:mm", n, s, r), this.AggMinutesRoundTo15 = new J(g.AggMinutesRoundTo15, e, g.AggMinutesRoundTo15, "HH:mm", ...d), this.AggMinutesRoundTo1 = new J(g.AggMinutesRoundTo1, e, g.AggMinutesRoundTo1, "HH:mm", ...d), this.setAttributes([
|
|
156
155
|
this.Years,
|
|
157
156
|
this.Quarters,
|
|
158
157
|
this.Months,
|
|
@@ -173,74 +172,219 @@ class p extends y {
|
|
|
173
172
|
return this.expression;
|
|
174
173
|
}
|
|
175
174
|
setDimensions() {}
|
|
176
|
-
setAttributes(
|
|
177
|
-
this._attributes =
|
|
175
|
+
setAttributes(i) {
|
|
176
|
+
this._attributes = i;
|
|
178
177
|
}
|
|
179
178
|
getSort() {
|
|
180
179
|
return this._sort;
|
|
181
180
|
}
|
|
182
|
-
sort(
|
|
183
|
-
return new
|
|
181
|
+
sort(i) {
|
|
182
|
+
return new D(this.name, this.expression, this.description, i, this.dataSource, this.composeCode, this.indexed, this.merged);
|
|
184
183
|
}
|
|
185
184
|
serialize() {
|
|
186
185
|
return super.serialize();
|
|
187
186
|
}
|
|
188
|
-
jaql(
|
|
187
|
+
jaql(i) {
|
|
189
188
|
const e = this[this.defaultLevel].jaql();
|
|
190
|
-
return e.jaql.title = this.name,
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
var
|
|
194
|
-
function
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
return new
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
if (
|
|
201
|
-
let
|
|
202
|
-
for (let M = 0;M <
|
|
203
|
-
|
|
189
|
+
return e.jaql.title = this.name, i ? e.jaql : e;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
var I = (t) => t && t.__serializable === "DimensionalDateDimension";
|
|
193
|
+
function z(t) {
|
|
194
|
+
const i = t.name || t.title, e = t.desc || t.description, n = t.expression || t.dim, s = g2.parseType(t.dimtype || t.type), r = t.sort, a = t.dataSource, h2 = t.indexed, c = t.merged;
|
|
195
|
+
if (s == E.DateDimension)
|
|
196
|
+
return new D(i, n, e, r, a, undefined, h2, c);
|
|
197
|
+
const d = Object.getOwnPropertyNames(t).map((o) => t[o]).filter((o) => E.isAttribute(o == null ? undefined : o.type));
|
|
198
|
+
if (d.length == 0)
|
|
199
|
+
if (t.attributes) {
|
|
200
|
+
let o;
|
|
201
|
+
for (let M = 0;M < t.attributes.length; M++)
|
|
202
|
+
o = t.attributes[M], d.push(new Ke(o.name, o.expression, o.type, o.description, o.sort, o.dataSource, undefined, undefined, o.indexed, o.merged));
|
|
204
203
|
} else
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
for (let
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
return
|
|
212
|
-
}
|
|
213
|
-
function
|
|
214
|
-
const
|
|
215
|
-
return new
|
|
204
|
+
n && d.push(new Ke(i, n, s, e, r, a, undefined, undefined, h2, c));
|
|
205
|
+
const f = Object.getOwnPropertyNames(t).map((o) => t[o]).filter((o) => E.isDimension(o == null ? undefined : o.type));
|
|
206
|
+
if (f.length == 0 && t.dimensions)
|
|
207
|
+
for (let o = 0;o < t.dimensions.length; o++)
|
|
208
|
+
f.push(z(t.dimensions[o]));
|
|
209
|
+
const p = new g2(i, n, d, f, s, e, r, a);
|
|
210
|
+
return t.defaultAttribute && (p.defaultAttribute = d.find((o) => o.name === t.defaultAttribute)), p;
|
|
211
|
+
}
|
|
212
|
+
function Q(t) {
|
|
213
|
+
const i = t.name || t.title, e = t.expression || t.dim, n = t.desc || t.description, s = t.sort, r = t.dataSource;
|
|
214
|
+
return new D(i, e, n, s, r, undefined, t.indexed, t.merged);
|
|
215
|
+
}
|
|
216
|
+
function T(t, i) {
|
|
217
|
+
const e = [];
|
|
218
|
+
let n = "", s = 0, r = false, a = null;
|
|
219
|
+
for (let h2 = 0;h2 < t.length; h2++) {
|
|
220
|
+
const c = t[h2], d = t[h2 + 1];
|
|
221
|
+
if (r) {
|
|
222
|
+
if (c !== a) {
|
|
223
|
+
n += c;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (d === a) {
|
|
227
|
+
n += c + d, h2++;
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
r = false, a = null, n += c;
|
|
231
|
+
continue;
|
|
232
|
+
} else {
|
|
233
|
+
if (c === "'" || c === '"') {
|
|
234
|
+
r = true, a = c, n += c;
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if ("([{".includes(c) && s++, ")]}".includes(c) && s--, c === i && s === 0) {
|
|
238
|
+
e.push(n.trim()), n = "";
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
n += c;
|
|
243
|
+
}
|
|
244
|
+
return n.trim() && e.push(n.trim()), e;
|
|
245
|
+
}
|
|
246
|
+
function N2(t, i) {
|
|
247
|
+
let e = 0, n = false, s = null;
|
|
248
|
+
for (let r = 0;r < t.length; r++) {
|
|
249
|
+
const a = t[r], h2 = t[r + 1];
|
|
250
|
+
if (n) {
|
|
251
|
+
if (a !== s)
|
|
252
|
+
continue;
|
|
253
|
+
if (h2 === s) {
|
|
254
|
+
r++;
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
n = false, s = null;
|
|
258
|
+
} else {
|
|
259
|
+
if (a === "'" || a === '"') {
|
|
260
|
+
n = true, s = a;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if ("([{".includes(a) && e++, ")]}".includes(a) && e--, a === i && e === 0)
|
|
264
|
+
return r;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return -1;
|
|
268
|
+
}
|
|
269
|
+
function Y(t, i) {
|
|
270
|
+
if (t[i] !== "(")
|
|
271
|
+
return -1;
|
|
272
|
+
let e = 1, n = i + 1, s = false, r = null;
|
|
273
|
+
for (;n < t.length; ) {
|
|
274
|
+
const a = t[n], h2 = t[n + 1];
|
|
275
|
+
if (s) {
|
|
276
|
+
if (a !== r) {
|
|
277
|
+
n++;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (h2 === r) {
|
|
281
|
+
n += 2;
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
s = false, r = null, n++;
|
|
285
|
+
} else {
|
|
286
|
+
if (a === "'" || a === '"') {
|
|
287
|
+
s = true, r = a, n++;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if ("([{".includes(a) && e++, ")]}".includes(a) && --e === 0)
|
|
291
|
+
return n;
|
|
292
|
+
n++;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return -1;
|
|
296
|
+
}
|
|
297
|
+
function C(t) {
|
|
298
|
+
return t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"') ? t.slice(1, -1) : t;
|
|
299
|
+
}
|
|
300
|
+
function q(t) {
|
|
301
|
+
if (!t || typeof t != "string")
|
|
302
|
+
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof t}`);
|
|
303
|
+
const i = t.trim();
|
|
304
|
+
if (!i)
|
|
305
|
+
throw new Error("Invalid composeCode: empty string");
|
|
306
|
+
const e = i.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
307
|
+
if (!e)
|
|
308
|
+
throw new Error(`Invalid composeCode format: expected function call, got '${i}'`);
|
|
309
|
+
const n = e[1], s = e[2], r = _(s);
|
|
310
|
+
return {
|
|
311
|
+
function: n,
|
|
312
|
+
args: r
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function _(t) {
|
|
316
|
+
return t.trim() ? T(t, ",").map(H) : [];
|
|
317
|
+
}
|
|
318
|
+
function H(t) {
|
|
319
|
+
if (!t)
|
|
320
|
+
throw new Error("Cannot parse empty argument value");
|
|
321
|
+
if (t === "null")
|
|
322
|
+
return null;
|
|
323
|
+
if (t === "undefined")
|
|
324
|
+
return;
|
|
325
|
+
if (t === "true")
|
|
326
|
+
return true;
|
|
327
|
+
if (t === "false")
|
|
328
|
+
return false;
|
|
329
|
+
if (t.match(/^-?\d+(\.\d+)?$/))
|
|
330
|
+
return parseFloat(t);
|
|
331
|
+
if (t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"')) {
|
|
332
|
+
const e = t[0];
|
|
333
|
+
return t.slice(1, -1).replace(new RegExp(`${e}${e}`, "g"), e);
|
|
334
|
+
}
|
|
335
|
+
if (t.startsWith("[") && t.endsWith("]")) {
|
|
336
|
+
const e = t.slice(1, -1).trim();
|
|
337
|
+
if (!e)
|
|
338
|
+
return [];
|
|
339
|
+
const n = _(e);
|
|
340
|
+
return n.every((s) => typeof s == "string"), n;
|
|
341
|
+
}
|
|
342
|
+
if (t.startsWith("{") && t.endsWith("}")) {
|
|
343
|
+
const e = t.slice(1, -1).trim();
|
|
344
|
+
return e ? $(e) : {};
|
|
345
|
+
}
|
|
346
|
+
return t.includes("(") && t.includes(")") ? q(t) : (t.startsWith("DM."), t);
|
|
347
|
+
}
|
|
348
|
+
function E2(t) {
|
|
349
|
+
const i = N2(t, ":");
|
|
350
|
+
if (i === -1)
|
|
351
|
+
throw new Error(`Invalid object property: expected 'key: value', got '${t}'`);
|
|
352
|
+
const e = C(t.slice(0, i).trim()), n = H(t.slice(i + 1).trim());
|
|
353
|
+
return [e, n];
|
|
354
|
+
}
|
|
355
|
+
function $(t) {
|
|
356
|
+
if (!t.trim())
|
|
357
|
+
return {};
|
|
358
|
+
const i = T(t, ",").map(E2).filter(([, e]) => e !== null);
|
|
359
|
+
return Object.fromEntries(i);
|
|
216
360
|
}
|
|
217
361
|
|
|
218
362
|
// 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
|
|
363
|
+
var Lt2 = Object.defineProperty;
|
|
364
|
+
var Ut = Object.defineProperties;
|
|
365
|
+
var _t = Object.getOwnPropertyDescriptors;
|
|
366
|
+
var Pe = Object.getOwnPropertySymbols;
|
|
367
|
+
var Vt = Object.prototype.hasOwnProperty;
|
|
368
|
+
var jt = Object.prototype.propertyIsEnumerable;
|
|
369
|
+
var ke = (e, t, r) => (t in e) ? Lt2(e, t, { enumerable: true, configurable: true, writable: true, value: r }) : e[t] = r;
|
|
370
|
+
var y = (e, t) => {
|
|
227
371
|
for (var r in t || (t = {}))
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
for (var r of
|
|
231
|
-
|
|
372
|
+
Vt.call(t, r) && ke(e, r, t[r]);
|
|
373
|
+
if (Pe)
|
|
374
|
+
for (var r of Pe(t))
|
|
375
|
+
jt.call(t, r) && ke(e, r, t[r]);
|
|
232
376
|
return e;
|
|
233
377
|
};
|
|
234
|
-
var
|
|
235
|
-
function
|
|
236
|
-
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i,
|
|
378
|
+
var A = (e, t) => Ut(e, _t(t));
|
|
379
|
+
function Gr(e, t) {
|
|
380
|
+
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, a) => Array.from({ length: s + 1 }, (o, u) => a === 0 ? u : u === 0 ? a : 0));
|
|
237
381
|
for (let i = 1;i <= r; i++)
|
|
238
|
-
for (let
|
|
239
|
-
n[i][
|
|
382
|
+
for (let a = 1;a <= s; a++)
|
|
383
|
+
n[i][a] = Math.min(n[i - 1][a] + 1, n[i][a - 1] + 1, n[i - 1][a - 1] + (e[i - 1] === t[a - 1] ? 0 : 1));
|
|
240
384
|
return n[r][s];
|
|
241
385
|
}
|
|
242
386
|
|
|
243
|
-
class
|
|
387
|
+
class Yr {
|
|
244
388
|
constructor() {
|
|
245
389
|
this.keyToValue = /* @__PURE__ */ new Map, this.valueToKey = /* @__PURE__ */ new Map;
|
|
246
390
|
}
|
|
@@ -258,9 +402,9 @@ class Jr {
|
|
|
258
402
|
}
|
|
259
403
|
}
|
|
260
404
|
|
|
261
|
-
class
|
|
405
|
+
class it {
|
|
262
406
|
constructor(t) {
|
|
263
|
-
this.generateIdentifier = t, this.kv = new
|
|
407
|
+
this.generateIdentifier = t, this.kv = new Yr;
|
|
264
408
|
}
|
|
265
409
|
register(t, r) {
|
|
266
410
|
this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
|
|
@@ -276,7 +420,7 @@ class ot {
|
|
|
276
420
|
}
|
|
277
421
|
}
|
|
278
422
|
|
|
279
|
-
class
|
|
423
|
+
class Jr extends it {
|
|
280
424
|
constructor() {
|
|
281
425
|
super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map;
|
|
282
426
|
}
|
|
@@ -287,7 +431,7 @@ class Hr extends ot {
|
|
|
287
431
|
return this.classToAllowedProps.get(t);
|
|
288
432
|
}
|
|
289
433
|
}
|
|
290
|
-
function
|
|
434
|
+
function Hr(e) {
|
|
291
435
|
if ("values" in Object)
|
|
292
436
|
return Object.values(e);
|
|
293
437
|
const t = [];
|
|
@@ -295,8 +439,8 @@ function Qr(e) {
|
|
|
295
439
|
e.hasOwnProperty(r) && t.push(e[r]);
|
|
296
440
|
return t;
|
|
297
441
|
}
|
|
298
|
-
function
|
|
299
|
-
const r =
|
|
442
|
+
function Qr(e, t) {
|
|
443
|
+
const r = Hr(e);
|
|
300
444
|
if ("find" in r)
|
|
301
445
|
return r.find(t);
|
|
302
446
|
const s = r;
|
|
@@ -312,7 +456,7 @@ function V(e, t) {
|
|
|
312
456
|
function ee(e, t) {
|
|
313
457
|
return e.indexOf(t) !== -1;
|
|
314
458
|
}
|
|
315
|
-
function
|
|
459
|
+
function ze(e, t) {
|
|
316
460
|
for (let r = 0;r < e.length; r++) {
|
|
317
461
|
const s = e[r];
|
|
318
462
|
if (t(s))
|
|
@@ -320,7 +464,7 @@ function We(e, t) {
|
|
|
320
464
|
}
|
|
321
465
|
}
|
|
322
466
|
|
|
323
|
-
class
|
|
467
|
+
class Xr {
|
|
324
468
|
constructor() {
|
|
325
469
|
this.transfomers = {};
|
|
326
470
|
}
|
|
@@ -328,36 +472,36 @@ class Zr {
|
|
|
328
472
|
this.transfomers[t.name] = t;
|
|
329
473
|
}
|
|
330
474
|
findApplicable(t) {
|
|
331
|
-
return
|
|
475
|
+
return Qr(this.transfomers, (r) => r.isApplicable(t));
|
|
332
476
|
}
|
|
333
477
|
findByName(t) {
|
|
334
478
|
return this.transfomers[t];
|
|
335
479
|
}
|
|
336
480
|
}
|
|
337
|
-
var
|
|
481
|
+
var Zr = (e) => Object.prototype.toString.call(e).slice(8, -1);
|
|
338
482
|
var at = (e) => typeof e == "undefined";
|
|
339
|
-
var
|
|
483
|
+
var es = (e) => e === null;
|
|
340
484
|
var G = (e) => typeof e != "object" || e === null || e === Object.prototype ? false : Object.getPrototypeOf(e) === null ? true : Object.getPrototypeOf(e) === Object.prototype;
|
|
341
|
-
var
|
|
342
|
-
var
|
|
343
|
-
var
|
|
344
|
-
var
|
|
345
|
-
var
|
|
346
|
-
var
|
|
347
|
-
var
|
|
485
|
+
var de = (e) => G(e) && Object.keys(e).length === 0;
|
|
486
|
+
var I2 = (e) => Array.isArray(e);
|
|
487
|
+
var ts = (e) => typeof e == "string";
|
|
488
|
+
var rs = (e) => typeof e == "number" && !isNaN(e);
|
|
489
|
+
var ss = (e) => typeof e == "boolean";
|
|
490
|
+
var ns = (e) => e instanceof RegExp;
|
|
491
|
+
var Y2 = (e) => e instanceof Map;
|
|
348
492
|
var J2 = (e) => e instanceof Set;
|
|
349
|
-
var
|
|
350
|
-
var
|
|
493
|
+
var ot = (e) => Zr(e) === "Symbol";
|
|
494
|
+
var is = (e) => e instanceof Date && !isNaN(e.valueOf());
|
|
351
495
|
var as = (e) => e instanceof Error;
|
|
352
|
-
var
|
|
353
|
-
var
|
|
354
|
-
var
|
|
496
|
+
var Le = (e) => typeof e == "number" && isNaN(e);
|
|
497
|
+
var os = (e) => ss(e) || es(e) || at(e) || rs(e) || ts(e) || ot(e);
|
|
498
|
+
var us = (e) => typeof e == "bigint";
|
|
355
499
|
var ls = (e) => e === 1 / 0 || e === -1 / 0;
|
|
356
|
-
var
|
|
357
|
-
var
|
|
358
|
-
var
|
|
359
|
-
var
|
|
360
|
-
var
|
|
500
|
+
var cs = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
501
|
+
var fs = (e) => e instanceof URL;
|
|
502
|
+
var ut = (e) => e.replace(/\./g, "\\.");
|
|
503
|
+
var oe = (e) => e.map(String).map(ut).join(".");
|
|
504
|
+
var W = (e) => {
|
|
361
505
|
const t = [];
|
|
362
506
|
let r = "";
|
|
363
507
|
for (let n = 0;n < e.length; n++) {
|
|
@@ -375,7 +519,7 @@ var K = (e) => {
|
|
|
375
519
|
const s = r;
|
|
376
520
|
return t.push(s), t;
|
|
377
521
|
};
|
|
378
|
-
function
|
|
522
|
+
function R(e, t, r, s) {
|
|
379
523
|
return {
|
|
380
524
|
isApplicable: e,
|
|
381
525
|
annotation: t,
|
|
@@ -384,10 +528,10 @@ function v(e, t, r, s) {
|
|
|
384
528
|
};
|
|
385
529
|
}
|
|
386
530
|
var lt = [
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
531
|
+
R(at, "undefined", () => null, () => {}),
|
|
532
|
+
R(us, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
533
|
+
R(is, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
534
|
+
R(as, "Error", (e, t) => {
|
|
391
535
|
const r = {
|
|
392
536
|
name: e.name,
|
|
393
537
|
message: e.message
|
|
@@ -401,17 +545,17 @@ var lt = [
|
|
|
401
545
|
r[s] = e[s];
|
|
402
546
|
}), r;
|
|
403
547
|
}),
|
|
404
|
-
|
|
548
|
+
R(ns, "regexp", (e) => "" + e, (e) => {
|
|
405
549
|
const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
|
|
406
550
|
return new RegExp(t, r);
|
|
407
551
|
}),
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
552
|
+
R(J2, "set", (e) => [...e.values()], (e) => new Set(e)),
|
|
553
|
+
R(Y2, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
554
|
+
R((e) => Le(e) || ls(e), "number", (e) => Le(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
555
|
+
R((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
556
|
+
R(fs, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
413
557
|
];
|
|
414
|
-
function
|
|
558
|
+
function se(e, t, r, s) {
|
|
415
559
|
return {
|
|
416
560
|
isApplicable: e,
|
|
417
561
|
annotation: t,
|
|
@@ -419,13 +563,13 @@ function ie(e, t, r, s) {
|
|
|
419
563
|
untransform: s
|
|
420
564
|
};
|
|
421
565
|
}
|
|
422
|
-
var
|
|
566
|
+
var ct = se((e, t) => ot(e) ? !!t.symbolRegistry.getIdentifier(e) : false, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
|
|
423
567
|
const s = r.symbolRegistry.getValue(t[1]);
|
|
424
568
|
if (!s)
|
|
425
569
|
throw new Error("Trying to deserialize unknown symbol");
|
|
426
570
|
return s;
|
|
427
571
|
});
|
|
428
|
-
var
|
|
572
|
+
var ds = [
|
|
429
573
|
Int8Array,
|
|
430
574
|
Uint8Array,
|
|
431
575
|
Int16Array,
|
|
@@ -436,19 +580,19 @@ var ms = [
|
|
|
436
580
|
Float64Array,
|
|
437
581
|
Uint8ClampedArray
|
|
438
582
|
].reduce((e, t) => (e[t.name] = t, e), {});
|
|
439
|
-
var
|
|
440
|
-
const r =
|
|
583
|
+
var ft = se(cs, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
584
|
+
const r = ds[t[1]];
|
|
441
585
|
if (!r)
|
|
442
586
|
throw new Error("Trying to deserialize unknown typed array");
|
|
443
587
|
return new r(e);
|
|
444
588
|
});
|
|
445
|
-
function
|
|
589
|
+
function dt(e, t) {
|
|
446
590
|
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : false;
|
|
447
591
|
}
|
|
448
|
-
var
|
|
592
|
+
var mt = se(dt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
449
593
|
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
450
594
|
if (!r)
|
|
451
|
-
return
|
|
595
|
+
return y({}, e);
|
|
452
596
|
const s = {};
|
|
453
597
|
return r.forEach((n) => {
|
|
454
598
|
s[n] = e[n];
|
|
@@ -459,53 +603,53 @@ var pt = ie(mt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)
|
|
|
459
603
|
throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
460
604
|
return Object.assign(Object.create(s.prototype), e);
|
|
461
605
|
});
|
|
462
|
-
var
|
|
606
|
+
var pt = se((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
607
|
const s = r.customTransformerRegistry.findByName(t[1]);
|
|
464
608
|
if (!s)
|
|
465
609
|
throw new Error("Trying to deserialize unknown custom value");
|
|
466
610
|
return s.deserialize(e);
|
|
467
611
|
});
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
const r =
|
|
612
|
+
var ms = [mt, ct, pt, ft];
|
|
613
|
+
var Ue = (e, t) => {
|
|
614
|
+
const r = ze(ms, (n) => n.isApplicable(e, t));
|
|
471
615
|
if (r)
|
|
472
616
|
return {
|
|
473
617
|
value: r.transform(e, t),
|
|
474
618
|
type: r.annotation(e, t)
|
|
475
619
|
};
|
|
476
|
-
const s =
|
|
620
|
+
const s = ze(lt, (n) => n.isApplicable(e, t));
|
|
477
621
|
if (s)
|
|
478
622
|
return {
|
|
479
623
|
value: s.transform(e, t),
|
|
480
624
|
type: s.annotation
|
|
481
625
|
};
|
|
482
626
|
};
|
|
483
|
-
var
|
|
627
|
+
var gt = {};
|
|
484
628
|
lt.forEach((e) => {
|
|
485
|
-
|
|
629
|
+
gt[e.annotation] = e;
|
|
486
630
|
});
|
|
487
|
-
var
|
|
488
|
-
if (
|
|
631
|
+
var ps = (e, t, r) => {
|
|
632
|
+
if (I2(t))
|
|
489
633
|
switch (t[0]) {
|
|
490
634
|
case "symbol":
|
|
491
|
-
return
|
|
635
|
+
return ct.untransform(e, t, r);
|
|
492
636
|
case "class":
|
|
493
|
-
return
|
|
637
|
+
return mt.untransform(e, t, r);
|
|
494
638
|
case "custom":
|
|
495
|
-
return
|
|
639
|
+
return pt.untransform(e, t, r);
|
|
496
640
|
case "typed-array":
|
|
497
|
-
return
|
|
641
|
+
return ft.untransform(e, t, r);
|
|
498
642
|
default:
|
|
499
643
|
throw new Error("Unknown transformation: " + t);
|
|
500
644
|
}
|
|
501
645
|
else {
|
|
502
|
-
const s =
|
|
646
|
+
const s = gt[t];
|
|
503
647
|
if (!s)
|
|
504
648
|
throw new Error("Unknown transformation: " + t);
|
|
505
649
|
return s.untransform(e, r);
|
|
506
650
|
}
|
|
507
651
|
};
|
|
508
|
-
var
|
|
652
|
+
var L2 = (e, t) => {
|
|
509
653
|
if (t > e.size)
|
|
510
654
|
throw new Error("index out of bounds");
|
|
511
655
|
const r = e.keys();
|
|
@@ -513,7 +657,7 @@ var L = (e, t) => {
|
|
|
513
657
|
r.next(), t--;
|
|
514
658
|
return r.next().value;
|
|
515
659
|
};
|
|
516
|
-
function
|
|
660
|
+
function yt(e) {
|
|
517
661
|
if (ee(e, "__proto__"))
|
|
518
662
|
throw new Error("__proto__ is not allowed as a property");
|
|
519
663
|
if (ee(e, "prototype"))
|
|
@@ -521,20 +665,20 @@ function ht(e) {
|
|
|
521
665
|
if (ee(e, "constructor"))
|
|
522
666
|
throw new Error("constructor is not allowed as a property");
|
|
523
667
|
}
|
|
524
|
-
var
|
|
525
|
-
|
|
668
|
+
var gs = (e, t) => {
|
|
669
|
+
yt(t);
|
|
526
670
|
for (let r = 0;r < t.length; r++) {
|
|
527
671
|
const s = t[r];
|
|
528
672
|
if (J2(e))
|
|
529
|
-
e =
|
|
530
|
-
else if (
|
|
531
|
-
const n = +s, i = +t[++r] == 0 ? "key" : "value",
|
|
673
|
+
e = L2(e, +s);
|
|
674
|
+
else if (Y2(e)) {
|
|
675
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", a = L2(e, n);
|
|
532
676
|
switch (i) {
|
|
533
677
|
case "key":
|
|
534
|
-
e =
|
|
678
|
+
e = a;
|
|
535
679
|
break;
|
|
536
680
|
case "value":
|
|
537
|
-
e = e.get(
|
|
681
|
+
e = e.get(a);
|
|
538
682
|
break;
|
|
539
683
|
}
|
|
540
684
|
} else
|
|
@@ -542,159 +686,159 @@ var ys = (e, t) => {
|
|
|
542
686
|
}
|
|
543
687
|
return e;
|
|
544
688
|
};
|
|
545
|
-
var
|
|
546
|
-
if (
|
|
689
|
+
var me = (e, t, r) => {
|
|
690
|
+
if (yt(t), t.length === 0)
|
|
547
691
|
return r(e);
|
|
548
692
|
let s = e;
|
|
549
693
|
for (let i = 0;i < t.length - 1; i++) {
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
552
|
-
const
|
|
553
|
-
s = s[a];
|
|
554
|
-
} else if (G(s))
|
|
694
|
+
const a = t[i];
|
|
695
|
+
if (I2(s)) {
|
|
696
|
+
const o = +a;
|
|
555
697
|
s = s[o];
|
|
698
|
+
} else if (G(s))
|
|
699
|
+
s = s[a];
|
|
556
700
|
else if (J2(s)) {
|
|
557
|
-
const
|
|
558
|
-
s =
|
|
559
|
-
} else if (
|
|
701
|
+
const o = +a;
|
|
702
|
+
s = L2(s, o);
|
|
703
|
+
} else if (Y2(s)) {
|
|
560
704
|
if (i === t.length - 2)
|
|
561
705
|
break;
|
|
562
|
-
const u = +
|
|
563
|
-
switch (
|
|
706
|
+
const u = +a, l = +t[++i] == 0 ? "key" : "value", p = L2(s, u);
|
|
707
|
+
switch (l) {
|
|
564
708
|
case "key":
|
|
565
|
-
s =
|
|
709
|
+
s = p;
|
|
566
710
|
break;
|
|
567
711
|
case "value":
|
|
568
|
-
s = s.get(
|
|
712
|
+
s = s.get(p);
|
|
569
713
|
break;
|
|
570
714
|
}
|
|
571
715
|
}
|
|
572
716
|
}
|
|
573
717
|
const n = t[t.length - 1];
|
|
574
|
-
if (
|
|
575
|
-
const i =
|
|
576
|
-
i !==
|
|
718
|
+
if (I2(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J2(s)) {
|
|
719
|
+
const i = L2(s, +n), a = r(i);
|
|
720
|
+
i !== a && (s.delete(i), s.add(a));
|
|
577
721
|
}
|
|
578
|
-
if (
|
|
579
|
-
const i = +t[t.length - 2],
|
|
722
|
+
if (Y2(s)) {
|
|
723
|
+
const i = +t[t.length - 2], a = L2(s, i);
|
|
580
724
|
switch (+n == 0 ? "key" : "value") {
|
|
581
725
|
case "key": {
|
|
582
|
-
const u = r(
|
|
583
|
-
s.set(u, s.get(
|
|
726
|
+
const u = r(a);
|
|
727
|
+
s.set(u, s.get(a)), u !== a && s.delete(a);
|
|
584
728
|
break;
|
|
585
729
|
}
|
|
586
730
|
case "value": {
|
|
587
|
-
s.set(
|
|
731
|
+
s.set(a, r(s.get(a)));
|
|
588
732
|
break;
|
|
589
733
|
}
|
|
590
734
|
}
|
|
591
735
|
}
|
|
592
736
|
return e;
|
|
593
737
|
};
|
|
594
|
-
function
|
|
738
|
+
function pe(e, t, r = []) {
|
|
595
739
|
if (!e)
|
|
596
740
|
return;
|
|
597
|
-
if (!
|
|
598
|
-
V(e, (i,
|
|
741
|
+
if (!I2(e)) {
|
|
742
|
+
V(e, (i, a) => pe(i, t, [...r, ...W(a)]));
|
|
599
743
|
return;
|
|
600
744
|
}
|
|
601
745
|
const [s, n] = e;
|
|
602
|
-
n && V(n, (i,
|
|
603
|
-
|
|
746
|
+
n && V(n, (i, a) => {
|
|
747
|
+
pe(i, t, [...r, ...W(a)]);
|
|
604
748
|
}), t(s, r);
|
|
605
749
|
}
|
|
606
|
-
function
|
|
607
|
-
return
|
|
608
|
-
e =
|
|
750
|
+
function ys(e, t, r) {
|
|
751
|
+
return pe(t, (s, n) => {
|
|
752
|
+
e = me(e, n, (i) => ps(i, s, r));
|
|
609
753
|
}), e;
|
|
610
754
|
}
|
|
611
|
-
function
|
|
755
|
+
function hs(e, t) {
|
|
612
756
|
function r(s, n) {
|
|
613
|
-
const i =
|
|
614
|
-
s.map(
|
|
615
|
-
e =
|
|
757
|
+
const i = gs(e, W(n));
|
|
758
|
+
s.map(W).forEach((a) => {
|
|
759
|
+
e = me(e, a, () => i);
|
|
616
760
|
});
|
|
617
761
|
}
|
|
618
|
-
if (
|
|
762
|
+
if (I2(t)) {
|
|
619
763
|
const [s, n] = t;
|
|
620
764
|
s.forEach((i) => {
|
|
621
|
-
e =
|
|
765
|
+
e = me(e, W(i), () => e);
|
|
622
766
|
}), n && V(n, r);
|
|
623
767
|
} else
|
|
624
768
|
V(t, r);
|
|
625
769
|
return e;
|
|
626
770
|
}
|
|
627
|
-
var
|
|
771
|
+
var bs = (e, t) => G(e) || I2(e) || Y2(e) || J2(e) || dt(e, t);
|
|
628
772
|
function Fs(e, t, r) {
|
|
629
773
|
const s = r.get(e);
|
|
630
774
|
s ? s.push(t) : r.set(e, [t]);
|
|
631
775
|
}
|
|
632
|
-
function
|
|
776
|
+
function As(e, t) {
|
|
633
777
|
const r = {};
|
|
634
778
|
let s;
|
|
635
779
|
return e.forEach((n) => {
|
|
636
780
|
if (n.length <= 1)
|
|
637
781
|
return;
|
|
638
|
-
t || (n = n.map((
|
|
639
|
-
const [i, ...
|
|
640
|
-
i.length === 0 ? s =
|
|
641
|
-
}), s ?
|
|
782
|
+
t || (n = n.map((o) => o.map(String)).sort((o, u) => o.length - u.length));
|
|
783
|
+
const [i, ...a] = n;
|
|
784
|
+
i.length === 0 ? s = a.map(oe) : r[oe(i)] = a.map(oe);
|
|
785
|
+
}), s ? de(r) ? [s] : [s, r] : de(r) ? undefined : r;
|
|
642
786
|
}
|
|
643
|
-
var
|
|
787
|
+
var ht2 = (e, t, r, s, n = [], i = [], a = /* @__PURE__ */ new Map) => {
|
|
644
788
|
var b2;
|
|
645
|
-
const
|
|
646
|
-
if (!
|
|
789
|
+
const o = os(e);
|
|
790
|
+
if (!o) {
|
|
647
791
|
Fs(e, n, t);
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
792
|
+
const g3 = a.get(e);
|
|
793
|
+
if (g3)
|
|
650
794
|
return s ? {
|
|
651
795
|
transformedValue: null
|
|
652
|
-
} :
|
|
796
|
+
} : g3;
|
|
653
797
|
}
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
transformedValue:
|
|
657
|
-
annotations: [
|
|
798
|
+
if (!bs(e, r)) {
|
|
799
|
+
const g3 = Ue(e, r), m2 = g3 ? {
|
|
800
|
+
transformedValue: g3.value,
|
|
801
|
+
annotations: [g3.type]
|
|
658
802
|
} : {
|
|
659
803
|
transformedValue: e
|
|
660
804
|
};
|
|
661
|
-
return
|
|
805
|
+
return o || a.set(e, m2), m2;
|
|
662
806
|
}
|
|
663
807
|
if (ee(i, e))
|
|
664
808
|
return {
|
|
665
809
|
transformedValue: null
|
|
666
810
|
};
|
|
667
|
-
const u =
|
|
668
|
-
V(
|
|
811
|
+
const u = Ue(e, r), l = (b2 = u == null ? undefined : u.value) != null ? b2 : e, p = I2(l) ? [] : {}, c = {};
|
|
812
|
+
V(l, (g3, m2) => {
|
|
669
813
|
if (m2 === "__proto__" || m2 === "constructor" || m2 === "prototype")
|
|
670
814
|
throw new Error(`Detected property ${m2}. This is a prototype pollution risk, please remove it from your object.`);
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
815
|
+
const F = ht2(g3, t, r, s, [...n, m2], [...i, e], a);
|
|
816
|
+
p[m2] = F.transformedValue, I2(F.annotations) ? c[m2] = F.annotations : G(F.annotations) && V(F.annotations, (C2, N3) => {
|
|
817
|
+
c[ut(m2) + "." + N3] = C2;
|
|
674
818
|
});
|
|
675
819
|
});
|
|
676
|
-
const d =
|
|
677
|
-
transformedValue:
|
|
820
|
+
const d = de(c) ? {
|
|
821
|
+
transformedValue: p,
|
|
678
822
|
annotations: u ? [u.type] : undefined
|
|
679
823
|
} : {
|
|
680
|
-
transformedValue:
|
|
681
|
-
annotations: u ? [u.type,
|
|
824
|
+
transformedValue: p,
|
|
825
|
+
annotations: u ? [u.type, c] : c
|
|
682
826
|
};
|
|
683
|
-
return
|
|
827
|
+
return o || a.set(e, d), d;
|
|
684
828
|
};
|
|
685
|
-
function
|
|
829
|
+
function bt(e) {
|
|
686
830
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
687
831
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
832
|
+
function _e(e) {
|
|
833
|
+
return bt(e) === "Array";
|
|
690
834
|
}
|
|
691
|
-
function
|
|
692
|
-
if (
|
|
835
|
+
function ws2(e) {
|
|
836
|
+
if (bt(e) !== "Object")
|
|
693
837
|
return false;
|
|
694
838
|
const t = Object.getPrototypeOf(e);
|
|
695
839
|
return !!t && t.constructor === Object && t === Object.prototype;
|
|
696
840
|
}
|
|
697
|
-
function
|
|
841
|
+
function Es(e, t, r, s, n) {
|
|
698
842
|
const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
699
843
|
i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
|
|
700
844
|
value: r,
|
|
@@ -703,43 +847,43 @@ function Cs(e, t, r, s, n) {
|
|
|
703
847
|
configurable: true
|
|
704
848
|
});
|
|
705
849
|
}
|
|
706
|
-
function
|
|
707
|
-
if (
|
|
708
|
-
return e.map((n) =>
|
|
709
|
-
if (!
|
|
850
|
+
function ge(e, t = {}) {
|
|
851
|
+
if (_e(e))
|
|
852
|
+
return e.map((n) => ge(n, t));
|
|
853
|
+
if (!ws2(e))
|
|
710
854
|
return e;
|
|
711
855
|
const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
712
856
|
return [...r, ...s].reduce((n, i) => {
|
|
713
|
-
if (
|
|
857
|
+
if (_e(t.props) && !t.props.includes(i))
|
|
714
858
|
return n;
|
|
715
|
-
const
|
|
716
|
-
return
|
|
859
|
+
const a = e[i], o = ge(a, t);
|
|
860
|
+
return Es(n, i, o, e, t.nonenumerable), n;
|
|
717
861
|
}, {});
|
|
718
862
|
}
|
|
719
863
|
|
|
720
864
|
class h2 {
|
|
721
865
|
constructor({ dedupe: t = false } = {}) {
|
|
722
|
-
this.classRegistry = new
|
|
866
|
+
this.classRegistry = new Jr, this.symbolRegistry = new it((r) => {
|
|
723
867
|
var s;
|
|
724
868
|
return (s = r.description) != null ? s : "";
|
|
725
|
-
}), this.customTransformerRegistry = new
|
|
869
|
+
}), this.customTransformerRegistry = new Xr, this.allowedErrorProps = [], this.dedupe = t;
|
|
726
870
|
}
|
|
727
871
|
serialize(t) {
|
|
728
|
-
const r = /* @__PURE__ */ new Map, s =
|
|
872
|
+
const r = /* @__PURE__ */ new Map, s = ht2(t, r, this, this.dedupe), n = {
|
|
729
873
|
json: s.transformedValue
|
|
730
874
|
};
|
|
731
|
-
s.annotations && (n.meta =
|
|
875
|
+
s.annotations && (n.meta = A(y({}, n.meta), {
|
|
732
876
|
values: s.annotations
|
|
733
877
|
}));
|
|
734
|
-
const i =
|
|
735
|
-
return i && (n.meta =
|
|
878
|
+
const i = As(r, this.dedupe);
|
|
879
|
+
return i && (n.meta = A(y({}, n.meta), {
|
|
736
880
|
referentialEqualities: i
|
|
737
881
|
})), n;
|
|
738
882
|
}
|
|
739
883
|
deserialize(t) {
|
|
740
884
|
const { json: r, meta: s } = t;
|
|
741
|
-
let n =
|
|
742
|
-
return s != null && s.values && (n =
|
|
885
|
+
let n = ge(r);
|
|
886
|
+
return s != null && s.values && (n = ys(n, s.values, this)), s != null && s.referentialEqualities && (n = hs(n, s.referentialEqualities)), n;
|
|
743
887
|
}
|
|
744
888
|
stringify(t) {
|
|
745
889
|
return JSON.stringify(this.serialize(t));
|
|
@@ -754,7 +898,7 @@ class h2 {
|
|
|
754
898
|
this.symbolRegistry.register(t, r);
|
|
755
899
|
}
|
|
756
900
|
registerCustom(t, r) {
|
|
757
|
-
this.customTransformerRegistry.register(
|
|
901
|
+
this.customTransformerRegistry.register(y({
|
|
758
902
|
name: r
|
|
759
903
|
}, t));
|
|
760
904
|
}
|
|
@@ -771,45 +915,45 @@ h2.registerClass = h2.defaultInstance.registerClass.bind(h2.defaultInstance);
|
|
|
771
915
|
h2.registerSymbol = h2.defaultInstance.registerSymbol.bind(h2.defaultInstance);
|
|
772
916
|
h2.registerCustom = h2.defaultInstance.registerCustom.bind(h2.defaultInstance);
|
|
773
917
|
h2.allowErrorProps = h2.defaultInstance.allowErrorProps.bind(h2.defaultInstance);
|
|
774
|
-
var z2 = (e) => e === undefined ?
|
|
775
|
-
var
|
|
776
|
-
var
|
|
777
|
-
var
|
|
918
|
+
var z2 = (e) => e === undefined ? N.None : e;
|
|
919
|
+
var Cs = (e) => new m(e.metadataItem, e.type);
|
|
920
|
+
var Ae = (e) => new Ke(e.name, e.expression, e.type, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
921
|
+
var we = (e) => new J(e.name, e.expression, e.granularity, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
778
922
|
var O = (e) => {
|
|
779
923
|
switch (e.__serializable) {
|
|
780
924
|
case "DimensionalAttribute":
|
|
781
|
-
return
|
|
925
|
+
return Ae(e);
|
|
782
926
|
case "DimensionalLevelAttribute":
|
|
783
|
-
return
|
|
927
|
+
return we(e);
|
|
784
928
|
default:
|
|
785
929
|
return e;
|
|
786
930
|
}
|
|
787
931
|
};
|
|
788
|
-
var Ft = (e) => new
|
|
789
|
-
var
|
|
790
|
-
var
|
|
932
|
+
var Ft = (e) => new g2(e.name, e.expression, e.attributes.map(O), e.dimensions.map(Ts), e.type, e.description, z2(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? O(e.defaultAttribute) : undefined);
|
|
933
|
+
var At = (e) => new D(e.name, e.expression, e.description, z2(e.sort), e.dataSource, e.composeCode, e.indexed, e.merged);
|
|
934
|
+
var Ts = (e) => {
|
|
791
935
|
switch (e.__serializable) {
|
|
792
936
|
case "DimensionalDimension":
|
|
793
937
|
return Ft(e);
|
|
794
938
|
case "DimensionalDateDimension":
|
|
795
|
-
return
|
|
939
|
+
return At(e);
|
|
796
940
|
default:
|
|
797
941
|
return e;
|
|
798
942
|
}
|
|
799
943
|
};
|
|
800
|
-
var
|
|
801
|
-
var
|
|
944
|
+
var Ee = (e) => new ye(e.name, O(e.attribute), e.aggregation, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
945
|
+
var Ce = (e) => {
|
|
802
946
|
const t = Object.fromEntries(Object.entries(e.context).map(([r, s]) => {
|
|
803
947
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
804
948
|
switch (s.__serializable) {
|
|
805
949
|
case "DimensionalAttribute":
|
|
806
|
-
return [r,
|
|
950
|
+
return [r, Ae(s)];
|
|
807
951
|
case "DimensionalLevelAttribute":
|
|
808
|
-
return [r,
|
|
952
|
+
return [r, we(s)];
|
|
809
953
|
case "DimensionalBaseMeasure":
|
|
810
|
-
return [r,
|
|
954
|
+
return [r, Ee(s)];
|
|
811
955
|
case "DimensionalCalculatedMeasure":
|
|
812
|
-
return [r,
|
|
956
|
+
return [r, Ce(s)];
|
|
813
957
|
default:
|
|
814
958
|
return [r, s];
|
|
815
959
|
}
|
|
@@ -817,47 +961,47 @@ var qe = (e) => {
|
|
|
817
961
|
}));
|
|
818
962
|
return new X(e.name, e.expression, t, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
819
963
|
};
|
|
820
|
-
var
|
|
821
|
-
var
|
|
964
|
+
var wt = (e) => new Zt(e.name, O(e.attribute), e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
965
|
+
var ue = (e) => {
|
|
822
966
|
switch (e.__serializable) {
|
|
823
967
|
case "DimensionalBaseMeasure":
|
|
824
|
-
return
|
|
968
|
+
return Ee(e);
|
|
825
969
|
case "DimensionalCalculatedMeasure":
|
|
826
|
-
return
|
|
970
|
+
return Ce(e);
|
|
827
971
|
case "DimensionalMeasureTemplate":
|
|
828
|
-
return
|
|
972
|
+
return wt(e);
|
|
829
973
|
default:
|
|
830
974
|
return e;
|
|
831
975
|
}
|
|
832
976
|
};
|
|
833
|
-
var
|
|
977
|
+
var T3 = (e) => {
|
|
834
978
|
switch (e.__serializable) {
|
|
835
979
|
case "MembersFilter":
|
|
836
|
-
return new
|
|
980
|
+
return new zd(O(e.attribute), e.members, e.config.backgroundFilter ? A(y({}, e.config), { backgroundFilter: T3(e.config.backgroundFilter) }) : e.config, e.composeCode);
|
|
837
981
|
case "LogicalAttributeFilter":
|
|
838
|
-
return new
|
|
982
|
+
return new Wi(e.filters.map((r) => T3(r)), e.operator, e.config, e.composeCode);
|
|
839
983
|
case "CascadingFilter":
|
|
840
|
-
return new
|
|
984
|
+
return new Hd(e._filters.map((r) => T3(r)), e.config, e.composeCode);
|
|
841
985
|
case "ExcludeFilter":
|
|
842
|
-
return new
|
|
986
|
+
return new kd(T3(e.filter), e.input ? T3(e.input) : undefined, e.config, e.composeCode);
|
|
843
987
|
case "MeasureFilter":
|
|
844
|
-
return new
|
|
988
|
+
return new qd(O(e.attribute), ue(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
845
989
|
case "RankingFilter":
|
|
846
|
-
return new
|
|
990
|
+
return new Gi(O(e.attribute), ue(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
847
991
|
case "MeasureRankingFilter":
|
|
848
|
-
return new
|
|
992
|
+
return new Vi(ue(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
849
993
|
case "NumericFilter":
|
|
850
|
-
return new
|
|
994
|
+
return new Wd(O(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
851
995
|
case "TextFilter":
|
|
852
996
|
return new re(O(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
|
|
853
997
|
case "DateRangeFilter": {
|
|
854
998
|
const { valueA: r, valueB: s } = e;
|
|
855
|
-
return new
|
|
999
|
+
return new Gd(O(e.attribute), r, s, e.config, e.composeCode);
|
|
856
1000
|
}
|
|
857
1001
|
case "RelativeDateFilter":
|
|
858
|
-
return new
|
|
1002
|
+
return new Rn(O(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
|
|
859
1003
|
case "CustomFilter":
|
|
860
|
-
return new
|
|
1004
|
+
return new Vd(O(e.attribute), e.jaqlExpression, e.config, e.composeCode);
|
|
861
1005
|
default:
|
|
862
1006
|
return e;
|
|
863
1007
|
}
|
|
@@ -865,157 +1009,157 @@ var T2 = (e) => {
|
|
|
865
1009
|
h2.registerCustom({
|
|
866
1010
|
isApplicable: h,
|
|
867
1011
|
serialize: (e) => e.serialize(),
|
|
868
|
-
deserialize: (e) =>
|
|
1012
|
+
deserialize: (e) => Cs(e)
|
|
869
1013
|
}, "JaqlElement");
|
|
870
1014
|
h2.registerCustom({
|
|
871
|
-
isApplicable:
|
|
1015
|
+
isApplicable: Ip,
|
|
872
1016
|
serialize: (e) => e.serialize(),
|
|
873
|
-
deserialize: (e) =>
|
|
1017
|
+
deserialize: (e) => Ae(e)
|
|
874
1018
|
}, "DimensionalAttribute");
|
|
875
1019
|
h2.registerCustom({
|
|
876
|
-
isApplicable:
|
|
1020
|
+
isApplicable: $p,
|
|
877
1021
|
serialize: (e) => e.serialize(),
|
|
878
|
-
deserialize: (e) =>
|
|
1022
|
+
deserialize: (e) => we(e)
|
|
879
1023
|
}, "DimensionalLevelAttribute");
|
|
880
1024
|
h2.registerCustom({
|
|
881
|
-
isApplicable:
|
|
1025
|
+
isApplicable: L,
|
|
882
1026
|
serialize: (e) => e.serialize(),
|
|
883
1027
|
deserialize: (e) => Ft(e)
|
|
884
1028
|
}, "DimensionalDimension");
|
|
885
1029
|
h2.registerCustom({
|
|
886
|
-
isApplicable:
|
|
1030
|
+
isApplicable: I,
|
|
887
1031
|
serialize: (e) => e.serialize(),
|
|
888
|
-
deserialize: (e) =>
|
|
1032
|
+
deserialize: (e) => At(e)
|
|
889
1033
|
}, "DimensionalDateDimension");
|
|
890
1034
|
h2.registerCustom({
|
|
891
|
-
isApplicable:
|
|
1035
|
+
isApplicable: Bi,
|
|
892
1036
|
serialize: (e) => e.serialize(),
|
|
893
|
-
deserialize: (e) =>
|
|
1037
|
+
deserialize: (e) => Ee(e)
|
|
894
1038
|
}, "DimensionalBaseMeasure");
|
|
895
1039
|
h2.registerCustom({
|
|
896
|
-
isApplicable:
|
|
1040
|
+
isApplicable: zi,
|
|
897
1041
|
serialize: (e) => e.serialize(),
|
|
898
|
-
deserialize: (e) =>
|
|
1042
|
+
deserialize: (e) => Ce(e)
|
|
899
1043
|
}, "DimensionalCalculatedMeasure");
|
|
900
1044
|
h2.registerCustom({
|
|
901
|
-
isApplicable:
|
|
1045
|
+
isApplicable: gp,
|
|
902
1046
|
serialize: (e) => e.serialize(),
|
|
903
|
-
deserialize: (e) =>
|
|
1047
|
+
deserialize: (e) => wt(e)
|
|
904
1048
|
}, "DimensionalMeasureTemplate");
|
|
905
1049
|
h2.registerCustom({
|
|
906
|
-
isApplicable:
|
|
1050
|
+
isApplicable: pp,
|
|
907
1051
|
serialize: (e) => e.serialize(),
|
|
908
|
-
deserialize: (e) =>
|
|
1052
|
+
deserialize: (e) => T3(e)
|
|
909
1053
|
}, "MembersFilter");
|
|
910
1054
|
h2.registerCustom({
|
|
911
|
-
isApplicable:
|
|
1055
|
+
isApplicable: Ap,
|
|
912
1056
|
serialize: (e) => e.serialize(),
|
|
913
|
-
deserialize: (e) =>
|
|
1057
|
+
deserialize: (e) => T3(e)
|
|
914
1058
|
}, "LogicalAttributeFilter");
|
|
915
1059
|
h2.registerCustom({
|
|
916
|
-
isApplicable:
|
|
1060
|
+
isApplicable: Ct,
|
|
917
1061
|
serialize: (e) => e.serialize(),
|
|
918
|
-
deserialize: (e) =>
|
|
1062
|
+
deserialize: (e) => T3(e)
|
|
919
1063
|
}, "CascadingFilter");
|
|
920
1064
|
h2.registerCustom({
|
|
921
|
-
isApplicable:
|
|
1065
|
+
isApplicable: vp,
|
|
922
1066
|
serialize: (e) => e.serialize(),
|
|
923
|
-
deserialize: (e) =>
|
|
1067
|
+
deserialize: (e) => T3(e)
|
|
924
1068
|
}, "ExcludeFilter");
|
|
925
1069
|
h2.registerCustom({
|
|
926
|
-
isApplicable:
|
|
1070
|
+
isApplicable: Sp,
|
|
927
1071
|
serialize: (e) => e.serialize(),
|
|
928
|
-
deserialize: (e) =>
|
|
1072
|
+
deserialize: (e) => T3(e)
|
|
929
1073
|
}, "MeasureFilter");
|
|
930
1074
|
h2.registerCustom({
|
|
931
|
-
isApplicable:
|
|
1075
|
+
isApplicable: bp,
|
|
932
1076
|
serialize: (e) => e.serialize(),
|
|
933
|
-
deserialize: (e) =>
|
|
1077
|
+
deserialize: (e) => T3(e)
|
|
934
1078
|
}, "RankingFilter");
|
|
935
1079
|
h2.registerCustom({
|
|
936
|
-
isApplicable:
|
|
1080
|
+
isApplicable: yp,
|
|
937
1081
|
serialize: (e) => e.serialize(),
|
|
938
|
-
deserialize: (e) =>
|
|
1082
|
+
deserialize: (e) => T3(e)
|
|
939
1083
|
}, "MeasureRankingFilter");
|
|
940
1084
|
h2.registerCustom({
|
|
941
|
-
isApplicable:
|
|
1085
|
+
isApplicable: mp,
|
|
942
1086
|
serialize: (e) => e.serialize(),
|
|
943
|
-
deserialize: (e) =>
|
|
1087
|
+
deserialize: (e) => T3(e)
|
|
944
1088
|
}, "NumericFilter");
|
|
945
1089
|
h2.registerCustom({
|
|
946
|
-
isApplicable:
|
|
1090
|
+
isApplicable: Ep,
|
|
947
1091
|
serialize: (e) => e.serialize(),
|
|
948
|
-
deserialize: (e) =>
|
|
1092
|
+
deserialize: (e) => T3(e)
|
|
949
1093
|
}, "TextFilter");
|
|
950
1094
|
h2.registerCustom({
|
|
951
|
-
isApplicable:
|
|
1095
|
+
isApplicable: _p,
|
|
952
1096
|
serialize: (e) => e.serialize(),
|
|
953
|
-
deserialize: (e) =>
|
|
1097
|
+
deserialize: (e) => T3(e)
|
|
954
1098
|
}, "DateRangeFilter");
|
|
955
1099
|
h2.registerCustom({
|
|
956
|
-
isApplicable:
|
|
1100
|
+
isApplicable: Tp,
|
|
957
1101
|
serialize: (e) => e.serialize(),
|
|
958
|
-
deserialize: (e) =>
|
|
1102
|
+
deserialize: (e) => T3(e)
|
|
959
1103
|
}, "RelativeDateFilter");
|
|
960
1104
|
h2.registerCustom({
|
|
961
|
-
isApplicable:
|
|
1105
|
+
isApplicable: hp,
|
|
962
1106
|
serialize: (e) => e.serialize(),
|
|
963
|
-
deserialize: (e) =>
|
|
1107
|
+
deserialize: (e) => T3(e)
|
|
964
1108
|
}, "CustomFilter");
|
|
965
|
-
var
|
|
966
|
-
var
|
|
967
|
-
function
|
|
1109
|
+
var Yn = h2;
|
|
1110
|
+
var E4 = "DM.";
|
|
1111
|
+
function S(e) {
|
|
968
1112
|
return typeof e == "object" && e !== null;
|
|
969
1113
|
}
|
|
970
1114
|
function q3(e) {
|
|
971
1115
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
972
1116
|
}
|
|
973
|
-
function
|
|
1117
|
+
function Et(e) {
|
|
974
1118
|
return e.every(q3);
|
|
975
1119
|
}
|
|
976
|
-
function
|
|
1120
|
+
function ne(e) {
|
|
977
1121
|
return "attribute" in e && "config" in e;
|
|
978
1122
|
}
|
|
979
1123
|
function Z(e) {
|
|
980
1124
|
return "left" in e && "right" in e && "operator" in e;
|
|
981
1125
|
}
|
|
982
|
-
function
|
|
983
|
-
return !
|
|
1126
|
+
function Te(e) {
|
|
1127
|
+
return !ne(e) && !Z(e);
|
|
984
1128
|
}
|
|
985
|
-
function
|
|
986
|
-
return
|
|
1129
|
+
function qs(e) {
|
|
1130
|
+
return S(e) && "column" in e && typeof e.column == "string" && !(("function" in e) && ("args" in e));
|
|
987
1131
|
}
|
|
988
|
-
function
|
|
989
|
-
return !
|
|
1132
|
+
function xs2(e) {
|
|
1133
|
+
return !S(e) || !("column" in e) ? false : q3(e.column);
|
|
990
1134
|
}
|
|
991
1135
|
var x = 3;
|
|
992
|
-
function
|
|
1136
|
+
function v(e, t, r) {
|
|
993
1137
|
if (t.length === 0)
|
|
994
1138
|
return;
|
|
995
1139
|
let s = Number.MAX_SAFE_INTEGER, n;
|
|
996
1140
|
for (const i of t) {
|
|
997
|
-
const
|
|
998
|
-
|
|
1141
|
+
const a = r(i), o = Gr(e, a);
|
|
1142
|
+
o < s && (s = o, n = i);
|
|
999
1143
|
}
|
|
1000
1144
|
return n !== undefined ? { best: n, distance: s } : undefined;
|
|
1001
1145
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return e.localeCompare(t,
|
|
1146
|
+
var Ct2 = "en";
|
|
1147
|
+
function le(e, t) {
|
|
1148
|
+
return e.localeCompare(t, Ct2, { sensitivity: "accent" }) === 0;
|
|
1005
1149
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return t.length <= e.length && e.slice(0, t.length).localeCompare(t,
|
|
1150
|
+
function Ve(e, t) {
|
|
1151
|
+
return t.length <= e.length && e.slice(0, t.length).localeCompare(t, Ct2, { sensitivity: "accent" }) === 0;
|
|
1008
1152
|
}
|
|
1009
|
-
function
|
|
1010
|
-
const t = [...e].sort((i,
|
|
1153
|
+
function qe(e) {
|
|
1154
|
+
const t = [...e].sort((i, a) => a.name.length - i.name.length), r = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
|
|
1011
1155
|
for (const i of e) {
|
|
1012
1156
|
r.set(i.name, i);
|
|
1013
|
-
const
|
|
1014
|
-
n.set(i.name,
|
|
1015
|
-
const
|
|
1157
|
+
const a = [...i.columns].sort((u, l) => l.name.length - u.name.length);
|
|
1158
|
+
n.set(i.name, a);
|
|
1159
|
+
const o = /* @__PURE__ */ new Map;
|
|
1016
1160
|
for (const u of i.columns)
|
|
1017
|
-
|
|
1018
|
-
s.set(i.name,
|
|
1161
|
+
o.set(u.name, u);
|
|
1162
|
+
s.set(i.name, o);
|
|
1019
1163
|
}
|
|
1020
1164
|
return {
|
|
1021
1165
|
sortedTables: t,
|
|
@@ -1024,138 +1168,138 @@ function $e(e) {
|
|
|
1024
1168
|
columnMap: s
|
|
1025
1169
|
};
|
|
1026
1170
|
}
|
|
1027
|
-
function
|
|
1028
|
-
if (!e.startsWith(
|
|
1029
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1030
|
-
const r = e.slice(
|
|
1171
|
+
function xe(e, t) {
|
|
1172
|
+
if (!e.startsWith(E4))
|
|
1173
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
|
|
1174
|
+
const r = e.slice(E4.length);
|
|
1031
1175
|
if (!r)
|
|
1032
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1176
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
|
|
1033
1177
|
let s, n;
|
|
1034
1178
|
for (const m2 of t.sortedTables)
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
if (!
|
|
1038
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1039
|
-
s = m2, n =
|
|
1179
|
+
if (Ve(r, m2.name + ".")) {
|
|
1180
|
+
const F = r.slice(m2.name.length + 1);
|
|
1181
|
+
if (!F)
|
|
1182
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
|
|
1183
|
+
s = m2, n = F;
|
|
1040
1184
|
break;
|
|
1041
1185
|
}
|
|
1042
1186
|
if (!s) {
|
|
1043
1187
|
const m2 = r.indexOf(".");
|
|
1044
1188
|
if (m2 === -1)
|
|
1045
|
-
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1046
|
-
const
|
|
1047
|
-
throw new Error(`Table '${
|
|
1189
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
|
|
1190
|
+
const F = r.slice(0, m2), C2 = v(F, t.sortedTables, (ae) => ae.name), N3 = C2 && C2.distance <= x ? ` Did you mean '${C2.best.name}'?` : "";
|
|
1191
|
+
throw new Error(`Table '${F}' not found in the data model.${N3}`);
|
|
1048
1192
|
}
|
|
1049
1193
|
const i = t.tableColumnMap.get(s.name);
|
|
1050
1194
|
if (!i)
|
|
1051
1195
|
throw new Error(`Table '${s.name}' found but has no columns`);
|
|
1052
|
-
let
|
|
1196
|
+
let a, o;
|
|
1053
1197
|
const u = g.all;
|
|
1054
1198
|
for (const m2 of i) {
|
|
1055
|
-
if (
|
|
1199
|
+
if (le(n, m2.name))
|
|
1056
1200
|
return { table: s, column: m2 };
|
|
1057
|
-
if (!
|
|
1201
|
+
if (!Ve(n, m2.name + "."))
|
|
1058
1202
|
continue;
|
|
1059
|
-
const
|
|
1060
|
-
if (!
|
|
1203
|
+
const F = n.slice(m2.name.length + 1);
|
|
1204
|
+
if (!F)
|
|
1061
1205
|
continue;
|
|
1062
|
-
const C2 = u.includes(
|
|
1206
|
+
const C2 = u.includes(F), N3 = Lt(m2.dataType);
|
|
1063
1207
|
if (C2) {
|
|
1064
|
-
if (
|
|
1065
|
-
return { table: s, column: m2, level:
|
|
1066
|
-
|
|
1208
|
+
if (N3)
|
|
1209
|
+
return { table: s, column: m2, level: F };
|
|
1210
|
+
a || (a = m2, o = F);
|
|
1067
1211
|
continue;
|
|
1068
1212
|
}
|
|
1069
|
-
|
|
1213
|
+
N3 && !a && (a = m2, o = F);
|
|
1070
1214
|
}
|
|
1071
|
-
if (
|
|
1072
|
-
if (u.includes(
|
|
1073
|
-
throw new Error(`Invalid date level '${
|
|
1074
|
-
const m2 =
|
|
1075
|
-
throw new Error(`Invalid date level '${
|
|
1215
|
+
if (a && o) {
|
|
1216
|
+
if (u.includes(o))
|
|
1217
|
+
throw new Error(`Invalid date level '${o}' in dimensional element '${e}'. Column '${s.name}.${a.name}' is not a datetime column`);
|
|
1218
|
+
const m2 = v(o, u, (C2) => C2), F = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
|
|
1219
|
+
throw new Error(`Invalid date level '${o}' in dimensional element '${e}'. Valid levels are: ${u.join(", ")}.${F}`);
|
|
1076
1220
|
}
|
|
1077
|
-
const
|
|
1078
|
-
throw new Error(`Column '${
|
|
1221
|
+
const l = n.indexOf("."), p = l === -1 ? n : n.slice(0, l), c = v(n, i, (m2) => m2.name), d = c && c.distance <= x && !le(c.best.name, p), b2 = d ? ` Did you mean '${c.best.name}'?` : "", g3 = !d && n.endsWith(".") && c !== undefined && le(c.best.name, p) ? ` Use '${p}' without a trailing dot.` : "";
|
|
1222
|
+
throw new Error(`Column '${p}' not found in table '${s.name}'.${b2}${g3}`);
|
|
1079
1223
|
}
|
|
1080
|
-
function
|
|
1081
|
-
const { table: r, column: s, level: n } =
|
|
1224
|
+
function $s(e, t) {
|
|
1225
|
+
const { table: r, column: s, level: n } = xe(e, t);
|
|
1082
1226
|
if (n) {
|
|
1083
|
-
if (!
|
|
1227
|
+
if (!Lt(s.dataType))
|
|
1084
1228
|
throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`);
|
|
1085
1229
|
const i = g.all;
|
|
1086
1230
|
if (!i.includes(n))
|
|
1087
1231
|
throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Valid levels are: ${i.join(", ")}`);
|
|
1088
|
-
const
|
|
1089
|
-
if (s.dataType === "date" && !
|
|
1232
|
+
const a = g.dateOnly;
|
|
1233
|
+
if (s.dataType === "date" && !a.includes(n))
|
|
1090
1234
|
throw new Error(`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`);
|
|
1091
|
-
const
|
|
1092
|
-
if (s.dataType === "time" && !
|
|
1235
|
+
const o = g.timeOnly;
|
|
1236
|
+
if (s.dataType === "time" && !o.includes(n))
|
|
1093
1237
|
throw new Error(`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`);
|
|
1094
1238
|
}
|
|
1095
1239
|
return { table: r, column: s, level: n };
|
|
1096
1240
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const { table: n, column: i, level:
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1101
|
-
const u = s.inferredDateLevel,
|
|
1102
|
-
if (!
|
|
1103
|
-
throw new Error(`Invalid inferred date level '${u}'. Valid levels are: ${
|
|
1104
|
-
const
|
|
1105
|
-
if (i.dataType === "date" && !
|
|
1106
|
-
throw new Error(`Invalid level '${u}' in dimensional element '${
|
|
1241
|
+
function H2(e, t, r, s) {
|
|
1242
|
+
const { table: n, column: i, level: a } = $s(e, r);
|
|
1243
|
+
let o = a;
|
|
1244
|
+
if (Lt(i.dataType) && o === undefined && (s != null && s.inferredDateLevel)) {
|
|
1245
|
+
const u = s.inferredDateLevel, l = g.all;
|
|
1246
|
+
if (!l.includes(u))
|
|
1247
|
+
throw new Error(`Invalid inferred date level '${u}'. Valid levels are: ${l.join(", ")}`);
|
|
1248
|
+
const p = `${e}.${u}`, c = g.dateOnly;
|
|
1249
|
+
if (i.dataType === "date" && !c.includes(u))
|
|
1250
|
+
throw new Error(`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`);
|
|
1107
1251
|
const d = g.timeOnly;
|
|
1108
1252
|
if (i.dataType === "time" && !d.includes(u))
|
|
1109
|
-
throw new Error(`Invalid level '${u}' in dimensional element '${
|
|
1110
|
-
|
|
1253
|
+
throw new Error(`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a time column, not a date column`);
|
|
1254
|
+
o = u;
|
|
1111
1255
|
}
|
|
1112
|
-
return
|
|
1256
|
+
return Dn({
|
|
1113
1257
|
expression: i.expression,
|
|
1114
1258
|
dataType: i.dataType,
|
|
1115
|
-
granularity:
|
|
1259
|
+
granularity: o,
|
|
1116
1260
|
format: undefined,
|
|
1117
1261
|
sort: undefined,
|
|
1118
1262
|
dataSource: t
|
|
1119
1263
|
});
|
|
1120
1264
|
}
|
|
1121
|
-
function
|
|
1122
|
-
const { column: s, level: n } =
|
|
1265
|
+
function Ss(e, t, r) {
|
|
1266
|
+
const { column: s, level: n } = xe(e, r);
|
|
1123
1267
|
if (n)
|
|
1124
|
-
throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${
|
|
1125
|
-
if (!
|
|
1268
|
+
throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${E4}TableName.ColumnName'`);
|
|
1269
|
+
if (!Lt(s.dataType))
|
|
1126
1270
|
throw new Error(`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`);
|
|
1127
|
-
return
|
|
1271
|
+
return Q({
|
|
1128
1272
|
name: s.name,
|
|
1129
1273
|
expression: s.expression,
|
|
1130
1274
|
dataSource: t
|
|
1131
1275
|
});
|
|
1132
1276
|
}
|
|
1133
|
-
var
|
|
1277
|
+
var Os = (e, t) => {
|
|
1134
1278
|
if (!e)
|
|
1135
1279
|
return;
|
|
1136
1280
|
const r = typeof e == "object" ? e.direction : e;
|
|
1137
|
-
if (!
|
|
1138
|
-
return
|
|
1281
|
+
if (!ws(r))
|
|
1282
|
+
return A(y({}, t), {
|
|
1139
1283
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
|
|
1140
1284
|
});
|
|
1141
1285
|
};
|
|
1142
|
-
var
|
|
1143
|
-
const n =
|
|
1286
|
+
var Ds = (e, t, r, s) => {
|
|
1287
|
+
const n = Os(e.sortType, s);
|
|
1144
1288
|
if (n)
|
|
1145
1289
|
return {
|
|
1146
|
-
attribute:
|
|
1290
|
+
attribute: H2(e.column, t, r),
|
|
1147
1291
|
style: {},
|
|
1148
1292
|
error: n
|
|
1149
1293
|
};
|
|
1150
|
-
const i =
|
|
1151
|
-
return { attribute: i, style:
|
|
1294
|
+
const i = H2(e.column, t, r), a = od(e, "column");
|
|
1295
|
+
return { attribute: i, style: a };
|
|
1152
1296
|
};
|
|
1153
|
-
var
|
|
1154
|
-
error:
|
|
1297
|
+
var Ms = (e, t, r, s) => typeof e == "string" ? { attribute: H2(e, t, r) } : qs(e) ? Ds(e, t, r, s) : {
|
|
1298
|
+
error: A(y({}, s), {
|
|
1155
1299
|
message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
|
|
1156
1300
|
})
|
|
1157
1301
|
};
|
|
1158
|
-
var
|
|
1302
|
+
var Tt = (e) => {
|
|
1159
1303
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
1160
1304
|
if (!t)
|
|
1161
1305
|
return { success: true, data: [] };
|
|
@@ -1172,61 +1316,61 @@ var qt = (e) => {
|
|
|
1172
1316
|
]
|
|
1173
1317
|
};
|
|
1174
1318
|
const n = [], i = [];
|
|
1175
|
-
return t.forEach((
|
|
1319
|
+
return t.forEach((a, o) => {
|
|
1176
1320
|
const u = {
|
|
1177
1321
|
category: "dimensions",
|
|
1178
|
-
index:
|
|
1179
|
-
input:
|
|
1322
|
+
index: o,
|
|
1323
|
+
input: a
|
|
1180
1324
|
};
|
|
1181
1325
|
try {
|
|
1182
|
-
const
|
|
1183
|
-
if (
|
|
1184
|
-
i.push(
|
|
1326
|
+
const l = Ms(a, r, s, u);
|
|
1327
|
+
if (l.error) {
|
|
1328
|
+
i.push(l.error);
|
|
1185
1329
|
return;
|
|
1186
1330
|
}
|
|
1187
|
-
|
|
1188
|
-
} catch (
|
|
1189
|
-
const
|
|
1190
|
-
i.push(
|
|
1331
|
+
l.attribute && n.push(l.style !== undefined ? { attribute: l.attribute, style: l.style } : { attribute: l.attribute });
|
|
1332
|
+
} catch (l) {
|
|
1333
|
+
const p = l instanceof Error ? l.message : "Unknown error";
|
|
1334
|
+
i.push(A(y({}, u), { message: p }));
|
|
1191
1335
|
}
|
|
1192
1336
|
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
1193
1337
|
};
|
|
1194
|
-
function
|
|
1338
|
+
function $e(e, t) {
|
|
1195
1339
|
const r = Reflect.get(e, t);
|
|
1196
1340
|
if (typeof r != "function")
|
|
1197
1341
|
throw new Error(`Function '${t}' not found or is not a function`);
|
|
1198
1342
|
return r;
|
|
1199
1343
|
}
|
|
1200
|
-
function
|
|
1201
|
-
const r = e.replace("measureFactory.", ""), n =
|
|
1202
|
-
if (!
|
|
1344
|
+
function Ns(e, t) {
|
|
1345
|
+
const r = e.replace("measureFactory.", ""), n = $e(dp, r)(...t);
|
|
1346
|
+
if (!Te(n))
|
|
1203
1347
|
throw new Error(`Function '${e}' did not return a valid Measure`);
|
|
1204
1348
|
return n;
|
|
1205
1349
|
}
|
|
1206
|
-
function
|
|
1207
|
-
const r = e.replace("filterFactory.logic.", ""), n =
|
|
1350
|
+
function vs(e, t) {
|
|
1351
|
+
const r = e.replace("filterFactory.logic.", ""), n = $e(Se, r)(...t);
|
|
1208
1352
|
if (!Z(n))
|
|
1209
1353
|
throw new Error(`Function '${e}' did not return a valid FilterRelations`);
|
|
1210
1354
|
return n;
|
|
1211
1355
|
}
|
|
1212
|
-
function
|
|
1356
|
+
function Rs(e, t) {
|
|
1213
1357
|
if (e.startsWith("filterFactory.logic."))
|
|
1214
|
-
return
|
|
1215
|
-
const r = e.replace("filterFactory.", ""), n =
|
|
1216
|
-
if (!
|
|
1358
|
+
return vs(e, t);
|
|
1359
|
+
const r = e.replace("filterFactory.", ""), n = $e(Op, r)(...t);
|
|
1360
|
+
if (!ne(n) && !Z(n))
|
|
1217
1361
|
throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
|
|
1218
1362
|
return n;
|
|
1219
1363
|
}
|
|
1220
|
-
function
|
|
1364
|
+
function Is(e, t) {
|
|
1221
1365
|
const s = e.split(".")[0];
|
|
1222
1366
|
if (s === "measureFactory")
|
|
1223
|
-
return
|
|
1367
|
+
return Ns(e, t);
|
|
1224
1368
|
if (s === "filterFactory")
|
|
1225
|
-
return
|
|
1369
|
+
return Rs(e, t);
|
|
1226
1370
|
throw new Error(`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`);
|
|
1227
1371
|
}
|
|
1228
|
-
var f2 = (e, t, r, s) =>
|
|
1229
|
-
var
|
|
1372
|
+
var f2 = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s);
|
|
1373
|
+
var Ps = /* @__PURE__ */ new Set([
|
|
1230
1374
|
"CORREL",
|
|
1231
1375
|
"COVARP",
|
|
1232
1376
|
"COVAR",
|
|
@@ -1353,164 +1497,19 @@ var te = {
|
|
|
1353
1497
|
SQRT: f2("scalar", 1, 1),
|
|
1354
1498
|
TAN: f2("scalar", 1, 1)
|
|
1355
1499
|
};
|
|
1356
|
-
var
|
|
1357
|
-
function
|
|
1358
|
-
return
|
|
1500
|
+
var ks = Object.keys(te).filter((e) => te[e].category === "xdiff");
|
|
1501
|
+
function qt() {
|
|
1502
|
+
return ks;
|
|
1359
1503
|
}
|
|
1360
|
-
function
|
|
1504
|
+
function xt(e) {
|
|
1361
1505
|
const t = te[e.toUpperCase()];
|
|
1362
1506
|
return t == null ? undefined : t.requiredDateLevel;
|
|
1363
1507
|
}
|
|
1364
|
-
function
|
|
1508
|
+
function Bs(e, t) {
|
|
1365
1509
|
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
1510
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
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([
|
|
1511
|
+
var zs = /\[(\w[\w.-]*)\]/g;
|
|
1512
|
+
var $t = /* @__PURE__ */ new Set([
|
|
1514
1513
|
"AVG",
|
|
1515
1514
|
"COUNT",
|
|
1516
1515
|
"DUPCOUNT",
|
|
@@ -1528,28 +1527,28 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
1528
1527
|
"YTDAVG",
|
|
1529
1528
|
"YTDSUM"
|
|
1530
1529
|
]);
|
|
1531
|
-
var
|
|
1532
|
-
function
|
|
1533
|
-
return q3(e) ? true : typeof e == "string" && e.startsWith(
|
|
1530
|
+
var Ls = new RegExp(`\\b(${Array.from($t).join("|")})\\s*\\(`, "i");
|
|
1531
|
+
function St(e) {
|
|
1532
|
+
return q3(e) ? true : typeof e == "string" && e.startsWith(E4) ? false : S(e) && ("kind" in e) ? e.kind === "measure" : true;
|
|
1534
1533
|
}
|
|
1535
|
-
function
|
|
1534
|
+
function Us(e) {
|
|
1536
1535
|
const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set;
|
|
1537
1536
|
let s;
|
|
1538
1537
|
for (;(s = t.exec(e)) !== null; ) {
|
|
1539
1538
|
const n = s[1];
|
|
1540
|
-
|
|
1539
|
+
$t.has(n.toUpperCase()) || r.add(n);
|
|
1541
1540
|
}
|
|
1542
1541
|
return Array.from(r);
|
|
1543
1542
|
}
|
|
1544
|
-
function
|
|
1543
|
+
function _s2(e) {
|
|
1545
1544
|
return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
|
|
1546
1545
|
}
|
|
1547
|
-
function
|
|
1546
|
+
function Vs(e) {
|
|
1548
1547
|
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1549
1548
|
}
|
|
1550
1549
|
var j2 = (e) => e.startsWith("[") ? e : `[${e}]`;
|
|
1551
|
-
var
|
|
1552
|
-
function
|
|
1550
|
+
var Ot = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1551
|
+
function Dt(e, t) {
|
|
1553
1552
|
if (t.length === 0)
|
|
1554
1553
|
return [];
|
|
1555
1554
|
const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`, "gi");
|
|
@@ -1559,16 +1558,16 @@ function Rt(e, t) {
|
|
|
1559
1558
|
ref2: n[3].trim()
|
|
1560
1559
|
}));
|
|
1561
1560
|
}
|
|
1562
|
-
function
|
|
1563
|
-
var
|
|
1564
|
-
const s = Object.keys(t), n = ((
|
|
1561
|
+
function js(e, t, r) {
|
|
1562
|
+
var a, o, u;
|
|
1563
|
+
const s = Object.keys(t), n = ((a = r.errorPrefix) != null ? a : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
|
|
1565
1564
|
return {
|
|
1566
1565
|
formula: e,
|
|
1567
1566
|
context: t,
|
|
1568
1567
|
contextKeys: s,
|
|
1569
1568
|
canonicalContextKeys: new Set(s.map(j2)),
|
|
1570
1569
|
errorPrefix: i,
|
|
1571
|
-
warnUnusedContext: (
|
|
1570
|
+
warnUnusedContext: (o = r.warnUnusedContext) != null ? o : true,
|
|
1572
1571
|
errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : true,
|
|
1573
1572
|
schemaIndex: r.schemaIndex,
|
|
1574
1573
|
result: { isValid: true, errors: [], warnings: [], references: [], unusedContextKeys: [] }
|
|
@@ -1577,12 +1576,12 @@ function Hs(e, t, r) {
|
|
|
1577
1576
|
function M(e, t) {
|
|
1578
1577
|
e.result.errors.push(t), e.result.isValid = false;
|
|
1579
1578
|
}
|
|
1580
|
-
var
|
|
1581
|
-
function
|
|
1582
|
-
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !
|
|
1579
|
+
var Ws2 = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
|
|
1580
|
+
function Ks(e) {
|
|
1581
|
+
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !Ws2.has(s[1].toUpperCase()));
|
|
1583
1582
|
r && M(e, `${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`);
|
|
1584
1583
|
}
|
|
1585
|
-
function
|
|
1584
|
+
function Gs2(e, t) {
|
|
1586
1585
|
const r = e[t];
|
|
1587
1586
|
let s = t + 1;
|
|
1588
1587
|
for (;s < e.length; ) {
|
|
@@ -1599,27 +1598,27 @@ function Zs(e, t) {
|
|
|
1599
1598
|
}
|
|
1600
1599
|
return e.length;
|
|
1601
1600
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1601
|
+
function Ys(e) {
|
|
1602
|
+
return T(e, ",").filter((t) => t.trim().length > 0).length;
|
|
1604
1603
|
}
|
|
1605
|
-
function
|
|
1604
|
+
function Js(e, t, r, s) {
|
|
1606
1605
|
for (;t < e.length && /\s/.test(e[t]); )
|
|
1607
1606
|
t++;
|
|
1608
1607
|
if (e[t] !== "(")
|
|
1609
1608
|
return t;
|
|
1610
|
-
const n = t, i =
|
|
1609
|
+
const n = t, i = Y(e, n);
|
|
1611
1610
|
if (i === -1)
|
|
1612
1611
|
return n + 1;
|
|
1613
|
-
const
|
|
1614
|
-
return s.push({ name: r.toUpperCase(), argCount:
|
|
1612
|
+
const a = e.slice(n + 1, i);
|
|
1613
|
+
return s.push({ name: r.toUpperCase(), argCount: Ys(a) }), s.push(...Mt(a)), i + 1;
|
|
1615
1614
|
}
|
|
1616
|
-
function
|
|
1615
|
+
function Mt(e) {
|
|
1617
1616
|
const t = [];
|
|
1618
1617
|
let r = 0;
|
|
1619
1618
|
for (;r < e.length; ) {
|
|
1620
1619
|
const s = e[r];
|
|
1621
1620
|
if (s === "'" || s === '"') {
|
|
1622
|
-
r =
|
|
1621
|
+
r = Gs2(e, r);
|
|
1623
1622
|
continue;
|
|
1624
1623
|
}
|
|
1625
1624
|
if (/[A-Za-z_]/.test(s)) {
|
|
@@ -1627,203 +1626,203 @@ function vt(e) {
|
|
|
1627
1626
|
for (r++;r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
|
|
1628
1627
|
r++;
|
|
1629
1628
|
const i = e.slice(n, r);
|
|
1630
|
-
r =
|
|
1629
|
+
r = Js(e, r, i, t);
|
|
1631
1630
|
continue;
|
|
1632
1631
|
}
|
|
1633
1632
|
r++;
|
|
1634
1633
|
}
|
|
1635
1634
|
return t;
|
|
1636
1635
|
}
|
|
1637
|
-
function
|
|
1638
|
-
const t =
|
|
1636
|
+
function Hs(e) {
|
|
1637
|
+
const t = Mt(e.formula), r = /* @__PURE__ */ new Set, s = /* @__PURE__ */ new Set;
|
|
1639
1638
|
for (const { name: n, argCount: i } of t) {
|
|
1640
|
-
if (
|
|
1639
|
+
if (Ps.has(n)) {
|
|
1641
1640
|
r.has(n) || (r.add(n), M(e, `${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`));
|
|
1642
1641
|
continue;
|
|
1643
1642
|
}
|
|
1644
|
-
const
|
|
1645
|
-
if (
|
|
1643
|
+
const a = te[n];
|
|
1644
|
+
if (a && (i < a.minArgs || i > a.maxArgs) && !s.has(n)) {
|
|
1646
1645
|
s.add(n);
|
|
1647
|
-
const
|
|
1648
|
-
M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${
|
|
1646
|
+
const o = Bs(a.minArgs, a.maxArgs);
|
|
1647
|
+
M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${o}`);
|
|
1649
1648
|
}
|
|
1650
1649
|
}
|
|
1651
1650
|
}
|
|
1652
|
-
function
|
|
1651
|
+
function Qs(e) {
|
|
1653
1652
|
return [
|
|
1654
|
-
...new Set([...e.matchAll(new RegExp(
|
|
1653
|
+
...new Set([...e.matchAll(new RegExp(zs.source, "g"))].map((t) => t[1]))
|
|
1655
1654
|
];
|
|
1656
1655
|
}
|
|
1657
|
-
function
|
|
1656
|
+
function Xs(e) {
|
|
1658
1657
|
const t = e.result.references.filter((n) => !e.canonicalContextKeys.has(j2(n)));
|
|
1659
1658
|
if (t.length === 0)
|
|
1660
1659
|
return;
|
|
1661
|
-
const r = e.contextKeys.map((n) => `[${
|
|
1660
|
+
const r = e.contextKeys.map((n) => `[${Ot(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
|
|
1662
1661
|
M(e, `${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`);
|
|
1663
1662
|
}
|
|
1664
|
-
function
|
|
1665
|
-
if (
|
|
1663
|
+
function Zs(e) {
|
|
1664
|
+
if (Ls.test(e.formula))
|
|
1666
1665
|
return;
|
|
1667
1666
|
const t = e.result.references.filter((r) => {
|
|
1668
1667
|
var n;
|
|
1669
1668
|
const s = (n = e.context[j2(r)]) != null ? n : e.context[r];
|
|
1670
|
-
return s !== undefined && !
|
|
1669
|
+
return s !== undefined && !St(s);
|
|
1671
1670
|
});
|
|
1672
|
-
t.length !== 0 && M(e, `${e.errorPrefix}args[1]: ${
|
|
1671
|
+
t.length !== 0 && M(e, `${e.errorPrefix}args[1]: ${Vs(Us(e.formula))}Bracket reference(s) ${_s2(t)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`);
|
|
1673
1672
|
}
|
|
1674
|
-
function
|
|
1673
|
+
function en(e) {
|
|
1675
1674
|
if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0)
|
|
1676
1675
|
return;
|
|
1677
1676
|
const t = new Set(e.result.references.map(j2)), r = e.contextKeys.filter((i) => !t.has(j2(i)));
|
|
1678
1677
|
if (e.result.unusedContextKeys = r, r.length === 0)
|
|
1679
1678
|
return;
|
|
1680
|
-
const s = r.map((i) => `[${
|
|
1679
|
+
const s = r.map((i) => `[${Ot(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
|
|
1681
1680
|
e.errorOnUnusedContext ? M(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
|
|
1682
1681
|
}
|
|
1683
|
-
function
|
|
1684
|
-
var
|
|
1685
|
-
const n = (
|
|
1682
|
+
function je(e, t, r, s) {
|
|
1683
|
+
var a;
|
|
1684
|
+
const n = (a = s.context[j2(e)]) != null ? a : s.context[e];
|
|
1686
1685
|
if (n === undefined)
|
|
1687
1686
|
return;
|
|
1688
|
-
if (!(typeof n == "string" && n.startsWith(
|
|
1689
|
-
|
|
1687
|
+
if (!(typeof n == "string" && n.startsWith(E4))) {
|
|
1688
|
+
St(n) && M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E4}Table.Column.Level).`);
|
|
1690
1689
|
return;
|
|
1691
1690
|
}
|
|
1692
1691
|
if (s.schemaIndex)
|
|
1693
1692
|
try {
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
} catch (
|
|
1697
|
-
const u =
|
|
1693
|
+
const o = xe(n, s.schemaIndex);
|
|
1694
|
+
Lt(o.column.dataType) ? r && o.level && o.level !== r && M(s, `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${o.level}'.`) : M(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${o.column.name}'.`);
|
|
1695
|
+
} catch (o) {
|
|
1696
|
+
const u = o instanceof Error ? o.message : "Unknown error";
|
|
1698
1697
|
M(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
|
|
1699
1698
|
}
|
|
1700
1699
|
}
|
|
1701
|
-
function
|
|
1702
|
-
const t =
|
|
1700
|
+
function tn(e) {
|
|
1701
|
+
const t = qt(), r = Dt(e.formula, t);
|
|
1703
1702
|
for (const s of r) {
|
|
1704
|
-
const n =
|
|
1705
|
-
|
|
1703
|
+
const n = xt(s.functionName);
|
|
1704
|
+
je(s.ref1, s, n, e), je(s.ref2, s, n, e);
|
|
1706
1705
|
}
|
|
1707
1706
|
}
|
|
1708
|
-
function
|
|
1707
|
+
function rn(e, t, r = {}) {
|
|
1709
1708
|
var n;
|
|
1710
|
-
const s =
|
|
1711
|
-
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (
|
|
1709
|
+
const s = js(e, t, r);
|
|
1710
|
+
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Ks(s), Hs(s), s.result.references = Qs(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) : (Xs(s), Zs(s), en(s), tn(s), s.result));
|
|
1712
1711
|
}
|
|
1713
|
-
function
|
|
1714
|
-
const s =
|
|
1712
|
+
function sn(e, t, r = {}) {
|
|
1713
|
+
const s = rn(e, t, r);
|
|
1715
1714
|
if (!s.isValid)
|
|
1716
1715
|
throw new Error(s.errors.join("; "));
|
|
1717
1716
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1718
1717
|
}
|
|
1719
|
-
function
|
|
1718
|
+
function nn2(e, t) {
|
|
1720
1719
|
if (e.length < 3 || e.length > 5)
|
|
1721
1720
|
throw new Error(`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`);
|
|
1722
1721
|
const r = e[1];
|
|
1723
1722
|
if (typeof r != "string")
|
|
1724
1723
|
throw new Error(`${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`);
|
|
1725
1724
|
const s = r, n = e[2];
|
|
1726
|
-
if (!
|
|
1725
|
+
if (!S(n))
|
|
1727
1726
|
throw new Error(`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`);
|
|
1728
1727
|
const i = n;
|
|
1729
|
-
|
|
1728
|
+
sn(s, i, {
|
|
1730
1729
|
errorPrefix: `${t.pathPrefix}`,
|
|
1731
1730
|
errorOnUnusedContext: true,
|
|
1732
1731
|
allowEmptyFormula: false,
|
|
1733
1732
|
schemaIndex: t.schemaIndex
|
|
1734
1733
|
});
|
|
1735
|
-
const
|
|
1736
|
-
for (const [u,
|
|
1737
|
-
const
|
|
1738
|
-
if (q3(
|
|
1739
|
-
|
|
1740
|
-
data:
|
|
1734
|
+
const a = an(s), o = {};
|
|
1735
|
+
for (const [u, l] of Object.entries(i)) {
|
|
1736
|
+
const p = `args[2].${u}`;
|
|
1737
|
+
if (q3(l))
|
|
1738
|
+
o[`${u}`] = D2({
|
|
1739
|
+
data: l,
|
|
1741
1740
|
context: {
|
|
1742
1741
|
dataSource: t.dataSource,
|
|
1743
1742
|
schemaIndex: t.schemaIndex,
|
|
1744
|
-
pathPrefix:
|
|
1743
|
+
pathPrefix: p
|
|
1745
1744
|
}
|
|
1746
1745
|
});
|
|
1747
|
-
else if (typeof
|
|
1748
|
-
const
|
|
1746
|
+
else if (typeof l == "string" && l.startsWith(E4)) {
|
|
1747
|
+
const c = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = a[c];
|
|
1749
1748
|
try {
|
|
1750
|
-
|
|
1749
|
+
o[`${u}`] = H2(l, t.dataSource, t.schemaIndex, d !== undefined ? { inferredDateLevel: d } : undefined);
|
|
1751
1750
|
} catch (b2) {
|
|
1752
|
-
const
|
|
1753
|
-
throw new Error(`${
|
|
1751
|
+
const g3 = b2 instanceof Error ? b2.message : "Unknown error";
|
|
1752
|
+
throw new Error(`${p}: ${g3}`);
|
|
1754
1753
|
}
|
|
1755
|
-
} else if (
|
|
1756
|
-
|
|
1754
|
+
} else if (l && typeof l == "object" && "kind" in l)
|
|
1755
|
+
o[`${u}`] = l;
|
|
1757
1756
|
else
|
|
1758
|
-
throw new Error(`${
|
|
1757
|
+
throw new Error(`${p}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E4}...), but got: ${typeof l}`);
|
|
1759
1758
|
}
|
|
1760
|
-
e[2] =
|
|
1759
|
+
e[2] = o;
|
|
1761
1760
|
}
|
|
1762
|
-
function
|
|
1763
|
-
const t =
|
|
1761
|
+
function an(e) {
|
|
1762
|
+
const t = qt(), r = Dt(e, t), s = {};
|
|
1764
1763
|
for (const n of r) {
|
|
1765
|
-
const i =
|
|
1764
|
+
const i = xt(n.functionName);
|
|
1766
1765
|
if (i !== undefined)
|
|
1767
|
-
for (const
|
|
1768
|
-
const
|
|
1769
|
-
if (
|
|
1770
|
-
throw new Error(`Reference [${
|
|
1771
|
-
s[
|
|
1766
|
+
for (const a of [n.ref1, n.ref2]) {
|
|
1767
|
+
const o = s[a];
|
|
1768
|
+
if (o !== undefined && o !== i)
|
|
1769
|
+
throw new Error(`Reference [${a}] is used in xdiff functions with conflicting date levels ('${o}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`);
|
|
1770
|
+
s[a] = i;
|
|
1772
1771
|
}
|
|
1773
1772
|
}
|
|
1774
1773
|
return s;
|
|
1775
1774
|
}
|
|
1776
|
-
function
|
|
1775
|
+
function Nt(e) {
|
|
1777
1776
|
return e.type === E.TextAttribute;
|
|
1778
1777
|
}
|
|
1779
|
-
function
|
|
1778
|
+
function vt(e) {
|
|
1780
1779
|
return e.type === E.NumericAttribute;
|
|
1781
1780
|
}
|
|
1782
|
-
function
|
|
1781
|
+
function on(e) {
|
|
1783
1782
|
return e.type === E.DateLevel;
|
|
1784
1783
|
}
|
|
1785
|
-
function
|
|
1786
|
-
return
|
|
1784
|
+
function un(e) {
|
|
1785
|
+
return Nt(e) || vt(e);
|
|
1787
1786
|
}
|
|
1788
|
-
function
|
|
1787
|
+
function ie(e) {
|
|
1789
1788
|
return e.type === E.TextAttribute ? "text" : e.type === E.NumericAttribute ? "numeric" : e.type === E.DateLevel ? "date/datetime" : "unknown";
|
|
1790
1789
|
}
|
|
1791
|
-
function
|
|
1790
|
+
function Se2(e, t) {
|
|
1792
1791
|
const r = e[0];
|
|
1793
1792
|
if (!r || typeof r != "object" || !("type" in r))
|
|
1794
1793
|
throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1795
1794
|
return r;
|
|
1796
1795
|
}
|
|
1797
|
-
function
|
|
1798
|
-
const r =
|
|
1799
|
-
if (!
|
|
1800
|
-
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${
|
|
1796
|
+
function We(e, t) {
|
|
1797
|
+
const r = Se2(e, t);
|
|
1798
|
+
if (!un(r))
|
|
1799
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ie(r)} attribute`);
|
|
1801
1800
|
}
|
|
1802
1801
|
function P(e, t) {
|
|
1803
|
-
const r =
|
|
1804
|
-
if (!
|
|
1805
|
-
throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${
|
|
1802
|
+
const r = Se2(e, t);
|
|
1803
|
+
if (!vt(r))
|
|
1804
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ie(r)} attribute`);
|
|
1806
1805
|
}
|
|
1807
1806
|
function k(e, t) {
|
|
1808
|
-
const r =
|
|
1809
|
-
if (!
|
|
1810
|
-
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${
|
|
1807
|
+
const r = Se2(e, t);
|
|
1808
|
+
if (!Nt(r))
|
|
1809
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${ie(r)} attribute`);
|
|
1811
1810
|
}
|
|
1812
|
-
function
|
|
1811
|
+
function ln(e, t) {
|
|
1813
1812
|
const r = e[0];
|
|
1814
1813
|
if (!r || typeof r != "object" || !("attribute" in r))
|
|
1815
1814
|
throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1816
1815
|
return r;
|
|
1817
1816
|
}
|
|
1818
|
-
function
|
|
1819
|
-
const r =
|
|
1820
|
-
if (!
|
|
1817
|
+
function cn(e, t) {
|
|
1818
|
+
const r = ln(e, t);
|
|
1819
|
+
if (!pp(r))
|
|
1821
1820
|
throw new Error(`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`);
|
|
1822
1821
|
}
|
|
1823
|
-
var
|
|
1824
|
-
"measureFactory.customFormula":
|
|
1825
|
-
"filterFactory.equals":
|
|
1826
|
-
"filterFactory.doesntEqual":
|
|
1822
|
+
var fn = {
|
|
1823
|
+
"measureFactory.customFormula": nn2,
|
|
1824
|
+
"filterFactory.equals": We,
|
|
1825
|
+
"filterFactory.doesntEqual": We,
|
|
1827
1826
|
"filterFactory.greaterThan": P,
|
|
1828
1827
|
"filterFactory.greaterThanOrEqual": P,
|
|
1829
1828
|
"filterFactory.lessThan": P,
|
|
@@ -1838,12 +1837,12 @@ var hn = {
|
|
|
1838
1837
|
"filterFactory.endsWith": k,
|
|
1839
1838
|
"filterFactory.doesntEndWith": k,
|
|
1840
1839
|
"filterFactory.like": k,
|
|
1841
|
-
"filterFactory.exclude":
|
|
1840
|
+
"filterFactory.exclude": cn
|
|
1842
1841
|
};
|
|
1843
|
-
function
|
|
1844
|
-
return
|
|
1842
|
+
function dn(e) {
|
|
1843
|
+
return fn[`${e}`];
|
|
1845
1844
|
}
|
|
1846
|
-
var
|
|
1845
|
+
var Rt2 = {
|
|
1847
1846
|
"measureFactory.sum": [
|
|
1848
1847
|
{ type: "Attribute", required: true },
|
|
1849
1848
|
{ type: "string", required: false },
|
|
@@ -2262,18 +2261,18 @@ var kt = {
|
|
|
2262
2261
|
{ type: "FilterRelationsNode", required: true }
|
|
2263
2262
|
]
|
|
2264
2263
|
};
|
|
2265
|
-
function
|
|
2266
|
-
return
|
|
2264
|
+
function Oe2(e) {
|
|
2265
|
+
return Rt2[`${e}`];
|
|
2267
2266
|
}
|
|
2268
|
-
function
|
|
2269
|
-
const t =
|
|
2267
|
+
function mn(e) {
|
|
2268
|
+
const t = Oe2(e);
|
|
2270
2269
|
return t ? t.filter((r) => r.required).length : 0;
|
|
2271
2270
|
}
|
|
2272
|
-
function
|
|
2273
|
-
const t =
|
|
2271
|
+
function pn(e) {
|
|
2272
|
+
const t = Oe2(e);
|
|
2274
2273
|
return t ? t.length : 0;
|
|
2275
2274
|
}
|
|
2276
|
-
function
|
|
2275
|
+
function gn(e) {
|
|
2277
2276
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
2278
2277
|
return false;
|
|
2279
2278
|
const r = Date.parse(e);
|
|
@@ -2282,185 +2281,185 @@ function wn2(e) {
|
|
|
2282
2281
|
const s = new Date(e);
|
|
2283
2282
|
return !isNaN(s.getTime());
|
|
2284
2283
|
}
|
|
2285
|
-
function
|
|
2286
|
-
if (e.startsWith(
|
|
2284
|
+
function ce(e, t, r, s) {
|
|
2285
|
+
if (e.startsWith(E4))
|
|
2287
2286
|
try {
|
|
2288
|
-
return
|
|
2287
|
+
return H2(e, t, r);
|
|
2289
2288
|
} catch (n) {
|
|
2290
2289
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2291
2290
|
throw new Error(`${s}: ${i}`);
|
|
2292
2291
|
}
|
|
2293
|
-
throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${
|
|
2292
|
+
throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${E4}TableName.ColumnName[.Level]'`);
|
|
2294
2293
|
}
|
|
2295
|
-
function
|
|
2296
|
-
if (e.startsWith(
|
|
2294
|
+
function yn(e, t, r, s) {
|
|
2295
|
+
if (e.startsWith(E4))
|
|
2297
2296
|
try {
|
|
2298
|
-
return
|
|
2297
|
+
return Ss(e, t, r);
|
|
2299
2298
|
} catch (n) {
|
|
2300
2299
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2301
2300
|
throw new Error(`${s}: ${i}`);
|
|
2302
2301
|
}
|
|
2303
|
-
throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${
|
|
2302
|
+
throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${E4}TableName.ColumnName'`);
|
|
2304
2303
|
}
|
|
2305
|
-
function
|
|
2306
|
-
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context,
|
|
2304
|
+
function hn(e) {
|
|
2305
|
+
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, a = i;
|
|
2307
2306
|
if (t === undefined) {
|
|
2308
2307
|
if (r.required)
|
|
2309
|
-
throw new Error(`${
|
|
2308
|
+
throw new Error(`${a}: Required argument is missing (expected ${r.type})`);
|
|
2310
2309
|
return;
|
|
2311
2310
|
}
|
|
2312
2311
|
if (!(t === null && !r.required))
|
|
2313
2312
|
switch (r.type) {
|
|
2314
2313
|
case "string":
|
|
2315
2314
|
if (typeof t != "string")
|
|
2316
|
-
throw new Error(`${
|
|
2315
|
+
throw new Error(`${a}: Expected string, got ${typeof t}`);
|
|
2317
2316
|
return t;
|
|
2318
2317
|
case "number":
|
|
2319
2318
|
if (typeof t != "number")
|
|
2320
|
-
throw new Error(`${
|
|
2319
|
+
throw new Error(`${a}: Expected number, got ${typeof t}`);
|
|
2321
2320
|
return t;
|
|
2322
2321
|
case "boolean":
|
|
2323
2322
|
if (typeof t != "boolean")
|
|
2324
|
-
throw new Error(`${
|
|
2323
|
+
throw new Error(`${a}: Expected boolean, got ${typeof t}`);
|
|
2325
2324
|
return t;
|
|
2326
2325
|
case "string[]":
|
|
2327
2326
|
if (!Array.isArray(t))
|
|
2328
|
-
throw new Error(`${
|
|
2329
|
-
if (!t.every((
|
|
2330
|
-
throw new Error(`${
|
|
2327
|
+
throw new Error(`${a}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`);
|
|
2328
|
+
if (!t.every((o) => typeof o == "string"))
|
|
2329
|
+
throw new Error(`${a}: Expected array of strings, but contains non-string values`);
|
|
2331
2330
|
return t;
|
|
2332
2331
|
case "number[]":
|
|
2333
2332
|
if (!Array.isArray(t))
|
|
2334
|
-
throw new Error(`${
|
|
2335
|
-
if (!t.every((
|
|
2336
|
-
throw new Error(`${
|
|
2333
|
+
throw new Error(`${a}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`);
|
|
2334
|
+
if (!t.every((o) => typeof o == "number"))
|
|
2335
|
+
throw new Error(`${a}: Expected array of numbers, but contains non-number values`);
|
|
2337
2336
|
return t;
|
|
2338
2337
|
case "Attribute":
|
|
2339
2338
|
if (typeof t != "string")
|
|
2340
|
-
throw new Error(`${
|
|
2341
|
-
return
|
|
2339
|
+
throw new Error(`${a}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`);
|
|
2340
|
+
return ce(t, s, n, a);
|
|
2342
2341
|
case "Attribute[]":
|
|
2343
2342
|
if (!Array.isArray(t))
|
|
2344
|
-
throw new Error(`${
|
|
2345
|
-
return t.map((
|
|
2346
|
-
if (typeof
|
|
2347
|
-
throw new Error(`${
|
|
2348
|
-
return
|
|
2343
|
+
throw new Error(`${a}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`);
|
|
2344
|
+
return t.map((o, u) => {
|
|
2345
|
+
if (typeof o != "string")
|
|
2346
|
+
throw new Error(`${a}[${u}]: Expected attribute string, got ${typeof o}`);
|
|
2347
|
+
return ce(o, s, n, `${a}[${u}]`);
|
|
2349
2348
|
});
|
|
2350
2349
|
case "Measure":
|
|
2351
2350
|
case "BaseMeasure":
|
|
2352
2351
|
if (!q3(t))
|
|
2353
|
-
throw new Error(`${
|
|
2354
|
-
return
|
|
2352
|
+
throw new Error(`${a}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`);
|
|
2353
|
+
return D2({
|
|
2355
2354
|
data: t,
|
|
2356
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2355
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2357
2356
|
});
|
|
2358
2357
|
case "Measure[]":
|
|
2359
2358
|
if (!Array.isArray(t))
|
|
2360
|
-
throw new Error(`${
|
|
2361
|
-
return t.map((
|
|
2362
|
-
if (!q3(
|
|
2363
|
-
throw new Error(`${
|
|
2364
|
-
return
|
|
2365
|
-
data:
|
|
2366
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2359
|
+
throw new Error(`${a}: Expected array of measure function calls, got ${typeof t}`);
|
|
2360
|
+
return t.map((o, u) => {
|
|
2361
|
+
if (!q3(o))
|
|
2362
|
+
throw new Error(`${a}[${u}]: Expected measure function call, got ${typeof o}`);
|
|
2363
|
+
return D2({
|
|
2364
|
+
data: o,
|
|
2365
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
|
|
2367
2366
|
});
|
|
2368
2367
|
});
|
|
2369
2368
|
case "Filter":
|
|
2370
2369
|
if (!q3(t))
|
|
2371
|
-
throw new Error(`${
|
|
2372
|
-
return
|
|
2370
|
+
throw new Error(`${a}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`);
|
|
2371
|
+
return D2({
|
|
2373
2372
|
data: t,
|
|
2374
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2373
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2375
2374
|
});
|
|
2376
2375
|
case "Filter[]":
|
|
2377
2376
|
if (!Array.isArray(t))
|
|
2378
|
-
throw new Error(`${
|
|
2379
|
-
return t.map((
|
|
2380
|
-
if (!q3(
|
|
2381
|
-
throw new Error(`${
|
|
2382
|
-
return
|
|
2383
|
-
data:
|
|
2384
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2377
|
+
throw new Error(`${a}: Expected array of filter function calls, got ${typeof t}`);
|
|
2378
|
+
return t.map((o, u) => {
|
|
2379
|
+
if (!q3(o))
|
|
2380
|
+
throw new Error(`${a}[${u}]: Expected filter function call, got ${typeof o}`);
|
|
2381
|
+
return D2({
|
|
2382
|
+
data: o,
|
|
2383
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
|
|
2385
2384
|
});
|
|
2386
2385
|
});
|
|
2387
2386
|
case "FilterRelationsNode":
|
|
2388
2387
|
if (Array.isArray(t))
|
|
2389
|
-
return t.map((
|
|
2390
|
-
if (!q3(
|
|
2391
|
-
throw new Error(`${
|
|
2392
|
-
return
|
|
2393
|
-
data:
|
|
2394
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2388
|
+
return t.map((o, u) => {
|
|
2389
|
+
if (!q3(o))
|
|
2390
|
+
throw new Error(`${a}[${u}]: Expected filter function call, got ${typeof o}`);
|
|
2391
|
+
return D2({
|
|
2392
|
+
data: o,
|
|
2393
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
|
|
2395
2394
|
});
|
|
2396
2395
|
});
|
|
2397
2396
|
if (q3(t))
|
|
2398
|
-
return
|
|
2397
|
+
return D2({
|
|
2399
2398
|
data: t,
|
|
2400
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2399
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2401
2400
|
});
|
|
2402
|
-
throw new Error(`${
|
|
2401
|
+
throw new Error(`${a}: Expected filter function call or array of filters, got ${typeof t}`);
|
|
2403
2402
|
case "DateDimension":
|
|
2404
2403
|
if (typeof t != "string")
|
|
2405
|
-
throw new Error(`${
|
|
2406
|
-
return
|
|
2404
|
+
throw new Error(`${a}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`);
|
|
2405
|
+
return yn(t, s, n, a);
|
|
2407
2406
|
case "LevelAttribute": {
|
|
2408
2407
|
if (typeof t != "string")
|
|
2409
|
-
throw new Error(`${
|
|
2410
|
-
const
|
|
2411
|
-
if (!
|
|
2412
|
-
throw new Error(`${
|
|
2413
|
-
return
|
|
2408
|
+
throw new Error(`${a}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`);
|
|
2409
|
+
const o = ce(t, s, n, a);
|
|
2410
|
+
if (!on(o))
|
|
2411
|
+
throw new Error(`${a}: Attribute must be date/datetime type, got ${ie(o)} attribute`);
|
|
2412
|
+
return o;
|
|
2414
2413
|
}
|
|
2415
2414
|
case "Measure | number":
|
|
2416
2415
|
if (typeof t == "number")
|
|
2417
2416
|
return t;
|
|
2418
2417
|
if (q3(t))
|
|
2419
|
-
return
|
|
2418
|
+
return D2({
|
|
2420
2419
|
data: t,
|
|
2421
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2420
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2422
2421
|
});
|
|
2423
|
-
throw new Error(`${
|
|
2422
|
+
throw new Error(`${a}: Expected measure function call or number, got ${typeof t}`);
|
|
2424
2423
|
case "Date | string":
|
|
2425
2424
|
if (typeof t == "string") {
|
|
2426
|
-
if (
|
|
2425
|
+
if (gn(t))
|
|
2427
2426
|
return t;
|
|
2428
|
-
throw new Error(`${
|
|
2427
|
+
throw new Error(`${a}: Expected valid ISO date string or Date object, got invalid date string '${t}'`);
|
|
2429
2428
|
} else {
|
|
2430
2429
|
if (t instanceof Date)
|
|
2431
2430
|
return t;
|
|
2432
|
-
throw new Error(`${
|
|
2431
|
+
throw new Error(`${a}: Expected date string or Date object, got ${typeof t}`);
|
|
2433
2432
|
}
|
|
2434
2433
|
case "string | number":
|
|
2435
2434
|
if (typeof t == "string" || typeof t == "number")
|
|
2436
2435
|
return t;
|
|
2437
|
-
throw new Error(`${
|
|
2436
|
+
throw new Error(`${a}: Expected string or number, got ${typeof t}`);
|
|
2438
2437
|
case "BaseFilterConfig":
|
|
2439
2438
|
case "MembersFilterConfig":
|
|
2440
2439
|
case "CustomFormulaContext":
|
|
2441
2440
|
case "any":
|
|
2442
2441
|
if (t == null && r.required)
|
|
2443
|
-
throw new Error(`${
|
|
2442
|
+
throw new Error(`${a}: Required argument is null/undefined`);
|
|
2444
2443
|
return t;
|
|
2445
2444
|
default:
|
|
2446
2445
|
return t;
|
|
2447
2446
|
}
|
|
2448
2447
|
}
|
|
2449
|
-
function
|
|
2450
|
-
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args:
|
|
2448
|
+
function D2(e) {
|
|
2449
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: a } = t, o = n ? `${n}.` : "", u = Oe2(i);
|
|
2451
2450
|
if (!u) {
|
|
2452
|
-
const
|
|
2453
|
-
throw new Error(`${
|
|
2454
|
-
}
|
|
2455
|
-
const
|
|
2456
|
-
if (
|
|
2457
|
-
throw new Error(`${
|
|
2458
|
-
if (
|
|
2459
|
-
throw new Error(`${
|
|
2460
|
-
const
|
|
2461
|
-
for (let
|
|
2462
|
-
const m2 = u[`${
|
|
2463
|
-
if (
|
|
2451
|
+
const g3 = Object.keys(Rt2), m2 = v(i, g3, (C2) => C2), F = m2 && m2.distance <= x ? ` Did you mean '${m2.best}'?` : "";
|
|
2452
|
+
throw new Error(`${o}function: Unknown function '${i}'.${F}`);
|
|
2453
|
+
}
|
|
2454
|
+
const l = mn(i), p = pn(i);
|
|
2455
|
+
if (a.length < l)
|
|
2456
|
+
throw new Error(`${o}function: Expected at least ${l} arguments, got ${a.length}`);
|
|
2457
|
+
if (a.length > p)
|
|
2458
|
+
throw new Error(`${o}function: Expected at most ${p} arguments, got ${a.length}`);
|
|
2459
|
+
const c = [], d = [];
|
|
2460
|
+
for (let g3 = 0;g3 < Math.max(a.length, u.length); g3++) {
|
|
2461
|
+
const m2 = u[`${g3}`], F = a[`${g3}`], C2 = o ? `${o}args[${g3}]` : `args[${g3}]`;
|
|
2462
|
+
if (F === undefined) {
|
|
2464
2463
|
m2 != null && m2.required && d.push(`${C2}: Missing required argument (expected ${m2.type})`);
|
|
2465
2464
|
continue;
|
|
2466
2465
|
}
|
|
@@ -2469,8 +2468,8 @@ function D(e) {
|
|
|
2469
2468
|
continue;
|
|
2470
2469
|
}
|
|
2471
2470
|
try {
|
|
2472
|
-
const
|
|
2473
|
-
data:
|
|
2471
|
+
const N3 = hn({
|
|
2472
|
+
data: F,
|
|
2474
2473
|
context: {
|
|
2475
2474
|
dataSource: r,
|
|
2476
2475
|
schemaIndex: s,
|
|
@@ -2478,67 +2477,67 @@ function D(e) {
|
|
|
2478
2477
|
argSchema: m2
|
|
2479
2478
|
}
|
|
2480
2479
|
});
|
|
2481
|
-
|
|
2482
|
-
} catch (
|
|
2483
|
-
const
|
|
2484
|
-
d.push(
|
|
2480
|
+
c.push(N3);
|
|
2481
|
+
} catch (N3) {
|
|
2482
|
+
const ae = N3 instanceof Error ? N3.message : "Unknown error";
|
|
2483
|
+
d.push(ae);
|
|
2485
2484
|
}
|
|
2486
2485
|
}
|
|
2487
2486
|
if (d.length > 0) {
|
|
2488
|
-
const
|
|
2489
|
-
throw new Error(
|
|
2487
|
+
const g3 = d.join("; ");
|
|
2488
|
+
throw new Error(g3);
|
|
2490
2489
|
}
|
|
2491
|
-
const b2 =
|
|
2490
|
+
const b2 = dn(i);
|
|
2492
2491
|
if (b2)
|
|
2493
2492
|
try {
|
|
2494
|
-
b2(
|
|
2493
|
+
b2(c, {
|
|
2495
2494
|
dataSource: r,
|
|
2496
2495
|
schemaIndex: s,
|
|
2497
|
-
pathPrefix:
|
|
2496
|
+
pathPrefix: o
|
|
2498
2497
|
});
|
|
2499
|
-
} catch (
|
|
2500
|
-
const m2 =
|
|
2498
|
+
} catch (g3) {
|
|
2499
|
+
const m2 = g3 instanceof Error ? g3.message : "Unknown validation error";
|
|
2501
2500
|
throw new Error(m2);
|
|
2502
2501
|
}
|
|
2503
|
-
return
|
|
2502
|
+
return Is(i, c);
|
|
2504
2503
|
}
|
|
2505
|
-
function
|
|
2504
|
+
function It(e) {
|
|
2506
2505
|
const { attribute: t, config: r } = e;
|
|
2507
|
-
if (
|
|
2508
|
-
const { granularity: s } = t, n = e.members.map((
|
|
2509
|
-
return
|
|
2506
|
+
if (pp(e) && Fp(t)) {
|
|
2507
|
+
const { granularity: s } = t, n = e.members.map((o) => s === "Years" && !isNaN(Number(o)) ? `${o}-01-01T00:00:00` : o), i = ki(r), a = Object.keys(i).length === 0 ? undefined : i;
|
|
2508
|
+
return Rt(t, n, a);
|
|
2510
2509
|
}
|
|
2511
2510
|
return e;
|
|
2512
2511
|
}
|
|
2513
|
-
function
|
|
2512
|
+
function bn(e) {
|
|
2514
2513
|
let t = [];
|
|
2515
2514
|
for (const r of e)
|
|
2516
|
-
Z(r) ? t =
|
|
2515
|
+
Z(r) ? t = Up(r, t) : t = Up([It(r)], t);
|
|
2517
2516
|
return t != null ? t : [];
|
|
2518
2517
|
}
|
|
2519
|
-
var
|
|
2518
|
+
var Fn2 = (e) => {
|
|
2520
2519
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2521
|
-
return t.forEach((
|
|
2520
|
+
return t.forEach((a, o) => {
|
|
2522
2521
|
const u = {
|
|
2523
2522
|
category: "filters",
|
|
2524
|
-
index:
|
|
2525
|
-
input:
|
|
2523
|
+
index: o,
|
|
2524
|
+
input: a
|
|
2526
2525
|
};
|
|
2527
2526
|
try {
|
|
2528
|
-
const
|
|
2529
|
-
data:
|
|
2527
|
+
const l = D2({
|
|
2528
|
+
data: a,
|
|
2530
2529
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2531
2530
|
});
|
|
2532
|
-
!Z(
|
|
2533
|
-
} catch (
|
|
2534
|
-
const
|
|
2535
|
-
i.push(
|
|
2531
|
+
!Z(l) && !ne(l) ? i.push(A(y({}, u), { message: "Invalid filter JSON" })) : n.push(l);
|
|
2532
|
+
} catch (l) {
|
|
2533
|
+
const p = l instanceof Error ? l.message : "Unknown error";
|
|
2534
|
+
i.push(A(y({}, u), { message: p }));
|
|
2536
2535
|
}
|
|
2537
|
-
}), i.length > 0 ? { success: false, errors: i } : { success: true, data:
|
|
2536
|
+
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: bn(n) };
|
|
2538
2537
|
};
|
|
2539
|
-
var
|
|
2538
|
+
var De = (e) => {
|
|
2540
2539
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2541
|
-
return t ?
|
|
2540
|
+
return t ? Et(t) ? Fn2({
|
|
2542
2541
|
data: t,
|
|
2543
2542
|
context: { dataSource: r, schemaIndex: s }
|
|
2544
2543
|
}) : {
|
|
@@ -2553,29 +2552,29 @@ var Re = (e) => {
|
|
|
2553
2552
|
]
|
|
2554
2553
|
} : { success: true, data: [] };
|
|
2555
2554
|
};
|
|
2556
|
-
var
|
|
2555
|
+
var An = (e) => {
|
|
2557
2556
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2558
|
-
return t.forEach((
|
|
2557
|
+
return t.forEach((a, o) => {
|
|
2559
2558
|
const u = {
|
|
2560
2559
|
category: "highlights",
|
|
2561
|
-
index:
|
|
2562
|
-
input:
|
|
2560
|
+
index: o,
|
|
2561
|
+
input: a
|
|
2563
2562
|
};
|
|
2564
2563
|
try {
|
|
2565
|
-
const
|
|
2566
|
-
data:
|
|
2564
|
+
const l = D2({
|
|
2565
|
+
data: a,
|
|
2567
2566
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2568
2567
|
});
|
|
2569
|
-
|
|
2570
|
-
} catch (
|
|
2571
|
-
const
|
|
2572
|
-
i.push(
|
|
2568
|
+
ne(l) ? n.push(It(l)) : i.push(A(y({}, u), { message: "Invalid filter JSON" }));
|
|
2569
|
+
} catch (l) {
|
|
2570
|
+
const p = l instanceof Error ? l.message : "Unknown error";
|
|
2571
|
+
i.push(A(y({}, u), { message: p }));
|
|
2573
2572
|
}
|
|
2574
2573
|
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
2575
2574
|
};
|
|
2576
|
-
var
|
|
2575
|
+
var Me = (e) => {
|
|
2577
2576
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2578
|
-
return t ?
|
|
2577
|
+
return t ? Et(t) ? An({
|
|
2579
2578
|
data: t,
|
|
2580
2579
|
context: { dataSource: r, schemaIndex: s }
|
|
2581
2580
|
}) : {
|
|
@@ -2590,63 +2589,63 @@ var ve = (e) => {
|
|
|
2590
2589
|
]
|
|
2591
2590
|
} : { success: true, data: [] };
|
|
2592
2591
|
};
|
|
2593
|
-
var
|
|
2594
|
-
if (e && !
|
|
2595
|
-
return
|
|
2592
|
+
var wn = (e, t) => {
|
|
2593
|
+
if (e && !ws(e))
|
|
2594
|
+
return A(y({}, t), {
|
|
2596
2595
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
|
|
2597
2596
|
});
|
|
2598
2597
|
};
|
|
2599
|
-
var
|
|
2598
|
+
var En2 = (e, t, r) => {
|
|
2600
2599
|
const { dataSource: s, schemaIndex: n } = t;
|
|
2601
2600
|
try {
|
|
2602
|
-
const i =
|
|
2601
|
+
const i = D2({
|
|
2603
2602
|
data: e,
|
|
2604
2603
|
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2605
2604
|
});
|
|
2606
|
-
return
|
|
2605
|
+
return Te(i) ? { success: true, data: i } : {
|
|
2607
2606
|
success: false,
|
|
2608
|
-
errors: [
|
|
2607
|
+
errors: [A(y({}, r), { message: "Invalid measure JSON" })]
|
|
2609
2608
|
};
|
|
2610
2609
|
} catch (i) {
|
|
2611
|
-
const
|
|
2610
|
+
const a = i instanceof Error ? i.message : "Unknown error";
|
|
2612
2611
|
return {
|
|
2613
2612
|
success: false,
|
|
2614
|
-
errors: [
|
|
2613
|
+
errors: [A(y({}, r), { message: a })]
|
|
2615
2614
|
};
|
|
2616
2615
|
}
|
|
2617
2616
|
};
|
|
2618
|
-
var
|
|
2619
|
-
const n =
|
|
2617
|
+
var Cn = (e, t, r, s) => {
|
|
2618
|
+
const n = D2({
|
|
2620
2619
|
data: e.column,
|
|
2621
2620
|
context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
|
|
2622
2621
|
});
|
|
2623
|
-
if (!
|
|
2622
|
+
if (!Te(n))
|
|
2624
2623
|
return {
|
|
2625
2624
|
style: {},
|
|
2626
|
-
error:
|
|
2625
|
+
error: A(y({}, s), { message: "Invalid measure JSON" })
|
|
2627
2626
|
};
|
|
2628
|
-
const i =
|
|
2627
|
+
const i = wn(e.sortType, s);
|
|
2629
2628
|
if (i) {
|
|
2630
|
-
const
|
|
2631
|
-
return { measure: n, style:
|
|
2629
|
+
const o = od(e, "column");
|
|
2630
|
+
return { measure: n, style: o, error: i };
|
|
2632
2631
|
}
|
|
2633
|
-
const
|
|
2634
|
-
return { measure: n, style:
|
|
2632
|
+
const a = od(e, "column");
|
|
2633
|
+
return { measure: n, style: a };
|
|
2635
2634
|
};
|
|
2636
|
-
var
|
|
2637
|
-
if (
|
|
2638
|
-
return
|
|
2635
|
+
var Tn = (e, t, r, s) => {
|
|
2636
|
+
if (xs2(e))
|
|
2637
|
+
return Cn(e, t, r, s);
|
|
2639
2638
|
if (q3(e)) {
|
|
2640
|
-
const n =
|
|
2639
|
+
const n = En2(e, { dataSource: t, schemaIndex: r }, s);
|
|
2641
2640
|
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2642
2641
|
}
|
|
2643
2642
|
return {
|
|
2644
|
-
error:
|
|
2643
|
+
error: A(y({}, s), {
|
|
2645
2644
|
message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
|
|
2646
2645
|
})
|
|
2647
2646
|
};
|
|
2648
2647
|
};
|
|
2649
|
-
var
|
|
2648
|
+
var Pt = (e) => {
|
|
2650
2649
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2651
2650
|
if (!t)
|
|
2652
2651
|
return { success: true, data: [] };
|
|
@@ -2663,27 +2662,27 @@ var zt = (e) => {
|
|
|
2663
2662
|
]
|
|
2664
2663
|
};
|
|
2665
2664
|
const n = [], i = [];
|
|
2666
|
-
return t.forEach((
|
|
2665
|
+
return t.forEach((a, o) => {
|
|
2667
2666
|
const u = {
|
|
2668
2667
|
category: "measures",
|
|
2669
|
-
index:
|
|
2670
|
-
input:
|
|
2668
|
+
index: o,
|
|
2669
|
+
input: a
|
|
2671
2670
|
};
|
|
2672
2671
|
try {
|
|
2673
|
-
const
|
|
2674
|
-
if (
|
|
2675
|
-
i.push(
|
|
2672
|
+
const l = Tn(a, r, s, u);
|
|
2673
|
+
if (l.error) {
|
|
2674
|
+
i.push(l.error);
|
|
2676
2675
|
return;
|
|
2677
2676
|
}
|
|
2678
|
-
|
|
2679
|
-
} catch (
|
|
2680
|
-
const
|
|
2681
|
-
i.push(
|
|
2677
|
+
l.measure && n.push(l.style !== undefined ? { measure: l.measure, style: l.style } : { measure: l.measure });
|
|
2678
|
+
} catch (l) {
|
|
2679
|
+
const p = l instanceof Error ? l.message : "Unknown error";
|
|
2680
|
+
i.push(A(y({}, u), { message: p }));
|
|
2682
2681
|
}
|
|
2683
2682
|
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
2684
2683
|
};
|
|
2685
|
-
function
|
|
2686
|
-
return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(
|
|
2684
|
+
function Q2(e) {
|
|
2685
|
+
return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(Q2) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([t, r]) => [t, Q2(r)])) : e;
|
|
2687
2686
|
}
|
|
2688
2687
|
function w(e, t, r) {
|
|
2689
2688
|
const s = e();
|
|
@@ -2693,47 +2692,19 @@ function w(e, t, r) {
|
|
|
2693
2692
|
}
|
|
2694
2693
|
return s.data;
|
|
2695
2694
|
}
|
|
2696
|
-
var
|
|
2697
|
-
|
|
2698
|
-
function Mn(e) {
|
|
2699
|
-
return e.map(({ attribute: t, style: r }) => {
|
|
2700
|
-
const s = r == null ? undefined : r.sortType;
|
|
2701
|
-
if (!s)
|
|
2702
|
-
return t;
|
|
2703
|
-
const n = typeof s == "object" ? s.direction : s;
|
|
2704
|
-
return Lp(n) ? t.sort(Ap(n)) : t;
|
|
2705
|
-
});
|
|
2706
|
-
}
|
|
2707
|
-
function Nn(e) {
|
|
2708
|
-
var t, r;
|
|
2709
|
-
return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false;
|
|
2710
|
-
}
|
|
2711
|
-
function Rn2(e) {
|
|
2712
|
-
var t, r;
|
|
2713
|
-
return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false;
|
|
2714
|
-
}
|
|
2715
|
-
function vn2(e) {
|
|
2716
|
-
var r, s;
|
|
2717
|
-
const t = [];
|
|
2718
|
-
for (const { measure: n, style: i } of e) {
|
|
2719
|
-
const o = i == null ? undefined : i.sortType, a = o && Lp(o) ? n.sort(Ap(o)) : n;
|
|
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));
|
|
2721
|
-
}
|
|
2722
|
-
return t;
|
|
2723
|
-
}
|
|
2724
|
-
var ii = (e) => {
|
|
2725
|
-
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = $e(s), i = [], o = w(() => qt({
|
|
2695
|
+
var Jn = (e) => {
|
|
2696
|
+
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = qe(s), i = [], a = w(() => Tt({
|
|
2726
2697
|
data: t.dimensions || [],
|
|
2727
2698
|
context: { dataSource: r, schemaIndex: n }
|
|
2728
|
-
}), i),
|
|
2699
|
+
}), i), o = w(() => Pt({
|
|
2729
2700
|
data: t.measures || [],
|
|
2730
2701
|
context: { dataSource: r, schemaIndex: n }
|
|
2731
|
-
}), i), u = w(() =>
|
|
2702
|
+
}), i), u = w(() => De({
|
|
2732
2703
|
data: t.filters || [],
|
|
2733
2704
|
context: { dataSource: r, schemaIndex: n }
|
|
2734
2705
|
}), i);
|
|
2735
|
-
let
|
|
2736
|
-
return t.highlights && (
|
|
2706
|
+
let l = null;
|
|
2707
|
+
return t.highlights && (l = w(() => Me({
|
|
2737
2708
|
data: t.highlights || [],
|
|
2738
2709
|
context: { dataSource: r, schemaIndex: n }
|
|
2739
2710
|
}), i)), i.length > 0 ? {
|
|
@@ -2741,56 +2712,56 @@ var ii = (e) => {
|
|
|
2741
2712
|
errors: i
|
|
2742
2713
|
} : {
|
|
2743
2714
|
success: true,
|
|
2744
|
-
data:
|
|
2745
|
-
dataSource:
|
|
2746
|
-
dimensions:
|
|
2747
|
-
measures:
|
|
2715
|
+
data: y({
|
|
2716
|
+
dataSource: Np(r),
|
|
2717
|
+
dimensions: a ? gm(a) : [],
|
|
2718
|
+
measures: o ? hm(o) : [],
|
|
2748
2719
|
filters: u || []
|
|
2749
|
-
},
|
|
2720
|
+
}, l && { highlights: l })
|
|
2750
2721
|
};
|
|
2751
2722
|
};
|
|
2752
|
-
function
|
|
2723
|
+
function Ke2(e) {
|
|
2753
2724
|
return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
|
|
2754
2725
|
}
|
|
2755
|
-
function
|
|
2726
|
+
function Ne(e) {
|
|
2756
2727
|
const t = [], r = [];
|
|
2757
2728
|
return e.forEach((s, n) => {
|
|
2758
|
-
var
|
|
2759
|
-
const i =
|
|
2729
|
+
var c, d, b2;
|
|
2730
|
+
const i = Ke2(s) ? s.column : s, a = Ke2(s) ? s : undefined, o = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2760
2731
|
if (!i.composeCode) {
|
|
2761
2732
|
r.push({
|
|
2762
2733
|
category: "dimensions",
|
|
2763
2734
|
index: n,
|
|
2764
|
-
input:
|
|
2735
|
+
input: o(),
|
|
2765
2736
|
message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2766
2737
|
});
|
|
2767
2738
|
return;
|
|
2768
2739
|
}
|
|
2769
|
-
if (!i.composeCode.startsWith(
|
|
2740
|
+
if (!i.composeCode.startsWith(E4)) {
|
|
2770
2741
|
r.push({
|
|
2771
2742
|
category: "dimensions",
|
|
2772
2743
|
index: n,
|
|
2773
|
-
input:
|
|
2774
|
-
message: `Expected composeCode to start with '${
|
|
2744
|
+
input: o(),
|
|
2745
|
+
message: `Expected composeCode to start with '${E4}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
|
|
2775
2746
|
});
|
|
2776
2747
|
return;
|
|
2777
2748
|
}
|
|
2778
|
-
const u = (b2 =
|
|
2779
|
-
if (u !== undefined && u !==
|
|
2780
|
-
const
|
|
2749
|
+
const u = (b2 = a != null && a.sortType ? _s(a.sortType) : undefined) != null ? b2 : ((c = i.getSort) == null ? undefined : c.call(i)) !== undefined && ((d = i.getSort) == null ? undefined : d.call(i)) !== N.None ? i.getSort() : undefined, l = a ? od(a, "column") : {};
|
|
2750
|
+
if (u !== undefined && u !== N.None || a && Object.keys(l).length > 0) {
|
|
2751
|
+
const g3 = y(y({
|
|
2781
2752
|
column: i.composeCode
|
|
2782
|
-
}, u !== undefined && u !==
|
|
2783
|
-
t.push(
|
|
2753
|
+
}, u !== undefined && u !== N.None && { sortType: Rp(u) }), l);
|
|
2754
|
+
t.push(g3);
|
|
2784
2755
|
} else
|
|
2785
2756
|
t.push(i.composeCode);
|
|
2786
2757
|
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2787
2758
|
}
|
|
2788
|
-
var
|
|
2789
|
-
function
|
|
2759
|
+
var ye2 = "Unknown error";
|
|
2760
|
+
function ve(e) {
|
|
2790
2761
|
if (!e)
|
|
2791
2762
|
return { success: true, data: [] };
|
|
2792
2763
|
const t = [];
|
|
2793
|
-
if (
|
|
2764
|
+
if (nn(e)) {
|
|
2794
2765
|
if (!e.composeCode)
|
|
2795
2766
|
return {
|
|
2796
2767
|
success: false,
|
|
@@ -2804,9 +2775,9 @@ function Be(e) {
|
|
|
2804
2775
|
]
|
|
2805
2776
|
};
|
|
2806
2777
|
try {
|
|
2807
|
-
return { success: true, data: [
|
|
2778
|
+
return { success: true, data: [q(e.composeCode)] };
|
|
2808
2779
|
} catch (s) {
|
|
2809
|
-
const n = s instanceof Error ? s.message :
|
|
2780
|
+
const n = s instanceof Error ? s.message : ye2;
|
|
2810
2781
|
return {
|
|
2811
2782
|
success: false,
|
|
2812
2783
|
errors: [
|
|
@@ -2833,20 +2804,20 @@ function Be(e) {
|
|
|
2833
2804
|
return;
|
|
2834
2805
|
}
|
|
2835
2806
|
try {
|
|
2836
|
-
const
|
|
2837
|
-
r.push(
|
|
2838
|
-
} catch (
|
|
2839
|
-
const
|
|
2807
|
+
const a = q(s.composeCode);
|
|
2808
|
+
r.push(a);
|
|
2809
|
+
} catch (a) {
|
|
2810
|
+
const o = a instanceof Error ? a.message : ye2;
|
|
2840
2811
|
t.push({
|
|
2841
2812
|
category: "filters",
|
|
2842
2813
|
index: n,
|
|
2843
2814
|
input: s,
|
|
2844
|
-
message: `Failed to parse composeCode for filter at index ${n}: ${
|
|
2815
|
+
message: `Failed to parse composeCode for filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
|
|
2845
2816
|
});
|
|
2846
2817
|
}
|
|
2847
2818
|
}), t.length > 0 ? { success: false, errors: t } : { success: true, data: r };
|
|
2848
2819
|
}
|
|
2849
|
-
function
|
|
2820
|
+
function Re(e) {
|
|
2850
2821
|
if (!e)
|
|
2851
2822
|
return { success: true, data: [] };
|
|
2852
2823
|
const t = [], r = [];
|
|
@@ -2862,135 +2833,120 @@ function ze(e) {
|
|
|
2862
2833
|
return;
|
|
2863
2834
|
}
|
|
2864
2835
|
try {
|
|
2865
|
-
const
|
|
2866
|
-
t.push(
|
|
2867
|
-
} catch (
|
|
2868
|
-
const
|
|
2836
|
+
const a = q(s.composeCode);
|
|
2837
|
+
t.push(a);
|
|
2838
|
+
} catch (a) {
|
|
2839
|
+
const o = a instanceof Error ? a.message : ye2;
|
|
2869
2840
|
r.push({
|
|
2870
2841
|
category: "highlights",
|
|
2871
2842
|
index: n,
|
|
2872
2843
|
input: s,
|
|
2873
|
-
message: `Failed to parse composeCode for highlight filter at index ${n}: ${
|
|
2844
|
+
message: `Failed to parse composeCode for highlight filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
|
|
2874
2845
|
});
|
|
2875
2846
|
}
|
|
2876
2847
|
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2877
2848
|
}
|
|
2878
|
-
function
|
|
2849
|
+
function Ge(e) {
|
|
2879
2850
|
return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
|
|
2880
2851
|
}
|
|
2881
|
-
function
|
|
2852
|
+
function Ie(e) {
|
|
2882
2853
|
const t = [], r = [];
|
|
2883
2854
|
return e.forEach((s, n) => {
|
|
2884
|
-
var u,
|
|
2885
|
-
const i =
|
|
2855
|
+
var u, l, p;
|
|
2856
|
+
const i = Ge(s) ? s.column : s, a = Ge(s) ? s : undefined, o = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2886
2857
|
if (!i.composeCode) {
|
|
2887
2858
|
r.push({
|
|
2888
2859
|
category: "measures",
|
|
2889
2860
|
index: n,
|
|
2890
|
-
input:
|
|
2861
|
+
input: o(),
|
|
2891
2862
|
message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2892
2863
|
});
|
|
2893
2864
|
return;
|
|
2894
2865
|
}
|
|
2895
2866
|
try {
|
|
2896
|
-
const
|
|
2897
|
-
if (d !== undefined && d !==
|
|
2898
|
-
const
|
|
2899
|
-
column:
|
|
2900
|
-
}, d !== undefined && d !==
|
|
2867
|
+
const c = q(i.composeCode), d = (p = a != null && a.sortType ? _s(a.sortType) : undefined) != null ? p : ((u = i.getSort) == null ? undefined : u.call(i)) !== undefined && ((l = i.getSort) == null ? undefined : l.call(i)) !== N.None ? i.getSort() : undefined;
|
|
2868
|
+
if (d !== undefined && d !== N.None || a && Object.keys(od(a, "column")).length > 0) {
|
|
2869
|
+
const g3 = a ? od(a, "column") : {}, m2 = y(y({
|
|
2870
|
+
column: c
|
|
2871
|
+
}, d !== undefined && d !== N.None && { sortType: Rp(d) }), g3);
|
|
2901
2872
|
t.push(m2);
|
|
2902
2873
|
} else
|
|
2903
|
-
t.push(
|
|
2904
|
-
} catch (
|
|
2905
|
-
const d =
|
|
2874
|
+
t.push(c);
|
|
2875
|
+
} catch (c) {
|
|
2876
|
+
const d = c instanceof Error ? c.message : "Unknown error";
|
|
2906
2877
|
r.push({
|
|
2907
2878
|
category: "measures",
|
|
2908
2879
|
index: n,
|
|
2909
|
-
input:
|
|
2880
|
+
input: o(),
|
|
2910
2881
|
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${d}. ComposeCode: '${i.composeCode}'`
|
|
2911
2882
|
});
|
|
2912
2883
|
}
|
|
2913
2884
|
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2914
2885
|
}
|
|
2915
|
-
function
|
|
2886
|
+
function Ye(e) {
|
|
2916
2887
|
var t, r, s, n;
|
|
2917
|
-
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(
|
|
2888
|
+
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Ws)) != null ? n : false);
|
|
2918
2889
|
}
|
|
2919
|
-
function
|
|
2890
|
+
function Je(e) {
|
|
2920
2891
|
var t, r, s, n;
|
|
2921
|
-
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(
|
|
2892
|
+
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Gs)) != null ? n : false);
|
|
2922
2893
|
}
|
|
2923
|
-
function
|
|
2894
|
+
function He(e) {
|
|
2924
2895
|
try {
|
|
2925
|
-
const t =
|
|
2896
|
+
const t = q(e.trim());
|
|
2926
2897
|
return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : undefined;
|
|
2927
2898
|
} catch (t) {
|
|
2928
2899
|
return;
|
|
2929
2900
|
}
|
|
2930
2901
|
}
|
|
2931
|
-
function
|
|
2902
|
+
function qn(e) {
|
|
2932
2903
|
var s, n, i;
|
|
2933
2904
|
if (!(e != null && e.length))
|
|
2934
2905
|
return [];
|
|
2935
2906
|
const t = /* @__PURE__ */ new Set, r = [];
|
|
2936
|
-
for (let
|
|
2937
|
-
if (t.has(
|
|
2907
|
+
for (let a = 0;a < e.length; a++) {
|
|
2908
|
+
if (t.has(a))
|
|
2938
2909
|
continue;
|
|
2939
|
-
const
|
|
2940
|
-
if (
|
|
2941
|
-
r.push(
|
|
2910
|
+
const o = e[a];
|
|
2911
|
+
if (Ye(o) || Je(o)) {
|
|
2912
|
+
r.push(o);
|
|
2942
2913
|
continue;
|
|
2943
2914
|
}
|
|
2944
|
-
const u = (s =
|
|
2945
|
-
let
|
|
2946
|
-
if (b2 < e.length && !t.has(b2) &&
|
|
2947
|
-
const
|
|
2948
|
-
|
|
2915
|
+
const u = (s = o.name) != null ? s : "Measure", l = `${Ws}_${u}`, p = `${Gs}_${u}`;
|
|
2916
|
+
let c, d, b2 = a + 1;
|
|
2917
|
+
if (b2 < e.length && !t.has(b2) && Ye(e[b2]) && e[b2].name === l) {
|
|
2918
|
+
const g3 = (n = e[b2].composeCode) == null ? undefined : n.trim();
|
|
2919
|
+
g3 && (c = He(g3), t.add(b2), b2++);
|
|
2949
2920
|
}
|
|
2950
|
-
if (b2 < e.length && !t.has(b2) &&
|
|
2951
|
-
const
|
|
2952
|
-
|
|
2921
|
+
if (b2 < e.length && !t.has(b2) && Je(e[b2]) && e[b2].name === p) {
|
|
2922
|
+
const g3 = (i = e[b2].composeCode) == null ? undefined : i.trim();
|
|
2923
|
+
g3 && (d = He(g3), t.add(b2));
|
|
2953
2924
|
}
|
|
2954
|
-
|
|
2955
|
-
column:
|
|
2956
|
-
},
|
|
2925
|
+
c !== undefined || d !== undefined ? r.push(y(y({
|
|
2926
|
+
column: o
|
|
2927
|
+
}, c && Object.keys(c).length > 0 && { trend: c }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(o);
|
|
2957
2928
|
}
|
|
2958
2929
|
return r;
|
|
2959
2930
|
}
|
|
2960
|
-
function
|
|
2961
|
-
const t = [], r = w(() =>
|
|
2962
|
-
let
|
|
2963
|
-
if (e.highlights && e.highlights.length > 0 && (
|
|
2931
|
+
function Hn(e) {
|
|
2932
|
+
const t = [], r = w(() => Ne(e.dimensions || []), t), s = qn(e.measures || []), n = w(() => Ie(s), t), i = w(() => ve(e.filters), t);
|
|
2933
|
+
let a = null;
|
|
2934
|
+
if (e.highlights && e.highlights.length > 0 && (a = w(() => Re(e.highlights), t)), t.length > 0)
|
|
2964
2935
|
return {
|
|
2965
2936
|
success: false,
|
|
2966
2937
|
errors: t
|
|
2967
2938
|
};
|
|
2968
|
-
const
|
|
2939
|
+
const o = y({
|
|
2969
2940
|
dimensions: r || [],
|
|
2970
2941
|
measures: n || [],
|
|
2971
2942
|
filters: i || []
|
|
2972
|
-
},
|
|
2943
|
+
}, a && { highlights: a });
|
|
2973
2944
|
return {
|
|
2974
2945
|
success: true,
|
|
2975
|
-
data:
|
|
2946
|
+
data: Q2(o)
|
|
2976
2947
|
};
|
|
2977
2948
|
}
|
|
2978
|
-
var
|
|
2979
|
-
var
|
|
2980
|
-
function Zn(e) {
|
|
2981
|
-
const { filters: t, relations: r } = bp(e.filters || []);
|
|
2982
|
-
return {
|
|
2983
|
-
dataSource: e.dataSource,
|
|
2984
|
-
dimensions: e.dimensions,
|
|
2985
|
-
measures: e.measures,
|
|
2986
|
-
filters: t,
|
|
2987
|
-
filterRelations: r,
|
|
2988
|
-
highlights: e.highlights
|
|
2989
|
-
};
|
|
2990
|
-
}
|
|
2991
|
-
function fi(e, t, r = false) {
|
|
2992
|
-
const s = Zn(e), n = jn(s, t);
|
|
2993
|
-
return Dh(n, r);
|
|
2994
|
-
}
|
|
2949
|
+
var kt = new Set(sm.filter((e) => e !== "image"));
|
|
2950
|
+
var Qe = Object.freeze([...kt]);
|
|
2995
2951
|
|
|
2996
|
-
export {
|
|
2952
|
+
export { g2 as g, z, Q, q, Yn, Jn, Hn };
|