@sisense/mcp-server 0.2.5 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ai-qt2rw4p0.js → ai-3wz11tv8.js} +414 -414
- package/dist/{index-mxkgxy04.js → index-c0zk3ctc.js} +25524 -21921
- package/dist/{sse-server-kpkj0hbc.js → sse-server-dkaznf2x.js} +24223 -23378
- package/dist/sse-server-tg36wntb.js +2814 -0
- package/dist/sse-server-xfrv5734.js +6406 -0
- package/dist/sse-server.js +13659 -14270
- package/dist/view.html +649 -618
- package/dist/{widget-renderer-wjrpnwpy.js → widget-renderer-56n3m26y.js} +6 -7
- package/package.json +9 -9
- package/dist/sse-server-22mq7fhc.js +0 -2254
- package/dist/sse-server-d3yx2z0r.js +0 -6296
|
@@ -0,0 +1,2814 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$i,
|
|
3
|
+
Ap,
|
|
4
|
+
Bd,
|
|
5
|
+
Bi,
|
|
6
|
+
C,
|
|
7
|
+
Ci,
|
|
8
|
+
Ct,
|
|
9
|
+
Dh,
|
|
10
|
+
E,
|
|
11
|
+
Fd,
|
|
12
|
+
Fi,
|
|
13
|
+
Hd,
|
|
14
|
+
Hi,
|
|
15
|
+
J,
|
|
16
|
+
Ke,
|
|
17
|
+
Ld,
|
|
18
|
+
Ln,
|
|
19
|
+
Lp,
|
|
20
|
+
Md,
|
|
21
|
+
Mp,
|
|
22
|
+
Nt,
|
|
23
|
+
Oe,
|
|
24
|
+
Pd,
|
|
25
|
+
Rn,
|
|
26
|
+
Rp,
|
|
27
|
+
Se,
|
|
28
|
+
Sp,
|
|
29
|
+
Tp,
|
|
30
|
+
Ud,
|
|
31
|
+
X,
|
|
32
|
+
Xp,
|
|
33
|
+
Yt,
|
|
34
|
+
Zt,
|
|
35
|
+
ap,
|
|
36
|
+
be,
|
|
37
|
+
bp,
|
|
38
|
+
cp,
|
|
39
|
+
dp,
|
|
40
|
+
ed,
|
|
41
|
+
fp,
|
|
42
|
+
g,
|
|
43
|
+
gp,
|
|
44
|
+
gt,
|
|
45
|
+
h1 as h,
|
|
46
|
+
hp,
|
|
47
|
+
ip,
|
|
48
|
+
jd,
|
|
49
|
+
ji,
|
|
50
|
+
jn,
|
|
51
|
+
lp,
|
|
52
|
+
m,
|
|
53
|
+
mp,
|
|
54
|
+
op,
|
|
55
|
+
pp,
|
|
56
|
+
re,
|
|
57
|
+
rp,
|
|
58
|
+
sp,
|
|
59
|
+
up,
|
|
60
|
+
vn,
|
|
61
|
+
vs,
|
|
62
|
+
wn,
|
|
63
|
+
wp,
|
|
64
|
+
xp,
|
|
65
|
+
ye,
|
|
66
|
+
zd,
|
|
67
|
+
zi
|
|
68
|
+
} from "./sse-server-xfrv5734.js";
|
|
69
|
+
|
|
70
|
+
// node_modules/@sisense/sdk-ui/dist/dimensions-C0BmtTH2.js
|
|
71
|
+
class y extends vn {
|
|
72
|
+
constructor(t, e, r, o, d, m2, l, c, a, g2) {
|
|
73
|
+
if (super(t, d || E.Dimension, m2, c, a), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = C.None, !a && e) {
|
|
74
|
+
const { table: D, column: s } = Oe(e);
|
|
75
|
+
this.composeCode = `${Ci}.${gt(D)}.${gt(s)}`;
|
|
76
|
+
}
|
|
77
|
+
this._sort = l || C.None, this._expression = e, this.setDimensions(o || []), this.setAttributes(r), g2 && (this.defaultAttribute = g2);
|
|
78
|
+
}
|
|
79
|
+
static parseType(t) {
|
|
80
|
+
switch (t) {
|
|
81
|
+
case "datetime":
|
|
82
|
+
case E.DateDimension:
|
|
83
|
+
return E.DateDimension;
|
|
84
|
+
case "text":
|
|
85
|
+
case E.TextDimension:
|
|
86
|
+
return E.TextDimension;
|
|
87
|
+
case "numeric":
|
|
88
|
+
case E.NumericDimension:
|
|
89
|
+
return E.NumericDimension;
|
|
90
|
+
}
|
|
91
|
+
return E.TextDimension;
|
|
92
|
+
}
|
|
93
|
+
getAttachedName(t, e) {
|
|
94
|
+
let r = t;
|
|
95
|
+
const o = be(t);
|
|
96
|
+
return (o === "id" || o === "name" || Object.getOwnPropertyDescriptor(this, o) !== undefined || this[o] !== undefined) && (r = e), r;
|
|
97
|
+
}
|
|
98
|
+
setDimensions(t) {
|
|
99
|
+
this._dimensions = t;
|
|
100
|
+
for (let e = 0;e < t.length; e++) {
|
|
101
|
+
const r = this.getAttachedName(t[e].name, t[e].attributes[0].expression);
|
|
102
|
+
this[be(r)] = t[e], r != t[e].name && (t[e].name = r);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
setAttributes(t) {
|
|
106
|
+
this._attributes = t || [];
|
|
107
|
+
for (let e = 0;e < t.length; e++) {
|
|
108
|
+
const r = this.getAttachedName(t[e].name, t[e].expression);
|
|
109
|
+
this[be(r)] = t[e], t[e].name != r && (t[e].name = r);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
get id() {
|
|
113
|
+
return this._expression;
|
|
114
|
+
}
|
|
115
|
+
get attributes() {
|
|
116
|
+
return this._attributes;
|
|
117
|
+
}
|
|
118
|
+
get dimensions() {
|
|
119
|
+
return this._dimensions;
|
|
120
|
+
}
|
|
121
|
+
get expression() {
|
|
122
|
+
return this._expression;
|
|
123
|
+
}
|
|
124
|
+
getSort() {
|
|
125
|
+
return this._sort;
|
|
126
|
+
}
|
|
127
|
+
sort(t) {
|
|
128
|
+
return new y(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, t, this.dataSource, this.composeCode, this.defaultAttribute);
|
|
129
|
+
}
|
|
130
|
+
serialize() {
|
|
131
|
+
const t = super.serialize();
|
|
132
|
+
return t.expression = this.expression, this.getSort() !== undefined && (t.sort = this.getSort()), t.attributes = this._attributes.map((e) => e.serialize()), t.dimensions = this._dimensions.map((e) => e.serialize()), this.defaultAttribute && (t.defaultAttribute = this.defaultAttribute.serialize()), t;
|
|
133
|
+
}
|
|
134
|
+
jaql(t) {
|
|
135
|
+
if (this.defaultAttribute)
|
|
136
|
+
return this.defaultAttribute.jaql(t);
|
|
137
|
+
if (this.dimensions.length > 0)
|
|
138
|
+
return this.dimensions[0].jaql(t);
|
|
139
|
+
const e = {
|
|
140
|
+
jaql: {
|
|
141
|
+
title: this.name,
|
|
142
|
+
dim: this.expression,
|
|
143
|
+
datatype: vs(this.type)
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return this._sort != C.None && (e.jaql.sort = this._sort == C.Ascending ? "asc" : "desc"), t === true ? e.jaql : e;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
var z = (i) => i && i.__serializable === "DimensionalDimension";
|
|
150
|
+
|
|
151
|
+
class p extends y {
|
|
152
|
+
constructor(t, e, r, o, d, m2, l, c) {
|
|
153
|
+
super(t, e, [], [], E.DateDimension, r, o, d, m2), this.__serializable = "DimensionalDateDimension";
|
|
154
|
+
const a = [r, o, d, undefined, undefined, l, c];
|
|
155
|
+
this.defaultLevel = g.Years, this.Years = new J(g.Years, e, g.Years, "yyyy", ...a), this.Quarters = new J(g.Quarters, e, g.Quarters, "Q yyyy", ...a), this.Months = new J(g.Months, e, g.Months, "yyyy-MM", ...a), this.Weeks = new J(g.Weeks, e, g.Weeks, "ww yyyy", ...a), this.Days = new J(g.Days, e, g.Days, "yyyy-MM-dd", ...a), this.Hours = new J(g.Hours, e, g.Hours, "yyyy-MM-dd HH:mm", ...a), this.MinutesRoundTo30 = new J(g.MinutesRoundTo30, e, g.MinutesRoundTo30, "yyyy-MM-dd HH:mm", r, o, d), this.MinutesRoundTo15 = new J(g.MinutesRoundTo15, e, g.MinutesRoundTo15, "yyyy-MM-dd HH:mm", ...a), this.Minutes = new J(g.Minutes, e, g.Minutes, "yyyy-MM-dd HH:mm", ...a), this.Seconds = new J(g.Seconds, e, g.Seconds, "yyyy-MM-dd HH:mm:ss", r, o, d), this.AggHours = new J(g.AggHours, e, g.AggHours, "HH:mm", ...a), this.AggMinutesRoundTo30 = new J(g.AggMinutesRoundTo30, e, g.AggMinutesRoundTo30, "HH:mm", r, o, d), this.AggMinutesRoundTo15 = new J(g.AggMinutesRoundTo15, e, g.AggMinutesRoundTo15, "HH:mm", ...a), this.AggMinutesRoundTo1 = new J(g.AggMinutesRoundTo1, e, g.AggMinutesRoundTo1, "HH:mm", ...a), this.setAttributes([
|
|
156
|
+
this.Years,
|
|
157
|
+
this.Quarters,
|
|
158
|
+
this.Months,
|
|
159
|
+
this.Weeks,
|
|
160
|
+
this.Days,
|
|
161
|
+
this.Hours,
|
|
162
|
+
this.MinutesRoundTo30,
|
|
163
|
+
this.MinutesRoundTo15,
|
|
164
|
+
this.Minutes,
|
|
165
|
+
this.Seconds,
|
|
166
|
+
this.AggHours,
|
|
167
|
+
this.AggMinutesRoundTo30,
|
|
168
|
+
this.AggMinutesRoundTo15,
|
|
169
|
+
this.AggMinutesRoundTo1
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
get id() {
|
|
173
|
+
return this.expression;
|
|
174
|
+
}
|
|
175
|
+
setDimensions() {}
|
|
176
|
+
setAttributes(t) {
|
|
177
|
+
this._attributes = t;
|
|
178
|
+
}
|
|
179
|
+
getSort() {
|
|
180
|
+
return this._sort;
|
|
181
|
+
}
|
|
182
|
+
sort(t) {
|
|
183
|
+
return new p(this.name, this.expression, this.description, t, this.dataSource, this.composeCode, this.indexed, this.merged);
|
|
184
|
+
}
|
|
185
|
+
serialize() {
|
|
186
|
+
return super.serialize();
|
|
187
|
+
}
|
|
188
|
+
jaql(t) {
|
|
189
|
+
const e = this[this.defaultLevel].jaql();
|
|
190
|
+
return e.jaql.title = this.name, t ? e.jaql : e;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
var S = (i) => i && i.__serializable === "DimensionalDateDimension";
|
|
194
|
+
function N(i) {
|
|
195
|
+
const t = i.name || i.title, e = i.desc || i.description, r = i.expression || i.dim, o = y.parseType(i.dimtype || i.type), d = i.sort, m2 = i.dataSource, l = i.indexed, c = i.merged;
|
|
196
|
+
if (o == E.DateDimension)
|
|
197
|
+
return new p(t, r, e, d, m2, undefined, l, c);
|
|
198
|
+
const a = Object.getOwnPropertyNames(i).map((s) => i[s]).filter((s) => E.isAttribute(s == null ? undefined : s.type));
|
|
199
|
+
if (a.length == 0)
|
|
200
|
+
if (i.attributes) {
|
|
201
|
+
let s;
|
|
202
|
+
for (let M = 0;M < i.attributes.length; M++)
|
|
203
|
+
s = i.attributes[M], a.push(new Ke(s.name, s.expression, s.type, s.description, s.sort, s.dataSource, undefined, undefined, s.indexed, s.merged));
|
|
204
|
+
} else
|
|
205
|
+
r && a.push(new Ke(t, r, o, e, d, m2, undefined, undefined, l, c));
|
|
206
|
+
const g2 = Object.getOwnPropertyNames(i).map((s) => i[s]).filter((s) => E.isDimension(s == null ? undefined : s.type));
|
|
207
|
+
if (g2.length == 0 && i.dimensions)
|
|
208
|
+
for (let s = 0;s < i.dimensions.length; s++)
|
|
209
|
+
g2.push(N(i.dimensions[s]));
|
|
210
|
+
const D = new y(t, r, a, g2, o, e, d, m2);
|
|
211
|
+
return i.defaultAttribute && (D.defaultAttribute = a.find((s) => s.name === i.defaultAttribute)), D;
|
|
212
|
+
}
|
|
213
|
+
function q(i) {
|
|
214
|
+
const t = i.name || i.title, e = i.expression || i.dim, r = i.desc || i.description, o = i.sort, d = i.dataSource;
|
|
215
|
+
return new p(t, e, r, o, d, undefined, i.indexed, i.merged);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// node_modules/@sisense/sdk-ui/dist/analytics-composer/node.js
|
|
219
|
+
var zt = Object.defineProperty;
|
|
220
|
+
var Pt = Object.defineProperties;
|
|
221
|
+
var Lt = Object.getOwnPropertyDescriptors;
|
|
222
|
+
var ze = Object.getOwnPropertySymbols;
|
|
223
|
+
var _t = Object.prototype.hasOwnProperty;
|
|
224
|
+
var Ut = Object.prototype.propertyIsEnumerable;
|
|
225
|
+
var Pe = (e, t, r) => (t in e) ? zt(e, t, { enumerable: true, configurable: true, writable: true, value: r }) : e[t] = r;
|
|
226
|
+
var g2 = (e, t) => {
|
|
227
|
+
for (var r in t || (t = {}))
|
|
228
|
+
_t.call(t, r) && Pe(e, r, t[r]);
|
|
229
|
+
if (ze)
|
|
230
|
+
for (var r of ze(t))
|
|
231
|
+
Ut.call(t, r) && Pe(e, r, t[r]);
|
|
232
|
+
return e;
|
|
233
|
+
};
|
|
234
|
+
var F = (e, t) => Pt(e, Lt(t));
|
|
235
|
+
function jr(e, t) {
|
|
236
|
+
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, o) => Array.from({ length: s + 1 }, (a, u) => o === 0 ? u : u === 0 ? o : 0));
|
|
237
|
+
for (let i = 1;i <= r; i++)
|
|
238
|
+
for (let o = 1;o <= s; o++)
|
|
239
|
+
n[i][o] = Math.min(n[i - 1][o] + 1, n[i][o - 1] + 1, n[i - 1][o - 1] + (e[i - 1] === t[o - 1] ? 0 : 1));
|
|
240
|
+
return n[r][s];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
class Vr {
|
|
244
|
+
constructor() {
|
|
245
|
+
this.keyToValue = /* @__PURE__ */ new Map, this.valueToKey = /* @__PURE__ */ new Map;
|
|
246
|
+
}
|
|
247
|
+
set(t, r) {
|
|
248
|
+
this.keyToValue.set(t, r), this.valueToKey.set(r, t);
|
|
249
|
+
}
|
|
250
|
+
getByKey(t) {
|
|
251
|
+
return this.keyToValue.get(t);
|
|
252
|
+
}
|
|
253
|
+
getByValue(t) {
|
|
254
|
+
return this.valueToKey.get(t);
|
|
255
|
+
}
|
|
256
|
+
clear() {
|
|
257
|
+
this.keyToValue.clear(), this.valueToKey.clear();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
class rt {
|
|
262
|
+
constructor(t) {
|
|
263
|
+
this.generateIdentifier = t, this.kv = new Vr;
|
|
264
|
+
}
|
|
265
|
+
register(t, r) {
|
|
266
|
+
this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
|
|
267
|
+
}
|
|
268
|
+
clear() {
|
|
269
|
+
this.kv.clear();
|
|
270
|
+
}
|
|
271
|
+
getIdentifier(t) {
|
|
272
|
+
return this.kv.getByValue(t);
|
|
273
|
+
}
|
|
274
|
+
getValue(t) {
|
|
275
|
+
return this.kv.getByKey(t);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
class Wr extends rt {
|
|
280
|
+
constructor() {
|
|
281
|
+
super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map;
|
|
282
|
+
}
|
|
283
|
+
register(t, r) {
|
|
284
|
+
typeof r == "object" ? (r.allowProps && this.classToAllowedProps.set(t, r.allowProps), super.register(t, r.identifier)) : super.register(t, r);
|
|
285
|
+
}
|
|
286
|
+
getAllowedProps(t) {
|
|
287
|
+
return this.classToAllowedProps.get(t);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function Kr(e) {
|
|
291
|
+
if ("values" in Object)
|
|
292
|
+
return Object.values(e);
|
|
293
|
+
const t = [];
|
|
294
|
+
for (const r in e)
|
|
295
|
+
e.hasOwnProperty(r) && t.push(e[r]);
|
|
296
|
+
return t;
|
|
297
|
+
}
|
|
298
|
+
function Jr(e, t) {
|
|
299
|
+
const r = Kr(e);
|
|
300
|
+
if ("find" in r)
|
|
301
|
+
return r.find(t);
|
|
302
|
+
const s = r;
|
|
303
|
+
for (let n = 0;n < s.length; n++) {
|
|
304
|
+
const i = s[n];
|
|
305
|
+
if (t(i))
|
|
306
|
+
return i;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function U(e, t) {
|
|
310
|
+
Object.entries(e).forEach(([r, s]) => t(s, r));
|
|
311
|
+
}
|
|
312
|
+
function Z(e, t) {
|
|
313
|
+
return e.indexOf(t) !== -1;
|
|
314
|
+
}
|
|
315
|
+
function _e(e, t) {
|
|
316
|
+
for (let r = 0;r < e.length; r++) {
|
|
317
|
+
const s = e[r];
|
|
318
|
+
if (t(s))
|
|
319
|
+
return s;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
class Yr {
|
|
324
|
+
constructor() {
|
|
325
|
+
this.transfomers = {};
|
|
326
|
+
}
|
|
327
|
+
register(t) {
|
|
328
|
+
this.transfomers[t.name] = t;
|
|
329
|
+
}
|
|
330
|
+
findApplicable(t) {
|
|
331
|
+
return Jr(this.transfomers, (r) => r.isApplicable(t));
|
|
332
|
+
}
|
|
333
|
+
findByName(t) {
|
|
334
|
+
return this.transfomers[t];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
var Gr = (e) => Object.prototype.toString.call(e).slice(8, -1);
|
|
338
|
+
var st = (e) => typeof e == "undefined";
|
|
339
|
+
var Qr = (e) => e === null;
|
|
340
|
+
var K = (e) => typeof e != "object" || e === null || e === Object.prototype ? false : Object.getPrototypeOf(e) === null ? true : Object.getPrototypeOf(e) === Object.prototype;
|
|
341
|
+
var fe = (e) => K(e) && Object.keys(e).length === 0;
|
|
342
|
+
var R = (e) => Array.isArray(e);
|
|
343
|
+
var Hr = (e) => typeof e == "string";
|
|
344
|
+
var Xr = (e) => typeof e == "number" && !isNaN(e);
|
|
345
|
+
var Zr = (e) => typeof e == "boolean";
|
|
346
|
+
var es = (e) => e instanceof RegExp;
|
|
347
|
+
var J2 = (e) => e instanceof Map;
|
|
348
|
+
var Y = (e) => e instanceof Set;
|
|
349
|
+
var nt = (e) => Gr(e) === "Symbol";
|
|
350
|
+
var ts = (e) => e instanceof Date && !isNaN(e.valueOf());
|
|
351
|
+
var rs = (e) => e instanceof Error;
|
|
352
|
+
var Ue = (e) => typeof e == "number" && isNaN(e);
|
|
353
|
+
var ss = (e) => Zr(e) || Qr(e) || st(e) || Xr(e) || Hr(e) || nt(e);
|
|
354
|
+
var ns = (e) => typeof e == "bigint";
|
|
355
|
+
var is = (e) => e === 1 / 0 || e === -1 / 0;
|
|
356
|
+
var os = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
357
|
+
var as = (e) => e instanceof URL;
|
|
358
|
+
var it = (e) => e.replace(/\./g, "\\.");
|
|
359
|
+
var ae = (e) => e.map(String).map(it).join(".");
|
|
360
|
+
var W = (e) => {
|
|
361
|
+
const t = [];
|
|
362
|
+
let r = "";
|
|
363
|
+
for (let n = 0;n < e.length; n++) {
|
|
364
|
+
let i = e.charAt(n);
|
|
365
|
+
if (i === "\\" && e.charAt(n + 1) === ".") {
|
|
366
|
+
r += ".", n++;
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
if (i === ".") {
|
|
370
|
+
t.push(r), r = "";
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
r += i;
|
|
374
|
+
}
|
|
375
|
+
const s = r;
|
|
376
|
+
return t.push(s), t;
|
|
377
|
+
};
|
|
378
|
+
function v(e, t, r, s) {
|
|
379
|
+
return {
|
|
380
|
+
isApplicable: e,
|
|
381
|
+
annotation: t,
|
|
382
|
+
transform: r,
|
|
383
|
+
untransform: s
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
var ot = [
|
|
387
|
+
v(st, "undefined", () => null, () => {}),
|
|
388
|
+
v(ns, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
389
|
+
v(ts, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
390
|
+
v(rs, "Error", (e, t) => {
|
|
391
|
+
const r = {
|
|
392
|
+
name: e.name,
|
|
393
|
+
message: e.message
|
|
394
|
+
};
|
|
395
|
+
return t.allowedErrorProps.forEach((s) => {
|
|
396
|
+
r[s] = e[s];
|
|
397
|
+
}), r;
|
|
398
|
+
}, (e, t) => {
|
|
399
|
+
const r = new Error(e.message);
|
|
400
|
+
return r.name = e.name, r.stack = e.stack, t.allowedErrorProps.forEach((s) => {
|
|
401
|
+
r[s] = e[s];
|
|
402
|
+
}), r;
|
|
403
|
+
}),
|
|
404
|
+
v(es, "regexp", (e) => "" + e, (e) => {
|
|
405
|
+
const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
|
|
406
|
+
return new RegExp(t, r);
|
|
407
|
+
}),
|
|
408
|
+
v(Y, "set", (e) => [...e.values()], (e) => new Set(e)),
|
|
409
|
+
v(J2, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
410
|
+
v((e) => Ue(e) || is(e), "number", (e) => Ue(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
411
|
+
v((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
412
|
+
v(as, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
413
|
+
];
|
|
414
|
+
function se(e, t, r, s) {
|
|
415
|
+
return {
|
|
416
|
+
isApplicable: e,
|
|
417
|
+
annotation: t,
|
|
418
|
+
transform: r,
|
|
419
|
+
untransform: s
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
var at = se((e, t) => nt(e) ? !!t.symbolRegistry.getIdentifier(e) : false, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
|
|
423
|
+
const s = r.symbolRegistry.getValue(t[1]);
|
|
424
|
+
if (!s)
|
|
425
|
+
throw new Error("Trying to deserialize unknown symbol");
|
|
426
|
+
return s;
|
|
427
|
+
});
|
|
428
|
+
var us = [
|
|
429
|
+
Int8Array,
|
|
430
|
+
Uint8Array,
|
|
431
|
+
Int16Array,
|
|
432
|
+
Uint16Array,
|
|
433
|
+
Int32Array,
|
|
434
|
+
Uint32Array,
|
|
435
|
+
Float32Array,
|
|
436
|
+
Float64Array,
|
|
437
|
+
Uint8ClampedArray
|
|
438
|
+
].reduce((e, t) => (e[t.name] = t, e), {});
|
|
439
|
+
var ut = se(os, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
440
|
+
const r = us[t[1]];
|
|
441
|
+
if (!r)
|
|
442
|
+
throw new Error("Trying to deserialize unknown typed array");
|
|
443
|
+
return new r(e);
|
|
444
|
+
});
|
|
445
|
+
function ct(e, t) {
|
|
446
|
+
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : false;
|
|
447
|
+
}
|
|
448
|
+
var lt = se(ct, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
449
|
+
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
450
|
+
if (!r)
|
|
451
|
+
return g2({}, e);
|
|
452
|
+
const s = {};
|
|
453
|
+
return r.forEach((n) => {
|
|
454
|
+
s[n] = e[n];
|
|
455
|
+
}), s;
|
|
456
|
+
}, (e, t, r) => {
|
|
457
|
+
const s = r.classRegistry.getValue(t[1]);
|
|
458
|
+
if (!s)
|
|
459
|
+
throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
460
|
+
return Object.assign(Object.create(s.prototype), e);
|
|
461
|
+
});
|
|
462
|
+
var ft = 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
|
+
const s = r.customTransformerRegistry.findByName(t[1]);
|
|
464
|
+
if (!s)
|
|
465
|
+
throw new Error("Trying to deserialize unknown custom value");
|
|
466
|
+
return s.deserialize(e);
|
|
467
|
+
});
|
|
468
|
+
var cs = [lt, at, ft, ut];
|
|
469
|
+
var je = (e, t) => {
|
|
470
|
+
const r = _e(cs, (n) => n.isApplicable(e, t));
|
|
471
|
+
if (r)
|
|
472
|
+
return {
|
|
473
|
+
value: r.transform(e, t),
|
|
474
|
+
type: r.annotation(e, t)
|
|
475
|
+
};
|
|
476
|
+
const s = _e(ot, (n) => n.isApplicable(e, t));
|
|
477
|
+
if (s)
|
|
478
|
+
return {
|
|
479
|
+
value: s.transform(e, t),
|
|
480
|
+
type: s.annotation
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
var dt = {};
|
|
484
|
+
ot.forEach((e) => {
|
|
485
|
+
dt[e.annotation] = e;
|
|
486
|
+
});
|
|
487
|
+
var ls = (e, t, r) => {
|
|
488
|
+
if (R(t))
|
|
489
|
+
switch (t[0]) {
|
|
490
|
+
case "symbol":
|
|
491
|
+
return at.untransform(e, t, r);
|
|
492
|
+
case "class":
|
|
493
|
+
return lt.untransform(e, t, r);
|
|
494
|
+
case "custom":
|
|
495
|
+
return ft.untransform(e, t, r);
|
|
496
|
+
case "typed-array":
|
|
497
|
+
return ut.untransform(e, t, r);
|
|
498
|
+
default:
|
|
499
|
+
throw new Error("Unknown transformation: " + t);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
const s = dt[t];
|
|
503
|
+
if (!s)
|
|
504
|
+
throw new Error("Unknown transformation: " + t);
|
|
505
|
+
return s.untransform(e, r);
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
var P = (e, t) => {
|
|
509
|
+
if (t > e.size)
|
|
510
|
+
throw new Error("index out of bounds");
|
|
511
|
+
const r = e.keys();
|
|
512
|
+
for (;t > 0; )
|
|
513
|
+
r.next(), t--;
|
|
514
|
+
return r.next().value;
|
|
515
|
+
};
|
|
516
|
+
function mt(e) {
|
|
517
|
+
if (Z(e, "__proto__"))
|
|
518
|
+
throw new Error("__proto__ is not allowed as a property");
|
|
519
|
+
if (Z(e, "prototype"))
|
|
520
|
+
throw new Error("prototype is not allowed as a property");
|
|
521
|
+
if (Z(e, "constructor"))
|
|
522
|
+
throw new Error("constructor is not allowed as a property");
|
|
523
|
+
}
|
|
524
|
+
var fs = (e, t) => {
|
|
525
|
+
mt(t);
|
|
526
|
+
for (let r = 0;r < t.length; r++) {
|
|
527
|
+
const s = t[r];
|
|
528
|
+
if (Y(e))
|
|
529
|
+
e = P(e, +s);
|
|
530
|
+
else if (J2(e)) {
|
|
531
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", o = P(e, n);
|
|
532
|
+
switch (i) {
|
|
533
|
+
case "key":
|
|
534
|
+
e = o;
|
|
535
|
+
break;
|
|
536
|
+
case "value":
|
|
537
|
+
e = e.get(o);
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
} else
|
|
541
|
+
e = e[s];
|
|
542
|
+
}
|
|
543
|
+
return e;
|
|
544
|
+
};
|
|
545
|
+
var de = (e, t, r) => {
|
|
546
|
+
if (mt(t), t.length === 0)
|
|
547
|
+
return r(e);
|
|
548
|
+
let s = e;
|
|
549
|
+
for (let i = 0;i < t.length - 1; i++) {
|
|
550
|
+
const o = t[i];
|
|
551
|
+
if (R(s)) {
|
|
552
|
+
const a = +o;
|
|
553
|
+
s = s[a];
|
|
554
|
+
} else if (K(s))
|
|
555
|
+
s = s[o];
|
|
556
|
+
else if (Y(s)) {
|
|
557
|
+
const a = +o;
|
|
558
|
+
s = P(s, a);
|
|
559
|
+
} else if (J2(s)) {
|
|
560
|
+
if (i === t.length - 2)
|
|
561
|
+
break;
|
|
562
|
+
const u = +o, c = +t[++i] == 0 ? "key" : "value", m2 = P(s, u);
|
|
563
|
+
switch (c) {
|
|
564
|
+
case "key":
|
|
565
|
+
s = m2;
|
|
566
|
+
break;
|
|
567
|
+
case "value":
|
|
568
|
+
s = s.get(m2);
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const n = t[t.length - 1];
|
|
574
|
+
if (R(s) ? s[+n] = r(s[+n]) : K(s) && (s[n] = r(s[n])), Y(s)) {
|
|
575
|
+
const i = P(s, +n), o = r(i);
|
|
576
|
+
i !== o && (s.delete(i), s.add(o));
|
|
577
|
+
}
|
|
578
|
+
if (J2(s)) {
|
|
579
|
+
const i = +t[t.length - 2], o = P(s, i);
|
|
580
|
+
switch (+n == 0 ? "key" : "value") {
|
|
581
|
+
case "key": {
|
|
582
|
+
const u = r(o);
|
|
583
|
+
s.set(u, s.get(o)), u !== o && s.delete(o);
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
case "value": {
|
|
587
|
+
s.set(o, r(s.get(o)));
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return e;
|
|
593
|
+
};
|
|
594
|
+
function me(e, t, r = []) {
|
|
595
|
+
if (!e)
|
|
596
|
+
return;
|
|
597
|
+
if (!R(e)) {
|
|
598
|
+
U(e, (i, o) => me(i, t, [...r, ...W(o)]));
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const [s, n] = e;
|
|
602
|
+
n && U(n, (i, o) => {
|
|
603
|
+
me(i, t, [...r, ...W(o)]);
|
|
604
|
+
}), t(s, r);
|
|
605
|
+
}
|
|
606
|
+
function ds(e, t, r) {
|
|
607
|
+
return me(t, (s, n) => {
|
|
608
|
+
e = de(e, n, (i) => ls(i, s, r));
|
|
609
|
+
}), e;
|
|
610
|
+
}
|
|
611
|
+
function ms(e, t) {
|
|
612
|
+
function r(s, n) {
|
|
613
|
+
const i = fs(e, W(n));
|
|
614
|
+
s.map(W).forEach((o) => {
|
|
615
|
+
e = de(e, o, () => i);
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
if (R(t)) {
|
|
619
|
+
const [s, n] = t;
|
|
620
|
+
s.forEach((i) => {
|
|
621
|
+
e = de(e, W(i), () => e);
|
|
622
|
+
}), n && U(n, r);
|
|
623
|
+
} else
|
|
624
|
+
U(t, r);
|
|
625
|
+
return e;
|
|
626
|
+
}
|
|
627
|
+
var ps = (e, t) => K(e) || R(e) || J2(e) || Y(e) || ct(e, t);
|
|
628
|
+
function ys(e, t, r) {
|
|
629
|
+
const s = r.get(e);
|
|
630
|
+
s ? s.push(t) : r.set(e, [t]);
|
|
631
|
+
}
|
|
632
|
+
function gs(e, t) {
|
|
633
|
+
const r = {};
|
|
634
|
+
let s;
|
|
635
|
+
return e.forEach((n) => {
|
|
636
|
+
if (n.length <= 1)
|
|
637
|
+
return;
|
|
638
|
+
t || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
|
|
639
|
+
const [i, ...o] = n;
|
|
640
|
+
i.length === 0 ? s = o.map(ae) : r[ae(i)] = o.map(ae);
|
|
641
|
+
}), s ? fe(r) ? [s] : [s, r] : fe(r) ? undefined : r;
|
|
642
|
+
}
|
|
643
|
+
var pt = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map) => {
|
|
644
|
+
var h2;
|
|
645
|
+
const a = ss(e);
|
|
646
|
+
if (!a) {
|
|
647
|
+
ys(e, n, t);
|
|
648
|
+
const p2 = o.get(e);
|
|
649
|
+
if (p2)
|
|
650
|
+
return s ? {
|
|
651
|
+
transformedValue: null
|
|
652
|
+
} : p2;
|
|
653
|
+
}
|
|
654
|
+
if (!ps(e, r)) {
|
|
655
|
+
const p2 = je(e, r), d = p2 ? {
|
|
656
|
+
transformedValue: p2.value,
|
|
657
|
+
annotations: [p2.type]
|
|
658
|
+
} : {
|
|
659
|
+
transformedValue: e
|
|
660
|
+
};
|
|
661
|
+
return a || o.set(e, d), d;
|
|
662
|
+
}
|
|
663
|
+
if (Z(i, e))
|
|
664
|
+
return {
|
|
665
|
+
transformedValue: null
|
|
666
|
+
};
|
|
667
|
+
const u = je(e, r), c = (h2 = u == null ? undefined : u.value) != null ? h2 : e, m2 = R(c) ? [] : {}, l = {};
|
|
668
|
+
U(c, (p2, d) => {
|
|
669
|
+
if (d === "__proto__" || d === "constructor" || d === "prototype")
|
|
670
|
+
throw new Error(`Detected property ${d}. This is a prototype pollution risk, please remove it from your object.`);
|
|
671
|
+
const b2 = pt(p2, t, r, s, [...n, d], [...i, e], o);
|
|
672
|
+
m2[d] = b2.transformedValue, R(b2.annotations) ? l[d] = b2.annotations : K(b2.annotations) && U(b2.annotations, (A, O) => {
|
|
673
|
+
l[it(d) + "." + O] = A;
|
|
674
|
+
});
|
|
675
|
+
});
|
|
676
|
+
const f2 = fe(l) ? {
|
|
677
|
+
transformedValue: m2,
|
|
678
|
+
annotations: u ? [u.type] : undefined
|
|
679
|
+
} : {
|
|
680
|
+
transformedValue: m2,
|
|
681
|
+
annotations: u ? [u.type, l] : l
|
|
682
|
+
};
|
|
683
|
+
return a || o.set(e, f2), f2;
|
|
684
|
+
};
|
|
685
|
+
function yt(e) {
|
|
686
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
687
|
+
}
|
|
688
|
+
function Ve(e) {
|
|
689
|
+
return yt(e) === "Array";
|
|
690
|
+
}
|
|
691
|
+
function hs(e) {
|
|
692
|
+
if (yt(e) !== "Object")
|
|
693
|
+
return false;
|
|
694
|
+
const t = Object.getPrototypeOf(e);
|
|
695
|
+
return !!t && t.constructor === Object && t === Object.prototype;
|
|
696
|
+
}
|
|
697
|
+
function bs(e, t, r, s, n) {
|
|
698
|
+
const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
699
|
+
i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
|
|
700
|
+
value: r,
|
|
701
|
+
enumerable: false,
|
|
702
|
+
writable: true,
|
|
703
|
+
configurable: true
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
function pe(e, t = {}) {
|
|
707
|
+
if (Ve(e))
|
|
708
|
+
return e.map((n) => pe(n, t));
|
|
709
|
+
if (!hs(e))
|
|
710
|
+
return e;
|
|
711
|
+
const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
712
|
+
return [...r, ...s].reduce((n, i) => {
|
|
713
|
+
if (Ve(t.props) && !t.props.includes(i))
|
|
714
|
+
return n;
|
|
715
|
+
const o = e[i], a = pe(o, t);
|
|
716
|
+
return bs(n, i, a, e, t.nonenumerable), n;
|
|
717
|
+
}, {});
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
class y2 {
|
|
721
|
+
constructor({ dedupe: t = false } = {}) {
|
|
722
|
+
this.classRegistry = new Wr, this.symbolRegistry = new rt((r) => {
|
|
723
|
+
var s;
|
|
724
|
+
return (s = r.description) != null ? s : "";
|
|
725
|
+
}), this.customTransformerRegistry = new Yr, this.allowedErrorProps = [], this.dedupe = t;
|
|
726
|
+
}
|
|
727
|
+
serialize(t) {
|
|
728
|
+
const r = /* @__PURE__ */ new Map, s = pt(t, r, this, this.dedupe), n = {
|
|
729
|
+
json: s.transformedValue
|
|
730
|
+
};
|
|
731
|
+
s.annotations && (n.meta = F(g2({}, n.meta), {
|
|
732
|
+
values: s.annotations
|
|
733
|
+
}));
|
|
734
|
+
const i = gs(r, this.dedupe);
|
|
735
|
+
return i && (n.meta = F(g2({}, n.meta), {
|
|
736
|
+
referentialEqualities: i
|
|
737
|
+
})), n;
|
|
738
|
+
}
|
|
739
|
+
deserialize(t) {
|
|
740
|
+
const { json: r, meta: s } = t;
|
|
741
|
+
let n = pe(r);
|
|
742
|
+
return s != null && s.values && (n = ds(n, s.values, this)), s != null && s.referentialEqualities && (n = ms(n, s.referentialEqualities)), n;
|
|
743
|
+
}
|
|
744
|
+
stringify(t) {
|
|
745
|
+
return JSON.stringify(this.serialize(t));
|
|
746
|
+
}
|
|
747
|
+
parse(t) {
|
|
748
|
+
return this.deserialize(JSON.parse(t));
|
|
749
|
+
}
|
|
750
|
+
registerClass(t, r) {
|
|
751
|
+
this.classRegistry.register(t, r);
|
|
752
|
+
}
|
|
753
|
+
registerSymbol(t, r) {
|
|
754
|
+
this.symbolRegistry.register(t, r);
|
|
755
|
+
}
|
|
756
|
+
registerCustom(t, r) {
|
|
757
|
+
this.customTransformerRegistry.register(g2({
|
|
758
|
+
name: r
|
|
759
|
+
}, t));
|
|
760
|
+
}
|
|
761
|
+
allowErrorProps(...t) {
|
|
762
|
+
this.allowedErrorProps.push(...t);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
y2.defaultInstance = new y2;
|
|
766
|
+
y2.serialize = y2.defaultInstance.serialize.bind(y2.defaultInstance);
|
|
767
|
+
y2.deserialize = y2.defaultInstance.deserialize.bind(y2.defaultInstance);
|
|
768
|
+
y2.stringify = y2.defaultInstance.stringify.bind(y2.defaultInstance);
|
|
769
|
+
y2.parse = y2.defaultInstance.parse.bind(y2.defaultInstance);
|
|
770
|
+
y2.registerClass = y2.defaultInstance.registerClass.bind(y2.defaultInstance);
|
|
771
|
+
y2.registerSymbol = y2.defaultInstance.registerSymbol.bind(y2.defaultInstance);
|
|
772
|
+
y2.registerCustom = y2.defaultInstance.registerCustom.bind(y2.defaultInstance);
|
|
773
|
+
y2.allowErrorProps = y2.defaultInstance.allowErrorProps.bind(y2.defaultInstance);
|
|
774
|
+
var z2 = (e) => e === undefined ? C.None : e;
|
|
775
|
+
var Fs = (e) => new m(e.metadataItem, e.type);
|
|
776
|
+
var we = (e) => new Ke(e.name, e.expression, e.type, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
777
|
+
var qe = (e) => new J(e.name, e.expression, e.granularity, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
778
|
+
var D = (e) => {
|
|
779
|
+
switch (e.__serializable) {
|
|
780
|
+
case "DimensionalAttribute":
|
|
781
|
+
return we(e);
|
|
782
|
+
case "DimensionalLevelAttribute":
|
|
783
|
+
return qe(e);
|
|
784
|
+
default:
|
|
785
|
+
return e;
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
var gt2 = (e) => new y(e.name, e.expression, e.attributes.map(D), e.dimensions.map(ws), e.type, e.description, z2(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? D(e.defaultAttribute) : undefined);
|
|
789
|
+
var ht = (e) => new p(e.name, e.expression, e.description, z2(e.sort), e.dataSource, e.composeCode, e.indexed, e.merged);
|
|
790
|
+
var ws = (e) => {
|
|
791
|
+
switch (e.__serializable) {
|
|
792
|
+
case "DimensionalDimension":
|
|
793
|
+
return gt2(e);
|
|
794
|
+
case "DimensionalDateDimension":
|
|
795
|
+
return ht(e);
|
|
796
|
+
default:
|
|
797
|
+
return e;
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
var Ae = (e) => new ye(e.name, D(e.attribute), e.aggregation, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
801
|
+
var Ce = (e) => {
|
|
802
|
+
const t = Object.fromEntries(Object.entries(e.context).map(([r, s]) => {
|
|
803
|
+
if (s && typeof s == "object" && "__serializable" in s)
|
|
804
|
+
switch (s.__serializable) {
|
|
805
|
+
case "DimensionalAttribute":
|
|
806
|
+
return [r, we(s)];
|
|
807
|
+
case "DimensionalLevelAttribute":
|
|
808
|
+
return [r, qe(s)];
|
|
809
|
+
case "DimensionalBaseMeasure":
|
|
810
|
+
return [r, Ae(s)];
|
|
811
|
+
case "DimensionalCalculatedMeasure":
|
|
812
|
+
return [r, Ce(s)];
|
|
813
|
+
default:
|
|
814
|
+
return [r, s];
|
|
815
|
+
}
|
|
816
|
+
return [r, s];
|
|
817
|
+
}));
|
|
818
|
+
return new X(e.name, e.expression, t, e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
819
|
+
};
|
|
820
|
+
var bt = (e) => new Yt(e.name, D(e.attribute), e.format, e.description, z2(e.sort), e.dataSource, e.composeCode);
|
|
821
|
+
var ue = (e) => {
|
|
822
|
+
switch (e.__serializable) {
|
|
823
|
+
case "DimensionalBaseMeasure":
|
|
824
|
+
return Ae(e);
|
|
825
|
+
case "DimensionalCalculatedMeasure":
|
|
826
|
+
return Ce(e);
|
|
827
|
+
case "DimensionalMeasureTemplate":
|
|
828
|
+
return bt(e);
|
|
829
|
+
default:
|
|
830
|
+
return e;
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
var C2 = (e) => {
|
|
834
|
+
switch (e.__serializable) {
|
|
835
|
+
case "MembersFilter":
|
|
836
|
+
return new jd(D(e.attribute), e.members, e.config.backgroundFilter ? F(g2({}, e.config), { backgroundFilter: C2(e.config.backgroundFilter) }) : e.config, e.composeCode);
|
|
837
|
+
case "LogicalAttributeFilter":
|
|
838
|
+
return new Bi(e.filters.map((r) => C2(r)), e.operator, e.config, e.composeCode);
|
|
839
|
+
case "CascadingFilter":
|
|
840
|
+
return new Pd(e._filters.map((r) => C2(r)), e.config, e.composeCode);
|
|
841
|
+
case "ExcludeFilter":
|
|
842
|
+
return new Fd(C2(e.filter), e.input ? C2(e.input) : undefined, e.config, e.composeCode);
|
|
843
|
+
case "MeasureFilter":
|
|
844
|
+
return new Ud(D(e.attribute), ue(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
845
|
+
case "RankingFilter":
|
|
846
|
+
return new zi(D(e.attribute), ue(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
847
|
+
case "MeasureRankingFilter":
|
|
848
|
+
return new Hi(ue(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
849
|
+
case "NumericFilter":
|
|
850
|
+
return new Bd(D(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
851
|
+
case "TextFilter":
|
|
852
|
+
return new re(D(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
|
|
853
|
+
case "DateRangeFilter": {
|
|
854
|
+
const { valueA: r, valueB: s } = e;
|
|
855
|
+
return new zd(D(e.attribute), r, s, e.config, e.composeCode);
|
|
856
|
+
}
|
|
857
|
+
case "RelativeDateFilter":
|
|
858
|
+
return new wn(D(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
|
|
859
|
+
case "CustomFilter":
|
|
860
|
+
return new Hd(D(e.attribute), e.jaqlExpression, e.config, e.composeCode);
|
|
861
|
+
default:
|
|
862
|
+
return e;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
y2.registerCustom({
|
|
866
|
+
isApplicable: h,
|
|
867
|
+
serialize: (e) => e.serialize(),
|
|
868
|
+
deserialize: (e) => Fs(e)
|
|
869
|
+
}, "JaqlElement");
|
|
870
|
+
y2.registerCustom({
|
|
871
|
+
isApplicable: xp,
|
|
872
|
+
serialize: (e) => e.serialize(),
|
|
873
|
+
deserialize: (e) => we(e)
|
|
874
|
+
}, "DimensionalAttribute");
|
|
875
|
+
y2.registerCustom({
|
|
876
|
+
isApplicable: wp,
|
|
877
|
+
serialize: (e) => e.serialize(),
|
|
878
|
+
deserialize: (e) => qe(e)
|
|
879
|
+
}, "DimensionalLevelAttribute");
|
|
880
|
+
y2.registerCustom({
|
|
881
|
+
isApplicable: z,
|
|
882
|
+
serialize: (e) => e.serialize(),
|
|
883
|
+
deserialize: (e) => gt2(e)
|
|
884
|
+
}, "DimensionalDimension");
|
|
885
|
+
y2.registerCustom({
|
|
886
|
+
isApplicable: S,
|
|
887
|
+
serialize: (e) => e.serialize(),
|
|
888
|
+
deserialize: (e) => ht(e)
|
|
889
|
+
}, "DimensionalDateDimension");
|
|
890
|
+
y2.registerCustom({
|
|
891
|
+
isApplicable: $i,
|
|
892
|
+
serialize: (e) => e.serialize(),
|
|
893
|
+
deserialize: (e) => Ae(e)
|
|
894
|
+
}, "DimensionalBaseMeasure");
|
|
895
|
+
y2.registerCustom({
|
|
896
|
+
isApplicable: ji,
|
|
897
|
+
serialize: (e) => e.serialize(),
|
|
898
|
+
deserialize: (e) => Ce(e)
|
|
899
|
+
}, "DimensionalCalculatedMeasure");
|
|
900
|
+
y2.registerCustom({
|
|
901
|
+
isApplicable: ip,
|
|
902
|
+
serialize: (e) => e.serialize(),
|
|
903
|
+
deserialize: (e) => bt(e)
|
|
904
|
+
}, "DimensionalMeasureTemplate");
|
|
905
|
+
y2.registerCustom({
|
|
906
|
+
isApplicable: ap,
|
|
907
|
+
serialize: (e) => e.serialize(),
|
|
908
|
+
deserialize: (e) => C2(e)
|
|
909
|
+
}, "MembersFilter");
|
|
910
|
+
y2.registerCustom({
|
|
911
|
+
isApplicable: dp,
|
|
912
|
+
serialize: (e) => e.serialize(),
|
|
913
|
+
deserialize: (e) => C2(e)
|
|
914
|
+
}, "LogicalAttributeFilter");
|
|
915
|
+
y2.registerCustom({
|
|
916
|
+
isApplicable: Nt,
|
|
917
|
+
serialize: (e) => e.serialize(),
|
|
918
|
+
deserialize: (e) => C2(e)
|
|
919
|
+
}, "CascadingFilter");
|
|
920
|
+
y2.registerCustom({
|
|
921
|
+
isApplicable: fp,
|
|
922
|
+
serialize: (e) => e.serialize(),
|
|
923
|
+
deserialize: (e) => C2(e)
|
|
924
|
+
}, "ExcludeFilter");
|
|
925
|
+
y2.registerCustom({
|
|
926
|
+
isApplicable: lp,
|
|
927
|
+
serialize: (e) => e.serialize(),
|
|
928
|
+
deserialize: (e) => C2(e)
|
|
929
|
+
}, "MeasureFilter");
|
|
930
|
+
y2.registerCustom({
|
|
931
|
+
isApplicable: up,
|
|
932
|
+
serialize: (e) => e.serialize(),
|
|
933
|
+
deserialize: (e) => C2(e)
|
|
934
|
+
}, "RankingFilter");
|
|
935
|
+
y2.registerCustom({
|
|
936
|
+
isApplicable: cp,
|
|
937
|
+
serialize: (e) => e.serialize(),
|
|
938
|
+
deserialize: (e) => C2(e)
|
|
939
|
+
}, "MeasureRankingFilter");
|
|
940
|
+
y2.registerCustom({
|
|
941
|
+
isApplicable: op,
|
|
942
|
+
serialize: (e) => e.serialize(),
|
|
943
|
+
deserialize: (e) => C2(e)
|
|
944
|
+
}, "NumericFilter");
|
|
945
|
+
y2.registerCustom({
|
|
946
|
+
isApplicable: hp,
|
|
947
|
+
serialize: (e) => e.serialize(),
|
|
948
|
+
deserialize: (e) => C2(e)
|
|
949
|
+
}, "TextFilter");
|
|
950
|
+
y2.registerCustom({
|
|
951
|
+
isApplicable: pp,
|
|
952
|
+
serialize: (e) => e.serialize(),
|
|
953
|
+
deserialize: (e) => C2(e)
|
|
954
|
+
}, "DateRangeFilter");
|
|
955
|
+
y2.registerCustom({
|
|
956
|
+
isApplicable: gp,
|
|
957
|
+
serialize: (e) => e.serialize(),
|
|
958
|
+
deserialize: (e) => C2(e)
|
|
959
|
+
}, "RelativeDateFilter");
|
|
960
|
+
y2.registerCustom({
|
|
961
|
+
isApplicable: sp,
|
|
962
|
+
serialize: (e) => e.serialize(),
|
|
963
|
+
deserialize: (e) => C2(e)
|
|
964
|
+
}, "CustomFilter");
|
|
965
|
+
var Kn = y2;
|
|
966
|
+
var q3 = "DM.";
|
|
967
|
+
function T2(e) {
|
|
968
|
+
return typeof e == "object" && e !== null;
|
|
969
|
+
}
|
|
970
|
+
function E3(e) {
|
|
971
|
+
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
972
|
+
}
|
|
973
|
+
function Ft(e) {
|
|
974
|
+
return e.every(E3);
|
|
975
|
+
}
|
|
976
|
+
function ne(e) {
|
|
977
|
+
return "attribute" in e && "config" in e;
|
|
978
|
+
}
|
|
979
|
+
function X2(e) {
|
|
980
|
+
return "left" in e && "right" in e && "operator" in e;
|
|
981
|
+
}
|
|
982
|
+
function Ee(e) {
|
|
983
|
+
return !ne(e) && !X2(e);
|
|
984
|
+
}
|
|
985
|
+
function qs(e) {
|
|
986
|
+
return T2(e) && "column" in e && typeof e.column == "string" && !(("function" in e) && ("args" in e));
|
|
987
|
+
}
|
|
988
|
+
function As(e) {
|
|
989
|
+
return !T2(e) || !("column" in e) ? false : E3(e.column);
|
|
990
|
+
}
|
|
991
|
+
var x = 3;
|
|
992
|
+
function M(e, t, r) {
|
|
993
|
+
if (t.length === 0)
|
|
994
|
+
return;
|
|
995
|
+
let s = Number.MAX_SAFE_INTEGER, n;
|
|
996
|
+
for (const i of t) {
|
|
997
|
+
const o = r(i), a = jr(e, o);
|
|
998
|
+
a < s && (s = a, n = i);
|
|
999
|
+
}
|
|
1000
|
+
return n !== undefined ? { best: n, distance: s } : undefined;
|
|
1001
|
+
}
|
|
1002
|
+
function xe(e) {
|
|
1003
|
+
const t = [...e].sort((i, o) => o.name.length - i.name.length), r = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
|
|
1004
|
+
for (const i of e) {
|
|
1005
|
+
r.set(i.name, i);
|
|
1006
|
+
const o = [...i.columns].sort((u, c) => c.name.length - u.name.length);
|
|
1007
|
+
n.set(i.name, o);
|
|
1008
|
+
const a = /* @__PURE__ */ new Map;
|
|
1009
|
+
for (const u of i.columns)
|
|
1010
|
+
a.set(u.name, u);
|
|
1011
|
+
s.set(i.name, a);
|
|
1012
|
+
}
|
|
1013
|
+
return {
|
|
1014
|
+
sortedTables: t,
|
|
1015
|
+
tableColumnMap: n,
|
|
1016
|
+
tableMap: r,
|
|
1017
|
+
columnMap: s
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
function $e(e, t) {
|
|
1021
|
+
if (!e.startsWith(q3))
|
|
1022
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${q3}TableName.ColumnName[.Level]'`);
|
|
1023
|
+
const r = e.slice(q3.length);
|
|
1024
|
+
if (!r)
|
|
1025
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${q3}TableName.ColumnName[.Level]'`);
|
|
1026
|
+
let s, n;
|
|
1027
|
+
for (const d of t.sortedTables)
|
|
1028
|
+
if (r.startsWith(d.name + ".")) {
|
|
1029
|
+
const b2 = r.slice(d.name.length + 1);
|
|
1030
|
+
if (!b2)
|
|
1031
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${q3}TableName.ColumnName[.Level]'`);
|
|
1032
|
+
s = d, n = b2;
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
if (!s) {
|
|
1036
|
+
const d = r.indexOf(".");
|
|
1037
|
+
if (d === -1)
|
|
1038
|
+
throw new Error(`Invalid dimensional element name format: '${e}'. Expected format: '${q3}TableName.ColumnName[.Level]'`);
|
|
1039
|
+
const b2 = r.slice(0, d), A = M(b2, t.sortedTables, (oe) => oe.name), O = A && A.distance <= x ? ` Did you mean '${A.best.name}'?` : "";
|
|
1040
|
+
throw new Error(`Table '${b2}' not found in the data model.${O}`);
|
|
1041
|
+
}
|
|
1042
|
+
const i = t.tableColumnMap.get(s.name);
|
|
1043
|
+
if (!i)
|
|
1044
|
+
throw new Error(`Table '${s.name}' found but has no columns`);
|
|
1045
|
+
let o, a;
|
|
1046
|
+
const u = g.all;
|
|
1047
|
+
for (const d of i) {
|
|
1048
|
+
if (n === d.name)
|
|
1049
|
+
return { table: s, column: d };
|
|
1050
|
+
if (!n.startsWith(d.name + "."))
|
|
1051
|
+
continue;
|
|
1052
|
+
const b2 = n.slice(d.name.length + 1);
|
|
1053
|
+
if (!b2)
|
|
1054
|
+
continue;
|
|
1055
|
+
const A = u.includes(b2), O = Rn(d.dataType);
|
|
1056
|
+
if (A) {
|
|
1057
|
+
if (O)
|
|
1058
|
+
return { table: s, column: d, level: b2 };
|
|
1059
|
+
o || (o = d, a = b2);
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
O && !o && (o = d, a = b2);
|
|
1063
|
+
}
|
|
1064
|
+
if (o && a) {
|
|
1065
|
+
if (u.includes(a))
|
|
1066
|
+
throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Column '${s.name}.${o.name}' is not a datetime column`);
|
|
1067
|
+
const d = M(a, u, (A) => A), b2 = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
|
|
1068
|
+
throw new Error(`Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(", ")}.${b2}`);
|
|
1069
|
+
}
|
|
1070
|
+
const c = n.indexOf("."), m2 = c === -1 ? n : n.slice(0, c), l = M(n, i, (d) => d.name), f2 = l && l.distance <= x && l.best.name !== m2, h2 = f2 ? ` Did you mean '${l.best.name}'?` : "", p2 = !f2 && n.endsWith(".") && (l == null ? undefined : l.best.name) === m2 ? ` Use '${m2}' without a trailing dot.` : "";
|
|
1071
|
+
throw new Error(`Column '${m2}' not found in table '${s.name}'.${h2}${p2}`);
|
|
1072
|
+
}
|
|
1073
|
+
function Cs(e, t) {
|
|
1074
|
+
const { table: r, column: s, level: n } = $e(e, t);
|
|
1075
|
+
if (n) {
|
|
1076
|
+
if (!Rn(s.dataType))
|
|
1077
|
+
throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`);
|
|
1078
|
+
const i = g.all;
|
|
1079
|
+
if (!i.includes(n))
|
|
1080
|
+
throw new Error(`Invalid date level '${n}' in dimensional element '${e}'. Valid levels are: ${i.join(", ")}`);
|
|
1081
|
+
const o = g.dateOnly;
|
|
1082
|
+
if (s.dataType === "date" && !o.includes(n))
|
|
1083
|
+
throw new Error(`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`);
|
|
1084
|
+
const a = g.timeOnly;
|
|
1085
|
+
if (s.dataType === "time" && !a.includes(n))
|
|
1086
|
+
throw new Error(`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`);
|
|
1087
|
+
}
|
|
1088
|
+
return { table: r, column: s, level: n };
|
|
1089
|
+
}
|
|
1090
|
+
function G(e, t, r, s) {
|
|
1091
|
+
const { table: n, column: i, level: o } = Cs(e, r);
|
|
1092
|
+
let a = o;
|
|
1093
|
+
if (Rn(i.dataType) && a === undefined && (s != null && s.inferredDateLevel)) {
|
|
1094
|
+
const u = s.inferredDateLevel, c = g.all;
|
|
1095
|
+
if (!c.includes(u))
|
|
1096
|
+
throw new Error(`Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`);
|
|
1097
|
+
const m2 = `${e}.${u}`, l = g.dateOnly;
|
|
1098
|
+
if (i.dataType === "date" && !l.includes(u))
|
|
1099
|
+
throw new Error(`Invalid level '${u}' in dimensional element '${m2}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`);
|
|
1100
|
+
const f2 = g.timeOnly;
|
|
1101
|
+
if (i.dataType === "time" && !f2.includes(u))
|
|
1102
|
+
throw new Error(`Invalid level '${u}' in dimensional element '${m2}'. Column '${n.name}.${i.name}' is only a time column, not a date column`);
|
|
1103
|
+
a = u;
|
|
1104
|
+
}
|
|
1105
|
+
return Ln({
|
|
1106
|
+
expression: i.expression,
|
|
1107
|
+
dataType: i.dataType,
|
|
1108
|
+
granularity: a,
|
|
1109
|
+
format: undefined,
|
|
1110
|
+
sort: undefined,
|
|
1111
|
+
dataSource: t
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
function Es(e, t, r) {
|
|
1115
|
+
const { column: s, level: n } = $e(e, r);
|
|
1116
|
+
if (n)
|
|
1117
|
+
throw new Error(`Invalid DateDimension name format: '${e}'. Expected format: '${q3}TableName.ColumnName'`);
|
|
1118
|
+
if (!Rn(s.dataType))
|
|
1119
|
+
throw new Error(`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`);
|
|
1120
|
+
return q({
|
|
1121
|
+
name: s.name,
|
|
1122
|
+
expression: s.expression,
|
|
1123
|
+
dataSource: t
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
var xs = (e, t) => {
|
|
1127
|
+
if (!e)
|
|
1128
|
+
return;
|
|
1129
|
+
const r = typeof e == "object" ? e.direction : e;
|
|
1130
|
+
if (!Lp(r))
|
|
1131
|
+
return F(g2({}, t), {
|
|
1132
|
+
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
|
|
1133
|
+
});
|
|
1134
|
+
};
|
|
1135
|
+
var $s = (e, t, r, s) => {
|
|
1136
|
+
const n = xs(e.sortType, s);
|
|
1137
|
+
if (n)
|
|
1138
|
+
return {
|
|
1139
|
+
attribute: G(e.column, t, r),
|
|
1140
|
+
style: {},
|
|
1141
|
+
error: n
|
|
1142
|
+
};
|
|
1143
|
+
const i = G(e.column, t, r), o = ed(e, "column");
|
|
1144
|
+
return { attribute: i, style: o };
|
|
1145
|
+
};
|
|
1146
|
+
var Ts = (e, t, r, s) => typeof e == "string" ? { attribute: G(e, t, r) } : qs(e) ? $s(e, t, r, s) : {
|
|
1147
|
+
error: F(g2({}, s), {
|
|
1148
|
+
message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
|
|
1149
|
+
})
|
|
1150
|
+
};
|
|
1151
|
+
var wt = (e) => {
|
|
1152
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
1153
|
+
if (!t)
|
|
1154
|
+
return { success: true, data: [] };
|
|
1155
|
+
if (!Array.isArray(t))
|
|
1156
|
+
return {
|
|
1157
|
+
success: false,
|
|
1158
|
+
errors: [
|
|
1159
|
+
{
|
|
1160
|
+
category: "dimensions",
|
|
1161
|
+
index: -1,
|
|
1162
|
+
input: t,
|
|
1163
|
+
message: "Invalid dimensions JSON. Expected an array."
|
|
1164
|
+
}
|
|
1165
|
+
]
|
|
1166
|
+
};
|
|
1167
|
+
const n = [], i = [];
|
|
1168
|
+
return t.forEach((o, a) => {
|
|
1169
|
+
const u = {
|
|
1170
|
+
category: "dimensions",
|
|
1171
|
+
index: a,
|
|
1172
|
+
input: o
|
|
1173
|
+
};
|
|
1174
|
+
try {
|
|
1175
|
+
const c = Ts(o, r, s, u);
|
|
1176
|
+
if (c.error) {
|
|
1177
|
+
i.push(c.error);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
c.attribute && n.push(c.style !== undefined ? { attribute: c.attribute, style: c.style } : { attribute: c.attribute });
|
|
1181
|
+
} catch (c) {
|
|
1182
|
+
const m2 = c instanceof Error ? c.message : "Unknown error";
|
|
1183
|
+
i.push(F(g2({}, u), { message: m2 }));
|
|
1184
|
+
}
|
|
1185
|
+
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
1186
|
+
};
|
|
1187
|
+
function Te(e, t) {
|
|
1188
|
+
const r = Reflect.get(e, t);
|
|
1189
|
+
if (typeof r != "function")
|
|
1190
|
+
throw new Error(`Function '${t}' not found or is not a function`);
|
|
1191
|
+
return r;
|
|
1192
|
+
}
|
|
1193
|
+
function Ds(e, t) {
|
|
1194
|
+
const r = e.replace("measureFactory.", ""), n = Te(rp, r)(...t);
|
|
1195
|
+
if (!Ee(n))
|
|
1196
|
+
throw new Error(`Function '${e}' did not return a valid Measure`);
|
|
1197
|
+
return n;
|
|
1198
|
+
}
|
|
1199
|
+
function Ss(e, t) {
|
|
1200
|
+
const r = e.replace("filterFactory.logic.", ""), n = Te(Se, r)(...t);
|
|
1201
|
+
if (!X2(n))
|
|
1202
|
+
throw new Error(`Function '${e}' did not return a valid FilterRelations`);
|
|
1203
|
+
return n;
|
|
1204
|
+
}
|
|
1205
|
+
function Os(e, t) {
|
|
1206
|
+
if (e.startsWith("filterFactory.logic."))
|
|
1207
|
+
return Ss(e, t);
|
|
1208
|
+
const r = e.replace("filterFactory.", ""), n = Te(mp, r)(...t);
|
|
1209
|
+
if (!ne(n) && !X2(n))
|
|
1210
|
+
throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
|
|
1211
|
+
return n;
|
|
1212
|
+
}
|
|
1213
|
+
function Ms(e, t) {
|
|
1214
|
+
const s = e.split(".")[0];
|
|
1215
|
+
if (s === "measureFactory")
|
|
1216
|
+
return Ds(e, t);
|
|
1217
|
+
if (s === "filterFactory")
|
|
1218
|
+
return Os(e, t);
|
|
1219
|
+
throw new Error(`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`);
|
|
1220
|
+
}
|
|
1221
|
+
var ye2 = {
|
|
1222
|
+
SDIFF: {
|
|
1223
|
+
category: "time-diff",
|
|
1224
|
+
argCount: 2,
|
|
1225
|
+
requiredDateLevel: g.Seconds,
|
|
1226
|
+
argType: "datetime"
|
|
1227
|
+
},
|
|
1228
|
+
MNDIFF: {
|
|
1229
|
+
category: "time-diff",
|
|
1230
|
+
argCount: 2,
|
|
1231
|
+
requiredDateLevel: g.Minutes,
|
|
1232
|
+
argType: "datetime"
|
|
1233
|
+
},
|
|
1234
|
+
HDIFF: {
|
|
1235
|
+
category: "time-diff",
|
|
1236
|
+
argCount: 2,
|
|
1237
|
+
requiredDateLevel: g.Hours,
|
|
1238
|
+
argType: "datetime"
|
|
1239
|
+
},
|
|
1240
|
+
DDIFF: {
|
|
1241
|
+
category: "time-diff",
|
|
1242
|
+
argCount: 2,
|
|
1243
|
+
requiredDateLevel: g.Days,
|
|
1244
|
+
argType: "datetime"
|
|
1245
|
+
},
|
|
1246
|
+
MDIFF: {
|
|
1247
|
+
category: "time-diff",
|
|
1248
|
+
argCount: 2,
|
|
1249
|
+
requiredDateLevel: g.Months,
|
|
1250
|
+
argType: "datetime"
|
|
1251
|
+
},
|
|
1252
|
+
QDIFF: {
|
|
1253
|
+
category: "time-diff",
|
|
1254
|
+
argCount: 2,
|
|
1255
|
+
requiredDateLevel: g.Quarters,
|
|
1256
|
+
argType: "datetime"
|
|
1257
|
+
},
|
|
1258
|
+
YDIFF: {
|
|
1259
|
+
category: "time-diff",
|
|
1260
|
+
argCount: 2,
|
|
1261
|
+
requiredDateLevel: g.Years,
|
|
1262
|
+
argType: "datetime"
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
var vs2 = Object.keys(ye2).filter((e) => ye2[e].category === "time-diff");
|
|
1266
|
+
function qt() {
|
|
1267
|
+
return vs2;
|
|
1268
|
+
}
|
|
1269
|
+
function At(e) {
|
|
1270
|
+
const t = ye2[e.toUpperCase()];
|
|
1271
|
+
return t == null ? undefined : t.requiredDateLevel;
|
|
1272
|
+
}
|
|
1273
|
+
var Ns = /\[(\w[\w.-]*)\]/g;
|
|
1274
|
+
var Ct2 = /* @__PURE__ */ new Set([
|
|
1275
|
+
"AVG",
|
|
1276
|
+
"COUNT",
|
|
1277
|
+
"DUPCOUNT",
|
|
1278
|
+
"LARGEST",
|
|
1279
|
+
"MAX",
|
|
1280
|
+
"MEDIAN",
|
|
1281
|
+
"MIN",
|
|
1282
|
+
"MODE",
|
|
1283
|
+
"SUM",
|
|
1284
|
+
"WTDAVG",
|
|
1285
|
+
"WTDSUM",
|
|
1286
|
+
"MTDAVG",
|
|
1287
|
+
"MTDSUM",
|
|
1288
|
+
"QTDAVG",
|
|
1289
|
+
"QTDSUM",
|
|
1290
|
+
"YTDAVG",
|
|
1291
|
+
"YTDSUM",
|
|
1292
|
+
"CORREL",
|
|
1293
|
+
"COVARP",
|
|
1294
|
+
"COVAR",
|
|
1295
|
+
"SKEWP",
|
|
1296
|
+
"SKEW",
|
|
1297
|
+
"SLOPE"
|
|
1298
|
+
]);
|
|
1299
|
+
var Rs = new RegExp(`\\b(${Array.from(Ct2).join("|")})\\s*\\(`, "i");
|
|
1300
|
+
function Et(e) {
|
|
1301
|
+
return E3(e) ? true : typeof e == "string" && e.startsWith(q3) ? false : T2(e) && ("kind" in e) ? e.kind === "measure" : true;
|
|
1302
|
+
}
|
|
1303
|
+
function Is(e) {
|
|
1304
|
+
const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set;
|
|
1305
|
+
let s;
|
|
1306
|
+
for (;(s = t.exec(e)) !== null; ) {
|
|
1307
|
+
const n = s[1];
|
|
1308
|
+
Ct2.has(n.toUpperCase()) || r.add(n);
|
|
1309
|
+
}
|
|
1310
|
+
return Array.from(r);
|
|
1311
|
+
}
|
|
1312
|
+
function ks(e) {
|
|
1313
|
+
return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
|
|
1314
|
+
}
|
|
1315
|
+
function Bs(e) {
|
|
1316
|
+
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1317
|
+
}
|
|
1318
|
+
var j2 = (e) => e.startsWith("[") ? e : `[${e}]`;
|
|
1319
|
+
var xt = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1320
|
+
function $t(e, t) {
|
|
1321
|
+
if (t.length === 0)
|
|
1322
|
+
return [];
|
|
1323
|
+
const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`, "gi");
|
|
1324
|
+
return [...e.matchAll(s)].map((n) => ({
|
|
1325
|
+
functionName: n[1].toUpperCase(),
|
|
1326
|
+
ref1: n[2].trim(),
|
|
1327
|
+
ref2: n[3].trim()
|
|
1328
|
+
}));
|
|
1329
|
+
}
|
|
1330
|
+
function zs(e, t, r) {
|
|
1331
|
+
var o, a, u;
|
|
1332
|
+
const s = Object.keys(t), n = ((o = r.errorPrefix) != null ? o : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
|
|
1333
|
+
return {
|
|
1334
|
+
formula: e,
|
|
1335
|
+
context: t,
|
|
1336
|
+
contextKeys: s,
|
|
1337
|
+
canonicalContextKeys: new Set(s.map(j2)),
|
|
1338
|
+
errorPrefix: i,
|
|
1339
|
+
warnUnusedContext: (a = r.warnUnusedContext) != null ? a : true,
|
|
1340
|
+
errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : true,
|
|
1341
|
+
schemaIndex: r.schemaIndex,
|
|
1342
|
+
result: { isValid: true, errors: [], warnings: [], references: [], unusedContextKeys: [] }
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
function N2(e, t) {
|
|
1346
|
+
e.result.errors.push(t), e.result.isValid = false;
|
|
1347
|
+
}
|
|
1348
|
+
var Ps = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
|
|
1349
|
+
function Ls(e) {
|
|
1350
|
+
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find((s) => !Ps.has(s[1].toUpperCase()));
|
|
1351
|
+
r && N2(e, `${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`);
|
|
1352
|
+
}
|
|
1353
|
+
function _s(e) {
|
|
1354
|
+
return [
|
|
1355
|
+
...new Set([...e.matchAll(new RegExp(Ns.source, "g"))].map((t) => t[1]))
|
|
1356
|
+
];
|
|
1357
|
+
}
|
|
1358
|
+
function Us(e) {
|
|
1359
|
+
const t = e.result.references.filter((n) => !e.canonicalContextKeys.has(j2(n)));
|
|
1360
|
+
if (t.length === 0)
|
|
1361
|
+
return;
|
|
1362
|
+
const r = e.contextKeys.map((n) => `[${xt(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
|
|
1363
|
+
N2(e, `${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`);
|
|
1364
|
+
}
|
|
1365
|
+
function js(e) {
|
|
1366
|
+
if (Rs.test(e.formula))
|
|
1367
|
+
return;
|
|
1368
|
+
const t = e.result.references.filter((r) => {
|
|
1369
|
+
var n;
|
|
1370
|
+
const s = (n = e.context[j2(r)]) != null ? n : e.context[r];
|
|
1371
|
+
return s !== undefined && !Et(s);
|
|
1372
|
+
});
|
|
1373
|
+
t.length !== 0 && N2(e, `${e.errorPrefix}args[1]: ${Bs(Is(e.formula))}Bracket reference(s) ${ks(t)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`);
|
|
1374
|
+
}
|
|
1375
|
+
function Vs(e) {
|
|
1376
|
+
if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0)
|
|
1377
|
+
return;
|
|
1378
|
+
const t = new Set(e.result.references.map(j2)), r = e.contextKeys.filter((i) => !t.has(j2(i)));
|
|
1379
|
+
if (e.result.unusedContextKeys = r, r.length === 0)
|
|
1380
|
+
return;
|
|
1381
|
+
const s = r.map((i) => `[${xt(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
|
|
1382
|
+
e.errorOnUnusedContext ? N2(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
|
|
1383
|
+
}
|
|
1384
|
+
function We(e, t, r, s) {
|
|
1385
|
+
var o;
|
|
1386
|
+
const n = (o = s.context[j2(e)]) != null ? o : s.context[e];
|
|
1387
|
+
if (n === undefined)
|
|
1388
|
+
return;
|
|
1389
|
+
if (!(typeof n == "string" && n.startsWith(q3))) {
|
|
1390
|
+
Et(n) && N2(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${q3}Table.Column.Level).`);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
if (s.schemaIndex)
|
|
1394
|
+
try {
|
|
1395
|
+
const a = $e(n, s.schemaIndex);
|
|
1396
|
+
Rn(a.column.dataType) ? r && a.level && a.level !== r && N2(s, `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${a.level}'.`) : N2(s, `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${a.column.name}'.`);
|
|
1397
|
+
} catch (a) {
|
|
1398
|
+
const u = a instanceof Error ? a.message : "Unknown error";
|
|
1399
|
+
N2(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
function Ws(e) {
|
|
1403
|
+
const t = qt(), r = $t(e.formula, t);
|
|
1404
|
+
for (const s of r) {
|
|
1405
|
+
const n = At(s.functionName);
|
|
1406
|
+
We(s.ref1, s, n, e), We(s.ref2, s, n, e);
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
function Ks(e, t, r = {}) {
|
|
1410
|
+
var n;
|
|
1411
|
+
const s = zs(e, t, r);
|
|
1412
|
+
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || N2(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Ls(s), s.result.references = _s(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 ? (N2(s, `${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`), s.result) : (Us(s), js(s), Vs(s), Ws(s), s.result));
|
|
1413
|
+
}
|
|
1414
|
+
function Js(e, t, r = {}) {
|
|
1415
|
+
const s = Ks(e, t, r);
|
|
1416
|
+
if (!s.isValid)
|
|
1417
|
+
throw new Error(s.errors.join("; "));
|
|
1418
|
+
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1419
|
+
}
|
|
1420
|
+
function Ys(e, t) {
|
|
1421
|
+
if (e.length < 3 || e.length > 5)
|
|
1422
|
+
throw new Error(`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`);
|
|
1423
|
+
const r = e[1];
|
|
1424
|
+
if (typeof r != "string")
|
|
1425
|
+
throw new Error(`${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`);
|
|
1426
|
+
const s = r, n = e[2];
|
|
1427
|
+
if (!T2(n))
|
|
1428
|
+
throw new Error(`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`);
|
|
1429
|
+
const i = n;
|
|
1430
|
+
Js(s, i, {
|
|
1431
|
+
errorPrefix: `${t.pathPrefix}`,
|
|
1432
|
+
errorOnUnusedContext: true,
|
|
1433
|
+
allowEmptyFormula: false,
|
|
1434
|
+
schemaIndex: t.schemaIndex
|
|
1435
|
+
});
|
|
1436
|
+
const o = Gs(s), a = {};
|
|
1437
|
+
for (const [u, c] of Object.entries(i)) {
|
|
1438
|
+
const m2 = `args[2].${u}`;
|
|
1439
|
+
if (E3(c))
|
|
1440
|
+
a[`${u}`] = S2({
|
|
1441
|
+
data: c,
|
|
1442
|
+
context: {
|
|
1443
|
+
dataSource: t.dataSource,
|
|
1444
|
+
schemaIndex: t.schemaIndex,
|
|
1445
|
+
pathPrefix: m2
|
|
1446
|
+
}
|
|
1447
|
+
});
|
|
1448
|
+
else if (typeof c == "string" && c.startsWith(q3)) {
|
|
1449
|
+
const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, f2 = o[l];
|
|
1450
|
+
try {
|
|
1451
|
+
a[`${u}`] = G(c, t.dataSource, t.schemaIndex, f2 !== undefined ? { inferredDateLevel: f2 } : undefined);
|
|
1452
|
+
} catch (h2) {
|
|
1453
|
+
const p2 = h2 instanceof Error ? h2.message : "Unknown error";
|
|
1454
|
+
throw new Error(`${m2}: ${p2}`);
|
|
1455
|
+
}
|
|
1456
|
+
} else if (c && typeof c == "object" && "kind" in c)
|
|
1457
|
+
a[`${u}`] = c;
|
|
1458
|
+
else
|
|
1459
|
+
throw new Error(`${m2}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${q3}...), but got: ${typeof c}`);
|
|
1460
|
+
}
|
|
1461
|
+
e[2] = a;
|
|
1462
|
+
}
|
|
1463
|
+
function Gs(e) {
|
|
1464
|
+
const t = qt(), r = $t(e, t), s = {};
|
|
1465
|
+
for (const n of r) {
|
|
1466
|
+
const i = At(n.functionName);
|
|
1467
|
+
if (i !== undefined)
|
|
1468
|
+
for (const o of [n.ref1, n.ref2]) {
|
|
1469
|
+
const a = s[o];
|
|
1470
|
+
if (a !== undefined && a !== i)
|
|
1471
|
+
throw new Error(`Reference [${o}] is used in time-diff functions with conflicting date levels ('${a}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`);
|
|
1472
|
+
s[o] = i;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
return s;
|
|
1476
|
+
}
|
|
1477
|
+
function Tt(e) {
|
|
1478
|
+
return e.type === E.TextAttribute;
|
|
1479
|
+
}
|
|
1480
|
+
function Dt(e) {
|
|
1481
|
+
return e.type === E.NumericAttribute;
|
|
1482
|
+
}
|
|
1483
|
+
function Qs(e) {
|
|
1484
|
+
return e.type === E.DateLevel;
|
|
1485
|
+
}
|
|
1486
|
+
function Hs(e) {
|
|
1487
|
+
return Tt(e) || Dt(e);
|
|
1488
|
+
}
|
|
1489
|
+
function ie(e) {
|
|
1490
|
+
return e.type === E.TextAttribute ? "text" : e.type === E.NumericAttribute ? "numeric" : e.type === E.DateLevel ? "date/datetime" : "unknown";
|
|
1491
|
+
}
|
|
1492
|
+
function De(e, t) {
|
|
1493
|
+
const r = e[0];
|
|
1494
|
+
if (!r || typeof r != "object" || !("type" in r))
|
|
1495
|
+
throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1496
|
+
return r;
|
|
1497
|
+
}
|
|
1498
|
+
function Ke2(e, t) {
|
|
1499
|
+
const r = De(e, t);
|
|
1500
|
+
if (!Hs(r))
|
|
1501
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ie(r)} attribute`);
|
|
1502
|
+
}
|
|
1503
|
+
function I(e, t) {
|
|
1504
|
+
const r = De(e, t);
|
|
1505
|
+
if (!Dt(r))
|
|
1506
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ie(r)} attribute`);
|
|
1507
|
+
}
|
|
1508
|
+
function k(e, t) {
|
|
1509
|
+
const r = De(e, t);
|
|
1510
|
+
if (!Tt(r))
|
|
1511
|
+
throw new Error(`${t.pathPrefix}args[0]: Attribute must be string type, got ${ie(r)} attribute`);
|
|
1512
|
+
}
|
|
1513
|
+
function Xs(e, t) {
|
|
1514
|
+
const r = e[0];
|
|
1515
|
+
if (!r || typeof r != "object" || !("attribute" in r))
|
|
1516
|
+
throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1517
|
+
return r;
|
|
1518
|
+
}
|
|
1519
|
+
function Zs(e, t) {
|
|
1520
|
+
const r = Xs(e, t);
|
|
1521
|
+
if (!ap(r))
|
|
1522
|
+
throw new Error(`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`);
|
|
1523
|
+
}
|
|
1524
|
+
var en = {
|
|
1525
|
+
"measureFactory.customFormula": Ys,
|
|
1526
|
+
"filterFactory.equals": Ke2,
|
|
1527
|
+
"filterFactory.doesntEqual": Ke2,
|
|
1528
|
+
"filterFactory.greaterThan": I,
|
|
1529
|
+
"filterFactory.greaterThanOrEqual": I,
|
|
1530
|
+
"filterFactory.lessThan": I,
|
|
1531
|
+
"filterFactory.lessThanOrEqual": I,
|
|
1532
|
+
"filterFactory.between": I,
|
|
1533
|
+
"filterFactory.betweenNotEqual": I,
|
|
1534
|
+
"filterFactory.numeric": I,
|
|
1535
|
+
"filterFactory.contains": k,
|
|
1536
|
+
"filterFactory.doesntContain": k,
|
|
1537
|
+
"filterFactory.startsWith": k,
|
|
1538
|
+
"filterFactory.doesntStartWith": k,
|
|
1539
|
+
"filterFactory.endsWith": k,
|
|
1540
|
+
"filterFactory.doesntEndWith": k,
|
|
1541
|
+
"filterFactory.like": k,
|
|
1542
|
+
"filterFactory.exclude": Zs
|
|
1543
|
+
};
|
|
1544
|
+
function tn(e) {
|
|
1545
|
+
return en[`${e}`];
|
|
1546
|
+
}
|
|
1547
|
+
var St = {
|
|
1548
|
+
"measureFactory.sum": [
|
|
1549
|
+
{ type: "Attribute", required: true },
|
|
1550
|
+
{ type: "string", required: false },
|
|
1551
|
+
{ type: "string", required: false }
|
|
1552
|
+
],
|
|
1553
|
+
"measureFactory.average": [
|
|
1554
|
+
{ type: "Attribute", required: true },
|
|
1555
|
+
{ type: "string", required: false },
|
|
1556
|
+
{ type: "string", required: false }
|
|
1557
|
+
],
|
|
1558
|
+
"measureFactory.avg": [
|
|
1559
|
+
{ type: "Attribute", required: true },
|
|
1560
|
+
{ type: "string", required: false },
|
|
1561
|
+
{ type: "string", required: false }
|
|
1562
|
+
],
|
|
1563
|
+
"measureFactory.min": [
|
|
1564
|
+
{ type: "Attribute", required: true },
|
|
1565
|
+
{ type: "string", required: false },
|
|
1566
|
+
{ type: "string", required: false }
|
|
1567
|
+
],
|
|
1568
|
+
"measureFactory.max": [
|
|
1569
|
+
{ type: "Attribute", required: true },
|
|
1570
|
+
{ type: "string", required: false },
|
|
1571
|
+
{ type: "string", required: false }
|
|
1572
|
+
],
|
|
1573
|
+
"measureFactory.median": [
|
|
1574
|
+
{ type: "Attribute", required: true },
|
|
1575
|
+
{ type: "string", required: false },
|
|
1576
|
+
{ type: "string", required: false }
|
|
1577
|
+
],
|
|
1578
|
+
"measureFactory.count": [
|
|
1579
|
+
{ type: "Attribute", required: true },
|
|
1580
|
+
{ type: "string", required: false },
|
|
1581
|
+
{ type: "string", required: false }
|
|
1582
|
+
],
|
|
1583
|
+
"measureFactory.countDistinct": [
|
|
1584
|
+
{ type: "Attribute", required: true },
|
|
1585
|
+
{ type: "string", required: false },
|
|
1586
|
+
{ type: "string", required: false }
|
|
1587
|
+
],
|
|
1588
|
+
"measureFactory.aggregate": [
|
|
1589
|
+
{ type: "Attribute", required: true },
|
|
1590
|
+
{ type: "string", required: true },
|
|
1591
|
+
{ type: "string", required: false },
|
|
1592
|
+
{ type: "string", required: false }
|
|
1593
|
+
],
|
|
1594
|
+
"measureFactory.constant": [{ type: "number", required: true }],
|
|
1595
|
+
"measureFactory.customFormula": [
|
|
1596
|
+
{ type: "string", required: true },
|
|
1597
|
+
{ type: "string", required: true },
|
|
1598
|
+
{ type: "CustomFormulaContext", required: true },
|
|
1599
|
+
{ type: "string", required: false },
|
|
1600
|
+
{ type: "string", required: false }
|
|
1601
|
+
],
|
|
1602
|
+
"measureFactory.add": [
|
|
1603
|
+
{ type: "Measure | number", required: true },
|
|
1604
|
+
{ type: "Measure | number", required: true },
|
|
1605
|
+
{ type: "string", required: false },
|
|
1606
|
+
{ type: "boolean", required: false }
|
|
1607
|
+
],
|
|
1608
|
+
"measureFactory.subtract": [
|
|
1609
|
+
{ type: "Measure | number", required: true },
|
|
1610
|
+
{ type: "Measure | number", required: true },
|
|
1611
|
+
{ type: "string", required: false },
|
|
1612
|
+
{ type: "boolean", required: false }
|
|
1613
|
+
],
|
|
1614
|
+
"measureFactory.multiply": [
|
|
1615
|
+
{ type: "Measure | number", required: true },
|
|
1616
|
+
{ type: "Measure | number", required: true },
|
|
1617
|
+
{ type: "string", required: false },
|
|
1618
|
+
{ type: "boolean", required: false }
|
|
1619
|
+
],
|
|
1620
|
+
"measureFactory.divide": [
|
|
1621
|
+
{ type: "Measure | number", required: true },
|
|
1622
|
+
{ type: "Measure | number", required: true },
|
|
1623
|
+
{ type: "string", required: false },
|
|
1624
|
+
{ type: "boolean", required: false }
|
|
1625
|
+
],
|
|
1626
|
+
"measureFactory.measuredValue": [
|
|
1627
|
+
{ type: "Measure", required: true },
|
|
1628
|
+
{ type: "Filter[]", required: true },
|
|
1629
|
+
{ type: "string", required: false },
|
|
1630
|
+
{ type: "string", required: false }
|
|
1631
|
+
],
|
|
1632
|
+
"measureFactory.rank": [
|
|
1633
|
+
{ type: "Measure", required: true },
|
|
1634
|
+
{ type: "string", required: false },
|
|
1635
|
+
{ type: "string", required: false },
|
|
1636
|
+
{ type: "string", required: false },
|
|
1637
|
+
{ type: "Attribute[]", required: false }
|
|
1638
|
+
],
|
|
1639
|
+
"measureFactory.trend": [
|
|
1640
|
+
{ type: "Measure", required: true },
|
|
1641
|
+
{ type: "string", required: false },
|
|
1642
|
+
{ type: "any", required: false }
|
|
1643
|
+
],
|
|
1644
|
+
"measureFactory.forecast": [
|
|
1645
|
+
{ type: "Measure", required: true },
|
|
1646
|
+
{ type: "string", required: false },
|
|
1647
|
+
{ type: "any", required: false }
|
|
1648
|
+
],
|
|
1649
|
+
"measureFactory.yearToDateSum": [
|
|
1650
|
+
{ type: "Measure", required: true },
|
|
1651
|
+
{ type: "string", required: false }
|
|
1652
|
+
],
|
|
1653
|
+
"measureFactory.quarterToDateSum": [
|
|
1654
|
+
{ type: "Measure", required: true },
|
|
1655
|
+
{ type: "string", required: false }
|
|
1656
|
+
],
|
|
1657
|
+
"measureFactory.monthToDateSum": [
|
|
1658
|
+
{ type: "Measure", required: true },
|
|
1659
|
+
{ type: "string", required: false }
|
|
1660
|
+
],
|
|
1661
|
+
"measureFactory.weekToDateSum": [
|
|
1662
|
+
{ type: "Measure", required: true },
|
|
1663
|
+
{ type: "string", required: false }
|
|
1664
|
+
],
|
|
1665
|
+
"measureFactory.runningSum": [
|
|
1666
|
+
{ type: "Measure", required: true },
|
|
1667
|
+
{ type: "boolean", required: false },
|
|
1668
|
+
{ type: "string", required: false }
|
|
1669
|
+
],
|
|
1670
|
+
"measureFactory.growth": [
|
|
1671
|
+
{ type: "Measure", required: true },
|
|
1672
|
+
{ type: "string", required: false }
|
|
1673
|
+
],
|
|
1674
|
+
"measureFactory.growthRate": [
|
|
1675
|
+
{ type: "Measure", required: true },
|
|
1676
|
+
{ type: "string", required: false }
|
|
1677
|
+
],
|
|
1678
|
+
"measureFactory.growthPastWeek": [
|
|
1679
|
+
{ type: "Measure", required: true },
|
|
1680
|
+
{ type: "string", required: false }
|
|
1681
|
+
],
|
|
1682
|
+
"measureFactory.growthPastMonth": [
|
|
1683
|
+
{ type: "Measure", required: true },
|
|
1684
|
+
{ type: "string", required: false }
|
|
1685
|
+
],
|
|
1686
|
+
"measureFactory.growthPastQuarter": [
|
|
1687
|
+
{ type: "Measure", required: true },
|
|
1688
|
+
{ type: "string", required: false }
|
|
1689
|
+
],
|
|
1690
|
+
"measureFactory.growthPastYear": [
|
|
1691
|
+
{ type: "Measure", required: true },
|
|
1692
|
+
{ type: "string", required: false }
|
|
1693
|
+
],
|
|
1694
|
+
"measureFactory.difference": [
|
|
1695
|
+
{ type: "Measure", required: true },
|
|
1696
|
+
{ type: "string", required: false }
|
|
1697
|
+
],
|
|
1698
|
+
"measureFactory.diffPastWeek": [
|
|
1699
|
+
{ type: "Measure", required: true },
|
|
1700
|
+
{ type: "string", required: false }
|
|
1701
|
+
],
|
|
1702
|
+
"measureFactory.diffPastMonth": [
|
|
1703
|
+
{ type: "Measure", required: true },
|
|
1704
|
+
{ type: "string", required: false }
|
|
1705
|
+
],
|
|
1706
|
+
"measureFactory.diffPastQuarter": [
|
|
1707
|
+
{ type: "Measure", required: true },
|
|
1708
|
+
{ type: "string", required: false }
|
|
1709
|
+
],
|
|
1710
|
+
"measureFactory.diffPastYear": [
|
|
1711
|
+
{ type: "Measure", required: true },
|
|
1712
|
+
{ type: "string", required: false }
|
|
1713
|
+
],
|
|
1714
|
+
"measureFactory.pastDay": [
|
|
1715
|
+
{ type: "Measure", required: true },
|
|
1716
|
+
{ type: "string", required: false }
|
|
1717
|
+
],
|
|
1718
|
+
"measureFactory.pastWeek": [
|
|
1719
|
+
{ type: "Measure", required: true },
|
|
1720
|
+
{ type: "string", required: false }
|
|
1721
|
+
],
|
|
1722
|
+
"measureFactory.pastMonth": [
|
|
1723
|
+
{ type: "Measure", required: true },
|
|
1724
|
+
{ type: "string", required: false }
|
|
1725
|
+
],
|
|
1726
|
+
"measureFactory.pastQuarter": [
|
|
1727
|
+
{ type: "Measure", required: true },
|
|
1728
|
+
{ type: "string", required: false }
|
|
1729
|
+
],
|
|
1730
|
+
"measureFactory.pastYear": [
|
|
1731
|
+
{ type: "Measure", required: true },
|
|
1732
|
+
{ type: "string", required: false }
|
|
1733
|
+
],
|
|
1734
|
+
"measureFactory.contribution": [
|
|
1735
|
+
{ type: "Measure", required: true },
|
|
1736
|
+
{ type: "string", required: false }
|
|
1737
|
+
],
|
|
1738
|
+
"filterFactory.union": [
|
|
1739
|
+
{ type: "Filter[]", required: true },
|
|
1740
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1741
|
+
],
|
|
1742
|
+
"filterFactory.intersection": [
|
|
1743
|
+
{ type: "Filter[]", required: true },
|
|
1744
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1745
|
+
],
|
|
1746
|
+
"filterFactory.exclude": [
|
|
1747
|
+
{ type: "Filter", required: true },
|
|
1748
|
+
{ type: "Filter", required: false },
|
|
1749
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1750
|
+
],
|
|
1751
|
+
"filterFactory.contains": [
|
|
1752
|
+
{ type: "Attribute", required: true },
|
|
1753
|
+
{ type: "string", required: true },
|
|
1754
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1755
|
+
],
|
|
1756
|
+
"filterFactory.doesntContain": [
|
|
1757
|
+
{ type: "Attribute", required: true },
|
|
1758
|
+
{ type: "string", required: true },
|
|
1759
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1760
|
+
],
|
|
1761
|
+
"filterFactory.startsWith": [
|
|
1762
|
+
{ type: "Attribute", required: true },
|
|
1763
|
+
{ type: "string", required: true },
|
|
1764
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1765
|
+
],
|
|
1766
|
+
"filterFactory.doesntStartWith": [
|
|
1767
|
+
{ type: "Attribute", required: true },
|
|
1768
|
+
{ type: "string", required: true },
|
|
1769
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1770
|
+
],
|
|
1771
|
+
"filterFactory.endsWith": [
|
|
1772
|
+
{ type: "Attribute", required: true },
|
|
1773
|
+
{ type: "string", required: true },
|
|
1774
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1775
|
+
],
|
|
1776
|
+
"filterFactory.doesntEndWith": [
|
|
1777
|
+
{ type: "Attribute", required: true },
|
|
1778
|
+
{ type: "string", required: true },
|
|
1779
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1780
|
+
],
|
|
1781
|
+
"filterFactory.like": [
|
|
1782
|
+
{ type: "Attribute", required: true },
|
|
1783
|
+
{ type: "string", required: true },
|
|
1784
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1785
|
+
],
|
|
1786
|
+
"filterFactory.equals": [
|
|
1787
|
+
{ type: "Attribute", required: true },
|
|
1788
|
+
{ type: "string | number", required: true },
|
|
1789
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1790
|
+
],
|
|
1791
|
+
"filterFactory.doesntEqual": [
|
|
1792
|
+
{ type: "Attribute", required: true },
|
|
1793
|
+
{ type: "string | number", required: true },
|
|
1794
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1795
|
+
],
|
|
1796
|
+
"filterFactory.greaterThan": [
|
|
1797
|
+
{ type: "Attribute", required: true },
|
|
1798
|
+
{ type: "number", required: true },
|
|
1799
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1800
|
+
],
|
|
1801
|
+
"filterFactory.greaterThanOrEqual": [
|
|
1802
|
+
{ type: "Attribute", required: true },
|
|
1803
|
+
{ type: "number", required: true },
|
|
1804
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1805
|
+
],
|
|
1806
|
+
"filterFactory.lessThan": [
|
|
1807
|
+
{ type: "Attribute", required: true },
|
|
1808
|
+
{ type: "number", required: true },
|
|
1809
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1810
|
+
],
|
|
1811
|
+
"filterFactory.lessThanOrEqual": [
|
|
1812
|
+
{ type: "Attribute", required: true },
|
|
1813
|
+
{ type: "number", required: true },
|
|
1814
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1815
|
+
],
|
|
1816
|
+
"filterFactory.between": [
|
|
1817
|
+
{ type: "Attribute", required: true },
|
|
1818
|
+
{ type: "number", required: true },
|
|
1819
|
+
{ type: "number", required: true },
|
|
1820
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1821
|
+
],
|
|
1822
|
+
"filterFactory.betweenNotEqual": [
|
|
1823
|
+
{ type: "Attribute", required: true },
|
|
1824
|
+
{ type: "number", required: true },
|
|
1825
|
+
{ type: "number", required: true },
|
|
1826
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1827
|
+
],
|
|
1828
|
+
"filterFactory.numeric": [
|
|
1829
|
+
{ type: "Attribute", required: true },
|
|
1830
|
+
{ type: "string", required: false },
|
|
1831
|
+
{ type: "number", required: false },
|
|
1832
|
+
{ type: "string", required: false },
|
|
1833
|
+
{ type: "number", required: false },
|
|
1834
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1835
|
+
],
|
|
1836
|
+
"filterFactory.members": [
|
|
1837
|
+
{ type: "Attribute", required: true },
|
|
1838
|
+
{ type: "string[]", required: true },
|
|
1839
|
+
{ type: "MembersFilterConfig", required: false }
|
|
1840
|
+
],
|
|
1841
|
+
"filterFactory.dateFrom": [
|
|
1842
|
+
{ type: "LevelAttribute", required: true },
|
|
1843
|
+
{ type: "Date | string", required: true },
|
|
1844
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1845
|
+
],
|
|
1846
|
+
"filterFactory.dateTo": [
|
|
1847
|
+
{ type: "LevelAttribute", required: true },
|
|
1848
|
+
{ type: "Date | string", required: true },
|
|
1849
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1850
|
+
],
|
|
1851
|
+
"filterFactory.dateRange": [
|
|
1852
|
+
{ type: "LevelAttribute", required: true },
|
|
1853
|
+
{ type: "Date | string", required: false },
|
|
1854
|
+
{ type: "Date | string", required: false },
|
|
1855
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1856
|
+
],
|
|
1857
|
+
"filterFactory.dateRelative": [
|
|
1858
|
+
{ type: "LevelAttribute", required: true },
|
|
1859
|
+
{ type: "number", required: true },
|
|
1860
|
+
{ type: "number", required: true },
|
|
1861
|
+
{ type: "Date | string", required: false },
|
|
1862
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1863
|
+
],
|
|
1864
|
+
"filterFactory.dateRelativeFrom": [
|
|
1865
|
+
{ type: "LevelAttribute", required: true },
|
|
1866
|
+
{ type: "number", required: true },
|
|
1867
|
+
{ type: "number", required: true },
|
|
1868
|
+
{ type: "Date | string", required: false },
|
|
1869
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1870
|
+
],
|
|
1871
|
+
"filterFactory.dateRelativeTo": [
|
|
1872
|
+
{ type: "LevelAttribute", required: true },
|
|
1873
|
+
{ type: "number", required: true },
|
|
1874
|
+
{ type: "number", required: true },
|
|
1875
|
+
{ type: "Date | string", required: false },
|
|
1876
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1877
|
+
],
|
|
1878
|
+
"filterFactory.thisYear": [
|
|
1879
|
+
{ type: "DateDimension", required: true },
|
|
1880
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1881
|
+
],
|
|
1882
|
+
"filterFactory.thisMonth": [
|
|
1883
|
+
{ type: "DateDimension", required: true },
|
|
1884
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1885
|
+
],
|
|
1886
|
+
"filterFactory.thisQuarter": [
|
|
1887
|
+
{ type: "DateDimension", required: true },
|
|
1888
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1889
|
+
],
|
|
1890
|
+
"filterFactory.today": [
|
|
1891
|
+
{ type: "DateDimension", required: true },
|
|
1892
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1893
|
+
],
|
|
1894
|
+
"filterFactory.measureEquals": [
|
|
1895
|
+
{ type: "BaseMeasure", required: true },
|
|
1896
|
+
{ type: "number", required: true },
|
|
1897
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1898
|
+
],
|
|
1899
|
+
"filterFactory.measureGreaterThan": [
|
|
1900
|
+
{ type: "BaseMeasure", required: true },
|
|
1901
|
+
{ type: "number", required: true },
|
|
1902
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1903
|
+
],
|
|
1904
|
+
"filterFactory.measureGreaterThanOrEqual": [
|
|
1905
|
+
{ type: "BaseMeasure", required: true },
|
|
1906
|
+
{ type: "number", required: true },
|
|
1907
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1908
|
+
],
|
|
1909
|
+
"filterFactory.measureLessThan": [
|
|
1910
|
+
{ type: "BaseMeasure", required: true },
|
|
1911
|
+
{ type: "number", required: true },
|
|
1912
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1913
|
+
],
|
|
1914
|
+
"filterFactory.measureLessThanOrEqual": [
|
|
1915
|
+
{ type: "BaseMeasure", required: true },
|
|
1916
|
+
{ type: "number", required: true },
|
|
1917
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1918
|
+
],
|
|
1919
|
+
"filterFactory.measureBetween": [
|
|
1920
|
+
{ type: "BaseMeasure", required: true },
|
|
1921
|
+
{ type: "number", required: true },
|
|
1922
|
+
{ type: "number", required: true },
|
|
1923
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1924
|
+
],
|
|
1925
|
+
"filterFactory.measureBetweenNotEqual": [
|
|
1926
|
+
{ type: "BaseMeasure", required: true },
|
|
1927
|
+
{ type: "number", required: true },
|
|
1928
|
+
{ type: "number", required: true },
|
|
1929
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1930
|
+
],
|
|
1931
|
+
"filterFactory.topRanking": [
|
|
1932
|
+
{ type: "Attribute", required: true },
|
|
1933
|
+
{ type: "Measure", required: true },
|
|
1934
|
+
{ type: "number", required: true },
|
|
1935
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1936
|
+
],
|
|
1937
|
+
"filterFactory.bottomRanking": [
|
|
1938
|
+
{ type: "Attribute", required: true },
|
|
1939
|
+
{ type: "Measure", required: true },
|
|
1940
|
+
{ type: "number", required: true },
|
|
1941
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1942
|
+
],
|
|
1943
|
+
"filterFactory.measureTopRanking": [
|
|
1944
|
+
{ type: "BaseMeasure", required: true },
|
|
1945
|
+
{ type: "number", required: true },
|
|
1946
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1947
|
+
],
|
|
1948
|
+
"filterFactory.measureBottomRanking": [
|
|
1949
|
+
{ type: "BaseMeasure", required: true },
|
|
1950
|
+
{ type: "number", required: true },
|
|
1951
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1952
|
+
],
|
|
1953
|
+
"filterFactory.cascading": [
|
|
1954
|
+
{ type: "Filter[]", required: true },
|
|
1955
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1956
|
+
],
|
|
1957
|
+
"filterFactory.logic.and": [
|
|
1958
|
+
{ type: "FilterRelationsNode", required: true },
|
|
1959
|
+
{ type: "FilterRelationsNode", required: true }
|
|
1960
|
+
],
|
|
1961
|
+
"filterFactory.logic.or": [
|
|
1962
|
+
{ type: "FilterRelationsNode", required: true },
|
|
1963
|
+
{ type: "FilterRelationsNode", required: true }
|
|
1964
|
+
]
|
|
1965
|
+
};
|
|
1966
|
+
function Se2(e) {
|
|
1967
|
+
return St[`${e}`];
|
|
1968
|
+
}
|
|
1969
|
+
function rn(e) {
|
|
1970
|
+
const t = Se2(e);
|
|
1971
|
+
return t ? t.filter((r) => r.required).length : 0;
|
|
1972
|
+
}
|
|
1973
|
+
function sn(e) {
|
|
1974
|
+
const t = Se2(e);
|
|
1975
|
+
return t ? t.length : 0;
|
|
1976
|
+
}
|
|
1977
|
+
function nn(e) {
|
|
1978
|
+
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
1979
|
+
return false;
|
|
1980
|
+
const r = Date.parse(e);
|
|
1981
|
+
if (isNaN(r) || e.length < 10)
|
|
1982
|
+
return false;
|
|
1983
|
+
const s = new Date(e);
|
|
1984
|
+
return !isNaN(s.getTime());
|
|
1985
|
+
}
|
|
1986
|
+
function ce(e, t, r, s) {
|
|
1987
|
+
if (e.startsWith(q3))
|
|
1988
|
+
try {
|
|
1989
|
+
return G(e, t, r);
|
|
1990
|
+
} catch (n) {
|
|
1991
|
+
const i = n instanceof Error ? n.message : "Unknown error";
|
|
1992
|
+
throw new Error(`${s}: ${i}`);
|
|
1993
|
+
}
|
|
1994
|
+
throw new Error(`${s}: Invalid attribute '${e}'. Expected format: '${q3}TableName.ColumnName[.Level]'`);
|
|
1995
|
+
}
|
|
1996
|
+
function on(e, t, r, s) {
|
|
1997
|
+
if (e.startsWith(q3))
|
|
1998
|
+
try {
|
|
1999
|
+
return Es(e, t, r);
|
|
2000
|
+
} catch (n) {
|
|
2001
|
+
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2002
|
+
throw new Error(`${s}: ${i}`);
|
|
2003
|
+
}
|
|
2004
|
+
throw new Error(`${s}: Invalid date dimension string '${e}'. Expected format: '${q3}TableName.ColumnName'`);
|
|
2005
|
+
}
|
|
2006
|
+
function an(e) {
|
|
2007
|
+
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, o = i;
|
|
2008
|
+
if (t === undefined) {
|
|
2009
|
+
if (r.required)
|
|
2010
|
+
throw new Error(`${o}: Required argument is missing (expected ${r.type})`);
|
|
2011
|
+
return;
|
|
2012
|
+
}
|
|
2013
|
+
if (!(t === null && !r.required))
|
|
2014
|
+
switch (r.type) {
|
|
2015
|
+
case "string":
|
|
2016
|
+
if (typeof t != "string")
|
|
2017
|
+
throw new Error(`${o}: Expected string, got ${typeof t}`);
|
|
2018
|
+
return t;
|
|
2019
|
+
case "number":
|
|
2020
|
+
if (typeof t != "number")
|
|
2021
|
+
throw new Error(`${o}: Expected number, got ${typeof t}`);
|
|
2022
|
+
return t;
|
|
2023
|
+
case "boolean":
|
|
2024
|
+
if (typeof t != "boolean")
|
|
2025
|
+
throw new Error(`${o}: Expected boolean, got ${typeof t}`);
|
|
2026
|
+
return t;
|
|
2027
|
+
case "string[]":
|
|
2028
|
+
if (!Array.isArray(t))
|
|
2029
|
+
throw new Error(`${o}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`);
|
|
2030
|
+
if (!t.every((a) => typeof a == "string"))
|
|
2031
|
+
throw new Error(`${o}: Expected array of strings, but contains non-string values`);
|
|
2032
|
+
return t;
|
|
2033
|
+
case "number[]":
|
|
2034
|
+
if (!Array.isArray(t))
|
|
2035
|
+
throw new Error(`${o}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`);
|
|
2036
|
+
if (!t.every((a) => typeof a == "number"))
|
|
2037
|
+
throw new Error(`${o}: Expected array of numbers, but contains non-number values`);
|
|
2038
|
+
return t;
|
|
2039
|
+
case "Attribute":
|
|
2040
|
+
if (typeof t != "string")
|
|
2041
|
+
throw new Error(`${o}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`);
|
|
2042
|
+
return ce(t, s, n, o);
|
|
2043
|
+
case "Attribute[]":
|
|
2044
|
+
if (!Array.isArray(t))
|
|
2045
|
+
throw new Error(`${o}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`);
|
|
2046
|
+
return t.map((a, u) => {
|
|
2047
|
+
if (typeof a != "string")
|
|
2048
|
+
throw new Error(`${o}[${u}]: Expected attribute string, got ${typeof a}`);
|
|
2049
|
+
return ce(a, s, n, `${o}[${u}]`);
|
|
2050
|
+
});
|
|
2051
|
+
case "Measure":
|
|
2052
|
+
case "BaseMeasure":
|
|
2053
|
+
if (!E3(t))
|
|
2054
|
+
throw new Error(`${o}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`);
|
|
2055
|
+
return S2({
|
|
2056
|
+
data: t,
|
|
2057
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2058
|
+
});
|
|
2059
|
+
case "Measure[]":
|
|
2060
|
+
if (!Array.isArray(t))
|
|
2061
|
+
throw new Error(`${o}: Expected array of measure function calls, got ${typeof t}`);
|
|
2062
|
+
return t.map((a, u) => {
|
|
2063
|
+
if (!E3(a))
|
|
2064
|
+
throw new Error(`${o}[${u}]: Expected measure function call, got ${typeof a}`);
|
|
2065
|
+
return S2({
|
|
2066
|
+
data: a,
|
|
2067
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2068
|
+
});
|
|
2069
|
+
});
|
|
2070
|
+
case "Filter":
|
|
2071
|
+
if (!E3(t))
|
|
2072
|
+
throw new Error(`${o}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`);
|
|
2073
|
+
return S2({
|
|
2074
|
+
data: t,
|
|
2075
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2076
|
+
});
|
|
2077
|
+
case "Filter[]":
|
|
2078
|
+
if (!Array.isArray(t))
|
|
2079
|
+
throw new Error(`${o}: Expected array of filter function calls, got ${typeof t}`);
|
|
2080
|
+
return t.map((a, u) => {
|
|
2081
|
+
if (!E3(a))
|
|
2082
|
+
throw new Error(`${o}[${u}]: Expected filter function call, got ${typeof a}`);
|
|
2083
|
+
return S2({
|
|
2084
|
+
data: a,
|
|
2085
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2086
|
+
});
|
|
2087
|
+
});
|
|
2088
|
+
case "FilterRelationsNode":
|
|
2089
|
+
if (Array.isArray(t))
|
|
2090
|
+
return t.map((a, u) => {
|
|
2091
|
+
if (!E3(a))
|
|
2092
|
+
throw new Error(`${o}[${u}]: Expected filter function call, got ${typeof a}`);
|
|
2093
|
+
return S2({
|
|
2094
|
+
data: a,
|
|
2095
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2096
|
+
});
|
|
2097
|
+
});
|
|
2098
|
+
if (E3(t))
|
|
2099
|
+
return S2({
|
|
2100
|
+
data: t,
|
|
2101
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2102
|
+
});
|
|
2103
|
+
throw new Error(`${o}: Expected filter function call or array of filters, got ${typeof t}`);
|
|
2104
|
+
case "DateDimension":
|
|
2105
|
+
if (typeof t != "string")
|
|
2106
|
+
throw new Error(`${o}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`);
|
|
2107
|
+
return on(t, s, n, o);
|
|
2108
|
+
case "LevelAttribute": {
|
|
2109
|
+
if (typeof t != "string")
|
|
2110
|
+
throw new Error(`${o}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`);
|
|
2111
|
+
const a = ce(t, s, n, o);
|
|
2112
|
+
if (!Qs(a))
|
|
2113
|
+
throw new Error(`${o}: Attribute must be date/datetime type, got ${ie(a)} attribute`);
|
|
2114
|
+
return a;
|
|
2115
|
+
}
|
|
2116
|
+
case "Measure | number":
|
|
2117
|
+
if (typeof t == "number")
|
|
2118
|
+
return t;
|
|
2119
|
+
if (E3(t))
|
|
2120
|
+
return S2({
|
|
2121
|
+
data: t,
|
|
2122
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2123
|
+
});
|
|
2124
|
+
throw new Error(`${o}: Expected measure function call or number, got ${typeof t}`);
|
|
2125
|
+
case "Date | string":
|
|
2126
|
+
if (typeof t == "string") {
|
|
2127
|
+
if (nn(t))
|
|
2128
|
+
return t;
|
|
2129
|
+
throw new Error(`${o}: Expected valid ISO date string or Date object, got invalid date string '${t}'`);
|
|
2130
|
+
} else {
|
|
2131
|
+
if (t instanceof Date)
|
|
2132
|
+
return t;
|
|
2133
|
+
throw new Error(`${o}: Expected date string or Date object, got ${typeof t}`);
|
|
2134
|
+
}
|
|
2135
|
+
case "string | number":
|
|
2136
|
+
if (typeof t == "string" || typeof t == "number")
|
|
2137
|
+
return t;
|
|
2138
|
+
throw new Error(`${o}: Expected string or number, got ${typeof t}`);
|
|
2139
|
+
case "BaseFilterConfig":
|
|
2140
|
+
case "MembersFilterConfig":
|
|
2141
|
+
case "CustomFormulaContext":
|
|
2142
|
+
case "any":
|
|
2143
|
+
if (t == null && r.required)
|
|
2144
|
+
throw new Error(`${o}: Required argument is null/undefined`);
|
|
2145
|
+
return t;
|
|
2146
|
+
default:
|
|
2147
|
+
return t;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
function S2(e) {
|
|
2151
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u = Se2(i);
|
|
2152
|
+
if (!u) {
|
|
2153
|
+
const p2 = Object.keys(St), d = M(i, p2, (A) => A), b2 = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
|
|
2154
|
+
throw new Error(`${a}function: Unknown function '${i}'.${b2}`);
|
|
2155
|
+
}
|
|
2156
|
+
const c = rn(i), m2 = sn(i);
|
|
2157
|
+
if (o.length < c)
|
|
2158
|
+
throw new Error(`${a}function: Expected at least ${c} arguments, got ${o.length}`);
|
|
2159
|
+
if (o.length > m2)
|
|
2160
|
+
throw new Error(`${a}function: Expected at most ${m2} arguments, got ${o.length}`);
|
|
2161
|
+
const l = [], f2 = [];
|
|
2162
|
+
for (let p2 = 0;p2 < Math.max(o.length, u.length); p2++) {
|
|
2163
|
+
const d = u[`${p2}`], b2 = o[`${p2}`], A = a ? `${a}args[${p2}]` : `args[${p2}]`;
|
|
2164
|
+
if (b2 === undefined) {
|
|
2165
|
+
d != null && d.required && f2.push(`${A}: Missing required argument (expected ${d.type})`);
|
|
2166
|
+
continue;
|
|
2167
|
+
}
|
|
2168
|
+
if (!d) {
|
|
2169
|
+
f2.push(`${A}: Unexpected argument`);
|
|
2170
|
+
continue;
|
|
2171
|
+
}
|
|
2172
|
+
try {
|
|
2173
|
+
const O = an({
|
|
2174
|
+
data: b2,
|
|
2175
|
+
context: {
|
|
2176
|
+
dataSource: r,
|
|
2177
|
+
schemaIndex: s,
|
|
2178
|
+
pathPrefix: A,
|
|
2179
|
+
argSchema: d
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
l.push(O);
|
|
2183
|
+
} catch (O) {
|
|
2184
|
+
const oe = O instanceof Error ? O.message : "Unknown error";
|
|
2185
|
+
f2.push(oe);
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
if (f2.length > 0) {
|
|
2189
|
+
const p2 = f2.join("; ");
|
|
2190
|
+
throw new Error(p2);
|
|
2191
|
+
}
|
|
2192
|
+
const h2 = tn(i);
|
|
2193
|
+
if (h2)
|
|
2194
|
+
try {
|
|
2195
|
+
h2(l, {
|
|
2196
|
+
dataSource: r,
|
|
2197
|
+
schemaIndex: s,
|
|
2198
|
+
pathPrefix: a
|
|
2199
|
+
});
|
|
2200
|
+
} catch (p2) {
|
|
2201
|
+
const d = p2 instanceof Error ? p2.message : "Unknown validation error";
|
|
2202
|
+
throw new Error(d);
|
|
2203
|
+
}
|
|
2204
|
+
return Ms(i, l);
|
|
2205
|
+
}
|
|
2206
|
+
function Ot(e) {
|
|
2207
|
+
const { attribute: t, config: r } = e;
|
|
2208
|
+
if (ap(e) && Rp(t)) {
|
|
2209
|
+
const { granularity: s } = t, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), i = Fi(r), o = Object.keys(i).length === 0 ? undefined : i;
|
|
2210
|
+
return Ct(t, n, o);
|
|
2211
|
+
}
|
|
2212
|
+
return e;
|
|
2213
|
+
}
|
|
2214
|
+
function un(e) {
|
|
2215
|
+
let t = [];
|
|
2216
|
+
for (const r of e)
|
|
2217
|
+
X2(r) ? t = Mp(r, t) : t = Mp([Ot(r)], t);
|
|
2218
|
+
return t != null ? t : [];
|
|
2219
|
+
}
|
|
2220
|
+
var cn = (e) => {
|
|
2221
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2222
|
+
return t.forEach((o, a) => {
|
|
2223
|
+
const u = {
|
|
2224
|
+
category: "filters",
|
|
2225
|
+
index: a,
|
|
2226
|
+
input: o
|
|
2227
|
+
};
|
|
2228
|
+
try {
|
|
2229
|
+
const c = S2({
|
|
2230
|
+
data: o,
|
|
2231
|
+
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2232
|
+
});
|
|
2233
|
+
!X2(c) && !ne(c) ? i.push(F(g2({}, u), { message: "Invalid filter JSON" })) : n.push(c);
|
|
2234
|
+
} catch (c) {
|
|
2235
|
+
const m2 = c instanceof Error ? c.message : "Unknown error";
|
|
2236
|
+
i.push(F(g2({}, u), { message: m2 }));
|
|
2237
|
+
}
|
|
2238
|
+
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: un(n) };
|
|
2239
|
+
};
|
|
2240
|
+
var Oe2 = (e) => {
|
|
2241
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2242
|
+
return t ? Ft(t) ? cn({
|
|
2243
|
+
data: t,
|
|
2244
|
+
context: { dataSource: r, schemaIndex: s }
|
|
2245
|
+
}) : {
|
|
2246
|
+
success: false,
|
|
2247
|
+
errors: [
|
|
2248
|
+
{
|
|
2249
|
+
category: "filters",
|
|
2250
|
+
index: -1,
|
|
2251
|
+
input: t,
|
|
2252
|
+
message: "Invalid filters JSON. Expected an array of function calls with 'function' and 'args' properties."
|
|
2253
|
+
}
|
|
2254
|
+
]
|
|
2255
|
+
} : { success: true, data: [] };
|
|
2256
|
+
};
|
|
2257
|
+
var ln = (e) => {
|
|
2258
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2259
|
+
return t.forEach((o, a) => {
|
|
2260
|
+
const u = {
|
|
2261
|
+
category: "highlights",
|
|
2262
|
+
index: a,
|
|
2263
|
+
input: o
|
|
2264
|
+
};
|
|
2265
|
+
try {
|
|
2266
|
+
const c = S2({
|
|
2267
|
+
data: o,
|
|
2268
|
+
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2269
|
+
});
|
|
2270
|
+
ne(c) ? n.push(Ot(c)) : i.push(F(g2({}, u), { message: "Invalid filter JSON" }));
|
|
2271
|
+
} catch (c) {
|
|
2272
|
+
const m2 = c instanceof Error ? c.message : "Unknown error";
|
|
2273
|
+
i.push(F(g2({}, u), { message: m2 }));
|
|
2274
|
+
}
|
|
2275
|
+
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
2276
|
+
};
|
|
2277
|
+
var Me = (e) => {
|
|
2278
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2279
|
+
return t ? Ft(t) ? ln({
|
|
2280
|
+
data: t,
|
|
2281
|
+
context: { dataSource: r, schemaIndex: s }
|
|
2282
|
+
}) : {
|
|
2283
|
+
success: false,
|
|
2284
|
+
errors: [
|
|
2285
|
+
{
|
|
2286
|
+
category: "highlights",
|
|
2287
|
+
index: -1,
|
|
2288
|
+
input: t,
|
|
2289
|
+
message: "Invalid highlights JSON. Expected an array of function calls with 'function' and 'args' properties."
|
|
2290
|
+
}
|
|
2291
|
+
]
|
|
2292
|
+
} : { success: true, data: [] };
|
|
2293
|
+
};
|
|
2294
|
+
var fn = (e, t) => {
|
|
2295
|
+
if (e && !Lp(e))
|
|
2296
|
+
return F(g2({}, t), {
|
|
2297
|
+
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
|
|
2298
|
+
});
|
|
2299
|
+
};
|
|
2300
|
+
var dn = (e, t, r) => {
|
|
2301
|
+
const { dataSource: s, schemaIndex: n } = t;
|
|
2302
|
+
try {
|
|
2303
|
+
const i = S2({
|
|
2304
|
+
data: e,
|
|
2305
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2306
|
+
});
|
|
2307
|
+
return Ee(i) ? { success: true, data: i } : {
|
|
2308
|
+
success: false,
|
|
2309
|
+
errors: [F(g2({}, r), { message: "Invalid measure JSON" })]
|
|
2310
|
+
};
|
|
2311
|
+
} catch (i) {
|
|
2312
|
+
const o = i instanceof Error ? i.message : "Unknown error";
|
|
2313
|
+
return {
|
|
2314
|
+
success: false,
|
|
2315
|
+
errors: [F(g2({}, r), { message: o })]
|
|
2316
|
+
};
|
|
2317
|
+
}
|
|
2318
|
+
};
|
|
2319
|
+
var mn = (e, t, r, s) => {
|
|
2320
|
+
const n = S2({
|
|
2321
|
+
data: e.column,
|
|
2322
|
+
context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
|
|
2323
|
+
});
|
|
2324
|
+
if (!Ee(n))
|
|
2325
|
+
return {
|
|
2326
|
+
style: {},
|
|
2327
|
+
error: F(g2({}, s), { message: "Invalid measure JSON" })
|
|
2328
|
+
};
|
|
2329
|
+
const i = fn(e.sortType, s);
|
|
2330
|
+
if (i) {
|
|
2331
|
+
const a = ed(e, "column");
|
|
2332
|
+
return { measure: n, style: a, error: i };
|
|
2333
|
+
}
|
|
2334
|
+
const o = ed(e, "column");
|
|
2335
|
+
return { measure: n, style: o };
|
|
2336
|
+
};
|
|
2337
|
+
var pn = (e, t, r, s) => {
|
|
2338
|
+
if (As(e))
|
|
2339
|
+
return mn(e, t, r, s);
|
|
2340
|
+
if (E3(e)) {
|
|
2341
|
+
const n = dn(e, { dataSource: t, schemaIndex: r }, s);
|
|
2342
|
+
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2343
|
+
}
|
|
2344
|
+
return {
|
|
2345
|
+
error: F(g2({}, s), {
|
|
2346
|
+
message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
|
|
2347
|
+
})
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2350
|
+
var Mt = (e) => {
|
|
2351
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2352
|
+
if (!t)
|
|
2353
|
+
return { success: true, data: [] };
|
|
2354
|
+
if (!Array.isArray(t))
|
|
2355
|
+
return {
|
|
2356
|
+
success: false,
|
|
2357
|
+
errors: [
|
|
2358
|
+
{
|
|
2359
|
+
category: "measures",
|
|
2360
|
+
index: -1,
|
|
2361
|
+
input: t,
|
|
2362
|
+
message: "Invalid measures JSON. Expected an array."
|
|
2363
|
+
}
|
|
2364
|
+
]
|
|
2365
|
+
};
|
|
2366
|
+
const n = [], i = [];
|
|
2367
|
+
return t.forEach((o, a) => {
|
|
2368
|
+
const u = {
|
|
2369
|
+
category: "measures",
|
|
2370
|
+
index: a,
|
|
2371
|
+
input: o
|
|
2372
|
+
};
|
|
2373
|
+
try {
|
|
2374
|
+
const c = pn(o, r, s, u);
|
|
2375
|
+
if (c.error) {
|
|
2376
|
+
i.push(c.error);
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
c.measure && n.push(c.style !== undefined ? { measure: c.measure, style: c.style } : { measure: c.measure });
|
|
2380
|
+
} catch (c) {
|
|
2381
|
+
const m2 = c instanceof Error ? c.message : "Unknown error";
|
|
2382
|
+
i.push(F(g2({}, u), { message: m2 }));
|
|
2383
|
+
}
|
|
2384
|
+
}), i.length > 0 ? { success: false, errors: i } : { success: true, data: n };
|
|
2385
|
+
};
|
|
2386
|
+
function Q(e) {
|
|
2387
|
+
return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(Q) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([t, r]) => [t, Q(r)])) : e;
|
|
2388
|
+
}
|
|
2389
|
+
function w(e, t, r) {
|
|
2390
|
+
const s = e();
|
|
2391
|
+
if (!s.success) {
|
|
2392
|
+
const n = r ? s.errors.map(r) : s.errors;
|
|
2393
|
+
return t.push(...n), null;
|
|
2394
|
+
}
|
|
2395
|
+
return s.data;
|
|
2396
|
+
}
|
|
2397
|
+
var ve = "$trend";
|
|
2398
|
+
var Ne = "$forecast";
|
|
2399
|
+
function yn(e) {
|
|
2400
|
+
return e.map(({ attribute: t, style: r }) => {
|
|
2401
|
+
const s = r == null ? undefined : r.sortType;
|
|
2402
|
+
if (!s)
|
|
2403
|
+
return t;
|
|
2404
|
+
const n = typeof s == "object" ? s.direction : s;
|
|
2405
|
+
return Lp(n) ? t.sort(Ap(n)) : t;
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
function gn(e) {
|
|
2409
|
+
var t, r;
|
|
2410
|
+
return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false;
|
|
2411
|
+
}
|
|
2412
|
+
function hn(e) {
|
|
2413
|
+
var t, r;
|
|
2414
|
+
return (r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false;
|
|
2415
|
+
}
|
|
2416
|
+
function bn(e) {
|
|
2417
|
+
var r, s;
|
|
2418
|
+
const t = [];
|
|
2419
|
+
for (const { measure: n, style: i } of e) {
|
|
2420
|
+
const o = i == null ? undefined : i.sortType, a = o && Lp(o) ? n.sort(Ap(o)) : n;
|
|
2421
|
+
t.push(a), i != null && i.trend && !gn(n) && t.push(Ld(n, `${ve}_${(r = n.name) != null ? r : "Measure"}`, i.trend)), i != null && i.forecast && !hn(n) && t.push(Md(n, `${Ne}_${(s = n.name) != null ? s : "Measure"}`, i.forecast));
|
|
2422
|
+
}
|
|
2423
|
+
return t;
|
|
2424
|
+
}
|
|
2425
|
+
var Jn = (e) => {
|
|
2426
|
+
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = xe(s), i = [], o = w(() => wt({
|
|
2427
|
+
data: t.dimensions || [],
|
|
2428
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2429
|
+
}), i), a = w(() => Mt({
|
|
2430
|
+
data: t.measures || [],
|
|
2431
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2432
|
+
}), i), u = w(() => Oe2({
|
|
2433
|
+
data: t.filters || [],
|
|
2434
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2435
|
+
}), i);
|
|
2436
|
+
let c = null;
|
|
2437
|
+
return t.highlights && (c = w(() => Me({
|
|
2438
|
+
data: t.highlights || [],
|
|
2439
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2440
|
+
}), i)), i.length > 0 ? {
|
|
2441
|
+
success: false,
|
|
2442
|
+
errors: i
|
|
2443
|
+
} : {
|
|
2444
|
+
success: true,
|
|
2445
|
+
data: g2({
|
|
2446
|
+
dataSource: Sp(r),
|
|
2447
|
+
dimensions: o ? yn(o) : [],
|
|
2448
|
+
measures: a ? bn(a) : [],
|
|
2449
|
+
filters: u || []
|
|
2450
|
+
}, c && { highlights: c })
|
|
2451
|
+
};
|
|
2452
|
+
};
|
|
2453
|
+
function Je(e) {
|
|
2454
|
+
return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
|
|
2455
|
+
}
|
|
2456
|
+
function Re(e) {
|
|
2457
|
+
const t = [], r = [];
|
|
2458
|
+
return e.forEach((s, n) => {
|
|
2459
|
+
var l, f2, h2;
|
|
2460
|
+
const i = Je(s) ? s.column : s, o = Je(s) ? s : undefined, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2461
|
+
if (!i.composeCode) {
|
|
2462
|
+
r.push({
|
|
2463
|
+
category: "dimensions",
|
|
2464
|
+
index: n,
|
|
2465
|
+
input: a(),
|
|
2466
|
+
message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2467
|
+
});
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
if (!i.composeCode.startsWith(q3)) {
|
|
2471
|
+
r.push({
|
|
2472
|
+
category: "dimensions",
|
|
2473
|
+
index: n,
|
|
2474
|
+
input: a(),
|
|
2475
|
+
message: `Expected composeCode to start with '${q3}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
|
|
2476
|
+
});
|
|
2477
|
+
return;
|
|
2478
|
+
}
|
|
2479
|
+
const u = (h2 = o != null && o.sortType ? Ap(o.sortType) : undefined) != null ? h2 : ((l = i.getSort) == null ? undefined : l.call(i)) !== undefined && ((f2 = i.getSort) == null ? undefined : f2.call(i)) !== C.None ? i.getSort() : undefined, c = o ? ed(o, "column") : {};
|
|
2480
|
+
if (u !== undefined && u !== C.None || o && Object.keys(c).length > 0) {
|
|
2481
|
+
const p2 = g2(g2({
|
|
2482
|
+
column: i.composeCode
|
|
2483
|
+
}, u !== undefined && u !== C.None && { sortType: Tp(u) }), c);
|
|
2484
|
+
t.push(p2);
|
|
2485
|
+
} else
|
|
2486
|
+
t.push(i.composeCode);
|
|
2487
|
+
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2488
|
+
}
|
|
2489
|
+
function vt(e, t) {
|
|
2490
|
+
const r = [];
|
|
2491
|
+
let s = "", n = 0, i = false, o = null;
|
|
2492
|
+
for (let a = 0;a < e.length; a++) {
|
|
2493
|
+
const u = e[a], c = e[a + 1];
|
|
2494
|
+
if (i) {
|
|
2495
|
+
if (u !== o) {
|
|
2496
|
+
s += u;
|
|
2497
|
+
continue;
|
|
2498
|
+
}
|
|
2499
|
+
if (c === o) {
|
|
2500
|
+
s += u + c, a++;
|
|
2501
|
+
continue;
|
|
2502
|
+
}
|
|
2503
|
+
i = false, o = null, s += u;
|
|
2504
|
+
continue;
|
|
2505
|
+
} else {
|
|
2506
|
+
if (u === "'" || u === '"') {
|
|
2507
|
+
i = true, o = u, s += u;
|
|
2508
|
+
continue;
|
|
2509
|
+
}
|
|
2510
|
+
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
|
|
2511
|
+
r.push(s.trim()), s = "";
|
|
2512
|
+
continue;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
s += u;
|
|
2516
|
+
}
|
|
2517
|
+
return s.trim() && r.push(s.trim()), r;
|
|
2518
|
+
}
|
|
2519
|
+
function Fn(e, t) {
|
|
2520
|
+
let r = 0, s = false, n = null;
|
|
2521
|
+
for (let i = 0;i < e.length; i++) {
|
|
2522
|
+
const o = e[i], a = e[i + 1];
|
|
2523
|
+
if (s) {
|
|
2524
|
+
if (o !== n)
|
|
2525
|
+
continue;
|
|
2526
|
+
if (a === n) {
|
|
2527
|
+
i++;
|
|
2528
|
+
continue;
|
|
2529
|
+
}
|
|
2530
|
+
s = false, n = null;
|
|
2531
|
+
} else {
|
|
2532
|
+
if (o === "'" || o === '"') {
|
|
2533
|
+
s = true, n = o;
|
|
2534
|
+
continue;
|
|
2535
|
+
}
|
|
2536
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0)
|
|
2537
|
+
return i;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
return -1;
|
|
2541
|
+
}
|
|
2542
|
+
function wn2(e) {
|
|
2543
|
+
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
2544
|
+
}
|
|
2545
|
+
function V(e) {
|
|
2546
|
+
if (!e || typeof e != "string")
|
|
2547
|
+
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
|
|
2548
|
+
const t = e.trim();
|
|
2549
|
+
if (!t)
|
|
2550
|
+
throw new Error("Invalid composeCode: empty string");
|
|
2551
|
+
const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
2552
|
+
if (!r)
|
|
2553
|
+
throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
|
|
2554
|
+
const s = r[1], n = r[2], i = Nt2(n);
|
|
2555
|
+
return {
|
|
2556
|
+
function: s,
|
|
2557
|
+
args: i
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
function Nt2(e) {
|
|
2561
|
+
return e.trim() ? vt(e, ",").map(Rt) : [];
|
|
2562
|
+
}
|
|
2563
|
+
function Rt(e) {
|
|
2564
|
+
if (!e)
|
|
2565
|
+
throw new Error("Cannot parse empty argument value");
|
|
2566
|
+
if (e === "null")
|
|
2567
|
+
return null;
|
|
2568
|
+
if (e === "undefined")
|
|
2569
|
+
return;
|
|
2570
|
+
if (e === "true")
|
|
2571
|
+
return true;
|
|
2572
|
+
if (e === "false")
|
|
2573
|
+
return false;
|
|
2574
|
+
if (e.match(/^-?\d+(\.\d+)?$/))
|
|
2575
|
+
return parseFloat(e);
|
|
2576
|
+
if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
|
|
2577
|
+
const r = e[0];
|
|
2578
|
+
return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
|
|
2579
|
+
}
|
|
2580
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
2581
|
+
const r = e.slice(1, -1).trim();
|
|
2582
|
+
if (!r)
|
|
2583
|
+
return [];
|
|
2584
|
+
const s = Nt2(r);
|
|
2585
|
+
return s.every((n) => typeof n == "string"), s;
|
|
2586
|
+
}
|
|
2587
|
+
if (e.startsWith("{") && e.endsWith("}")) {
|
|
2588
|
+
const r = e.slice(1, -1).trim();
|
|
2589
|
+
return r ? An(r) : {};
|
|
2590
|
+
}
|
|
2591
|
+
return e.includes("(") && e.includes(")") ? V(e) : (e.startsWith("DM."), e);
|
|
2592
|
+
}
|
|
2593
|
+
function qn(e) {
|
|
2594
|
+
const t = Fn(e, ":");
|
|
2595
|
+
if (t === -1)
|
|
2596
|
+
throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
|
|
2597
|
+
const r = wn2(e.slice(0, t).trim()), s = Rt(e.slice(t + 1).trim());
|
|
2598
|
+
return [r, s];
|
|
2599
|
+
}
|
|
2600
|
+
function An(e) {
|
|
2601
|
+
if (!e.trim())
|
|
2602
|
+
return {};
|
|
2603
|
+
const t = vt(e, ",").map(qn).filter(([, r]) => r !== null);
|
|
2604
|
+
return Object.fromEntries(t);
|
|
2605
|
+
}
|
|
2606
|
+
var ge = "Unknown error";
|
|
2607
|
+
function Ie(e) {
|
|
2608
|
+
if (!e)
|
|
2609
|
+
return { success: true, data: [] };
|
|
2610
|
+
const t = [];
|
|
2611
|
+
if (Zt(e)) {
|
|
2612
|
+
if (!e.composeCode)
|
|
2613
|
+
return {
|
|
2614
|
+
success: false,
|
|
2615
|
+
errors: [
|
|
2616
|
+
{
|
|
2617
|
+
category: "filters",
|
|
2618
|
+
index: -1,
|
|
2619
|
+
input: e,
|
|
2620
|
+
message: `FilterRelations is missing composeCode. Operator: ${e.operator || "unknown"}`
|
|
2621
|
+
}
|
|
2622
|
+
]
|
|
2623
|
+
};
|
|
2624
|
+
try {
|
|
2625
|
+
return { success: true, data: [V(e.composeCode)] };
|
|
2626
|
+
} catch (s) {
|
|
2627
|
+
const n = s instanceof Error ? s.message : ge;
|
|
2628
|
+
return {
|
|
2629
|
+
success: false,
|
|
2630
|
+
errors: [
|
|
2631
|
+
{
|
|
2632
|
+
category: "filters",
|
|
2633
|
+
index: -1,
|
|
2634
|
+
input: e,
|
|
2635
|
+
message: `Failed to parse composeCode for FilterRelations: ${n}. ComposeCode: '${e.composeCode}'`
|
|
2636
|
+
}
|
|
2637
|
+
]
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
const r = [];
|
|
2642
|
+
return e.forEach((s, n) => {
|
|
2643
|
+
var i;
|
|
2644
|
+
if (!s.composeCode) {
|
|
2645
|
+
t.push({
|
|
2646
|
+
category: "filters",
|
|
2647
|
+
index: n,
|
|
2648
|
+
input: s,
|
|
2649
|
+
message: `Filter at index ${n} (${(i = s.name) != null ? i : "unnamed"}) is missing composeCode`
|
|
2650
|
+
});
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
try {
|
|
2654
|
+
const o = V(s.composeCode);
|
|
2655
|
+
r.push(o);
|
|
2656
|
+
} catch (o) {
|
|
2657
|
+
const a = o instanceof Error ? o.message : ge;
|
|
2658
|
+
t.push({
|
|
2659
|
+
category: "filters",
|
|
2660
|
+
index: n,
|
|
2661
|
+
input: s,
|
|
2662
|
+
message: `Failed to parse composeCode for filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
}), t.length > 0 ? { success: false, errors: t } : { success: true, data: r };
|
|
2666
|
+
}
|
|
2667
|
+
function ke(e) {
|
|
2668
|
+
if (!e)
|
|
2669
|
+
return { success: true, data: [] };
|
|
2670
|
+
const t = [], r = [];
|
|
2671
|
+
return e.forEach((s, n) => {
|
|
2672
|
+
var i;
|
|
2673
|
+
if (!s.composeCode) {
|
|
2674
|
+
r.push({
|
|
2675
|
+
category: "highlights",
|
|
2676
|
+
index: n,
|
|
2677
|
+
input: s,
|
|
2678
|
+
message: `Highlight filter at index ${n} (${(i = s.name) != null ? i : "unnamed"}) is missing composeCode`
|
|
2679
|
+
});
|
|
2680
|
+
return;
|
|
2681
|
+
}
|
|
2682
|
+
try {
|
|
2683
|
+
const o = V(s.composeCode);
|
|
2684
|
+
t.push(o);
|
|
2685
|
+
} catch (o) {
|
|
2686
|
+
const a = o instanceof Error ? o.message : ge;
|
|
2687
|
+
r.push({
|
|
2688
|
+
category: "highlights",
|
|
2689
|
+
index: n,
|
|
2690
|
+
input: s,
|
|
2691
|
+
message: `Failed to parse composeCode for highlight filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2695
|
+
}
|
|
2696
|
+
function Ye(e) {
|
|
2697
|
+
return typeof e == "object" && e !== null && "column" in e && e.column !== undefined;
|
|
2698
|
+
}
|
|
2699
|
+
function Be(e) {
|
|
2700
|
+
const t = [], r = [];
|
|
2701
|
+
return e.forEach((s, n) => {
|
|
2702
|
+
var u, c, m2;
|
|
2703
|
+
const i = Ye(s) ? s.column : s, o = Ye(s) ? s : undefined, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2704
|
+
if (!i.composeCode) {
|
|
2705
|
+
r.push({
|
|
2706
|
+
category: "measures",
|
|
2707
|
+
index: n,
|
|
2708
|
+
input: a(),
|
|
2709
|
+
message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2710
|
+
});
|
|
2711
|
+
return;
|
|
2712
|
+
}
|
|
2713
|
+
try {
|
|
2714
|
+
const l = V(i.composeCode), f2 = (m2 = o != null && o.sortType ? Ap(o.sortType) : undefined) != null ? m2 : ((u = i.getSort) == null ? undefined : u.call(i)) !== undefined && ((c = i.getSort) == null ? undefined : c.call(i)) !== C.None ? i.getSort() : undefined;
|
|
2715
|
+
if (f2 !== undefined && f2 !== C.None || o && Object.keys(ed(o, "column")).length > 0) {
|
|
2716
|
+
const p2 = o ? ed(o, "column") : {}, d = g2(g2({
|
|
2717
|
+
column: l
|
|
2718
|
+
}, f2 !== undefined && f2 !== C.None && { sortType: Tp(f2) }), p2);
|
|
2719
|
+
t.push(d);
|
|
2720
|
+
} else
|
|
2721
|
+
t.push(l);
|
|
2722
|
+
} catch (l) {
|
|
2723
|
+
const f2 = l instanceof Error ? l.message : "Unknown error";
|
|
2724
|
+
r.push({
|
|
2725
|
+
category: "measures",
|
|
2726
|
+
index: n,
|
|
2727
|
+
input: a(),
|
|
2728
|
+
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${f2}. ComposeCode: '${i.composeCode}'`
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
}), r.length > 0 ? { success: false, errors: r } : { success: true, data: t };
|
|
2732
|
+
}
|
|
2733
|
+
function Ge(e) {
|
|
2734
|
+
var t, r, s, n;
|
|
2735
|
+
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.trend")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(ve)) != null ? n : false);
|
|
2736
|
+
}
|
|
2737
|
+
function Qe(e) {
|
|
2738
|
+
var t, r, s, n;
|
|
2739
|
+
return ((r = (t = e.composeCode) == null ? undefined : t.includes("measureFactory.forecast")) != null ? r : false) || ((n = (s = e.name) == null ? undefined : s.startsWith(Ne)) != null ? n : false);
|
|
2740
|
+
}
|
|
2741
|
+
function He(e) {
|
|
2742
|
+
try {
|
|
2743
|
+
const t = V(e.trim());
|
|
2744
|
+
return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : undefined;
|
|
2745
|
+
} catch (t) {
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
function Cn(e) {
|
|
2750
|
+
var s, n, i;
|
|
2751
|
+
if (!(e != null && e.length))
|
|
2752
|
+
return [];
|
|
2753
|
+
const t = /* @__PURE__ */ new Set, r = [];
|
|
2754
|
+
for (let o = 0;o < e.length; o++) {
|
|
2755
|
+
if (t.has(o))
|
|
2756
|
+
continue;
|
|
2757
|
+
const a = e[o];
|
|
2758
|
+
if (Ge(a) || Qe(a)) {
|
|
2759
|
+
r.push(a);
|
|
2760
|
+
continue;
|
|
2761
|
+
}
|
|
2762
|
+
const u = (s = a.name) != null ? s : "Measure", c = `${ve}_${u}`, m2 = `${Ne}_${u}`;
|
|
2763
|
+
let l, f2, h2 = o + 1;
|
|
2764
|
+
if (h2 < e.length && !t.has(h2) && Ge(e[h2]) && e[h2].name === c) {
|
|
2765
|
+
const p2 = (n = e[h2].composeCode) == null ? undefined : n.trim();
|
|
2766
|
+
p2 && (l = He(p2), t.add(h2), h2++);
|
|
2767
|
+
}
|
|
2768
|
+
if (h2 < e.length && !t.has(h2) && Qe(e[h2]) && e[h2].name === m2) {
|
|
2769
|
+
const p2 = (i = e[h2].composeCode) == null ? undefined : i.trim();
|
|
2770
|
+
p2 && (f2 = He(p2), t.add(h2));
|
|
2771
|
+
}
|
|
2772
|
+
l !== undefined || f2 !== undefined ? r.push(g2(g2({
|
|
2773
|
+
column: a
|
|
2774
|
+
}, l && Object.keys(l).length > 0 && { trend: l }), f2 && Object.keys(f2).length > 0 && { forecast: f2 })) : r.push(a);
|
|
2775
|
+
}
|
|
2776
|
+
return r;
|
|
2777
|
+
}
|
|
2778
|
+
function Yn(e) {
|
|
2779
|
+
const t = [], r = w(() => Re(e.dimensions || []), t), s = Cn(e.measures || []), n = w(() => Be(s), t), i = w(() => Ie(e.filters), t);
|
|
2780
|
+
let o = null;
|
|
2781
|
+
if (e.highlights && e.highlights.length > 0 && (o = w(() => ke(e.highlights), t)), t.length > 0)
|
|
2782
|
+
return {
|
|
2783
|
+
success: false,
|
|
2784
|
+
errors: t
|
|
2785
|
+
};
|
|
2786
|
+
const a = g2({
|
|
2787
|
+
dimensions: r || [],
|
|
2788
|
+
measures: n || [],
|
|
2789
|
+
filters: i || []
|
|
2790
|
+
}, o && { highlights: o });
|
|
2791
|
+
return {
|
|
2792
|
+
success: true,
|
|
2793
|
+
data: Q(a)
|
|
2794
|
+
};
|
|
2795
|
+
}
|
|
2796
|
+
var It = new Set(Xp.filter((e) => e !== "image"));
|
|
2797
|
+
var Xe = Object.freeze([...It]);
|
|
2798
|
+
function _n(e) {
|
|
2799
|
+
const { filters: t, relations: r } = bp(e.filters || []);
|
|
2800
|
+
return {
|
|
2801
|
+
dataSource: e.dataSource,
|
|
2802
|
+
dimensions: e.dimensions,
|
|
2803
|
+
measures: e.measures,
|
|
2804
|
+
filters: t,
|
|
2805
|
+
filterRelations: r,
|
|
2806
|
+
highlights: e.highlights
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
function Zn(e, t, r = false) {
|
|
2810
|
+
const s = _n(e), n = jn(s, t);
|
|
2811
|
+
return Dh(n, r);
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
export { y, N, q, Kn, Jn, Yn, Zn };
|