react-semaphor 0.1.526 → 0.1.527

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 (175) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1179 -296
  3. package/dist/brand-studio/index.js +15 -15
  4. package/dist/briefings/index.js +50 -49
  5. package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DEhjPSr-.js} +66 -65
  6. package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BlIbwkuD.js} +68 -65
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-JNHR0_cZ.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-D9pFByPh.js} +372 -359
  10. package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-CJI5ZWMq.js} +739 -686
  11. package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DLdrFry-.js} +10 -10
  12. package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-D5LjWle1.js} +6603 -6572
  13. package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-G91NQKxU.js} +266 -267
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-DeVQLIsP.js} +19 -19
  15. package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
  16. package/dist/chunks/{index-CbjuruKe.js → index-BvJOYbNv.js} +755 -745
  17. package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
  18. package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DY45yiUM.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BypfLZsK.js} +11 -11
  20. package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
  21. package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-BoKU3MzZ.js} +655 -511
  22. package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
  23. package/dist/chunks/matrix-operation-contract-BV02rLhu.js +809 -0
  24. package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
  25. package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
  26. package/dist/chunks/pivot-header-presentation-D5v8uyjj.js +618 -0
  27. package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-BWrPhlGT.js} +259 -204
  29. package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
  30. package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
  31. package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
  32. package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-D3hxu4sE.js} +131 -132
  33. package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
  34. package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-C7Um5XN-.js} +47 -26
  35. package/dist/chunks/semantic-format-BjBMOSoo.js +192 -0
  36. package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-D46I_4g7.js} +49895 -46141
  37. package/dist/chunks/{slider-BYIH4icg.js → slider-B6LELqx6.js} +81 -82
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/switch-_7uBAbYx.js +24003 -0
  40. package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
  41. package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
  42. package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
  43. package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
  44. package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
  45. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  46. package/dist/dashboard/index.js +1 -1
  47. package/dist/dashboard-authoring/index.js +138 -137
  48. package/dist/data-app-sdk/index.js +12 -12
  49. package/dist/data-app-sdk-adapters/index.js +23 -22
  50. package/dist/data-app-sdk-validation/index.js +27 -26
  51. package/dist/format-utils/index.js +247 -329
  52. package/dist/index.js +165 -168
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +1 -1
  56. package/dist/types/briefings/index.d.ts +3 -0
  57. package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
  58. package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
  59. package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
  60. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
  61. package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
  62. package/dist/types/components/surfboard/filter/types.d.ts +8 -29
  63. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
  64. package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
  65. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
  66. package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
  67. package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
  68. package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
  69. package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
  70. package/dist/types/index.js +5 -5
  71. package/dist/types/lib/api/exports-api.d.ts +3 -0
  72. package/dist/types/lib/csv-download.d.ts +9 -0
  73. package/dist/types/lib/csv-encoding-options.d.ts +6 -0
  74. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
  75. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
  76. package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
  77. package/dist/types/lib/export-utils.d.ts +17 -15
  78. package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
  79. package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
  80. package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
  81. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  82. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
  83. package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
  84. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
  85. package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
  86. package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
  87. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
  88. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
  89. package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
  90. package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
  91. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
  92. package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
  93. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
  94. package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
  95. package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
  96. package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
  97. package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
  98. package/dist/types/lib/types/common-types.d.ts +5 -0
  99. package/dist/types/lib/types/explorer-types.d.ts +14 -0
  100. package/dist/types/lib/types/token-types.d.ts +0 -1
  101. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  102. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  103. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  104. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  105. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  106. package/dist/types/shared/analytics-protocol/contracts.d.ts +10 -7
  107. package/dist/types/shared/analytics-protocol/index.d.ts +12 -1
  108. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  109. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  110. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  111. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +51 -5
  112. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  113. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  114. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  115. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  116. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  117. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  118. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  119. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  120. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  121. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  122. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  123. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  124. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  125. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  126. package/dist/types/shared/temporal/index.d.ts +5 -0
  127. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  128. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  129. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  130. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  131. package/package.json +1 -17
  132. package/src/data-app-sdk/README.md +6 -3
  133. package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
  134. package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
  135. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  136. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  137. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  138. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  139. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  140. package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
  141. package/dist/chunks/search-CJz-QQ0Q.js +0 -24
  142. package/dist/chunks/switch-XaAACBrJ.js +0 -2234
  143. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  144. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  145. package/dist/data-app-builder/index.js +0 -3666
  146. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  147. package/dist/data-app-codegen/index.js +0 -22
  148. package/dist/data-app-codegen-node/index.js +0 -1807
  149. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  150. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  151. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  152. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  153. package/dist/types/data-app-builder/constants.d.ts +0 -14
  154. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  155. package/dist/types/data-app-builder/index.d.ts +0 -1
  156. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  157. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  158. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  159. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  160. package/dist/types/data-app-builder/types.d.ts +0 -558
  161. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  162. package/dist/types/data-app-builder.d.ts +0 -2
  163. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  164. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  165. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  166. package/dist/types/data-app-codegen/index.d.ts +0 -6
  167. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  168. package/dist/types/data-app-codegen/node.d.ts +0 -2
  169. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  170. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  171. package/dist/types/data-app-codegen-node.d.ts +0 -2
  172. package/dist/types/data-app-codegen.d.ts +0 -2
  173. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  174. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  175. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -1,4 +1,5 @@
1
1
  import { MatrixConfig, MatrixViewState } from '../../shared/analytics-protocol/index.js';
2
+ import { CsvEncoding } from '../../shared/format-utils/exporters/csv-utils.js';
2
3
  import { MatrixExportContent } from '../../shared/dashboard-authoring/matrix-delivery.js';
