react-semaphor 0.1.600 → 0.1.602

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 (83) hide show
  1. package/dist/analytics-protocol/index.js +9 -9
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +7 -7
  4. package/dist/briefings/index.js +48 -45
  5. package/dist/chunks/{assistant-chat-BULOkG9j.js → assistant-chat-BWF3GYip.js} +12 -12
  6. package/dist/chunks/{bookmark-impact-kdvXke8n.js → bookmark-impact-BF3iRx5a.js} +3 -3
  7. package/dist/chunks/{bookmark-state-h1OLXVjE.js → bookmark-state-CBSTdW6q.js} +4 -4
  8. package/dist/chunks/{card-filter-builder-CSCdSQQy.js → card-filter-builder-B8XHwMY6.js} +394 -394
  9. package/dist/chunks/comparison-window-caption-W83qB4V5.js +741 -0
  10. package/dist/chunks/{dashboard-y9ON19ge.js → dashboard-DG5EIYYB.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-9YwUclHA.js → dashboard-briefing-launcher-CBSrhyWZ.js} +727 -718
  12. package/dist/chunks/{dashboard-controls-O6PNXMCp.js → dashboard-controls-D6ECO4N1.js} +15 -15
  13. package/dist/chunks/{dashboard-json-Bxf91TYq.js → dashboard-json-DrJftBSL.js} +4 -4
  14. package/dist/chunks/{dates-DPTbpNxK.js → dates-Bz-qM5px.js} +10 -10
  15. package/dist/chunks/{edit-dashboard-visual-CKwaW8H_.js → edit-dashboard-visual-BDYAJIbb.js} +1569 -1548
  16. package/dist/chunks/filter-line-BXT6y303.js +703 -0
  17. package/dist/chunks/{filter-reach-copy-ClzNcNhP.js → filter-reach-copy-BukhZmzm.js} +1688 -1806
  18. package/dist/chunks/{filter-value-text-CXyuLW9Q.js → filter-value-text-D3-bf3_b.js} +6 -6
  19. package/dist/chunks/{index-CRo5--Y6.js → index-BW0yozjs.js} +386 -360
  20. package/dist/chunks/{layout-grid-DSrBSfPM.js → layout-grid-Ds0diMeY.js} +1 -1
  21. package/dist/chunks/{matrix-analytical-definition-i9PQY066.js → matrix-analytical-definition-CgQgVeeI.js} +35 -35
  22. package/dist/chunks/{matrix-member-presentation-B_2beBc0.js → matrix-member-presentation-DSBIIudt.js} +1 -1
  23. package/dist/chunks/{matrix-operation-contract-DdK0J_KU.js → matrix-operation-contract--DkNCOzd.js} +517 -514
  24. package/dist/chunks/{metric-comparison-Bhz0V841.js → metric-comparison-zMylnIkc.js} +3 -3
  25. package/dist/chunks/{paintbrush-1UiU-uTz.js → paintbrush-CX8pao1j.js} +1 -1
  26. package/dist/chunks/{palette-DFIFf_-m.js → palette-CuA0HlzF.js} +1 -1
  27. package/dist/chunks/{pivot-result-contract-expectations-Dk7WFR_u.js → pivot-result-contract-expectations-C8KL7hPx.js} +14 -14
  28. package/dist/chunks/{pivot-result-identity-CzzrJpEm.js → pivot-result-identity-C1AOH1PS.js} +1 -1
  29. package/dist/chunks/{raw-temporal-value-BLvdaMng.js → raw-temporal-value-E416F-0L.js} +16 -16
  30. package/dist/chunks/{report-preferences-dialog-DiDsYpng.js → report-preferences-dialog-CbuVNDGi.js} +13 -13
  31. package/dist/chunks/{report-runtime-context-CEGluufW.js → report-runtime-context-E7USjN7E.js} +1 -1
  32. package/dist/chunks/{resolve-dashboard-input-context-BAv33KGg.js → resolve-dashboard-input-context-CULCE_hM.js} +8419 -7054
  33. package/dist/chunks/{save-CWQ02kHo.js → save-BKHlDONy.js} +1 -1
  34. package/dist/chunks/{saved-dashboard-context-CvzYqADe.js → saved-dashboard-context-C1WlOx5z.js} +24 -24
  35. package/dist/chunks/{selection-filter-compiler-SwrBvyyJ.js → selection-filter-compiler-ifT8JCXS.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator-1PRI9Yh2.js → semaphor-ready-indicator-CBIRcDWs.js} +33810 -32067
  37. package/dist/chunks/{shelf-drop-preview-context-BLk5Nc6K.js → shelf-drop-preview-context-xR69SMA8.js} +53 -53
  38. package/dist/chunks/{stored-dashboard-xhYYKBsO.js → stored-dashboard-BuM8vnWf.js} +679 -657
  39. package/dist/chunks/{style-sheet-parts-BX7d7-2-.js → style-sheet-parts-Bt9ZNre8.js} +2 -2
  40. package/dist/chunks/{table-export-sheet-BWSVTclx.js → table-export-sheet-DVljtHkG.js} +1 -1
  41. package/dist/chunks/{token-types-CnlEiAdS.js → token-types-D_xKgyVS.js} +1 -1
  42. package/dist/chunks/{upload-DsqUSS8l.js → upload-Dll_M7XQ.js} +1 -1
  43. package/dist/chunks/{validators-D2Hm57lJ.js → validators-ClWHpYql.js} +80 -80
  44. package/dist/chunks/{variable-draft-DcKj8T1b.js → variable-draft-CDGGl53R.js} +27 -28
  45. package/dist/dashboard/index.js +2 -2
  46. package/dist/dashboard-authoring/index.js +3086 -2573
  47. package/dist/format-utils/index.js +238 -237
  48. package/dist/index.js +71 -73
  49. package/dist/report-runtime-context/index.js +1 -1
  50. package/dist/style.css +1 -1
  51. package/dist/surfboard/index.js +2 -2
  52. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  53. package/dist/types/briefings/attachments.d.ts +45 -4
  54. package/dist/types/briefings/index.d.ts +1 -1
  55. package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
  56. package/dist/types/index.js +5 -5
  57. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
  58. package/dist/types/lib/export-utils.d.ts +72 -0
  59. package/dist/types/lib/formatters/dashboard-temporal-presentation.d.ts +10 -0
  60. package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
  61. package/dist/types/lib/stores/dashboard-store.d.ts +30 -0
  62. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
  63. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
  64. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
  65. package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
  66. package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
  67. package/dist/types/shared/dashboard-authoring/card-data-file.d.ts +31 -0
  68. package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
  69. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +144 -2
  70. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +21 -2
  71. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
  72. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
  73. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
  74. package/dist/types/shared/dashboard-authoring/index.d.ts +10 -1
  75. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +133 -0
  76. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
  77. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +18 -5
  78. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
  79. package/dist/types/shared/usage-events/details.d.ts +2 -2
  80. package/dist/types/shared/usage-events/envelope.d.ts +2 -2
  81. package/package.json +1 -1
  82. package/dist/chunks/comparison-window-caption-DJDwP9XO.js +0 -1309
  83. package/dist/chunks/filter-line-Dkg3yuOX.js +0 -134
