react-semaphor 0.1.514 → 0.1.516
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 +226 -225
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +8 -8
- package/dist/chunks/{calculated-field-identity-BiTGmnST.cjs → calculated-field-identity-5bg9oHTw.cjs} +1 -1
- package/dist/chunks/{calculated-field-identity-DnRd4YIY.js → calculated-field-identity-DzJBs2J8.js} +4 -4
- package/dist/chunks/{card-config-utils-B2cDWQqB.js → card-config-utils-Cxnq2R6z.js} +14 -14
- package/dist/chunks/{card-config-utils-CMO4_zVs.cjs → card-config-utils-z86y6tSq.cjs} +1 -1
- package/dist/chunks/column-bands-CU0byntA.cjs +1 -0
- package/dist/chunks/column-bands-RdM-kjDe.js +47 -0
- package/dist/chunks/{dashboard-briefing-launcher-e3s3MuSs.js → dashboard-briefing-launcher-BCEHJ_eD.js} +15 -12
- package/dist/chunks/{dashboard-briefing-launcher-BzPD50QD.cjs → dashboard-briefing-launcher-CjZ4aE34.cjs} +2 -2
- package/dist/chunks/{dashboard-controls-DAOABnks.js → dashboard-controls-DFfit5KH.js} +12 -12
- package/dist/chunks/{dashboard-controls-DQBfOqmC.cjs → dashboard-controls-f9aJ70Zu.cjs} +1 -1
- package/dist/chunks/{dashboard-date-comparison-definition-D7Bl-YAl.js → dashboard-date-comparison-definition-BqNhECUr.js} +6 -6
- package/dist/chunks/{dashboard-date-comparison-definition-C_w-GO_5.cjs → dashboard-date-comparison-definition-Y6JZwpcr.cjs} +1 -1
- package/dist/chunks/{dashboard-json-S5Eq2GAg.js → dashboard-json-DVtcA02f.js} +7 -7
- package/dist/chunks/{dashboard-json-1jZycd5h.cjs → dashboard-json-deqQC-UR.cjs} +1 -1
- package/dist/chunks/edit-dashboard-visual-DK6lSC_p.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-Bkm0ciHG.js → edit-dashboard-visual-lJ6rDH3w.js} +4553 -4542
- package/dist/chunks/{editor-action-buttons-Bvv16QA-.js → editor-action-buttons-Bnxxa439.js} +7 -7
- package/dist/chunks/{editor-action-buttons-B2NCSsDw.cjs → editor-action-buttons-CmDaQbPN.cjs} +1 -1
- package/dist/chunks/{field-aggregations-CzuQKtqx.js → field-aggregations-Dl2A3rbV.js} +461 -358
- package/dist/chunks/field-aggregations-pH_3kymD.cjs +1 -0
- package/dist/chunks/{field-dependencies-DIab72rQ.cjs → field-dependencies-EB485TdB.cjs} +1 -1
- package/dist/chunks/{field-dependencies-DXW4jtvJ.js → field-dependencies-v-lJNzC7.js} +1 -1
- package/dist/chunks/{index-nhUr9xBz.js → index-BVVl2JDK.js} +57955 -54696
- package/dist/chunks/{index-CACdoqu3.js → index-C8w91oj4.js} +61 -51
- package/dist/chunks/index-Cw2ypaFl.cjs +1 -0
- package/dist/chunks/index-DfqMtR9S.cjs +4 -0
- package/dist/chunks/index-UNKSfi7s.cjs +1434 -0
- package/dist/chunks/{index-CnGVjyF8.js → index-ylOpKRDu.js} +877 -849
- package/dist/chunks/{matrix-analytical-definition-Ct5Tu8np.cjs → matrix-analytical-definition-BWd159lN.cjs} +1 -1
- package/dist/chunks/{matrix-analytical-definition-BDAK2aEi.js → matrix-analytical-definition-BimC4XIV.js} +1 -1
- package/dist/chunks/{matrix-card-U4c72doZ.cjs → matrix-card-C2RjEYZ8.cjs} +1 -1
- package/dist/chunks/{matrix-card-DOIeTmjh.js → matrix-card-CIlz0Dnp.js} +2 -2
- package/dist/chunks/{matrix-control-sources-FjxGIbqk.cjs → matrix-control-sources-BvEJF7d3.cjs} +1 -1
- package/dist/chunks/{matrix-control-sources-BxKH2yu2.js → matrix-control-sources-KbZe1gj_.js} +51 -51
- package/dist/chunks/{matrix-definition-CBJW_4ii.cjs → matrix-definition-DanUT11P.cjs} +1 -1
- package/dist/chunks/{matrix-definition-I9rHB9zN.js → matrix-definition-E5gXXSTZ.js} +1 -1
- package/dist/chunks/matrix-formatter-BJTO8ky9.cjs +1 -0
- package/dist/chunks/matrix-formatter-CCXNRt3s.js +341 -0
- package/dist/chunks/{matrix-member-presentation-DO1VSqfh.js → matrix-member-presentation-Bw7-JCrr.js} +64 -64
- package/dist/chunks/matrix-member-presentation-DvXDEo0U.cjs +1 -0
- package/dist/chunks/{matrix-operation-contract-DoiWTUbT.cjs → matrix-operation-contract-0RxoU_M3.cjs} +1 -1
- package/dist/chunks/{matrix-operation-contract-D0HfzwZg.js → matrix-operation-contract-D32U2CSw.js} +19 -19
- package/dist/chunks/{metric-comparison-Dqc7_tnW.js → metric-comparison-BphoJ9bq.js} +1 -1
- package/dist/chunks/{metric-comparison-DBQ3EJTz.cjs → metric-comparison-CUmltzpz.cjs} +1 -1
- package/dist/chunks/pivot-header-presentation-BSZhB1g-.js +661 -0
- package/dist/chunks/pivot-header-presentation-EoUS5ze5.cjs +5 -0
- package/dist/chunks/{pivot-result-identity-8M-bZrw9.js → pivot-result-identity-BzUQiCEV.js} +4 -4
- package/dist/chunks/{pivot-result-identity-uTiylUNr.cjs → pivot-result-identity-gquWljbd.cjs} +1 -1
- package/dist/chunks/pivot-result-lifecycle-gl9cBfB-.cjs +1 -0
- package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-kRhiJkzg.js} +208 -149
- package/dist/chunks/{raw-temporal-DrmCX9Wq.js → raw-temporal-BqOfk-xN.js} +471 -361
- package/dist/chunks/{raw-temporal-contract-CFLGwTiI.js → raw-temporal-contract-BQZIJ1fn.js} +1 -1
- package/dist/chunks/{raw-temporal-contract-DECbTuzA.cjs → raw-temporal-contract-CklMVG_1.cjs} +1 -1
- package/dist/chunks/raw-temporal-eJXecCyJ.cjs +1 -0
- package/dist/chunks/{report-preferences-dialog-B2fzQH1T.js → report-preferences-dialog-CHXPEl7v.js} +6 -6
- package/dist/chunks/{report-preferences-dialog-DcLkVqni.cjs → report-preferences-dialog-Cto0vDwI.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-Cs65Mrxj.js → report-runtime-context-CxIoGyNM.js} +1 -1
- package/dist/chunks/{report-runtime-context-DzvHBPxl.cjs → report-runtime-context-CzSrCBsu.cjs} +1 -1
- package/dist/chunks/{selection-reducer-BIiQXbGM.js → selection-reducer-CvCBQbl2.js} +1 -1
- package/dist/chunks/{selection-reducer-CGKKsaPa.cjs → selection-reducer-Kl22OzIk.cjs} +1 -1
- package/dist/chunks/{semantic-format-BZxJLKvw.js → semantic-format-DwqGYx4V.js} +25 -31
- package/dist/chunks/semantic-format-mVI32OJH.cjs +1 -0
- package/dist/chunks/{source-entity-resolution-D7vnmDwm.js → source-entity-resolution-Bzefiive.js} +7 -7
- package/dist/chunks/{source-entity-resolution-CjbgnwyX.cjs → source-entity-resolution-R46X34SE.cjs} +1 -1
- package/dist/chunks/switch-DNbWXEOP.cjs +134 -0
- package/dist/chunks/{switch-QfKb0Iwe.js → switch-DNv-hVmt.js} +8260 -7659
- package/dist/chunks/{temporal-bucket-B9hMwemw.js → temporal-bucket-DlFuhCnT.js} +6 -6
- package/dist/chunks/{temporal-bucket-contract-IWDgyTMw.js → temporal-bucket-contract-DTLDRzgV.js} +1 -1
- package/dist/chunks/{temporal-bucket-contract-ZctiyXYk.cjs → temporal-bucket-contract-nTv6gvX5.cjs} +1 -1
- package/dist/chunks/{token-types-Dl0hcKBX.js → token-types-BC6RcUY8.js} +1 -1
- package/dist/chunks/{token-types-Ahh5u4iT.cjs → token-types-aWrzwonf.cjs} +1 -1
- package/dist/chunks/{update-policy-COjFudhl.cjs → update-policy-DRDLWe7Y.cjs} +1 -1
- package/dist/chunks/{update-policy-BeQqjupC.js → update-policy-DhAUtiC8.js} +2 -2
- package/dist/chunks/{validators-CkHsAvwB.js → validators-CsdOtZI6.js} +411 -397
- package/dist/chunks/validators-DFeDcdpA.cjs +1 -0
- 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 +233 -227
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +3 -3
- 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 +1 -1
- package/dist/data-app-sdk/index.js +5 -5
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +5 -5
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +291 -397
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/dist/pdf-table-layout/index.cjs +1 -0
- package/dist/pdf-table-layout/index.js +993 -0
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/index.d.ts +1 -1
- package/dist/types/components/document-sheet/document-input-bar.d.ts +1 -3
- package/dist/types/components/document-sheet/document-insert-picker.d.ts +37 -0
- package/dist/types/components/document-sheet/document-kpi-section.d.ts +17 -0
- package/dist/types/components/document-sheet/document-matrix-layout-context.d.ts +10 -0
- package/dist/types/components/document-sheet/document-matrix-section.d.ts +27 -0
- package/dist/types/components/document-sheet/document-measure-layer.d.ts +45 -0
- package/dist/types/components/document-sheet/document-outline.d.ts +7 -1
- package/dist/types/components/document-sheet/document-page-navigation.d.ts +22 -0
- package/dist/types/components/document-sheet/document-page.d.ts +9 -5
- package/dist/types/components/document-sheet/document-panel/document-side-panel.d.ts +36 -0
- package/dist/types/components/document-sheet/document-panel/inputs-panel.d.ts +9 -0
- package/dist/types/components/document-sheet/document-panel/page-panel.d.ts +5 -0
- package/dist/types/components/document-sheet/document-panel/panel-controls.d.ts +14 -0
- package/dist/types/components/document-sheet/document-panel/region-panels.d.ts +11 -0
- package/dist/types/components/document-sheet/document-panel/section-panel.d.ts +25 -0
- package/dist/types/components/document-sheet/document-section-print-boundary.d.ts +9 -0
- package/dist/types/components/document-sheet/document-table-chrome.d.ts +22 -0
- package/dist/types/components/document-sheet/document-table-section.d.ts +3 -7
- package/dist/types/components/document-sheet/document-text-preview-context.d.ts +8 -0
- package/dist/types/components/document-sheet/use-first-fitting-variant.d.ts +18 -0
- package/dist/types/components/editor/editor-main/dashboard-variable-node.d.ts +12 -2
- package/dist/types/components/explorer/chart-configuration/matrix-authoring-controls.d.ts +7 -2
- package/dist/types/components/text-variables/variable-chip-plugin.d.ts +23 -0
- package/dist/types/components/text-variables/variable-chip.d.ts +18 -0
- package/dist/types/components/text-variables/variable-picker.d.ts +27 -0
- 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/components/visual/settings/table-presentation-settings.d.ts +27 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-inputs/text-variable-options.d.ts +15 -0
- package/dist/types/lib/document/document-canvas-actions.d.ts +22 -0
- package/dist/types/lib/document/document-edits.d.ts +119 -0
- package/dist/types/lib/document/document-kpi-figure.d.ts +27 -0
- package/dist/types/lib/document/document-kpi-layout.d.ts +29 -0
- package/dist/types/lib/document/document-kpi-section-edits.d.ts +15 -0
- package/dist/types/lib/document/document-matrix-bands.d.ts +66 -0
- package/dist/types/lib/document/document-matrix-print.d.ts +11 -0
- package/dist/types/lib/document/document-pagination.d.ts +56 -3
- package/dist/types/lib/document/document-panel-target.d.ts +19 -0
- package/dist/types/lib/document/document-section-editor.d.ts +8 -7
- package/dist/types/lib/document/document-section-kinds.d.ts +49 -0
- package/dist/types/lib/document/document-section-query-options.d.ts +25 -0
- package/dist/types/lib/document/document-section-render-state.d.ts +26 -0
- package/dist/types/lib/document/document-section-utils.d.ts +11 -4
- package/dist/types/lib/document/document-table-dom.d.ts +4 -6
- package/dist/types/lib/document/document-table-pagination-model.d.ts +0 -5
- package/dist/types/lib/document/document-table-print-model.d.ts +4 -3
- package/dist/types/lib/document/document-table-style.d.ts +15 -4
- package/dist/types/lib/document/document-table-surface.d.ts +15 -0
- package/dist/types/lib/document/document-variables.d.ts +40 -6
- package/dist/types/lib/document/use-document-section-data.d.ts +39 -0
- package/dist/types/lib/document/use-measured-document-table-layout.d.ts +50 -0
- package/dist/types/lib/formatters/kpi-result-values.d.ts +20 -0
- package/dist/types/lib/formatters/metric-formatting.d.ts +3 -3
- package/dist/types/lib/hooks/query-context/use-dashboard-card-execution-snapshot.d.ts +8 -2
- package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +6 -0
- package/dist/types/lib/hooks/use-dashboard-kpi-actions.d.ts +1 -1
- package/dist/types/lib/hooks/use-document-section-editor.d.ts +2 -2
- package/dist/types/lib/hooks/use-document-section-session.d.ts +36 -0
- package/dist/types/lib/hooks/use-editor-preview.d.ts +17 -0
- package/dist/types/lib/hooks/use-is-editing-card.d.ts +7 -0
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
- package/dist/types/lib/matrix-table/matrix-layout-read.d.ts +68 -0
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +8 -1
- package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +4 -2
- package/dist/types/lib/query-context/card-execution.d.ts +30 -0
- package/dist/types/lib/query-context/document-section-card-query.d.ts +37 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +12 -8
- package/dist/types/lib/stores/editor-store.d.ts +2 -0
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +1 -0
- package/dist/types/lib/text-variables/text-variable-types.d.ts +39 -0
- package/dist/types/lib/types/common-types.d.ts +34 -1
- package/dist/types/lib/utils/card-definition.d.ts +2 -0
- package/dist/types/lib/utils/card-utils.d.ts +13 -6
- package/dist/types/lib/utils/date-timezone-utils.d.ts +26 -4
- package/dist/types/pdf-table-layout.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +45 -0
- package/dist/types/shared/analytics-protocol/matrix-member-presentation.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/document-section-cards.d.ts +56 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +36 -1
- 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/matrix-formatter.d.ts +5 -0
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +8 -2
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +690 -1
- package/dist/types/shared/format-utils/matrix-print.d.ts +38 -0
- package/dist/types/shared/format-utils/pdf-table-layout/column-bands.d.ts +55 -0
- package/dist/types/shared/format-utils/pdf-table-layout/index.d.ts +6 -0
- package/dist/types/shared/format-utils/pdf-table-layout/page-size.d.ts +7 -0
- package/dist/types/shared/format-utils/pdf-table-layout/table-column-semantics.d.ts +106 -0
- package/dist/types/shared/format-utils/pdf-table-layout/table-column-widths.d.ts +13 -0
- package/dist/types/shared/format-utils/pdf-table-layout/table-page-geometry.d.ts +19 -0
- package/dist/types/shared/format-utils/pdf-table-layout/wide-table-layout.d.ts +46 -0
- package/dist/types/shared/format-utils/presentation-execution.d.ts +17 -2
- package/dist/types/shared/format-utils/table-structure.d.ts +9 -0
- package/dist/types/shared/format-utils/types/format-types.d.ts +16 -1
- package/package.json +6 -1
- package/dist/chunks/edit-dashboard-visual-BwJ2Eljw.cjs +0 -172
- package/dist/chunks/field-aggregations-jSi77h9Z.cjs +0 -1
- package/dist/chunks/index-DhlVxvyI.cjs +0 -4
- package/dist/chunks/index-DrOFJOCq.cjs +0 -1424
- 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/matrix-member-presentation-CFHjdrxT.cjs +0 -1
- package/dist/chunks/pivot-header-presentation-Cxz8-06f.cjs +0 -5
- package/dist/chunks/pivot-header-presentation-Dm9dUQsl.js +0 -415
- 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/validators-DVYAnnX0.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("./validators-
|
|
1
|
+
"use strict";const u=require("./validators-DFeDcdpA.cjs");function m(t){const{label:i,...n}=t;return{dataset:u.semaphorSourceIdentityKey(n),...t.kind==="physical"?{dialect:t.dialect,connectionType:t.connectionType}:{}}}function y(t){const{label:i,source:n,...e}=t;return{...e,source:n&&m(n)}}function s(t){const{label:i,format:n,description:e,tags:a,inputs:r,...l}=t;return{...l,inputs:Object.fromEntries(Object.entries(r).map(([c,f])=>[c,{...f,field:y(f.field)}]))}}function d(t){const{derivedField:i,...n}=t;return{...y(n),derivedField:i&&s(i)}}function o(t){const{label:i,format:n,description:e,semanticTemporalPresentation:a,derivedField:r,calculatedFormula:l,...c}=t;return{...c,semanticTemporalPresentation:a&&{granularity:a.granularity},derivedField:r&&s(r),calculatedFormula:l&&{...l,inputFields:l.inputFields.map(o)}}}function p(t){return{...t,conditions:t.conditions.map(({label:i,field:n,...e})=>({...e,field:o(n)})),groups:t.groups.map(p)}}function b(t){return{...t,source:m(t.source),rows:t.rows.map(i=>({...i,field:d(i.field)})),columns:t.columns.map(i=>({...i,field:d(i.field)})),measures:t.measures.map(i=>i.kind==="aggregate"?{...i,field:d(i.field)}:{...i,definition:s(i.definition)}),filters:t.filters&&p(t.filters),joinPlan:t.joinPlan&&{...t.joinPlan,joins:t.joinPlan.joins.map(i=>({...i,joinKeyGroups:i.joinKeyGroups.map(n=>({...n,keys:n.keys.map(e=>({...e,source:o(e.source),target:o(e.target)}))}))}))},sorts:[...t.sorts].sort((i,n)=>{const e=u.matrixSortKey(i),a=u.matrixSortKey(n);return e<a?-1:e>a?1:0})}}exports.getMatrixAnalyticalCalculation=s;exports.getMatrixAnalyticalDefinition=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./validators-
|
|
1
|
+
"use strict";const o=require("./validators-DFeDcdpA.cjs");require("./matrix-operation-contract-0RxoU_M3.cjs");function s(i,r={}){var n,a;if(i.type!=="matrixTable"||!i.config||typeof i.config!="object"||!("matrix"in i.config))return{status:"absent"};if((n=i.sql)!=null&&n.trim()||(a=i.python)!=null&&a.trim())return{status:"invalid",error:new Error("A Matrix definition requires a config-only Matrix card.")};if("matrixIntent"in i.config&&i.config.matrixIntent!==void 0)return{status:"invalid",error:new Error("A Matrix card cannot contain two definitions.")};const t=(r.authoringDraft?o.matrixAuthoringConfigSchema:o.matrixConfigSchema).safeParse(i.config.matrix);return t.success?{status:"ready",config:t.data}:{status:"invalid",error:t.error}}function u(i){const r=s(i);if(r.status==="invalid")throw r.error;return r.status==="ready"?r.config:void 0}function f(i){const r=[],e=t=>{r.push(t),t.derivedField&&Object.values(t.derivedField.inputs).forEach(n=>e(n.field))};return[...i.rows,...i.columns].forEach(t=>e(t.field)),i.measures.forEach(t=>{t.kind==="aggregate"?e(t.field):Object.values(t.definition.inputs).forEach(n=>e(n.field))}),r}function c(i){return o.mergeSemaphorSourcesByIdentity([i.source,...f(i).map(r=>r.source??i.source)])}exports.inspectMatrixCardConfig=s;exports.matrixDefinitionFields=f;exports.matrixDefinitionSources=c;exports.readMatrixCardConfig=u;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as a, t as s, u as f } from "./validators-
|
|
2
|
-
import "./matrix-operation-contract-
|
|
1
|
+
import { r as a, t as s, u as f } from "./validators-CsdOtZI6.js";
|
|
2
|
+
import "./matrix-operation-contract-D32U2CSw.js";
|
|
3
3
|
function u(i, r = {}) {
|
|
4
4
|
var n, o;
|
|
5
5
|
if (i.type !== "matrixTable" || !i.config || typeof i.config != "object" || !("matrix" in i.config)) return { status: "absent" };
|
package/dist/chunks/{matrix-control-sources-FjxGIbqk.cjs → matrix-control-sources-BvEJF7d3.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty;var ge=(e,t,o)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var v=(e,t,o)=>ge(e,typeof t!="symbol"?t+"":t,o);const _=require("./validators-DVYAnnX0.cjs"),L=require("./common-types-nBuCd3u2.cjs");require("./matrix-operation-contract-DoiWTUbT.cjs");const Y=require("./calculated-field-identity-BiTGmnST.cjs"),fe=require("./field-aggregations-jSi77h9Z.cjs"),me=require("zod"),Z=require("./matrix-card-U4c72doZ.cjs"),b=require("./constants-B00YUv89.cjs");function X(e,t){const r=Ne(e);let i;if(r.date){const g=pe(r.date,2);i=Re(g.restDateString,g.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let d=0,u;if(r.time&&(d=De(r.time),isNaN(d)))return new Date(NaN);if(r.timezone){if(u=Te(r.timezone),isNaN(u))return new Date(NaN)}else{const g=new Date(a+d),R=new Date(0);return R.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),R.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),R}return new Date(a+d+u)}const S={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},_e=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Oe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Ie=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ne(e){const t={},o=e.split(S.dateTimeDelimiter);let r;if(o.length>2)return t;if(/:/.test(o[0])?r=o[0]:(t.date=o[0],r=o[1],S.timeZoneDelimiter.test(t.date)&&(t.date=e.split(S.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const i=S.timezone.exec(r);i?(t.time=r.replace(i[1],""),t.timezone=i[1]):t.time=r}return t}function pe(e,t){const o=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(o);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function Re(e,t){if(t===null)return new Date(NaN);const o=e.match(_e);if(!o)return new Date(NaN);const r=!!o[4],i=w(o[1]),a=w(o[2])-1,d=w(o[3]),u=w(o[4]),g=w(o[5])-1;if(r)return Ae(t,u,g)?Ce(t,u,g):new Date(NaN);{const R=new Date(0);return!ye(t,a,d)||!he(t,i)?new Date(NaN):(R.setUTCFullYear(t,a,Math.max(i,d)),R)}}function w(e){return e?parseInt(e):1}function De(e){const t=e.match(Oe);if(!t)return NaN;const o=M(t[1]),r=M(t[2]),i=M(t[3]);return we(o,r,i)?o*b.millisecondsInHour+r*b.millisecondsInMinute+i*1e3:NaN}function M(e){return e&&parseFloat(e.replace(",","."))||0}function Te(e){if(e==="Z")return 0;const t=e.match(Ie);if(!t)return 0;const o=t[1]==="+"?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Se(r,i)?o*(r*b.millisecondsInHour+i*b.millisecondsInMinute):NaN}function Ce(e,t,o){const r=new Date(0);r.setUTCFullYear(e,0,4);const i=r.getUTCDay()||7,a=(t-1)*7+o+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const Ee=[31,null,31,30,31,30,31,31,30,31,30,31];function W(e){return e%400===0||e%4===0&&e%100!==0}function ye(e,t,o){return t>=0&&t<=11&&o>=1&&o<=(Ee[t]||(W(e)?29:28))}function he(e,t){return t>=1&&t<=(W(e)?366:365)}function Ae(e,t,o){return t>=1&&t<=53&&o>=0&&o<=6}function we(e,t,o){return e===24?t===0&&o===0:o>=0&&o<60&&t>=0&&t<60&&e>=0&&e<25}function Se(e,t){return t>=0&&t<=59}const Le=["lg","md","sm","xs","xxs"],be=15;function Ve(e,t){return e.name===t.name&&e.qualifiedEntityName===t.qualifiedEntityName}function xe(e,t,o){var i,a;if(o.sortPolicy==="dropUnrelatedSorts"){const d=new Set((e.metricColumns||[]).map(u=>u.id));return{...e,groupByColumns:[t],sortByColumns:(e.sortByColumns||[]).filter(u=>u.id===t.id||d.has(u.id))}}const r=(i=e.groupByColumns)==null?void 0:i[0];return{...e,groupByColumns:[t],sortByColumns:(a=e.sortByColumns)==null?void 0:a.map(d=>r&&Ve(d,r)?{...t,role:"sortby",direction:d.direction}:d)}}function ve(e,t){return`${e}-${t}`}const Me="CONTROL_PLACEHOLDER_QUOTED",Q="CONTROL_REFERENCE_MISSING",K="CONTROL_VALUE_MISSING",Fe="CONTROL_VALUE_INVALID",Ue="CONTROL_CONTEXT_UNSUPPORTED",J="CONTROL_DEFINITION_DUPLICATE",ee="CONTROL_DEFINITION_INVALID",V="CONTROL_BINDING_MAPPING_MISSING",te="CONTROL_BINDING_TARGET_INVALID",F="CONTROL_BINDING_VALUE_INVALID";class O extends Error{constructor(o,r){super(o);v(this,"status",400);v(this,"details");Object.setPrototypeOf(this,O.prototype),this.name="ControlResolutionError",this.details=r}}function B(e,t){const o=new Map;for(const r of[...e,...t]){if(!r||typeof r!="object"||typeof r.id!="string"||r.id.trim().length===0)throw new O("Malformed control definition was provided for query execution.",{code:ee});if(o.get(r.id))throw new O(`Duplicate control definition '${r.id}' was provided for query execution.`,{code:J,controlId:r.id});o.set(r.id,r)}return o}const Be=/^-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;function Ge(e){switch(e.source.kind){case"manual":return e.source.options.map(t=>t.value);case"field_allowlist":return e.source.fieldIds;case"metric_allowlist":return e.source.metricIds;case"dataset_values":return null;default:return null}}function D(e){return`${e.label||e.id} (${e.id})`}function Pe(e){return e.type==="field_selector"||e.type==="metric_selector"||e.type==="aggregation_selector"||e.type==="grain_selector"}function j(e,t){const o=Ge(e);if(!(!o||o.length===0)&&!o.includes(t))throw new Error(`Control ${D(e)} received unsupported value '${t}'.`)}function re(e,t){switch(e.type){case"enum":case"field_selector":case"metric_selector":case"aggregation_selector":case"grain_selector":{if(typeof t!="string"||t.trim().length===0)throw new Error(`Control ${D(e)} requires a non-empty string value.`);return Pe(e)&&t===L.CONTROL_CARD_DEFAULT_VALUE||j(e,t),t}case"multi_enum":{if(!Array.isArray(t))throw new Error(`Control ${D(e)} requires a non-empty array value.`);if(t.length===0){if(!e.requiredAtExecution)return;throw new Error(`Control ${D(e)} requires a non-empty array value.`)}for(const o of t){if(typeof o!="string"||o.trim().length===0)throw new Error(`Control ${D(e)} requires string array values.`);j(e,o)}return t}case"text":{if(typeof t!="string")throw new Error(`Control ${D(e)} requires a string value.`);return t}case"number":{if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&Be.test(t.trim()))return Number(t);throw new Error(`Control ${D(e)} requires a numeric value.`)}case"boolean":{if(typeof t!="boolean")throw new Error(`Control ${D(e)} requires a boolean value.`);return t}case"date":{if(t instanceof Date&&!Number.isNaN(t.getTime()))return t;if(typeof t=="string"&&t.trim().length>0){const o=t.trim(),r=X(o);if(!Number.isNaN(r.getTime()))return o}throw new Error(`Control ${D(e)} requires a date-compatible value.`)}default:return t}}function G(e){var i;const t=e.definitions.get(e.binding.controlId);if(!t)throw new O(`Binding references unknown control '${e.binding.controlId}'.`,{code:Q,controlId:e.binding.controlId});if(!Object.prototype.hasOwnProperty.call(e.controlValues||{},e.binding.controlId)){if(!t.requiredAtExecution)return;throw new O(`Control '${e.binding.controlId}' must resolve to a concrete value before query execution.`,{code:K,controlId:e.binding.controlId})}let r;try{r=re(t,(i=e.controlValues)==null?void 0:i[e.binding.controlId])}catch(a){const d=a instanceof Error?a.message:String(a);throw new O(d,{code:F,controlId:e.binding.controlId})}if(typeof r=="string"&&r.trim().length>0)return r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(r instanceof Date&&!Number.isNaN(r.getTime()))return r.toISOString();throw new O(`Binding control '${e.binding.controlId}' must resolve to a single scalar value.`,{code:F,controlId:e.binding.controlId})}function U(e){const t=e.binding.mapping[e.selectedValue];if(typeof t=="string"&&t.trim().length>0)return t;throw new O(`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}'.`,{code:V,controlId:e.binding.controlId})}function oe(e){const t=e.binding.mapping[e.selectedValue];if(t&&typeof t=="object"&&"role"in t&&t.role==="groupby")return t;throw new O(`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}' to a valid group-by field.`,{code:V,controlId:e.binding.controlId})}function ne(e){const t=e.binding.mapping[e.selectedValue];if(t&&typeof t=="object"&&"role"in t&&t.role==="metric")return t;throw new O(`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}' to a valid metric field.`,{code:V,controlId:e.binding.controlId})}function ie(e,t,o){if(_.shouldDropInheritedCalculationAggregate(_.getCalculatedFieldComputeStage(t),e.aggregateOrigin))return{aggregate:void 0,aggregateOrigin:void 0};const r=o==="selection"&&e.role==="metric"?t.aggregate:void 0;return{aggregate:e.aggregate??r,aggregateOrigin:e.aggregate?e.aggregateOrigin:r?t.aggregateOrigin:void 0}}function ae(e,t,o){var r,i,a,d,u,g;if(o==="domain")return{filters:(r=t.parameters)==null?void 0:r.filters,windowTransform:(i=e.parameters)==null?void 0:i.windowTransform};if(!(!e.parameters&&!t.parameters))return{filters:((a=e.parameters)==null?void 0:a.filters)??((d=t.parameters)==null?void 0:d.filters),windowTransform:((u=e.parameters)==null?void 0:u.windowTransform)??((g=t.parameters)==null?void 0:g.windowTransform)}}function $e(e,t,o){const r=e;return{id:e.id,role:e.role,...o==="selection"&&e.alias?{alias:e.alias}:{},granularity:e.granularity??t.granularity,dateFormat:e.dateFormat,customFormat:e.customFormat,semanticTemporalPresentation:t.semanticTemporalPresentation||e.semanticTemporalPresentation,...ie(e,t,o),...e.role==="metric"?{aliasTemplate:r.aliasTemplate,valueAliases:r.valueAliases,comparison:r.comparison,comparisonPolarity:r.comparisonPolarity,parameters:ae(r,t,"domain")}:{},...se(e)}}function se(e){const t={...e.labelOrigin==="override"?{label:e.label,labelOrigin:e.labelOrigin}:{},...e.formatOrigin==="override"?{format:e.format,formatOrigin:e.formatOrigin}:{}};switch(e.role){case"pivotby":return{...t,memberOrder:e.memberOrder};case"sortby":return{...t,direction:e.direction};case"detail":return{...t,...e.dateFormat!==void 0?{dateFormat:e.dateFormat}:{},...e.customFormat!==void 0?{customFormat:e.customFormat}:{}};default:return t}}const qe=new Set(["day","week","month","quarter","year","hour","minute","second"]);function ke(e){let t=e.spec;const o=B(e.controlDefinitions||[],e.cardControlDefinitions||[]),r=(e.controlBindings||[]).filter(n=>n.target!=="sql_param"),i=r.filter(n=>n.target==="config_metric_selector"||n.target==="config_field_selector"),a=r.filter(n=>n.target==="config_grain"||n.target==="config_aggregation"),d=new Set,u=new Map;let g;const R=()=>{if(g)return g;const n=e.catalog,c=new Map;for(const l of n){const f=c.get(l.id)??[];c.set(l.id,[...f,l])}return g={refs:n,byId:c},g},y=(n,c)=>{throw new O(n,{code:te,...c?{controlId:c}:{}})},x=(n,c)=>{var f;if(n.derivedField)return n.derivedField.dataType;const l=R().refs.filter(C=>C.field.name===n.name&&_.semaphorSourcesReferToSameDataset(C.field.source??e.spec.source,n.source??e.spec.source));return l.length>1?y("The selected field is ambiguous in the authorized Matrix field catalog.",c):_.normalizeAnalyticsCatalogDataType(((f=l[0])==null?void 0:f.field.dataType)??n.dataType)},P=(n,c)=>Y.getMatrixBindingTargets(n,c.target,l=>x(l,c.controlId)),T=_.matrixSpecSchema.safeParse(t);if(!T.success)return y(T.error.message);t=T.data;const le=[...i,...a].map(n=>{const c=G({binding:n,definitions:o,controlValues:e.controlValues}),l=!n.matrixTargetId&&c!==void 0&&c!==L.CONTROL_CARD_DEFAULT_VALUE?P(T.data,n):[];return{binding:n,selectedValue:c,targetId:n.matrixTargetId??(l.length===1?l[0].id:void 0)}});for(const{binding:n,targetId:c,selectedValue:l}of le){if(l===void 0||l===L.CONTROL_CARD_DEFAULT_VALUE)continue;const f=s=>y(s,n.controlId),C=n.target==="config_metric_selector"||n.target==="config_aggregation",de=P(t,n);(!c||!de.some(s=>s.id===c))&&f("Choose a valid Matrix level or measure target for this control.");const $=`${n.target}:${c}`;d.has($)&&f("Multiple controls cannot replace the same Matrix target."),d.add($);const q=s=>{const m=(R().byId.get(s.id)??[]).filter(N=>!s.source||_.semaphorSourcesReferToSameDataset(s.source,N.field.source??e.spec.source));if(m.length!==1)return f(m.length?"The selected field is ambiguous in the authorized Matrix field catalog.":"The selected field is not in the authorized Matrix field catalog.");const p=_.matrixFieldSchema.safeParse(m[0].field);return p.success?p.data:f(p.error.message)},h=n.target==="config_metric_selector"||n.target==="config_field_selector"?n.mapping[l]:void 0,E=h&&typeof h=="object"&&"kind"in h&&h.kind==="matrix_instance"?h.id:void 0;if(C){u.set(c,n.controlId);const s=E===void 0?void 0:T.data.measures.find(I=>I.id===E&&I.kind==="aggregate");E!==void 0&&!s&&f("The selected Matrix aggregate measure is no longer available.");const m=n.target==="config_metric_selector"&&!s?ne({binding:n,selectedValue:l}):void 0,p=((s==null?void 0:s.kind)==="aggregate"?s.aggregate:m==null?void 0:m.aggregate)??(n.target==="config_aggregation"?U({binding:n,selectedValue:l}):void 0),N=p===void 0?void 0:_.matrixAggregateSchema.safeParse(p);N&&!N.success&&f("This aggregation is not supported by Matrix."),t={...t,measures:t.measures.map(I=>I.id!==c||I.kind!=="aggregate"?I:{...I,...m?{field:q(m)}:{},...(s==null?void 0:s.kind)==="aggregate"?{field:s.field}:{},aggregate:N!=null&&N.success?N.data:I.aggregate})}}else{const s=E===void 0?void 0:[...T.data.rows,...T.data.columns].find(I=>I.id===E);E!==void 0&&!s&&f("The selected Matrix level is no longer available.");const m=n.target==="config_field_selector"&&!s?oe({binding:n,selectedValue:l}):void 0,p=n.target==="config_grain"?U({binding:n,selectedValue:l}):s?s.grain:m==null?void 0:m.granularity;p!==void 0&&!qe.has(p)&&f("This time grain is not supported by Matrix.");const N=I=>I.map(A=>{if(A.id!==c)return A;const k=(s==null?void 0:s.field)??(m?q(m):A.field),H=x(k,n.controlId),z=p??(m&&_.isAnalyticsDateLikeDataType(H)?A.grain:void 0);return z&&!_.isAnalyticsDateLikeDataType(H)&&f("A time grain requires a temporal Matrix level."),{...A,field:k,grain:z}});t={...t,rows:N(t.rows),columns:N(t.columns)}}}for(const[n,c]of Array.from(u)){const l=t.measures.find(C=>C.id===n);if(!l||l.kind!=="aggregate")continue;const f=x(l.field,c);fe.getFieldAggregationOptions(f).some(C=>C.value===l.aggregate)||y(`Aggregation '${l.aggregate}' is not eligible for this Matrix field datatype.`,c)}try{return Y.reconcileMatrixSpecStructure(T.data,t)}catch(n){if(n instanceof me.ZodError)return y(n.message);throw n}}function ce(e,t){const o=[],r=i=>{if(i.source){const a=_.configSourceRefSchema.safeParse(i.source);if(a.success)o.push(a.data);else if(t)throw a.error}i.derivedField&&Object.values(i.derivedField.inputs).forEach(a=>r(a.field))};for(const i of e){if(i.target!=="config_field_selector"&&i.target!=="config_metric_selector")continue;const a=t==null?void 0:t.get(i),d=t?a&&a!==L.CONTROL_CARD_DEFAULT_VALUE?[i.mapping[a]]:[]:Object.values(i.mapping);for(const u of d)u&&"role"in u&&r(u)}return o}function He(e,t=[],o=[]){return _.mergeSemaphorSourcesByIdentity([...Z.matrixDefinitionSources(e),...ce(t),...o])}function ze(e,t={}){const o=t.controlBindings??[],r=B(t.controlDefinitions??[],t.cardControlDefinitions??[]),i=new Map(o.filter(a=>a.target==="config_field_selector"||a.target==="config_metric_selector").map(a=>[a,G({binding:a,definitions:r,controlValues:t.controlValues})]));return _.mergeSemaphorSourcesByIdentity([...Z.matrixDefinitionSources(e),...ce(o,i)])}exports.CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE=V;exports.CONTROL_BINDING_TARGET_INVALID_ERROR_CODE=te;exports.CONTROL_BINDING_VALUE_INVALID_ERROR_CODE=F;exports.CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE=Ue;exports.CONTROL_DEFINITION_DUPLICATE_ERROR_CODE=J;exports.CONTROL_DEFINITION_INVALID_ERROR_CODE=ee;exports.CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE=Me;exports.CONTROL_REFERENCE_MISSING_ERROR_CODE=Q;exports.CONTROL_VALUE_INVALID_ERROR_CODE=Fe;exports.CONTROL_VALUE_MISSING_ERROR_CODE=K;exports.ControlResolutionError=O;exports.DASHBOARD_AUTHORING_BREAKPOINTS=Le;exports.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS=be;exports.applyGroupByOverride=xe;exports.buildControlDefinitionIndex=B;exports.getCalculatedFieldAggregateOverrides=ie;exports.getCalculatedFieldParameters=ae;exports.getCalculatedFieldShelfOverrides=se;exports.getColumnCatalogFieldId=ve;exports.getDomainCalculatedSelectionOverrides=$e;exports.matrixCatalogSources=He;exports.matrixExecutionSources=ze;exports.parseISO=X;exports.resolveBindingControlValue=G;exports.resolveGroupByFieldTarget=oe;exports.resolveMatrixControlBindings=ke;exports.resolveMetricFieldTarget=ne;exports.resolveScalarMappedValue=U;exports.validateControlValue=re;
|
|
1
|
+
"use strict";var ue=Object.defineProperty;var ge=(e,t,o)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var v=(e,t,o)=>ge(e,typeof t!="symbol"?t+"":t,o);const _=require("./validators-DFeDcdpA.cjs"),L=require("./common-types-nBuCd3u2.cjs");require("./matrix-operation-contract-0RxoU_M3.cjs");const Y=require("./calculated-field-identity-5bg9oHTw.cjs"),fe=require("./field-aggregations-pH_3kymD.cjs"),me=require("zod"),Z=require("./matrix-card-C2RjEYZ8.cjs"),b=require("./constants-B00YUv89.cjs");function X(e,t){const r=Ne(e);let i;if(r.date){const g=pe(r.date,2);i=Re(g.restDateString,g.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let d=0,u;if(r.time&&(d=De(r.time),isNaN(d)))return new Date(NaN);if(r.timezone){if(u=Te(r.timezone),isNaN(u))return new Date(NaN)}else{const g=new Date(a+d),R=new Date(0);return R.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),R.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),R}return new Date(a+d+u)}const S={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},_e=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Oe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Ie=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ne(e){const t={},o=e.split(S.dateTimeDelimiter);let r;if(o.length>2)return t;if(/:/.test(o[0])?r=o[0]:(t.date=o[0],r=o[1],S.timeZoneDelimiter.test(t.date)&&(t.date=e.split(S.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const i=S.timezone.exec(r);i?(t.time=r.replace(i[1],""),t.timezone=i[1]):t.time=r}return t}function pe(e,t){const o=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(o);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function Re(e,t){if(t===null)return new Date(NaN);const o=e.match(_e);if(!o)return new Date(NaN);const r=!!o[4],i=w(o[1]),a=w(o[2])-1,d=w(o[3]),u=w(o[4]),g=w(o[5])-1;if(r)return Ae(t,u,g)?Ce(t,u,g):new Date(NaN);{const R=new Date(0);return!ye(t,a,d)||!he(t,i)?new Date(NaN):(R.setUTCFullYear(t,a,Math.max(i,d)),R)}}function w(e){return e?parseInt(e):1}function De(e){const t=e.match(Oe);if(!t)return NaN;const o=M(t[1]),r=M(t[2]),i=M(t[3]);return we(o,r,i)?o*b.millisecondsInHour+r*b.millisecondsInMinute+i*1e3:NaN}function M(e){return e&&parseFloat(e.replace(",","."))||0}function Te(e){if(e==="Z")return 0;const t=e.match(Ie);if(!t)return 0;const o=t[1]==="+"?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Se(r,i)?o*(r*b.millisecondsInHour+i*b.millisecondsInMinute):NaN}function Ce(e,t,o){const r=new Date(0);r.setUTCFullYear(e,0,4);const i=r.getUTCDay()||7,a=(t-1)*7+o+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const Ee=[31,null,31,30,31,30,31,31,30,31,30,31];function W(e){return e%400===0||e%4===0&&e%100!==0}function ye(e,t,o){return t>=0&&t<=11&&o>=1&&o<=(Ee[t]||(W(e)?29:28))}function he(e,t){return t>=1&&t<=(W(e)?366:365)}function Ae(e,t,o){return t>=1&&t<=53&&o>=0&&o<=6}function we(e,t,o){return e===24?t===0&&o===0:o>=0&&o<60&&t>=0&&t<60&&e>=0&&e<25}function Se(e,t){return t>=0&&t<=59}const Le=["lg","md","sm","xs","xxs"],be=15;function Ve(e,t){return e.name===t.name&&e.qualifiedEntityName===t.qualifiedEntityName}function xe(e,t,o){var i,a;if(o.sortPolicy==="dropUnrelatedSorts"){const d=new Set((e.metricColumns||[]).map(u=>u.id));return{...e,groupByColumns:[t],sortByColumns:(e.sortByColumns||[]).filter(u=>u.id===t.id||d.has(u.id))}}const r=(i=e.groupByColumns)==null?void 0:i[0];return{...e,groupByColumns:[t],sortByColumns:(a=e.sortByColumns)==null?void 0:a.map(d=>r&&Ve(d,r)?{...t,role:"sortby",direction:d.direction}:d)}}function ve(e,t){return`${e}-${t}`}const Me="CONTROL_PLACEHOLDER_QUOTED",Q="CONTROL_REFERENCE_MISSING",K="CONTROL_VALUE_MISSING",Fe="CONTROL_VALUE_INVALID",Ue="CONTROL_CONTEXT_UNSUPPORTED",J="CONTROL_DEFINITION_DUPLICATE",ee="CONTROL_DEFINITION_INVALID",V="CONTROL_BINDING_MAPPING_MISSING",te="CONTROL_BINDING_TARGET_INVALID",F="CONTROL_BINDING_VALUE_INVALID";class O extends Error{constructor(o,r){super(o);v(this,"status",400);v(this,"details");Object.setPrototypeOf(this,O.prototype),this.name="ControlResolutionError",this.details=r}}function B(e,t){const o=new Map;for(const r of[...e,...t]){if(!r||typeof r!="object"||typeof r.id!="string"||r.id.trim().length===0)throw new O("Malformed control definition was provided for query execution.",{code:ee});if(o.get(r.id))throw new O(`Duplicate control definition '${r.id}' was provided for query execution.`,{code:J,controlId:r.id});o.set(r.id,r)}return o}const Be=/^-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;function Ge(e){switch(e.source.kind){case"manual":return e.source.options.map(t=>t.value);case"field_allowlist":return e.source.fieldIds;case"metric_allowlist":return e.source.metricIds;case"dataset_values":return null;default:return null}}function D(e){return`${e.label||e.id} (${e.id})`}function Pe(e){return e.type==="field_selector"||e.type==="metric_selector"||e.type==="aggregation_selector"||e.type==="grain_selector"}function j(e,t){const o=Ge(e);if(!(!o||o.length===0)&&!o.includes(t))throw new Error(`Control ${D(e)} received unsupported value '${t}'.`)}function re(e,t){switch(e.type){case"enum":case"field_selector":case"metric_selector":case"aggregation_selector":case"grain_selector":{if(typeof t!="string"||t.trim().length===0)throw new Error(`Control ${D(e)} requires a non-empty string value.`);return Pe(e)&&t===L.CONTROL_CARD_DEFAULT_VALUE||j(e,t),t}case"multi_enum":{if(!Array.isArray(t))throw new Error(`Control ${D(e)} requires a non-empty array value.`);if(t.length===0){if(!e.requiredAtExecution)return;throw new Error(`Control ${D(e)} requires a non-empty array value.`)}for(const o of t){if(typeof o!="string"||o.trim().length===0)throw new Error(`Control ${D(e)} requires string array values.`);j(e,o)}return t}case"text":{if(typeof t!="string")throw new Error(`Control ${D(e)} requires a string value.`);return t}case"number":{if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&Be.test(t.trim()))return Number(t);throw new Error(`Control ${D(e)} requires a numeric value.`)}case"boolean":{if(typeof t!="boolean")throw new Error(`Control ${D(e)} requires a boolean value.`);return t}case"date":{if(t instanceof Date&&!Number.isNaN(t.getTime()))return t;if(typeof t=="string"&&t.trim().length>0){const o=t.trim(),r=X(o);if(!Number.isNaN(r.getTime()))return o}throw new Error(`Control ${D(e)} requires a date-compatible value.`)}default:return t}}function G(e){var i;const t=e.definitions.get(e.binding.controlId);if(!t)throw new O(`Binding references unknown control '${e.binding.controlId}'.`,{code:Q,controlId:e.binding.controlId});if(!Object.prototype.hasOwnProperty.call(e.controlValues||{},e.binding.controlId)){if(!t.requiredAtExecution)return;throw new O(`Control '${e.binding.controlId}' must resolve to a concrete value before query execution.`,{code:K,controlId:e.binding.controlId})}let r;try{r=re(t,(i=e.controlValues)==null?void 0:i[e.binding.controlId])}catch(a){const d=a instanceof Error?a.message:String(a);throw new O(d,{code:F,controlId:e.binding.controlId})}if(typeof r=="string"&&r.trim().length>0)return r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(r instanceof Date&&!Number.isNaN(r.getTime()))return r.toISOString();throw new O(`Binding control '${e.binding.controlId}' must resolve to a single scalar value.`,{code:F,controlId:e.binding.controlId})}function U(e){const t=e.binding.mapping[e.selectedValue];if(typeof t=="string"&&t.trim().length>0)return t;throw new O(`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}'.`,{code:V,controlId:e.binding.controlId})}function oe(e){const t=e.binding.mapping[e.selectedValue];if(t&&typeof t=="object"&&"role"in t&&t.role==="groupby")return t;throw new O(`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}' to a valid group-by field.`,{code:V,controlId:e.binding.controlId})}function ne(e){const t=e.binding.mapping[e.selectedValue];if(t&&typeof t=="object"&&"role"in t&&t.role==="metric")return t;throw new O(`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}' to a valid metric field.`,{code:V,controlId:e.binding.controlId})}function ie(e,t,o){if(_.shouldDropInheritedCalculationAggregate(_.getCalculatedFieldComputeStage(t),e.aggregateOrigin))return{aggregate:void 0,aggregateOrigin:void 0};const r=o==="selection"&&e.role==="metric"?t.aggregate:void 0;return{aggregate:e.aggregate??r,aggregateOrigin:e.aggregate?e.aggregateOrigin:r?t.aggregateOrigin:void 0}}function ae(e,t,o){var r,i,a,d,u,g;if(o==="domain")return{filters:(r=t.parameters)==null?void 0:r.filters,windowTransform:(i=e.parameters)==null?void 0:i.windowTransform};if(!(!e.parameters&&!t.parameters))return{filters:((a=e.parameters)==null?void 0:a.filters)??((d=t.parameters)==null?void 0:d.filters),windowTransform:((u=e.parameters)==null?void 0:u.windowTransform)??((g=t.parameters)==null?void 0:g.windowTransform)}}function $e(e,t,o){const r=e;return{id:e.id,role:e.role,...o==="selection"&&e.alias?{alias:e.alias}:{},granularity:e.granularity??t.granularity,dateFormat:e.dateFormat,customFormat:e.customFormat,semanticTemporalPresentation:t.semanticTemporalPresentation||e.semanticTemporalPresentation,...ie(e,t,o),...e.role==="metric"?{aliasTemplate:r.aliasTemplate,valueAliases:r.valueAliases,comparison:r.comparison,comparisonPolarity:r.comparisonPolarity,parameters:ae(r,t,"domain")}:{},...se(e)}}function se(e){const t={...e.labelOrigin==="override"?{label:e.label,labelOrigin:e.labelOrigin}:{},...e.formatOrigin==="override"?{format:e.format,formatOrigin:e.formatOrigin}:{}};switch(e.role){case"pivotby":return{...t,memberOrder:e.memberOrder};case"sortby":return{...t,direction:e.direction};case"detail":return{...t,...e.dateFormat!==void 0?{dateFormat:e.dateFormat}:{},...e.customFormat!==void 0?{customFormat:e.customFormat}:{}};default:return t}}const qe=new Set(["day","week","month","quarter","year","hour","minute","second"]);function ke(e){let t=e.spec;const o=B(e.controlDefinitions||[],e.cardControlDefinitions||[]),r=(e.controlBindings||[]).filter(n=>n.target!=="sql_param"),i=r.filter(n=>n.target==="config_metric_selector"||n.target==="config_field_selector"),a=r.filter(n=>n.target==="config_grain"||n.target==="config_aggregation"),d=new Set,u=new Map;let g;const R=()=>{if(g)return g;const n=e.catalog,c=new Map;for(const l of n){const f=c.get(l.id)??[];c.set(l.id,[...f,l])}return g={refs:n,byId:c},g},y=(n,c)=>{throw new O(n,{code:te,...c?{controlId:c}:{}})},x=(n,c)=>{var f;if(n.derivedField)return n.derivedField.dataType;const l=R().refs.filter(C=>C.field.name===n.name&&_.semaphorSourcesReferToSameDataset(C.field.source??e.spec.source,n.source??e.spec.source));return l.length>1?y("The selected field is ambiguous in the authorized Matrix field catalog.",c):_.normalizeAnalyticsCatalogDataType(((f=l[0])==null?void 0:f.field.dataType)??n.dataType)},P=(n,c)=>Y.getMatrixBindingTargets(n,c.target,l=>x(l,c.controlId)),T=_.matrixSpecSchema.safeParse(t);if(!T.success)return y(T.error.message);t=T.data;const le=[...i,...a].map(n=>{const c=G({binding:n,definitions:o,controlValues:e.controlValues}),l=!n.matrixTargetId&&c!==void 0&&c!==L.CONTROL_CARD_DEFAULT_VALUE?P(T.data,n):[];return{binding:n,selectedValue:c,targetId:n.matrixTargetId??(l.length===1?l[0].id:void 0)}});for(const{binding:n,targetId:c,selectedValue:l}of le){if(l===void 0||l===L.CONTROL_CARD_DEFAULT_VALUE)continue;const f=s=>y(s,n.controlId),C=n.target==="config_metric_selector"||n.target==="config_aggregation",de=P(t,n);(!c||!de.some(s=>s.id===c))&&f("Choose a valid Matrix level or measure target for this control.");const $=`${n.target}:${c}`;d.has($)&&f("Multiple controls cannot replace the same Matrix target."),d.add($);const q=s=>{const m=(R().byId.get(s.id)??[]).filter(N=>!s.source||_.semaphorSourcesReferToSameDataset(s.source,N.field.source??e.spec.source));if(m.length!==1)return f(m.length?"The selected field is ambiguous in the authorized Matrix field catalog.":"The selected field is not in the authorized Matrix field catalog.");const p=_.matrixFieldSchema.safeParse(m[0].field);return p.success?p.data:f(p.error.message)},h=n.target==="config_metric_selector"||n.target==="config_field_selector"?n.mapping[l]:void 0,E=h&&typeof h=="object"&&"kind"in h&&h.kind==="matrix_instance"?h.id:void 0;if(C){u.set(c,n.controlId);const s=E===void 0?void 0:T.data.measures.find(I=>I.id===E&&I.kind==="aggregate");E!==void 0&&!s&&f("The selected Matrix aggregate measure is no longer available.");const m=n.target==="config_metric_selector"&&!s?ne({binding:n,selectedValue:l}):void 0,p=((s==null?void 0:s.kind)==="aggregate"?s.aggregate:m==null?void 0:m.aggregate)??(n.target==="config_aggregation"?U({binding:n,selectedValue:l}):void 0),N=p===void 0?void 0:_.matrixAggregateSchema.safeParse(p);N&&!N.success&&f("This aggregation is not supported by Matrix."),t={...t,measures:t.measures.map(I=>I.id!==c||I.kind!=="aggregate"?I:{...I,...m?{field:q(m)}:{},...(s==null?void 0:s.kind)==="aggregate"?{field:s.field}:{},aggregate:N!=null&&N.success?N.data:I.aggregate})}}else{const s=E===void 0?void 0:[...T.data.rows,...T.data.columns].find(I=>I.id===E);E!==void 0&&!s&&f("The selected Matrix level is no longer available.");const m=n.target==="config_field_selector"&&!s?oe({binding:n,selectedValue:l}):void 0,p=n.target==="config_grain"?U({binding:n,selectedValue:l}):s?s.grain:m==null?void 0:m.granularity;p!==void 0&&!qe.has(p)&&f("This time grain is not supported by Matrix.");const N=I=>I.map(A=>{if(A.id!==c)return A;const k=(s==null?void 0:s.field)??(m?q(m):A.field),H=x(k,n.controlId),z=p??(m&&_.isAnalyticsDateLikeDataType(H)?A.grain:void 0);return z&&!_.isAnalyticsDateLikeDataType(H)&&f("A time grain requires a temporal Matrix level."),{...A,field:k,grain:z}});t={...t,rows:N(t.rows),columns:N(t.columns)}}}for(const[n,c]of Array.from(u)){const l=t.measures.find(C=>C.id===n);if(!l||l.kind!=="aggregate")continue;const f=x(l.field,c);fe.getFieldAggregationOptions(f).some(C=>C.value===l.aggregate)||y(`Aggregation '${l.aggregate}' is not eligible for this Matrix field datatype.`,c)}try{return Y.reconcileMatrixSpecStructure(T.data,t)}catch(n){if(n instanceof me.ZodError)return y(n.message);throw n}}function ce(e,t){const o=[],r=i=>{if(i.source){const a=_.configSourceRefSchema.safeParse(i.source);if(a.success)o.push(a.data);else if(t)throw a.error}i.derivedField&&Object.values(i.derivedField.inputs).forEach(a=>r(a.field))};for(const i of e){if(i.target!=="config_field_selector"&&i.target!=="config_metric_selector")continue;const a=t==null?void 0:t.get(i),d=t?a&&a!==L.CONTROL_CARD_DEFAULT_VALUE?[i.mapping[a]]:[]:Object.values(i.mapping);for(const u of d)u&&"role"in u&&r(u)}return o}function He(e,t=[],o=[]){return _.mergeSemaphorSourcesByIdentity([...Z.matrixDefinitionSources(e),...ce(t),...o])}function ze(e,t={}){const o=t.controlBindings??[],r=B(t.controlDefinitions??[],t.cardControlDefinitions??[]),i=new Map(o.filter(a=>a.target==="config_field_selector"||a.target==="config_metric_selector").map(a=>[a,G({binding:a,definitions:r,controlValues:t.controlValues})]));return _.mergeSemaphorSourcesByIdentity([...Z.matrixDefinitionSources(e),...ce(o,i)])}exports.CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE=V;exports.CONTROL_BINDING_TARGET_INVALID_ERROR_CODE=te;exports.CONTROL_BINDING_VALUE_INVALID_ERROR_CODE=F;exports.CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE=Ue;exports.CONTROL_DEFINITION_DUPLICATE_ERROR_CODE=J;exports.CONTROL_DEFINITION_INVALID_ERROR_CODE=ee;exports.CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE=Me;exports.CONTROL_REFERENCE_MISSING_ERROR_CODE=Q;exports.CONTROL_VALUE_INVALID_ERROR_CODE=Fe;exports.CONTROL_VALUE_MISSING_ERROR_CODE=K;exports.ControlResolutionError=O;exports.DASHBOARD_AUTHORING_BREAKPOINTS=Le;exports.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS=be;exports.applyGroupByOverride=xe;exports.buildControlDefinitionIndex=B;exports.getCalculatedFieldAggregateOverrides=ie;exports.getCalculatedFieldParameters=ae;exports.getCalculatedFieldShelfOverrides=se;exports.getColumnCatalogFieldId=ve;exports.getDomainCalculatedSelectionOverrides=$e;exports.matrixCatalogSources=He;exports.matrixExecutionSources=ze;exports.parseISO=X;exports.resolveBindingControlValue=G;exports.resolveGroupByFieldTarget=oe;exports.resolveMatrixControlBindings=ke;exports.resolveMetricFieldTarget=ne;exports.resolveScalarMappedValue=U;exports.validateControlValue=re;
|
package/dist/chunks/{matrix-control-sources-BxKH2yu2.js → matrix-control-sources-KbZe1gj_.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var te = Object.defineProperty;
|
|
2
2
|
var re = (e, t, o) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
3
|
var x = (e, t, o) => re(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
-
import { h as oe, f as ne, U as ie, F as ae,
|
|
4
|
+
import { h as oe, f as ne, U as ie, F as ae, a$ as G, G as se, an as P, al as ce, u as j, a0 as le } from "./validators-CsdOtZI6.js";
|
|
5
5
|
import { C as A } from "./common-types-C6cAQgyh.js";
|
|
6
|
-
import "./matrix-operation-contract-
|
|
7
|
-
import { v as de, y as ue } from "./calculated-field-identity-
|
|
8
|
-
import {
|
|
6
|
+
import "./matrix-operation-contract-D32U2CSw.js";
|
|
7
|
+
import { v as de, y as ue } from "./calculated-field-identity-DzJBs2J8.js";
|
|
8
|
+
import { B as ge } from "./field-aggregations-Dl2A3rbV.js";
|
|
9
9
|
import { ZodError as fe } from "zod";
|
|
10
|
-
import { a as H } from "./matrix-card-
|
|
10
|
+
import { a as H } from "./matrix-card-CIlz0Dnp.js";
|
|
11
11
|
import { m as Y, a as Z } from "./constants-DeLIHVAW.js";
|
|
12
12
|
function me(e, t) {
|
|
13
13
|
const r = Ne(e);
|
|
@@ -44,7 +44,7 @@ const b = {
|
|
|
44
44
|
dateTimeDelimiter: /[T ]/,
|
|
45
45
|
timeZoneDelimiter: /[Z ]/i,
|
|
46
46
|
timezone: /([Z+-].*)$/
|
|
47
|
-
}, pe = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,
|
|
47
|
+
}, pe = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Ie = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, _e = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
48
48
|
function Ne(e) {
|
|
49
49
|
const t = {}, o = e.split(b.dateTimeDelimiter);
|
|
50
50
|
let r;
|
|
@@ -86,17 +86,17 @@ function R(e) {
|
|
|
86
86
|
return e ? parseInt(e) : 1;
|
|
87
87
|
}
|
|
88
88
|
function De(e) {
|
|
89
|
-
const t = e.match(
|
|
89
|
+
const t = e.match(Ie);
|
|
90
90
|
if (!t) return NaN;
|
|
91
|
-
const o =
|
|
91
|
+
const o = L(t[1]), r = L(t[2]), i = L(t[3]);
|
|
92
92
|
return be(o, r, i) ? o * Y + r * Z + i * 1e3 : NaN;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function L(e) {
|
|
95
95
|
return e && parseFloat(e.replace(",", ".")) || 0;
|
|
96
96
|
}
|
|
97
97
|
function he(e) {
|
|
98
98
|
if (e === "Z") return 0;
|
|
99
|
-
const t = e.match(
|
|
99
|
+
const t = e.match(_e);
|
|
100
100
|
if (!t) return 0;
|
|
101
101
|
const o = t[1] === "+" ? -1 : 1, r = parseInt(t[2]), i = t[3] && parseInt(t[3]) || 0;
|
|
102
102
|
return Ae(r, i) ? o * (r * Y + i * Z) : NaN;
|
|
@@ -166,30 +166,30 @@ function ot(e, t, o) {
|
|
|
166
166
|
function nt(e, t) {
|
|
167
167
|
return `${e}-${t}`;
|
|
168
168
|
}
|
|
169
|
-
const it = "CONTROL_PLACEHOLDER_QUOTED", xe = "CONTROL_REFERENCE_MISSING",
|
|
170
|
-
class
|
|
169
|
+
const it = "CONTROL_PLACEHOLDER_QUOTED", xe = "CONTROL_REFERENCE_MISSING", Le = "CONTROL_VALUE_MISSING", at = "CONTROL_VALUE_INVALID", st = "CONTROL_CONTEXT_UNSUPPORTED", ve = "CONTROL_DEFINITION_DUPLICATE", Ve = "CONTROL_DEFINITION_INVALID", v = "CONTROL_BINDING_MAPPING_MISSING", Me = "CONTROL_BINDING_TARGET_INVALID", q = "CONTROL_BINDING_VALUE_INVALID";
|
|
170
|
+
class I extends Error {
|
|
171
171
|
constructor(o, r) {
|
|
172
172
|
super(o);
|
|
173
173
|
x(this, "status", 400);
|
|
174
174
|
x(this, "details");
|
|
175
|
-
Object.setPrototypeOf(this,
|
|
175
|
+
Object.setPrototypeOf(this, I.prototype), this.name = "ControlResolutionError", this.details = r;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
function X(e, t) {
|
|
179
179
|
const o = /* @__PURE__ */ new Map();
|
|
180
180
|
for (const r of [...e, ...t]) {
|
|
181
181
|
if (!r || typeof r != "object" || typeof r.id != "string" || r.id.trim().length === 0)
|
|
182
|
-
throw new
|
|
182
|
+
throw new I(
|
|
183
183
|
"Malformed control definition was provided for query execution.",
|
|
184
184
|
{
|
|
185
185
|
code: Ve
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
if (o.get(r.id))
|
|
189
|
-
throw new
|
|
189
|
+
throw new I(
|
|
190
190
|
`Duplicate control definition '${r.id}' was provided for query execution.`,
|
|
191
191
|
{
|
|
192
|
-
code:
|
|
192
|
+
code: ve,
|
|
193
193
|
controlId: r.id
|
|
194
194
|
}
|
|
195
195
|
);
|
|
@@ -218,7 +218,7 @@ function T(e) {
|
|
|
218
218
|
function $e(e) {
|
|
219
219
|
return e.type === "field_selector" || e.type === "metric_selector" || e.type === "aggregation_selector" || e.type === "grain_selector";
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function k(e, t) {
|
|
222
222
|
const o = Ue(e);
|
|
223
223
|
if (!(!o || o.length === 0) && !o.includes(t))
|
|
224
224
|
throw new Error(
|
|
@@ -236,7 +236,7 @@ function Be(e, t) {
|
|
|
236
236
|
throw new Error(
|
|
237
237
|
`Control ${T(e)} requires a non-empty string value.`
|
|
238
238
|
);
|
|
239
|
-
return $e(e) && t === A ||
|
|
239
|
+
return $e(e) && t === A || k(e, t), t;
|
|
240
240
|
}
|
|
241
241
|
case "multi_enum": {
|
|
242
242
|
if (!Array.isArray(t))
|
|
@@ -255,7 +255,7 @@ function Be(e, t) {
|
|
|
255
255
|
throw new Error(
|
|
256
256
|
`Control ${T(e)} requires string array values.`
|
|
257
257
|
);
|
|
258
|
-
|
|
258
|
+
k(e, o);
|
|
259
259
|
}
|
|
260
260
|
return t;
|
|
261
261
|
}
|
|
@@ -302,7 +302,7 @@ function Q(e) {
|
|
|
302
302
|
var i;
|
|
303
303
|
const t = e.definitions.get(e.binding.controlId);
|
|
304
304
|
if (!t)
|
|
305
|
-
throw new
|
|
305
|
+
throw new I(
|
|
306
306
|
`Binding references unknown control '${e.binding.controlId}'.`,
|
|
307
307
|
{
|
|
308
308
|
code: xe,
|
|
@@ -315,10 +315,10 @@ function Q(e) {
|
|
|
315
315
|
)) {
|
|
316
316
|
if (!t.requiredAtExecution)
|
|
317
317
|
return;
|
|
318
|
-
throw new
|
|
318
|
+
throw new I(
|
|
319
319
|
`Control '${e.binding.controlId}' must resolve to a concrete value before query execution.`,
|
|
320
320
|
{
|
|
321
|
-
code:
|
|
321
|
+
code: Le,
|
|
322
322
|
controlId: e.binding.controlId
|
|
323
323
|
}
|
|
324
324
|
);
|
|
@@ -331,8 +331,8 @@ function Q(e) {
|
|
|
331
331
|
);
|
|
332
332
|
} catch (a) {
|
|
333
333
|
const d = a instanceof Error ? a.message : String(a);
|
|
334
|
-
throw new
|
|
335
|
-
code:
|
|
334
|
+
throw new I(d, {
|
|
335
|
+
code: q,
|
|
336
336
|
controlId: e.binding.controlId
|
|
337
337
|
});
|
|
338
338
|
}
|
|
@@ -342,10 +342,10 @@ function Q(e) {
|
|
|
342
342
|
return String(r);
|
|
343
343
|
if (r instanceof Date && !Number.isNaN(r.getTime()))
|
|
344
344
|
return r.toISOString();
|
|
345
|
-
throw new
|
|
345
|
+
throw new I(
|
|
346
346
|
`Binding control '${e.binding.controlId}' must resolve to a single scalar value.`,
|
|
347
347
|
{
|
|
348
|
-
code:
|
|
348
|
+
code: q,
|
|
349
349
|
controlId: e.binding.controlId
|
|
350
350
|
}
|
|
351
351
|
);
|
|
@@ -354,10 +354,10 @@ function z(e) {
|
|
|
354
354
|
const t = e.binding.mapping[e.selectedValue];
|
|
355
355
|
if (typeof t == "string" && t.trim().length > 0)
|
|
356
356
|
return t;
|
|
357
|
-
throw new
|
|
357
|
+
throw new I(
|
|
358
358
|
`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}'.`,
|
|
359
359
|
{
|
|
360
|
-
code:
|
|
360
|
+
code: v,
|
|
361
361
|
controlId: e.binding.controlId
|
|
362
362
|
}
|
|
363
363
|
);
|
|
@@ -366,10 +366,10 @@ function Ge(e) {
|
|
|
366
366
|
const t = e.binding.mapping[e.selectedValue];
|
|
367
367
|
if (t && typeof t == "object" && "role" in t && t.role === "groupby")
|
|
368
368
|
return t;
|
|
369
|
-
throw new
|
|
369
|
+
throw new I(
|
|
370
370
|
`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}' to a valid group-by field.`,
|
|
371
371
|
{
|
|
372
|
-
code:
|
|
372
|
+
code: v,
|
|
373
373
|
controlId: e.binding.controlId
|
|
374
374
|
}
|
|
375
375
|
);
|
|
@@ -378,15 +378,15 @@ function Pe(e) {
|
|
|
378
378
|
const t = e.binding.mapping[e.selectedValue];
|
|
379
379
|
if (t && typeof t == "object" && "role" in t && t.role === "metric")
|
|
380
380
|
return t;
|
|
381
|
-
throw new
|
|
381
|
+
throw new I(
|
|
382
382
|
`Binding for control '${e.binding.controlId}' does not map value '${e.selectedValue}' to a valid metric field.`,
|
|
383
383
|
{
|
|
384
|
-
code:
|
|
384
|
+
code: v,
|
|
385
385
|
controlId: e.binding.controlId
|
|
386
386
|
}
|
|
387
387
|
);
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function qe(e, t, o) {
|
|
390
390
|
if (oe(
|
|
391
391
|
ne(t),
|
|
392
392
|
e.aggregateOrigin
|
|
@@ -398,7 +398,7 @@ function ke(e, t, o) {
|
|
|
398
398
|
aggregateOrigin: e.aggregate ? e.aggregateOrigin : r ? t.aggregateOrigin : void 0
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function ke(e, t, o) {
|
|
402
402
|
var r, i, a, d, u, g;
|
|
403
403
|
if (o === "domain")
|
|
404
404
|
return {
|
|
@@ -423,13 +423,13 @@ function ct(e, t, o) {
|
|
|
423
423
|
dateFormat: e.dateFormat,
|
|
424
424
|
customFormat: e.customFormat,
|
|
425
425
|
semanticTemporalPresentation: t.semanticTemporalPresentation || e.semanticTemporalPresentation,
|
|
426
|
-
...
|
|
426
|
+
...qe(e, t, o),
|
|
427
427
|
...e.role === "metric" ? {
|
|
428
428
|
aliasTemplate: r.aliasTemplate,
|
|
429
429
|
valueAliases: r.valueAliases,
|
|
430
430
|
comparison: r.comparison,
|
|
431
431
|
comparisonPolarity: r.comparisonPolarity,
|
|
432
|
-
parameters:
|
|
432
|
+
parameters: ke(
|
|
433
433
|
r,
|
|
434
434
|
t,
|
|
435
435
|
"domain"
|
|
@@ -496,7 +496,7 @@ function lt(e) {
|
|
|
496
496
|
}
|
|
497
497
|
return g = { refs: n, byId: c }, g;
|
|
498
498
|
}, C = (n, c) => {
|
|
499
|
-
throw new
|
|
499
|
+
throw new I(n, {
|
|
500
500
|
code: Me,
|
|
501
501
|
...c ? { controlId: c } : {}
|
|
502
502
|
});
|
|
@@ -524,7 +524,7 @@ function lt(e) {
|
|
|
524
524
|
const M = `${n.target}:${c}`;
|
|
525
525
|
d.has(M) && f("Multiple controls cannot replace the same Matrix target."), d.add(M);
|
|
526
526
|
const F = (s) => {
|
|
527
|
-
const m = (O().byId.get(s.id) ?? []).filter((
|
|
527
|
+
const m = (O().byId.get(s.id) ?? []).filter((_) => !s.source || G(s.source, _.field.source ?? e.spec.source));
|
|
528
528
|
if (m.length !== 1) return f(m.length ? "The selected field is ambiguous in the authorized Matrix field catalog." : "The selected field is not in the authorized Matrix field catalog.");
|
|
529
529
|
const N = se.safeParse(m[0].field);
|
|
530
530
|
return N.success ? N.data : f(N.error.message);
|
|
@@ -535,15 +535,15 @@ function lt(e) {
|
|
|
535
535
|
(p) => p.id === y && p.kind === "aggregate"
|
|
536
536
|
);
|
|
537
537
|
y !== void 0 && !s && f("The selected Matrix aggregate measure is no longer available.");
|
|
538
|
-
const m = n.target === "config_metric_selector" && !s ? Pe({ binding: n, selectedValue: l }) : void 0, N = ((s == null ? void 0 : s.kind) === "aggregate" ? s.aggregate : m == null ? void 0 : m.aggregate) ?? (n.target === "config_aggregation" ? z({ binding: n, selectedValue: l }) : void 0),
|
|
539
|
-
|
|
538
|
+
const m = n.target === "config_metric_selector" && !s ? Pe({ binding: n, selectedValue: l }) : void 0, N = ((s == null ? void 0 : s.kind) === "aggregate" ? s.aggregate : m == null ? void 0 : m.aggregate) ?? (n.target === "config_aggregation" ? z({ binding: n, selectedValue: l }) : void 0), _ = N === void 0 ? void 0 : ae.safeParse(N);
|
|
539
|
+
_ && !_.success && f("This aggregation is not supported by Matrix."), t = {
|
|
540
540
|
...t,
|
|
541
541
|
measures: t.measures.map(
|
|
542
542
|
(p) => p.id !== c || p.kind !== "aggregate" ? p : {
|
|
543
543
|
...p,
|
|
544
544
|
...m ? { field: F(m) } : {},
|
|
545
545
|
...(s == null ? void 0 : s.kind) === "aggregate" ? { field: s.field } : {},
|
|
546
|
-
aggregate:
|
|
546
|
+
aggregate: _ != null && _.success ? _.data : p.aggregate
|
|
547
547
|
}
|
|
548
548
|
)
|
|
549
549
|
};
|
|
@@ -554,15 +554,15 @@ function lt(e) {
|
|
|
554
554
|
y !== void 0 && !s && f("The selected Matrix level is no longer available.");
|
|
555
555
|
const m = n.target === "config_field_selector" && !s ? Ge({ binding: n, selectedValue: l }) : void 0, N = n.target === "config_grain" ? z({ binding: n, selectedValue: l }) : s ? s.grain : m == null ? void 0 : m.granularity;
|
|
556
556
|
N !== void 0 && !je.has(N) && f("This time grain is not supported by Matrix.");
|
|
557
|
-
const
|
|
557
|
+
const _ = (p) => p.map((E) => {
|
|
558
558
|
if (E.id !== c) return E;
|
|
559
559
|
const U = (s == null ? void 0 : s.field) ?? (m ? F(m) : E.field), $ = S(U, n.controlId), B = N ?? (m && P($) ? E.grain : void 0);
|
|
560
560
|
return B && !P($) && f("A time grain requires a temporal Matrix level."), { ...E, field: U, grain: B };
|
|
561
561
|
});
|
|
562
562
|
t = {
|
|
563
563
|
...t,
|
|
564
|
-
rows:
|
|
565
|
-
columns:
|
|
564
|
+
rows: _(t.rows),
|
|
565
|
+
columns: _(t.columns)
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
568
|
}
|
|
@@ -611,25 +611,25 @@ export {
|
|
|
611
611
|
ut as b,
|
|
612
612
|
ot as c,
|
|
613
613
|
xe as d,
|
|
614
|
-
|
|
614
|
+
Le as e,
|
|
615
615
|
at as f,
|
|
616
616
|
nt as g,
|
|
617
617
|
st as h,
|
|
618
|
-
|
|
618
|
+
ve as i,
|
|
619
619
|
Ve as j,
|
|
620
|
-
|
|
620
|
+
v as k,
|
|
621
621
|
Me as l,
|
|
622
622
|
dt as m,
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
q as n,
|
|
624
|
+
I as o,
|
|
625
625
|
X as p,
|
|
626
626
|
z as q,
|
|
627
627
|
Q as r,
|
|
628
628
|
Ge as s,
|
|
629
629
|
Pe as t,
|
|
630
|
-
|
|
630
|
+
qe as u,
|
|
631
631
|
Be as v,
|
|
632
|
-
|
|
632
|
+
ke as w,
|
|
633
633
|
ct as x,
|
|
634
634
|
ze as y,
|
|
635
635
|
lt as z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./validators-
|
|
1
|
+
"use strict";const i=require("./validators-DFeDcdpA.cjs");function d(e,t){return t.levelLabels[e.id]??e.field.label??e.field.name}function p(e,t){return t.measureLabels[e.id]??(e.kind==="aggregate"?e.field.label??e.field.name:e.definition.label)}function x(e){return i.matrixConfigSchema.parse(m(e))}function m(e){const t=i.matrixAuthoringSpecSchema.parse(e),n=a=>({grand:{visible:!0,position:"after"},levels:Object.fromEntries(a.map(r=>[r.id,{visible:!0,position:"before"}]))});return i.matrixAuthoringConfigSchema.parse({version:1,spec:t,presentation:{layout:{kind:"compact"},absence:{emptyText:"—",nullText:""},levelLabels:{},measureLabels:{},levelFormats:{},measureFormats:{},totals:{rows:n(t.rows),columns:n(t.columns)}},defaultView:{rows:{depth:0,overrides:[]},columns:{depth:t.columns.length>1?1:0,overrides:[]}}})}function f(e,t){const n=new Map(e.map(a=>[i.matrixSortKey(a),a]));for(const a of t??[])n.set(i.matrixSortKey(a),a);return[...n.values()]}function g(e){const{spec:t,presentation:n,defaults:a,session:r}=i.matrixDefinitionInputSchema.parse(e),c=new Map(f(t.sorts,r==null?void 0:r.sorts).map(o=>[i.matrixSortKey(o),o]));for(const o of["rows","columns"])for(const l of t[o]){const s={axis:o,levelId:l.id,scope:{kind:"level"},target:{kind:"member"},direction:"asc",nulls:"last"};c.has(i.matrixSortKey(s))||c.set(i.matrixSortKey(s),s)}const u=(o,l)=>({depth:Math.min(o.depth,Math.max(0,l-1)),overrides:o.overrides.filter(s=>s.path.length<l)});return{spec:{...t,sorts:[...c.values()]},presentation:n,view:{rows:u((r==null?void 0:r.rows)??a.rows,t.rows.length),columns:u((r==null?void 0:r.columns)??a.columns,t.columns.length),sorts:(r==null?void 0:r.sorts)??[]}}}exports.createMatrixAuthoringDraft=m;exports.createMatrixConfig=x;exports.getMatrixLevelLabel=d;exports.getMatrixMeasureLabel=p;exports.mergeMatrixSorts=f;exports.resolveMatrixDefinition=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const b=require("./validators-DFeDcdpA.cjs");require("./matrix-operation-contract-0RxoU_M3.cjs");const c=require("./semantic-format-mVI32OJH.cjs"),v=require("./index-Cw2ypaFl.cjs"),y=require("./raw-temporal-eJXecCyJ.cjs"),T=require("./constants-B00YUv89.cjs"),w=require("./temporal-bucket-4YEPEKlJ.cjs");function p(t,e){const n=c.toDate(t),s=c.toDate(e),r=n.getTime()-s.getTime();return r<0?-1:r>0?1:r}function R(t){return c.constructFrom(t,Date.now())}function z(t,e){const n=c.toDate(t),s=c.toDate(e),r=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return r*12+o}function O(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function S(t,e){return+c.toDate(t)-+c.toDate(e)}function Z(t){const e=c.toDate(t);return e.setHours(23,59,59,999),e}function k(t){const e=c.toDate(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function V(t){const e=c.toDate(t);return+Z(e)==+k(e)}function X(t,e){const n=c.toDate(t),s=c.toDate(e),r=p(n,s),o=Math.abs(z(n,s));let f;if(o<1)f=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*o);let a=p(n,s)===-r;V(c.toDate(t))&&o===1&&p(t,s)===1&&(a=!1),f=r*(o-Number(a))}return f===0?0:f}function q(t,e,n){const s=S(t,e)/1e3;return O(n==null?void 0:n.roundingMethod)(s)}function E(t,e,n){const s=c.getDefaultOptions(),r=(n==null?void 0:n.locale)??s.locale??c.enUS,o=2520,f=p(t,e);if(isNaN(f))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:f});let D,i;f>0?(D=c.toDate(e),i=c.toDate(t)):(D=c.toDate(t),i=c.toDate(e));const m=q(i,D),l=(c.getTimezoneOffsetInMilliseconds(i)-c.getTimezoneOffsetInMilliseconds(D))/1e3,u=Math.round((m-l)/60);let h;if(u<2)return n!=null&&n.includeSeconds?m<5?r.formatDistance("lessThanXSeconds",5,a):m<10?r.formatDistance("lessThanXSeconds",10,a):m<20?r.formatDistance("lessThanXSeconds",20,a):m<40?r.formatDistance("halfAMinute",0,a):m<60?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",1,a):u===0?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",u,a);if(u<45)return r.formatDistance("xMinutes",u,a);if(u<90)return r.formatDistance("aboutXHours",1,a);if(u<T.minutesInDay){const M=Math.round(u/60);return r.formatDistance("aboutXHours",M,a)}else{if(u<o)return r.formatDistance("xDays",1,a);if(u<T.minutesInMonth){const M=Math.round(u/T.minutesInDay);return r.formatDistance("xDays",M,a)}else if(u<T.minutesInMonth*2)return h=Math.round(u/T.minutesInMonth),r.formatDistance("aboutXMonths",h,a)}if(h=X(i,D),h<12){const M=Math.round(u/T.minutesInMonth);return r.formatDistance("xMonths",M,a)}else{const M=h%12,d=Math.trunc(h/12);return M<3?r.formatDistance("aboutXYears",d,a):M<9?r.formatDistance("overXYears",d,a):r.formatDistance("almostXYears",d+1,a)}}function L(t,e){return E(t,R(t),e)}function P(t,e){return t&&t!=="auto"?t:e}function $(t,e=new Date){try{const n={timeZone:t,timeZoneName:"short"},r=new Intl.DateTimeFormat("en-US",n).formatToParts(e).find(o=>o.type==="timeZoneName");return(r==null?void 0:r.value)||t}catch{return t}}function Y(t){try{const e={timeZone:t,timeZoneName:"long"},s=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(r=>r.type==="timeZoneName");return(s==null?void 0:s.value)||t}catch{return t}}function x(t,e="auto"){if(!t)return new Date(NaN);const n=t.endsWith("Z"),s=/[+-]\d{2}:?\d{2}$/.test(t),r=/\([A-Z]{3,4}\)$/.test(t);if(e==="auto")return n||s||r?new Date(t):new Date(t+"Z");if(e==="local"){if(n||s){const o=t.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(o)}return new Date(t)}else return e==="UTC"?n?new Date(t):s?new Date(t):new Date(t+"Z"):n||s||r?new Date(t):v.fromZonedTime(t,e)}const B="MM/dd/yyyy",N=(t,e,n,s="auto")=>{if(!t)return"";try{const r=x(t,s);if(isNaN(r.getTime()))return t;const f=(e&&e.trim()?e:B).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?c.formatInTimeZone(r,n,f):c.format(r,f)}catch(r){return console.error("Date formatting error:",r),t}},I=(t,e="auto")=>{if(!t)return"";try{const n=x(t,e);return isNaN(n.getTime())?t:L(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),t}};function j(t,e,n,s){const r=t instanceof Date?t.toISOString():String(t),o=(s==null?void 0:s.browserTimezone)||n,f=(s==null?void 0:s.isSqlCard)??!1;if(e!=null&&e.useRelativeTime)return I(r,(e==null?void 0:e.sourceTimezone)||"auto");const a=e!=null&&e.useCustomFormat&&(e!=null&&e.customFormat)?e.customFormat:(e==null?void 0:e.format)||"MM/dd/yyyy";return N(r,a,e!=null&&e.timezone&&(e==null?void 0:e.timezone)!=="auto"?e.timezone:f?o:n,(e==null?void 0:e.sourceTimezone)||"auto")}function g(t,e,n){var f,a;if(t==null)return t===null?((f=n.absence)==null?void 0:f.nullText)??"":((a=n.absence)==null?void 0:a.emptyText)??"";const s=b.isExactNumericValue(t)?t:void 0,r=s?s.value:t,o=s??(typeof t=="number"?t:void 0);if(!n.useFormattedValues||!e)return String(r);switch(e.type){case"number":return o!==void 0?y.formatNumberWithColumnSettings(o,e.numberFormat,n.locale):String(r);case"date":return j(r,e.dateFormat,n.timezone,{browserTimezone:n.browserTimezone,isSqlCard:n.isSqlCard});case"progress":return o!==void 0?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function H(t,e){return e.visibleColumns.map(n=>{const s=t[n],r=e.columnSettings[n];return g(s,r,{useFormattedValues:e.useFormattedValues,timezone:e.timezone,locale:e.locale})})}function _(t,e){var r;const n=t[t.length-1];if(!n)return"";if(n.member.kind==="others")return"Others";const s=n.member.value;return s===null?"(Blank)":((r=e==null?void 0:e.get(n.levelId))==null?void 0:r(s))??(typeof s=="object"?s.value:String(s))}function A(t,e,n){return t==="grand_total"?n??"Grand Total":t==="subtotal"?(n==null?void 0:n.split(b.MATRIX_TOTAL_MEMBER_PLACEHOLDER).join(e))??`${e} Total`:e}function U(t,e,n,s){var f;const r=t[t.length-1],o=e==="grand_total"?n.grand.label:r?(f=n.levels[r.levelId])==null?void 0:f.label:void 0;return A(e,_(t,s),o)}function W(t,e,n){return t.kind==="value"?(e==null?void 0:e(t.value))??"":t.kind==="null"?n.nullText:n.emptyText}function K(t){const{path:e,previousPath:n,role:s,repeatLabels:r,levelCount:o}=t;return Array.from({length:o},(f,a)=>{const D=e.slice(0,a+1),i=s==="grand_total"?a===0:s==="subtotal"&&a===e.length-1,m=n&&n.length>a&&b.matrixPathKey(n.slice(0,a+1))===b.matrixPathKey(D);return{path:D,total:i,visible:i||e.length>a&&(r||!m||a===e.length-1)}})}function C(t,e){return c.fromSemanticFormat(t??e,{preserveOmittedProperties:!0,numericInput:"canonical"})}function F(t,e,n){const s=new Map,r=(o,f)=>{const a=(f==="levels"?e.levelFormats:e.measureFormats)[o.id],D=o.semanticFormat,i=C(a,D);f==="measures"&&s.set(o.id,{isNumeric:b.normalizeAnalyticsCatalogDataType(o.column.dataType)==="number",hasTextAffixes:!!i&&!!("prefix"in i&&i.prefix||"suffix"in i&&i.suffix)});const m=l=>g(l,void 0,{useFormattedValues:!0,timezone:n.calendar.tz,locale:n.valueFormat.locale,absence:e.absence});if(o.column.temporalBucket){const l=o.column.temporalBucket,u=w.resolveTemporalBucketPresentation({metadata:l,cardFormat:(a==null?void 0:a.type)==="temporal_bucket"?a:void 0,semanticFormat:(D==null?void 0:D.type)==="temporal_bucket"?{granularity:l.granularity,format:D}:void 0,locale:n.valueFormat.locale,styles:{dateStyle:n.valueFormat.dateStyle,dateTime:n.valueFormat.dateTime}});return h=>typeof h=="string"?w.formatTemporalBucket({value:h,metadata:l,format:u.format}):m(h)}if(o.column.rawTemporal){const l=y.prepareRawTemporalFormatter({metadata:o.column.rawTemporal,format:y.resolveRawTemporalFormat({format:(i==null?void 0:i.type)==="date"?{type:"raw_temporal",timezone:i.timezone,sourceTimezone:i.sourceTimezone,presentation:i.pattern?{mode:"pattern",dialect:"semaphor_tokens",pattern:i.pattern}:{mode:"auto"}}:void 0,preferences:n.valueFormat,calendar:n.calendar})});return u=>{if(typeof u!="string")return m(u);const h=l(u);return h.ok?h.text:m(u)}}if(v.isNumericCanonicalFormat(i)){const l=y.resolveNumericPresentation(i,n.valueFormat);return u=>typeof u=="number"||typeof u=="object"&&u!==null?y.formatNumericCanonical(u,l):m(u)}return(i==null?void 0:i.type)==="duration"?l=>typeof l=="number"||typeof l=="string"||typeof l=="object"&&l!==null?y.formatDuration(typeof l=="object"?l.value:l,i):m(l):(i==null?void 0:i.type)==="string"?l=>l===null?m(l):`${i.prefix??""}${m(l)}${i.suffix??""}`:m};return{levels:new Map(t.levels.map(o=>[o.id,r(o,"levels")])),measures:new Map(t.measures.map(o=>[o.id,r(o,"measures")])),measureSemantics:s}}exports.formatCellValue=g;exports.formatDate=N;exports.formatDistanceToNow=L;exports.formatRelativeTime=I;exports.formatRowForExport=H;exports.getTimezoneAbbreviation=$;exports.getTimezoneName=Y;exports.matrixAxisLabel=U;exports.matrixCellText=W;exports.matrixLevelLabels=K;exports.matrixMemberLabel=_;exports.matrixTotalLabel=A;exports.parseWithSourceTimezone=x;exports.prepareMatrixFormatting=F;exports.resolveMatrixValueFormat=C;exports.resolveTimezone=P;
|