react-semaphor 0.1.601 → 0.1.603

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 (123) hide show
  1. package/dist/analytics-protocol/index.js +415 -375
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +8 -8
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{add-to-dashboard-ClhEIFst.js → add-to-dashboard-CFF-wFU-.js} +1 -1
  7. package/dist/chunks/{analytics-base-schemas-DevrgqQb.js → analytics-base-schemas-DsUh5Q3C.js} +14 -12
  8. package/dist/chunks/{assistant-chat-BE0XXzZP.js → assistant-chat-B6hNQI1t.js} +146 -146
  9. package/dist/chunks/{bookmark-impact-DXDAN5AY.js → bookmark-impact-Ba2PLcGp.js} +3 -3
  10. package/dist/chunks/{bookmark-state-BMyB3Tb6.js → bookmark-state-n7AaNzR_.js} +517 -516
  11. package/dist/chunks/{card-filter-builder-CE0-YVN5.js → card-filter-builder-Y22HizVx.js} +474 -474
  12. package/dist/chunks/{comparison-window-caption-Dxj2CHOa.js → comparison-window-caption-Ck2TIbnR.js} +69 -69
  13. package/dist/chunks/{context-BJoEFgNl.js → context-UCQ7sere.js} +1 -1
  14. package/dist/chunks/{dashboard-mJKPFRbb.js → dashboard-BghI99oY.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CntwKyiZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +725 -716
  16. package/dist/chunks/{dashboard-controls-XO089DMg.js → dashboard-controls-CtFXlyjV.js} +53 -53
  17. package/dist/chunks/{dashboard-json-CQRiydUv.js → dashboard-json-DfGBUtCd.js} +5 -5
  18. package/dist/chunks/dates-BnrXF4bb.js +185 -0
  19. package/dist/chunks/{edit-dashboard-visual-f-Dm-BLR.js → edit-dashboard-visual-oxt3x1wb.js} +8081 -8268
  20. package/dist/chunks/{filter-line-CKNMyNTQ.js → filter-line-Cy5YYqRL.js} +27 -27
  21. package/dist/chunks/{filter-reach-copy-B8GGyVuR.js → filter-reach-copy-CE_ZX147.js} +1786 -2214
  22. package/dist/chunks/{filter-value-text-CRtKecI5.js → filter-value-text-fWvSDwkl.js} +11 -11
  23. package/dist/chunks/{index-DoPApnxg.js → index-D5rxbtS4.js} +24 -24
  24. package/dist/chunks/{layout-grid-CiSCZdIr.js → layout-grid-9LndRoLa.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-myf3D3Qx.js → matrix-analytical-definition-CCp48UCw.js} +496 -425
  26. package/dist/chunks/matrix-member-presentation-zNehruXR.js +391 -0
  27. package/dist/chunks/{matrix-operation-contract-C1SuOHLZ.js → matrix-operation-contract-DPBj69D8.js} +518 -514
  28. package/dist/chunks/{metric-comparison-Cm0G893W.js → metric-comparison-B0FR-Q8I.js} +184 -125
  29. package/dist/chunks/{paintbrush-DQIwqlck.js → paintbrush-58FQYY-y.js} +1 -1
  30. package/dist/chunks/{palette-Cun747Rg.js → palette-Be62Tkoa.js} +1 -1
  31. package/dist/chunks/{pivot-result-contract-expectations-C1Dyx8du.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
  32. package/dist/chunks/{pivot-result-identity-CBS-ssEp.js → pivot-result-identity-CAP4--iq.js} +1 -1
  33. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +3778 -0
  34. package/dist/chunks/{report-preferences-dialog-SDZEcG2x.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
  35. package/dist/chunks/{report-runtime-context-BbedQdtc.js → report-runtime-context-c77_KF9v.js} +2 -2
  36. package/dist/chunks/{resolve-dashboard-input-context-DRBS0eRa.js → resolve-dashboard-input-context-Rtl1ffmE.js} +8808 -7291
  37. package/dist/chunks/{save-Dj5bjm7P.js → save-C5A0JnEV.js} +1 -1
  38. package/dist/chunks/{saved-dashboard-context-DWVlJcsa.js → saved-dashboard-context-tcyTU8jm.js} +199 -213
  39. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
  40. package/dist/chunks/{semaphor-ready-indicator-OFOoAY-A.js → semaphor-ready-indicator-FBvunj6S.js} +37894 -35726
  41. package/dist/chunks/{shelf-drop-preview-context-2swWypXu.js → shelf-drop-preview-context-QKStrcK9.js} +54 -54
  42. package/dist/chunks/{stored-dashboard-NtOuEX6a.js → stored-dashboard-CHozcAY9.js} +770 -743
  43. package/dist/chunks/{style-sheet-parts-Qv4UcLAo.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
  44. package/dist/chunks/{table-export-sheet-Do7ZB0_F.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
  45. package/dist/chunks/{token-types-Dy_aXO-U.js → token-types-XbM6QByy.js} +1 -1
  46. package/dist/chunks/{upload-Bq-puSVy.js → upload-H15d7uHK.js} +1 -1
  47. package/dist/chunks/{validators-C7DFk3QK.js → validators-Baf3VIf5.js} +5 -5
  48. package/dist/chunks/{variable-draft-Cy03qnEi.js → variable-draft-C2y8Jp6Z.js} +27 -28
  49. package/dist/dashboard/index.js +2 -2
  50. package/dist/dashboard-authoring/index.js +3392 -2761
  51. package/dist/format-utils/index.js +205 -204
  52. package/dist/index.js +73 -75
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
  57. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  58. package/dist/types/index.js +5 -5
  59. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
  60. package/dist/types/lib/document/document-edits.d.ts +0 -4
  61. package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
  62. package/dist/types/lib/stores/dashboard-store.d.ts +30 -1
  63. package/dist/types/lib/types/common-types.d.ts +0 -2
  64. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  65. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
  66. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  67. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  68. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  69. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  70. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  71. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  72. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  73. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  74. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  75. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  76. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  77. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
  78. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
  79. package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
  80. package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
  81. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  82. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  83. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  84. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  85. package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
  86. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +165 -360
  87. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +23 -2
  88. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
  89. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
  90. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
  91. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  92. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  93. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  94. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  95. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  96. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  97. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  98. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  99. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  100. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  101. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  102. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  103. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +158 -0
  104. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
  105. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +17 -6
  106. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
  107. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
  108. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  109. package/dist/types/shared/format-utils/index.d.ts +1 -0
  110. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  111. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  112. package/dist/types/shared/temporal/index.d.ts +2 -0
  113. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  114. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  115. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  116. package/dist/types/shared/usage-events/details.d.ts +2 -2
  117. package/dist/types/shared/usage-events/envelope.d.ts +2 -2
  118. package/dist/usage-events/index.js +1 -1
  119. package/package.json +3 -2
  120. package/dist/chunks/dates-B-Urp5OD.js +0 -164
  121. package/dist/chunks/matrix-member-presentation-g0c_NpDW.js +0 -258
  122. package/dist/chunks/raw-temporal-value-DN_l-Tss.js +0 -454
  123. package/dist/chunks/selection-filter-compiler-DmAr7yqC.js +0 -131
@@ -46,7 +46,7 @@ export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'co
46
46
  /** Text words the subset can't hold, or a token that isn't one of the card's variables (building a report SPEC §2.4, S-9). */
47
47
  | 'text_invalid'
48
48
  /** A `dashboard.style` change the style owner refuses, with its own code and fix (dashboard style SPEC §4.3). */
49
- | StyleRefusal['code'] | DataVariableProblemCode;
49
+ | StyleRefusal['code'] | DataVariableProblemCode | CalculatedFieldProblemCode;
50
50
  export type ChangeWarningCode =
51
51
  /** In-scope cards the filter doesn't reach. */
52
52
  'filter_not_reaching_cards'
@@ -76,10 +76,31 @@ export type ChangeWarningCode =
76
76
  | 'viewer_settings_affected'
77
77
  /** A period or year comparison where no date window applies to its date: it shows only while one does. */
78
78
  | 'comparison_without_date_window'
79
+ /** A step back that lands inside the date window a fresh viewer gets: it shows no comparison until a viewer picks a range it clears (compare-with CW-D16). */
80
+ | 'comparison_overlaps_date_window'
79
81
  /** A table calculation ordered along a grouping that isn't a date. */
80
82
  | 'transform_order_not_date'
81
83
  /** A text card in a KPI's spot shows as the KPI's info, as in the editor, not as a tab (building a report SPEC §5.1). */
82
- | 'tabs_show_as_kpi_info';
84
+ | 'tabs_show_as_kpi_info'
85
+ /** The same condition on every card a filter on its field reaches on a sheet: one dashboard filter's default (shared conditions SC-D10, SC-D16). */
86
+ | 'repeated_card_condition'
87
+ /** A card condition equal to the default of a dashboard filter that reaches the card: it won't follow the filter (SC-D11). */
88
+ | 'card_condition_repeats_filter_default';
89
+ /**
90
+ * Calculated fields (calculated fields one core, plan "Refusals"): a
91
+ * dashboard field's add, change or removal, and its formula.
92
+ */
93
+ export type CalculatedFieldProblemCode =
94
+ /** The name is a dashboard field already, or a field or calculation of the dataset in the domain. */
95
+ 'calculated_field_name_taken'
96
+ /** The compiler or the connection refuses the formula; the domain's own code. */
97
+ | 'invalid_calculation'
98
+ /** `calculation.update` or `.remove` names no dashboard field. */
99
+ | 'calculated_field_not_found'
100
+ /** `calculation.remove` while a copy remains; `details.usedBy` names the cards and filters. */
101
+ | 'calculated_field_in_use'
102
+ /** A Matrix card names a dashboard field. */
103
+ | 'calculated_field_not_for_matrix';
83
104
  /**
84
105
  * Data variables (spec 4.3): each refusal names the fix in its message; the
85
106
  * one writer's other issues (get, columns, measures) come back as `invalid_change`.
@@ -97,77 +97,6 @@ export declare const contextChangeSchema: z.ZodObject<{
97
97
  } | undefined;
98
98
  }>;
99
99
  export declare const COMPARISON_POLARITIES: readonly ["higher_is_better", "lower_is_better", "neutral"];
100
- /**
101
- * A new calculation, by intent: the domain decides whether it is a fact, a
102
- * dimension or a metric from its formula (SE-D2). One dataset's formula names
103
- * the dataset; one across datasets names its `inputs` as {token}s.
104
- */
105
- export declare const calculationAddSchema: z.ZodObject<{
106
- op: z.ZodLiteral<"calculation.add">;
107
- dataset: z.ZodOptional<z.ZodString>;
108
- name: z.ZodString;
109
- label: z.ZodOptional<z.ZodString>;
110
- description: z.ZodOptional<z.ZodString>;
111
- expression: z.ZodString;
112
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
113
- dataset: z.ZodString;
114
- field: z.ZodString;
115
- aggregate: z.ZodOptional<z.ZodEnum<["SUM", "COUNT", "AVG", "MIN", "MAX", "MEDIAN", "DISTINCT"]>>;
116
- }, "strict", z.ZodTypeAny, {
117
- field: string;
118
- dataset: string;
119
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
120
- }, {
121
- field: string;
122
- dataset: string;
123
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
124
- }>, z.ZodObject<{
125
- metric: z.ZodString;
126
- dataset: z.ZodOptional<z.ZodString>;
127
- }, "strict", z.ZodTypeAny, {
128
- metric: string;
129
- dataset?: string | undefined;
130
- }, {
131
- metric: string;
132
- dataset?: string | undefined;
133
- }>]>>>;
134
- use: z.ZodOptional<z.ZodEnum<["aggregate", "group_or_filter"]>>;
135
- dataType: z.ZodOptional<z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>>;
136
- }, "strict", z.ZodTypeAny, {
137
- name: string;
138
- expression: string;
139
- op: "calculation.add";
140
- label?: string | undefined;
141
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
142
- description?: string | undefined;
143
- inputs?: Record<string, {
144
- field: string;
145
- dataset: string;
146
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
147
- } | {
148
- metric: string;
149
- dataset?: string | undefined;
150
- }> | undefined;
151
- dataset?: string | undefined;
152
- use?: "aggregate" | "group_or_filter" | undefined;
153
- }, {
154
- name: string;
155
- expression: string;
156
- op: "calculation.add";
157
- label?: string | undefined;
158
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
159
- description?: string | undefined;
160
- inputs?: Record<string, {
161
- field: string;
162
- dataset: string;
163
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
164
- } | {
165
- metric: string;
166
- dataset?: string | undefined;
167
- }> | undefined;
168
- dataset?: string | undefined;
169
- use?: "aggregate" | "group_or_filter" | undefined;
170
- }>;
171
100
  /** The changes that edit a domain's metadata, in full (the parsing shape). */
172
101
  export declare const domainEditChangeSchemas: readonly [z.ZodObject<{
173
102
  label: z.ZodOptional<z.ZodString>;
@@ -540,71 +469,6 @@ export declare const domainEditChangeSchemas: readonly [z.ZodObject<{
540
469
  remove?: string[] | undefined;
541
470
  } | undefined;
542
471
  } | undefined;
543
- }>, z.ZodObject<{
544
- op: z.ZodLiteral<"calculation.add">;
545
- dataset: z.ZodOptional<z.ZodString>;
546
- name: z.ZodString;
547
- label: z.ZodOptional<z.ZodString>;
548
- description: z.ZodOptional<z.ZodString>;
549
- expression: z.ZodString;
550
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
551
- dataset: z.ZodString;
552
- field: z.ZodString;
553
- aggregate: z.ZodOptional<z.ZodEnum<["SUM", "COUNT", "AVG", "MIN", "MAX", "MEDIAN", "DISTINCT"]>>;
554
- }, "strict", z.ZodTypeAny, {
555
- field: string;
556
- dataset: string;
557
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
558
- }, {
559
- field: string;
560
- dataset: string;
561
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
562
- }>, z.ZodObject<{
563
- metric: z.ZodString;
564
- dataset: z.ZodOptional<z.ZodString>;
565
- }, "strict", z.ZodTypeAny, {
566
- metric: string;
567
- dataset?: string | undefined;
568
- }, {
569
- metric: string;
570
- dataset?: string | undefined;
571
- }>]>>>;
572
- use: z.ZodOptional<z.ZodEnum<["aggregate", "group_or_filter"]>>;
573
- dataType: z.ZodOptional<z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>>;
574
- }, "strict", z.ZodTypeAny, {
575
- name: string;
576
- expression: string;
577
- op: "calculation.add";
578
- label?: string | undefined;
579
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
580
- description?: string | undefined;
581
- inputs?: Record<string, {
582
- field: string;
583
- dataset: string;
584
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
585
- } | {
586
- metric: string;
587
- dataset?: string | undefined;
588
- }> | undefined;
589
- dataset?: string | undefined;
590
- use?: "aggregate" | "group_or_filter" | undefined;
591
- }, {
592
- name: string;
593
- expression: string;
594
- op: "calculation.add";
595
- label?: string | undefined;
596
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
597
- description?: string | undefined;
598
- inputs?: Record<string, {
599
- field: string;
600
- dataset: string;
601
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
602
- } | {
603
- metric: string;
604
- dataset?: string | undefined;
605
- }> | undefined;
606
- dataset?: string | undefined;
607
- use?: "aggregate" | "group_or_filter" | undefined;
608
472
  }>, z.ZodObject<{
609
473
  op: z.ZodLiteral<"relationship.update">;
610
474
  relationship: z.ZodString;
@@ -1061,71 +925,6 @@ export declare const registeredDomainEditChangeSchemas: readonly [z.ZodObject<{
1061
925
  remove?: string[] | undefined;
1062
926
  } | undefined;
1063
927
  } | undefined;
1064
- }>, z.ZodObject<{
1065
- op: z.ZodLiteral<"calculation.add">;
1066
- dataset: z.ZodOptional<z.ZodString>;
1067
- name: z.ZodString;
1068
- label: z.ZodOptional<z.ZodString>;
1069
- description: z.ZodOptional<z.ZodString>;
1070
- expression: z.ZodString;
1071
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1072
- dataset: z.ZodString;
1073
- field: z.ZodString;
1074
- aggregate: z.ZodOptional<z.ZodEnum<["SUM", "COUNT", "AVG", "MIN", "MAX", "MEDIAN", "DISTINCT"]>>;
1075
- }, "strict", z.ZodTypeAny, {
1076
- field: string;
1077
- dataset: string;
1078
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1079
- }, {
1080
- field: string;
1081
- dataset: string;
1082
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1083
- }>, z.ZodObject<{
1084
- metric: z.ZodString;
1085
- dataset: z.ZodOptional<z.ZodString>;
1086
- }, "strict", z.ZodTypeAny, {
1087
- metric: string;
1088
- dataset?: string | undefined;
1089
- }, {
1090
- metric: string;
1091
- dataset?: string | undefined;
1092
- }>]>>>;
1093
- use: z.ZodOptional<z.ZodEnum<["aggregate", "group_or_filter"]>>;
1094
- dataType: z.ZodOptional<z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>>;
1095
- }, "strict", z.ZodTypeAny, {
1096
- name: string;
1097
- expression: string;
1098
- op: "calculation.add";
1099
- label?: string | undefined;
1100
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
1101
- description?: string | undefined;
1102
- inputs?: Record<string, {
1103
- field: string;
1104
- dataset: string;
1105
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1106
- } | {
1107
- metric: string;
1108
- dataset?: string | undefined;
1109
- }> | undefined;
1110
- dataset?: string | undefined;
1111
- use?: "aggregate" | "group_or_filter" | undefined;
1112
- }, {
1113
- name: string;
1114
- expression: string;
1115
- op: "calculation.add";
1116
- label?: string | undefined;
1117
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
1118
- description?: string | undefined;
1119
- inputs?: Record<string, {
1120
- field: string;
1121
- dataset: string;
1122
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1123
- } | {
1124
- metric: string;
1125
- dataset?: string | undefined;
1126
- }> | undefined;
1127
- dataset?: string | undefined;
1128
- use?: "aggregate" | "group_or_filter" | undefined;
1129
928
  }>, z.ZodObject<{
1130
929
  op: z.ZodLiteral<"relationship.update">;
1131
930
  relationship: z.ZodString;
@@ -1210,6 +1009,7 @@ export declare const registeredDomainEditChangeSchemas: readonly [z.ZodObject<{
1210
1009
  } | undefined;
1211
1010
  isActive?: false | undefined;
1212
1011
  }>];
