react-semaphor 0.1.560 → 0.1.562

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 (168) hide show
  1. package/dist/analytics-protocol/index.js +450 -423
  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 +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{analytics-base-schemas-CHLxsPfX.js → analytics-base-schemas-BaIQrEzX.js} +221 -188
  7. package/dist/chunks/{assistant-chat-Bu2fFm_I.js → assistant-chat-R_yT8xH4.js} +116 -117
  8. package/dist/chunks/bookmark-impact-D4Kl4amw.js +75 -0
  9. package/dist/chunks/bookmark-state-CWeoGbrx.js +743 -0
  10. package/dist/chunks/{braces-Da41xfUd.js → braces-DzgoQC64.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-4FNkMrzE.js → comparison-window-caption-D1EUXzaR.js} +550 -425
  12. package/dist/chunks/{context-BgPDzLHZ.js → context-R31TSL5V.js} +1 -1
  13. package/dist/chunks/{dashboard-_MeBuy67.js → dashboard-Bp1y5oun.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-CEi4Pr_v.js → dashboard-briefing-launcher-S5FB3aUW.js} +236 -236
  15. package/dist/chunks/dashboard-controls-CfC_6Ztn.js +2277 -0
  16. package/dist/chunks/{dashboard-json-B1mU_OMa.js → dashboard-json-gYZT7ZQY.js} +5 -5
  17. package/dist/chunks/dates-DFY7Gfss.js +91 -0
  18. package/dist/chunks/{edit-dashboard-visual-0CJN31Y3.js → edit-dashboard-visual-u7OI_g8Q.js} +7119 -7198
  19. package/dist/chunks/filter-reach-copy-CvV7W5dd.js +3965 -0
  20. package/dist/chunks/{filter-value-text-CRC-K_l_.js → filter-value-text-CPwFkrMz.js} +11 -10
  21. package/dist/chunks/global-date-filter-utils-N1kcsOFE.js +16722 -0
  22. package/dist/chunks/{index-DtHidOPV.js → index-CNGkfUp4.js} +269 -264
  23. package/dist/chunks/{layout-grid-BvsH4RY2.js → layout-grid-BM65viQh.js} +1 -1
  24. package/dist/chunks/{list-filter-Dg0otx5E.js → list-filter-BoeLBfL3.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-CM18W8w6.js → matrix-analytical-definition-hEucouWM.js} +4 -4
  26. package/dist/chunks/{matrix-card-HPskLaPy.js → matrix-card-CCh9JjP1.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-Bbrfrke4.js → matrix-member-presentation-DsAUbuoL.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-WPv4R-H_.js → matrix-operation-contract-DsLdFdSa.js} +365 -349
  29. package/dist/chunks/{metric-comparison-ljMKYZKa.js → metric-comparison-Bnso1cm1.js} +6 -6
  30. package/dist/chunks/{model-change-Ccn1zaxl.js → model-change-T1cRkh3m.js} +1 -1
  31. package/dist/chunks/{palette-Bsh376zO.js → palette-p1XSJFgB.js} +1 -1
  32. package/dist/chunks/pivot-result-contract-expectations-B53jqszr.js +56 -0
  33. package/dist/chunks/{pivot-result-identity-vS9TSh4f.js → pivot-result-identity-Dq5jm-EC.js} +1 -1
  34. package/dist/chunks/{zoned-wall-clock-B1n_WjW3.js → raw-temporal-value-Bqz8wc7L.js} +97 -46
  35. package/dist/chunks/{report-preferences-dialog-BV8L0SeS.js → report-preferences-dialog-C4RAR8u5.js} +68 -63
  36. package/dist/chunks/{report-runtime-context-BZQh9ywy.js → report-runtime-context-BITkNSDa.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-DaDrZGuA.js +8214 -0
  38. package/dist/chunks/{save-B5EAsgQF.js → save-CHV1B1fL.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-n2Wn11cV.js → saved-dashboard-context-DFYBrE6O.js} +93 -94
  40. package/dist/chunks/{selection-filter-compiler-BKXmyLrS.js → selection-filter-compiler-CUDRnUxc.js} +19 -18
  41. package/dist/chunks/{selection-reducer-D0YnaAD9.js → selection-reducer-Bz5aywT4.js} +1 -1
  42. package/dist/chunks/{semaphor-ready-indicator-XLBLOJ2V.js → semaphor-ready-indicator-Cfuafnem.js} +38188 -40344
  43. package/dist/chunks/{shelf-drop-preview-context-DHMa54a-.js → shelf-drop-preview-context-BR2GEYog.js} +81 -82
  44. package/dist/chunks/{source-entity-resolution-dUG5VWRm.js → source-entity-resolution-DdDVXFB8.js} +6 -6
  45. package/dist/chunks/{switch-ByxH4M7t.js → switch-BW4yXSYs.js} +3 -3
  46. package/dist/chunks/{table-export-sheet-C_GdeTYU.js → table-export-sheet-bSXxGn-v.js} +1 -1
  47. package/dist/chunks/temporal-input-presentation-sk9gqLi6.js +4960 -0
  48. package/dist/chunks/{token-types-CQtXUVMy.js → token-types-BUK06hU2.js} +1 -1
  49. package/dist/chunks/{upload-wbR-NVzq.js → upload-BnmuyPqW.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-CEBaLOKC.js → use-create-flow-overlay-state-DyzhWvRJ.js} +6 -6
  51. package/dist/chunks/{validators-CXTneCA4.js → validators-BIM0FE31.js} +774 -895
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2477 -2685
  54. package/dist/data-app-sdk/index.js +30 -30
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +25 -25
  57. package/dist/format-utils/index.js +274 -267
  58. package/dist/index.js +59 -59
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  63. package/dist/types/components/dashboard/dashboard-create-dialog.d.ts +23 -0
  64. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  65. package/dist/types/components/index.d.ts +1 -2
  66. package/dist/types/components/surfboard/filter/types.d.ts +3 -1
  67. package/dist/types/index.js +50 -51
  68. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  69. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +59 -2
  70. package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +5 -0
  71. package/dist/types/lib/interactions/get-click-context-from-table.d.ts +45 -0
  72. package/dist/types/lib/print/print-inputs.d.ts +2 -1
  73. package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -0
  74. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -0
  75. package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
  76. package/dist/types/lib/stores/editor-store.d.ts +9 -1
  77. package/dist/types/lib/stores/table-actions.d.ts +0 -2
  78. package/dist/types/lib/types/common-types.d.ts +6 -0
  79. package/dist/types/lib/types/explorer-types.d.ts +7 -1
  80. package/dist/types/lib/types/interaction-types.d.ts +3 -1
  81. package/dist/types/lib/types/token-types.d.ts +0 -1
  82. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +13 -1
  83. package/dist/types/shared/analytics-protocol/contracts.d.ts +9 -40
  84. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  85. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +12 -2
  86. package/dist/types/shared/analytics-protocol/validators.d.ts +1 -2
  87. package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
  88. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +7 -1
  89. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  90. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +76 -0
  91. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  92. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  93. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  94. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  95. package/dist/types/shared/dashboard-authoring/card-settings/column-polarity-write.d.ts +5 -0
  96. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  97. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  98. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  99. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +17 -0
  100. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +117 -0
  101. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  102. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  103. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  104. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +51 -0
  105. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +30 -0
  106. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  107. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  108. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +3402 -4313
  109. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +49 -8
  110. package/dist/types/shared/dashboard-authoring/changes/field-ref.d.ts +91 -0
  111. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +7 -0
  112. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +52 -2
  113. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-create.d.ts +26 -0
  114. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +2 -1
  115. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +1 -8
  116. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +20 -20
  117. package/dist/types/shared/dashboard-authoring/detail-date-presentation.d.ts +9 -0
  118. package/dist/types/shared/dashboard-authoring/index.d.ts +11 -6
  119. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  120. package/dist/types/shared/dashboard-authoring/measure-calculations/apply.d.ts +8 -0
  121. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +16 -0
  122. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +41 -0
  123. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +17 -0
  124. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +63 -0
  125. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +16 -0
  126. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +79 -0
  127. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +934 -0
  128. package/dist/types/shared/dashboard-authoring/measure-calculations/sentences.d.ts +4 -0
  129. package/dist/types/shared/dashboard-authoring/measure-calculations/set.d.ts +11 -0
  130. package/dist/types/shared/dashboard-authoring/measure-calculations/transform.d.ts +63 -0
  131. package/dist/types/shared/dashboard-authoring/measure-calculations/window-transforms.d.ts +60 -0
  132. package/dist/types/shared/dashboard-authoring/new-card.d.ts +12 -1
  133. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +2 -1
  134. package/dist/types/shared/dashboard-authoring/operations/operation-sentences.d.ts +46 -0
  135. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +73 -3
  136. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -3
  137. package/dist/types/shared/dashboard-authoring/text-card-words/blocks.d.ts +58 -0
  138. package/dist/types/shared/dashboard-authoring/text-card-words/index.d.ts +55 -0
  139. package/dist/types/shared/dashboard-authoring/text-card-words/rich-content.d.ts +18 -0
  140. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  141. package/dist/types/shared/format-utils/document-print.d.ts +82 -0
  142. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +8 -1
  143. package/dist/types/shared/format-utils/index.d.ts +1 -0
  144. package/dist/types/shared/format-utils/raw-temporal.d.ts +18 -7
  145. package/dist/types/shared/temporal/index.d.ts +1 -0
  146. package/dist/types/shared/temporal/raw-temporal-equality.d.ts +19 -0
  147. package/dist/types/shared/temporal/raw-temporal-value.d.ts +29 -0
  148. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +6 -0
  149. package/package.json +2 -2
  150. package/dist/chunks/bookmark-state-BFY9oNmr.js +0 -111
  151. package/dist/chunks/custom-visual-inputs-Dz-enUNR.js +0 -292
  152. package/dist/chunks/dashboard-controls-Bi7fyG-4.js +0 -2339
  153. package/dist/chunks/document-dashboard-inputs-CkWfDB8c.js +0 -3010
  154. package/dist/chunks/filter-reach-copy-BF4w4kI2.js +0 -3738
  155. package/dist/chunks/global-date-filter-utils-D8365uPH.js +0 -12889
  156. package/dist/chunks/pivot-result-contract-expectations-Bl5suy4-.js +0 -1832
  157. package/dist/chunks/raw-temporal-presentation-BHm7s-hz.js +0 -540
  158. package/dist/chunks/resolve-dashboard-input-context-CAMiWvyR.js +0 -5280
  159. package/dist/chunks/table-settings-Imz0FgWi.js +0 -637
  160. package/dist/chunks/temporal-input-presentation-uvNK_tM0.js +0 -3228
  161. package/dist/types/components/dashboard/ai-dashboard-create-dialog.d.ts +0 -38
  162. package/dist/types/components/dashboard/dashboard-create-template.d.ts +0 -10
  163. package/dist/types/lib/hooks/use-dashboard-authoring.d.ts +0 -49
  164. package/dist/types/shared/dashboard-authoring/artifact-compiler.d.ts +0 -6
  165. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -106
  166. package/dist/types/shared/dashboard-authoring/protocol-adapter.d.ts +0 -7
  167. package/dist/types/shared/dashboard-authoring/source-matching.d.ts +0 -34
  168. package/dist/types/shared/dashboard-authoring/validators.d.ts +0 -2
@@ -1,9 +1,4 @@
1
- /**
2
- * Problems and warnings for dashboard changes (MCP dashboard editing SPEC
3
- * 3.2). One shape for both: a refusal lists problems, a proposal carries
4
- * warnings. Messages are one sentence a person can read and never name the
5
- * product; `fix` tells the agent what to do next.
6
- */
1
+ import { ProposedChange } from './dashboard-change.js';
7
2
  export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'copy_required' | 'not_permitted' | 'dashboard_not_found' | 'card_not_found' | 'filter_not_found' | 'sheet_not_found' | 'sheet_required' | 'sheet_not_a_grid' | 'field_not_found'
8
3
  /**
9
4
  * The card's datasets aren't joined by the domain's relationships, so the
@@ -14,7 +9,41 @@ export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'co
14
9
  /** filter.update or filter.bind on a filter the outline marks read only. */
15
10
  | 'filter_not_editable'
16
11
  /** The changed dashboard fails the save's own validation (propose or apply). */
17
- | 'document_invalid';
12
+ | 'document_invalid'
13
+ /** A setting the card's kind doesn't take (SPEC 3.4). */
14
+ | 'setting_not_for_card'
15
+ /** No column of the card has that name. */
16
+ | 'column_not_found'
17
+ /** The name matches two columns. */
18
+ | 'column_ambiguous'
19
+ /** A SQL table's result columns couldn't be read to check a column name. */
20
+ | 'columns_unavailable'
21
+ /** A format that fails the stored format's schema, has nothing to merge onto, or doesn't fit the column's data. */
22
+ | 'format_invalid'
23
+ /** A date format finer than the column's grain. */
24
+ | 'date_finer_than_grain'
25
+ /** Not a theme color name or `#rrggbb`. */
26
+ | 'color_unknown'
27
+ /** No highlight rule on the card has that id. */
28
+ | 'highlight_not_found'
29
+ /** A width, range or title that can't be stored, or two labels for one column. */
30
+ | 'value_invalid'
31
+ /** A comparison on a card type that doesn't run that kind, or on a SQL card. */
32
+ | 'comparison_not_for_card'
33
+ /** A period or year comparison on a card with no date to compare over. */
34
+ | 'comparison_needs_date'
35
+ /** One measure with a comparison of its own and a table calculation at once. */
36
+ | 'comparison_with_transform'
37
+ /** A polarity that differs from the one the semantic model sets. */
38
+ | 'polarity_set_by_model'
39
+ /** A table calculation on a card, query or measure that can't take one. */
40
+ | 'transform_not_for_card'
41
+ /** A table calculation's order or reset fields that aren't groupings of the card, or a reset with a grand total. */
42
+ | 'transform_field_invalid'
43
+ /** Tabs that can't be made: fewer than two cards, cards on two sheets, a Document section's card, a custom visual's input (building a report SPEC §7). */
44
+ | 'layout_invalid'
45
+ /** 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). */
46
+ | 'text_invalid';
18
47
  export type ChangeWarningCode =
19
48
  /** In-scope cards the filter doesn't reach. */
20
49
  'filter_not_reaching_cards'
@@ -37,7 +66,15 @@ export type ChangeWarningCode =
37
66
  * dashboard already fails the save's own check, so the change wasn't
38
67
  * checked against it; the person's Save reports what it finds.
39
68
  */
40
- | 'document_not_checked';
69
+ | 'document_not_checked'
70
+ /** A change removes something viewers' bookmarks or remembered table settings use (card appearance CA-D17). */
71
+ | 'viewer_settings_affected'
72
+ /** A period or year comparison where no date window applies to its date: it shows only while one does. */
73
+ | 'comparison_without_date_window'
74
+ /** A table calculation ordered along a grouping that isn't a date. */
75
+ | 'transform_order_not_date'
76
+ /** 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). */
77
+ | 'tabs_show_as_kpi_info';
41
78
  export type ChangeDiagnostic = {
42
79
  code: ChangeProblemCode | ChangeWarningCode;
43
80
  /** One sentence, safe to show an end user. */
@@ -48,4 +85,8 @@ export type ChangeDiagnostic = {
48
85
  fix?: string;
49
86
  /** E.g. `{ sheets }`, `{ available }`, `{ suggestedFields }`. */
50
87
  details?: Record<string, unknown>;
88
+ /** What this card or setting accepts, in the input words (card appearance CA-D9). */
89
+ allowed?: readonly string[];
90
+ /** A change the agent can send as written (CA-D9). */
91
+ suggestedChange?: ProposedChange;
51
92
  };
@@ -0,0 +1,91 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A field reference in the public change vocabulary (MCP dashboard editing
4
+ * SPEC 3.1): the one schema queries, filters and table calculations name a
5
+ * field with. Its own module so `dashboard-change.ts` and the measure
6
+ * calculations owner both import it without importing each other.
7
+ */
8
+ /** A non-empty, trimmed name. */
9
+ export declare const nameSchema: z.ZodString;
10
+ /** The fields of a field reference's object form. */
11
+ export declare const fieldRefObject: {
12
+ name: z.ZodString;
13
+ /** A label for the column; a stated label wins over the one the card had. */
14
+ label: z.ZodOptional<z.ZodString>;
15
+ datasetName: z.ZodOptional<z.ZodString>;
16
+ datasetId: z.ZodOptional<z.ZodString>;
17
+ connectionId: z.ZodOptional<z.ZodString>;
18
+ source: z.ZodOptional<z.ZodObject<{
19
+ kind: z.ZodLiteral<"semantic">;
20
+ domainId: z.ZodString;
21
+ datasetName: z.ZodString;
22
+ datasetId: z.ZodOptional<z.ZodString>;
23
+ connectionId: z.ZodOptional<z.ZodString>;
24
+ }, "strict", z.ZodTypeAny, {
25
+ kind: "semantic";
26
+ domainId: string;
27
+ datasetName: string;
28
+ datasetId?: string | undefined;
29
+ connectionId?: string | undefined;
30
+ }, {
31
+ kind: "semantic";
32
+ domainId: string;
33
+ datasetName: string;
34
+ datasetId?: string | undefined;
35
+ connectionId?: string | undefined;
36
+ }>>;
37
+ };
38
+ /** A field name, or `{ name, datasetName }` for a field of a joined dataset. */
39
+ export declare const fieldRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
40
+ name: z.ZodString;
41
+ /** A label for the column; a stated label wins over the one the card had. */
42
+ label: z.ZodOptional<z.ZodString>;
43
+ datasetName: z.ZodOptional<z.ZodString>;
44
+ datasetId: z.ZodOptional<z.ZodString>;
45
+ connectionId: z.ZodOptional<z.ZodString>;
46
+ source: z.ZodOptional<z.ZodObject<{
47
+ kind: z.ZodLiteral<"semantic">;
48
+ domainId: z.ZodString;
49
+ datasetName: z.ZodString;
50
+ datasetId: z.ZodOptional<z.ZodString>;
51
+ connectionId: z.ZodOptional<z.ZodString>;
52
+ }, "strict", z.ZodTypeAny, {
53
+ kind: "semantic";
54
+ domainId: string;
55
+ datasetName: string;
56
+ datasetId?: string | undefined;
57
+ connectionId?: string | undefined;
58
+ }, {
59
+ kind: "semantic";
60
+ domainId: string;
61
+ datasetName: string;
62
+ datasetId?: string | undefined;
63
+ connectionId?: string | undefined;
64
+ }>>;
65
+ }, "strict", z.ZodTypeAny, {
66
+ name: string;
67
+ datasetName?: string | undefined;
68
+ datasetId?: string | undefined;
69
+ label?: string | undefined;
70
+ connectionId?: string | undefined;
71
+ source?: {
72
+ kind: "semantic";
73
+ domainId: string;
74
+ datasetName: string;
75
+ datasetId?: string | undefined;
76
+ connectionId?: string | undefined;
77
+ } | undefined;
78
+ }, {
79
+ name: string;
80
+ datasetName?: string | undefined;
81
+ datasetId?: string | undefined;
82
+ label?: string | undefined;
83
+ connectionId?: string | undefined;
84
+ source?: {
85
+ kind: "semantic";
86
+ domainId: string;
87
+ datasetName: string;
88
+ datasetId?: string | undefined;
89
+ connectionId?: string | undefined;
90
+ } | undefined;
91
+ }>]>;
@@ -41,8 +41,15 @@ export type CardQueryRead = {
41
41
  detail?: string;
42
42
  source?: OutlineCardSource;
43
43
  };
