react-semaphor 0.1.540 → 0.1.542

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 (118) hide show
  1. package/dist/analytics-protocol/index.js +75 -75
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +3 -3
  4. package/dist/briefings/index.js +50 -45
  5. package/dist/chunks/apply-dashboard-operations-Btbp2-6v.js +2260 -0
  6. package/dist/chunks/{assistant-chat-ya7xopaC.js → assistant-chat-oHF5lTjA.js} +12 -12
  7. package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
  8. package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
  9. package/dist/chunks/comparison-window-caption-ChIyd_-L.js +1618 -0
  10. package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
  11. package/dist/chunks/{dashboard-briefing-launcher-DJI-zfEq.js → dashboard-briefing-launcher-B-cm719R.js} +18 -18
  12. package/dist/chunks/{dashboard-controls-Dh7HqoKy.js → dashboard-controls-CIn22Qgp.js} +69 -70
  13. package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
  14. package/dist/chunks/{dashboard-json-BnmlB71h.js → dashboard-json-ZUYsIExq.js} +4 -4
  15. package/dist/chunks/{dashboard-B6Bithfl.js → dashboard-s5WJBcK8.js} +1 -1
  16. package/dist/chunks/{document-dashboard-inputs-BrYYlRVo.js → document-dashboard-inputs-C6MJVyoI.js} +2357 -4948
  17. package/dist/chunks/document-sheet-utils-BsZUnHRl.js +3619 -0
  18. package/dist/chunks/{edit-dashboard-visual-CydOkSko.js → edit-dashboard-visual-DLdereA7.js} +728 -728
  19. package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
  20. package/dist/chunks/index-CV5rHq5D.js +2673 -0
  21. package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
  22. package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
  23. package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
  24. package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
  25. package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
  26. package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
  27. package/dist/chunks/numeric-presentation-BSAqPpHt.js +5227 -0
  28. package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
  29. package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
  30. package/dist/chunks/pivot-result-lifecycle-BBlAfBA0.js +1155 -0
  31. package/dist/chunks/raw-temporal-presentation-CZ2r0Vb_.js +585 -0
  32. package/dist/chunks/{report-preferences-dialog-neMDolLg.js → report-preferences-dialog-MRUWpMcJ.js} +75 -75
  33. package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
  34. package/dist/chunks/{saved-dashboard-context-CCrLpfSQ.js → saved-dashboard-context-DjPqgFly.js} +233 -206
  35. package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator--4DWtVBu.js → semaphor-ready-indicator-BWSpRsPj.js} +38555 -40449
  37. package/dist/chunks/{shelf-drop-preview-context-CpdB5ois.js → shelf-drop-preview-context-CQbFLm3q.js} +6 -6
  38. package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
  39. package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
  40. package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
  41. package/dist/chunks/table-export-sheet-BHSnuZHd.js +949 -0
  42. package/dist/chunks/table-settings-CLZocegs.js +501 -0
  43. package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
  44. package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
  45. package/dist/chunks/{use-create-flow-overlay-state-8g6Zhphh.js → use-create-flow-overlay-state-BJDNqdOh.js} +151 -151
  46. package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
  47. package/dist/dashboard/index.js +2 -2
  48. package/dist/dashboard-authoring/index.js +399 -380
  49. package/dist/data-app-sdk/index.js +5 -5
  50. package/dist/data-app-sdk-adapters/index.js +2 -2
  51. package/dist/data-app-sdk-validation/index.js +9 -9
  52. package/dist/format-utils/index.js +346 -238
  53. package/dist/index.js +174 -175
  54. package/dist/pdf-export-policy/index.js +20 -10
  55. package/dist/report-runtime-context/index.js +1 -1
  56. package/dist/surfboard/index.js +2 -2
  57. package/dist/types/briefings/attachment-outcomes.d.ts +23 -0
  58. package/dist/types/briefings/attachments.d.ts +17 -1
  59. package/dist/types/briefings/index.d.ts +6 -3
  60. package/dist/types/index.js +48 -48
  61. package/dist/types/lib/api/exports-api.d.ts +11 -65
  62. package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
  63. package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
  64. package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
  65. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
  66. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
  67. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
  68. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
  69. package/dist/types/lib/query-context/card-server-request.d.ts +5 -1
  70. package/dist/types/lib/types/common-types.d.ts +7 -0
  71. package/dist/types/lib/types/explorer-types.d.ts +8 -2
  72. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
  73. package/dist/types/shared/assistant-context/index.d.ts +1 -1
  74. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
  75. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
  76. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +20 -0
  77. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  78. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
  79. package/dist/types/shared/format-utils/attachment-filter-line.d.ts +14 -0
  80. package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
  81. package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
  82. package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
  83. package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
  84. package/dist/types/shared/format-utils/filter-line.d.ts +7 -0
  85. package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
  86. package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
  87. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
  88. package/dist/types/shared/format-utils/index.d.ts +3 -0
  89. package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
  90. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
  91. package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
  92. package/dist/types/shared/format-utils/pdf-export-policy.d.ts +9 -0
  93. package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
  94. package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
  95. package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
  96. package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
  97. package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
  98. package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
  99. package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
  100. package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
  101. package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
  102. package/package.json +2 -1
  103. package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +0 -979
  104. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
  105. package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
  106. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
  107. package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
  108. package/dist/chunks/common-types-CUf03Htv.js +0 -288
  109. package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
  110. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
  111. package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
  112. package/dist/chunks/index-CqMiAkay.js +0 -3164
  113. package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
  114. package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
  115. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
  116. package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
  117. package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
  118. package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