3
4
  import { ReportRuntimeContext } from '../../shared/report-runtime-context/index.js';
4
5
  import { CompiledCardQueryContext } from '../query-context/build-card-query-context.js';
@@ -34,6 +35,8 @@ export declare function buildMatrixDeliveryPayload(input: {
34
35
  content: MatrixExportContent;
35
36
  format: 'csv' | 'pdf';
36
37
  delimiter: ',' | ';' | '\t';
38
+ /** CSV only; absent lets the app resolve the dashboard's setting. */
39
+ csvEncoding?: CsvEncoding;
37
40
  includeHeaders: boolean;
38
41
  }): {
39
42
  controlValues: Record<string, unknown>;
@@ -64,7 +67,7 @@ export declare function buildMatrixDeliveryPayload(input: {
64
67
  levelId: string;
65
68
  axis: "columns" | "rows";
66
69
  direction: "asc" | "desc";
67
- nulls: "first" | "last";
70
+ nulls: "last" | "first";
68
71
  }[] | undefined;
69
72
  runtimeFilters?: import('../types/explorer-types.js').FilterGroup | undefined;
70
73
  } & {
@@ -381,7 +384,7 @@ export declare function buildMatrixDeliveryPayload(input: {
381
384
  levelId: string;
382
385
  axis: "columns" | "rows";
383
386
  direction: "asc" | "desc";
384
- nulls: "first" | "last";
387
+ nulls: "last" | "first";
385
388
  }[];
386
389
  rankings: readonly import('../../shared/analytics-protocol/index.js').MatrixRanking[];
387
390
  filters?: import('../types/explorer-types.js').FilterGroup | undefined;
@@ -733,7 +736,7 @@ export declare function buildMatrixDeliveryPayload(input: {
733
736
  levelId: string;
734
737
  axis: "columns" | "rows";
735
738
  direction: "asc" | "desc";
736
- nulls: "first" | "last";
739
+ nulls: "last" | "first";
737
740
  }[];
738
741
  rankings: readonly import('../../shared/analytics-protocol/index.js').MatrixRanking[];
739
742
  filters?: import('../types/explorer-types.js').FilterGroup | undefined;
@@ -747,6 +750,7 @@ export declare function buildMatrixDeliveryPayload(input: {
747
750
  includeHeaders: boolean;
748
751
  timezone: string;
749
752
  presentationExecutionSnapshot: import('../../shared/format-utils/index.js').PresentationExecutionSnapshot;
753
+ csvEncoding?: "utf-8-bom" | "utf-8" | undefined;
750
754
  acquisition?: "continuation" | undefined;
751
755
  };
752
756
  };
@@ -2,6 +2,7 @@ import { CompiledCardQueryContext } from '../query-context/build-card-query-cont
2
2
  import { ReportRuntimeContext } from '../../shared/report-runtime-context/index.js';
3
3
  import { MatrixWindowExecutor } from './matrix-runtime-types.js';
4
4
  import { MatrixOperationQueue } from './matrix-operation-queue.js';
5
+ import { MatrixDatasetHistory } from './matrix-dataset-history.js';
5
6
  export type MatrixExecutionEnvironment = {
6
7
  ready: boolean;
7
8
  /** Existing auth/project scope identity, never a token in the query key. */
@@ -15,4 +16,5 @@ export type MatrixExecutionEnvironment = {
15
16
  };
16
17
  export declare const MatrixExecutionContext: import('react').Context<(MatrixExecutionEnvironment & {
17
18
  queue: MatrixOperationQueue;
19
+ history: MatrixDatasetHistory;
18
20
  }) | null>;
@@ -1,3 +1,6 @@
1
1
  import { MatrixExecutionEnvironment } from './matrix-execution-context.js';
2
- /** The dashboard endpoint owns auth and grounding; no data/SQL reconstruction here. */
2
+ /**
3
+ * The dashboard endpoint owns auth and grounding; no data/SQL reconstruction
4
+ * here. Successful windows arrive indexed (efficiency plan E-D8).
5
+ */
3
6
  export declare function createMatrixQueryTransport(endpoint: string, token: string): MatrixExecutionEnvironment['execute'];
@@ -1,4 +1,4 @@
1
- import { MatrixAxis, MatrixAxisPage, MatrixCoordinate, MatrixFailure, MatrixPageRequest, MatrixPath, MatrixPresentation, MatrixSpec, MatrixViewState, MatrixWindow, MatrixWindowOutcome, MatrixWindowRequest, SemaphorScalarValue } from '../../shared/analytics-protocol/index.js';
1
+ import { MatrixAxis, MatrixAxisPage, MatrixCellBlock, MatrixCoordinate, MatrixFailure, MatrixPageRequest, MatrixPath, MatrixPresentation, MatrixSpec, MatrixViewState, MatrixWindow, MatrixIndexedWindowOutcome, MatrixWindowRequest, OperationTemporalState, SemaphorScalarValue } from '../../shared/analytics-protocol/index.js';
2
2
  export type MatrixRuntimeError = {
3
3
  failure: MatrixFailure;
4
4
  retryKey: string | null;
@@ -53,15 +53,110 @@ export type MatrixAxisItem = {
53
53
  error: MatrixRuntimeError;
54
54
  };
55
55
  };
56
+ /**
57
+ * Slots are per runtime; a copied dataset duplicates them. The loaded data a
58
+ * slot points to (request, page, coverage, values) is replaced whole, never
59
+ * modified, so copies may share it (efficiency plan E-INV-6).
60
+ */
56
61
  export type MatrixPageSlot = {
57
62
  key: string;
58
- request: MatrixPageRequest;
63
+ request: Readonly<MatrixPageRequest>;
59
64
  ordinal: number;
60
- data?: MatrixAxisPage;
65
+ data?: Readonly<MatrixAxisPage>;
66
+ status: 'idle' | 'loading' | 'ready' | 'failed';
67
+ error?: MatrixRuntimeError;
68
+ touched: number;
69
+ bytes: number;
70
+ };
71
+ /** A loaded cell tile: one row owner (page or singleton path) by one column owner. */
72
+ export type MatrixTileSlot = {
73
+ key: string;
74
+ rowOwner: string;
75
+ columnOwner: string;
76
+ rows: readonly MatrixPath[];
77
+ columns: readonly MatrixPath[];
61
78
  status: 'idle' | 'loading' | 'ready' | 'failed';
62
79
  error?: MatrixRuntimeError;
80
+ coverage?: Readonly<MatrixCellBlock['coverage']>;
81
+ /**
82
+ * Present values by position in `coverage`, keyed
83
+ * `(row * columns + column) * measures + measure`; absent means no data.
84
+ */
85
+ values: ReadonlyMap<number, Readonly<MatrixCellBlock['cells'][number]['value']>>;
86
+ /** Coverage positions by row key, column key and measure id, for `readCell`. */
87
+ positions?: MatrixTilePositions;
63
88
  touched: number;
64
89
  bytes: number;
90
+ cells: number;
91
+ };
92
+ export type MatrixTilePositions = {
93
+ rows: ReadonlyMap<string, number>;
94
+ columns: ReadonlyMap<string, number>;
95
+ measures: ReadonlyMap<string, number>;
96
+ };
97
+ /** Resident usage in every retention dimension. Bytes are serialized payload, never heap. */
98
+ export type MatrixUsage = {
99
+ pages: number;
100
+ blocks: number;
101
+ cells: number;
102
+ bytes: number;
103
+ };
104
+ /**
105
+ * One card's loaded data for one query identity and sort order. It holds only
106
+ * ready pages and tiles, never failed or loading ones. It is in one runtime or
107
+ * in the dataset History, never both; a seeded runtime holds its own copy.
108
+ */
109
+ export type MatrixDataset = {
110
+ /** The effective sort order it was acquired under. */
111
+ sorts: string;
112
+ /** The card generation it belongs to; a refresh makes it unusable. */
113
+ generation: number;
114
+ /** When its oldest piece was fetched; saving or restoring never resets it. */
115
+ fetchedAt: number;
116
+ queryIdentity: string;
117
+ descriptors: MatrixWindow['descriptors'];
118
+ pages: readonly MatrixPageSlot[];
119
+ tiles: readonly MatrixTileSlot[];
120
+ usage: MatrixUsage;
121
+ /**
122
+ * The operation state its first response reported (analytics kernel K14):
123
+ * every later page and expansion of this dataset runs on it, so a restored
124
+ * or seeded dataset continues on the same instant.
125
+ */
126
+ temporalState?: OperationTemporalState;
127
+ };
128
+ /** What a mounted runtime exposes to History. */
129
+ export type MatrixLiveView = {
130
+ usage: () => MatrixUsage;
131
+ /** A copy of its ready pieces, or nothing while it has none or is in an error state. */
132
+ snapshot: () => MatrixDataset | undefined;
133
+ };
134
+ /** How one runtime keeps and restores its card's datasets for one query identity. */
135
+ export type MatrixDatasetRetention = {
136
+ now(): number;
137
+ /** The card generation a dataset starting now belongs to. */
138
+ generation(): number;
139
+ /**
140
+ * A restorable dataset for these sorts: a saved one, else a copy of another
141
+ * live view's. A pure read, safe during render.
142
+ */
143
+ peek(sorts: string): MatrixDataset | undefined;
144
+ /**
145
+ * Takes ownership of a peeked dataset (a saved one leaves History; a live
146
+ * copy leaves its source untouched); false when it is gone, stale or expired.
147
+ */
148
+ adopt(dataset: MatrixDataset): boolean;
149
+ /** Moves a stopped dataset into History; a stale generation or scope is rejected. */
150
+ save(dataset: MatrixDataset): void;
151
+ /** Clears the card's History and returns the card's new generation. */
152
+ invalidate(): number;
153
+ /**
154
+ * Registers this runtime as a live view: its usage counts against the card's
155
+ * History allowance, and its snapshot may seed another view of the card.
156
+ */
157
+ register(view: MatrixLiveView): () => void;
158
+ /** Live usage grew; History re-fits the card's allowance. */
159
+ usageChanged(): void;
65
160
  };
66
161
  export type MatrixRuntimeSnapshot = {
67
162
  rows: readonly MatrixAxisItem[];
@@ -107,7 +202,13 @@ export type MatrixWindowExecutor = (input: {
107
202
  spec: MatrixSpec;
108
203
  window: MatrixWindowRequest;
109
204
  signal: AbortSignal;
110
- }) => Promise<MatrixWindowOutcome>;
205
+ /** The acquisition's state once its first response reported one. */
206
+ temporalState?: OperationTemporalState;
207
+ }) => Promise<MatrixWindowExecution>;
208
+ /** A window outcome and the operation state the server ran it on. */
209
+ export type MatrixWindowExecution = MatrixIndexedWindowOutcome & {
210
+ temporalState?: OperationTemporalState;
211
+ };
111
212
  export type MatrixRuntimeInput = {
112
213
  spec: MatrixSpec;
113
214
  presentation: MatrixPresentation;
@@ -1,10 +1,11 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  import { MatrixAxis, MatrixCoordinate, MatrixPath, MatrixSort, MatrixViewState } from '../../shared/analytics-protocol/index.js';
3
- import { MatrixCellAddress, MatrixCellState, MatrixRuntimeInput, MatrixRuntimeSnapshot, MatrixViewport, MatrixVisibleCoverage, MatrixWindowExecutor } from './matrix-runtime-types.js';
3
+ import { MatrixCellAddress, MatrixCellState, MatrixDatasetRetention, MatrixRuntimeInput, MatrixRuntimeSnapshot, MatrixViewport, MatrixVisibleCoverage, MatrixWindowExecutor } from './matrix-runtime-types.js';
4
4
  /** Owns acquisition, errors, generation fencing and retention for exactly one card. */
5
5
  export declare class MatrixRuntimeController {
6
6
  private query;
7
7
  private execute;
8
+ private retention;
8
9
  private readonly prefix;
9
10
  private listeners;
10
11
  private pages;
@@ -19,6 +20,12 @@ export declare class MatrixRuntimeController {
19
20
  private mounted;
20
21
  private scheduled;
21
22
  private queryIdentity?;
23
+ /**
24
+ * The acquisition's operation state (analytics kernel K14): until its first
25
+ * response reports one, the generation runs one request at a time; after,
26
+ * every page and expansion sends it, so they all run on one instant.
27
+ */
28
+ private temporalState?;
22
29
  private error?;
23
30
  private notice?;
24
31
  private blockingFailures;
@@ -28,12 +35,24 @@ export declare class MatrixRuntimeController {
28
35
  private view;
29
36
  private spec;
30
37
  private snapshot;
31
- constructor(input: MatrixRuntimeInput, query: QueryClient, execute: MatrixWindowExecutor, session?: MatrixViewState);
38
+ /** Card generation of the current dataset; set when the dataset starts. */
39
+ private datasetGeneration;
40
+ /** Fetch time of the current dataset's oldest piece. */
41
+ private datasetFetchedAt?;
42
+ /** Installed at construction, adopted from History when the runtime starts. */
43
+ private restored?;
44
+ private unregister?;
45
+ constructor(input: MatrixRuntimeInput, query: QueryClient, execute: MatrixWindowExecutor, session?: MatrixViewState, retention?: MatrixDatasetRetention);
32
46
  subscribe: (listener: () => void) => () => boolean;
33
47
  getSnapshot: () => MatrixRuntimeSnapshot;
34
48
  start: () => void;
35
49
  stop: () => void;
36
50
  private clear;
51
+ /**
52
+ * "This card, as of now": every refresh, retry of a request-wide failure and
53
+ * server-forced reset invalidates the card's History (plan MF-D5), and the new
54
+ * dataset starts under the bumped generation.
55
+ */
37
56
  refresh: () => void;
38
57
  dismissNotice: () => void;
39
58
  /** Presentation updates never change the acquisition generation. */
@@ -66,6 +85,12 @@ export declare class MatrixRuntimeController {
66
85
  private loadTile;
67
86
  private enqueue;
68
87
  private pump;
88
+ /**
89
+ * Re-derived on every pump, never a flag cleared on success: a bootstrap that
90
+ * fails, is cancelled or is superseded ends its active work, and the next
91
+ * queued request becomes the bootstrap.
92
+ */
93
+ private awaitingTemporalState;
69
94
  private run;
70
95
  private current;
71
96
  private runtimeError;
@@ -74,6 +99,22 @@ export declare class MatrixRuntimeController {
74
99
  private removeTile;
75
100
  private removeResource;
76
101
  private trim;
102
+ /** One measure of resident usage for the runtime budget and History. */
103
+ private usage;
104
+ /** Order-insensitive, like the sort comparison that decides a reset. */
105
+ private sortsKey;
106
+ /** Page ownership for acquired and restored pages alike. */
107
+ private ownPage;
108
+ /**
109
+ * The ready pieces of the current dataset. Failed and loading pieces never
110
+ * leave (plan INV-7), and a view in a request-wide failure saves nothing.
111
+ * Copies are taken, so History entries are never mutated afterwards.
112
+ */
113
+ private exportDataset;
114
+ /** Installs copies, so a dataset peeked by two runtimes is never shared mutably. */
115
+ private install;
116
+ /** Adopts a fresh saved dataset for the current sorts, if History has one. */
117
+ private restore;
77
118
  private deferPlan;
78
119
  private publish;
79
120
  }
@@ -9,6 +9,12 @@ type MatrixInput = MatrixRuntimeInput & {
9
9
  cardId?: string;
10
10
  /** Authored controls input; runtime spec is the resolved display definition. */
11
11
  authoredSpec?: MatrixSpec;
12
+ /**
13
+ * The shared card query identity (`createCompiledCardQueryIdentities`) of the
14
+ * same `queryContext` and calendar this card sends. It is the only source of
15
+ * query-context identity here; never hash query-context fields locally.
16
+ */
17
+ queryInputIdentity: string;
12
18
  queryContext: CompiledCardQueryContext;
13
19
  reportContext: ReportRuntimeContext;
14
20
  /** Milliseconds from the card refresh setting; absent while editing. */
@@ -1,6 +1,7 @@
1
1
  import { TFilter, TFilterValue } from '../../components/surfboard/filter/types.js';
2
2
  import { ControlBinding, ControlDefinition, ResolvedDashboardDateComparisonInput, ResolvedDashboardInputContext, TCard, TDashboard } from '../types/common-types.js';
3
- import { GlobalDateComparisonSelection } from '../../shared/analytics-protocol/index.js';
3
+ import { GlobalDateComparisonContext, GlobalDateComparisonSelection } from '../../shared/analytics-protocol/index.js';
4
+ import { ResolvedPrimaryDateField } from '../types/semantic-runtime-types.js';
4
5
  import { CardConfig } from '../types/explorer-types.js';
5
6
  import { resolveRuntimeCardFilters } from './resolve-runtime-card-filters.js';
6
7
  import { CardViewState } from '../dashboard-view-state/index.js';
@@ -50,6 +51,9 @@ export type CardQueryContext = {
50
51
  export type CompiledCardQueryContext = Omit<CardQueryContext, 'filterCompilationInput'> & {
51
52
  cardFilterValues: TFilterValue[];
52
53
  queryFilterDefinitions: TFilter[];
54
+ /** Compiled outputs the shared card query identity reads; see `createCompiledCardQueryIdentities`. */
55
+ resolvedPrimaryDateField: ResolvedPrimaryDateField | null;
56
+ globalDateComparison: GlobalDateComparisonContext | undefined;
53
57
  globalDateComparisonSelection?: GlobalDateComparisonSelection;
54
58
  dateComparisonInputs?: ResolvedDashboardDateComparisonInput[];
55
59
  };
@@ -51,7 +51,6 @@ export type DashboardCardQueryExecutionOptions = {
51
51
  resolvedPrimaryDateField?: ResolvedPrimaryDateField;
52
52
  calendarContext: CalendarContext;
53
53
  allowGlobalDateMinutePrecision?: boolean;
54
- globalDateComparisonReferenceTime?: string;
55
54
  resolvePaginationConfig?: (queryInputIdentity: string) => PaginationConfig | undefined;
56
55
  };
57
56
  /** One final compilation for interactive requests and immutable input captures. */
@@ -1,9 +1,8 @@
1
1
  import { TCard } from '../types/common-types.js';
2
2
  import { DashboardDateComparisonOwner, GlobalDateComparisonContext, GlobalDateComparisonSelection } from '../../shared/analytics-protocol/index.js';
3
3
  import { DashboardDateComparisonResolution } from '../dashboard-inputs/dashboard-date-comparison-plan.js';
4
- export declare function buildGlobalDateComparisonContext(card: Pick<TCard, 'preferences'>, selection: GlobalDateComparisonSelection | undefined, referenceTime?: string, owner?: DashboardDateComparisonOwner): GlobalDateComparisonContext | undefined;
4
+ export declare function buildGlobalDateComparisonContext(card: Pick<TCard, 'preferences'>, selection: GlobalDateComparisonSelection | undefined, owner?: DashboardDateComparisonOwner): GlobalDateComparisonContext | undefined;
5
5
  export declare function buildDashboardDateComparisonContext(params: {
6
6
  card: TCard;
7
7
  resolution: DashboardDateComparisonResolution;
8
- referenceTime?: string;
9
8
  }): GlobalDateComparisonContext | undefined;
@@ -35,7 +35,6 @@ export type CompileDashboardCardFiltersParams = {
35
35
  semanticExecutionPayload?: SemanticExecutionPayload;
36
36
  timezone?: string;
37
37
  allowMinutePrecision?: boolean;
38
- comparisonReferenceTime?: string;
39
38
  };
40
39
  export type CompiledDashboardCardFilters = {
41
40
  cardFilterValues: TFilterValue[];
@@ -68,5 +67,5 @@ export declare function composeCardFilterValues(card: TCard, input: DashboardCar
68
67
  * The single final per-card filter compiler. Every card execution consumer
69
68
  * calls this once and treats its result as immutable query state.
70
69
  */
71
- export declare function compileDashboardCardFilters({ card, cardConfig, input, resolvedPrimaryDateField, resolvedFields, semanticExecutionPayload, timezone, allowMinutePrecision, comparisonReferenceTime, }: CompileDashboardCardFiltersParams): DashboardCardFilterCompilationResult;
70
+ export declare function compileDashboardCardFilters({ card, cardConfig, input, resolvedPrimaryDateField, resolvedFields, semanticExecutionPayload, timezone, allowMinutePrecision, }: CompileDashboardCardFiltersParams): DashboardCardFilterCompilationResult;
72
71
  export {};
@@ -3,6 +3,7 @@ import { ResolvedPrimaryDateField } from '../types/semantic-runtime-types.js';
3
3
  import { CardConfig, PaginationConfig } from '../types/explorer-types.js';
4
4
  import { GlobalDateComparisonContext } from '../../shared/analytics-protocol/index.js';
5
5
  import { CalendarContext } from '../../shared/report-runtime-context/index.js';
6
+ import { CompiledCardQueryContext } from './build-card-query-context.js';
6
7
  export declare const isPaginatedCardType: (card: TCard) => boolean;
7
8
  export type CreateDashboardCardQueryKeyOptions = {
8
9
  finalFiltersKey: string;
@@ -36,4 +37,13 @@ export declare function createDashboardCardQueryIdentities(card: TCard, options:
36
37
  queryInputIdentity: string;
37
38
  paginationConfig: PaginationConfig | undefined;
38
39
  };
40
+ /**
41
+ * The one identity for a compiled card context. Regular cards and the Matrix
42
+ * both use it, so a card's identity always covers what its request sends.
43
+ */
44
+ export declare function createCompiledCardQueryIdentities(card: TCard, context: CompiledCardQueryContext, calendarContext: CalendarContext, identityOptions?: Parameters<typeof createDashboardCardQueryIdentities>[2]): {
45
+ queryKey: string[];
46
+ queryInputIdentity: string;
47
+ paginationConfig: PaginationConfig | undefined;
48
+ };
39
49
  export declare function createDashboardCardQueryKey(card: TCard, options: CreateDashboardCardQueryKeyOptions): string[];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The auth scope every card puts in its query identity: a stable hash of the
3
+ * access token, never the token itself. A new token is a new scope.
4
+ */
5
+ export declare function hashTokenForQueryKey(accessToken?: string): string;
@@ -101,8 +101,12 @@ export type DashboardStore = {
101
101
  cardViewState: CardViewStateMap;
102
102
  /** Session-only server pagination, attached to the query identity that owns each page. */
103
103
  dashboardCardPagination: Record<string, DashboardCardPaginationState>;
104
- /** Fixed execution clock from a strict dashboard input replay snapshot. */
105
- dashboardInputReferenceTime?: string;
104
+ /**
105
+ * When the replayed input snapshot was generated, for a document's
106
+ * "Generated at" text only. Queries never read it: a print render's
107
+ * instant comes from its pinned calendar (analytics kernel K15).
108
+ */
109
+ dashboardInputGeneratedAt?: string;
106
110
  /**
107
111
  * Set when a PDF render's sheet has applicable inputs that were never
108
112
  * captured. The sheet must not print; DashboardTabs renders the reason.
@@ -205,14 +209,14 @@ type Actions = {
205
209
  setDashboard: (dashboard: TDashboard, options?: {
206
210
  semanticExecutionPayload?: SemanticExecutionPayload;
207
211
  dashboardInputValues?: DashboardInputValues;
208
- dashboardInputReferenceTime?: string;
212
+ dashboardInputGeneratedAt?: string;
209
213
  reportContext?: ReportRuntimeContext;
210
214
  }) => void;
211
215
  setDashboardWithFilterValues: (dashboard: TDashboard, filterValues: TFilterValue[], runtimeOverrides?: Record<string, unknown>, options?: {
212
216
  selectedSheetId?: string | null;
213
217
  semanticExecutionPayload?: SemanticExecutionPayload;
214
218
  dashboardInputValues?: DashboardInputValues;
215
- dashboardInputReferenceTime?: string;
219
+ dashboardInputGeneratedAt?: string;
216
220
  /** Drill paths replayed from an execution snapshot. */
217
221
  cardViewState?: CardViewStateMap;
218
222
  transientContexts?: TransientInputContext[];
@@ -226,6 +230,7 @@ type Actions = {
226
230
  setDashboardTheme: (theme: 'light' | 'dark' | 'system') => void;
227
231
  setDashboardTitle: (title: string) => void;
228
232
  setDashboardDescription: (description: string) => void;
233
+ setDashboardExportDefaults: (exportDefaults: TDashboard['exportDefaults']) => void;
229
234
  setSheets: (sheets: TSheet[]) => void;
230
235
  addSheet: (sheet: TSheet) => void;
231
236
  duplicateSheet: (sheetId: string) => string | null;
@@ -31,11 +31,18 @@ export declare function formatTimeInTimezone(date: Date, timezone: string): stri
31
31
  export declare function composeDateTimeInTimezone(date: Date, time: string, timezone: string, options?: {
32
32
  boundary?: 'start' | 'end';
33
33
  }): Date | null;
34
- export declare function normalizeDateFilterRange(date: DateRange, options?: {
34
+ /**
35
+ * The range a date filter stores. At day precision, a single day (a start
36
+ * with no end, or an end equal to the start) becomes that whole calendar day
37
+ * in the report timezone, ending its last millisecond: 23 or 25 hours on a
38
+ * daylight-saving day, and never the next day's midnight, which an inclusive
39
+ * range would count (on a date column, as the whole next day).
40
+ */
41
+ export declare function normalizeDateFilterRange(date: DateRange, options: {
35
42
  temporalPrecision?: TemporalPrecision;
43
+ timezone: string;
36
44
  }): {
37
45
  from?: Date;
38
46
  to?: Date;
39
47
  values: [Date | string, Date | string] | [Date | string];
40
48
  };
41
- export declare function resolveSubDayRelativeDateRange(meta: RelativeDateFilter, anchor?: Date): [Date, Date] | null;
@@ -15,6 +15,7 @@ import { DashboardAIContext } from './assistant-types.js';
15
15
  import { CardInteractionConfig, InteractionTargetOverride } from './interaction-types.js';
16
16
  import { SemanticExecutionPayload } from './semantic-runtime-types.js';
17
17
  import { ReportRuntimeContext } from '../../shared/report-runtime-context/index.js';
18
+ import { CsvEncoding } from '../../shared/format-utils/exporters/csv-utils.js';
18
19
  import { PresentationExecutionSnapshot, TemporalInputPresentation } from '../../shared/format-utils/index.js';
19
20
  import { JSX } from 'react';
20
21
  export type { DashboardFilterApplication, DashboardFilterBoundCardApplication, DashboardFilterCardApplication, DashboardFilterExcludedCardApplication, DashboardFilterTarget, DashboardFilterTargetField, DashboardFilterTargetSource, DashboardFilterOptionSource, } from '../../shared/dashboard-authoring/dashboard-filter-mapping-types.js';
@@ -1573,6 +1574,10 @@ export type TDashboard = {
1573
1574
  /** Dashboard creation sets 'on'. Absent resolves to 'off', so existing dashboards do not change. */
1574
1575
  clickToFilter: 'on' | 'off';
1575
1576
  };
1577
+ exportDefaults?: {
1578
+ /** Absent resolves to DEFAULT_CSV_ENCODING, so existing dashboards do not change. */
1579
+ csvEncoding?: CsvEncoding;
1580
+ };
1576
1581
  aiContext?: DashboardAIContext;
1577
1582
  summary?: {
1578
1583
  enabled?: boolean;
@@ -2,6 +2,7 @@ import { TimeDrillStep } from './interaction-types.js';
2
2
  import { SemaphorDerivedFieldDefinition, MatrixConfig, SemaphorSourceRef, SemaphorResultColumn, SemaphorPivotValue, SemaphorTimeGrain, SemanticGroupedTemporalInput, TemporalBucketMetadata, TemporalBucketFormat, MetricComparisonConfig, MetricComparisonPolarity } from '../../shared/analytics-protocol/index.js';
3
3
  import { CanonicalPivotResultContract, CanonicalPivotResultState, FlatTableExportTotalsBehavior, FlatTableExportTotalsRequest, QueryColumnKeyMap as SharedQueryColumnKeyMap } from '../../shared/format-utils/index.js';
4
4
  import { TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
5
+ import { RelativeDateFilter } from '../../shared/analytics-protocol/relative-date-filter.js';
5
6
  /**
6
7
  * Special entity name marker for calculated fields.
7
8
  *
@@ -464,6 +465,19 @@ export interface FilterCondition {
464
465
  label?: string;
465
466
  /** Governed meaning for a canonical grouped-temporal scalar. */
466
467
  temporalBucket?: TemporalBucketMetadata;
468
+ /**
469
+ * Relative date window ("This month"). When present it is authoritative:
470
+ * the server resolves it on every run and `value` only keeps the range seen
471
+ * when it was saved. Valid only with `between` and `not between`.
472
+ */
473
+ relativeMeta?: RelativeDateFilter;
474
+ /**
475
+ * "Equals the latest value of this field" (analytics kernel K13). With `=`
476
+ * on a date or timestamp field only. The server resolves it on every run
477
+ * through the field's data anchor; `value` only keeps the value seen when
478
+ * it was saved.
479
+ */
480
+ latestValue?: true;
467
481
  }
468
482
  export interface FilterGroup {
469
483
  id: string;
@@ -117,7 +117,6 @@ export type UIConfig = {
117
117
  features: {
118
118
  dashboardAssistant: boolean;
119
119
  dashboardAiAuthoring: boolean;
120
- dataAppBuilder: boolean;
121
120
  analyticalBriefings: boolean;
122
121
  aiWritingHelpers: boolean;
123
122
  };
@@ -326,7 +326,7 @@ export declare function getCardDefinition(card: DefinitionCard, catalog?: Matrix
326
326
  levelId: string;
327
327
  axis: "columns" | "rows";
328
328
  direction: "asc" | "desc";
329
- nulls: "first" | "last";
329
+ nulls: "last" | "first";
330
330
  }[];
331
331
  rankings: readonly import('../../shared/analytics-protocol/matrix-definition-contract.js').MatrixRanking[];
332
332
  filters?: import('../types/explorer-types.js').FilterGroup | undefined;
@@ -1,4 +1,4 @@
1
- import { CalendarContext, WeekStart } from '../types/token-types.js';
1
+ import { CalendarContext } from '../types/token-types.js';
2
2
  /**
3
3
  * Gets the start of day (00:00:00.000) for a date in the specified timezone.
4
4
  * This ensures that when the Date is serialized to UTC, it represents the correct day boundary.
@@ -18,7 +18,9 @@ import { CalendarContext, WeekStart } from '../types/token-types.js';
18
18
  */
19
19
  export declare const startOfDayInTimezone: (date: Date, timezone: string) => Date;
20
20
  /**
21
- * Gets the end of day (23:59:59.999) for a date in the specified timezone.
21
+ * Gets the last millisecond of the day for a date in the specified timezone:
22
+ * 23:59:59.999, or the instant before the next day starts on a day that
23
+ * ends inside a daylight-saving change.
22
24
  * This ensures that when the Date is serialized to UTC, it represents the correct day boundary.
23
25
  *
24
26
  * @param date - The date to get end of day for
@@ -49,42 +51,6 @@ export declare const endOfDayInTimezone: (date: Date, timezone: string) => Date;
49
51
  * `getEffectiveTimezone` does.
50
52
  */
51
53
  export declare const parseFilterDateValue: (value: unknown, timezone: string | null | undefined, bound?: "start" | "end") => Date | undefined;
52
- /**
53
- * Gets the start of week (midnight) for a date in the specified timezone.
54
- *
55
- * @param date - The date to get start of week for
56
- * @param timezone - The timezone to use (e.g., 'America/Los_Angeles')
57
- * @param weekStartsOn - Day the week starts on (0=Sunday, 1=Monday). Can also pass CalendarContext.
58
- * @returns A Date object representing midnight on the first day of the week
59
- *
60
- * @example
61
- * // With weekStartsOn number
62
- * startOfWeekInTimezone(new Date(), 'America/Chicago', 0) // Sunday start
63
- *
64
- * // With CalendarContext
65
- * startOfWeekInTimezone(new Date(), 'America/Chicago', { tz: 'America/Chicago', weekStart: 0, anchor: 'now' })
66
- */
67
- export declare const startOfWeekInTimezone: (date: Date, timezone: string, weekStartsOn?: WeekStart | CalendarContext) => Date;
68
- /**
69
- * Gets the end of week (23:59:59.999) for a date in the specified timezone.
70
- *
71
- * @param date - The date to get end of week for
72
- * @param timezone - The timezone to use (e.g., 'America/Los_Angeles')
73
- * @param weekStartsOn - Day the week starts on (0=Sunday, 1=Monday). Can also pass CalendarContext.
74
- * @returns A Date object representing the last moment of the last day of the week
75
- */
76
- export declare const endOfWeekInTimezone: (date: Date, timezone: string, weekStartsOn?: WeekStart | CalendarContext) => Date;
77
- export declare const startOfMonthInTimezone: (date: Date, timezone: string) => Date;
78
- export declare const endOfMonthInTimezone: (date: Date, timezone: string) => Date;
79
- export declare const startOfQuarterInTimezone: (date: Date, timezone: string) => Date;
80
- export declare const endOfQuarterInTimezone: (date: Date, timezone: string) => Date;
81
- export declare const startOfYearInTimezone: (date: Date, timezone: string) => Date;
82
- export declare const endOfYearInTimezone: (date: Date, timezone: string) => Date;
83
- export declare const shiftDateByDaysInTimezone: (date: Date, timezone: string, days: number) => Date;
84
- export declare const shiftDateByWeeksInTimezone: (date: Date, timezone: string, weeks: number) => Date;
85
- export declare const shiftDateByMonthsInTimezone: (date: Date, timezone: string, months: number) => Date;
86
- export declare const shiftDateByQuartersInTimezone: (date: Date, timezone: string, quarters: number) => Date;
87
- export declare const shiftDateByYearsInTimezone: (date: Date, timezone: string, years: number) => Date;
88
54
  /**
89
55
  * Resolves the effective timezone.
90
56
  *
@@ -111,11 +77,3 @@ export declare const shiftDateByYearsInTimezone: (date: Date, timezone: string,
111
77
  * getEffectiveTimezone() // Returns browser's timezone (e.g., 'America/Los_Angeles')
112
78
  */
113
79
  export declare const getEffectiveTimezone: (timezoneOrContext?: string | CalendarContext | null) => string;
114
- /**
115
- * Resolves the effective weekStart from CalendarContext.
116
- *
117
- * @param calendarContext - Optional CalendarContext
118
- * @returns The week start day (0=Sunday, 1=Monday)
119
- * @default 1 (Monday) for backward compatibility with ISO standard
120
- */
121
- export declare const getEffectiveWeekStart: (calendarContext?: CalendarContext | null) => WeekStart;
@@ -1,12 +1,18 @@
1
1
  import { TFilter, TFilterValue } from '../../components/surfboard/filter/types.js';
2
2
  import { TInlineFilter } from '../types/common-types.js';
3
+ import { CalendarContext } from '../../shared/report-runtime-context/index.js';
4
+ /**
5
+ * The report calendar defaults resolve in: its timezone, or the calendar
6
+ * with its week start too, so a week default matches the server's week.
7
+ */
8
+ export type DefaultsCalendar = string | Pick<CalendarContext, 'tz' | 'weekStart'>;
3
9
  type DefaultBackedFilter = Pick<TFilter, 'id' | 'column' | 'operation' | 'dataType' | 'nativeDataType' | 'dateSelectionMode' | 'defaultValues' | 'defaultDateFilter' | 'fieldMeta' | 'semanticContext'> & Partial<Pick<TInlineFilter, 'id' | 'column' | 'operation' | 'dataType' | 'nativeDataType' | 'dateSelectionMode' | 'defaultValues' | 'defaultDateFilter' | 'fieldMeta' | 'semanticContext'>>;
4
10
  /**
5
11
  * Converts a filter's default configuration into an active runtime filter value.
6
12
  * Returns undefined when no defaults are configured.
7
13
  */
8
- export declare function buildFilterValueFromDefaults(filter: DefaultBackedFilter, timezone?: string): TFilterValue | undefined;
9
- export declare function buildFilterValuesFromDefaults(filters: DefaultBackedFilter[] | undefined, timezone?: string): TFilterValue[];
14
+ export declare function buildFilterValueFromDefaults(filter: DefaultBackedFilter, calendar?: DefaultsCalendar | null): TFilterValue | undefined;
15
+ export declare function buildFilterValuesFromDefaults(filters: DefaultBackedFilter[] | undefined, calendar?: DefaultsCalendar): TFilterValue[];
10
16
  export declare function isCompatibleFilterValue(filter: Pick<TFilter, 'id' | 'operation' | 'dataType'>, filterValue: TFilterValue): boolean;
11
17
  export declare function filterCompatibleFilterValues(filters: TFilter[] | undefined, filterValues: TFilterValue[] | undefined): TFilterValue[];
12
18
  export declare function mergeFilterValueLayers(baseValues: TFilterValue[], overrideValues: TFilterValue[]): TFilterValue[];
@@ -1,5 +1,6 @@
1
1
  import { TDashboard } from '../types/common-types.js';
2
2
  import { TFilterValue } from '../../components/surfboard/filter/types.js';
3
+ import { DefaultsCalendar } from './filter-default-value-utils.js';
3
4
  /**
4
5
  * Hydrate inline filter defaults for all cards in the dashboard.
5
6
  * Returns a map of cardId → TFilterValue[] for runtime-only storage.
@@ -9,7 +10,7 @@ import { TFilterValue } from '../../components/surfboard/filter/types.js';
9
10
  * function only owns traversal and card-scoped runtime storage.
10
11
  *
11
12
  * @param dashboard - The dashboard to extract inline filter defaults from
12
- * @param timezone - Optional timezone for date calculations (defaults to browser timezone)
13
+ * @param calendar - The report calendar (or its timezone) for date defaults (defaults to the browser timezone)
13
14
  * @returns Map of cardId to array of filter values
14
15
  */
15
- export declare function computeInlineFilterDefaults(dashboard: TDashboard, timezone?: string): Record<string, TFilterValue[]>;
16
+ export declare function computeInlineFilterDefaults(dashboard: TDashboard, calendar?: DefaultsCalendar): Record<string, TFilterValue[]>;