44
+ /**
45
+ * `calculations: false` reads the query without its measures' calculations:
46
+ * the change resolver's check that a requery holds what was asked, before the
47
+ * calculations step checks a kept table calculation (reports by conversation
48
+ * S-13).
49
+ */
44
50
  export declare function readCardQuery(card: TCard, viewer: {
45
51
  sql: boolean;
52
+ calculations?: boolean;
46
53
  }): CardQueryRead;
47
54
  /**
48
55
  * Where a card's data comes from, as the outline names it. SQL owns the result
@@ -1,4 +1,4 @@
1
- import { TDashboard } from '../../../lib/types/common-types.js';
1
+ import { TCard, TDashboard } from '../../../lib/types/common-types.js';
2
2
  import { DataSource, Field } from '../../../lib/types/explorer-types.js';
3
3
  import { TChartType } from '../../../lib/charts/types.js';
4
4
  import { CalendarContext } from '../../report-runtime-context/index.js';
@@ -7,6 +7,8 @@ import { DashboardOperation, OperationContext, OperationDescription } from '../o
7
7
  import { CardQueryPart } from './card-query-part.js';
8
8
  import { FieldRef, MetricCardQuery, RecordsCardQuery } from './dashboard-change.js';
9
9
  import { ChangeDiagnostic } from './diagnostics.js';
10
+ import { ModelFormats } from '../../format-utils/resolve-column-format.js';
11
+ import { ComparisonDates } from '../measure-calculations/dates.js';
10
12
  /**
11
13
  * Public dashboard changes to resolved operations (MCP dashboard editing SPEC
12
14
  * 3.7, DE-D48). Every rule the schema can't state lives here; everything that
@@ -66,13 +68,45 @@ export type ChangeServices = {
66
68
  * RF-D15). Without one, those cards read as decided when they run.
67
69
  */
