react-semaphor 0.1.526 → 0.1.528
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DATA_APP_SDK.md +5 -1
- package/dist/analytics-protocol/index.js +1190 -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-DUu-tCQw.js} +66 -65
- package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BdPceiw8.js} +68 -65
- package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
- package/dist/chunks/dashboard-BkskKMck.js +14 -0
- package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-Bb0RhGRC.js} +372 -359
- package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-loWTHPMi.js} +739 -686
- package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DUci_SOR.js} +10 -10
- package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-z9WN26w7.js} +6603 -6572
- package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-CGSFK9S-.js} +266 -267
- package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-CdXSo1pb.js} +19 -19
- package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
- package/dist/chunks/{index-CbjuruKe.js → index-CTYnXU85.js} +781 -780
- 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-DhykwdZs.js} +7 -6
- package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BV9ywFtJ.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-1Mm8x8w7.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-Dp7kFpVk.js +1383 -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-CZa3556D.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-Bqdtknud.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-VV0-Ro6F.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-IZjBSU6Z.js} +47 -26
- package/dist/chunks/semantic-format-BBLvfwua.js +192 -0
- package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-DbA4mVQL.js} +49909 -46207
- package/dist/chunks/{slider-BYIH4icg.js → slider-DpiJG8lv.js} +81 -82
- package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
- package/dist/chunks/switch-C4YH-W1X.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/semantic-types.d.ts +4 -2
- package/dist/types/lib/types/token-types.d.ts +0 -1
- package/dist/types/lib/utils/aggregate-expression-utils.d.ts +0 -4
- 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/aggregate-expression.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +32 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +48 -7
- package/dist/types/shared/analytics-protocol/index.d.ts +15 -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 +61 -6
- package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +63 -0
- 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,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;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CalendarContext } from '../report-runtime-context/index.js';
|
|
2
|
+
import { ZonedWallClockTime } from './zoned-wall-clock.js';
|
|
3
|
+
/** The units a period or a shift counts in. */
|
|
4
|
+
export type TemporalUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
5
|
+
/**
|
|
6
|
+
* What period math reads from a calendar. The anchor ("now") is never read
|
|
7
|
+
* here: callers pass the instant they resolve against.
|
|
8
|
+
*/
|
|
9
|
+
export type TemporalCalendar = Pick<CalendarContext, 'tz' | 'weekStart' | 'fiscalCalendar'>;
|
|
10
|
+
/** Every instant from `start` up to, not including, `endExclusive`. */
|
|
11
|
+
export type TemporalPeriod = {
|
|
12
|
+
start: Date;
|
|
13
|
+
endExclusive: Date;
|
|
14
|
+
};
|
|
15
|
+
/** A wall-clock time with every field set. */
|
|
16
|
+
export type WallClockTime = Required<ZonedWallClockTime>;
|
|
17
|
+
/** Units measured as elapsed time rather than on the calendar, in milliseconds. */
|
|
18
|
+
export declare const ELAPSED_UNIT_MILLISECONDS: Partial<Record<TemporalUnit, number>>;
|
|
19
|
+
/** The wall clock at an instant, with its milliseconds (offsets are whole seconds). */
|
|
20
|
+
export declare function wallClockAt(instant: Date, tz: string): WallClockTime;
|
|
21
|
+
/** The instant a wall clock names, under the daylight-saving rule (K7). */
|
|
22
|
+
export declare function instantAt(wall: ZonedWallClockTime, tz: string): Date;
|
|
23
|
+
export declare function daysInMonth(year: number, month: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* The wall clock moved by whole units, keeping the time of day for calendar
|
|
26
|
+
* units and clamping the day for months, quarters and years (January 31 plus
|
|
27
|
+
* one month is February 28), as date-fns does.
|
|
28
|
+
*/
|
|
29
|
+
export declare function shiftWallClock(wall: WallClockTime, amount: number, unit: TemporalUnit): WallClockTime;
|
|
30
|
+
/** The weekday of a wall date, 0 for Sunday. */
|
|
31
|
+
export declare function wallWeekday(wall: Pick<WallClockTime, 'year' | 'month' | 'day'>): number;
|
|
32
|
+
/**
|
|
33
|
+
* The period `offset` periods from the one containing `instant` (0 for that
|
|
34
|
+
* period, -1 for the one before). Calendar periods are found in the wall
|
|
35
|
+
* clock, so a day that starts after a skipped midnight starts when it does
|
|
36
|
+
* (K7). Seconds, minutes and hours count elapsed time from the instant's own
|
|
37
|
+
* occurrence, so a repeated hour is two periods.
|
|
38
|
+
*/
|
|
39
|
+
export declare function periodAt(instant: Date, unit: TemporalUnit, calendar: TemporalCalendar, offset?: number): TemporalPeriod;
|
|
40
|
+
/** Where the period containing `instant` starts. */
|
|
41
|
+
export declare function startOfPeriod(instant: Date, unit: TemporalUnit, calendar: TemporalCalendar): Date;
|
|
42
|
+
/** The last millisecond of the period containing `instant`. */
|
|
43
|
+
export declare function endOfPeriod(instant: Date, unit: TemporalUnit, calendar: TemporalCalendar): Date;
|
|
44
|
+
/**
|
|
45
|
+
* The instant moved by whole units in the calendar's wall clock, keeping its
|
|
46
|
+
* time of day (see `shiftWallClock`).
|
|
47
|
+
*/
|
|
48
|
+
export declare function shiftInstant(instant: Date, amount: number, unit: TemporalUnit, calendar: Pick<TemporalCalendar, 'tz'>): Date;
|
|
49
|
+
/** Calendar days from `start`'s date to `end`'s date in the timezone. */
|
|
50
|
+
export declare function calendarDaysBetween(start: Date, end: Date, tz: string): number;
|
|
51
|
+
/** `YYYY-MM-DD` of the instant's wall date in the timezone. */
|
|
52
|
+
export declare function formatWallDate(instant: Date, tz: string): string;
|
|
53
|
+
/** The fields of a `YYYY-MM-DD` date that names a real day, else null. */
|
|
54
|
+
export declare function parseWallDate(value: string): Pick<WallClockTime, 'year' | 'month' | 'day'> | null;
|
|
55
|
+
/** The day a `YYYY-MM-DD` date names in the timezone, or null when it names none. */
|
|
56
|
+
export declare function wallDatePeriod(value: string, tz: string): TemporalPeriod | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RelativeDateFilter } from '../analytics-protocol/relative-date-filter.js';
|
|
2
|
+
import { TemporalCalendar } from './calendar-periods.js';
|
|
3
|
+
/** A resolved window: `end` is the inclusive last instant. */
|
|
4
|
+
export type ResolvedRelativeDate = {
|
|
5
|
+
start: Date;
|
|
6
|
+
end: Date;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The window a relative date names at `anchor` in the calendar:
|
|
10
|
+
* - `last` n units: the n units back to the anchor, the same wall-clock time
|
|
11
|
+
* n units earlier (minutes and hours count elapsed time); with `complete`,
|
|
12
|
+
* the n whole periods before the one containing the anchor;
|
|
13
|
+
* - `this`: the period containing the anchor, or up to the anchor with
|
|
14
|
+
* `toDate`; a month `boundary` names its first or last day (months only);
|
|
15
|
+
* - `previous`: the period before;
|
|
16
|
+
* - `between` from/to: from the start of the `from` period to the end of the
|
|
17
|
+
* `to` period, counted from the anchor's.
|
|
18
|
+
* Weeks start on the calendar's week start; quarters and years follow its
|
|
19
|
+
* fiscal calendar when it has one.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveRelativeDate(relative: RelativeDateFilter, calendar: TemporalCalendar, anchor: Date): ResolvedRelativeDate;
|