1012
+ /** A domain proposal's changes as parsed: its own edits and the calculation changes (MC-D3, MC-D7). */
1213
1013
  export declare const domainEditChangeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
1214
1014
  label: z.ZodOptional<z.ZodString>;
1215
1015
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1581,71 +1381,6 @@ export declare const domainEditChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zo
1581
1381
  remove?: string[] | undefined;
1582
1382
  } | undefined;
1583
1383
  } | undefined;
1584
- }>, z.ZodObject<{
1585
- op: z.ZodLiteral<"calculation.add">;
1586
- dataset: z.ZodOptional<z.ZodString>;
1587
- name: z.ZodString;
1588
- label: z.ZodOptional<z.ZodString>;
1589
- description: z.ZodOptional<z.ZodString>;
1590
- expression: z.ZodString;
1591
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1592
- dataset: z.ZodString;
1593
- field: z.ZodString;
1594
- aggregate: z.ZodOptional<z.ZodEnum<["SUM", "COUNT", "AVG", "MIN", "MAX", "MEDIAN", "DISTINCT"]>>;
1595
- }, "strict", z.ZodTypeAny, {
1596
- field: string;
1597
- dataset: string;
1598
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1599
- }, {
1600
- field: string;
1601
- dataset: string;
1602
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1603
- }>, z.ZodObject<{
1604
- metric: z.ZodString;
1605
- dataset: z.ZodOptional<z.ZodString>;
1606
- }, "strict", z.ZodTypeAny, {
1607
- metric: string;
1608
- dataset?: string | undefined;
1609
- }, {
1610
- metric: string;
1611
- dataset?: string | undefined;
1612
- }>]>>>;
1613
- use: z.ZodOptional<z.ZodEnum<["aggregate", "group_or_filter"]>>;
1614
- dataType: z.ZodOptional<z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>>;
1615
- }, "strict", z.ZodTypeAny, {
1616
- name: string;
1617
- expression: string;
1618
- op: "calculation.add";
1619
- label?: string | undefined;
1620
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
1621
- description?: string | undefined;
1622
- inputs?: Record<string, {
1623
- field: string;
1624
- dataset: string;
1625
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1626
- } | {
1627
- metric: string;
1628
- dataset?: string | undefined;
1629
- }> | undefined;
1630
- dataset?: string | undefined;
1631
- use?: "aggregate" | "group_or_filter" | undefined;
1632
- }, {
1633
- name: string;
1634
- expression: string;
1635
- op: "calculation.add";
1636
- label?: string | undefined;
1637
- dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
1638
- description?: string | undefined;
1639
- inputs?: Record<string, {
1640
- field: string;
1641
- dataset: string;
1642
- aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1643
- } | {
1644
- metric: string;
1645
- dataset?: string | undefined;
1646
- }> | undefined;
1647
- dataset?: string | undefined;
1648
- use?: "aggregate" | "group_or_filter" | undefined;
1649
1384
  }>, z.ZodObject<{
1650
1385
  op: z.ZodLiteral<"relationship.update">;
1651
1386
  relationship: z.ZodString;
@@ -1729,6 +1464,148 @@ export declare const domainEditChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zo
1729
1464
  } | undefined;