68
70
  relationshipReach?: DashboardRelationshipReachResolver;
71
+ /**
72
+ * A SQL card's result keys, read by running it on this dashboard (card
73
+ * appearance SPEC 5, V-9); null when it can't run or returns no rows.
74
+ * Called only when a change names a SQL card's columns.
75
+ */
76
+ readSqlResultColumns?(input: {
77
+ cardId: string;
78
+ dashboard: TDashboard;
79
+ }): Promise<readonly string[] | null>;
80
+ /**
81
+ * The model format each of a card's columns shows, by column id (a config
82
+ * field's id, a Matrix level's or measure's), as the query gives it to the
83
+ * renderer: a config card's `modelFormats` (CF-D23), a Matrix's bound
84
+ * catalog formats. Called only when a change states a format; null when it
85
+ * can't be read (card appearance ledger P2-20).
86
+ */
87
+ readModelFormats?(input: {
88
+ card: TCard;
89
+ }): Promise<ModelFormats | null>;
90
+ /**
91
+ * The facts a period or year comparison needs, as a fresh viewer gets them
92
+ * (reports by conversation SPEC S-9, `readDefaultComparisonDates`): the date
93
+ * it compares over and whether a date window applies. Called only when a
94
+ * change states a period or year comparison; without it, the card's grained
95
+ * date is the comparison date and the window is unknown.
96
+ */
97
+ readComparisonDates?(input: {
98
+ card: TCard;
99
+ dashboard: TDashboard;
100
+ }): Promise<ComparisonDates>;
69
101
  };
