react-semaphor 0.1.602 → 0.1.604

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 (211) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1451
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4491
  72. package/dist/format-utils/index.js +1 -424
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/document/document-edits.d.ts +0 -4
  85. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  86. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  87. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  88. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  89. package/dist/types/lib/types/common-types.d.ts +0 -2
  90. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  91. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  92. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  93. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  94. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  95. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  96. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  97. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  98. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  99. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  100. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  101. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  102. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  103. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  104. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  105. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  106. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  114. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  117. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  119. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  120. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  121. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  122. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  123. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  124. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  125. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  126. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  127. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  128. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  129. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  130. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  131. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  132. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  133. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  134. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  135. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  136. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  137. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  141. package/dist/types/shared/format-utils/index.d.ts +1 -0
  142. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  143. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  144. package/dist/types/shared/temporal/index.d.ts +2 -0
  145. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  146. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  147. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  148. package/dist/usage-events/index.js +1 -285
  149. package/dist/value-format-preferences/index.js +1 -635
  150. package/package.json +6 -2
  151. package/dist/chunks/add-to-dashboard-ClhEIFst.js +0 -291
  152. package/dist/chunks/analytics-base-schemas-DevrgqQb.js +0 -678
  153. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  154. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  155. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  156. package/dist/chunks/assistant-chat-BWF3GYip.js +0 -6115
  157. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  158. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  159. package/dist/chunks/bookmark-impact-BF3iRx5a.js +0 -76
  160. package/dist/chunks/bookmark-state-CBSTdW6q.js +0 -1666
  161. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  162. package/dist/chunks/card-filter-builder-B8XHwMY6.js +0 -4069
  163. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  164. package/dist/chunks/comparison-window-caption-W83qB4V5.js +0 -741
  165. package/dist/chunks/context-BJoEFgNl.js +0 -369
  166. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  167. package/dist/chunks/dashboard-DG5EIYYB.js +0 -14
  168. package/dist/chunks/dashboard-briefing-launcher-CBSrhyWZ.js +0 -4875
  169. package/dist/chunks/dashboard-controls-D6ECO4N1.js +0 -2290
  170. package/dist/chunks/dashboard-json-DrJftBSL.js +0 -66
  171. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  172. package/dist/chunks/edit-9df1zOWe.js +0 -226
  173. package/dist/chunks/edit-dashboard-visual-BDYAJIbb.js +0 -18605
  174. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  175. package/dist/chunks/filter-line-BXT6y303.js +0 -703
  176. package/dist/chunks/filter-reach-copy-BukhZmzm.js +0 -5250
  177. package/dist/chunks/filter-value-text-D3-bf3_b.js +0 -153
  178. package/dist/chunks/index-BVKzKl5d.js +0 -90
  179. package/dist/chunks/index-BW0yozjs.js +0 -2795
  180. package/dist/chunks/index-CV_Kzou0.js +0 -595
  181. package/dist/chunks/layout-grid-Ds0diMeY.js +0 -16
  182. package/dist/chunks/matrix-analytical-definition-CgQgVeeI.js +0 -1162
  183. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  184. package/dist/chunks/matrix-operation-contract--DkNCOzd.js +0 -1412
  185. package/dist/chunks/metric-comparison-zMylnIkc.js +0 -541
  186. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  187. package/dist/chunks/paintbrush-CX8pao1j.js +0 -27
  188. package/dist/chunks/palette-CuA0HlzF.js +0 -23
  189. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  190. package/dist/chunks/pivot-result-contract-expectations-C8KL7hPx.js +0 -5046
  191. package/dist/chunks/pivot-result-identity-C1AOH1PS.js +0 -77
  192. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  193. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  194. package/dist/chunks/report-preferences-dialog-CbuVNDGi.js +0 -1637
  195. package/dist/chunks/report-runtime-context-E7USjN7E.js +0 -388
  196. package/dist/chunks/resolve-dashboard-input-context-CULCE_hM.js +0 -25172
  197. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  198. package/dist/chunks/save-BKHlDONy.js +0 -21
  199. package/dist/chunks/saved-dashboard-context-C1WlOx5z.js +0 -632
  200. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  201. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
  202. package/dist/chunks/semaphor-ready-indicator-CBIRcDWs.js +0 -145326
  203. package/dist/chunks/shelf-drop-preview-context-xR69SMA8.js +0 -2466
  204. package/dist/chunks/stored-dashboard-BuM8vnWf.js +0 -4070
  205. package/dist/chunks/style-sheet-parts-Bt9ZNre8.js +0 -8674
  206. package/dist/chunks/table-export-sheet-DVljtHkG.js +0 -949
  207. package/dist/chunks/token-types-D_xKgyVS.js +0 -8
  208. package/dist/chunks/upload-Dll_M7XQ.js +0 -15
  209. package/dist/chunks/validators-ClWHpYql.js +0 -3686
  210. package/dist/chunks/variable-draft-CDGGl53R.js +0 -242
  211. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -0,0 +1,114 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { DatabaseEntityReference, Field, Join, JoinPlan, MetricField } from '../../../lib/types/explorer-types.js';
