react-semaphor 0.1.541 → 0.1.543

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 (109) 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 +51 -49
  5. package/dist/chunks/apply-dashboard-operations-CG9S7MGt.js +2260 -0
  6. package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-BFMRUYoB.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-Bv18samq.js +1618 -0
  10. package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
  11. package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-B9mKTJoy.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-Bdmry_oG.js} +18 -18
  13. package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-UGpjOM2k.js} +69 -70
  14. package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
  15. package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-DG8dz0eX.js} +4 -4
  16. package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-OwqCbrVp.js} +2382 -4975
  17. package/dist/chunks/document-sheet-utils-BTb3VZxV.js +3619 -0
  18. package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-CDpA4y5e.js} +728 -728
  19. package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
  20. package/dist/chunks/{index-DaQlghLY.js → index-l5LclZvs.js} +824 -1351
  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-F_-H6VAw.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-DupbRk-R.js +1155 -0
  31. package/dist/chunks/raw-temporal-presentation-D-azM_98.js +585 -0
  32. package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-CPwRwEJx.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-CJ2WpoMF.js → saved-dashboard-context-BKvMfRfC.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-KT598QJq.js → semaphor-ready-indicator-CN2AHm2x.js} +37489 -39476
  37. package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-BGl_rxcW.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-BDRXLLdq.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-DdD12SMY.js → use-create-flow-overlay-state-BnclfB2k.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 +462 -457
  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 -241
  53. package/dist/index.js +174 -175
  54. package/dist/report-runtime-context/index.js +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  57. package/dist/types/briefings/attachments.d.ts +17 -1
  58. package/dist/types/briefings/index.d.ts +5 -3
  59. package/dist/types/index.js +48 -48
  60. package/dist/types/lib/api/exports-api.d.ts +11 -65
  61. package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
  62. package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
  63. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
  64. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
  65. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
  66. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
  67. package/dist/types/lib/types/explorer-types.d.ts +6 -0
  68. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
  69. package/dist/types/shared/assistant-context/index.d.ts +1 -1
  70. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
  71. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
  72. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  73. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
  74. package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
  75. package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
  76. package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
  77. package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
  78. package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
  79. package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
  80. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
  81. package/dist/types/shared/format-utils/index.d.ts +2 -0
  82. package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
  83. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
  84. package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
  85. package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
  86. package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
  87. package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
  88. package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
  89. package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
  90. package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
  91. package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
  92. package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
  93. package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
  94. package/package.json +2 -1
  95. package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
  96. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
  97. package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
  98. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
  99. package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
  100. package/dist/chunks/common-types-CUf03Htv.js +0 -288
  101. package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
  102. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
  103. package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
  104. package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
  105. package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
  106. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
  107. package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
  108. package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
  109. package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