70
102
  export type ChangeRef = {
71
103
  ref: string;
72
- kind: 'card' | 'filter';
104
+ kind: 'card' | 'filter' | 'sheet';
73
105
  id: string;
74
106
  title: string;
75
107
  changeIndex: number;
108
+ /** A highlight rule a `highlight.add` made, minted at resolve (card appearance SPEC 5); never in a sentence (S-10). */
109
+ ruleId?: string;
76
110
  };
77
111
  export type ChangeResolution = {
78
112
  ok: true;
@@ -84,6 +118,8 @@ export type ChangeResolution = {
84
118
  /** Handle or existing id to final id, in change order; a handle-less card.add gets $card_1, $card_2... */
85
119
  refs: ChangeRef[];
86
120
  descriptions: OperationDescription[];
121
+ /** The dry run detached a library visual (`DashboardOperationResult.detaches`). */
122
+ detaches: boolean;
87
123
  /** Cards whose query part or type changed, and added cards, in change order: the preview runs the first five. */
88
124
  changedCardIds: string[];
89
125
  /** Every capability the resolution relied on (DE-D60). */
@@ -93,4 +129,18 @@ export type ChangeResolution = {
93
129
  ok: false;
94
130
  problems: ChangeDiagnostic[];
95
131
  };
132
+ /** How many changes a target takes, and what to do with more (building a report S-12). */
133
+ export type ChangeLimit = {
134
+ max: number;
135
+ what: string;
136
+ fix: string;
137
+ };
96
138
  export declare function resolveDashboardChanges(dashboard: TDashboard, changes: readonly unknown[], services: ChangeServices): Promise<ChangeResolution>;
139
+ /**
140
+ * The one resolver an edit and a create run (building a report S-1): the
141
+ * target decides only the dashboard it starts from and the limit. Not in
142
+ * the package's entry; `resolveDashboardCreate` is its other caller.
143
+ */
144
+ export declare function resolveChanges(dashboard: TDashboard, changes: readonly unknown[], services: ChangeServices, options: {
145
+ limit: ChangeLimit;
146
+ }): Promise<ChangeResolution>;
@@ -0,0 +1,26 @@
1
+ import { TDashboard } from '../../../lib/types/common-types.js';
2
+ import { CreateTarget } from './dashboard-change.js';
3
+ import { ChangeDiagnostic } from './diagnostics.js';
4
+ import { ChangeResolution, ChangeServices } from './resolve-dashboard-changes.js';
5
+ /**
6
+ * A proposal that creates a dashboard (building a report BR-D2, BR-D4, SPEC
7
+ * §5.2): its changes resolve against a seed with no cards, through the
8
+ * resolver an edit runs (S-1). Apply replays the operations onto the stored
9
+ * seed, so the dashboard saved is the one previewed.
10
+ */
11
+ export type CreateResolution = (Extract<ChangeResolution, {
12
+ ok: true;
13
+ }> & {
14
+ /** What the operations replay onto at apply (S-4). */
15
+ seed: TDashboard;
16
+ /** "Creates a private dashboard "…" with 2 sheets, 6 cards and 1 filter." */
17
+ sentence: string;
18
+ }) | {
19
+ ok: false;
20
+ problems: ChangeDiagnostic[];
21
+ };
22
+ export declare function resolveDashboardCreate(request: {
23
+ dashboardId: string;
24
+ create: CreateTarget;
25
+ changes: readonly unknown[];
26
+ }, services: ChangeServices): Promise<CreateResolution>;
@@ -67,7 +67,8 @@ export declare function defaultClickToFilterSettings(card: Pick<TCard, 'type'>,
67
67
  * Grounds an explorer field on one of the card's own executable sources.
68
68
  * A field that carries catalog identity must match an executable source. A
69
69
  * field without it is grounded by its entity, or by the card's single source.
70
- * Calculated fields and unknown data types cannot be grounded.
70
+ * Calculated fields and unknown data types cannot be grounded. The field's
71
+ * database type travels with it (ledger P7-06).
71
72
  */
72
73
  export declare function selectionFieldFromExplorerField(field: Field, sourceIndex: DashboardCardFilterSourceInventory): SelectionField | undefined;
73
74
  /** The source-index members ground a legacy attribute trigger to a stable field key. */
@@ -1,14 +1,7 @@
1
1
  import { TCard } from '../../../lib/types/common-types.js';
2
- import { CardColumnRef } from './types.js';
3
2
  export type KpiValueStyle = {
4
3
  color?: string;
5
4
  backgroundColor?: string;
6
5
  };
7
- /**
8
- * The column a KPI's value rules name: a SQL KPI's value, else its first
9
- * measure (or the one named). The renderers color it, and the KPI rule panel
10
- * offers only it, so a rule can't be saved where it never shows (ledger P4-16).
11
- */
12
- export declare function kpiValueColumn(card: Pick<TCard, 'sql' | 'config'>, metricId?: string): CardColumnRef | undefined;
13
6
  /** The colors the card's rules give this value. */
14
- export declare function resolveKpiValueStyle(card: Pick<TCard, 'sql' | 'config' | 'preferences'>, value: unknown, metricId?: string): KpiValueStyle;
7
+ export declare function resolveKpiValueStyle(card: Pick<TCard, 'sql' | 'config' | 'preferences'>, value: unknown): KpiValueStyle;
@@ -1443,10 +1443,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
1443
1443
  color: string;
1444
1444
  showValue: boolean;
1445
1445
  } | undefined;
1446
+ italic?: boolean | undefined;
1447
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1446
1448
  backgroundColor?: string | undefined;
1447
1449
  textColor?: string | undefined;
1448
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1449
- italic?: boolean | undefined;
1450
1450
  textDecoration?: "none" | "underline" | "line-through" | undefined;
1451
1451
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
1452
1452
  }, {
@@ -1454,10 +1454,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
1454
1454
  color: string;
1455
1455
  showValue: boolean;
1456
1456
  } | undefined;
1457
+ italic?: boolean | undefined;
1458
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1457
1459
  backgroundColor?: string | undefined;
1458
1460
  textColor?: string | undefined;
1459
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1460
- italic?: boolean | undefined;
1461
1461
  textDecoration?: "none" | "underline" | "line-through" | undefined;
1462
1462
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
1463
1463
  }>>;
