react-semaphor 0.1.514 → 0.1.515
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/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +1 -1
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-BzPD50QD.cjs → dashboard-briefing-launcher-B7zqm8P1.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-e3s3MuSs.js → dashboard-briefing-launcher-BA_bl05p.js} +5 -5
- package/dist/chunks/{dashboard-controls-DAOABnks.js → dashboard-controls-QMW17RKx.js} +6 -6
- package/dist/chunks/{dashboard-controls-DQBfOqmC.cjs → dashboard-controls-x_v9wLOU.cjs} +1 -1
- package/dist/chunks/{dashboard-json-1jZycd5h.cjs → dashboard-json-0ZLLBlHj.cjs} +1 -1
- package/dist/chunks/{dashboard-json-S5Eq2GAg.js → dashboard-json-DRnpkNwO.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-Bkm0ciHG.js → edit-dashboard-visual-1ISjhwry.js} +1377 -1380
- package/dist/chunks/{edit-dashboard-visual-BwJ2Eljw.cjs → edit-dashboard-visual-CI0EqzKj.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-Bvv16QA-.js → editor-action-buttons-BTCKZERI.js} +3 -3
- package/dist/chunks/{editor-action-buttons-B2NCSsDw.cjs → editor-action-buttons-Czq5SnA9.cjs} +1 -1
- package/dist/chunks/{index-DhlVxvyI.cjs → index-BMMXKK3G.cjs} +1 -1
- package/dist/chunks/{index-DrOFJOCq.cjs → index-C6_xef4P.cjs} +147 -147
- package/dist/chunks/{index-CACdoqu3.js → index-C8w91oj4.js} +61 -51
- package/dist/chunks/index-Cw2ypaFl.cjs +1 -0
- package/dist/chunks/{index-nhUr9xBz.js → index-Dlic9KZs.js} +31494 -31379
- package/dist/chunks/{index-CnGVjyF8.js → index-v1OE4-eA.js} +2 -2
- package/dist/chunks/matrix-formatter-BdIsE7Qu.js +341 -0
- package/dist/chunks/matrix-formatter-Dajj91Ni.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-Dm9dUQsl.js → pivot-header-presentation-BIf4HW3L.js} +35 -36
- package/dist/chunks/{pivot-header-presentation-Cxz8-06f.cjs → pivot-header-presentation-B_N11CgN.cjs} +3 -3
- package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-CEmyU2At.js} +207 -148
- package/dist/chunks/pivot-result-lifecycle-vg_suUNb.cjs +1 -0
- package/dist/chunks/{raw-temporal-DrmCX9Wq.js → raw-temporal-Bj6_w9cG.js} +471 -361
- package/dist/chunks/raw-temporal-CeblVJbu.cjs +1 -0
- package/dist/chunks/{report-preferences-dialog-DcLkVqni.cjs → report-preferences-dialog-Dr1BYwuf.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-B2fzQH1T.js → report-preferences-dialog-b8J6KjSy.js} +2 -2
- package/dist/chunks/semantic-format-DFI1iszk.cjs +1 -0
- package/dist/chunks/{semantic-format-BZxJLKvw.js → semantic-format-Dt-nUxFB.js} +23 -29
- package/dist/chunks/switch-Ced9ZZwI.cjs +134 -0
- package/dist/chunks/{switch-QfKb0Iwe.js → switch-D5_tjsIS.js} +3139 -3087
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +131 -126
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/visual/aggregated-table/utils/metric-format-resolver.d.ts +3 -3
- package/dist/types/components/visual/data-table/types/data-table.d.ts +4 -1
- package/dist/types/components/visual/pivot-table/utils/pivot-metric-formatting.d.ts +2 -2
- package/dist/types/lib/formatters/metric-formatting.d.ts +3 -3
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +1 -0
- package/dist/types/lib/utils/date-timezone-utils.d.ts +26 -4
- package/dist/types/shared/format-utils/formatters/duration-formatter.d.ts +4 -1
- package/dist/types/shared/format-utils/formatters/index.d.ts +2 -2
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +8 -2
- package/dist/types/shared/format-utils/presentation-execution.d.ts +17 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +16 -1
- package/package.json +1 -1
- package/dist/chunks/index-F25jnH0p.cjs +0 -1
- package/dist/chunks/matrix-formatter-BLunke3R.js +0 -424
- package/dist/chunks/matrix-formatter-CveLJo6S.cjs +0 -1
- package/dist/chunks/pivot-result-lifecycle-BiERyXnS.cjs +0 -1
- package/dist/chunks/raw-temporal-BUeTpG76.cjs +0 -1
- package/dist/chunks/semantic-format-BzH69TRq.cjs +0 -1
- package/dist/chunks/switch--Re1K566.cjs +0 -134
package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-CEmyU2At.js}
RENAMED
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { p as
|
|
5
|
-
import { b as
|
|
6
|
-
import { i as
|
|
7
|
-
import {
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var _ = (e, o, t) => o in e ? E(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
|
+
var f = (e, o, t) => _(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { p as K, a as S } from "./raw-temporal-Bj6_w9cG.js";
|
|
5
|
+
import { b as F } from "./report-runtime-context-Cs65Mrxj.js";
|
|
6
|
+
import { i as u, p as j } from "./temporal-bucket-B9hMwemw.js";
|
|
7
|
+
import { i as M } from "./index-C8w91oj4.js";
|
|
8
|
+
import { a6 as P } from "./validators-CkHsAvwB.js";
|
|
8
9
|
import "./matrix-operation-contract-D0HfzwZg.js";
|
|
9
|
-
import { a as
|
|
10
|
-
import { a as
|
|
11
|
-
import { b as
|
|
12
|
-
class
|
|
10
|
+
import { a as T } from "./metric-comparison-Dqc7_tnW.js";
|
|
11
|
+
import { a as O } from "./temporal-bucket-contract-IWDgyTMw.js";
|
|
12
|
+
import { b as U, P as q } from "./pivot-result-identity-8M-bZrw9.js";
|
|
13
|
+
class I extends Error {
|
|
13
14
|
constructor(t) {
|
|
14
15
|
super(
|
|
15
16
|
`invalid_presentation_execution_snapshot: ${t} Resave this report before running it again.`
|
|
16
17
|
);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
f(this, "code", "invalid_presentation_execution_snapshot");
|
|
19
|
+
f(this, "deliveryBlocking", !0);
|
|
19
20
|
this.name = "PresentationExecutionSnapshotError";
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
class
|
|
23
|
+
class pe extends Error {
|
|
23
24
|
constructor(t) {
|
|
24
25
|
super(
|
|
25
26
|
`missing_resolved_raw_temporal_format: Column "${t}" has no captured presentation. Resave this report before running it again.`
|
|
26
27
|
);
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
f(this, "code", "missing_resolved_raw_temporal_format");
|
|
29
|
+
f(this, "deliveryBlocking", !0);
|
|
29
30
|
this.name = "MissingResolvedRawTemporalFormatError";
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
function v(e, o, t) {
|
|
33
|
-
const s = new Set(o), r = Object.keys(e).find((
|
|
34
|
+
const s = new Set(o), r = Object.keys(e).find((i) => !s.has(i));
|
|
34
35
|
if (r)
|
|
35
36
|
throw new Error(`${t} contains unknown property "${r}"`);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
if (!
|
|
38
|
+
function N(e, o = "scope") {
|
|
39
|
+
if (!u(e))
|
|
39
40
|
throw new Error(`${o} must be an object`);
|
|
40
41
|
v(
|
|
41
42
|
e,
|
|
@@ -67,8 +68,8 @@ function y(e, o, t, s) {
|
|
|
67
68
|
throw new Error(`${s}.${t} is required`);
|
|
68
69
|
return r;
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
-
if (!
|
|
71
|
+
function k(e, o) {
|
|
72
|
+
if (!u(e))
|
|
72
73
|
throw new Error(`${o} must be an object`);
|
|
73
74
|
const t = y(e, "metric", "metricId", o);
|
|
74
75
|
if (t) return { kind: "metric", metricId: t };
|
|
@@ -83,21 +84,64 @@ function B(e, o) {
|
|
|
83
84
|
if (r) return { kind: "matrix_measure", measureId: r };
|
|
84
85
|
throw new Error(`${o} is not a valid numeric presentation target`);
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
const B = [
|
|
88
|
+
"type",
|
|
89
|
+
"inputUnit",
|
|
90
|
+
"outputStyle",
|
|
91
|
+
"largestUnit",
|
|
92
|
+
"smallestUnit",
|
|
93
|
+
"maxUnits",
|
|
94
|
+
"prefix",
|
|
95
|
+
"suffix",
|
|
96
|
+
"negativeStyle"
|
|
97
|
+
];
|
|
98
|
+
function D(e) {
|
|
99
|
+
return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
|
|
100
|
+
}
|
|
101
|
+
function z(e, o) {
|
|
102
|
+
v(e, B, o);
|
|
103
|
+
for (const i of ["inputUnit", "largestUnit", "smallestUnit"])
|
|
104
|
+
if (e[i] !== void 0 && !D(e[i]))
|
|
105
|
+
throw new Error(`${o}.${i} must be a duration unit`);
|
|
106
|
+
const t = e.outputStyle;
|
|
107
|
+
if (t !== void 0 && t !== "compact" && t !== "digital" && t !== "long")
|
|
108
|
+
throw new Error(`${o}.outputStyle must be compact, digital, or long`);
|
|
109
|
+
const s = e.maxUnits;
|
|
110
|
+
if (s !== void 0 && (typeof s != "number" || !Number.isInteger(s) || s < 0 || s > 10))
|
|
111
|
+
throw new Error(`${o}.maxUnits must be an integer from 0 to 10`);
|
|
112
|
+
for (const i of ["prefix", "suffix"])
|
|
113
|
+
if (e[i] !== void 0 && typeof e[i] != "string")
|
|
114
|
+
throw new Error(`${o}.${i} must be a string`);
|
|
115
|
+
const r = e.negativeStyle;
|
|
116
|
+
if (r !== void 0 && r !== "minus" && r !== "parentheses")
|
|
117
|
+
throw new Error(`${o}.negativeStyle must be minus or parentheses`);
|
|
118
|
+
return {
|
|
119
|
+
type: "duration",
|
|
120
|
+
...e.inputUnit !== void 0 ? { inputUnit: e.inputUnit } : {},
|
|
121
|
+
...t !== void 0 ? { outputStyle: t } : {},
|
|
122
|
+
...e.largestUnit !== void 0 ? { largestUnit: e.largestUnit } : {},
|
|
123
|
+
...e.smallestUnit !== void 0 ? { smallestUnit: e.smallestUnit } : {},
|
|
124
|
+
...s !== void 0 ? { maxUnits: s } : {},
|
|
125
|
+
...e.prefix !== void 0 ? { prefix: e.prefix } : {},
|
|
126
|
+
...e.suffix !== void 0 ? { suffix: e.suffix } : {},
|
|
127
|
+
...r !== void 0 ? { negativeStyle: r } : {}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function J(e, o) {
|
|
131
|
+
if (!u(e))
|
|
88
132
|
throw new Error(`${o} must be an object`);
|
|
89
133
|
if (e.kind === "field") {
|
|
90
134
|
v(e, ["kind", "fieldId", "role"], o);
|
|
91
135
|
const r = typeof e.fieldId == "string" ? e.fieldId.trim() : "";
|
|
92
136
|
if (!r)
|
|
93
137
|
throw new Error(`${o}.fieldId is required`);
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
138
|
+
const i = e.role;
|
|
139
|
+
if (i !== void 0 && i !== "groupby" && i !== "pivotby")
|
|
96
140
|
throw new Error(`${o}.role must be groupby or pivotby`);
|
|
97
141
|
return {
|
|
98
142
|
kind: "field",
|
|
99
143
|
fieldId: r,
|
|
100
|
-
...
|
|
144
|
+
...i ? { role: i } : {}
|
|
101
145
|
};
|
|
102
146
|
}
|
|
103
147
|
const t = y(e, "column", "columnKey", o);
|
|
@@ -111,15 +155,15 @@ function N(e, o) {
|
|
|
111
155
|
if (s) return { kind: "matrix_axis", axisInstanceId: s };
|
|
112
156
|
throw new Error(`${o} is not a valid temporal bucket presentation target`);
|
|
113
157
|
}
|
|
114
|
-
function
|
|
115
|
-
if (!
|
|
158
|
+
function L(e, o) {
|
|
159
|
+
if (!u(e))
|
|
116
160
|
throw new Error(`${o} must be an object`);
|
|
117
161
|
const t = y(e, "column", "columnKey", o);
|
|
118
162
|
if (!t)
|
|
119
163
|
throw new Error(`${o} must identify a column`);
|
|
120
164
|
return { kind: "column", columnKey: t };
|
|
121
165
|
}
|
|
122
|
-
function
|
|
166
|
+
function V(e) {
|
|
123
167
|
return [
|
|
124
168
|
e.dashboardId,
|
|
125
169
|
e.cardId ?? null,
|
|
@@ -145,76 +189,86 @@ function b(e, o) {
|
|
|
145
189
|
}
|
|
146
190
|
function g(e, o) {
|
|
147
191
|
const t = h(e), s = h(o);
|
|
148
|
-
return t.length === s.length && t.every((r,
|
|
192
|
+
return t.length === s.length && t.every((r, i) => r === s[i]);
|
|
149
193
|
}
|
|
150
|
-
function
|
|
194
|
+
function G(e) {
|
|
151
195
|
if (!Array.isArray(e))
|
|
152
196
|
throw new Error("resolvedFormats must be an array");
|
|
153
197
|
const o = /* @__PURE__ */ new Set();
|
|
154
198
|
return e.map((t, s) => {
|
|
155
199
|
var m, p;
|
|
156
200
|
const r = `resolvedFormats.${s}`;
|
|
157
|
-
if (!
|
|
201
|
+
if (!u(t))
|
|
158
202
|
throw new Error(`${r} must be an object`);
|
|
159
203
|
v(t, ["scope", "target", "format"], r);
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
204
|
+
const i = N(t.scope, `${r}.scope`);
|
|
205
|
+
if (!u(t.format))
|
|
162
206
|
throw new Error(`${r}.format must be an object`);
|
|
163
|
-
let
|
|
207
|
+
let n;
|
|
164
208
|
switch (t.format.type) {
|
|
165
209
|
case "temporal_bucket": {
|
|
166
|
-
const l =
|
|
210
|
+
const l = j(t.format);
|
|
167
211
|
if (!l.ok)
|
|
168
212
|
throw new Error(
|
|
169
213
|
`${r}.format is invalid: ${((m = l.issues[0]) == null ? void 0 : m.message) ?? "invalid value"}`
|
|
170
214
|
);
|
|
171
|
-
|
|
172
|
-
scope:
|
|
173
|
-
target:
|
|
215
|
+
n = {
|
|
216
|
+
scope: i,
|
|
217
|
+
target: J(t.target, `${r}.target`),
|
|
174
218
|
format: l.value
|
|
175
219
|
};
|
|
176
220
|
break;
|
|
177
221
|
}
|
|
178
222
|
case "raw_temporal":
|
|
179
|
-
|
|
180
|
-
scope:
|
|
181
|
-
target:
|
|
182
|
-
format:
|
|
223
|
+
n = {
|
|
224
|
+
scope: i,
|
|
225
|
+
target: L(t.target, `${r}.target`),
|
|
226
|
+
format: S(t.format)
|
|
183
227
|
};
|
|
184
228
|
break;
|
|
185
229
|
case "number":
|
|
186
230
|
case "currency":
|
|
187
231
|
case "percent":
|
|
188
232
|
case "scientific": {
|
|
189
|
-
const l =
|
|
233
|
+
const l = K(t.format);
|
|
190
234
|
if (!l.ok)
|
|
191
235
|
throw new Error(
|
|
192
236
|
`${r}.format is invalid: ${((p = l.issues[0]) == null ? void 0 : p.message) ?? "invalid value"}`
|
|
193
237
|
);
|
|
194
|
-
|
|
195
|
-
scope:
|
|
196
|
-
target:
|
|
238
|
+
n = {
|
|
239
|
+
scope: i,
|
|
240
|
+
target: k(t.target, `${r}.target`),
|
|
197
241
|
format: l.value
|
|
198
242
|
};
|
|
199
243
|
break;
|
|
200
244
|
}
|
|
245
|
+
case "duration":
|
|
246
|
+
n = {
|
|
247
|
+
scope: i,
|
|
248
|
+
target: k(t.target, `${r}.target`),
|
|
249
|
+
format: z(
|
|
250
|
+
t.format,
|
|
251
|
+
`${r}.format`
|
|
252
|
+
)
|
|
253
|
+
};
|
|
254
|
+
break;
|
|
201
255
|
default:
|
|
202
256
|
throw new Error(`${r}.format.type is unsupported`);
|
|
203
257
|
}
|
|
204
258
|
const c = JSON.stringify([
|
|
205
|
-
...
|
|
206
|
-
...h(
|
|
259
|
+
...V(n.scope),
|
|
260
|
+
...h(n.target)
|
|
207
261
|
]);
|
|
208
262
|
if (o.has(c))
|
|
209
263
|
throw new Error(
|
|
210
264
|
`${r} duplicates a scoped presentation target`
|
|
211
265
|
);
|
|
212
|
-
return o.add(c),
|
|
266
|
+
return o.add(c), n;
|
|
213
267
|
});
|
|
214
268
|
}
|
|
215
|
-
function
|
|
269
|
+
function H(e) {
|
|
216
270
|
try {
|
|
217
|
-
if (!
|
|
271
|
+
if (!u(e))
|
|
218
272
|
throw new Error("presentation execution snapshot must be an object");
|
|
219
273
|
if (v(
|
|
220
274
|
e,
|
|
@@ -222,7 +276,7 @@ function L(e) {
|
|
|
222
276
|
"presentation execution snapshot"
|
|
223
277
|
), e.version !== 1)
|
|
224
278
|
throw new Error("presentation execution snapshot version must be 1");
|
|
225
|
-
const o =
|
|
279
|
+
const o = F(e.reportContext);
|
|
226
280
|
if (!o.ok) {
|
|
227
281
|
const t = o.issues[0];
|
|
228
282
|
throw new Error(
|
|
@@ -232,74 +286,78 @@ function L(e) {
|
|
|
232
286
|
return {
|
|
233
287
|
version: 1,
|
|
234
288
|
reportContext: o.value,
|
|
235
|
-
resolvedFormats:
|
|
289
|
+
resolvedFormats: G(e.resolvedFormats)
|
|
236
290
|
};
|
|
237
291
|
} catch (o) {
|
|
238
|
-
throw o instanceof
|
|
292
|
+
throw o instanceof I ? o : new I(
|
|
239
293
|
o instanceof Error ? o.message : "Snapshot is invalid."
|
|
240
294
|
);
|
|
241
295
|
}
|
|
242
296
|
}
|
|
243
|
-
function
|
|
244
|
-
return
|
|
297
|
+
function ye(e) {
|
|
298
|
+
return H({
|
|
245
299
|
version: 1,
|
|
246
300
|
reportContext: e.reportContext,
|
|
247
301
|
resolvedFormats: [...e.resolvedFormats]
|
|
248
302
|
});
|
|
249
303
|
}
|
|
250
|
-
function
|
|
304
|
+
function ve(e) {
|
|
305
|
+
const o = Y(e);
|
|
306
|
+
return M(o) ? o : void 0;
|
|
307
|
+
}
|
|
308
|
+
function Y(e) {
|
|
251
309
|
const o = e.snapshot.resolvedFormats.find(
|
|
252
310
|
(t) => t.format.type !== "temporal_bucket" && t.format.type !== "raw_temporal" && b(t.scope, e.scope) && g(t.target, e.target)
|
|
253
311
|
);
|
|
254
312
|
return o == null ? void 0 : o.format;
|
|
255
313
|
}
|
|
256
|
-
function
|
|
314
|
+
function we(e) {
|
|
257
315
|
const o = e.snapshot.resolvedFormats.find(
|
|
258
316
|
(t) => t.format.type === "raw_temporal" && b(t.scope, e.scope) && g(t.target, e.target)
|
|
259
317
|
);
|
|
260
318
|
return o == null ? void 0 : o.format;
|
|
261
319
|
}
|
|
262
|
-
function
|
|
320
|
+
function he(e) {
|
|
263
321
|
const o = e.snapshot.resolvedFormats.find(
|
|
264
322
|
(t) => t.format.type === "temporal_bucket" && b(t.scope, e.scope) && g(t.target, e.target)
|
|
265
323
|
);
|
|
266
324
|
return o == null ? void 0 : o.format;
|
|
267
325
|
}
|
|
268
|
-
function
|
|
326
|
+
function be(e) {
|
|
269
327
|
var r;
|
|
270
328
|
const o = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
271
|
-
if (e.snapshot.resolvedFormats.forEach((
|
|
272
|
-
if (
|
|
329
|
+
if (e.snapshot.resolvedFormats.forEach((i, n) => {
|
|
330
|
+
if (i.scope.attachmentIndex !== void 0)
|
|
273
331
|
throw new Error(
|
|
274
|
-
`resolvedFormats.${
|
|
332
|
+
`resolvedFormats.${n}.scope.attachmentIndex is not valid for a card export`
|
|
275
333
|
);
|
|
276
|
-
if (
|
|
334
|
+
if (i.scope.dashboardId !== e.expectedScope.dashboardId || i.scope.cardId !== e.expectedScope.cardId)
|
|
277
335
|
throw new Error(
|
|
278
|
-
`resolvedFormats.${
|
|
336
|
+
`resolvedFormats.${n}.scope must match the executing dashboard/card`
|
|
279
337
|
);
|
|
280
|
-
if (
|
|
281
|
-
const c = JSON.stringify(h(
|
|
338
|
+
if (i.target.kind === "field" && i.format.type === "temporal_bucket") {
|
|
339
|
+
const c = JSON.stringify(h(i.target));
|
|
282
340
|
if (t.has(c))
|
|
283
341
|
throw new Error(
|
|
284
|
-
`resolvedFormats.${
|
|
342
|
+
`resolvedFormats.${n} duplicates export field "${i.target.fieldId}"`
|
|
285
343
|
);
|
|
286
344
|
t.add(c);
|
|
287
345
|
return;
|
|
288
346
|
}
|
|
289
|
-
if (
|
|
347
|
+
if (i.target.kind !== "column")
|
|
290
348
|
throw new Error(
|
|
291
|
-
`resolvedFormats.${
|
|
349
|
+
`resolvedFormats.${n}.target must identify an export column or temporal pivot field`
|
|
292
350
|
);
|
|
293
|
-
if (o.has(
|
|
351
|
+
if (o.has(i.target.columnKey))
|
|
294
352
|
throw new Error(
|
|
295
|
-
`resolvedFormats.${
|
|
353
|
+
`resolvedFormats.${n} duplicates export column "${i.target.columnKey}"`
|
|
296
354
|
);
|
|
297
|
-
o.add(
|
|
355
|
+
o.add(i.target.columnKey);
|
|
298
356
|
}), !e.useFormattedValues) return;
|
|
299
357
|
if (!((r = e.visibleColumns) != null && r.length))
|
|
300
358
|
throw new Error("visibleColumns must identify every formatted export column");
|
|
301
359
|
const s = e.visibleColumns.find(
|
|
302
|
-
(
|
|
360
|
+
(i) => !o.has(i)
|
|
303
361
|
);
|
|
304
362
|
if (s)
|
|
305
363
|
throw new Error(
|
|
@@ -315,35 +373,35 @@ function w(e) {
|
|
|
315
373
|
)
|
|
316
374
|
);
|
|
317
375
|
}
|
|
318
|
-
function
|
|
376
|
+
function Q(e) {
|
|
319
377
|
const o = /* @__PURE__ */ new Map();
|
|
320
378
|
return e.forEach((t) => {
|
|
321
379
|
t.id && o.set(t.id, (o.get(t.id) ?? 0) + 1);
|
|
322
380
|
}), e.flatMap(
|
|
323
|
-
(t) => t.id && (o.get(t.id) ?? 0) > 1 ? [
|
|
381
|
+
(t) => t.id && (o.get(t.id) ?? 0) > 1 ? [T(t)] : []
|
|
324
382
|
);
|
|
325
383
|
}
|
|
326
|
-
function
|
|
384
|
+
function ge(e) {
|
|
327
385
|
const o = e.metricFields ?? [], t = w(o);
|
|
328
386
|
return {
|
|
329
387
|
expectedRoleFieldIds: {
|
|
330
388
|
groupby: w(e.groupByFields),
|
|
331
|
-
metric: t.length > 0 ? t : [
|
|
389
|
+
metric: t.length > 0 ? t : [P],
|
|
332
390
|
pivotby: w(e.pivotByFields),
|
|
333
391
|
detail: w(e.detailFields)
|
|
334
392
|
},
|
|
335
|
-
expectedMetricAliases:
|
|
393
|
+
expectedMetricAliases: Q(o)
|
|
336
394
|
};
|
|
337
395
|
}
|
|
338
396
|
class a extends Error {
|
|
339
397
|
constructor(t, s) {
|
|
340
398
|
super(`invalid_pivot_result_lifecycle: ${t}`);
|
|
341
|
-
|
|
342
|
-
|
|
399
|
+
f(this, "code", "invalid_pivot_result_lifecycle");
|
|
400
|
+
f(this, "deliveryBlocking", !0);
|
|
343
401
|
this.cause = s, this.name = "PivotResultLifecycleError";
|
|
344
402
|
}
|
|
345
403
|
}
|
|
346
|
-
function
|
|
404
|
+
function W(e) {
|
|
347
405
|
if (!Array.isArray(e) || e.some(
|
|
348
406
|
(t) => !t || typeof t != "object" || Array.isArray(t) || typeof t.key != "string" || !t.key || typeof t.name != "string" || typeof t.label != "string"
|
|
349
407
|
))
|
|
@@ -356,7 +414,7 @@ function V(e) {
|
|
|
356
414
|
"Canonical pivot column keys must be unique."
|
|
357
415
|
);
|
|
358
416
|
for (const t of o) {
|
|
359
|
-
const s =
|
|
417
|
+
const s = O(t, {
|
|
360
418
|
metadataRequired: !1
|
|
361
419
|
});
|
|
362
420
|
if (!s.ok)
|
|
@@ -366,7 +424,7 @@ function V(e) {
|
|
|
366
424
|
}
|
|
367
425
|
return o;
|
|
368
426
|
}
|
|
369
|
-
function
|
|
427
|
+
function R(e) {
|
|
370
428
|
if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1 || e.source !== "explorer" || !e.byRole || typeof e.byRole != "object" || Array.isArray(e.byRole))
|
|
371
429
|
throw new a(
|
|
372
430
|
"A loaded canonical pivot result requires its role-scoped column key map."
|
|
@@ -377,10 +435,10 @@ function k(e) {
|
|
|
377
435
|
throw new a(
|
|
378
436
|
`Canonical pivot role map contains invalid "${s}" bindings.`
|
|
379
437
|
);
|
|
380
|
-
for (const [
|
|
381
|
-
if (!
|
|
438
|
+
for (const [i, n] of Object.entries(r))
|
|
439
|
+
if (!i || !n || typeof n != "object" || Array.isArray(n) || n.role !== s || typeof n.rawKey != "string" || !n.rawKey || n.outputKey !== void 0 && (typeof n.outputKey != "string" || !n.outputKey))
|
|
382
440
|
throw new a(
|
|
383
|
-
`Canonical pivot role map contains an invalid "${s}:${
|
|
441
|
+
`Canonical pivot role map contains an invalid "${s}:${i}" binding.`
|
|
384
442
|
);
|
|
385
443
|
}
|
|
386
444
|
if (o.byMetricAlias !== void 0) {
|
|
@@ -398,7 +456,7 @@ function k(e) {
|
|
|
398
456
|
}
|
|
399
457
|
return o;
|
|
400
458
|
}
|
|
401
|
-
function
|
|
459
|
+
function X(e) {
|
|
402
460
|
if (e === void 0) return {};
|
|
403
461
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
404
462
|
throw new a(
|
|
@@ -417,14 +475,14 @@ function G(e) {
|
|
|
417
475
|
}
|
|
418
476
|
return e;
|
|
419
477
|
}
|
|
420
|
-
function
|
|
478
|
+
function $(e, o) {
|
|
421
479
|
if (!Array.isArray(e) || e.some((t) => typeof t != "string" || !t) || new Set(e).size !== e.length)
|
|
422
480
|
throw new a(
|
|
423
481
|
`Canonical pivot contract ${o} must be an array of unique field identities.`
|
|
424
482
|
);
|
|
425
483
|
return e;
|
|
426
484
|
}
|
|
427
|
-
function
|
|
485
|
+
function Z(e, o) {
|
|
428
486
|
if (!e || typeof e != "object" || Array.isArray(e) || e.version !== 1)
|
|
429
487
|
throw new a(
|
|
430
488
|
"A canonical pivot result requires its versioned result contract."
|
|
@@ -434,7 +492,7 @@ function H(e, o) {
|
|
|
434
492
|
throw new a(
|
|
435
493
|
"Canonical pivot contract role identities must be an object."
|
|
436
494
|
);
|
|
437
|
-
const
|
|
495
|
+
const i = Object.fromEntries(
|
|
438
496
|
[
|
|
439
497
|
"groupby",
|
|
440
498
|
"metric",
|
|
@@ -442,12 +500,12 @@ function H(e, o) {
|
|
|
442
500
|
"detail"
|
|
443
501
|
].map((d) => [
|
|
444
502
|
d,
|
|
445
|
-
|
|
503
|
+
$(
|
|
446
504
|
s[d],
|
|
447
505
|
`expectedRoleFieldIds.${d}`
|
|
448
506
|
)
|
|
449
507
|
])
|
|
450
|
-
),
|
|
508
|
+
), n = $(
|
|
451
509
|
t.expectedMetricAliases,
|
|
452
510
|
"expectedMetricAliases"
|
|
453
511
|
), c = t.columnKinds;
|
|
@@ -468,10 +526,10 @@ function H(e, o) {
|
|
|
468
526
|
throw new a(
|
|
469
527
|
"Canonical pivot contract must classify every authoritative result column exactly once."
|
|
470
528
|
);
|
|
471
|
-
const
|
|
529
|
+
const x = X(
|
|
472
530
|
t.columnClassifications
|
|
473
531
|
);
|
|
474
|
-
if (Object.keys(
|
|
532
|
+
if (Object.keys(x).some(
|
|
475
533
|
(d) => !p.includes(d)
|
|
476
534
|
))
|
|
477
535
|
throw new a(
|
|
@@ -479,33 +537,33 @@ function H(e, o) {
|
|
|
479
537
|
);
|
|
480
538
|
return {
|
|
481
539
|
version: 1,
|
|
482
|
-
expectedRoleFieldIds:
|
|
483
|
-
expectedMetricAliases:
|
|
540
|
+
expectedRoleFieldIds: i,
|
|
541
|
+
expectedMetricAliases: n,
|
|
484
542
|
columnKinds: c,
|
|
485
|
-
columnClassifications:
|
|
543
|
+
columnClassifications: x
|
|
486
544
|
};
|
|
487
545
|
}
|
|
488
|
-
function
|
|
546
|
+
function A(e, o) {
|
|
489
547
|
const t = [
|
|
490
548
|
"groupby",
|
|
491
549
|
"metric",
|
|
492
550
|
"pivotby",
|
|
493
551
|
"detail"
|
|
494
552
|
];
|
|
495
|
-
for (const
|
|
496
|
-
const
|
|
497
|
-
if (c.length !==
|
|
553
|
+
for (const i of t) {
|
|
554
|
+
const n = new Set(o.expectedRoleFieldIds[i] ?? []), c = Object.keys(e.byRole[i] ?? {});
|
|
555
|
+
if (c.length !== n.size || c.some((m) => !n.has(m)))
|
|
498
556
|
throw new a(
|
|
499
|
-
`The role-scoped ${
|
|
557
|
+
`The role-scoped ${i} bindings do not match the authored result fields.`
|
|
500
558
|
);
|
|
501
559
|
}
|
|
502
560
|
const s = new Set(o.expectedMetricAliases), r = Object.keys(e.byMetricAlias ?? {});
|
|
503
|
-
if (r.length !== s.size || r.some((
|
|
561
|
+
if (r.length !== s.size || r.some((i) => !s.has(i)))
|
|
504
562
|
throw new a(
|
|
505
563
|
"The metric-alias bindings do not match the authored metric instances."
|
|
506
564
|
);
|
|
507
565
|
}
|
|
508
|
-
function
|
|
566
|
+
function ee(e) {
|
|
509
567
|
if (!Array.isArray(e) || e.some(
|
|
510
568
|
(o) => !o || typeof o != "object" || Array.isArray(o)
|
|
511
569
|
))
|
|
@@ -514,7 +572,7 @@ function Q(e) {
|
|
|
514
572
|
);
|
|
515
573
|
return e;
|
|
516
574
|
}
|
|
517
|
-
function
|
|
575
|
+
function te(e, o) {
|
|
518
576
|
e.forEach((t, s) => {
|
|
519
577
|
o.forEach((r) => {
|
|
520
578
|
if (!Object.prototype.hasOwnProperty.call(t, r.key) || t[r.key] === void 0)
|
|
@@ -524,15 +582,15 @@ function W(e, o) {
|
|
|
524
582
|
});
|
|
525
583
|
});
|
|
526
584
|
}
|
|
527
|
-
function
|
|
585
|
+
function oe(e, o, t) {
|
|
528
586
|
const s = new Set(o.map((r) => r.key));
|
|
529
587
|
["groupby", "detail"].forEach((r) => {
|
|
530
588
|
Object.entries(e.byRole[r] ?? {}).forEach(
|
|
531
|
-
([
|
|
532
|
-
const c =
|
|
589
|
+
([i, n]) => {
|
|
590
|
+
const c = n.outputKey || n.rawKey;
|
|
533
591
|
if (!s.has(c) || t.columnKinds[c] !== "row")
|
|
534
592
|
throw new a(
|
|
535
|
-
`The role-scoped ${r} binding for "${
|
|
593
|
+
`The role-scoped ${r} binding for "${i}" does not name an authoritative result column.`
|
|
536
594
|
);
|
|
537
595
|
}
|
|
538
596
|
);
|
|
@@ -551,8 +609,8 @@ function C(e, o) {
|
|
|
551
609
|
);
|
|
552
610
|
});
|
|
553
611
|
}
|
|
554
|
-
function
|
|
555
|
-
const o =
|
|
612
|
+
function re(e) {
|
|
613
|
+
const o = ee(e.records), t = W(e.columns), s = Z(
|
|
556
614
|
e.pivotResultContract,
|
|
557
615
|
t
|
|
558
616
|
), r = s.expectedRoleFieldIds.pivotby ?? [];
|
|
@@ -568,8 +626,8 @@ function Y(e) {
|
|
|
568
626
|
"A loaded_empty pivot result cannot carry physical pivot columns."
|
|
569
627
|
);
|
|
570
628
|
C(s, t);
|
|
571
|
-
const c =
|
|
572
|
-
return
|
|
629
|
+
const c = R(e.columnKeyMap);
|
|
630
|
+
return A(c, s), {
|
|
573
631
|
pivotResultState: "loaded_empty",
|
|
574
632
|
records: [],
|
|
575
633
|
columns: t,
|
|
@@ -585,40 +643,40 @@ function Y(e) {
|
|
|
585
643
|
throw new a(
|
|
586
644
|
"A loaded_valid pivot result must carry at least one record."
|
|
587
645
|
);
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
const
|
|
646
|
+
const i = R(e.columnKeyMap);
|
|
647
|
+
A(i, s), oe(i, t, s), C(s, t);
|
|
648
|
+
const n = t.filter(
|
|
591
649
|
(c) => s.columnKinds[c.key] === "pivot_metric"
|
|
592
650
|
);
|
|
593
|
-
if (r.length > 0 &&
|
|
651
|
+
if (r.length > 0 && n.length === 0)
|
|
594
652
|
throw new a(
|
|
595
653
|
"A loaded_valid pivot result is missing its physical pivot columns."
|
|
596
654
|
);
|
|
597
655
|
try {
|
|
598
|
-
|
|
656
|
+
U(n, {
|
|
599
657
|
expectedPivotFieldIds: r,
|
|
600
658
|
columnClassifications: s.columnClassifications
|
|
601
659
|
});
|
|
602
660
|
} catch (c) {
|
|
603
|
-
throw c instanceof
|
|
661
|
+
throw c instanceof q ? new a(c.message, c) : c;
|
|
604
662
|
}
|
|
605
|
-
return
|
|
663
|
+
return te(o, t), {
|
|
606
664
|
pivotResultState: "loaded_valid",
|
|
607
665
|
records: o,
|
|
608
666
|
columns: t,
|
|
609
|
-
columnKeyMap:
|
|
667
|
+
columnKeyMap: i,
|
|
610
668
|
pivotResultContract: s
|
|
611
669
|
};
|
|
612
670
|
}
|
|
613
|
-
function
|
|
671
|
+
function xe(e) {
|
|
614
672
|
const o = /* @__PURE__ */ new Set();
|
|
615
|
-
["groupby", "detail"].forEach((
|
|
616
|
-
Object.values(e.columnKeyMap.byRole[
|
|
617
|
-
o.add(
|
|
673
|
+
["groupby", "detail"].forEach((i) => {
|
|
674
|
+
Object.values(e.columnKeyMap.byRole[i] ?? {}).forEach((n) => {
|
|
675
|
+
o.add(n.outputKey || n.rawKey);
|
|
618
676
|
});
|
|
619
677
|
});
|
|
620
678
|
const t = new Set(e.physicalPivotColumnKeys), s = new Set(
|
|
621
|
-
e.columns.map((
|
|
679
|
+
e.columns.map((i) => i.key)
|
|
622
680
|
), r = {
|
|
623
681
|
version: 1,
|
|
624
682
|
expectedRoleFieldIds: {
|
|
@@ -637,18 +695,18 @@ function ye(e) {
|
|
|
637
695
|
},
|
|
638
696
|
expectedMetricAliases: [...e.expectedMetricAliases ?? []],
|
|
639
697
|
columnKinds: Object.fromEntries(
|
|
640
|
-
e.columns.map((
|
|
641
|
-
|
|
642
|
-
o.has(
|
|
698
|
+
e.columns.map((i) => [
|
|
699
|
+
i.key,
|
|
700
|
+
o.has(i.key) ? "row" : t.has(i.key) ? "pivot_metric" : "value"
|
|
643
701
|
])
|
|
644
702
|
),
|
|
645
703
|
columnClassifications: Object.fromEntries(
|
|
646
704
|
Object.entries(e.columnMetadata ?? {}).filter(
|
|
647
|
-
([
|
|
705
|
+
([i]) => s.has(i)
|
|
648
706
|
)
|
|
649
707
|
)
|
|
650
708
|
};
|
|
651
|
-
return
|
|
709
|
+
return re({
|
|
652
710
|
pivotResultState: e.records.length === 0 ? "loaded_empty" : "loaded_valid",
|
|
653
711
|
pivotResultContract: r,
|
|
654
712
|
records: e.records,
|
|
@@ -657,19 +715,20 @@ function ye(e) {
|
|
|
657
715
|
});
|
|
658
716
|
}
|
|
659
717
|
export {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
718
|
+
pe as M,
|
|
719
|
+
I as P,
|
|
720
|
+
G as a,
|
|
721
|
+
H as b,
|
|
722
|
+
ye as c,
|
|
723
|
+
ve as d,
|
|
724
|
+
we as e,
|
|
725
|
+
Y as f,
|
|
726
|
+
he as g,
|
|
727
|
+
Q as h,
|
|
728
|
+
ge as i,
|
|
729
|
+
a as j,
|
|
730
|
+
re as k,
|
|
731
|
+
xe as l,
|
|
732
|
+
N as p,
|
|
733
|
+
be as v
|
|
675
734
|
};
|