1730
1465
  } | undefined;
1731
1466
  isActive?: false | undefined;
1467
+ }>, z.ZodObject<{
1468
+ op: z.ZodLiteral<"calculation.add">;
1469
+ domainId: z.ZodOptional<z.ZodString>;
1470
+ dataset: z.ZodOptional<z.ZodString>;
1471
+ name: z.ZodString;
1472
+ label: z.ZodOptional<z.ZodString>;
1473
+ description: z.ZodOptional<z.ZodString>;
1474
+ expression: z.ZodString;
1475
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1476
+ dataset: z.ZodString;
1477
+ field: z.ZodString;
1478
+ aggregate: z.ZodOptional<z.ZodEnum<["SUM", "COUNT", "AVG", "MIN", "MAX", "MEDIAN", "DISTINCT"]>>;
1479
+ }, "strict", z.ZodTypeAny, {
1480
+ field: string;
1481
+ dataset: string;
1482
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1483
+ }, {
1484
+ field: string;
1485
+ dataset: string;
1486
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1487
+ }>, z.ZodObject<{
1488
+ metric: z.ZodString;
1489
+ dataset: z.ZodOptional<z.ZodString>;
1490
+ }, "strict", z.ZodTypeAny, {
1491
+ metric: string;
1492
+ dataset?: string | undefined;
1493
+ }, {
1494
+ metric: string;
1495
+ dataset?: string | undefined;
1496
+ }>]>>>;
1497
+ use: z.ZodOptional<z.ZodEnum<["aggregate", "group_or_filter"]>>;
1498
+ dataType: z.ZodOptional<z.ZodEnum<["string", "number", "boolean", "date", "datetime"]>>;
1499
+ }, "strict", z.ZodTypeAny, {
1500
+ name: string;
1501
+ expression: string;
1502
+ op: "calculation.add";
1503
+ domainId?: string | undefined;
1504
+ label?: string | undefined;
1505
+ dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
1506
+ description?: string | undefined;
1507
+ inputs?: Record<string, {
1508
+ field: string;
1509
+ dataset: string;
1510
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1511
+ } | {
1512
+ metric: string;
1513
+ dataset?: string | undefined;
1514
+ }> | undefined;
1515
+ dataset?: string | undefined;
1516
+ use?: "aggregate" | "group_or_filter" | undefined;
1517
+ }, {
1518
+ name: string;
1519
+ expression: string;
1520
+ op: "calculation.add";
1521
+ domainId?: string | undefined;
1522
+ label?: string | undefined;
1523
+ dataType?: "string" | "number" | "boolean" | "date" | "datetime" | undefined;
1524
+ description?: string | undefined;
1525
+ inputs?: Record<string, {
1526
+ field: string;
1527
+ dataset: string;
1528
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1529
+ } | {
1530
+ metric: string;
1531
+ dataset?: string | undefined;
1532
+ }> | undefined;
1533
+ dataset?: string | undefined;
1534
+ use?: "aggregate" | "group_or_filter" | undefined;
1535
+ }>, z.ZodObject<{
1536
+ op: z.ZodLiteral<"calculation.update">;
1537
+ name: z.ZodString;
1538
+ domainId: z.ZodOptional<z.ZodString>;
1539
+ dataset: z.ZodOptional<z.ZodString>;
1540
+ label: z.ZodOptional<z.ZodString>;
1541
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1542
+ expression: z.ZodOptional<z.ZodString>;
1543
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1544
+ dataset: z.ZodString;
1545
+ field: z.ZodString;
1546
+ aggregate: z.ZodOptional<z.ZodEnum<["SUM", "COUNT", "AVG", "MIN", "MAX", "MEDIAN", "DISTINCT"]>>;
1547
+ }, "strict", z.ZodTypeAny, {
1548
+ field: string;
1549
+ dataset: string;
1550
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1551
+ }, {
1552
+ field: string;
1553
+ dataset: string;
1554
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1555
+ }>, z.ZodObject<{
1556
+ metric: z.ZodString;
1557
+ dataset: z.ZodOptional<z.ZodString>;
1558
+ }, "strict", z.ZodTypeAny, {
1559
+ metric: string;
1560
+ dataset?: string | undefined;
1561
+ }, {
1562
+ metric: string;
1563
+ dataset?: string | undefined;
1564
+ }>]>>>;
1565
+ }, "strict", z.ZodTypeAny, {
1566
+ name: string;
1567
+ op: "calculation.update";
1568
+ domainId?: string | undefined;
1569
+ label?: string | undefined;
1570
+ description?: string | null | undefined;
1571
+ expression?: string | undefined;
1572
+ inputs?: Record<string, {
1573
+ field: string;
1574
+ dataset: string;
1575
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1576
+ } | {
1577
+ metric: string;
1578
+ dataset?: string | undefined;
1579
+ }> | undefined;
1580
+ dataset?: string | undefined;
1581
+ }, {
1582
+ name: string;
1583
+ op: "calculation.update";
1584
+ domainId?: string | undefined;
1585
+ label?: string | undefined;
1586
+ description?: string | null | undefined;
1587
+ expression?: string | undefined;
1588
+ inputs?: Record<string, {
1589
+ field: string;
1590
+ dataset: string;
1591
+ aggregate?: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX" | "MEDIAN" | "DISTINCT" | undefined;
1592
+ } | {
1593
+ metric: string;
1594
+ dataset?: string | undefined;
1595
+ }> | undefined;
1596
+ dataset?: string | undefined;
1597
+ }>, z.ZodObject<{
1598
+ op: z.ZodLiteral<"calculation.remove">;
1599
+ name: z.ZodString;
1600
+ dataset: z.ZodOptional<z.ZodString>;
1601
+ }, "strict", z.ZodTypeAny, {
1602
+ name: string;
1603
+ op: "calculation.remove";
1604
+ dataset?: string | undefined;
1605
+ }, {
1606
+ name: string;
1607
+ op: "calculation.remove";
1608
+ dataset?: string | undefined;
1732
1609
  }>]>;