@@ -1723,10 +1723,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
1723
1723
  color: string;
1724
1724
  showValue: boolean;
1725
1725
  } | undefined;
1726
+ italic?: boolean | undefined;
1727
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1726
1728
  backgroundColor?: string | undefined;
1727
1729
  textColor?: string | undefined;
1728
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1729
- italic?: boolean | undefined;
1730
1730
  textDecoration?: "none" | "underline" | "line-through" | undefined;
1731
1731
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
1732
1732
  } | undefined;
@@ -1993,10 +1993,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
1993
1993
  color: string;
1994
1994
  showValue: boolean;
1995
1995
  } | undefined;
1996
+ italic?: boolean | undefined;
1997
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1996
1998
  backgroundColor?: string | undefined;
1997
1999
  textColor?: string | undefined;
1998
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
1999
- italic?: boolean | undefined;
2000
2000
  textDecoration?: "none" | "underline" | "line-through" | undefined;
2001
2001
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
2002
2002
  } | undefined;
@@ -3377,10 +3377,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
3377
3377
  color: string;
3378
3378
  showValue: boolean;
3379
3379
  } | undefined;
3380
+ italic?: boolean | undefined;
3381
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3380
3382
  backgroundColor?: string | undefined;
3381
3383
  textColor?: string | undefined;