@@ -0,0 +1,90 @@
1
+ import { ExactNumericValue } from '../../analytics-protocol/scalar-value.js';
2
+ import { MeasureCanonicalFormat } from '../types/format-types.js';
3
+ export type ExportDataType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
4
+ /** What an export path knows about one column. Input to resolveXlsxColumn. */
5
+ export type XlsxColumnInput = {
6
+ key: string;
7
+ /** The column's header label. */
8
+ label: string;
9
+ /** "Use formatted values". False means stored values. */
10
+ formattedValues: boolean;
11
+ /** Authoritative: from the result's `resultColumns` (SemaphorResultColumn.dataType); 'unknown' when absent. */
12
+ dataType: ExportDataType;
13
+ /** The presentation that made this column's display text, if any. */
14
+ presentation?: XlsxColumnPresentation;
15
+ };
16
+ export type XlsxColumnPresentation =
17
+ /** A numeric or duration measure format (from the presentation snapshot). */
18
+ {
19
+ kind: 'measure';
20
+ format: MeasureCanonicalFormat;
21
+ }
22
+ /** A grouped date. `grain` from the bucket metadata; an unlisted grain is 'custom'. */
23
+ | {
24
+ kind: 'temporal_bucket';
25
+ grain: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' | 'fiscal' | 'custom';
26
+ }
27
+ /** A raw date or datetime column, or a column with date settings. `dateOnly` when its values carry no time. */
28
+ | {
29
+ kind: 'datetime';
30
+ dateOnly: boolean;
31
+ }
32
+ /** Shown as text, including epoch numbers shown as dates. */
33
+ | {
34
+ kind: 'text';
35
+ };
36
+ /** A column as the Excel writer needs it. Built only by resolveXlsxColumn. */
37
+ export type XlsxColumn = {
38
+ readonly key: string;
39
+ readonly label: string;
40
+ /** 'by_value' types each value by its JS type: stored-value exports and columns of unknown type. */
41
+ readonly cellType: 'number' | 'date' | 'boolean' | 'text' | 'by_value';
42
+ /** Excel number format code for number and date cells; undefined means General. */
43
+ readonly numberFormat?: string;
44
+ };
45
+ /** One exported cell. `text` is its display text. */
46
+ export type ExportCell = {
47
+ kind: 'empty';
48
+ } | {
49
+ kind: 'text';
50
+ text: string;
51
+ } | {
52
+ kind: 'number';
53
+ text: string;
54
+ /** A JS number, an exact decimal, or plain decimal text. */
55
+ value: number | ExactNumericValue | string;
56
+ } | {
57
+ kind: 'date';
58
+ text: string;
59
+ serial: number;
60
+ } | {
61
+ kind: 'boolean';
62
+ text: string;
63
+ value: boolean;
64
+ };
65
+ /** A calendar date and time with no zone, as a temporal owner interpreted it for display. */
66
+ export type ExportWallClock = {
67
+ year: number;
68
+ month: number;
69
+ day: number;
70
+ hour: number;
71
+ minute: number;
72
+ second: number;
73
+ };
74
+ /** Pure. Never throws. The complete rule is the two tables in the Excel exports spec (§2.2). */
75
+ export declare function resolveXlsxColumn(input: XlsxColumnInput): XlsxColumn;
76
+ /** A plain decimal: optional '-', digits, optional '.digits', optional exponent. No grouping separators, no spaces. */
77
+ export declare function parsePlainNumericString(value: string): string | undefined;
78
+ /**
79
+ * The cell rule. Pure; never throws. `text` is the display text the path made.
80
+ * `wallClock` is supplied for date columns by the temporal owner that made
81
+ * `text`; this module never parses dates. First matching rule wins (spec §2.3).
82
+ */
83
+ export declare function toExportCell(input: {
84
+ value: unknown;
85
+ text: string;
86
+ column: XlsxColumn;
87
+ wallClock?: ExportWallClock;
88
+ }): ExportCell;
89
+ /** The display text: '' for empty, otherwise `text`. */
90
+ export declare function exportCellText(cell: ExportCell): string;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The export file format owner: what a CSV or Excel export file is called,
3
+ * typed, keyed and stored as. Every export producer (browser downloads, the
4
+ * app's export routes, the chunk and compaction Lambdas, Briefing
5
+ * attachments) reads these traits instead of writing its own extension,
6
+ * content type or storage-key suffix. See "Excel file standard" in the
7
+ * format-utils README.
8
+ * IMPORTANT: No React or browser-specific imports allowed
9
+ */
10
+ /** Data file formats a Table, Detail Table or Matrix export can produce. */
11
+ export declare const EXPORT_FILE_FORMATS: readonly ["csv", "xlsx"];
12
+ export type ExportFileFormat = (typeof EXPORT_FILE_FORMATS)[number];
13
+ /** Content type of every delivered Excel workbook. */
14
+ export declare const XLSX_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
15
+ export type ExportFileTraits = {
16
+ format: ExportFileFormat;
17
+ /** File name extension without the dot: 'csv' | 'xlsx'. */
18
+ extension: 'csv' | 'xlsx';
19
+ /** CSV_CONTENT_TYPE | XLSX_CONTENT_TYPE. */
20
+ contentType: string;
21
+ /** Extension of one chunk or Matrix batch object before compaction: 'csv' | 'xml'. */
22
+ partExtension: 'csv' | 'xml';
23
+ /** Content type that object is stored with: 'text/csv' (as Matrix attempts have always been stored) | 'application/xml'. */
24
+ partContentType: 'text/csv' | 'application/xml';
25
+ /** File name of the compacted background artifact: 'export.csv.gz' | 'export.xlsx'. */
26
+ compactedFileName: 'export.csv.gz' | 'export.xlsx';
27
+ /** How the compacted artifact is stored: CSV gzipped, a workbook as is (already a zip). */
28
+ storedEncoding: 'gzip' | 'identity';
29
+ /** Stored form: Prisma ExportFormat value and the export job config's `format`. */
30
+ storedValue: 'CSV' | 'XLSX';
31
+ /** Customer-facing name: 'CSV' | 'Excel'. */
32
+ label: 'CSV' | 'Excel';
33
+ };
34
+ export declare function parseExportFileFormat(value: unknown): ExportFileFormat | undefined;
35
+ export declare function exportFileTraits(format: ExportFileFormat): ExportFileTraits;
36
+ export declare function exportFileFormatFromStored(value: 'CSV' | 'XLSX'): ExportFileFormat;
37
+ /** For a client reading a server response: the format whose contentType matches (ignoring parameters), else undefined. */
38
+ export declare function exportFileFormatFromContentType(contentType: string | null): ExportFileFormat | undefined;
39
+ /** `${safeTitle}-${UTC timestamp}.${extension}`. The only export file name builder. */
40
+ export declare function exportFileName(input: {
41
+ format: ExportFileFormat;
42
+ title: string | null | undefined;
43
+ at?: Date;
44
+ }): string;
@@ -1,2 +1,8 @@
1
1
  export { CSV_ENCODINGS, DEFAULT_CSV_ENCODING, CSV_DELIMITERS, CSV_RECORD_SEPARATOR, CSV_CONTENT_TYPE, parseCsvEncoding, parseCsvDelimiter, resolveCsvEncoding, csvFilePreamble, toCsvCell, escapeCSVValue, protectCSVText, csvRecord, csvRecords, encodeCsvFile, } from './csv-utils.js';
