react-semaphor 0.1.507 → 0.1.509
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 +279 -250
- 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-B5AQu-Vb.js} +12 -12
- package/dist/chunks/{dashboard-briefing-launcher-C8nDSDnV.cjs → dashboard-briefing-launcher-BoXFrqq0.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CyL0yimg.js → dashboard-controls-CKKkSXEX.js} +16 -14
- package/dist/chunks/dashboard-controls-gUVkQm8o.cjs +52 -0
- package/dist/chunks/dashboard-json-B7fSi6_b.cjs +1 -0
- package/dist/chunks/{dashboard-json-5Jr3RudV.js → dashboard-json-CAJJquVx.js} +9 -9
- package/dist/chunks/edit-dashboard-visual-AZetLUv1.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-C7X-um9g.js → edit-dashboard-visual-DCnbqRRn.js} +1986 -1990
- package/dist/chunks/{editor-action-buttons-CcDm8nA5.cjs → editor-action-buttons-CBQsVYdt.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-C5Wja_J4.js → editor-action-buttons-DDA5JGwO.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-De2QNsqV.js → index-CL2lvhwk.js} +47783 -46019
- 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/index-DkEAikW8.cjs +1420 -0
- 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-Bv2VIOKc.js} +4 -4
- package/dist/chunks/report-preferences-dialog-Wg9g9fIj.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 +24 -3
- package/dist/types/components/visual/matrix-table/matrix-selection-click.d.ts +6 -0
- package/dist/types/components/visual/matrix-table/matrix-window-viewer.d.ts +1 -1
- 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/matrix-table/matrix-runtime-types.d.ts +0 -3
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +0 -4
- package/dist/types/lib/matrix-table/{use-matrix-selection.d.ts → use-matrix-cell-focus.d.ts} +13 -17
- package/dist/types/lib/matrix-table/use-matrix.d.ts +0 -1
- 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/matrix-table/matrix-clipboard.d.ts +0 -45
- package/dist/types/lib/matrix-table/matrix-selection.d.ts +0 -20
- 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,8 +1,8 @@
|
|
|
1
|
-
import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/matrix-operation-contract-
|
|
2
|
-
import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-
|
|
3
|
-
import { C as Mn, e as Cn, R as On, f as Gn, g as xn, h as Nn, i as En, j as
|
|
1
|
+
import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/matrix-operation-contract-xL8IhFzp.js";
|
|
2
|
+
import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-D9q1Tz8k.js";
|
|
3
|
+
import { C as Mn, e as Cn, R as On, f as Gn, g as xn, h as Nn, i as En, j as vn, v as An, d as Hn } from "../chunks/update-policy-D9q1Tz8k.js";
|
|
4
4
|
import { createHash as ye } from "node:crypto";
|
|
5
|
-
const wn = "src/semaphor/generated",
|
|
5
|
+
const wn = "src/semaphor/generated", H = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
|
|
6
6
|
// Regenerate from the accepted semaphor_plan_data_app codegenSummary when the plan changes.
|
|
7
7
|
`;
|
|
8
8
|
function Sn(e, n = {}) {
|
|
@@ -27,7 +27,7 @@ function Sn(e, n = {}) {
|
|
|
27
27
|
files: a,
|
|
28
28
|
manifest: o,
|
|
29
29
|
contentHash: String(o.generatedContentHash || ""),
|
|
30
|
-
usageExample:
|
|
30
|
+
usageExample: Ae(r),
|
|
31
31
|
warnings: r.warnings,
|
|
32
32
|
stats: {
|
|
33
33
|
inputCount: r.inputs.length,
|
|
@@ -39,30 +39,30 @@ function Sn(e, n = {}) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function Ce(e) {
|
|
42
|
-
var d,
|
|
42
|
+
var d, l, m, i, c, h, y, V, S, R, k, O;
|
|
43
43
|
const n = [], r = [];
|
|
44
44
|
for (const s of e.inputs) {
|
|
45
|
-
|
|
46
|
-
for (const
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
g(r, s.fieldRef);
|
|
46
|
+
for (const I of s.bindings || [])
|
|
47
|
+
g(r, I.fieldRef);
|
|
48
|
+
g(r, (d = s.optionQuery) == null ? void 0 : d.valueFieldRef), g(r, (l = s.optionQuery) == null ? void 0 : l.labelFieldRef), g(r, (m = s.optionQuery) == null ? void 0 : m.filterFieldRef), B(r, (i = s.optionQuery) == null ? void 0 : i.spec);
|
|
49
49
|
}
|
|
50
50
|
for (const s of e.filterContracts) {
|
|
51
|
-
|
|
52
|
-
for (const
|
|
53
|
-
|
|
51
|
+
g(r, s.fieldRef), g(r, (c = s.optionQuery) == null ? void 0 : c.valueFieldRef), g(r, (h = s.optionQuery) == null ? void 0 : h.labelFieldRef), g(r, (y = s.optionQuery) == null ? void 0 : y.filterFieldRef), B(r, (V = s.optionQuery) == null ? void 0 : V.spec);
|
|
52
|
+
for (const I of s.bindings || [])
|
|
53
|
+
g(r, I.fieldRef);
|
|
54
54
|
}
|
|
55
55
|
for (const s of e.views) {
|
|
56
|
-
for (const
|
|
57
|
-
|
|
58
|
-
B(r, (
|
|
56
|
+
for (const I of s.fields || [])
|
|
57
|
+
g(r, I);
|
|
58
|
+
B(r, (S = s.sdkSpec) == null ? void 0 : S.spec), B(r, s.visualSpec);
|
|
59
59
|
}
|
|
60
60
|
const t = e.implementationChecklist || {};
|
|
61
61
|
for (const s of Object.values(t.bindingsByView || {}))
|
|
62
|
-
for (const
|
|
63
|
-
|
|
62
|
+
for (const I of Array.isArray(s) ? s : [])
|
|
63
|
+
g(r, I.fieldRef), g(r, I.optionValueField), g(r, I.optionLabelField);
|
|
64
64
|
for (const s of t.requiredInputOptions || [])
|
|
65
|
-
|
|
65
|
+
g(r, s.visibleLabelField), g(r, s.optionValueField), g(r, s.runtimeFilterField);
|
|
66
66
|
const o = pn(
|
|
67
67
|
[
|
|
68
68
|
...e.sources.map((s) => ({
|
|
@@ -75,9 +75,9 @@ function Ce(e) {
|
|
|
75
75
|
]
|
|
76
76
|
);
|
|
77
77
|
P(o, (s) => {
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
s.raw.label || (
|
|
78
|
+
const I = b(s.raw);
|
|
79
|
+
return q(
|
|
80
|
+
s.raw.label || (I == null ? void 0 : I.datasetName) || (I == null ? void 0 : I.datasetId) || (I == null ? void 0 : I.name) || s.raw.kind || "source"
|
|
81
81
|
);
|
|
82
82
|
});
|
|
83
83
|
const a = ln(o), u = X(
|
|
@@ -90,18 +90,18 @@ function Ce(e) {
|
|
|
90
90
|
);
|
|
91
91
|
P(
|
|
92
92
|
u,
|
|
93
|
-
(s) =>
|
|
93
|
+
(s) => q([
|
|
94
94
|
s.raw.sourceKey ? yn(s.raw.sourceKey) : "",
|
|
95
95
|
s.raw.aggregate ? s.raw.aggregate.toLowerCase() : "",
|
|
96
96
|
s.raw.name
|
|
97
97
|
].filter(Boolean).join("_"))
|
|
98
98
|
);
|
|
99
|
-
const
|
|
99
|
+
const p = new Map(u.map((s) => [s.key, s.name])), w = e.inputs.map((s) => ({
|
|
100
100
|
raw: s,
|
|
101
|
-
name:
|
|
101
|
+
name: q(s.id || s.label || "input")
|
|
102
102
|
}));
|
|
103
|
-
P(
|
|
104
|
-
const f =
|
|
103
|
+
P(w, (s) => s.name);
|
|
104
|
+
const f = w.filter((s) => !!s.raw.optionQuery).map((s) => ({
|
|
105
105
|
input: s,
|
|
106
106
|
name: `${s.name}Options`,
|
|
107
107
|
raw: s.raw.optionQuery
|
|
@@ -109,38 +109,38 @@ function Ce(e) {
|
|
|
109
109
|
P(f, (s) => s.name);
|
|
110
110
|
for (const s of f)
|
|
111
111
|
un(s.raw.labelFieldRef, s.raw.valueFieldRef) && dn(s.raw.valueFieldRef) && n.push(
|
|
112
|
-
`Input option query ${((
|
|
112
|
+
`Input option query ${((R = s.raw.spec) == null ? void 0 : R.inputId) || s.input.raw.id || s.name} uses identifier field ${s.raw.valueFieldRef.name} as both label and value. It can execute, but the UI will show key values unless the semantic model exposes a human-readable label through a modeled relationship.`
|
|
113
113
|
);
|
|
114
|
-
const
|
|
114
|
+
const $ = e.views.filter(
|
|
115
115
|
(s) => {
|
|
116
|
-
var
|
|
117
|
-
return !!((
|
|
116
|
+
var I, T;
|
|
117
|
+
return !!((I = s.sdkSpec) != null && I.builder && ((T = s.sdkSpec) != null && T.spec));
|
|
118
118
|
}
|
|
119
119
|
).map((s) => ({
|
|
120
120
|
raw: s,
|
|
121
|
-
name:
|
|
121
|
+
name: q(s.id || s.title || "query")
|
|
122
122
|
}));
|
|
123
|
-
P(
|
|
124
|
-
const
|
|
123
|
+
P($, (s) => s.name);
|
|
124
|
+
const F = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => sn(s));
|
|
125
125
|
for (const s of e.views)
|
|
126
|
-
(!("sdkSpec" in s) || !((
|
|
126
|
+
(!("sdkSpec" in s) || !((k = s.sdkSpec) != null && k.builder) || !((O = s.sdkSpec) != null && O.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
|
|
127
127
|
return Oe({
|
|
128
|
-
inputs:
|
|
129
|
-
views:
|
|
128
|
+
inputs: w,
|
|
129
|
+
views: $,
|
|
130
130
|
filterContracts: e.filterContracts
|
|
131
131
|
}), {
|
|
132
132
|
summary: e,
|
|
133
133
|
title: e.title || "Semaphor Data App",
|
|
134
134
|
sources: o,
|
|
135
135
|
fields: u,
|
|
136
|
-
inputs:
|
|
136
|
+
inputs: w,
|
|
137
137
|
optionQueries: f,
|
|
138
|
-
views:
|
|
139
|
-
presentationViews:
|
|
138
|
+
views: $,
|
|
139
|
+
presentationViews: F,
|
|
140
140
|
filterContracts: e.filterContracts,
|
|
141
141
|
checklist: t,
|
|
142
142
|
sourceNameByKey: a,
|
|
143
|
-
fieldNameByKey:
|
|
143
|
+
fieldNameByKey: p,
|
|
144
144
|
warnings: n
|
|
145
145
|
};
|
|
146
146
|
}
|
|
@@ -153,27 +153,27 @@ function Oe({
|
|
|
153
153
|
for (const [a, u] of r.entries()) {
|
|
154
154
|
if (!t.has(u.inputId))
|
|
155
155
|
throw new Error(`filterContracts.${a}.inputId must reference a generated input.`);
|
|
156
|
-
const
|
|
157
|
-
for (const [f,
|
|
158
|
-
if (!o.has(
|
|
156
|
+
const p = new Set(u.appliesToViewIds || []), w = new Set(u.notAppliedToViewIds || []);
|
|
157
|
+
for (const [f, $] of (u.appliesToViewIds || []).entries())
|
|
158
|
+
if (!o.has($))
|
|
159
159
|
throw new Error(
|
|
160
160
|
`filterContracts.${a}.appliesToViewIds.${f} must reference an executable generated view.`
|
|
161
161
|
);
|
|
162
|
-
for (const [f,
|
|
163
|
-
if (!o.has(
|
|
162
|
+
for (const [f, $] of (u.notAppliedToViewIds || []).entries())
|
|
163
|
+
if (!o.has($))
|
|
164
164
|
throw new Error(
|
|
165
165
|
`filterContracts.${a}.notAppliedToViewIds.${f} must reference an executable generated view.`
|
|
166
166
|
);
|
|
167
|
-
for (const [f,
|
|
168
|
-
if (!o.has(
|
|
167
|
+
for (const [f, $] of (u.bindings || []).entries()) {
|
|
168
|
+
if (!o.has($.viewId))
|
|
169
169
|
throw new Error(
|
|
170
170
|
`filterContracts.${a}.bindings.${f}.viewId must reference an executable generated view.`
|
|
171
171
|
);
|
|
172
|
-
if (!
|
|
172
|
+
if (!p.has($.viewId))
|
|
173
173
|
throw new Error(
|
|
174
174
|
`filterContracts.${a}.bindings.${f}.viewId must be included in appliesToViewIds.`
|
|
175
175
|
);
|
|
176
|
-
if (
|
|
176
|
+
if (w.has($.viewId))
|
|
177
177
|
throw new Error(
|
|
178
178
|
`filterContracts.${a}.bindings.${f}.viewId must not be listed in notAppliedToViewIds.`
|
|
179
179
|
);
|
|
@@ -182,7 +182,7 @@ function Oe({
|
|
|
182
182
|
}
|
|
183
183
|
function Ge(e) {
|
|
184
184
|
return {
|
|
185
|
-
"sources.ts":
|
|
185
|
+
"sources.ts": qe(e),
|
|
186
186
|
"fields.ts": Te(e),
|
|
187
187
|
"inputs.ts": Qe(e),
|
|
188
188
|
"queries.ts": De(e),
|
|
@@ -208,7 +208,7 @@ function xe({
|
|
|
208
208
|
},
|
|
209
209
|
generatedContentHash: Ne(n),
|
|
210
210
|
codegenSummaryValidatorVersion: Re,
|
|
211
|
-
codegenSummaryHash:
|
|
211
|
+
codegenSummaryHash: ve(e.summary),
|
|
212
212
|
codegenSummary: e.summary
|
|
213
213
|
};
|
|
214
214
|
}
|
|
@@ -229,7 +229,7 @@ function Ee(e) {
|
|
|
229
229
|
"Use the app-facing exports from `index.ts`:",
|
|
230
230
|
"",
|
|
231
231
|
"- `queries`: generated governed query factories.",
|
|
232
|
-
"- `queryOptionsForView`:
|
|
232
|
+
"- `queryOptionsForView`: scalar-input and explicit selection wiring for each generated view.",
|
|
233
233
|
"- `rowsForView`: table/records row readers.",
|
|
234
234
|
"- `rowValuesForView`: friendly row object readers for chart/table views.",
|
|
235
235
|
"- `metricValuesForView`: friendly metric-value readers.",
|
|
@@ -240,6 +240,8 @@ function Ee(e) {
|
|
|
240
240
|
"- `semaphorGeneratedContractMetadata`: generated view/input metadata and presentation-only views.",
|
|
241
241
|
"",
|
|
242
242
|
"Start with these exports before opening large generated internals such as `metadata.ts`.",
|
|
243
|
+
"",
|
|
244
|
+
"For click-to-filter behavior, create one `semaphor.selection({ id, fields })` per source chart, call `useSemaphorSelection`, render its tuples as removable chips in app code, and pass the target view's selection handles as the second argument to `queryOptionsForView.<view>(inputHandles, selections)`. Do not mix selection handles into `appInputSpecs` or scalar input arrays.",
|
|
243
245
|
""
|
|
244
246
|
];
|
|
245
247
|
return e.views.length > 0 && (n.push("Generated executable views:"), e.views.forEach((r) => {
|
|
@@ -250,7 +252,7 @@ function Ee(e) {
|
|
|
250
252
|
`)}
|
|
251
253
|
`;
|
|
252
254
|
}
|
|
253
|
-
function
|
|
255
|
+
function ve(e) {
|
|
254
256
|
return `sha256:${ye("sha256").update(ae(e)).digest("hex")}`;
|
|
255
257
|
}
|
|
256
258
|
function ae(e) {
|
|
@@ -261,9 +263,9 @@ function ae(e) {
|
|
|
261
263
|
const n = e;
|
|
262
264
|
return `{${Object.keys(n).sort().filter((t) => n[t] !== void 0).map((t) => `${JSON.stringify(t)}:${ae(n[t])}`).join(",")}}`;
|
|
263
265
|
}
|
|
264
|
-
function
|
|
266
|
+
function Ae(e) {
|
|
265
267
|
const n = e.views.find(
|
|
266
|
-
(f) =>
|
|
268
|
+
(f) => v(f) && A(f)
|
|
267
269
|
);
|
|
268
270
|
if (n)
|
|
269
271
|
return [
|
|
@@ -279,7 +281,7 @@ function je(e) {
|
|
|
279
281
|
].join(`
|
|
280
282
|
`);
|
|
281
283
|
const r = e.views.find(
|
|
282
|
-
(f) =>
|
|
284
|
+
(f) => v(f)
|
|
283
285
|
);
|
|
284
286
|
if (r)
|
|
285
287
|
return [
|
|
@@ -295,7 +297,7 @@ function je(e) {
|
|
|
295
297
|
].join(`
|
|
296
298
|
`);
|
|
297
299
|
const t = e.views.find(
|
|
298
|
-
(f) => z(f) &&
|
|
300
|
+
(f) => z(f) && A(f)
|
|
299
301
|
);
|
|
300
302
|
if (t)
|
|
301
303
|
return [
|
|
@@ -309,7 +311,7 @@ function je(e) {
|
|
|
309
311
|
].join(`
|
|
310
312
|
`);
|
|
311
313
|
const o = e.views.find(
|
|
312
|
-
(f) => ue(f) &&
|
|
314
|
+
(f) => ue(f) && A(f)
|
|
313
315
|
);
|
|
314
316
|
if (o)
|
|
315
317
|
return [
|
|
@@ -323,8 +325,8 @@ function je(e) {
|
|
|
323
325
|
].join(`
|
|
324
326
|
`);
|
|
325
327
|
const a = e.views.find((f) => {
|
|
326
|
-
var
|
|
327
|
-
return mn((
|
|
328
|
+
var $;
|
|
329
|
+
return mn(($ = f.raw.sdkSpec) == null ? void 0 : $.builder);
|
|
328
330
|
});
|
|
329
331
|
if (a)
|
|
330
332
|
return [
|
|
@@ -336,7 +338,7 @@ function je(e) {
|
|
|
336
338
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
337
339
|
].join(`
|
|
338
340
|
`);
|
|
339
|
-
const u = e.views.find((f) =>
|
|
341
|
+
const u = e.views.find((f) => He(f));
|
|
340
342
|
if (u)
|
|
341
343
|
return [
|
|
342
344
|
'import { appInputSpecs, createInputHandleMap, kpiPropsForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
@@ -347,54 +349,54 @@ function je(e) {
|
|
|
347
349
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
348
350
|
].join(`
|
|
349
351
|
`);
|
|
350
|
-
const
|
|
352
|
+
const p = e.views[0];
|
|
351
353
|
return [
|
|
352
354
|
'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
353
355
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
354
356
|
"const inputHandles = createInputHandleMap(handles);",
|
|
355
|
-
|
|
357
|
+
p ? `const result = useSemaphorQuery(queries.${p.name}(), queryOptionsForView.${p.name}(inputHandles));` : "const result = undefined;",
|
|
356
358
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
357
359
|
].join(`
|
|
358
360
|
`);
|
|
359
361
|
}
|
|
360
362
|
function z(e) {
|
|
361
363
|
var n;
|
|
362
|
-
return
|
|
364
|
+
return K((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
|
|
363
365
|
}
|
|
364
|
-
function
|
|
366
|
+
function He(e) {
|
|
365
367
|
var n;
|
|
366
|
-
return
|
|
368
|
+
return K((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
|
|
367
369
|
}
|
|
368
|
-
function
|
|
370
|
+
function v(e) {
|
|
369
371
|
var n, r, t;
|
|
370
372
|
return z(e) && ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.sorting) == null ? void 0 : t.mode) === "server";
|
|
371
373
|
}
|
|
372
374
|
function ue(e) {
|
|
373
375
|
var n;
|
|
374
|
-
return
|
|
376
|
+
return K((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "sql";
|
|
375
377
|
}
|
|
376
|
-
function
|
|
378
|
+
function A(e) {
|
|
377
379
|
var n, r, t;
|
|
378
380
|
return ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.pagination) == null ? void 0 : t.mode) === "server";
|
|
379
381
|
}
|
|
380
|
-
function
|
|
381
|
-
return z(e) && (
|
|
382
|
+
function je(e) {
|
|
383
|
+
return z(e) && (A(e) || v(e)) || ue(e) && A(e);
|
|
382
384
|
}
|
|
383
|
-
function
|
|
385
|
+
function qe(e) {
|
|
384
386
|
const n = e.sources.map(({ name: t, raw: o }) => {
|
|
385
|
-
const a =
|
|
387
|
+
const a = Ke(o);
|
|
386
388
|
return ` ${t}: ${a},`;
|
|
387
389
|
}).join(`
|
|
388
390
|
`), r = e.sources.some((t) => t.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
|
|
389
391
|
|
|
390
392
|
` : "";
|
|
391
|
-
return `${
|
|
393
|
+
return `${H}
|
|
392
394
|
${r}export const sources = {
|
|
393
395
|
${n}
|
|
394
396
|
} as const;
|
|
395
397
|
`;
|
|
396
398
|
}
|
|
397
|
-
function
|
|
399
|
+
function Ke(e) {
|
|
398
400
|
if (e.kind === "semantic") {
|
|
399
401
|
const n = {
|
|
400
402
|
domainId: e.domainId,
|
|
@@ -402,9 +404,9 @@ function qe(e) {
|
|
|
402
404
|
datasetName: e.datasetName,
|
|
403
405
|
label: e.label
|
|
404
406
|
};
|
|
405
|
-
return `semaphor.source.semantic(${
|
|
407
|
+
return `semaphor.source.semantic(${M(N(n))})`;
|
|
406
408
|
}
|
|
407
|
-
return `${
|
|
409
|
+
return `${M(N({ ...e, sourceKey: void 0 }))} as const`;
|
|
408
410
|
}
|
|
409
411
|
function Te(e) {
|
|
410
412
|
const n = e.fields.map(({ name: t, raw: o }) => {
|
|
@@ -414,7 +416,7 @@ function Te(e) {
|
|
|
414
416
|
`), r = n.includes("sources.") ? `import { sources } from "./sources";
|
|
415
417
|
|
|
416
418
|
` : "";
|
|
417
|
-
return `${
|
|
419
|
+
return `${H}
|
|
418
420
|
${r}export const fields = {
|
|
419
421
|
${n}
|
|
420
422
|
} as const;
|
|
@@ -432,64 +434,64 @@ function Be(e, n) {
|
|
|
432
434
|
throw new Error(
|
|
433
435
|
`Field ${e.name} references source ${t}, but that source is not renderable. Include the source in codegenSummary.sources or provide field.source.`
|
|
434
436
|
);
|
|
435
|
-
const a = Object.entries(N(r)).map(([u,
|
|
437
|
+
const a = Object.entries(N(r)).map(([u, p]) => `${JSON.stringify(u)}: ${x(p, n)}`);
|
|
436
438
|
return o && a.push(`"source": sources.${o}`), `{ ${a.join(", ")} }`;
|
|
437
439
|
}
|
|
438
440
|
function Qe(e) {
|
|
439
441
|
const n = e.inputs.map((m) => {
|
|
440
|
-
const i =
|
|
442
|
+
const i = C(m.raw.fieldRef, e), c = [
|
|
441
443
|
`id: ${JSON.stringify(m.raw.id)}`,
|
|
442
444
|
`label: ${JSON.stringify(m.raw.label || m.raw.id)}`,
|
|
443
445
|
`operator: ${JSON.stringify(fn(m.raw))}`
|
|
444
446
|
];
|
|
445
|
-
if (i &&
|
|
447
|
+
if (i && c.push(`field: fields.${i}`), m.raw.relationshipHint && c.push(`relationshipHint: ${M(m.raw.relationshipHint)}`), !i)
|
|
446
448
|
throw new Error(`Input ${m.raw.id || m.name} is missing a generated field reference.`);
|
|
447
|
-
return ` ${m.name}: semaphor.filter({ ${
|
|
449
|
+
return ` ${m.name}: semaphor.filter({ ${c.join(", ")} }),`;
|
|
448
450
|
}).join(`
|
|
449
451
|
`), r = e.inputs.map((m) => `filterSpecs.${m.name}`).join(", "), t = e.inputs.map((m) => JSON.stringify(m.raw.id)).join(", "), o = e.optionQueries.map((m) => {
|
|
450
|
-
const i = m.input.raw,
|
|
451
|
-
id:
|
|
452
|
-
inputId:
|
|
453
|
-
source:
|
|
454
|
-
sourceKey:
|
|
455
|
-
valueField:
|
|
456
|
-
labelField:
|
|
452
|
+
const i = m.input.raw, c = m.raw, h = b(c.spec) || {}, {
|
|
453
|
+
id: y,
|
|
454
|
+
inputId: V,
|
|
455
|
+
source: S,
|
|
456
|
+
sourceKey: R,
|
|
457
|
+
valueField: k,
|
|
458
|
+
labelField: O,
|
|
457
459
|
population: s,
|
|
458
|
-
dependencies:
|
|
460
|
+
dependencies: I,
|
|
459
461
|
limit: T,
|
|
460
462
|
...ee
|
|
461
|
-
} =
|
|
463
|
+
} = h, U = c.sourceKey ? { sourceKey: c.sourceKey } : c.source || S || (typeof R == "string" ? { sourceKey: R } : void 0), ne = Se(U, e), re = C(c.valueFieldRef, e), te = C(c.labelFieldRef, e), oe = he(m), se = {
|
|
462
464
|
...ee,
|
|
463
|
-
id:
|
|
465
|
+
id: c.id || h.id || `${i.id}-options`,
|
|
464
466
|
inputId: i.id,
|
|
465
467
|
source: U,
|
|
466
|
-
valueField:
|
|
467
|
-
labelField:
|
|
468
|
-
population:
|
|
468
|
+
valueField: c.valueFieldRef,
|
|
469
|
+
labelField: c.labelFieldRef,
|
|
470
|
+
population: c.population || s,
|
|
469
471
|
dependencies: oe,
|
|
470
|
-
limit:
|
|
472
|
+
limit: c.limit || T || 100
|
|
471
473
|
};
|
|
472
474
|
if (!ne || !re || !te)
|
|
473
|
-
throw new Error(`Input option query ${
|
|
475
|
+
throw new Error(`Input option query ${c.id || `${i.id}-options`} is missing source, valueField, or labelField.`);
|
|
474
476
|
const Ve = Object.entries(N(se)).map(([Fe, be]) => `${JSON.stringify(Fe)}: ${x(be, e)}`);
|
|
475
477
|
return ` ${m.name}: semaphor.inputOptions({ ${Ve.join(", ")} }),`;
|
|
476
478
|
}).join(`
|
|
477
479
|
`), a = e.optionQueries.map((m) => {
|
|
478
|
-
const i = Pe(e, m),
|
|
479
|
-
const
|
|
480
|
-
if (!
|
|
480
|
+
const i = Pe(e, m), c = i.length > 0 ? "inputHandles" : "_inputHandles", h = i.map((y) => {
|
|
481
|
+
const V = C(y.raw.fieldRef, e);
|
|
482
|
+
if (!V)
|
|
481
483
|
throw new Error(
|
|
482
|
-
`Input option query ${m.raw.id || `${m.input.raw.id}-options`} references input ${
|
|
484
|
+
`Input option query ${m.raw.id || `${m.input.raw.id}-options`} references input ${y.raw.id} without a generated field reference.`
|
|
483
485
|
);
|
|
484
|
-
const
|
|
485
|
-
return ` if (${
|
|
486
|
-
inputs.push(semaphor.bindInput(${
|
|
486
|
+
const S = `inputHandles[${JSON.stringify(y.raw.id)}]`;
|
|
487
|
+
return ` if (${S}) {
|
|
488
|
+
inputs.push(semaphor.bindInput(${S}, { field: fields.${V} }));
|
|
487
489
|
}`;
|
|
488
490
|
}).join(`
|
|
489
491
|
`);
|
|
490
|
-
return ` ${m.name}(${
|
|
492
|
+
return ` ${m.name}(${c}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
491
493
|
const inputs: SemaphorInputReference[] = [];
|
|
492
|
-
${
|
|
494
|
+
${h}
|
|
493
495
|
return inputs;
|
|
494
496
|
},`;
|
|
495
497
|
}).join(`
|
|
@@ -500,22 +502,22 @@ ${g}
|
|
|
500
502
|
};
|
|
501
503
|
},`).join(`
|
|
502
504
|
|
|
503
|
-
`),
|
|
505
|
+
`), p = e.optionQueries.map((m) => ` case ${JSON.stringify(m.raw.id || `${m.input.raw.id}-options`)}:
|
|
504
506
|
return queryOptionsForInputOptionQuery.${m.name}(inputHandles);`).join(`
|
|
505
|
-
`),
|
|
507
|
+
`), w = e.inputs.length > 0, f = e.optionQueries.length > 0, $ = f ? "inputOptionQueryId" : "_inputOptionQueryId", F = f ? "inputHandles" : "_inputHandles", d = [
|
|
506
508
|
"SemaphorInputHandle",
|
|
507
509
|
f ? "SemaphorInputReference" : void 0,
|
|
508
510
|
"SemaphorQueryRuntimeOptions"
|
|
509
|
-
].filter(E).join(", "),
|
|
510
|
-
|
|
511
|
+
].filter(E).join(", "), l = [
|
|
512
|
+
w || f ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
511
513
|
`import type { ${d} } from "react-semaphor/data-app-sdk";`,
|
|
512
|
-
|
|
514
|
+
w || f ? 'import { fields } from "./fields";' : void 0,
|
|
513
515
|
f ? 'import { sources } from "./sources";' : void 0,
|
|
514
516
|
'import type { SemaphorGeneratedInputId, SemaphorGeneratedInputOptionQueryId } from "./metadata";'
|
|
515
517
|
].filter(E).join(`
|
|
516
518
|
`);
|
|
517
|
-
return `${
|
|
518
|
-
${
|
|
519
|
+
return `${H}
|
|
520
|
+
${l}
|
|
519
521
|
|
|
520
522
|
export const filterSpecs = {
|
|
521
523
|
${n}
|
|
@@ -543,13 +545,13 @@ ${u}
|
|
|
543
545
|
} as const;
|
|
544
546
|
|
|
545
547
|
export function queryOptionsForInputOptionQueryId(
|
|
546
|
-
${
|
|
547
|
-
${
|
|
548
|
+
${$}: SemaphorGeneratedInputOptionQueryId,
|
|
549
|
+
${F}: SemaphorGeneratedInputHandleMap,
|
|
548
550
|
): SemaphorQueryRuntimeOptions {
|
|
549
|
-
switch (${
|
|
550
|
-
${
|
|
551
|
+
switch (${$}) {
|
|
552
|
+
${p}
|
|
551
553
|
}
|
|
552
|
-
throw new Error(\`Unknown generated Semaphor input option query id: \${${
|
|
554
|
+
throw new Error(\`Unknown generated Semaphor input option query id: \${${$}}\`);
|
|
553
555
|
}
|
|
554
556
|
`;
|
|
555
557
|
}
|
|
@@ -567,29 +569,29 @@ function he(e) {
|
|
|
567
569
|
return e.raw.dependencies || ((n = e.raw.spec) == null ? void 0 : n.dependencies);
|
|
568
570
|
}
|
|
569
571
|
function De(e) {
|
|
570
|
-
const n = e.views.map((
|
|
571
|
-
var
|
|
572
|
-
const m =
|
|
573
|
-
if (z(
|
|
574
|
-
const
|
|
575
|
-
view:
|
|
572
|
+
const n = e.views.map((l) => {
|
|
573
|
+
var c, h, y, V, S, R;
|
|
574
|
+
const m = K(l.raw.sdkSpec.builder), i = _e(l);
|
|
575
|
+
if (z(l) && je(l)) {
|
|
576
|
+
const k = (c = l.raw.visualSpec) == null ? void 0 : c.tableBehavior, O = b(i.pagination), s = A(l), I = v(l), T = ((h = k == null ? void 0 : k.pagination) == null ? void 0 : h.pageSize) || J(O == null ? void 0 : O.pageSize) || J(i.limit) || 100, ee = I ? L(l, e) : [], U = I ? Ue({
|
|
577
|
+
view: l,
|
|
576
578
|
contract: e,
|
|
577
579
|
sortFields: ee,
|
|
578
|
-
defaultField: (
|
|
579
|
-
}) : void 0, ne =
|
|
580
|
-
viewName:
|
|
580
|
+
defaultField: (y = k == null ? void 0 : k.sorting) == null ? void 0 : y.defaultField
|
|
581
|
+
}) : void 0, ne = I ? (V = k == null ? void 0 : k.sorting) == null ? void 0 : V.defaultDirection : void 0, re = Je({
|
|
582
|
+
viewName: l.name,
|
|
581
583
|
supportsPagination: s,
|
|
582
|
-
supportsSort:
|
|
583
|
-
}), te =
|
|
584
|
-
recordsSortFieldsForView.${
|
|
584
|
+
supportsSort: I
|
|
585
|
+
}), te = I ? ` const orderBy = resolveRecordsOrderBy(
|
|
586
|
+
recordsSortFieldsForView.${l.name},
|
|
585
587
|
params.sort,
|
|
586
588
|
${x(U, e)},
|
|
587
589
|
${x(ne, e)},
|
|
588
590
|
);
|
|
589
|
-
` : "", oe =
|
|
591
|
+
` : "", oe = I ? ` ...(orderBy ? { orderBy } : {}),
|
|
590
592
|
` : "", se = s ? ` pagination: resolveServerTablePagination(params, ${JSON.stringify(T)}),
|
|
591
593
|
` : "";
|
|
592
|
-
return ` ${
|
|
594
|
+
return ` ${l.name}(
|
|
593
595
|
params: ${re} = {},
|
|
594
596
|
) {
|
|
595
597
|
${te} return semaphor.${m}({
|
|
@@ -597,9 +599,9 @@ ${te} return semaphor.${m}({
|
|
|
597
599
|
${oe}${se} });
|
|
598
600
|
},`;
|
|
599
601
|
}
|
|
600
|
-
if (ue(
|
|
601
|
-
const
|
|
602
|
-
return ` ${
|
|
602
|
+
if (ue(l) && A(l)) {
|
|
603
|
+
const k = (S = l.raw.visualSpec) == null ? void 0 : S.tableBehavior, O = b(i.pagination), s = ((R = k == null ? void 0 : k.pagination) == null ? void 0 : R.pageSize) || J(O == null ? void 0 : O.pageSize) || J(i.limit) || 100;
|
|
604
|
+
return ` ${l.name}(
|
|
603
605
|
params: SemaphorGeneratedServerPaginationParams = {},
|
|
604
606
|
) {
|
|
605
607
|
return semaphor.${m}({
|
|
@@ -608,32 +610,32 @@ ${oe}${se} });
|
|
|
608
610
|
});
|
|
609
611
|
},`;
|
|
610
612
|
}
|
|
611
|
-
return ` ${
|
|
613
|
+
return ` ${l.name}: () => semaphor.${m}(${x(i, e)}),`;
|
|
612
614
|
}).join(`
|
|
613
|
-
`), r = e.views.filter((
|
|
614
|
-
const i = L(
|
|
615
|
+
`), r = e.views.filter((l) => v(l)).map((l) => {
|
|
616
|
+
const i = L(l, e).map((c) => ` ${JSON.stringify(c.key)}: fields.${c.fieldName},`).join(`
|
|
615
617
|
`);
|
|
616
|
-
return ` ${
|
|
618
|
+
return ` ${l.name}: {
|
|
617
619
|
${i}
|
|
618
620
|
},`;
|
|
619
621
|
}).join(`
|
|
620
|
-
`), t = e.views.filter((
|
|
621
|
-
const i = L(
|
|
622
|
+
`), t = e.views.filter((l) => v(l)).map((l) => {
|
|
623
|
+
const i = L(l, e).map((c) => ` { key: ${JSON.stringify(c.key)}, label: ${JSON.stringify(c.label)}, field: fields.${c.fieldName} },`).join(`
|
|
622
624
|
`);
|
|
623
|
-
return ` ${
|
|
625
|
+
return ` ${l.name}: [
|
|
624
626
|
${i}
|
|
625
627
|
],`;
|
|
626
628
|
}).join(`
|
|
627
|
-
`), o = e.views.some((
|
|
628
|
-
`),
|
|
629
|
+
`), o = e.views.some((l) => v(l)), a = e.views.some((l) => A(l)), u = [n, r, t].join(`
|
|
630
|
+
`), p = [
|
|
629
631
|
n ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
630
632
|
o ? 'import type { SemaphorFieldRef } from "react-semaphor/data-app-sdk";' : void 0,
|
|
631
633
|
u.includes("fields.") ? 'import { fields } from "./fields";' : void 0,
|
|
632
634
|
u.includes("sources.") ? 'import { sources } from "./sources";' : void 0
|
|
633
635
|
].filter(E).join(`
|
|
634
636
|
`);
|
|
635
|
-
return `${
|
|
636
|
-
${
|
|
637
|
+
return `${H}
|
|
638
|
+
${p}
|
|
637
639
|
${o ? `export type SemaphorGeneratedRecordsSortDirection = "asc" | "desc";
|
|
638
640
|
|
|
639
641
|
export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
|
|
@@ -699,7 +701,7 @@ ${a ? `function resolveServerTablePagination(
|
|
|
699
701
|
}
|
|
700
702
|
function _e(e) {
|
|
701
703
|
var a, u;
|
|
702
|
-
const n =
|
|
704
|
+
const n = b((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: t, ...o } = n;
|
|
703
705
|
return {
|
|
704
706
|
...o,
|
|
705
707
|
id: e.raw.id,
|
|
@@ -708,22 +710,22 @@ function _e(e) {
|
|
|
708
710
|
}
|
|
709
711
|
function L(e, n) {
|
|
710
712
|
var a, u;
|
|
711
|
-
const r = [], t =
|
|
712
|
-
for (const
|
|
713
|
-
|
|
714
|
-
for (const
|
|
713
|
+
const r = [], t = b((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
|
|
714
|
+
for (const p of j(t.fields)) g(r, p);
|
|
715
|
+
g(r, t.dateField), g(r, (u = b(t.orderBy)) == null ? void 0 : u.field);
|
|
716
|
+
for (const p of e.raw.fields || []) g(r, p);
|
|
715
717
|
return X(
|
|
716
|
-
r.map((
|
|
717
|
-
const
|
|
718
|
-
if (!(!
|
|
718
|
+
r.map((p) => {
|
|
719
|
+
const w = C(p, n);
|
|
720
|
+
if (!(!p.name || !w))
|
|
719
721
|
return {
|
|
720
|
-
key:
|
|
721
|
-
fieldName:
|
|
722
|
-
rawName:
|
|
723
|
-
label:
|
|
722
|
+
key: w,
|
|
723
|
+
fieldName: w,
|
|
724
|
+
rawName: p.name,
|
|
725
|
+
label: p.label || p.name
|
|
724
726
|
};
|
|
725
727
|
}).filter(E),
|
|
726
|
-
(
|
|
728
|
+
(p) => p.key
|
|
727
729
|
);
|
|
728
730
|
}
|
|
729
731
|
function Ue({
|
|
@@ -732,15 +734,15 @@ function Ue({
|
|
|
732
734
|
sortFields: r,
|
|
733
735
|
defaultField: t
|
|
734
736
|
}) {
|
|
735
|
-
var
|
|
736
|
-
const o = new Set(r.map((
|
|
737
|
+
var w, f;
|
|
738
|
+
const o = new Set(r.map(($) => $.key));
|
|
737
739
|
if (t && o.has(t))
|
|
738
740
|
return t;
|
|
739
|
-
const a = r.filter((
|
|
741
|
+
const a = r.filter(($) => $.rawName === t);
|
|
740
742
|
if (a.length === 1)
|
|
741
743
|
return a[0].key;
|
|
742
|
-
const u =
|
|
743
|
-
return
|
|
744
|
+
const u = b((w = e.raw.sdkSpec) == null ? void 0 : w.spec), p = C((f = b(u == null ? void 0 : u.orderBy)) == null ? void 0 : f.field, n);
|
|
745
|
+
return p && o.has(p) ? p : void 0;
|
|
744
746
|
}
|
|
745
747
|
function Je({
|
|
746
748
|
viewName: e,
|
|
@@ -750,59 +752,60 @@ function Je({
|
|
|
750
752
|
return n && r ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : r ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
|
|
751
753
|
}
|
|
752
754
|
function Le(e) {
|
|
753
|
-
const n = e.views.map((
|
|
754
|
-
const
|
|
755
|
-
const
|
|
756
|
-
if (!
|
|
755
|
+
const n = e.views.map((F) => {
|
|
756
|
+
const l = ze(e, F.raw.id).map((m) => {
|
|
757
|
+
const i = m.inputId, c = C(m.fieldRef, e);
|
|
758
|
+
if (!i || !c)
|
|
757
759
|
return "";
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
|
|
761
|
-
else if (Array.isArray(
|
|
762
|
-
const
|
|
763
|
-
var
|
|
764
|
-
return (
|
|
765
|
-
}).filter((
|
|
766
|
-
|
|
760
|
+
const h = [`field: fields.${c}`];
|
|
761
|
+
if (m.relationshipHint)
|
|
762
|
+
h.push(`relationshipHint: ${M(m.relationshipHint)}`);
|
|
763
|
+
else if (Array.isArray(m.relationshipsUsed) && m.relationshipsUsed.length > 0) {
|
|
764
|
+
const V = m.relationshipsUsed.map((S) => {
|
|
765
|
+
var R;
|
|
766
|
+
return (R = b(S)) == null ? void 0 : R.id;
|
|
767
|
+
}).filter((S) => typeof S == "string" && S.length > 0);
|
|
768
|
+
V.length > 0 && h.push(`relationshipHint: ${M({ relationshipIds: V })}`);
|
|
767
769
|
}
|
|
768
|
-
const
|
|
769
|
-
return ` if (${
|
|
770
|
-
inputs.push(semaphor.bindInput(${
|
|
770
|
+
const y = `inputHandles[${JSON.stringify(i)}]`;
|
|
771
|
+
return ` if (${y}) {
|
|
772
|
+
inputs.push(semaphor.bindInput(${y}, { ${h.join(", ")} }));
|
|
771
773
|
}`;
|
|
772
774
|
}).filter(Boolean).join(`
|
|
773
775
|
`);
|
|
774
|
-
return { view:
|
|
775
|
-
}), r = n.some((
|
|
776
|
-
const
|
|
777
|
-
return ` ${
|
|
776
|
+
return { view: F, renderedBindings: l };
|
|
777
|
+
}), r = n.some((F) => F.renderedBindings.length > 0), t = n.map(({ view: F, renderedBindings: d }) => {
|
|
778
|
+
const l = d ? "inputHandles" : "_inputHandles";
|
|
779
|
+
return ` ${F.name}(${l}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
778
780
|
const inputs: SemaphorInputReference[] = [];
|
|
779
|
-
${
|
|
781
|
+
${d}
|
|
780
782
|
return inputs;
|
|
781
783
|
},`;
|
|
782
784
|
}).join(`
|
|
783
785
|
|
|
784
|
-
`), o = e.views.map((
|
|
786
|
+
`), o = e.views.map((F) => ` ${F.name}(inputHandles: SemaphorGeneratedInputHandleMap, selections: SemaphorSelectionReference[] = []): SemaphorQueryRuntimeOptions {
|
|
785
787
|
return {
|
|
786
|
-
inputs: inputsForView.${
|
|
787
|
-
|
|
788
|
+
inputs: inputsForView.${F.name}(inputHandles),
|
|
789
|
+
selections,
|
|
790
|
+
debug: queryDebugForView.${F.name},
|
|
788
791
|
};
|
|
789
792
|
},`).join(`
|
|
790
793
|
|
|
791
|
-
`), a = e.views.map((
|
|
792
|
-
return inputsForView.${
|
|
793
|
-
`), u = e.views.map((
|
|
794
|
-
return queryOptionsForView.${
|
|
795
|
-
`),
|
|
794
|
+
`), a = e.views.map((F) => ` case ${JSON.stringify(F.raw.id)}:
|
|
795
|
+
return inputsForView.${F.name}(inputHandles);`).join(`
|
|
796
|
+
`), u = e.views.map((F) => ` case ${JSON.stringify(F.raw.id)}:
|
|
797
|
+
return queryOptionsForView.${F.name}(inputHandles, selections);`).join(`
|
|
798
|
+
`), p = e.views.length > 0, w = p ? "inputHandles" : "_inputHandles", f = p ? "selections" : "_selections", $ = [
|
|
796
799
|
r ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
797
|
-
'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions } from "react-semaphor/data-app-sdk";',
|
|
800
|
+
'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions, SemaphorSelectionReference } from "react-semaphor/data-app-sdk";',
|
|
798
801
|
r ? 'import { fields } from "./fields";' : void 0,
|
|
799
802
|
'import type { SemaphorGeneratedInputHandleMap } from "./inputs";',
|
|
800
|
-
|
|
803
|
+
p ? 'import { queryDebugForView } from "./metadata";' : void 0,
|
|
801
804
|
'import type { SemaphorGeneratedQueryViewId } from "./metadata";'
|
|
802
805
|
].filter(E).join(`
|
|
803
806
|
`);
|
|
804
|
-
return `${
|
|
805
|
-
${
|
|
807
|
+
return `${H}
|
|
808
|
+
${$}
|
|
806
809
|
|
|
807
810
|
export const inputsForView = {
|
|
808
811
|
${t}
|
|
@@ -814,7 +817,7 @@ ${o}
|
|
|
814
817
|
|
|
815
818
|
export function inputsForViewId(
|
|
816
819
|
viewId: SemaphorGeneratedQueryViewId,
|
|
817
|
-
${
|
|
820
|
+
${w}: SemaphorGeneratedInputHandleMap,
|
|
818
821
|
): SemaphorInputReference[] {
|
|
819
822
|
switch (viewId) {
|
|
820
823
|
${a}
|
|
@@ -824,7 +827,8 @@ ${a}
|
|
|
824
827
|
|
|
825
828
|
export function queryOptionsForViewId(
|
|
826
829
|
viewId: SemaphorGeneratedQueryViewId,
|
|
827
|
-
${
|
|
830
|
+
${w}: SemaphorGeneratedInputHandleMap,
|
|
831
|
+
${f}: SemaphorSelectionReference[] = [],
|
|
828
832
|
): SemaphorQueryRuntimeOptions {
|
|
829
833
|
switch (viewId) {
|
|
830
834
|
${u}
|
|
@@ -845,61 +849,61 @@ function ze(e, n) {
|
|
|
845
849
|
}
|
|
846
850
|
function Ye(e) {
|
|
847
851
|
const n = e.views.map((i) => {
|
|
848
|
-
const
|
|
849
|
-
const
|
|
850
|
-
return
|
|
852
|
+
const h = D(i, e).map((y) => {
|
|
853
|
+
const V = C(y.raw, e);
|
|
854
|
+
return V ? ` ${y.name}: fields.${V},` : "";
|
|
851
855
|
}).filter(Boolean).join(`
|
|
852
856
|
`);
|
|
853
857
|
return ` ${i.name}: {
|
|
854
|
-
${
|
|
858
|
+
${h}
|
|
855
859
|
},`;
|
|
856
860
|
}).join(`
|
|
857
861
|
`), r = e.views.map((i) => {
|
|
858
|
-
const
|
|
859
|
-
const
|
|
860
|
-
return
|
|
862
|
+
const h = Q(i, e).map((y) => {
|
|
863
|
+
const V = C(y.raw, e);
|
|
864
|
+
return V ? ` ${y.name}: fields.${V},` : "";
|
|
861
865
|
}).filter(Boolean).join(`
|
|
862
866
|
`);
|
|
863
867
|
return ` ${i.name}: {
|
|
864
|
-
${
|
|
868
|
+
${h}
|
|
865
869
|
},`;
|
|
866
870
|
}).join(`
|
|
867
871
|
`), t = e.views.map((i) => {
|
|
868
|
-
const
|
|
872
|
+
const h = Q(i, e).map((y, V) => ` ${y.name}: ${JSON.stringify(en(i, y, V))},`).join(`
|
|
869
873
|
`);
|
|
870
874
|
return ` ${i.name}: {
|
|
871
|
-
${
|
|
875
|
+
${h}
|
|
872
876
|
},`;
|
|
873
877
|
}).join(`
|
|
874
878
|
`), o = e.views.map((i) => {
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
879
|
+
const c = Q(i, e);
|
|
880
|
+
if (c.length === 0)
|
|
877
881
|
return ` ${i.name}(): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
|
|
878
882
|
return {};
|
|
879
883
|
},`;
|
|
880
|
-
const
|
|
881
|
-
const
|
|
882
|
-
return ` ${
|
|
884
|
+
const h = c.map((y) => {
|
|
885
|
+
const S = `readMetricValueByBinding(measures, measureBindings, ${`metricMeasureBindingKeysForView.${i.name}.${y.name}`})`;
|
|
886
|
+
return ` ${y.name}: ${S},`;
|
|
883
887
|
}).join(`
|
|
884
888
|
`);
|
|
885
889
|
return ` ${i.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
|
|
886
890
|
const measures = result?.measures;
|
|
887
891
|
const measureBindings = result?.measureBindings;
|
|
888
892
|
return {
|
|
889
|
-
${
|
|
893
|
+
${h}
|
|
890
894
|
};
|
|
891
895
|
},`;
|
|
892
896
|
}).join(`
|
|
893
897
|
|
|
894
898
|
`), a = e.views.map((i) => {
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
899
|
+
const c = Q(i, e);
|
|
900
|
+
if (c.length === 0)
|
|
897
901
|
return ` ${i.name}(): Array<keyof typeof metricFieldsForView.${i.name}> {
|
|
898
902
|
return [];
|
|
899
903
|
},`;
|
|
900
|
-
const
|
|
901
|
-
const
|
|
902
|
-
return ` ...(missing.has(${
|
|
904
|
+
const h = c.map((y, V) => {
|
|
905
|
+
const S = `metricMeasureBindingKeysForView.${i.name}.${y.name}`, R = V === 0 ? `readMetricValueByBinding(measures, measureBindings, ${S}) === undefined && !hasOwnPrimaryMetricValue(result)` : `readMetricValueByBinding(measures, measureBindings, ${S}) === undefined`;
|
|
906
|
+
return ` ...(missing.has(${S}) || (${R}) ? [${JSON.stringify(y.name)} as keyof typeof metricFieldsForView.${i.name}] : []),`;
|
|
903
907
|
}).join(`
|
|
904
908
|
`);
|
|
905
909
|
return ` ${i.name}(result: SemaphorGeneratedMetricResult): Array<keyof typeof metricFieldsForView.${i.name}> {
|
|
@@ -907,25 +911,25 @@ ${g}
|
|
|
907
911
|
const measures = result?.measures;
|
|
908
912
|
const measureBindings = result?.measureBindings;
|
|
909
913
|
return [
|
|
910
|
-
${
|
|
914
|
+
${h}
|
|
911
915
|
];
|
|
912
916
|
},`;
|
|
913
917
|
}).join(`
|
|
914
918
|
|
|
915
919
|
`), u = e.views.map((i) => {
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
920
|
+
const c = Q(i, e);
|
|
921
|
+
if (c.length === 0)
|
|
918
922
|
return "";
|
|
919
|
-
const
|
|
923
|
+
const h = c[0], y = c.map((S) => `{ key: ${JSON.stringify(S.name)}, label: ${JSON.stringify(S.raw.label || S.raw.name)} }`).join(", "), V = c.filter((S) => S.name !== h.name).map((S) => ` if (missing.includes(${JSON.stringify(S.name)})) delete values.${S.name};`).join(`
|
|
920
924
|
`);
|
|
921
925
|
return ` ${i.name}(result: SemaphorGeneratedMetricResult): SemaphorGeneratedKpiProps {
|
|
922
926
|
const values = mapMetricDisplayValues(metricValuesForView.${i.name}(result));
|
|
923
927
|
const missing = missingMetricMeasuresForView.${i.name}(result).map((key) => String(key));
|
|
924
|
-
const primaryMissing = missing.includes(${JSON.stringify(
|
|
925
|
-
const boundPrimaryValue = values.${
|
|
928
|
+
const primaryMissing = missing.includes(${JSON.stringify(h.name)});
|
|
929
|
+
const boundPrimaryValue = values.${h.name};
|
|
926
930
|
const primaryValue = primaryMissing || boundPrimaryValue === undefined ? result?.primaryValue : boundPrimaryValue;
|
|
927
|
-
if (primaryMissing) values.${
|
|
928
|
-
${
|
|
931
|
+
if (primaryMissing) values.${h.name} = metricDisplayValue(result?.primaryValue);
|
|
932
|
+
${V}
|
|
929
933
|
return {
|
|
930
934
|
result: {
|
|
931
935
|
...(result || {}),
|
|
@@ -934,55 +938,55 @@ ${I}
|
|
|
934
938
|
measures: values,
|
|
935
939
|
},
|
|
936
940
|
title: ${JSON.stringify(i.raw.title || i.raw.id)},
|
|
937
|
-
label: ${JSON.stringify(
|
|
941
|
+
label: ${JSON.stringify(h.raw.label || h.raw.name)},
|
|
938
942
|
value: metricDisplayValue(primaryValue),
|
|
939
|
-
measures: [${
|
|
943
|
+
measures: [${y}],
|
|
940
944
|
missingMeasures: missing,
|
|
941
945
|
showComparison: Boolean(result?.comparisonKind),
|
|
942
946
|
};
|
|
943
947
|
},`;
|
|
944
948
|
}).filter(Boolean).join(`
|
|
945
949
|
|
|
946
|
-
`),
|
|
947
|
-
const
|
|
948
|
-
return ` ${i.name}: ${
|
|
950
|
+
`), p = e.views.map((i) => {
|
|
951
|
+
const c = Ze(i, e);
|
|
952
|
+
return ` ${i.name}: ${M(c)},`;
|
|
949
953
|
}).join(`
|
|
950
|
-
`),
|
|
951
|
-
const
|
|
954
|
+
`), w = e.views.map((i) => {
|
|
955
|
+
const h = D(i, e).map((y) => ` ${y.name}: resolveColumnKey(columns, fieldsForView.${i.name}.${y.name}),`).join(`
|
|
952
956
|
`);
|
|
953
957
|
return ` ${i.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, string | undefined> {
|
|
954
958
|
return {
|
|
955
|
-
${
|
|
959
|
+
${h}
|
|
956
960
|
};
|
|
957
961
|
},`;
|
|
958
962
|
}).join(`
|
|
959
963
|
|
|
960
964
|
`), f = e.views.map((i) => {
|
|
961
|
-
const
|
|
965
|
+
const h = D(i, e).map((y) => ` ${y.name}: readCell(row, columns, fieldsForView.${i.name}.${y.name}),`).join(`
|
|
962
966
|
`);
|
|
963
967
|
return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, unknown> {
|
|
964
968
|
return {
|
|
965
|
-
${
|
|
969
|
+
${h}
|
|
966
970
|
};
|
|
967
971
|
},`;
|
|
968
972
|
}).join(`
|
|
969
973
|
|
|
970
|
-
`),
|
|
974
|
+
`), $ = e.views.map((i) => ` ${i.name}(result: SemaphorGeneratedRecordsResult): Array<Record<keyof typeof fieldsForView.${i.name}, unknown>> {
|
|
971
975
|
return (result?.records || []).map((row) => rowValuesForView.${i.name}(row, result?.columns));
|
|
972
976
|
},`).join(`
|
|
973
977
|
|
|
974
|
-
`),
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
978
|
+
`), F = e.views.map((i) => {
|
|
979
|
+
const c = D(i, e), h = c.filter((s) => s.raw.role === "dimension"), y = c.filter((s) => s.raw.role === "measure"), V = h[0], S = h[1], R = y[0], k = y[1], O = [
|
|
980
|
+
V ? ` primaryDimension: values.${V.name},` : " primaryDimension: undefined,",
|
|
981
|
+
S ? ` secondaryDimension: values.${S.name},` : " secondaryDimension: undefined,",
|
|
982
|
+
R ? ` primaryMeasure: values.${R.name},` : " primaryMeasure: undefined,",
|
|
983
|
+
k ? ` secondaryMeasure: values.${k.name},` : " secondaryMeasure: undefined,"
|
|
980
984
|
].join(`
|
|
981
985
|
`);
|
|
982
986
|
return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): SemaphorGeneratedRoleValues {
|
|
983
987
|
const values = rowValuesForView.${i.name}(row, columns);
|
|
984
988
|
return {
|
|
985
|
-
${
|
|
989
|
+
${O}
|
|
986
990
|
};
|
|
987
991
|
},`;
|
|
988
992
|
}).join(`
|
|
@@ -995,7 +999,7 @@ ${C}
|
|
|
995
999
|
d ? 'import { fields } from "./fields";' : void 0
|
|
996
1000
|
].filter(E).join(`
|
|
997
1001
|
`);
|
|
998
|
-
return `${
|
|
1002
|
+
return `${H}
|
|
999
1003
|
${m}
|
|
1000
1004
|
|
|
1001
1005
|
export type SemaphorGeneratedRow = Record<string, unknown>;
|
|
@@ -1066,11 +1070,11 @@ ${t}
|
|
|
1066
1070
|
} as const;
|
|
1067
1071
|
|
|
1068
1072
|
export const tableColumnsForView = {
|
|
1069
|
-
${
|
|
1073
|
+
${p}
|
|
1070
1074
|
} as const;
|
|
1071
1075
|
|
|
1072
1076
|
export const columnKeysForView = {
|
|
1073
|
-
${
|
|
1077
|
+
${w}
|
|
1074
1078
|
} as const;
|
|
1075
1079
|
|
|
1076
1080
|
export const rowValuesForView = {
|
|
@@ -1078,11 +1082,11 @@ ${f}
|
|
|
1078
1082
|
} as const;
|
|
1079
1083
|
|
|
1080
1084
|
export const rowsForView = {
|
|
1081
|
-
${
|
|
1085
|
+
${$}
|
|
1082
1086
|
} as const;
|
|
1083
1087
|
|
|
1084
1088
|
export const roleValuesForView = {
|
|
1085
|
-
${
|
|
1089
|
+
${F}
|
|
1086
1090
|
} as const;
|
|
1087
1091
|
|
|
1088
1092
|
export const metricValuesForView = {
|
|
@@ -1282,10 +1286,10 @@ function sourcesReferToSameDataset(
|
|
|
1282
1286
|
}
|
|
1283
1287
|
function Ze(e, n) {
|
|
1284
1288
|
const r = D(e, n), t = new Map(
|
|
1285
|
-
(
|
|
1289
|
+
(v(e) ? L(e, n) : []).map((o) => [o.fieldName, o.key])
|
|
1286
1290
|
);
|
|
1287
1291
|
return r.map((o) => {
|
|
1288
|
-
const a =
|
|
1292
|
+
const a = C(o.raw, n), u = a ? t.get(a) : void 0;
|
|
1289
1293
|
return N({
|
|
1290
1294
|
key: o.name,
|
|
1291
1295
|
label: o.raw.label || o.raw.name,
|
|
@@ -1296,12 +1300,12 @@ function Ze(e, n) {
|
|
|
1296
1300
|
});
|
|
1297
1301
|
}
|
|
1298
1302
|
function We(e) {
|
|
1299
|
-
const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((d) => d.id).filter(Boolean), o = e.views.map((d) => d.raw.id).filter(Boolean), a = e.inputs.map((d) => d.raw.id).filter(Boolean), u = e.optionQueries.map((d) => d.raw.id || `${d.input.raw.id}-options`).filter(Boolean),
|
|
1303
|
+
const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((d) => d.id).filter(Boolean), o = e.views.map((d) => d.raw.id).filter(Boolean), a = e.inputs.map((d) => d.raw.id).filter(Boolean), u = e.optionQueries.map((d) => d.raw.id || `${d.input.raw.id}-options`).filter(Boolean), p = Object.fromEntries(o.map((d) => [
|
|
1300
1304
|
d,
|
|
1301
1305
|
e.filterContracts.filter(
|
|
1302
|
-
(
|
|
1303
|
-
).map((
|
|
1304
|
-
])),
|
|
1306
|
+
(l) => Array.isArray(l.appliesToViewIds) && l.appliesToViewIds.includes(d)
|
|
1307
|
+
).map((l) => l.inputId)
|
|
1308
|
+
])), w = Object.fromEntries(e.views.map((d) => [
|
|
1305
1309
|
d.raw.id,
|
|
1306
1310
|
{
|
|
1307
1311
|
title: d.raw.title,
|
|
@@ -1311,14 +1315,14 @@ function We(e) {
|
|
|
1311
1315
|
sdkBuilder: d.raw.sdkBuilder
|
|
1312
1316
|
}
|
|
1313
1317
|
])), f = Object.fromEntries(e.views.map((d) => {
|
|
1314
|
-
var
|
|
1318
|
+
var l;
|
|
1315
1319
|
return [
|
|
1316
1320
|
d.raw.id,
|
|
1317
1321
|
N({
|
|
1318
1322
|
viewId: d.raw.id,
|
|
1319
1323
|
queryId: d.name,
|
|
1320
1324
|
title: d.raw.title,
|
|
1321
|
-
visualType: ((
|
|
1325
|
+
visualType: ((l = d.raw.visualSpec) == null ? void 0 : l.visualType) || d.raw.visual,
|
|
1322
1326
|
suggestedComponentName: me(d.raw.title || d.raw.id || d.name),
|
|
1323
1327
|
marker: {
|
|
1324
1328
|
attribute: "data-semaphor-view-id",
|
|
@@ -1326,15 +1330,15 @@ function We(e) {
|
|
|
1326
1330
|
}
|
|
1327
1331
|
})
|
|
1328
1332
|
];
|
|
1329
|
-
})),
|
|
1330
|
-
var
|
|
1333
|
+
})), $ = Object.fromEntries(e.inputs.map((d) => {
|
|
1334
|
+
var l;
|
|
1331
1335
|
return [
|
|
1332
1336
|
d.raw.id,
|
|
1333
1337
|
N({
|
|
1334
1338
|
inputId: d.raw.id,
|
|
1335
1339
|
label: d.raw.label,
|
|
1336
1340
|
type: d.raw.type,
|
|
1337
|
-
optionQueryId: ((
|
|
1341
|
+
optionQueryId: ((l = d.raw.optionQuery) == null ? void 0 : l.id) || (d.raw.optionQuery ? `${d.raw.id}-options` : void 0),
|
|
1338
1342
|
suggestedComponentName: me(d.raw.label || d.raw.id || d.name),
|
|
1339
1343
|
marker: {
|
|
1340
1344
|
attribute: "data-semaphor-input-id",
|
|
@@ -1342,25 +1346,25 @@ function We(e) {
|
|
|
1342
1346
|
}
|
|
1343
1347
|
})
|
|
1344
1348
|
];
|
|
1345
|
-
})),
|
|
1346
|
-
var
|
|
1349
|
+
})), F = Object.fromEntries(e.views.map((d) => {
|
|
1350
|
+
var l, m, i;
|
|
1347
1351
|
return [
|
|
1348
1352
|
d.name,
|
|
1349
1353
|
N({
|
|
1350
1354
|
viewId: d.raw.id,
|
|
1351
|
-
viewTitle: ((
|
|
1355
|
+
viewTitle: ((l = d.raw.visualSpec) == null ? void 0 : l.title) || d.raw.title,
|
|
1352
1356
|
visualType: (m = d.raw.visualSpec) == null ? void 0 : m.visualType,
|
|
1353
1357
|
title: ((i = d.raw.visualSpec) == null ? void 0 : i.title) || d.raw.title
|
|
1354
1358
|
})
|
|
1355
1359
|
];
|
|
1356
1360
|
}));
|
|
1357
|
-
return `${
|
|
1358
|
-
export const generatedViewIds = ${
|
|
1359
|
-
export const generatedQueryViewIds = ${
|
|
1360
|
-
export const generatedInputIds = ${
|
|
1361
|
-
export const generatedInputOptionQueryIds = ${
|
|
1362
|
-
export const generatedViewAuthoring = ${
|
|
1363
|
-
export const generatedInputAuthoring = ${
|
|
1361
|
+
return `${H}
|
|
1362
|
+
export const generatedViewIds = ${M(t)} as const;
|
|
1363
|
+
export const generatedQueryViewIds = ${M(o)} as const;
|
|
1364
|
+
export const generatedInputIds = ${M(a)} as const;
|
|
1365
|
+
export const generatedInputOptionQueryIds = ${M(u)} as const;
|
|
1366
|
+
export const generatedViewAuthoring = ${M(f)} as const;
|
|
1367
|
+
export const generatedInputAuthoring = ${M($)} as const;
|
|
1364
1368
|
|
|
1365
1369
|
export type SemaphorGeneratedViewId = typeof generatedViewIds[number];
|
|
1366
1370
|
export type SemaphorGeneratedQueryViewId = typeof generatedQueryViewIds[number];
|
|
@@ -1379,8 +1383,8 @@ export type SemaphorGeneratedFilterContract = {
|
|
|
1379
1383
|
readonly [key: string]: unknown;
|
|
1380
1384
|
};
|
|
1381
1385
|
|
|
1382
|
-
export const generatedInputIdsForView = ${
|
|
1383
|
-
export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${
|
|
1386
|
+
export const generatedInputIdsForView = ${M(p)} as const;
|
|
1387
|
+
export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${M(e.filterContracts)} as const;
|
|
1384
1388
|
|
|
1385
1389
|
export function semaphorViewMarkerProps(viewId: SemaphorGeneratedViewId) {
|
|
1386
1390
|
return {
|
|
@@ -1400,9 +1404,9 @@ export function filterContractsForView(viewId: SemaphorGeneratedQueryViewId) {
|
|
|
1400
1404
|
);
|
|
1401
1405
|
}
|
|
1402
1406
|
|
|
1403
|
-
export const queryDebugForView = ${
|
|
1407
|
+
export const queryDebugForView = ${M(F)} as const;
|
|
1404
1408
|
|
|
1405
|
-
export const semaphorGeneratedContractMetadata = ${
|
|
1409
|
+
export const semaphorGeneratedContractMetadata = ${M({
|
|
1406
1410
|
schemaVersion: "semaphor-generated-data-app-contract/v1",
|
|
1407
1411
|
title: e.title,
|
|
1408
1412
|
requiredDevtools: r,
|
|
@@ -1412,16 +1416,16 @@ export const semaphorGeneratedContractMetadata = ${k({
|
|
|
1412
1416
|
generatedQueryViewIds: o,
|
|
1413
1417
|
generatedInputIds: a,
|
|
1414
1418
|
generatedInputOptionQueryIds: u,
|
|
1415
|
-
generatedInputIdsForView:
|
|
1419
|
+
generatedInputIdsForView: p,
|
|
1416
1420
|
generatedViewAuthoring: f,
|
|
1417
|
-
generatedInputAuthoring:
|
|
1418
|
-
visualSpecs:
|
|
1421
|
+
generatedInputAuthoring: $,
|
|
1422
|
+
visualSpecs: w,
|
|
1419
1423
|
presentationViews: e.presentationViews
|
|
1420
1424
|
})} as const;
|
|
1421
1425
|
`;
|
|
1422
1426
|
}
|
|
1423
1427
|
function Xe() {
|
|
1424
|
-
return `${
|
|
1428
|
+
return `${H}
|
|
1425
1429
|
export * from "./sources";
|
|
1426
1430
|
export * from "./fields";
|
|
1427
1431
|
export * from "./inputs";
|
|
@@ -1437,7 +1441,7 @@ function B(e, n) {
|
|
|
1437
1441
|
for (const r of n) B(e, r);
|
|
1438
1442
|
return;
|
|
1439
1443
|
}
|
|
1440
|
-
G(n) &&
|
|
1444
|
+
G(n) && g(e, Y(n));
|
|
1441
1445
|
for (const r of Object.values(n))
|
|
1442
1446
|
B(e, r);
|
|
1443
1447
|
}
|
|
@@ -1446,22 +1450,22 @@ function D(e, n) {
|
|
|
1446
1450
|
const r = [];
|
|
1447
1451
|
if (on(r, e.raw.sdkSpec), r.length === 0)
|
|
1448
1452
|
for (const o of e.raw.fields || [])
|
|
1449
|
-
|
|
1453
|
+
g(r, o);
|
|
1450
1454
|
const t = X(
|
|
1451
|
-
r.filter((o) => o.name &&
|
|
1455
|
+
r.filter((o) => o.name && C(o, n)).map((o) => ({ raw: o, key: Z(o), name: "" })),
|
|
1452
1456
|
(o) => o.key
|
|
1453
1457
|
);
|
|
1454
1458
|
return ge(t, n, "field"), t;
|
|
1455
1459
|
}
|
|
1456
1460
|
function Q(e, n) {
|
|
1457
|
-
if (
|
|
1461
|
+
if (K(e.raw.sdkSpec.builder) !== "metric")
|
|
1458
1462
|
return [];
|
|
1459
|
-
const r =
|
|
1460
|
-
|
|
1461
|
-
for (const a of
|
|
1462
|
-
|
|
1463
|
+
const r = b(e.raw.sdkSpec.spec), t = [];
|
|
1464
|
+
g(t, r == null ? void 0 : r.primaryMeasure);
|
|
1465
|
+
for (const a of j(r == null ? void 0 : r.measures))
|
|
1466
|
+
g(t, a);
|
|
1463
1467
|
const o = X(
|
|
1464
|
-
t.filter((a) => a.name &&
|
|
1468
|
+
t.filter((a) => a.name && C(a, n)).map((a) => ({ raw: a, key: Z(a), name: "" })),
|
|
1465
1469
|
(a) => a.key
|
|
1466
1470
|
);
|
|
1467
1471
|
return ge(o, n, "metric"), o;
|
|
@@ -1478,17 +1482,17 @@ function en(e, n, r) {
|
|
|
1478
1482
|
function ge(e, n, r) {
|
|
1479
1483
|
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1480
1484
|
for (const u of e) {
|
|
1481
|
-
const
|
|
1482
|
-
t.set(u.key,
|
|
1485
|
+
const p = q(u.raw.name || u.raw.label || r) || r;
|
|
1486
|
+
t.set(u.key, p), o.set(p, (o.get(p) || 0) + 1);
|
|
1483
1487
|
}
|
|
1484
1488
|
const a = /* @__PURE__ */ new Set();
|
|
1485
1489
|
for (const u of e) {
|
|
1486
|
-
const
|
|
1490
|
+
const p = t.get(u.key) || r, w = C(u.raw, n) || p, f = o.get(p) === 1 ? p : w;
|
|
1487
1491
|
u.name = nn(f, u.key, a);
|
|
1488
1492
|
}
|
|
1489
1493
|
}
|
|
1490
1494
|
function nn(e, n, r) {
|
|
1491
|
-
const t = tn(e) ? e :
|
|
1495
|
+
const t = tn(e) ? e : q(e || "field") || "field";
|
|
1492
1496
|
if (!r.has(t))
|
|
1493
1497
|
return r.add(t), t;
|
|
1494
1498
|
const o = rn(n), a = `${t}${o}`;
|
|
@@ -1497,8 +1501,8 @@ function nn(e, n, r) {
|
|
|
1497
1501
|
let u = 2;
|
|
1498
1502
|
for (; r.has(`${a}${u}`); )
|
|
1499
1503
|
u += 1;
|
|
1500
|
-
const
|
|
1501
|
-
return r.add(
|
|
1504
|
+
const p = `${a}${u}`;
|
|
1505
|
+
return r.add(p), p;
|
|
1502
1506
|
}
|
|
1503
1507
|
function rn(e) {
|
|
1504
1508
|
let n = 0;
|
|
@@ -1510,55 +1514,55 @@ function tn(e) {
|
|
|
1510
1514
|
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e);
|
|
1511
1515
|
}
|
|
1512
1516
|
function on(e, n) {
|
|
1513
|
-
const r =
|
|
1517
|
+
const r = b(n.spec);
|
|
1514
1518
|
if (!r)
|
|
1515
1519
|
return;
|
|
1516
|
-
const t =
|
|
1520
|
+
const t = K(n.builder);
|
|
1517
1521
|
if (t === "records") {
|
|
1518
|
-
for (const o of
|
|
1522
|
+
for (const o of j(r.fields)) g(e, o);
|
|
1519
1523
|
return;
|
|
1520
1524
|
}
|
|
1521
1525
|
if (t === "sql") {
|
|
1522
|
-
for (const o of
|
|
1526
|
+
for (const o of j(r.fields)) g(e, o);
|
|
1523
1527
|
return;
|
|
1524
1528
|
}
|
|
1525
1529
|
if (t === "analysis" || t === "metric") {
|
|
1526
|
-
|
|
1527
|
-
for (const o of
|
|
1528
|
-
for (const o of
|
|
1529
|
-
|
|
1530
|
+
g(e, r.primaryMeasure);
|
|
1531
|
+
for (const o of j(r.measures)) g(e, o);
|
|
1532
|
+
for (const o of j(r.dimensions)) g(e, o);
|
|
1533
|
+
g(e, r.dateField);
|
|
1530
1534
|
return;
|
|
1531
1535
|
}
|
|
1532
1536
|
if (t === "matrix") {
|
|
1533
|
-
const o = pe(r.rows), a = pe(r.columns), u =
|
|
1534
|
-
for (const
|
|
1535
|
-
for (const
|
|
1536
|
-
for (const
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1537
|
+
const o = pe(r.rows), a = pe(r.columns), u = j(r.values);
|
|
1538
|
+
for (const p of o) le(e, p);
|
|
1539
|
+
for (const p of a) le(e, p);
|
|
1540
|
+
for (const p of u) {
|
|
1541
|
+
const w = b(p);
|
|
1542
|
+
g(e, w == null ? void 0 : w.field), g(e, w == null ? void 0 : w.measure);
|
|
1539
1543
|
}
|
|
1540
1544
|
}
|
|
1541
1545
|
}
|
|
1542
1546
|
function pe(e) {
|
|
1543
1547
|
if (Array.isArray(e))
|
|
1544
1548
|
return e;
|
|
1545
|
-
const n =
|
|
1549
|
+
const n = b(e);
|
|
1546
1550
|
return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
|
|
1547
1551
|
}
|
|
1548
1552
|
function le(e, n) {
|
|
1549
1553
|
var r;
|
|
1550
1554
|
if (G(n)) {
|
|
1551
|
-
|
|
1555
|
+
g(e, n);
|
|
1552
1556
|
return;
|
|
1553
1557
|
}
|
|
1554
|
-
|
|
1558
|
+
g(e, (r = b(n)) == null ? void 0 : r.field);
|
|
1555
1559
|
}
|
|
1556
1560
|
function ce(e) {
|
|
1557
1561
|
var n, r, t, o;
|
|
1558
1562
|
return ((n = e == null ? void 0 : e.computation) == null ? void 0 : n.kind) === "presentation_only" || ((r = e == null ? void 0 : e.computation) == null ? void 0 : r.kind) === "derived" || ((t = e == null ? void 0 : e.computation) == null ? void 0 : t.kind) === "unsupported" || (e == null ? void 0 : e.visual) === "text_block" || ((o = e == null ? void 0 : e.visualSpec) == null ? void 0 : o.visualType) === "text_block";
|
|
1559
1563
|
}
|
|
1560
1564
|
function sn(e) {
|
|
1561
|
-
const n =
|
|
1565
|
+
const n = b(e) || {};
|
|
1562
1566
|
return N({
|
|
1563
1567
|
id: e.id,
|
|
1564
1568
|
title: e.title,
|
|
@@ -1573,7 +1577,7 @@ function sn(e) {
|
|
|
1573
1577
|
description: n.description
|
|
1574
1578
|
});
|
|
1575
1579
|
}
|
|
1576
|
-
function
|
|
1580
|
+
function g(e, n) {
|
|
1577
1581
|
G(n) && e.push(Y(n));
|
|
1578
1582
|
}
|
|
1579
1583
|
function Y(e) {
|
|
@@ -1603,11 +1607,11 @@ function an(e) {
|
|
|
1603
1607
|
};
|
|
1604
1608
|
}
|
|
1605
1609
|
function G(e) {
|
|
1606
|
-
const n =
|
|
1610
|
+
const n = b(e);
|
|
1607
1611
|
return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
|
|
1608
1612
|
}
|
|
1609
1613
|
function we(e) {
|
|
1610
|
-
const n =
|
|
1614
|
+
const n = b(e);
|
|
1611
1615
|
return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
|
|
1612
1616
|
}
|
|
1613
1617
|
function x(e, n) {
|
|
@@ -1618,20 +1622,20 @@ function x(e, n) {
|
|
|
1618
1622
|
if (Array.isArray(e))
|
|
1619
1623
|
return `[${e.map((o) => x(o, n)).join(", ")}]`;
|
|
1620
1624
|
if (G(e)) {
|
|
1621
|
-
const o =
|
|
1625
|
+
const o = C(Y(e), n);
|
|
1622
1626
|
if (o) return `fields.${o}`;
|
|
1623
1627
|
}
|
|
1624
1628
|
if (we(e)) {
|
|
1625
1629
|
const o = Se(e, n);
|
|
1626
1630
|
if (o) return `sources.${o}`;
|
|
1627
1631
|
}
|
|
1628
|
-
const r =
|
|
1632
|
+
const r = b(e);
|
|
1629
1633
|
return r ? `{ ${Object.entries(r).filter(([, o]) => o !== void 0).map(([o, a]) => `${JSON.stringify(o)}: ${x(a, n)}`).join(", ")} }` : JSON.stringify(e);
|
|
1630
1634
|
}
|
|
1631
|
-
function
|
|
1635
|
+
function M(e) {
|
|
1632
1636
|
return JSON.stringify(e, null, 2);
|
|
1633
1637
|
}
|
|
1634
|
-
function
|
|
1638
|
+
function C(e, n) {
|
|
1635
1639
|
if (G(e))
|
|
1636
1640
|
return n.fieldNameByKey.get(Z(Y(e)));
|
|
1637
1641
|
}
|
|
@@ -1691,7 +1695,7 @@ function $e(e) {
|
|
|
1691
1695
|
return W(e)[0] || de(e);
|
|
1692
1696
|
}
|
|
1693
1697
|
function W(e) {
|
|
1694
|
-
const n =
|
|
1698
|
+
const n = b(e);
|
|
1695
1699
|
if (!n)
|
|
1696
1700
|
return [];
|
|
1697
1701
|
const r = [];
|
|
@@ -1705,7 +1709,7 @@ function Ie(e) {
|
|
|
1705
1709
|
return W(e);
|
|
1706
1710
|
}
|
|
1707
1711
|
function de(e) {
|
|
1708
|
-
const n =
|
|
1712
|
+
const n = b(e);
|
|
1709
1713
|
return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
|
|
1710
1714
|
}
|
|
1711
1715
|
function cn(e) {
|
|
@@ -1717,18 +1721,18 @@ function ie(e) {
|
|
|
1717
1721
|
...e.source ? W(e.source) : []
|
|
1718
1722
|
]) : [];
|
|
1719
1723
|
}
|
|
1720
|
-
function
|
|
1724
|
+
function K(e) {
|
|
1721
1725
|
const n = String(e || "").replace(/^semaphor\./, "");
|
|
1722
1726
|
if (!["metric", "records", "analysis", "matrix", "sql"].includes(n))
|
|
1723
1727
|
throw new Error(`Unsupported sdkSpec builder: ${e}`);
|
|
1724
1728
|
return n;
|
|
1725
1729
|
}
|
|
1726
1730
|
function mn(e) {
|
|
1727
|
-
const n =
|
|
1731
|
+
const n = K(e);
|
|
1728
1732
|
return n === "records" || n === "sql";
|
|
1729
1733
|
}
|
|
1730
1734
|
function fn(e) {
|
|
1731
|
-
const n =
|
|
1735
|
+
const n = b(e);
|
|
1732
1736
|
return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
|
|
1733
1737
|
}
|
|
1734
1738
|
function P(e, n) {
|
|
@@ -1746,7 +1750,7 @@ function X(e, n) {
|
|
|
1746
1750
|
}
|
|
1747
1751
|
return t;
|
|
1748
1752
|
}
|
|
1749
|
-
function
|
|
1753
|
+
function q(e) {
|
|
1750
1754
|
const n = String(e || "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
1751
1755
|
if (n.length === 0)
|
|
1752
1756
|
return "item";
|
|
@@ -1757,7 +1761,7 @@ function K(e) {
|
|
|
1757
1761
|
return /^[A-Za-z_$]/.test(o) ? o : `item${o}`;
|
|
1758
1762
|
}
|
|
1759
1763
|
function me(e) {
|
|
1760
|
-
const n =
|
|
1764
|
+
const n = q(e);
|
|
1761
1765
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
1762
1766
|
}
|
|
1763
1767
|
function yn(e) {
|
|
@@ -1767,10 +1771,10 @@ function yn(e) {
|
|
|
1767
1771
|
function N(e) {
|
|
1768
1772
|
return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
|
|
1769
1773
|
}
|
|
1770
|
-
function
|
|
1774
|
+
function b(e) {
|
|
1771
1775
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
1772
1776
|
}
|
|
1773
|
-
function
|
|
1777
|
+
function j(e) {
|
|
1774
1778
|
return Array.isArray(e) ? e : [];
|
|
1775
1779
|
}
|
|
1776
1780
|
function J(e) {
|
|
@@ -1794,10 +1798,10 @@ export {
|
|
|
1794
1798
|
xn as buildSemaphorGeneratedInputOptionIntent,
|
|
1795
1799
|
Nn as buildSemaphorGeneratedViewExecutionRequest,
|
|
1796
1800
|
En as buildSemaphorGeneratedViewExecutionRequests,
|
|
1797
|
-
|
|
1801
|
+
vn as evaluateSemaphorDataAppContractUpdatePolicy,
|
|
1798
1802
|
Sn as generateSemaphorDataAppContract,
|
|
1799
1803
|
bn as isSemaphorDataAppCodegenSummary,
|
|
1800
|
-
|
|
1804
|
+
An as validateCodegenSummary,
|
|
1801
1805
|
kn as validateSemaphorDataAppCodegenSummary,
|
|
1802
|
-
|
|
1806
|
+
Hn as validateSemaphorGeneratedContract
|
|
1803
1807
|
};
|