react-semaphor 0.1.541 → 0.1.542
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/analytics-protocol/index.js +75 -75
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/briefings/index.js +51 -49
- package/dist/chunks/apply-dashboard-operations-Btbp2-6v.js +2260 -0
- package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-oHF5lTjA.js} +12 -12
- package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
- package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
- package/dist/chunks/comparison-window-caption-ChIyd_-L.js +1618 -0
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
- package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-B-cm719R.js} +18 -18
- package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-CIn22Qgp.js} +69 -70
- package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
- package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-ZUYsIExq.js} +4 -4
- package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-s5WJBcK8.js} +1 -1
- package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-C6MJVyoI.js} +2382 -4975
- package/dist/chunks/document-sheet-utils-BsZUnHRl.js +3619 -0
- package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-DLdereA7.js} +728 -728
- package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
- package/dist/chunks/{index-DaQlghLY.js → index-CV5rHq5D.js} +824 -1351
- package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
- package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
- package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
- package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
- package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
- package/dist/chunks/numeric-presentation-BSAqPpHt.js +5227 -0
- package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
- package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-BBlAfBA0.js +1155 -0
- package/dist/chunks/raw-temporal-presentation-CZ2r0Vb_.js +585 -0
- package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-MRUWpMcJ.js} +75 -75
- package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CJ2WpoMF.js → saved-dashboard-context-DjPqgFly.js} +233 -206
- package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-KT598QJq.js → semaphor-ready-indicator-BWSpRsPj.js} +37489 -39476
- package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-CQbFLm3q.js} +6 -6
- package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
- package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
- package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
- package/dist/chunks/table-export-sheet-BHSnuZHd.js +949 -0
- package/dist/chunks/table-settings-CLZocegs.js +501 -0
- package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
- package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DdD12SMY.js → use-create-flow-overlay-state-BJDNqdOh.js} +151 -151
- package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +462 -457
- package/dist/data-app-sdk/index.js +5 -5
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +9 -9
- package/dist/format-utils/index.js +346 -241
- package/dist/index.js +174 -175
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +17 -1
- package/dist/types/briefings/index.d.ts +5 -3
- package/dist/types/index.js +48 -48
- package/dist/types/lib/api/exports-api.d.ts +11 -65
- package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
- package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
- package/dist/types/lib/types/explorer-types.d.ts +6 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
- package/dist/types/shared/assistant-context/index.d.ts +1 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
- package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
- package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
- package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
- package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
- package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
- package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
- package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
- package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
- package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
- package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
- package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
- package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
- package/package.json +2 -1
- package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
- package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
- package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
- package/dist/chunks/common-types-CUf03Htv.js +0 -288
- package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
- package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
- package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
- package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
- package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
- package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { m as p, e as g } from "./temporal-bucket-D8JF7zKz.js";
|
|
2
|
-
import { x as h, r as N, y as x, o as f, t as w } from "./validators-Ej1DdCXa.js";
|
|
3
|
-
function A(t, e) {
|
|
4
|
-
const n = M(t);
|
|
5
|
-
let a;
|
|
6
|
-
if (n.date) {
|
|
7
|
-
const s = C(n.date, 2);
|
|
8
|
-
a = U(s.restDateString, s.year);
|
|
9
|
-
}
|
|
10
|
-
if (!a || isNaN(a.getTime()))
|
|
11
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
12
|
-
const o = a.getTime();
|
|
13
|
-
let l = 0, i;
|
|
14
|
-
if (n.time && (l = I(n.time), isNaN(l)))
|
|
15
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
16
|
-
if (n.timezone) {
|
|
17
|
-
if (i = y(n.timezone), isNaN(i))
|
|
18
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
19
|
-
} else {
|
|
20
|
-
const s = new Date(o + l), c = /* @__PURE__ */ new Date(0);
|
|
21
|
-
return c.setFullYear(
|
|
22
|
-
s.getUTCFullYear(),
|
|
23
|
-
s.getUTCMonth(),
|
|
24
|
-
s.getUTCDate()
|
|
25
|
-
), c.setHours(
|
|
26
|
-
s.getUTCHours(),
|
|
27
|
-
s.getUTCMinutes(),
|
|
28
|
-
s.getUTCSeconds(),
|
|
29
|
-
s.getUTCMilliseconds()
|
|
30
|
-
), c;
|
|
31
|
-
}
|
|
32
|
-
return new Date(o + l + i);
|
|
33
|
-
}
|
|
34
|
-
const m = {
|
|
35
|
-
dateTimeDelimiter: /[T ]/,
|
|
36
|
-
timeZoneDelimiter: /[Z ]/i,
|
|
37
|
-
timezone: /([Z+-].*)$/
|
|
38
|
-
}, T = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, b = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, v = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
39
|
-
function M(t) {
|
|
40
|
-
const e = {}, r = t.split(m.dateTimeDelimiter);
|
|
41
|
-
let n;
|
|
42
|
-
if (r.length > 2)
|
|
43
|
-
return e;
|
|
44
|
-
if (/:/.test(r[0]) ? n = r[0] : (e.date = r[0], n = r[1], m.timeZoneDelimiter.test(e.date) && (e.date = t.split(m.timeZoneDelimiter)[0], n = t.substr(
|
|
45
|
-
e.date.length,
|
|
46
|
-
t.length
|
|
47
|
-
))), n) {
|
|
48
|
-
const a = m.timezone.exec(n);
|
|
49
|
-
a ? (e.time = n.replace(a[1], ""), e.timezone = a[1]) : e.time = n;
|
|
50
|
-
}
|
|
51
|
-
return e;
|
|
52
|
-
}
|
|
53
|
-
function C(t, e) {
|
|
54
|
-
const r = new RegExp(
|
|
55
|
-
"^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
|
|
56
|
-
), n = t.match(r);
|
|
57
|
-
if (!n) return { year: NaN, restDateString: "" };
|
|
58
|
-
const a = n[1] ? parseInt(n[1]) : null, o = n[2] ? parseInt(n[2]) : null;
|
|
59
|
-
return {
|
|
60
|
-
year: o === null ? a : o * 100,
|
|
61
|
-
restDateString: t.slice((n[1] || n[2]).length)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function U(t, e) {
|
|
65
|
-
if (e === null) return /* @__PURE__ */ new Date(NaN);
|
|
66
|
-
const r = t.match(T);
|
|
67
|
-
if (!r) return /* @__PURE__ */ new Date(NaN);
|
|
68
|
-
const n = !!r[4], a = u(r[1]), o = u(r[2]) - 1, l = u(r[3]), i = u(r[4]), s = u(r[5]) - 1;
|
|
69
|
-
if (n)
|
|
70
|
-
return z(e, i, s) ? S(e, i, s) : /* @__PURE__ */ new Date(NaN);
|
|
71
|
-
{
|
|
72
|
-
const c = /* @__PURE__ */ new Date(0);
|
|
73
|
-
return !Y(e, o, l) || !L(e, a) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(e, o, Math.max(a, l)), c);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function u(t) {
|
|
77
|
-
return t ? parseInt(t) : 1;
|
|
78
|
-
}
|
|
79
|
-
function I(t) {
|
|
80
|
-
const e = t.match(b);
|
|
81
|
-
if (!e) return NaN;
|
|
82
|
-
const r = d(e[1]), n = d(e[2]), a = d(e[3]);
|
|
83
|
-
return F(r, n, a) ? r * p + n * g + a * 1e3 : NaN;
|
|
84
|
-
}
|
|
85
|
-
function d(t) {
|
|
86
|
-
return t && parseFloat(t.replace(",", ".")) || 0;
|
|
87
|
-
}
|
|
88
|
-
function y(t) {
|
|
89
|
-
if (t === "Z") return 0;
|
|
90
|
-
const e = t.match(v);
|
|
91
|
-
if (!e) return 0;
|
|
92
|
-
const r = e[1] === "+" ? -1 : 1, n = parseInt(e[2]), a = e[3] && parseInt(e[3]) || 0;
|
|
93
|
-
return O(n, a) ? r * (n * p + a * g) : NaN;
|
|
94
|
-
}
|
|
95
|
-
function S(t, e, r) {
|
|
96
|
-
const n = /* @__PURE__ */ new Date(0);
|
|
97
|
-
n.setUTCFullYear(t, 0, 4);
|
|
98
|
-
const a = n.getUTCDay() || 7, o = (e - 1) * 7 + r + 1 - a;
|
|
99
|
-
return n.setUTCDate(n.getUTCDate() + o), n;
|
|
100
|
-
}
|
|
101
|
-
const k = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
102
|
-
function D(t) {
|
|
103
|
-
return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
|
|
104
|
-
}
|
|
105
|
-
function Y(t, e, r) {
|
|
106
|
-
return e >= 0 && e <= 11 && r >= 1 && r <= (k[e] || (D(t) ? 29 : 28));
|
|
107
|
-
}
|
|
108
|
-
function L(t, e) {
|
|
109
|
-
return e >= 1 && e <= (D(t) ? 366 : 365);
|
|
110
|
-
}
|
|
111
|
-
function z(t, e, r) {
|
|
112
|
-
return e >= 1 && e <= 53 && r >= 0 && r <= 6;
|
|
113
|
-
}
|
|
114
|
-
function F(t, e, r) {
|
|
115
|
-
return t === 24 ? e === 0 && r === 0 : r >= 0 && r < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
|
|
116
|
-
}
|
|
117
|
-
function O(t, e) {
|
|
118
|
-
return e >= 0 && e <= 59;
|
|
119
|
-
}
|
|
120
|
-
function H(t, e) {
|
|
121
|
-
return e.levelLabels[t.id] ?? t.field.label ?? t.field.name;
|
|
122
|
-
}
|
|
123
|
-
function E(t, e) {
|
|
124
|
-
return e.measureLabels[t.id] ?? (t.kind === "aggregate" ? t.field.label ?? t.field.name : t.definition.label);
|
|
125
|
-
}
|
|
126
|
-
function _(t) {
|
|
127
|
-
return w.parse(Z(t));
|
|
128
|
-
}
|
|
129
|
-
function Z(t) {
|
|
130
|
-
const e = h.parse(t), r = (n) => ({
|
|
131
|
-
grand: { visible: !0, position: "after" },
|
|
132
|
-
levels: Object.fromEntries(
|
|
133
|
-
n.map((a) => [
|
|
134
|
-
a.id,
|
|
135
|
-
{ visible: !0, position: "before" }
|
|
136
|
-
])
|
|
137
|
-
)
|
|
138
|
-
});
|
|
139
|
-
return N.parse({
|
|
140
|
-
version: 1,
|
|
141
|
-
spec: e,
|
|
142
|
-
presentation: {
|
|
143
|
-
layout: { kind: "compact" },
|
|
144
|
-
absence: { emptyText: "—", nullText: "" },
|
|
145
|
-
levelLabels: {},
|
|
146
|
-
measureLabels: {},
|
|
147
|
-
levelFormats: {},
|
|
148
|
-
measureFormats: {},
|
|
149
|
-
totals: { rows: r(e.rows), columns: r(e.columns) }
|
|
150
|
-
},
|
|
151
|
-
defaultView: {
|
|
152
|
-
rows: { depth: 0, overrides: [] },
|
|
153
|
-
columns: { depth: e.columns.length > 1 ? 1 : 0, overrides: [] }
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
function R(t, e) {
|
|
158
|
-
const r = new Map(t.map((n) => [f(n), n]));
|
|
159
|
-
for (const n of e ?? []) r.set(f(n), n);
|
|
160
|
-
return [...r.values()];
|
|
161
|
-
}
|
|
162
|
-
function j(t) {
|
|
163
|
-
const { spec: e, presentation: r, defaults: n, session: a } = x.parse(t), o = new Map(
|
|
164
|
-
R(e.sorts, a == null ? void 0 : a.sorts).map((i) => [f(i), i])
|
|
165
|
-
);
|
|
166
|
-
for (const i of ["rows", "columns"])
|
|
167
|
-
for (const s of e[i]) {
|
|
168
|
-
const c = {
|
|
169
|
-
axis: i,
|
|
170
|
-
levelId: s.id,
|
|
171
|
-
scope: { kind: "level" },
|
|
172
|
-
target: { kind: "member" },
|
|
173
|
-
direction: "asc",
|
|
174
|
-
nulls: "last"
|
|
175
|
-
};
|
|
176
|
-
o.has(f(c)) || o.set(f(c), c);
|
|
177
|
-
}
|
|
178
|
-
const l = (i, s) => ({
|
|
179
|
-
depth: Math.min(i.depth, Math.max(0, s - 1)),
|
|
180
|
-
// Leaf toggles are valid but have no effect. Collapsed ancestors retain dormant overrides.
|
|
181
|
-
overrides: i.overrides.filter(
|
|
182
|
-
(c) => c.path.length < s
|
|
183
|
-
)
|
|
184
|
-
});
|
|
185
|
-
return {
|
|
186
|
-
spec: { ...e, sorts: [...o.values()] },
|
|
187
|
-
presentation: r,
|
|
188
|
-
view: {
|
|
189
|
-
rows: l((a == null ? void 0 : a.rows) ?? n.rows, e.rows.length),
|
|
190
|
-
columns: l(
|
|
191
|
-
(a == null ? void 0 : a.columns) ?? n.columns,
|
|
192
|
-
e.columns.length
|
|
193
|
-
),
|
|
194
|
-
sorts: (a == null ? void 0 : a.sorts) ?? []
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
export {
|
|
199
|
-
E as a,
|
|
200
|
-
Z as b,
|
|
201
|
-
_ as c,
|
|
202
|
-
H as g,
|
|
203
|
-
R as m,
|
|
204
|
-
A as p,
|
|
205
|
-
j as r
|
|
206
|
-
};
|
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import { v as b } from "./validators-Ej1DdCXa.js";
|
|
2
|
-
const g = "higher_is_better", D = {
|
|
3
|
-
displayMode: "difference",
|
|
4
|
-
showComparison: !0,
|
|
5
|
-
indicatorStyle: "arrow_badge",
|
|
6
|
-
showColor: !0,
|
|
7
|
-
conditionalLabel: !1
|
|
8
|
-
};
|
|
9
|
-
function u(o) {
|
|
10
|
-
return b(o) !== null;
|
|
11
|
-
}
|
|
12
|
-
function y(o) {
|
|
13
|
-
var n, e, s, t;
|
|
14
|
-
if (((n = o.metricComparison) == null ? void 0 : n.mode) !== "off") {
|
|
15
|
-
if (((e = o.metricComparison) == null ? void 0 : e.mode) === "explicit")
|
|
16
|
-
return { source: "explicit", spec: o.metricComparison.spec };
|
|
17
|
-
if (!((o.inheritGlobalComparison ?? ((s = o.globalDateComparison) == null ? void 0 : s.inheritGlobalComparison)) === !1 || ((t = o.globalDateComparison) == null ? void 0 : t.selection.mode) !== "period"))
|
|
18
|
-
return {
|
|
19
|
-
source: "inherited",
|
|
20
|
-
spec: o.globalDateComparison.selection.spec,
|
|
21
|
-
...o.globalDateComparison.owner ? { owner: o.globalDateComparison.owner } : {}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function I(o) {
|
|
26
|
-
if (o.alias) return o.alias;
|
|
27
|
-
const n = o.entityName && o.entityName !== "SEMAPHOR_CALCULATED_FIELD" ? o.entityName : void 0, e = n && n !== o.name ? `${n}_` : "";
|
|
28
|
-
if (o.role !== "metric") return `${e}${o.name}`;
|
|
29
|
-
let s = o.aggregate || "metric";
|
|
30
|
-
if (o.expression) {
|
|
31
|
-
const t = o.expression.match(
|
|
32
|
-
/^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
|
|
33
|
-
);
|
|
34
|
-
s = t ? t[1].toLowerCase() : "expr";
|
|
35
|
-
} else
|
|
36
|
-
s = s.toLowerCase();
|
|
37
|
-
return `${e}${o.name}_${s}`;
|
|
38
|
-
}
|
|
39
|
-
function i(o, n, e) {
|
|
40
|
-
return e ? { code: o, message: n, path: e } : { code: o, message: n };
|
|
41
|
-
}
|
|
42
|
-
function p(o) {
|
|
43
|
-
return !!o && typeof o == "object" && !Array.isArray(o);
|
|
44
|
-
}
|
|
45
|
-
function a(o, n, e, s) {
|
|
46
|
-
Object.keys(o).forEach((t) => {
|
|
47
|
-
n.includes(t) || s.push(
|
|
48
|
-
i(
|
|
49
|
-
"invalid_comparison_spec",
|
|
50
|
-
`Comparison kind does not accept field "${t}".`,
|
|
51
|
-
`${e}.${t}`
|
|
52
|
-
)
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function d(o, n, e) {
|
|
57
|
-
o.alignment !== void 0 && o.alignment !== "calendar" && o.alignment !== "weekday" && e.push(
|
|
58
|
-
i(
|
|
59
|
-
"invalid_comparison_spec",
|
|
60
|
-
'Comparison alignment must be "calendar" or "weekday".',
|
|
61
|
-
`${n}.alignment`
|
|
62
|
-
)
|
|
63
|
-
), o.toDate !== void 0 && typeof o.toDate != "boolean" && e.push(
|
|
64
|
-
i(
|
|
65
|
-
"invalid_comparison_spec",
|
|
66
|
-
"Comparison toDate must be a boolean.",
|
|
67
|
-
`${n}.toDate`
|
|
68
|
-
)
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
function f(o, n, e) {
|
|
72
|
-
o !== void 0 && (typeof o != "number" || !Number.isSafeInteger(o) || o <= 0) && e.push(
|
|
73
|
-
i(
|
|
74
|
-
"invalid_comparison_spec",
|
|
75
|
-
"Comparison offset must be a positive safe integer.",
|
|
76
|
-
n
|
|
77
|
-
)
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
function _(o, n = "comparison") {
|
|
81
|
-
const e = [];
|
|
82
|
-
return p(o) ? (o.kind === "previous_period" ? (a(
|
|
83
|
-
o,
|
|
84
|
-
["kind", "offsetPeriods", "alignment", "toDate"],
|
|
85
|
-
n,
|
|
86
|
-
e
|
|
87
|
-
), f(o.offsetPeriods, `${n}.offsetPeriods`, e), d(o, n, e)) : o.kind === "previous_year" ? (a(
|
|
88
|
-
o,
|
|
89
|
-
["kind", "offsetYears", "alignment", "toDate"],
|
|
90
|
-
n,
|
|
91
|
-
e
|
|
92
|
-
), f(o.offsetYears, `${n}.offsetYears`, e), d(o, n, e)) : o.kind === "target" ? (a(o, ["kind", "targetValue"], n, e), (typeof o.targetValue != "number" || !Number.isFinite(o.targetValue)) && e.push(
|
|
93
|
-
i(
|
|
94
|
-
"invalid_comparison_spec",
|
|
95
|
-
"Target comparison requires a finite targetValue.",
|
|
96
|
-
`${n}.targetValue`
|
|
97
|
-
)
|
|
98
|
-
)) : e.push(
|
|
99
|
-
i(
|
|
100
|
-
"invalid_comparison_spec",
|
|
101
|
-
"Comparison kind must be previous_period, previous_year, or target.",
|
|
102
|
-
`${n}.kind`
|
|
103
|
-
)
|
|
104
|
-
), { ok: e.length === 0, errors: e, warnings: [] }) : {
|
|
105
|
-
ok: !1,
|
|
106
|
-
errors: [
|
|
107
|
-
i(
|
|
108
|
-
"invalid_comparison_spec",
|
|
109
|
-
"Comparison spec must be an object.",
|
|
110
|
-
n
|
|
111
|
-
)
|
|
112
|
-
],
|
|
113
|
-
warnings: []
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function k(o, n = "comparison") {
|
|
117
|
-
if (!p(o))
|
|
118
|
-
return {
|
|
119
|
-
ok: !1,
|
|
120
|
-
errors: [
|
|
121
|
-
i(
|
|
122
|
-
"invalid_comparison_config",
|
|
123
|
-
"Comparison config must be an object.",
|
|
124
|
-
n
|
|
125
|
-
)
|
|
126
|
-
],
|
|
127
|
-
warnings: []
|
|
128
|
-
};
|
|
129
|
-
const e = [];
|
|
130
|
-
return o.mode === "off" ? a(o, ["mode"], n, e) : o.mode === "explicit" ? (a(o, ["mode", "spec"], n, e), e.push(..._(o.spec, `${n}.spec`).errors)) : e.push(
|
|
131
|
-
i(
|
|
132
|
-
"invalid_comparison_config",
|
|
133
|
-
"Comparison mode must be off or explicit.",
|
|
134
|
-
`${n}.mode`
|
|
135
|
-
)
|
|
136
|
-
), { ok: e.length === 0, errors: e, warnings: [] };
|
|
137
|
-
}
|
|
138
|
-
function C(o, n = "comparisonSelection") {
|
|
139
|
-
if (!p(o))
|
|
140
|
-
return {
|
|
141
|
-
ok: !1,
|
|
142
|
-
errors: [
|
|
143
|
-
i(
|
|
144
|
-
"invalid_global_date_comparison",
|
|
145
|
-
"Global Date comparison selection must be an object.",
|
|
146
|
-
n
|
|
147
|
-
)
|
|
148
|
-
],
|
|
149
|
-
warnings: []
|
|
150
|
-
};
|
|
151
|
-
const e = [];
|
|
152
|
-
if (o.mode === "off")
|
|
153
|
-
a(o, ["mode"], n, e);
|
|
154
|
-
else if (o.mode === "period") {
|
|
155
|
-
a(o, ["mode", "spec"], n, e);
|
|
156
|
-
const s = _(o.spec, `${n}.spec`);
|
|
157
|
-
e.push(...s.errors), p(o.spec) && o.spec.kind === "target" && e.push(
|
|
158
|
-
i(
|
|
159
|
-
"invalid_global_date_comparison",
|
|
160
|
-
"Global Date comparison supports previous_period or previous_year, not target.",
|
|
161
|
-
`${n}.spec.kind`
|
|
162
|
-
)
|
|
163
|
-
);
|
|
164
|
-
} else
|
|
165
|
-
e.push(
|
|
166
|
-
i(
|
|
167
|
-
"invalid_global_date_comparison",
|
|
168
|
-
"Global Date comparison mode must be off or period.",
|
|
169
|
-
`${n}.mode`
|
|
170
|
-
)
|
|
171
|
-
);
|
|
172
|
-
return { ok: e.length === 0, errors: e, warnings: [] };
|
|
173
|
-
}
|
|
174
|
-
function N(o, n = "globalDateComparison") {
|
|
175
|
-
if (!p(o))
|
|
176
|
-
return {
|
|
177
|
-
ok: !1,
|
|
178
|
-
errors: [
|
|
179
|
-
i(
|
|
180
|
-
"invalid_global_date_comparison",
|
|
181
|
-
"Global Date comparison context must be an object.",
|
|
182
|
-
n
|
|
183
|
-
)
|
|
184
|
-
],
|
|
185
|
-
warnings: []
|
|
186
|
-
};
|
|
187
|
-
const e = [];
|
|
188
|
-
return a(
|
|
189
|
-
o,
|
|
190
|
-
["selection", "inheritGlobalComparison", "owner", "referenceTime"],
|
|
191
|
-
n,
|
|
192
|
-
e
|
|
193
|
-
), e.push(
|
|
194
|
-
...C(
|
|
195
|
-
o.selection,
|
|
196
|
-
`${n}.selection`
|
|
197
|
-
).errors
|
|
198
|
-
), o.inheritGlobalComparison !== void 0 && o.inheritGlobalComparison !== !1 && e.push(
|
|
199
|
-
i(
|
|
200
|
-
"invalid_global_date_comparison",
|
|
201
|
-
"inheritGlobalComparison may only be false when present.",
|
|
202
|
-
`${n}.inheritGlobalComparison`
|
|
203
|
-
)
|
|
204
|
-
), o.owner !== void 0 && (p(o.owner) ? o.owner.kind === "global_date" ? a(o.owner, ["kind"], `${n}.owner`, e) : o.owner.kind === "field_date" ? (a(
|
|
205
|
-
o.owner,
|
|
206
|
-
["kind", "filterId", "label"],
|
|
207
|
-
`${n}.owner`,
|
|
208
|
-
e
|
|
209
|
-
), (typeof o.owner.filterId != "string" || !o.owner.filterId.trim()) && e.push(
|
|
210
|
-
i(
|
|
211
|
-
"invalid_global_date_comparison",
|
|
212
|
-
"Field Date comparison owner requires a non-empty filterId.",
|
|
213
|
-
`${n}.owner.filterId`
|
|
214
|
-
)
|
|
215
|
-
), (typeof o.owner.label != "string" || !o.owner.label.trim()) && e.push(
|
|
216
|
-
i(
|
|
217
|
-
"invalid_global_date_comparison",
|
|
218
|
-
"Field Date comparison owner requires a non-empty label.",
|
|
219
|
-
`${n}.owner.label`
|
|
220
|
-
)
|
|
221
|
-
)) : e.push(
|
|
222
|
-
i(
|
|
223
|
-
"invalid_global_date_comparison",
|
|
224
|
-
"Comparison owner kind must be global_date or field_date.",
|
|
225
|
-
`${n}.owner.kind`
|
|
226
|
-
)
|
|
227
|
-
) : e.push(
|
|
228
|
-
i(
|
|
229
|
-
"invalid_global_date_comparison",
|
|
230
|
-
"Comparison owner must be an object.",
|
|
231
|
-
`${n}.owner`
|
|
232
|
-
)
|
|
233
|
-
)), o.referenceTime !== void 0 && (typeof o.referenceTime != "string" || !u(o.referenceTime)) && e.push(
|
|
234
|
-
i(
|
|
235
|
-
"invalid_global_date_comparison",
|
|
236
|
-
"referenceTime must be a valid ISO date-time string when present.",
|
|
237
|
-
`${n}.referenceTime`
|
|
238
|
-
)
|
|
239
|
-
), { ok: e.length === 0, errors: e, warnings: [] };
|
|
240
|
-
}
|
|
241
|
-
function T(o) {
|
|
242
|
-
const { referenceTime: n, ...e } = o;
|
|
243
|
-
return e;
|
|
244
|
-
}
|
|
245
|
-
function M(o, n = "comparisonPolarity") {
|
|
246
|
-
return o === "higher_is_better" || o === "lower_is_better" || o === "neutral" ? { ok: !0, errors: [], warnings: [] } : {
|
|
247
|
-
ok: !1,
|
|
248
|
-
errors: [
|
|
249
|
-
i(
|
|
250
|
-
"invalid_comparison_polarity",
|
|
251
|
-
"Comparison polarity must be higher_is_better, lower_is_better, or neutral.",
|
|
252
|
-
n
|
|
253
|
-
)
|
|
254
|
-
],
|
|
255
|
-
warnings: []
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
function S(o, n = "comparisonPresentation") {
|
|
259
|
-
if (!p(o))
|
|
260
|
-
return {
|
|
261
|
-
ok: !1,
|
|
262
|
-
errors: [
|
|
263
|
-
i(
|
|
264
|
-
"invalid_comparison_presentation",
|
|
265
|
-
"Comparison presentation must be an object.",
|
|
266
|
-
n
|
|
267
|
-
)
|
|
268
|
-
],
|
|
269
|
-
warnings: []
|
|
270
|
-
};
|
|
271
|
-
const e = [], s = [
|
|
272
|
-
"displayMode",
|
|
273
|
-
"showComparison",
|
|
274
|
-
"precision",
|
|
275
|
-
"indicatorStyle",
|
|
276
|
-
"showColor",
|
|
277
|
-
"position",
|
|
278
|
-
"conditionalLabel",
|
|
279
|
-
"labelName",
|
|
280
|
-
"conditionalLabels",
|
|
281
|
-
"colors"
|
|
282
|
-
];
|
|
283
|
-
return Object.keys(o).forEach((r) => {
|
|
284
|
-
s.includes(r) || e.push(
|
|
285
|
-
i(
|
|
286
|
-
"invalid_comparison_presentation",
|
|
287
|
-
`Comparison presentation does not accept field "${r}".`,
|
|
288
|
-
`${n}.${r}`
|
|
289
|
-
)
|
|
290
|
-
);
|
|
291
|
-
}), [
|
|
292
|
-
["displayMode", ["difference", "percent_change", "both", "ratio"]],
|
|
293
|
-
["indicatorStyle", ["arrow_badge", "arrow", "badge", "none"]],
|
|
294
|
-
["position", ["left", "right", "top"]]
|
|
295
|
-
].forEach(([r, l]) => {
|
|
296
|
-
o[r] !== void 0 && !l.includes(o[r]) && e.push(
|
|
297
|
-
i(
|
|
298
|
-
"invalid_comparison_presentation",
|
|
299
|
-
`Comparison presentation ${r} is invalid.`,
|
|
300
|
-
`${n}.${r}`
|
|
301
|
-
)
|
|
302
|
-
);
|
|
303
|
-
}), ["showComparison", "showColor", "conditionalLabel"].forEach((r) => {
|
|
304
|
-
o[r] !== void 0 && typeof o[r] != "boolean" && e.push(
|
|
305
|
-
i(
|
|
306
|
-
"invalid_comparison_presentation",
|
|
307
|
-
`Comparison presentation ${r} must be a boolean.`,
|
|
308
|
-
`${n}.${r}`
|
|
309
|
-
)
|
|
310
|
-
);
|
|
311
|
-
}), o.precision !== void 0 && (typeof o.precision != "number" || !Number.isInteger(o.precision) || o.precision < 0 || o.precision > 6) && e.push(
|
|
312
|
-
i(
|
|
313
|
-
"invalid_comparison_presentation",
|
|
314
|
-
"Comparison presentation precision must be an integer from 0 through 6.",
|
|
315
|
-
`${n}.precision`
|
|
316
|
-
)
|
|
317
|
-
), o.labelName !== void 0 && typeof o.labelName != "string" && e.push(
|
|
318
|
-
i(
|
|
319
|
-
"invalid_comparison_presentation",
|
|
320
|
-
"Comparison presentation labelName must be a string.",
|
|
321
|
-
`${n}.labelName`
|
|
322
|
-
)
|
|
323
|
-
), ["conditionalLabels", "colors"].forEach((r) => {
|
|
324
|
-
const l = o[r];
|
|
325
|
-
if (l !== void 0) {
|
|
326
|
-
if (!p(l)) {
|
|
327
|
-
e.push(
|
|
328
|
-
i(
|
|
329
|
-
"invalid_comparison_presentation",
|
|
330
|
-
`Comparison presentation ${r} must be an object.`,
|
|
331
|
-
`${n}.${r}`
|
|
332
|
-
)
|
|
333
|
-
);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
Object.keys(l).forEach((c) => {
|
|
337
|
-
["increase", "decrease", "neutral"].includes(c) || e.push(
|
|
338
|
-
i(
|
|
339
|
-
"invalid_comparison_presentation",
|
|
340
|
-
`Comparison presentation ${r} does not accept field "${c}".`,
|
|
341
|
-
`${n}.${r}.${c}`
|
|
342
|
-
)
|
|
343
|
-
);
|
|
344
|
-
}), Object.entries(l).forEach(([c, m]) => {
|
|
345
|
-
m !== void 0 && typeof m != "string" && e.push(
|
|
346
|
-
i(
|
|
347
|
-
"invalid_comparison_presentation",
|
|
348
|
-
`Comparison presentation ${r}.${c} must be a string.`,
|
|
349
|
-
`${n}.${r}.${c}`
|
|
350
|
-
)
|
|
351
|
-
);
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
}), { ok: e.length === 0, errors: e, warnings: [] };
|
|
355
|
-
}
|
|
356
|
-
function w(o) {
|
|
357
|
-
return o === null ? "unknown" : o > 0 ? "increase" : o < 0 ? "decrease" : "no_change";
|
|
358
|
-
}
|
|
359
|
-
function $(o, n) {
|
|
360
|
-
return o === "unknown" || o === "no_change" || n === "neutral" ? "neutral" : n === "higher_is_better" && o === "increase" || n === "lower_is_better" && o === "decrease" ? "favorable" : "unfavorable";
|
|
361
|
-
}
|
|
362
|
-
function A(o) {
|
|
363
|
-
const {
|
|
364
|
-
currentValue: n,
|
|
365
|
-
comparisonValue: e,
|
|
366
|
-
polarity: s = g
|
|
367
|
-
} = o, r = n !== null && e !== null ? n - e : null, l = r !== null && e !== null && e !== 0 ? r / Math.abs(e) : null, c = n !== null && e !== null && e !== 0 ? n / e : null, m = w(r);
|
|
368
|
-
return {
|
|
369
|
-
status: e === null ? "insufficient_history" : "available",
|
|
370
|
-
currentValue: n,
|
|
371
|
-
comparisonValue: e,
|
|
372
|
-
delta: r,
|
|
373
|
-
percentChange: l,
|
|
374
|
-
ratio: c,
|
|
375
|
-
direction: m,
|
|
376
|
-
sentiment: $(m, s)
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
export {
|
|
380
|
-
D as C,
|
|
381
|
-
g as D,
|
|
382
|
-
y as a,
|
|
383
|
-
_ as b,
|
|
384
|
-
k as c,
|
|
385
|
-
N as d,
|
|
386
|
-
M as e,
|
|
387
|
-
S as f,
|
|
388
|
-
A as g,
|
|
389
|
-
I as r,
|
|
390
|
-
C as v,
|
|
391
|
-
T as w
|
|
392
|
-
};
|