react-semaphor 0.1.526 → 0.1.527
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DATA_APP_SDK.md +5 -1
- package/dist/analytics-protocol/index.js +1179 -296
- package/dist/brand-studio/index.js +15 -15
- package/dist/briefings/index.js +50 -49
- package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DEhjPSr-.js} +66 -65
- package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BlIbwkuD.js} +68 -65
- package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
- package/dist/chunks/dashboard-JNHR0_cZ.js +14 -0
- package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-D9pFByPh.js} +372 -359
- package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-CJI5ZWMq.js} +739 -686
- package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DLdrFry-.js} +10 -10
- package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-D5LjWle1.js} +6603 -6572
- package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-G91NQKxU.js} +266 -267
- package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-DeVQLIsP.js} +19 -19
- package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
- package/dist/chunks/{index-CbjuruKe.js → index-BvJOYbNv.js} +755 -745
- package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
- package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DY45yiUM.js} +7 -6
- package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BypfLZsK.js} +11 -11
- package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
- package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-BoKU3MzZ.js} +655 -511
- package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
- package/dist/chunks/matrix-operation-contract-BV02rLhu.js +809 -0
- package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
- package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
- package/dist/chunks/pivot-header-presentation-D5v8uyjj.js +618 -0
- package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-BWrPhlGT.js} +259 -204
- package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
- package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
- package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
- package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-D3hxu4sE.js} +131 -132
- package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
- package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-C7Um5XN-.js} +47 -26
- package/dist/chunks/semantic-format-BjBMOSoo.js +192 -0
- package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-D46I_4g7.js} +49895 -46141
- package/dist/chunks/{slider-BYIH4icg.js → slider-B6LELqx6.js} +81 -82
- package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
- package/dist/chunks/switch-_7uBAbYx.js +24003 -0
- package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
- package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
- package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
- package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
- package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
- package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +138 -137
- package/dist/data-app-sdk/index.js +12 -12
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +27 -26
- package/dist/format-utils/index.js +247 -329
- package/dist/index.js +165 -168
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/briefings/index.d.ts +3 -0
- package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
- package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
- package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
- package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
- package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +8 -29
- package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
- package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
- package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
- package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
- package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
- package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
- package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
- package/dist/types/index.js +5 -5
- package/dist/types/lib/api/exports-api.d.ts +3 -0
- package/dist/types/lib/csv-download.d.ts +9 -0
- package/dist/types/lib/csv-encoding-options.d.ts +6 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
- package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
- package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
- package/dist/types/lib/export-utils.d.ts +17 -15
- package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
- package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
- package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
- package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
- package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
- package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
- package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
- package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
- package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
- package/dist/types/lib/types/common-types.d.ts +5 -0
- package/dist/types/lib/types/explorer-types.d.ts +14 -0
- package/dist/types/lib/types/token-types.d.ts +0 -1
- package/dist/types/lib/utils/card-definition.d.ts +1 -1
- package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
- package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
- package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +10 -7
- package/dist/types/shared/analytics-protocol/index.d.ts +12 -1
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
- package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
- package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +51 -5
- package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
- package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
- package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
- package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
- package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
- package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
- package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
- package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
- package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
- package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
- package/dist/types/shared/temporal/index.d.ts +5 -0
- package/dist/types/shared/temporal/relative-date.d.ts +21 -0
- package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
- package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
- package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
- package/package.json +1 -17
- package/src/data-app-sdk/README.md +6 -3
- package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
- package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
- package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
- package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
- package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
- package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
- package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
- package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
- package/dist/chunks/search-CJz-QQ0Q.js +0 -24
- package/dist/chunks/switch-XaAACBrJ.js +0 -2234
- package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
- package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
- package/dist/data-app-builder/index.js +0 -3666
- package/dist/data-app-builder-browser-runtime/index.js +0 -8
- package/dist/data-app-codegen/index.js +0 -22
- package/dist/data-app-codegen-node/index.js +0 -1807
- package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
- package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
- package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
- package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
- package/dist/types/data-app-builder/constants.d.ts +0 -14
- package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
- package/dist/types/data-app-builder/index.d.ts +0 -1
- package/dist/types/data-app-builder/lib/api.d.ts +0 -36
- package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
- package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
- package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
- package/dist/types/data-app-builder/types.d.ts +0 -558
- package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
- package/dist/types/data-app-builder.d.ts +0 -2
- package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
- package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
- package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
- package/dist/types/data-app-codegen/index.d.ts +0 -6
- package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
- package/dist/types/data-app-codegen/node.d.ts +0 -2
- package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
- package/dist/types/data-app-codegen/validation.d.ts +0 -8
- package/dist/types/data-app-codegen-node.d.ts +0 -2
- package/dist/types/data-app-codegen.d.ts +0 -2
- package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
- package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
- package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Calendar units a relative date can count in. */
|
|
3
|
+
export type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
4
|
+
/** Sub-day units, used only by rolling `last` windows. */
|
|
5
|
+
export type SubDayDateUnit = 'minute' | 'hour';
|
|
6
|
+
export type RelativeDateUnit = DateUnit | SubDayDateUnit;
|
|
7
|
+
/**
|
|
8
|
+
* A date window stated relative to an anchor ("now" or a pinned instant).
|
|
9
|
+
* Dashboard filters carry it as `TFilterValue.relativeMeta` and card filters as
|
|
10
|
+
* `FilterCondition.relativeMeta`; the server resolves it on every run in the
|
|
11
|
+
* governed calendar.
|
|
12
|
+
*/
|
|
13
|
+
export type RelativeDateFilter = {
|
|
14
|
+
mode: 'last';
|
|
15
|
+
n: number;
|
|
16
|
+
unit: SubDayDateUnit;
|
|
17
|
+
complete?: false;
|
|
18
|
+
relativeTo?: RelativeDateAnchor;
|
|
19
|
+
} | {
|
|
20
|
+
mode: 'last';
|
|
21
|
+
n: number;
|
|
22
|
+
unit: DateUnit;
|
|
23
|
+
complete?: boolean;
|
|
24
|
+
relativeTo?: RelativeDateAnchor;
|
|
25
|
+
} | {
|
|
26
|
+
mode: 'this';
|
|
27
|
+
unit: DateUnit;
|
|
28
|
+
toDate?: boolean;
|
|
29
|
+
/** Only used with unit=month for single-day month-boundary presets. */
|
|
30
|
+
boundary?: 'first_day' | 'last_day';
|
|
31
|
+
} | {
|
|
32
|
+
mode: 'previous';
|
|
33
|
+
unit: DateUnit;
|
|
34
|
+
} | {
|
|
35
|
+
mode: 'between';
|
|
36
|
+
unit: DateUnit;
|
|
37
|
+
from: number;
|
|
38
|
+
to: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* What a `last` window counts back from. Omitted means now (or a pinned
|
|
42
|
+
* instant); `'latest_data'` means the latest value of the window's own field
|
|
43
|
+
* in its lookup scope (analytics kernel K11). Only agents author it.
|
|
44
|
+
*/
|
|
45
|
+
export type RelativeDateAnchor = 'latest_data';
|
|
46
|
+
/** A `last` window that counts back from the latest data (K11). */
|
|
47
|
+
export type DataRelativeDateFilter = Extract<RelativeDateFilter, {
|
|
48
|
+
mode: 'last';
|
|
49
|
+
}> & {
|
|
50
|
+
relativeTo: 'latest_data';
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A window that counts back from the latest data instead of from now (K11):
|
|
54
|
+
* the one test every reader uses. It reads any value, so callers can pass a
|
|
55
|
+
* field they have not validated.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isDataRelativeDateFilter(meta: unknown): meta is DataRelativeDateFilter;
|
|
58
|
+
/** A relative date belongs only on a range condition (plan D3). */
|
|
59
|
+
export declare function allowsRelativeDate(operator: string): boolean;
|
|
60
|
+
/** Strict schema for a persisted `RelativeDateFilter`. */
|
|
61
|
+
export declare const relativeDateFilterSchema: z.ZodType<RelativeDateFilter>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RelativeDateFilter } from './relative-date-filter.js';
|
|
2
|
+
/** The preset a relative date is, or null when it isn't one. */
|
|
3
|
+
export declare function findPresetLabel(meta: RelativeDateFilter | undefined): string | null;
|
|
4
|
+
/** One offset as an option label: "Today", "Last month", "6 days ago". */
|
|
5
|
+
export declare function getRelativeOffsetLabel(offset: number, unit: RelativeDateFilter['unit']): string;
|
|
6
|
+
/**
|
|
7
|
+
* Format a `RelativeDateFilter` meta into a human-readable label.
|
|
8
|
+
*
|
|
9
|
+
* 1. First tries to reverse-match against `presetMetadata` so canonical
|
|
10
|
+
* presets (Today, Last 7 days, This week, …) round-trip back to the
|
|
11
|
+
* same wording the user originally clicked.
|
|
12
|
+
* 2. Falls back to a generated label for ad-hoc relative ranges that
|
|
13
|
+
* aren't in the preset list (e.g., from the Relative tab's custom
|
|
14
|
+
* From/To dropdowns).
|
|
15
|
+
*
|
|
16
|
+
* Returns null if the meta can't be sensibly labelled.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getRelativeDateLabel(meta: RelativeDateFilter | undefined): string | null;
|
|
19
|
+
export declare function relativeMetaEquals(a: RelativeDateFilter, b: RelativeDateFilter): boolean;
|
|
20
|
+
export declare const presetMetadata: Record<string, RelativeDateFilter>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SemaphorAnalyzeResult } from './analyze-result-types.js';
|
|
3
3
|
import { SemaphorAnalyticsDiagnosticFeedback, SemaphorAnalyticsExecutionResult, SemaphorAnalyticsPopulation, SemaphorAnalyticsResult, SemaphorRelationshipDiagnostics } from './contracts.js';
|
|
4
|
-
import { SemaphorDataAppCodegenSummary } from './data-app-codegen-summary.js';
|
|
5
4
|
export * from './analytics-base-schemas.js';
|
|
6
5
|
export { matrixResultSchema as semaphorMatrixResultSchema } from './matrix-window-contract.js';
|
|
7
6
|
export declare const semaphorAnalyticsResultSchema: z.ZodType<SemaphorAnalyticsResult>;
|
|
@@ -3370,4 +3369,3 @@ export declare const analyticsExecutionEnvelopeSchema: z.ZodObject<{
|
|
|
3370
3369
|
export declare const semaphorAnalyticsExecutionResultSchema: z.ZodType<SemaphorAnalyticsExecutionResult>;
|
|
3371
3370
|
export declare const semaphorAnalyzeResultShape: z.ZodRawShape;
|
|
3372
3371
|
export declare const semaphorAnalyzeResultSchema: z.ZodType<SemaphorAnalyzeResult>;
|
|
3373
|
-
export declare const semaphorDataAppCodegenSummarySchema: z.ZodType<SemaphorDataAppCodegenSummary>;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for `SemaphorTimeWindow`, built from the shared rules in
|
|
4
|
+
* `time-window.ts`. `strict: true` rejects unknown keys; otherwise they are
|
|
5
|
+
* dropped, as tool argument parsing expects.
|
|
6
|
+
*/
|
|
7
|
+
export declare function semaphorTimeWindowSchemas(options?: {
|
|
8
|
+
strict?: boolean;
|
|
9
|
+
}): {
|
|
10
|
+
relative: z.ZodEffects<z.ZodObject<{
|
|
11
|
+
kind: z.ZodOptional<z.ZodLiteral<"relative">>;
|
|
12
|
+
unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
|
|
13
|
+
value: z.ZodNumber;
|
|
14
|
+
anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
|
|
15
|
+
completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
value: number;
|
|
18
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
19
|
+
kind?: "relative" | undefined;
|
|
20
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
21
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
value: number;
|
|
24
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
25
|
+
kind?: "relative" | undefined;
|
|
26
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
27
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
value: number;
|
|
30
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
31
|
+
kind?: "relative" | undefined;
|
|
32
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
33
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
value: number;
|
|
36
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
37
|
+
kind?: "relative" | undefined;
|
|
38
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
39
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
40
|
+
}> | z.ZodEffects<z.ZodObject<{
|
|
41
|
+
kind: z.ZodOptional<z.ZodLiteral<"relative">>;
|
|
42
|
+
unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
|
|
43
|
+
value: z.ZodNumber;
|
|
44
|
+
anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
|
|
45
|
+
completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
|
|
46
|
+
}, "strict", z.ZodTypeAny, {
|
|
47
|
+
value: number;
|
|
48
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
49
|
+
kind?: "relative" | undefined;
|
|
50
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
51
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
value: number;
|
|
54
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
55
|
+
kind?: "relative" | undefined;
|
|
56
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
57
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
58
|
+
}>, {
|
|
59
|
+
value: number;
|
|
60
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
61
|
+
kind?: "relative" | undefined;
|
|
62
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
63
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
value: number;
|
|
66
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
67
|
+
kind?: "relative" | undefined;
|
|
68
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
69
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
calendar: z.ZodEffects<z.ZodObject<{
|
|
72
|
+
kind: z.ZodLiteral<"calendar">;
|
|
73
|
+
unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
|
|
74
|
+
period: z.ZodEnum<["this", "previous"]>;
|
|
75
|
+
toDate: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
kind: "calendar";
|
|
78
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
79
|
+
period: "this" | "previous";
|
|
80
|
+
toDate?: boolean | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
kind: "calendar";
|
|
83
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
84
|
+
period: "this" | "previous";
|
|
85
|
+
toDate?: boolean | undefined;
|
|
86
|
+
}>, {
|
|
87
|
+
kind: "calendar";
|
|
88
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
89
|
+
period: "this" | "previous";
|
|
90
|
+
toDate?: boolean | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
kind: "calendar";
|
|
93
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
94
|
+
period: "this" | "previous";
|
|
95
|
+
toDate?: boolean | undefined;
|
|
96
|
+
}> | z.ZodEffects<z.ZodObject<{
|
|
97
|
+
kind: z.ZodLiteral<"calendar">;
|
|
98
|
+
unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
|
|
99
|
+
period: z.ZodEnum<["this", "previous"]>;
|
|
100
|
+
toDate: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
}, "strict", z.ZodTypeAny, {
|
|
102
|
+
kind: "calendar";
|
|
103
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
104
|
+
period: "this" | "previous";
|
|
105
|
+
toDate?: boolean | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
kind: "calendar";
|
|
108
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
109
|
+
period: "this" | "previous";
|
|
110
|
+
toDate?: boolean | undefined;
|
|
111
|
+
}>, {
|
|
112
|
+
kind: "calendar";
|
|
113
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
114
|
+
period: "this" | "previous";
|
|
115
|
+
toDate?: boolean | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
kind: "calendar";
|
|
118
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
119
|
+
period: "this" | "previous";
|
|
120
|
+
toDate?: boolean | undefined;
|
|
121
|
+
}>;
|
|
122
|
+
absolute: z.ZodEffects<z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"absolute">;
|
|
124
|
+
start: z.ZodString;
|
|
125
|
+
end: z.ZodString;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
kind: "absolute";
|
|
128
|
+
start: string;
|
|
129
|
+
end: string;
|
|
130
|
+
}, {
|
|
131
|
+
kind: "absolute";
|
|
132
|
+
start: string;
|
|
133
|
+
end: string;
|
|
134
|
+
}>, {
|
|
135
|
+
kind: "absolute";
|
|
136
|
+
start: string;
|
|
137
|
+
end: string;
|
|
138
|
+
}, {
|
|
139
|
+
kind: "absolute";
|
|
140
|
+
start: string;
|
|
141
|
+
end: string;
|
|
142
|
+
}> | z.ZodEffects<z.ZodObject<{
|
|
143
|
+
kind: z.ZodLiteral<"absolute">;
|
|
144
|
+
start: z.ZodString;
|
|
145
|
+
end: z.ZodString;
|
|
146
|
+
}, "strict", z.ZodTypeAny, {
|
|
147
|
+
kind: "absolute";
|
|
148
|
+
start: string;
|
|
149
|
+
end: string;
|
|
150
|
+
}, {
|
|
151
|
+
kind: "absolute";
|
|
152
|
+
start: string;
|
|
153
|
+
end: string;
|
|
154
|
+
}>, {
|
|
155
|
+
kind: "absolute";
|
|
156
|
+
start: string;
|
|
157
|
+
end: string;
|
|
158
|
+
}, {
|
|
159
|
+
kind: "absolute";
|
|
160
|
+
start: string;
|
|
161
|
+
end: string;
|
|
162
|
+
}>;
|
|
163
|
+
timeWindow: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
164
|
+
kind: z.ZodOptional<z.ZodLiteral<"relative">>;
|
|
165
|
+
unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
|
|
166
|
+
value: z.ZodNumber;
|
|
167
|
+
anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
|
|
168
|
+
completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
value: number;
|
|
171
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
172
|
+
kind?: "relative" | undefined;
|
|
173
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
174
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
value: number;
|
|
177
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
178
|
+
kind?: "relative" | undefined;
|
|
179
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
180
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
181
|
+
}>, {
|
|
182
|
+
value: number;
|
|
183
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
184
|
+
kind?: "relative" | undefined;
|
|
185
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
186
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
187
|
+
}, {
|
|
188
|
+
value: number;
|
|
189
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
190
|
+
kind?: "relative" | undefined;
|
|
191
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
192
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
193
|
+
}> | z.ZodEffects<z.ZodObject<{
|
|
194
|
+
kind: z.ZodOptional<z.ZodLiteral<"relative">>;
|
|
195
|
+
unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
|
|
196
|
+
value: z.ZodNumber;
|
|
197
|
+
anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
|
|
198
|
+
completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
|
|
199
|
+
}, "strict", z.ZodTypeAny, {
|
|
200
|
+
value: number;
|
|
201
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
202
|
+
kind?: "relative" | undefined;
|
|
203
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
204
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
205
|
+
}, {
|
|
206
|
+
value: number;
|
|
207
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
208
|
+
kind?: "relative" | undefined;
|
|
209
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
210
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
211
|
+
}>, {
|
|
212
|
+
value: number;
|
|
213
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
214
|
+
kind?: "relative" | undefined;
|
|
215
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
216
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
value: number;
|
|
219
|
+
unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
220
|
+
kind?: "relative" | undefined;
|
|
221
|
+
anchor?: "now" | "latest_available" | undefined;
|
|
222
|
+
completeness?: "include_partial" | "complete_periods" | undefined;
|
|
223
|
+
}>, z.ZodEffects<z.ZodObject<{
|
|
224
|
+
kind: z.ZodLiteral<"calendar">;
|
|
225
|
+
unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
|
|
226
|
+
period: z.ZodEnum<["this", "previous"]>;
|
|
227
|
+
toDate: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
kind: "calendar";
|
|
230
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
231
|
+
period: "this" | "previous";
|
|
232
|
+
toDate?: boolean | undefined;
|
|
233
|
+
}, {
|
|
234
|
+
kind: "calendar";
|
|
235
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
236
|
+
period: "this" | "previous";
|
|
237
|
+
toDate?: boolean | undefined;
|
|
238
|
+
}>, {
|
|
239
|
+
kind: "calendar";
|
|
240
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
241
|
+
period: "this" | "previous";
|
|
242
|
+
toDate?: boolean | undefined;
|
|
243
|
+
}, {
|
|
244
|
+
kind: "calendar";
|
|
245
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
246
|
+
period: "this" | "previous";
|
|
247
|
+
toDate?: boolean | undefined;
|
|
248
|
+
}> | z.ZodEffects<z.ZodObject<{
|
|
249
|
+
kind: z.ZodLiteral<"calendar">;
|
|
250
|
+
unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
|
|
251
|
+
period: z.ZodEnum<["this", "previous"]>;
|
|
252
|
+
toDate: z.ZodOptional<z.ZodBoolean>;
|
|
253
|
+
}, "strict", z.ZodTypeAny, {
|
|
254
|
+
kind: "calendar";
|
|
255
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
256
|
+
period: "this" | "previous";
|
|
257
|
+
toDate?: boolean | undefined;
|
|
258
|
+
}, {
|
|
259
|
+
kind: "calendar";
|
|
260
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
261
|
+
period: "this" | "previous";
|
|
262
|
+
toDate?: boolean | undefined;
|
|
263
|
+
}>, {
|
|
264
|
+
kind: "calendar";
|
|
265
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
266
|
+
period: "this" | "previous";
|
|
267
|
+
toDate?: boolean | undefined;
|
|
268
|
+
}, {
|
|
269
|
+
kind: "calendar";
|
|
270
|
+
unit: "day" | "week" | "month" | "quarter" | "year";
|
|
271
|
+
period: "this" | "previous";
|
|
272
|
+
toDate?: boolean | undefined;
|
|
273
|
+
}>, z.ZodEffects<z.ZodObject<{
|
|
274
|
+
kind: z.ZodLiteral<"absolute">;
|
|
275
|
+
start: z.ZodString;
|
|
276
|
+
end: z.ZodString;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
kind: "absolute";
|
|
279
|
+
start: string;
|
|
280
|
+
end: string;
|
|
281
|
+
}, {
|
|
282
|
+
kind: "absolute";
|
|
283
|
+
start: string;
|
|
284
|
+
end: string;
|
|
285
|
+
}>, {
|
|
286
|
+
kind: "absolute";
|
|
287
|
+
start: string;
|
|
288
|
+
end: string;
|
|
289
|
+
}, {
|
|
290
|
+
kind: "absolute";
|
|
291
|
+
start: string;
|
|
292
|
+
end: string;
|
|
293
|
+
}> | z.ZodEffects<z.ZodObject<{
|
|
294
|
+
kind: z.ZodLiteral<"absolute">;
|
|
295
|
+
start: z.ZodString;
|
|
296
|
+
end: z.ZodString;
|
|
297
|
+
}, "strict", z.ZodTypeAny, {
|
|
298
|
+
kind: "absolute";
|
|
299
|
+
start: string;
|
|
300
|
+
end: string;
|
|
301
|
+
}, {
|
|
302
|
+
kind: "absolute";
|
|
303
|
+
start: string;
|
|
304
|
+
end: string;
|
|
305
|
+
}>, {
|
|
306
|
+
kind: "absolute";
|
|
307
|
+
start: string;
|
|
308
|
+
end: string;
|
|
309
|
+
}, {
|
|
310
|
+
kind: "absolute";
|
|
311
|
+
start: string;
|
|
312
|
+
end: string;
|
|
313
|
+
}>]>;
|
|
314
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SemaphorRelativeTimeWindow, SemaphorTimeGrain } from './contracts.js';
|
|
2
|
+
/** Units a calendar window ("this month", "previous quarter") can name. */
|
|
3
|
+
export declare const SEMAPHOR_CALENDAR_TIME_WINDOW_UNITS: readonly ["day", "week", "month", "quarter", "year"];
|
|
4
|
+
export declare const SEMAPHOR_CALENDAR_TIME_WINDOW_PERIODS: readonly ["this", "previous"];
|
|
5
|
+
export declare const SEMAPHOR_TIME_WINDOW_ANCHORS: readonly ["now", "latest_available"];
|
|
6
|
+
export declare const SEMAPHOR_TIME_WINDOW_COMPLETENESS: readonly ["include_partial", "complete_periods"];
|
|
7
|
+
/** The largest rolling window per unit: ten years. */
|
|
8
|
+
export declare const SEMAPHOR_TIME_WINDOW_MAX_VALUE: Readonly<Record<SemaphorTimeGrain, number>>;
|
|
9
|
+
/**
|
|
10
|
+
* The anchor a rolling window counts back from. An omitted anchor means the
|
|
11
|
+
* latest available data; a saved card that should keep rolling states "now".
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveTimeWindowAnchor(timeWindow: Pick<SemaphorRelativeTimeWindow, 'anchor'>): 'now' | 'latest_available';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CsvEncoding } from '../format-utils/exporters/csv-utils.js';
|
|
2
3
|
import { MatrixConfig, MatrixExportLayout, MatrixExportRequest, MatrixExportRow, MatrixFailure, MatrixViewState } from '../analytics-protocol/index.js';
|
|
3
4
|
import { ReportRuntimeContext } from '../report-runtime-context/index.js';
|
|
4
5
|
export type MatrixExportContent = 'current' | 'all' | 'flat';
|
|
@@ -306,7 +307,7 @@ export declare function captureMatrixExport(input: {
|
|
|
306
307
|
levelId: string;
|
|
307
308
|
axis: "columns" | "rows";
|
|
308
309
|
direction: "asc" | "desc";
|
|
309
|
-
nulls: "
|
|
310
|
+
nulls: "last" | "first";
|
|
310
311
|
}[];
|
|
311
312
|
rankings: readonly import('../analytics-protocol/index.js').MatrixRanking[];
|
|
312
313
|
filters?: import('../../components/index.js').FilterGroup | undefined;
|
|
@@ -658,7 +659,7 @@ export declare function captureMatrixExport(input: {
|
|
|
658
659
|
levelId: string;
|
|
659
660
|
axis: "columns" | "rows";
|
|
660
661
|
direction: "asc" | "desc";
|
|
661
|
-
nulls: "
|
|
662
|
+
nulls: "last" | "first";
|
|
662
663
|
}[];
|
|
663
664
|
rankings: readonly import('../analytics-protocol/index.js').MatrixRanking[];
|
|
664
665
|
filters?: import('../../components/index.js').FilterGroup | undefined;
|
|
@@ -776,6 +777,8 @@ export declare function buildMatrixDeliveryEnvelope<TSource extends {
|
|
|
776
777
|
reportContext: ReportRuntimeContext;
|
|
777
778
|
delimiter: ',' | ';' | '\t';
|
|
778
779
|
includeHeaders: boolean;
|
|
780
|
+
/** CSV only; absent lets the app resolve the dashboard's setting. */
|
|
781
|
+
csvEncoding?: CsvEncoding;
|
|
779
782
|
}): TControls & {
|
|
780
783
|
type: "card";
|
|
781
784
|
dashboardId: string;
|
|
@@ -1090,7 +1093,7 @@ export declare function buildMatrixDeliveryEnvelope<TSource extends {
|
|
|
1090
1093
|
levelId: string;
|
|
1091
1094
|
axis: "columns" | "rows";
|
|
1092
1095
|
direction: "asc" | "desc";
|
|
1093
|
-
nulls: "
|
|
1096
|
+
nulls: "last" | "first";
|
|
1094
1097
|
}[];
|
|
1095
1098
|
rankings: readonly import('../analytics-protocol/index.js').MatrixRanking[];
|
|
1096
1099
|
filters?: import('../../components/index.js').FilterGroup | undefined;
|
|
@@ -1442,7 +1445,7 @@ export declare function buildMatrixDeliveryEnvelope<TSource extends {
|
|
|
1442
1445
|
levelId: string;
|
|
1443
1446
|
axis: "columns" | "rows";
|
|
1444
1447
|
direction: "asc" | "desc";
|
|
1445
|
-
nulls: "
|
|
1448
|
+
nulls: "last" | "first";
|
|
1446
1449
|
}[];
|
|
1447
1450
|
rankings: readonly import('../analytics-protocol/index.js').MatrixRanking[];
|
|
1448
1451
|
filters?: import('../../components/index.js').FilterGroup | undefined;
|
|
@@ -1456,6 +1459,7 @@ export declare function buildMatrixDeliveryEnvelope<TSource extends {
|
|
|
1456
1459
|
includeHeaders: boolean;
|
|
1457
1460
|
timezone: string;
|
|
1458
1461
|
presentationExecutionSnapshot: import('../format-utils/index.js').PresentationExecutionSnapshot;
|
|
1462
|
+
csvEncoding?: "utf-8-bom" | "utf-8" | undefined;
|
|
1459
1463
|
acquisition?: "continuation" | undefined;
|
|
1460
1464
|
};
|
|
1461
1465
|
};
|
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The CSV file contract: the one place that decides how CSV rows become
|
|
3
|
+
* bytes. Every CSV file delivered to a person or system (browser downloads,
|
|
4
|
+
* chunked exports, Matrix exports, rendered Briefing attachments) is written
|
|
5
|
+
* through these functions. Writers decide which rows to write; this module
|
|
6
|
+
* decides the BOM, quoting and record separators. See "CSV file standard" in
|
|
7
|
+
* the format-utils README.
|
|
8
|
+
* IMPORTANT: No React or browser-specific imports allowed
|
|
9
|
+
*/
|
|
10
|
+
export declare const CSV_ENCODINGS: readonly ["utf-8-bom", "utf-8"];
|
|
11
|
+
export type CsvEncoding = (typeof CSV_ENCODINGS)[number];
|
|
12
|
+
/** Excel garbles non-ASCII text in a UTF-8 file without a BOM, so the BOM is the default. */
|
|
13
|
+
export declare const DEFAULT_CSV_ENCODING: CsvEncoding;
|
|
14
|
+
export declare const CSV_DELIMITERS: readonly [",", ";", "\t"];
|
|
15
|
+
export type CsvDelimiter = (typeof CSV_DELIMITERS)[number];
|
|
16
|
+
/** RFC 4180 record separator. Every record, including the last, ends with it. */
|
|
17
|
+
export declare const CSV_RECORD_SEPARATOR = "\r\n";
|
|
18
|
+
/** Content type of every delivered CSV file. */
|
|
19
|
+
export declare const CSV_CONTENT_TYPE = "text/csv; charset=utf-8";
|
|
20
|
+
export type CsvCell = string | number | null | undefined;
|
|
21
|
+
/** Turn a raw record value into a cell: objects become JSON, not "[object Object]". */
|
|
22
|
+
export declare function toCsvCell(value: unknown): CsvCell;
|
|
23
|
+
export declare function parseCsvEncoding(value: unknown): CsvEncoding | undefined;
|
|
24
|
+
export declare function parseCsvDelimiter(value: unknown): CsvDelimiter | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The one precedence rule for a file's encoding: an explicit per-export
|
|
27
|
+
* choice, then the dashboard's setting, then the default. Boundaries reject
|
|
28
|
+
* invalid values before resolving; here they fall through.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveCsvEncoding(input: {
|
|
31
|
+
requested?: unknown;
|
|
32
|
+
dashboardDefault?: unknown;
|
|
33
|
+
}): CsvEncoding;
|
|
34
|
+
/** What a file starts with. Only the writer of a file's first piece adds it. */
|
|
35
|
+
export declare function csvFilePreamble(encoding: CsvEncoding): string;
|
|
2
36
|
/** Protect explicitly textual cells before RFC escaping. Never apply this to
|
|
3
37
|
* numeric operands (including exact numeric text); their sign is meaningful. */
|
|
4
38
|
export declare function protectCSVText(value: string): string;
|
|
@@ -6,18 +40,15 @@ export declare function protectCSVText(value: string): string;
|
|
|
6
40
|
* Escape a value for CSV output (RFC 4180 compliant)
|
|
7
41
|
* Wraps in quotes if value contains delimiter, quotes, or newlines
|
|
8
42
|
*/
|
|
9
|
-
export declare function escapeCSVValue(value:
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
export declare function
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
export declare function objectsToCSV(data: Record<string, unknown>[], options?: Partial<CSVExportOptions> & {
|
|
22
|
-
columns?: string[];
|
|
43
|
+
export declare function escapeCSVValue(value: CsvCell, delimiter?: CsvDelimiter): string;
|
|
44
|
+
/** One escaped record, ending with CSV_RECORD_SEPARATOR. */
|
|
45
|
+
export declare function csvRecord(values: readonly CsvCell[], delimiter: CsvDelimiter): string;
|
|
46
|
+
/** Escaped records, each ending with CSV_RECORD_SEPARATOR. */
|
|
47
|
+
export declare function csvRecords(rows: readonly (readonly CsvCell[])[], delimiter: CsvDelimiter): string;
|
|
48
|
+
/** A whole CSV file held in memory: preamble, optional header, then rows. */
|
|
49
|
+
export declare function encodeCsvFile(input: {
|
|
50
|
+
header?: readonly CsvCell[];
|
|
51
|
+
rows: readonly (readonly CsvCell[])[];
|
|
52
|
+
delimiter: CsvDelimiter;
|
|
53
|
+
encoding: CsvEncoding;
|
|
23
54
|
}): string;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { escapeCSVValue, protectCSVText,
|
|
2
|
-
export {
|
|
3
|
-
export { generatePivotHeaders, formatPivotDataRow, formatPivotTableForCSV, } from './pivot-exporter.js';
|
|
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
|
+
export type { CsvEncoding, CsvDelimiter, CsvCell } from './csv-utils.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CsvDelimiter } from './exporters/csv-utils.js';
|
|
1
2
|
import { PresentationExecutionSnapshot, PresentationScope } from './presentation-execution.js';
|
|
2
3
|
export type FlatTableExportTotalsBehavior = 'sum' | 'avg' | 'count' | 'label';
|
|
3
4
|
export type FlatTableExportTotalsRequest = {
|
|
@@ -21,5 +22,5 @@ export declare function buildFlatTableExportTotalsFooter(params: {
|
|
|
21
22
|
snapshot: PresentationExecutionSnapshot;
|
|
22
23
|
scope: PresentationScope;
|
|
23
24
|
useFormattedValues: boolean;
|
|
24
|
-
delimiter:
|
|
25
|
+
delimiter: CsvDelimiter;
|
|
25
26
|
}): string;
|
|
@@ -345,7 +345,7 @@ export declare function buildMatrixPrintTable(input: {
|
|
|
345
345
|
levelId: string;
|
|
346
346
|
axis: "columns" | "rows";
|
|
347
347
|
direction: "asc" | "desc";
|
|
348
|
-
nulls: "
|
|
348
|
+
nulls: "last" | "first";
|
|
349
349
|
}[];
|
|
350
350
|
rankings: readonly import('../analytics-protocol/index.js').MatrixRanking[];
|
|
351
351
|
filters?: import('../../components/index.js').FilterGroup | undefined;
|
|
@@ -697,7 +697,7 @@ export declare function buildMatrixPrintTable(input: {
|
|
|
697
697
|
levelId: string;
|
|
698
698
|
axis: "columns" | "rows";
|
|
699
699
|
direction: "asc" | "desc";
|
|
700
|
-
nulls: "
|
|
700
|
+
nulls: "last" | "first";
|
|
701
701
|
}[];
|
|
702
702
|
rankings: readonly import('../analytics-protocol/index.js').MatrixRanking[];
|
|
703
703
|
filters?: import('../../components/index.js').FilterGroup | undefined;
|
|
@@ -189,53 +189,11 @@ export interface ExportFormattingConfig {
|
|
|
189
189
|
/** Ordered list of columns to include */
|
|
190
190
|
visibleColumns: string[];
|
|
191
191
|
}
|
|
192
|
-
export interface CSVExportOptions {
|
|
193
|
-
delimiter: ',' | ';' | '\t';
|
|
194
|
-
includeHeaders: boolean;
|
|
195
|
-
lineEnding: '\n' | '\r\n';
|
|
196
|
-
}
|
|
197
192
|
export interface GroupByField {
|
|
198
193
|
name: string;
|
|
199
194
|
alias: string;
|
|
200
195
|
label?: string;
|
|
201
196
|
}
|
|
202
|
-
export interface PivotByColumn {
|
|
203
|
-
name: string;
|
|
204
|
-
alias: string;
|
|
205
|
-
label?: string;
|
|
206
|
-
}
|
|
207
|
-
export interface ColumnHeaderNode {
|
|
208
|
-
name: string;
|
|
209
|
-
level: number;
|
|
210
|
-
colspan: number;
|
|
211
|
-
children?: ColumnHeaderNode[];
|
|
212
|
-
columnKey?: string;
|
|
213
|
-
}
|
|
214
|
-
export interface PivotExportConfig {
|
|
215
|
-
groupByColumns: GroupByField[];
|
|
216
|
-
pivotByColumns: PivotByColumn[];
|
|
217
|
-
columnHeadersTree: ColumnHeaderNode[];
|
|
218
|
-
columnHeaders: string[];
|
|
219
|
-
columnSubtotalMeta?: ColumnSubtotalMeta[];
|
|
220
|
-
includeSubtotals: boolean;
|
|
221
|
-
includeGrandTotal: boolean;
|
|
222
|
-
showRowTotals: boolean;
|
|
223
|
-
}
|
|
224
|
-
export interface ColumnSubtotalMeta {
|
|
225
|
-
columnKey: string;
|
|
226
|
-
label: string;
|
|
227
|
-
level: number;
|
|
228
|
-
}
|
|
229
|
-
export interface PivotCellData {
|
|
230
|
-
value: unknown;
|
|
231
|
-
formatted?: string;
|
|
232
|
-
}
|
|
233
|
-
export interface PivotRowData {
|
|
234
|
-
fieldValues: string[];
|
|
235
|
-
cells: Record<string, PivotCellData>;
|
|
236
|
-
isSubtotal?: boolean;
|
|
237
|
-
isGrandTotal?: boolean;
|
|
238
|
-
}
|
|
239
197
|
export interface FormatOptions {
|
|
240
198
|
decimalPlaces?: number;
|
|
241
199
|
useSuffix?: boolean;
|