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
@@ -1,62 +1,8 @@
1
- import { TFilterValue } from '../../components/surfboard/filter/types.js';
2
- import { CsvEncoding } from '../../shared/format-utils/exporters/csv-utils.js';
3
- import { CardConfig, DataSource, TableTotalsRequest } from '../types/explorer-types.js';
4
- import { ControlBinding, ControlDefinition } from '../types/common-types.js';
5
- import { ResolvedPrimaryDateField } from '../types/semantic-runtime-types.js';
6
- import { ComparisonPresentationSpec, GlobalDateComparisonContext } from '../../shared/analytics-protocol/index.js';
7
- import { TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
8
- import { PresentationExecutionSnapshot } from '../../shared/format-utils/index.js';
9
- import { MatrixCsvExportRequest } from '../matrix-table/matrix-delivery.js';
1
+ import { ExportFileFormat } from '../../shared/format-utils/index.js';
2
+ import { MatrixFileExportRequest } from '../matrix-table/matrix-delivery.js';
3
+ import { CreateExportRequest } from '../../shared/dashboard-authoring/card-export-request.js';
10
4
  export type ExportStatus = 'pending' | 'processing' | 'chunking' | 'compacting' | 'completed' | 'failed' | 'cancelled';
11
- export type ExportFormat = 'csv';
12
5
  export type CardType = 'table' | 'aggregateTable' | 'pivotTable' | 'detailTable';
13
- /** Formatting configuration passed to the export job */
14
- export interface ExportFormattingConfig {
15
- useFormattedValues: boolean;
16
- timezone: string;
17
- browserTimezone?: string;
18
- isSqlCard?: boolean;
19
- delimiter: ',' | ';' | '\t';
20
- /** Resolved by the dialog: the person's choice, else the dashboard's setting. */
21
- csvEncoding: CsvEncoding;
22
- includeHeaders: boolean;
23
- columnSettings?: Record<string, unknown>;
24
- visibleColumns?: string[];
25
- columnLabels?: Record<string, string>;
26
- tableTotalsLabelColumnKey?: string;
27
- presentationExecutionSnapshot?: PresentationExecutionSnapshot;
28
- comparisonPresentation?: ComparisonPresentationSpec;
29
- }
30
- export type AuthoritativeExportFormattingConfig = ExportFormattingConfig & {
31
- comparisonPresentation: ComparisonPresentationSpec;
32
- presentationExecutionSnapshot: PresentationExecutionSnapshot;
33
- };
34
- /** Request to create a new export job */
35
- export interface CreateExportRequest {
36
- type: 'visual' | 'card';
37
- dashboardId: string;
38
- visualId?: string;
39
- cardId: string;
40
- title?: string;
41
- connection_id: string;
42
- cardType: string;
43
- sql: string;
44
- python: string;
45
- resultOwner: TemporalResultOwner;
46
- cardConfig: CardConfig;
47
- cardDataSource: DataSource;
48
- active_filters: TFilterValue[];
49
- controlValues?: Record<string, unknown>;
50
- controlDefinitions?: ControlDefinition[];
51
- cardControlDefinitions?: ControlDefinition[];
52
- controlBindings?: ControlBinding[];
53
- resolvedPrimaryDateField?: ResolvedPrimaryDateField;
54
- globalDateComparison?: GlobalDateComparisonContext;
55
- tableTotalsRequest?: TableTotalsRequest;
56
- totalRows: number;
57
- format: ExportFormat;
58
- formatOptions: AuthoritativeExportFormattingConfig;
59
- }
60
6
  /** Response from creating an export job */
61
7
  export interface CreateExportResponse {
62
8
  exportId: string;
@@ -68,7 +14,7 @@ export interface CreateExportResponse {
68
14
  originalRows?: number;
69
15
  maxRows?: number;
70
16
  }
71
- export type CardExportRequest = CreateExportRequest | MatrixCsvExportRequest;
17
+ export type CardExportRequest = CreateExportRequest | MatrixFileExportRequest;
72
18
  /** Export job status response */
73
19
  export interface ExportJobStatus {
74
20
  id: string;
@@ -125,6 +71,7 @@ export type MatrixDirectExportResult = {
125
71
  kind: 'file';
126
72
  file: Blob;
127
73
  fileName: string;
74
+ format: ExportFileFormat;
128
75
  } | {
129
76
  kind: 'background';
130
77
  exportId: string;
@@ -132,14 +79,13 @@ export type MatrixDirectExportResult = {
132
79
  deadlineAt: string | null;
133
80
  };
134
81
  /**
135
- * A Matrix CSV a user downloads: built in the request when it fits the direct
136
- * limits, otherwise moved to a background export by the server. The file is
137
- * read as bytes, so its BOM survives. Errors carry the server's catalog
138
- * reason in `details.message`.
82
+ * A Matrix CSV or Excel file a user downloads: built in the request when it
83
+ * fits the direct limits, otherwise moved to a background export by the
84
+ * server. The file is read as bytes, so a CSV's BOM survives; its format is
85
+ * the response's content type. Errors carry the server's catalog reason in
86
+ * `details.message` (an Excel limit answers 422 `excel_limit`).
139
87
  */
140
- export declare function createMatrixDirectExport(apiServiceUrl: string, token: string, params: MatrixCsvExportRequest & {
141
- format: 'csv';
142
- }): Promise<MatrixDirectExportResult>;
88
+ export declare function createMatrixDirectExport(apiServiceUrl: string, token: string, params: MatrixFileExportRequest): Promise<MatrixDirectExportResult>;
143
89
  /**
144
90
  * Get list of user's exports
145
91
  */
@@ -0,0 +1,17 @@
1
+ import { ControlBinding, ControlDefinition, TDashboard } from '../types/common-types.js';
2
+ /** A saved control contract a host replays: a card attachment's controls and bindings. */
3
+ export type ControlContractOverrides = {
4
+ controlDefinitions?: ControlDefinition[];
5
+ cardControlDefinitions?: ControlDefinition[];
6
+ controlBindings?: ControlBinding[];
7
+ };
8
+ /**
9
+ * Puts a saved control contract on the dashboard (and on one card) before it
10
+ * hydrates. Mutates and returns `dashboard`: callers pass a copy. The
11
+ * dashboard's hydration (`useDashboard`) and a saved card's request on the
12
+ * server (`buildSavedCardRequest`) both apply it here.
13
+ */
14
+ export declare function applyControlContractOverrides(dashboard: TDashboard, params: {
15
+ cardId?: string;
16
+ controlContractOverrides?: ControlContractOverrides | undefined;
17
+ }): TDashboard;
@@ -34,6 +34,8 @@ export declare function readExportViewerTable(state: {
34
34
  export declare function resolveExportTableView(input: {
35
35
  readonly card: TCard;
36
36
  readonly records: readonly Record<string, unknown>[];
37
+ /** The result's output keys when it has no row to read them from; else the rows' keys. */
38
+ readonly keys?: readonly string[];
37
39
  readonly columnKeyMap?: QueryColumnKeyMap;
38
40
  readonly resultColumns?: readonly SemaphorResultColumn[];
39
41
  readonly comparisonMetadata?: ComparisonMetadataMap;
@@ -1,6 +1,7 @@
1
- import { AuthToken, ControlBinding, ControlDefinition, CustomCard, DashboardLifecycleEvent, DashboardInputExecutionSnapshot, TDashboard, TEvent, TStyle } from '../types/common-types.js';
1
+ import { AuthToken, CustomCard, DashboardLifecycleEvent, DashboardInputExecutionSnapshot, TDashboard, TEvent, TStyle } from '../types/common-types.js';
2
2
  import { PresentationExecutionSnapshot } from '../../shared/format-utils/index.js';
3
3
  import { TFilterValue } from '../../components/surfboard/filter/types.js';
4
+ import { ControlContractOverrides } from '../dashboard-inputs/control-contract-overrides.js';
4
5
  import { ViewerTableSettings } from '../../shared/dashboard-viewer/index.js';
5
6
  type UseDashboardProps = {
6
7
  id?: string;
@@ -11,11 +12,7 @@ type UseDashboardProps = {
11
12
  values: string[] | number[];
12
13
  }[] | TFilterValue[];
13
14
  defaultControlValues?: Record<string, unknown>;
14
- controlContractOverrides?: {
15
- controlDefinitions?: ControlDefinition[];
16
- cardControlDefinitions?: ControlDefinition[];
17
- controlBindings?: ControlBinding[];
18
- };
15
+ controlContractOverrides?: ControlContractOverrides;
19
16
  dashboardInputExecutionSnapshot?: DashboardInputExecutionSnapshot;
20
17
  /** Untrusted per-sheet input capture of a Full dashboard PDF; see resolvePrintInputs. */
21
18
  printInputCapture?: unknown;
@@ -8,8 +8,14 @@ export declare const MATRIX_EXPORT_CONTENT: readonly [{
8
8
  readonly label: "Matrix layout: All detail levels";
9
9
  }, {
10
10
  readonly value: "flat";
11
- readonly label: "Flat aggregate CSV";
11
+ readonly label: "Flat aggregate table";
12
12
  }];
13
+ /**
14
+ * What a Matrix download or attachment may be: PDF, CSV and Excel for the
15
+ * layout, CSV and Excel for Flat content, which is a data file only
16
+ * (XL-D16). Downloads off leaves PDF of the layout. One policy for the export
17
+ * dialog and Briefing attachments.
18
+ */
13
19
  export declare function matrixDeliveryOptions(allowDownload?: boolean, content?: MatrixExportContent): {
14
20
  contents: ({
15
21
  readonly value: "current";
@@ -19,7 +25,7 @@ export declare function matrixDeliveryOptions(allowDownload?: boolean, content?:
19
25
  readonly label: "Matrix layout: All detail levels";
20
26
  } | {
21
27
  readonly value: "flat";
22
- readonly label: "Flat aggregate CSV";
28
+ readonly label: "Flat aggregate table";
23
29
  })[];
24
30
  formats: import('../types/index.js').BriefingAttachmentFormat[];
25
31
  };
@@ -1,10 +1,11 @@
1
1
  import { MatrixConfig, MatrixViewState } from '../../shared/analytics-protocol/index.js';
2
2
  import { CsvEncoding } from '../../shared/format-utils/exporters/csv-utils.js';
3
+ import { ExportFileFormat } from '../../shared/format-utils/exporters/export-file-format.js';
3
4
  import { MatrixExportContent } from '../../shared/dashboard-authoring/matrix-delivery.js';
4
5
  import { ReportRuntimeContext } from '../../shared/report-runtime-context/index.js';
5
6
  import { CompiledCardQueryContext } from '../query-context/build-card-query-context.js';
6
7
  import { DataSource } from '../types/explorer-types.js';
7
- import { BriefingAttachment } from '../../briefings.js';
8
+ import { BriefingAttachment, BriefingAttachmentFormat } from '../../briefings.js';
8
9
  export { captureMatrixExport, type MatrixExportContent } from '../../shared/dashboard-authoring/matrix-delivery.js';
9
10
  /** Schedule authoring shares the query snapshot but explicitly excludes session state. */
10
11
  export declare function buildMatrixBriefingAttachment(input: {
@@ -13,7 +14,7 @@ export declare function buildMatrixBriefingAttachment(input: {
13
14
  cardId: string;
14
15
  title: string;
15
16
  content: MatrixExportContent;
16
- format: 'csv' | 'pdf';
17
+ format: BriefingAttachmentFormat;
17
18
  }): BriefingAttachment;
18
19
  export { MATRIX_EXPORT_CONTENT } from './matrix-delivery-policy.js';
19
20
  /** Supplied by the mounted Matrix host, never inferred from resident cells. */
@@ -33,7 +34,7 @@ export declare function buildMatrixDeliveryPayload(input: {
33
34
  title: string;
34
35
  reportContext: ReportRuntimeContext;
35
36
  content: MatrixExportContent;
36
- format: 'csv' | 'pdf';
37
+ format: 'csv' | 'xlsx' | 'pdf';
37
38
  delimiter: ',' | ';' | '\t';
38
39
  /** CSV only; absent lets the app resolve the dashboard's setting. */
39
40
  csvEncoding?: CsvEncoding;
@@ -662,7 +663,7 @@ export declare function buildMatrixDeliveryPayload(input: {
662
663
  }[];
663
664
  } | undefined;
664
665
  };
665
- format: "csv";
666
+ format: "csv" | "xlsx";
666
667
  spec: {
667
668
  source: {
668
669
  kind: "semantic";
@@ -754,6 +755,7 @@ export declare function buildMatrixDeliveryPayload(input: {
754
755
  acquisition?: "continuation" | undefined;
755
756
  };
756
757
  };
757
- export type MatrixCsvExportRequest = ReturnType<typeof buildMatrixDeliveryPayload> & {
758
- format: 'csv';
758
+ /** A Matrix data file request (CSV or Excel) for the direct path or a job. */
759
+ export type MatrixFileExportRequest = ReturnType<typeof buildMatrixDeliveryPayload> & {
760
+ format: ExportFileFormat;
759
761
  };
@@ -0,0 +1,50 @@
1
+ import { TCard, TDashboard } from '../types/common-types.js';
2
+ import { PaginationConfig } from '../types/explorer-types.js';
3
+ import { ResolvedPrimaryDateField } from '../types/semantic-runtime-types.js';
4
+ import { TableConfig } from '../types/query-types.js';
5
+ import { CardQueryContext, CompiledCardQueryContext } from './build-card-query-context.js';
6
+ import { CalendarContext } from '../../shared/report-runtime-context/index.js';
7
+ import { DashboardCardQueryRequestPayloadBase } from '../../shared/dashboard-authoring/card-query-request.js';
8
+ import { CompiledDashboardCardFilters, CompileDashboardCardFiltersParams } from './compile-dashboard-card-filters.js';
9
+ export type { DashboardCardQueryRequestPayloadBase } from '../../shared/dashboard-authoring/card-query-request.js';
10
+ export type DashboardCardQueryContract = {
11
+ status: 'ready';
12
+ queryKey: string[];
13
+ queryInputIdentity: string;
14
+ paginationConfig?: PaginationConfig;
15
+ requestPayloadBase: DashboardCardQueryRequestPayloadBase;
16
+ tableConfig: TableConfig;
17
+ compiledFilters: CompiledDashboardCardFilters;
18
+ };
19
+ export type DashboardCardQueryContractResult = DashboardCardQueryContract | {
20
+ status: 'blocked';
21
+ cardId: string;
22
+ mappingDispositions: CompiledDashboardCardFilters['mappingDispositions'];
23
+ tableConfig: TableConfig;
24
+ };
25
+ /** Test/invariant helper for fixtures that cannot contain mapped inputs. */
26
+ export declare function requireReadyDashboardCardQueryContract(result: DashboardCardQueryContractResult): DashboardCardQueryContract;
27
+ export type DashboardCardQueryExecutionOptions = {
28
+ resolvedPrimaryDateField?: ResolvedPrimaryDateField;
29
+ calendarContext: CalendarContext;
30
+ allowGlobalDateMinutePrecision?: boolean;
31
+ /**
32
+ * The cache settings of the dashboard the card belongs to (ledger P1-01).
33
+ * Required so that every caller decides; never read from the store.
34
+ */
35
+ globalCacheConfig: TDashboard['globalCacheConfig'];
36
+ resolvePaginationConfig?: (queryInputIdentity: string) => PaginationConfig | undefined;
37
+ };
38
+ /** One final compilation for interactive requests and immutable input captures. */
39
+ export declare function compileDashboardCardQueryContext(card: TCard, context: CardQueryContext, execution: Omit<CompileDashboardCardFiltersParams, 'card' | 'cardConfig' | 'input'>): {
40
+ status: "blocked";
41
+ cardId: string;
42
+ mappingDispositions: import('./dashboard-filter-mapping-resolution.js').DashboardFilterMappingDisposition[];
43
+ } | {
44
+ status: "ready";
45
+ queryContext: CompiledCardQueryContext;
46
+ compiledFilters: CompiledDashboardCardFilters & {
47
+ status: "ready";
48
+ };
49
+ };
50
+ export declare function buildDashboardCardQueryContract(card: TCard, context: CardQueryContext, execution: DashboardCardQueryExecutionOptions): DashboardCardQueryContractResult;
@@ -700,6 +700,12 @@ export interface PaginationMetadata {
700
700
  totalCount: number;
701
701
  hasNextPage: boolean;
702
702
  hasPrevPage: boolean;
703
+ /**
704
+ * `verified` only when the count query returned its row; `unavailable` when
705
+ * it failed (the count shown is then today's fallback, never a fact). A
706
+ * server export sizes itself only from a verified count (Excel exports XL-D21).
707
+ */
708
+ totalCountStatus?: 'verified' | 'unavailable';
703
709
  }
704
710
  export { resolveQueryColumnKeyMapEntry, resolveUniqueQueryColumnKeyMapEntry, type QueryColumnKeyMapByRole, type QueryColumnKeyMapEntry, type QueryColumnKeyRole, } from '../../shared/format-utils/pivot-result-identity.js';
705
711
  export type QueryColumnKeyMap = SharedQueryColumnKeyMap;
@@ -6861,7 +6861,7 @@ declare const exportRequestShape: z.ZodUnion<[z.ZodObject<{
6861
6861
  presentation: MatrixPresentationSchema;
6862
6862
  } & {
6863
6863
  mode: z.ZodLiteral<"flat">;
6864
- format: z.ZodLiteral<"csv">;
6864
+ format: z.ZodEnum<["csv", "xlsx"]>;
6865
6865
  }, "strict", z.ZodTypeAny, {
6866
6866
  mode: "flat";
6867
6867
  presentation: {
@@ -7086,7 +7086,7 @@ declare const exportRequestShape: z.ZodUnion<[z.ZodObject<{
7086
7086
  }[];
7087
7087
  } | undefined;
7088
7088
  };
7089
- format: "csv";
7089
+ format: "csv" | "xlsx";
7090
7090
  spec: {
7091
7091
  source: {
7092
7092
  kind: "semantic";
@@ -7379,7 +7379,7 @@ declare const exportRequestShape: z.ZodUnion<[z.ZodObject<{
7379
7379
  }[];
7380
7380
  } | undefined;
7381
7381
  };
7382
- format: "csv";
7382
+ format: "csv" | "xlsx";
7383
7383
  spec: {
7384
7384
  source: {
7385
7385
  kind: "semantic";
@@ -6,4 +6,4 @@
6
6
  * case's context from a saved dashboard with `projectSavedDashboardContext`.
7
7
  */
8
8
  export { AssistantContextSourceError, projectAssistantContext, type AssistantContextSource, type AssistantContextSourceIssue, } from './project-context.js';
9
- export { assistantCardReplayFields, buildSavedCardRequest, cardReplayOf, projectSavedDashboardContext, projectSavedDashboardTurn, type AssistantCardReplayFields, type SavedCardRequestRefusal, type SavedDashboardPlace, } from './saved-dashboard-context.js';
9
+ export { assistantCardReplayFields, buildSavedCardRequest, cardReplayOf, projectSavedDashboardContext, projectSavedDashboardTurn, type AssistantCardReplayFields, type SavedCardHost, type SavedCardRequestRefusal, type SavedDashboardPlace, } from './saved-dashboard-context.js';
@@ -1,5 +1,7 @@
1
- import { TCard, TDashboard } from '../../lib/types/common-types.js';
1
+ import { DashboardInputExecutionSnapshot, TCard, TDashboard } from '../../lib/types/common-types.js';
2
+ import { TFilterValue } from '../../components/surfboard/filter/types.js';
2
3
  import { CardViewStateMap } from '../../lib/dashboard-view-state/index.js';
4
+ import { ControlContractOverrides } from '../../lib/dashboard-inputs/control-contract-overrides.js';
3
5
  import { SemanticExecutionPayload } from '../../lib/types/semantic-runtime-types.js';
4
6
  import { CalendarContext } from '../report-runtime-context/index.js';
5
7
  import { ViewerStoreInputValues } from '../../lib/dashboard-viewer/compatibility-input-storage.js';
@@ -108,11 +110,25 @@ export declare function cardReplayOf(input: {
108
110
  message?: string;
109
111
  };
110
112
  /**
111
- * A saved card's request as a fresh viewer opens it (saved defaults, no
112
- * bookmark, no drill), for an external client's `fromCard` replay
113
- * (analytics agent Plan 1, Phase 3b, D3b-2). The same owners as the context:
114
- * the viewer baseline, the store's input values, the card's snapshot with its
115
- * request, and the server-request owner CSV export shares. Pure; the caller
113
+ * What a host opens a saved dashboard with, as a scheduled card attachment's
114
+ * print view gets it: default filter and control values, a saved control
115
+ * contract, and a saved input snapshot. Every field is optional; none at all
116
+ * is a fresh viewer (saved defaults).
117
+ */
118
+ export type SavedCardHost = {
119
+ filterValues?: readonly TFilterValue[];
120
+ controlValues?: Readonly<Record<string, unknown>>;
121
+ controlContract?: ControlContractOverrides;
122
+ dashboardInputExecutionSnapshot?: DashboardInputExecutionSnapshot;
123
+ };
124
+ /**
125
+ * A saved card's request as a host opens it: by default a fresh viewer
126
+ * (saved defaults, no bookmark, no drill), for an external client's
127
+ * `fromCard` replay (analytics agent Plan 1, Phase 3b, D3b-2); with `host`,
128
+ * a scheduled card attachment's saved values, the values its print view
129
+ * opens with (Excel exports Phase 6). The same owners as the context: the
130
+ * viewer baseline, the store's input values, the card's snapshot with its
131
+ * request, and the server-request owner exports share. Pure; the caller
116
132
  * loads the dashboard, its semantic payload and calendar, and checks access.
117
133
  */
118
134
  export declare function buildSavedCardRequest(input: {
@@ -120,6 +136,7 @@ export declare function buildSavedCardRequest(input: {
120
136
  cardId: string;
121
137
  semanticExecutionPayload: SemanticExecutionPayload | undefined;
122
138
  calendar: CalendarContext;
139
+ host?: SavedCardHost;
123
140
  }): {
124
141
  status: 'ready';
125
142
  request: AssistantCardRequest;
@@ -0,0 +1,173 @@
1
+ import { TFilterValue } from '../../components/surfboard/filter/types.js';
2
+ import { DashboardCardQueryRequestPayloadBase } from '../../lib/query-context/build-dashboard-card-query-contract.js';
3
+ import { ControlBinding, ControlDefinition, TCard } from '../../lib/types/common-types.js';
4
+ import { DataSource, TableTotalsRequest, CardConfig, QueryColumnKeyMap } from '../../lib/types/explorer-types.js';
5
+ import { ResolvedPrimaryDateField } from '../../lib/types/semantic-runtime-types.js';
6
+ import { ComparisonMetadataMap } from '../../lib/types/query-types.js';
7
+ import { ComparisonPresentationSpec, GlobalDateComparisonContext, SemaphorResultColumn } from '../analytics-protocol/index.js';
8
+ import { ReportRuntimeContext } from '../report-runtime-context/index.js';
9
+ import { CanonicalPivotResultTransport, CsvDelimiter, CsvEncoding, ExportFileFormat, PresentationExecutionSnapshot } from '../format-utils/index.js';
10
+ import { TemporalResultOwner } from './temporal-result-owner.js';
11
+ import { ExportViewerTable } from '../../lib/dashboard-viewer/export-table-view.js';
12
+ /** Formatting configuration passed to the export job */
13
+ export interface ExportFormattingConfig {
14
+ useFormattedValues: boolean;
15
+ timezone: string;
16
+ browserTimezone?: string;
17
+ isSqlCard?: boolean;
18
+ delimiter: CsvDelimiter;
19
+ /** Resolved by the caller: the person's or attachment's choice, else the dashboard's setting. */
20
+ csvEncoding: CsvEncoding;
21
+ includeHeaders: boolean;
22
+ columnSettings?: Record<string, unknown>;
23
+ visibleColumns?: string[];
24
+ columnLabels?: Record<string, string>;
25
+ tableTotalsLabelColumnKey?: string;
26
+ presentationExecutionSnapshot?: PresentationExecutionSnapshot;
27
+ comparisonPresentation?: ComparisonPresentationSpec;
28
+ }
29
+ export type AuthoritativeExportFormattingConfig = ExportFormattingConfig & {
30
+ comparisonPresentation: ComparisonPresentationSpec;
31
+ presentationExecutionSnapshot: PresentationExecutionSnapshot;
32
+ };
33
+ /** Request to create a new export job */
34
+ export interface CreateExportRequest {
35
+ type: 'visual' | 'card';
36
+ dashboardId: string;
37
+ visualId?: string;
38
+ cardId: string;
39
+ title?: string;
40
+ connection_id: string;
41
+ cardType: string;
42
+ sql: string;
43
+ python: string;
44
+ resultOwner: TemporalResultOwner;
45
+ cardConfig: CardConfig;
46
+ cardDataSource: DataSource;
47
+ active_filters: TFilterValue[];
48
+ controlValues?: Record<string, unknown>;
49
+ controlDefinitions?: ControlDefinition[];
50
+ cardControlDefinitions?: ControlDefinition[];
51
+ controlBindings?: ControlBinding[];
52
+ resolvedPrimaryDateField?: ResolvedPrimaryDateField;
53
+ globalDateComparison?: GlobalDateComparisonContext;
54
+ tableTotalsRequest?: TableTotalsRequest;
55
+ totalRows: number;
56
+ /** The file the job writes: CSV, or Excel for Table and Detail Table. */
57
+ format: ExportFileFormat;
58
+ formatOptions: AuthoritativeExportFormattingConfig;
59
+ }
60
+ /** The facts a result gives an export: a viewer's loaded result, or the server's sizing query. */
61
+ export type CardResultFacts = {
62
+ totalRows: number;
63
+ resultColumns: readonly SemaphorResultColumn[];
64
+ columnKeyMap?: QueryColumnKeyMap;
65
+ comparisonMetadata?: ComparisonMetadataMap;
66
+ };
67
+ /** File options a viewer or an attachment chose. */
68
+ export type CardExportFileOptions = {
69
+ format: ExportFileFormat;
70
+ /** False writes stored values. */
71
+ useFormattedValues: boolean;
72
+ includeHeaders: boolean;
73
+ /** CSV only; ignored for Excel. */
74
+ delimiter: CsvDelimiter;
75
+ /** CSV only; ignored for Excel. */
76
+ csvEncoding: CsvEncoding;
77
+ /** The viewer's table settings at the click; absent for a scheduled attachment (the author's view). */
78
+ viewerTable?: ExportViewerTable;
79
+ };
80
+ /**
81
+ * The `formatOptions` a table export request carries, from the result: the
82
+ * visible columns, order and labels of the one table view resolver, and the
83
+ * card's saved column settings. The background export and the browser file
84
+ * both start here. Null when the columns cannot be resolved.
85
+ */
86
+ export declare function buildTableExportFormatOptions(input: {
87
+ card: TCard;
88
+ effectiveCardConfig?: CardConfig;
89
+ rows: readonly Record<string, unknown>[];
90
+ /**
91
+ * The output keys when no row is loaded: a scheduled export's sizing page
92
+ * that a cleanup step emptied names its columns from the result's columns.
93
+ */
94
+ resultKeys?: readonly string[];
95
+ result: Pick<CardResultFacts, 'resultColumns' | 'columnKeyMap' | 'comparisonMetadata'>;
96
+ reportContext: ReportRuntimeContext;
97
+ file: CardExportFileOptions;
98
+ }): {
99
+ view: import('../../lib/dashboard-viewer/table-view.js').TableView;
100
+ formatOptions: {
101
+ useFormattedValues: boolean;
102
+ timezone: string;
103
+ delimiter: "," | ";" | "\t";
104
+ csvEncoding: "utf-8-bom" | "utf-8";
105
+ includeHeaders: boolean;
106
+ columnSettings: Record<string, unknown> | undefined;
107
+ visibleColumns: string[];
108
+ columnLabels: {
109
+ [k: string]: string;
110
+ };
111
+ };
112
+ } | null;
113
+ export { buildCardServerRequest as buildCardExportQueryContext, type CardServerRequest as CardExportQueryContext, } from '../../lib/query-context/card-server-request.js';
114
+ type CardExportPresentationParams = {
115
+ card: TCard;
116
+ dashboardId: string;
117
+ reportContext: ReportRuntimeContext;
118
+ totalRows: number;
119
+ formatOptions: ExportFormattingConfig;
120
+ comparisonMetadata?: ComparisonMetadataMap;
121
+ requestPayloadBase: DashboardCardQueryRequestPayloadBase;
122
+ resultColumns?: SemaphorResultColumn[];
123
+ columnKeyMap?: QueryColumnKeyMap;
124
+ canonicalPivotResult?: CanonicalPivotResultTransport;
125
+ effectiveCardConfig?: CardConfig;
126
+ };
127
+ /**
128
+ * The presentation half of a card export request: `formatOptions` with the
129
+ * captured presentation snapshot, the totals label column and the totals
130
+ * request. A browser download formats with exactly this; a background export
131
+ * sends it with the card's query context (`buildCardExportRequest`).
132
+ */
133
+ export declare function buildCardExportFormatOptions(params: CardExportPresentationParams): {
134
+ formatOptions: CreateExportRequest['formatOptions'];
135
+ tableTotalsRequest?: CreateExportRequest['tableTotalsRequest'];
136
+ };
137
+ /** The request from formatOptions already built: the dialog's request, and tests of the presentation half. */
138
+ export declare function buildCardExportRequestFromOptions(params: CardExportPresentationParams & {
139
+ title: string;
140
+ format: ExportFileFormat;
141
+ }): CreateExportRequest;
142
+ /** Why a card has no export request. */
143
+ export type CardExportRequestRefusal =
144
+ /** Comparison columns without their metadata (SPEC §3.0 case 28). */
145
+ 'comparison_metadata_missing'
146
+ /** Only Table and Detail Table export through this request. */
147
+ | 'not_a_table'
148
+ /** No visible column could be resolved from the result. */
149
+ | 'columns_unresolved';
150
+ /**
151
+ * A Table or Detail Table background export request (SPEC §3.5): the card's
152
+ * query, the columns and presentation its result gives, and the file the
153
+ * viewer or attachment chose. The dialog's "Export full dataset" and a
154
+ * scheduled attachment the server starts call exactly this (XL-SI-14).
155
+ */
156
+ export declare function buildCardExportRequest(input: {
157
+ card: TCard;
158
+ dashboardId: string;
159
+ title: string;
160
+ query: DashboardCardQueryRequestPayloadBase;
161
+ effectiveCardConfig?: CardConfig;
162
+ result: CardResultFacts;
163
+ /** The rows the columns are read from: the viewer's loaded rows, or the server's sizing page. */
164
+ rows: readonly Record<string, unknown>[];
165
+ reportContext: ReportRuntimeContext;
166
+ file: CardExportFileOptions;
167
+ }): {
168
+ status: 'ready';
169
+ request: CreateExportRequest;
170
+ } | {
171
+ status: 'refused';
172
+ reason: CardExportRequestRefusal;
173
+ };
@@ -28,6 +28,7 @@ export * from './control-value-resolution.js';
28
28
  export * from './control-execution-contract.js';
29
29
  export * from './resolved-primary-date-field-validation.js';
30
30
  export * from './card-query-request.js';
31
+ export * from './card-export-request.js';
31
32
  export * from './calculated-field-identity.js';
32
33
  export * from './calculated-field-placement.js';
33
34
  export * from './matrix-control-resolution.js';
@@ -7,7 +7,8 @@ export declare function captureMatrixExport(input: {
7
7
  config: MatrixConfig;
8
8
  session?: MatrixViewState;
9
9
  content: MatrixExportContent;
10
- format: 'csv' | 'pdf';
10
+ /** A data file (CSV or Excel) or a PDF; Flat content is a data file only. */
11
+ format: 'csv' | 'xlsx' | 'pdf';
11
12
  purpose: 'manual' | 'schedule';
12
13
  }): {
13
14
  mode: "layout";
@@ -585,7 +586,7 @@ export declare function captureMatrixExport(input: {
585
586
  }[];
586
587
  } | undefined;
587
588
  };
588
- format: "csv";
589
+ format: "csv" | "xlsx";
589
590
  spec: {
590
591
  source: {
591
592
  kind: "semantic";
@@ -1371,7 +1372,7 @@ export declare function buildMatrixDeliveryEnvelope<TSource extends {
1371
1372
  }[];
1372
1373
  } | undefined;
1373
1374
  };
1374
- format: "csv";
1375
+ format: "csv" | "xlsx";
1375
1376
  spec: {
1376
1377
  source: {
1377
1378
  kind: "semantic";