2
2
  export type { CsvEncoding, CsvDelimiter, CsvCell } from './csv-utils.js';
3
+ export { EXPORT_FILE_FORMATS, XLSX_CONTENT_TYPE, parseExportFileFormat, exportFileTraits, exportFileFormatFromStored, exportFileFormatFromContentType, exportFileName, } from './export-file-format.js';
4
+ export type { ExportFileFormat, ExportFileTraits } from './export-file-format.js';
5
+ export { resolveXlsxColumn, exportCellText } from './export-cells.js';
6
+ export type { ExportDataType, XlsxColumnInput, XlsxColumnPresentation, XlsxColumn, ExportCell, ExportWallClock, } from './export-cells.js';
7
+ export { XlsxLimitError, isXlsxLimitError, XLSX_LIMIT_FAILURE_REASONS, xlsxLimitFailureReason, assertXlsxColumnCount, defineXlsxSheet, serializeXlsxSheet, parseXlsxSheet, withXlsxSheetColumns, serializeXlsxColumns, parseXlsxColumns, xlsxColumnsFingerprint, encodeXlsxFile, encodeXlsxRows, streamXlsxFile, } from './xlsx-file.js';
8
+ export type { XlsxSheet, XlsxRow, XlsxMerge, XlsxLimitFailureReason } from './xlsx-file.js';
@@ -0,0 +1,90 @@
1
+ import { ExportCell, XlsxColumn } from './export-cells.js';
2
+ /** The only error the Excel modules throw on purpose. Its message is customer-facing and product-neutral. */
3
+ export declare class XlsxLimitError extends Error {
4
+ /** `size` counts sheet XML bytes. */
5
+ readonly limit: 'rows' | 'columns' | 'size';
6
+ readonly actual: number;
7
+ readonly max: number;
8
+ constructor(limit: 'rows' | 'columns' | 'size', actual: number, max: number);
9
+ }
10
+ /**
11
+ * The export failure catalog reason for each Excel limit (SPEC §2.6). A worker
12
+ * that hits a limit inside a job reports this reason; the app's catalog holds
13
+ * the message. Nothing ever recovers a reason from message text.
14
+ */
15
+ export declare const XLSX_LIMIT_FAILURE_REASONS: readonly ["excel_row_limit", "excel_column_limit", "excel_size_limit"];
16
+ export type XlsxLimitFailureReason = (typeof XLSX_LIMIT_FAILURE_REASONS)[number];
17
+ export declare function xlsxLimitFailureReason(error: XlsxLimitError): XlsxLimitFailureReason;
18
+ /** Throws XlsxLimitError('columns') when a sheet would be wider than Excel allows: for callers that know the width before any rows exist (XL-D33). */
19
+ export declare function assertXlsxColumnCount(count: number): void;
20
+ /** Structural, so an error from another copy of this module still counts. */
21
+ export declare function isXlsxLimitError(error: unknown): error is XlsxLimitError;
22
+ export type XlsxMerge = {
23
+ row: number;
24
+ firstColumn: number;
25
+ lastColumn: number;
26
+ };
27
+ /** A validated sheet layout that every writer of one file shares. Built only by defineXlsxSheet. */
28
+ export type XlsxSheet = {
29
+ readonly name: string;
30
+ readonly columns: readonly XlsxColumn[];
31
+ /** Header rows above the data, top first. Empty when headers are off. */
32
+ readonly headerRows: readonly (readonly string[])[];
33
+ /** Horizontal merges inside header rows (Matrix column bands). Zero-based. */
34
+ readonly merges: readonly XlsxMerge[];
35
+ /** Column widths in characters, one per column. */
36
+ readonly widths: readonly number[];
37
+ };
38
+ /**
39
+ * Validates and freezes a sheet. Throws XlsxLimitError('columns') above 16,384
40
+ * columns. `sampleRows` only tunes widths.
41
+ */
42
+ export declare function defineXlsxSheet(input: {
43
+ title: string;
44
+ columns: readonly XlsxColumn[];
45
+ headerRows: readonly (readonly string[])[];
46
+ /** Explicit header merges. The caller derives them from identity (Matrix: member paths and roles); the writer only validates and writes them. */
47
+ merges?: readonly XlsxMerge[];
48
+ sampleRows?: readonly (readonly ExportCell[])[];
49
+ }): XlsxSheet;
50
+ /** JSON form, for workers that share one sheet (the first chunk or layout batch writes it; compaction reads it). */
51
+ export declare function serializeXlsxSheet(sheet: XlsxSheet): string;
52
+ /**
53
+ * The same sheet with settled columns, one per existing column. A background
54
+ * job's first chunk writes the sheet; a column its rows could not type takes
55
+ * the type the other chunks found (row fragments do not depend on it: styles
56
+ * go by column position).
57
+ */
58
+ export declare function withXlsxSheetColumns(sheet: XlsxSheet, columns: readonly XlsxColumn[]): XlsxSheet;
59
+ /** A column list as JSON and back, checked as a sheet's columns are. */
60
+ export declare function serializeXlsxColumns(columns: readonly XlsxColumn[]): string;
61
+ export declare function parseXlsxColumns(value: unknown): XlsxColumn[];
62
+ export declare function parseXlsxSheet(json: string): XlsxSheet;
63
+ /** Stable hash of a column list; equal for structurally equal columns. */
64
+ export declare function xlsxColumnsFingerprint(columns: readonly XlsxColumn[]): string;
65
+ export type XlsxRow = {
66
+ role: 'body' | 'total';
67
+ cells: readonly ExportCell[];
68
+ };
69
+ /** Joinable sheet XML for some rows (one chunk, one Matrix batch, or a totals row). Pure. */
70
+ export declare function encodeXlsxRows(sheet: XlsxSheet, rows: Iterable<XlsxRow>): string;
71
+ /** A whole workbook in memory: browser downloads and Matrix direct. */
72
+ export declare function encodeXlsxFile(sheet: XlsxSheet, rows: Iterable<XlsxRow>): Uint8Array;
73
+ /**
74
+ * The whole workbook as zip bytes, from row fragments made by encodeXlsxRows,
75
+ * in order. A totals row is just a last fragment. `rowCount` counts every
76
+ * row in the fragments (body and total); `fragmentBytes` is their UTF-8 size
77
+ * (the stored size of the chunk or batch objects). Backpressure follows the
78
+ * consumer: the next fragment is read only after the bytes before it were
79
+ * taken. Throws XlsxLimitError('rows') or ('size') here, before anything is
80
+ * written. Fragments that turn out larger than `fragmentBytes` fail with
81
+ * XlsxLimitError('size') before the sheet passes the limit, and any other
82
+ * mismatch fails with TypeError before the file is finished, so a wrong count
83
+ * never yields a complete file.
84
+ */
85
+ export declare function streamXlsxFile(input: {
86
+ sheet: XlsxSheet;
87
+ fragments: AsyncIterable<string | Uint8Array>;
88
+ rowCount: number;
89
+ fragmentBytes: number;
90
+ }): AsyncIterable<Uint8Array>;
@@ -1,15 +1,4 @@
1
- /**
2
- * Date formatting utilities with timezone support
3
- * IMPORTANT: No React imports allowed in this file
4
- *
5
- * Uses date-fns and date-fns-tz for consistent behavior in browser and Node.js
6
- *
7
- * This module provides the canonical date formatting functions used by:
8
- * - data-table component
9
- * - pivot-table component
10
- * - aggregated-table component
11
- * - Lambda CSV export (chunk-processor)
12
- */
1
+ import { ExportWallClock } from '../exporters/export-cells.js';
13
2
  /**
14
3
  * Resolve which timezone to use for formatting
15
4
  * Priority: column-specific > context timezone
@@ -52,6 +41,13 @@ export declare function parseWithSourceTimezone(dateString: string, sourceTimezo
52
41
  * formatDate('2024-01-15T10:30:00Z', 'MM/dd/yyyy HH:mm', 'America/Chicago') // '01/15/2024 04:30'
53
42
  */