3
+ type Entity = DatabaseEntityReference;
4
+ /** One condition: a column of the table joined from, an operator, a column of the joined table. */
5
+ export type JoinConditionDraft = {
6
+ from: string;
7
+ operator: string;
8
+ to: string;
9
+ };
10
+ /** Conditions that hold together (AND) or any of which holds (OR); sets combine with AND. */
11
+ export type JoinSetDraft = {
12
+ operator: 'AND' | 'OR';
13
+ conditions: JoinConditionDraft[];
14
+ };
15
+ export type JoinMatches = NonNullable<Join['relationshipCardinality']>;
16
+ export type CardJoinDraft = {
17
+ /** The table joined from: the base or a table already joined. */
18
+ from: Entity;
19
+ /** The table joined. */
20
+ to: Entity;
21
+ joinType: Join['joinType'];
22
+ sets: JoinSetDraft[];
23
+ /** Not set until the author states it (OB-D10). */
24
+ matches?: JoinMatches;
25
+ };
26
+ /** A table as the join dialog's selects name it (connection, type, name, database, schema); a dataset whole. */
27
+ export declare function joinTableReference(entity: Entity): Entity;
28
+ /** The join a draft states. */
29
+ export declare function joinFromDraft(draft: CardJoinDraft, at: {
30
+ id: string;
31
+ sequence: number;
32
+ createId: () => string;
33
+ }): Join;
34
+ /** The draft a saved join reads as, for editing. */
35
+ export declare function draftFromJoin(join: Join, entityOf: (name: string) => Entity | undefined): CardJoinDraft;
36
+ /** A join's match count from the table it joins from, a reverse stamp read flipped (ledger P5-06). */
37
+ export declare function joinMatches(join: Pick<Join, 'relationshipCardinality' | 'relationshipTraversalDirection'>): JoinMatches | undefined;
38
+ /**
39
+ * A join today's dialog refuses (ledger P2-10): the base itself, or a table
40
+ * already on the card's joins (one alias per table). The one rule the dialog
41
+ * and any later caller read.
42
+ */
43
+ export declare function joinTargetRefusal(card: TCard, base: Entity, to: Entity, replacingJoinId?: string): string | undefined;
44
+ /** The card with the draft joined (OB-D8): after its last join; the joined table added to the selection. */
45
+ export declare function addCardJoin(input: {
46
+ card: TCard;
47
+ base: Entity;
48
+ draft: CardJoinDraft;
49
+ catalog: readonly Field[];
50
+ createId: () => string;
51
+ /**
52
+ * The joins a semantic card's query makes today, when it has none of its
53
+ * own: its first join of its own keeps them, so what the card already
54
+ * joins keeps joining (ledger P5-07).
55
+ */
56
+ resolvedPlan?: JoinPlan;
57
+ }): TCard;
58
+ export type CardJoinRemoval = {
59
+ card: TCard;
60
+ /** The joins removed: the join and every join from the tables it brought. */
61
+ joins: Join[];
62
+ /** Placed fields removed because they read a removed table. */
63
+ removed: Field[];
64
+ /** Measures that stayed but lost a table calculation the card can no longer run (P9-03). */
65
+ calculations?: MetricField[];
66
+ };
67
+ /**
68
+ * The card without the join and every join from the tables it brought, and
69
+ * without the fields that read those tables (OB-D7, OB-T-9). The tables leave
70
+ * the selection; no join left means no join plan. A Matrix card's plan is its
71
+ * definition's (`withAuthoredCardJoinPlan`); its measures aren't on the field
72
+ * walk, so they stay for the definition's own check, as the old join manager
73
+ * left them (ledger P5-02).
74
+ */
75
+ export declare function removeCardJoin(card: TCard, joinId: string): CardJoinRemoval;
76
+ /**
77
+ * Start over (ledger P7-12): the card back to its base alone. Every join goes
78
+ * as Remove join removes it (the fields that read a joined table with it,
79
+ * filters included), then the shelves are emptied as Clear fields empties
80
+ * them. The base, and filters on the base, stay. Not for Matrix, whose
81
+ * fields live in its definition.
82
+ */
83
+ export declare function startCardOver(card: TCard): {
84
+ card: TCard;
85
+ joins: Join[];
86
+ fields: number;
87
+ };
88
+ /**
89
+ * The card with a join changed. The same joined table keeps its place, its
90
+ * joins and the fields that read it; another table is a new join, so the old
91
+ * one is removed as Remove join removes it.
92
+ */
93
+ export declare function updateCardJoin(input: {
94
+ card: TCard;
95
+ base: Entity;
96
+ joinId: string;
97
+ draft: CardJoinDraft;
98
+ catalog: readonly Field[];
99
+ createId: () => string;
100
+ }): CardJoinRemoval;
101
+ /**
102
+ * The condition a new join starts from (the author can change it): the
103
+ * joined-from table's `<to>_id` to the joined table's `id`, or the other way
104
+ * round, else a column both tables have (a key-like `_id` one first), else
105
+ * their first columns.
106
+ */
107
+ export declare function suggestJoinCondition(from: {
108
+ name: string;
109
+ columns: readonly string[];
110
+ }, to: {
111
+ name: string;
112
+ columns: readonly string[];
113
+ }): JoinConditionDraft | undefined;
114
+ export {};
@@ -0,0 +1,12 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { Field, MetricField } from '../../../lib/types/explorer-types.js';
3
+ export type PrunedCard = {
4
+ card: TCard;
5
+ /** Fields removed, as placed: the writer's decisions and the measures whose own condition went. */
6
+ removed: Field[];
7
+ /** Measures that kept their place but lost their table calculation. */
8
+ calculations: MetricField[];
9
+ };
10
+ export declare function pruneCardFields(card: TCard, decide: (field: Field) => Field | null): PrunedCard;
11
+ /** The words a toast adds for table calculations removed with the fields. */
12
+ export declare function calculationsRemovedWords(calculations: readonly MetricField[]): string;
@@ -0,0 +1,60 @@
1
+ import { TDataColumn } from '../../../lib/types/common-types.js';
2
+ import { Field } from '../../../lib/types/explorer-types.js';
3
+ import { FilterFieldFolder } from './filter-field-folders.js';
4
+ /** A dashboard or Document filter, or a card's pinned filter. */
5
+ export type FilterFieldPurpose = 'dashboard' | 'pinned';
6
+ /** One source's `/v1/columns` answer. */
7
+ export type FilterFieldColumnsResponse = {
8
+ columns?: TDataColumn[];
9
+ calculatedFields?: Field[];
10
+ } | undefined;
11
+ export type FilterFieldCatalog = {
12
+ /** Each folder's fields, by folder key. */
13
+ byKey: Map<string, Field[]>;
14
+ /** Calculated fields over several datasets, each with the folder whose source a filter on it stores (its domain's, the first it reads). */
15
+ several: Array<{
16
+ field: Field;
17
+ folderKey?: string;
18
+ }>;
19
+ };
20
+ /**
21
+ * A calculated field the picker may offer once the server says it reaches a
22
+ * card (DF-D11): its key in the per-card read, the folder it sits in (the one
23
+ * domain dataset it reads, when that dataset has a folder) and the folder
24
+ * whose source a filter on it stores.
25
+ */
26
+ export type FilterFieldCalculatedCandidate = {
27
+ key: string;
28
+ field: Field;
29
+ folderKey?: string;
30
+ homeKey?: string;
31
+ };
32
+ type CatalogInput = {
33
+ folders: readonly FilterFieldFolder[];
34
+ /** Each folder's columns response, by folder key. */
35
+ responses: ReadonlyMap<string, FilterFieldColumnsResponse>;
36
+ /** The dashboard's calculated fields. */
37
+ dashboardCalculated?: readonly Field[];
38
+ /** A pinned filter's card: its own calculated fields, on its domain. */
39
+ cardCalculated?: {
40
+ fields: readonly Field[];
41
+ domainId?: string;
42
+ };
43
+ purpose: FilterFieldPurpose;
44
+ };
45
+ /**
46
+ * The calculated fields a picker could offer, each placed by source identity
47
+ * (domain plus dataset): a domain's calculations once per domain by the field
48
+ * list's namespace rule, the dashboard's by their inputs, a pinned card's own
49
+ * on its domain. Whether each is offered is the server's decision (DF-D11).
50
+ */
51
+ export declare function filterFieldCalculatedCandidates(input: CatalogInput): FilterFieldCalculatedCandidate[];
52
+ export declare function filterFieldCatalog(input: CatalogInput & {
53
+ /**
54
+ * The cards each candidate reaches, by key, from the per-card read
55
+ * (DF-D11). A calculated field is offered only when it reaches one of
56
+ * the picker's cards; before the read answers, none is.
57
+ */
58
+ calculatedReach?: ReadonlyMap<string, readonly string[]>;
59
+ }): FilterFieldCatalog;
60
+ export {};
@@ -0,0 +1,132 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { DataSource, DatabaseEntityReference, Field } from '../../../lib/types/explorer-types.js';
3
+ type Entity = DatabaseEntityReference;
4
+ /** How one card is reached from a folder's dataset. */
5
+ export type FilterFolderCard = {
6
+ cardId: string;
7
+ title: string;
8
+ /** The card's base, as the folder list names it. */
9
+ baseLabel: string;
10
+ /** The key fields on the card's side, nearest step first; empty on the base itself. */
11
+ keys: readonly string[];
12
+ /** Reached through one of the card's own joins. */
13
+ throughJoin?: boolean;
14
+ /** The folder's dataset or table is the card's base. */
15
+ onBase?: boolean;
16
+ };
17
+ export type FilterFieldFolder = {
18
+ /** Stable identity: the domain and dataset, or the table's connection and qualified name. */
19
+ key: string;
20
+ label: string;
21
+ /** The source the folder's fields are read from and a filter on them stores (DF-D5). */
22
+ source: Entity;
23
+ domainId?: string;
24
+ /** A direct table: no domain relationships. */
25
+ direct: boolean;
26
+ section: 'onSheet' | 'related';
27
+ cards: readonly FilterFolderCard[];
28
+ /** Chosen from Browse all data: listed whether or not it reaches a card (DF-D6). */
29
+ picked?: boolean;
30
+ };
31
+ /** A card as the per-card read takes it: what decides a filter's reach on it, a draft included. */
32
+ export type FilterFieldReachCard = Pick<TCard, 'id' | 'title' | 'type' | 'dataSource' | 'config' | 'sql'>;
33
+ /**
34
+ * A calculated field a filter picker would offer, decided per card by the
35
+ * same decision as a dataset (review P8-01): the field as the catalog has it
36
+ * and the source a filter on it would store.
37
+ */
38
+ export type FilterFieldReachCandidate = {
39
+ key: string;
40
+ field: Field;
41
+ source: DataSource;
42
+ };
43
+ export type FilterFieldReachRequest = {
44
+ cards: FilterFieldReachCard[];
45
+ fields?: FilterFieldReachCandidate[];
46
+ };
47
+ /** A domain dataset a filter can be on, and each card a filter on it reaches. */
48
+ export type FilterFieldReachDataset = {
49
+ domainId: string;
50
+ name: string;
51
+ label: string;
52
+ type?: string;
53
+ table?: string | null;
54
+ schema?: string | null;
55
+ catalog?: string | null;
56
+ cards: Array<{
57
+ cardId: string;
58
+ /** Reached through a relationship route: the key fields on the card's side, nearest step first (labels). */
59
+ keys?: string[];
60
+ }>;
61
+ };
62
+ /** The per-card read's answer (DF-D2): each dataset's cards, and each candidate field's (DF-D11). */
63
+ export type FilterFieldReachResponse = {
64
+ datasets: FilterFieldReachDataset[];
65
+ fields?: Array<{
66
+ key: string;
67
+ cards: string[];
68
+ }>;
69
+ };
70
+ /**
71
+ * A card as the per-card read decides it, with only what decides it: its
72
+ * domain read the one way every surface reads it
73
+ * (`getDataSourceSemanticDomainId`: the source's, else the one its datasets
74
+ * name) and stated on its source, so a new visual whose domain sits on its
75
+ * dataset is decided like any other (review P8-02). The browser builds the
76
+ * request with it and the server reads every card through it again.
77
+ */
78
+ export declare function filterFieldReachCard(card: FilterFieldReachCard): FilterFieldReachCard;
79
+ /**
80
+ * The cards the per-card read decides: every card with a base. Datasets are
81
+ * decided on a domain's cards; a candidate field on every card (a table
82
+ * card's own calculations included).
83
+ */
84
+ export declare function filterFieldReachCards(cards: readonly TCard[]): FilterFieldReachCard[];
85
+ /** Reads a `/api/v1/filter-fields/reach` body; anything malformed is no answer. */
86
+ export declare function readFilterFieldReachResponse(body: unknown): FilterFieldReachResponse | undefined;
87
+ export type FilterFieldFoldersInput = {
88
+ /** The cards a filter added here can reach: a sheet's, a Document's, or one card's. */
89
+ cards: readonly TCard[];
90
+ /** The server's per-card decision on the domains' datasets, once it answers; before, no dataset folder. */
91
+ reach: FilterFieldReachResponse | undefined;
92
+ /** The server's decision on each table folder (`filterFieldTables`), by folder key: the cards it reaches. */
93
+ tableReach?: ReadonlyMap<string, readonly string[]>;
94
+ };
95
+ /**
96
+ * A folder's identity for a source: a domain dataset by its domain and name,
97
+ * a table by its connection and qualified name. The folders and a source
98
+ * picked from Browse all data compare by it (review P6-03).
99
+ */
100
+ export declare function filterFolderKey(source: Entity): string;
101
+ /** A card with a source a filter can reach: its base. */
102
+ export declare function filterableCards(cards: readonly TCard[]): TCard[];
103
+ /**
104
+ * The tables the cards' table cards read, each once: the table folders a
105
+ * picker may list. Whether each reaches a card is the server's decision
106
+ * (`tableReach`); this only names the candidates and their sources.
107
+ */
108
+ export declare function filterFieldTables(cards: readonly TCard[]): FilterFieldFolder[];
109
+ /** The folders, On this sheet first, then Related; most cards reached first, then most built on it, then by label. */
110
+ export declare function filterFieldFolders(input: FilterFieldFoldersInput): FilterFieldFolder[];
111
+ /**
112
+ * The data source a filter added from a folder stores (DF-D5): the folder's
113
+ * own dataset on its domain, or its own table; never another card's source.
114
+ */
115
+ export declare function filterFolderDataSource(folder: Pick<FilterFieldFolder, 'source' | 'domainId' | 'direct'>): DataSource;
116
+ /** "6 cards", or "4 of 6 cards": a folder header's reach (DF-D4). */
117
+ export declare function filterReachCount(folder: Pick<FilterFieldFolder, 'cards'>, total: number): string;
118
+ /**
119
+ * The reach line under the list for a highlighted folder or field (DF-D4):
120
+ * the cards it filters, grouped by base with the keys it goes through, and
121
+ * the cards it leaves unfiltered; for a direct table, how to reach one.
122
+ */
123
+ export declare function filterReachLine(input: {
124
+ folder: FilterFieldFolder;
125
+ /** Every card a filter here could reach (the sheet's or the Document's). */
126
+ cards: readonly Pick<TCard, 'id' | 'title'>[];
127
+ /** The highlighted field's label, when a field is highlighted. */
128
+ fieldLabel?: string;
129
+ /** A key field's label on the card's base. */
130
+ keyLabel?: (baseLabel: string, field: string) => string;
131
+ }): string;
132
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './join-reach.js';
2
+ export * from './card-field-folders.js';
3
+ export * from './card-base.js';
4
+ export * from './card-joins.js';
5
+ export * from './card-prune.js';
6
+ export * from './filter-field-folders.js';
7
+ export * from './filter-field-catalog.js';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * What a semantic dataset reaches, as a card's query would join it (one base
3
+ * per card OB-D15). Served beside the joinability map by
4
+ * GET /api/v1/domains/[domainId]/joinability and built by the app's reach
5
+ * module (`relatedDatasetsFrom`, rule `card`), so the editor has no path
6
+ * finder of its own. The field list puts each reached dataset in a folder at
7
+ * the key its last step joins on (OB-D5).
8
+ */
9
+ /** One relationship crossed on the way, from the dataset nearer the base to the next. */
10
+ export interface JoinReachStep {
11
+ from: string;
12
+ to: string;
13
+ relationshipId?: string;
14
+ relationshipName?: string;
15
+ /** The relationship's fields on `from`'s side, in key order. One field: the folder stands at it. */
16
+ nearFields: string[];
17
+ /** The relationship's fields on `to`'s side, in the same order (a Needs setup join starts from them). */
18
+ farFields: string[];
19
+ /**
20
+ * The step lands on `to`'s whole primary key, so the near field refers to
21
+ * a `to` row ("Customer ID" → Customer): the folder may take the key's name.
22
+ */
23
+ towardKey?: true;
24
+ }
25
+ export interface JoinReach {
26
+ dataset: string;
27
+ steps: JoinReachStep[];
28
+ /**
29
+ * Reached only through an active relationship that doesn't join
30
+ * automatically (OB-D9): a Needs setup folder. One step.
31
+ */
32
+ needsSetup?: true;
33
+ /**
34
+ * Reached in two hops through more than one dataset: which way the query
35
+ * joins it depends on what else the card reads, so its folder stands at
36
+ * the base's top level, after the base's fields, never under one route
37
+ * (ledger P1-05).
38
+ */
39
+ alternateRoutes?: true;
40
+ }
41
+ /** Per base dataset, the datasets it reaches, nearest first. */
42
+ export type JoinReachMap = Record<string, JoinReach[]>;
@@ -0,0 +1,28 @@
1
+ import { TCard } from '../../lib/types/common-types.js';
2
+ import { Field } from '../../lib/types/explorer-types.js';
3
+ export declare const CARD_FIELD_SHELVES: readonly ["metricColumns", "groupByColumns", "detailColumns", "sortByColumns", "pivotByColumns"];
4
+ /**
5
+ * The Detail table backup's shelves: the Table shelves a Detail table keeps
6
+ * to restore when it switches back (`table-type-switch.ts`). Its fields are
7
+ * the card's too, so the walk covers them (ledger P8-02).
8
+ */
9
+ export declare const DETAIL_BACKUP_SHELVES: readonly ["metricColumns", "groupByColumns", "sortByColumns", "pivotByColumns"];
10
+ /**
11
+ * A card config's shelves, emptied, with the Detail table backup: what Clear
12
+ * fields writes (one base per card, ledger P7-12, P8-02). Filters stay.
13
+ */
14
+ export declare function clearedCardShelves(): Record<(typeof CARD_FIELD_SHELVES)[number], []> & {
15
+ detailTableBackup: undefined;
16
+ };
17
+ export type CardFieldPlace = 'column' | 'filter';
18
+ /**
19
+ * `onRemoved`: the writer removes sources from the card (a base switch,
20
+ * Remove join, Start over): a column one of whose own conditions (an
21
+ * attribute filter) can't be kept goes with it, rather than change meaning
22
+ * quietly, and is reported for the writer to list (ledger P8-07). Without it
23
+ * (calculated field edits, whose own rule drops the condition and keeps the
24
+ * measure), the condition alone goes.
25
+ */
26
+ export declare function mapCardFieldPlaces(card: TCard, map: (field: Field, place: CardFieldPlace) => Field | null, onRemoved?: (column: Field) => void): TCard;
27
+ /** Each field the card holds, once per place. */
28
+ export declare function cardFieldsInPlaces(card: TCard): Field[];
@@ -89,6 +89,14 @@ export declare function writeAxisConfig(preferences: TCardPreferences | undefine
89
89
  * labels and position are kept as they are.
90
90
  */
91
91
  export declare function writeComparisonDisplay(preferences: TCardPreferences | undefined, display: ResolvedComparisonDisplay): TCardPreferences;
92
+ /**
93
+ * The card's comparisons no longer saved hidden (compare-with CW-D28): the
94
+ * stored `showComparison` goes, and the presentation with it when nothing
95
+ * else is left. Each measure's own state says what it shows.
96
+ */
97
+ /** Whether a two-metric KPI compares its first metric with the second (compare-with CW-D29): `true` stored, the key removed when off. */
98
+ export declare function writeMetricPairComparison(preferences: TCardPreferences | undefined, on: boolean): TCardPreferences;
99
+ export declare function writeComparisonsUnhidden(preferences: TCardPreferences | undefined): TCardPreferences;
92
100
  /**
93
101
  * An edit of the comparison panel's fields, as the comparison panel and the
94
102
  * table's settings make it: what a word states (show, mode, precision)
@@ -1,6 +1,6 @@
1
1
  import { TCard } from '../../../lib/types/common-types.js';
2
2
  import { CardType } from '../changes/card-types.js';
3
- export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'inheritComparison' | 'trend' | 'trendGrain' | 'seeRecords' | 'columnOrder' | 'columnFilters' | 'tableSearch';
3
+ export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'trend' | 'trendGrain' | 'seeRecords' | 'columnOrder' | 'columnFilters' | 'tableSearch';
4
4
  export declare const SETTINGS_BY_KIND: Readonly<Record<CardType, readonly SettingName[]>>;
5
5
  export type CardSettingsKind = {
6
6
  type: CardType;
@@ -36,6 +36,7 @@ export type AxisInput = {
36
36
  export type LegendPosition = 'top' | 'bottom' | 'left' | 'right';
37
37
  /** How a card shows its comparisons (RC-D4): a patch of the card's one comparison display. */
38
38
  export type ComparisonDisplayInput = {
39
+ /** Retired (compare-with CW-D28): refused; a measure set to off shows none. */
39
40
  show?: boolean;
40
41
  mode?: 'difference' | 'percent_change' | 'both' | 'ratio';
41
42
  /** Decimals of a percent change or ratio, an integer 0 to 6; null returns to the surface's default. */
@@ -79,7 +80,7 @@ export type CardSettingsInput = {
79
80
  y?: AxisInput;
80
81
  };
81
82
  comparisonDisplay?: ComparisonDisplayInput;
82
- /** false: measures without a comparison of their own ignore the dashboard's; true removes the stored opt-out (RC-D16). */
83
+ /** Retired (compare-with CW-D18): refused; each measure's comparison says whether it follows the Date filter. */
83
84
  inheritComparison?: boolean;
84
85
  /** A KPI's Trend switch (KPI trend window KT-D16): on draws its trend on the date it counts (KT-D1); off follows the summary and target. */
85
86
  trend?: boolean;
@@ -16,7 +16,6 @@ export type ResolvedColumnSettings = {
16
16
  };
17
17
  /** Only the comparison display fields that change; precision null removes the stored precision (RC-D4). */
18
18
  export type ResolvedComparisonDisplay = {
19
- show?: boolean;
20
19
  mode?: ComparisonDisplayInput['mode'];
21
20
  precision?: number | null;
22
21
  };
@@ -51,8 +50,6 @@ export type ResolvedCardSettings = {
51
50
  remove?: string[];
52
51
  };
53
52
  comparisonDisplay?: ResolvedComparisonDisplay;
54
- /** Whether measures without a comparison of their own follow the dashboard's (RC-D16). */
55
- inheritComparison?: boolean;
56
53
  /** A KPI's Trend switch (KT-D16). */
57
54
  trend?: boolean;
58
55
  /** A KPI trend's grain (KT-D12); null returns it to Automatic. */