react-semaphor 0.1.444 → 0.1.446
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/CHANGELOG.md +7 -0
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +123 -107
- package/dist/appearance/index.cjs +1 -1
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +5 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +526 -457
- package/dist/chunks/analyze-result-contract-BHb7sUUW.cjs +1 -0
- package/dist/chunks/analyze-result-contract-DUv3QnMl.js +29 -0
- package/dist/chunks/{braces-CbO-aIwH.js → braces-BKimshER.cjs} +1 -1
- package/dist/chunks/{code-editor-BpADiIlq.js → code-editor-B4gTfvc5.js} +6800 -6560
- package/dist/chunks/code-editor-BYVorgOf.cjs +138 -0
- package/dist/chunks/common-types-CQ6SHfLk.cjs +1 -0
- package/dist/chunks/{common-types-ClkOI-3O.js → common-types-DFsDdpH7.js} +22 -21
- package/dist/chunks/dashboard-DGX9b3T-.cjs +1402 -0
- package/dist/chunks/{dashboard-CJNVq8XI.js → dashboard-ECv6p6DC.js} +50511 -47720
- package/dist/chunks/{dashboard-briefing-launcher-Bg_SeBV8.js → dashboard-briefing-launcher-BpWq3shh.js} +190 -187
- package/dist/chunks/dashboard-briefing-launcher-C2kEWFgy.cjs +26 -0
- package/dist/chunks/{dashboard-controls-CYBi_mes.js → dashboard-controls-DNoMwxMy.cjs} +2 -2
- package/dist/chunks/{dashboard-controls-Da9MkPaf.js → dashboard-controls-DPLepxZy.js} +14 -13
- package/dist/chunks/dashboard-date-comparison-definition-DZq0htjG.cjs +1 -0
- package/dist/chunks/{dashboard-json-BtrdGo1U.js → dashboard-json-0Etvlp57.js} +14 -12
- package/dist/chunks/dashboard-json-4LbKuMSm.cjs +1 -0
- package/dist/chunks/{edit-dashboard-visual-kE6_3R3j.js → edit-dashboard-visual-0uKSZPPa.js} +8302 -8123
- package/dist/chunks/edit-dashboard-visual-C1uVqhI5.cjs +182 -0
- package/dist/chunks/{editor-action-buttons-8_CQa8Hb.js → editor-action-buttons-DKXO5aK7.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-DROkx4PS.js → editor-action-buttons-DpA5PdEo.js} +24 -23
- package/dist/chunks/{index-D7KJindZ.js → format-types-CSv0V7mm.cjs} +1 -1
- package/dist/chunks/{index-CnujJ3fa.js → format-types-CZH5w1lo.js} +23 -17
- package/dist/chunks/{layout-grid-B08pP7v6.js → layout-grid-3-HWzEwU.cjs} +1 -1
- package/dist/chunks/{metric-comparison-CPoDx56y.js → metric-comparison-BJ_Qu1ZF.js} +1 -1
- package/dist/chunks/metric-comparison-CUAJ8n4y.cjs +1 -0
- package/dist/chunks/mouse-pointer-2-BOL92ext.cjs +6 -0
- package/dist/chunks/mouse-pointer-2-DXNw3_3o.js +19 -0
- package/dist/chunks/{palette-C0yjT5Tv.js → palette-DW_l7Jr0.cjs} +1 -1
- package/dist/chunks/pivot-result-identity-B6QCWOSi.js +94 -0
- package/dist/chunks/pivot-result-identity-CDLRT-YG.cjs +1 -0
- package/dist/chunks/pivot-result-lifecycle-BM3Pl-D1.js +914 -0
- package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +4 -0
- package/dist/chunks/presentation-execution-BTV-Q43g.cjs +1 -0
- package/dist/chunks/presentation-execution-CGlb7YZ6.js +637 -0
- package/dist/chunks/report-preferences-dialog-CBMox_qt.cjs +1 -0
- package/dist/chunks/{report-preferences-dialog-Dq7rmN93.js → report-preferences-dialog-CkZ2KHWX.js} +7 -6
- package/dist/chunks/report-runtime-context-C8LZFsqV.cjs +1 -0
- package/dist/chunks/report-runtime-context-Qzn11HQe.js +387 -0
- package/dist/chunks/{save-Xdc4pnys.js → save-4_uMnE6s.cjs} +1 -1
- package/dist/chunks/{search-Dcud9ajy.js → search-6ZmeMq55.cjs} +1 -1
- package/dist/chunks/temporal-bucket-BnPxGrAi.js +446 -0
- package/dist/chunks/temporal-bucket-authoring-BUZMuVca.js +205 -0
- package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +1 -0
- package/dist/chunks/temporal-bucket-contract-B2bJ1oe4.js +108 -0
- package/dist/chunks/temporal-bucket-contract-ChDBWX8I.cjs +1 -0
- package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +1 -0
- package/dist/chunks/{comparison-document-migration-Dj6xZMCb.js → temporal-result-owner-Cb27SSG9.js} +152 -123
- package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +1 -0
- package/dist/chunks/token-types-BdQ8kHBm.cjs +1 -0
- package/dist/chunks/token-types-DLo91nOf.js +8 -0
- package/dist/chunks/{update-policy-DnF_74zC.js → update-policy-BxvYMYz0.cjs} +1 -1
- package/dist/chunks/{update-policy-De2NswtM.js → update-policy-eg59mQqv.js} +1 -1
- package/dist/chunks/validators-9D4KBqKD.cjs +1 -0
- package/dist/chunks/validators-wZ2WlNHc.js +4640 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +136 -126
- package/dist/data-app-builder/index.cjs +13 -18
- package/dist/data-app-builder/index.js +91 -105
- 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 +34 -35
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +5 -5
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +9 -10
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +155 -176
- package/dist/index.cjs +1 -1
- package/dist/index.js +180 -174
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +7 -392
- package/dist/shared/index.cjs +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +3 -3
- package/dist/types/analytics-protocol.d.ts +257 -48
- package/dist/types/briefings.d.ts +138 -50
- package/dist/types/dashboard-assistant.d.ts +207 -52
- package/dist/types/dashboard-authoring.d.ts +182 -50
- package/dist/types/dashboard.d.ts +290 -48
- package/dist/types/data-app-builder.d.ts +48 -42
- package/dist/types/data-app-codegen-node.d.ts +50 -44
- package/dist/types/data-app-codegen.d.ts +50 -44
- package/dist/types/data-app-sdk-adapters.d.ts +48 -42
- package/dist/types/data-app-sdk-validation.d.ts +81 -43
- package/dist/types/data-app-sdk.d.ts +83 -45
- package/dist/types/format-utils.d.ts +645 -67
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +19 -19
- package/dist/types/main.d.ts +305 -100
- package/dist/types/report-runtime-context.d.ts +3 -0
- package/dist/types/shared.d.ts +116 -41
- package/dist/types/surfboard.d.ts +290 -48
- package/dist/types/types.d.ts +455 -65
- package/package.json +3 -1
- package/dist/chunks/analyze-result-contract-BswhsmWT.js +0 -1
- package/dist/chunks/analyze-result-contract-CfOBEwaC.js +0 -1998
- package/dist/chunks/code-editor-M7HTUhdF.js +0 -138
- package/dist/chunks/common-types-C73-Ud1-.js +0 -1
- package/dist/chunks/comparison-document-migration-DbU_BTxR.js +0 -1
- package/dist/chunks/csv-utils-BZDvO2Fw.js +0 -376
- package/dist/chunks/csv-utils-Co0WxHke.js +0 -4
- package/dist/chunks/dashboard-DxZuqe8t.js +0 -1402
- package/dist/chunks/dashboard-briefing-launcher-Do6ZcOj4.js +0 -26
- package/dist/chunks/dashboard-date-comparison-definition-DGZr3m-b.js +0 -1
- package/dist/chunks/dashboard-json-ezLyW7AK.js +0 -1
- package/dist/chunks/edit-dashboard-visual-DEb9MeSM.js +0 -182
- package/dist/chunks/metric-comparison-DVy3fll_.js +0 -1
- package/dist/chunks/numeric-presentation-BJs5lSar.js +0 -517
- package/dist/chunks/numeric-presentation-Dlb-Dk4c.js +0 -1
- package/dist/chunks/report-preferences-dialog-D5sIaFnb.js +0 -1
- package/dist/chunks/source-identity-5OPV4gvg.js +0 -92
- package/dist/chunks/source-identity-Cbo2LOHQ.js +0 -1
- package/dist/chunks/validators-B2vUAqTf.js +0 -1
- package/dist/chunks/validators-Bce_J7Vd.js +0 -2448
- /package/dist/chunks/{card-config-utils-15sRtebL.js → card-config-utils-15sRtebL.cjs} +0 -0
- /package/dist/chunks/{catalog-field-grounding-Bnx-3tE0.js → catalog-field-grounding-Bnx-3tE0.cjs} +0 -0
- /package/dist/chunks/{dashboard-input-contract-DV3cshjz.js → dashboard-input-contract-DV3cshjz.cjs} +0 -0
- /package/dist/chunks/{index-Dpm_VET4.js → index-Dpm_VET4.cjs} +0 -0
- /package/dist/chunks/{index-jSrCwPQz.js → index-jSrCwPQz.cjs} +0 -0
- /package/dist/chunks/{normalize-dashboard-for-dirty-check-BXRUMVb2.js → normalize-dashboard-for-dirty-check-BXRUMVb2.cjs} +0 -0
- /package/dist/chunks/{operators-DrTQsJXv.js → operators-DrTQsJXv.cjs} +0 -0
- /package/dist/chunks/{use-debounced-dirty-check-XHSwAefL.js → use-debounced-dirty-check-XHSwAefL.cjs} +0 -0
package/dist/chunks/{report-preferences-dialog-Dq7rmN93.js → report-preferences-dialog-CkZ2KHWX.js}
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs as l, Fragment as R, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import le, { useState as C, useRef as Y, useEffect as U, useCallback as A, useMemo as _ } from "react";
|
|
3
|
-
import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-
|
|
4
|
-
import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./code-editor-
|
|
5
|
-
import {
|
|
3
|
+
import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-ECv6p6DC.js";
|
|
4
|
+
import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./code-editor-B4gTfvc5.js";
|
|
5
|
+
import { a as xe } from "./report-runtime-context-Qzn11HQe.js";
|
|
6
6
|
import "./index-xHCrHprY.js";
|
|
7
|
-
import "./
|
|
7
|
+
import "./validators-wZ2WlNHc.js";
|
|
8
|
+
import "./analyze-result-contract-DUv3QnMl.js";
|
|
8
9
|
import { parseValueFormatPreferencesResponse as Ne, canonicalizeSupportedLocale as Pe, canonicalizeSupportedCurrencyCode as Ee } from "../value-format-preferences/index.js";
|
|
9
10
|
function Ae(r = {}) {
|
|
10
11
|
const { authToken: c, tokenProps: e } = Q(), m = X(
|
|
@@ -653,7 +654,7 @@ function Ue({
|
|
|
653
654
|
] })
|
|
654
655
|
] });
|
|
655
656
|
}
|
|
656
|
-
function
|
|
657
|
+
function Ge({
|
|
657
658
|
open: r,
|
|
658
659
|
onOpenChange: c
|
|
659
660
|
}) {
|
|
@@ -686,5 +687,5 @@ function qe({
|
|
|
686
687
|
] }) });
|
|
687
688
|
}
|
|
688
689
|
export {
|
|
689
|
-
|
|
690
|
+
Ge as R
|
|
690
691
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("../value-format-preferences/index.cjs"),f=require("./validators-9D4KBqKD.cjs"),g={tz:"UTC",weekStart:1,anchor:"now"},b=["tz","weekStart","anchor","fiscalCalendar"],E=["kind","yearStartMonth"],w=["calendar","valueFormat","preferenceSources"],T=["calendar","valueFormat"],y=["tz","weekStart"],F=["stored","inherited","inheritedSources","resolved","sources"],z=["locale","dateStyle","dateTime","defaultCurrency"],R=["dateStyle","timeStyle"];function o(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const a=Object.getPrototypeOf(e);return a===null||Object.getPrototypeOf(a)===null}function n(e,a,r){const t=new Set(a);return Object.keys(e).filter(s=>!t.has(s)).map(s=>({path:r==="$"?s:`${r}.${s}`,code:"unknown_property",message:`Unknown property "${s}"`}))}function _(e){return Number.isInteger(e)&&typeof e=="number"&&e>=0&&e<=6}function d(e,a,r){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preferences must be an object"}]};const t=n(e,["tz","weekStart"],a);return(!r||e.tz!==void 0)&&(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&t.push({path:`${a}.tz`,code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),(!r||e.weekStart!==void 0)&&!_(e.weekStart)&&t.push({path:`${a}.weekStart`,code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"}),t.length?{ok:!1,issues:t}:{ok:!0,value:{...e.tz!==void 0?{tz:e.tz}:{},...e.weekStart!==void 0?{weekStart:e.weekStart}:{}}}}function A(e){if(e==="now")return{ok:!0,value:"now"};if(!o(e))return{ok:!1,issues:[{path:"anchor",code:"invalid_anchor",message:'anchor must be "now" or an object with an ISO timestamp'}]};const a=n(e,["iso"],"anchor"),r=e.iso;return f.parseSemaphorIsoInstant(r)===null&&a.push({path:"anchor.iso",code:"invalid_anchor",message:"anchor.iso must be an ISO timestamp with an explicit offset"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{iso:r}}}function O(e){if(!o(e))return{ok:!1,issues:[{path:"fiscalCalendar",code:"invalid_fiscal_calendar",message:"fiscalCalendar must be an object"}]};const a=n(e,E,"fiscalCalendar");return e.kind!=="month_aligned"&&a.push({path:"fiscalCalendar.kind",code:"invalid_fiscal_calendar",message:'fiscalCalendar.kind must be "month_aligned"'}),(!Number.isInteger(e.yearStartMonth)||typeof e.yearStartMonth!="number"||e.yearStartMonth<1||e.yearStartMonth>12)&&a.push({path:"fiscalCalendar.yearStartMonth",code:"invalid_fiscal_calendar",message:"fiscalCalendar.yearStartMonth must be an integer from 1 to 12"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{kind:"month_aligned",yearStartMonth:e.yearStartMonth}}}function C(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar context must be an object"}]};const a=n(e,b,"$");(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&a.push({path:"tz",code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),_(e.weekStart)||a.push({path:"weekStart",code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"});const r=A(e.anchor);r.ok||a.push(...r.issues);let t;if(e.fiscalCalendar!==void 0){const s=O(e.fiscalCalendar);s.ok?t=s.value:a.push(...s.issues)}return a.length||!r.ok?{ok:!1,issues:a}:{ok:!0,value:{tz:e.tz,weekStart:e.weekStart,anchor:r.value,...t?{fiscalCalendar:t}:{}}}}function l(e,a,r){if(!p.isReportPreferenceSource(e)){r.push({path:a,code:"invalid_preference_source",message:"Preference source is invalid"});return}return e}function k(e,a){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preference sources must be an object"}]};const r=n(e,y,a),t=l(e.tz,`${a}.tz`,r),s=l(e.weekStart,`${a}.weekStart`,r);return r.length||!t||!s?{ok:!1,issues:r}:{ok:!0,value:{tz:t,weekStart:s}}}function $(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar preference response must be an object"}]};const a=n(e,F,"$"),r=e.stored===null?{ok:!0,value:null}:d(e.stored,"stored",!0),t=d(e.inherited,"inherited",!1),s=k(e.inheritedSources,"inheritedSources"),c=d(e.resolved,"resolved",!1),i=k(e.sources,"sources");for(const u of[r,t,s,c,i])u.ok||a.push(...u.issues);return a.length||!r.ok||!t.ok||!s.ok||!c.ok||!i.ok?{ok:!1,issues:a}:{ok:!0,value:{stored:r.value,inherited:t.value,inheritedSources:s.value,resolved:c.value,sources:i.value}}}function P(e){if(!o(e))return{ok:!1,issues:[{path:"preferenceSources",code:"invalid_type",message:"preferenceSources must be an object"}]};const a=n(e,T,"preferenceSources"),r=e.calendar,t=e.valueFormat;if(o(r)||a.push({path:"preferenceSources.calendar",code:"invalid_type",message:"Calendar preference sources must be an object"}),o(t)||a.push({path:"preferenceSources.valueFormat",code:"invalid_type",message:"Value-format preference sources must be an object"}),!o(r)||!o(t))return{ok:!1,issues:a};a.push(...n(r,y,"preferenceSources.calendar"),...n(t,z,"preferenceSources.valueFormat"));const s=t.dateTime;o(s)?a.push(...n(s,R,"preferenceSources.valueFormat.dateTime")):a.push({path:"preferenceSources.valueFormat.dateTime",code:"invalid_type",message:"Datetime preference sources must be an object"});const c=l(r.tz,"preferenceSources.calendar.tz",a),i=l(r.weekStart,"preferenceSources.calendar.weekStart",a),u=l(t.locale,"preferenceSources.valueFormat.locale",a),m=l(t.dateStyle,"preferenceSources.valueFormat.dateStyle",a),S=o(s)?l(s.dateStyle,"preferenceSources.valueFormat.dateTime.dateStyle",a):void 0,v=o(s)?l(s.timeStyle,"preferenceSources.valueFormat.dateTime.timeStyle",a):void 0,h=l(t.defaultCurrency,"preferenceSources.valueFormat.defaultCurrency",a);return a.length||!c||!i||!u||!m||!S||!v||!h?{ok:!1,issues:a}:{ok:!0,value:{calendar:{tz:c,weekStart:i},valueFormat:{locale:u,dateStyle:m,dateTime:{dateStyle:S,timeStyle:v},defaultCurrency:h}}}}function j(e){var t;const a=p.parseValueFormatPreferences(e);if(!a.ok)return{ok:!1,issues:a.issues.map(s=>({path:`valueFormat.${s.path}`,code:"invalid_value_format",message:s.message}))};const r=a.value;return r.locale===void 0||r.dateStyle===void 0||((t=r.dateTime)==null?void 0:t.dateStyle)===void 0||r.dateTime.timeStyle===void 0||r.defaultCurrency===void 0?{ok:!1,issues:[{path:"valueFormat",code:"invalid_value_format",message:"Resolved value-format preferences must be complete"}]}:{ok:!0,value:{locale:r.locale,dateStyle:r.dateStyle,dateTime:{dateStyle:r.dateTime.dateStyle,timeStyle:r.dateTime.timeStyle},defaultCurrency:r.defaultCurrency}}}function N(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Report runtime context must be an object"}]};const a=n(e,w,"$"),r=C(e.calendar),t=j(e.valueFormat),s=P(e.preferenceSources);return r.ok||a.push(...r.issues.map(c=>({...c,path:c.path==="$"?"calendar":`calendar.${c.path}`}))),t.ok||a.push(...t.issues),s.ok||a.push(...s.issues),a.length||!r.ok||!t.ok||!s.ok?{ok:!1,issues:a}:{ok:!0,value:{calendar:r.value,valueFormat:t.value,preferenceSources:s.value}}}exports.DEFAULT_CALENDAR_CONTEXT=g;exports.parseCalendarContext=C;exports.parseCalendarPreferencesResponse=$;exports.parseReportRuntimeContext=N;
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { parseValueFormatPreferences as _, isReportPreferenceSource as C } from "../value-format-preferences/index.js";
|
|
2
|
+
import { b as k, e as g } from "./validators-wZ2WlNHc.js";
|
|
3
|
+
const M = {
|
|
4
|
+
tz: "UTC",
|
|
5
|
+
weekStart: 1,
|
|
6
|
+
anchor: "now"
|
|
7
|
+
}, b = [
|
|
8
|
+
"tz",
|
|
9
|
+
"weekStart",
|
|
10
|
+
"anchor",
|
|
11
|
+
"fiscalCalendar"
|
|
12
|
+
], w = ["kind", "yearStartMonth"], E = [
|
|
13
|
+
"calendar",
|
|
14
|
+
"valueFormat",
|
|
15
|
+
"preferenceSources"
|
|
16
|
+
], z = ["calendar", "valueFormat"], p = ["tz", "weekStart"], F = [
|
|
17
|
+
"stored",
|
|
18
|
+
"inherited",
|
|
19
|
+
"inheritedSources",
|
|
20
|
+
"resolved",
|
|
21
|
+
"sources"
|
|
22
|
+
], T = [
|
|
23
|
+
"locale",
|
|
24
|
+
"dateStyle",
|
|
25
|
+
"dateTime",
|
|
26
|
+
"defaultCurrency"
|
|
27
|
+
], R = ["dateStyle", "timeStyle"];
|
|
28
|
+
function o(e) {
|
|
29
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
30
|
+
return !1;
|
|
31
|
+
const a = Object.getPrototypeOf(e);
|
|
32
|
+
return a === null || Object.getPrototypeOf(a) === null;
|
|
33
|
+
}
|
|
34
|
+
function n(e, a, r) {
|
|
35
|
+
const t = new Set(a);
|
|
36
|
+
return Object.keys(e).filter((s) => !t.has(s)).map((s) => ({
|
|
37
|
+
path: r === "$" ? s : `${r}.${s}`,
|
|
38
|
+
code: "unknown_property",
|
|
39
|
+
message: `Unknown property "${s}"`
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
function y(e) {
|
|
43
|
+
return Number.isInteger(e) && typeof e == "number" && e >= 0 && e <= 6;
|
|
44
|
+
}
|
|
45
|
+
function d(e, a, r) {
|
|
46
|
+
if (!o(e))
|
|
47
|
+
return {
|
|
48
|
+
ok: !1,
|
|
49
|
+
issues: [
|
|
50
|
+
{
|
|
51
|
+
path: a,
|
|
52
|
+
code: "invalid_type",
|
|
53
|
+
message: "Calendar preferences must be an object"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
const t = n(e, ["tz", "weekStart"], a);
|
|
58
|
+
return (!r || e.tz !== void 0) && (typeof e.tz != "string" || !k(e.tz)) && t.push({
|
|
59
|
+
path: `${a}.tz`,
|
|
60
|
+
code: "invalid_timezone",
|
|
61
|
+
message: "tz must be a valid IANA timezone"
|
|
62
|
+
}), (!r || e.weekStart !== void 0) && !y(e.weekStart) && t.push({
|
|
63
|
+
path: `${a}.weekStart`,
|
|
64
|
+
code: "invalid_week_start",
|
|
65
|
+
message: "weekStart must be an integer from 0 to 6"
|
|
66
|
+
}), t.length ? { ok: !1, issues: t } : {
|
|
67
|
+
ok: !0,
|
|
68
|
+
value: {
|
|
69
|
+
...e.tz !== void 0 ? { tz: e.tz } : {},
|
|
70
|
+
...e.weekStart !== void 0 ? { weekStart: e.weekStart } : {}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function A(e) {
|
|
75
|
+
if (e === "now") return { ok: !0, value: "now" };
|
|
76
|
+
if (!o(e))
|
|
77
|
+
return {
|
|
78
|
+
ok: !1,
|
|
79
|
+
issues: [
|
|
80
|
+
{
|
|
81
|
+
path: "anchor",
|
|
82
|
+
code: "invalid_anchor",
|
|
83
|
+
message: 'anchor must be "now" or an object with an ISO timestamp'
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
const a = n(e, ["iso"], "anchor"), r = e.iso;
|
|
88
|
+
return g(r) === null && a.push({
|
|
89
|
+
path: "anchor.iso",
|
|
90
|
+
code: "invalid_anchor",
|
|
91
|
+
message: "anchor.iso must be an ISO timestamp with an explicit offset"
|
|
92
|
+
}), a.length ? { ok: !1, issues: a } : { ok: !0, value: { iso: r } };
|
|
93
|
+
}
|
|
94
|
+
function $(e) {
|
|
95
|
+
if (!o(e))
|
|
96
|
+
return {
|
|
97
|
+
ok: !1,
|
|
98
|
+
issues: [
|
|
99
|
+
{
|
|
100
|
+
path: "fiscalCalendar",
|
|
101
|
+
code: "invalid_fiscal_calendar",
|
|
102
|
+
message: "fiscalCalendar must be an object"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
};
|
|
106
|
+
const a = n(e, w, "fiscalCalendar");
|
|
107
|
+
return e.kind !== "month_aligned" && a.push({
|
|
108
|
+
path: "fiscalCalendar.kind",
|
|
109
|
+
code: "invalid_fiscal_calendar",
|
|
110
|
+
message: 'fiscalCalendar.kind must be "month_aligned"'
|
|
111
|
+
}), (!Number.isInteger(e.yearStartMonth) || typeof e.yearStartMonth != "number" || e.yearStartMonth < 1 || e.yearStartMonth > 12) && a.push({
|
|
112
|
+
path: "fiscalCalendar.yearStartMonth",
|
|
113
|
+
code: "invalid_fiscal_calendar",
|
|
114
|
+
message: "fiscalCalendar.yearStartMonth must be an integer from 1 to 12"
|
|
115
|
+
}), a.length ? { ok: !1, issues: a } : {
|
|
116
|
+
ok: !0,
|
|
117
|
+
value: {
|
|
118
|
+
kind: "month_aligned",
|
|
119
|
+
yearStartMonth: e.yearStartMonth
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function O(e) {
|
|
124
|
+
if (!o(e))
|
|
125
|
+
return {
|
|
126
|
+
ok: !1,
|
|
127
|
+
issues: [
|
|
128
|
+
{
|
|
129
|
+
path: "$",
|
|
130
|
+
code: "invalid_type",
|
|
131
|
+
message: "Calendar context must be an object"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
};
|
|
135
|
+
const a = n(e, b, "$");
|
|
136
|
+
(typeof e.tz != "string" || !k(e.tz)) && a.push({
|
|
137
|
+
path: "tz",
|
|
138
|
+
code: "invalid_timezone",
|
|
139
|
+
message: "tz must be a valid IANA timezone"
|
|
140
|
+
}), y(e.weekStart) || a.push({
|
|
141
|
+
path: "weekStart",
|
|
142
|
+
code: "invalid_week_start",
|
|
143
|
+
message: "weekStart must be an integer from 0 to 6"
|
|
144
|
+
});
|
|
145
|
+
const r = A(e.anchor);
|
|
146
|
+
r.ok || a.push(...r.issues);
|
|
147
|
+
let t;
|
|
148
|
+
if (e.fiscalCalendar !== void 0) {
|
|
149
|
+
const s = $(e.fiscalCalendar);
|
|
150
|
+
s.ok ? t = s.value : a.push(...s.issues);
|
|
151
|
+
}
|
|
152
|
+
return a.length || !r.ok ? { ok: !1, issues: a } : {
|
|
153
|
+
ok: !0,
|
|
154
|
+
value: {
|
|
155
|
+
tz: e.tz,
|
|
156
|
+
weekStart: e.weekStart,
|
|
157
|
+
anchor: r.value,
|
|
158
|
+
...t ? { fiscalCalendar: t } : {}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function l(e, a, r) {
|
|
163
|
+
if (!C(e)) {
|
|
164
|
+
r.push({
|
|
165
|
+
path: a,
|
|
166
|
+
code: "invalid_preference_source",
|
|
167
|
+
message: "Preference source is invalid"
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
return e;
|
|
172
|
+
}
|
|
173
|
+
function h(e, a) {
|
|
174
|
+
if (!o(e))
|
|
175
|
+
return {
|
|
176
|
+
ok: !1,
|
|
177
|
+
issues: [
|
|
178
|
+
{
|
|
179
|
+
path: a,
|
|
180
|
+
code: "invalid_type",
|
|
181
|
+
message: "Calendar preference sources must be an object"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
};
|
|
185
|
+
const r = n(e, p, a), t = l(e.tz, `${a}.tz`, r), s = l(
|
|
186
|
+
e.weekStart,
|
|
187
|
+
`${a}.weekStart`,
|
|
188
|
+
r
|
|
189
|
+
);
|
|
190
|
+
return r.length || !t || !s ? { ok: !1, issues: r } : { ok: !0, value: { tz: t, weekStart: s } };
|
|
191
|
+
}
|
|
192
|
+
function D(e) {
|
|
193
|
+
if (!o(e))
|
|
194
|
+
return {
|
|
195
|
+
ok: !1,
|
|
196
|
+
issues: [
|
|
197
|
+
{
|
|
198
|
+
path: "$",
|
|
199
|
+
code: "invalid_type",
|
|
200
|
+
message: "Calendar preference response must be an object"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
};
|
|
204
|
+
const a = n(e, F, "$"), r = e.stored === null ? { ok: !0, value: null } : d(e.stored, "stored", !0), t = d(
|
|
205
|
+
e.inherited,
|
|
206
|
+
"inherited",
|
|
207
|
+
!1
|
|
208
|
+
), s = h(
|
|
209
|
+
e.inheritedSources,
|
|
210
|
+
"inheritedSources"
|
|
211
|
+
), c = d(e.resolved, "resolved", !1), i = h(e.sources, "sources");
|
|
212
|
+
for (const u of [r, t, s, c, i])
|
|
213
|
+
u.ok || a.push(...u.issues);
|
|
214
|
+
return a.length || !r.ok || !t.ok || !s.ok || !c.ok || !i.ok ? { ok: !1, issues: a } : {
|
|
215
|
+
ok: !0,
|
|
216
|
+
value: {
|
|
217
|
+
stored: r.value,
|
|
218
|
+
inherited: t.value,
|
|
219
|
+
inheritedSources: s.value,
|
|
220
|
+
resolved: c.value,
|
|
221
|
+
sources: i.value
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function j(e) {
|
|
226
|
+
if (!o(e))
|
|
227
|
+
return {
|
|
228
|
+
ok: !1,
|
|
229
|
+
issues: [
|
|
230
|
+
{
|
|
231
|
+
path: "preferenceSources",
|
|
232
|
+
code: "invalid_type",
|
|
233
|
+
message: "preferenceSources must be an object"
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
};
|
|
237
|
+
const a = n(e, z, "preferenceSources"), r = e.calendar, t = e.valueFormat;
|
|
238
|
+
if (o(r) || a.push({
|
|
239
|
+
path: "preferenceSources.calendar",
|
|
240
|
+
code: "invalid_type",
|
|
241
|
+
message: "Calendar preference sources must be an object"
|
|
242
|
+
}), o(t) || a.push({
|
|
243
|
+
path: "preferenceSources.valueFormat",
|
|
244
|
+
code: "invalid_type",
|
|
245
|
+
message: "Value-format preference sources must be an object"
|
|
246
|
+
}), !o(r) || !o(t))
|
|
247
|
+
return { ok: !1, issues: a };
|
|
248
|
+
a.push(
|
|
249
|
+
...n(
|
|
250
|
+
r,
|
|
251
|
+
p,
|
|
252
|
+
"preferenceSources.calendar"
|
|
253
|
+
),
|
|
254
|
+
...n(
|
|
255
|
+
t,
|
|
256
|
+
T,
|
|
257
|
+
"preferenceSources.valueFormat"
|
|
258
|
+
)
|
|
259
|
+
);
|
|
260
|
+
const s = t.dateTime;
|
|
261
|
+
o(s) ? a.push(
|
|
262
|
+
...n(
|
|
263
|
+
s,
|
|
264
|
+
R,
|
|
265
|
+
"preferenceSources.valueFormat.dateTime"
|
|
266
|
+
)
|
|
267
|
+
) : a.push({
|
|
268
|
+
path: "preferenceSources.valueFormat.dateTime",
|
|
269
|
+
code: "invalid_type",
|
|
270
|
+
message: "Datetime preference sources must be an object"
|
|
271
|
+
});
|
|
272
|
+
const c = l(
|
|
273
|
+
r.tz,
|
|
274
|
+
"preferenceSources.calendar.tz",
|
|
275
|
+
a
|
|
276
|
+
), i = l(
|
|
277
|
+
r.weekStart,
|
|
278
|
+
"preferenceSources.calendar.weekStart",
|
|
279
|
+
a
|
|
280
|
+
), u = l(
|
|
281
|
+
t.locale,
|
|
282
|
+
"preferenceSources.valueFormat.locale",
|
|
283
|
+
a
|
|
284
|
+
), f = l(
|
|
285
|
+
t.dateStyle,
|
|
286
|
+
"preferenceSources.valueFormat.dateStyle",
|
|
287
|
+
a
|
|
288
|
+
), m = o(s) ? l(
|
|
289
|
+
s.dateStyle,
|
|
290
|
+
"preferenceSources.valueFormat.dateTime.dateStyle",
|
|
291
|
+
a
|
|
292
|
+
) : void 0, S = o(s) ? l(
|
|
293
|
+
s.timeStyle,
|
|
294
|
+
"preferenceSources.valueFormat.dateTime.timeStyle",
|
|
295
|
+
a
|
|
296
|
+
) : void 0, v = l(
|
|
297
|
+
t.defaultCurrency,
|
|
298
|
+
"preferenceSources.valueFormat.defaultCurrency",
|
|
299
|
+
a
|
|
300
|
+
);
|
|
301
|
+
return a.length || !c || !i || !u || !f || !m || !S || !v ? { ok: !1, issues: a } : {
|
|
302
|
+
ok: !0,
|
|
303
|
+
value: {
|
|
304
|
+
calendar: {
|
|
305
|
+
tz: c,
|
|
306
|
+
weekStart: i
|
|
307
|
+
},
|
|
308
|
+
valueFormat: {
|
|
309
|
+
locale: u,
|
|
310
|
+
dateStyle: f,
|
|
311
|
+
dateTime: {
|
|
312
|
+
dateStyle: m,
|
|
313
|
+
timeStyle: S
|
|
314
|
+
},
|
|
315
|
+
defaultCurrency: v
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function P(e) {
|
|
321
|
+
var t;
|
|
322
|
+
const a = _(e);
|
|
323
|
+
if (!a.ok)
|
|
324
|
+
return {
|
|
325
|
+
ok: !1,
|
|
326
|
+
issues: a.issues.map((s) => ({
|
|
327
|
+
path: `valueFormat.${s.path}`,
|
|
328
|
+
code: "invalid_value_format",
|
|
329
|
+
message: s.message
|
|
330
|
+
}))
|
|
331
|
+
};
|
|
332
|
+
const r = a.value;
|
|
333
|
+
return r.locale === void 0 || r.dateStyle === void 0 || ((t = r.dateTime) == null ? void 0 : t.dateStyle) === void 0 || r.dateTime.timeStyle === void 0 || r.defaultCurrency === void 0 ? {
|
|
334
|
+
ok: !1,
|
|
335
|
+
issues: [
|
|
336
|
+
{
|
|
337
|
+
path: "valueFormat",
|
|
338
|
+
code: "invalid_value_format",
|
|
339
|
+
message: "Resolved value-format preferences must be complete"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
} : {
|
|
343
|
+
ok: !0,
|
|
344
|
+
value: {
|
|
345
|
+
locale: r.locale,
|
|
346
|
+
dateStyle: r.dateStyle,
|
|
347
|
+
dateTime: {
|
|
348
|
+
dateStyle: r.dateTime.dateStyle,
|
|
349
|
+
timeStyle: r.dateTime.timeStyle
|
|
350
|
+
},
|
|
351
|
+
defaultCurrency: r.defaultCurrency
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function K(e) {
|
|
356
|
+
if (!o(e))
|
|
357
|
+
return {
|
|
358
|
+
ok: !1,
|
|
359
|
+
issues: [
|
|
360
|
+
{
|
|
361
|
+
path: "$",
|
|
362
|
+
code: "invalid_type",
|
|
363
|
+
message: "Report runtime context must be an object"
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
};
|
|
367
|
+
const a = n(e, E, "$"), r = O(e.calendar), t = P(e.valueFormat), s = j(e.preferenceSources);
|
|
368
|
+
return r.ok || a.push(
|
|
369
|
+
...r.issues.map((c) => ({
|
|
370
|
+
...c,
|
|
371
|
+
path: c.path === "$" ? "calendar" : `calendar.${c.path}`
|
|
372
|
+
}))
|
|
373
|
+
), t.ok || a.push(...t.issues), s.ok || a.push(...s.issues), a.length || !r.ok || !t.ok || !s.ok ? { ok: !1, issues: a } : {
|
|
374
|
+
ok: !0,
|
|
375
|
+
value: {
|
|
376
|
+
calendar: r.value,
|
|
377
|
+
valueFormat: t.value,
|
|
378
|
+
preferenceSources: s.value
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
export {
|
|
383
|
+
M as D,
|
|
384
|
+
D as a,
|
|
385
|
+
K as b,
|
|
386
|
+
O as p
|
|
387
|
+
};
|