3382
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3383
- italic?: boolean | undefined;
3384
3384
  textDecoration?: "none" | "underline" | "line-through" | undefined;
3385
3385
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
3386
3386
  }, {
@@ -3388,10 +3388,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
3388
3388
  color: string;
3389
3389
  showValue: boolean;
3390
3390
  } | undefined;
3391
+ italic?: boolean | undefined;
3392
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3391
3393
  backgroundColor?: string | undefined;
3392
3394
  textColor?: string | undefined;
3393
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3394
- italic?: boolean | undefined;
3395
3395
  textDecoration?: "none" | "underline" | "line-through" | undefined;
3396
3396
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
3397
3397
  }>>;
@@ -3657,10 +3657,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
3657
3657
  color: string;
3658
3658
  showValue: boolean;
3659
3659
  } | undefined;
3660
+ italic?: boolean | undefined;
3661
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3660
3662
  backgroundColor?: string | undefined;
3661
3663
  textColor?: string | undefined;
3662
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3663
- italic?: boolean | undefined;
3664
3664
  textDecoration?: "none" | "underline" | "line-through" | undefined;
3665
3665
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
3666
3666
  } | undefined;
@@ -3927,10 +3927,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
3927
3927
  color: string;
3928
3928
  showValue: boolean;
3929
3929
  } | undefined;
3930
+ italic?: boolean | undefined;
3931
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3930
3932
  backgroundColor?: string | undefined;
3931
3933
  textColor?: string | undefined;
3932
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
3933
- italic?: boolean | undefined;
3934
3934
  textDecoration?: "none" | "underline" | "line-through" | undefined;
3935
3935
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
3936
3936
  } | undefined;
@@ -4200,10 +4200,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
4200
4200
  color: string;
4201
4201
  showValue: boolean;
4202
4202
  } | undefined;
4203
+ italic?: boolean | undefined;
4204
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
4203
4205
  backgroundColor?: string | undefined;
4204
4206
  textColor?: string | undefined;
4205
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
4206
- italic?: boolean | undefined;
4207
4207
  textDecoration?: "none" | "underline" | "line-through" | undefined;
4208
4208
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
4209
4209
  } | undefined;
@@ -4473,10 +4473,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
4473
4473
  color: string;
4474
4474
  showValue: boolean;
4475
4475
  } | undefined;
4476
+ italic?: boolean | undefined;
4477
+ fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
4476
4478
  backgroundColor?: string | undefined;
