react-semaphor 0.1.506 → 0.1.508
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/DATA_APP_SDK.md +56 -0
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +194 -172
- package/dist/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/appearance-runtime/index.cjs +1 -1
- package/dist/appearance-runtime/index.js +1 -1
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +139 -119
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/appearance-context-DzqCdhB4.cjs +1 -0
- package/dist/chunks/{appearance-context-XviHOhWJ.js → appearance-context-VJdrKi7r.js} +2 -1
- package/dist/chunks/{appearance-runtime-provider-D0xVQWnH.js → appearance-runtime-provider-CC4HT2Gi.js} +2 -2
- package/dist/chunks/{appearance-runtime-provider-Ca8rxO86.cjs → appearance-runtime-provider-D5pkvgE4.cjs} +1 -1
- package/dist/chunks/calculated-field-identity-BiTGmnST.cjs +1 -0
- package/dist/chunks/calculated-field-identity-CJL54uFx.js +1373 -0
- package/dist/chunks/{constants-NUleP4DY.js → card-config-utils-Bq1enstT.js} +260 -260
- package/dist/chunks/card-config-utils-CMO4_zVs.cjs +1 -0
- package/dist/chunks/{dashboard-briefing-launcher-DXTpU85p.js → dashboard-briefing-launcher-B9l0ZAbv.js} +12 -12
- package/dist/chunks/{dashboard-briefing-launcher-C8nDSDnV.cjs → dashboard-briefing-launcher-C4zsM3Hd.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CyL0yimg.js → dashboard-controls-BCQv4xWM.js} +16 -14
- package/dist/chunks/dashboard-controls-CWwllVOe.cjs +52 -0
- package/dist/chunks/{dashboard-json-5Jr3RudV.js → dashboard-json-BtU_q_0A.js} +9 -9
- package/dist/chunks/dashboard-json-DVj2xLsH.cjs +1 -0
- package/dist/chunks/edit-dashboard-visual-CO2IVBOq.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-C7X-um9g.js → edit-dashboard-visual-RgFUx-py.js} +1986 -1990
- package/dist/chunks/{editor-action-buttons-CcDm8nA5.cjs → editor-action-buttons-BE8Fby6n.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-C5Wja_J4.js → editor-action-buttons-D-MaqTIs.js} +6 -6
- package/dist/chunks/field-aggregations-DUb0NU6c.js +1229 -0
- package/dist/chunks/field-aggregations-jSi77h9Z.cjs +1 -0
- package/dist/chunks/{field-dependencies-DVl2p1Nm.js → field-dependencies-Cl97kkHy.js} +30 -34
- package/dist/chunks/{field-dependencies-r_U0CGQ-.cjs → field-dependencies-DIab72rQ.cjs} +1 -1
- package/dist/chunks/{index-BVr4fcCB.js → index-0pdaQ9e1.js} +5 -5
- package/dist/chunks/index-BaIrLSBb.cjs +1422 -0
- package/dist/chunks/{index-De2QNsqV.js → index-ByiS9sB4.js} +45343 -43665
- package/dist/chunks/{index-C9KXfCkC.js → index-CLIro-EG.js} +3 -0
- package/dist/chunks/index-Cx3qmRUB.cjs +1 -0
- package/dist/chunks/{index-BlYf8gNa.cjs → index-DhlVxvyI.cjs} +1 -1
- package/dist/chunks/{matrix-card-DACDwdTq.js → matrix-card-CnKQpnsj.js} +1 -1
- package/dist/chunks/{matrix-card-CRXcmAjp.cjs → matrix-card-U4c72doZ.cjs} +1 -1
- package/dist/chunks/{matrix-control-sources-ClQzIk7E.js → matrix-control-sources-CRRdP03Q.js} +165 -134
- package/dist/chunks/matrix-control-sources-FjxGIbqk.cjs +1 -0
- package/dist/chunks/{matrix-formatter-7GLTcBuy.cjs → matrix-formatter-CveLJo6S.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-xsq7n_e6.js → matrix-formatter-ZVS5QOuq.js} +2 -2
- package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +1 -0
- package/dist/chunks/matrix-member-presentation-CzGZJd3a.js +182 -0
- package/dist/chunks/matrix-operation-contract-DoiWTUbT.cjs +1 -0
- package/dist/chunks/matrix-operation-contract-xL8IhFzp.js +1802 -0
- package/dist/chunks/{pivot-header-presentation-3wqWChFd.cjs → pivot-header-presentation-Cxz8-06f.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-D44ODZGn.js → pivot-header-presentation-DVylCBHB.js} +2 -2
- package/dist/chunks/{pivot-result-lifecycle-DZ0ZSMoM.cjs → pivot-result-lifecycle-BiERyXnS.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BSmqVkVG.js → pivot-result-lifecycle-CmjpW7qG.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-xADifRXs.js → report-preferences-dialog-BbkXcnnn.js} +4 -4
- package/dist/chunks/report-preferences-dialog-C9rpWgQZ.cjs +1 -0
- package/dist/chunks/{search-BHsQIWBV.js → selection-reducer-B94WgZ9V.js} +55 -11
- package/dist/chunks/selection-reducer-CGKKsaPa.cjs +26 -0
- package/dist/chunks/{semantic-format-BhIL1PXP.cjs → semantic-format-BzH69TRq.cjs} +1 -1
- package/dist/chunks/{semantic-format-C3amkGmY.js → semantic-format-CBlRO8Aw.js} +1 -1
- package/dist/chunks/{switch-DHGiC0aU.js → switch-CD4uGTZI.js} +7450 -7694
- package/dist/chunks/switch-iC1x2dcE.cjs +134 -0
- package/dist/chunks/token-types-Ahh5u4iT.cjs +1 -0
- package/dist/chunks/token-types-CPde8_LG.js +8 -0
- package/dist/chunks/{update-policy-Cc9h57pA.cjs → update-policy-COjFudhl.cjs} +1 -1
- package/dist/chunks/{update-policy-eTcz52jO.js → update-policy-D9q1Tz8k.js} +1 -1
- 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 +734 -622
- 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 +94 -92
- package/dist/data-app-codegen-node/index.js +337 -333
- package/dist/data-app-sdk/index.cjs +9 -9
- package/dist/data-app-sdk/index.js +1091 -969
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +104 -96
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/brand-studio/brand-studio-draft.d.ts +3 -1
- package/dist/types/components/dashboard/card-selection-pill.d.ts +5 -0
- package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
- package/dist/types/components/dashboard/drill-breadcrumb.d.ts +1 -0
- package/dist/types/components/dashboard/drill-navigation-controls.d.ts +3 -3
- package/dist/types/components/interactions/applied-filters-display.d.ts +6 -1
- package/dist/types/components/interactions/click-to-filter-review-dialog.d.ts +21 -0
- package/dist/types/components/interactions/dashboard-drill-host.d.ts +13 -0
- package/dist/types/components/interactions/filter-badge-tooltip.d.ts +4 -4
- package/dist/types/components/interactions/insight-modal.d.ts +4 -14
- package/dist/types/components/interactions/insight-viewer.d.ts +7 -19
- package/dist/types/components/interactions/interactions-sheet.d.ts +6 -0
- package/dist/types/components/interactions/panels/click-to-filter-panel.d.ts +20 -0
- package/dist/types/components/interactions/reusable/interaction-selection-popover.d.ts +2 -2
- package/dist/types/components/interactions/sheet/action-editor.d.ts +17 -0
- package/dist/types/components/interactions/sheet/action-meta.d.ts +45 -0
- package/dist/types/components/interactions/sheet/action-picker.d.ts +7 -0
- package/dist/types/components/interactions/sheet/click-outcome-preview.d.ts +10 -0
- package/dist/types/components/interactions/sheet/interactions-home.d.ts +28 -0
- package/dist/types/components/interactions/sheet/sheet-parts.d.ts +37 -0
- package/dist/types/components/surfboard/filter/dashboard-filter-mapping-panel.d.ts +28 -1
- package/dist/types/components/surfboard/filter/selection-chip.d.ts +11 -0
- package/dist/types/components/surfboard/filter/selection-filter-section.d.ts +4 -0
- package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +3 -0
- package/dist/types/components/ui/resizable.d.ts +1 -1
- package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +13 -1
- package/dist/types/components/visual/matrix-table/matrix-selection-click.d.ts +6 -0
- package/dist/types/data-app-sdk/adapters.d.ts +3 -2
- package/dist/types/data-app-sdk/builders.d.ts +2 -1
- package/dist/types/data-app-sdk/contracts.d.ts +44 -2
- package/dist/types/data-app-sdk/index.d.ts +1 -0
- package/dist/types/data-app-sdk/query-request.d.ts +7 -2
- package/dist/types/data-app-sdk/selection.d.ts +2 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +24 -23
- package/dist/types/lib/appearance/types.d.ts +3 -1
- package/dist/types/lib/briefings/briefing-attachment-model.d.ts +0 -2
- package/dist/types/lib/contexts/interactions-popover-context.d.ts +1 -8
- package/dist/types/lib/dashboard/click-to-filter-card-references.d.ts +23 -0
- package/dist/types/lib/dashboard-inputs/build-normalized-dashboard-inputs.d.ts +16 -2
- package/dist/types/lib/dashboard-inputs/build-selection-dashboard-inputs.d.ts +31 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-emitted-fields.d.ts +17 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-mapping-draft.d.ts +99 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-sheet-reach.d.ts +12 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +18 -1
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-candidate-metadata.d.ts +4 -1
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +10 -0
- package/dist/types/lib/dashboard-inputs/dashboard-input-snapshot.d.ts +8 -1
- package/dist/types/lib/dashboard-inputs/index.d.ts +1 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +18 -7
- package/dist/types/lib/dashboard-inputs/resolve-field-date-comparison-coverage.d.ts +5 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +77 -0
- package/dist/types/lib/dashboard-inputs/selection-targets.d.ts +26 -0
- package/dist/types/lib/dashboard-inputs/transient-input-context.d.ts +102 -0
- package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +50 -0
- package/dist/types/lib/dashboard-navigation/describe-carried-context.d.ts +11 -0
- package/dist/types/lib/dashboard-navigation/index.d.ts +1 -0
- package/dist/types/lib/dashboard-navigation/navigation-state.d.ts +120 -0
- package/dist/types/lib/dashboard-navigation/run-one-off-drill.d.ts +11 -0
- package/dist/types/lib/dashboard-navigation/use-transient-contexts.d.ts +17 -0
- package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +48 -0
- package/dist/types/lib/dashboard-view-state/drill-path.d.ts +20 -0
- package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
- package/dist/types/lib/download-pdf.d.ts +0 -3
- package/dist/types/lib/formatters/metric-formatting.d.ts +1 -1
- package/dist/types/lib/hooks/ai/dashboard-context.d.ts +15 -8
- package/dist/types/lib/hooks/chartjs/use-chart-blur.d.ts +10 -2
- package/dist/types/lib/hooks/interactions/{use-event-engine.d.ts → use-drill-actions.d.ts} +28 -7
- package/dist/types/lib/hooks/selection/use-active-selections.d.ts +15 -0
- package/dist/types/lib/hooks/selection/use-click-to-filter-mapping-draft.d.ts +20 -0
- package/dist/types/lib/hooks/selection/use-selection-click.d.ts +34 -0
- package/dist/types/lib/hooks/selection/use-selection-gestures.d.ts +38 -0
- package/dist/types/lib/hooks/selection/use-table-row-selection.d.ts +46 -0
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +0 -2
- package/dist/types/lib/hooks/use-dashboard-filter-mapping-candidates.d.ts +18 -0
- package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard.d.ts +1 -3
- package/dist/types/lib/hooks/use-interactions-popover.d.ts +1 -8
- package/dist/types/lib/hooks/use-resolved-card-config.d.ts +6 -0
- package/dist/types/lib/interactions/click-outcome.d.ts +25 -0
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +3 -1
- package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +1 -1
- package/dist/types/lib/interactions/get-click-context-from-table.d.ts +7 -0
- package/dist/types/lib/interactions/interaction-utils.d.ts +17 -1
- package/dist/types/lib/matrix-table/build-matrix-drill-to-detail.d.ts +15 -0
- package/dist/types/lib/matrix-table/matrix-card-interactions.d.ts +14 -3
- package/dist/types/lib/query-context/build-card-query-context.d.ts +19 -8
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -3
- package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +12 -4
- package/dist/types/lib/query-context/compile-selection-filters.d.ts +5 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +46 -0
- package/dist/types/lib/query-context/filter-group-utils.d.ts +3 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +29 -0
- package/dist/types/lib/selection/click-to-filter-authoring-support.d.ts +9 -0
- package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
- package/dist/types/lib/selection/selection-labels.d.ts +3 -0
- package/dist/types/lib/selection/selection-notices.d.ts +9 -0
- package/dist/types/lib/selection/selection-reducer.d.ts +46 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +62 -17
- package/dist/types/lib/stores/editor-store.d.ts +1 -2
- package/dist/types/lib/stores/index.d.ts +0 -2
- package/dist/types/lib/types/common-types.d.ts +60 -6
- package/dist/types/lib/types/explorer-types.d.ts +1 -22
- package/dist/types/lib/types/interaction-types.d.ts +6 -198
- package/dist/types/lib/utils/calculate-context-aware-filters.d.ts +21 -12
- package/dist/types/lib/utils/card-utils.d.ts +11 -0
- package/dist/types/lib/utils/date-hierarchy-utils.d.ts +3 -1
- package/dist/types/lib/utils/drag-and-drop-utils.d.ts +1 -1
- package/dist/types/lib/utils/interaction-icons.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +32 -32
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/selection-contract.d.ts +100 -0
- package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/apply-group-by-override.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +88 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/linked-click-to-filter-overrides.d.ts +32 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
- package/package.json +1 -1
- package/src/data-app-sdk/README.md +58 -1
- package/dist/chunks/appearance-context-tNjvTJj3.cjs +0 -1
- package/dist/chunks/calculated-field-identity-BTpUqfEu.js +0 -1276
- package/dist/chunks/calculated-field-identity-rMuXuzEY.cjs +0 -1
- package/dist/chunks/constants-vtu7_IUo.cjs +0 -1
- package/dist/chunks/dashboard-controls-DlxeddZN.cjs +0 -52
- package/dist/chunks/dashboard-json-DhS4yJfc.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-X3OCnivL.cjs +0 -172
- package/dist/chunks/field-aggregations-BU_3gHKR.js +0 -957
- package/dist/chunks/field-aggregations-CDCamEsQ.cjs +0 -1
- package/dist/chunks/index-C8XCKzB6.cjs +0 -1
- package/dist/chunks/index-DSa6RSdg.cjs +0 -1417
- package/dist/chunks/matrix-control-sources-CeC5EMyq.cjs +0 -1
- package/dist/chunks/matrix-member-presentation-E2B4k3ws.cjs +0 -1
- package/dist/chunks/matrix-member-presentation-qiHxv67e.js +0 -105
- package/dist/chunks/matrix-operation-contract-Cqy4EW2H.js +0 -1638
- package/dist/chunks/matrix-operation-contract-D9dLX-Wr.cjs +0 -1
- package/dist/chunks/report-preferences-dialog-7Vsc_fsG.cjs +0 -1
- package/dist/chunks/search-BqqhaMx9.cjs +0 -26
- package/dist/chunks/switch-BytP6QY8.cjs +0 -139
- package/dist/types/components/interactions/configuration-popover.d.ts +0 -1
- package/dist/types/components/interactions/interaction-card.d.ts +0 -59
- package/dist/types/components/interactions/interaction-event-handler.d.ts +0 -11
- package/dist/types/components/interactions/interactions-list.d.ts +0 -50
- package/dist/types/components/interactions/panels/cross-filter-panel.d.ts +0 -24
- package/dist/types/components/interactions/panels/inline-drill-panel.d.ts +0 -24
- package/dist/types/components/interactions/selectors/action-selector.d.ts +0 -31
- package/dist/types/components/interactions/selectors/trigger-selector.d.ts +0 -38
- package/dist/types/components/surfboard/filter/click-filter-section.d.ts +0 -5
- package/dist/types/lib/interactions/build-interaction-event.d.ts +0 -25
- package/dist/types/lib/interactions/convert-click-filters-to-filter-group.d.ts +0 -10
- package/dist/types/lib/interactions/execute-interaction-event.d.ts +0 -80
- package/dist/types/lib/interactions/field-utils.d.ts +0 -11
- package/dist/types/lib/interactions/handle-chart-click.d.ts +0 -75
- package/dist/types/lib/interactions/linked-interaction-utils.d.ts +0 -14
- package/dist/types/lib/interactions/source-card-filter-utils.d.ts +0 -9
- package/dist/types/lib/stores/drill-actions.d.ts +0 -139
- package/dist/types/lib/stores/interaction-store.d.ts +0 -113
- package/dist/types/lib/stores/pointer-interaction-store.d.ts +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/operators-DEfKaU_V.cjs"),l=require("../chunks/validators-DVYAnnX0.cjs"),g=require("../chunks/matrix-operation-contract-DoiWTUbT.cjs");function p(t){var e,r,o;const i=R(t);return{version:1,kind:"metric",id:t.id,label:t.label,source:f(t),measures:i,primaryMeasure:b(t,i),dateField:t.dateField?a(t.dateField,"date"):void 0,timeGrain:t.timeGrain,dimensions:(e=t.dimensions)==null?void 0:e.map(n=>a(n,"dimension")),comparison:G(t.comparison),orderBy:t.orderBy?{field:a(t.orderBy.field),direction:t.orderBy.direction}:void 0,inputs:s(t.inputs),...(r=t.filters)!=null&&r.length?{filters:t.filters}:{},...t.relationshipHint?{relationshipHint:t.relationshipHint}:{},limit:t.limit,...(o=t.derivedFields)!=null&&o.length?{derivedFields:t.derivedFields}:{}}}function F(t){return{...p(t),...t.timeWindow?{timeWindow:t.timeWindow}:{},...t.analysis?{analysis:t.analysis}:{}}}function M(t){return{...t.chartTitle?{chartTitle:t.chartTitle}:{},...t.chartType?{chartType:t.chartType}:{},...t.driverMode?{driverMode:t.driverMode}:{},...t.includePopulation!==void 0?{includePopulation:t.includePopulation}:{},...t.calendarContext?{calendarContext:t.calendarContext}:{}}}function b(t,i){if(!t.primaryMeasure)return i[0]||{name:"",role:"measure"};const e=a(t.primaryMeasure,"measure"),r=H(e,i),o=r.length===1?r[0]:void 0;return o?c(e,o):e}function R(t){const i=[];for(const e of t.measures.map(r=>a(r,"measure"))){if(!e.name)continue;const r=i.findIndex(o=>w(o,e));if(r===-1){i.push(e);continue}i[r]=c(i[r],e)}return i}function w(t,i){return l.semaphorFieldRefsMatch(t,i)&&d(t)===d(i)}function A(t,i){return d(i)===d(t)}function k(t,i){return i.name!==t.name||t.source&&!l.semaphorFieldRefsMatch(i,t)?!1:A(t,i)}function H(t,i){const e=i.filter(r=>k(t,r));return t.aggregate!==void 0,e}function d(t){return l.semaphorMetricAggregate(t)}function c(t,i){if(t.aggregate&&i.aggregate&&t.aggregate!==i.aggregate)throw new Error(`Measure "${t.name}" was requested with conflicting aggregate semantics: ${t.aggregate} and ${i.aggregate}.`);return{...l.preferSemaphorFieldRefMetadata(t,i),aggregate:t.aggregate||i.aggregate}}function B(t){var e,r;if("sort"in t)throw new Error("semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!_(t))throw new Error("semaphor.records needs at least one field.");const i=O(t.fields);return{version:1,kind:"records",id:t.id,label:t.label,source:f(t),fields:i,dateField:t.dateField?a(t.dateField,"date"):void 0,timeGrain:t.timeGrain,...t.timeWindow?{timeWindow:t.timeWindow}:{},...(e=t.filters)!=null&&e.length?{filters:t.filters}:{},orderBy:t.orderBy?{field:a(t.orderBy.field),direction:t.orderBy.direction}:void 0,inputs:s(t.inputs),...t.relationshipHint?{relationshipHint:t.relationshipHint}:{},limit:t.limit,...t.pagination?{pagination:t.pagination}:{},...t.totals?{totals:{mode:"server",measures:t.totals.measures.map(o=>a(o,"measure"))}}:{},...(r=t.derivedFields)!=null&&r.length?{derivedFields:t.derivedFields}:{}}}function O(t){return t.map(i=>{const e=a(i);if(!e.role)throw new Error(`semaphor.records field "${e.name}" needs an explicit role.`);return e})}function q(t){var e,r,o;const i=f(t);if(i.kind==="sql")throw new Error("semaphor.inputOptions requires a semantic or physical option source.");return{version:1,kind:"inputOptions",id:t.id,label:t.label,inputId:t.inputId,source:i,labelField:a(t.labelField,"dimension"),valueField:a(t.valueField,"dimension"),...t.searchField?{searchField:a(t.searchField,"dimension")}:{},...(e=t.disambiguationFields)!=null&&e.length?{disambiguationFields:t.disambiguationFields.map(n=>a(n,"dimension"))}:{},...t.population?{population:t.population}:{},...t.dependencies?{dependencies:t.dependencies}:{},search:t.search,limit:t.limit,...(r=t.inputs)!=null&&r.length?{inputs:t.inputs.map(n=>m(n))}:{},...(o=t.derivedFields)!=null&&o.length?{derivedFields:t.derivedFields}:{}}}function z(t){var i;return{version:1,kind:"sql",id:t.id,label:t.label,source:t.source,sql:t.sql,...t.defaultParameters?{defaultParameters:t.defaultParameters}:{},...t.pythonCode?{pythonCode:t.pythonCode}:{},...(i=t.fields)!=null&&i.length?{fields:t.fields.map(e=>a(e))}:{},inputs:s(t.inputs),limit:t.limit,...t.pagination?{pagination:t.pagination}:{},rationale:t.rationale}}function C(t){const{id:i,label:e,inputs:r,matrixWindowRequest:o,...n}=t,{queryKind:j,...I}=n;return l.matrixAnalyticalIntentSchema.parse({...I,kind:"matrix"})}function m(t){if("toAnalyticsInput"in t){const n=t.toAnalyticsInput();return{inputId:n.inputId,kind:n.kind,...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{},...n.relationshipHint?{relationshipHint:n.relationshipHint}:{}}}if("id"in t){const n=h(t);return{inputId:n.inputId,kind:n.kind,...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{},...n.relationshipHint?{relationshipHint:n.relationshipHint}:{}}}const i="kind"in t?t.kind:void 0,e="operator"in t?y(t.operator,t.inputId):void 0,r="controlRole"in t?t.controlRole:"role"in t?t.role:void 0,o=P(r)?r:void 0;return{inputId:t.inputId,...i?{kind:i}:{},...o?{controlRole:o}:{},...e?{operator:e}:{},...t.field?{field:t.field}:{},...t.relationshipHint?{relationshipHint:t.relationshipHint}:{}}}function P(t){return t==="grain"||t==="measure"||t==="dimension"||t==="aggregation"||t==="sqlParam"}function x(t){const i=s(t);return i.length>0?i:void 0}function S(t){return(t||[]).map($)}function T(t){return S(t).filter(i=>i.isActive)}function W(t){const i=(t||[]).flatMap(e=>{const r="toAnalyticsSelection"in e?e.toAnalyticsSelection():e;return r?[g.analyticsSelectionSchema.parse(r)]:[]});return g.canonicalizeAnalyticsSelections(i)}function h(t){if(t.kind==="filter"){const i=y(t.operator,t.id);return{inputId:t.id,kind:t.kind,label:t.label,field:a(t.field,"dimension"),operator:i||"in",...t.relationshipHint?{relationshipHint:t.relationshipHint}:{}}}return{inputId:t.id,kind:t.kind,label:t.label,controlRole:t.role}}function E(t=[]){return t.map(i=>typeof i=="object"?i:{label:String(i),value:i})}function u(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t.trim().length>0:!0}function $(t){if("toAnalyticsInput"in t)return t.toAnalyticsInput();if("kind"in t&&"isActive"in t)return t;if("id"in t){const i=h(t),e=Object.prototype.hasOwnProperty.call(t,"value")?t.value:t.defaultValue;return{inputId:i.inputId,kind:i.kind,label:i.label,...i.field?{field:i.field}:{},...i.operator?{operator:i.operator}:{},...i.controlRole?{controlRole:i.controlRole}:{},...i.relationshipHint?{relationshipHint:i.relationshipHint}:{},value:e,isActive:u(e)}}return{...t,kind:"filter",isActive:u(t.value),value:t.value}}function f(t){return t.source}function _(t){var i;return!!((i=t.fields)!=null&&i.length)}function a(t,i){return{...t,role:t.role||i}}function s(t){return(t||[]).map(m)}function G(t){if(t)return t}function y(t,i){if(t===void 0)return;const e=v.normalizeSemaphorInputOperator(t);if(!e)throw new Error(`useSemaphorInput "${i}" uses unsupported filter operator "${t}".`);return e}exports.hasSemaphorInputValue=u;exports.normalizeSemaphorInputOptions=E;exports.toSemaphorActiveInputSnapshots=T;exports.toSemaphorAnalysisIntent=F;exports.toSemaphorAnalysisQueryOptions=M;exports.toSemaphorInputBinding=m;exports.toSemaphorInputBindings=x;exports.toSemaphorInputOptionsIntent=q;exports.toSemaphorInputSnapshots=S;exports.toSemaphorInputSpec=h;exports.toSemaphorMatrixIntent=C;exports.toSemaphorMetricIntent=p;exports.toSemaphorRecordsIntent=B;exports.toSemaphorSelectionSnapshots=W;exports.toSemaphorSqlIntent=z;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { n as y } from "../chunks/operators-B3zZoskU.js";
|
|
2
2
|
import { m as v, k as m, p as I, l as S } from "../chunks/validators-BDYzZFgs.js";
|
|
3
|
-
import "../chunks/matrix-operation-contract-
|
|
4
|
-
function
|
|
5
|
-
var
|
|
6
|
-
const t =
|
|
3
|
+
import { b as F, c as b } from "../chunks/matrix-operation-contract-xL8IhFzp.js";
|
|
4
|
+
function w(i) {
|
|
5
|
+
var n, r, o;
|
|
6
|
+
const t = R(i);
|
|
7
7
|
return {
|
|
8
8
|
version: 1,
|
|
9
9
|
kind: "metric",
|
|
10
10
|
id: i.id,
|
|
11
11
|
label: i.label,
|
|
12
|
-
source:
|
|
12
|
+
source: s(i),
|
|
13
13
|
measures: t,
|
|
14
|
-
primaryMeasure:
|
|
14
|
+
primaryMeasure: M(i, t),
|
|
15
15
|
dateField: i.dateField ? a(i.dateField, "date") : void 0,
|
|
16
16
|
timeGrain: i.timeGrain,
|
|
17
|
-
dimensions: (
|
|
18
|
-
comparison:
|
|
17
|
+
dimensions: (n = i.dimensions) == null ? void 0 : n.map((e) => a(e, "dimension")),
|
|
18
|
+
comparison: x(i.comparison),
|
|
19
19
|
orderBy: i.orderBy ? {
|
|
20
20
|
field: a(i.orderBy.field),
|
|
21
21
|
direction: i.orderBy.direction
|
|
@@ -27,14 +27,14 @@ function F(i) {
|
|
|
27
27
|
...(o = i.derivedFields) != null && o.length ? { derivedFields: i.derivedFields } : {}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function _(i) {
|
|
31
31
|
return {
|
|
32
|
-
...
|
|
32
|
+
...w(i),
|
|
33
33
|
...i.timeWindow ? { timeWindow: i.timeWindow } : {},
|
|
34
34
|
...i.analysis ? { analysis: i.analysis } : {}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function G(i) {
|
|
38
38
|
return {
|
|
39
39
|
...i.chartTitle ? { chartTitle: i.chartTitle } : {},
|
|
40
40
|
...i.chartType ? { chartType: i.chartType } : {},
|
|
@@ -43,47 +43,47 @@ function $(i) {
|
|
|
43
43
|
...i.calendarContext ? { calendarContext: i.calendarContext } : {}
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function M(i, t) {
|
|
47
47
|
if (!i.primaryMeasure)
|
|
48
48
|
return t[0] || { name: "", role: "measure" };
|
|
49
|
-
const
|
|
50
|
-
return o ? f(
|
|
49
|
+
const n = a(i.primaryMeasure, "measure"), r = B(n, t), o = r.length === 1 ? r[0] : void 0;
|
|
50
|
+
return o ? f(n, o) : n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function R(i) {
|
|
53
53
|
const t = [];
|
|
54
|
-
for (const
|
|
54
|
+
for (const n of i.measures.map(
|
|
55
55
|
(r) => a(r, "measure")
|
|
56
56
|
)) {
|
|
57
|
-
if (!
|
|
57
|
+
if (!n.name)
|
|
58
58
|
continue;
|
|
59
59
|
const r = t.findIndex(
|
|
60
|
-
(o) =>
|
|
60
|
+
(o) => k(o, n)
|
|
61
61
|
);
|
|
62
62
|
if (r === -1) {
|
|
63
|
-
t.push(
|
|
63
|
+
t.push(n);
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
66
|
t[r] = f(
|
|
67
67
|
t[r],
|
|
68
|
-
|
|
68
|
+
n
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
return t;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function k(i, t) {
|
|
74
74
|
return m(i, t) && l(i) === l(t);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function H(i, t) {
|
|
77
77
|
return l(t) === l(i);
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
return t.name !== i.name || i.source && !m(t, i) ? !1 :
|
|
79
|
+
function A(i, t) {
|
|
80
|
+
return t.name !== i.name || i.source && !m(t, i) ? !1 : H(i, t);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
(r) =>
|
|
82
|
+
function B(i, t) {
|
|
83
|
+
const n = t.filter(
|
|
84
|
+
(r) => A(i, r)
|
|
85
85
|
);
|
|
86
|
-
return i.aggregate !== void 0,
|
|
86
|
+
return i.aggregate !== void 0, n;
|
|
87
87
|
}
|
|
88
88
|
function l(i) {
|
|
89
89
|
return S(i);
|
|
@@ -98,26 +98,26 @@ function f(i, t) {
|
|
|
98
98
|
aggregate: i.aggregate || t.aggregate
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
var
|
|
101
|
+
function j(i) {
|
|
102
|
+
var n, r;
|
|
103
103
|
if ("sort" in i)
|
|
104
104
|
throw new Error(
|
|
105
105
|
"semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet."
|
|
106
106
|
);
|
|
107
|
-
if (!
|
|
107
|
+
if (!q(i))
|
|
108
108
|
throw new Error("semaphor.records needs at least one field.");
|
|
109
|
-
const t =
|
|
109
|
+
const t = O(i.fields);
|
|
110
110
|
return {
|
|
111
111
|
version: 1,
|
|
112
112
|
kind: "records",
|
|
113
113
|
id: i.id,
|
|
114
114
|
label: i.label,
|
|
115
|
-
source:
|
|
115
|
+
source: s(i),
|
|
116
116
|
fields: t,
|
|
117
117
|
dateField: i.dateField ? a(i.dateField, "date") : void 0,
|
|
118
118
|
timeGrain: i.timeGrain,
|
|
119
119
|
...i.timeWindow ? { timeWindow: i.timeWindow } : {},
|
|
120
|
-
...(
|
|
120
|
+
...(n = i.filters) != null && n.length ? { filters: i.filters } : {},
|
|
121
121
|
orderBy: i.orderBy ? {
|
|
122
122
|
field: a(i.orderBy.field),
|
|
123
123
|
direction: i.orderBy.direction
|
|
@@ -137,19 +137,19 @@ function _(i) {
|
|
|
137
137
|
...(r = i.derivedFields) != null && r.length ? { derivedFields: i.derivedFields } : {}
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function O(i) {
|
|
141
141
|
return i.map((t) => {
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
142
|
+
const n = a(t);
|
|
143
|
+
if (!n.role)
|
|
144
144
|
throw new Error(
|
|
145
|
-
`semaphor.records field "${
|
|
145
|
+
`semaphor.records field "${n.name}" needs an explicit role.`
|
|
146
146
|
);
|
|
147
|
-
return
|
|
147
|
+
return n;
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
var
|
|
152
|
-
const t =
|
|
150
|
+
function K(i) {
|
|
151
|
+
var n, r, o;
|
|
152
|
+
const t = s(i);
|
|
153
153
|
if (t.kind === "sql")
|
|
154
154
|
throw new Error(
|
|
155
155
|
"semaphor.inputOptions requires a semantic or physical option source."
|
|
@@ -164,20 +164,20 @@ function G(i) {
|
|
|
164
164
|
labelField: a(i.labelField, "dimension"),
|
|
165
165
|
valueField: a(i.valueField, "dimension"),
|
|
166
166
|
...i.searchField ? { searchField: a(i.searchField, "dimension") } : {},
|
|
167
|
-
...(
|
|
167
|
+
...(n = i.disambiguationFields) != null && n.length ? {
|
|
168
168
|
disambiguationFields: i.disambiguationFields.map(
|
|
169
|
-
(
|
|
169
|
+
(e) => a(e, "dimension")
|
|
170
170
|
)
|
|
171
171
|
} : {},
|
|
172
172
|
...i.population ? { population: i.population } : {},
|
|
173
173
|
...i.dependencies ? { dependencies: i.dependencies } : {},
|
|
174
174
|
search: i.search,
|
|
175
175
|
limit: i.limit,
|
|
176
|
-
...(r = i.inputs) != null && r.length ? { inputs: i.inputs.map((
|
|
176
|
+
...(r = i.inputs) != null && r.length ? { inputs: i.inputs.map((e) => h(e)) } : {},
|
|
177
177
|
...(o = i.derivedFields) != null && o.length ? { derivedFields: i.derivedFields } : {}
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function V(i) {
|
|
181
181
|
var t;
|
|
182
182
|
return {
|
|
183
183
|
version: 1,
|
|
@@ -188,62 +188,69 @@ function j(i) {
|
|
|
188
188
|
sql: i.sql,
|
|
189
189
|
...i.defaultParameters ? { defaultParameters: i.defaultParameters } : {},
|
|
190
190
|
...i.pythonCode ? { pythonCode: i.pythonCode } : {},
|
|
191
|
-
...(t = i.fields) != null && t.length ? { fields: i.fields.map((
|
|
191
|
+
...(t = i.fields) != null && t.length ? { fields: i.fields.map((n) => a(n)) } : {},
|
|
192
192
|
inputs: d(i.inputs),
|
|
193
193
|
limit: i.limit,
|
|
194
194
|
...i.pagination ? { pagination: i.pagination } : {},
|
|
195
195
|
rationale: i.rationale
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
function
|
|
199
|
-
const { id: t, label:
|
|
198
|
+
function Q(i) {
|
|
199
|
+
const { id: t, label: n, inputs: r, matrixWindowRequest: o, ...e } = i, { queryKind: T, ...p } = e;
|
|
200
200
|
return v.parse({ ...p, kind: "matrix" });
|
|
201
201
|
}
|
|
202
202
|
function h(i) {
|
|
203
203
|
if ("toAnalyticsInput" in i) {
|
|
204
|
-
const
|
|
204
|
+
const e = i.toAnalyticsInput();
|
|
205
205
|
return {
|
|
206
|
-
inputId:
|
|
207
|
-
kind:
|
|
208
|
-
...
|
|
209
|
-
...
|
|
210
|
-
...
|
|
211
|
-
...
|
|
206
|
+
inputId: e.inputId,
|
|
207
|
+
kind: e.kind,
|
|
208
|
+
...e.controlRole ? { controlRole: e.controlRole } : {},
|
|
209
|
+
...e.operator ? { operator: e.operator } : {},
|
|
210
|
+
...e.field ? { field: e.field } : {},
|
|
211
|
+
...e.relationshipHint ? { relationshipHint: e.relationshipHint } : {}
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
if ("id" in i) {
|
|
215
|
-
const
|
|
215
|
+
const e = g(i);
|
|
216
216
|
return {
|
|
217
|
-
inputId:
|
|
218
|
-
kind:
|
|
219
|
-
...
|
|
220
|
-
...
|
|
221
|
-
...
|
|
222
|
-
...
|
|
217
|
+
inputId: e.inputId,
|
|
218
|
+
kind: e.kind,
|
|
219
|
+
...e.controlRole ? { controlRole: e.controlRole } : {},
|
|
220
|
+
...e.operator ? { operator: e.operator } : {},
|
|
221
|
+
...e.field ? { field: e.field } : {},
|
|
222
|
+
...e.relationshipHint ? { relationshipHint: e.relationshipHint } : {}
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
const t = "kind" in i ? i.kind : void 0,
|
|
225
|
+
const t = "kind" in i ? i.kind : void 0, n = "operator" in i ? c(i.operator, i.inputId) : void 0, r = "controlRole" in i ? i.controlRole : "role" in i ? i.role : void 0, o = z(r) ? r : void 0;
|
|
226
226
|
return {
|
|
227
227
|
inputId: i.inputId,
|
|
228
228
|
...t ? { kind: t } : {},
|
|
229
229
|
...o ? { controlRole: o } : {},
|
|
230
|
-
...
|
|
230
|
+
...n ? { operator: n } : {},
|
|
231
231
|
...i.field ? { field: i.field } : {},
|
|
232
232
|
...i.relationshipHint ? { relationshipHint: i.relationshipHint } : {}
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function z(i) {
|
|
236
236
|
return i === "grain" || i === "measure" || i === "dimension" || i === "aggregation" || i === "sqlParam";
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function D(i) {
|
|
239
239
|
const t = d(i);
|
|
240
240
|
return t.length > 0 ? t : void 0;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return (i || []).map(
|
|
242
|
+
function C(i) {
|
|
243
|
+
return (i || []).map(P);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
return
|
|
245
|
+
function J(i) {
|
|
246
|
+
return C(i).filter((t) => t.isActive);
|
|
247
|
+
}
|
|
248
|
+
function L(i) {
|
|
249
|
+
const t = (i || []).flatMap((n) => {
|
|
250
|
+
const r = "toAnalyticsSelection" in n ? n.toAnalyticsSelection() : n;
|
|
251
|
+
return r ? [F.parse(r)] : [];
|
|
252
|
+
});
|
|
253
|
+
return b(t);
|
|
247
254
|
}
|
|
248
255
|
function g(i) {
|
|
249
256
|
if (i.kind === "filter") {
|
|
@@ -264,7 +271,7 @@ function g(i) {
|
|
|
264
271
|
controlRole: i.role
|
|
265
272
|
};
|
|
266
273
|
}
|
|
267
|
-
function
|
|
274
|
+
function N(i = []) {
|
|
268
275
|
return i.map(
|
|
269
276
|
(t) => typeof t == "object" ? t : {
|
|
270
277
|
label: String(t),
|
|
@@ -272,16 +279,16 @@ function D(i = []) {
|
|
|
272
279
|
}
|
|
273
280
|
);
|
|
274
281
|
}
|
|
275
|
-
function
|
|
282
|
+
function u(i) {
|
|
276
283
|
return i == null ? !1 : Array.isArray(i) ? i.length > 0 : typeof i == "string" ? i.trim().length > 0 : !0;
|
|
277
284
|
}
|
|
278
|
-
function
|
|
285
|
+
function P(i) {
|
|
279
286
|
if ("toAnalyticsInput" in i)
|
|
280
287
|
return i.toAnalyticsInput();
|
|
281
288
|
if ("kind" in i && "isActive" in i)
|
|
282
289
|
return i;
|
|
283
290
|
if ("id" in i) {
|
|
284
|
-
const t = g(i),
|
|
291
|
+
const t = g(i), n = Object.prototype.hasOwnProperty.call(i, "value") ? i.value : i.defaultValue;
|
|
285
292
|
return {
|
|
286
293
|
inputId: t.inputId,
|
|
287
294
|
kind: t.kind,
|
|
@@ -290,23 +297,23 @@ function C(i) {
|
|
|
290
297
|
...t.operator ? { operator: t.operator } : {},
|
|
291
298
|
...t.controlRole ? { controlRole: t.controlRole } : {},
|
|
292
299
|
...t.relationshipHint ? { relationshipHint: t.relationshipHint } : {},
|
|
293
|
-
value:
|
|
294
|
-
isActive:
|
|
300
|
+
value: n,
|
|
301
|
+
isActive: u(n)
|
|
295
302
|
};
|
|
296
303
|
}
|
|
297
304
|
return {
|
|
298
305
|
...i,
|
|
299
306
|
kind: "filter",
|
|
300
|
-
isActive:
|
|
307
|
+
isActive: u(
|
|
301
308
|
i.value
|
|
302
309
|
),
|
|
303
310
|
value: i.value
|
|
304
311
|
};
|
|
305
312
|
}
|
|
306
|
-
function
|
|
313
|
+
function s(i) {
|
|
307
314
|
return i.source;
|
|
308
315
|
}
|
|
309
|
-
function
|
|
316
|
+
function q(i) {
|
|
310
317
|
var t;
|
|
311
318
|
return !!((t = i.fields) != null && t.length);
|
|
312
319
|
}
|
|
@@ -319,33 +326,34 @@ function a(i, t) {
|
|
|
319
326
|
function d(i) {
|
|
320
327
|
return (i || []).map(h);
|
|
321
328
|
}
|
|
322
|
-
function
|
|
329
|
+
function x(i) {
|
|
323
330
|
if (i)
|
|
324
331
|
return i;
|
|
325
332
|
}
|
|
326
333
|
function c(i, t) {
|
|
327
334
|
if (i === void 0)
|
|
328
335
|
return;
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
336
|
+
const n = y(i);
|
|
337
|
+
if (!n)
|
|
331
338
|
throw new Error(
|
|
332
339
|
`useSemaphorInput "${t}" uses unsupported filter operator "${i}".`
|
|
333
340
|
);
|
|
334
|
-
return
|
|
341
|
+
return n;
|
|
335
342
|
}
|
|
336
343
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
344
|
+
u as hasSemaphorInputValue,
|
|
345
|
+
N as normalizeSemaphorInputOptions,
|
|
346
|
+
J as toSemaphorActiveInputSnapshots,
|
|
347
|
+
_ as toSemaphorAnalysisIntent,
|
|
348
|
+
G as toSemaphorAnalysisQueryOptions,
|
|
342
349
|
h as toSemaphorInputBinding,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
350
|
+
D as toSemaphorInputBindings,
|
|
351
|
+
K as toSemaphorInputOptionsIntent,
|
|
352
|
+
C as toSemaphorInputSnapshots,
|
|
346
353
|
g as toSemaphorInputSpec,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
354
|
+
Q as toSemaphorMatrixIntent,
|
|
355
|
+
w as toSemaphorMetricIntent,
|
|
356
|
+
j as toSemaphorRecordsIntent,
|
|
357
|
+
L as toSemaphorSelectionSnapshots,
|
|
358
|
+
V as toSemaphorSqlIntent
|
|
351
359
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../chunks/validators-DVYAnnX0.cjs"),N=require("../chunks/matrix-operation-contract-D9dLX-Wr.cjs"),E=require("../chunks/report-runtime-context-DzvHBPxl.cjs"),K=require("../chunks/source-entity-resolution-CjbgnwyX.cjs"),y=require("../data-app-sdk-adapters/index.cjs"),Q=require("../chunks/matrix-card-CRXcmAjp.cjs");function W({intent:e,field:r,catalogField:t,relativePath:o}){const i=J({intent:e,field:r,relativePath:o});if(!i||i.allowedRelatedRoles.length===0)return!1;const n=I(r,i.selectedField),s=$(t),c=h(n);return P(s,i.allowedRelatedRoles)?c===s:!1}function U(e){return e.kind==="records"?L(e):e.kind==="metric"?X(e):[]}function $(e){const r=d.normalizeAnalyticsCatalogName(e.role);if(r==="measure")return"measure";if(r==="id")return"id";const t=d.normalizeAnalyticsCatalogDataType(e.dataType);if(r==="date"||t==="date"||t==="datetime")return"date";if(r==="dimension")return"dimension"}function P(e,r){return!!(e&&r.includes(e))}function I(e,r){const t=h(e);if(t)return e.role===t?e:{...e,role:t};const o=r?h(r):void 0;return o?{...e,role:o}:e}function v(e,r){return e.find(t=>T(t,r))}function J({intent:e,field:r,relativePath:t}){if(e.kind==="records")return V(e,r,t);if(e.kind==="metric")return G(e,r,t)}function V(e,r,t){if(t.startsWith("spec.fields."))return{allowedRelatedRoles:["dimension","date","id"]};if(t==="spec.dateField"&&!e.timeWindow)return{allowedRelatedRoles:["date"]};if(t==="spec.orderBy.field"){const o=v(H(e),r);return{selectedField:o,allowedRelatedRoles:o?k(o):[]}}}function G(e,r,t){if(t.startsWith("spec.dimensions."))return{allowedRelatedRoles:["dimension"]};if(t==="spec.orderBy.field"){const o=v(e.dimensions||[],r);return{selectedField:o,allowedRelatedRoles:o?["dimension"]:[]}}}function L(e){var o,i;const r=H(e),t=(o=e.orderBy)!=null&&o.field?v(r,e.orderBy.field):void 0;return b([...r.map(n=>p(n,k(n))),...(i=e.orderBy)!=null&&i.field?[p(I(e.orderBy.field,t),t?k(t):[],{unsupportedRelatedRoleMessage:"Joined records projections support related sort fields only when the same related field is included in spec.fields.",recommendedNextStep:"Add the related sort field to spec.fields, or keep orderBy fields on the base source."})]:[]])}function X(e){var t,o;const r=(t=e.orderBy)!=null&&t.field?v(e.dimensions||[],e.orderBy.field):void 0;return b([...e.measures.map(i=>p(i,[])),...e.primaryMeasure?[p(e.primaryMeasure,[])]:[],...(e.dimensions||[]).map(i=>p(i,["dimension"])),...e.dateField?[p({...e.dateField,role:"date"},[])]:[],...(o=e.orderBy)!=null&&o.field?[p(I(e.orderBy.field,r),r?["dimension"]:[],{unsupportedRelatedRoleMessage:"Joined metric projections support related orderBy fields only when the same related field is declared in spec.dimensions.",recommendedNextStep:"Add the related field as a metric dimension when it should participate in the grouped result, or keep orderBy fields on the base source."})]:[]])}function k(e){const r=e?h(e):void 0;return r==="dimension"?["dimension"]:r==="date"?["date"]:r==="id"?["id"]:["dimension","date","id"]}function p(e,r,t={}){return{field:I(e),allowedRelatedRoles:r,...t}}function b(e){const r=[];return e.forEach(t=>{r.some(o=>Y(o,t))||r.push(t)}),r}function H(e){const r=[...e.fields];return e.dateField&&!r.some(t=>w(t,e.dateField))&&r.push({...e.dateField,role:"date"}),r}function Y(e,r){return T(e.field,r.field)&&e.allowedRelatedRoles.join("|")===r.allowedRelatedRoles.join("|")&&(e.unsupportedRelatedRoleMessage||"")===(r.unsupportedRelatedRoleMessage||"")&&(e.recommendedNextStep||"")===(r.recommendedNextStep||"")}function w(e,r){return d.semaphorFieldRefsMatch(e,r)}function T(e,r){return w(e,r)&&Z(h(e),h(r))}function Z(e,r){return!!(e&&(!r||e===r))}function h(e){return $(e)}function j({intent:e,field:r,relativePath:t,baseCatalog:o,fieldCatalogs:i}){const n=g(r,e.source),s=d.semaphorSourcesReferToSameDataset(n,e.source);if(e.kind!=="matrix"&&!s&&!re(e.source,n))return{ok:!1,code:"invalid_source_ref",message:`Field "${r.name}" references a related Semaphor source outside the query's semantic domain.`,pathSuffix:".source",source:n};const c=s?o:S(i,n);if(!c)return{ok:!1,code:"invalid_source_ref",message:`Field "${r.name}" references a Semaphor source that is not present in the visible field catalog.`,pathSuffix:".source",source:n};const a=q(c,r,e.source);return a?e.kind!=="matrix"&&!s&&!ee({intent:e,field:r,catalogField:a,relativePath:t})?{ok:!1,code:"unsupported_joined_projection",message:`Field "${r.name}" references a related Semaphor source, but this query kind does not support joined projections for that field yet.`,pathSuffix:".source",source:n}:{ok:!0,source:n,catalogField:a,usesBaseSource:s}:{ok:!1,code:"missing_field",message:`Field "${r.name}" is not visible on the selected Semaphor source.`,source:n}}function ee({intent:e,field:r,catalogField:t,relativePath:o}){return W({intent:e,field:r,catalogField:t,relativePath:o})}function re(e,r){return e.kind==="semantic"&&r.kind==="semantic"&&e.domainId===r.domainId}function S(e,r){return e.find(t=>F(t,r))}function q(e,r,t){const o=g(r,t);if(F(e,o))return e.fields.find(i=>te(i,r)&&F(e,g(i,e.source)))}function R(e){return d.normalizeAnalyticsCatalogName(e)}function g(e,r){return e.source||r}function F(e,r){return[e.source,...e.sourceAliases||[]].some(t=>d.semaphorSourcesReferToSameDataset(t,r))}function te(e,r){return!!(e.name&&r.name&&e.name===r.name)}function oe(e){const r=[];if(!e.intent.filters)return r;const t=e.intent.source,i=d.mergeSemaphorSourcesByIdentity(e.fieldCatalogs.flatMap(a=>[a.source,...a.sourceAliases??[]])).filter(a=>t.kind==="semantic"?a.kind==="semantic"&&a.domainId===t.domainId:a.kind==="physical"&&a.connectionId===t.connectionId).map(a=>a.kind==="semantic"?{type:"dataset",name:a.datasetName,id:a.datasetId,domainId:a.domainId,connectionId:a.connectionId}:{type:"table",name:a.tableName,database:a.databaseName,schema:a.schemaName,connectionId:a.connectionId,connectionType:a.connectionType,dialect:a.dialect}),n=(a,u)=>{r.push({field:a,path:u,validation:j({...e,field:a,relativePath:u})})},s=(a,u)=>{if(a.derivedField)Object.entries(a.derivedField.inputs).forEach(([l,f])=>n(f.field,`${u}.derivedField.inputs.${l}.field`));else if(a.calculatedFormula)a.calculatedFormula.inputFields.forEach((l,f)=>s(l,`${u}.calculatedFormula.inputFields.${f}`));else{const l=K.resolveSemaphorSourceEntity({entities:i,semanticDomainId:t.kind==="semantic"?t.domainId:void 0,connectionId:t.connectionId,connectionType:t.kind==="physical"?t.connectionType:void 0,dialect:t.kind==="physical"?t.dialect:void 0,fieldEntityType:a.entityType,entityId:a.entityId,entityName:a.entityName,qualifiedHints:[a.qualifiedEntityName]});l.kind==="resolved"?n({name:a.name,source:l.source},u):r.push({field:{name:a.name},path:u,validation:{ok:!1,code:"invalid_source_ref",source:t,message:`Filter field "${a.name}" has no unambiguous source in the visible field catalog (${l.kind}).`}})}},c=(a,u)=>{a.conditions.forEach((l,f)=>s(l.field,`${u}.conditions.${f}.field`)),a.groups.forEach((l,f)=>c(l,`${u}.groups.${f}`))};return c(e.intent.filters,"spec.filters"),r}function M(e,r={}){const t=r.pathPrefix||"analysisOptions";if(e===void 0)return{ok:!0};if(!e||typeof e!="object"||Array.isArray(e))return m(t,"Data App analysis options must be an object.");const o=e,i={};if(o.chartTitle!==void 0){if(typeof o.chartTitle!="string")return m(`${t}.chartTitle`,'Data App analysis option "chartTitle" must be a string.');i.chartTitle=o.chartTitle}if(o.chartType!==void 0){if(typeof o.chartType!="string")return m(`${t}.chartType`,'Data App analysis option "chartType" must be a string.');i.chartType=o.chartType}if(o.driverMode!==void 0){if(!ne(o.driverMode))return m(`${t}.driverMode`,'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.');i.driverMode=o.driverMode}if(o.includePopulation!==void 0){if(typeof o.includePopulation!="boolean")return m(`${t}.includePopulation`,'Data App analysis option "includePopulation" must be a boolean.');i.includePopulation=o.includePopulation}if(o.calendarContext!==void 0){const n=se(o.calendarContext,{pathPrefix:`${t}.calendarContext`,validateTimezone:r.validateTimezone});if(!n.ok)return n;i.calendarContext=n.calendarContext}return{ok:!0,analysisOptions:i}}function ie(e){const r=e.queries.map((i,n)=>ae(i,n,{fieldCatalogs:e.fieldCatalogs||[],requireFieldCatalog:!!e.requireFieldCatalog,validateTimezone:e.validateTimezone})),t=r.flatMap(i=>i.diagnostics),o=r.map(i=>i.executionResult);return{ok:t.every(i=>i.severity!=="error"),diagnostics:t,queries:r,intents:r.flatMap(i=>i.intent?[i.intent]:[]),executionResults:o}}function ae(e,r,t){const o=`queries.${r}`;try{const i=de(e),n=ke(e,i),s=d.validateSemaphorAnalyticsIntent(i),c=[...ge({querySpec:e,queryId:n,intent:i,pathPrefix:o}),...s.errors.map(u=>_(u,{queryHook:e.queryHook,queryId:n,pathPrefix:o,severity:"error",intent:i})),...s.warnings.map(u=>_(u,{queryHook:e.queryHook,queryId:n,pathPrefix:o,severity:"warning",intent:i})),...ce({querySpec:e,queryId:n,intent:i,pathPrefix:o,fieldCatalogs:t.fieldCatalogs,requireFieldCatalog:t.requireFieldCatalog}),...he({querySpec:e,queryId:n,intent:i,pathPrefix:o,validateTimezone:t.validateTimezone})],a=Se(s,c);return{queryHook:e.queryHook,queryId:n,intent:i,diagnostics:c,executionResult:x({intent:i,validation:a,diagnostics:c})}}catch(i){const n={severity:"error",code:"invalid_query_spec",message:i instanceof Error?i.message:String(i),path:o,queryHook:e.queryHook,queryId:O(e.spec)},s=z([n]);return{queryHook:e.queryHook,queryId:n.queryId,diagnostics:[n],executionResult:x({validation:s,diagnostics:[n]})}}}function m(e,r){return{ok:!1,issues:[{code:"invalid_analysis_option",message:r,path:e}]}}function D(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function ne(e){return e==="absolute_delta"||e==="largest_negative"||e==="largest_positive"||e==="positive_and_negative"||e==="all"}function se(e,r){if(!e||typeof e!="object"||Array.isArray(e))return m(r.pathPrefix,'Data App analysis option "calendarContext" must be an object.');const t=e,o=t.tz;let i=o;if(typeof o=="string"&&r.validateTimezone&&(i=r.validateTimezone(o)),i===null)return m(`${r.pathPrefix}.tz`,'Data App analysis option "calendarContext.tz" must be a valid timezone string.');const n=E.parseCalendarContext({...t,tz:i});if(!n.ok){const s=n.issues[0];return m(s!=null&&s.path?`${r.pathPrefix}.${s.path}`:r.pathPrefix,`Data App analysis option "calendarContext" is invalid: ${(s==null?void 0:s.message)??"invalid value"}.`)}return{ok:!0,calendarContext:n.value}}function de(e){return le(e.spec)}function le(e){if(!D(e))throw new Error("useSemaphorQuery spec must be an object.");if(e.queryKind==="metric")return y.toSemaphorMetricIntent(e);if(e.queryKind==="analysis")return y.toSemaphorAnalysisIntent(e);if(e.queryKind==="records")return y.toSemaphorRecordsIntent(e);if(e.queryKind==="sql")return y.toSemaphorSqlIntent(e);if(e.queryKind==="matrix")return y.toSemaphorMatrixIntent(e);if(e.queryKind==="inputOptions")return y.toSemaphorInputOptionsIntent(e);throw new Error("useSemaphorQuery spec.queryKind must be metric, analysis, records, inputOptions, sql, or matrix.")}function ce(e){if(e.intent.kind==="sql")return[];if(e.fieldCatalogs.length===0&&!e.requireFieldCatalog)return[];const r=S(e.fieldCatalogs,e.intent.source);if(!r)return[{severity:"error",code:"invalid_source_ref",message:`Source ref for ${e.querySpec.queryHook} does not match a visible Semaphor source.`,path:`${e.pathPrefix}.spec.source`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source}];const t=fe({...e,catalog:r}),o={...r,fields:[...r.fields,...ve(e.intent,r,e.intent.source)]};return[...t,...ue({...e,fieldCatalogs:e.fieldCatalogs}),...me({...e,catalog:o,fieldCatalogs:e.fieldCatalogs}),...pe({...e,catalog:o,fieldCatalogs:e.fieldCatalogs})]}function ue(e){var t;if(e.intent.kind!=="inputOptions"||((t=e.intent.population)==null?void 0:t.kind)!=="related_population")return[];const r=e.intent.population.baseSource;return S(e.fieldCatalogs,r)?[]:[{severity:"error",code:"invalid_source_ref",message:"Input options related population baseSource does not match a visible Semaphor source.",path:`${e.pathPrefix}.spec.population.baseSource`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:r}]}function fe(e){const r=B(e.intent);if(r.length===0)return[];const t=[],o=new Set;return r.forEach((i,n)=>{const s=`${e.pathPrefix}.spec.derivedFields.${n}`,c=R(i.name);c&&(o.has(c)&&t.push({severity:"error",code:"duplicate_derived_field",message:`Derived field "${i.name}" is declared more than once.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source}),o.add(c),e.catalog.fields.some(a=>R(a.name)===c)&&t.push({severity:"error",code:"derived_field_name_collision",message:`Derived field "${i.name}" conflicts with a field already visible on the selected Semaphor source.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source})),Object.entries(i.inputs||{}).forEach(([a,u])=>{const l=qe(u);if(!l)return;const f=g(l,e.intent.source);if(!d.semaphorSourcesReferToSameDataset(f,e.intent.source)){t.push({severity:"error",code:"unsupported_derived_field_source",message:`Derived field "${i.name}" input "${a}" references a different Semaphor source. App-local derived fields must use fields from the query source.`,path:`${s}.inputs.${a}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:f,field:l});return}q(e.catalog,l,e.intent.source)||t.push({severity:"error",code:"missing_field",message:`Derived field "${i.name}" input "${a}" references field "${l.name}", which is not visible on the selected Semaphor source.`,path:`${s}.inputs.${a}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:f,field:l})})}),t}function me(e){const r=Ie(e.intent).map(({field:t,path:o})=>{const i=j({intent:e.intent,field:t,relativePath:o,baseCatalog:e.catalog,fieldCatalogs:e.fieldCatalogs});return{field:t,path:o,validation:i}});return e.intent.kind==="matrix"&&r.push(...oe({intent:e.intent,baseCatalog:e.catalog,fieldCatalogs:e.fieldCatalogs})),r.flatMap(({field:t,path:o,validation:i})=>i.ok?[]:[{severity:"error",code:i.code,message:i.message,path:`${e.pathPrefix}.${o}${i.pathSuffix||""}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i.source,field:t}])}function pe(e){return("inputs"in e.intent?e.intent.inputs||[]:[]).flatMap((t,o)=>{if(!t.field)return[];const i=g(t.field,e.intent.source);if(!d.semaphorSourcesReferToSameDataset(i,e.intent.source)){if(ye(e.intent,i)){const n=S(e.fieldCatalogs,i);return n?q(n,t.field,i)?[]:[{severity:"error",code:"missing_field",message:`Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]:[{severity:"error",code:"invalid_source_ref",message:`Input "${t.inputId}" references a Semaphor source that is not present in the visible field catalog.`,path:`${e.pathPrefix}.spec.inputs.${o}.field.source`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]}return[{severity:"error",code:"unsupported_input_filter_composition",message:`Input "${t.inputId}" filters a different Semaphor source than the query, and no relationship-aware semantic validation path is available for this query kind.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]}return q(e.catalog,t.field,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]})}function ye(e,r){return e.source.kind==="semantic"&&r.kind==="semantic"&&r.domainId===e.source.domainId}function he(e){if(e.querySpec.spec.queryKind!=="analysis")return[];const r=M(e.querySpec.spec,{pathPrefix:`${e.pathPrefix}.spec`,validateTimezone:e.validateTimezone});return r.ok?[]:r.issues.map(t=>({severity:"error",code:t.code,message:t.message,path:t.path,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source}))}function ge(e){if(e.querySpec.spec.queryKind==="matrix"){const r=N.matrixWindowRequestSchema.safeParse(e.querySpec.spec.matrixWindowRequest);return r.success?[]:r.error.issues.map(t=>({severity:"error",code:"invalid_query_spec",message:t.message,path:[e.pathPrefix,"spec","matrixWindowRequest",...t.path].join("."),queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent)}))}return e.querySpec.spec.queryKind!=="sql"?[]:D(e.querySpec.spec)?Object.prototype.hasOwnProperty.call(e.querySpec.spec,"parameters")?[{severity:"error",code:"deprecated_sql_parameters",message:"semaphor.sql uses defaultParameters for static SQL param(...) fallback values. The legacy parameters field is not supported.",path:`${e.pathPrefix}.spec.parameters`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent)}]:[]:[]}function Ie(e){return e.kind==="metric"?[...e.measures.map((r,t)=>({field:r,path:`spec.measures.${t}`})),...e.primaryMeasure?[{field:e.primaryMeasure,path:"spec.primaryMeasure"}]:[],...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...(e.dimensions||[]).map((r,t)=>({field:r,path:`spec.dimensions.${t}`})),...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="records"?[...e.fields.map((r,t)=>({field:r,path:`spec.fields.${t}`})),...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="inputOptions"?[{field:e.labelField,path:"spec.labelField"},{field:e.valueField,path:"spec.valueField"},...e.searchField?[{field:e.searchField,path:"spec.searchField"}]:[],...(e.disambiguationFields||[]).map((r,t)=>({field:r,path:`spec.disambiguationFields.${t}`}))]:e.kind==="matrix"?Q.matrixDefinitionFields(e).flatMap((r,t)=>r.derivedField||r.name==="*"?[]:[{field:r,path:`spec.fields.${t}`}]):[]}function B(e){return!("derivedFields"in e)||!Array.isArray(e.derivedFields)?[]:e.derivedFields}function ve(e,r,t){return B(e).map(o=>({name:o.name,label:o.label,role:o.resultRole,dataType:o.dataType,source:r.source||t,...o.defaultAggregate?{aggregate:o.defaultAggregate}:{}}))}function qe(e){if(!(!e||typeof e!="object"))return e.field}function _(e,r){return{severity:r.severity,code:e.code||"invalid_analytics_intent",message:e.message,path:e.path?`${r.pathPrefix}.spec.${e.path}`:r.pathPrefix,queryHook:r.queryHook,queryId:r.queryId,intentId:d.getAnalyticsIntentId(r.intent),source:r.intent.source}}function Se(e,r){const t=z(r);return{ok:t.ok&&e.ok,errors:C([...e.errors,...t.errors]),warnings:C([...e.warnings,...t.warnings]),repairHints:[...e.repairHints,...t.repairHints]}}function z(e){const r=e.filter(o=>o.severity==="error").map(A),t=e.filter(o=>o.severity==="warning").map(A);return{ok:r.length===0,errors:r,warnings:t,repairHints:r.map(o=>{var i,n;return{code:o.code,message:o.message,fieldRole:o.fieldRole,invalidField:(i=o.repairHint)==null?void 0:i.invalidField,recommendedNextStep:((n=o.repairHint)==null?void 0:n.recommendedNextStep)||"Update the Data App SDK query spec to use visible Semaphor source and field refs."}})}}function A(e){var r;return{code:e.code,message:e.message,path:e.path,fieldRole:e.code==="invalid_source_ref"?"source":void 0,repairHint:{code:e.code,message:e.message,invalidField:(r=e.field)==null?void 0:r.name,fieldRole:e.code==="invalid_source_ref"?"source":void 0,recommendedNextStep:e.code==="unsupported_input_filter_composition"?"Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped queries.":"Update the query spec to use a visible Semaphor source and field ref."}}}function C(e){const r=new Set;return e.filter(t=>{const o=`${t.code}:${t.path||""}:${t.message}`;return r.has(o)?!1:(r.add(o),!0)})}function x(e){var t;const r=e.diagnostics.filter(o=>o.severity==="error");return{intentId:d.getAnalyticsIntentId(e.intent),status:r.length?"failed":"answered",resultShape:(t=e.intent)==null?void 0:t.kind,intent:e.intent,validation:e.validation,coverage:{answeredObligations:r.length?[]:["query_spec_validation"],missingObligations:r.length?["query_spec_validation"]:[],warnings:e.validation.warnings},missingFields:r.filter(o=>o.code==="missing_field").flatMap(o=>{var i;return(i=o.field)!=null&&i.name?[o.field.name]:[]}),warnings:e.diagnostics.filter(o=>o.severity==="warning").map(o=>o.message),metadata:{validationKind:"data_app_sdk_query_spec"}}}function ke(e,r){return d.getAnalyticsIntentId(r)||O(e.spec)}function O(e){if(!e||typeof e!="object"||!("id"in e))return;const r=e.id;return typeof r=="string"&&r.trim()?r:void 0}exports.fieldWithSelectedProjectionRole=I;exports.findMatchingRelatedProjectionField=v;exports.isAllowedRelatedProjectionRole=P;exports.normalizeSemaphorAnalysisQueryOptions=M;exports.normalizeSemaphorFieldRole=$;exports.relatedProjectionFieldCandidatesForIntent=U;exports.validateSemaphorDataAppQuerySpecs=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../chunks/validators-DVYAnnX0.cjs"),N=require("../chunks/matrix-operation-contract-DoiWTUbT.cjs"),E=require("../chunks/report-runtime-context-DzvHBPxl.cjs"),K=require("../chunks/source-entity-resolution-CjbgnwyX.cjs"),y=require("../data-app-sdk-adapters/index.cjs"),Q=require("../chunks/matrix-card-U4c72doZ.cjs");function W({intent:e,field:r,catalogField:t,relativePath:o}){const i=J({intent:e,field:r,relativePath:o});if(!i||i.allowedRelatedRoles.length===0)return!1;const n=I(r,i.selectedField),s=$(t),c=h(n);return P(s,i.allowedRelatedRoles)?c===s:!1}function U(e){return e.kind==="records"?L(e):e.kind==="metric"?X(e):[]}function $(e){const r=d.normalizeAnalyticsCatalogName(e.role);if(r==="measure")return"measure";if(r==="id")return"id";const t=d.normalizeAnalyticsCatalogDataType(e.dataType);if(r==="date"||t==="date"||t==="datetime")return"date";if(r==="dimension")return"dimension"}function P(e,r){return!!(e&&r.includes(e))}function I(e,r){const t=h(e);if(t)return e.role===t?e:{...e,role:t};const o=r?h(r):void 0;return o?{...e,role:o}:e}function v(e,r){return e.find(t=>T(t,r))}function J({intent:e,field:r,relativePath:t}){if(e.kind==="records")return V(e,r,t);if(e.kind==="metric")return G(e,r,t)}function V(e,r,t){if(t.startsWith("spec.fields."))return{allowedRelatedRoles:["dimension","date","id"]};if(t==="spec.dateField"&&!e.timeWindow)return{allowedRelatedRoles:["date"]};if(t==="spec.orderBy.field"){const o=v(H(e),r);return{selectedField:o,allowedRelatedRoles:o?k(o):[]}}}function G(e,r,t){if(t.startsWith("spec.dimensions."))return{allowedRelatedRoles:["dimension"]};if(t==="spec.orderBy.field"){const o=v(e.dimensions||[],r);return{selectedField:o,allowedRelatedRoles:o?["dimension"]:[]}}}function L(e){var o,i;const r=H(e),t=(o=e.orderBy)!=null&&o.field?v(r,e.orderBy.field):void 0;return b([...r.map(n=>p(n,k(n))),...(i=e.orderBy)!=null&&i.field?[p(I(e.orderBy.field,t),t?k(t):[],{unsupportedRelatedRoleMessage:"Joined records projections support related sort fields only when the same related field is included in spec.fields.",recommendedNextStep:"Add the related sort field to spec.fields, or keep orderBy fields on the base source."})]:[]])}function X(e){var t,o;const r=(t=e.orderBy)!=null&&t.field?v(e.dimensions||[],e.orderBy.field):void 0;return b([...e.measures.map(i=>p(i,[])),...e.primaryMeasure?[p(e.primaryMeasure,[])]:[],...(e.dimensions||[]).map(i=>p(i,["dimension"])),...e.dateField?[p({...e.dateField,role:"date"},[])]:[],...(o=e.orderBy)!=null&&o.field?[p(I(e.orderBy.field,r),r?["dimension"]:[],{unsupportedRelatedRoleMessage:"Joined metric projections support related orderBy fields only when the same related field is declared in spec.dimensions.",recommendedNextStep:"Add the related field as a metric dimension when it should participate in the grouped result, or keep orderBy fields on the base source."})]:[]])}function k(e){const r=e?h(e):void 0;return r==="dimension"?["dimension"]:r==="date"?["date"]:r==="id"?["id"]:["dimension","date","id"]}function p(e,r,t={}){return{field:I(e),allowedRelatedRoles:r,...t}}function b(e){const r=[];return e.forEach(t=>{r.some(o=>Y(o,t))||r.push(t)}),r}function H(e){const r=[...e.fields];return e.dateField&&!r.some(t=>w(t,e.dateField))&&r.push({...e.dateField,role:"date"}),r}function Y(e,r){return T(e.field,r.field)&&e.allowedRelatedRoles.join("|")===r.allowedRelatedRoles.join("|")&&(e.unsupportedRelatedRoleMessage||"")===(r.unsupportedRelatedRoleMessage||"")&&(e.recommendedNextStep||"")===(r.recommendedNextStep||"")}function w(e,r){return d.semaphorFieldRefsMatch(e,r)}function T(e,r){return w(e,r)&&Z(h(e),h(r))}function Z(e,r){return!!(e&&(!r||e===r))}function h(e){return $(e)}function j({intent:e,field:r,relativePath:t,baseCatalog:o,fieldCatalogs:i}){const n=g(r,e.source),s=d.semaphorSourcesReferToSameDataset(n,e.source);if(e.kind!=="matrix"&&!s&&!re(e.source,n))return{ok:!1,code:"invalid_source_ref",message:`Field "${r.name}" references a related Semaphor source outside the query's semantic domain.`,pathSuffix:".source",source:n};const c=s?o:S(i,n);if(!c)return{ok:!1,code:"invalid_source_ref",message:`Field "${r.name}" references a Semaphor source that is not present in the visible field catalog.`,pathSuffix:".source",source:n};const a=q(c,r,e.source);return a?e.kind!=="matrix"&&!s&&!ee({intent:e,field:r,catalogField:a,relativePath:t})?{ok:!1,code:"unsupported_joined_projection",message:`Field "${r.name}" references a related Semaphor source, but this query kind does not support joined projections for that field yet.`,pathSuffix:".source",source:n}:{ok:!0,source:n,catalogField:a,usesBaseSource:s}:{ok:!1,code:"missing_field",message:`Field "${r.name}" is not visible on the selected Semaphor source.`,source:n}}function ee({intent:e,field:r,catalogField:t,relativePath:o}){return W({intent:e,field:r,catalogField:t,relativePath:o})}function re(e,r){return e.kind==="semantic"&&r.kind==="semantic"&&e.domainId===r.domainId}function S(e,r){return e.find(t=>F(t,r))}function q(e,r,t){const o=g(r,t);if(F(e,o))return e.fields.find(i=>te(i,r)&&F(e,g(i,e.source)))}function R(e){return d.normalizeAnalyticsCatalogName(e)}function g(e,r){return e.source||r}function F(e,r){return[e.source,...e.sourceAliases||[]].some(t=>d.semaphorSourcesReferToSameDataset(t,r))}function te(e,r){return!!(e.name&&r.name&&e.name===r.name)}function oe(e){const r=[];if(!e.intent.filters)return r;const t=e.intent.source,i=d.mergeSemaphorSourcesByIdentity(e.fieldCatalogs.flatMap(a=>[a.source,...a.sourceAliases??[]])).filter(a=>t.kind==="semantic"?a.kind==="semantic"&&a.domainId===t.domainId:a.kind==="physical"&&a.connectionId===t.connectionId).map(a=>a.kind==="semantic"?{type:"dataset",name:a.datasetName,id:a.datasetId,domainId:a.domainId,connectionId:a.connectionId}:{type:"table",name:a.tableName,database:a.databaseName,schema:a.schemaName,connectionId:a.connectionId,connectionType:a.connectionType,dialect:a.dialect}),n=(a,u)=>{r.push({field:a,path:u,validation:j({...e,field:a,relativePath:u})})},s=(a,u)=>{if(a.derivedField)Object.entries(a.derivedField.inputs).forEach(([l,f])=>n(f.field,`${u}.derivedField.inputs.${l}.field`));else if(a.calculatedFormula)a.calculatedFormula.inputFields.forEach((l,f)=>s(l,`${u}.calculatedFormula.inputFields.${f}`));else{const l=K.resolveSemaphorSourceEntity({entities:i,semanticDomainId:t.kind==="semantic"?t.domainId:void 0,connectionId:t.connectionId,connectionType:t.kind==="physical"?t.connectionType:void 0,dialect:t.kind==="physical"?t.dialect:void 0,fieldEntityType:a.entityType,entityId:a.entityId,entityName:a.entityName,qualifiedHints:[a.qualifiedEntityName]});l.kind==="resolved"?n({name:a.name,source:l.source},u):r.push({field:{name:a.name},path:u,validation:{ok:!1,code:"invalid_source_ref",source:t,message:`Filter field "${a.name}" has no unambiguous source in the visible field catalog (${l.kind}).`}})}},c=(a,u)=>{a.conditions.forEach((l,f)=>s(l.field,`${u}.conditions.${f}.field`)),a.groups.forEach((l,f)=>c(l,`${u}.groups.${f}`))};return c(e.intent.filters,"spec.filters"),r}function M(e,r={}){const t=r.pathPrefix||"analysisOptions";if(e===void 0)return{ok:!0};if(!e||typeof e!="object"||Array.isArray(e))return m(t,"Data App analysis options must be an object.");const o=e,i={};if(o.chartTitle!==void 0){if(typeof o.chartTitle!="string")return m(`${t}.chartTitle`,'Data App analysis option "chartTitle" must be a string.');i.chartTitle=o.chartTitle}if(o.chartType!==void 0){if(typeof o.chartType!="string")return m(`${t}.chartType`,'Data App analysis option "chartType" must be a string.');i.chartType=o.chartType}if(o.driverMode!==void 0){if(!ne(o.driverMode))return m(`${t}.driverMode`,'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.');i.driverMode=o.driverMode}if(o.includePopulation!==void 0){if(typeof o.includePopulation!="boolean")return m(`${t}.includePopulation`,'Data App analysis option "includePopulation" must be a boolean.');i.includePopulation=o.includePopulation}if(o.calendarContext!==void 0){const n=se(o.calendarContext,{pathPrefix:`${t}.calendarContext`,validateTimezone:r.validateTimezone});if(!n.ok)return n;i.calendarContext=n.calendarContext}return{ok:!0,analysisOptions:i}}function ie(e){const r=e.queries.map((i,n)=>ae(i,n,{fieldCatalogs:e.fieldCatalogs||[],requireFieldCatalog:!!e.requireFieldCatalog,validateTimezone:e.validateTimezone})),t=r.flatMap(i=>i.diagnostics),o=r.map(i=>i.executionResult);return{ok:t.every(i=>i.severity!=="error"),diagnostics:t,queries:r,intents:r.flatMap(i=>i.intent?[i.intent]:[]),executionResults:o}}function ae(e,r,t){const o=`queries.${r}`;try{const i=de(e),n=ke(e,i),s=d.validateSemaphorAnalyticsIntent(i),c=[...ge({querySpec:e,queryId:n,intent:i,pathPrefix:o}),...s.errors.map(u=>_(u,{queryHook:e.queryHook,queryId:n,pathPrefix:o,severity:"error",intent:i})),...s.warnings.map(u=>_(u,{queryHook:e.queryHook,queryId:n,pathPrefix:o,severity:"warning",intent:i})),...ce({querySpec:e,queryId:n,intent:i,pathPrefix:o,fieldCatalogs:t.fieldCatalogs,requireFieldCatalog:t.requireFieldCatalog}),...he({querySpec:e,queryId:n,intent:i,pathPrefix:o,validateTimezone:t.validateTimezone})],a=Se(s,c);return{queryHook:e.queryHook,queryId:n,intent:i,diagnostics:c,executionResult:x({intent:i,validation:a,diagnostics:c})}}catch(i){const n={severity:"error",code:"invalid_query_spec",message:i instanceof Error?i.message:String(i),path:o,queryHook:e.queryHook,queryId:O(e.spec)},s=z([n]);return{queryHook:e.queryHook,queryId:n.queryId,diagnostics:[n],executionResult:x({validation:s,diagnostics:[n]})}}}function m(e,r){return{ok:!1,issues:[{code:"invalid_analysis_option",message:r,path:e}]}}function D(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function ne(e){return e==="absolute_delta"||e==="largest_negative"||e==="largest_positive"||e==="positive_and_negative"||e==="all"}function se(e,r){if(!e||typeof e!="object"||Array.isArray(e))return m(r.pathPrefix,'Data App analysis option "calendarContext" must be an object.');const t=e,o=t.tz;let i=o;if(typeof o=="string"&&r.validateTimezone&&(i=r.validateTimezone(o)),i===null)return m(`${r.pathPrefix}.tz`,'Data App analysis option "calendarContext.tz" must be a valid timezone string.');const n=E.parseCalendarContext({...t,tz:i});if(!n.ok){const s=n.issues[0];return m(s!=null&&s.path?`${r.pathPrefix}.${s.path}`:r.pathPrefix,`Data App analysis option "calendarContext" is invalid: ${(s==null?void 0:s.message)??"invalid value"}.`)}return{ok:!0,calendarContext:n.value}}function de(e){return le(e.spec)}function le(e){if(!D(e))throw new Error("useSemaphorQuery spec must be an object.");if(e.queryKind==="metric")return y.toSemaphorMetricIntent(e);if(e.queryKind==="analysis")return y.toSemaphorAnalysisIntent(e);if(e.queryKind==="records")return y.toSemaphorRecordsIntent(e);if(e.queryKind==="sql")return y.toSemaphorSqlIntent(e);if(e.queryKind==="matrix")return y.toSemaphorMatrixIntent(e);if(e.queryKind==="inputOptions")return y.toSemaphorInputOptionsIntent(e);throw new Error("useSemaphorQuery spec.queryKind must be metric, analysis, records, inputOptions, sql, or matrix.")}function ce(e){if(e.intent.kind==="sql")return[];if(e.fieldCatalogs.length===0&&!e.requireFieldCatalog)return[];const r=S(e.fieldCatalogs,e.intent.source);if(!r)return[{severity:"error",code:"invalid_source_ref",message:`Source ref for ${e.querySpec.queryHook} does not match a visible Semaphor source.`,path:`${e.pathPrefix}.spec.source`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source}];const t=fe({...e,catalog:r}),o={...r,fields:[...r.fields,...ve(e.intent,r,e.intent.source)]};return[...t,...ue({...e,fieldCatalogs:e.fieldCatalogs}),...me({...e,catalog:o,fieldCatalogs:e.fieldCatalogs}),...pe({...e,catalog:o,fieldCatalogs:e.fieldCatalogs})]}function ue(e){var t;if(e.intent.kind!=="inputOptions"||((t=e.intent.population)==null?void 0:t.kind)!=="related_population")return[];const r=e.intent.population.baseSource;return S(e.fieldCatalogs,r)?[]:[{severity:"error",code:"invalid_source_ref",message:"Input options related population baseSource does not match a visible Semaphor source.",path:`${e.pathPrefix}.spec.population.baseSource`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:r}]}function fe(e){const r=B(e.intent);if(r.length===0)return[];const t=[],o=new Set;return r.forEach((i,n)=>{const s=`${e.pathPrefix}.spec.derivedFields.${n}`,c=R(i.name);c&&(o.has(c)&&t.push({severity:"error",code:"duplicate_derived_field",message:`Derived field "${i.name}" is declared more than once.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source}),o.add(c),e.catalog.fields.some(a=>R(a.name)===c)&&t.push({severity:"error",code:"derived_field_name_collision",message:`Derived field "${i.name}" conflicts with a field already visible on the selected Semaphor source.`,path:`${s}.name`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source})),Object.entries(i.inputs||{}).forEach(([a,u])=>{const l=qe(u);if(!l)return;const f=g(l,e.intent.source);if(!d.semaphorSourcesReferToSameDataset(f,e.intent.source)){t.push({severity:"error",code:"unsupported_derived_field_source",message:`Derived field "${i.name}" input "${a}" references a different Semaphor source. App-local derived fields must use fields from the query source.`,path:`${s}.inputs.${a}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:f,field:l});return}q(e.catalog,l,e.intent.source)||t.push({severity:"error",code:"missing_field",message:`Derived field "${i.name}" input "${a}" references field "${l.name}", which is not visible on the selected Semaphor source.`,path:`${s}.inputs.${a}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:f,field:l})})}),t}function me(e){const r=Ie(e.intent).map(({field:t,path:o})=>{const i=j({intent:e.intent,field:t,relativePath:o,baseCatalog:e.catalog,fieldCatalogs:e.fieldCatalogs});return{field:t,path:o,validation:i}});return e.intent.kind==="matrix"&&r.push(...oe({intent:e.intent,baseCatalog:e.catalog,fieldCatalogs:e.fieldCatalogs})),r.flatMap(({field:t,path:o,validation:i})=>i.ok?[]:[{severity:"error",code:i.code,message:i.message,path:`${e.pathPrefix}.${o}${i.pathSuffix||""}`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i.source,field:t}])}function pe(e){return("inputs"in e.intent?e.intent.inputs||[]:[]).flatMap((t,o)=>{if(!t.field)return[];const i=g(t.field,e.intent.source);if(!d.semaphorSourcesReferToSameDataset(i,e.intent.source)){if(ye(e.intent,i)){const n=S(e.fieldCatalogs,i);return n?q(n,t.field,i)?[]:[{severity:"error",code:"missing_field",message:`Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]:[{severity:"error",code:"invalid_source_ref",message:`Input "${t.inputId}" references a Semaphor source that is not present in the visible field catalog.`,path:`${e.pathPrefix}.spec.inputs.${o}.field.source`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]}return[{severity:"error",code:"unsupported_input_filter_composition",message:`Input "${t.inputId}" filters a different Semaphor source than the query, and no relationship-aware semantic validation path is available for this query kind.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]}return q(e.catalog,t.field,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:i,field:t.field}]})}function ye(e,r){return e.source.kind==="semantic"&&r.kind==="semantic"&&r.domainId===e.source.domainId}function he(e){if(e.querySpec.spec.queryKind!=="analysis")return[];const r=M(e.querySpec.spec,{pathPrefix:`${e.pathPrefix}.spec`,validateTimezone:e.validateTimezone});return r.ok?[]:r.issues.map(t=>({severity:"error",code:t.code,message:t.message,path:t.path,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent),source:e.intent.source}))}function ge(e){if(e.querySpec.spec.queryKind==="matrix"){const r=N.matrixWindowRequestSchema.safeParse(e.querySpec.spec.matrixWindowRequest);return r.success?[]:r.error.issues.map(t=>({severity:"error",code:"invalid_query_spec",message:t.message,path:[e.pathPrefix,"spec","matrixWindowRequest",...t.path].join("."),queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent)}))}return e.querySpec.spec.queryKind!=="sql"?[]:D(e.querySpec.spec)?Object.prototype.hasOwnProperty.call(e.querySpec.spec,"parameters")?[{severity:"error",code:"deprecated_sql_parameters",message:"semaphor.sql uses defaultParameters for static SQL param(...) fallback values. The legacy parameters field is not supported.",path:`${e.pathPrefix}.spec.parameters`,queryHook:e.querySpec.queryHook,queryId:e.queryId,intentId:d.getAnalyticsIntentId(e.intent)}]:[]:[]}function Ie(e){return e.kind==="metric"?[...e.measures.map((r,t)=>({field:r,path:`spec.measures.${t}`})),...e.primaryMeasure?[{field:e.primaryMeasure,path:"spec.primaryMeasure"}]:[],...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...(e.dimensions||[]).map((r,t)=>({field:r,path:`spec.dimensions.${t}`})),...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="records"?[...e.fields.map((r,t)=>({field:r,path:`spec.fields.${t}`})),...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((r,t)=>({field:r.field,path:`spec.filters.${t}.field`}))]:e.kind==="inputOptions"?[{field:e.labelField,path:"spec.labelField"},{field:e.valueField,path:"spec.valueField"},...e.searchField?[{field:e.searchField,path:"spec.searchField"}]:[],...(e.disambiguationFields||[]).map((r,t)=>({field:r,path:`spec.disambiguationFields.${t}`}))]:e.kind==="matrix"?Q.matrixDefinitionFields(e).flatMap((r,t)=>r.derivedField||r.name==="*"?[]:[{field:r,path:`spec.fields.${t}`}]):[]}function B(e){return!("derivedFields"in e)||!Array.isArray(e.derivedFields)?[]:e.derivedFields}function ve(e,r,t){return B(e).map(o=>({name:o.name,label:o.label,role:o.resultRole,dataType:o.dataType,source:r.source||t,...o.defaultAggregate?{aggregate:o.defaultAggregate}:{}}))}function qe(e){if(!(!e||typeof e!="object"))return e.field}function _(e,r){return{severity:r.severity,code:e.code||"invalid_analytics_intent",message:e.message,path:e.path?`${r.pathPrefix}.spec.${e.path}`:r.pathPrefix,queryHook:r.queryHook,queryId:r.queryId,intentId:d.getAnalyticsIntentId(r.intent),source:r.intent.source}}function Se(e,r){const t=z(r);return{ok:t.ok&&e.ok,errors:C([...e.errors,...t.errors]),warnings:C([...e.warnings,...t.warnings]),repairHints:[...e.repairHints,...t.repairHints]}}function z(e){const r=e.filter(o=>o.severity==="error").map(A),t=e.filter(o=>o.severity==="warning").map(A);return{ok:r.length===0,errors:r,warnings:t,repairHints:r.map(o=>{var i,n;return{code:o.code,message:o.message,fieldRole:o.fieldRole,invalidField:(i=o.repairHint)==null?void 0:i.invalidField,recommendedNextStep:((n=o.repairHint)==null?void 0:n.recommendedNextStep)||"Update the Data App SDK query spec to use visible Semaphor source and field refs."}})}}function A(e){var r;return{code:e.code,message:e.message,path:e.path,fieldRole:e.code==="invalid_source_ref"?"source":void 0,repairHint:{code:e.code,message:e.message,invalidField:(r=e.field)==null?void 0:r.name,fieldRole:e.code==="invalid_source_ref"?"source":void 0,recommendedNextStep:e.code==="unsupported_input_filter_composition"?"Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped queries.":"Update the query spec to use a visible Semaphor source and field ref."}}}function C(e){const r=new Set;return e.filter(t=>{const o=`${t.code}:${t.path||""}:${t.message}`;return r.has(o)?!1:(r.add(o),!0)})}function x(e){var t;const r=e.diagnostics.filter(o=>o.severity==="error");return{intentId:d.getAnalyticsIntentId(e.intent),status:r.length?"failed":"answered",resultShape:(t=e.intent)==null?void 0:t.kind,intent:e.intent,validation:e.validation,coverage:{answeredObligations:r.length?[]:["query_spec_validation"],missingObligations:r.length?["query_spec_validation"]:[],warnings:e.validation.warnings},missingFields:r.filter(o=>o.code==="missing_field").flatMap(o=>{var i;return(i=o.field)!=null&&i.name?[o.field.name]:[]}),warnings:e.diagnostics.filter(o=>o.severity==="warning").map(o=>o.message),metadata:{validationKind:"data_app_sdk_query_spec"}}}function ke(e,r){return d.getAnalyticsIntentId(r)||O(e.spec)}function O(e){if(!e||typeof e!="object"||!("id"in e))return;const r=e.id;return typeof r=="string"&&r.trim()?r:void 0}exports.fieldWithSelectedProjectionRole=I;exports.findMatchingRelatedProjectionField=v;exports.isAllowedRelatedProjectionRole=P;exports.normalizeSemaphorAnalysisQueryOptions=M;exports.normalizeSemaphorFieldRole=$;exports.relatedProjectionFieldCandidatesForIntent=U;exports.validateSemaphorDataAppQuerySpecs=ie;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ah as b, ak as N, k as O, a_ as v, u as E, ac as K, aW as l } from "../chunks/validators-BDYzZFgs.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Q } from "../chunks/matrix-operation-contract-xL8IhFzp.js";
|
|
3
3
|
import { p as W } from "../chunks/report-runtime-context-DWvUf1HT.js";
|
|
4
4
|
import { o as U } from "../chunks/source-entity-resolution-DZhUckix.js";
|
|
5
5
|
import { toSemaphorMetricIntent as J, toSemaphorAnalysisIntent as V, toSemaphorRecordsIntent as G, toSemaphorSqlIntent as L, toSemaphorMatrixIntent as X, toSemaphorInputOptionsIntent as Y } from "../data-app-sdk-adapters/index.js";
|
|
6
|
-
import { m as Z } from "../chunks/matrix-card-
|
|
6
|
+
import { m as Z } from "../chunks/matrix-card-CnKQpnsj.js";
|
|
7
7
|
function ee({
|
|
8
8
|
intent: e,
|
|
9
9
|
field: r,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../chunks/semantic-format-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../chunks/semantic-format-BzH69TRq.cjs"),c=require("../chunks/raw-temporal-BUeTpG76.cjs"),T=require("../chunks/matrix-formatter-CveLJo6S.cjs"),n=require("../chunks/pivot-header-presentation-Cxz8-06f.cjs"),x=require("../chunks/validators-DVYAnnX0.cjs"),h=require("../chunks/matrix-continuation-6nhDy-lF.cjs");require("../chunks/matrix-operation-contract-DoiWTUbT.cjs");const q=require("../chunks/matrix-definition-CBJW_4ii.cjs"),C=require("../pdf-export-policy/index.cjs"),E=require("../chunks/pivot-result-lifecycle-BiERyXnS.cjs"),d=require("../chunks/temporal-bucket-4YEPEKlJ.cjs"),X=require("../chunks/metric-comparison-DBQ3EJTz.cjs"),w=require("../chunks/pivot-result-identity-uTiylUNr.cjs"),N=require("../chunks/raw-temporal-contract-DECbTuzA.cjs");function O(e,r){const a=[];r.includeHeaders&&a.push(n.arrayToCSVRow(r.visibleColumns,r.delimiter));for(const o of e){const s=T.formatRowForExport(o,r);a.push(s.map(i=>n.escapeCSVValue(i,r.delimiter)).join(r.delimiter))}return a}function $(e,r,a=`
|
|
2
2
|
`){return O(e,r).join(a)}function V(e,r,a){for(const o of e){if(o.level<a){r[o.level].push(o.name);for(let s=1;s<o.colspan;s++)r[o.level].push("")}o.children?V(o.children,r,a):o.columnKey&&r[a].push(o.name)}}function k(e){const r=e.pivotByColumns.length,a=e.groupByColumns.length,o=Array.from({length:r+1},()=>[]);for(let s=0;s<r;s++)o[s].push(...Array(a).fill(""));if(o[r].push(...e.groupByColumns.map(s=>s.label||s.name)),V(e.columnHeadersTree,o,r),e.showRowTotals){for(let s=0;s<r;s++)o[s].push("");o[r].push("Total")}return o}function G(e,r,a){if(e==null)return"";if(!a.useFormattedValues)return String(e);const o=a.columnSettings[r];return typeof e=="number"&&(o==null?void 0:o.type)==="number"?c.formatNumberWithColumnSettings(e,o.numberFormat,a.locale):typeof e=="number"?e.toLocaleString(a.locale):String(e)}function L(e,r,a){const o=[];e.fieldValues.forEach((i,t)=>{e.isSubtotal&&t===0?o.push(`${i} Total`):e.isSubtotal?o.push(""):o.push(String(i??""))});let s=0;return r.columnHeaders.forEach(i=>{var u;const t=(u=e.cells[i])==null?void 0:u.value,m=G(t,i,a);o.push(m),r.showRowTotals&&typeof t=="number"&&(s+=t)}),r.showRowTotals&&o.push(s.toLocaleString(a.locale)),o}function H(e,r,a){const o=[];if(a.includeHeaders){const s=k(r);for(const i of s)o.push(n.arrayToCSVRow(i,a.delimiter))}for(const s of e){const i=L(s,r,a);o.push(i.map(t=>n.escapeCSVValue(t,a.delimiter)).join(a.delimiter))}return o}function B(e,r,a){const o=T.prepareMatrixFormatting(e.descriptors,r.presentation,a),s=e.columns.map(l=>{var p;return l.kind==="measure"&&((p=o.measureSemantics.get(l.measureId))==null?void 0:p.isNumeric)===!0}),i=l=>T.matrixMemberLabel([l],o.levels),t=(l,p,f)=>T.matrixAxisLabel(l,p,r.presentation.totals[f],o.levels),m=e.columns.map(l=>{if(l.kind!=="measure")return l.label;const p=l.columnPath.map(i);return l.role!=="member"&&p.push(t(l.columnPath,l.role,"columns")),[...p,l.label].join(" / ")}),u=Math.min(r.spec.columns.length,Math.max(0,...e.columns.map(l=>l.kind==="measure"?l.columnPath.length+(l.role!=="member"?1:0):0))),R=Array.from({length:u+1},(l,p)=>e.columns.map(f=>p===u?f.label:f.kind!=="measure"?"":p<f.columnPath.length?i(f.columnPath[p]):p===f.columnPath.length&&f.role!=="member"?t(f.columnPath,f.role,"columns"):"")),b=(l,p)=>{if(l.kind!=="layout")throw new Error("Layout presentation requires layout rows.");if(l.values.length!==e.columns.length)throw new Error("Matrix row does not match its frozen layout.");const f=T.matrixLevelLabels({path:l.rowPath,role:l.role,levelCount:Math.max(1,r.spec.rows.length),repeatLabels:r.presentation.layout.kind!=="tabular"||r.presentation.layout.repeatLabels,previousPath:p==null?void 0:p.rowPath});return e.columns.map((v,S)=>{if(v.kind==="hierarchy")return`${" ".repeat(Math.max(0,l.rowPath.length-1))}${t(l.rowPath,l.role,"rows")}`;if(v.kind==="level"){const y=r.spec.rows.findIndex(D=>D.id===v.levelId),g=f[y];return g!=null&&g.visible?g.total?t(l.rowPath,l.role,"rows"):T.matrixMemberLabel(g.path,o.levels):""}const A=l.values[S],_=o.measures.get(v.measureId);if(A.kind==="value"&&!_)throw new Error("Matrix value is missing its measure descriptor.");return T.matrixCellText(A,_,r.presentation.absence)})},P=(l,p)=>b(l,p).map((f,v)=>{var y;const S=l.values[v],A=e.columns[v];return A.kind==="measure"&&!((y=o.measureSemantics.get(A.measureId))!=null&&y.hasTextAffixes)&&S.kind==="value"&&(typeof S.value=="number"||x.isExactNumericValue(S.value))?f:n.protectCSVText(f)});return{headers:m,headerBands:R,row:l=>b(l),numericColumns:s,csvRow:l=>P(l),csvRows:l=>l.map((p,f)=>P(p,l[f-1]))}}function U(e){return e.columns.map(r=>n.protectCSVText(r.label))}function j(e){if(e.kind!=="flat")throw new Error("Raw Matrix CSV requires flat rows.");return e.values.map(r=>r.kind!=="value"?null:x.isExactNumericValue(r.value)?r.value.value:typeof r.value=="string"?n.protectCSVText(r.value):typeof r.value=="boolean"?String(r.value):r.value)}function z(e){const r=B(e.layout,e.request,e.report),a=e.layout.columns.map((t,m)=>({index:m,columnId:`matrix:${m}`,label:r.headers[m],isNumeric:r.numericColumns[m]})),o=(t,m,u)=>({text:t,colspan:1,rowspan:1,columnId:a[m].columnId,isHeader:u,isNumeric:a[m].isNumeric,className:a[m].isNumeric?"numeric":e.layout.columns[m].kind==="hierarchy"?"matrix-hierarchy":""}),s=[],i=e.layout.columns.findIndex(t=>t.kind==="measure");e.request.spec.columns.length&&i>=0&&s.push({repeatHeader:!0,headerType:"pivot-axis",headerRowIndex:0,cells:[...i?[{...o("",0,!0),colspan:i}]:[],{...o(e.request.spec.columns.map(t=>q.getMatrixLevelLabel(t,e.request.presentation)).join(" / "),i,!0),colspan:e.layout.columns.length-i,isNumeric:!1,className:""}]});for(const[t,m]of r.headerBands.entries())s.push({repeatHeader:!0,headerType:t===r.headerBands.length-1?"metrics":"pivot-level",headerRowIndex:s.length,cells:m.map((u,R)=>o(u,R,!0))});return{headers:s,rows:e.rows.map((t,m)=>({index:m,type:t.kind==="layout"&&t.role!=="member"?"subtotal":"data",subtotalLevel:String(t.rowPath.length),cells:r.row(t).map((u,R)=>o(u,R,!1))})),grandTotal:null,metadata:{tableType:"pivot",totalRows:e.rows.length,totalColumns:a.length,rowLevels:e.layout.columns.filter(t=>t.kind!=="measure").length,pivotLevels:e.request.spec.columns.length,hasGrandTotal:!1,columnOrder:a.map(t=>t.columnId),columns:a}}}function F(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function M(e,r,a){const o=new Set(r),s=Object.keys(e).find(i=>!o.has(i));if(s)throw new Error(`${a} contains unknown property "${s}"`)}function K(e,r="tableTotalsRequest"){if(!F(e))throw new Error(`${r} must be an object`);if(M(e,["source","columns"],r),e.source!=="documentFlatTable")throw new Error(`${r}.source must be documentFlatTable`);if(!Array.isArray(e.columns)||e.columns.length===0)throw new Error(`${r}.columns must be a non-empty array`);let a=0;const o=e.columns.map((t,m)=>{const u=`${r}.columns.${m}`;if(!F(t))throw new Error(`${u} must be an object`);M(t,["fieldId","role","behavior","metricAlias","label"],u);const R=typeof t.fieldId=="string"?t.fieldId.trim():"";if(!R)throw new Error(`${u}.fieldId must be a non-empty string`);if(t.role!=="detail"&&t.role!=="groupby"&&t.role!=="metric")throw new Error(`${u}.role is invalid`);const b=t.role;if(t.behavior!=="sum"&&t.behavior!=="avg"&&t.behavior!=="count"&&t.behavior!=="label")throw new Error(`${u}.behavior is invalid`);const P=t.behavior,l=typeof t.metricAlias=="string"?t.metricAlias.trim():void 0;if(t.metricAlias!==void 0&&!l)throw new Error(`${u}.metricAlias must be a non-empty string`);if(l&&b!=="metric")throw new Error(`${u}.metricAlias requires metric role`);if(P==="label"){if(a+=1,b==="metric")throw new Error(`${u}.behavior label requires a non-metric role`)}else if(b!=="metric")throw new Error(`${u}.${P} requires metric role`);if(t.label!==void 0&&typeof t.label!="string")throw new Error(`${u}.label must be a string`);return{fieldId:R,role:b,behavior:P,...l?{metricAlias:l}:{},...t.label!==void 0?{label:t.label}:{}}}),s=new Map,i=new Set;for(const t of o){if(t.metricAlias){if(i.has(t.metricAlias))throw new Error(`${r}.columns duplicates metricAlias "${t.metricAlias}"`);i.add(t.metricAlias)}const m=s.get(t.fieldId)??[];m.push(t),s.set(t.fieldId,m)}for(const[t,m]of s)if(m.length!==1){for(const u of m)if(u.role!=="metric"||!u.metricAlias)throw new Error(`${r}.columns duplicates fieldId "${t}" without distinct metricAlias values`)}if(a>1)throw new Error(`${r}.columns may contain at most one label`);return{source:"documentFlatTable",columns:o}}function Y(e,r="tableTotalsByColumnId"){if(!F(e))throw new Error(`${r} must be an object`);const a={};for(const[o,s]of Object.entries(e)){if(!o.trim())throw new Error(`${r} contains an empty column id`);if(s!==null&&typeof s!="string"&&(typeof s!="number"||!Number.isFinite(s)))throw new Error(`${r}.${o} must be a string, finite number, or null`);a[o]=s}if(Object.keys(a).length===0)throw new Error(`${r} must not be empty`);return a}function W(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.trim())return null;const r=Number(e);return Number.isFinite(r)?r:null}function Q(e){const r=e.visibleColumns.map(a=>{const s=Object.prototype.hasOwnProperty.call(e.totalsByColumnId,a)?e.totalsByColumnId[a]:a===e.labelColumnKey?"Total":null;if(s===null)return"";if(!e.useFormattedValues)return String(s);const i=E.findResolvedNumericFormat({snapshot:e.snapshot,scope:e.scope,target:{kind:"column",columnKey:a}}),t=i?W(s):null;return i&&t!==null?c.formatNumericCanonical(t,i):String(s)});return`${n.arrayToCSVRow(r,e.delimiter)}
|
|
3
3
|
`}exports.fromSemanticFormat=I.fromSemanticFormat;exports.isNumericCanonicalFormat=I.isNumericCanonicalFormat;exports.RawTemporalFormatContractError=c.RawTemporalFormatContractError;exports.assertRawTemporalChunkClassificationAgreement=c.assertRawTemporalChunkClassificationAgreement;exports.classifyDeclaredSqlTemporalColumn=c.classifyDeclaredSqlTemporalColumn;exports.createRawTemporalChunkClassificationEvidence=c.createRawTemporalChunkClassificationEvidence;exports.formatCurrency=c.formatCurrency;exports.formatNumber=c.formatNumber;exports.formatNumberCustom=c.formatNumberCustom;exports.formatNumberWithColumnSettings=c.formatNumberWithColumnSettings;exports.formatNumericCanonical=c.formatNumericCanonical;exports.formatPercent=c.formatPercent;exports.formatRawTemporalValue=c.formatRawTemporalValue;exports.formatScientific=c.formatScientific;exports.parseNumericCanonicalFormat=c.parseNumericCanonicalFormat;exports.parseRawTemporalChunkClassificationEvidence=c.parseRawTemporalChunkClassificationEvidence;exports.parseResolvedNumericCanonicalFormat=c.parseResolvedNumericCanonicalFormat;exports.parseResolvedRawTemporalFormat=c.parseResolvedRawTemporalFormat;exports.prepareRawTemporalFormatter=c.prepareRawTemporalFormatter;exports.resolveCurrencyFractionDigits=c.resolveCurrencyFractionDigits;exports.resolveNumericPresentation=c.resolveNumericPresentation;exports.resolveRawTemporalFormat=c.resolveRawTemporalFormat;exports.validateCardExportNumericPresentationSnapshot=c.validateCardExportNumericPresentationSnapshot;exports.validateRawTemporalPattern=c.validateRawTemporalPattern;exports.formatCellValue=T.formatCellValue;exports.formatDate=T.formatDate;exports.formatDuration=T.formatDuration;exports.formatRelativeTime=T.formatRelativeTime;exports.formatRowForExport=T.formatRowForExport;exports.getTimezoneAbbreviation=T.getTimezoneAbbreviation;exports.getTimezoneName=T.getTimezoneName;exports.parseWithSourceTimezone=T.parseWithSourceTimezone;exports.resolveTimezone=T.resolveTimezone;exports.AGGREGATE_PDF_CONTINUATION_CLASS=n.PDF_GROUP_CONTINUATION_CLASS;exports.AGGREGATE_TOTAL_MEMBER_MARKER=n.AGGREGATE_TOTAL_MEMBER_MARKER;exports.DIRECT_CSV_EXPORT_MAX_ROWS=n.DIRECT_CSV_EXPORT_MAX_ROWS;exports.FULL_DATASET_CSV_EXPORT_MAX_ROWS=n.FULL_DATASET_CSV_EXPORT_MAX_ROWS;exports.MATRIX_EXPORT_MAX_ARTIFACT_BYTES=n.MATRIX_EXPORT_MAX_ARTIFACT_BYTES;exports.MATRIX_EXPORT_MAX_CELLS=n.MATRIX_EXPORT_MAX_CELLS;exports.MATRIX_EXPORT_MAX_ENCODED_BYTES=n.MATRIX_EXPORT_MAX_ENCODED_BYTES;exports.PDF_GROUP_CONTINUATION_CLASS=n.PDF_GROUP_CONTINUATION_CLASS;exports.PdfSafetyLimitError=n.PdfSafetyLimitError;exports.PivotHeaderPresentationError=n.PivotHeaderPresentationError;exports.arrayToCSV=n.arrayToCSV;exports.arrayToCSVRow=n.arrayToCSVRow;exports.escapeCSVValue=n.escapeCSVValue;exports.formatAggregateGrandTotalLabel=n.formatAggregateGrandTotalLabel;exports.formatAggregateGroupCell=n.formatAggregateGroupCell;exports.formatAggregateGroupRow=n.formatAggregateGroupRow;exports.formatAggregateSubtotalLabel=n.formatAggregateSubtotalLabel;exports.formatMetricComparison=n.formatMetricComparison;exports.isAggregateTotalMemberMarker=n.isAggregateTotalMemberMarker;exports.objectsToCSV=n.objectsToCSV;exports.presentAggregateGroupRow=n.presentAggregateGroupRow;exports.presentPivotHeader=n.presentPivotHeader;exports.protectCSVText=n.protectCSVText;exports.readPdfErrorResponse=n.readPdfErrorResponse;exports.requestStructuredPdf=n.requestStructuredPdf;exports.requiresChunkedCsvExport=n.requiresChunkedCsvExport;exports.resolveAggregateTablePresentationContext=n.resolveAggregateTablePresentationContext;exports.shouldPresentAggregateGroupValue=n.shouldPresentAggregateGroupValue;exports.SEMAPHOR_GENERATED_COUNT_METRIC_ID=x.SEMAPHOR_GENERATED_COUNT_METRIC_ID;exports.MATRIX_EXPORT_TRANSFER_BYTES=h.MATRIX_EXPORT_TRANSFER_BYTES;exports.assertMatrixBatchResponseSize=h.assertMatrixBatchResponseSize;exports.matrixAttemptKey=h.matrixAttemptKey;exports.matrixBatchInputSchema=h.matrixBatchInputSchema;exports.matrixBatchResponseSchema=h.matrixBatchResponseSchema;exports.matrixExportDeadlineSchema=h.matrixExportDeadlineSchema;exports.matrixManifestSchema=h.matrixManifestSchema;exports.parseMatrixAttemptKey=h.parseMatrixAttemptKey;exports.parseMatrixBatchResponse=h.parseMatrixBatchResponse;exports.parseMatrixManifest=h.parseMatrixManifest;exports.FAST_PDF_POLICY=C.FAST_PDF_POLICY;exports.PDF_SAFETY_LIMIT_EXCEEDED=C.PDF_SAFETY_LIMIT_EXCEEDED;exports.getUtf8ByteLength=C.getUtf8ByteLength;exports.isFastPdfOutputSizeEligible=C.isFastPdfOutputSizeEligible;exports.isFastPdfPageCountEligible=C.isFastPdfPageCountEligible;exports.isFastPdfRequestSizeEligible=C.isFastPdfRequestSizeEligible;exports.isFastPdfRowCountEligible=C.isFastPdfRowCountEligible;exports.MissingResolvedRawTemporalFormatError=E.MissingResolvedRawTemporalFormatError;exports.PivotResultLifecycleError=E.PivotResultLifecycleError;exports.PresentationExecutionSnapshotError=E.PresentationExecutionSnapshotError;exports.createCanonicalPivotResultTransport=E.createCanonicalPivotResultTransport;exports.createPresentationExecutionSnapshot=E.createPresentationExecutionSnapshot;exports.deriveMetricInstanceAliasExpectations=E.deriveMetricInstanceAliasExpectations;exports.derivePivotResultContractExpectations=E.derivePivotResultContractExpectations;exports.findResolvedNumericFormat=E.findResolvedNumericFormat;exports.findResolvedRawTemporalFormat=E.findResolvedRawTemporalFormat;exports.findResolvedTemporalBucketFormat=E.findResolvedTemporalBucketFormat;exports.parseCanonicalPivotResultTransport=E.parseCanonicalPivotResultTransport;exports.parsePresentationExecutionSnapshot=E.parsePresentationExecutionSnapshot;exports.parsePresentationScope=E.parsePresentationScope;exports.parseResolvedPresentationEntries=E.parseResolvedPresentationEntries;exports.validateCardExportPresentationSnapshot=E.validateCardExportPresentationSnapshot;exports.DEFAULT_RESOLVED_TEMPORAL_STYLE_SET=d.DEFAULT_RESOLVED_TEMPORAL_STYLE_SET;exports.TEMPORAL_BUCKET_PATTERN_TOKENS=d.TEMPORAL_BUCKET_PATTERN_TOKENS;exports.TemporalBucketContractError=d.TemporalBucketContractError;exports.formatTemporalBucket=d.formatTemporalBucket;exports.isTemporalBucketPreset=d.isTemporalBucketPreset;exports.parseResolvedTemporalBucketFormat=d.parseResolvedTemporalBucketFormat;exports.parseTemporalBucketValue=d.parseTemporalBucketValue;exports.resolveApplicableTemporalBucketFormat=d.resolveApplicableTemporalBucketFormat;exports.resolveTemporalBucketPresentation=d.resolveTemporalBucketPresentation;exports.tokenizeTemporalBucketPattern=d.tokenizeTemporalBucketPattern;exports.validateTemporalBucketFormatApplicability=d.validateTemporalBucketFormatApplicability;exports.resolveMetricResultAlias=X.resolveMetricResultAlias;exports.PivotResultIdentityError=w.PivotResultIdentityError;exports.isPivotEmptyTupleAllowed=w.isPivotEmptyTupleAllowed;exports.isPivotSubtotalPrefix=w.isPivotSubtotalPrefix;exports.requirePivotHeaderMembers=w.requirePivotHeaderMembers;exports.requirePivotResultColumnIdentities=w.requirePivotResultColumnIdentities;exports.resolveQueryColumnKeyMapEntry=w.resolveQueryColumnKeyMapEntry;exports.resolveUniqueQueryColumnKeyMapEntry=w.resolveUniqueQueryColumnKeyMapEntry;exports.parseRawTemporalValueMetadata=N.parseRawTemporalValueMetadata;exports.validateRawTemporalResultColumn=N.validateRawTemporalResultColumn;exports.buildFlatTableExportTotalsFooter=Q;exports.buildMatrixTableStructure=z;exports.formatPivotDataRow=L;exports.formatPivotTableForCSV=H;exports.formatTableForCSV=O;exports.generatePivotHeaders=k;exports.generateTableCSV=$;exports.matrixFlatCsvHeaders=U;exports.matrixFlatCsvRow=j;exports.parseFlatTableExportTotalsByColumnId=Y;exports.parseFlatTableExportTotalsRequest=K;exports.prepareMatrixExportPresentation=B;
|