react-semaphor 0.1.428 → 0.1.429
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.cjs +1 -1
- package/dist/analytics-protocol/index.js +72 -71
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +5 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +1031 -622
- package/dist/chunks/analyze-result-contract-BswhsmWT.js +1 -0
- package/dist/chunks/{analyze-result-contract-DnfF8kBb.js → analyze-result-contract-CfOBEwaC.js} +681 -759
- package/dist/chunks/{code-editor-CojfM3qp.js → code-editor-C65eEYyU.js} +2980 -2960
- package/dist/chunks/code-editor-DOh3aYEh.js +138 -0
- package/dist/chunks/{comparison-document-migration-b6c3xiWh.js → comparison-document-migration-DbU_BTxR.js} +1 -1
- package/dist/chunks/{comparison-document-migration-BJH1idOd.js → comparison-document-migration-Dj6xZMCb.js} +2 -2
- package/dist/chunks/csv-utils-Co0WxHke.js +4 -0
- package/dist/chunks/csv-utils-suxSkJGj.js +376 -0
- package/dist/chunks/dashboard-CQfAvRYI.js +1401 -0
- package/dist/chunks/{dashboard-509sbC4_.js → dashboard-agBXhvKo.js} +47563 -44929
- package/dist/chunks/{dashboard-briefing-launcher-B-ZTWJwo.js → dashboard-briefing-launcher-CkH_pthg.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DIdYHNTq.js → dashboard-briefing-launcher-gBNNKqoH.js} +100 -99
- package/dist/chunks/{dashboard-controls-CWprw-Pb.js → dashboard-controls-CAZnIGfT.js} +2 -2
- package/dist/chunks/{dashboard-controls-CbRzWo1N.js → dashboard-controls-CoIxUTvH.js} +114 -113
- package/dist/chunks/{dashboard-json-jO4GQfZk.js → dashboard-json-BMcPjL8-.js} +18 -17
- package/dist/chunks/dashboard-json-D4hFrMkX.js +1 -0
- package/dist/chunks/{edit-dashboard-visual-KgQTjqWp.js → edit-dashboard-visual-Bc8qNfSr.js} +8721 -8481
- package/dist/chunks/edit-dashboard-visual-onhUUXlw.js +182 -0
- package/dist/chunks/{metric-comparison-CWweq9RG.js → metric-comparison-CPoDx56y.js} +1 -1
- package/dist/chunks/{metric-comparison-BKgkMy9r.js → metric-comparison-DVy3fll_.js} +1 -1
- package/dist/chunks/numeric-presentation-CGTcqocU.js +517 -0
- package/dist/chunks/numeric-presentation-Dlb-Dk4c.js +1 -0
- package/dist/chunks/report-preferences-dialog-CPptr_V9.js +690 -0
- package/dist/chunks/report-preferences-dialog-DV_5aHrS.js +1 -0
- package/dist/chunks/source-identity-5OPV4gvg.js +92 -0
- package/dist/chunks/source-identity-Cbo2LOHQ.js +1 -0
- package/dist/chunks/{update-policy-CY2k-pJP.js → update-policy-De2NswtM.js} +1 -1
- package/dist/chunks/{update-policy-BgONreNd.js → update-policy-DnF_74zC.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BiMYdjZP.js → use-create-flow-overlay-state-Bs6gqgjo.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CGsLzp9A.js → use-create-flow-overlay-state-CgQbCrni.js} +97 -96
- package/dist/chunks/validators-B2vUAqTf.js +1 -0
- package/dist/chunks/{validators-Cz-XuORM.js → validators-Bce_J7Vd.js} +19 -13
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +20 -19
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +50 -50
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +27 -26
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +25 -24
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +57 -55
- package/dist/format-utils/index.cjs +2 -5
- package/dist/format-utils/index.js +136 -161
- package/dist/index.cjs +1 -1
- package/dist/index.js +158 -155
- package/dist/report-runtime-context/index.cjs +1 -0
- package/dist/report-runtime-context/index.js +394 -0
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +7 -6
- package/dist/types/analytics-protocol.d.ts +0 -4
- package/dist/types/briefings.d.ts +216 -19
- package/dist/types/dashboard-assistant.d.ts +0 -2
- package/dist/types/dashboard-authoring.d.ts +34 -9
- package/dist/types/dashboard.d.ts +93 -9
- package/dist/types/data-app-builder.d.ts +0 -1
- package/dist/types/data-app-codegen-node.d.ts +6 -28
- package/dist/types/data-app-codegen.d.ts +6 -28
- package/dist/types/data-app-sdk-adapters.d.ts +6 -28
- package/dist/types/data-app-sdk-validation.d.ts +6 -29
- package/dist/types/data-app-sdk.d.ts +6 -31
- package/dist/types/format-utils.d.ts +128 -4
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +10 -13
- package/dist/types/main.d.ts +249 -89
- package/dist/types/report-runtime-context.d.ts +99 -0
- package/dist/types/shared.d.ts +34 -9
- package/dist/types/surfboard.d.ts +119 -16
- package/dist/types/types.d.ts +156 -73
- package/dist/types/value-format-preferences.d.ts +126 -0
- package/dist/value-format-preferences/index.cjs +1 -0
- package/dist/value-format-preferences/index.js +635 -0
- package/package.json +11 -1
- package/dist/chunks/analyze-result-contract-ege_u6Nl.js +0 -1
- package/dist/chunks/calendar-preferences-dialog-BF9bNAF_.js +0 -457
- package/dist/chunks/calendar-preferences-dialog-_L9eBQfj.js +0 -1
- package/dist/chunks/code-editor-BoowcKU0.js +0 -138
- package/dist/chunks/dashboard-CMDXBLnG.js +0 -1402
- package/dist/chunks/dashboard-json-BEZrxx_k.js +0 -1
- package/dist/chunks/date-formatter-BTTYdAik.js +0 -1
- package/dist/chunks/date-formatter-D-89jTjG.js +0 -514
- package/dist/chunks/edit-dashboard-visual-D3uhqgm3.js +0 -182
- package/dist/chunks/validators-B4VMLX3_.js +0 -1
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
const v = {
|
|
2
|
+
locale: "en-US",
|
|
3
|
+
dateStyle: "short",
|
|
4
|
+
dateTime: {
|
|
5
|
+
dateStyle: "short",
|
|
6
|
+
timeStyle: "short"
|
|
7
|
+
},
|
|
8
|
+
defaultCurrency: "USD"
|
|
9
|
+
}, F = [
|
|
10
|
+
"viewer_user",
|
|
11
|
+
"viewer_tenant_user",
|
|
12
|
+
"session_initial",
|
|
13
|
+
"viewer_tenant",
|
|
14
|
+
"viewer_organization",
|
|
15
|
+
"system_default"
|
|
16
|
+
], D = new Set(
|
|
17
|
+
F
|
|
18
|
+
);
|
|
19
|
+
function T(e) {
|
|
20
|
+
return typeof e == "string" && D.has(e);
|
|
21
|
+
}
|
|
22
|
+
const I = [
|
|
23
|
+
"locale",
|
|
24
|
+
"dateStyle",
|
|
25
|
+
"dateTime",
|
|
26
|
+
"defaultCurrency"
|
|
27
|
+
], C = ["dateStyle", "timeStyle"], U = [
|
|
28
|
+
"stored",
|
|
29
|
+
"inherited",
|
|
30
|
+
"inheritedSources",
|
|
31
|
+
"resolved",
|
|
32
|
+
"sources",
|
|
33
|
+
"diagnostics"
|
|
34
|
+
], V = [
|
|
35
|
+
"locale",
|
|
36
|
+
"dateStyle",
|
|
37
|
+
"dateTime",
|
|
38
|
+
"defaultCurrency"
|
|
39
|
+
], z = ["scope", "path", "code"], g = [
|
|
40
|
+
"locale",
|
|
41
|
+
"dateStyle",
|
|
42
|
+
"dateTime.dateStyle",
|
|
43
|
+
"dateTime.timeStyle",
|
|
44
|
+
"defaultCurrency"
|
|
45
|
+
], N = ["short", "medium", "long"];
|
|
46
|
+
let _, h;
|
|
47
|
+
function f(e) {
|
|
48
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
49
|
+
return !1;
|
|
50
|
+
const t = Object.getPrototypeOf(e);
|
|
51
|
+
return t === null || Object.getPrototypeOf(t) === null;
|
|
52
|
+
}
|
|
53
|
+
function u(e, t) {
|
|
54
|
+
return Object.prototype.hasOwnProperty.call(e, t);
|
|
55
|
+
}
|
|
56
|
+
function n(e, t, a) {
|
|
57
|
+
return { path: e, code: t, message: a };
|
|
58
|
+
}
|
|
59
|
+
function E(e, t) {
|
|
60
|
+
if (typeof e != "string")
|
|
61
|
+
return {
|
|
62
|
+
ok: !1,
|
|
63
|
+
issue: n(t, "invalid_type", `${t} must be a string`)
|
|
64
|
+
};
|
|
65
|
+
const a = e.trim();
|
|
66
|
+
let s;
|
|
67
|
+
try {
|
|
68
|
+
s = Intl.getCanonicalLocales(a)[0] ?? "";
|
|
69
|
+
} catch {
|
|
70
|
+
return {
|
|
71
|
+
ok: !1,
|
|
72
|
+
issue: n(
|
|
73
|
+
t,
|
|
74
|
+
"invalid_locale",
|
|
75
|
+
`${t} must be a valid BCP 47 locale`
|
|
76
|
+
)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (!s || new Intl.Locale(s).baseName !== s)
|
|
80
|
+
return {
|
|
81
|
+
ok: !1,
|
|
82
|
+
issue: n(
|
|
83
|
+
t,
|
|
84
|
+
"invalid_locale",
|
|
85
|
+
`${t} must be a base BCP 47 locale without extensions`
|
|
86
|
+
)
|
|
87
|
+
};
|
|
88
|
+
const r = Intl.DateTimeFormat.supportedLocalesOf([s]).length === 1, i = Intl.NumberFormat.supportedLocalesOf([s]).length === 1;
|
|
89
|
+
return !r || !i ? {
|
|
90
|
+
ok: !1,
|
|
91
|
+
issue: n(
|
|
92
|
+
t,
|
|
93
|
+
"unsupported_locale",
|
|
94
|
+
`${t} is not supported by this runtime`
|
|
95
|
+
)
|
|
96
|
+
} : { ok: !0, value: s };
|
|
97
|
+
}
|
|
98
|
+
function J(e) {
|
|
99
|
+
const t = E(e, "locale");
|
|
100
|
+
return t.ok ? t.value : void 0;
|
|
101
|
+
}
|
|
102
|
+
function L() {
|
|
103
|
+
if (_)
|
|
104
|
+
return _;
|
|
105
|
+
const e = Intl.supportedValuesOf;
|
|
106
|
+
if (typeof e != "function")
|
|
107
|
+
throw new Error(
|
|
108
|
+
'This runtime does not support Intl.supportedValuesOf("currency")'
|
|
109
|
+
);
|
|
110
|
+
return _ = new Set(e.call(Intl, "currency")), _;
|
|
111
|
+
}
|
|
112
|
+
function Q() {
|
|
113
|
+
return h || (h = Object.freeze(
|
|
114
|
+
[...L()].sort(
|
|
115
|
+
(e, t) => e.localeCompare(t)
|
|
116
|
+
)
|
|
117
|
+
)), h;
|
|
118
|
+
}
|
|
119
|
+
function Y(e) {
|
|
120
|
+
if (typeof e != "string")
|
|
121
|
+
return;
|
|
122
|
+
const t = e.trim().toUpperCase();
|
|
123
|
+
return L().has(t) ? t : void 0;
|
|
124
|
+
}
|
|
125
|
+
function A(e, t) {
|
|
126
|
+
if (typeof e != "string")
|
|
127
|
+
return {
|
|
128
|
+
ok: !1,
|
|
129
|
+
issue: n(t, "invalid_type", `${t} must be a string`)
|
|
130
|
+
};
|
|
131
|
+
const a = Y(e);
|
|
132
|
+
return a ? { ok: !0, value: a } : {
|
|
133
|
+
ok: !1,
|
|
134
|
+
issue: n(
|
|
135
|
+
t,
|
|
136
|
+
"invalid_currency",
|
|
137
|
+
`${t} must be a supported ISO 4217 currency code`
|
|
138
|
+
)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function S(e, t) {
|
|
142
|
+
return typeof e != "string" ? {
|
|
143
|
+
ok: !1,
|
|
144
|
+
issue: n(t, "invalid_type", `${t} must be a string`)
|
|
145
|
+
} : N.includes(e) ? { ok: !0, value: e } : {
|
|
146
|
+
ok: !1,
|
|
147
|
+
issue: n(
|
|
148
|
+
t,
|
|
149
|
+
"invalid_style",
|
|
150
|
+
`${t} must be short, medium, or long`
|
|
151
|
+
)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function m(e, t, a = "") {
|
|
155
|
+
const s = new Set(t);
|
|
156
|
+
return Object.keys(e).filter((r) => !s.has(r)).sort().map((r) => {
|
|
157
|
+
const i = a ? `${a}.${r}` : r;
|
|
158
|
+
return n(
|
|
159
|
+
i,
|
|
160
|
+
"unknown_property",
|
|
161
|
+
`${i} is not a recognized preference property`
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function O(e) {
|
|
166
|
+
if (!f(e))
|
|
167
|
+
return {
|
|
168
|
+
ok: !1,
|
|
169
|
+
issues: [
|
|
170
|
+
n(
|
|
171
|
+
"$",
|
|
172
|
+
"invalid_type",
|
|
173
|
+
"Value format preferences must be a plain object"
|
|
174
|
+
)
|
|
175
|
+
]
|
|
176
|
+
};
|
|
177
|
+
const t = m(e, I), a = {};
|
|
178
|
+
if (u(e, "locale")) {
|
|
179
|
+
const s = E(e.locale, "locale");
|
|
180
|
+
s.ok ? a.locale = s.value : t.push(s.issue);
|
|
181
|
+
}
|
|
182
|
+
if (u(e, "dateStyle")) {
|
|
183
|
+
const s = S(e.dateStyle, "dateStyle");
|
|
184
|
+
s.ok ? a.dateStyle = s.value : t.push(s.issue);
|
|
185
|
+
}
|
|
186
|
+
if (u(e, "dateTime"))
|
|
187
|
+
if (!f(e.dateTime))
|
|
188
|
+
t.push(
|
|
189
|
+
n(
|
|
190
|
+
"dateTime",
|
|
191
|
+
"invalid_type",
|
|
192
|
+
"dateTime must be a plain object"
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
else {
|
|
196
|
+
t.push(
|
|
197
|
+
...m(e.dateTime, C, "dateTime")
|
|
198
|
+
);
|
|
199
|
+
const s = {};
|
|
200
|
+
if (u(e.dateTime, "dateStyle")) {
|
|
201
|
+
const r = S(
|
|
202
|
+
e.dateTime.dateStyle,
|
|
203
|
+
"dateTime.dateStyle"
|
|
204
|
+
);
|
|
205
|
+
r.ok ? s.dateStyle = r.value : t.push(r.issue);
|
|
206
|
+
}
|
|
207
|
+
if (u(e.dateTime, "timeStyle")) {
|
|
208
|
+
const r = S(
|
|
209
|
+
e.dateTime.timeStyle,
|
|
210
|
+
"dateTime.timeStyle"
|
|
211
|
+
);
|
|
212
|
+
r.ok ? s.timeStyle = r.value : t.push(r.issue);
|
|
213
|
+
}
|
|
214
|
+
Object.keys(s).length > 0 && (a.dateTime = s);
|
|
215
|
+
}
|
|
216
|
+
if (u(e, "defaultCurrency")) {
|
|
217
|
+
const s = A(e.defaultCurrency, "defaultCurrency");
|
|
218
|
+
s.ok ? a.defaultCurrency = s.value : t.push(s.issue);
|
|
219
|
+
}
|
|
220
|
+
return t.length > 0 ? { ok: !1, issues: t } : { ok: !0, value: a };
|
|
221
|
+
}
|
|
222
|
+
function $(e, t) {
|
|
223
|
+
var r;
|
|
224
|
+
const a = O(e);
|
|
225
|
+
if (!a.ok)
|
|
226
|
+
return {
|
|
227
|
+
ok: !1,
|
|
228
|
+
issues: a.issues.map((i) => ({
|
|
229
|
+
...i,
|
|
230
|
+
path: i.path === "$" ? t : `${t}.${i.path}`
|
|
231
|
+
}))
|
|
232
|
+
};
|
|
233
|
+
const s = a.value;
|
|
234
|
+
return !s.locale || !s.dateStyle || !((r = s.dateTime) != null && r.dateStyle) || !s.dateTime.timeStyle || !s.defaultCurrency ? {
|
|
235
|
+
ok: !1,
|
|
236
|
+
issues: [
|
|
237
|
+
n(
|
|
238
|
+
t,
|
|
239
|
+
"invalid_type",
|
|
240
|
+
`${t} must contain every resolved preference`
|
|
241
|
+
)
|
|
242
|
+
]
|
|
243
|
+
} : {
|
|
244
|
+
ok: !0,
|
|
245
|
+
value: {
|
|
246
|
+
locale: s.locale,
|
|
247
|
+
dateStyle: s.dateStyle,
|
|
248
|
+
dateTime: s.dateTime,
|
|
249
|
+
defaultCurrency: s.defaultCurrency
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function P(e, t) {
|
|
254
|
+
if (!f(e))
|
|
255
|
+
return {
|
|
256
|
+
ok: !1,
|
|
257
|
+
issues: [
|
|
258
|
+
n(
|
|
259
|
+
t,
|
|
260
|
+
"invalid_type",
|
|
261
|
+
`${t} must contain a valid source for every preference`
|
|
262
|
+
)
|
|
263
|
+
]
|
|
264
|
+
};
|
|
265
|
+
const a = m(e, V, t);
|
|
266
|
+
f(e.dateTime) ? a.push(
|
|
267
|
+
...m(
|
|
268
|
+
e.dateTime,
|
|
269
|
+
C,
|
|
270
|
+
`${t}.dateTime`
|
|
271
|
+
)
|
|
272
|
+
) : a.push(
|
|
273
|
+
n(
|
|
274
|
+
`${t}.dateTime`,
|
|
275
|
+
"invalid_type",
|
|
276
|
+
`${t}.dateTime must contain valid date and time sources`
|
|
277
|
+
)
|
|
278
|
+
);
|
|
279
|
+
const s = f(e.dateTime) ? e.dateTime : void 0, r = T(e.locale) ? e.locale : void 0, i = T(e.dateStyle) ? e.dateStyle : void 0, o = T(s == null ? void 0 : s.dateStyle) ? s.dateStyle : void 0, l = T(s == null ? void 0 : s.timeStyle) ? s.timeStyle : void 0, d = T(e.defaultCurrency) ? e.defaultCurrency : void 0;
|
|
280
|
+
return (!r || !i || !o || !l || !d) && a.push(
|
|
281
|
+
n(
|
|
282
|
+
t,
|
|
283
|
+
"invalid_type",
|
|
284
|
+
`${t} must contain a valid source for every preference`
|
|
285
|
+
)
|
|
286
|
+
), a.length > 0 || !s || !r || !i || !o || !l || !d ? { ok: !1, issues: a } : {
|
|
287
|
+
ok: !0,
|
|
288
|
+
value: {
|
|
289
|
+
locale: r,
|
|
290
|
+
dateStyle: i,
|
|
291
|
+
dateTime: {
|
|
292
|
+
dateStyle: o,
|
|
293
|
+
timeStyle: l
|
|
294
|
+
},
|
|
295
|
+
defaultCurrency: d
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
const K = /* @__PURE__ */ new Set([
|
|
300
|
+
"viewer_user",
|
|
301
|
+
"viewer_tenant_user",
|
|
302
|
+
"viewer_tenant",
|
|
303
|
+
"viewer_organization"
|
|
304
|
+
]), M = new Set(g);
|
|
305
|
+
function x(e) {
|
|
306
|
+
if (!Array.isArray(e))
|
|
307
|
+
return {
|
|
308
|
+
ok: !1,
|
|
309
|
+
issues: [
|
|
310
|
+
n(
|
|
311
|
+
"diagnostics",
|
|
312
|
+
"invalid_type",
|
|
313
|
+
"diagnostics must be an array"
|
|
314
|
+
)
|
|
315
|
+
]
|
|
316
|
+
};
|
|
317
|
+
const t = [], a = [];
|
|
318
|
+
return e.forEach((s, r) => {
|
|
319
|
+
const i = f(s) ? m(
|
|
320
|
+
s,
|
|
321
|
+
z,
|
|
322
|
+
`diagnostics.${r}`
|
|
323
|
+
) : [];
|
|
324
|
+
if (a.push(...i), !f(s) || i.length > 0 || typeof s.scope != "string" || !K.has(s.scope) || s.path !== "$" && !M.has(
|
|
325
|
+
s.path
|
|
326
|
+
) || s.code !== "invalid_stored_preference") {
|
|
327
|
+
a.push(
|
|
328
|
+
n(
|
|
329
|
+
`diagnostics.${r}`,
|
|
330
|
+
"invalid_type",
|
|
331
|
+
"diagnostic entry is invalid"
|
|
332
|
+
)
|
|
333
|
+
);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
t.push(s);
|
|
337
|
+
}), a.length > 0 ? { ok: !1, issues: a } : { ok: !0, value: t };
|
|
338
|
+
}
|
|
339
|
+
function X(e) {
|
|
340
|
+
if (!f(e))
|
|
341
|
+
return {
|
|
342
|
+
ok: !1,
|
|
343
|
+
issues: [
|
|
344
|
+
n(
|
|
345
|
+
"$",
|
|
346
|
+
"invalid_type",
|
|
347
|
+
"Value format preference response must be a plain object"
|
|
348
|
+
)
|
|
349
|
+
]
|
|
350
|
+
};
|
|
351
|
+
const t = m(e, U), a = e.stored === null ? { ok: !0, value: null } : O(e.stored), s = $(e.inherited, "inherited"), r = $(e.resolved, "resolved"), i = P(
|
|
352
|
+
e.inheritedSources,
|
|
353
|
+
"inheritedSources"
|
|
354
|
+
), o = P(e.sources, "sources"), l = x(e.diagnostics), d = [
|
|
355
|
+
...t,
|
|
356
|
+
...a.ok ? [] : a.issues,
|
|
357
|
+
...s.ok ? [] : s.issues,
|
|
358
|
+
...r.ok ? [] : r.issues,
|
|
359
|
+
...i.ok ? [] : i.issues,
|
|
360
|
+
...o.ok ? [] : o.issues,
|
|
361
|
+
...l.ok ? [] : l.issues
|
|
362
|
+
];
|
|
363
|
+
return d.length > 0 || !a.ok || !s.ok || !r.ok || !i.ok || !o.ok || !l.ok ? { ok: !1, issues: d } : {
|
|
364
|
+
ok: !0,
|
|
365
|
+
value: {
|
|
366
|
+
stored: a.value,
|
|
367
|
+
inherited: s.value,
|
|
368
|
+
inheritedSources: i.value,
|
|
369
|
+
resolved: r.value,
|
|
370
|
+
sources: o.value,
|
|
371
|
+
diagnostics: l.value
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
function k(e) {
|
|
376
|
+
var a, s;
|
|
377
|
+
const t = /* @__PURE__ */ new Set();
|
|
378
|
+
return e.locale !== void 0 && t.add("locale"), e.dateStyle !== void 0 && t.add("dateStyle"), ((a = e.dateTime) == null ? void 0 : a.dateStyle) !== void 0 && t.add("dateTime.dateStyle"), ((s = e.dateTime) == null ? void 0 : s.timeStyle) !== void 0 && t.add("dateTime.timeStyle"), e.defaultCurrency !== void 0 && t.add("defaultCurrency"), t;
|
|
379
|
+
}
|
|
380
|
+
function B(e, t) {
|
|
381
|
+
return {
|
|
382
|
+
...e,
|
|
383
|
+
...t.locale !== void 0 ? { locale: t.locale } : {},
|
|
384
|
+
...t.dateStyle !== void 0 ? { dateStyle: t.dateStyle } : {},
|
|
385
|
+
...t.dateTime ? {
|
|
386
|
+
dateTime: {
|
|
387
|
+
...e.dateTime,
|
|
388
|
+
...t.dateTime
|
|
389
|
+
}
|
|
390
|
+
} : {},
|
|
391
|
+
...t.defaultCurrency !== void 0 ? { defaultCurrency: t.defaultCurrency } : {}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function G(e, t) {
|
|
395
|
+
var s, r;
|
|
396
|
+
const a = {
|
|
397
|
+
...e,
|
|
398
|
+
...e.dateTime ? { dateTime: { ...e.dateTime } } : {}
|
|
399
|
+
};
|
|
400
|
+
for (const i of t)
|
|
401
|
+
i === "locale" && delete a.locale, i === "dateStyle" && delete a.dateStyle, i === "dateTime.dateStyle" && ((s = a.dateTime) == null || delete s.dateStyle), i === "dateTime.timeStyle" && ((r = a.dateTime) == null || delete r.timeStyle), i === "defaultCurrency" && delete a.defaultCurrency;
|
|
402
|
+
return a.dateTime && Object.keys(a.dateTime).length === 0 && delete a.dateTime, a;
|
|
403
|
+
}
|
|
404
|
+
function H(e) {
|
|
405
|
+
if (e === void 0) return { paths: [], issues: [] };
|
|
406
|
+
if (!Array.isArray(e))
|
|
407
|
+
return {
|
|
408
|
+
paths: [],
|
|
409
|
+
issues: [
|
|
410
|
+
n("clear", "invalid_type", "clear must be an array")
|
|
411
|
+
]
|
|
412
|
+
};
|
|
413
|
+
const t = [], a = [], s = /* @__PURE__ */ new Set();
|
|
414
|
+
return e.forEach((r, i) => {
|
|
415
|
+
if (typeof r != "string" || !g.includes(r)) {
|
|
416
|
+
a.push(
|
|
417
|
+
n(
|
|
418
|
+
`clear.${i}`,
|
|
419
|
+
typeof r == "string" ? "unknown_property" : "invalid_type",
|
|
420
|
+
`clear.${i} must be a recognized preference path`
|
|
421
|
+
)
|
|
422
|
+
);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const o = r;
|
|
426
|
+
if (s.has(o)) {
|
|
427
|
+
a.push(
|
|
428
|
+
n(
|
|
429
|
+
o,
|
|
430
|
+
"duplicate_clear_path",
|
|
431
|
+
`${o} appears more than once in clear`
|
|
432
|
+
)
|
|
433
|
+
);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
s.add(o), t.push(o);
|
|
437
|
+
}), { paths: t, issues: a };
|
|
438
|
+
}
|
|
439
|
+
function Z(e, t) {
|
|
440
|
+
if (!f(t))
|
|
441
|
+
return {
|
|
442
|
+
ok: !1,
|
|
443
|
+
issues: [
|
|
444
|
+
n(
|
|
445
|
+
"$",
|
|
446
|
+
"invalid_type",
|
|
447
|
+
"Preference mutation must be a plain object"
|
|
448
|
+
)
|
|
449
|
+
]
|
|
450
|
+
};
|
|
451
|
+
const a = m(t, ["set", "clear"]);
|
|
452
|
+
let s = {};
|
|
453
|
+
if (t.set !== void 0) {
|
|
454
|
+
const d = O(t.set);
|
|
455
|
+
d.ok ? s = d.value : a.push(...d.issues);
|
|
456
|
+
}
|
|
457
|
+
const r = H(t.clear);
|
|
458
|
+
a.push(...r.issues);
|
|
459
|
+
const i = k(s);
|
|
460
|
+
a.length === 0 && i.size === 0 && r.paths.length === 0 && a.push(
|
|
461
|
+
n(
|
|
462
|
+
"$",
|
|
463
|
+
"empty_mutation",
|
|
464
|
+
"Preference mutation must set or clear at least one leaf"
|
|
465
|
+
)
|
|
466
|
+
);
|
|
467
|
+
for (const d of r.paths)
|
|
468
|
+
i.has(d) && a.push(
|
|
469
|
+
n(
|
|
470
|
+
d,
|
|
471
|
+
"conflicting_operation",
|
|
472
|
+
`${d} cannot be set and cleared in the same mutation`
|
|
473
|
+
)
|
|
474
|
+
);
|
|
475
|
+
if (a.length > 0)
|
|
476
|
+
return { ok: !1, issues: a };
|
|
477
|
+
const o = W(e), l = G(B(o ?? {}, s), r.paths);
|
|
478
|
+
return {
|
|
479
|
+
ok: !0,
|
|
480
|
+
value: k(l).size === 0 ? null : l
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
function R(e, t) {
|
|
484
|
+
return { scope: e, path: t, code: "invalid_stored_preference" };
|
|
485
|
+
}
|
|
486
|
+
function w(e, t) {
|
|
487
|
+
if (e == null)
|
|
488
|
+
return { value: null, diagnostics: [] };
|
|
489
|
+
if (!f(e))
|
|
490
|
+
return { value: null, diagnostics: [R(t, "$")] };
|
|
491
|
+
const a = /* @__PURE__ */ new Set();
|
|
492
|
+
Object.keys(e).some((o) => !I.includes(o)) && a.add("$");
|
|
493
|
+
const s = {};
|
|
494
|
+
if (u(e, "locale")) {
|
|
495
|
+
const o = E(e.locale, "locale");
|
|
496
|
+
o.ok ? s.locale = o.value : a.add("locale");
|
|
497
|
+
}
|
|
498
|
+
if (u(e, "dateStyle")) {
|
|
499
|
+
const o = S(e.dateStyle, "dateStyle");
|
|
500
|
+
o.ok ? s.dateStyle = o.value : a.add("dateStyle");
|
|
501
|
+
}
|
|
502
|
+
if (u(e, "dateTime"))
|
|
503
|
+
if (!f(e.dateTime))
|
|
504
|
+
a.add("$");
|
|
505
|
+
else {
|
|
506
|
+
Object.keys(e.dateTime).some(
|
|
507
|
+
(l) => !C.includes(l)
|
|
508
|
+
) && a.add("$");
|
|
509
|
+
const o = {};
|
|
510
|
+
if (u(e.dateTime, "dateStyle")) {
|
|
511
|
+
const l = S(
|
|
512
|
+
e.dateTime.dateStyle,
|
|
513
|
+
"dateTime.dateStyle"
|
|
514
|
+
);
|
|
515
|
+
l.ok ? o.dateStyle = l.value : a.add("dateTime.dateStyle");
|
|
516
|
+
}
|
|
517
|
+
if (u(e.dateTime, "timeStyle")) {
|
|
518
|
+
const l = S(
|
|
519
|
+
e.dateTime.timeStyle,
|
|
520
|
+
"dateTime.timeStyle"
|
|
521
|
+
);
|
|
522
|
+
l.ok ? o.timeStyle = l.value : a.add("dateTime.timeStyle");
|
|
523
|
+
}
|
|
524
|
+
Object.keys(o).length > 0 && (s.dateTime = o);
|
|
525
|
+
}
|
|
526
|
+
if (u(e, "defaultCurrency")) {
|
|
527
|
+
const o = A(e.defaultCurrency, "defaultCurrency");
|
|
528
|
+
o.ok ? s.defaultCurrency = o.value : a.add("defaultCurrency");
|
|
529
|
+
}
|
|
530
|
+
const i = [
|
|
531
|
+
"$",
|
|
532
|
+
...g
|
|
533
|
+
].filter((o) => a.has(o)).map((o) => R(t, o));
|
|
534
|
+
return {
|
|
535
|
+
value: k(s).size === 0 ? null : s,
|
|
536
|
+
diagnostics: i
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function W(e) {
|
|
540
|
+
return w(e, "viewer_user").value;
|
|
541
|
+
}
|
|
542
|
+
function q(e, t) {
|
|
543
|
+
return w(e, t);
|
|
544
|
+
}
|
|
545
|
+
function p(e, t, a) {
|
|
546
|
+
for (const s of e) {
|
|
547
|
+
if (!s.value) continue;
|
|
548
|
+
const r = t(s.value);
|
|
549
|
+
if (r !== void 0) return { value: r, source: s.source };
|
|
550
|
+
}
|
|
551
|
+
return { value: a, source: "system_default" };
|
|
552
|
+
}
|
|
553
|
+
function ee(e) {
|
|
554
|
+
if (e.user !== void 0 && e.tenantUser !== void 0)
|
|
555
|
+
throw new TypeError(
|
|
556
|
+
"Value format preference resolution cannot include both user and tenantUser"
|
|
557
|
+
);
|
|
558
|
+
const t = [], a = [], s = (c, y, j) => {
|
|
559
|
+
const b = w(c, y);
|
|
560
|
+
t.push({ value: b.value, source: j }), a.push(...b.diagnostics);
|
|
561
|
+
};
|
|
562
|
+
e.user !== void 0 ? s(e.user, "viewer_user", "viewer_user") : e.tenantUser !== void 0 && s(
|
|
563
|
+
e.tenantUser,
|
|
564
|
+
"viewer_tenant_user",
|
|
565
|
+
"viewer_tenant_user"
|
|
566
|
+
), e.sessionInitial && t.push({
|
|
567
|
+
value: e.sessionInitial,
|
|
568
|
+
source: "session_initial"
|
|
569
|
+
}), e.user === void 0 && (e.tenantUser !== void 0 || e.tenant !== void 0) && s(e.tenant, "viewer_tenant", "viewer_tenant"), s(
|
|
570
|
+
e.organization,
|
|
571
|
+
"viewer_organization",
|
|
572
|
+
"viewer_organization"
|
|
573
|
+
);
|
|
574
|
+
const r = p(
|
|
575
|
+
t,
|
|
576
|
+
(c) => c.locale,
|
|
577
|
+
v.locale
|
|
578
|
+
), i = p(
|
|
579
|
+
t,
|
|
580
|
+
(c) => c.dateStyle,
|
|
581
|
+
v.dateStyle
|
|
582
|
+
), o = p(
|
|
583
|
+
t,
|
|
584
|
+
(c) => {
|
|
585
|
+
var y;
|
|
586
|
+
return (y = c.dateTime) == null ? void 0 : y.dateStyle;
|
|
587
|
+
},
|
|
588
|
+
v.dateTime.dateStyle
|
|
589
|
+
), l = p(
|
|
590
|
+
t,
|
|
591
|
+
(c) => {
|
|
592
|
+
var y;
|
|
593
|
+
return (y = c.dateTime) == null ? void 0 : y.timeStyle;
|
|
594
|
+
},
|
|
595
|
+
v.dateTime.timeStyle
|
|
596
|
+
), d = p(
|
|
597
|
+
t,
|
|
598
|
+
(c) => c.defaultCurrency,
|
|
599
|
+
v.defaultCurrency
|
|
600
|
+
);
|
|
601
|
+
return {
|
|
602
|
+
preferences: {
|
|
603
|
+
locale: r.value,
|
|
604
|
+
dateStyle: i.value,
|
|
605
|
+
dateTime: {
|
|
606
|
+
dateStyle: o.value,
|
|
607
|
+
timeStyle: l.value
|
|
608
|
+
},
|
|
609
|
+
defaultCurrency: d.value
|
|
610
|
+
},
|
|
611
|
+
sources: {
|
|
612
|
+
locale: r.source,
|
|
613
|
+
dateStyle: i.source,
|
|
614
|
+
dateTime: {
|
|
615
|
+
dateStyle: o.source,
|
|
616
|
+
timeStyle: l.source
|
|
617
|
+
},
|
|
618
|
+
defaultCurrency: d.source
|
|
619
|
+
},
|
|
620
|
+
diagnostics: a
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
export {
|
|
624
|
+
v as DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES,
|
|
625
|
+
F as REPORT_PREFERENCE_SOURCES,
|
|
626
|
+
Z as applyValueFormatPreferenceMutation,
|
|
627
|
+
Y as canonicalizeSupportedCurrencyCode,
|
|
628
|
+
J as canonicalizeSupportedLocale,
|
|
629
|
+
q as decodeStoredValueFormatPreferences,
|
|
630
|
+
Q as getSupportedCurrencyCodes,
|
|
631
|
+
T as isReportPreferenceSource,
|
|
632
|
+
O as parseValueFormatPreferences,
|
|
633
|
+
X as parseValueFormatPreferencesResponse,
|
|
634
|
+
ee as resolveValueFormatPreferences
|
|
635
|
+
};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "support@semaphor.cloud"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.429",
|
|
9
9
|
"description": "Fully interactive and customizable dashboards for your apps.",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
@@ -122,6 +122,16 @@
|
|
|
122
122
|
"import": "./dist/format-utils/index.js",
|
|
123
123
|
"require": "./dist/format-utils/index.cjs"
|
|
124
124
|
},
|
|
125
|
+
"./value-format-preferences": {
|
|
126
|
+
"types": "./dist/types/value-format-preferences.d.ts",
|
|
127
|
+
"import": "./dist/value-format-preferences/index.js",
|
|
128
|
+
"require": "./dist/value-format-preferences/index.cjs"
|
|
129
|
+
},
|
|
130
|
+
"./report-runtime-context": {
|
|
131
|
+
"types": "./dist/types/report-runtime-context.d.ts",
|
|
132
|
+
"import": "./dist/report-runtime-context/index.js",
|
|
133
|
+
"require": "./dist/report-runtime-context/index.cjs"
|
|
134
|
+
},
|
|
125
135
|
"./style.css": "./dist/style.css"
|
|
126
136
|
},
|
|
127
137
|
"scripts": {
|