react-semaphor 0.1.495 → 0.1.496

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.
Files changed (124) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +233 -218
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +5 -5
  7. package/dist/chunks/calculated-field-identity-Cq9GwHfE.js +1266 -0
  8. package/dist/chunks/calculated-field-identity-DTfyvvLC.cjs +1 -0
  9. package/dist/chunks/{constants-BjGBVFbu.js → constants-CC3WKmqC.js} +14 -14
  10. package/dist/chunks/{constants-C-GvudXp.cjs → constants-DIuhVR6J.cjs} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-tYTkfNPj.js → dashboard-briefing-launcher-Bbz4cwHb.js} +9 -9
  12. package/dist/chunks/{dashboard-briefing-launcher-DyYVbfXp.cjs → dashboard-briefing-launcher-CM6LTGw5.cjs} +1 -1
  13. package/dist/chunks/{dashboard-controls-Hwo4ZnW4.cjs → dashboard-controls-B2nrczJl.cjs} +1 -1
  14. package/dist/chunks/{dashboard-controls-BR7hSzDh.js → dashboard-controls-BsgADy-S.js} +11 -11
  15. package/dist/chunks/{dashboard-date-comparison-definition-CpCZAGIz.js → dashboard-date-comparison-definition-Bqti6YAo.js} +1 -1
  16. package/dist/chunks/{dashboard-date-comparison-definition-1NBx_7QQ.cjs → dashboard-date-comparison-definition-C69F-zaC.cjs} +1 -1
  17. package/dist/chunks/{dashboard-json-FDNan6Lc.js → dashboard-json-CA-BChbt.js} +7 -7
  18. package/dist/chunks/{dashboard-json-B3CuJo_G.cjs → dashboard-json-CwRRBSSL.cjs} +1 -1
  19. package/dist/chunks/{edit-dashboard-visual-aqW4Jtrr.cjs → edit-dashboard-visual-BlS27LDw.cjs} +1 -1
  20. package/dist/chunks/{edit-dashboard-visual-DTJwFkdX.js → edit-dashboard-visual-CEiPgdkX.js} +15 -15
  21. package/dist/chunks/{editor-action-buttons-DSGiwWur.js → editor-action-buttons-6HBjjcfK.js} +6 -6
  22. package/dist/chunks/{editor-action-buttons-B3Dpnink.cjs → editor-action-buttons-kk2BNiTe.cjs} +1 -1
  23. package/dist/chunks/{field-aggregations-Cy4hBBqe.js → field-aggregations-C8kZqMTD.js} +11 -11
  24. package/dist/chunks/{field-aggregations-U54X9_Rt.cjs → field-aggregations-naKZ7S2Q.cjs} +1 -1
  25. package/dist/chunks/{index-a9nBmD-v.cjs → index-BSRwdFTN.cjs} +222 -222
  26. package/dist/chunks/{index-B9FLuTyx.cjs → index-CCa-A-Yx.cjs} +1 -1
  27. package/dist/chunks/{index-Ne0-ePdz.js → index-Cgoz65yM.js} +39098 -38334
  28. package/dist/chunks/{index-zKj-mqbS.js → index-oll4m-qi.js} +11 -11
  29. package/dist/chunks/{matrix-analytical-definition-DSRmzber.js → matrix-analytical-definition-B1xhoCak.js} +1 -1
  30. package/dist/chunks/{matrix-analytical-definition-B5oWAePu.cjs → matrix-analytical-definition-BK5y9XHH.cjs} +1 -1
  31. package/dist/chunks/{matrix-card-CxTCV9HF.js → matrix-card-BEb6hr8i.js} +2 -2
  32. package/dist/chunks/{matrix-card-BV7OPtq_.cjs → matrix-card-Ii8yYSnw.cjs} +1 -1
  33. package/dist/chunks/{matrix-control-sources-BLGlb4S9.cjs → matrix-control-sources-CdegRBcA.cjs} +1 -1
  34. package/dist/chunks/{matrix-control-sources-DYMzccBY.js → matrix-control-sources-cbYmqWNg.js} +5 -5
  35. package/dist/chunks/{matrix-definition-jy7ygO6J.cjs → matrix-definition-CSNthxru.cjs} +1 -1
  36. package/dist/chunks/{matrix-definition-Djesv_9v.js → matrix-definition-CZM5-YJX.js} +1 -1
  37. package/dist/chunks/{matrix-formatter-CuRTrMP2.cjs → matrix-formatter-C19PZAal.cjs} +1 -1
  38. package/dist/chunks/{matrix-formatter-BhkdDosE.js → matrix-formatter-CiXzpX6X.js} +27 -27
  39. package/dist/chunks/matrix-member-presentation-CQHvq18l.cjs +1 -0
  40. package/dist/chunks/matrix-member-presentation-CabW8mJc.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-4q53iAUW.js → matrix-operation-contract-0Nor-C71.js} +21 -21
  42. package/dist/chunks/{matrix-operation-contract-CbavkrJj.cjs → matrix-operation-contract-o9GXbiHw.cjs} +1 -1
  43. package/dist/chunks/{metric-comparison-CPx_2iqI.js → metric-comparison-Br8l0WkK.js} +1 -1
  44. package/dist/chunks/{metric-comparison-l2X7Reol.cjs → metric-comparison-DeiOjEm5.cjs} +1 -1
  45. package/dist/chunks/{operators-C8TxpM4C.js → operators-B3zZoskU.js} +28 -10
  46. package/dist/chunks/operators-DEfKaU_V.cjs +1 -0
  47. package/dist/chunks/{pivot-header-presentation-BDMb1Wlc.cjs → pivot-header-presentation-DRv-cSIP.cjs} +1 -1
  48. package/dist/chunks/{pivot-header-presentation-utM9JrgD.js → pivot-header-presentation-DW-ti5ek.js} +3 -3
  49. package/dist/chunks/{pivot-result-identity-Hm1sO9KE.cjs → pivot-result-identity-DEenUrMj.cjs} +1 -1
  50. package/dist/chunks/{pivot-result-identity-BDntll93.js → pivot-result-identity-sZc1RaIz.js} +1 -1
  51. package/dist/chunks/{pivot-result-lifecycle-QiOUMsYd.cjs → pivot-result-lifecycle-D81qcCcZ.cjs} +1 -1
  52. package/dist/chunks/{pivot-result-lifecycle-Cu9hRFAp.js → pivot-result-lifecycle-DJ40gdwk.js} +7 -7
  53. package/dist/chunks/{raw-temporal-DWuF9bt7.cjs → raw-temporal-DDTt2yv5.cjs} +1 -1
  54. package/dist/chunks/{raw-temporal-CknUT-Fp.js → raw-temporal-DHCZrFe7.js} +15 -15
  55. package/dist/chunks/{raw-temporal-contract-B3YGcvzw.cjs → raw-temporal-contract-BcbV56Rc.cjs} +1 -1
  56. package/dist/chunks/{raw-temporal-contract-BVcDonCB.js → raw-temporal-contract-CkvdtPYA.js} +1 -1
  57. package/dist/chunks/{report-preferences-dialog-DsjMwa3m.js → report-preferences-dialog-CVRJOCQu.js} +6 -6
  58. package/dist/chunks/{report-preferences-dialog-BP_EdVHP.cjs → report-preferences-dialog-DGEq-iBF.cjs} +1 -1
  59. package/dist/chunks/{report-runtime-context-DTxVBKqP.js → report-runtime-context-BlDpc-F-.js} +1 -1
  60. package/dist/chunks/{report-runtime-context-C-As8sq_.cjs → report-runtime-context-lSIvyKm2.cjs} +1 -1
  61. package/dist/chunks/{semantic-format-CyJWf8gZ.cjs → semantic-format--_VEin18.cjs} +1 -1
  62. package/dist/chunks/{semantic-format-BTEhH9ga.js → semantic-format-ew5zviaT.js} +2 -2
  63. package/dist/chunks/{source-entity-resolution-DXjCZPuO.js → source-entity-resolution-79Rihbk3.js} +121 -107
  64. package/dist/chunks/source-entity-resolution-DPjslVgx.cjs +1 -0
  65. package/dist/chunks/{switch-BmCGBb2F.js → switch-BmyuyM7e.js} +4736 -4697
  66. package/dist/chunks/switch-nDjQC2y3.cjs +139 -0
  67. package/dist/chunks/{temporal-bucket-contract-pW4c6N2M.cjs → temporal-bucket-contract-BYR6tj6F.cjs} +1 -1
  68. package/dist/chunks/{temporal-bucket-contract-Bhsl_j4B.js → temporal-bucket-contract-C-kKQ_W4.js} +1 -1
  69. package/dist/chunks/{token-types-DpYncMPp.js → token-types-BIYFAsGq.js} +1 -1
  70. package/dist/chunks/{token-types-CsKRtJp0.cjs → token-types-CkAGFhiW.cjs} +1 -1
  71. package/dist/chunks/{update-policy-CtLb9ish.cjs → update-policy-BCtFr2Qh.cjs} +1 -1
  72. package/dist/chunks/{update-policy-BoB26XrS.js → update-policy-CP_A1IVD.js} +2 -2
  73. package/dist/chunks/{validators-DgmJaRF4.js → validators-D-_IT-Xw.js} +1132 -1013
  74. package/dist/chunks/validators-ux2obZB9.cjs +1 -0
  75. package/dist/dashboard/index.cjs +1 -1
  76. package/dist/dashboard/index.js +1 -1
  77. package/dist/dashboard-authoring/index.cjs +3 -3
  78. package/dist/dashboard-authoring/index.js +157 -150
  79. package/dist/data-app-builder/index.cjs +1 -1
  80. package/dist/data-app-builder/index.js +2 -2
  81. package/dist/data-app-codegen/index.cjs +1 -1
  82. package/dist/data-app-codegen/index.js +2 -2
  83. package/dist/data-app-codegen-node/index.cjs +2 -2
  84. package/dist/data-app-codegen-node/index.js +33 -36
  85. package/dist/data-app-sdk/index.cjs +2 -2
  86. package/dist/data-app-sdk/index.js +232 -230
  87. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  88. package/dist/data-app-sdk-adapters/index.js +3 -3
  89. package/dist/data-app-sdk-validation/index.cjs +1 -1
  90. package/dist/data-app-sdk-validation/index.js +5 -5
  91. package/dist/format-utils/index.cjs +1 -1
  92. package/dist/format-utils/index.js +26 -26
  93. package/dist/index.cjs +1 -1
  94. package/dist/index.js +15 -15
  95. package/dist/report-runtime-context/index.cjs +1 -1
  96. package/dist/report-runtime-context/index.js +2 -2
  97. package/dist/surfboard/index.cjs +1 -1
  98. package/dist/surfboard/index.js +2 -2
  99. package/dist/types/analytics-protocol.d.ts +256 -1
  100. package/dist/types/briefings.d.ts +46 -0
  101. package/dist/types/dashboard-assistant.d.ts +46 -1
  102. package/dist/types/dashboard-authoring.d.ts +131 -2
  103. package/dist/types/dashboard.d.ts +48 -0
  104. package/dist/types/data-app-builder.d.ts +23 -1
  105. package/dist/types/data-app-codegen-node.d.ts +23 -1
  106. package/dist/types/data-app-codegen.d.ts +23 -1
  107. package/dist/types/data-app-sdk-adapters.d.ts +23 -1
  108. package/dist/types/data-app-sdk-validation.d.ts +46 -1
  109. package/dist/types/data-app-sdk.d.ts +51 -1
  110. package/dist/types/index.cjs +1 -1
  111. package/dist/types/index.js +4 -4
  112. package/dist/types/main.d.ts +111 -1
  113. package/dist/types/shared.d.ts +46 -0
  114. package/dist/types/surfboard.d.ts +48 -0
  115. package/dist/types/types.d.ts +48 -0
  116. package/package.json +1 -1
  117. package/dist/chunks/calculated-field-identity-Cc-RlE-0.cjs +0 -1
  118. package/dist/chunks/calculated-field-identity-D7ygZ7oN.js +0 -1117
  119. package/dist/chunks/matrix-member-presentation-BN6VD-fr.js +0 -24
  120. package/dist/chunks/matrix-member-presentation-D82rMVDG.cjs +0 -1
  121. package/dist/chunks/operators-DrTQsJXv.cjs +0 -1
  122. package/dist/chunks/source-entity-resolution-BA8sdBbL.cjs +0 -1
  123. package/dist/chunks/switch-COujiMcB.cjs +0 -139
  124. package/dist/chunks/validators-CueUwVE4.cjs +0 -1
