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
@@ -1,9 +1 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-CbuVNDGi.js";
2
- import { C as f, E as D } from "../chunks/bookmark-state-CBSTdW6q.js";
3
- export {
4
- f as CONTROL_CARD_DEFAULT_VALUE,
5
- a as DisplayFormatPreferencesFields,
6
- D as EMPTY_SELECTION,
7
- s as ReportPreferencesDialog,
8
- o as Surfboard
9
- };
1
+ import{a,R as s,D as o}from"../chunks/report-preferences-dialog-B_gUmCzG.js";import{C as f,E as D}from"../chunks/bookmark-state-69YYnRql.js";export{f as CONTROL_CARD_DEFAULT_VALUE,a as DisplayFormatPreferencesFields,D as EMPTY_SELECTION,s as ReportPreferencesDialog,o as Surfboard};
@@ -1,6 +1,7 @@
1
1
  import { DefaultDateFilter, FixedDayDefaultDateFilter, FixedMonthDefaultDateFilter } from '../surfboard/filter/types.js';
2
2
  import { WeekStart } from '../../lib/types/token-types.js';
3
3
  import { CalendarContext } from '../../shared/report-runtime-context/index.js';
4
+ import { ComparisonWindowShape } from '../../shared/analytics-protocol/comparison-choices.js';
4
5
  /** Calendar inputs for defaults, including reproducible and fiscal reports. */
5
6
  export type DefaultDateCalendar = Pick<CalendarContext, 'tz' | 'weekStart'> & Partial<Pick<CalendarContext, 'anchor' | 'fiscalCalendar'>>;
6
7
  export declare const isFixedMonthDefaultDateFilter: (value: unknown) => value is FixedMonthDefaultDateFilter;
