react-semaphor 0.1.526 → 0.1.528

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 (180) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1190 -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-DUu-tCQw.js} +66 -65
  6. package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BdPceiw8.js} +68 -65
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-BkskKMck.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-Bb0RhGRC.js} +372 -359
  10. package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-loWTHPMi.js} +739 -686
  11. package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DUci_SOR.js} +10 -10
  12. package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-z9WN26w7.js} +6603 -6572
  13. package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-CGSFK9S-.js} +266 -267
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-CdXSo1pb.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-CTYnXU85.js} +781 -780
  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-DhykwdZs.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BV9ywFtJ.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-1Mm8x8w7.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-Dp7kFpVk.js +1383 -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-CZa3556D.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-Bqdtknud.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-VV0-Ro6F.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-IZjBSU6Z.js} +47 -26
  35. package/dist/chunks/semantic-format-BBLvfwua.js +192 -0
  36. package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-DbA4mVQL.js} +49909 -46207
  37. package/dist/chunks/{slider-BYIH4icg.js → slider-DpiJG8lv.js} +81 -82
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/switch-C4YH-W1X.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/semantic-types.d.ts +4 -2
  101. package/dist/types/lib/types/token-types.d.ts +0 -1
  102. package/dist/types/lib/utils/aggregate-expression-utils.d.ts +0 -4
  103. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  104. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  105. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  106. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  107. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  108. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +89 -0
  109. package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +32 -0
  110. package/dist/types/shared/analytics-protocol/contracts.d.ts +48 -7
  111. package/dist/types/shared/analytics-protocol/index.d.ts +15 -1
  112. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  113. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  114. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  115. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +61 -6
  116. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +63 -0
  117. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  118. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  119. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  120. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  121. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  122. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  123. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  124. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  125. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  126. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  127. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  128. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  129. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  130. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  131. package/dist/types/shared/temporal/index.d.ts +5 -0
  132. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  133. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  134. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  135. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  136. package/package.json +1 -17
  137. package/src/data-app-sdk/README.md +6 -3
  138. package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
  139. package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
  140. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  141. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  142. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  143. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  144. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  145. package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
  146. package/dist/chunks/search-CJz-QQ0Q.js +0 -24
  147. package/dist/chunks/switch-XaAACBrJ.js +0 -2234
  148. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  149. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  150. package/dist/data-app-builder/index.js +0 -3666
  151. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  152. package/dist/data-app-codegen/index.js +0 -22
  153. package/dist/data-app-codegen-node/index.js +0 -1807
  154. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  155. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  156. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  157. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  158. package/dist/types/data-app-builder/constants.d.ts +0 -14
  159. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  160. package/dist/types/data-app-builder/index.d.ts +0 -1
  161. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  162. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  163. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  164. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  165. package/dist/types/data-app-builder/types.d.ts +0 -558
  166. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  167. package/dist/types/data-app-builder.d.ts +0 -2
  168. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  169. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  170. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  171. package/dist/types/data-app-codegen/index.d.ts +0 -6
  172. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  173. package/dist/types/data-app-codegen/node.d.ts +0 -2
  174. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  175. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  176. package/dist/types/data-app-codegen-node.d.ts +0 -2
  177. package/dist/types/data-app-codegen.d.ts +0 -2
  178. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  179. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  180. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -56,10 +56,19 @@ export type MatrixDescriptor = {
56
56
  nativeDataType: string;
57
57
  semanticFormat?: SemaphorValueFormat;
58
58
  };