54
43
  export declare const formatDate: (dateString: string | null | undefined, formatPattern: string | undefined, displayTimezone?: string, sourceTimezone?: string) => string;
44
+ /**
45
+ * The calendar date and time `formatDate` shows for the same inputs, with no
46
+ * zone: the same source-zone interpretation and display-zone conversion.
47
+ * Undefined when `formatDate` would return the input unchanged (empty or not
48
+ * a date). Excel exports write it as a date serial (Excel exports plan XL-D35).
49
+ */
50
+ export declare function dateWallClock(dateString: string | null | undefined, displayTimezone?: string, sourceTimezone?: string): ExportWallClock | undefined;
55
51
  /**
56
52
  * Format relative time using date-fns (e.g., "2 days ago")
57
53
  *
@@ -1,6 +1,6 @@
1
1
  export { formatNumber, formatCurrency, formatPercent, formatScientific, formatNumericCanonical, formatMeasureCanonical, formatNumberWithColumnSettings, formatNumberCustom, } from './number-formatter.js';
2
2
  export { formatDuration, formatDurationCanonical } from './duration-formatter.js';
3
3
  export { formatMetricComparison, type FormattedMetricComparison, type FormattedMetricComparisonPart, type FormatMetricComparisonOptions, type MetricComparisonDisplayMode, } from './metric-comparison-formatter.js';
4
- export { formatDate, formatRelativeTime, resolveTimezone, getTimezoneAbbreviation, getTimezoneName, parseWithSourceTimezone, } from './date-formatter.js';
4
+ export { formatDate, formatRelativeTime, dateWallClock, resolveTimezone, getTimezoneAbbreviation, getTimezoneName, parseWithSourceTimezone, } from './date-formatter.js';
5
5
  export { formatCellValue, formatRowForExport } from './cell-formatter.js';
6
6
  export type { CellAbsencePresentation } from './cell-formatter.js';
@@ -1,5 +1,6 @@
1
1
  import { MatrixPath, MatrixPresentation, MatrixWindow, SemaphorScalarValue, SemaphorValueFormat } from '../../analytics-protocol/index.js';
2
2
  import { ReportRuntimeContext } from '../../report-runtime-context/index.js';
3
+ import { MeasureCanonicalFormat } from '../types/index.js';
3
4
  /** Null hierarchy members stay identifiable even when null cells render blank. */
