react-semaphor 0.1.601 → 0.1.603
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 +415 -375
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +8 -8
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/{add-to-dashboard-ClhEIFst.js → add-to-dashboard-CFF-wFU-.js} +1 -1
- package/dist/chunks/{analytics-base-schemas-DevrgqQb.js → analytics-base-schemas-DsUh5Q3C.js} +14 -12
- package/dist/chunks/{assistant-chat-BE0XXzZP.js → assistant-chat-B6hNQI1t.js} +146 -146
- package/dist/chunks/{bookmark-impact-DXDAN5AY.js → bookmark-impact-Ba2PLcGp.js} +3 -3
- package/dist/chunks/{bookmark-state-BMyB3Tb6.js → bookmark-state-n7AaNzR_.js} +517 -516
- package/dist/chunks/{card-filter-builder-CE0-YVN5.js → card-filter-builder-Y22HizVx.js} +474 -474
- package/dist/chunks/{comparison-window-caption-Dxj2CHOa.js → comparison-window-caption-Ck2TIbnR.js} +69 -69
- package/dist/chunks/{context-BJoEFgNl.js → context-UCQ7sere.js} +1 -1
- package/dist/chunks/{dashboard-mJKPFRbb.js → dashboard-BghI99oY.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CntwKyiZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +725 -716
- package/dist/chunks/{dashboard-controls-XO089DMg.js → dashboard-controls-CtFXlyjV.js} +53 -53
- package/dist/chunks/{dashboard-json-CQRiydUv.js → dashboard-json-DfGBUtCd.js} +5 -5
- package/dist/chunks/dates-BnrXF4bb.js +185 -0
- package/dist/chunks/{edit-dashboard-visual-f-Dm-BLR.js → edit-dashboard-visual-oxt3x1wb.js} +8081 -8268
- package/dist/chunks/{filter-line-CKNMyNTQ.js → filter-line-Cy5YYqRL.js} +27 -27
- package/dist/chunks/{filter-reach-copy-B8GGyVuR.js → filter-reach-copy-CE_ZX147.js} +1786 -2214
- package/dist/chunks/{filter-value-text-CRtKecI5.js → filter-value-text-fWvSDwkl.js} +11 -11
- package/dist/chunks/{index-DoPApnxg.js → index-D5rxbtS4.js} +24 -24
- package/dist/chunks/{layout-grid-CiSCZdIr.js → layout-grid-9LndRoLa.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-myf3D3Qx.js → matrix-analytical-definition-CCp48UCw.js} +496 -425
- package/dist/chunks/matrix-member-presentation-zNehruXR.js +391 -0
- package/dist/chunks/{matrix-operation-contract-C1SuOHLZ.js → matrix-operation-contract-DPBj69D8.js} +518 -514
- package/dist/chunks/{metric-comparison-Cm0G893W.js → metric-comparison-B0FR-Q8I.js} +184 -125
- package/dist/chunks/{paintbrush-DQIwqlck.js → paintbrush-58FQYY-y.js} +1 -1
- package/dist/chunks/{palette-Cun747Rg.js → palette-Be62Tkoa.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-C1Dyx8du.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
- package/dist/chunks/{pivot-result-identity-CBS-ssEp.js → pivot-result-identity-CAP4--iq.js} +1 -1
- package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +3778 -0
- package/dist/chunks/{report-preferences-dialog-SDZEcG2x.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
- package/dist/chunks/{report-runtime-context-BbedQdtc.js → report-runtime-context-c77_KF9v.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-DRBS0eRa.js → resolve-dashboard-input-context-Rtl1ffmE.js} +8808 -7291
- package/dist/chunks/{save-Dj5bjm7P.js → save-C5A0JnEV.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-DWVlJcsa.js → saved-dashboard-context-tcyTU8jm.js} +199 -213
- package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
- package/dist/chunks/{semaphor-ready-indicator-OFOoAY-A.js → semaphor-ready-indicator-FBvunj6S.js} +37894 -35726
- package/dist/chunks/{shelf-drop-preview-context-2swWypXu.js → shelf-drop-preview-context-QKStrcK9.js} +54 -54
- package/dist/chunks/{stored-dashboard-NtOuEX6a.js → stored-dashboard-CHozcAY9.js} +770 -743
- package/dist/chunks/{style-sheet-parts-Qv4UcLAo.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
- package/dist/chunks/{table-export-sheet-Do7ZB0_F.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
- package/dist/chunks/{token-types-Dy_aXO-U.js → token-types-XbM6QByy.js} +1 -1
- package/dist/chunks/{upload-Bq-puSVy.js → upload-H15d7uHK.js} +1 -1
- package/dist/chunks/{validators-C7DFk3QK.js → validators-Baf3VIf5.js} +5 -5
- package/dist/chunks/{variable-draft-Cy03qnEi.js → variable-draft-C2y8Jp6Z.js} +27 -28
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +3392 -2761
- package/dist/format-utils/index.js +205 -204
- package/dist/index.js +73 -75
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
- package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
- package/dist/types/lib/document/document-edits.d.ts +0 -4
- package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
- package/dist/types/lib/stores/dashboard-store.d.ts +30 -1
- package/dist/types/lib/types/common-types.d.ts +0 -2
- package/dist/types/lib/types/explorer-types.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
- package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
- package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
- package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
- package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
- package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
- package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
- package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
- package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
- package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +165 -360
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +23 -2
- package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
- package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
- package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
- package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
- package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
- package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
- package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +158 -0
- package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +17 -6
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
- package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
- package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
- package/dist/types/shared/temporal/index.d.ts +2 -0
- package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
- package/dist/types/shared/temporal/temporal.d.ts +27 -0
- package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
- package/dist/types/shared/usage-events/details.d.ts +2 -2
- package/dist/types/shared/usage-events/envelope.d.ts +2 -2
- package/dist/usage-events/index.js +1 -1
- package/package.json +3 -2
- package/dist/chunks/dates-B-Urp5OD.js +0 -164
- package/dist/chunks/matrix-member-presentation-g0c_NpDW.js +0 -258
- package/dist/chunks/raw-temporal-value-DN_l-Tss.js +0 -454
- package/dist/chunks/selection-filter-compiler-DmAr7yqC.js +0 -131
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as
|
|
2
|
-
import { p as C } from "./validators-
|
|
3
|
-
function
|
|
1
|
+
import { T as f, a as h, b as y } from "./analytics-base-schemas-DsUh5Q3C.js";
|
|
2
|
+
import { p as C } from "./validators-Baf3VIf5.js";
|
|
3
|
+
function P(e) {
|
|
4
4
|
switch (e.kind) {
|
|
5
5
|
case "monthDay":
|
|
6
6
|
return {
|
|
@@ -26,7 +26,7 @@ function N(e) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
case "periods": {
|
|
29
|
-
const { unit: r, from: o, to: n, toDate:
|
|
29
|
+
const { unit: r, from: o, to: n, toDate: i } = e, a = e.anchor === "latest_data", s = e.anchor === "now", l = !!i && s, d = o === n;
|
|
30
30
|
return {
|
|
31
31
|
subDay: !1,
|
|
32
32
|
dataAnchored: a,
|
|
@@ -35,93 +35,93 @@ function N(e) {
|
|
|
35
35
|
bounds: { start: "day", end: l ? "instant" : "day" },
|
|
36
36
|
comparesBySpan: typeof e.anchor == "object",
|
|
37
37
|
printsByName: a || r === "quarter" || r === "year",
|
|
38
|
-
dayPickerDefault: r === "day" &&
|
|
39
|
-
monthPickerDefault: r === "month" &&
|
|
38
|
+
dayPickerDefault: r === "day" && d && s,
|
|
39
|
+
monthPickerDefault: r === "month" && d && (o === 0 || o === -1) && s && !i,
|
|
40
40
|
span: { unit: r, n: n - o + 1, complete: n < 0 }
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const r =
|
|
45
|
+
function $(e) {
|
|
46
|
+
const r = y.safeParse(e);
|
|
47
47
|
return r.success ? { ok: !0, value: r.data } : {
|
|
48
48
|
ok: !1,
|
|
49
49
|
error: {
|
|
50
|
-
code:
|
|
50
|
+
code: f.invalidMetadata,
|
|
51
51
|
message: "Temporal bucket metadata is invalid.",
|
|
52
52
|
path: "temporalBucket"
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function b(e, r) {
|
|
57
57
|
if (!e.temporalBucket)
|
|
58
58
|
return r.metadataRequired ? {
|
|
59
59
|
ok: !1,
|
|
60
60
|
error: {
|
|
61
|
-
code:
|
|
61
|
+
code: f.missingMetadata,
|
|
62
62
|
message: "Activated temporal bucket result is missing metadata.",
|
|
63
63
|
path: "temporalBucket"
|
|
64
64
|
}
|
|
65
65
|
} : { ok: !0 };
|
|
66
|
-
const o =
|
|
66
|
+
const o = $(
|
|
67
67
|
e.temporalBucket
|
|
68
68
|
);
|
|
69
69
|
if (!o.ok || !o.value)
|
|
70
70
|
return o;
|
|
71
|
-
const n =
|
|
71
|
+
const n = h(
|
|
72
72
|
o.value.granularity
|
|
73
73
|
);
|
|
74
74
|
return e.dataType !== n ? {
|
|
75
75
|
ok: !1,
|
|
76
76
|
error: {
|
|
77
|
-
code:
|
|
77
|
+
code: f.invalidMetadata,
|
|
78
78
|
message: `${o.value.granularity} temporal buckets require dataType ${n}.`,
|
|
79
79
|
path: "dataType"
|
|
80
80
|
}
|
|
81
81
|
} : o;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
var o, n,
|
|
85
|
-
return e.granularity === r.granularity && e.calendar.tz === r.calendar.tz && e.calendar.weekStart === r.calendar.weekStart && ((o = e.calendar.fiscalCalendar) == null ? void 0 : o.kind) === ((n = r.calendar.fiscalCalendar) == null ? void 0 : n.kind) && ((
|
|
83
|
+
function w(e, r) {
|
|
84
|
+
var o, n, i, a;
|
|
85
|
+
return e.granularity === r.granularity && e.calendar.tz === r.calendar.tz && e.calendar.weekStart === r.calendar.weekStart && ((o = e.calendar.fiscalCalendar) == null ? void 0 : o.kind) === ((n = r.calendar.fiscalCalendar) == null ? void 0 : n.kind) && ((i = e.calendar.fiscalCalendar) == null ? void 0 : i.yearStartMonth) === ((a = r.calendar.fiscalCalendar) == null ? void 0 : a.yearStartMonth);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function O(e, r) {
|
|
88
88
|
const o = /* @__PURE__ */ new Map();
|
|
89
89
|
for (const n of e) {
|
|
90
90
|
if (o.has(n.key))
|
|
91
91
|
return {
|
|
92
92
|
ok: !1,
|
|
93
93
|
error: {
|
|
94
|
-
code:
|
|
94
|
+
code: f.invalidMetadata,
|
|
95
95
|
message: `Canonical result contains duplicate column key "${n.key}".`,
|
|
96
96
|
path: "columns"
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
if (o.set(n.key, n), n.temporalBucket) {
|
|
100
|
-
const
|
|
100
|
+
const i = b(n, {
|
|
101
101
|
metadataRequired: !1
|
|
102
102
|
});
|
|
103
|
-
if (!
|
|
103
|
+
if (!i.ok)
|
|
104
104
|
return {
|
|
105
105
|
ok: !1,
|
|
106
106
|
error: {
|
|
107
|
-
...
|
|
108
|
-
path: `columns.${n.key}.${
|
|
107
|
+
...i.error,
|
|
108
|
+
path: `columns.${n.key}.${i.error.path || "temporalBucket"}`
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
for (const n of r) {
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
114
|
+
const i = o.get(n.key);
|
|
115
|
+
if (!i)
|
|
116
116
|
return {
|
|
117
117
|
ok: !1,
|
|
118
118
|
error: {
|
|
119
|
-
code:
|
|
119
|
+
code: f.missingMetadata,
|
|
120
120
|
message: `Activated temporal bucket result is missing column "${n.key}".`,
|
|
121
121
|
path: `columns.${n.key}`
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
-
const a =
|
|
124
|
+
const a = b(i, {
|
|
125
125
|
metadataRequired: !0
|
|
126
126
|
});
|
|
127
127
|
if (!a.ok)
|
|
@@ -132,11 +132,11 @@ function A(e, r) {
|
|
|
132
132
|
path: `columns.${n.key}.${a.error.path || "temporalBucket"}`
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
|
-
if (!a.value || !
|
|
135
|
+
if (!a.value || !w(a.value, n.metadata))
|
|
136
136
|
return {
|
|
137
137
|
ok: !1,
|
|
138
138
|
error: {
|
|
139
|
-
code:
|
|
139
|
+
code: f.invalidMetadata,
|
|
140
140
|
message: `Temporal bucket metadata for column "${n.key}" contradicts the governed query context.`,
|
|
141
141
|
path: `columns.${n.key}.temporalBucket`
|
|
142
142
|
}
|
|
@@ -144,112 +144,165 @@ function A(e, r) {
|
|
|
144
144
|
}
|
|
145
145
|
return { ok: !0, value: e };
|
|
146
146
|
}
|
|
147
|
-
const
|
|
147
|
+
const _ = ["period", "day", "week", "month", "quarter", "year"];
|
|
148
|
+
function u(e) {
|
|
149
|
+
const r = (o) => o !== void 0 && o !== 1 ? { offset: o } : {};
|
|
150
|
+
switch (e.kind) {
|
|
151
|
+
case "target":
|
|
152
|
+
return { kind: "target", targetValue: e.targetValue };
|
|
153
|
+
case "shift":
|
|
154
|
+
return {
|
|
155
|
+
kind: "shift",
|
|
156
|
+
unit: e.unit,
|
|
157
|
+
...r(e.offset),
|
|
158
|
+
...e.matchWeekdays && e.unit === "year" ? { matchWeekdays: !0 } : {}
|
|
159
|
+
};
|
|
160
|
+
case "previous_period":
|
|
161
|
+
return { kind: "shift", unit: "period", ...r(e.offsetPeriods) };
|
|
162
|
+
case "previous_year":
|
|
163
|
+
return {
|
|
164
|
+
kind: "shift",
|
|
165
|
+
unit: "year",
|
|
166
|
+
...r(e.offsetYears),
|
|
167
|
+
...e.alignment === "weekday" ? { matchWeekdays: !0 } : {}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function R(e) {
|
|
172
|
+
const r = u(e);
|
|
173
|
+
return r.kind === "target" ? "target" : r.unit === "year" ? "previous_year" : "previous_period";
|
|
174
|
+
}
|
|
175
|
+
function B(e) {
|
|
176
|
+
return e.offset ?? 1;
|
|
177
|
+
}
|
|
178
|
+
const D = "higher_is_better", E = {
|
|
148
179
|
displayMode: "difference",
|
|
149
180
|
showComparison: !0,
|
|
150
181
|
indicatorStyle: "arrow_badge",
|
|
151
182
|
showColor: !0,
|
|
152
183
|
conditionalLabel: !1
|
|
153
184
|
};
|
|
154
|
-
function
|
|
185
|
+
function T(e) {
|
|
155
186
|
return C(e) !== null;
|
|
156
187
|
}
|
|
157
|
-
function
|
|
158
|
-
var r, o
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
188
|
+
function M(e) {
|
|
189
|
+
var r, o;
|
|
190
|
+
return e.hidden || ((r = e.metricComparison) == null ? void 0 : r.mode) === "off" ? { state: "off" } : ((o = e.metricComparison) == null ? void 0 : o.mode) === "explicit" ? { state: "pinned", spec: u(e.metricComparison.spec) } : e.inheritGlobalComparison === !1 ? { state: "off" } : { state: "follow" };
|
|
191
|
+
}
|
|
192
|
+
function G(e) {
|
|
193
|
+
return (e == null ? void 0 : e.showComparison) === !1;
|
|
194
|
+
}
|
|
195
|
+
function j(e) {
|
|
196
|
+
var o, n;
|
|
197
|
+
const r = M({
|
|
198
|
+
metricComparison: e.metricComparison,
|
|
199
|
+
inheritGlobalComparison: e.inheritGlobalComparison ?? ((o = e.globalDateComparison) == null ? void 0 : o.inheritGlobalComparison)
|
|
200
|
+
});
|
|
201
|
+
if (r.state !== "off") {
|
|
202
|
+
if (r.state === "pinned") return { source: "explicit", spec: r.spec };
|
|
203
|
+
if (((n = e.globalDateComparison) == null ? void 0 : n.selection.mode) === "period")
|
|
163
204
|
return {
|
|
164
205
|
source: "inherited",
|
|
165
|
-
spec: e.globalDateComparison.selection.spec,
|
|
206
|
+
spec: u(e.globalDateComparison.selection.spec),
|
|
166
207
|
...e.globalDateComparison.owner ? { owner: e.globalDateComparison.owner } : {}
|
|
167
208
|
};
|
|
168
209
|
}
|
|
169
210
|
}
|
|
170
|
-
function
|
|
211
|
+
function L(e) {
|
|
171
212
|
if (e.alias) return e.alias;
|
|
172
213
|
const r = e.entityName && e.entityName !== "SEMAPHOR_CALCULATED_FIELD" ? e.entityName : void 0, o = r && r !== e.name ? `${r}_` : "";
|
|
173
214
|
if (e.role !== "metric") return `${o}${e.name}`;
|
|
174
215
|
let n = e.aggregate || "metric";
|
|
175
216
|
if (e.expression) {
|
|
176
|
-
const
|
|
217
|
+
const i = e.expression.match(
|
|
177
218
|
/^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
|
|
178
219
|
);
|
|
179
|
-
n =
|
|
220
|
+
n = i ? i[1].toLowerCase() : "expr";
|
|
180
221
|
} else
|
|
181
222
|
n = n.toLowerCase();
|
|
182
223
|
return `${o}${e.name}_${n}`;
|
|
183
224
|
}
|
|
184
|
-
function
|
|
225
|
+
function t(e, r, o) {
|
|
185
226
|
return o ? { code: e, message: r, path: o } : { code: e, message: r };
|
|
186
227
|
}
|
|
187
|
-
function
|
|
228
|
+
function m(e) {
|
|
188
229
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
189
230
|
}
|
|
190
231
|
function c(e, r, o, n) {
|
|
191
|
-
Object.keys(e).forEach((
|
|
192
|
-
r.includes(
|
|
193
|
-
|
|
232
|
+
Object.keys(e).forEach((i) => {
|
|
233
|
+
r.includes(i) || n.push(
|
|
234
|
+
t(
|
|
194
235
|
"invalid_comparison_spec",
|
|
195
|
-
`Comparison kind does not accept field "${
|
|
196
|
-
`${o}.${
|
|
236
|
+
`Comparison kind does not accept field "${i}".`,
|
|
237
|
+
`${o}.${i}`
|
|
197
238
|
)
|
|
198
239
|
);
|
|
199
240
|
});
|
|
200
241
|
}
|
|
201
|
-
function
|
|
242
|
+
function g(e, r, o) {
|
|
202
243
|
e.alignment !== void 0 && e.alignment !== "calendar" && e.alignment !== "weekday" && o.push(
|
|
203
|
-
|
|
244
|
+
t(
|
|
204
245
|
"invalid_comparison_spec",
|
|
205
246
|
'Comparison alignment must be "calendar" or "weekday".',
|
|
206
247
|
`${r}.alignment`
|
|
207
248
|
)
|
|
208
249
|
), e.toDate !== void 0 && typeof e.toDate != "boolean" && o.push(
|
|
209
|
-
|
|
250
|
+
t(
|
|
210
251
|
"invalid_comparison_spec",
|
|
211
252
|
"Comparison toDate must be a boolean.",
|
|
212
253
|
`${r}.toDate`
|
|
213
254
|
)
|
|
214
255
|
);
|
|
215
256
|
}
|
|
216
|
-
function
|
|
257
|
+
function p(e, r, o) {
|
|
217
258
|
e !== void 0 && (typeof e != "number" || !Number.isSafeInteger(e) || e <= 0) && o.push(
|
|
218
|
-
|
|
259
|
+
t(
|
|
219
260
|
"invalid_comparison_spec",
|
|
220
261
|
"Comparison offset must be a positive safe integer.",
|
|
221
262
|
r
|
|
222
263
|
)
|
|
223
264
|
);
|
|
224
265
|
}
|
|
225
|
-
function
|
|
266
|
+
function k(e, r = "comparison") {
|
|
226
267
|
const o = [];
|
|
227
|
-
return
|
|
268
|
+
return m(e) ? (e.kind === "shift" ? (c(e, ["kind", "unit", "offset", "matchWeekdays"], r, o), _.includes(e.unit) || o.push(
|
|
269
|
+
t(
|
|
270
|
+
"invalid_comparison_spec",
|
|
271
|
+
`Comparison unit must be one of ${_.join(", ")}.`,
|
|
272
|
+
`${r}.unit`
|
|
273
|
+
)
|
|
274
|
+
), p(e.offset, `${r}.offset`, o), e.matchWeekdays !== void 0 && (e.matchWeekdays !== !0 || e.unit !== "year") && o.push(
|
|
275
|
+
t(
|
|
276
|
+
"invalid_comparison_spec",
|
|
277
|
+
"matchWeekdays is true only on a step by years (52 weeks a year back).",
|
|
278
|
+
`${r}.matchWeekdays`
|
|
279
|
+
)
|
|
280
|
+
)) : e.kind === "previous_period" ? (c(
|
|
228
281
|
e,
|
|
229
282
|
["kind", "offsetPeriods", "alignment", "toDate"],
|
|
230
283
|
r,
|
|
231
284
|
o
|
|
232
|
-
),
|
|
285
|
+
), p(e.offsetPeriods, `${r}.offsetPeriods`, o), g(e, r, o)) : e.kind === "previous_year" ? (c(
|
|
233
286
|
e,
|
|
234
287
|
["kind", "offsetYears", "alignment", "toDate"],
|
|
235
288
|
r,
|
|
236
289
|
o
|
|
237
|
-
),
|
|
238
|
-
|
|
290
|
+
), p(e.offsetYears, `${r}.offsetYears`, o), g(e, r, o)) : e.kind === "target" ? (c(e, ["kind", "targetValue"], r, o), (typeof e.targetValue != "number" || !Number.isFinite(e.targetValue)) && o.push(
|
|
291
|
+
t(
|
|
239
292
|
"invalid_comparison_spec",
|
|
240
293
|
"Target comparison requires a finite targetValue.",
|
|
241
294
|
`${r}.targetValue`
|
|
242
295
|
)
|
|
243
296
|
)) : o.push(
|
|
244
|
-
|
|
297
|
+
t(
|
|
245
298
|
"invalid_comparison_spec",
|
|
246
|
-
"Comparison kind must be
|
|
299
|
+
"Comparison kind must be shift or target.",
|
|
247
300
|
`${r}.kind`
|
|
248
301
|
)
|
|
249
302
|
), { ok: o.length === 0, errors: o, warnings: [] }) : {
|
|
250
303
|
ok: !1,
|
|
251
304
|
errors: [
|
|
252
|
-
|
|
305
|
+
t(
|
|
253
306
|
"invalid_comparison_spec",
|
|
254
307
|
"Comparison spec must be an object.",
|
|
255
308
|
r
|
|
@@ -258,12 +311,12 @@ function _(e, r = "comparison") {
|
|
|
258
311
|
warnings: []
|
|
259
312
|
};
|
|
260
313
|
}
|
|
261
|
-
function
|
|
262
|
-
if (!
|
|
314
|
+
function V(e, r = "comparison") {
|
|
315
|
+
if (!m(e))
|
|
263
316
|
return {
|
|
264
317
|
ok: !1,
|
|
265
318
|
errors: [
|
|
266
|
-
|
|
319
|
+
t(
|
|
267
320
|
"invalid_comparison_config",
|
|
268
321
|
"Comparison config must be an object.",
|
|
269
322
|
r
|
|
@@ -272,20 +325,20 @@ function R(e, r = "comparison") {
|
|
|
272
325
|
warnings: []
|
|
273
326
|
};
|
|
274
327
|
const o = [];
|
|
275
|
-
return e.mode === "off" ? c(e, ["mode"], r, o) : e.mode === "explicit" ? (c(e, ["mode", "spec"], r, o), o.push(...
|
|
276
|
-
|
|
328
|
+
return e.mode === "off" ? c(e, ["mode"], r, o) : e.mode === "explicit" ? (c(e, ["mode", "spec"], r, o), o.push(...k(e.spec, `${r}.spec`).errors)) : o.push(
|
|
329
|
+
t(
|
|
277
330
|
"invalid_comparison_config",
|
|
278
331
|
"Comparison mode must be off or explicit.",
|
|
279
332
|
`${r}.mode`
|
|
280
333
|
)
|
|
281
334
|
), { ok: o.length === 0, errors: o, warnings: [] };
|
|
282
335
|
}
|
|
283
|
-
function
|
|
284
|
-
if (!
|
|
336
|
+
function S(e, r = "comparisonSelection") {
|
|
337
|
+
if (!m(e))
|
|
285
338
|
return {
|
|
286
339
|
ok: !1,
|
|
287
340
|
errors: [
|
|
288
|
-
|
|
341
|
+
t(
|
|
289
342
|
"invalid_global_date_comparison",
|
|
290
343
|
"Global Date comparison selection must be an object.",
|
|
291
344
|
r
|
|
@@ -298,17 +351,17 @@ function D(e, r = "comparisonSelection") {
|
|
|
298
351
|
c(e, ["mode"], r, o);
|
|
299
352
|
else if (e.mode === "period") {
|
|
300
353
|
c(e, ["mode", "spec"], r, o);
|
|
301
|
-
const n =
|
|
302
|
-
o.push(...n.errors),
|
|
303
|
-
|
|
354
|
+
const n = k(e.spec, `${r}.spec`);
|
|
355
|
+
o.push(...n.errors), m(e.spec) && e.spec.kind === "target" && o.push(
|
|
356
|
+
t(
|
|
304
357
|
"invalid_global_date_comparison",
|
|
305
|
-
"
|
|
358
|
+
"A dashboard date comparison is a step back (shift), not a target.",
|
|
306
359
|
`${r}.spec.kind`
|
|
307
360
|
)
|
|
308
361
|
);
|
|
309
362
|
} else
|
|
310
363
|
o.push(
|
|
311
|
-
|
|
364
|
+
t(
|
|
312
365
|
"invalid_global_date_comparison",
|
|
313
366
|
"Global Date comparison mode must be off or period.",
|
|
314
367
|
`${r}.mode`
|
|
@@ -316,12 +369,12 @@ function D(e, r = "comparisonSelection") {
|
|
|
316
369
|
);
|
|
317
370
|
return { ok: o.length === 0, errors: o, warnings: [] };
|
|
318
371
|
}
|
|
319
|
-
function
|
|
320
|
-
if (!
|
|
372
|
+
function q(e, r = "globalDateComparison") {
|
|
373
|
+
if (!m(e))
|
|
321
374
|
return {
|
|
322
375
|
ok: !1,
|
|
323
376
|
errors: [
|
|
324
|
-
|
|
377
|
+
t(
|
|
325
378
|
"invalid_global_date_comparison",
|
|
326
379
|
"Global Date comparison context must be an object.",
|
|
327
380
|
r
|
|
@@ -336,62 +389,62 @@ function E(e, r = "globalDateComparison") {
|
|
|
336
389
|
r,
|
|
337
390
|
o
|
|
338
391
|
), o.push(
|
|
339
|
-
...
|
|
392
|
+
...S(
|
|
340
393
|
e.selection,
|
|
341
394
|
`${r}.selection`
|
|
342
395
|
).errors
|
|
343
396
|
), e.inheritGlobalComparison !== void 0 && e.inheritGlobalComparison !== !1 && o.push(
|
|
344
|
-
|
|
397
|
+
t(
|
|
345
398
|
"invalid_global_date_comparison",
|
|
346
399
|
"inheritGlobalComparison may only be false when present.",
|
|
347
400
|
`${r}.inheritGlobalComparison`
|
|
348
401
|
)
|
|
349
|
-
), e.owner !== void 0 && (
|
|
402
|
+
), e.owner !== void 0 && (m(e.owner) ? e.owner.kind === "global_date" ? c(e.owner, ["kind"], `${r}.owner`, o) : e.owner.kind === "field_date" ? (c(
|
|
350
403
|
e.owner,
|
|
351
404
|
["kind", "filterId", "label"],
|
|
352
405
|
`${r}.owner`,
|
|
353
406
|
o
|
|
354
407
|
), (typeof e.owner.filterId != "string" || !e.owner.filterId.trim()) && o.push(
|
|
355
|
-
|
|
408
|
+
t(
|
|
356
409
|
"invalid_global_date_comparison",
|
|
357
410
|
"Field Date comparison owner requires a non-empty filterId.",
|
|
358
411
|
`${r}.owner.filterId`
|
|
359
412
|
)
|
|
360
413
|
), (typeof e.owner.label != "string" || !e.owner.label.trim()) && o.push(
|
|
361
|
-
|
|
414
|
+
t(
|
|
362
415
|
"invalid_global_date_comparison",
|
|
363
416
|
"Field Date comparison owner requires a non-empty label.",
|
|
364
417
|
`${r}.owner.label`
|
|
365
418
|
)
|
|
366
419
|
)) : o.push(
|
|
367
|
-
|
|
420
|
+
t(
|
|
368
421
|
"invalid_global_date_comparison",
|
|
369
422
|
"Comparison owner kind must be global_date or field_date.",
|
|
370
423
|
`${r}.owner.kind`
|
|
371
424
|
)
|
|
372
425
|
) : o.push(
|
|
373
|
-
|
|
426
|
+
t(
|
|
374
427
|
"invalid_global_date_comparison",
|
|
375
428
|
"Comparison owner must be an object.",
|
|
376
429
|
`${r}.owner`
|
|
377
430
|
)
|
|
378
|
-
)), e.referenceTime !== void 0 && (typeof e.referenceTime != "string" || !
|
|
379
|
-
|
|
431
|
+
)), e.referenceTime !== void 0 && (typeof e.referenceTime != "string" || !T(e.referenceTime)) && o.push(
|
|
432
|
+
t(
|
|
380
433
|
"invalid_global_date_comparison",
|
|
381
434
|
"referenceTime must be a valid ISO date-time string when present.",
|
|
382
435
|
`${r}.referenceTime`
|
|
383
436
|
)
|
|
384
437
|
), { ok: o.length === 0, errors: o, warnings: [] };
|
|
385
438
|
}
|
|
386
|
-
function
|
|
439
|
+
function x(e) {
|
|
387
440
|
const { referenceTime: r, ...o } = e;
|
|
388
441
|
return o;
|
|
389
442
|
}
|
|
390
|
-
function
|
|
443
|
+
function F(e, r = "comparisonPolarity") {
|
|
391
444
|
return e === "higher_is_better" || e === "lower_is_better" || e === "neutral" ? { ok: !0, errors: [], warnings: [] } : {
|
|
392
445
|
ok: !1,
|
|
393
446
|
errors: [
|
|
394
|
-
|
|
447
|
+
t(
|
|
395
448
|
"invalid_comparison_polarity",
|
|
396
449
|
"Comparison polarity must be higher_is_better, lower_is_better, or neutral.",
|
|
397
450
|
r
|
|
@@ -400,12 +453,12 @@ function G(e, r = "comparisonPolarity") {
|
|
|
400
453
|
warnings: []
|
|
401
454
|
};
|
|
402
455
|
}
|
|
403
|
-
function
|
|
404
|
-
if (!
|
|
456
|
+
function W(e, r = "comparisonPresentation") {
|
|
457
|
+
if (!m(e))
|
|
405
458
|
return {
|
|
406
459
|
ok: !1,
|
|
407
460
|
errors: [
|
|
408
|
-
|
|
461
|
+
t(
|
|
409
462
|
"invalid_comparison_presentation",
|
|
410
463
|
"Comparison presentation must be an object.",
|
|
411
464
|
r
|
|
@@ -427,7 +480,7 @@ function L(e, r = "comparisonPresentation") {
|
|
|
427
480
|
];
|
|
428
481
|
return Object.keys(e).forEach((a) => {
|
|
429
482
|
n.includes(a) || o.push(
|
|
430
|
-
|
|
483
|
+
t(
|
|
431
484
|
"invalid_comparison_presentation",
|
|
432
485
|
`Comparison presentation does not accept field "${a}".`,
|
|
433
486
|
`${r}.${a}`
|
|
@@ -439,7 +492,7 @@ function L(e, r = "comparisonPresentation") {
|
|
|
439
492
|
["position", ["left", "right", "top"]]
|
|
440
493
|
].forEach(([a, s]) => {
|
|
441
494
|
e[a] !== void 0 && !s.includes(e[a]) && o.push(
|
|
442
|
-
|
|
495
|
+
t(
|
|
443
496
|
"invalid_comparison_presentation",
|
|
444
497
|
`Comparison presentation ${a} is invalid.`,
|
|
445
498
|
`${r}.${a}`
|
|
@@ -447,20 +500,20 @@ function L(e, r = "comparisonPresentation") {
|
|
|
447
500
|
);
|
|
448
501
|
}), ["showComparison", "showColor", "conditionalLabel"].forEach((a) => {
|
|
449
502
|
e[a] !== void 0 && typeof e[a] != "boolean" && o.push(
|
|
450
|
-
|
|
503
|
+
t(
|
|
451
504
|
"invalid_comparison_presentation",
|
|
452
505
|
`Comparison presentation ${a} must be a boolean.`,
|
|
453
506
|
`${r}.${a}`
|
|
454
507
|
)
|
|
455
508
|
);
|
|
456
509
|
}), e.precision !== void 0 && (typeof e.precision != "number" || !Number.isInteger(e.precision) || e.precision < 0 || e.precision > 6) && o.push(
|
|
457
|
-
|
|
510
|
+
t(
|
|
458
511
|
"invalid_comparison_presentation",
|
|
459
512
|
"Comparison presentation precision must be an integer from 0 through 6.",
|
|
460
513
|
`${r}.precision`
|
|
461
514
|
)
|
|
462
515
|
), e.labelName !== void 0 && typeof e.labelName != "string" && o.push(
|
|
463
|
-
|
|
516
|
+
t(
|
|
464
517
|
"invalid_comparison_presentation",
|
|
465
518
|
"Comparison presentation labelName must be a string.",
|
|
466
519
|
`${r}.labelName`
|
|
@@ -468,9 +521,9 @@ function L(e, r = "comparisonPresentation") {
|
|
|
468
521
|
), ["conditionalLabels", "colors"].forEach((a) => {
|
|
469
522
|
const s = e[a];
|
|
470
523
|
if (s !== void 0) {
|
|
471
|
-
if (!
|
|
524
|
+
if (!m(s)) {
|
|
472
525
|
o.push(
|
|
473
|
-
|
|
526
|
+
t(
|
|
474
527
|
"invalid_comparison_presentation",
|
|
475
528
|
`Comparison presentation ${a} must be an object.`,
|
|
476
529
|
`${r}.${a}`
|
|
@@ -480,15 +533,15 @@ function L(e, r = "comparisonPresentation") {
|
|
|
480
533
|
}
|
|
481
534
|
Object.keys(s).forEach((l) => {
|
|
482
535
|
["increase", "decrease", "neutral"].includes(l) || o.push(
|
|
483
|
-
|
|
536
|
+
t(
|
|
484
537
|
"invalid_comparison_presentation",
|
|
485
538
|
`Comparison presentation ${a} does not accept field "${l}".`,
|
|
486
539
|
`${r}.${a}.${l}`
|
|
487
540
|
)
|
|
488
541
|
);
|
|
489
|
-
}), Object.entries(s).forEach(([l,
|
|
490
|
-
|
|
491
|
-
|
|
542
|
+
}), Object.entries(s).forEach(([l, d]) => {
|
|
543
|
+
d !== void 0 && typeof d != "string" && o.push(
|
|
544
|
+
t(
|
|
492
545
|
"invalid_comparison_presentation",
|
|
493
546
|
`Comparison presentation ${a}.${l} must be a string.`,
|
|
494
547
|
`${r}.${a}.${l}`
|
|
@@ -498,18 +551,18 @@ function L(e, r = "comparisonPresentation") {
|
|
|
498
551
|
}
|
|
499
552
|
}), { ok: o.length === 0, errors: o, warnings: [] };
|
|
500
553
|
}
|
|
501
|
-
function
|
|
554
|
+
function v(e) {
|
|
502
555
|
return e === null ? "unknown" : e > 0 ? "increase" : e < 0 ? "decrease" : "no_change";
|
|
503
556
|
}
|
|
504
|
-
function
|
|
557
|
+
function N(e, r) {
|
|
505
558
|
return e === "unknown" || e === "no_change" || r === "neutral" ? "neutral" : r === "higher_is_better" && e === "increase" || r === "lower_is_better" && e === "decrease" ? "favorable" : "unfavorable";
|
|
506
559
|
}
|
|
507
|
-
function
|
|
560
|
+
function U(e) {
|
|
508
561
|
const {
|
|
509
562
|
currentValue: r,
|
|
510
563
|
comparisonValue: o,
|
|
511
|
-
polarity: n =
|
|
512
|
-
} = e, a = r !== null && o !== null ? r - o : null, s = a !== null && o !== null && o !== 0 ? a / Math.abs(o) : null, l = r !== null && o !== null && o !== 0 ? r / o : null,
|
|
564
|
+
polarity: n = D
|
|
565
|
+
} = e, a = r !== null && o !== null ? r - o : null, s = a !== null && o !== null && o !== 0 ? a / Math.abs(o) : null, l = r !== null && o !== null && o !== 0 ? r / o : null, d = v(a);
|
|
513
566
|
return {
|
|
514
567
|
status: o === null ? "insufficient_history" : "available",
|
|
515
568
|
currentValue: r,
|
|
@@ -517,25 +570,31 @@ function j(e) {
|
|
|
517
570
|
delta: a,
|
|
518
571
|
percentChange: s,
|
|
519
572
|
ratio: l,
|
|
520
|
-
direction:
|
|
521
|
-
sentiment:
|
|
573
|
+
direction: d,
|
|
574
|
+
sentiment: N(d, n)
|
|
522
575
|
};
|
|
523
576
|
}
|
|
524
577
|
export {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
578
|
+
_ as C,
|
|
579
|
+
D,
|
|
580
|
+
P as a,
|
|
581
|
+
u as b,
|
|
582
|
+
R as c,
|
|
583
|
+
B as d,
|
|
584
|
+
E as e,
|
|
585
|
+
M as f,
|
|
533
586
|
G as g,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
587
|
+
j as h,
|
|
588
|
+
k as i,
|
|
589
|
+
V as j,
|
|
590
|
+
S as k,
|
|
591
|
+
q as l,
|
|
592
|
+
F as m,
|
|
593
|
+
W as n,
|
|
594
|
+
U as o,
|
|
595
|
+
b as p,
|
|
596
|
+
O as q,
|
|
597
|
+
L as r,
|
|
598
|
+
$ as v,
|
|
599
|
+
x as w
|
|
541
600
|
};
|