@@ -1,6 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  /** Transport budget, independent of total export bytes and analytical tile budgets. */
3
3
  export declare const MATRIX_EXPORT_TRANSFER_BYTES: number;
4
+ /**
5
+ * Largest decoded Excel data part of one batch. Excel rows travel gzipped
6
+ * (their markup is several times the CSV text), so the transfer budget bounds
7
+ * them compressed; this bounds what the worker decodes and stores.
8
+ */
9
+ export declare const MATRIX_EXPORT_DECODED_PART_BYTES: number;
4
10
  export declare const matrixExportDeadlineSchema: z.ZodNumber;
5
11
  export declare function parseMatrixAttemptKey(jobId: string, key: string): {
6
12
  attemptId: string;
@@ -37,27 +43,27 @@ export declare const matrixBatchResponseSchema: z.ZodDiscriminatedUnion<"kind",
37
43
  objects: z.ZodArray<z.ZodEffects<z.ZodObject<{
38
44
  key: z.ZodString;
39
45
  content: z.ZodString;
40
- contentType: z.ZodEnum<["text/csv", "application/json"]>;
46
+ contentType: z.ZodEnum<[string, ...string[]]>;
41
47
  encoding: z.ZodOptional<z.ZodLiteral<"gzip-base64">>;
42
48
  }, "strip", z.ZodTypeAny, {
43
49
  key: string;
44
50
  content: string;
45
- contentType: "text/csv" | "application/json";
51
+ contentType: string;
46
52
  encoding?: "gzip-base64" | undefined;
47
53
  }, {
48
54
  key: string;
49
55
  content: string;
50
- contentType: "text/csv" | "application/json";
56
+ contentType: string;
51
57
  encoding?: "gzip-base64" | undefined;
52
58
  }>, {
53
59
  key: string;
54
60
  content: string;
55
- contentType: "text/csv" | "application/json";
61
+ contentType: string;
56
62
  encoding?: "gzip-base64" | undefined;
57
63
  }, {
58
64
  key: string;
59
65
  content: string;
60
- contentType: "text/csv" | "application/json";
66
+ contentType: string;
61
67
  encoding?: "gzip-base64" | undefined;
62
68
  }>, "many">;
63
69
  deadlineAt: z.ZodNumber;
@@ -69,7 +75,7 @@ export declare const matrixBatchResponseSchema: z.ZodDiscriminatedUnion<"kind",
69
75
  objects: {
70
76
  key: string;
71
77
  content: string;
72
- contentType: "text/csv" | "application/json";
78
+ contentType: string;
73
79
  encoding?: "gzip-base64" | undefined;
74
80
  }[];
75
81
  }, {
@@ -80,7 +86,7 @@ export declare const matrixBatchResponseSchema: z.ZodDiscriminatedUnion<"kind",
80
86
  objects: {
81
87
  key: string;
82
88
  content: string;
83
- contentType: "text/csv" | "application/json";
89
+ contentType: string;
84
90
  encoding?: "gzip-base64" | undefined;
85
91
  }[];
86
92
  }>, z.ZodObject<{
@@ -110,7 +116,7 @@ export declare function parseMatrixBatchResponse(value: unknown, input: MatrixBa
110
116
  objects: {
111
117
  key: string;
112
118
  content: string;
113
- contentType: "text/csv" | "application/json";
119
+ contentType: string;
114
120
  encoding?: "gzip-base64" | undefined;
115
121
  }[];
116
122
  } | {
@@ -119,7 +125,7 @@ export declare function parseMatrixBatchResponse(value: unknown, input: MatrixBa
119
125
  done: boolean;
120
126
  deadlineAt: number;
121
127
  };
122
- export declare const matrixManifestSchema: z.ZodEffects<z.ZodObject<{
128
+ export declare const matrixManifestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
123
129
  acquisition: z.ZodLiteral<"continuation">;
124
130
  deadlineAt: z.ZodNumber;
125
131
  chunks: z.ZodArray<z.ZodObject<{
@@ -136,6 +142,10 @@ export declare const matrixManifestSchema: z.ZodEffects<z.ZodObject<{
136
142
  totalBytes: z.ZodNumber;
137
143
  fileKey: z.ZodOptional<z.ZodString>;
138
144
  fileSize: z.ZodOptional<z.ZodNumber>;
145
+ /** The file the job writes; absent means CSV (manifests from before Excel). */
146
+ format: z.ZodOptional<z.ZodEnum<["csv", "xlsx"]>>;
147
+ /** Excel only: the sheet layout the layout batch stored, which compaction wraps the rows in. */
148
+ sheetKey: z.ZodOptional<z.ZodString>;
139
149
  }, "strip", z.ZodTypeAny, {
140
150
  acquisition: "continuation";
141
151
  deadlineAt: number;
@@ -145,8 +155,10 @@ export declare const matrixManifestSchema: z.ZodEffects<z.ZodObject<{
145
155
  }[];
146
156
  totalRows: number;
147
157
  totalBytes: number;
158
+ format?: "csv" | "xlsx" | undefined;
148
159
  fileKey?: string | undefined;
149
160
  fileSize?: number | undefined;
161
+ sheetKey?: string | undefined;
150
162
  }, {
151
163
  acquisition: "continuation";
152
164
  deadlineAt: number;
@@ -156,8 +168,10 @@ export declare const matrixManifestSchema: z.ZodEffects<z.ZodObject<{
156
168
  }[];
157
169
  totalRows: number;
158
170
  totalBytes: number;
171
+ format?: "csv" | "xlsx" | undefined;
159
172
  fileKey?: string | undefined;
160
173
  fileSize?: number | undefined;
174
+ sheetKey?: string | undefined;
161
175
  }>, {
162
176
  acquisition: "continuation";
163
177
  deadlineAt: number;
@@ -167,8 +181,10 @@ export declare const matrixManifestSchema: z.ZodEffects<z.ZodObject<{
167
181
  }[];
168
182
  totalRows: number;
169
183
  totalBytes: number;
184
+ format?: "csv" | "xlsx" | undefined;
170
185
  fileKey?: string | undefined;
171
186
  fileSize?: number | undefined;
187
+ sheetKey?: string | undefined;
172
188
  }, {
173
189
  acquisition: "continuation";
174
190
  deadlineAt: number;
@@ -178,8 +194,36 @@ export declare const matrixManifestSchema: z.ZodEffects<z.ZodObject<{
178
194
  }[];
179
195
  totalRows: number;
180
196
  totalBytes: number;
197
+ format?: "csv" | "xlsx" | undefined;
181
198
  fileKey?: string | undefined;
182
199
  fileSize?: number | undefined;
200
+ sheetKey?: string | undefined;
201
+ }>, {
202
+ acquisition: "continuation";
203
+ deadlineAt: number;
204
+ chunks: {
205
+ chunkNumber: number;
206
+ dataKey: string;
207
+ }[];
208
+ totalRows: number;
209
+ totalBytes: number;
210
+ format?: "csv" | "xlsx" | undefined;
211
+ fileKey?: string | undefined;
212
+ fileSize?: number | undefined;
213
+ sheetKey?: string | undefined;
214
+ }, {
215
+ acquisition: "continuation";
216
+ deadlineAt: number;
217
+ chunks: {
218
+ chunkNumber: number;
219
+ dataKey: string;
220
+ }[];
221
+ totalRows: number;
222
+ totalBytes: number;
223
+ format?: "csv" | "xlsx" | undefined;
224
+ fileKey?: string | undefined;
225
+ fileSize?: number | undefined;
226
+ sheetKey?: string | undefined;
183
227
  }>;
184
228
  export declare function parseMatrixManifest(value: unknown, jobId: string, deadlineAt: number): {
185
229
  acquisition: "continuation";
@@ -190,6 +234,8 @@ export declare function parseMatrixManifest(value: unknown, jobId: string, deadl
190
234
  }[];
191
235
  totalRows: number;
192
236
  totalBytes: number;
237
+ format?: "csv" | "xlsx" | undefined;
193
238
  fileKey?: string | undefined;
194
239
  fileSize?: number | undefined;
240
+ sheetKey?: string | undefined;
195
241
  };
@@ -18,6 +18,20 @@ export declare function prepareMatrixExportPresentation(layout: MatrixExportLayo
18
18
  headers: string[];
19
19
  headerBands: string[][];
20
20
  numericColumns: boolean[];
21
+ /** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
22
+ formatting: {
23
+ levels: Map<string, (value: import('../analytics-protocol/index.js').SemaphorScalarValue) => string>;
24
+ measures: Map<string, (value: import('../analytics-protocol/index.js').SemaphorScalarValue) => string>;
25
+ measureSemantics: Map<string, {
26
+ isNumeric: boolean;
27
+ hasTextAffixes: boolean;
28
+ }>;
29
+ measureFormats: Map<string, import('./types/index.js').MeasureCanonicalFormat>;
30
+ absence: {
31
+ emptyText: string;
32
+ nullText: string;
33
+ };
34
+ };
21
35
  /** A row's cells; after `previous`, a tabular layout prints each label once. */
22
36
  row: (data: MatrixExportRow, previous?: MatrixExportRow) => string[];
23
37
  /**
@@ -45,6 +59,12 @@ export declare function matrixFlatCsvHeaders(layout: MatrixExportLayout): string
45
59
  * CSV. Prepare `formatting` once per batch with `prepareMatrixFormatting`.
46
60
  */
47
61
  export declare function matrixFlatCsvRow(data: MatrixExportRow, layout: MatrixExportLayout, formatting: MatrixFormatting): string[];
62
+ /**
63
+ * One Flat row's display text, unguarded: what the Excel form writes and the
64
+ * CSV form protects. Level values as the screen and Layout label members
65
+ * (`(Blank)` for a null member); measures through the card's formatter.
66
+ */
67
+ export declare function matrixFlatRowText(data: MatrixExportRow, layout: MatrixExportLayout, formatting: MatrixFormatting): string[];
48
68
  /** Bounded physical projection only; values and totals have already been acquired. */
49
69
  export declare function buildMatrixTableStructure(input: {
50
70
  layout: MatrixExportLayout;
@@ -647,7 +667,7 @@ export declare function buildMatrixPrintTable(input: {
647
667
  } | undefined;
648
668
  };
649
669
  mode: "flat";
650
- format: "csv";
670
+ format: "csv" | "xlsx";
651
671
  spec: {
652
672
  source: {
653
673
  kind: "semantic";
@@ -0,0 +1,27 @@
1
+ import { MatrixExportLayout, MatrixExportRequest, MatrixExportRow } from '../analytics-protocol/index.js';
2
+ import { ReportRuntimeContext } from '../report-runtime-context/index.js';
3
+ import { XlsxRow, XlsxSheet } from './exporters/xlsx-file.js';
4
+ import { MatrixFormatting } from './formatters/matrix-formatter.js';
5
+ /** Prepared once per batch, like the CSV presentation it reads. */
6
+ export declare function prepareMatrixXlsxPresentation(layout: MatrixExportLayout, request: MatrixExportRequest, report: ReportRuntimeContext): {
7
+ /** Header bands as header rows (XL-D16), with merges from identity (XL-D34). */
8
+ xlsxSheet: (input: {
9
+ title: string;
10
+ includeHeaders: boolean;
11
+ }) => XlsxSheet;
12
+ /** Every row label repeated; subtotal and grand-total rows are 'total' (bold). */
13
+ xlsxRows: (rows: readonly MatrixExportRow[]) => XlsxRow[];
14
+ };
15
+ /**
16
+ * The Flat form, prepared once per batch like the layout form: its columns
17
+ * (and their number formats) are built once, never per row.
18
+ */
19
+ export declare function prepareMatrixFlatXlsxPresentation(layout: MatrixExportLayout, formatting: MatrixFormatting): {
20
+ /** One header row of the layout's column labels. */
21
+ xlsxSheet: (input: {
22
+ title: string;
23
+ includeHeaders: boolean;
24
+ }) => XlsxSheet;
25
+ /** Flat rows with the card's formats (MX-D10) and typed measure cells. */
26
+ xlsxRows: (rows: readonly MatrixExportRow[]) => XlsxRow[];
27
+ };
@@ -12,6 +12,15 @@ export declare const FAST_PDF_POLICY: Readonly<{
12
12
  maxOutputBytes: 52428800;
13
13
  }>;
14
14
  export declare const PDF_SAFETY_LIMIT_EXCEEDED: "PDF_SAFETY_LIMIT_EXCEEDED";
15
+ /**
16
+ * Card types a PDF prints as a table, across pages, in table mode. The one
17
+ * list every reader uses: the interactive download and export dialog, the
18
+ * fast path, the print views and scheduled attachments (report attachment
19
+ * delivery RA-D1).
20
+ */
21
+ export declare const PDF_TABLE_CARD_TYPES: readonly ["table", "detailTable", "aggregateTable", "pivotTable"];
22
+ export type PdfTableCardType = (typeof PDF_TABLE_CARD_TYPES)[number];
23
+ export declare function isPdfTableCardType(cardType: unknown): cardType is PdfTableCardType;
15
24
  /** Exact UTF-8 bytes used by the structured POST body. */
16
25
  export declare function getUtf8ByteLength(value: string): number;
17
26
  export declare function isFastPdfRowCountEligible(rowCount: number): boolean;
@@ -2,7 +2,7 @@ import { ResolvedRawTemporalFormat } from './raw-temporal.js';
2
2
  import { ReportRuntimeContext } from '../report-runtime-context/index.js';
3
3
  import { NumericPresentationTarget } from './numeric-presentation.js';
4
4
  import { ResolvedTemporalBucketFormat } from './temporal-bucket.js';
5
- import { DurationCanonicalFormat, MeasureCanonicalFormat, NumericCanonicalFormat } from './types/index.js';
5
+ import { DateCanonicalFormat, DurationCanonicalFormat, MeasureCanonicalFormat, NumericCanonicalFormat } from './types/index.js';
6
6
  export type PresentationScope = {
7
7
  dashboardId: string;
8
8
  cardId?: string;
@@ -30,6 +30,22 @@ export type ResolvedDurationPresentationEntry = {
30
30
  target: NumericPresentationTarget;
31
31
  format: DurationCanonicalFormat;
32
32
  };
33
+ /**
34
+ * A date presentation on a numeric (epoch milliseconds) column: a semantic
35
+ * date format the dashboard shows as a date (Excel exports plan XL-D27).
36
+ * Column targets only; `locale` is resolved at capture.
37
+ */
38
+ export type ResolvedDatePresentationEntry = {
39
+ scope: PresentationScope;
40
+ target: {
41
+ kind: 'column';
42
+ columnKey: string;
43
+ };
44
+ format: ResolvedDateFormat;
45
+ };
46
+ export type ResolvedDateFormat = Pick<DateCanonicalFormat, 'type' | 'pattern' | 'timezone' | 'sourceTimezone'> & {
47
+ locale: string;
48
+ };
33
49
  export type ResolvedTemporalBucketPresentationEntry = {
34
50
  scope: PresentationScope;
35
51
  target: TemporalBucketPresentationTarget;
@@ -44,7 +60,7 @@ export type ResolvedRawTemporalPresentationEntry = {
44
60
  target: RawTemporalPresentationTarget;
45
61
  format: ResolvedRawTemporalFormat;
46
62
  };
47
- export type ResolvedPresentationEntry = ResolvedNumericPresentationEntry | ResolvedDurationPresentationEntry | ResolvedTemporalBucketPresentationEntry | ResolvedRawTemporalPresentationEntry;
63
+ export type ResolvedPresentationEntry = ResolvedNumericPresentationEntry | ResolvedDurationPresentationEntry | ResolvedTemporalBucketPresentationEntry | ResolvedRawTemporalPresentationEntry | ResolvedDatePresentationEntry;
48
64
  export type PresentationExecutionSnapshot = {
49
65
  version: 1;
50
66
  reportContext: ReportRuntimeContext;
@@ -82,6 +98,15 @@ export declare function findResolvedMeasureFormat(input: {
82
98
  scope: PresentationScope;
83
99
  target: NumericPresentationTarget;
84
100
  }): MeasureCanonicalFormat | undefined;
101
+ /** The date presentation captured for an epoch column (XL-D27), if any. */
102
+ export declare function findResolvedDateFormat(input: {
103
+ snapshot: PresentationExecutionSnapshot;
104
+ scope: PresentationScope;
105
+ target: {
106
+ kind: 'column';
107
+ columnKey: string;
108
+ };
109
+ }): ResolvedDateFormat | undefined;
85
110
  export declare function findResolvedRawTemporalFormat(input: {
86
111
  snapshot: PresentationExecutionSnapshot;
87
112
  scope: PresentationScope;
@@ -1,3 +1,4 @@
1
+ import { ExportWallClock } from './exporters/export-cells.js';
1
2
  import { CalendarContext } from '../report-runtime-context/report-runtime-context.js';
2
3
  import { RawTemporalValueKind, RawTemporalValueMetadata } from '../analytics-protocol/contracts.js';
3
4
  import { parseRawTemporalValueMetadata, validateRawTemporalResultColumn } from '../analytics-protocol/raw-temporal-contract.js';
@@ -31,6 +32,13 @@ export type RawTemporalFormatResult = {
31
32
  ok: true;
32
33
  text: string;
33
34
  status: 'formatted' | 'empty';
35
+ /**
36
+ * The calendar date and time `text` shows, with no zone: the same
37
+ * interpretation (date-only, wall clock, instant, source zone) that made
38
+ * the text. Present when `status` is 'formatted'. Excel exports write it
39
+ * as a date serial (Excel exports plan XL-D35).
40
+ */
41
+ wallClock?: ExportWallClock;
34
42
  } | {
35
43
  ok: false;
36
44
  text: string;
@@ -0,0 +1,8 @@
1
+ export { prepareTableExport } from './prepare-table-export.js';
2
+ export type { PreparedTableColumn, TableExportContent, TableExportFormatter, } from './prepare-table-export.js';
3
+ export { parseTableExportFormatting, tableExportFormattingFromOptions } from './table-export-formatting.js';
4
+ export type { TableExportFormatting } from './table-export-formatting.js';
5
+ export type { TableExportResult, TableExportResultColumn } from './table-export-result.js';
6
+ export { requiresRawTemporalSqlChunkEvidence } from './table-export-raw-temporal.js';
7
+ export { TABLE_EXPORT_SHEET_SAMPLE_ROWS, defineTableExportSheet, tableExportXlsxRows, encodeTableExportWorkbook, tableExportSheetColumns, serializeTableExportSheetColumns, parseTableExportSheetColumns, tableExportJobSheet, } from './table-export-sheet.js';
8
+ export type { TableExportSheetColumns } from './table-export-sheet.js';
@@ -0,0 +1,50 @@
1
+ import { ExportCell, ExportDataType, XlsxColumn, XlsxColumnPresentation } from '../exporters/export-cells.js';
2
+ import { RawTemporalChunkClassificationEvidence } from '../raw-temporal.js';
3
+ import { TableExportFormatting } from './table-export-formatting.js';
4
+ import { TableExportResult } from './table-export-result.js';
5
+ /** One visible column, prepared once. Data type, identity and presentation stay separate. */
6
+ export type PreparedTableColumn = {
7
+ /** Result key (identity). */
8
+ key: string;
9
+ /** Header label. */
10
+ label: string;
11
+ /** Authoritative, from `resultColumns`; decides Excel cell type and whether strings may be numbers. */
12
+ dataType: ExportDataType;
13
+ /** What made the display text; decides the Excel number format. */
14
+ presentation?: XlsxColumnPresentation;
15
+ /** resolveXlsxColumn of the above. */
16
+ xlsx: XlsxColumn;
17
+ /**
18
+ * These values could not type the Excel column: a declared SQL date column
19
+ * whose values here are all empty or invalid (its raw temporal evidence is
20
+ * inconclusive), so `xlsx` is text. A background job takes the column's
21
+ * type from the chunks that could (`tableExportJobSheet`).
22
+ */
23
+ xlsxPending?: true;
24
+ };
25
+ /** The rows of one table export, ready for any encoder. */
26
+ export type TableExportContent = {
27
+ /** Header labels in visible order; undefined when headers are off. */
28
+ header?: string[];
29
+ /** One prepared column per visible column. */
30
+ columns: PreparedTableColumn[];
31
+ /** Typed cells; `exportCellText` of each is the display text. */
32
+ rows: ExportCell[][];
33
+ /** Raw temporal evidence the compactor's chunk-agreement check needs (unchanged). */
34
+ rawTemporalClassification?: RawTemporalChunkClassificationEvidence;
35
+ };
36
+ /** Prepared once per export (browser) or per chunk (Lambda). */
37
+ export type TableExportFormatter = {
38
+ /** Header, columns and typed cells for these records. `withHeader` false skips the header (chunks after the first). */
39
+ format(result: TableExportResult, options?: {
40
+ withHeader?: boolean;
41
+ }): TableExportContent;
42
+ /** The totals row: 'Total' in the label column, '' in other dimensions, formatted metric totals. Undefined when totalRows is 0. */
43
+ totals(totalsByColumnId: Record<string, unknown>, totalRows: number): ExportCell[] | undefined;
44
+ };
45
+ export declare function prepareTableExport(input: {
46
+ formatting: TableExportFormatting;
47
+ cardType: 'table' | 'detailTable' | 'pivotTable' | 'aggregateTable';
48
+ /** The /api/v1/query body the rows came from (a background job's `queryPayload`). Read for the effective card config, result owner, SQL and Python flags. */
49
+ queryPayload: Record<string, unknown>;
50
+ }): TableExportFormatter;
@@ -0,0 +1,47 @@
1
+ import { CsvDelimiter, CsvEncoding } from '../exporters/csv-utils.js';
2
+ import { ExportFileFormat } from '../exporters/export-file-format.js';
3
+ import { PresentationExecutionSnapshot } from '../presentation-execution.js';
4
+ /** The formatting contract a table export carries (same keys and checks as the scheduler's former contract, plus `fileFormat`). */
5
+ export type TableExportFormatting = {
6
+ scope: {
7
+ dashboardId: string;
8
+ cardId: string;
9
+ };
10
+ useFormattedValues: boolean;
11
+ /** Must equal presentationExecutionSnapshot.reportContext.calendar.tz. */
12
+ timezone: string;
13
+ presentationExecutionSnapshot: PresentationExecutionSnapshot;
14
+ delimiter: CsvDelimiter;
15
+ csvEncoding: CsvEncoding;
16
+ includeHeaders: boolean;
17
+ /** The card's persisted column settings. Only `type: 'date'` and `dateFormat` are read. */
18
+ columnSettings?: Record<string, unknown>;
19
+ /** Required when values are formatted; a stored-value export may omit it (columns then come from the result). */
20
+ visibleColumns?: string[];
21
+ columnLabels?: Record<string, string>;
22
+ tableTotalsLabelColumnKey?: string;
23
+ /** The file format the workers write. Absent means 'csv', so jobs dispatched before this field existed still run. */
24
+ fileFormat?: ExportFileFormat;
25
+ /** The export's title. Names the Excel sheet, as the browser download does; CSV ignores it. */
26
+ title?: string;
27
+ };
28
+ /** Checks a table export's formatting contract. Unknown keys and retired keys are rejected. */
29
+ export declare function parseTableExportFormatting(input: unknown): TableExportFormatting;
30
+ /**
31
+ * The formatting contract for a table export job, assembled field by field
32
+ * from the export request's `formatOptions`: what the app's export executor
33
+ * dispatches to the workers and what the browser download formats with, so
34
+ * the two never differ. Fields the workers do not read (browser timezone,
35
+ * comparison presentation) are dropped here. Check the result with
36
+ * `parseTableExportFormatting`.
37
+ */
38
+ export declare function tableExportFormattingFromOptions(input: {
39
+ dashboardId: string;
40
+ cardId: string;
41
+ formatOptions: Record<string, unknown> & {
42
+ presentationExecutionSnapshot: PresentationExecutionSnapshot;
43
+ };
44
+ fileFormat?: ExportFileFormat;
45
+ /** The export's title (names the Excel sheet). */
46
+ title?: string | null;
47
+ }): Record<string, unknown>;
@@ -0,0 +1,40 @@
1
+ import { prepareRawTemporalFormatter, RawTemporalChunkClassificationEvidence, RawTemporalValueMetadata, ResolvedRawTemporalFormat } from '../raw-temporal.js';
2
+ import { ExportWallClock } from '../exporters/export-cells.js';
3
+ import { TableExportFormatting } from './table-export-formatting.js';
4
+ import { TableExportResultColumn } from './table-export-result.js';
5
+ type PreparedRawTemporalColumn = {
6
+ metadata: RawTemporalValueMetadata;
7
+ format: ResolvedRawTemporalFormat;
8
+ formatValue: ReturnType<typeof prepareRawTemporalFormatter>;
9
+ };
10
+ export type RawTemporalExportResolution = {
11
+ activatedColumnKeys: ReadonlySet<string>;
12
+ byColumnKey: ReadonlyMap<string, PreparedRawTemporalColumn>;
13
+ sqlChunkEvidence?: RawTemporalChunkClassificationEvidence;
14
+ };
15
+ export declare function requiresRawTemporalSqlChunkEvidence(input: {
16
+ formatting: TableExportFormatting;
17
+ queryPayload?: Record<string, unknown>;
18
+ }): boolean;
19
+ export declare function resolveRawTemporalExportPresentation(input: {
20
+ records: readonly Record<string, unknown>[];
21
+ columns: readonly TableExportResultColumn[];
22
+ formatting: TableExportFormatting;
23
+ queryPayload?: Record<string, unknown>;
24
+ }): RawTemporalExportResolution;
25
+ /**
26
+ * One raw temporal cell. Undefined when the column is not activated (other
27
+ * rules apply). A missing key in an activated column is a broken result and
28
+ * fails, whoever owns the result (SPEC §3.0 case 4).
29
+ */
30
+ export declare function formatRawTemporalExportValue(input: {
31
+ value: unknown;
32
+ columnKey: string;
33
+ rowIndex: number;
34
+ resolution: RawTemporalExportResolution;
35
+ }): {
36
+ text: string;
37
+ wallClock?: ExportWallClock;
38
+ } | undefined;
39
+ export declare function rawTemporalColumnIsDateOnly(resolution: RawTemporalExportResolution, columnKey: string): boolean | undefined;
40
+ export {};
@@ -0,0 +1,31 @@
1
+ import { RawTemporalValueMetadata, SemaphorResultColumn, TemporalBucketMetadata } from '../../analytics-protocol/contracts.js';
2
+ import { QueryColumnKeyMap } from '../pivot-result-identity.js';
3
+ /** A result column as the response describes it (`columns`). */
4
+ export type TableExportResultColumn = {
5
+ key?: string;
6
+ field?: string;
7
+ label?: string;
8
+ headerName?: string;
9
+ temporalBucket?: TemporalBucketMetadata;
10
+ rawTemporal?: RawTemporalValueMetadata;
11
+ pivotIdentity?: {
12
+ metricId: string;
13
+ metricAlias: string;
14
+ members?: Array<{
15
+ fieldId: string;
16
+ value: string | null;
17
+ temporalBucket?: TemporalBucketMetadata;
18
+ }>;
19
+ };
20
+ };
21
+ export type TableExportResult = {
22
+ records: readonly Record<string, unknown>[];
23
+ columns: readonly TableExportResultColumn[];
24
+ /** Authoritative data types (SemaphorResultColumn.dataType), from the same response. Missing columns are 'unknown'. */
25
+ resultColumns: readonly Pick<SemaphorResultColumn, 'key' | 'dataType'>[];
26
+ columnKeyMap?: QueryColumnKeyMap;
27
+ /** Pivot column classifications (deprecated pivot results only). */
28
+ columnMetadata?: unknown;
29
+ /** 'not_pivot' for Table and Detail Table; the other values only for deprecated pivot results. */
30
+ pivotResultKind: 'not_pivot' | 'canonical' | 'legacy_raw';
31
+ };
@@ -0,0 +1,38 @@
1
+ import { ExportCell, XlsxColumn } from '../exporters/export-cells.js';
2
+ import { XlsxRow, XlsxSheet } from '../exporters/xlsx-file.js';
3
+ import { TableExportContent } from './prepare-table-export.js';
4
+ /** Rows a sheet reads to size its columns (SPEC XL-SI-10). */
5
+ export declare const TABLE_EXPORT_SHEET_SAMPLE_ROWS = 200;
6
+ /**
7
+ * The sheet a table export writes: the title names it, the header is its one
8
+ * header row, and the first rows size its columns. The background job calls
9
+ * this with its first chunk's content; that chunk holds the same first rows.
10
+ */
11
+ export declare function defineTableExportSheet(title: string | null | undefined, content: Pick<TableExportContent, 'columns' | 'header' | 'rows'>): XlsxSheet;
12
+ /** A table export's rows as sheet rows: body rows, then the totals row when there is one. */
13
+ export declare function tableExportXlsxRows(rows: readonly ExportCell[][], totals?: readonly ExportCell[]): XlsxRow[];
14
+ /** The whole workbook of a table export (the browser download). An Excel limit throws XlsxLimitError. */
15
+ export declare function encodeTableExportWorkbook(title: string | null | undefined, content: Pick<TableExportContent, 'columns' | 'header' | 'rows'>, totals?: readonly ExportCell[]): Uint8Array;
16
+ /**
17
+ * One chunk's Excel columns, as a background job compares them: each column,
18
+ * and whether this chunk's values could type it (`pending` when they could
19
+ * not, `PreparedTableColumn.xlsxPending`). Stored beside the chunk before it
20
+ * is completed (XL-D37).
21
+ */
22
+ export type TableExportSheetColumns = {
23
+ columns: readonly XlsxColumn[];
24
+ pending: readonly boolean[];
25
+ };
26
+ export declare function tableExportSheetColumns(content: Pick<TableExportContent, 'columns'>): TableExportSheetColumns;
27
+ export declare function serializeTableExportSheetColumns(value: TableExportSheetColumns): string;
28
+ export declare function parseTableExportSheetColumns(json: string): TableExportSheetColumns;
29
+ /**
30
+ * The sheet a background job writes: the first chunk's sheet, with each
31
+ * column's type settled across the chunks. Every chunk has the same columns
32
+ * (key and label); at each position the chunks that could type it agree, and
33
+ * a chunk that could not (all its dates empty, for example) is no evidence.
34
+ * When no chunk could, the first chunk's column stands (its cells are empty
35
+ * or text). Chunks that disagree, or a sheet that is not the first chunk's,
36
+ * are a fault and throw: the job fails rather than mislabel dates.
37
+ */
38
+ export declare function tableExportJobSheet(sheet: XlsxSheet, chunks: readonly TableExportSheetColumns[]): XlsxSheet;
@@ -1,3 +1,4 @@
1
+ import { ExportWallClock } from './exporters/export-cells.js';
1
2
  import { SemaphorTimeGrain, TemporalBucketFormat, TemporalBucketMetadata, TemporalBucketPreset } from '../analytics-protocol/contracts.js';
2
3
  import { ResolvedTemporalStyleSet } from './raw-temporal.js';
3
4
  export type { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
@@ -77,6 +78,14 @@ export declare function parseTemporalBucketValue(value: TemporalBucketValue, met
77
78
  export declare function describeTemporalBucketCalendar(metadata: TemporalBucketMetadata): string;
78
79
  export declare function parseResolvedTemporalBucketFormat(input: unknown): ResolvedTemporalBucketFormatParseResult;
79
80
  export declare function resolveTemporalBucketPresentation(input: ResolveTemporalBucketPresentationInput): ResolvedTemporalBucketPresentation;
81
+ /**
82
+ * The start of a bucket as a calendar date and time with no zone, for the
83
+ * grains Excel shows as dates (second to month); undefined for week, quarter
84
+ * and year buckets, blanks and invalid values. Bucket values are already wall
85
+ * clock in the governed calendar, so this is the value `formatTemporalBucket`
86
+ * presents (Excel exports plan XL-D35).
87
+ */
88
+ export declare function temporalBucketWallClock(value: TemporalBucketValue, metadata: TemporalBucketMetadata): ExportWallClock | undefined;
80
89
  export declare function formatTemporalBucket(input: {
81
90
  value: TemporalBucketValue;
82
91
  metadata: TemporalBucketMetadata;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.540",
8
+ "version": "0.1.542",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -204,6 +204,7 @@
204
204
  "date-fns-tz": "^3.2.0",
205
205
  "dompurify": "^3.4.2",
206
206
  "fast-deep-equal": "^3.1.3",
207
+ "fflate": "^0.8.3",
207
208
  "immer": "^10.0.3",
208
209
  "jwt-decode": "^4.0.0",
209
210
  "lexical": "^0.43.0",