@@ -8704,6 +8704,12 @@ declare type DashboardFilterAuthoringSettingsUpdate = {
8704
8704
  target?: DashboardInputRuntimeTarget;
8705
8705
  optionSourceChanged?: boolean;
8706
8706
  optionSource?: DashboardFilterOptionSource;
8707
+ /** Authored option dependency policy edit; undefined value restores the
8708
+ * dashboard default (omitted, meaning All applicable). */
8709
+ optionDependenciesChanged?: boolean;
8710
+ optionDependencies?: DashboardFilterOptionDependencies;
8711
+ optionPopulationChanged?: boolean;
8712
+ optionPopulation?: DashboardFilterOptionPopulation;
8707
8713
  /** Raw selection identity changed; the previous runtime value is invalid. */
8708
8714
  selectionIdentityChanged?: boolean;
8709
8715
  };
@@ -8890,6 +8896,16 @@ declare type DashboardFilterMappingDraftRow = {
8890
8896
 
8891
8897
  declare type DashboardFilterMappingDraftStatus = 'pendingSource' | 'automatic' | 'suggested' | 'needsMapping' | 'mapped' | 'notApplicable' | 'excluded' | 'invalidMapping' | 'metadataUnavailable';
8892
8898
 
8899
+ /**
8900
+ * Persisted policy for which peer selections narrow a filter's option list.
8901
+ * Omitted means All applicable for dashboards; see
8902
+ * `resolveDashboardOptionDependencies`.
8903
+ */
8904
+ declare type DashboardFilterOptionDependencies = SemaphorOptionDependencies;
8905
+
8906
+ /** Persisted population that fixes relevance for fact-bridged cascades. */
8907
+ declare type DashboardFilterOptionPopulation = SemaphorOptionPopulation;
8908
+
8893
8909
  /** Persisted label/value option definition for a mapped dashboard filter. */
8894
8910
  export declare type DashboardFilterOptionSource = SemaphorInputOptionSource;
8895
8911
 
@@ -10117,6 +10133,8 @@ export declare type EmbeddedFilterDashboardInput = FilterDashboardInputBase & {
10117
10133
  filter: TFilter;
10118
10134
  filterReference?: never;
10119
10135
  optionSource?: DashboardFilterOptionSource;
10136
+ optionDependencies?: DashboardFilterOptionDependencies;
10137
+ optionPopulation?: DashboardFilterOptionPopulation;
10120
10138
  application?: DashboardFilterApplication;
10121
10139
  };
10122
10140
 
@@ -10720,6 +10738,53 @@ declare type FilterOnClick = {
10720
10738
  columnIndex: number;
10721
10739
  };
10722
10740
 
10741
+ declare type FilterOptionDependencyFailure = {
10742
+ peer: FilterOptionDependencyPeer;
10743
+ reason?: SemaphorOptionDependencyOutcomeReason;
10744
+ /** Viewer-safe explanation built from the reason, never raw server text. */
10745
+ message: string;
10746
+ /** Explicit mode and an overridable, classified reason. */
10747
+ canOverride: boolean;
10748
+ };
10749
+
10750
+ declare type FilterOptionDependencyFeedback = {
10751
+ applied: FilterOptionDependencyPeer[];
10752
+ skipped: Array<FilterOptionDependencyPeer & {
10753
+ reason?: SemaphorOptionDependencyOutcomeReason;
10754
+ }>;
10755
+ overridden: Array<FilterOptionDependencyPeer & {
10756
+ reason?: SemaphorOptionDependencyOutcomeReason;
10757
+ }>;
10758
+ failure?: FilterOptionDependencyFailure;
10759
+ };
10760
+
10761
+ /**
10762
+ * Viewer-facing reading of the server's dependency outcomes for one option
10763
+ * list. Pure: outcomes and the request error come from the response, labels
10764
+ * come from the dashboard. Nothing here decides applicability; the server
10765
+ * already did. It only says what was applied, what was skipped and why, what
10766
+ * the viewer is browsing around, and whether a classified failure may be
10767
+ * browsed around at all.
10768
+ */
10769
+ declare type FilterOptionDependencyPeer = {
10770
+ inputId: string;
10771
+ label: string;
10772
+ };
10773
+
10774
+ /**
10775
+ * Dependency state a list renders: what narrowed it, what was skipped, the
10776
+ * active browse override, and the one classified failure a viewer may
10777
+ * browse around. Overrides live here, in browse state, and nowhere else.
10778
+ */
10779
+ declare type FilterOptionDependencyState = FilterOptionDependencyFeedback & {
10780
+ /** Explicit dependency ids currently browsed without. */
10781
+ override: readonly string[];
10782
+ showDiagnostics: boolean;
10783
+ /** Browse without one classified dependency; the server re-validates. */
10784
+ overrideDependency: (inputId: string) => void;
10785
+ clearOverride: () => void;
10786
+ };
10787
+
10723
10788
  declare type FilterOptionValue = string | number | boolean;
10724
10789
 
10725
10790
  declare type FilterSemanticContext = {
@@ -19936,6 +20001,8 @@ export declare type NormalizedFilterDashboardInput = FilterDashboardInputBase &
19936
20001
  kind: 'filter';
19937
20002
  filter: TFilter;
19938
20003
  optionSource?: DashboardFilterOptionSource;
20004
+ optionDependencies?: DashboardFilterOptionDependencies;
20005
+ optionPopulation?: DashboardFilterOptionPopulation;
19939
20006
  application?: DashboardFilterApplication;
19940
20007
  definitionOrigin: 'embedded' | 'dashboardFilter';
19941
20008
  };
@@ -20003,6 +20070,21 @@ declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in'
20003
20070
 
20004
20071
  export declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'like' | 'not like' | 'in' | 'not in' | 'between' | 'not between' | 'isNull' | 'isNotNull';
20005
20072
 
20073
+ declare type OptionSelectionRelevance = {
20074
+ byIdentity: ReadonlyMap<string, OptionSelectionRelevanceStatus>;
20075
+ noMatchIdentities: ReadonlySet<string>;
20076
+ isPending: boolean;
20077
+ };
20078
+
20079
+ /**
20080
+ * Per-value relevance of a retained selection under the authored dependency
20081
+ * context. Only a successful, complete exact-value check may say
20082
+ * `no_match`; everything else (pending, failed, unsupported, truncated,
20083
+ * beyond the bounded batch) stays `unknown`, so a stale or partial answer can
20084
+ * never mark a current selection wrong.
20085
+ */
20086
+ declare type OptionSelectionRelevanceStatus = 'matches' | 'no_match' | 'unknown';
20087
+
20006
20088
  declare type OptionsMap = {
20007
20089
  number: NumberOptions;
20008
20090
  string: StringOptions;
@@ -21881,6 +21963,8 @@ export declare type ReferencedFilterDashboardInput = FilterDashboardInputBase &
21881
21963
  filterId: string;
21882
21964
  };
21883
21965
  optionSource?: DashboardFilterOptionSource;
21966
+ optionDependencies?: DashboardFilterOptionDependencies;
21967
+ optionPopulation?: DashboardFilterOptionPopulation;
21884
21968
  application?: DashboardFilterApplication;
21885
21969
  };
