@sisense/mcp-server 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +35 -0
- package/README.md +121 -0
- package/dist/ai-hspmgr2c.js +3148 -0
- package/dist/fileFromPath-s6ap5vrh.js +128 -0
- package/dist/index-29n08mw7.js +95 -0
- package/dist/index-atgbxy7h.js +98603 -0
- package/dist/index-d6843g0v.js +372 -0
- package/dist/index-dcrjg3fk.js +207 -0
- package/dist/index-dxfb3krz.js +1489 -0
- package/dist/index-er0yspcy.js +918 -0
- package/dist/index-g8bgq79c.js +53 -0
- package/dist/index-p1pxtmwn.js +162 -0
- package/dist/index-qdth51hx.js +250 -0
- package/dist/index-tqba2rwh.js +603 -0
- package/dist/index-vrapm0b4.js +765 -0
- package/dist/index-vx54d05h.js +475 -0
- package/dist/sse-server-3343e7xh.js +117 -0
- package/dist/sse-server-36t17nga.js +12127 -0
- package/dist/sse-server-3e0efmg2.js +6276 -0
- package/dist/sse-server-4b60tg0c.js +136 -0
- package/dist/sse-server-4g9za0qq.js +89 -0
- package/dist/sse-server-4jjec4fz.js +9753 -0
- package/dist/sse-server-5tmgacdx.js +62 -0
- package/dist/sse-server-7wcvyxyj.js +31 -0
- package/dist/sse-server-brx9qtyd.js +2131 -0
- package/dist/sse-server-epd916s3.js +167 -0
- package/dist/sse-server-gt7tx6n2.js +2240 -0
- package/dist/sse-server-mkesh468.js +53 -0
- package/dist/sse-server-nwjjjz6x.js +113 -0
- package/dist/sse-server-qj4zxq0f.js +267 -0
- package/dist/sse-server-rr3dp62e.js +116721 -0
- package/dist/sse-server-ss0mydv4.js +3980 -0
- package/dist/sse-server-txz5g5t0.js +5328 -0
- package/dist/sse-server.js +30432 -0
- package/dist/view.html +3016 -0
- package/dist/widget-renderer-66ws3xtk.js +312 -0
- package/package.json +82 -0
|
@@ -0,0 +1,2131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$r,
|
|
3
|
+
Bi,
|
|
4
|
+
Cd,
|
|
5
|
+
Cr,
|
|
6
|
+
Ct,
|
|
7
|
+
E,
|
|
8
|
+
Fi,
|
|
9
|
+
Gh,
|
|
10
|
+
Hi,
|
|
11
|
+
Jh,
|
|
12
|
+
Kh,
|
|
13
|
+
L,
|
|
14
|
+
Ld,
|
|
15
|
+
Md,
|
|
16
|
+
Nd,
|
|
17
|
+
Nr,
|
|
18
|
+
Nt,
|
|
19
|
+
Qe,
|
|
20
|
+
Qh,
|
|
21
|
+
Qt,
|
|
22
|
+
Rd,
|
|
23
|
+
Ri,
|
|
24
|
+
Se,
|
|
25
|
+
Sh,
|
|
26
|
+
Vh,
|
|
27
|
+
Wh,
|
|
28
|
+
Xh,
|
|
29
|
+
Y,
|
|
30
|
+
Yh,
|
|
31
|
+
Z,
|
|
32
|
+
Zh,
|
|
33
|
+
_e,
|
|
34
|
+
_r,
|
|
35
|
+
ap,
|
|
36
|
+
be,
|
|
37
|
+
bp,
|
|
38
|
+
dp,
|
|
39
|
+
ep,
|
|
40
|
+
g,
|
|
41
|
+
gp,
|
|
42
|
+
gt,
|
|
43
|
+
h1 as h,
|
|
44
|
+
ip,
|
|
45
|
+
ji,
|
|
46
|
+
kh,
|
|
47
|
+
m,
|
|
48
|
+
mp,
|
|
49
|
+
ne,
|
|
50
|
+
np,
|
|
51
|
+
qh,
|
|
52
|
+
rp,
|
|
53
|
+
tp,
|
|
54
|
+
vs,
|
|
55
|
+
wd,
|
|
56
|
+
xd,
|
|
57
|
+
ye,
|
|
58
|
+
yr,
|
|
59
|
+
zi
|
|
60
|
+
} from "./sse-server-3e0efmg2.js";
|
|
61
|
+
|
|
62
|
+
// node_modules/@sisense/sdk-ui/dist/dimensions-Blw0p98x.js
|
|
63
|
+
class c extends yr {
|
|
64
|
+
constructor(e, t, s, r, u, m2, l, d, y, a) {
|
|
65
|
+
if (super(e, u || E.Dimension, m2, d, y), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = L.None, !y && t) {
|
|
66
|
+
const { table: g2, column: b } = _e(t);
|
|
67
|
+
this.composeCode = `${Ri}.${gt(g2)}.${gt(b)}`;
|
|
68
|
+
}
|
|
69
|
+
this._sort = l || L.None, this._expression = t, this.setDimensions(r || []), this.setAttributes(s), a && (this.defaultAttribute = a);
|
|
70
|
+
}
|
|
71
|
+
static parseType(e) {
|
|
72
|
+
switch (e) {
|
|
73
|
+
case "datetime":
|
|
74
|
+
case E.DateDimension:
|
|
75
|
+
return E.DateDimension;
|
|
76
|
+
case "text":
|
|
77
|
+
case E.TextDimension:
|
|
78
|
+
return E.TextDimension;
|
|
79
|
+
case "numeric":
|
|
80
|
+
case E.NumericDimension:
|
|
81
|
+
return E.NumericDimension;
|
|
82
|
+
}
|
|
83
|
+
return E.TextDimension;
|
|
84
|
+
}
|
|
85
|
+
getAttachedName(e, t) {
|
|
86
|
+
let s = e;
|
|
87
|
+
const r = be(e);
|
|
88
|
+
return (r === "id" || r === "name" || Object.getOwnPropertyDescriptor(this, r) !== undefined || this[r] !== undefined) && (s = t), s;
|
|
89
|
+
}
|
|
90
|
+
setDimensions(e) {
|
|
91
|
+
this._dimensions = e;
|
|
92
|
+
for (let t = 0;t < e.length; t++) {
|
|
93
|
+
const s = this.getAttachedName(e[t].name, e[t].attributes[0].expression);
|
|
94
|
+
this[be(s)] = e[t], s != e[t].name && (e[t].name = s);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
setAttributes(e) {
|
|
98
|
+
this._attributes = e || [];
|
|
99
|
+
for (let t = 0;t < e.length; t++) {
|
|
100
|
+
const s = this.getAttachedName(e[t].name, e[t].expression);
|
|
101
|
+
this[be(s)] = e[t], e[t].name != s && (e[t].name = s);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
get id() {
|
|
105
|
+
return this._expression;
|
|
106
|
+
}
|
|
107
|
+
get attributes() {
|
|
108
|
+
return this._attributes;
|
|
109
|
+
}
|
|
110
|
+
get dimensions() {
|
|
111
|
+
return this._dimensions;
|
|
112
|
+
}
|
|
113
|
+
get expression() {
|
|
114
|
+
return this._expression;
|
|
115
|
+
}
|
|
116
|
+
getSort() {
|
|
117
|
+
return this._sort;
|
|
118
|
+
}
|
|
119
|
+
sort(e) {
|
|
120
|
+
return new c(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, e, this.dataSource, this.composeCode, this.defaultAttribute);
|
|
121
|
+
}
|
|
122
|
+
serialize() {
|
|
123
|
+
const e = super.serialize();
|
|
124
|
+
return e.expression = this.expression, this.getSort() !== undefined && (e.sort = this.getSort()), e.attributes = this._attributes.map((t) => t.serialize()), e.dimensions = this._dimensions.map((t) => t.serialize()), this.defaultAttribute && (e.defaultAttribute = this.defaultAttribute.serialize()), e;
|
|
125
|
+
}
|
|
126
|
+
jaql(e) {
|
|
127
|
+
if (this.defaultAttribute)
|
|
128
|
+
return this.defaultAttribute.jaql(e);
|
|
129
|
+
if (this.dimensions.length > 0)
|
|
130
|
+
return this.dimensions[0].jaql(e);
|
|
131
|
+
const t = {
|
|
132
|
+
jaql: {
|
|
133
|
+
title: this.name,
|
|
134
|
+
dim: this.expression,
|
|
135
|
+
datatype: vs(this.type)
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
return this._sort != L.None && (t.jaql.sort = this._sort == L.Ascending ? "asc" : "desc"), e === true ? t.jaql : t;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
var z = (i) => i && i.__serializable === "DimensionalDimension";
|
|
142
|
+
|
|
143
|
+
class p extends c {
|
|
144
|
+
constructor(e, t, s, r, u, m2) {
|
|
145
|
+
super(e, t, [], [], E.DateDimension, s, r, u, m2), this.__serializable = "DimensionalDateDimension", this.defaultLevel = g.Years, this.Years = new Y(g.Years, t, g.Years, "yyyy", s, r, u), this.Quarters = new Y(g.Quarters, t, g.Quarters, "Q yyyy", s, r, u), this.Months = new Y(g.Months, t, g.Months, "yyyy-MM", s, r, u), this.Weeks = new Y(g.Weeks, t, g.Weeks, "ww yyyy", s, r, u), this.Days = new Y(g.Days, t, g.Days, "yyyy-MM-dd", s, r, u), this.Hours = new Y(g.Hours, t, g.Hours, "yyyy-MM-dd HH:mm", s, r, u), this.MinutesRoundTo30 = new Y(g.MinutesRoundTo30, t, g.MinutesRoundTo30, "yyyy-MM-dd HH:mm", s, r, u), this.MinutesRoundTo15 = new Y(g.MinutesRoundTo15, t, g.MinutesRoundTo15, "yyyy-MM-dd HH:mm", s, r, u), this.Minutes = new Y(g.Minutes, t, g.Minutes, "yyyy-MM-dd HH:mm", s, r, u), this.Seconds = new Y(g.Seconds, t, g.Seconds, "yyyy-MM-dd HH:mm:ss", s, r, u), this.AggHours = new Y(g.AggHours, t, g.AggHours, "HH:mm", s, r, u), this.AggMinutesRoundTo30 = new Y(g.AggMinutesRoundTo30, t, g.AggMinutesRoundTo30, "HH:mm", s, r, u), this.AggMinutesRoundTo15 = new Y(g.AggMinutesRoundTo15, t, g.AggMinutesRoundTo15, "HH:mm", s, r, u), this.AggMinutesRoundTo1 = new Y(g.AggMinutesRoundTo1, t, g.AggMinutesRoundTo1, "HH:mm", s, r, u), this.setAttributes([
|
|
146
|
+
this.Years,
|
|
147
|
+
this.Quarters,
|
|
148
|
+
this.Months,
|
|
149
|
+
this.Weeks,
|
|
150
|
+
this.Days,
|
|
151
|
+
this.Hours,
|
|
152
|
+
this.MinutesRoundTo30,
|
|
153
|
+
this.MinutesRoundTo15,
|
|
154
|
+
this.Minutes,
|
|
155
|
+
this.Seconds,
|
|
156
|
+
this.AggHours,
|
|
157
|
+
this.AggMinutesRoundTo30,
|
|
158
|
+
this.AggMinutesRoundTo15,
|
|
159
|
+
this.AggMinutesRoundTo1
|
|
160
|
+
]);
|
|
161
|
+
}
|
|
162
|
+
get id() {
|
|
163
|
+
return this.expression;
|
|
164
|
+
}
|
|
165
|
+
setDimensions() {}
|
|
166
|
+
setAttributes(e) {
|
|
167
|
+
this._attributes = e;
|
|
168
|
+
}
|
|
169
|
+
getSort() {
|
|
170
|
+
return this._sort;
|
|
171
|
+
}
|
|
172
|
+
sort(e) {
|
|
173
|
+
return new p(this.name, this.expression, this.description, e, this.dataSource, this.composeCode);
|
|
174
|
+
}
|
|
175
|
+
serialize() {
|
|
176
|
+
return super.serialize();
|
|
177
|
+
}
|
|
178
|
+
jaql(e) {
|
|
179
|
+
const t = this[this.defaultLevel].jaql();
|
|
180
|
+
return t.jaql.title = this.name, e ? t.jaql : t;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
var q = (i) => i && i.__serializable === "DimensionalDateDimension";
|
|
184
|
+
function R(i) {
|
|
185
|
+
const e = i.name || i.title, t = i.desc || i.description, s = i.expression || i.dim, r = c.parseType(i.dimtype || i.type), u = i.sort, m2 = i.dataSource;
|
|
186
|
+
if (r == E.DateDimension)
|
|
187
|
+
return new p(e, s, t, u, m2);
|
|
188
|
+
const l = Object.getOwnPropertyNames(i).map((a) => i[a]).filter((a) => E.isAttribute(a == null ? undefined : a.type));
|
|
189
|
+
if (l.length == 0)
|
|
190
|
+
if (i.attributes) {
|
|
191
|
+
let a;
|
|
192
|
+
for (let g2 = 0;g2 < i.attributes.length; g2++)
|
|
193
|
+
a = i.attributes[g2], l.push(new Qe(a.name, a.expression, a.type, a.description, a.sort, a.dataSource));
|
|
194
|
+
} else
|
|
195
|
+
s && l.push(new Qe(e, s, r, t, u, m2));
|
|
196
|
+
const d = Object.getOwnPropertyNames(i).map((a) => i[a]).filter((a) => E.isDimension(a == null ? undefined : a.type));
|
|
197
|
+
if (d.length == 0 && i.dimensions)
|
|
198
|
+
for (let a = 0;a < i.dimensions.length; a++)
|
|
199
|
+
d.push(R(i.dimensions[a]));
|
|
200
|
+
const y = new c(e, s, l, d, r, t, u, m2);
|
|
201
|
+
return i.defaultAttribute && (y.defaultAttribute = l.find((a) => a.name === i.defaultAttribute)), y;
|
|
202
|
+
}
|
|
203
|
+
function x(i) {
|
|
204
|
+
const e = i.name || i.title, t = i.expression || i.dim, s = i.desc || i.description, r = i.sort, u = i.dataSource;
|
|
205
|
+
return new p(e, t, s, r, u);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// node_modules/@sisense/sdk-ui/dist/analytics-composer/node.js
|
|
209
|
+
var Qe2 = Object.defineProperty;
|
|
210
|
+
var Ye = Object.defineProperties;
|
|
211
|
+
var He = Object.getOwnPropertyDescriptors;
|
|
212
|
+
var pe = Object.getOwnPropertySymbols;
|
|
213
|
+
var Ze = Object.prototype.hasOwnProperty;
|
|
214
|
+
var Ge = Object.prototype.propertyIsEnumerable;
|
|
215
|
+
var ye2 = (e, r, t) => (r in e) ? Qe2(e, r, { enumerable: true, configurable: true, writable: true, value: t }) : e[r] = t;
|
|
216
|
+
var b2 = (e, r) => {
|
|
217
|
+
for (var t in r || (r = {}))
|
|
218
|
+
Ze.call(r, t) && ye2(e, t, r[t]);
|
|
219
|
+
if (pe)
|
|
220
|
+
for (var t of pe(r))
|
|
221
|
+
Ge.call(r, t) && ye2(e, t, r[t]);
|
|
222
|
+
return e;
|
|
223
|
+
};
|
|
224
|
+
var E3 = (e, r) => Ye(e, He(r));
|
|
225
|
+
|
|
226
|
+
class Gr {
|
|
227
|
+
constructor() {
|
|
228
|
+
this.keyToValue = /* @__PURE__ */ new Map, this.valueToKey = /* @__PURE__ */ new Map;
|
|
229
|
+
}
|
|
230
|
+
set(r, t) {
|
|
231
|
+
this.keyToValue.set(r, t), this.valueToKey.set(t, r);
|
|
232
|
+
}
|
|
233
|
+
getByKey(r) {
|
|
234
|
+
return this.keyToValue.get(r);
|
|
235
|
+
}
|
|
236
|
+
getByValue(r) {
|
|
237
|
+
return this.valueToKey.get(r);
|
|
238
|
+
}
|
|
239
|
+
clear() {
|
|
240
|
+
this.keyToValue.clear(), this.valueToKey.clear();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
class Ee {
|
|
245
|
+
constructor(r) {
|
|
246
|
+
this.generateIdentifier = r, this.kv = new Gr;
|
|
247
|
+
}
|
|
248
|
+
register(r, t) {
|
|
249
|
+
this.kv.getByValue(r) || (t || (t = this.generateIdentifier(r)), this.kv.set(t, r));
|
|
250
|
+
}
|
|
251
|
+
clear() {
|
|
252
|
+
this.kv.clear();
|
|
253
|
+
}
|
|
254
|
+
getIdentifier(r) {
|
|
255
|
+
return this.kv.getByValue(r);
|
|
256
|
+
}
|
|
257
|
+
getValue(r) {
|
|
258
|
+
return this.kv.getByKey(r);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
class Xr extends Ee {
|
|
263
|
+
constructor() {
|
|
264
|
+
super((r) => r.name), this.classToAllowedProps = /* @__PURE__ */ new Map;
|
|
265
|
+
}
|
|
266
|
+
register(r, t) {
|
|
267
|
+
typeof t == "object" ? (t.allowProps && this.classToAllowedProps.set(r, t.allowProps), super.register(r, t.identifier)) : super.register(r, t);
|
|
268
|
+
}
|
|
269
|
+
getAllowedProps(r) {
|
|
270
|
+
return this.classToAllowedProps.get(r);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function vr(e) {
|
|
274
|
+
if ("values" in Object)
|
|
275
|
+
return Object.values(e);
|
|
276
|
+
const r = [];
|
|
277
|
+
for (const t in e)
|
|
278
|
+
e.hasOwnProperty(t) && r.push(e[t]);
|
|
279
|
+
return r;
|
|
280
|
+
}
|
|
281
|
+
function et(e, r) {
|
|
282
|
+
const t = vr(e);
|
|
283
|
+
if ("find" in t)
|
|
284
|
+
return t.find(r);
|
|
285
|
+
const s = t;
|
|
286
|
+
for (let n = 0;n < s.length; n++) {
|
|
287
|
+
const a = s[n];
|
|
288
|
+
if (r(a))
|
|
289
|
+
return a;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function B(e, r) {
|
|
293
|
+
Object.entries(e).forEach(([t, s]) => r(s, t));
|
|
294
|
+
}
|
|
295
|
+
function U(e, r) {
|
|
296
|
+
return e.indexOf(r) !== -1;
|
|
297
|
+
}
|
|
298
|
+
function he(e, r) {
|
|
299
|
+
for (let t = 0;t < e.length; t++) {
|
|
300
|
+
const s = e[t];
|
|
301
|
+
if (r(s))
|
|
302
|
+
return s;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
class rt {
|
|
307
|
+
constructor() {
|
|
308
|
+
this.transfomers = {};
|
|
309
|
+
}
|
|
310
|
+
register(r) {
|
|
311
|
+
this.transfomers[r.name] = r;
|
|
312
|
+
}
|
|
313
|
+
findApplicable(r) {
|
|
314
|
+
return et(this.transfomers, (t) => t.isApplicable(r));
|
|
315
|
+
}
|
|
316
|
+
findByName(r) {
|
|
317
|
+
return this.transfomers[r];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
var tt = (e) => Object.prototype.toString.call(e).slice(8, -1);
|
|
321
|
+
var Ce = (e) => typeof e == "undefined";
|
|
322
|
+
var st = (e) => e === null;
|
|
323
|
+
var k = (e) => typeof e != "object" || e === null || e === Object.prototype ? false : Object.getPrototypeOf(e) === null ? true : Object.getPrototypeOf(e) === Object.prototype;
|
|
324
|
+
var G = (e) => k(e) && Object.keys(e).length === 0;
|
|
325
|
+
var N = (e) => Array.isArray(e);
|
|
326
|
+
var nt = (e) => typeof e == "string";
|
|
327
|
+
var it = (e) => typeof e == "number" && !isNaN(e);
|
|
328
|
+
var at = (e) => typeof e == "boolean";
|
|
329
|
+
var ot = (e) => e instanceof RegExp;
|
|
330
|
+
var _ = (e) => e instanceof Map;
|
|
331
|
+
var L2 = (e) => e instanceof Set;
|
|
332
|
+
var $e = (e) => tt(e) === "Symbol";
|
|
333
|
+
var ut = (e) => e instanceof Date && !isNaN(e.valueOf());
|
|
334
|
+
var lt = (e) => e instanceof Error;
|
|
335
|
+
var be2 = (e) => typeof e == "number" && isNaN(e);
|
|
336
|
+
var ct = (e) => at(e) || st(e) || Ce(e) || it(e) || nt(e) || $e(e);
|
|
337
|
+
var ft = (e) => typeof e == "bigint";
|
|
338
|
+
var dt = (e) => e === 1 / 0 || e === -1 / 0;
|
|
339
|
+
var mt = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
340
|
+
var pt = (e) => e instanceof URL;
|
|
341
|
+
var xe = (e) => e.replace(/\./g, "\\.");
|
|
342
|
+
var Y2 = (e) => e.map(String).map(xe).join(".");
|
|
343
|
+
var P = (e) => {
|
|
344
|
+
const r = [];
|
|
345
|
+
let t = "";
|
|
346
|
+
for (let n = 0;n < e.length; n++) {
|
|
347
|
+
let a = e.charAt(n);
|
|
348
|
+
if (a === "\\" && e.charAt(n + 1) === ".") {
|
|
349
|
+
t += ".", n++;
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (a === ".") {
|
|
353
|
+
r.push(t), t = "";
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
t += a;
|
|
357
|
+
}
|
|
358
|
+
const s = t;
|
|
359
|
+
return r.push(s), r;
|
|
360
|
+
};
|
|
361
|
+
function $(e, r, t, s) {
|
|
362
|
+
return {
|
|
363
|
+
isApplicable: e,
|
|
364
|
+
annotation: r,
|
|
365
|
+
transform: t,
|
|
366
|
+
untransform: s
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
var Ae = [
|
|
370
|
+
$(Ce, "undefined", () => null, () => {}),
|
|
371
|
+
$(ft, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
372
|
+
$(ut, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
373
|
+
$(lt, "Error", (e, r) => {
|
|
374
|
+
const t = {
|
|
375
|
+
name: e.name,
|
|
376
|
+
message: e.message
|
|
377
|
+
};
|
|
378
|
+
return r.allowedErrorProps.forEach((s) => {
|
|
379
|
+
t[s] = e[s];
|
|
380
|
+
}), t;
|
|
381
|
+
}, (e, r) => {
|
|
382
|
+
const t = new Error(e.message);
|
|
383
|
+
return t.name = e.name, t.stack = e.stack, r.allowedErrorProps.forEach((s) => {
|
|
384
|
+
t[s] = e[s];
|
|
385
|
+
}), t;
|
|
386
|
+
}),
|
|
387
|
+
$(ot, "regexp", (e) => "" + e, (e) => {
|
|
388
|
+
const r = e.slice(1, e.lastIndexOf("/")), t = e.slice(e.lastIndexOf("/") + 1);
|
|
389
|
+
return new RegExp(r, t);
|
|
390
|
+
}),
|
|
391
|
+
$(L2, "set", (e) => [...e.values()], (e) => new Set(e)),
|
|
392
|
+
$(_, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
393
|
+
$((e) => be2(e) || dt(e), "number", (e) => be2(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
394
|
+
$((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
395
|
+
$(pt, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
396
|
+
];
|
|
397
|
+
function j2(e, r, t, s) {
|
|
398
|
+
return {
|
|
399
|
+
isApplicable: e,
|
|
400
|
+
annotation: r,
|
|
401
|
+
transform: t,
|
|
402
|
+
untransform: s
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
var De = j2((e, r) => $e(e) ? !!r.symbolRegistry.getIdentifier(e) : false, (e, r) => ["symbol", r.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, r, t) => {
|
|
406
|
+
const s = t.symbolRegistry.getValue(r[1]);
|
|
407
|
+
if (!s)
|
|
408
|
+
throw new Error("Trying to deserialize unknown symbol");
|
|
409
|
+
return s;
|
|
410
|
+
});
|
|
411
|
+
var yt = [
|
|
412
|
+
Int8Array,
|
|
413
|
+
Uint8Array,
|
|
414
|
+
Int16Array,
|
|
415
|
+
Uint16Array,
|
|
416
|
+
Int32Array,
|
|
417
|
+
Uint32Array,
|
|
418
|
+
Float32Array,
|
|
419
|
+
Float64Array,
|
|
420
|
+
Uint8ClampedArray
|
|
421
|
+
].reduce((e, r) => (e[r.name] = r, e), {});
|
|
422
|
+
var Me = j2(mt, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, r) => {
|
|
423
|
+
const t = yt[r[1]];
|
|
424
|
+
if (!t)
|
|
425
|
+
throw new Error("Trying to deserialize unknown typed array");
|
|
426
|
+
return new t(e);
|
|
427
|
+
});
|
|
428
|
+
function Ne(e, r) {
|
|
429
|
+
return e != null && e.constructor ? !!r.classRegistry.getIdentifier(e.constructor) : false;
|
|
430
|
+
}
|
|
431
|
+
var Re = j2(Ne, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor)], (e, r) => {
|
|
432
|
+
const t = r.classRegistry.getAllowedProps(e.constructor);
|
|
433
|
+
if (!t)
|
|
434
|
+
return b2({}, e);
|
|
435
|
+
const s = {};
|
|
436
|
+
return t.forEach((n) => {
|
|
437
|
+
s[n] = e[n];
|
|
438
|
+
}), s;
|
|
439
|
+
}, (e, r, t) => {
|
|
440
|
+
const s = t.classRegistry.getValue(r[1]);
|
|
441
|
+
if (!s)
|
|
442
|
+
throw new Error(`Trying to deserialize unknown class '${r[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
443
|
+
return Object.assign(Object.create(s.prototype), e);
|
|
444
|
+
});
|
|
445
|
+
var Se2 = j2((e, r) => !!r.customTransformerRegistry.findApplicable(e), (e, r) => ["custom", r.customTransformerRegistry.findApplicable(e).name], (e, r) => r.customTransformerRegistry.findApplicable(e).serialize(e), (e, r, t) => {
|
|
446
|
+
const s = t.customTransformerRegistry.findByName(r[1]);
|
|
447
|
+
if (!s)
|
|
448
|
+
throw new Error("Trying to deserialize unknown custom value");
|
|
449
|
+
return s.deserialize(e);
|
|
450
|
+
});
|
|
451
|
+
var gt2 = [Re, De, Se2, Me];
|
|
452
|
+
var Fe = (e, r) => {
|
|
453
|
+
const t = he(gt2, (n) => n.isApplicable(e, r));
|
|
454
|
+
if (t)
|
|
455
|
+
return {
|
|
456
|
+
value: t.transform(e, r),
|
|
457
|
+
type: t.annotation(e, r)
|
|
458
|
+
};
|
|
459
|
+
const s = he(Ae, (n) => n.isApplicable(e, r));
|
|
460
|
+
if (s)
|
|
461
|
+
return {
|
|
462
|
+
value: s.transform(e, r),
|
|
463
|
+
type: s.annotation
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
var Oe = {};
|
|
467
|
+
Ae.forEach((e) => {
|
|
468
|
+
Oe[e.annotation] = e;
|
|
469
|
+
});
|
|
470
|
+
var ht = (e, r, t) => {
|
|
471
|
+
if (N(r))
|
|
472
|
+
switch (r[0]) {
|
|
473
|
+
case "symbol":
|
|
474
|
+
return De.untransform(e, r, t);
|
|
475
|
+
case "class":
|
|
476
|
+
return Re.untransform(e, r, t);
|
|
477
|
+
case "custom":
|
|
478
|
+
return Se2.untransform(e, r, t);
|
|
479
|
+
case "typed-array":
|
|
480
|
+
return Me.untransform(e, r, t);
|
|
481
|
+
default:
|
|
482
|
+
throw new Error("Unknown transformation: " + r);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
const s = Oe[r];
|
|
486
|
+
if (!s)
|
|
487
|
+
throw new Error("Unknown transformation: " + r);
|
|
488
|
+
return s.untransform(e, t);
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
var I = (e, r) => {
|
|
492
|
+
if (r > e.size)
|
|
493
|
+
throw new Error("index out of bounds");
|
|
494
|
+
const t = e.keys();
|
|
495
|
+
for (;r > 0; )
|
|
496
|
+
t.next(), r--;
|
|
497
|
+
return t.next().value;
|
|
498
|
+
};
|
|
499
|
+
function Te(e) {
|
|
500
|
+
if (U(e, "__proto__"))
|
|
501
|
+
throw new Error("__proto__ is not allowed as a property");
|
|
502
|
+
if (U(e, "prototype"))
|
|
503
|
+
throw new Error("prototype is not allowed as a property");
|
|
504
|
+
if (U(e, "constructor"))
|
|
505
|
+
throw new Error("constructor is not allowed as a property");
|
|
506
|
+
}
|
|
507
|
+
var bt = (e, r) => {
|
|
508
|
+
Te(r);
|
|
509
|
+
for (let t = 0;t < r.length; t++) {
|
|
510
|
+
const s = r[t];
|
|
511
|
+
if (L2(e))
|
|
512
|
+
e = I(e, +s);
|
|
513
|
+
else if (_(e)) {
|
|
514
|
+
const n = +s, a = +r[++t] == 0 ? "key" : "value", i = I(e, n);
|
|
515
|
+
switch (a) {
|
|
516
|
+
case "key":
|
|
517
|
+
e = i;
|
|
518
|
+
break;
|
|
519
|
+
case "value":
|
|
520
|
+
e = e.get(i);
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
} else
|
|
524
|
+
e = e[s];
|
|
525
|
+
}
|
|
526
|
+
return e;
|
|
527
|
+
};
|
|
528
|
+
var X = (e, r, t) => {
|
|
529
|
+
if (Te(r), r.length === 0)
|
|
530
|
+
return t(e);
|
|
531
|
+
let s = e;
|
|
532
|
+
for (let a = 0;a < r.length - 1; a++) {
|
|
533
|
+
const i = r[a];
|
|
534
|
+
if (N(s)) {
|
|
535
|
+
const o = +i;
|
|
536
|
+
s = s[o];
|
|
537
|
+
} else if (k(s))
|
|
538
|
+
s = s[i];
|
|
539
|
+
else if (L2(s)) {
|
|
540
|
+
const o = +i;
|
|
541
|
+
s = I(s, o);
|
|
542
|
+
} else if (_(s)) {
|
|
543
|
+
if (a === r.length - 2)
|
|
544
|
+
break;
|
|
545
|
+
const u = +i, l = +r[++a] == 0 ? "key" : "value", p2 = I(s, u);
|
|
546
|
+
switch (l) {
|
|
547
|
+
case "key":
|
|
548
|
+
s = p2;
|
|
549
|
+
break;
|
|
550
|
+
case "value":
|
|
551
|
+
s = s.get(p2);
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const n = r[r.length - 1];
|
|
557
|
+
if (N(s) ? s[+n] = t(s[+n]) : k(s) && (s[n] = t(s[n])), L2(s)) {
|
|
558
|
+
const a = I(s, +n), i = t(a);
|
|
559
|
+
a !== i && (s.delete(a), s.add(i));
|
|
560
|
+
}
|
|
561
|
+
if (_(s)) {
|
|
562
|
+
const a = +r[r.length - 2], i = I(s, a);
|
|
563
|
+
switch (+n == 0 ? "key" : "value") {
|
|
564
|
+
case "key": {
|
|
565
|
+
const u = t(i);
|
|
566
|
+
s.set(u, s.get(i)), u !== i && s.delete(i);
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
case "value": {
|
|
570
|
+
s.set(i, t(s.get(i)));
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return e;
|
|
576
|
+
};
|
|
577
|
+
function v(e, r, t = []) {
|
|
578
|
+
if (!e)
|
|
579
|
+
return;
|
|
580
|
+
if (!N(e)) {
|
|
581
|
+
B(e, (a, i) => v(a, r, [...t, ...P(i)]));
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const [s, n] = e;
|
|
585
|
+
n && B(n, (a, i) => {
|
|
586
|
+
v(a, r, [...t, ...P(i)]);
|
|
587
|
+
}), r(s, t);
|
|
588
|
+
}
|
|
589
|
+
function Ft(e, r, t) {
|
|
590
|
+
return v(r, (s, n) => {
|
|
591
|
+
e = X(e, n, (a) => ht(a, s, t));
|
|
592
|
+
}), e;
|
|
593
|
+
}
|
|
594
|
+
function wt(e, r) {
|
|
595
|
+
function t(s, n) {
|
|
596
|
+
const a = bt(e, P(n));
|
|
597
|
+
s.map(P).forEach((i) => {
|
|
598
|
+
e = X(e, i, () => a);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
if (N(r)) {
|
|
602
|
+
const [s, n] = r;
|
|
603
|
+
s.forEach((a) => {
|
|
604
|
+
e = X(e, P(a), () => e);
|
|
605
|
+
}), n && B(n, t);
|
|
606
|
+
} else
|
|
607
|
+
B(r, t);
|
|
608
|
+
return e;
|
|
609
|
+
}
|
|
610
|
+
var qt = (e, r) => k(e) || N(e) || _(e) || L2(e) || Ne(e, r);
|
|
611
|
+
function Et(e, r, t) {
|
|
612
|
+
const s = t.get(e);
|
|
613
|
+
s ? s.push(r) : t.set(e, [r]);
|
|
614
|
+
}
|
|
615
|
+
function Ct2(e, r) {
|
|
616
|
+
const t = {};
|
|
617
|
+
let s;
|
|
618
|
+
return e.forEach((n) => {
|
|
619
|
+
if (n.length <= 1)
|
|
620
|
+
return;
|
|
621
|
+
r || (n = n.map((o) => o.map(String)).sort((o, u) => o.length - u.length));
|
|
622
|
+
const [a, ...i] = n;
|
|
623
|
+
a.length === 0 ? s = i.map(Y2) : t[Y2(a)] = i.map(Y2);
|
|
624
|
+
}), s ? G(t) ? [s] : [s, t] : G(t) ? undefined : t;
|
|
625
|
+
}
|
|
626
|
+
var Ie = (e, r, t, s, n = [], a = [], i = /* @__PURE__ */ new Map) => {
|
|
627
|
+
var F;
|
|
628
|
+
const o = ct(e);
|
|
629
|
+
if (!o) {
|
|
630
|
+
Et(e, n, r);
|
|
631
|
+
const d = i.get(e);
|
|
632
|
+
if (d)
|
|
633
|
+
return s ? {
|
|
634
|
+
transformedValue: null
|
|
635
|
+
} : d;
|
|
636
|
+
}
|
|
637
|
+
if (!qt(e, t)) {
|
|
638
|
+
const d = Fe(e, t), f2 = d ? {
|
|
639
|
+
transformedValue: d.value,
|
|
640
|
+
annotations: [d.type]
|
|
641
|
+
} : {
|
|
642
|
+
transformedValue: e
|
|
643
|
+
};
|
|
644
|
+
return o || i.set(e, f2), f2;
|
|
645
|
+
}
|
|
646
|
+
if (U(a, e))
|
|
647
|
+
return {
|
|
648
|
+
transformedValue: null
|
|
649
|
+
};
|
|
650
|
+
const u = Fe(e, t), l = (F = u == null ? undefined : u.value) != null ? F : e, p2 = N(l) ? [] : {}, m2 = {};
|
|
651
|
+
B(l, (d, f2) => {
|
|
652
|
+
if (f2 === "__proto__" || f2 === "constructor" || f2 === "prototype")
|
|
653
|
+
throw new Error(`Detected property ${f2}. This is a prototype pollution risk, please remove it from your object.`);
|
|
654
|
+
const w = Ie(d, r, t, s, [...n, f2], [...a, e], i);
|
|
655
|
+
p2[f2] = w.transformedValue, N(w.annotations) ? m2[f2] = w.annotations : k(w.annotations) && B(w.annotations, (T2, A) => {
|
|
656
|
+
m2[xe(f2) + "." + A] = T2;
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
const y = G(m2) ? {
|
|
660
|
+
transformedValue: p2,
|
|
661
|
+
annotations: u ? [u.type] : undefined
|
|
662
|
+
} : {
|
|
663
|
+
transformedValue: p2,
|
|
664
|
+
annotations: u ? [u.type, m2] : m2
|
|
665
|
+
};
|
|
666
|
+
return o || i.set(e, y), y;
|
|
667
|
+
};
|
|
668
|
+
function ze(e) {
|
|
669
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
670
|
+
}
|
|
671
|
+
function we(e) {
|
|
672
|
+
return ze(e) === "Array";
|
|
673
|
+
}
|
|
674
|
+
function $t(e) {
|
|
675
|
+
if (ze(e) !== "Object")
|
|
676
|
+
return false;
|
|
677
|
+
const r = Object.getPrototypeOf(e);
|
|
678
|
+
return !!r && r.constructor === Object && r === Object.prototype;
|
|
679
|
+
}
|
|
680
|
+
function xt(e, r, t, s, n) {
|
|
681
|
+
const a = {}.propertyIsEnumerable.call(s, r) ? "enumerable" : "nonenumerable";
|
|
682
|
+
a === "enumerable" && (e[r] = t), n && a === "nonenumerable" && Object.defineProperty(e, r, {
|
|
683
|
+
value: t,
|
|
684
|
+
enumerable: false,
|
|
685
|
+
writable: true,
|
|
686
|
+
configurable: true
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
function ee(e, r = {}) {
|
|
690
|
+
if (we(e))
|
|
691
|
+
return e.map((n) => ee(n, r));
|
|
692
|
+
if (!$t(e))
|
|
693
|
+
return e;
|
|
694
|
+
const t = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
695
|
+
return [...t, ...s].reduce((n, a) => {
|
|
696
|
+
if (we(r.props) && !r.props.includes(a))
|
|
697
|
+
return n;
|
|
698
|
+
const i = e[a], o = ee(i, r);
|
|
699
|
+
return xt(n, a, o, e, r.nonenumerable), n;
|
|
700
|
+
}, {});
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
class c2 {
|
|
704
|
+
constructor({ dedupe: r = false } = {}) {
|
|
705
|
+
this.classRegistry = new Xr, this.symbolRegistry = new Ee((t) => {
|
|
706
|
+
var s;
|
|
707
|
+
return (s = t.description) != null ? s : "";
|
|
708
|
+
}), this.customTransformerRegistry = new rt, this.allowedErrorProps = [], this.dedupe = r;
|
|
709
|
+
}
|
|
710
|
+
serialize(r) {
|
|
711
|
+
const t = /* @__PURE__ */ new Map, s = Ie(r, t, this, this.dedupe), n = {
|
|
712
|
+
json: s.transformedValue
|
|
713
|
+
};
|
|
714
|
+
s.annotations && (n.meta = E3(b2({}, n.meta), {
|
|
715
|
+
values: s.annotations
|
|
716
|
+
}));
|
|
717
|
+
const a = Ct2(t, this.dedupe);
|
|
718
|
+
return a && (n.meta = E3(b2({}, n.meta), {
|
|
719
|
+
referentialEqualities: a
|
|
720
|
+
})), n;
|
|
721
|
+
}
|
|
722
|
+
deserialize(r) {
|
|
723
|
+
const { json: t, meta: s } = r;
|
|
724
|
+
let n = ee(t);
|
|
725
|
+
return s != null && s.values && (n = Ft(n, s.values, this)), s != null && s.referentialEqualities && (n = wt(n, s.referentialEqualities)), n;
|
|
726
|
+
}
|
|
727
|
+
stringify(r) {
|
|
728
|
+
return JSON.stringify(this.serialize(r));
|
|
729
|
+
}
|
|
730
|
+
parse(r) {
|
|
731
|
+
return this.deserialize(JSON.parse(r));
|
|
732
|
+
}
|
|
733
|
+
registerClass(r, t) {
|
|
734
|
+
this.classRegistry.register(r, t);
|
|
735
|
+
}
|
|
736
|
+
registerSymbol(r, t) {
|
|
737
|
+
this.symbolRegistry.register(r, t);
|
|
738
|
+
}
|
|
739
|
+
registerCustom(r, t) {
|
|
740
|
+
this.customTransformerRegistry.register(b2({
|
|
741
|
+
name: t
|
|
742
|
+
}, r));
|
|
743
|
+
}
|
|
744
|
+
allowErrorProps(...r) {
|
|
745
|
+
this.allowedErrorProps.push(...r);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
c2.defaultInstance = new c2;
|
|
749
|
+
c2.serialize = c2.defaultInstance.serialize.bind(c2.defaultInstance);
|
|
750
|
+
c2.deserialize = c2.defaultInstance.deserialize.bind(c2.defaultInstance);
|
|
751
|
+
c2.stringify = c2.defaultInstance.stringify.bind(c2.defaultInstance);
|
|
752
|
+
c2.parse = c2.defaultInstance.parse.bind(c2.defaultInstance);
|
|
753
|
+
c2.registerClass = c2.defaultInstance.registerClass.bind(c2.defaultInstance);
|
|
754
|
+
c2.registerSymbol = c2.defaultInstance.registerSymbol.bind(c2.defaultInstance);
|
|
755
|
+
c2.registerCustom = c2.defaultInstance.registerCustom.bind(c2.defaultInstance);
|
|
756
|
+
c2.allowErrorProps = c2.defaultInstance.allowErrorProps.bind(c2.defaultInstance);
|
|
757
|
+
var O = (e) => e === undefined ? L.None : e;
|
|
758
|
+
var At = (e) => new m(e.metadataItem, e.type);
|
|
759
|
+
var ie = (e) => new Qe(e.name, e.expression, e.type, e.description, O(e.sort), e.dataSource, e.composeCode);
|
|
760
|
+
var ae = (e) => new Y(e.name, e.expression, e.granularity, e.format, e.description, O(e.sort), e.dataSource, e.composeCode);
|
|
761
|
+
var q3 = (e) => {
|
|
762
|
+
switch (e.__serializable) {
|
|
763
|
+
case "DimensionalAttribute":
|
|
764
|
+
return ie(e);
|
|
765
|
+
case "DimensionalLevelAttribute":
|
|
766
|
+
return ae(e);
|
|
767
|
+
default:
|
|
768
|
+
return e;
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
var Be = (e) => new c(e.name, e.expression, e.attributes.map(q3), e.dimensions.map(Dt), e.type, e.description, O(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? q3(e.defaultAttribute) : undefined);
|
|
772
|
+
var Pe = (e) => new p(e.name, e.expression, e.description, O(e.sort), e.dataSource, e.composeCode);
|
|
773
|
+
var Dt = (e) => {
|
|
774
|
+
switch (e.__serializable) {
|
|
775
|
+
case "DimensionalDimension":
|
|
776
|
+
return Be(e);
|
|
777
|
+
case "DimensionalDateDimension":
|
|
778
|
+
return Pe(e);
|
|
779
|
+
default:
|
|
780
|
+
return e;
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
var oe = (e) => new ye(e.name, q3(e.attribute), e.aggregation, e.format, e.description, O(e.sort), e.dataSource, e.composeCode);
|
|
784
|
+
var ue = (e) => {
|
|
785
|
+
const r = Object.fromEntries(Object.entries(e.context).map(([t, s]) => {
|
|
786
|
+
if (s && typeof s == "object" && "__serializable" in s)
|
|
787
|
+
switch (s.__serializable) {
|
|
788
|
+
case "DimensionalAttribute":
|
|
789
|
+
return [t, ie(s)];
|
|
790
|
+
case "DimensionalLevelAttribute":
|
|
791
|
+
return [t, ae(s)];
|
|
792
|
+
case "DimensionalBaseMeasure":
|
|
793
|
+
return [t, oe(s)];
|
|
794
|
+
case "DimensionalCalculatedMeasure":
|
|
795
|
+
return [t, ue(s)];
|
|
796
|
+
default:
|
|
797
|
+
return [t, s];
|
|
798
|
+
}
|
|
799
|
+
return [t, s];
|
|
800
|
+
}));
|
|
801
|
+
return new Z(e.name, e.expression, r, e.format, e.description, O(e.sort), e.dataSource, e.composeCode);
|
|
802
|
+
};
|
|
803
|
+
var ke = (e) => new Qt(e.name, q3(e.attribute), e.format, e.description, O(e.sort), e.dataSource, e.composeCode);
|
|
804
|
+
var H = (e) => {
|
|
805
|
+
switch (e.__serializable) {
|
|
806
|
+
case "DimensionalBaseMeasure":
|
|
807
|
+
return oe(e);
|
|
808
|
+
case "DimensionalCalculatedMeasure":
|
|
809
|
+
return ue(e);
|
|
810
|
+
case "DimensionalMeasureTemplate":
|
|
811
|
+
return ke(e);
|
|
812
|
+
default:
|
|
813
|
+
return e;
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
var g2 = (e) => {
|
|
817
|
+
switch (e.__serializable) {
|
|
818
|
+
case "MembersFilter":
|
|
819
|
+
return new xd(q3(e.attribute), e.members, e.config.backgroundFilter ? E3(b2({}, e.config), { backgroundFilter: g2(e.config.backgroundFilter) }) : e.config, e.composeCode);
|
|
820
|
+
case "LogicalAttributeFilter":
|
|
821
|
+
return new Bi(e.filters.map((t) => g2(t)), e.operator, e.config, e.composeCode);
|
|
822
|
+
case "CascadingFilter":
|
|
823
|
+
return new wd(e._filters.map((t) => g2(t)), e.config, e.composeCode);
|
|
824
|
+
case "ExcludeFilter":
|
|
825
|
+
return new Nd(g2(e.filter), e.input ? g2(e.input) : undefined, e.config, e.composeCode);
|
|
826
|
+
case "MeasureFilter":
|
|
827
|
+
return new Cd(q3(e.attribute), H(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
828
|
+
case "RankingFilter":
|
|
829
|
+
return new zi(q3(e.attribute), H(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
830
|
+
case "MeasureRankingFilter":
|
|
831
|
+
return new Hi(H(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
832
|
+
case "NumericFilter":
|
|
833
|
+
return new Rd(q3(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
834
|
+
case "TextFilter":
|
|
835
|
+
return new ne(q3(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
|
|
836
|
+
case "DateRangeFilter": {
|
|
837
|
+
const { valueA: t, valueB: s } = e;
|
|
838
|
+
return new Ld(q3(e.attribute), t, s, e.config, e.composeCode);
|
|
839
|
+
}
|
|
840
|
+
case "RelativeDateFilter":
|
|
841
|
+
return new _r(q3(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
|
|
842
|
+
case "CustomFilter":
|
|
843
|
+
return new Md(q3(e.attribute), e.jaqlExpression, e.config, e.composeCode);
|
|
844
|
+
default:
|
|
845
|
+
return e;
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
c2.registerCustom({
|
|
849
|
+
isApplicable: h,
|
|
850
|
+
serialize: (e) => e.serialize(),
|
|
851
|
+
deserialize: (e) => At(e)
|
|
852
|
+
}, "JaqlElement");
|
|
853
|
+
c2.registerCustom({
|
|
854
|
+
isApplicable: dp,
|
|
855
|
+
serialize: (e) => e.serialize(),
|
|
856
|
+
deserialize: (e) => ie(e)
|
|
857
|
+
}, "DimensionalAttribute");
|
|
858
|
+
c2.registerCustom({
|
|
859
|
+
isApplicable: gp,
|
|
860
|
+
serialize: (e) => e.serialize(),
|
|
861
|
+
deserialize: (e) => ae(e)
|
|
862
|
+
}, "DimensionalLevelAttribute");
|
|
863
|
+
c2.registerCustom({
|
|
864
|
+
isApplicable: z,
|
|
865
|
+
serialize: (e) => e.serialize(),
|
|
866
|
+
deserialize: (e) => Be(e)
|
|
867
|
+
}, "DimensionalDimension");
|
|
868
|
+
c2.registerCustom({
|
|
869
|
+
isApplicable: q,
|
|
870
|
+
serialize: (e) => e.serialize(),
|
|
871
|
+
deserialize: (e) => Pe(e)
|
|
872
|
+
}, "DimensionalDateDimension");
|
|
873
|
+
c2.registerCustom({
|
|
874
|
+
isApplicable: ji,
|
|
875
|
+
serialize: (e) => e.serialize(),
|
|
876
|
+
deserialize: (e) => oe(e)
|
|
877
|
+
}, "DimensionalBaseMeasure");
|
|
878
|
+
c2.registerCustom({
|
|
879
|
+
isApplicable: kh,
|
|
880
|
+
serialize: (e) => e.serialize(),
|
|
881
|
+
deserialize: (e) => ue(e)
|
|
882
|
+
}, "DimensionalCalculatedMeasure");
|
|
883
|
+
c2.registerCustom({
|
|
884
|
+
isApplicable: Wh,
|
|
885
|
+
serialize: (e) => e.serialize(),
|
|
886
|
+
deserialize: (e) => ke(e)
|
|
887
|
+
}, "DimensionalMeasureTemplate");
|
|
888
|
+
c2.registerCustom({
|
|
889
|
+
isApplicable: Vh,
|
|
890
|
+
serialize: (e) => e.serialize(),
|
|
891
|
+
deserialize: (e) => g2(e)
|
|
892
|
+
}, "MembersFilter");
|
|
893
|
+
c2.registerCustom({
|
|
894
|
+
isApplicable: Xh,
|
|
895
|
+
serialize: (e) => e.serialize(),
|
|
896
|
+
deserialize: (e) => g2(e)
|
|
897
|
+
}, "LogicalAttributeFilter");
|
|
898
|
+
c2.registerCustom({
|
|
899
|
+
isApplicable: Nt,
|
|
900
|
+
serialize: (e) => e.serialize(),
|
|
901
|
+
deserialize: (e) => g2(e)
|
|
902
|
+
}, "CascadingFilter");
|
|
903
|
+
c2.registerCustom({
|
|
904
|
+
isApplicable: Zh,
|
|
905
|
+
serialize: (e) => e.serialize(),
|
|
906
|
+
deserialize: (e) => g2(e)
|
|
907
|
+
}, "ExcludeFilter");
|
|
908
|
+
c2.registerCustom({
|
|
909
|
+
isApplicable: Yh,
|
|
910
|
+
serialize: (e) => e.serialize(),
|
|
911
|
+
deserialize: (e) => g2(e)
|
|
912
|
+
}, "MeasureFilter");
|
|
913
|
+
c2.registerCustom({
|
|
914
|
+
isApplicable: Kh,
|
|
915
|
+
serialize: (e) => e.serialize(),
|
|
916
|
+
deserialize: (e) => g2(e)
|
|
917
|
+
}, "RankingFilter");
|
|
918
|
+
c2.registerCustom({
|
|
919
|
+
isApplicable: Jh,
|
|
920
|
+
serialize: (e) => e.serialize(),
|
|
921
|
+
deserialize: (e) => g2(e)
|
|
922
|
+
}, "MeasureRankingFilter");
|
|
923
|
+
c2.registerCustom({
|
|
924
|
+
isApplicable: Qh,
|
|
925
|
+
serialize: (e) => e.serialize(),
|
|
926
|
+
deserialize: (e) => g2(e)
|
|
927
|
+
}, "NumericFilter");
|
|
928
|
+
c2.registerCustom({
|
|
929
|
+
isApplicable: tp,
|
|
930
|
+
serialize: (e) => e.serialize(),
|
|
931
|
+
deserialize: (e) => g2(e)
|
|
932
|
+
}, "TextFilter");
|
|
933
|
+
c2.registerCustom({
|
|
934
|
+
isApplicable: rp,
|
|
935
|
+
serialize: (e) => e.serialize(),
|
|
936
|
+
deserialize: (e) => g2(e)
|
|
937
|
+
}, "DateRangeFilter");
|
|
938
|
+
c2.registerCustom({
|
|
939
|
+
isApplicable: ep,
|
|
940
|
+
serialize: (e) => e.serialize(),
|
|
941
|
+
deserialize: (e) => g2(e)
|
|
942
|
+
}, "RelativeDateFilter");
|
|
943
|
+
c2.registerCustom({
|
|
944
|
+
isApplicable: Gh,
|
|
945
|
+
serialize: (e) => e.serialize(),
|
|
946
|
+
deserialize: (e) => g2(e)
|
|
947
|
+
}, "CustomFilter");
|
|
948
|
+
var Fs = c2;
|
|
949
|
+
var h2 = "DM.";
|
|
950
|
+
function x2(e) {
|
|
951
|
+
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
952
|
+
}
|
|
953
|
+
function le(e) {
|
|
954
|
+
return e.every(x2);
|
|
955
|
+
}
|
|
956
|
+
function K(e) {
|
|
957
|
+
return "attribute" in e && "config" in e;
|
|
958
|
+
}
|
|
959
|
+
function W(e) {
|
|
960
|
+
return "left" in e && "right" in e && "operator" in e;
|
|
961
|
+
}
|
|
962
|
+
function _e2(e) {
|
|
963
|
+
return !K(e) && !W(e);
|
|
964
|
+
}
|
|
965
|
+
function Mt(e) {
|
|
966
|
+
return e.every((r) => typeof r == "string");
|
|
967
|
+
}
|
|
968
|
+
function Nt2(e) {
|
|
969
|
+
const r = [...e].sort((a, i) => i.name.length - a.name.length), t = /* @__PURE__ */ new Map, s = /* @__PURE__ */ new Map, n = /* @__PURE__ */ new Map;
|
|
970
|
+
for (const a of e) {
|
|
971
|
+
t.set(a.name, a);
|
|
972
|
+
const i = [...a.columns].sort((u, l) => l.name.length - u.name.length);
|
|
973
|
+
n.set(a.name, i);
|
|
974
|
+
const o = /* @__PURE__ */ new Map;
|
|
975
|
+
for (const u of a.columns)
|
|
976
|
+
o.set(u.name, u);
|
|
977
|
+
s.set(a.name, o);
|
|
978
|
+
}
|
|
979
|
+
return {
|
|
980
|
+
sortedTables: r,
|
|
981
|
+
tableColumnMap: n,
|
|
982
|
+
tableMap: t,
|
|
983
|
+
columnMap: s
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
function Le(e, r) {
|
|
987
|
+
if (!e.startsWith(h2))
|
|
988
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${h2}TableName.ColumnName[.Level]"`);
|
|
989
|
+
const t = e.slice(h2.length);
|
|
990
|
+
if (!t)
|
|
991
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${h2}TableName.ColumnName[.Level]"`);
|
|
992
|
+
let s, n;
|
|
993
|
+
for (const m2 of r.sortedTables)
|
|
994
|
+
if (t.startsWith(m2.name + ".")) {
|
|
995
|
+
const y = t.slice(m2.name.length + 1);
|
|
996
|
+
if (!y)
|
|
997
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${h2}TableName.ColumnName[.Level]"`);
|
|
998
|
+
s = m2, n = y;
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
if (!s) {
|
|
1002
|
+
const m2 = t.indexOf(".");
|
|
1003
|
+
if (m2 === -1)
|
|
1004
|
+
throw new Error(`Invalid dimensional element name format: "${e}". Expected format: "${h2}TableName.ColumnName[.Level]"`);
|
|
1005
|
+
const y = t.slice(0, m2);
|
|
1006
|
+
throw new Error(`Table "${y}" not found in the data model`);
|
|
1007
|
+
}
|
|
1008
|
+
const a = r.tableColumnMap.get(s.name);
|
|
1009
|
+
if (!a)
|
|
1010
|
+
throw new Error(`Table "${s.name}" found but has no columns`);
|
|
1011
|
+
let i, o;
|
|
1012
|
+
const u = g.all;
|
|
1013
|
+
for (const m2 of a) {
|
|
1014
|
+
if (n === m2.name)
|
|
1015
|
+
return { table: s, column: m2 };
|
|
1016
|
+
if (!n.startsWith(m2.name + "."))
|
|
1017
|
+
continue;
|
|
1018
|
+
const y = n.slice(m2.name.length + 1);
|
|
1019
|
+
if (!y)
|
|
1020
|
+
continue;
|
|
1021
|
+
const F = u.includes(y), d = Nr(m2.dataType);
|
|
1022
|
+
if (F) {
|
|
1023
|
+
if (d)
|
|
1024
|
+
return { table: s, column: m2, level: y };
|
|
1025
|
+
i || (i = m2, o = y);
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
d && !i && (i = m2, o = y);
|
|
1029
|
+
}
|
|
1030
|
+
if (i && o)
|
|
1031
|
+
throw u.includes(o) ? new Error(`Invalid date level "${o}" in dimensional element "${e}". Column "${s.name}.${i.name}" is not a datetime column`) : new Error(`Invalid date level "${o}" in dimensional element "${e}". Valid levels are: ${u.join(", ")}`);
|
|
1032
|
+
const l = n.indexOf("."), p2 = l === -1 ? n : n.slice(0, l);
|
|
1033
|
+
throw new Error(`Column "${p2}" not found in table "${s.name}"`);
|
|
1034
|
+
}
|
|
1035
|
+
function Rt(e, r) {
|
|
1036
|
+
const { table: t, column: s, level: n } = Le(e, r);
|
|
1037
|
+
if (n) {
|
|
1038
|
+
if (!Nr(s.dataType))
|
|
1039
|
+
throw new Error(`Invalid date level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is not a datetime column`);
|
|
1040
|
+
const a = g.all;
|
|
1041
|
+
if (!a.includes(n))
|
|
1042
|
+
throw new Error(`Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${a.join(", ")}`);
|
|
1043
|
+
const i = g.dateOnly;
|
|
1044
|
+
if (s.dataType === "date" && !i.includes(n))
|
|
1045
|
+
throw new Error(`Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a date column, not a datetime column`);
|
|
1046
|
+
const o = g.timeOnly;
|
|
1047
|
+
if (s.dataType === "time" && !o.includes(n))
|
|
1048
|
+
throw new Error(`Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a time column, not a date column`);
|
|
1049
|
+
}
|
|
1050
|
+
return { column: s, level: n };
|
|
1051
|
+
}
|
|
1052
|
+
function Ve(e) {
|
|
1053
|
+
return e.type === E.TextAttribute;
|
|
1054
|
+
}
|
|
1055
|
+
function We(e) {
|
|
1056
|
+
return e.type === E.NumericAttribute;
|
|
1057
|
+
}
|
|
1058
|
+
function St(e) {
|
|
1059
|
+
return e.type === E.DateLevel;
|
|
1060
|
+
}
|
|
1061
|
+
function Ot(e) {
|
|
1062
|
+
return Ve(e) || We(e);
|
|
1063
|
+
}
|
|
1064
|
+
function Q(e) {
|
|
1065
|
+
return e.type === E.TextAttribute ? "text" : e.type === E.NumericAttribute ? "numeric" : e.type === E.DateLevel ? "date/datetime" : "unknown";
|
|
1066
|
+
}
|
|
1067
|
+
function ce(e, r, t) {
|
|
1068
|
+
const { column: s, level: n } = Rt(e, t);
|
|
1069
|
+
return Cr({
|
|
1070
|
+
expression: s.expression,
|
|
1071
|
+
dataType: s.dataType,
|
|
1072
|
+
granularity: n,
|
|
1073
|
+
format: undefined,
|
|
1074
|
+
sort: undefined,
|
|
1075
|
+
dataSource: r
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
function Tt(e, r, t) {
|
|
1079
|
+
const { column: s, level: n } = Le(e, t);
|
|
1080
|
+
if (n)
|
|
1081
|
+
throw new Error(`Invalid DateDimension name format: "${e}". Expected format: "${h2}TableName.ColumnName"`);
|
|
1082
|
+
if (!Nr(s.dataType))
|
|
1083
|
+
throw new Error(`Invalid DateDimension name "${e}". Column "${s.name}" is not a datetime column (got ${s.dataType}).`);
|
|
1084
|
+
return x({
|
|
1085
|
+
name: s.name,
|
|
1086
|
+
expression: s.expression,
|
|
1087
|
+
dataSource: r
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
function M(e, r) {
|
|
1091
|
+
const t = e();
|
|
1092
|
+
return t.success ? t.data : (r.push(...t.errors), null);
|
|
1093
|
+
}
|
|
1094
|
+
var It = (e) => {
|
|
1095
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
1096
|
+
if (!r)
|
|
1097
|
+
return { success: true, data: [] };
|
|
1098
|
+
if (!Mt(r))
|
|
1099
|
+
return {
|
|
1100
|
+
success: false,
|
|
1101
|
+
errors: [
|
|
1102
|
+
{
|
|
1103
|
+
category: "dimensions",
|
|
1104
|
+
index: -1,
|
|
1105
|
+
input: r,
|
|
1106
|
+
message: "Invalid dimensions JSON. Expected an array of strings."
|
|
1107
|
+
}
|
|
1108
|
+
]
|
|
1109
|
+
};
|
|
1110
|
+
const n = [], a = [];
|
|
1111
|
+
return r.forEach((i, o) => {
|
|
1112
|
+
const u = {
|
|
1113
|
+
category: "dimensions",
|
|
1114
|
+
index: o,
|
|
1115
|
+
input: i
|
|
1116
|
+
};
|
|
1117
|
+
try {
|
|
1118
|
+
const l = ce(i, t, s);
|
|
1119
|
+
n.push(l);
|
|
1120
|
+
} catch (l) {
|
|
1121
|
+
const p2 = l instanceof Error ? l.message : "Unknown error";
|
|
1122
|
+
a.push(E3(b2({}, u), { message: p2 }));
|
|
1123
|
+
}
|
|
1124
|
+
}), a.length > 0 ? { success: false, errors: a } : { success: true, data: n };
|
|
1125
|
+
};
|
|
1126
|
+
function fe(e, r) {
|
|
1127
|
+
const t = Reflect.get(e, r);
|
|
1128
|
+
if (typeof t != "function")
|
|
1129
|
+
throw new Error(`Function "${r}" not found or is not a function`);
|
|
1130
|
+
return t;
|
|
1131
|
+
}
|
|
1132
|
+
function zt(e, r) {
|
|
1133
|
+
const t = e.replace("measureFactory.", ""), n = fe(qh, t)(...r);
|
|
1134
|
+
if (!_e2(n))
|
|
1135
|
+
throw new Error(`Function "${e}" did not return a valid Measure`);
|
|
1136
|
+
return n;
|
|
1137
|
+
}
|
|
1138
|
+
function Bt(e, r) {
|
|
1139
|
+
const t = e.replace("filterFactory.logic.", ""), n = fe(Se, t)(...r);
|
|
1140
|
+
if (!W(n))
|
|
1141
|
+
throw new Error(`Function "${e}" did not return a valid FilterRelations`);
|
|
1142
|
+
return n;
|
|
1143
|
+
}
|
|
1144
|
+
function Pt(e, r) {
|
|
1145
|
+
if (e.startsWith("filterFactory.logic."))
|
|
1146
|
+
return Bt(e, r);
|
|
1147
|
+
const t = e.replace("filterFactory.", ""), n = fe(np, t)(...r);
|
|
1148
|
+
if (!K(n) && !W(n))
|
|
1149
|
+
throw new Error(`Function "${e}" did not return a valid Filter or FilterRelations`);
|
|
1150
|
+
return n;
|
|
1151
|
+
}
|
|
1152
|
+
function kt(e, r) {
|
|
1153
|
+
const s = e.split(".")[0];
|
|
1154
|
+
if (s === "measureFactory")
|
|
1155
|
+
return zt(e, r);
|
|
1156
|
+
if (s === "filterFactory")
|
|
1157
|
+
return Pt(e, r);
|
|
1158
|
+
throw new Error(`Unsupported factory: "${s}". Supported factories: measureFactory, filterFactory`);
|
|
1159
|
+
}
|
|
1160
|
+
var _t = /\[([a-zA-Z_][a-zA-Z0-9_.-]*)\]/g;
|
|
1161
|
+
function Lt(e, r, t = {}) {
|
|
1162
|
+
const {
|
|
1163
|
+
warnUnusedContext: s = true,
|
|
1164
|
+
errorOnUnusedContext: n = true,
|
|
1165
|
+
allowEmptyFormula: a = false,
|
|
1166
|
+
errorPrefix: i = "customFormula validation"
|
|
1167
|
+
} = t, o = {
|
|
1168
|
+
isValid: true,
|
|
1169
|
+
errors: [],
|
|
1170
|
+
warnings: [],
|
|
1171
|
+
references: [],
|
|
1172
|
+
unusedContextKeys: []
|
|
1173
|
+
};
|
|
1174
|
+
if (!e || e.trim().length === 0)
|
|
1175
|
+
return a || (o.errors.push(`${i}args[1]: Formula cannot be empty`), o.isValid = false), o;
|
|
1176
|
+
const u = /\b\w+\s*\[/gi, l = e.match(u);
|
|
1177
|
+
if (l) {
|
|
1178
|
+
const f2 = l[0].replace(/\s*\[.*$/, "");
|
|
1179
|
+
o.errors.push(`${i}args[1]: Invalid syntax: '${f2}' - operator cannot be used before bracket reference without parentheses`), o.isValid = false;
|
|
1180
|
+
}
|
|
1181
|
+
const p2 = _t, m2 = /* @__PURE__ */ new Set;
|
|
1182
|
+
let y;
|
|
1183
|
+
for (;(y = p2.exec(e)) !== null; ) {
|
|
1184
|
+
const f2 = y[1];
|
|
1185
|
+
m2.add(f2);
|
|
1186
|
+
}
|
|
1187
|
+
o.references = Array.from(m2);
|
|
1188
|
+
const F = Object.keys(r);
|
|
1189
|
+
if (o.references.length > 0 && (/\b\w+\s*\(/gi.test(e) || o.references.every((A) => {
|
|
1190
|
+
if (!(A in r))
|
|
1191
|
+
return false;
|
|
1192
|
+
const D = r[A];
|
|
1193
|
+
return x2(D) ? false : typeof D == "string" && D.startsWith(h2) ? true : D && typeof D == "object" && ("kind" in D) ? D.kind !== "measure" : false;
|
|
1194
|
+
}) && (o.errors.push(`${i}args[1]: Formulas with bracket references must contain aggregate function calls`), o.isValid = false)), o.references.length === 0)
|
|
1195
|
+
return o.warnings.push(`${i}args[1]: No bracket references found in formula - ensure this is intentional`), o;
|
|
1196
|
+
if (F.length === 0)
|
|
1197
|
+
return o.errors.push(`${i}args[2]: Context cannot be empty - custom formulas require context definitions`), o.isValid = false, o;
|
|
1198
|
+
const d = [];
|
|
1199
|
+
for (const f2 of o.references)
|
|
1200
|
+
F.includes(f2) || d.push(f2);
|
|
1201
|
+
if (d.length > 0 && (o.isValid = false, d.length === 1 ? o.errors.push(`${i}args[1]: Reference [${d[0]}] not found in context. Available keys: ${F.join(", ")}`) : o.errors.push(`${i}args[1]: References [${d.join("], [")}] not found in context. Available keys: ${F.join(", ")}`)), (s || n) && F.length > 0) {
|
|
1202
|
+
const f2 = F.filter((w) => !o.references.includes(w));
|
|
1203
|
+
if (o.unusedContextKeys = f2, f2.length > 0) {
|
|
1204
|
+
const w = `${i}args[2]: Context keys [${f2.join(", ")}] are defined but not used in formula`;
|
|
1205
|
+
n ? (o.errors.push(w), o.isValid = false) : s && o.warnings.push(w);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
return o;
|
|
1209
|
+
}
|
|
1210
|
+
function Vt(e, r, t = {}) {
|
|
1211
|
+
const s = Lt(e, r, t);
|
|
1212
|
+
if (!s.isValid)
|
|
1213
|
+
throw new Error(s.errors.join("; "));
|
|
1214
|
+
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1215
|
+
}
|
|
1216
|
+
function Wt(e, r) {
|
|
1217
|
+
if (e.length < 3 || e.length > 5)
|
|
1218
|
+
throw new Error(`${r.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`);
|
|
1219
|
+
const t = e[1], s = e[2];
|
|
1220
|
+
Vt(t, s, {
|
|
1221
|
+
errorPrefix: `${r.pathPrefix}`,
|
|
1222
|
+
errorOnUnusedContext: true,
|
|
1223
|
+
allowEmptyFormula: false
|
|
1224
|
+
});
|
|
1225
|
+
const n = {};
|
|
1226
|
+
for (const [a, i] of Object.entries(s)) {
|
|
1227
|
+
const o = `args[2].${a}`;
|
|
1228
|
+
if (x2(i))
|
|
1229
|
+
n[`${a}`] = C({
|
|
1230
|
+
data: i,
|
|
1231
|
+
context: {
|
|
1232
|
+
dataSource: r.dataSource,
|
|
1233
|
+
schemaIndex: r.schemaIndex,
|
|
1234
|
+
pathPrefix: o
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
else if (typeof i == "string" && i.startsWith(h2))
|
|
1238
|
+
try {
|
|
1239
|
+
n[`${a}`] = ce(i, r.dataSource, r.schemaIndex);
|
|
1240
|
+
} catch (u) {
|
|
1241
|
+
const l = u instanceof Error ? u.message : "Unknown error";
|
|
1242
|
+
throw new Error(`${o}: ${l}`);
|
|
1243
|
+
}
|
|
1244
|
+
else if (i && typeof i == "object" && "kind" in i)
|
|
1245
|
+
n[`${a}`] = i;
|
|
1246
|
+
else
|
|
1247
|
+
throw new Error(`${o}: Invalid context value for key '${a}'. Expected a function call or attribute reference (${h2}...), but got: ${typeof i}`);
|
|
1248
|
+
}
|
|
1249
|
+
e[2] = n;
|
|
1250
|
+
}
|
|
1251
|
+
function de(e, r) {
|
|
1252
|
+
const t = e[0];
|
|
1253
|
+
if (!t || typeof t != "object" || !("type" in t))
|
|
1254
|
+
throw new Error(`${r.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1255
|
+
return t;
|
|
1256
|
+
}
|
|
1257
|
+
function qe(e, r) {
|
|
1258
|
+
const t = de(e, r);
|
|
1259
|
+
if (!Ot(t))
|
|
1260
|
+
throw new Error(`${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${Q(t)} attribute`);
|
|
1261
|
+
}
|
|
1262
|
+
function R2(e, r) {
|
|
1263
|
+
const t = de(e, r);
|
|
1264
|
+
if (!We(t))
|
|
1265
|
+
throw new Error(`${r.pathPrefix}args[0]: Attribute must be numeric type, got ${Q(t)} attribute`);
|
|
1266
|
+
}
|
|
1267
|
+
function S(e, r) {
|
|
1268
|
+
const t = de(e, r);
|
|
1269
|
+
if (!Ve(t))
|
|
1270
|
+
throw new Error(`${r.pathPrefix}args[0]: Attribute must be string type, got ${Q(t)} attribute`);
|
|
1271
|
+
}
|
|
1272
|
+
function Jt(e, r) {
|
|
1273
|
+
const t = e[0];
|
|
1274
|
+
if (!t || typeof t != "object" || !("attribute" in t))
|
|
1275
|
+
throw new Error(`${r.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1276
|
+
return t;
|
|
1277
|
+
}
|
|
1278
|
+
function Ut(e, r) {
|
|
1279
|
+
const t = Jt(e, r);
|
|
1280
|
+
if (!Vh(t))
|
|
1281
|
+
throw new Error(`${r.pathPrefix}args[0]: exclude filter only accepts members filter, got ${t.__serializable || "unknown"} filter`);
|
|
1282
|
+
}
|
|
1283
|
+
var jt = {
|
|
1284
|
+
"measureFactory.customFormula": Wt,
|
|
1285
|
+
"filterFactory.equals": qe,
|
|
1286
|
+
"filterFactory.doesntEqual": qe,
|
|
1287
|
+
"filterFactory.greaterThan": R2,
|
|
1288
|
+
"filterFactory.greaterThanOrEqual": R2,
|
|
1289
|
+
"filterFactory.lessThan": R2,
|
|
1290
|
+
"filterFactory.lessThanOrEqual": R2,
|
|
1291
|
+
"filterFactory.between": R2,
|
|
1292
|
+
"filterFactory.betweenNotEqual": R2,
|
|
1293
|
+
"filterFactory.numeric": R2,
|
|
1294
|
+
"filterFactory.contains": S,
|
|
1295
|
+
"filterFactory.doesntContain": S,
|
|
1296
|
+
"filterFactory.startsWith": S,
|
|
1297
|
+
"filterFactory.doesntStartWith": S,
|
|
1298
|
+
"filterFactory.endsWith": S,
|
|
1299
|
+
"filterFactory.doesntEndWith": S,
|
|
1300
|
+
"filterFactory.like": S,
|
|
1301
|
+
"filterFactory.exclude": Ut
|
|
1302
|
+
};
|
|
1303
|
+
function Kt(e) {
|
|
1304
|
+
return jt[`${e}`];
|
|
1305
|
+
}
|
|
1306
|
+
var Qt2 = {
|
|
1307
|
+
"measureFactory.sum": [
|
|
1308
|
+
{ type: "Attribute", required: true },
|
|
1309
|
+
{ type: "string", required: false },
|
|
1310
|
+
{ type: "string", required: false }
|
|
1311
|
+
],
|
|
1312
|
+
"measureFactory.average": [
|
|
1313
|
+
{ type: "Attribute", required: true },
|
|
1314
|
+
{ type: "string", required: false },
|
|
1315
|
+
{ type: "string", required: false }
|
|
1316
|
+
],
|
|
1317
|
+
"measureFactory.avg": [
|
|
1318
|
+
{ type: "Attribute", required: true },
|
|
1319
|
+
{ type: "string", required: false },
|
|
1320
|
+
{ type: "string", required: false }
|
|
1321
|
+
],
|
|
1322
|
+
"measureFactory.min": [
|
|
1323
|
+
{ type: "Attribute", required: true },
|
|
1324
|
+
{ type: "string", required: false },
|
|
1325
|
+
{ type: "string", required: false }
|
|
1326
|
+
],
|
|
1327
|
+
"measureFactory.max": [
|
|
1328
|
+
{ type: "Attribute", required: true },
|
|
1329
|
+
{ type: "string", required: false },
|
|
1330
|
+
{ type: "string", required: false }
|
|
1331
|
+
],
|
|
1332
|
+
"measureFactory.median": [
|
|
1333
|
+
{ type: "Attribute", required: true },
|
|
1334
|
+
{ type: "string", required: false },
|
|
1335
|
+
{ type: "string", required: false }
|
|
1336
|
+
],
|
|
1337
|
+
"measureFactory.count": [
|
|
1338
|
+
{ type: "Attribute", required: true },
|
|
1339
|
+
{ type: "string", required: false },
|
|
1340
|
+
{ type: "string", required: false }
|
|
1341
|
+
],
|
|
1342
|
+
"measureFactory.countDistinct": [
|
|
1343
|
+
{ type: "Attribute", required: true },
|
|
1344
|
+
{ type: "string", required: false },
|
|
1345
|
+
{ type: "string", required: false }
|
|
1346
|
+
],
|
|
1347
|
+
"measureFactory.aggregate": [
|
|
1348
|
+
{ type: "Attribute", required: true },
|
|
1349
|
+
{ type: "string", required: true },
|
|
1350
|
+
{ type: "string", required: false },
|
|
1351
|
+
{ type: "string", required: false }
|
|
1352
|
+
],
|
|
1353
|
+
"measureFactory.constant": [{ type: "number", required: true }],
|
|
1354
|
+
"measureFactory.customFormula": [
|
|
1355
|
+
{ type: "string", required: true },
|
|
1356
|
+
{ type: "string", required: true },
|
|
1357
|
+
{ type: "CustomFormulaContext", required: true },
|
|
1358
|
+
{ type: "string", required: false },
|
|
1359
|
+
{ type: "string", required: false }
|
|
1360
|
+
],
|
|
1361
|
+
"measureFactory.add": [
|
|
1362
|
+
{ type: "Measure | number", required: true },
|
|
1363
|
+
{ type: "Measure | number", required: true },
|
|
1364
|
+
{ type: "string", required: false },
|
|
1365
|
+
{ type: "boolean", required: false }
|
|
1366
|
+
],
|
|
1367
|
+
"measureFactory.subtract": [
|
|
1368
|
+
{ type: "Measure | number", required: true },
|
|
1369
|
+
{ type: "Measure | number", required: true },
|
|
1370
|
+
{ type: "string", required: false },
|
|
1371
|
+
{ type: "boolean", required: false }
|
|
1372
|
+
],
|
|
1373
|
+
"measureFactory.multiply": [
|
|
1374
|
+
{ type: "Measure | number", required: true },
|
|
1375
|
+
{ type: "Measure | number", required: true },
|
|
1376
|
+
{ type: "string", required: false },
|
|
1377
|
+
{ type: "boolean", required: false }
|
|
1378
|
+
],
|
|
1379
|
+
"measureFactory.divide": [
|
|
1380
|
+
{ type: "Measure | number", required: true },
|
|
1381
|
+
{ type: "Measure | number", required: true },
|
|
1382
|
+
{ type: "string", required: false },
|
|
1383
|
+
{ type: "boolean", required: false }
|
|
1384
|
+
],
|
|
1385
|
+
"measureFactory.measuredValue": [
|
|
1386
|
+
{ type: "Measure", required: true },
|
|
1387
|
+
{ type: "Filter[]", required: true },
|
|
1388
|
+
{ type: "string", required: false },
|
|
1389
|
+
{ type: "string", required: false }
|
|
1390
|
+
],
|
|
1391
|
+
"measureFactory.rank": [
|
|
1392
|
+
{ type: "Measure", required: true },
|
|
1393
|
+
{ type: "string", required: false },
|
|
1394
|
+
{ type: "string", required: false },
|
|
1395
|
+
{ type: "string", required: false },
|
|
1396
|
+
{ type: "Attribute[]", required: false }
|
|
1397
|
+
],
|
|
1398
|
+
"measureFactory.trend": [
|
|
1399
|
+
{ type: "Measure", required: true },
|
|
1400
|
+
{ type: "string", required: false },
|
|
1401
|
+
{ type: "any", required: false }
|
|
1402
|
+
],
|
|
1403
|
+
"measureFactory.forecast": [
|
|
1404
|
+
{ type: "Measure", required: true },
|
|
1405
|
+
{ type: "string", required: false },
|
|
1406
|
+
{ type: "any", required: false }
|
|
1407
|
+
],
|
|
1408
|
+
"measureFactory.yearToDateSum": [
|
|
1409
|
+
{ type: "Measure", required: true },
|
|
1410
|
+
{ type: "string", required: false }
|
|
1411
|
+
],
|
|
1412
|
+
"measureFactory.quarterToDateSum": [
|
|
1413
|
+
{ type: "Measure", required: true },
|
|
1414
|
+
{ type: "string", required: false }
|
|
1415
|
+
],
|
|
1416
|
+
"measureFactory.monthToDateSum": [
|
|
1417
|
+
{ type: "Measure", required: true },
|
|
1418
|
+
{ type: "string", required: false }
|
|
1419
|
+
],
|
|
1420
|
+
"measureFactory.weekToDateSum": [
|
|
1421
|
+
{ type: "Measure", required: true },
|
|
1422
|
+
{ type: "string", required: false }
|
|
1423
|
+
],
|
|
1424
|
+
"measureFactory.runningSum": [
|
|
1425
|
+
{ type: "Measure", required: true },
|
|
1426
|
+
{ type: "boolean", required: false },
|
|
1427
|
+
{ type: "string", required: false }
|
|
1428
|
+
],
|
|
1429
|
+
"measureFactory.growth": [
|
|
1430
|
+
{ type: "Measure", required: true },
|
|
1431
|
+
{ type: "string", required: false }
|
|
1432
|
+
],
|
|
1433
|
+
"measureFactory.growthRate": [
|
|
1434
|
+
{ type: "Measure", required: true },
|
|
1435
|
+
{ type: "string", required: false }
|
|
1436
|
+
],
|
|
1437
|
+
"measureFactory.growthPastWeek": [
|
|
1438
|
+
{ type: "Measure", required: true },
|
|
1439
|
+
{ type: "string", required: false }
|
|
1440
|
+
],
|
|
1441
|
+
"measureFactory.growthPastMonth": [
|
|
1442
|
+
{ type: "Measure", required: true },
|
|
1443
|
+
{ type: "string", required: false }
|
|
1444
|
+
],
|
|
1445
|
+
"measureFactory.growthPastQuarter": [
|
|
1446
|
+
{ type: "Measure", required: true },
|
|
1447
|
+
{ type: "string", required: false }
|
|
1448
|
+
],
|
|
1449
|
+
"measureFactory.growthPastYear": [
|
|
1450
|
+
{ type: "Measure", required: true },
|
|
1451
|
+
{ type: "string", required: false }
|
|
1452
|
+
],
|
|
1453
|
+
"measureFactory.difference": [
|
|
1454
|
+
{ type: "Measure", required: true },
|
|
1455
|
+
{ type: "string", required: false }
|
|
1456
|
+
],
|
|
1457
|
+
"measureFactory.diffPastWeek": [
|
|
1458
|
+
{ type: "Measure", required: true },
|
|
1459
|
+
{ type: "string", required: false }
|
|
1460
|
+
],
|
|
1461
|
+
"measureFactory.diffPastMonth": [
|
|
1462
|
+
{ type: "Measure", required: true },
|
|
1463
|
+
{ type: "string", required: false }
|
|
1464
|
+
],
|
|
1465
|
+
"measureFactory.diffPastQuarter": [
|
|
1466
|
+
{ type: "Measure", required: true },
|
|
1467
|
+
{ type: "string", required: false }
|
|
1468
|
+
],
|
|
1469
|
+
"measureFactory.diffPastYear": [
|
|
1470
|
+
{ type: "Measure", required: true },
|
|
1471
|
+
{ type: "string", required: false }
|
|
1472
|
+
],
|
|
1473
|
+
"measureFactory.pastDay": [
|
|
1474
|
+
{ type: "Measure", required: true },
|
|
1475
|
+
{ type: "string", required: false }
|
|
1476
|
+
],
|
|
1477
|
+
"measureFactory.pastWeek": [
|
|
1478
|
+
{ type: "Measure", required: true },
|
|
1479
|
+
{ type: "string", required: false }
|
|
1480
|
+
],
|
|
1481
|
+
"measureFactory.pastMonth": [
|
|
1482
|
+
{ type: "Measure", required: true },
|
|
1483
|
+
{ type: "string", required: false }
|
|
1484
|
+
],
|
|
1485
|
+
"measureFactory.pastQuarter": [
|
|
1486
|
+
{ type: "Measure", required: true },
|
|
1487
|
+
{ type: "string", required: false }
|
|
1488
|
+
],
|
|
1489
|
+
"measureFactory.pastYear": [
|
|
1490
|
+
{ type: "Measure", required: true },
|
|
1491
|
+
{ type: "string", required: false }
|
|
1492
|
+
],
|
|
1493
|
+
"measureFactory.contribution": [
|
|
1494
|
+
{ type: "Measure", required: true },
|
|
1495
|
+
{ type: "string", required: false }
|
|
1496
|
+
],
|
|
1497
|
+
"filterFactory.union": [
|
|
1498
|
+
{ type: "Filter[]", required: true },
|
|
1499
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1500
|
+
],
|
|
1501
|
+
"filterFactory.intersection": [
|
|
1502
|
+
{ type: "Filter[]", required: true },
|
|
1503
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1504
|
+
],
|
|
1505
|
+
"filterFactory.exclude": [
|
|
1506
|
+
{ type: "Filter", required: true },
|
|
1507
|
+
{ type: "Filter", required: false },
|
|
1508
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1509
|
+
],
|
|
1510
|
+
"filterFactory.contains": [
|
|
1511
|
+
{ type: "Attribute", required: true },
|
|
1512
|
+
{ type: "string", required: true },
|
|
1513
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1514
|
+
],
|
|
1515
|
+
"filterFactory.doesntContain": [
|
|
1516
|
+
{ type: "Attribute", required: true },
|
|
1517
|
+
{ type: "string", required: true },
|
|
1518
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1519
|
+
],
|
|
1520
|
+
"filterFactory.startsWith": [
|
|
1521
|
+
{ type: "Attribute", required: true },
|
|
1522
|
+
{ type: "string", required: true },
|
|
1523
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1524
|
+
],
|
|
1525
|
+
"filterFactory.doesntStartWith": [
|
|
1526
|
+
{ type: "Attribute", required: true },
|
|
1527
|
+
{ type: "string", required: true },
|
|
1528
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1529
|
+
],
|
|
1530
|
+
"filterFactory.endsWith": [
|
|
1531
|
+
{ type: "Attribute", required: true },
|
|
1532
|
+
{ type: "string", required: true },
|
|
1533
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1534
|
+
],
|
|
1535
|
+
"filterFactory.doesntEndWith": [
|
|
1536
|
+
{ type: "Attribute", required: true },
|
|
1537
|
+
{ type: "string", required: true },
|
|
1538
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1539
|
+
],
|
|
1540
|
+
"filterFactory.like": [
|
|
1541
|
+
{ type: "Attribute", required: true },
|
|
1542
|
+
{ type: "string", required: true },
|
|
1543
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1544
|
+
],
|
|
1545
|
+
"filterFactory.equals": [
|
|
1546
|
+
{ type: "Attribute", required: true },
|
|
1547
|
+
{ type: "string | number", required: true },
|
|
1548
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1549
|
+
],
|
|
1550
|
+
"filterFactory.doesntEqual": [
|
|
1551
|
+
{ type: "Attribute", required: true },
|
|
1552
|
+
{ type: "string | number", required: true },
|
|
1553
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1554
|
+
],
|
|
1555
|
+
"filterFactory.greaterThan": [
|
|
1556
|
+
{ type: "Attribute", required: true },
|
|
1557
|
+
{ type: "number", required: true },
|
|
1558
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1559
|
+
],
|
|
1560
|
+
"filterFactory.greaterThanOrEqual": [
|
|
1561
|
+
{ type: "Attribute", required: true },
|
|
1562
|
+
{ type: "number", required: true },
|
|
1563
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1564
|
+
],
|
|
1565
|
+
"filterFactory.lessThan": [
|
|
1566
|
+
{ type: "Attribute", required: true },
|
|
1567
|
+
{ type: "number", required: true },
|
|
1568
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1569
|
+
],
|
|
1570
|
+
"filterFactory.lessThanOrEqual": [
|
|
1571
|
+
{ type: "Attribute", required: true },
|
|
1572
|
+
{ type: "number", required: true },
|
|
1573
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1574
|
+
],
|
|
1575
|
+
"filterFactory.between": [
|
|
1576
|
+
{ type: "Attribute", required: true },
|
|
1577
|
+
{ type: "number", required: true },
|
|
1578
|
+
{ type: "number", required: true },
|
|
1579
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1580
|
+
],
|
|
1581
|
+
"filterFactory.betweenNotEqual": [
|
|
1582
|
+
{ type: "Attribute", required: true },
|
|
1583
|
+
{ type: "number", required: true },
|
|
1584
|
+
{ type: "number", required: true },
|
|
1585
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1586
|
+
],
|
|
1587
|
+
"filterFactory.numeric": [
|
|
1588
|
+
{ type: "Attribute", required: true },
|
|
1589
|
+
{ type: "string", required: false },
|
|
1590
|
+
{ type: "number", required: false },
|
|
1591
|
+
{ type: "string", required: false },
|
|
1592
|
+
{ type: "number", required: false },
|
|
1593
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1594
|
+
],
|
|
1595
|
+
"filterFactory.members": [
|
|
1596
|
+
{ type: "Attribute", required: true },
|
|
1597
|
+
{ type: "string[]", required: true },
|
|
1598
|
+
{ type: "MembersFilterConfig", required: false }
|
|
1599
|
+
],
|
|
1600
|
+
"filterFactory.dateFrom": [
|
|
1601
|
+
{ type: "LevelAttribute", required: true },
|
|
1602
|
+
{ type: "Date | string", required: true },
|
|
1603
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1604
|
+
],
|
|
1605
|
+
"filterFactory.dateTo": [
|
|
1606
|
+
{ type: "LevelAttribute", required: true },
|
|
1607
|
+
{ type: "Date | string", required: true },
|
|
1608
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1609
|
+
],
|
|
1610
|
+
"filterFactory.dateRange": [
|
|
1611
|
+
{ type: "LevelAttribute", required: true },
|
|
1612
|
+
{ type: "Date | string", required: false },
|
|
1613
|
+
{ type: "Date | string", required: false },
|
|
1614
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1615
|
+
],
|
|
1616
|
+
"filterFactory.dateRelative": [
|
|
1617
|
+
{ type: "LevelAttribute", required: true },
|
|
1618
|
+
{ type: "number", required: true },
|
|
1619
|
+
{ type: "number", required: true },
|
|
1620
|
+
{ type: "Date | string", required: false },
|
|
1621
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1622
|
+
],
|
|
1623
|
+
"filterFactory.dateRelativeFrom": [
|
|
1624
|
+
{ type: "LevelAttribute", required: true },
|
|
1625
|
+
{ type: "number", required: true },
|
|
1626
|
+
{ type: "number", required: true },
|
|
1627
|
+
{ type: "Date | string", required: false },
|
|
1628
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1629
|
+
],
|
|
1630
|
+
"filterFactory.dateRelativeTo": [
|
|
1631
|
+
{ type: "LevelAttribute", required: true },
|
|
1632
|
+
{ type: "number", required: true },
|
|
1633
|
+
{ type: "number", required: true },
|
|
1634
|
+
{ type: "Date | string", required: false },
|
|
1635
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1636
|
+
],
|
|
1637
|
+
"filterFactory.thisYear": [
|
|
1638
|
+
{ type: "DateDimension", required: true },
|
|
1639
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1640
|
+
],
|
|
1641
|
+
"filterFactory.thisMonth": [
|
|
1642
|
+
{ type: "DateDimension", required: true },
|
|
1643
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1644
|
+
],
|
|
1645
|
+
"filterFactory.thisQuarter": [
|
|
1646
|
+
{ type: "DateDimension", required: true },
|
|
1647
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1648
|
+
],
|
|
1649
|
+
"filterFactory.today": [
|
|
1650
|
+
{ type: "DateDimension", required: true },
|
|
1651
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1652
|
+
],
|
|
1653
|
+
"filterFactory.measureEquals": [
|
|
1654
|
+
{ type: "BaseMeasure", required: true },
|
|
1655
|
+
{ type: "number", required: true },
|
|
1656
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1657
|
+
],
|
|
1658
|
+
"filterFactory.measureGreaterThan": [
|
|
1659
|
+
{ type: "BaseMeasure", required: true },
|
|
1660
|
+
{ type: "number", required: true },
|
|
1661
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1662
|
+
],
|
|
1663
|
+
"filterFactory.measureGreaterThanOrEqual": [
|
|
1664
|
+
{ type: "BaseMeasure", required: true },
|
|
1665
|
+
{ type: "number", required: true },
|
|
1666
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1667
|
+
],
|
|
1668
|
+
"filterFactory.measureLessThan": [
|
|
1669
|
+
{ type: "BaseMeasure", required: true },
|
|
1670
|
+
{ type: "number", required: true },
|
|
1671
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1672
|
+
],
|
|
1673
|
+
"filterFactory.measureLessThanOrEqual": [
|
|
1674
|
+
{ type: "BaseMeasure", required: true },
|
|
1675
|
+
{ type: "number", required: true },
|
|
1676
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1677
|
+
],
|
|
1678
|
+
"filterFactory.measureBetween": [
|
|
1679
|
+
{ type: "BaseMeasure", required: true },
|
|
1680
|
+
{ type: "number", required: true },
|
|
1681
|
+
{ type: "number", required: true },
|
|
1682
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1683
|
+
],
|
|
1684
|
+
"filterFactory.measureBetweenNotEqual": [
|
|
1685
|
+
{ type: "BaseMeasure", required: true },
|
|
1686
|
+
{ type: "number", required: true },
|
|
1687
|
+
{ type: "number", required: true },
|
|
1688
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1689
|
+
],
|
|
1690
|
+
"filterFactory.topRanking": [
|
|
1691
|
+
{ type: "Attribute", required: true },
|
|
1692
|
+
{ type: "Measure", required: true },
|
|
1693
|
+
{ type: "number", required: true },
|
|
1694
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1695
|
+
],
|
|
1696
|
+
"filterFactory.bottomRanking": [
|
|
1697
|
+
{ type: "Attribute", required: true },
|
|
1698
|
+
{ type: "Measure", required: true },
|
|
1699
|
+
{ type: "number", required: true },
|
|
1700
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1701
|
+
],
|
|
1702
|
+
"filterFactory.measureTopRanking": [
|
|
1703
|
+
{ type: "BaseMeasure", required: true },
|
|
1704
|
+
{ type: "number", required: true },
|
|
1705
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1706
|
+
],
|
|
1707
|
+
"filterFactory.measureBottomRanking": [
|
|
1708
|
+
{ type: "BaseMeasure", required: true },
|
|
1709
|
+
{ type: "number", required: true },
|
|
1710
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1711
|
+
],
|
|
1712
|
+
"filterFactory.cascading": [
|
|
1713
|
+
{ type: "Filter[]", required: true },
|
|
1714
|
+
{ type: "BaseFilterConfig", required: false }
|
|
1715
|
+
],
|
|
1716
|
+
"filterFactory.logic.and": [
|
|
1717
|
+
{ type: "FilterRelationsNode", required: true },
|
|
1718
|
+
{ type: "FilterRelationsNode", required: true }
|
|
1719
|
+
],
|
|
1720
|
+
"filterFactory.logic.or": [
|
|
1721
|
+
{ type: "FilterRelationsNode", required: true },
|
|
1722
|
+
{ type: "FilterRelationsNode", required: true }
|
|
1723
|
+
]
|
|
1724
|
+
};
|
|
1725
|
+
function me(e) {
|
|
1726
|
+
return Qt2[`${e}`];
|
|
1727
|
+
}
|
|
1728
|
+
function Yt2(e) {
|
|
1729
|
+
const r = me(e);
|
|
1730
|
+
return r ? r.filter((t) => t.required).length : 0;
|
|
1731
|
+
}
|
|
1732
|
+
function Ht(e) {
|
|
1733
|
+
const r = me(e);
|
|
1734
|
+
return r ? r.length : 0;
|
|
1735
|
+
}
|
|
1736
|
+
function Zt(e) {
|
|
1737
|
+
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
1738
|
+
return false;
|
|
1739
|
+
const t = Date.parse(e);
|
|
1740
|
+
if (isNaN(t) || e.length < 10)
|
|
1741
|
+
return false;
|
|
1742
|
+
const s = new Date(e);
|
|
1743
|
+
return !isNaN(s.getTime());
|
|
1744
|
+
}
|
|
1745
|
+
function Z2(e, r, t, s) {
|
|
1746
|
+
if (e.startsWith(h2))
|
|
1747
|
+
try {
|
|
1748
|
+
return ce(e, r, t);
|
|
1749
|
+
} catch (n) {
|
|
1750
|
+
const a = n instanceof Error ? n.message : "Unknown error";
|
|
1751
|
+
throw new Error(`${s}: ${a}`);
|
|
1752
|
+
}
|
|
1753
|
+
throw new Error(`${s}: Invalid attribute "${e}". Expected format: "${h2}TableName.ColumnName[.Level]"`);
|
|
1754
|
+
}
|
|
1755
|
+
function Gt(e, r, t, s) {
|
|
1756
|
+
if (e.startsWith(h2))
|
|
1757
|
+
try {
|
|
1758
|
+
return Tt(e, r, t);
|
|
1759
|
+
} catch (n) {
|
|
1760
|
+
const a = n instanceof Error ? n.message : "Unknown error";
|
|
1761
|
+
throw new Error(`${s}: ${a}`);
|
|
1762
|
+
}
|
|
1763
|
+
throw new Error(`${s}: Invalid date dimension string "${e}". Expected format: "${h2}TableName.ColumnName"`);
|
|
1764
|
+
}
|
|
1765
|
+
function Xt(e) {
|
|
1766
|
+
const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix: a } = e.context, i = a;
|
|
1767
|
+
if (r === undefined) {
|
|
1768
|
+
if (t.required)
|
|
1769
|
+
throw new Error(`${i}: Required argument is missing (expected ${t.type})`);
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
switch (t.type) {
|
|
1773
|
+
case "string":
|
|
1774
|
+
if (typeof r != "string")
|
|
1775
|
+
throw new Error(`${i}: Expected string, got ${typeof r}`);
|
|
1776
|
+
return r;
|
|
1777
|
+
case "number":
|
|
1778
|
+
if (typeof r != "number")
|
|
1779
|
+
throw new Error(`${i}: Expected number, got ${typeof r}`);
|
|
1780
|
+
return r;
|
|
1781
|
+
case "boolean":
|
|
1782
|
+
if (typeof r != "boolean")
|
|
1783
|
+
throw new Error(`${i}: Expected boolean, got ${typeof r}`);
|
|
1784
|
+
return r;
|
|
1785
|
+
case "string[]":
|
|
1786
|
+
if (!Array.isArray(r))
|
|
1787
|
+
throw new Error(`${i}: Expected array of strings, got ${typeof r}. Example: ["value1", "value2"]`);
|
|
1788
|
+
if (!r.every((o) => typeof o == "string"))
|
|
1789
|
+
throw new Error(`${i}: Expected array of strings, but contains non-string values`);
|
|
1790
|
+
return r;
|
|
1791
|
+
case "number[]":
|
|
1792
|
+
if (!Array.isArray(r))
|
|
1793
|
+
throw new Error(`${i}: Expected array of numbers, got ${typeof r}. Example: [10, 20]`);
|
|
1794
|
+
if (!r.every((o) => typeof o == "number"))
|
|
1795
|
+
throw new Error(`${i}: Expected array of numbers, but contains non-number values`);
|
|
1796
|
+
return r;
|
|
1797
|
+
case "Attribute":
|
|
1798
|
+
if (typeof r != "string")
|
|
1799
|
+
throw new Error(`${i}: Expected attribute string, got ${typeof r}. Example: "DM.Commerce.Revenue"`);
|
|
1800
|
+
return Z2(r, s, n, i);
|
|
1801
|
+
case "Attribute[]":
|
|
1802
|
+
if (!Array.isArray(r))
|
|
1803
|
+
throw new Error(`${i}: Expected array of attributes, got ${typeof r}. Example: ["DM.Commerce.AgeRange"]`);
|
|
1804
|
+
return r.map((o, u) => {
|
|
1805
|
+
if (typeof o != "string")
|
|
1806
|
+
throw new Error(`${i}[${u}]: Expected attribute string, got ${typeof o}`);
|
|
1807
|
+
return Z2(o, s, n, `${i}[${u}]`);
|
|
1808
|
+
});
|
|
1809
|
+
case "Measure":
|
|
1810
|
+
case "BaseMeasure":
|
|
1811
|
+
if (!x2(r))
|
|
1812
|
+
throw new Error(`${i}: Expected measure function call, got ${typeof r}. Example: {"function": "measureFactory.sum", "args": ["DM.Commerce.Revenue"]}`);
|
|
1813
|
+
return C({
|
|
1814
|
+
data: r,
|
|
1815
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1816
|
+
});
|
|
1817
|
+
case "Measure[]":
|
|
1818
|
+
if (!Array.isArray(r))
|
|
1819
|
+
throw new Error(`${i}: Expected array of measure function calls, got ${typeof r}`);
|
|
1820
|
+
return r.map((o, u) => {
|
|
1821
|
+
if (!x2(o))
|
|
1822
|
+
throw new Error(`${i}[${u}]: Expected measure function call, got ${typeof o}`);
|
|
1823
|
+
return C({
|
|
1824
|
+
data: o,
|
|
1825
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1826
|
+
});
|
|
1827
|
+
});
|
|
1828
|
+
case "Filter":
|
|
1829
|
+
if (!x2(r))
|
|
1830
|
+
throw new Error(`${i}: Expected filter function call, got ${typeof r}. Example: {"function": "filterFactory.contains", "args": ["DM.Brand.Brand", "Apple"]}`);
|
|
1831
|
+
return C({
|
|
1832
|
+
data: r,
|
|
1833
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1834
|
+
});
|
|
1835
|
+
case "Filter[]":
|
|
1836
|
+
if (!Array.isArray(r))
|
|
1837
|
+
throw new Error(`${i}: Expected array of filter function calls, got ${typeof r}`);
|
|
1838
|
+
return r.map((o, u) => {
|
|
1839
|
+
if (!x2(o))
|
|
1840
|
+
throw new Error(`${i}[${u}]: Expected filter function call, got ${typeof o}`);
|
|
1841
|
+
return C({
|
|
1842
|
+
data: o,
|
|
1843
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1844
|
+
});
|
|
1845
|
+
});
|
|
1846
|
+
case "FilterRelationsNode":
|
|
1847
|
+
if (Array.isArray(r))
|
|
1848
|
+
return r.map((o, u) => {
|
|
1849
|
+
if (!x2(o))
|
|
1850
|
+
throw new Error(`${i}[${u}]: Expected filter function call, got ${typeof o}`);
|
|
1851
|
+
return C({
|
|
1852
|
+
data: o,
|
|
1853
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1854
|
+
});
|
|
1855
|
+
});
|
|
1856
|
+
if (x2(r))
|
|
1857
|
+
return C({
|
|
1858
|
+
data: r,
|
|
1859
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1860
|
+
});
|
|
1861
|
+
throw new Error(`${i}: Expected filter function call or array of filters, got ${typeof r}`);
|
|
1862
|
+
case "DateDimension":
|
|
1863
|
+
if (typeof r != "string")
|
|
1864
|
+
throw new Error(`${i}: Expected date dimension string, got ${typeof r}. Example: "DM.Commerce.Date"`);
|
|
1865
|
+
return Gt(r, s, n, i);
|
|
1866
|
+
case "LevelAttribute": {
|
|
1867
|
+
if (typeof r != "string")
|
|
1868
|
+
throw new Error(`${i}: Expected date attribute string, got ${typeof r}. Example: "DM.Commerce.Date.Years"`);
|
|
1869
|
+
const o = Z2(r, s, n, i);
|
|
1870
|
+
if (!St(o))
|
|
1871
|
+
throw new Error(`${i}: Attribute must be date/datetime type, got ${Q(o)} attribute`);
|
|
1872
|
+
return o;
|
|
1873
|
+
}
|
|
1874
|
+
case "Measure | number":
|
|
1875
|
+
if (typeof r == "number")
|
|
1876
|
+
return r;
|
|
1877
|
+
if (x2(r))
|
|
1878
|
+
return C({
|
|
1879
|
+
data: r,
|
|
1880
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
1881
|
+
});
|
|
1882
|
+
throw new Error(`${i}: Expected measure function call or number, got ${typeof r}`);
|
|
1883
|
+
case "Date | string":
|
|
1884
|
+
if (typeof r == "string") {
|
|
1885
|
+
if (Zt(r))
|
|
1886
|
+
return r;
|
|
1887
|
+
throw new Error(`${i}: Expected valid ISO date string or Date object, got invalid date string "${r}"`);
|
|
1888
|
+
} else {
|
|
1889
|
+
if (r instanceof Date)
|
|
1890
|
+
return r;
|
|
1891
|
+
throw new Error(`${i}: Expected date string or Date object, got ${typeof r}`);
|
|
1892
|
+
}
|
|
1893
|
+
case "string | number":
|
|
1894
|
+
if (typeof r == "string" || typeof r == "number")
|
|
1895
|
+
return r;
|
|
1896
|
+
throw new Error(`${i}: Expected string or number, got ${typeof r}`);
|
|
1897
|
+
case "BaseFilterConfig":
|
|
1898
|
+
case "MembersFilterConfig":
|
|
1899
|
+
case "CustomFormulaContext":
|
|
1900
|
+
case "any":
|
|
1901
|
+
if (r == null && t.required)
|
|
1902
|
+
throw new Error(`${i}: Required argument is null/undefined`);
|
|
1903
|
+
return r;
|
|
1904
|
+
default:
|
|
1905
|
+
return r;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
function C(e) {
|
|
1909
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function: a, args: i } = r, o = n ? `${n}.` : "", u = me(a);
|
|
1910
|
+
if (!u)
|
|
1911
|
+
throw new Error(`${o}function: Unknown function "${a}"`);
|
|
1912
|
+
const l = Yt2(a), p2 = Ht(a);
|
|
1913
|
+
if (i.length < l)
|
|
1914
|
+
throw new Error(`${o}function: Expected at least ${l} arguments, got ${i.length}`);
|
|
1915
|
+
if (i.length > p2)
|
|
1916
|
+
throw new Error(`${o}function: Expected at most ${p2} arguments, got ${i.length}`);
|
|
1917
|
+
const m2 = [], y = [];
|
|
1918
|
+
for (let d = 0;d < Math.max(i.length, u.length); d++) {
|
|
1919
|
+
const f2 = u[`${d}`], w = i[`${d}`], T2 = o ? `${o}args[${d}]` : `args[${d}]`;
|
|
1920
|
+
if (w === undefined) {
|
|
1921
|
+
f2 != null && f2.required && y.push(`${T2}: Missing required argument (expected ${f2.type})`);
|
|
1922
|
+
continue;
|
|
1923
|
+
}
|
|
1924
|
+
if (!f2) {
|
|
1925
|
+
y.push(`${T2}: Unexpected argument`);
|
|
1926
|
+
continue;
|
|
1927
|
+
}
|
|
1928
|
+
try {
|
|
1929
|
+
const A = Xt({
|
|
1930
|
+
data: w,
|
|
1931
|
+
context: {
|
|
1932
|
+
dataSource: t,
|
|
1933
|
+
schemaIndex: s,
|
|
1934
|
+
pathPrefix: T2,
|
|
1935
|
+
argSchema: f2
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
1938
|
+
m2.push(A);
|
|
1939
|
+
} catch (A) {
|
|
1940
|
+
const D = A instanceof Error ? A.message : "Unknown error";
|
|
1941
|
+
y.push(D);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
if (y.length > 0) {
|
|
1945
|
+
const d = y.join("; ");
|
|
1946
|
+
throw new Error(d);
|
|
1947
|
+
}
|
|
1948
|
+
const F = Kt(a);
|
|
1949
|
+
if (F)
|
|
1950
|
+
try {
|
|
1951
|
+
F(m2, {
|
|
1952
|
+
dataSource: t,
|
|
1953
|
+
schemaIndex: s,
|
|
1954
|
+
pathPrefix: o
|
|
1955
|
+
});
|
|
1956
|
+
} catch (d) {
|
|
1957
|
+
const f2 = d instanceof Error ? d.message : "Unknown validation error";
|
|
1958
|
+
throw new Error(f2);
|
|
1959
|
+
}
|
|
1960
|
+
return kt(a, m2);
|
|
1961
|
+
}
|
|
1962
|
+
function Je(e) {
|
|
1963
|
+
const { attribute: r, config: t } = e;
|
|
1964
|
+
if (Vh(e) && mp(r)) {
|
|
1965
|
+
const { granularity: s } = r, n = e.members.map((o) => s === "Years" && !isNaN(Number(o)) ? `${o}-01-01T00:00:00` : o), a = Fi(t), i = Object.keys(a).length === 0 ? undefined : a;
|
|
1966
|
+
return Ct(r, n, i);
|
|
1967
|
+
}
|
|
1968
|
+
return e;
|
|
1969
|
+
}
|
|
1970
|
+
function vt(e) {
|
|
1971
|
+
let r = [];
|
|
1972
|
+
for (const t of e)
|
|
1973
|
+
W(t) ? r = bp(t, r) : r = bp([Je(t)], r);
|
|
1974
|
+
return r != null ? r : [];
|
|
1975
|
+
}
|
|
1976
|
+
var es = (e) => {
|
|
1977
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], a = [];
|
|
1978
|
+
return r.forEach((i, o) => {
|
|
1979
|
+
const u = {
|
|
1980
|
+
category: "filters",
|
|
1981
|
+
index: o,
|
|
1982
|
+
input: i
|
|
1983
|
+
};
|
|
1984
|
+
try {
|
|
1985
|
+
const l = C({
|
|
1986
|
+
data: i,
|
|
1987
|
+
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
1988
|
+
});
|
|
1989
|
+
!W(l) && !K(l) ? a.push(E3(b2({}, u), { message: "Invalid filter JSON" })) : n.push(l);
|
|
1990
|
+
} catch (l) {
|
|
1991
|
+
const p2 = l instanceof Error ? l.message : "Unknown error";
|
|
1992
|
+
a.push(E3(b2({}, u), { message: p2 }));
|
|
1993
|
+
}
|
|
1994
|
+
}), a.length > 0 ? { success: false, errors: a } : { success: true, data: vt(n) };
|
|
1995
|
+
};
|
|
1996
|
+
var rs = (e) => {
|
|
1997
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
1998
|
+
return r ? le(r) ? es({
|
|
1999
|
+
data: r,
|
|
2000
|
+
context: { dataSource: t, schemaIndex: s }
|
|
2001
|
+
}) : {
|
|
2002
|
+
success: false,
|
|
2003
|
+
errors: [
|
|
2004
|
+
{
|
|
2005
|
+
category: "filters",
|
|
2006
|
+
index: -1,
|
|
2007
|
+
input: r,
|
|
2008
|
+
message: 'Invalid filters JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
2009
|
+
}
|
|
2010
|
+
]
|
|
2011
|
+
} : { success: true, data: [] };
|
|
2012
|
+
};
|
|
2013
|
+
var ts = (e) => {
|
|
2014
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], a = [];
|
|
2015
|
+
return r.forEach((i, o) => {
|
|
2016
|
+
const u = {
|
|
2017
|
+
category: "highlights",
|
|
2018
|
+
index: o,
|
|
2019
|
+
input: i
|
|
2020
|
+
};
|
|
2021
|
+
try {
|
|
2022
|
+
const l = C({
|
|
2023
|
+
data: i,
|
|
2024
|
+
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
2025
|
+
});
|
|
2026
|
+
K(l) ? n.push(Je(l)) : a.push(E3(b2({}, u), { message: "Invalid filter JSON" }));
|
|
2027
|
+
} catch (l) {
|
|
2028
|
+
const p2 = l instanceof Error ? l.message : "Unknown error";
|
|
2029
|
+
a.push(E3(b2({}, u), { message: p2 }));
|
|
2030
|
+
}
|
|
2031
|
+
}), a.length > 0 ? { success: false, errors: a } : { success: true, data: n };
|
|
2032
|
+
};
|
|
2033
|
+
var ss = (e) => {
|
|
2034
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2035
|
+
return r ? le(r) ? ts({
|
|
2036
|
+
data: r,
|
|
2037
|
+
context: { dataSource: t, schemaIndex: s }
|
|
2038
|
+
}) : {
|
|
2039
|
+
success: false,
|
|
2040
|
+
errors: [
|
|
2041
|
+
{
|
|
2042
|
+
category: "highlights",
|
|
2043
|
+
index: -1,
|
|
2044
|
+
input: r,
|
|
2045
|
+
message: 'Invalid highlights JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
2046
|
+
}
|
|
2047
|
+
]
|
|
2048
|
+
} : { success: true, data: [] };
|
|
2049
|
+
};
|
|
2050
|
+
var ns = (e) => {
|
|
2051
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], a = [];
|
|
2052
|
+
return r.forEach((i, o) => {
|
|
2053
|
+
const u = {
|
|
2054
|
+
category: "measures",
|
|
2055
|
+
index: o,
|
|
2056
|
+
input: i
|
|
2057
|
+
};
|
|
2058
|
+
try {
|
|
2059
|
+
const l = C({
|
|
2060
|
+
data: i,
|
|
2061
|
+
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
2062
|
+
});
|
|
2063
|
+
_e2(l) ? n.push(l) : a.push(E3(b2({}, u), { message: "Invalid measure JSON" }));
|
|
2064
|
+
} catch (l) {
|
|
2065
|
+
const p2 = l instanceof Error ? l.message : "Unknown error";
|
|
2066
|
+
a.push(E3(b2({}, u), { message: p2 }));
|
|
2067
|
+
}
|
|
2068
|
+
}), a.length > 0 ? { success: false, errors: a } : { success: true, data: n };
|
|
2069
|
+
};
|
|
2070
|
+
var is = (e) => {
|
|
2071
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2072
|
+
return r ? le(r) ? ns({
|
|
2073
|
+
data: r,
|
|
2074
|
+
context: { dataSource: t, schemaIndex: s }
|
|
2075
|
+
}) : {
|
|
2076
|
+
success: false,
|
|
2077
|
+
errors: [
|
|
2078
|
+
{
|
|
2079
|
+
category: "measures",
|
|
2080
|
+
index: -1,
|
|
2081
|
+
input: r,
|
|
2082
|
+
message: 'Invalid measures JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
2083
|
+
}
|
|
2084
|
+
]
|
|
2085
|
+
} : { success: true, data: [] };
|
|
2086
|
+
};
|
|
2087
|
+
var ws = (e) => {
|
|
2088
|
+
const { data: r } = e, { dataSource: t, tables: s } = e.context, n = Nt2(s), a = [], i = M(() => It({
|
|
2089
|
+
data: r.dimensions || [],
|
|
2090
|
+
context: { dataSource: t, schemaIndex: n }
|
|
2091
|
+
}), a), o = M(() => is({
|
|
2092
|
+
data: r.measures || [],
|
|
2093
|
+
context: { dataSource: t, schemaIndex: n }
|
|
2094
|
+
}), a), u = M(() => rs({
|
|
2095
|
+
data: r.filters || [],
|
|
2096
|
+
context: { dataSource: t, schemaIndex: n }
|
|
2097
|
+
}), a);
|
|
2098
|
+
let l = null;
|
|
2099
|
+
return r.highlights && (l = M(() => ss({
|
|
2100
|
+
data: r.highlights || [],
|
|
2101
|
+
context: { dataSource: t, schemaIndex: n }
|
|
2102
|
+
}), a)), a.length > 0 ? {
|
|
2103
|
+
success: false,
|
|
2104
|
+
errors: a
|
|
2105
|
+
} : {
|
|
2106
|
+
success: true,
|
|
2107
|
+
data: b2({
|
|
2108
|
+
dataSource: ap(t),
|
|
2109
|
+
dimensions: i || [],
|
|
2110
|
+
measures: o || [],
|
|
2111
|
+
filters: u || []
|
|
2112
|
+
}, l && { highlights: l })
|
|
2113
|
+
};
|
|
2114
|
+
};
|
|
2115
|
+
function ps(e) {
|
|
2116
|
+
const { filters: r, relations: t } = ip(e.filters || []);
|
|
2117
|
+
return {
|
|
2118
|
+
dataSource: e.dataSource,
|
|
2119
|
+
dimensions: e.dimensions,
|
|
2120
|
+
measures: e.measures,
|
|
2121
|
+
filters: r,
|
|
2122
|
+
filterRelations: t,
|
|
2123
|
+
highlights: e.highlights
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
function Es(e, r, t = false) {
|
|
2127
|
+
const s = ps(e), n = $r(s, r);
|
|
2128
|
+
return Sh(n, t);
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
export { c, R, x, Fs, ws, Es };
|