59
+ /**
60
+ * Matrix failure codes: the shared refusal codes (Plan 2b, owner C) plus the
61
+ * two only a windowed Matrix has.
62
+ */
63
+ export declare const MATRIX_FAILURE_CODES: readonly ["invalid_request", "missing_relationship", "ambiguous_relationship", "unsafe_join", "unsupported_capability", "capability_required", "forbidden", "not_found", "execution_failed", "timeout", "budget_exceeded", "cancelled", "stale_cursor", "source_truncated"];
64
+ export type MatrixFailureCode = (typeof MATRIX_FAILURE_CODES)[number];
59
65
  export type MatrixFailure = {
60
- code: 'invalid_request' | 'unsupported_capability' | 'stale_cursor' | 'forbidden' | 'budget_exceeded' | 'source_truncated' | 'execution_failed' | 'cancelled';
66
+ code: MatrixFailureCode;
61
67
  message: string;
62
68
  detail?: string;
69
+ details?: Record<string, unknown>;
70
+ nextStep?: string;
71
+ status?: number;
63
72
  retryable: boolean;
64
73
  scope: {
65
74
  kind: 'operation';
@@ -90,6 +99,33 @@ export type MatrixWindowOutcome = {
90
99
  status: 'failed';
91
100
  failure: MatrixFailure;
92
101
  };
102
+ /**
103
+ * One present intersection of an indexed block: positions into the block's
104
+ * own coverage lists, then the value. Absent means no data at that
105
+ * intersection; `null` is a present aggregate null.
106
+ */
107
+ export type MatrixIndexedCell = readonly [
108
+ row: number,
109
+ column: number,
110
+ measure: number,
111
+ value: SemaphorScalarValue
112
+ ];
113
+ /** The dashboard's wire form of a cell block: each path is sent once, in coverage. */
114
+ export type MatrixIndexedCellBlock = {
115
+ requestId: string;
116
+ coverage: MatrixCellBlock['coverage'];
117
+ values: readonly MatrixIndexedCell[];
118
+ };
119
+ export type MatrixIndexedWindow = Omit<MatrixWindow, 'blocks'> & {
120
+ blocks: readonly MatrixIndexedCellBlock[];
121
+ };
122
+ export type MatrixIndexedWindowOutcome = {
123
+ status: 'success' | 'partial';
124
+ window: MatrixIndexedWindow;
125
+ } | {
126
+ status: 'failed';
127
+ failure: MatrixFailure;
128
+ };
93
129
  type MatrixWindowInput = {
94
130
  spec: MatrixSpec;
95
131
  request: MatrixWindowRequest;
@@ -98,9 +134,14 @@ type MatrixResult = {
98
134
  kind: 'matrix';
99
135
  window: MatrixWindow;
100
136
  };
101
- /** Shared request ceiling used by client tile sizing and server enforcement. */
137
+ /**
138
+ * Shared ceilings: request coordinates (client tile sizing and server
139
+ * enforcement), and the serialized size of one acquired window at its
140
+ * indexed size, which is what the dashboard receives.
141
+ */
102
142
  export declare const MATRIX_WINDOW_LIMITS: Readonly<{
103
143
  coordinates: 20000;
144
+ responseBytes: number;
104
145
  }>;
105
146
  export declare const matrixPageRequestSchema: z.ZodType<MatrixPageRequest>;
106
147
  export declare const matrixPathSelectionSchema: z.ZodType<MatrixPathSelection>;
@@ -109,6 +150,8 @@ export declare const matrixWindowRequestSchema: z.ZodType<MatrixWindowRequest>;
109
150
  export declare const matrixWindowInputSchema: z.ZodType<MatrixWindowInput>;
110
151
  export declare const matrixAxisPageSchema: z.ZodType<MatrixAxisPage>;
111
152
  export declare const matrixCellBlockSchema: z.ZodType<MatrixCellBlock>;
153
+ /** Positions are checked against coverage; no per-cell path keys are built. */
154
+ export declare const matrixIndexedCellBlockSchema: z.ZodType<MatrixIndexedCellBlock>;
112
155
  export declare const matrixDescriptorSchema: z.ZodObject<{
113
156
  id: z.ZodString;
114
157
  column: z.ZodType<SemaphorResultColumn, z.ZodTypeDef, SemaphorResultColumn>;
@@ -327,8 +370,20 @@ export declare const matrixDescriptorSchema: z.ZodObject<{
327
370
  }>;
328
371
  export declare const matrixFailureSchema: z.ZodType<MatrixFailure>;
329
372
  export declare const matrixCapabilitiesSchema: z.ZodType<MatrixCapabilities>;
330
- export declare const matrixWindowSchema: z.ZodType<MatrixWindow>;
373
+ export declare const matrixWindowSchema: z.ZodType<MatrixWindow, z.ZodTypeDef, MatrixWindow>;
374
+ export declare const matrixIndexedWindowSchema: z.ZodType<MatrixIndexedWindow, z.ZodTypeDef, MatrixIndexedWindow>;
331
375
  export declare const matrixWindowOutcomeSchema: z.ZodType<MatrixWindowOutcome>;
376
+ export declare const matrixIndexedWindowOutcomeSchema: z.ZodType<MatrixIndexedWindowOutcome>;
377
+ /**
378
+ * The indexed wire form of a block. Every cell must be inside coverage (the
379
+ * block schema guarantees it for parsed blocks).
380
+ */
381
+ export declare function encodeMatrixCellBlock(block: MatrixCellBlock): MatrixIndexedCellBlock;
382
+ /** Cells again; their paths are the coverage path objects, not copies. */
383
+ export declare function decodeMatrixCellBlock(block: MatrixIndexedCellBlock): MatrixCellBlock;
384
+ export declare function encodeMatrixWindow(window: MatrixWindow): MatrixIndexedWindow;
385
+ export declare function decodeMatrixWindow(window: MatrixIndexedWindow): MatrixWindow;
386
+ export declare function encodeMatrixWindowOutcome(outcome: MatrixWindowOutcome): MatrixIndexedWindowOutcome;
332
387
  export declare const matrixResultSchema: z.ZodType<MatrixResult>;
333
388
  export type MatrixExportColumn = {
334
389
  kind: 'hierarchy';
@@ -371,15 +426,15 @@ export type MatrixExportRow = {
371
426
  columnPath: MatrixPath;
372
427
  values: readonly MatrixExportValue[];
373
428
  };
374
- type MatrixExportRowInput = Omit<Extract<MatrixExportRow, {
429
+ type MatrixExportRowInput = (Omit<Extract<MatrixExportRow, {
375
430
  kind: 'layout';
376
431
  }>, 'values'> & {
377
432
  values: readonly MatrixExportValueInput[];
378
- } | Omit<Extract<MatrixExportRow, {
433
+ }) | (Omit<Extract<MatrixExportRow, {
379
434
  kind: 'flat';
380
435
  }>, 'values'> & {
381
436
  values: readonly MatrixExportValueInput[];
382
- };
437
+ });
383
438
  export type MatrixExportBatch = {
384
439
  kind: 'layout';
385
440
  layout: MatrixExportLayout;
@@ -0,0 +1,63 @@
1
+ import { AggregationFunctionKind } from './aggregate-expression.js';
2
+ /** The structural fields of a measure the profile reads. */
3
+ export type MeasureProfileField = {
4
+ name?: string;
5
+ role?: string;
6
+ aggregate?: string;
7
+ expression?: string;
8
+ isPreAggregated?: boolean;
9
+ calculatedFormula?: {
10
+ computeStage?: 'row' | 'aggregate';
11
+ inputFields?: ReadonlyArray<MeasureProfileField>;
12
+ };
13
+ derivedField?: {
14
+ computeStage?: 'row' | 'aggregate';
15
+ aggregationBehavior?: string;
16
+ };
17
+ };
18
+ /** How partial results of a measure combine into a larger group. */
19
+ export type MeasureReaggregation =
20
+ /** Sum the partials (SUM, COUNT, and sums of them). */
21
+ {
22
+ kind: 'additive';
23
+ }
24
+ /** Rebuild from summed parts: AVG from SUM and COUNT partials. */
25
+ | {
26
+ kind: 'decomposable_avg';
27
+ }
28
+ /** Take the MIN or MAX of the partials. */
29
+ | {
30
+ kind: 'idempotent';
31
+ fn: 'min' | 'max';
32
+ }
33
+ /** Partials can't be combined; recompute at the larger grain. */
34
+ | {
35
+ kind: 'none';
36
+ reason: 'distinct' | 'median' | 'ratio' | 'window' | 'declared' | 'unresolved' | 'other';
37
+ };
38
+ export type MeasureAggregationProfile = {
39
+ /** `aggregate`: the measure aggregates itself; `row`: it needs `outer`. */
40
+ stage: 'row' | 'aggregate';
41
+ /** The aggregate wrapping a row-stage measure. */
42
+ outer?: AggregationFunctionKind;
43
+ /** Every aggregate the measure computes, nested inputs expanded. */
44
+ calls: Array<{
45
+ kind: AggregationFunctionKind;
46
+ distinct: boolean;
47
+ }>;
48
+ windowed: boolean;
49
+ /** The value is unchanged when input rows repeat (as through a to-many join). */
50
+ repeatSafe: boolean;
51
+ reaggregation: MeasureReaggregation;
52
+ /** MIN and MAX keep their input's type; everything else is a number. */
53
+ outputType: 'numeric' | 'input';
54
+ /** A stable name for labels and result identity. */
55
+ identity: AggregationFunctionKind | 'ratio' | 'linear' | 'expression' | 'unresolved';
56
+ /** The profile could not be determined exactly; every answer is the cautious one. */
57
+ unresolved: boolean;
58
+ };
59
+ /**
60
+ * The aggregation profile of a compiled measure field. Pure; reads only the
61
+ * field and its nested `calculatedFormula.inputFields`.
62
+ */
63
+ export declare function resolveMeasureAggregationProfile(field: MeasureProfileField): MeasureAggregationProfile;
@@ -74,8 +74,6 @@ export type GlobalDateComparisonContext = {
74
74
  selection: GlobalDateComparisonSelection;
75
75
  inheritGlobalComparison?: false;
76
76
  owner?: DashboardDateComparisonOwner;
77
- /** Fixed execution clock carried by authoritative dashboard replay snapshots. */
78
- referenceTime?: string;
79
77
  };
80
78
  export type ResolvedMetricComparisonRequest = {
81
79
  source: 'explicit';
@@ -95,7 +93,9 @@ export type ResolvedDateWindow = {
95
93
  endExclusive: string;
96
94
  timezone: string;
97
95
  };
98
- export type ComparisonUnavailableReason = 'finite_current_window_required' | 'current_window_not_started' | 'temporal_binding_missing' | 'temporal_binding_ambiguous' | 'temporal_binding_invalid' | 'unsupported_output_shape' | 'unsupported_raw_sql' | 'insufficient_history' | 'invalid_comparison_spec' | 'comparison_execution_failed';
96
+ export type ComparisonUnavailableReason = 'finite_current_window_required' | 'current_window_not_started'
97
+ /** The date ranges the run applies to the field have no instant in common. */
98
+ | 'current_window_empty' | 'temporal_binding_missing' | 'temporal_binding_ambiguous' | 'temporal_binding_invalid' | 'unsupported_output_shape' | 'unsupported_raw_sql' | 'insufficient_history' | 'invalid_comparison_spec' | 'comparison_execution_failed';
99
99
  export type ComparisonAvailability = {
100
100
  status: 'available';
101
101
  } | {
@@ -174,6 +174,12 @@ export declare function validateMetricComparisonSpec(value: unknown, path?: stri
174
174
  export declare function validateMetricComparisonConfig(value: unknown, path?: string): SemaphorValidationResult;
175
175
  export declare function validateGlobalDateComparisonSelection(value: unknown, path?: string): SemaphorValidationResult;
176
176
  export declare function validateGlobalDateComparisonContext(value: unknown, path?: string): SemaphorValidationResult;
177
+ /**
178
+ * A validated comparison context without the legacy `referenceTime`, so no
179
+ * request replays the clock a stored rule or an old client stamped: every
180
+ * operation pins its own instant (analytics kernel K5).
181
+ */
182
+ export declare function withoutLegacyComparisonClock(context: GlobalDateComparisonContext): GlobalDateComparisonContext;
177
183
  export declare function validateMetricComparisonPolarity(value: unknown, path?: string): SemaphorValidationResult;
178
184
  export declare function validateComparisonPresentationSpec(value: unknown, path?: string): SemaphorValidationResult;
179
185
  export declare function evaluateMetricComparison(input: {
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The latest value of a field within a lookup scope, as the database wrote it
4
+ * (never a value passed through a JavaScript `Date`), or `null` when the scope
5
+ * has no rows. It carries no type: the server takes the native type from the
6
+ * field's governed metadata.
7
+ */
8
+ export type DataAnchor = {
9
+ key: string;
10
+ nativeText: string | null;
11
+ };
12
+ /**
13
+ * What one operation fixed: the instant every relative date resolves on, and
14
+ * the data anchors it read. Governed responses report it; requests that
15
+ * continue the operation (a Matrix page or expansion) send it back.
16
+ */
17
+ export type OperationTemporalState = {
18
+ executionInstant: string;
19
+ dataAnchors: DataAnchor[];
20
+ };
21
+ /**
22
+ * Strict. A request may send only `{ executionInstant }`; `dataAnchors`
23
+ * defaults to none. The instant must be a full ISO instant, and anchor keys
24
+ * are unique.
25
+ */
26
+ export declare const operationTemporalStateSchema: z.ZodEffects<z.ZodObject<{
27
+ executionInstant: z.ZodEffects<z.ZodString, string, string>;
28
+ dataAnchors: z.ZodDefault<z.ZodArray<z.ZodObject<{
29
+ key: z.ZodString;
30
+ nativeText: z.ZodNullable<z.ZodString>;
31
+ }, "strict", z.ZodTypeAny, {
32
+ key: string;
33
+ nativeText: string | null;
34
+ }, {
35
+ key: string;
36
+ nativeText: string | null;
37
+ }>, "many">>;
38
+ }, "strict", z.ZodTypeAny, {
39
+ executionInstant: string;
40
+ dataAnchors: {
41
+ key: string;
42
+ nativeText: string | null;
43
+ }[];
44
+ }, {
45
+ executionInstant: string;
46
+ dataAnchors?: {
47
+ key: string;
48
+ nativeText: string | null;
49
+ }[] | undefined;
50
+ }>, {
51
+ executionInstant: string;
52
+ dataAnchors: {
53
+ key: string;
54
+ nativeText: string | null;
55
+ }[];
56
+ }, {
57
+ executionInstant: string;
58
+ dataAnchors?: {
59
+ key: string;
60
+ nativeText: string | null;
61
+ }[] | undefined;
62
+ }>;
63
+ /** The state as parsed, or `undefined` when absent or invalid. */
64
+ export declare function readOperationTemporalState(value: unknown): OperationTemporalState | undefined;
@@ -0,0 +1,61 @@
1
+ import { z } from 'zod';
2
+ /** Calendar units a relative date can count in. */
3
+ export type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
4
+ /** Sub-day units, used only by rolling `last` windows. */
5
+ export type SubDayDateUnit = 'minute' | 'hour';
6
+ export type RelativeDateUnit = DateUnit | SubDayDateUnit;
7
+ /**
8
+ * A date window stated relative to an anchor ("now" or a pinned instant).
9
+ * Dashboard filters carry it as `TFilterValue.relativeMeta` and card filters as
10
+ * `FilterCondition.relativeMeta`; the server resolves it on every run in the
11
+ * governed calendar.
12
+ */
13
+ export type RelativeDateFilter = {
14
+ mode: 'last';
15
+ n: number;
16
+ unit: SubDayDateUnit;
17
+ complete?: false;
18
+ relativeTo?: RelativeDateAnchor;
19
+ } | {
20
+ mode: 'last';
21
+ n: number;
22
+ unit: DateUnit;
23
+ complete?: boolean;
24
+ relativeTo?: RelativeDateAnchor;
25
+ } | {
26
+ mode: 'this';
27
+ unit: DateUnit;
28
+ toDate?: boolean;
29
+ /** Only used with unit=month for single-day month-boundary presets. */
30
+ boundary?: 'first_day' | 'last_day';
31
+ } | {
32
+ mode: 'previous';
33
+ unit: DateUnit;
34
+ } | {
35
+ mode: 'between';
36
+ unit: DateUnit;
37
+ from: number;
38
+ to: number;
39
+ };
40
+ /**
41
+ * What a `last` window counts back from. Omitted means now (or a pinned
42
+ * instant); `'latest_data'` means the latest value of the window's own field
43
+ * in its lookup scope (analytics kernel K11). Only agents author it.
44
+ */
45
+ export type RelativeDateAnchor = 'latest_data';
46
+ /** A `last` window that counts back from the latest data (K11). */
47
+ export type DataRelativeDateFilter = Extract<RelativeDateFilter, {
48
+ mode: 'last';
49
+ }> & {
50
+ relativeTo: 'latest_data';
51
+ };
52
+ /**
53
+ * A window that counts back from the latest data instead of from now (K11):
54
+ * the one test every reader uses. It reads any value, so callers can pass a
55
+ * field they have not validated.
56
+ */
57
+ export declare function isDataRelativeDateFilter(meta: unknown): meta is DataRelativeDateFilter;
58
+ /** A relative date belongs only on a range condition (plan D3). */
59
+ export declare function allowsRelativeDate(operator: string): boolean;
60
+ /** Strict schema for a persisted `RelativeDateFilter`. */
61
+ export declare const relativeDateFilterSchema: z.ZodType<RelativeDateFilter>;
@@ -0,0 +1,20 @@
1
+ import { RelativeDateFilter } from './relative-date-filter.js';
2
+ /** The preset a relative date is, or null when it isn't one. */
3
+ export declare function findPresetLabel(meta: RelativeDateFilter | undefined): string | null;
4
+ /** One offset as an option label: "Today", "Last month", "6 days ago". */
5
+ export declare function getRelativeOffsetLabel(offset: number, unit: RelativeDateFilter['unit']): string;
6
+ /**
7
+ * Format a `RelativeDateFilter` meta into a human-readable label.
8
+ *
9
+ * 1. First tries to reverse-match against `presetMetadata` so canonical
10
+ * presets (Today, Last 7 days, This week, …) round-trip back to the
11
+ * same wording the user originally clicked.
12
+ * 2. Falls back to a generated label for ad-hoc relative ranges that
13
+ * aren't in the preset list (e.g., from the Relative tab's custom
14
+ * From/To dropdowns).
15
+ *
16
+ * Returns null if the meta can't be sensibly labelled.
17
+ */
18
+ export declare function getRelativeDateLabel(meta: RelativeDateFilter | undefined): string | null;
19
+ export declare function relativeMetaEquals(a: RelativeDateFilter, b: RelativeDateFilter): boolean;
20
+ export declare const presetMetadata: Record<string, RelativeDateFilter>;
@@ -1,7 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { SemaphorAnalyzeResult } from './analyze-result-types.js';
3
3
  import { SemaphorAnalyticsDiagnosticFeedback, SemaphorAnalyticsExecutionResult, SemaphorAnalyticsPopulation, SemaphorAnalyticsResult, SemaphorRelationshipDiagnostics } from './contracts.js';
4
- import { SemaphorDataAppCodegenSummary } from './data-app-codegen-summary.js';
5
4
  export * from './analytics-base-schemas.js';
6
5
  export { matrixResultSchema as semaphorMatrixResultSchema } from './matrix-window-contract.js';
7
6
  export declare const semaphorAnalyticsResultSchema: z.ZodType<SemaphorAnalyticsResult>;
@@ -3370,4 +3369,3 @@ export declare const analyticsExecutionEnvelopeSchema: z.ZodObject<{
3370
3369
  export declare const semaphorAnalyticsExecutionResultSchema: z.ZodType<SemaphorAnalyticsExecutionResult>;
3371
3370
  export declare const semaphorAnalyzeResultShape: z.ZodRawShape;
3372
3371
  export declare const semaphorAnalyzeResultSchema: z.ZodType<SemaphorAnalyzeResult>;
3373
- export declare const semaphorDataAppCodegenSummarySchema: z.ZodType<SemaphorDataAppCodegenSummary>;