21886
21970
 
@@ -22388,6 +22472,15 @@ declare type SemaphorInputOptionsIntent = SemaphorInputOptionSource & {
22388
22472
  dependencies?: SemaphorOptionDependencies;
22389
22473
  search?: string;
22390
22474
  limit?: number;
22475
+ /**
22476
+ * Authoritative selected-value relevance check: return only options whose
22477
+ * value is one of these exact raw values, under the same dependency and
22478
+ * population context, with no search or paging. Bounded by
22479
+ * `MAX_OPTION_MATCH_VALUES`. The result's `match.complete` says whether
22480
+ * absence from the returned options proves no match. Scalars only; see
22481
+ * `parseOptionMatchValues`.
22482
+ */
22483
+ matchValues?: Array<string | number | boolean>;
22391
22484
  inputs?: SemaphorInputBinding[];
22392
22485
  derivedFields?: SemaphorDerivedFieldDefinition[];
22393
22486
  };
@@ -22440,11 +22533,26 @@ declare type SemaphorMetricIntent = {
22440
22533
  };
22441
22534
 
22442
22535
  declare type SemaphorOptionDependencies = {
22443
- mode?: 'independent' | 'explicit';
22536
+ /** Omitted mode means independent for protocol callers. Dashboard authoring
22537
+ * normalizes omission separately through `resolveDashboardOptionDependencies`. */
22538
+ mode?: SemaphorOptionDependencyMode;
22444
22539
  includeInputIds?: string[];
22445
22540
  excludeInputIds?: string[];
22541
+ /**
22542
+ * Ephemeral browse override: explicit dependencies the viewer asked to
22543
+ * browse without. Only valid in explicit mode, only for ids in
22544
+ * `includeInputIds`, and only honored by the server when that dependency
22545
+ * would otherwise fail with an overridable reason (see
22546
+ * `OVERRIDABLE_OPTION_DEPENDENCY_REASONS`). Never persisted, never applied
22547
+ * to card predicates; it lives in one browse request and its cache identity.
22548
+ */
22549
+ omitInputIds?: string[];
22446
22550
  };
22447
22551
 
22552
+ declare type SemaphorOptionDependencyMode = 'independent' | 'explicit' | 'all_applicable';
22553
+
22554
+ declare type SemaphorOptionDependencyOutcomeReason = 'unrelated' | 'population_required' | 'missing_dependency' | 'missing_relationship' | 'ambiguous_relationship' | 'invalid_metadata' | 'unsupported_dependency' | 'override_not_eligible';
22555
+
22448
22556
  declare type SemaphorOptionPopulation = {
22449
22557
  kind: 'option_source';
22450
22558
  baseSource?: never;
@@ -26185,6 +26293,8 @@ export declare function useTextFilterHook(filterId: string): {
26185
26293
  isSearching: boolean;
26186
26294
  searchError: boolean;
26187
26295
  resultSource: "server" | "both" | "local";
26296
+ dependency: FilterOptionDependencyState;
26297
+ selectionRelevance: OptionSelectionRelevance;
26188
26298
  };
26189
26299
 
26190
26300
  export declare function validateBriefingFormDraft(draft: BriefingFormDraft): BriefingFormValidationResult;
@@ -4004,6 +4004,16 @@ declare type DashboardFilterExcludedCardApplication = {
4004
4004
  cardId: string;
4005
4005
  };
4006
4006
 
4007
+ /**
4008
+ * Persisted policy for which peer selections narrow a filter's option list.
4009
+ * Omitted means All applicable for dashboards; see
4010
+ * `resolveDashboardOptionDependencies`.
4011
+ */
4012
+ declare type DashboardFilterOptionDependencies = SemaphorOptionDependencies;
4013
+
4014
+ /** Persisted population that fixes relevance for fact-bridged cascades. */
4015
+ declare type DashboardFilterOptionPopulation = SemaphorOptionPopulation;
4016
+
4007
4017
  /** Persisted label/value option definition for a mapped dashboard filter. */
4008
4018
  declare type DashboardFilterOptionSource = SemaphorInputOptionSource;
4009
4019
 
@@ -4575,6 +4585,8 @@ declare type EmbeddedFilterDashboardInput = FilterDashboardInputBase & {
4575
4585
  filter: TFilter;
4576
4586
  filterReference?: never;
4577
4587
  optionSource?: DashboardFilterOptionSource;
4588
+ optionDependencies?: DashboardFilterOptionDependencies;
4589
+ optionPopulation?: DashboardFilterOptionPopulation;
4578
4590
  application?: DashboardFilterApplication;
4579
4591
  };
4580
4592
 
@@ -7139,6 +7151,8 @@ declare type ReferencedFilterDashboardInput = FilterDashboardInputBase & {
7139
7151
  filterId: string;
7140
7152
  };
7141
7153
  optionSource?: DashboardFilterOptionSource;
7154
+ optionDependencies?: DashboardFilterOptionDependencies;
7155
+ optionPopulation?: DashboardFilterOptionPopulation;
7142
7156
  application?: DashboardFilterApplication;
7143
7157
  };
7144
7158
 
@@ -7234,6 +7248,38 @@ declare type SemaphorInputOptionSource = {
7234
7248
  disambiguationFields?: SemaphorFieldRef[];
7235
7249
  };
7236
7250
 