@@ -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
  /**
@@ -33,6 +33,9 @@ export * from './control-execution-contract.js';
33
33
  export * from './resolved-primary-date-field-validation.js';
34
34
  export * from './card-query-request.js';
35
35
  export * from './card-export-request.js';
36
+ export * from './card-data-file.js';
37
+ export { buildTableFileCsv, type TableFileInput, type TableExportRefusal } from '../../lib/export-utils.js';
38
+ export { resolveDashboardTemporalPresentation } from '../../lib/formatters/dashboard-temporal-presentation.js';
36
39
  export * from './calculated-field-identity.js';
37
40
  export * from './calculated-field-placement.js';
38
41
  export * from './matrix-control-resolution.js';
@@ -47,7 +50,8 @@ export * from './changes/card-query-part.js';
47
50
  export * from './changes/read-card-query.js';
48
51
  export * from './changes/dashboard-change.js';
49
52
  export * from './changes/domain-change.js';
50
- export { resolveDashboardChanges, type CardSource, type ChangeServices, type ChangeRef, type ChangeResolution, } from './changes/resolve-dashboard-changes.js';
53
+ export * from './changes/calculation-change.js';
54
+ export { resolveDashboardChanges, type CalculationCompileRequest, type CalculationCompileResult, type CardSource, type ChangeServices, type ChangeRef, type ChangeResolution, } from './changes/resolve-dashboard-changes.js';
51
55
  export * from './changes/resolve-dashboard-create.js';
52
56
  export * from './text-card-words/index.js';
53
57
  export * from './outline/outline-filters.js';
@@ -85,3 +89,8 @@ export * from './filter-reach-copy.js';
85
89
  export * from './variable-draft.js';
86
90
  export * from './variable-editability.js';
87
91
  export * from './dashboard-style/index.js';
92
+ export * from './calculations/tokens.js';
93
+ export * from './calculations/calculated-column.js';
94
+ export * from './calculations/definition.js';
95
+ export * from './calculations/resolve-dashboard-field-copies.js';
96
+ export * from './operations/calculated-field-operations.js';