4477
4479
  textColor?: string | undefined;
4478
- fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
4479
- italic?: boolean | undefined;
4480
4480
  textDecoration?: "none" | "underline" | "line-through" | undefined;
4481
4481
  icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
4482
4482
  } | undefined;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Whether a config detail table draws a date column's stored format, for
3
+ * every kind of value the column may come back as (column formats CF-D4,
4
+ * ledger P7-07). A detail date on PostgreSQL, Snowflake or ClickHouse always
5
+ * comes back raw and the browser draws it: the table and its exports draw a
6
+ * format this refuses as Automatic, and the backfill rewrites the patterns
7
+ * only SQL drew so they don't. Pure.
8
+ */
9
+ export { checkDetailDateFormat } from '../../lib/formatters/raw-temporal-presentation.js';
@@ -1,10 +1,6 @@
1
- export * from './contracts.js';
2
1
  export * from './comparison-document-migration.js';
3
- export * from './source-matching.js';
4
- export * from './validators.js';
5
- export * from './artifact-compiler.js';
6
- export * from './protocol-adapter.js';
7
2
  export * from './temporal-result-owner.js';
3
+ export * from './detail-date-presentation.js';
8
4
  export * from './temporal-bucket-authoring.js';
9
5
  export * from './canonical-result-keys.js';
10
6
  export * from './dashboard-card-source-index.js';
@@ -43,7 +39,9 @@ export * from './changes/diagnostics.js';
43
39
  export * from './changes/card-query-part.js';
44
40
  export * from './changes/read-card-query.js';
45
41
  export * from './changes/dashboard-change.js';
46
- export * from './changes/resolve-dashboard-changes.js';
42
+ export { resolveDashboardChanges, type CardSource, type ChangeServices, type ChangeRef, type ChangeResolution, } from './changes/resolve-dashboard-changes.js';
43
+ export * from './changes/resolve-dashboard-create.js';
44
+ export * from './text-card-words/index.js';
47
45
  export * from './outline/outline-filters.js';
48
46
  export * from './outline/outline-dashboard.js';
49
47
  export * from './column-catalog.js';
@@ -52,6 +50,10 @@ export * from './upgrade-card-presentation.js';
52
50
  export * from './card-formats/sql-date-pattern.js';
53
51
  export * from './retired-presentation-fields.js';
54
52
  export * from './conditional-formatting/index.js';
53
+ export * from './kpi-figure.js';
54
+ export * from './card-settings/index.js';
55
+ export * from './measure-calculations/index.js';
56
+ export { bookmarkImpactSentence, describeBookmarkImpact, type BookmarkImpactItem, } from '../dashboard-viewer/bookmark-impact.js';
55
57
  export { prepareLoadedDashboard } from '../../lib/dashboard-inputs/prepare-loaded-dashboard.js';
56
58
  export { buildFilterInputFromField, buildFilterInputFromDefinition, applyFilterSettingsChange } from '../../lib/dashboard-inputs/filter-settings.js';
57
59
  export { relationshipRouteTarget } from '../../lib/dashboard-inputs/dashboard-filter-value-identity.js';