7251
+ declare type SemaphorOptionDependencies = {
7252
+ /** Omitted mode means independent for protocol callers. Dashboard authoring
7253
+ * normalizes omission separately through `resolveDashboardOptionDependencies`. */
7254
+ mode?: SemaphorOptionDependencyMode;
7255
+ includeInputIds?: string[];
7256
+ excludeInputIds?: string[];
7257
+ /**
7258
+ * Ephemeral browse override: explicit dependencies the viewer asked to
7259
+ * browse without. Only valid in explicit mode, only for ids in
7260
+ * `includeInputIds`, and only honored by the server when that dependency
7261
+ * would otherwise fail with an overridable reason (see
7262
+ * `OVERRIDABLE_OPTION_DEPENDENCY_REASONS`). Never persisted, never applied
7263
+ * to card predicates; it lives in one browse request and its cache identity.
7264
+ */
7265
+ omitInputIds?: string[];
7266
+ };
7267
+
7268
+ declare type SemaphorOptionDependencyMode = 'independent' | 'explicit' | 'all_applicable';
7269
+
7270
+ declare type SemaphorOptionPopulation = {
7271
+ kind: 'option_source';
7272
+ baseSource?: never;
7273
+ } | {
7274
+ kind: 'related_population';
7275
+ baseSource: SemaphorSourceRef;
7276
+ relationshipHint?: SemaphorRelationshipHint;
7277
+ };
7278
+
7279
+ declare type SemaphorRelationshipHint = {
7280
+ relationshipIds?: string[];
7281
+ };
7282
+
7237
7283
  declare type SemaphorScalarValueFormat = {
7238
7284
  type: 'number' | 'currency' | 'percent' | 'percentage' | 'scientific';
7239
7285
  minimumFractionDigits?: number;
@@ -4149,6 +4149,16 @@ export declare type DashboardFilterExcludedCardApplication = {
4149
4149
  cardId: string;
4150
4150
  };
4151
4151
 
4152
+ /**
4153
+ * Persisted policy for which peer selections narrow a filter's option list.
4154
+ * Omitted means All applicable for dashboards; see
4155
+ * `resolveDashboardOptionDependencies`.
4156
+ */
4157
+ declare type DashboardFilterOptionDependencies = SemaphorOptionDependencies;
4158
+
4159
+ /** Persisted population that fixes relevance for fact-bridged cascades. */
4160
+ declare type DashboardFilterOptionPopulation = SemaphorOptionPopulation;
4161
+
4152
4162
  /** Persisted label/value option definition for a mapped dashboard filter. */
4153
4163
  export declare type DashboardFilterOptionSource = SemaphorInputOptionSource;
4154
4164
 
@@ -4936,6 +4946,8 @@ export declare type EmbeddedFilterDashboardInput = FilterDashboardInputBase & {
4936
4946
  filter: TFilter;
4937
4947
  filterReference?: never;
4938
4948
  optionSource?: DashboardFilterOptionSource;
4949
+ optionDependencies?: DashboardFilterOptionDependencies;
4950
+ optionPopulation?: DashboardFilterOptionPopulation;
4939
4951
  application?: DashboardFilterApplication;
4940
4952
  };
4941
4953
 
@@ -5922,6 +5934,8 @@ export declare type NormalizedFilterDashboardInput = FilterDashboardInputBase &
5922
5934
  kind: 'filter';
5923
5935
  filter: TFilter;
5924
5936
  optionSource?: DashboardFilterOptionSource;
5937
+ optionDependencies?: DashboardFilterOptionDependencies;
5938
+ optionPopulation?: DashboardFilterOptionPopulation;
5925
5939
  application?: DashboardFilterApplication;
5926
5940
  definitionOrigin: 'embedded' | 'dashboardFilter';
5927
5941
  };
@@ -7689,6 +7703,8 @@ export declare type ReferencedFilterDashboardInput = FilterDashboardInputBase &
7689
7703
  filterId: string;
7690
7704
  };
7691
7705
  optionSource?: DashboardFilterOptionSource;
7706
+ optionDependencies?: DashboardFilterOptionDependencies;
7707
+ optionPopulation?: DashboardFilterOptionPopulation;
7692
7708
  application?: DashboardFilterApplication;
7693
7709
  };
7694
7710
 
@@ -7986,6 +8002,38 @@ declare type SemaphorInputOptionSource = {
7986
8002
  disambiguationFields?: SemaphorFieldRef[];
7987
8003
  };
7988
8004
 
8005
+ declare type SemaphorOptionDependencies = {
8006
+ /** Omitted mode means independent for protocol callers. Dashboard authoring
8007
+ * normalizes omission separately through `resolveDashboardOptionDependencies`. */
8008
+ mode?: SemaphorOptionDependencyMode;
8009
+ includeInputIds?: string[];
8010
+ excludeInputIds?: string[];
8011
+ /**
8012
+ * Ephemeral browse override: explicit dependencies the viewer asked to
8013
+ * browse without. Only valid in explicit mode, only for ids in
8014
+ * `includeInputIds`, and only honored by the server when that dependency
8015
+ * would otherwise fail with an overridable reason (see
8016
+ * `OVERRIDABLE_OPTION_DEPENDENCY_REASONS`). Never persisted, never applied
8017
+ * to card predicates; it lives in one browse request and its cache identity.
8018
+ */
8019
+ omitInputIds?: string[];
8020
+ };
8021
+
8022
+ declare type SemaphorOptionDependencyMode = 'independent' | 'explicit' | 'all_applicable';
8023
+
8024
+ declare type SemaphorOptionPopulation = {
8025
+ kind: 'option_source';
8026
+ baseSource?: never;
8027
+ } | {
8028
+ kind: 'related_population';
8029
+ baseSource: SemaphorSourceRef;
8030
+ relationshipHint?: SemaphorRelationshipHint;
8031
+ };
8032
+
8033
+ declare type SemaphorRelationshipHint = {
8034
+ relationshipIds?: string[];
8035
+ };
8036
+
7989
8037
  declare type SemaphorScalarValueFormat = {
7990
8038
  type: 'number' | 'currency' | 'percent' | 'percentage' | 'scientific';
7991
8039
  minimumFractionDigits?: number;
@@ -4664,6 +4664,16 @@ export declare type DashboardFilterExcludedCardApplication = {
4664
4664
  cardId: string;
4665
4665
  };
4666
4666
 
4667
+ /**
4668
+ * Persisted policy for which peer selections narrow a filter's option list.
4669
+ * Omitted means All applicable for dashboards; see
4670
+ * `resolveDashboardOptionDependencies`.
4671
+ */
4672
+ declare type DashboardFilterOptionDependencies = SemaphorOptionDependencies;
4673
+
4674
+ /** Persisted population that fixes relevance for fact-bridged cascades. */
4675
+ declare type DashboardFilterOptionPopulation = SemaphorOptionPopulation;
4676
+
4667
4677
  /** Persisted label/value option definition for a mapped dashboard filter. */
4668
4678
  export declare type DashboardFilterOptionSource = SemaphorInputOptionSource;
4669
4679
 
@@ -5513,6 +5523,8 @@ export declare type EmbeddedFilterDashboardInput = FilterDashboardInputBase & {
5513
5523
  filter: TFilter;
5514
5524
  filterReference?: never;
5515
5525
  optionSource?: DashboardFilterOptionSource;
5526
+ optionDependencies?: DashboardFilterOptionDependencies;
5527
+ optionPopulation?: DashboardFilterOptionPopulation;
5516
5528
  application?: DashboardFilterApplication;
5517
5529
  };
5518
5530
 
@@ -6592,6 +6604,8 @@ export declare type NormalizedFilterDashboardInput = FilterDashboardInputBase &
6592
6604
  kind: 'filter';
6593
6605
  filter: TFilter;
6594
6606
  optionSource?: DashboardFilterOptionSource;
6607
+ optionDependencies?: DashboardFilterOptionDependencies;
6608
+ optionPopulation?: DashboardFilterOptionPopulation;
6595
6609
  application?: DashboardFilterApplication;
6596
6610
  definitionOrigin: 'embedded' | 'dashboardFilter';
6597
6611
  };
@@ -8497,6 +8511,8 @@ export declare type ReferencedFilterDashboardInput = FilterDashboardInputBase &
8497
8511
  filterId: string;
8498
8512
  };
8499
8513
  optionSource?: DashboardFilterOptionSource;
8514
+ optionDependencies?: DashboardFilterOptionDependencies;
8515
+ optionPopulation?: DashboardFilterOptionPopulation;
8500
8516
  application?: DashboardFilterApplication;
8501
8517
  };
8502
8518
 
@@ -8847,6 +8863,34 @@ declare type SemaphorInputOptionSource = {
8847
8863
  disambiguationFields?: SemaphorFieldRef[];
8848
8864
  };
8849
8865
 