4
5
  export declare function matrixMemberLabel(path: MatrixPath, levels?: ReadonlyMap<string, (value: SemaphorScalarValue) => string>): string;
5
6
  /**
@@ -39,6 +40,7 @@ export declare function prepareMatrixFormatting(descriptors: MatrixWindow['descr
39
40
  isNumeric: boolean;
40
41
  hasTextAffixes: boolean;
41
42
  }>;
43
+ measureFormats: Map<string, MeasureCanonicalFormat>;
42
44
  absence: {
43
45
  emptyText: string;
44
46
  nullText: string;
@@ -18,6 +18,7 @@ export * from './exporters/index.js';
18
18
  export * from './export-policy.js';
19
19
  export * from './matrix-continuation.js';
20
20
  export * from './matrix-export-presentation.js';
21
+ export * from './matrix-export-xlsx.js';
21
22
  export * from './matrix-print.js';
22
23
  export { fromSemanticFormat } from './semantic-format.js';
23
24
  export type * from './table-structure.js';
@@ -30,6 +31,7 @@ export * from './temporal-bucket.js';
30
31
  export * from './raw-temporal.js';
31
32
  export * from './temporal-input-presentation.js';
32
33
  export * from './flat-table-export-totals.js';
34
+ export * from './table-export/index.js';
33
35
  export * from './filter-line.js';
34
36
  export * from './attachment-filter-line.js';
35
37
  export { describeFilterValueInFullDetail, type FullDetailFilterValue, } from './filter-value-text.js';
@@ -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
+ };
@@ -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';