1733
1610
  /** The ops that edit a domain's metadata: the one list callers route by (semaphor-app's MCP change tools, SE-D6). */
1734
1611
  export declare const DOMAIN_EDIT_CHANGE_OPS: readonly DomainEditChange['op'][];
@@ -57,6 +57,8 @@ export type CardQueryRead = {
57
57
  export declare function readCardQuery(card: TCard, viewer: {
58
58
  sql: boolean;
59
59
  calculations?: boolean;
60
+ /** The dashboard's own calculated fields: a copy equal to one reads by the field's name (calculated fields one core MC-D9). */
61
+ calculatedFields?: readonly Field[];
60
62
  }): CardQueryRead;
61
63
  /**
62
64
  * Where a card's data comes from, as the outline names it. SQL owns the result
@@ -24,6 +24,38 @@ export type CardSource = {
24
24
  connectionId: string;
25
25
  connectionType?: string;
26
26
  };
27
+ /** A calculation to compile, in the words `calculation.add` takes (calculated fields one core). */
28
+ export type CalculationCompileRequest = {
29
+ domainId: string;
30
+ /** A one-dataset formula's dataset; its formula names that dataset's fields. */
31
+ dataset?: string;
32
+ name: string;
33
+ label?: string;
34
+ description?: string;
35
+ expression: string;
36
+ inputs?: Record<string, {
37
+ dataset: string;
38
+ field: string;
39
+ aggregate?: string;
40
+ } | {
41
+ metric: string;
42
+ dataset?: string;
43
+ }>;
44
+ use?: 'aggregate' | 'group_or_filter';
45
+ dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime';
46
+ };
47
+ export type CalculationCompileResult = {
48
+ ok: true;
49
+ /** The compiled field in the stored shape (indexed tokens over full input fields), as the domain catalog builds it. */
50
+ field: Field;
51
+ /** A measure (fact or dataset metric) or a dimension, and its compute stage. */
52
+ kind: 'measure' | 'dimension';
53
+ stage: 'row' | 'aggregate';
54
+ dataset: string;
55
+ } | {
56
+ ok: false;
57
+ problems: ChangeDiagnostic[];
58
+ };
27
59
  export type ChangeServices = {
28
60
  /** The caller's capabilities; read only through `need`, which records each one relied on (DE-D60). */
29
61
  capabilities: {
@@ -39,6 +71,12 @@ export type ChangeServices = {
39
71
  compileCardQuery(request: {
40
72
  query: MetricCardQuery | RecordsCardQuery;
41
73
  chartType: TChartType;
74
+ /**
75
+ * The dashboard's own calculated fields, as the proposal has them so far:
76
+ * a name the query states resolves to one of them before the domain
77
+ * (MC-D9), on the card's dataset. Resolved in memory; nothing is fetched.
78
+ */
79
+ dashboardFields?: readonly Field[];
42
80
  }): Promise<{
43
81
  ok: true;
44
82
  part: CardQueryPart;
@@ -61,6 +99,14 @@ export type ChangeServices = {
61
99
  field: string;
62
100
  toDataset: string;
63
101
  }): Promise<FieldRef[]>;
102
+ /**
103
+ * A calculation compiled by the domain's own compiler, as the domain would
104
+ * place it (calculated fields one core MC-D5): the formula in a dataset's
105
+ * field names, or `{token}`s over `inputs`, placed by stage and use and
106
+ * built into the stored field shape. Compiles only; nothing is saved.
107
+ * Phase 4's dashboard-field changes call it at propose (MC-INV-4).
108
+ */
109
+ compileCalculation?(request: CalculationCompileRequest): Promise<CalculationCompileResult>;
64
110
  /** A new unique id (a UUID: Matrix ids must be UUIDs, ledger P1-04). */
65
111
  newId(): string;
66
112
  /**