@@ -26,4 +27,11 @@ export declare const isSingleDayDefaultDateFilter: (value: DefaultDateFilter | u
26
27
  * other window would filter on dates the control doesn't show.
27
28
  */
28
29
  export declare const isSingleMonthDefaultDateFilter: (value: DefaultDateFilter | undefined) => boolean;
30
+ /**
31
+ * A date default's window for the Compare with menu (compare-with CW-D7): a
32
+ * relative default's shape, a fixed day, or a fixed calendar month. Read from
33
+ * the stored default itself, so a fixed default is never unknown (review
34
+ * P2R-05: a fixed month offered a week back that overlaps it).
35
+ */
36
+ export declare function defaultDateFilterComparisonShape(meta: DefaultDateFilter | undefined): ComparisonWindowShape | undefined;
29
37
  export declare function resolveDefaultDateFilterForDefaults(meta: DefaultDateFilter, calendar: string | DefaultDateCalendar, weekStart?: WeekStart): [Date, Date] | undefined;
@@ -1,88 +1 @@
1
- import { B as t, z as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, y as p, x as D, o as A, h as I, q as _, w as F, v as S, m as b, n as L, l as f, p as N, k as y, s as R, u as h, i as g, r as x, t as M } from "../chunks/bookmark-state-CBSTdW6q.js";
2
- import { C as V, D as w, L as z, d as U, g as k, e as B, h as K, f as v, c as Y, a as q, i as G, b as P, n as Q, s as W } from "../chunks/validators-ClWHpYql.js";
3
- import { D as J } from "../chunks/token-types-D_xKgyVS.js";
4
- import { r as H, a as Z } from "../chunks/pivot-result-identity-C1AOH1PS.js";
5
- import { D as ee } from "../chunks/report-runtime-context-E7USjN7E.js";
6
- const e = [
7
- "concatenate",
8
- "conditional-category",
9
- "date-part",
10
- "date-difference",
11
- "null-to-zero",
12
- "safe-ratio",
13
- "nested-conditional",
14
- "membership-test",
15
- "uppercase",
16
- "lowercase",
17
- "trim-whitespace",
18
- "replace-text",
19
- "first-characters",
20
- "character-count",
21
- "starts-with",
22
- "number-to-text",
23
- "start-of-month",
24
- "start-of-quarter",
25
- "start-of-year",
26
- "year-number",
27
- "add-days",
28
- "round-number",
29
- "round-down",
30
- "round-up",
31
- "absolute-value",
32
- "cap-maximum",
33
- "floor-minimum",
34
- "fill-blanks",
35
- "null-if-zero",
36
- "is-blank"
37
- ];
38
- export {
39
- t as BOOKMARK_STATE_VERSION,
40
- r as BOOKMARK_VISIBILITIES,
41
- V as CALCULATED_FIELD_ENTITY_MARKER,
42
- e as CALCULATED_FIELD_TEMPLATE_IDS,
43
- l as CONTROL_CARD_DEFAULT_VALUE,
44
- w as DATE_FORMAT_VALUES,
45
- ee as DEFAULT_CALENDAR_CONTEXT,
46
- J as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
47
- o as EMPTY_SELECTION,
48
- z as LEGACY_CALCULATED_FIELD_ENTITY_MARKER,
49
- i as VIEWER_LIMITS,
50
- n as VIEWER_TABLE_SETTINGS_VERSION,
51
- d as collectDatasetNamesFromExplorerField,
52
- m as collectDatasetNamesFromFilterGroup,
53
- u as collectExecutionDatasetNamesFromExplorerField,
54
- c as collectPreferredDatasetNamesFromExplorerField,
55
- E as collectQualifiedDatasetNamesFromExplorerField,
56
- C as datasetRefFromSource,
57
- T as dependencyDisplayIdentity,
58
- U as getCalculatedFieldComputeStage,
59
- p as getCustomizableTableCardIds,
60
- k as getFieldRuntimeColumnName,
61
- D as getSortableTableCardIds,
62
- B as hasCalculatedFieldMarker,
63
- K as hasCalculatedFormulaInputs,
64
- A as hasColumnCustomization,
65
- v as hasSyntheticCalculatedFieldOwner,
66
- I as humanizeDatasetName,
67
- Y as inspectCalculatedField,
68
- q as isCalculatedDimension,
69
- G as isCalculatedMetric,
70
- P as isDerivedField,
71
- _ as isEmptyViewerTableSettings,
72
- F as isTableCardCustomizable,
73
- S as isTableCardSortable,
74
- b as measureJsonBytes,
75
- Q as normalizeCalculatedFieldRepresentation,
76
- L as normalizeTableColumnOrder,
77
- f as normalizeViewerTableSettings,
78
- N as parseBookmarkState,
79
- y as parseTableColumnId,
80
- R as parseViewerTableSettings,
81
- h as parseViewerTableSettingsMap,
82
- g as readBookmarkState,
83
- x as resolveFieldDatasetDependencies,
84
- H as resolveQueryColumnKeyMapEntry,
85
- Z as resolveUniqueQueryColumnKeyMapEntry,
86
- W as shouldDropInheritedCalculationAggregate,
87
- M as toTableColumnId
88
- };
1
+ import{B as t,z as r,C as l,E as o,V as i,j as n,c as d,g as m,f as u,b as c,e as E,d as C,a as T,y as p,x as D,o as A,h as I,q as _,w as F,v as S,m as b,n as L,l as f,p as N,k as y,s as R,u as h,i as g,r as x,t as M}from"../chunks/bookmark-state-69YYnRql.js";import{C as V,D as w,L as z,d as U,g as k,e as B,h as K,f as v,c as Y,a as q,i as G,b as P,n as Q,s as W}from"../chunks/validators-CqV3Yka1.js";import{D as J}from"../chunks/token-types-Bj9iMy0w.js";import{r as H,a as Z}from"../chunks/pivot-result-identity-DTNCB--h.js";import{D as ee}from"../chunks/report-runtime-context-BWzIHCKK.js";const e=["concatenate","conditional-category","date-part","date-difference","null-to-zero","safe-ratio","nested-conditional","membership-test","uppercase","lowercase","trim-whitespace","replace-text","first-characters","character-count","starts-with","number-to-text","start-of-month","start-of-quarter","start-of-year","year-number","add-days","round-number","round-down","round-up","absolute-value","cap-maximum","floor-minimum","fill-blanks","null-if-zero","is-blank"];export{t as BOOKMARK_STATE_VERSION,r as BOOKMARK_VISIBILITIES,V as CALCULATED_FIELD_ENTITY_MARKER,e as CALCULATED_FIELD_TEMPLATE_IDS,l as CONTROL_CARD_DEFAULT_VALUE,w as DATE_FORMAT_VALUES,ee as DEFAULT_CALENDAR_CONTEXT,J as DEFAULT_SEMANTIC_DOMAIN_ACCESS,o as EMPTY_SELECTION,z as LEGACY_CALCULATED_FIELD_ENTITY_MARKER,i as VIEWER_LIMITS,n as VIEWER_TABLE_SETTINGS_VERSION,d as collectDatasetNamesFromExplorerField,m as collectDatasetNamesFromFilterGroup,u as collectExecutionDatasetNamesFromExplorerField,c as collectPreferredDatasetNamesFromExplorerField,E as collectQualifiedDatasetNamesFromExplorerField,C as datasetRefFromSource,T as dependencyDisplayIdentity,U as getCalculatedFieldComputeStage,p as getCustomizableTableCardIds,k as getFieldRuntimeColumnName,D as getSortableTableCardIds,B as hasCalculatedFieldMarker,K as hasCalculatedFormulaInputs,A as hasColumnCustomization,v as hasSyntheticCalculatedFieldOwner,I as humanizeDatasetName,Y as inspectCalculatedField,q as isCalculatedDimension,G as isCalculatedMetric,P as isDerivedField,_ as isEmptyViewerTableSettings,F as isTableCardCustomizable,S as isTableCardSortable,b as measureJsonBytes,Q as normalizeCalculatedFieldRepresentation,L as normalizeTableColumnOrder,f as normalizeViewerTableSettings,N as parseBookmarkState,y as parseTableColumnId,R as parseViewerTableSettings,h as parseViewerTableSettingsMap,g as readBookmarkState,x as resolveFieldDatasetDependencies,H as resolveQueryColumnKeyMapEntry,Z as resolveUniqueQueryColumnKeyMapEntry,W as shouldDropInheritedCalculationAggregate,M as toTableColumnId};
@@ -1,5 +1,4 @@
1
1
  import { DocumentDefinition, DocumentKpiSection, DocumentSection, DocumentTableSection, DocumentTextContent, DocumentTextRegionBlock, DocumentTextStyle, TCard, TDashboard } from '../types/common-types.js';
2
- import { Field } from '../types/explorer-types.js';
3
2
  import { DashboardCardLocation } from '../../shared/dashboard-authoring/document-section-cards.js';
4
3
  import { DocumentPanelTarget } from './document-panel-target.js';
5
4
  import { DocumentIdFactory, DocumentSectionKindId } from './document-section-kinds.js';
@@ -71,7 +70,6 @@ export type DocumentEdit = {
71
70
  sectionId: string;
72
71
  oldCardId: string;
73
72
  card: TCard;
74
- calculatedFields?: Field[];
75
73
  }
76
74
  /** A placeholder KPI when neither `card` nor `source` is given. */
77
75
  | {
@@ -100,8 +98,6 @@ export type DocumentEditResult = {
100
98
  document: DocumentDefinition;
101
99
  /** Where the panel goes next: the inserted, moved or edited section, or a removed section's neighbor. */
102
100
  target: DocumentPanelTarget;
103
- /** The sheet's full calculated fields after a copy brought new ones; persist as the sheet's list. */
104
- calculatedFields?: Field[];
105
101
  /** Card ids removed (`to: null`) or replaced by a new id, for reference cleanup. */
106
102
  retargetedCardIds?: Array<{
107
103
  from: string;
@@ -0,0 +1,32 @@
1
+ import { TFilter } from '../../components/surfboard/filter/types.js';
2
+ import { DataSource, Field } from '../types/explorer-types.js';
3
+ export type CardFilterDefinition = Pick<TFilter, 'column' | 'title' | 'dataType' | 'nativeDataType' | 'qualifiedTableName' | 'connectionId' | 'operation' | 'sql' | 'fieldMeta' | 'semanticContext'> & {
4
+ table: string;
5
+ database: string;
6
+ };
7
+ /**
8
+ * The source a card's filters are built against: its data source and its
9
+ * connection, read in one order for every caller (the card filter builder's
10
+ * value browse, a pinned filter, a column filter). The editor's picked
11
+ * connection leads, then the data source's, then the card's own, since a card
12
+ * may store its connection only at card level.
13
+ */
14
+ export declare function cardFilterSource(card: {
15
+ dataSource?: DataSource | null;
16
+ connectionId?: string;
17
+ }, selectedConnectionId?: string): {
18
+ dataSource?: DataSource | null;
19
+ connectionId?: string;
20
+ };
21
+ /**
22
+ * The one mapping from an explorer `Field` on a card to the filter
23
+ * definition the filter-values route understands.
24
+ *
25
+ * Used for card inline filters and for browsing values inside the card
26
+ * filter builder, so both read the same catalog coordinates (semantic
27
+ * context, field metadata, qualified table) for the same field.
28
+ */
29
+ export declare function buildCardFilterDefinition(field: Field, source: {
30
+ dataSource?: DataSource | null;
31
+ connectionId?: string;
32
+ }): CardFilterDefinition;
@@ -187,6 +187,15 @@ export type DashboardFilterCardReach =
187
187
  | 'relationship'
188
188
  /** A server-side resolver confirmed the route the card will apply (RF-D15). */
189
189
  | 'relationshipApplied' | 'notApplicable';
190
+ /** The reaches a reader counts as reaching the card: bound, the card's own field, a SQL card's plain helper, a confirmed route. */
191
+ export type DashboardFilterCardReached = 'bound' | 'automatic' | 'sql' | 'relationshipApplied';
192
+ /**
193
+ * Whether a reach is one a reader counts as reaching the card: the one rule
194
+ * the MCP outline, the filter pickers and an agent's pinned filter read
195
+ * (dashboard filter fields DF-D2). `relationship` (decided when the card runs)
196
+ * and `sqlTemplate` (decided by the card's SQL) are never counted.
197
+ */
198
+ export declare function isFilterCardReached(reach: DashboardFilterCardReach): reach is DashboardFilterCardReached;
190
199
  /**
191
200
  * Why a filter in scope doesn't reach a card: a relationship resolver's
192
201
  * reason, or `sql_no_filter_reference` for a SQL card whose SQL names no
@@ -480,7 +480,6 @@ type Actions = {
480
480
  updateFrame: (sheetId: string, frame: TFrame, options?: {
481
481
  semanticExecutionPayload?: SemanticExecutionPayload;
482
482
  }) => void;
483
- updateSheetCalculatedFields: (sheetId: string, calculatedFields: Field[]) => void;
484
483
  updateDashboardCalculatedFields: (calculatedFields: Field[]) => void;
485
484
  /** Whether the field changes a Document section card's edit made would apply with that card committed; asked before writing it. */
486
485
  checkCalculatedFieldOps: (card: TCard, replacingCardId: string) => {
@@ -1,12 +1,17 @@
1
- import { CardConfig, DataSource, GroupByField, MetricField, FilterGroup, Join, PivotByField, SortByField } from '../types/explorer-types.js';
1
+ import { CardConfig, DataSource, GroupByField, MetricField, FilterGroup, PivotByField, SortByField } from '../types/explorer-types.js';
2
2
  import { TCard, TFrame } from '../types/common-types.js';
3
3
  import { EditorStore } from './editor-store.js';
4
+ import { ReachedDatasetInfo } from '../../shared/dashboard-authoring/card-data-source/card-base.js';
5
+ /** A config write's context: the domain's datasets, when the writer has them (ledger P9-04). */
6
+ export type CardWriteOptions = {
7
+ datasets?: readonly ReachedDatasetInfo[];
8
+ };
4
9
  export interface ExplorerActions {
5
10
  updateFrame: (updates: Partial<TFrame>) => void;
6
11
  setActiveCardInFrame: (cardId: string) => void;
7
12
  addCard: () => void;
8
13
  removeCard: (cardId: string) => void;
9
- updateCard: (cardId: string, updates: Partial<TCard>) => void;
14
+ updateCard: (cardId: string, updates: Partial<TCard>, options?: CardWriteOptions) => void;
10
15
  setActiveCard: (cardId: string) => void;
11
16
  setActiveTabCard: (cardId: string | null) => void;
12
17
  updateDataSource: (dataSource: DataSource) => void;
@@ -37,9 +42,5 @@ export interface ExplorerActions {
37
42
  updateSortByColumn: (cardId: string, columnId: string, updates: Partial<SortByField>) => void;
38
43
  updateFilters: (cardId: string, filters: FilterGroup) => void;
39
44
  clearFilters: (cardId: string) => void;
40
- addJoin: (cardId: string, join: Join) => void;
41
- removeJoin: (cardId: string, joinId: string) => void;
42
- updateJoin: (cardId: string, joinId: string, updates: Partial<Join>) => void;
43
- reorderJoins: (cardId: string, joinIds: string[]) => void;
44
45
  }
45
46
  export declare const createExplorerActions: (set: (fn: (draft: EditorStore) => void) => void, get: () => EditorStore) => ExplorerActions;
@@ -1431,7 +1431,6 @@ export type TFrame = {
1431
1431
  filterId?: string;
1432
1432
  cards: TCard[];
1433
1433
  activeCardId: string;
1434
- calculatedFields?: Field[];
1435
1434
  };
1436
1435
  export type DocumentPageSetup = {
1437
1436
  size: 'letter' | 'a4';
@@ -1626,7 +1625,6 @@ export type TSheet = {
1626
1625
  customizedBreakpoints?: CustomizableBreakpoint[];
1627
1626
  cards?: TCard[];
1628
1627
  frames?: TFrame[];
1629
- calculatedFields?: Field[];
1630
1628
  document?: DocumentDefinition;
1631
1629
  };
1632
1630
  export type TEvent = {
@@ -28,7 +28,7 @@ import { StoredRelativeDate } from '../../shared/analytics-protocol/relative-dat
28
28
  export declare const CALCULATED_FIELD_ENTITY_MARKER: "SEMAPHOR_CALCULATED_FIELD";
29
29
  export declare const LEGACY_CALCULATED_FIELD_ENTITY_MARKER: "calculated_fields";
30
30
  export type CardMode = 'explorer' | 'dev';
31
- export type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
31
+ export type FieldScope = 'card' | 'dashboard' | 'domain';
32
32
  export type SemanticTemporalPresentation = {
33
33
  granularity: SemaphorTimeGrain;
34
34
  format: TemporalBucketFormat;
@@ -1,13 +1,4 @@
1
- /**
2
- * Joinability types: the response of GET /api/v1/domains/[domainId]/joinability,
3
- * used by field draggability states in the query builder.
4
- *
5
- * The domain template contract (datasets, fields, metrics, relationships) has one
6
- * owner, semaphor-app (`src/lib/semantic/template/contract.ts`); it is not copied
7
- * here. If a react-semaphor consumer ever needs template types, move the contract
8
- * into react-semaphor's shared contracts and have the app import it, rather than
9
- * copy it (domain template 2.1, ledger P2-20).
10
- */
1
+ import { JoinReachMap } from '../../shared/dashboard-authoring/card-data-source/join-reach.js';
11
2
  /**
12
3
  * Joinability map for a semantic domain
13
4
  *
@@ -72,6 +63,11 @@ export interface JoinabilityMap {
72
63
  export interface JoinabilityMapResponse {
73
64
  /** Lightweight joinability map for field state calculation */
74
65
  joinabilityMap: JoinabilityMap;
66
+ /**
67
+ * Per dataset, the datasets a card based on it reaches and the keys each
68
+ * step joins on, as the query would join them (one base per card OB-D15).
69
+ */
70
+ reach: JoinReachMap;
75
71
  /** Minimal dataset information */
76
72
  datasets: Array<{
77
73
  name: string;
@@ -5,6 +5,7 @@ import { resolveFieldDatasetDependencies, FieldDatasetDependency } from './field
5
5
  import { getQualifiedEntityName } from './qualified-entity-name.js';
6
6
  export interface DatasetIdentityAlias {
7
7
  name: string;
8
+ label?: string | null;
8
9
  table?: string | null;
9
10
  catalog?: string | null;
10
11
  schema?: string | null;
@@ -90,7 +91,12 @@ export interface FieldStateContext {
90
91
  selectedFields: Field[];
91
92
  joinPlan?: JoinPlan;
92
93
  autoJoinMetadata?: AutoJoinMetadata;
93
- baseEntityName?: string;
94
+ /**
95
+ * The card's base (`cardBaseEntity`), read through the same identity as
96
+ * every other dataset here: a direct table by its qualified name, a domain
97
+ * dataset by its name (ledger P9-02, P9-07).
98
+ */
99
+ baseEntity?: DatasetAnchorRef;
94
100
  datasetAliases?: DatasetIdentityAlias[];
95
101
  /**
96
102
  * Whether the card reads from a semantic domain. Drives the fallback when
@@ -140,22 +146,4 @@ export declare function getFieldStateCopy(state: FieldDraggableState | undefined
140
146
  * dataset
141
147
  */
142
148
  export declare function calculateFieldState(field: Field, context: FieldStateContext): FieldStateResult;
143
- /** One data-source dataset's connection to the visual's base, for the Datasets panel. */
144
- export interface DataSourceConnection {
145
- /** Dataset identity (name in semantic mode, qualified table in physical). */
146
- entityName: string;
147
- label: string;
148
- state: FieldDraggableState;
149
- reason?: string;
150
- action?: string;
151
- mentions?: string[];
152
- }
153
- /**
154
- * How each selected dataset connects to the visual's base dataset, using
155
- * the same identity, base cascade, and per-dataset evaluation as the field
156
- * list. The Datasets panel shows this at selection time so the customer
157
- * learns about an unconnected dataset before the first drag. Order and
158
- * verdicts match `calculateFieldState` for a field of that dataset.
159
- */
160
- export declare function describeDataSourceConnections(context: FieldStateContext): DataSourceConnection[];
161
149
  export { resolveFieldDatasetDependencies, type FieldDatasetDependency };
@@ -1431,16 +1431,22 @@ export declare const semaphorMetricResultSchema: z.ZodObject<{
1431
1431
  missingMeasures: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1432
1432
  comparison: z.ZodOptional<z.ZodObject<{
1433
1433
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1434
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1435
+ words: z.ZodOptional<z.ZodString>;
1434
1436
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1435
1437
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1436
1438
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1437
1439
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1438
1440
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1441
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1442
+ words: z.ZodOptional<z.ZodString>;
1439
1443
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1440
1444
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1441
1445
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1442
1446
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1443
1447
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1448
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1449
+ words: z.ZodOptional<z.ZodString>;
1444
1450
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1445
1451
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1446
1452
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
@@ -1481,16 +1487,22 @@ export declare const semaphorMetricResultSchema: z.ZodObject<{
1481
1487
  missingMeasures: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1482
1488
  comparison: z.ZodOptional<z.ZodObject<{
1483
1489
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1490
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1491
+ words: z.ZodOptional<z.ZodString>;
1484
1492
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1485
1493
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1486
1494
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1487
1495
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1488
1496
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1497
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1498
+ words: z.ZodOptional<z.ZodString>;
1489
1499
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1490
1500
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1491
1501
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1492
1502
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1493
1503
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1504
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1505
+ words: z.ZodOptional<z.ZodString>;
1494
1506
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1495
1507
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1496
1508
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
@@ -1531,16 +1543,22 @@ export declare const semaphorMetricResultSchema: z.ZodObject<{
1531
1543
  missingMeasures: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1532
1544
  comparison: z.ZodOptional<z.ZodObject<{
1533
1545
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1546
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1547
+ words: z.ZodOptional<z.ZodString>;
1534
1548
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1535
1549
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1536
1550
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1537
1551
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1538
1552
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1553
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1554
+ words: z.ZodOptional<z.ZodString>;
1539
1555
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1540
1556
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1541
1557
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1542
1558
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1543
1559
  kind: z.ZodEnum<["previous_period", "previous_year", "target"]>;
1560
+ /** What it compared with, as a card names it (compare-with CW-D24). */
1561
+ words: z.ZodOptional<z.ZodString>;
1544
1562
  value: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>>;
1545
1563
  delta: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
1546
1564
  deltaPercent: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
@@ -5,6 +5,7 @@ export declare const SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT: {
5
5
  readonly responseDetail: "responseDetail";
6
6
  readonly mode: "string";
7
7
  readonly comparisonKind: "string";
8
+ readonly comparisonWords: "string";
8
9
  readonly executionResult: "executionResult";
9
10
  readonly compiledQuery: "unknown";
10
11
  readonly data: "unknown";
@@ -66,6 +67,8 @@ export type SemaphorAnalyzeResult = Partial<Record<SemaphorAnalyzeResultFieldNam
66
67
  responseDetail?: SemaphorAnalyzeResponseDetail;
67
68
  mode?: string;
68
69
  comparisonKind?: string;
70
+ /** What the comparison compared with, as a card names it: "Same day last week · Nov 6, until 8:06 AM" (compare-with CW-D24). */
71
+ comparisonWords?: string;
69
72
  executionResult?: SemaphorAnalyticsExecutionResult;
70
73
  compiledQuery?: SemaphorCompiledQuery;
71
74
  data?: unknown;
@@ -0,0 +1,92 @@
1
+ import { ComparisonShiftSpec, ComparisonUnit, ResolvedDateWindow } from './metric-comparison.js';
2
+ import { DateUnit, RelativeDateUnit, RelativeDateWindow } from './relative-date/index.js';
3
+ import { TemporalCalendar } from '../temporal/calendar-periods.js';
4
+ /** A calendar unit a comparison can step by. */
5
+ export type ComparisonCalendarUnit = Exclude<ComparisonUnit, 'period'>;
6
+ /**
7
+ * What the choices need to know about a window: the days it covers (a
8
+ * month counts its average length), and the calendar period it is when it is exactly one (Today, This month,
9
+ * Last quarter). Absent with no window.
10
+ */
11
+ export type ComparisonWindowShape = {
12
+ days: number;
13
+ period?: DateUnit;
14
+ /** A window counted in some unit other than days (the last 3 months, the last 6 hours): its count and unit, for its words (review P2R-02). */
15
+ count?: number;
16
+ unit?: RelativeDateUnit;
17
+ /**
18
+ * The fewest days the window can span, when that is less than `days` (a
19
+ * month 28, three months 89, twelve months 365): "certainly overlaps" is
20
+ * judged on it, so a step that fits in a short month is never refused.
21
+ */
22
+ fewestDays?: number;
23
+ };
24
+ /**
25
+ * What a surface has for the window a comparison applies to (compare-with
26
+ * CW-D15): a relative window as stored, a fixed day or month default, two
27
+ * dates as a filter stores them (the end included: a picked range's last
28
+ * instant, or a date-only day), or a run's resolved window (end exclusive).
29
+ */
30
+ export type ComparisonWindowSource = {
31
+ kind: 'relative';
32
+ window: unknown;
33
+ } | {
34
+ kind: 'fixedDay';
35
+ }
36
+ /** `month` 0 to 11, as the month picker saves it. */
37
+ | {
38
+ kind: 'fixedMonth';
39
+ year: number;
40
+ month: number;
41
+ }
42
+ /** `calendar`, when the caller knows the report's: a range that is exactly one calendar period is named by it, as placement steps it. */
43
+ | {
44
+ kind: 'range';
45
+ start: unknown;
46
+ end: unknown;
47
+ calendar?: TemporalCalendar | null;
48
+ } | {
49
+ kind: 'resolved';
50
+ window: ResolvedDateWindow;
51
+ calendar?: TemporalCalendar | null;
52
+ };
53
+ /**
54
+ * The one owner of a comparison window's shape (compare-with CW-D15, hotspot
55
+ * H-1): every surface (the Date filter's footer, chip and configuration
56
+ * panel, the card editor, the MCP) maps what it has to a source and asks
57
+ * here, so the days counted, the end included and the unit a window is named
58
+ * in are decided once. Undefined when the source has no finite window.
59
+ */
60
+ export declare function comparisonWindowShape(source: ComparisonWindowSource | undefined): ComparisonWindowShape | undefined;
61
+ /**
62
+ * What a current window is, for naming its comparison, where the run plans it
63
+ * (compare-with CW-D12, CW-D15; ledger P4-11): the window the user picked when
64
+ * one governs, else the whole range on the report calendar. Never the window
65
+ * the run counted: that is cut at the run instant while it is still running,
66
+ * and would name a running month "Previous 13 days".
67
+ */
68
+ export declare function plannedWindowShape(input: {
69
+ picked?: RelativeDateWindow;
70
+ whole?: ResolvedDateWindow;
71
+ calendar?: TemporalCalendar | null;
72
+ }): ComparisonWindowShape | undefined;
73
+ /**
74
+ * Whether a step back certainly lands on days the window still covers, for
75
+ * the control's note: previous period never does; a fixed step does when even
76
+ * its longest step is shorter than the window (a week back from This month).
77
+ * Placement decides on the dates (a month back from the last 30 days may
78
+ * fit); unknown with no window: false.
79
+ */
80
+ export declare function comparisonOverlaps(spec: ComparisonShiftSpec, shape: ComparisonWindowShape | undefined): boolean;
81
+ /**
82
+ * The steps a window is offered, in menu order (CW-D7, CW-D14): previous
83
+ * period always; then each calendar unit one step of which is longer than
84
+ * the window (so it cannot overlap, nor equal the previous period) and which
85
+ * is not the window's own period (a week back from
86
+ * This week is the previous period). A day step is never listed: on a day
87
+ * it is the previous period, on anything longer it overlaps. With no window,
88
+ * every unit.
89
+ */
90
+ export declare function offeredComparisons(shape: ComparisonWindowShape | undefined): ComparisonShiftSpec[];
91
+ /** The units a custom step may name, in menu order. */
92
+ export declare const CUSTOM_COMPARISON_UNITS: readonly ComparisonCalendarUnit[];
@@ -0,0 +1,30 @@
1
+ import { TemporalCalendar, TemporalShift } from '../temporal/calendar-periods.js';
2
+ import { DateColumnKind, DateWindowBasis } from './date-window.js';
3
+ import { ResolvedDateWindow, StoredViewerPeriodComparisonSpec } from './metric-comparison.js';
4
+ export type ComparisonWindowPlacementResult = {
5
+ status: 'resolved';
6
+ currentWindow: ResolvedDateWindow;
7
+ comparisonWindow: ResolvedDateWindow;
8
+ /** How far back the comparison window sits (CK-D4). */
9
+ step: TemporalShift;
10
+ } | {
11
+ status: 'unavailable';
12
+ reason: 'finite_current_window_required' | 'current_window_not_started' | 'temporal_binding_invalid' | 'insufficient_history' | 'overlaps_current_window';
13
+ };
14
+ /** The comparison window for a step back from the current window, or why there is none. */
15
+ export declare function placeComparisonWindow(input: {
16
+ currentWindow: ResolvedDateWindow | undefined;
17
+ /** A step back, in any stored shape: read through the one reader here (compare-with CW-D5). */
18
+ spec: StoredViewerPeriodComparisonSpec;
19
+ /** The date column the windows filter: a DATE column counts whole days. */
20
+ column: DateColumnKind;
21
+ referenceTime: Date;
22
+ /**
23
+ * What the current window is (CK-D2). An `anchored` window (Year to last
24
+ * completed month) compares with the same completed subperiods `offset`
25
+ * spans earlier (relative-date-as-of SPEC 3.3, AO-D26).
26
+ */
27
+ basis: DateWindowBasis;
28
+ weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6;
29
+ fiscalCalendar?: TemporalCalendar['fiscalCalendar'];
30
+ }): ComparisonWindowPlacementResult;
@@ -4,6 +4,7 @@ import { matrixResultSchema } from './matrix-window-contract.js';
4
4
  import { CalendarContext } from '../report-runtime-context/index.js';
5
5
  import { RelativeDateWindowInput } from './relative-date/index.js';
6
6
  import { SemaphorQueryConstraints } from './applied-constraints.js';
7
+ import { ComparisonFamily, MetricComparisonSpec } from './metric-comparison.js';
7
8
  export type SemaphorProtocolVersion = 1;
8
9
  export type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
9
10
  export type SemaphorSourceLevel = 'database' | 'schema' | 'table';
@@ -419,10 +420,12 @@ export type SemaphorMetricIntent = {
419
420
  timeWindow?: SemaphorTimeWindow;
420
421
  dimensions?: SemaphorFieldRef[];
421
422
  filters?: SemaphorAnalyticsFilter[];
422
- comparison?: {
423
- kind: 'previous_period' | 'previous_year' | 'target';
424
- targetValue?: number;
425
- };
423
+ /**
424
+ * One comparison for the analysis, in the words a card measure takes
425
+ * (compare-with CW-D24): a step back (`{ kind: 'shift', unit, offset?,
426
+ * matchWeekdays? }`) or a target.
427
+ */
428
+ comparison?: MetricComparisonSpec;
426
429
  analysis?: SemaphorMetricAnalysis;
427
430
  orderBy?: {
428
431
  field: SemaphorFieldRef;
@@ -633,7 +636,10 @@ export type SemaphorMetricResult = SemaphorAnalyticsResultBase & {
633
636
  primaryValue: number | string | null;
634
637
  missingMeasures?: string[];
635
638
  comparison?: {
636
- kind: NonNullable<SemaphorMetricIntent['comparison']>['kind'];
639
+ /** previous_year for a step by years, previous_period for any other step, or target. */
640
+ kind: ComparisonFamily;
641
+ /** What it compared with, named for the window (`describeComparison`): "Same day last week". */
642
+ words?: string;
637
643
  value?: number | string | null;
638
644
  delta?: number | null;
639
645
  deltaPercent?: number | null;