@@ -61,6 +63,9 @@ export { changeCardType, sharedCardPreferences, type CardTypeChange, type CardTy
61
63
  export { buildSavedEditorCard } from '../../lib/utils/build-saved-editor-card.js';
62
64
  export { getCardDefinition, type AuthoredCardFields } from '../../lib/utils/card-definition.js';
63
65
  export { changeMatrixEditor, dropMatrixEditorField, matrixEditorCatalogFromFields, } from '../../lib/matrix-table/matrix-editor.js';
66
+ export { resolveDetailTableRawTemporalPresentation } from '../../lib/formatters/raw-temporal-presentation.js';
67
+ export { getClickContextFromTable } from '../../lib/interactions/get-click-context-from-table.js';
68
+ export { selectionTupleFromClickContext } from '../../lib/selection/selection-from-click-context.js';
64
69
  export * from './filter-applicability.js';
65
70
  export * from './semantic-auto-join-card.js';
66
71
  export * from './filter-reach-preview.js';
@@ -0,0 +1,123 @@
1
+ import { TCard } from '../../lib/types/common-types.js';
2
+ import { CardConfig, MetricField } from '../../lib/types/explorer-types.js';
3
+ import { ComparisonMetadataMap } from '../../lib/types/query-types.js';
4
+ import { MetricComparisonEvaluation, MetricComparisonPolarity } from '../analytics-protocol/index.js';
5
+ type KpiCard = Pick<TCard, 'sql' | 'config' | 'preferences'>;
6
+ /**
7
+ * Which column is the value, by source. The shape reads ids, never formats, so
8
+ * it is the same for the saved card and the render card; formats, rules,
9
+ * currency targets and the settings panels need only this.
10
+ */
11
+ export type KpiShape = {
12
+ source: 'sql';
13
+ /** A SQL KPI's value is positional: its result's first numeric column (CF-D24). */
14
+ value: {
15
+ kind: 'sqlKpiValue';
16
+ };
17
+ /** `preferences.sqlKpiValue.comparisonPolarity`, else the default. */
18
+ polarity: MetricComparisonPolarity;
19
+ } | {
20
+ source: 'config';
21
+ /** Built from `measure`: always `{ kind: 'field', fieldId: measure.id }`. */
22
+ value: {
23
+ kind: 'field';
24
+ fieldId: string;
25
+ };
26
+ /** The value measure: the card's first. */
27
+ measure: MetricField;
28
+ /** The measure's polarity. */
29
+ polarity: MetricComparisonPolarity;
30
+ };
31
+ /** A KPI's value column, or another measure of a config KPI. */
32
+ export type KpiColumn = KpiShape['value'];
33
+ /** SQL text means a SQL KPI (KV-D2), as the server runs it. */
34
+ export declare function isSqlKpi(card: Pick<TCard, 'sql'>): boolean;
35
+ /** Undefined for a card with no value to show: a config KPI with no measure. */
36
+ export declare function resolveKpiShape(card: KpiCard): KpiShape | undefined;
37
+ /**
38
+ * What sits beside the value. `value`: the value and, when the card compares,
39
+ * its comparison (a previous period or a target). `measures`: the value and
40
+ * the card's second and third measures.
41
+ */
42
+ export type KpiLayout = 'value' | 'measures';
43
+ /** How many measures the measures layout shows: the value and the next two. The server queries no more. */
44
+ export declare const KPI_MEASURES_SHOWN = 3;
45
+ /**
46
+ * The one layout rule (KV-D7, option B): `measures` for two or more measures,
47
+ * no group-by and no target comparison; else `value`. A period comparison, the
48
+ * card's own or the dashboard's, never changes it. The server calls it and
49
+ * writes the answer on the response (`kpiLayout`), so no reader guesses which
50
+ * branch ran; `readKpiFigure` applies it to the card only before a response
51
+ * arrives.
52
+ */
53
+ export declare function resolveKpiLayout(input: {
54
+ config?: Pick<CardConfig, 'metricColumns' | 'groupByColumns'>;
55
+ }): KpiLayout;
56
+ /**
57
+ * A config KPI's result rows. Every row names its measure; `current` is a
58
+ * measure's value and `comparison` its prior or target, in every branch.
59
+ */
60
+ export type KpiResultSegment = {
61
+ segment: 'current' | 'comparison';
62
+ value: number | string | null;
63
+ metricId: string;
64
+ };
65
+ /** The metadata a config KPI response carries beside its rows. */
66
+ export type KpiResultMetadata = {
67
+ kpiLayout: KpiLayout;
68
+ comparisonMetadata?: ComparisonMetadataMap;
69
+ };
70
+ /** The id a row names its measure by (`id`, else `name`): the server writes it, the owner reads it. */
71
+ export declare function kpiSegmentMetricId(metric: Pick<MetricField, 'id' | 'name'>): string;
72
+ export type KpiComparison = {
73
+ /** A SQL KPI's prior (its second numeric column) reads as the previous period. */
74
+ kind: 'previous_period' | 'previous_year' | 'target';
75
+ /** "Previous", "Target" or `comparisonPresentation.labelName`. */
76
+ label: string;
77
+ /** False when the author turned it off (`comparisonPresentation.showComparison`). */
78
+ shown: boolean;
79
+ /** From `evaluateMetricComparison`, the only source of a change (KV-D8). */
80
+ evaluation: MetricComparisonEvaluation;
81
+ };
82
+ export type KpiFigure = {
83
+ /** Undefined for a config KPI with no measure. */
84
+ shape?: KpiShape;
85
+ /** `value` for a SQL KPI; the response's `kpiLayout` for a config KPI. */
86
+ layout: KpiLayout;
87
+ /** Null when the response has no number for the value (and the surface gave no `missingValue`). */
88
+ value: number | null;
89
+ /** Why the response has no number: none at all, or values that aren't numbers. */
90
+ missing?: 'no_value' | 'not_numeric';
91
+ /** The `value` layout's comparison, when the card compares and the response has one. */
92
+ comparison?: KpiComparison;
93
+ /** The `measures` layout's second and third measures and their values. */
94
+ others: ReadonlyArray<{
95
+ measure: MetricField;
96
+ value: number | null;
97
+ /** Against the value, when the author turned on the pair comparison (exactly two measures). */
98
+ evaluation?: MetricComparisonEvaluation;
99
+ }>;
100
+ /** A SQL KPI's result keys: the first numeric column is the value, the second the prior. */
101
+ resultKeys: {
102
+ value?: string;
103
+ previous?: string;
104
+ };
105
+ };
106
+ type KpiRecords = readonly Record<string, unknown>[] | null | undefined;
107
+ /** A finite number from a numeric value or a numeric string (thousands commas allowed). */
108
+ export declare function toFiniteKpiNumber(value: unknown): number | null;
109
+ /** A SQL KPI's result keys: its first numeric column is the value, the second the prior. */
110
+ export declare function sqlKpiResultKeys(records: KpiRecords): KpiFigure['resultKeys'];
111
+ /**
112
+ * The render card and its query response: what every renderer shows. A surface
113
+ * that shows a missing value as a number (the dashboard tiles show `0`) passes
114
+ * it as `missingValue`, and the value's evaluations use it too.
115
+ */
116
+ export declare function readKpiFigure(input: {
117
+ /** The query result's `renderCard` (live model formats included), never the saved card (column formats P5-12, P5-19). */
118
+ renderCard: KpiCard;
119
+ records?: KpiRecords;
120
+ metadata?: Partial<KpiResultMetadata>;
121
+ missingValue?: number;
122
+ }): KpiFigure;
123
+ export {};
@@ -0,0 +1,8 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { DroppedSetting } from '../card-settings/apply-card-settings.js';
3
+ import { MeasureCalculationsUpdate } from './resolve.js';
4
+ export type AppliedMeasureCalculations = {
5
+ card: TCard;
6
+ dropped: DroppedSetting[];
7
+ };
8
+ export declare function applyMeasureCalculations(card: TCard, update: MeasureCalculationsUpdate): AppliedMeasureCalculations;