react-semaphor 0.1.545 → 0.1.547
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 +408 -442
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +100 -76
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.js +6 -6
- package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
- package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
- package/dist/chunks/applied-constraints-DU-wndZ7.js +47 -0
- package/dist/chunks/{assistant-chat-D7sWTypJ.js → assistant-chat-CK84cPAB.js} +2826 -2595
- package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-Cu-a5ie_.js} +8 -15
- package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
- package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
- package/dist/chunks/custom-visual-inputs-ChL54gGm.js +295 -0
- package/dist/chunks/{dashboard-B1tMju0u.js → dashboard-DCk26-6i.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CePgIu0Z.js → dashboard-briefing-launcher-CQ1eYsGy.js} +1291 -1277
- package/dist/chunks/dashboard-controls-BMeZjF7r.js +2307 -0
- package/dist/chunks/{dashboard-json-CoYRPqxx.js → dashboard-json-BZqCoanC.js} +5 -5
- package/dist/chunks/{document-dashboard-inputs-BesAHZvB.js → document-dashboard-inputs-tYd7ao0o.js} +877 -979
- package/dist/chunks/{edit-dashboard-visual-JPtNfJRb.js → edit-dashboard-visual-Bv3MHM_G.js} +2157 -2243
- package/dist/chunks/filter-reach-copy-CGWsL_ez.js +3480 -0
- package/dist/chunks/{filter-value-text-ff7osJr7.js → filter-value-text-Ddf55Ku1.js} +9 -9
- package/dist/chunks/global-date-filter-utils-BhAu8zIM.js +12137 -0
- package/dist/chunks/index-CtoK1Lgu.js +586 -0
- package/dist/chunks/{index-DRWiuqyd.js → index-DmrLP5Ro.js} +105 -104
- package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
- package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
- package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
- package/dist/chunks/{matrix-formatter-DnCyRXJE.js → matrix-formatter-DWEeC0_c.js} +44 -44
- package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
- package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
- package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
- package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-C3mUgnEx.js → raw-temporal-presentation-DypB7sMX.js} +8 -8
- package/dist/chunks/{report-preferences-dialog-DUtuUL_5.js → report-preferences-dialog-DoVyriYC.js} +154 -155
- package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-D0JDUa4h.js +5576 -0
- package/dist/chunks/{saved-dashboard-context-LrF_kW0l.js → saved-dashboard-context-BfAH5j4L.js} +34 -34
- package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
- package/dist/chunks/{semaphor-ready-indicator-BxF96Yhv.js → semaphor-ready-indicator-CRm17oIP.js} +51771 -52574
- package/dist/chunks/{shelf-drop-preview-context-CNaM_Gmh.js → shelf-drop-preview-context-vy6P9THz.js} +7 -7
- package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
- package/dist/chunks/{switch-uDtPgQlQ.js → switch-CEBOR4n7.js} +3 -3
- package/dist/chunks/{table-export-sheet-YzMioA7Y.js → table-export-sheet-4X9mAG3V.js} +1 -1
- package/dist/chunks/table-settings-WysCBj62.js +614 -0
- package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
- package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CjB7ig1o.js → use-create-flow-overlay-state-Csx_Xjsh.js} +101 -101
- package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
- package/dist/chunks/{relative-date-label-Bk2j94pA.js → zoned-wall-clock-MulfA26h.js} +64 -21
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1895 -1163
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +14 -14
- package/dist/format-utils/index.js +133 -133
- package/dist/index.js +192 -186
- package/dist/layouts/index.js +5 -242
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/shared/index.js +4 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +7 -0
- package/dist/types/components/surfboard/screen-size-preview-button.d.ts +10 -0
- package/dist/types/components/visual/matrix-table/matrix-card-view.d.ts +3 -0
- package/dist/types/index.js +6 -6
- package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +346 -21
- package/dist/types/lib/dashboard-inputs/dashboard-filter-value-identity.d.ts +65 -0
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +6 -0
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +2 -0
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +3 -3
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +9 -1
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +5 -1
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +149 -10
- package/dist/types/lib/stores/dashboard-store.d.ts +137 -6
- package/dist/types/lib/types/common-types.d.ts +8 -0
- package/dist/types/lib/types/explorer-types.d.ts +10 -0
- package/dist/types/lib/types/semantic-types.d.ts +84 -0
- package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
- package/dist/types/lib/utils/card-type-change.d.ts +16 -0
- package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
- package/dist/types/lib/utils/field-placement.d.ts +96 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
- package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +57 -1
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -1
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +29 -29
- package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
- package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
- package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
- package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +45 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +96 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +3 -3
- package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +24 -14
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-automatic-target.d.ts +4 -4
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +3 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-types.d.ts +27 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-value-compatibility.d.ts +12 -3
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +26 -0
- package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-preview.d.ts +97 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +22 -2
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +101 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +100 -0
- package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +22 -0
- package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
- package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
- package/dist/types/shared/layouts/engine/index.d.ts +4 -0
- package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
- package/dist/types/shared/layouts/engine/types.d.ts +125 -0
- package/dist/types/shared/layouts/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/chunks/apply-dashboard-operations-CZEMsx8E.js +0 -2080
- package/dist/chunks/calendar-day-equality-dvoQp1xW.js +0 -410
- package/dist/chunks/comparison-window-caption-D4E6IHPD.js +0 -1624
- package/dist/chunks/custom-visual-inputs-DLCD9Y5V.js +0 -329
- package/dist/chunks/dashboard-controls-Cq05n3e0.js +0 -2315
- package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
- package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
- package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
- package/dist/chunks/numeric-presentation-7X_IrD58.js +0 -5226
- package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +0 -9415
- package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
- package/dist/chunks/table-settings-CLZocegs.js +0 -501
- package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
- package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +0 -46
- package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
- package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
- package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js}
RENAMED
|
@@ -1,210 +1,212 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { N, O, P as y, q as
|
|
1
|
+
var G = Object.defineProperty;
|
|
2
|
+
var Q = (e, t, o) => t in e ? G(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var h = (e, t, o) => Q(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { N as q, O as L, P as y, q as ee, H as te, E as oe, i as re, Q as K, f as ne, F as ae, r as ie, M as se, v as ce } from "./temporal-bucket-CQOSbv9-.js";
|
|
5
5
|
import { z as d } from "zod";
|
|
6
|
-
import { E as
|
|
7
|
-
import {
|
|
8
|
-
import { b as
|
|
9
|
-
import {
|
|
10
|
-
import "./
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
import { E as B, l as Y } from "./export-file-format-C-tJsxsf.js";
|
|
7
|
+
import { aM as le, l as de, X as me, O as T, o as ue } from "./validators-C-aOQlTB.js";
|
|
8
|
+
import { b as fe } from "./report-runtime-context-hWiTCzFV.js";
|
|
9
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as pe } from "../value-format-preferences/index.js";
|
|
10
|
+
import { z as ye } from "./zoned-wall-clock-MulfA26h.js";
|
|
11
|
+
import { S as he } from "./analytics-base-schemas-BKs3flFS.js";
|
|
12
|
+
import "./matrix-operation-contract-D6vYkZK4.js";
|
|
13
|
+
import { r as we, i as ge } from "./metric-comparison-zpGw4lD6.js";
|
|
14
|
+
import { d as ve, P as be } from "./pivot-result-identity-C-Q1j1Wb.js";
|
|
15
|
+
function Ot(e, t) {
|
|
16
|
+
const r = Ie(e);
|
|
15
17
|
let n;
|
|
16
18
|
if (r.date) {
|
|
17
|
-
const
|
|
18
|
-
n =
|
|
19
|
+
const c = Se(r.date, 2);
|
|
20
|
+
n = Ee(c.restDateString, c.year);
|
|
19
21
|
}
|
|
20
22
|
if (!n || isNaN(n.getTime()))
|
|
21
23
|
return /* @__PURE__ */ new Date(NaN);
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
if (r.time && (
|
|
24
|
+
const a = n.getTime();
|
|
25
|
+
let i = 0, s;
|
|
26
|
+
if (r.time && (i = Re(r.time), isNaN(i)))
|
|
25
27
|
return /* @__PURE__ */ new Date(NaN);
|
|
26
28
|
if (r.timezone) {
|
|
27
|
-
if (
|
|
29
|
+
if (s = Ae(r.timezone), isNaN(s))
|
|
28
30
|
return /* @__PURE__ */ new Date(NaN);
|
|
29
31
|
} else {
|
|
30
|
-
const
|
|
32
|
+
const c = new Date(a + i), m = /* @__PURE__ */ new Date(0);
|
|
31
33
|
return m.setFullYear(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
c.getUTCFullYear(),
|
|
35
|
+
c.getUTCMonth(),
|
|
36
|
+
c.getUTCDate()
|
|
35
37
|
), m.setHours(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
c.getUTCHours(),
|
|
39
|
+
c.getUTCMinutes(),
|
|
40
|
+
c.getUTCSeconds(),
|
|
41
|
+
c.getUTCMilliseconds()
|
|
40
42
|
), m;
|
|
41
43
|
}
|
|
42
|
-
return new Date(
|
|
44
|
+
return new Date(a + i + s);
|
|
43
45
|
}
|
|
44
|
-
const
|
|
46
|
+
const k = {
|
|
45
47
|
dateTimeDelimiter: /[T ]/,
|
|
46
48
|
timeZoneDelimiter: /[Z ]/i,
|
|
47
49
|
timezone: /([Z+-].*)$/
|
|
48
|
-
},
|
|
49
|
-
function
|
|
50
|
-
const t = {}, o = e.split(
|
|
50
|
+
}, xe = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Te = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, ke = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
51
|
+
function Ie(e) {
|
|
52
|
+
const t = {}, o = e.split(k.dateTimeDelimiter);
|
|
51
53
|
let r;
|
|
52
54
|
if (o.length > 2)
|
|
53
55
|
return t;
|
|
54
|
-
if (/:/.test(o[0]) ? r = o[0] : (t.date = o[0], r = o[1],
|
|
56
|
+
if (/:/.test(o[0]) ? r = o[0] : (t.date = o[0], r = o[1], k.timeZoneDelimiter.test(t.date) && (t.date = e.split(k.timeZoneDelimiter)[0], r = e.substr(
|
|
55
57
|
t.date.length,
|
|
56
58
|
e.length
|
|
57
59
|
))), r) {
|
|
58
|
-
const n =
|
|
60
|
+
const n = k.timezone.exec(r);
|
|
59
61
|
n ? (t.time = r.replace(n[1], ""), t.timezone = n[1]) : t.time = r;
|
|
60
62
|
}
|
|
61
63
|
return t;
|
|
62
64
|
}
|
|
63
|
-
function
|
|
65
|
+
function Se(e, t) {
|
|
64
66
|
const o = new RegExp(
|
|
65
67
|
"^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
|
|
66
68
|
), r = e.match(o);
|
|
67
69
|
if (!r) return { year: NaN, restDateString: "" };
|
|
68
|
-
const n = r[1] ? parseInt(r[1]) : null,
|
|
70
|
+
const n = r[1] ? parseInt(r[1]) : null, a = r[2] ? parseInt(r[2]) : null;
|
|
69
71
|
return {
|
|
70
|
-
year:
|
|
72
|
+
year: a === null ? n : a * 100,
|
|
71
73
|
restDateString: e.slice((r[1] || r[2]).length)
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
|
-
function
|
|
76
|
+
function Ee(e, t) {
|
|
75
77
|
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
76
|
-
const o = e.match(
|
|
78
|
+
const o = e.match(xe);
|
|
77
79
|
if (!o) return /* @__PURE__ */ new Date(NaN);
|
|
78
|
-
const r = !!o[4], n =
|
|
80
|
+
const r = !!o[4], n = x(o[1]), a = x(o[2]) - 1, i = x(o[3]), s = x(o[4]), c = x(o[5]) - 1;
|
|
79
81
|
if (r)
|
|
80
|
-
return
|
|
82
|
+
return Fe(t, s, c) ? Ce(t, s, c) : /* @__PURE__ */ new Date(NaN);
|
|
81
83
|
{
|
|
82
84
|
const m = /* @__PURE__ */ new Date(0);
|
|
83
|
-
return
|
|
85
|
+
return !$e(t, a, i) || !Me(t, n) ? /* @__PURE__ */ new Date(NaN) : (m.setUTCFullYear(t, a, Math.max(n, i)), m);
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
|
-
function
|
|
88
|
+
function x(e) {
|
|
87
89
|
return e ? parseInt(e) : 1;
|
|
88
90
|
}
|
|
89
|
-
function
|
|
90
|
-
const t = e.match(
|
|
91
|
+
function Re(e) {
|
|
92
|
+
const t = e.match(Te);
|
|
91
93
|
if (!t) return NaN;
|
|
92
|
-
const o =
|
|
93
|
-
return
|
|
94
|
+
const o = M(t[1]), r = M(t[2]), n = M(t[3]);
|
|
95
|
+
return De(o, r, n) ? o * q + r * L + n * 1e3 : NaN;
|
|
94
96
|
}
|
|
95
|
-
function
|
|
97
|
+
function M(e) {
|
|
96
98
|
return e && parseFloat(e.replace(",", ".")) || 0;
|
|
97
99
|
}
|
|
98
|
-
function
|
|
100
|
+
function Ae(e) {
|
|
99
101
|
if (e === "Z") return 0;
|
|
100
|
-
const t = e.match(
|
|
102
|
+
const t = e.match(ke);
|
|
101
103
|
if (!t) return 0;
|
|
102
104
|
const o = t[1] === "+" ? -1 : 1, r = parseInt(t[2]), n = t[3] && parseInt(t[3]) || 0;
|
|
103
|
-
return
|
|
105
|
+
return Ke(r, n) ? o * (r * q + n * L) : NaN;
|
|
104
106
|
}
|
|
105
|
-
function
|
|
107
|
+
function Ce(e, t, o) {
|
|
106
108
|
const r = /* @__PURE__ */ new Date(0);
|
|
107
109
|
r.setUTCFullYear(e, 0, 4);
|
|
108
|
-
const n = r.getUTCDay() || 7,
|
|
109
|
-
return r.setUTCDate(r.getUTCDate() +
|
|
110
|
+
const n = r.getUTCDay() || 7, a = (t - 1) * 7 + o + 1 - n;
|
|
111
|
+
return r.setUTCDate(r.getUTCDate() + a), r;
|
|
110
112
|
}
|
|
111
|
-
const
|
|
112
|
-
function
|
|
113
|
+
const _e = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
114
|
+
function Z(e) {
|
|
113
115
|
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
114
116
|
}
|
|
115
|
-
function
|
|
116
|
-
return t >= 0 && t <= 11 && o >= 1 && o <= (
|
|
117
|
+
function $e(e, t, o) {
|
|
118
|
+
return t >= 0 && t <= 11 && o >= 1 && o <= (_e[t] || (Z(e) ? 29 : 28));
|
|
117
119
|
}
|
|
118
|
-
function
|
|
119
|
-
return t >= 1 && t <= (
|
|
120
|
+
function Me(e, t) {
|
|
121
|
+
return t >= 1 && t <= (Z(e) ? 366 : 365);
|
|
120
122
|
}
|
|
121
|
-
function
|
|
123
|
+
function Fe(e, t, o) {
|
|
122
124
|
return t >= 1 && t <= 53 && o >= 0 && o <= 6;
|
|
123
125
|
}
|
|
124
|
-
function
|
|
126
|
+
function De(e, t, o) {
|
|
125
127
|
return e === 24 ? t === 0 && o === 0 : o >= 0 && o < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
|
|
126
128
|
}
|
|
127
|
-
function
|
|
129
|
+
function Ke(e, t) {
|
|
128
130
|
return t >= 0 && t <= 59;
|
|
129
131
|
}
|
|
130
|
-
const
|
|
131
|
-
function
|
|
132
|
+
const je = 5 * 1024 * 1024, Pt = 64 * 1024 * 1024, R = d.number().int().positive().max(Number.MAX_SAFE_INTEGER), S = d.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), A = S.refine((e) => e > 0), Ne = (e) => !!e && e !== "." && e !== ".." && !e.includes("/") && !e.includes("\\");
|
|
133
|
+
function v(e, t) {
|
|
132
134
|
const o = t.split("/");
|
|
133
|
-
if (o.length !== 5 || o[0] !== "exports" || o[1] !== e || o[2] !== "attempts" || !o.every(
|
|
135
|
+
if (o.length !== 5 || o[0] !== "exports" || o[1] !== e || o[2] !== "attempts" || !o.every(Ne))
|
|
134
136
|
throw new Error("Invalid Matrix export artifact namespace.");
|
|
135
137
|
return { attemptId: o[3], filename: o[4] };
|
|
136
138
|
}
|
|
137
|
-
function
|
|
139
|
+
function zt(e, t, o) {
|
|
138
140
|
const r = `exports/${e}/attempts/${t}/${o}`;
|
|
139
|
-
return
|
|
141
|
+
return v(e, r), r;
|
|
140
142
|
}
|
|
141
|
-
const
|
|
143
|
+
const qt = d.object({
|
|
142
144
|
acquisition: d.literal("continuation"),
|
|
143
145
|
jobId: d.string().min(1),
|
|
144
146
|
sequence: A,
|
|
145
|
-
deadlineAt:
|
|
146
|
-
}),
|
|
147
|
+
deadlineAt: R
|
|
148
|
+
}), Ue = [
|
|
147
149
|
"application/json",
|
|
148
|
-
...
|
|
149
|
-
],
|
|
150
|
+
...B.map((e) => Y(e).partContentType)
|
|
151
|
+
], Oe = d.object({
|
|
150
152
|
key: d.string(),
|
|
151
153
|
content: d.string(),
|
|
152
|
-
contentType: d.enum(
|
|
154
|
+
contentType: d.enum(Ue),
|
|
153
155
|
encoding: d.literal("gzip-base64").optional()
|
|
154
156
|
// Transport-only compression: JSON (layout, sheet layout) and Excel rows. CSV travels as it always has.
|
|
155
|
-
}).refine((e) => !e.encoding || e.contentType === "application/json" || e.contentType ===
|
|
156
|
-
d.object({ kind: d.literal("work"), sequence: A, checkpointKey: d.string(), objects: d.array(
|
|
157
|
-
d.object({ kind: d.literal("committed"), sequence: A, done: d.boolean(), deadlineAt:
|
|
157
|
+
}).refine((e) => !e.encoding || e.contentType === "application/json" || e.contentType === Y("xlsx").partContentType, "Unsupported Matrix artifact encoding."), Pe = d.discriminatedUnion("kind", [
|
|
158
|
+
d.object({ kind: d.literal("work"), sequence: A, checkpointKey: d.string(), objects: d.array(Oe).min(2).max(4), deadlineAt: R }),
|
|
159
|
+
d.object({ kind: d.literal("committed"), sequence: A, done: d.boolean(), deadlineAt: R })
|
|
158
160
|
]);
|
|
159
|
-
function
|
|
161
|
+
function ze(e) {
|
|
160
162
|
const t = JSON.stringify(e);
|
|
161
|
-
if (t === void 0 || new TextEncoder().encode(t).byteLength >
|
|
163
|
+
if (t === void 0 || new TextEncoder().encode(t).byteLength > je)
|
|
162
164
|
throw new RangeError("Matrix export batch exceeds its transport byte limit.");
|
|
163
165
|
}
|
|
164
|
-
function
|
|
165
|
-
const o =
|
|
166
|
-
if (
|
|
166
|
+
function Lt(e, t) {
|
|
167
|
+
const o = Pe.parse(e);
|
|
168
|
+
if (ze(e), o.deadlineAt !== t.deadlineAt) throw new Error("Matrix deadline does not match the job.");
|
|
167
169
|
if (o.sequence !== t.sequence + (o.kind === "committed" ? 1 : 0))
|
|
168
170
|
throw new Error("Invalid Matrix batch sequence.");
|
|
169
171
|
if (o.kind === "work") {
|
|
170
|
-
|
|
172
|
+
v(t.jobId, o.checkpointKey);
|
|
171
173
|
for (const r of o.objects)
|
|
172
|
-
|
|
174
|
+
v(t.jobId, r.key);
|
|
173
175
|
}
|
|
174
176
|
return o;
|
|
175
177
|
}
|
|
176
|
-
const
|
|
178
|
+
const qe = d.object({
|
|
177
179
|
acquisition: d.literal("continuation"),
|
|
178
|
-
deadlineAt:
|
|
180
|
+
deadlineAt: R,
|
|
179
181
|
chunks: d.array(d.object({ chunkNumber: A, dataKey: d.string() })).min(1),
|
|
180
|
-
totalRows:
|
|
181
|
-
totalBytes:
|
|
182
|
+
totalRows: S,
|
|
183
|
+
totalBytes: S,
|
|
182
184
|
fileKey: d.string().min(1).optional(),
|
|
183
|
-
fileSize:
|
|
185
|
+
fileSize: S.optional(),
|
|
184
186
|
/** The file the job writes; absent means CSV (manifests from before Excel). */
|
|
185
|
-
format: d.enum(
|
|
187
|
+
format: d.enum(B).optional(),
|
|
186
188
|
/** Excel only: the sheet layout the layout batch stored, which compaction wraps the rows in. */
|
|
187
189
|
sheetKey: d.string().min(1).optional()
|
|
188
190
|
}).refine((e) => e.fileKey === void 0 == (e.fileSize === void 0), "Incomplete published Matrix artifact.").refine((e) => e.format === "xlsx" == (e.sheetKey !== void 0), "An Excel Matrix manifest names its sheet layout, and only it does.");
|
|
189
|
-
function
|
|
190
|
-
const r =
|
|
191
|
+
function Bt(e, t, o) {
|
|
192
|
+
const r = qe.parse(e);
|
|
191
193
|
if (r.deadlineAt !== o) throw new Error("Matrix deadline does not match the job.");
|
|
192
|
-
return r.chunks.forEach((n,
|
|
193
|
-
if (n.chunkNumber !==
|
|
194
|
-
|
|
195
|
-
}), r.fileKey !== void 0 &&
|
|
194
|
+
return r.chunks.forEach((n, a) => {
|
|
195
|
+
if (n.chunkNumber !== a + 1) throw new Error("Invalid committed Matrix chunk order.");
|
|
196
|
+
v(t, n.dataKey);
|
|
197
|
+
}), r.fileKey !== void 0 && v(t, r.fileKey), r.sheetKey !== void 0 && v(t, r.sheetKey), r;
|
|
196
198
|
}
|
|
197
|
-
function
|
|
199
|
+
function Yt(e, t) {
|
|
198
200
|
return t.levelLabels[e.id] ?? e.field.label ?? e.field.name;
|
|
199
201
|
}
|
|
200
|
-
function
|
|
202
|
+
function Zt(e, t) {
|
|
201
203
|
return t.measureLabels[e.id] ?? (e.kind === "aggregate" ? e.field.label ?? e.field.name : e.definition.label);
|
|
202
204
|
}
|
|
203
|
-
function
|
|
204
|
-
return
|
|
205
|
+
function Ht(e) {
|
|
206
|
+
return ue.parse(Le(e));
|
|
205
207
|
}
|
|
206
|
-
function
|
|
207
|
-
const t =
|
|
208
|
+
function Le(e) {
|
|
209
|
+
const t = le.parse(e), o = (r) => ({
|
|
208
210
|
grand: { visible: !0, position: "after" },
|
|
209
211
|
levels: Object.fromEntries(
|
|
210
212
|
r.map((n) => [
|
|
@@ -213,7 +215,7 @@ function Re(e) {
|
|
|
213
215
|
])
|
|
214
216
|
)
|
|
215
217
|
});
|
|
216
|
-
return
|
|
218
|
+
return de.parse({
|
|
217
219
|
version: 1,
|
|
218
220
|
spec: t,
|
|
219
221
|
presentation: {
|
|
@@ -231,40 +233,40 @@ function Re(e) {
|
|
|
231
233
|
}
|
|
232
234
|
});
|
|
233
235
|
}
|
|
234
|
-
function
|
|
235
|
-
const o = new Map(e.map((r) => [
|
|
236
|
-
for (const r of t ?? []) o.set(
|
|
236
|
+
function Be(e, t) {
|
|
237
|
+
const o = new Map(e.map((r) => [T(r), r]));
|
|
238
|
+
for (const r of t ?? []) o.set(T(r), r);
|
|
237
239
|
return [...o.values()];
|
|
238
240
|
}
|
|
239
|
-
function
|
|
240
|
-
const { spec: t, presentation: o, defaults: r, session: n } =
|
|
241
|
-
|
|
241
|
+
function Vt(e) {
|
|
242
|
+
const { spec: t, presentation: o, defaults: r, session: n } = me.parse(e), a = new Map(
|
|
243
|
+
Be(t.sorts, n == null ? void 0 : n.sorts).map((s) => [T(s), s])
|
|
242
244
|
);
|
|
243
|
-
for (const
|
|
244
|
-
for (const
|
|
245
|
+
for (const s of ["rows", "columns"])
|
|
246
|
+
for (const c of t[s]) {
|
|
245
247
|
const m = {
|
|
246
|
-
axis:
|
|
247
|
-
levelId:
|
|
248
|
+
axis: s,
|
|
249
|
+
levelId: c.id,
|
|
248
250
|
scope: { kind: "level" },
|
|
249
251
|
target: { kind: "member" },
|
|
250
252
|
direction: "asc",
|
|
251
253
|
nulls: "last"
|
|
252
254
|
};
|
|
253
|
-
|
|
255
|
+
a.has(T(m)) || a.set(T(m), m);
|
|
254
256
|
}
|
|
255
|
-
const
|
|
256
|
-
depth: Math.min(
|
|
257
|
+
const i = (s, c) => ({
|
|
258
|
+
depth: Math.min(s.depth, Math.max(0, c - 1)),
|
|
257
259
|
// Leaf toggles are valid but have no effect. Collapsed ancestors retain dormant overrides.
|
|
258
|
-
overrides:
|
|
259
|
-
(m) => m.path.length <
|
|
260
|
+
overrides: s.overrides.filter(
|
|
261
|
+
(m) => m.path.length < c
|
|
260
262
|
)
|
|
261
263
|
});
|
|
262
264
|
return {
|
|
263
|
-
spec: { ...t, sorts: [...
|
|
265
|
+
spec: { ...t, sorts: [...a.values()] },
|
|
264
266
|
presentation: o,
|
|
265
267
|
view: {
|
|
266
|
-
rows:
|
|
267
|
-
columns:
|
|
268
|
+
rows: i((n == null ? void 0 : n.rows) ?? r.rows, t.rows.length),
|
|
269
|
+
columns: i(
|
|
268
270
|
(n == null ? void 0 : n.columns) ?? r.columns,
|
|
269
271
|
t.columns.length
|
|
270
272
|
),
|
|
@@ -272,35 +274,35 @@ function ut(e) {
|
|
|
272
274
|
}
|
|
273
275
|
};
|
|
274
276
|
}
|
|
275
|
-
class
|
|
277
|
+
class N extends Error {
|
|
276
278
|
constructor(o) {
|
|
277
279
|
super(
|
|
278
280
|
`invalid_presentation_execution_snapshot: ${o} Resave this report before running it again.`
|
|
279
281
|
);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
+
h(this, "code", "invalid_presentation_execution_snapshot");
|
|
283
|
+
h(this, "deliveryBlocking", !0);
|
|
282
284
|
this.name = "PresentationExecutionSnapshotError";
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
|
-
class
|
|
287
|
+
class Xt extends Error {
|
|
286
288
|
constructor(o) {
|
|
287
289
|
super(
|
|
288
290
|
`missing_resolved_raw_temporal_format: Column "${o}" has no captured presentation. Resave this report before running it again.`
|
|
289
291
|
);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
+
h(this, "code", "missing_resolved_raw_temporal_format");
|
|
293
|
+
h(this, "deliveryBlocking", !0);
|
|
292
294
|
this.name = "MissingResolvedRawTemporalFormatError";
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
|
-
function
|
|
296
|
-
const r = new Set(t), n = Object.keys(e).find((
|
|
297
|
+
function w(e, t, o) {
|
|
298
|
+
const r = new Set(t), n = Object.keys(e).find((a) => !r.has(a));
|
|
297
299
|
if (n)
|
|
298
300
|
throw new Error(`${o} contains unknown property "${n}"`);
|
|
299
301
|
}
|
|
300
|
-
function
|
|
302
|
+
function Ye(e, t = "scope") {
|
|
301
303
|
if (!y(e))
|
|
302
304
|
throw new Error(`${t} must be an object`);
|
|
303
|
-
|
|
305
|
+
w(
|
|
304
306
|
e,
|
|
305
307
|
["dashboardId", "cardId", "attachmentIndex"],
|
|
306
308
|
t
|
|
@@ -322,22 +324,22 @@ function $e(e, t = "scope") {
|
|
|
322
324
|
...typeof n == "number" ? { attachmentIndex: n } : {}
|
|
323
325
|
};
|
|
324
326
|
}
|
|
325
|
-
function
|
|
327
|
+
function b(e, t, o, r) {
|
|
326
328
|
if (e.kind !== t) return;
|
|
327
|
-
|
|
329
|
+
w(e, ["kind", o], r);
|
|
328
330
|
const n = e[o];
|
|
329
331
|
if (typeof n != "string" || !n.trim())
|
|
330
332
|
throw new Error(`${r}.${o} is required`);
|
|
331
333
|
return n;
|
|
332
334
|
}
|
|
333
|
-
function
|
|
335
|
+
function F(e, t) {
|
|
334
336
|
if (!y(e))
|
|
335
337
|
throw new Error(`${t} must be an object`);
|
|
336
|
-
const o =
|
|
338
|
+
const o = b(e, "metric", "metricId", t);
|
|
337
339
|
if (o) return { kind: "metric", metricId: o };
|
|
338
|
-
const r =
|
|
340
|
+
const r = b(e, "column", "columnKey", t);
|
|
339
341
|
if (r) return { kind: "column", columnKey: r };
|
|
340
|
-
const n =
|
|
342
|
+
const n = b(
|
|
341
343
|
e,
|
|
342
344
|
"matrix_measure",
|
|
343
345
|
"measureId",
|
|
@@ -346,7 +348,7 @@ function S(e, t) {
|
|
|
346
348
|
if (n) return { kind: "matrix_measure", measureId: n };
|
|
347
349
|
throw new Error(`${t} is not a valid numeric presentation target`);
|
|
348
350
|
}
|
|
349
|
-
const
|
|
351
|
+
const Ze = [
|
|
350
352
|
"type",
|
|
351
353
|
"inputUnit",
|
|
352
354
|
"outputStyle",
|
|
@@ -357,12 +359,12 @@ const Ce = [
|
|
|
357
359
|
"suffix",
|
|
358
360
|
"negativeStyle"
|
|
359
361
|
];
|
|
360
|
-
function
|
|
362
|
+
function He(e) {
|
|
361
363
|
return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
|
|
362
364
|
}
|
|
363
|
-
const
|
|
364
|
-
function
|
|
365
|
-
if (
|
|
365
|
+
const Ve = ["type", "locale", "pattern", "timezone", "sourceTimezone"];
|
|
366
|
+
function Xe(e, t) {
|
|
367
|
+
if (w(e, Ve, t), typeof e.locale != "string" || !e.locale.trim())
|
|
366
368
|
throw new Error(`${t}.locale must be a non-empty string`);
|
|
367
369
|
for (const o of ["pattern", "timezone", "sourceTimezone"])
|
|
368
370
|
if (e[o] !== void 0 && typeof e[o] != "string")
|
|
@@ -375,20 +377,20 @@ function _e(e, t) {
|
|
|
375
377
|
...typeof e.sourceTimezone == "string" ? { sourceTimezone: e.sourceTimezone } : {}
|
|
376
378
|
};
|
|
377
379
|
}
|
|
378
|
-
function
|
|
379
|
-
|
|
380
|
-
for (const
|
|
381
|
-
if (e[
|
|
382
|
-
throw new Error(`${t}.${
|
|
380
|
+
function We(e, t) {
|
|
381
|
+
w(e, Ze, t);
|
|
382
|
+
for (const a of ["inputUnit", "largestUnit", "smallestUnit"])
|
|
383
|
+
if (e[a] !== void 0 && !He(e[a]))
|
|
384
|
+
throw new Error(`${t}.${a} must be a duration unit`);
|
|
383
385
|
const o = e.outputStyle;
|
|
384
386
|
if (o !== void 0 && o !== "compact" && o !== "digital" && o !== "long")
|
|
385
387
|
throw new Error(`${t}.outputStyle must be compact, digital, or long`);
|
|
386
388
|
const r = e.maxUnits;
|
|
387
389
|
if (r !== void 0 && (typeof r != "number" || !Number.isInteger(r) || r < 0 || r > 10))
|
|
388
390
|
throw new Error(`${t}.maxUnits must be an integer from 0 to 10`);
|
|
389
|
-
for (const
|
|
390
|
-
if (e[
|
|
391
|
-
throw new Error(`${t}.${
|
|
391
|
+
for (const a of ["prefix", "suffix"])
|
|
392
|
+
if (e[a] !== void 0 && typeof e[a] != "string")
|
|
393
|
+
throw new Error(`${t}.${a} must be a string`);
|
|
392
394
|
const n = e.negativeStyle;
|
|
393
395
|
if (n !== void 0 && n !== "minus" && n !== "parentheses")
|
|
394
396
|
throw new Error(`${t}.negativeStyle must be minus or parentheses`);
|
|
@@ -404,26 +406,26 @@ function Ke(e, t) {
|
|
|
404
406
|
...n !== void 0 ? { negativeStyle: n } : {}
|
|
405
407
|
};
|
|
406
408
|
}
|
|
407
|
-
function
|
|
409
|
+
function Je(e, t) {
|
|
408
410
|
if (!y(e))
|
|
409
411
|
throw new Error(`${t} must be an object`);
|
|
410
412
|
if (e.kind === "field") {
|
|
411
|
-
|
|
413
|
+
w(e, ["kind", "fieldId", "role"], t);
|
|
412
414
|
const n = typeof e.fieldId == "string" ? e.fieldId.trim() : "";
|
|
413
415
|
if (!n)
|
|
414
416
|
throw new Error(`${t}.fieldId is required`);
|
|
415
|
-
const
|
|
416
|
-
if (
|
|
417
|
+
const a = e.role;
|
|
418
|
+
if (a !== void 0 && a !== "groupby" && a !== "pivotby")
|
|
417
419
|
throw new Error(`${t}.role must be groupby or pivotby`);
|
|
418
420
|
return {
|
|
419
421
|
kind: "field",
|
|
420
422
|
fieldId: n,
|
|
421
|
-
...
|
|
423
|
+
...a ? { role: a } : {}
|
|
422
424
|
};
|
|
423
425
|
}
|
|
424
|
-
const o =
|
|
426
|
+
const o = b(e, "column", "columnKey", t);
|
|
425
427
|
if (o) return { kind: "column", columnKey: o };
|
|
426
|
-
const r =
|
|
428
|
+
const r = b(
|
|
427
429
|
e,
|
|
428
430
|
"matrix_axis",
|
|
429
431
|
"axisInstanceId",
|
|
@@ -432,22 +434,22 @@ function Fe(e, t) {
|
|
|
432
434
|
if (r) return { kind: "matrix_axis", axisInstanceId: r };
|
|
433
435
|
throw new Error(`${t} is not a valid temporal bucket presentation target`);
|
|
434
436
|
}
|
|
435
|
-
function
|
|
437
|
+
function Ge(e, t) {
|
|
436
438
|
if (!y(e))
|
|
437
439
|
throw new Error(`${t} must be an object`);
|
|
438
|
-
const o =
|
|
440
|
+
const o = b(e, "column", "columnKey", t);
|
|
439
441
|
if (!o)
|
|
440
442
|
throw new Error(`${t} must identify a column`);
|
|
441
443
|
return { kind: "column", columnKey: o };
|
|
442
444
|
}
|
|
443
|
-
function
|
|
445
|
+
function Qe(e) {
|
|
444
446
|
return [
|
|
445
447
|
e.dashboardId,
|
|
446
448
|
e.cardId ?? null,
|
|
447
449
|
e.attachmentIndex ?? null
|
|
448
450
|
];
|
|
449
451
|
}
|
|
450
|
-
function
|
|
452
|
+
function C(e) {
|
|
451
453
|
switch (e.kind) {
|
|
452
454
|
case "metric":
|
|
453
455
|
return [e.kind, e.metricId];
|
|
@@ -461,80 +463,80 @@ function R(e) {
|
|
|
461
463
|
return [e.kind, e.axisInstanceId];
|
|
462
464
|
}
|
|
463
465
|
}
|
|
464
|
-
function
|
|
466
|
+
function _(e, t) {
|
|
465
467
|
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === t.attachmentIndex;
|
|
466
468
|
}
|
|
467
469
|
function $(e, t) {
|
|
468
|
-
const o =
|
|
469
|
-
return o.length === r.length && o.every((n,
|
|
470
|
+
const o = C(e), r = C(t);
|
|
471
|
+
return o.length === r.length && o.every((n, a) => n === r[a]);
|
|
470
472
|
}
|
|
471
|
-
function
|
|
473
|
+
function et(e) {
|
|
472
474
|
if (!Array.isArray(e))
|
|
473
475
|
throw new Error("resolvedFormats must be an array");
|
|
474
476
|
const t = /* @__PURE__ */ new Set();
|
|
475
477
|
return e.map((o, r) => {
|
|
476
|
-
var
|
|
478
|
+
var c, m;
|
|
477
479
|
const n = `resolvedFormats.${r}`;
|
|
478
480
|
if (!y(o))
|
|
479
481
|
throw new Error(`${n} must be an object`);
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
+
w(o, ["scope", "target", "format"], n);
|
|
483
|
+
const a = Ye(o.scope, `${n}.scope`);
|
|
482
484
|
if (!y(o.format))
|
|
483
485
|
throw new Error(`${n}.format must be an object`);
|
|
484
|
-
let
|
|
486
|
+
let i;
|
|
485
487
|
switch (o.format.type) {
|
|
486
488
|
case "temporal_bucket": {
|
|
487
|
-
const
|
|
488
|
-
if (!
|
|
489
|
+
const u = oe(o.format);
|
|
490
|
+
if (!u.ok)
|
|
489
491
|
throw new Error(
|
|
490
|
-
`${n}.format is invalid: ${((
|
|
492
|
+
`${n}.format is invalid: ${((c = u.issues[0]) == null ? void 0 : c.message) ?? "invalid value"}`
|
|
491
493
|
);
|
|
492
|
-
|
|
493
|
-
scope:
|
|
494
|
-
target:
|
|
495
|
-
format:
|
|
494
|
+
i = {
|
|
495
|
+
scope: a,
|
|
496
|
+
target: Je(o.target, `${n}.target`),
|
|
497
|
+
format: u.value
|
|
496
498
|
};
|
|
497
499
|
break;
|
|
498
500
|
}
|
|
499
501
|
case "raw_temporal":
|
|
500
|
-
|
|
501
|
-
scope:
|
|
502
|
-
target:
|
|
503
|
-
format:
|
|
502
|
+
i = {
|
|
503
|
+
scope: a,
|
|
504
|
+
target: Ge(o.target, `${n}.target`),
|
|
505
|
+
format: te(o.format)
|
|
504
506
|
};
|
|
505
507
|
break;
|
|
506
508
|
case "number":
|
|
507
509
|
case "currency":
|
|
508
510
|
case "percent":
|
|
509
511
|
case "scientific": {
|
|
510
|
-
const
|
|
511
|
-
if (!
|
|
512
|
+
const u = ee(o.format);
|
|
513
|
+
if (!u.ok)
|
|
512
514
|
throw new Error(
|
|
513
|
-
`${n}.format is invalid: ${((m =
|
|
515
|
+
`${n}.format is invalid: ${((m = u.issues[0]) == null ? void 0 : m.message) ?? "invalid value"}`
|
|
514
516
|
);
|
|
515
|
-
|
|
516
|
-
scope:
|
|
517
|
-
target:
|
|
518
|
-
format:
|
|
517
|
+
i = {
|
|
518
|
+
scope: a,
|
|
519
|
+
target: F(o.target, `${n}.target`),
|
|
520
|
+
format: u.value
|
|
519
521
|
};
|
|
520
522
|
break;
|
|
521
523
|
}
|
|
522
524
|
case "date": {
|
|
523
|
-
const
|
|
524
|
-
if (
|
|
525
|
+
const u = F(o.target, `${n}.target`);
|
|
526
|
+
if (u.kind !== "column")
|
|
525
527
|
throw new Error(`${n}.target must identify a column for a date format`);
|
|
526
|
-
|
|
527
|
-
scope:
|
|
528
|
-
target:
|
|
529
|
-
format:
|
|
528
|
+
i = {
|
|
529
|
+
scope: a,
|
|
530
|
+
target: u,
|
|
531
|
+
format: Xe(o.format, `${n}.format`)
|
|
530
532
|
};
|
|
531
533
|
break;
|
|
532
534
|
}
|
|
533
535
|
case "duration":
|
|
534
|
-
|
|
535
|
-
scope:
|
|
536
|
-
target:
|
|
537
|
-
format:
|
|
536
|
+
i = {
|
|
537
|
+
scope: a,
|
|
538
|
+
target: F(o.target, `${n}.target`),
|
|
539
|
+
format: We(
|
|
538
540
|
o.format,
|
|
539
541
|
`${n}.format`
|
|
540
542
|
)
|
|
@@ -543,28 +545,28 @@ function Ne(e) {
|
|
|
543
545
|
default:
|
|
544
546
|
throw new Error(`${n}.format.type is unsupported`);
|
|
545
547
|
}
|
|
546
|
-
const
|
|
547
|
-
...
|
|
548
|
-
...
|
|
548
|
+
const s = JSON.stringify([
|
|
549
|
+
...Qe(i.scope),
|
|
550
|
+
...C(i.target)
|
|
549
551
|
]);
|
|
550
|
-
if (t.has(
|
|
552
|
+
if (t.has(s))
|
|
551
553
|
throw new Error(
|
|
552
554
|
`${n} duplicates a scoped presentation target`
|
|
553
555
|
);
|
|
554
|
-
return t.add(
|
|
556
|
+
return t.add(s), i;
|
|
555
557
|
});
|
|
556
558
|
}
|
|
557
|
-
function
|
|
559
|
+
function tt(e) {
|
|
558
560
|
try {
|
|
559
561
|
if (!y(e))
|
|
560
562
|
throw new Error("presentation execution snapshot must be an object");
|
|
561
|
-
if (
|
|
563
|
+
if (w(
|
|
562
564
|
e,
|
|
563
565
|
["version", "reportContext", "resolvedFormats"],
|
|
564
566
|
"presentation execution snapshot"
|
|
565
567
|
), e.version !== 1)
|
|
566
568
|
throw new Error("presentation execution snapshot version must be 1");
|
|
567
|
-
const t =
|
|
569
|
+
const t = fe(e.reportContext);
|
|
568
570
|
if (!t.ok) {
|
|
569
571
|
const o = t.issues[0];
|
|
570
572
|
throw new Error(
|
|
@@ -574,90 +576,276 @@ function Oe(e) {
|
|
|
574
576
|
return {
|
|
575
577
|
version: 1,
|
|
576
578
|
reportContext: t.value,
|
|
577
|
-
resolvedFormats:
|
|
579
|
+
resolvedFormats: et(e.resolvedFormats)
|
|
578
580
|
};
|
|
579
581
|
} catch (t) {
|
|
580
|
-
throw t instanceof
|
|
582
|
+
throw t instanceof N ? t : new N(
|
|
581
583
|
t instanceof Error ? t.message : "Snapshot is invalid."
|
|
582
584
|
);
|
|
583
585
|
}
|
|
584
586
|
}
|
|
585
|
-
function
|
|
586
|
-
return
|
|
587
|
+
function Wt(e) {
|
|
588
|
+
return tt({
|
|
587
589
|
version: 1,
|
|
588
590
|
reportContext: e.reportContext,
|
|
589
591
|
resolvedFormats: [...e.resolvedFormats]
|
|
590
592
|
});
|
|
591
593
|
}
|
|
592
|
-
function
|
|
593
|
-
const t =
|
|
594
|
-
return
|
|
594
|
+
function Jt(e) {
|
|
595
|
+
const t = ot(e);
|
|
596
|
+
return re(t) ? t : void 0;
|
|
595
597
|
}
|
|
596
|
-
function
|
|
598
|
+
function ot(e) {
|
|
597
599
|
const t = e.snapshot.resolvedFormats.find(
|
|
598
|
-
(o) => o.format.type !== "temporal_bucket" && o.format.type !== "raw_temporal" && o.format.type !== "date" &&
|
|
600
|
+
(o) => o.format.type !== "temporal_bucket" && o.format.type !== "raw_temporal" && o.format.type !== "date" && _(o.scope, e.scope) && $(o.target, e.target)
|
|
599
601
|
);
|
|
600
602
|
return t == null ? void 0 : t.format;
|
|
601
603
|
}
|
|
602
|
-
function
|
|
604
|
+
function Gt(e) {
|
|
603
605
|
const t = e.snapshot.resolvedFormats.find(
|
|
604
|
-
(o) => o.format.type === "date" &&
|
|
606
|
+
(o) => o.format.type === "date" && _(o.scope, e.scope) && $(o.target, e.target)
|
|
605
607
|
);
|
|
606
608
|
return t == null ? void 0 : t.format;
|
|
607
609
|
}
|
|
608
|
-
function
|
|
610
|
+
function Qt(e) {
|
|
609
611
|
const t = e.snapshot.resolvedFormats.find(
|
|
610
|
-
(o) => o.format.type === "raw_temporal" &&
|
|
612
|
+
(o) => o.format.type === "raw_temporal" && _(o.scope, e.scope) && $(o.target, e.target)
|
|
611
613
|
);
|
|
612
614
|
return t == null ? void 0 : t.format;
|
|
613
615
|
}
|
|
614
|
-
function
|
|
616
|
+
function eo(e) {
|
|
615
617
|
const t = e.snapshot.resolvedFormats.find(
|
|
616
|
-
(o) => o.format.type === "temporal_bucket" &&
|
|
618
|
+
(o) => o.format.type === "temporal_bucket" && _(o.scope, e.scope) && $(o.target, e.target)
|
|
617
619
|
);
|
|
618
620
|
return t == null ? void 0 : t.format;
|
|
619
621
|
}
|
|
620
|
-
function
|
|
622
|
+
function to(e) {
|
|
621
623
|
var n;
|
|
622
624
|
const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
623
|
-
if (e.snapshot.resolvedFormats.forEach((
|
|
624
|
-
if (
|
|
625
|
+
if (e.snapshot.resolvedFormats.forEach((a, i) => {
|
|
626
|
+
if (a.scope.attachmentIndex !== void 0)
|
|
625
627
|
throw new Error(
|
|
626
|
-
`resolvedFormats.${
|
|
628
|
+
`resolvedFormats.${i}.scope.attachmentIndex is not valid for a card export`
|
|
627
629
|
);
|
|
628
|
-
if (
|
|
630
|
+
if (a.scope.dashboardId !== e.expectedScope.dashboardId || a.scope.cardId !== e.expectedScope.cardId)
|
|
629
631
|
throw new Error(
|
|
630
|
-
`resolvedFormats.${
|
|
632
|
+
`resolvedFormats.${i}.scope must match the executing dashboard/card`
|
|
631
633
|
);
|
|
632
|
-
if (
|
|
633
|
-
const
|
|
634
|
-
if (o.has(
|
|
634
|
+
if (a.target.kind === "field" && a.format.type === "temporal_bucket") {
|
|
635
|
+
const s = JSON.stringify(C(a.target));
|
|
636
|
+
if (o.has(s))
|
|
635
637
|
throw new Error(
|
|
636
|
-
`resolvedFormats.${
|
|
638
|
+
`resolvedFormats.${i} duplicates export field "${a.target.fieldId}"`
|
|
637
639
|
);
|
|
638
|
-
o.add(
|
|
640
|
+
o.add(s);
|
|
639
641
|
return;
|
|
640
642
|
}
|
|
641
|
-
if (
|
|
643
|
+
if (a.target.kind !== "column")
|
|
642
644
|
throw new Error(
|
|
643
|
-
`resolvedFormats.${
|
|
645
|
+
`resolvedFormats.${i}.target must identify an export column or temporal pivot field`
|
|
644
646
|
);
|
|
645
|
-
if (t.has(
|
|
647
|
+
if (t.has(a.target.columnKey))
|
|
646
648
|
throw new Error(
|
|
647
|
-
`resolvedFormats.${
|
|
649
|
+
`resolvedFormats.${i} duplicates export column "${a.target.columnKey}"`
|
|
648
650
|
);
|
|
649
|
-
t.add(
|
|
651
|
+
t.add(a.target.columnKey);
|
|
650
652
|
}), !e.useFormattedValues) return;
|
|
651
653
|
if (!((n = e.visibleColumns) != null && n.length))
|
|
652
654
|
throw new Error("visibleColumns must identify every formatted export column");
|
|
653
655
|
const r = e.visibleColumns.find(
|
|
654
|
-
(
|
|
656
|
+
(a) => !t.has(a)
|
|
655
657
|
);
|
|
656
658
|
if (r)
|
|
657
659
|
throw new Error(
|
|
658
660
|
`resolvedFormats is missing visible export column "${r}"`
|
|
659
661
|
);
|
|
660
662
|
}
|
|
663
|
+
const rt = /* @__PURE__ */ new Set(["short", "medium", "long"]), nt = /^(\d{4})-(\d{2})-(\d{2})$/, at = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/, it = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/, j = " – ";
|
|
664
|
+
function oo(e) {
|
|
665
|
+
if (!y(e)) return;
|
|
666
|
+
const t = Object.keys(e);
|
|
667
|
+
if (e.mode === "period_label" && t.length === 1)
|
|
668
|
+
return { mode: "period_label" };
|
|
669
|
+
if (e.mode === "style" && t.length === 2 && typeof e.dateStyle == "string" && rt.has(e.dateStyle))
|
|
670
|
+
return { mode: "style", dateStyle: e.dateStyle };
|
|
671
|
+
if (e.mode === "pattern" && t.length === 3 && e.dialect === "semaphor_tokens" && typeof e.pattern == "string" && st(e.pattern) === null)
|
|
672
|
+
return {
|
|
673
|
+
mode: "pattern",
|
|
674
|
+
dialect: "semaphor_tokens",
|
|
675
|
+
pattern: e.pattern
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function st(e) {
|
|
679
|
+
try {
|
|
680
|
+
return ce({ dialect: "semaphor_tokens", pattern: e }), null;
|
|
681
|
+
} catch (t) {
|
|
682
|
+
return t instanceof Error ? t.message : "The pattern is invalid.";
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function ro(e) {
|
|
686
|
+
const { value: t, part: o, presentation: r, preferences: n, calendar: a } = e;
|
|
687
|
+
if ((r == null ? void 0 : r.mode) === "period_label" && t.periodLabel && o === "range")
|
|
688
|
+
return { ok: !0, text: t.periodLabel };
|
|
689
|
+
const [i, s] = t.bounds, m = s === void 0 || o === "start" ? [{ raw: i, role: "start" }] : o === "end" ? [{ raw: s, role: "end" }] : [
|
|
690
|
+
{ raw: i, role: "start" },
|
|
691
|
+
{ raw: s, role: "end" }
|
|
692
|
+
], u = m.map(({ raw: p }) => mt(p, a.tz));
|
|
693
|
+
if (u.some((p) => p === null))
|
|
694
|
+
return {
|
|
695
|
+
ok: !1,
|
|
696
|
+
text: m.map(({ raw: p }) => p).join(j),
|
|
697
|
+
diagnostic: {
|
|
698
|
+
code: "invalid_temporal_input_value",
|
|
699
|
+
message: "A date input bound is not a date or an instant."
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
const g = t.precision === "day" ? u.map(
|
|
703
|
+
(p, J) => ft(p, m[J].role, a.tz)
|
|
704
|
+
) : [], f = g.length > 0 && g.every((p) => p !== null) ? g : null;
|
|
705
|
+
return { ok: !0, text: f ? ct(f, r, n, a) : lt(
|
|
706
|
+
u.map((p) => ut(p, a.tz)),
|
|
707
|
+
r,
|
|
708
|
+
n,
|
|
709
|
+
a
|
|
710
|
+
) };
|
|
711
|
+
}
|
|
712
|
+
function ct(e, t, o, r) {
|
|
713
|
+
const [n, a = n] = e;
|
|
714
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
715
|
+
return X(
|
|
716
|
+
e.map(
|
|
717
|
+
(c) => V(D(c), "date", t.pattern, o, r)
|
|
718
|
+
)
|
|
719
|
+
);
|
|
720
|
+
const i = (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : o.dateStyle;
|
|
721
|
+
if (!t || t.mode === "period_label") {
|
|
722
|
+
const c = pt(n, a, r);
|
|
723
|
+
if (c)
|
|
724
|
+
return ne({
|
|
725
|
+
value: D(n),
|
|
726
|
+
metadata: {
|
|
727
|
+
kind: "temporal_bucket",
|
|
728
|
+
granularity: c,
|
|
729
|
+
calendar: { tz: r.tz, weekStart: r.weekStart ?? 1 }
|
|
730
|
+
},
|
|
731
|
+
format: ae({
|
|
732
|
+
metadata: {
|
|
733
|
+
kind: "temporal_bucket",
|
|
734
|
+
granularity: c,
|
|
735
|
+
calendar: { tz: r.tz, weekStart: r.weekStart ?? 1 }
|
|
736
|
+
},
|
|
737
|
+
locale: o.locale,
|
|
738
|
+
styles: { dateStyle: i, dateTime: { ...o.dateTime } }
|
|
739
|
+
}).format
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
const s = new Intl.DateTimeFormat(o.locale, {
|
|
743
|
+
calendar: "gregory",
|
|
744
|
+
timeZone: "UTC",
|
|
745
|
+
dateStyle: i
|
|
746
|
+
});
|
|
747
|
+
return ht(n, a) ? s.format(E(n)) : H(s, E(n), E(a));
|
|
748
|
+
}
|
|
749
|
+
function lt(e, t, o, r) {
|
|
750
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
751
|
+
return X(
|
|
752
|
+
e.map(
|
|
753
|
+
(s) => V(
|
|
754
|
+
s.toISOString(),
|
|
755
|
+
"instant",
|
|
756
|
+
t.pattern,
|
|
757
|
+
o,
|
|
758
|
+
r
|
|
759
|
+
)
|
|
760
|
+
)
|
|
761
|
+
);
|
|
762
|
+
const n = new Intl.DateTimeFormat(o.locale, {
|
|
763
|
+
calendar: "gregory",
|
|
764
|
+
timeZone: r.tz,
|
|
765
|
+
dateStyle: (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : o.dateTime.dateStyle,
|
|
766
|
+
timeStyle: o.dateTime.timeStyle
|
|
767
|
+
}), [a, i] = e;
|
|
768
|
+
return i && i.getTime() !== a.getTime() ? H(n, a, i) : n.format(a);
|
|
769
|
+
}
|
|
770
|
+
function H(e, t, o) {
|
|
771
|
+
const r = e;
|
|
772
|
+
return typeof r.formatRange == "function" ? r.formatRange(t, o) : `${e.format(t)}${j}${e.format(o)}`;
|
|
773
|
+
}
|
|
774
|
+
function V(e, t, o, r, n) {
|
|
775
|
+
const a = ie({
|
|
776
|
+
format: {
|
|
777
|
+
type: "raw_temporal",
|
|
778
|
+
presentation: { mode: "pattern", dialect: "semaphor_tokens", pattern: o }
|
|
779
|
+
},
|
|
780
|
+
// Temporal formatting reads no currency.
|
|
781
|
+
preferences: {
|
|
782
|
+
...r,
|
|
783
|
+
defaultCurrency: pe.defaultCurrency
|
|
784
|
+
},
|
|
785
|
+
calendar: { tz: n.tz }
|
|
786
|
+
}), i = t === "date" && dt(o) ? "instant" : t;
|
|
787
|
+
return se({
|
|
788
|
+
value: i === t ? e : K(`${e}T00:00:00`, n.tz).toISOString(),
|
|
789
|
+
metadata: { kind: "raw_temporal", valueKind: i },
|
|
790
|
+
format: a
|
|
791
|
+
}).text;
|
|
792
|
+
}
|
|
793
|
+
function dt(e) {
|
|
794
|
+
return /HH|mm|ss/.test(e);
|
|
795
|
+
}
|
|
796
|
+
function X(e) {
|
|
797
|
+
return e[1] === void 0 || e[0] === e[1] ? e[0] : e.join(j);
|
|
798
|
+
}
|
|
799
|
+
function mt(e, t) {
|
|
800
|
+
const o = nt.exec(e);
|
|
801
|
+
if (o) {
|
|
802
|
+
const n = {
|
|
803
|
+
year: Number(o[1]),
|
|
804
|
+
month: Number(o[2]),
|
|
805
|
+
day: Number(o[3])
|
|
806
|
+
};
|
|
807
|
+
return wt(n) ? { kind: "date", date: n } : null;
|
|
808
|
+
}
|
|
809
|
+
const r = it.test(e) ? new Date(e.replace(" ", "T")) : at.test(e) ? K(e.replace(" ", "T"), t) : null;
|
|
810
|
+
return r && !Number.isNaN(r.getTime()) ? { kind: "instant", instant: r } : null;
|
|
811
|
+
}
|
|
812
|
+
function ut(e, t) {
|
|
813
|
+
return e.kind === "instant" ? e.instant : K(`${D(e.date)}T00:00:00`, t);
|
|
814
|
+
}
|
|
815
|
+
function ft(e, t, o) {
|
|
816
|
+
if (e.kind === "date") return e.date;
|
|
817
|
+
const r = ye(e.instant, o), n = { year: r.year, month: r.month, day: r.day };
|
|
818
|
+
if (r.hour === 0 && r.minute === 0 && r.second === 0 && e.instant.getUTCMilliseconds() === 0) return t === "start" ? n : yt(n, -1);
|
|
819
|
+
const i = r.hour === 23 && r.minute === 59 && r.second === 59;
|
|
820
|
+
return t === "end" && i ? n : null;
|
|
821
|
+
}
|
|
822
|
+
function pt(e, t, o) {
|
|
823
|
+
return o.fiscalCalendar || e.day !== 1 || e.year !== t.year || t.day !== W(t.year, t.month) ? null : e.month === t.month ? "month" : e.month % 3 === 1 && t.month === e.month + 2 ? "quarter" : e.month === 1 && t.month === 12 ? "year" : null;
|
|
824
|
+
}
|
|
825
|
+
function D(e) {
|
|
826
|
+
return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
827
|
+
}
|
|
828
|
+
function E(e) {
|
|
829
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
830
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(0, 0, 0, 0), t;
|
|
831
|
+
}
|
|
832
|
+
function yt(e, t) {
|
|
833
|
+
const o = E(e);
|
|
834
|
+
return o.setUTCDate(o.getUTCDate() + t), {
|
|
835
|
+
year: o.getUTCFullYear(),
|
|
836
|
+
month: o.getUTCMonth() + 1,
|
|
837
|
+
day: o.getUTCDate()
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
function ht(e, t) {
|
|
841
|
+
return e.year === t.year && e.month === t.month && e.day === t.day;
|
|
842
|
+
}
|
|
843
|
+
function W(e, t) {
|
|
844
|
+
return new Date(Date.UTC(e, t, 0)).getUTCDate();
|
|
845
|
+
}
|
|
846
|
+
function wt(e) {
|
|
847
|
+
return e.year >= 1 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= W(e.year, e.month);
|
|
848
|
+
}
|
|
661
849
|
function I(e) {
|
|
662
850
|
return Array.from(
|
|
663
851
|
new Set(
|
|
@@ -667,310 +855,310 @@ function I(e) {
|
|
|
667
855
|
)
|
|
668
856
|
);
|
|
669
857
|
}
|
|
670
|
-
function
|
|
858
|
+
function gt(e) {
|
|
671
859
|
const t = /* @__PURE__ */ new Map();
|
|
672
860
|
return e.forEach((o) => {
|
|
673
861
|
o.id && t.set(o.id, (t.get(o.id) ?? 0) + 1);
|
|
674
862
|
}), e.flatMap(
|
|
675
|
-
(o) => o.id && (t.get(o.id) ?? 0) > 1 ? [
|
|
863
|
+
(o) => o.id && (t.get(o.id) ?? 0) > 1 ? [we(o)] : []
|
|
676
864
|
);
|
|
677
865
|
}
|
|
678
|
-
function
|
|
866
|
+
function no(e) {
|
|
679
867
|
const t = e.metricFields ?? [], o = I(t);
|
|
680
868
|
return {
|
|
681
869
|
expectedRoleFieldIds: {
|
|
682
870
|
groupby: I(e.groupByFields),
|
|
683
|
-
metric: o.length > 0 ? o : [
|
|
871
|
+
metric: o.length > 0 ? o : [he],
|
|
684
872
|
pivotby: I(e.pivotByFields),
|
|
685
873
|
detail: I(e.detailFields)
|
|
686
874
|
},
|
|
687
|
-
expectedMetricAliases:
|
|
875
|
+
expectedMetricAliases: gt(t)
|
|
688
876
|
};
|
|
689
877
|
}
|
|
690
|
-
class
|
|
878
|
+
class l extends Error {
|
|
691
879
|
constructor(o, r) {
|
|
692
880
|
super(`invalid_pivot_result_lifecycle: ${o}`);
|
|
693
|
-
|
|
694
|
-
|
|
881
|
+
h(this, "code", "invalid_pivot_result_lifecycle");
|
|
882
|
+
h(this, "deliveryBlocking", !0);
|
|
695
883
|
this.cause = r, this.name = "PivotResultLifecycleError";
|
|
696
884
|
}
|
|
697
885
|
}
|
|
698
|
-
function
|
|
886
|
+
function vt(e) {
|
|
699
887
|
if (!Array.isArray(e) || e.some(
|
|
700
888
|
(o) => !o || typeof o != "object" || Array.isArray(o) || typeof o.key != "string" || !o.key || typeof o.name != "string" || typeof o.label != "string"
|
|
701
889
|
))
|
|
702
|
-
throw new
|
|
890
|
+
throw new l(
|
|
703
891
|
"Canonical pivot columns must be an array of keyed, named result descriptors."
|
|
704
892
|
);
|
|
705
893
|
const t = e;
|
|
706
894
|
if (new Set(t.map((o) => o.key)).size !== t.length)
|
|
707
|
-
throw new
|
|
895
|
+
throw new l(
|
|
708
896
|
"Canonical pivot column keys must be unique."
|
|
709
897
|
);
|
|
710
898
|
for (const o of t) {
|
|
711
|
-
const r =
|
|
899
|
+
const r = ge(o, {
|
|
712
900
|
metadataRequired: !1
|
|
713
901
|
});
|
|
714
902
|
if (!r.ok)
|
|
715
|
-
throw new
|
|
903
|
+
throw new l(
|
|
716
904
|
`Canonical pivot column "${o.key}" has invalid temporal metadata: ${r.error.message}`
|
|
717
905
|
);
|
|
718
906
|
}
|
|
719
907
|
return t;
|
|
720
908
|
}
|
|
721
|
-
function
|
|
909
|
+
function U(e) {
|
|
722
910
|
if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1 || e.source !== "explorer" || !e.byRole || typeof e.byRole != "object" || Array.isArray(e.byRole))
|
|
723
|
-
throw new
|
|
911
|
+
throw new l(
|
|
724
912
|
"A loaded canonical pivot result requires its role-scoped column key map."
|
|
725
913
|
);
|
|
726
914
|
const t = e, o = /* @__PURE__ */ new Set(["groupby", "metric", "pivotby", "detail"]);
|
|
727
915
|
for (const [r, n] of Object.entries(t.byRole)) {
|
|
728
916
|
if (!o.has(r) || !n || typeof n != "object" || Array.isArray(n))
|
|
729
|
-
throw new
|
|
917
|
+
throw new l(
|
|
730
918
|
`Canonical pivot role map contains invalid "${r}" bindings.`
|
|
731
919
|
);
|
|
732
|
-
for (const [
|
|
733
|
-
if (!
|
|
734
|
-
throw new
|
|
735
|
-
`Canonical pivot role map contains an invalid "${r}:${
|
|
920
|
+
for (const [a, i] of Object.entries(n))
|
|
921
|
+
if (!a || !i || typeof i != "object" || Array.isArray(i) || i.role !== r || typeof i.rawKey != "string" || !i.rawKey || i.outputKey !== void 0 && (typeof i.outputKey != "string" || !i.outputKey))
|
|
922
|
+
throw new l(
|
|
923
|
+
`Canonical pivot role map contains an invalid "${r}:${a}" binding.`
|
|
736
924
|
);
|
|
737
925
|
}
|
|
738
926
|
if (t.byMetricAlias !== void 0) {
|
|
739
927
|
if (!t.byMetricAlias || typeof t.byMetricAlias != "object" || Array.isArray(t.byMetricAlias))
|
|
740
|
-
throw new
|
|
928
|
+
throw new l(
|
|
741
929
|
"Canonical pivot metric-alias bindings must be an object."
|
|
742
930
|
);
|
|
743
931
|
for (const [r, n] of Object.entries(
|
|
744
932
|
t.byMetricAlias
|
|
745
933
|
))
|
|
746
934
|
if (!r || !n || typeof n != "object" || Array.isArray(n) || n.role !== "metric" || typeof n.rawKey != "string" || !n.rawKey || n.outputKey !== void 0 && (typeof n.outputKey != "string" || !n.outputKey))
|
|
747
|
-
throw new
|
|
935
|
+
throw new l(
|
|
748
936
|
`Canonical pivot metric-alias map contains an invalid "${r}" binding.`
|
|
749
937
|
);
|
|
750
938
|
}
|
|
751
939
|
return t;
|
|
752
940
|
}
|
|
753
|
-
function
|
|
941
|
+
function bt(e) {
|
|
754
942
|
if (e === void 0) return {};
|
|
755
943
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
756
|
-
throw new
|
|
944
|
+
throw new l(
|
|
757
945
|
"Canonical pivot column metadata must be an object."
|
|
758
946
|
);
|
|
759
947
|
for (const [t, o] of Object.entries(e)) {
|
|
760
948
|
if (!t || !o || typeof o != "object" || Array.isArray(o))
|
|
761
|
-
throw new
|
|
949
|
+
throw new l(
|
|
762
950
|
`Canonical pivot column metadata contains an invalid "${t}" classification.`
|
|
763
951
|
);
|
|
764
952
|
const { isSubtotal: r, subtotalScope: n } = o;
|
|
765
953
|
if (r !== void 0 && typeof r != "boolean" || n !== void 0 && n !== "base" && n !== "pivot-value" && n !== "grand-total" || r === !0 && n !== "pivot-value" && n !== "grand-total" || (n === "pivot-value" || n === "grand-total") && r !== !0 || n === "base" && r === !0)
|
|
766
|
-
throw new
|
|
954
|
+
throw new l(
|
|
767
955
|
`Canonical pivot column metadata contains an incoherent "${t}" subtotal classification.`
|
|
768
956
|
);
|
|
769
957
|
}
|
|
770
958
|
return e;
|
|
771
959
|
}
|
|
772
|
-
function
|
|
960
|
+
function O(e, t) {
|
|
773
961
|
if (!Array.isArray(e) || e.some((o) => typeof o != "string" || !o) || new Set(e).size !== e.length)
|
|
774
|
-
throw new
|
|
962
|
+
throw new l(
|
|
775
963
|
`Canonical pivot contract ${t} must be an array of unique field identities.`
|
|
776
964
|
);
|
|
777
965
|
return e;
|
|
778
966
|
}
|
|
779
|
-
function
|
|
967
|
+
function xt(e, t) {
|
|
780
968
|
if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1)
|
|
781
|
-
throw new
|
|
969
|
+
throw new l(
|
|
782
970
|
"A canonical pivot result requires its versioned result contract."
|
|
783
971
|
);
|
|
784
972
|
const o = e, r = o.expectedRoleFieldIds;
|
|
785
973
|
if (!r || typeof r != "object" || Array.isArray(r))
|
|
786
|
-
throw new
|
|
974
|
+
throw new l(
|
|
787
975
|
"Canonical pivot contract role identities must be an object."
|
|
788
976
|
);
|
|
789
|
-
const
|
|
977
|
+
const a = Object.fromEntries(
|
|
790
978
|
[
|
|
791
979
|
"groupby",
|
|
792
980
|
"metric",
|
|
793
981
|
"pivotby",
|
|
794
982
|
"detail"
|
|
795
|
-
].map((
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
r[
|
|
799
|
-
`expectedRoleFieldIds.${
|
|
983
|
+
].map((f) => [
|
|
984
|
+
f,
|
|
985
|
+
O(
|
|
986
|
+
r[f],
|
|
987
|
+
`expectedRoleFieldIds.${f}`
|
|
800
988
|
)
|
|
801
989
|
])
|
|
802
|
-
),
|
|
990
|
+
), i = O(
|
|
803
991
|
o.expectedMetricAliases,
|
|
804
992
|
"expectedMetricAliases"
|
|
805
|
-
),
|
|
806
|
-
if (!
|
|
807
|
-
throw new
|
|
993
|
+
), s = o.columnKinds;
|
|
994
|
+
if (!s || typeof s != "object" || Array.isArray(s))
|
|
995
|
+
throw new l(
|
|
808
996
|
"Canonical pivot contract column kinds must be an object."
|
|
809
997
|
);
|
|
810
|
-
const
|
|
998
|
+
const c = /* @__PURE__ */ new Set([
|
|
811
999
|
"row",
|
|
812
1000
|
"pivot_metric",
|
|
813
1001
|
"value"
|
|
814
|
-
]), m = t.map((
|
|
815
|
-
if (
|
|
816
|
-
(
|
|
817
|
-
|
|
1002
|
+
]), m = t.map((f) => f.key), u = Object.keys(s);
|
|
1003
|
+
if (u.length !== m.length || u.some(
|
|
1004
|
+
(f) => !m.includes(f) || !c.has(
|
|
1005
|
+
s[f]
|
|
818
1006
|
)
|
|
819
1007
|
))
|
|
820
|
-
throw new
|
|
1008
|
+
throw new l(
|
|
821
1009
|
"Canonical pivot contract must classify every authoritative result column exactly once."
|
|
822
1010
|
);
|
|
823
|
-
const
|
|
1011
|
+
const g = bt(
|
|
824
1012
|
o.columnClassifications
|
|
825
1013
|
);
|
|
826
|
-
if (Object.keys(
|
|
827
|
-
(
|
|
1014
|
+
if (Object.keys(g).some(
|
|
1015
|
+
(f) => !m.includes(f)
|
|
828
1016
|
))
|
|
829
|
-
throw new
|
|
1017
|
+
throw new l(
|
|
830
1018
|
"Canonical pivot contract contains a classification for an unknown result column."
|
|
831
1019
|
);
|
|
832
1020
|
return {
|
|
833
1021
|
version: 1,
|
|
834
|
-
expectedRoleFieldIds:
|
|
835
|
-
expectedMetricAliases:
|
|
836
|
-
columnKinds:
|
|
837
|
-
columnClassifications:
|
|
1022
|
+
expectedRoleFieldIds: a,
|
|
1023
|
+
expectedMetricAliases: i,
|
|
1024
|
+
columnKinds: s,
|
|
1025
|
+
columnClassifications: g
|
|
838
1026
|
};
|
|
839
1027
|
}
|
|
840
|
-
function
|
|
1028
|
+
function P(e, t) {
|
|
841
1029
|
const o = [
|
|
842
1030
|
"groupby",
|
|
843
1031
|
"metric",
|
|
844
1032
|
"pivotby",
|
|
845
1033
|
"detail"
|
|
846
1034
|
];
|
|
847
|
-
for (const
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
850
|
-
throw new
|
|
851
|
-
`The role-scoped ${
|
|
1035
|
+
for (const a of o) {
|
|
1036
|
+
const i = new Set(t.expectedRoleFieldIds[a] ?? []), s = Object.keys(e.byRole[a] ?? {});
|
|
1037
|
+
if (s.length !== i.size || s.some((c) => !i.has(c)))
|
|
1038
|
+
throw new l(
|
|
1039
|
+
`The role-scoped ${a} bindings do not match the authored result fields.`
|
|
852
1040
|
);
|
|
853
1041
|
}
|
|
854
1042
|
const r = new Set(t.expectedMetricAliases), n = Object.keys(e.byMetricAlias ?? {});
|
|
855
|
-
if (n.length !== r.size || n.some((
|
|
856
|
-
throw new
|
|
1043
|
+
if (n.length !== r.size || n.some((a) => !r.has(a)))
|
|
1044
|
+
throw new l(
|
|
857
1045
|
"The metric-alias bindings do not match the authored metric instances."
|
|
858
1046
|
);
|
|
859
1047
|
}
|
|
860
|
-
function
|
|
1048
|
+
function Tt(e) {
|
|
861
1049
|
if (!Array.isArray(e) || e.some(
|
|
862
1050
|
(t) => !t || typeof t != "object" || Array.isArray(t)
|
|
863
1051
|
))
|
|
864
|
-
throw new
|
|
1052
|
+
throw new l(
|
|
865
1053
|
"Canonical pivot records must be an array of row objects."
|
|
866
1054
|
);
|
|
867
1055
|
return e;
|
|
868
1056
|
}
|
|
869
|
-
function
|
|
1057
|
+
function kt(e, t) {
|
|
870
1058
|
e.forEach((o, r) => {
|
|
871
1059
|
t.forEach((n) => {
|
|
872
1060
|
if (!Object.prototype.hasOwnProperty.call(o, n.key) || o[n.key] === void 0)
|
|
873
|
-
throw new
|
|
1061
|
+
throw new l(
|
|
874
1062
|
`Canonical pivot column "${n.key}" is absent from row ${r}.`
|
|
875
1063
|
);
|
|
876
1064
|
});
|
|
877
1065
|
});
|
|
878
1066
|
}
|
|
879
|
-
function
|
|
1067
|
+
function It(e, t, o) {
|
|
880
1068
|
const r = new Set(t.map((n) => n.key));
|
|
881
1069
|
["groupby", "detail"].forEach((n) => {
|
|
882
1070
|
Object.entries(e.byRole[n] ?? {}).forEach(
|
|
883
|
-
([
|
|
884
|
-
const
|
|
885
|
-
if (!r.has(
|
|
886
|
-
throw new
|
|
887
|
-
`The role-scoped ${n} binding for "${
|
|
1071
|
+
([a, i]) => {
|
|
1072
|
+
const s = i.outputKey || i.rawKey;
|
|
1073
|
+
if (!r.has(s) || o.columnKinds[s] !== "row")
|
|
1074
|
+
throw new l(
|
|
1075
|
+
`The role-scoped ${n} binding for "${a}" does not name an authoritative result column.`
|
|
888
1076
|
);
|
|
889
1077
|
}
|
|
890
1078
|
);
|
|
891
1079
|
});
|
|
892
1080
|
}
|
|
893
|
-
function
|
|
1081
|
+
function z(e, t) {
|
|
894
1082
|
t.forEach((o) => {
|
|
895
1083
|
const r = e.columnKinds[o.key];
|
|
896
1084
|
if (r === "pivot_metric" && o.pivotIdentity === void 0)
|
|
897
|
-
throw new
|
|
1085
|
+
throw new l(
|
|
898
1086
|
`Physical pivot result column "${o.key}" is missing its identity.`
|
|
899
1087
|
);
|
|
900
1088
|
if (r !== "pivot_metric" && o.pivotIdentity !== void 0)
|
|
901
|
-
throw new
|
|
1089
|
+
throw new l(
|
|
902
1090
|
`Canonical pivot result column "${o.key}" carries pivot identity outside the physical pivot projection.`
|
|
903
1091
|
);
|
|
904
1092
|
});
|
|
905
1093
|
}
|
|
906
|
-
function
|
|
907
|
-
const t =
|
|
1094
|
+
function St(e) {
|
|
1095
|
+
const t = Tt(e.records), o = vt(e.columns), r = xt(
|
|
908
1096
|
e.pivotResultContract,
|
|
909
1097
|
o
|
|
910
1098
|
), n = r.expectedRoleFieldIds.pivotby ?? [];
|
|
911
1099
|
if (e.pivotResultState === "loaded_empty") {
|
|
912
1100
|
if (t.length !== 0)
|
|
913
|
-
throw new
|
|
1101
|
+
throw new l(
|
|
914
1102
|
"A loaded_empty pivot result cannot carry records."
|
|
915
1103
|
);
|
|
916
1104
|
if (o.some(
|
|
917
|
-
(
|
|
1105
|
+
(c) => r.columnKinds[c.key] === "pivot_metric"
|
|
918
1106
|
))
|
|
919
|
-
throw new
|
|
1107
|
+
throw new l(
|
|
920
1108
|
"A loaded_empty pivot result cannot carry physical pivot columns."
|
|
921
1109
|
);
|
|
922
|
-
|
|
923
|
-
const
|
|
924
|
-
return
|
|
1110
|
+
z(r, o);
|
|
1111
|
+
const s = U(e.columnKeyMap);
|
|
1112
|
+
return P(s, r), {
|
|
925
1113
|
pivotResultState: "loaded_empty",
|
|
926
1114
|
records: [],
|
|
927
1115
|
columns: o,
|
|
928
|
-
columnKeyMap:
|
|
1116
|
+
columnKeyMap: s,
|
|
929
1117
|
pivotResultContract: r
|
|
930
1118
|
};
|
|
931
1119
|
}
|
|
932
1120
|
if (e.pivotResultState !== "loaded_valid")
|
|
933
|
-
throw new
|
|
1121
|
+
throw new l(
|
|
934
1122
|
"A canonical pivot result must declare loaded_empty or loaded_valid."
|
|
935
1123
|
);
|
|
936
1124
|
if (t.length === 0)
|
|
937
|
-
throw new
|
|
1125
|
+
throw new l(
|
|
938
1126
|
"A loaded_valid pivot result must carry at least one record."
|
|
939
1127
|
);
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
(
|
|
1128
|
+
const a = U(e.columnKeyMap);
|
|
1129
|
+
P(a, r), It(a, o, r), z(r, o);
|
|
1130
|
+
const i = o.filter(
|
|
1131
|
+
(s) => r.columnKinds[s.key] === "pivot_metric"
|
|
944
1132
|
);
|
|
945
|
-
if (n.length > 0 &&
|
|
946
|
-
throw new
|
|
1133
|
+
if (n.length > 0 && i.length === 0)
|
|
1134
|
+
throw new l(
|
|
947
1135
|
"A loaded_valid pivot result is missing its physical pivot columns."
|
|
948
1136
|
);
|
|
949
1137
|
try {
|
|
950
|
-
|
|
1138
|
+
ve(i, {
|
|
951
1139
|
expectedPivotFieldIds: n,
|
|
952
1140
|
columnClassifications: r.columnClassifications
|
|
953
1141
|
});
|
|
954
|
-
} catch (
|
|
955
|
-
throw
|
|
1142
|
+
} catch (s) {
|
|
1143
|
+
throw s instanceof be ? new l(s.message, s) : s;
|
|
956
1144
|
}
|
|
957
|
-
return
|
|
1145
|
+
return kt(t, o), {
|
|
958
1146
|
pivotResultState: "loaded_valid",
|
|
959
1147
|
records: t,
|
|
960
1148
|
columns: o,
|
|
961
|
-
columnKeyMap:
|
|
1149
|
+
columnKeyMap: a,
|
|
962
1150
|
pivotResultContract: r
|
|
963
1151
|
};
|
|
964
1152
|
}
|
|
965
|
-
function
|
|
1153
|
+
function ao(e) {
|
|
966
1154
|
const t = /* @__PURE__ */ new Set();
|
|
967
|
-
["groupby", "detail"].forEach((
|
|
968
|
-
Object.values(e.columnKeyMap.byRole[
|
|
969
|
-
t.add(
|
|
1155
|
+
["groupby", "detail"].forEach((a) => {
|
|
1156
|
+
Object.values(e.columnKeyMap.byRole[a] ?? {}).forEach((i) => {
|
|
1157
|
+
t.add(i.outputKey || i.rawKey);
|
|
970
1158
|
});
|
|
971
1159
|
});
|
|
972
1160
|
const o = new Set(e.physicalPivotColumnKeys), r = new Set(
|
|
973
|
-
e.columns.map((
|
|
1161
|
+
e.columns.map((a) => a.key)
|
|
974
1162
|
), n = {
|
|
975
1163
|
version: 1,
|
|
976
1164
|
expectedRoleFieldIds: {
|
|
@@ -989,18 +1177,18 @@ function It(e) {
|
|
|
989
1177
|
},
|
|
990
1178
|
expectedMetricAliases: [...e.expectedMetricAliases ?? []],
|
|
991
1179
|
columnKinds: Object.fromEntries(
|
|
992
|
-
e.columns.map((
|
|
993
|
-
|
|
994
|
-
t.has(
|
|
1180
|
+
e.columns.map((a) => [
|
|
1181
|
+
a.key,
|
|
1182
|
+
t.has(a.key) ? "row" : o.has(a.key) ? "pivot_metric" : "value"
|
|
995
1183
|
])
|
|
996
1184
|
),
|
|
997
1185
|
columnClassifications: Object.fromEntries(
|
|
998
1186
|
Object.entries(e.columnMetadata ?? {}).filter(
|
|
999
|
-
([
|
|
1187
|
+
([a]) => r.has(a)
|
|
1000
1188
|
)
|
|
1001
1189
|
)
|
|
1002
1190
|
};
|
|
1003
|
-
return
|
|
1191
|
+
return St({
|
|
1004
1192
|
pivotResultState: e.records.length === 0 ? "loaded_empty" : "loaded_valid",
|
|
1005
1193
|
pivotResultContract: n,
|
|
1006
1194
|
records: e.records,
|
|
@@ -1009,39 +1197,42 @@ function It(e) {
|
|
|
1009
1197
|
});
|
|
1010
1198
|
}
|
|
1011
1199
|
export {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1200
|
+
l as A,
|
|
1201
|
+
St as B,
|
|
1202
|
+
ao as C,
|
|
1203
|
+
Yt as D,
|
|
1204
|
+
Zt as E,
|
|
1205
|
+
Ht as F,
|
|
1206
|
+
Le as G,
|
|
1207
|
+
Be as H,
|
|
1208
|
+
Vt as I,
|
|
1209
|
+
Ot as J,
|
|
1210
|
+
Xt as M,
|
|
1211
|
+
N as P,
|
|
1212
|
+
ot as a,
|
|
1213
|
+
je as b,
|
|
1214
|
+
Pt as c,
|
|
1215
|
+
zt as d,
|
|
1216
|
+
qt as e,
|
|
1217
|
+
Qt as f,
|
|
1218
|
+
Pe as g,
|
|
1219
|
+
ze as h,
|
|
1220
|
+
Lt as i,
|
|
1221
|
+
qe as j,
|
|
1222
|
+
Bt as k,
|
|
1223
|
+
Ye as l,
|
|
1224
|
+
R as m,
|
|
1225
|
+
et as n,
|
|
1226
|
+
tt as o,
|
|
1227
|
+
v as p,
|
|
1228
|
+
Wt as q,
|
|
1229
|
+
Jt as r,
|
|
1230
|
+
Gt as s,
|
|
1231
|
+
eo as t,
|
|
1232
|
+
oo as u,
|
|
1233
|
+
to as v,
|
|
1234
|
+
st as w,
|
|
1235
|
+
ro as x,
|
|
1236
|
+
gt as y,
|
|
1237
|
+
no as z
|
|
1047
1238
|
};
|