8866
+ declare type SemaphorOptionDependencies = {
8867
+ /** Omitted mode means independent for protocol callers. Dashboard authoring
8868
+ * normalizes omission separately through `resolveDashboardOptionDependencies`. */
8869
+ mode?: SemaphorOptionDependencyMode;
8870
+ includeInputIds?: string[];
8871
+ excludeInputIds?: string[];
8872
+ /**
8873
+ * Ephemeral browse override: explicit dependencies the viewer asked to
8874
+ * browse without. Only valid in explicit mode, only for ids in
8875
+ * `includeInputIds`, and only honored by the server when that dependency
8876
+ * would otherwise fail with an overridable reason (see
8877
+ * `OVERRIDABLE_OPTION_DEPENDENCY_REASONS`). Never persisted, never applied
8878
+ * to card predicates; it lives in one browse request and its cache identity.
8879
+ */
8880
+ omitInputIds?: string[];
8881
+ };
8882
+
8883
+ declare type SemaphorOptionDependencyMode = 'independent' | 'explicit' | 'all_applicable';
8884
+
8885
+ declare type SemaphorOptionPopulation = {
8886
+ kind: 'option_source';
8887
+ baseSource?: never;
8888
+ } | {
8889
+ kind: 'related_population';
8890
+ baseSource: SemaphorSourceRef;
8891
+ relationshipHint?: SemaphorRelationshipHint;
8892
+ };
8893
+
8850
8894
  declare type SemaphorPivotResultColumnIdentity = {
8851
8895
  metricId: string;
8852
8896
  /** Collision-safe identity for this configured metric instance. */
@@ -8871,6 +8915,10 @@ declare type SemaphorPivotResultMember = {
8871
8915
  /** Stable canonical scalar transported for one physical pivot member. */
8872
8916
  declare type SemaphorPivotValue = string | null;
8873
8917
 
8918
+ declare type SemaphorRelationshipHint = {
8919
+ relationshipIds?: string[];
8920
+ };
8921
+
8874
8922
  declare type SemaphorResultColumn = {
8875
8923
  /**
8876
8924
  * Stable row accessor for this result. Consumers should read values with
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.495",
8
+ "version": "0.1.496",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1 +0,0 @@
1
- "use strict";var le=Object.defineProperty;var ce=(e,t,n)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>ce(e,typeof t!="symbol"?t+"":t,n);const p=require("./validators-CueUwVE4.cjs");require("./matrix-operation-contract-CbavkrJj.cjs");const R=require("./field-aggregations-U54X9_Rt.cjs"),q=require("./matrix-analytical-definition-B5oWAePu.cjs"),N=require("./stable-serialize-jqCpyZvd.cjs"),J=(e,t)=>{const n={};if(e===null||t===null)return t;const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of r){if(!(i in e)&&i in t){n[i]=t[i];continue}if(i in e&&!(i in t)){n[i]=void 0;continue}const a=e[i],d=t[i];if(!C(a,d))if(Array.isArray(a)&&Array.isArray(d))n[i]=d;else if(j(a)&&j(d)){const o=J(a,d);Object.keys(o).length>0&&(n[i]=o)}else n[i]=d}return n},C=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((i,a)=>C(i,t[a]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>C(e[i],t[i]))}return!1},j=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),A=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>A(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=A(e[n]));return t},H=/\[\[\s*param\.([A-Za-z0-9_.-]+)\s*\]\]/g,V=/\bparam\s*\(\s*(['"])([^'"]+)\1/g;function ue(e){const t=[];let n=0;for(;n<e.length;){const r=e.indexOf("{{",n),i=e.indexOf("{%",n);let a=-1,d="";if(r===-1?(a=i,d="%}"):i===-1||r<i?(a=r,d="}}"):(a=i,d="%}"),a===-1)break;const o=e.indexOf(d,a+2);if(o===-1){n=a+2;continue}t.push(e.slice(a+2,o)),n=o+2}return t}function O(e){var r,i;if(!e)return[];const t=new Set;let n;for(H.lastIndex=0;(n=H.exec(e))!==null;){const a=(r=n[1])==null?void 0:r.trim();a&&t.add(a)}for(const a of ue(e))for(V.lastIndex=0;(n=V.exec(a))!==null;){const d=(i=n[2])==null?void 0:i.trim();d&&t.add(d)}return Array.from(t)}function fe(e){const t=new Set,n=new Map;for(const r of e.controlBindings||[])t.add(r.controlId),r.target==="sql_param"&&n.set(r.paramId,r.controlId);for(const r of O(e.sql))t.add(n.get(r)??r);return Array.from(t)}function X(e){const t=new Map,n=new Map;for(const r of e.controlBindings||[])r.target==="sql_param"&&n.set(r.paramId,r.controlId);for(const r of O(e.sql))t.set(r,{paramId:r,controlId:n.get(r)??r});return Array.from(t.values())}function me(e,t){var i;const n=(i=e.controlBindings)==null?void 0:i.map(a=>({...a,controlId:t.get(a.controlId)??a.controlId})),r=X(e).flatMap(({paramId:a,controlId:d})=>{var l;const o=t.get(d);return!o||o===d||(l=e.controlBindings)!=null&&l.some(s=>s.target==="sql_param"&&s.paramId===a)?[]:[{target:"sql_param",paramId:a,controlId:o}]});return r.length?[...n??[],...r]:n}function Q(e,t){var i,a;const n=e.source==="dashboardInputAlias"?((i=t.inputAliases)==null?void 0:i[e.variableName])??e:e,r=e.source==="dashboardInputAlias"&&n!==e?{...n,export:e.export??"label"}:n;return r.source==="dashboardInput"?{...r,inputId:((a=t.inputIds)==null?void 0:a[r.inputId])??r.inputId}:r}function pe(e,t){var i;const n={};for(const a of["cardIds","sheetIds","inputIds","controlIds","filterIds"]){const d={...t[a]};for(const[o,l]of Object.entries((e==null?void 0:e[a])??{}))d[o]=((i=t[a])==null?void 0:i[l])??l;Object.keys(d).length&&(n[a]=d)}const r={...t.inputAliases};for(const[a,d]of Object.entries((e==null?void 0:e.inputAliases)??{}))r[a]=Q(d,t);return Object.keys(r).length&&(n.inputAliases=r),n}function ge(e,t){var i,a,d,o;const n=A(e);n.controlBindings=me(e,new Map(Object.entries(t.controlIds??{})));for(const l of n.controls??[])l.id=((i=t.controlIds)==null?void 0:i[l.id])??l.id;for(const l of n.inlineFilters??[])l.id=((a=t.filterIds)==null?void 0:a[l.id])??l.id;const r=l=>{var m,f,u;if(!l||typeof l!="object")return;if(Array.isArray(l)){l.forEach(r);return}const s=l;if(s.type==="variable"&&s.ref&&typeof s.ref=="object"){const g=s.ref;s.ref=g.source==="input"?{...g,inputId:((m=t.inputIds)==null?void 0:m[g.inputId])??g.inputId}:Q(g,t)}if(typeof s.entityId=="string"){const g=s.entityId;s.fieldScope==="card"&&(s.entityId=((f=t.cardIds)==null?void 0:f[g])??g),s.fieldScope==="sheet"&&(s.entityId=((u=t.sheetIds)==null?void 0:u[g])??g)}for(const[g,T]of Object.entries(s))g!=="linkedReferenceOverrides"&&r(T)};r(n);for(const l of Object.values(((d=n.customCardPreferences)==null?void 0:d.dataInputCardIds)??{}))l.cardId=((o=t.cardIds)==null?void 0:o[l.cardId])??l.cardId;return n}function $(e){return(e==null?void 0:e.trim())||void 0}function W(e){return e.split(".").at(-1)||e}function K(e,t){var l,s;const n=$(t);if(!n)return;const r=W(n),i=$((l=e.fieldMeta)==null?void 0:l.name);if(i&&i!==n&&i!==r)return;const a=$((s=e.fieldMeta)==null?void 0:s.qualifiedFieldName);if(a&&W(a)!==r)return;const d=n.includes(".")?n:void 0,o=a!=null&&a.includes(".")?a:void 0;if(!(d&&o&&d!==o))return{leafName:r,...d||o?{qualifiedFieldName:d||o}:{}}}function U(e,t){return K(e,t)||K({},t)}function Y({source:e,sourceFieldName:t,target:n,targetFieldName:r}){const i=U(e,t),a=U(n,r);return!i||!a||i.leafName!==a.leafName?!1:a.qualifiedFieldName?i.qualifiedFieldName===a.qualifiedFieldName:!0}function w(e,t){var i,a;const n=he(e);if(n)return n;const r=(a=(i=e==null?void 0:e.fieldMeta)==null?void 0:i.nativeDataType)==null?void 0:a.trim();if(z(e==null?void 0:e.fieldMeta,t)&&r&&r!=="date"&&r!=="datetime")return r}function he(e){var n;const t=(n=e==null?void 0:e.nativeDataType)==null?void 0:n.trim();return t&&t!=="date"&&t!=="datetime"?t:void 0}function z(e,t){var d,o;const n=t.trim();if(!n)return!1;const r=n.split(".").at(-1),i=(d=e==null?void 0:e.qualifiedFieldName)==null?void 0:d.trim();if(i&&!(i===n||!i.includes(".")&&i===r))return!1;const a=(o=e==null?void 0:e.name)==null?void 0:o.trim();return a&&a!==n&&a!==r?!1:!!(i||a)}function be({fieldName:e,definition:t,value:n}){if((t==null?void 0:t.column)===e){const r=w(t,e);if(r)return r}return(n==null?void 0:n.name)===e?w(n,e):void 0}function Z({definition:e,value:t,sourceValue:n=t}){const r=e&&Y({source:e,sourceFieldName:e.column,target:t,targetFieldName:t.name})?e:void 0,i=n&&Y({source:n,sourceFieldName:n.name,target:t,targetFieldName:t.name})?n:void 0,a=(r?w(r,r.column):void 0)||(i?w(i,i.name):void 0);return ee({carrier:t,nativeDataType:a,projectNestedNativeDataType:z(t.fieldMeta,t.name)})}function ye({filterDefinitions:e,filterValues:t}){if(!(e!=null&&e.length)||!t.length)return t;const n=new Map(e.map(a=>[a.id,a]));let r=!1;const i=t.map(a=>{if(typeof a.name!="string"||!a.name.trim())return a;const d=n.get(a.filterId);if(!d)return a;const o=Z({definition:d,value:a});return r||(r=o!==a),o});return r?i:t}function Ie(e){const t=be({fieldName:e.column,definition:e});return ee({carrier:e,nativeDataType:t,projectNestedNativeDataType:z(e.fieldMeta,e.column)})}function ee({carrier:e,nativeDataType:t,projectNestedNativeDataType:n}){var s;const r=(s=e.fieldMeta)==null?void 0:s.nativeDataType;if(t){if(e.nativeDataType===t&&(!e.fieldMeta||(n?r===t:!r)))return e;const{nativeDataType:m,...f}=e.fieldMeta||{};return{...e,nativeDataType:t,...e.fieldMeta?{fieldMeta:n?{...e.fieldMeta,nativeDataType:t}:f}:{}}}if(e.nativeDataType===void 0&&r===void 0)return e;const{nativeDataType:i,fieldMeta:a,...d}=e,{nativeDataType:o,...l}=a||{};return{...d,...a?{fieldMeta:l}:{}}}function G(e){const t=new Set;for(const n of[e.name,e.sourceField]){if(!n)continue;const r=p.normalizeAnalyticsCatalogName(n);if(!r)continue;t.add(r);const i=r.split("."),a=i[i.length-1];a&&t.add(a)}return t}function te(e,t){const n=p.normalizeAnalyticsCatalogDataType(e),r=p.normalizeAnalyticsCatalogDataType(t);return n==="unknown"||r==="unknown"?!1:(n==="date"||n==="datetime")&&(r==="date"||r==="datetime")?!0:n===r}function ve(e,t){return p.semaphorSourcesReferToSameDataset(e.field.source,t.field.source)&&p.normalizeAnalyticsCatalogName(e.field.name)===p.normalizeAnalyticsCatalogName(t.field.name)&&p.normalizeAnalyticsCatalogName(e.field.sourceField||e.field.name)===p.normalizeAnalyticsCatalogName(t.field.sourceField||t.field.name)}function ne(e,t){if(e.kind!=="field")return!1;const n=G(t),r=G(e.field);return te(t.dataType,e.field.dataType)&&[...r].some(i=>n.has(i))}function Fe(e){const t=e.candidates.filter(n=>ne(n,e.logicalValueField));return t.length===1?{status:"matched",target:t[0]}:t.length>1?{status:"ambiguous"}:{status:"notApplicable"}}function Te(e){const t=[];for(const n of e.acceptedTargets)!te(e.logicalValueField.dataType,n.field.dataType)||t.some(r=>ve(r,n))||t.push(n);return t.length===1?{status:"matched",target:t[0]}:t.length>1?{status:"ambiguous"}:{status:"notApplicable"}}const _e=/\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i,Se=/\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i,De=/\bwhere\b/i;function re(e){return e!=null&&e.trim()?_e.test(e)||Se.test(e):!1}function Ne(e){return!(e!=null&&e.trim())||re(e)?null:De.test(e)?{helper:"{{ filters | and }}",description:"For queries with an existing WHERE clause."}:{helper:"{{ filters | where }}",description:"For queries without a WHERE clause."}}function ke(e){return(e.field.sourceField||e.field.name).trim()||void 0}function Ae(e){if(e.inventory.kind!=="sql"||e.target.kind!=="field")return{status:"ineligible"};const t=R.findDashboardSqlPinnedCatalogSource(e.inventory,e.target.field.source),n=ke(e.target);if(!t||!n)return{status:"ineligible"};if(t.executionTable){const d=[t.executionTable.databaseName,t.executionTable.schemaName,t.executionTable.tableName,n].filter(Boolean).join(".");return{status:"eligible",source:t.source,executionIdentifier:d}}if(e.inventory.pinnedCatalogSources.length!==1)return{status:"ineligible"};const r=p.normalizeAnalyticsCatalogName(n),i=(e.candidateTargets||[]).filter(d=>p.normalizeAnalyticsCatalogName(d.field.sourceField||d.field.name)===r),a=[];for(const d of i)a.some(o=>p.semaphorSourcesReferToSameDataset(o,d.field.source))||a.push(d.field.source);return a.length>1?{status:"ineligible"}:{status:"eligible",source:t.source,executionIdentifier:n}}class ie extends Error{constructor(n){super(n.map(r=>r.message).join(" "));L(this,"issues");this.name="DashboardFilterMappingContractError",this.issues=n}}const we={string:!0,number:!0,boolean:!0,date:!0,datetime:!0};function F(e){return typeof e=="string"&&e.trim().length>0}function y(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function k(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function xe(e){if(!y(e))return!1;switch(e.kind){case"allSheets":return e.sheetKinds===void 0||k(e.sheetKinds)&&e.sheetKinds.every(t=>t==="dashboard"||t==="document");case"sheets":return k(e.sheetIds);case"cards":return k(e.cardIds);case"documentSections":return F(e.sheetId)&&k(e.sectionIds);default:return!1}}function $e(e){return e==="shared"||e==="perSheet"||e==="perCard"||e==="perDocumentSection"}function Re(e){return y(e)?F(e.id)&&F(e.column)&&F(e.dataType):!1}function Ce(e,t,n,r){var o;if(!y(t)){r.push({code:"invalid_option_source",path:n,message:`${n} must be a semantic or physical option source.`,inputId:e});return}const i=t.source,a=[["labelField",t.labelField],["valueField",t.valueField],["searchField",t.searchField]];if(!y(i)||i.kind!=="semantic"&&i.kind!=="physical"||!p.hasCompleteSemaphorSourceIdentity(i)||!y(t.labelField)||!y(t.valueField)||t.searchField!==void 0&&!y(t.searchField)||t.disambiguationFields!==void 0&&(!Array.isArray(t.disambiguationFields)||!t.disambiguationFields.every(y))){r.push({code:"invalid_option_source",path:n,message:`${n} must contain a valid semantic or physical source and field references.`,inputId:e});return}for(const[l,s]of a)s!==void 0&&y(s)&&(!F(s.name)||s.source!==void 0&&!p.semaphorSourcesReferToSameDataset(s.source,i))&&r.push({code:"invalid_option_source",path:`${n}.${l}`,message:`${n}.${l} must be a named field belonging to the declared option source.`,inputId:e});for(const[l,s]of((o=t.disambiguationFields)==null?void 0:o.entries())||[])(!y(s)||!F(s.name)||s.source!==void 0&&!p.semaphorSourcesReferToSameDataset(s.source,i))&&r.push({code:"invalid_option_source",path:`${n}.disambiguationFields[${l}]`,message:`${n}.disambiguationFields[${l}] must be a named field belonging to the declared option source.`,inputId:e});const d=t.valueField;["string","number","boolean","date","datetime"].includes(String(d.dataType))||r.push({code:"invalid_option_source",path:`${n}.valueField.dataType`,message:`${n}.valueField.dataType must be a known option-value datatype.`,inputId:e})}function Ee(e,t,n,r,i,a){var s;if(F(t.bindingId)||i.push({code:"invalid_binding_id",path:`${n}.bindingId`,message:`${n}.bindingId must be an opaque non-empty id.`,inputId:e,cardId:t.cardId}),((s=t.target)==null?void 0:s.kind)!=="field"){i.push({code:"unsupported_target",path:`${n}.target`,message:`${n}.target must be one direct field target.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId});return}const d=t.target.field;if(!F(d==null?void 0:d.name)||!d.source||d.source.kind!=="semantic"&&d.source.kind!=="physical"||!p.hasCompleteSemaphorSourceIdentity(d.source)){i.push({code:"invalid_target_field",path:`${n}.target.field`,message:`${n}.target.field must have a name and a source-qualified semantic or physical identity.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId});return}if(Object.prototype.hasOwnProperty.call(we,d.dataType)||i.push({code:"unknown_target_data_type",path:`${n}.target.field.dataType`,message:`${n}.target.field.dataType must be known.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId}),d.sourceField!==void 0&&!F(d.sourceField)&&i.push({code:"invalid_target_field",path:`${n}.target.field.sourceField`,message:`${n}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId}),!a)return;const o=r.get(t.cardId);if(!o){i.push({code:"unknown_card",path:`${n}.cardId`,message:`${n}.cardId '${t.cardId}' does not exist.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId});return}const l=R.buildDashboardCardSourceIndex(o);(l.kind==="unconfigured"||!R.dashboardCardFilterSourceInventoryContains(l,d.source))&&i.push({code:"unavailable_card_source",path:`${n}.target.field.source`,message:`${n}.target field source is not declared by card '${o.id}'.`,inputId:e,cardId:o.id,bindingId:t.bindingId})}function Me(e,t,n,r,i,a){if(t===void 0)return;if(!y(t)||t.kind!=="cardMappings"||!Array.isArray(t.cards)){i.push({code:"invalid_application",path:n,message:`${n} must be a cardMappings application with a cards array.`,inputId:e});return}const d=new Set;t.cards.forEach((o,l)=>{const s=`${n}.cards[${l}]`;if(!F(o==null?void 0:o.cardId)){i.push({code:"unknown_card",path:`${s}.cardId`,message:`${s}.cardId is required.`,inputId:e});return}if(d.has(o.cardId)){i.push({code:"duplicate_card_application",path:`${s}.cardId`,message:`${n} contains more than one entry for card '${o.cardId}'.`,inputId:e,cardId:o.cardId});return}if(d.add(o.cardId),a&&!r.has(o.cardId)){i.push({code:"unknown_card",path:`${s}.cardId`,message:`${s}.cardId '${o.cardId}' does not exist.`,inputId:e,cardId:o.cardId});return}o.kind==="bound"?Ee(e,o,s,r,i,a):o.kind!=="excluded"&&i.push({code:"invalid_application",path:s,message:`${s}.kind must be 'bound' or 'excluded'.`,inputId:e,cardId:o.cardId})})}function ae({inputs:e,dashboardFilters:t,cards:n=[],validateCardTargets:r=!1}){const i=[],a=new Map((t||[]).map(s=>[s.id,s])),d=new Map(r?n.map(s=>[s.id,s]):[]),o=[],l=new Map;return e!=null&&!Array.isArray(e)?(i.push({code:"invalid_input",path:"dashboard.inputs",message:"dashboard.inputs must be an array when present."}),{ok:!1,inputs:o,issues:i}):((Array.isArray(e)?e:[]).forEach((s,m)=>{const f=`dashboard.inputs[${m}]`;if(!y(s)||s.kind!=="filter"&&s.kind!=="control"||!F(s.id)||!F(s.label)||!F(s.variableName)||!xe(s.scope)||!$e(s.runtimeScope)){i.push({code:"invalid_input",path:f,message:`${f} must be a complete filter or control Dashboard Input envelope.`,inputId:y(s)&&typeof s.id=="string"?s.id:void 0});return}if(s.kind==="control"&&!y(s.control)){i.push({code:"invalid_input",path:`${f}.control`,message:`${f}.control must be a control definition.`,inputId:s.id});return}const u=s;if(u.kind==="control"){o.push(u);return}const g=u.filter,T=u.filterReference,S=g!==void 0,D=!!T;if(S&&D){i.push({code:"both_filter_definitions",path:f,message:`${f} must contain either filter or filterReference, not both.`,inputId:u.id});return}if(!S&&!D){i.push({code:"missing_filter_definition",path:f,message:`${f} must contain filter or filterReference.`,inputId:u.id});return}if(S&&!Re(g)){i.push({code:"invalid_input",path:`${f}.filter`,message:`${f}.filter must be a complete dashboard filter definition.`,inputId:u.id});return}let I,c;if(S)I=g,c="embedded";else{if((T==null?void 0:T.kind)!=="dashboardFilter"){i.push({code:"invalid_filter_reference",path:`${f}.filterReference.kind`,message:`${f}.filterReference.kind must be 'dashboardFilter'.`,inputId:u.id});return}const x=typeof(T==null?void 0:T.filterId)=="string"?T.filterId:void 0;if(I=x?a.get(x):void 0,c="dashboardFilter",!I){i.push({code:"orphaned_filter_reference",path:`${f}.filterReference.filterId`,message:`${f}.filterReference cannot resolve dashboard filter '${x||""}'.`,inputId:u.id});return}if(I.kind==="global-date"){i.push({code:"global_date_reference",path:`${f}.filterReference`,message:`${f}.filterReference cannot reference the Global Date filter.`,inputId:u.id});return}const B=l.get(I.id);if(B){i.push({code:"duplicate_filter_reference",path:`${f}.filterReference.filterId`,message:`${f}.filterReference duplicates dashboard filter '${I.id}' already owned by Dashboard Input '${B}'.`,inputId:u.id});return}l.set(I.id,u.id)}if(!I)return;if(u.forceSelection!==void 0&&typeof u.forceSelection!="boolean"&&i.push({code:"invalid_input",path:`${f}.forceSelection`,message:`${f}.forceSelection must be a boolean.`,inputId:u.id}),u.optionSource!==void 0&&Ce(u.id,u.optionSource,`${f}.optionSource`,i),u.application&&I.kind==="global-date"){i.push({code:"global_date_reference",path:`${f}.application`,message:`${f}.application cannot map the Global Date filter.`,inputId:u.id});return}u.application&&u.scope.kind!=="allSheets"&&u.scope.kind!=="sheets"&&i.push({code:"unsupported_mapped_scope",path:`${f}.scope`,message:`${f}.scope must be allSheets or sheets when cardMappings are present.`,inputId:u.id}),Me(u.id,u.application,`${f}.application`,d,i,r);const{filter:_,filterReference:b,compatibility:v,...h}=u;o.push({...h,filter:I,...S&&v?{compatibility:v}:{},...u.optionSource?{optionSource:u.optionSource}:{},definitionOrigin:c})}),i.length?{ok:!1,inputs:o,issues:i}:{ok:!0,inputs:o})}function Oe(e){const t=ae(e);if(!t.ok)throw new ie(t.issues);return t.inputs}function ze(e=()=>globalThis.crypto.randomUUID()){return e()}const Pe={date:new Set(["between","not between","=","!=",">",">=","<","<=","is null","is not null"]),number:new Set(["between","not between","=","!=",">",">=","<","<=","in","not in","is null","is not null"]),string:new Set(["=","!=","in","not in","like","not like","is null","is not null"]),boolean:new Set(["=","!=","in","not in","is null","is not null"])};function oe(e){const t=p.normalizeAnalyticsCatalogDataType(e);return t==="number"||t==="boolean"?t:t==="date"||t==="datetime"?"date":"string"}function Be(e,t){return typeof t!="string"?!1:Pe[oe(e)].has(t)}function E(e,t,n=r=>{var i;return((i=r.derivedField)==null?void 0:i.dataType)??r.dataType}){return t==="sql_param"||t==="presentation_currency"?[]:t==="config_metric_selector"||t==="config_aggregation"?e.measures.flatMap(r=>r.kind==="aggregate"?[{id:r.id,kind:"measure",measure:r}]:[]):["rows","columns"].flatMap(r=>e[r].filter(i=>t!=="config_grain"||p.isAnalyticsDateLikeDataType(n(i.field))).map(i=>({id:i.id,kind:"level",axis:r,level:i})))}function Le(e,t,n,r){const i=[...e.rows,...e.columns].find(s=>s.id===t);if(!i)throw new Error("Matrix level is no longer present.");if(r===t)return{kind:"structure",rows:e.rows,columns:e.columns};const a=e.rows.filter(s=>s.id!==t),d=e.columns.filter(s=>s.id!==t),o=n==="rows"?a:d,l=r?o.findIndex(s=>s.id===r):-1;return o.splice(l<0?o.length:l,0,i),{kind:"structure",rows:a,columns:d}}function P(e,t){const n=q.getMatrixAnalyticalDefinition(e),r=q.getMatrixAnalyticalDefinition(t),i=(o,l)=>N.stableSerialize(n[o][l])===N.stableSerialize(r[o][l]),a=o=>{const l=n.rankings.find(m=>m.id===o),s=r.rankings.find(m=>m.id===o);return!!l&&!!s&&N.stableSerialize(l)===N.stableSerialize(s)};return(o,l,s=!1)=>l.length<=t[o].length&&l.every((m,f)=>{var u;return(m.member.kind==="value"||s&&a(m.member.rankingId))&&m.levelId===((u=t[o][f])==null?void 0:u.id)&&i(o,f)})}function M(e,t,n,r){if(!n)return n;const i=P(e,t),a=new Set(t.measures.map(d=>d.id));return{...n,rules:n.rules.filter(d=>{const o=d.target.matrix,l=!o||(o.levelId===void 0||t[o.axis].some(m=>m.id===o.levelId))&&(o.oppositePath===void 0||i(o.axis==="rows"?"columns":"rows",o.oppositePath,!0)),{validationRefs:s}=p.conditionalRuleMeasureRefs(d);return l&&s.every(m=>a.has(m))?!0:(r.push({kind:"conditional_format",id:d.id,message:"Removed a conditional rule whose measure, level or member path changed."}),!1)})}}function se(e,t,n=!1){const r={...t},i=[],a=P(e,r),d=new Set(r.measures.map(l=>l.id)),o=(l,s,m)=>i.push({kind:l,id:s,message:m});return r.sorts=r.sorts.filter(l=>{const s=r[l.axis].findIndex(f=>f.id===l.levelId),m=s>=0&&(l.scope.kind==="level"||l.scope.parent.length===s&&a(l.axis,l.scope.parent))&&(l.target.kind==="member"||d.has(l.target.measureId)&&a(l.axis==="rows"?"columns":"rows",l.target.oppositePath));return m||o("sort",l.levelId,"Removed a sort whose level, measure or member path changed."),m}),r.rankings=r.rankings.filter(l=>{const s=r[l.axis].some(m=>m.id===l.levelId)&&d.has(l.measureId)&&a(l.axis==="rows"?"columns":"rows",l.oppositePath);return s||o("ranking",l.id,"Removed a ranking whose level, measure or member path changed."),s}),{spec:(n?p.matrixAuthoringSpecSchema:p.matrixSpecSchema).parse(r),notices:i}}function qe(e,t,n=[],r,i=!1){const a=[];if(t.kind!=="structure"){const c=t.kind==="presentation"?{...e,presentation:t.presentation}:t.kind==="defaults"?{...e,defaultView:t.defaultView}:t.kind==="sorts"?{...e,spec:{...e.spec,sorts:t.sorts}}:{...e,spec:{...e.spec,rankings:t.rankings}};return t.kind==="rankings"&&c.presentation.conditionalFormatting&&(c.presentation={...c.presentation,conditionalFormatting:M(e.spec,c.spec,c.presentation.conditionalFormatting,a)}),{config:(i?p.matrixAuthoringConfigSchema:p.matrixConfigSchema).parse(c),notices:a,removedBindings:[],bindings:n}}const d=se(e.spec,{...e.spec,rows:t.rows??e.spec.rows,columns:t.columns??e.spec.columns,measures:t.measures??e.spec.measures},i),o=d.spec;a.push(...d.notices);const l=P(e.spec,o),s=new Set(o.measures.map(c=>c.id)),m=[...o.rows,...o.columns],f=new Set(m.map(c=>c.id)),u=(c,_,b)=>a.push({kind:c,id:_,message:b}),g=[],T=n.flatMap(c=>{if(c.target==="sql_param"||c.target==="presentation_currency")return[c];const _=E(e.spec,c.target,r),b=c.matrixTargetId??(_.length===1?_[0].id:void 0);return E(o,c.target,r).some(h=>h.id===b)?c.matrixTargetId?[c]:(u("binding",c.controlId,"Pinned the control binding to its original Matrix target after a structural change."),[{...c,matrixTargetId:b}]):(u("binding",c.controlId,"Removed a control binding whose original Matrix target is missing, ambiguous or no longer eligible."),g.push(c),[])}),S=(c,_,b)=>Object.fromEntries(Object.entries(c).filter(([v])=>_.has(v)?!0:(u(b,v,`Removed a ${b} override for a removed field.`),!1))),D={...e.presentation,levelLabels:S(e.presentation.levelLabels,f,"label"),measureLabels:S(e.presentation.measureLabels,s,"label"),levelFormats:S(e.presentation.levelFormats,f,"format"),measureFormats:S(e.presentation.measureFormats,s,"format"),totals:{...e.presentation.totals}};D.levelFormats=Object.fromEntries(Object.entries(D.levelFormats).filter(([c,_])=>{const b=m.find(h=>h.id===c),v=[...e.spec.rows,...e.spec.columns].find(h=>h.id===c);return _.type!=="temporal_bucket"||b.grain&&b.grain===(v==null?void 0:v.grain)?!0:(u("format",c,"Removed a temporal format because its grain changed."),!1)})),D.conditionalFormatting&&(D.conditionalFormatting=M(e.spec,o,D.conditionalFormatting,a));const I={...e.defaultView};for(const c of["rows","columns"]){const _={...e.presentation.totals.rows.levels,...e.presentation.totals.columns.levels};for(const h of Object.keys(e.presentation.totals[c].levels))f.has(h)||u("total",h,"Removed subtotal settings for a removed level.");D.totals[c]={...e.presentation.totals[c],levels:Object.fromEntries(o[c].map(h=>[h.id,_[h.id]??{visible:!0,position:"before"}]))};const b=e.defaultView[c],v=Math.min(b.depth,Math.max(0,o[c].length-1));v!==b.depth&&u("depth",c,`Reduced ${c} expansion depth to fit the hierarchy.`),I[c]={depth:v,overrides:b.overrides.filter(h=>h.path.length<o[c].length&&l(c,h.path)?!0:(u("expansion",c,`Removed a ${c} expansion override whose path changed or became a leaf.`),!1))}}return{config:(i?p.matrixAuthoringConfigSchema:p.matrixConfigSchema).parse({...e,spec:o,presentation:D,defaultView:I}),notices:a,removedBindings:g,bindings:T}}function de(e){return!e.entityName||e.entityName===p.CALCULATED_FIELD_ENTITY_MARKER||e.entityName==="calculated_fields"||e.qualifiedEntityName===p.CALCULATED_FIELD_ENTITY_MARKER||e.qualifiedEntityName==="calculated_fields"?"root":e.qualifiedEntityName||e.entityName}function je(e){return["domain",e.role||"field",de(e),e.name].join("::")}exports.DashboardFilterMappingContractError=ie;exports.applyCardReferenceRemapping=ge;exports.cloneDeep=A;exports.composeCardReferenceRemapping=pe;exports.createDashboardFilterBindingId=ze;exports.dashboardFilterTargetMatchesLogicalValue=ne;exports.dashboardFilterValueTypeForDataType=oe;exports.extractParamControlIdsFromSql=O;exports.extractReferencedControlIds=fe;exports.extractSqlParamReferences=X;exports.getCalculatedFieldNamespace=de;exports.getDashboardFilterSubscriptionHint=Ne;exports.getMatrixBindingTargets=E;exports.getObjectDiff=J;exports.getStableDomainCalculatedFieldId=je;exports.hasDashboardFilterSubscription=re;exports.isDashboardFilterOperationCompatible=Be;exports.materializeFilterDefinitionNativeDataType=Ie;exports.materializeFilterValueNativeDataType=Z;exports.materializeFilterValuesNativeDataType=ye;exports.moveMatrixLevel=Le;exports.normalizeDashboardInputs=ae;exports.reconcileMatrixSpecStructure=se;exports.requireNormalizedDashboardInputs=Oe;exports.resolveDashboardFilterAutomaticTarget=Fe;exports.resolveDashboardFilterInheritedTarget=Te;exports.resolveDashboardSqlFilterTarget=Ae;exports.retainMatrixConditionalFormatting=M;exports.updateMatrixConfig=qe;