react-semaphor 0.1.561 → 0.1.563
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/dist/analytics-protocol/index.js +452 -429
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +9 -9
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/{analytics-base-schemas-CB3oFAXk.js → analytics-base-schemas-BaIQrEzX.js} +139 -134
- package/dist/chunks/{assistant-chat-DiVHY3Hw.js → assistant-chat-iIp02_77.js} +104 -104
- package/dist/chunks/{bookmark-impact-CR09dpkn.js → bookmark-impact-D4Kl4amw.js} +2 -2
- package/dist/chunks/{bookmark-state-BusLpkb7.js → bookmark-state-CWeoGbrx.js} +25 -25
- package/dist/chunks/{braces-u8VorWJc.js → braces-DzgoQC64.js} +1 -1
- package/dist/chunks/{comparison-window-caption-DDsIWJYT.js → comparison-window-caption-D1EUXzaR.js} +562 -437
- package/dist/chunks/{context-TUjw9eqr.js → context-R31TSL5V.js} +1 -1
- package/dist/chunks/{dashboard-BRdZBPqr.js → dashboard-CmqeP3QZ.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CgvTLndW.js → dashboard-briefing-launcher-TYlSW77S.js} +155 -154
- package/dist/chunks/{dashboard-controls-B4vfSzTF.js → dashboard-controls-B253nJS-.js} +970 -968
- package/dist/chunks/{dashboard-json-Y3MF59g7.js → dashboard-json-osQuinUZ.js} +5 -5
- package/dist/chunks/dates-DFY7Gfss.js +91 -0
- package/dist/chunks/{edit-dashboard-visual-DwjZcxj-.js → edit-dashboard-visual-CMar-NhA.js} +4636 -4681
- package/dist/chunks/{filter-reach-copy-bijwf_-b.js → filter-reach-copy-CvV7W5dd.js} +1470 -1101
- package/dist/chunks/{filter-value-text-DFnhwuEW.js → filter-value-text-CPwFkrMz.js} +11 -10
- package/dist/chunks/{global-date-filter-utils-BXgCpvQM.js → global-date-filter-utils-N1kcsOFE.js} +8997 -7417
- package/dist/chunks/{index-ClwbY3BL.js → index-CNGkfUp4.js} +91 -85
- package/dist/chunks/{layout-grid-CtvCBfOm.js → layout-grid-BM65viQh.js} +1 -1
- package/dist/chunks/{list-filter-BklYgciR.js → list-filter-BoeLBfL3.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-pU51-JmY.js → matrix-analytical-definition-hEucouWM.js} +4 -4
- package/dist/chunks/{matrix-card-CUorIB7Q.js → matrix-card-CCh9JjP1.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-Df5UgCGN.js → matrix-member-presentation-DsAUbuoL.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-BSiGEXVC.js → matrix-operation-contract-DsLdFdSa.js} +339 -330
- package/dist/chunks/{metric-comparison-95aC0uEO.js → metric-comparison-Bnso1cm1.js} +2 -2
- package/dist/chunks/{model-change-B5wQhg5G.js → model-change-T1cRkh3m.js} +1 -1
- package/dist/chunks/{palette-DTnMhipt.js → palette-p1XSJFgB.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-Bo-86vwS.js → pivot-result-contract-expectations-B53jqszr.js} +5 -5
- package/dist/chunks/{pivot-result-identity-olvXJoB9.js → pivot-result-identity-Dq5jm-EC.js} +1 -1
- package/dist/chunks/{zoned-wall-clock-CGLVI40Q.js → raw-temporal-value-Bqz8wc7L.js} +97 -46
- package/dist/chunks/{report-preferences-dialog-C2YUIwKG.js → report-preferences-dialog-l54wJyYE.js} +68 -63
- package/dist/chunks/{report-runtime-context-DoIUr3MP.js → report-runtime-context-BITkNSDa.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-q_iiNXE1.js → resolve-dashboard-input-context-DaDrZGuA.js} +3455 -1744
- package/dist/chunks/{save-DH4RyrnG.js → save-CHV1B1fL.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-8jqfI7hI.js → saved-dashboard-context-DFYBrE6O.js} +94 -95
- package/dist/chunks/{selection-filter-compiler-BKXmyLrS.js → selection-filter-compiler-CUDRnUxc.js} +19 -18
- package/dist/chunks/{selection-reducer-CV7K4FI6.js → selection-reducer-Bz5aywT4.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-E2XWyibu.js → semaphor-ready-indicator-C3EQEiD9.js} +36434 -37732
- package/dist/chunks/{shelf-drop-preview-context-C29EUzDp.js → shelf-drop-preview-context-BODiBlqT.js} +81 -82
- package/dist/chunks/{source-entity-resolution-BXI3nQ5Z.js → source-entity-resolution-DdDVXFB8.js} +6 -6
- package/dist/chunks/{switch-balDSHc7.js → switch-BW4yXSYs.js} +3 -3
- package/dist/chunks/{table-export-sheet-CK8tvh4d.js → table-export-sheet-bSXxGn-v.js} +1 -1
- package/dist/chunks/{temporal-input-presentation-B77JsAzU.js → temporal-input-presentation-sk9gqLi6.js} +699 -741
- package/dist/chunks/{token-types-DhYH5YKb.js → token-types-BUK06hU2.js} +1 -1
- package/dist/chunks/{upload-Ufj8vjyn.js → upload-BnmuyPqW.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-9WsnzEO5.js → use-create-flow-overlay-state-BXY8-Cyz.js} +6 -6
- package/dist/chunks/{validators-BtaCFIEB.js → validators-BIM0FE31.js} +764 -885
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2278 -3030
- package/dist/data-app-sdk/index.js +43 -43
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +22 -22
- package/dist/format-utils/index.js +215 -209
- package/dist/index.js +225 -224
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/components/dashboard/dashboard-create-dialog.d.ts +23 -0
- package/dist/types/components/index.d.ts +1 -2
- package/dist/types/components/surfboard/filter/types.d.ts +3 -1
- package/dist/types/index.js +5 -5
- package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +59 -2
- package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +5 -0
- package/dist/types/lib/interactions/get-click-context-from-table.d.ts +45 -0
- package/dist/types/lib/print/print-inputs.d.ts +2 -1
- package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -0
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -0
- package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
- package/dist/types/lib/types/common-types.d.ts +6 -0
- package/dist/types/lib/types/explorer-types.d.ts +7 -1
- package/dist/types/lib/types/interaction-types.d.ts +3 -1
- package/dist/types/lib/types/token-types.d.ts +0 -1
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +3 -1
- package/dist/types/shared/analytics-protocol/contracts.d.ts +9 -40
- package/dist/types/shared/analytics-protocol/selection-contract.d.ts +12 -2
- package/dist/types/shared/analytics-protocol/validators.d.ts +1 -2
- package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
- package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +24 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/column-polarity-write.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +4 -2
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +12 -1
- package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -3
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +3230 -4658
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +24 -2
- package/dist/types/shared/dashboard-authoring/changes/field-ref.d.ts +91 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +27 -1
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-create.d.ts +26 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +2 -1
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/detail-date-presentation.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +8 -6
- package/dist/types/shared/dashboard-authoring/measure-calculations/apply.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +41 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +63 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +79 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +934 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/sentences.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/set.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/transform.d.ts +63 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/window-transforms.d.ts +60 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +12 -1
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +2 -1
- package/dist/types/shared/dashboard-authoring/operations/operation-sentences.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +52 -2
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +13 -1
- package/dist/types/shared/dashboard-authoring/text-card-words/blocks.d.ts +58 -0
- package/dist/types/shared/dashboard-authoring/text-card-words/index.d.ts +55 -0
- package/dist/types/shared/dashboard-authoring/text-card-words/rich-content.d.ts +18 -0
- package/dist/types/shared/format-utils/document-print.d.ts +82 -0
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +2 -7
- package/dist/types/shared/temporal/index.d.ts +1 -0
- package/dist/types/shared/temporal/raw-temporal-equality.d.ts +19 -0
- package/dist/types/shared/temporal/raw-temporal-value.d.ts +29 -0
- package/dist/types/shared/temporal/zoned-wall-clock.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunks/custom-visual-inputs-DfolidZ9.js +0 -292
- package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +0 -1718
- package/dist/types/components/dashboard/ai-dashboard-create-dialog.d.ts +0 -38
- package/dist/types/components/dashboard/dashboard-create-template.d.ts +0 -10
- package/dist/types/lib/hooks/use-dashboard-authoring.d.ts +0 -49
- package/dist/types/shared/dashboard-authoring/artifact-compiler.d.ts +0 -6
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -106
- package/dist/types/shared/dashboard-authoring/protocol-adapter.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/source-matching.d.ts +0 -34
- package/dist/types/shared/dashboard-authoring/validators.d.ts +0 -2
|
@@ -27,7 +27,23 @@ export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'co
|
|
|
27
27
|
/** No highlight rule on the card has that id. */
|
|
28
28
|
| 'highlight_not_found'
|
|
29
29
|
/** A width, range or title that can't be stored, or two labels for one column. */
|
|
30
|
-
| 'value_invalid'
|
|
30
|
+
| 'value_invalid'
|
|
31
|
+
/** A comparison on a card type that doesn't run that kind, or on a SQL card. */
|
|
32
|
+
| 'comparison_not_for_card'
|
|
33
|
+
/** A period or year comparison on a card with no date to compare over. */
|
|
34
|
+
| 'comparison_needs_date'
|
|
35
|
+
/** One measure with a comparison of its own and a table calculation at once. */
|
|
36
|
+
| 'comparison_with_transform'
|
|
37
|
+
/** A polarity that differs from the one the semantic model sets. */
|
|
38
|
+
| 'polarity_set_by_model'
|
|
39
|
+
/** A table calculation on a card, query or measure that can't take one. */
|
|
40
|
+
| 'transform_not_for_card'
|
|
41
|
+
/** A table calculation's order or reset fields that aren't groupings of the card, or a reset with a grand total. */
|
|
42
|
+
| 'transform_field_invalid'
|
|
43
|
+
/** Tabs that can't be made: fewer than two cards, cards on two sheets, a Document section's card, a custom visual's input (building a report SPEC §7). */
|
|
44
|
+
| 'layout_invalid'
|
|
45
|
+
/** Text words the subset can't hold, or a token that isn't one of the card's variables (building a report SPEC §2.4, S-9). */
|
|
46
|
+
| 'text_invalid';
|
|
31
47
|
export type ChangeWarningCode =
|
|
32
48
|
/** In-scope cards the filter doesn't reach. */
|
|
33
49
|
'filter_not_reaching_cards'
|
|
@@ -52,7 +68,13 @@ export type ChangeWarningCode =
|
|
|
52
68
|
*/
|
|
53
69
|
| 'document_not_checked'
|
|
54
70
|
/** A change removes something viewers' bookmarks or remembered table settings use (card appearance CA-D17). */
|
|
55
|
-
| 'viewer_settings_affected'
|
|
71
|
+
| 'viewer_settings_affected'
|
|
72
|
+
/** A period or year comparison where no date window applies to its date: it shows only while one does. */
|
|
73
|
+
| 'comparison_without_date_window'
|
|
74
|
+
/** A table calculation ordered along a grouping that isn't a date. */
|
|
75
|
+
| 'transform_order_not_date'
|
|
76
|
+
/** A text card in a KPI's spot shows as the KPI's info, as in the editor, not as a tab (building a report SPEC §5.1). */
|
|
77
|
+
| 'tabs_show_as_kpi_info';
|
|
56
78
|
export type ChangeDiagnostic = {
|
|
57
79
|
code: ChangeProblemCode | ChangeWarningCode;
|
|
58
80
|
/** One sentence, safe to show an end user. */
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A field reference in the public change vocabulary (MCP dashboard editing
|
|
4
|
+
* SPEC 3.1): the one schema queries, filters and table calculations name a
|
|
5
|
+
* field with. Its own module so `dashboard-change.ts` and the measure
|
|
6
|
+
* calculations owner both import it without importing each other.
|
|
7
|
+
*/
|
|
8
|
+
/** A non-empty, trimmed name. */
|
|
9
|
+
export declare const nameSchema: z.ZodString;
|
|
10
|
+
/** The fields of a field reference's object form. */
|
|
11
|
+
export declare const fieldRefObject: {
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
/** A label for the column; a stated label wins over the one the card had. */
|
|
14
|
+
label: z.ZodOptional<z.ZodString>;
|
|
15
|
+
datasetName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
datasetId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
kind: z.ZodLiteral<"semantic">;
|
|
20
|
+
domainId: z.ZodString;
|
|
21
|
+
datasetName: z.ZodString;
|
|
22
|
+
datasetId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
kind: "semantic";
|
|
26
|
+
domainId: string;
|
|
27
|
+
datasetName: string;
|
|
28
|
+
datasetId?: string | undefined;
|
|
29
|
+
connectionId?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
kind: "semantic";
|
|
32
|
+
domainId: string;
|
|
33
|
+
datasetName: string;
|
|
34
|
+
datasetId?: string | undefined;
|
|
35
|
+
connectionId?: string | undefined;
|
|
36
|
+
}>>;
|
|
37
|
+
};
|
|
38
|
+
/** A field name, or `{ name, datasetName }` for a field of a joined dataset. */
|
|
39
|
+
export declare const fieldRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
/** A label for the column; a stated label wins over the one the card had. */
|
|
42
|
+
label: z.ZodOptional<z.ZodString>;
|
|
43
|
+
datasetName: z.ZodOptional<z.ZodString>;
|
|
44
|
+
datasetId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
kind: z.ZodLiteral<"semantic">;
|
|
48
|
+
domainId: z.ZodString;
|
|
49
|
+
datasetName: z.ZodString;
|
|
50
|
+
datasetId: z.ZodOptional<z.ZodString>;
|
|
51
|
+
connectionId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strict", z.ZodTypeAny, {
|
|
53
|
+
kind: "semantic";
|
|
54
|
+
domainId: string;
|
|
55
|
+
datasetName: string;
|
|
56
|
+
datasetId?: string | undefined;
|
|
57
|
+
connectionId?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
kind: "semantic";
|
|
60
|
+
domainId: string;
|
|
61
|
+
datasetName: string;
|
|
62
|
+
datasetId?: string | undefined;
|
|
63
|
+
connectionId?: string | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
}, "strict", z.ZodTypeAny, {
|
|
66
|
+
name: string;
|
|
67
|
+
datasetName?: string | undefined;
|
|
68
|
+
datasetId?: string | undefined;
|
|
69
|
+
label?: string | undefined;
|
|
70
|
+
connectionId?: string | undefined;
|
|
71
|
+
source?: {
|
|
72
|
+
kind: "semantic";
|
|
73
|
+
domainId: string;
|
|
74
|
+
datasetName: string;
|
|
75
|
+
datasetId?: string | undefined;
|
|
76
|
+
connectionId?: string | undefined;
|
|
77
|
+
} | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
name: string;
|
|
80
|
+
datasetName?: string | undefined;
|
|
81
|
+
datasetId?: string | undefined;
|
|
82
|
+
label?: string | undefined;
|
|
83
|
+
connectionId?: string | undefined;
|
|
84
|
+
source?: {
|
|
85
|
+
kind: "semantic";
|
|
86
|
+
domainId: string;
|
|
87
|
+
datasetName: string;
|
|
88
|
+
datasetId?: string | undefined;
|
|
89
|
+
connectionId?: string | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
}>]>;
|
|
@@ -41,8 +41,15 @@ export type CardQueryRead = {
|
|
|
41
41
|
detail?: string;
|
|
42
42
|
source?: OutlineCardSource;
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* `calculations: false` reads the query without its measures' calculations:
|
|
46
|
+
* the change resolver's check that a requery holds what was asked, before the
|
|
47
|
+
* calculations step checks a kept table calculation (reports by conversation
|
|
48
|
+
* S-13).
|
|
49
|
+
*/
|
|
44
50
|
export declare function readCardQuery(card: TCard, viewer: {
|
|
45
51
|
sql: boolean;
|
|
52
|
+
calculations?: boolean;
|
|
46
53
|
}): CardQueryRead;
|
|
47
54
|
/**
|
|
48
55
|
* Where a card's data comes from, as the outline names it. SQL owns the result
|
|
@@ -8,6 +8,7 @@ import { CardQueryPart } from './card-query-part.js';
|
|
|
8
8
|
import { FieldRef, MetricCardQuery, RecordsCardQuery } from './dashboard-change.js';
|
|
9
9
|
import { ChangeDiagnostic } from './diagnostics.js';
|
|
10
10
|
import { ModelFormats } from '../../format-utils/resolve-column-format.js';
|
|
11
|
+
import { ComparisonDates } from '../measure-calculations/dates.js';
|
|
11
12
|
/**
|
|
12
13
|
* Public dashboard changes to resolved operations (MCP dashboard editing SPEC
|
|
13
14
|
* 3.7, DE-D48). Every rule the schema can't state lives here; everything that
|
|
@@ -86,10 +87,21 @@ export type ChangeServices = {
|
|
|
86
87
|
readModelFormats?(input: {
|
|
87
88
|
card: TCard;
|
|
88
89
|
}): Promise<ModelFormats | null>;
|
|
90
|
+
/**
|
|
91
|
+
* The facts a period or year comparison needs, as a fresh viewer gets them
|
|
92
|
+
* (reports by conversation SPEC S-9, `readDefaultComparisonDates`): the date
|
|
93
|
+
* it compares over and whether a date window applies. Called only when a
|
|
94
|
+
* change states a period or year comparison; without it, the card's grained
|
|
95
|
+
* date is the comparison date and the window is unknown.
|
|
96
|
+
*/
|
|
97
|
+
readComparisonDates?(input: {
|
|
98
|
+
card: TCard;
|
|
99
|
+
dashboard: TDashboard;
|
|
100
|
+
}): Promise<ComparisonDates>;
|
|
89
101
|
};
|
|
90
102
|
export type ChangeRef = {
|
|
91
103
|
ref: string;
|
|
92
|
-
kind: 'card' | 'filter';
|
|
104
|
+
kind: 'card' | 'filter' | 'sheet';
|
|
93
105
|
id: string;
|
|
94
106
|
title: string;
|
|
95
107
|
changeIndex: number;
|
|
@@ -117,4 +129,18 @@ export type ChangeResolution = {
|
|
|
117
129
|
ok: false;
|
|
118
130
|
problems: ChangeDiagnostic[];
|
|
119
131
|
};
|
|
132
|
+
/** How many changes a target takes, and what to do with more (building a report S-12). */
|
|
133
|
+
export type ChangeLimit = {
|
|
134
|
+
max: number;
|
|
135
|
+
what: string;
|
|
136
|
+
fix: string;
|
|
137
|
+
};
|
|
120
138
|
export declare function resolveDashboardChanges(dashboard: TDashboard, changes: readonly unknown[], services: ChangeServices): Promise<ChangeResolution>;
|
|
139
|
+
/**
|
|
140
|
+
* The one resolver an edit and a create run (building a report S-1): the
|
|
141
|
+
* target decides only the dashboard it starts from and the limit. Not in
|
|
142
|
+
* the package's entry; `resolveDashboardCreate` is its other caller.
|
|
143
|
+
*/
|
|
144
|
+
export declare function resolveChanges(dashboard: TDashboard, changes: readonly unknown[], services: ChangeServices, options: {
|
|
145
|
+
limit: ChangeLimit;
|
|
146
|
+
}): Promise<ChangeResolution>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TDashboard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { CreateTarget } from './dashboard-change.js';
|
|
3
|
+
import { ChangeDiagnostic } from './diagnostics.js';
|
|
4
|
+
import { ChangeResolution, ChangeServices } from './resolve-dashboard-changes.js';
|
|
5
|
+
/**
|
|
6
|
+
* A proposal that creates a dashboard (building a report BR-D2, BR-D4, SPEC
|
|
7
|
+
* §5.2): its changes resolve against a seed with no cards, through the
|
|
8
|
+
* resolver an edit runs (S-1). Apply replays the operations onto the stored
|
|
9
|
+
* seed, so the dashboard saved is the one previewed.
|
|
10
|
+
*/
|
|
11
|
+
export type CreateResolution = (Extract<ChangeResolution, {
|
|
12
|
+
ok: true;
|
|
13
|
+
}> & {
|
|
14
|
+
/** What the operations replay onto at apply (S-4). */
|
|
15
|
+
seed: TDashboard;
|
|
16
|
+
/** "Creates a private dashboard "…" with 2 sheets, 6 cards and 1 filter." */
|
|
17
|
+
sentence: string;
|
|
18
|
+
}) | {
|
|
19
|
+
ok: false;
|
|
20
|
+
problems: ChangeDiagnostic[];
|
|
21
|
+
};
|
|
22
|
+
export declare function resolveDashboardCreate(request: {
|
|
23
|
+
dashboardId: string;
|
|
24
|
+
create: CreateTarget;
|
|
25
|
+
changes: readonly unknown[];
|
|
26
|
+
}, services: ChangeServices): Promise<CreateResolution>;
|
|
@@ -67,7 +67,8 @@ export declare function defaultClickToFilterSettings(card: Pick<TCard, 'type'>,
|
|
|
67
67
|
* Grounds an explorer field on one of the card's own executable sources.
|
|
68
68
|
* A field that carries catalog identity must match an executable source. A
|
|
69
69
|
* field without it is grounded by its entity, or by the card's single source.
|
|
70
|
-
* Calculated fields and unknown data types cannot be grounded.
|
|
70
|
+
* Calculated fields and unknown data types cannot be grounded. The field's
|
|
71
|
+
* database type travels with it (ledger P7-06).
|
|
71
72
|
*/
|
|
72
73
|
export declare function selectionFieldFromExplorerField(field: Field, sourceIndex: DashboardCardFilterSourceInventory): SelectionField | undefined;
|
|
73
74
|
/** The source-index members ground a legacy attribute trigger to a stable field key. */
|
|
@@ -1443,10 +1443,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
|
|
|
1443
1443
|
color: string;
|
|
1444
1444
|
showValue: boolean;
|
|
1445
1445
|
} | undefined;
|
|
1446
|
+
italic?: boolean | undefined;
|
|
1446
1447
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
1447
1448
|
backgroundColor?: string | undefined;
|
|
1448
1449
|
textColor?: string | undefined;
|
|
1449
|
-
italic?: boolean | undefined;
|
|
1450
1450
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
1451
1451
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
1452
1452
|
}, {
|
|
@@ -1454,10 +1454,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
|
|
|
1454
1454
|
color: string;
|
|
1455
1455
|
showValue: boolean;
|
|
1456
1456
|
} | undefined;
|
|
1457
|
+
italic?: boolean | undefined;
|
|
1457
1458
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
1458
1459
|
backgroundColor?: string | undefined;
|
|
1459
1460
|
textColor?: string | undefined;
|
|
1460
|
-
italic?: boolean | undefined;
|
|
1461
1461
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
1462
1462
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
1463
1463
|
}>>;
|
|
@@ -1723,10 +1723,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
|
|
|
1723
1723
|
color: string;
|
|
1724
1724
|
showValue: boolean;
|
|
1725
1725
|
} | undefined;
|
|
1726
|
+
italic?: boolean | undefined;
|
|
1726
1727
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
1727
1728
|
backgroundColor?: string | undefined;
|
|
1728
1729
|
textColor?: string | undefined;
|
|
1729
|
-
italic?: boolean | undefined;
|
|
1730
1730
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
1731
1731
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
1732
1732
|
} | undefined;
|
|
@@ -1993,10 +1993,10 @@ export declare const conditionalRuleSchema: z.ZodObject<{
|
|
|
1993
1993
|
color: string;
|
|
1994
1994
|
showValue: boolean;
|
|
1995
1995
|
} | undefined;
|
|
1996
|
+
italic?: boolean | undefined;
|
|
1996
1997
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
1997
1998
|
backgroundColor?: string | undefined;
|
|
1998
1999
|
textColor?: string | undefined;
|
|
1999
|
-
italic?: boolean | undefined;
|
|
2000
2000
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
2001
2001
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
2002
2002
|
} | undefined;
|
|
@@ -3377,10 +3377,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
|
|
|
3377
3377
|
color: string;
|
|
3378
3378
|
showValue: boolean;
|
|
3379
3379
|
} | undefined;
|
|
3380
|
+
italic?: boolean | undefined;
|
|
3380
3381
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
3381
3382
|
backgroundColor?: string | undefined;
|
|
3382
3383
|
textColor?: string | undefined;
|
|
3383
|
-
italic?: boolean | undefined;
|
|
3384
3384
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
3385
3385
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
3386
3386
|
}, {
|
|
@@ -3388,10 +3388,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
|
|
|
3388
3388
|
color: string;
|
|
3389
3389
|
showValue: boolean;
|
|
3390
3390
|
} | undefined;
|
|
3391
|
+
italic?: boolean | undefined;
|
|
3391
3392
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
3392
3393
|
backgroundColor?: string | undefined;
|
|
3393
3394
|
textColor?: string | undefined;
|
|
3394
|
-
italic?: boolean | undefined;
|
|
3395
3395
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
3396
3396
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
3397
3397
|
}>>;
|
|
@@ -3657,10 +3657,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
|
|
|
3657
3657
|
color: string;
|
|
3658
3658
|
showValue: boolean;
|
|
3659
3659
|
} | undefined;
|
|
3660
|
+
italic?: boolean | undefined;
|
|
3660
3661
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
3661
3662
|
backgroundColor?: string | undefined;
|
|
3662
3663
|
textColor?: string | undefined;
|
|
3663
|
-
italic?: boolean | undefined;
|
|
3664
3664
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
3665
3665
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
3666
3666
|
} | undefined;
|
|
@@ -3927,10 +3927,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
|
|
|
3927
3927
|
color: string;
|
|
3928
3928
|
showValue: boolean;
|
|
3929
3929
|
} | undefined;
|
|
3930
|
+
italic?: boolean | undefined;
|
|
3930
3931
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
3931
3932
|
backgroundColor?: string | undefined;
|
|
3932
3933
|
textColor?: string | undefined;
|
|
3933
|
-
italic?: boolean | undefined;
|
|
3934
3934
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
3935
3935
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
3936
3936
|
} | undefined;
|
|
@@ -4200,10 +4200,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
|
|
|
4200
4200
|
color: string;
|
|
4201
4201
|
showValue: boolean;
|
|
4202
4202
|
} | undefined;
|
|
4203
|
+
italic?: boolean | undefined;
|
|
4203
4204
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
4204
4205
|
backgroundColor?: string | undefined;
|
|
4205
4206
|
textColor?: string | undefined;
|
|
4206
|
-
italic?: boolean | undefined;
|
|
4207
4207
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
4208
4208
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
4209
4209
|
} | undefined;
|
|
@@ -4473,10 +4473,10 @@ export declare const cardConditionalFormattingSchema: z.ZodObject<{
|
|
|
4473
4473
|
color: string;
|
|
4474
4474
|
showValue: boolean;
|
|
4475
4475
|
} | undefined;
|
|
4476
|
+
italic?: boolean | undefined;
|
|
4476
4477
|
fontWeight?: "bold" | "medium" | "normal" | "semibold" | undefined;
|
|
4477
4478
|
backgroundColor?: string | undefined;
|
|
4478
4479
|
textColor?: string | undefined;
|
|
4479
|
-
italic?: boolean | undefined;
|
|
4480
4480
|
textDecoration?: "none" | "underline" | "line-through" | undefined;
|
|
4481
4481
|
icon?: "warning" | "arrowUp" | "arrowDown" | "check" | "x" | undefined;
|
|
4482
4482
|
} | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a config detail table draws a date column's stored format, for
|
|
3
|
+
* every kind of value the column may come back as (column formats CF-D4,
|
|
4
|
+
* ledger P7-07). A detail date on PostgreSQL, Snowflake or ClickHouse always
|
|
5
|
+
* comes back raw and the browser draws it: the table and its exports draw a
|
|
6
|
+
* format this refuses as Automatic, and the backfill rewrites the patterns
|
|
7
|
+
* only SQL drew so they don't. Pure.
|
|
8
|
+
*/
|
|
9
|
+
export { checkDetailDateFormat } from '../../lib/formatters/raw-temporal-presentation.js';
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
export * from './contracts.js';
|
|
2
1
|
export * from './comparison-document-migration.js';
|
|
3
|
-
export * from './source-matching.js';
|
|
4
|
-
export * from './validators.js';
|
|
5
|
-
export * from './artifact-compiler.js';
|
|
6
|
-
export * from './protocol-adapter.js';
|
|
7
2
|
export * from './temporal-result-owner.js';
|
|
3
|
+
export * from './detail-date-presentation.js';
|
|
8
4
|
export * from './temporal-bucket-authoring.js';
|
|
9
5
|
export * from './canonical-result-keys.js';
|
|
10
6
|
export * from './dashboard-card-source-index.js';
|
|
@@ -43,7 +39,9 @@ export * from './changes/diagnostics.js';
|
|
|
43
39
|
export * from './changes/card-query-part.js';
|
|
44
40
|
export * from './changes/read-card-query.js';
|
|
45
41
|
export * from './changes/dashboard-change.js';
|
|
46
|
-
export
|
|
42
|
+
export { resolveDashboardChanges, type CardSource, type ChangeServices, type ChangeRef, type ChangeResolution, } from './changes/resolve-dashboard-changes.js';
|
|
43
|
+
export * from './changes/resolve-dashboard-create.js';
|
|
44
|
+
export * from './text-card-words/index.js';
|
|
47
45
|
export * from './outline/outline-filters.js';
|
|
48
46
|
export * from './outline/outline-dashboard.js';
|
|
49
47
|
export * from './column-catalog.js';
|
|
@@ -54,6 +52,7 @@ export * from './retired-presentation-fields.js';
|
|
|
54
52
|
export * from './conditional-formatting/index.js';
|
|
55
53
|
export * from './kpi-figure.js';
|
|
56
54
|
export * from './card-settings/index.js';
|
|
55
|
+
export * from './measure-calculations/index.js';
|
|
57
56
|
export { bookmarkImpactSentence, describeBookmarkImpact, type BookmarkImpactItem, } from '../dashboard-viewer/bookmark-impact.js';
|
|
58
57
|
export { prepareLoadedDashboard } from '../../lib/dashboard-inputs/prepare-loaded-dashboard.js';
|
|
59
58
|
export { buildFilterInputFromField, buildFilterInputFromDefinition, applyFilterSettingsChange } from '../../lib/dashboard-inputs/filter-settings.js';
|
|
@@ -64,6 +63,9 @@ export { changeCardType, sharedCardPreferences, type CardTypeChange, type CardTy
|
|
|
64
63
|
export { buildSavedEditorCard } from '../../lib/utils/build-saved-editor-card.js';
|
|
65
64
|
export { getCardDefinition, type AuthoredCardFields } from '../../lib/utils/card-definition.js';
|
|
66
65
|
export { changeMatrixEditor, dropMatrixEditorField, matrixEditorCatalogFromFields, } from '../../lib/matrix-table/matrix-editor.js';
|
|
66
|
+
export { resolveDetailTableRawTemporalPresentation } from '../../lib/formatters/raw-temporal-presentation.js';
|
|
67
|
+
export { getClickContextFromTable } from '../../lib/interactions/get-click-context-from-table.js';
|
|
68
|
+
export { selectionTupleFromClickContext } from '../../lib/selection/selection-from-click-context.js';
|
|
67
69
|
export * from './filter-applicability.js';
|
|
68
70
|
export * from './semantic-auto-join-card.js';
|
|
69
71
|
export * from './filter-reach-preview.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { DroppedSetting } from '../card-settings/apply-card-settings.js';
|
|
3
|
+
import { MeasureCalculationsUpdate } from './resolve.js';
|
|
4
|
+
export type AppliedMeasureCalculations = {
|
|
5
|
+
card: TCard;
|
|
6
|
+
dropped: DroppedSetting[];
|
|
7
|
+
};
|
|
8
|
+
export declare function applyMeasureCalculations(card: TCard, update: MeasureCalculationsUpdate): AppliedMeasureCalculations;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MetricComparisonConfig } from '../../analytics-protocol/metric-comparison.js';
|
|
2
|
+
import { ExplicitComparison, MeasureComparison } from './schemas.js';
|
|
3
|
+
/**
|
|
4
|
+
* A measure's comparison between its public words and its stored field
|
|
5
|
+
* (reports by conversation SPEC §3.2, S-6, S-7): the one mapping. Stored
|
|
6
|
+
* minimal, as the editor stores it: `inherit` is no field, and an offset of
|
|
7
|
+
* 1, `calendar` and a false `toDate` are absent.
|
|
8
|
+
*/
|
|
9
|
+
/** The stored comparison for public words; undefined for `inherit` (no field). */
|
|
10
|
+
export declare function toStoredComparison(comparison: MeasureComparison): MetricComparisonConfig | undefined;
|
|
11
|
+
/** The public words for a stored comparison, defaults left out; undefined when it has none of its own (`inherit`). */
|
|
12
|
+
export declare function readStoredComparison(stored: MetricComparisonConfig | undefined): MeasureComparison | undefined;
|
|
13
|
+
/** Whether a stated comparison means what the measure stores (equal by resolution, S-7). */
|
|
14
|
+
export declare function sameComparison(stated: MeasureComparison, stored: MetricComparisonConfig | undefined): boolean;
|
|
15
|
+
/** A comparison of the measure's own: a period, a year or a target (not `inherit` or `off`). */
|
|
16
|
+
export declare const isExplicitComparison: (comparison: MeasureComparison | undefined) => comparison is ExplicitComparison;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TCard, TDashboard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { SemanticExecutionPayload } from '../../../lib/types/semantic-runtime-types.js';
|
|
3
|
+
import { CompiledDashboardCardFilters } from '../../../lib/query-context/compile-dashboard-card-filters.js';
|
|
4
|
+
import { ResolvedPrimaryDateField } from '../../analytics-protocol/contracts.js';
|
|
5
|
+
import { CalendarContext } from '../../report-runtime-context/index.js';
|
|
6
|
+
export type ComparisonDates = {
|
|
7
|
+
/** The date a period or year comparison compares over: the card's grained date grouping, else the dataset's primary date; null when there is none. `label` is how the card shows it. */
|
|
8
|
+
comparisonDate: {
|
|
9
|
+
name: string;
|
|
10
|
+
label: string;
|
|
11
|
+
} | null;
|
|
12
|
+
/** Whether a date window applies to that date: the card's own window on it, or a dashboard date filter that reaches the card. */
|
|
13
|
+
dateWindow: 'applies' | 'none' | 'unknown';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* What `readComparisonDates` reads of a compiled card query: the editor's
|
|
17
|
+
* `compileCardQuery` result, or a snapshot's. A blocked compile still names
|
|
18
|
+
* the primary date where it resolved one.
|
|
19
|
+
*/
|
|
20
|
+
export type ComparisonCompilation = {
|
|
21
|
+
status: 'ready';
|
|
22
|
+
compiledFilters: CompiledDashboardCardFilters;
|
|
23
|
+
resolvedPrimaryDateField: ResolvedPrimaryDateField;
|
|
24
|
+
} | {
|
|
25
|
+
status: 'blocked';
|
|
26
|
+
resolvedPrimaryDateField?: ResolvedPrimaryDateField;
|
|
27
|
+
};
|
|
28
|
+
/** The two facts for a card, from its compiled query. */
|
|
29
|
+
export declare function readComparisonDates(card: TCard, compiled: ComparisonCompilation): ComparisonDates;
|
|
30
|
+
/**
|
|
31
|
+
* The same facts as a fresh viewer gets them (SPEC S-9): the dashboard's
|
|
32
|
+
* default filter values, compiled with this calendar, through the assembly a
|
|
33
|
+
* saved card's replay uses (`buildLocatedCardSnapshot`). The server's change
|
|
34
|
+
* resolver calls it; it has no viewer.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readDefaultComparisonDates(input: {
|
|
37
|
+
dashboard: TDashboard;
|
|
38
|
+
cardId: string;
|
|
39
|
+
semanticExecutionPayload: SemanticExecutionPayload | undefined;
|
|
40
|
+
calendar: CalendarContext;
|
|
41
|
+
}): ComparisonDates;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one owner of what a measure computes beyond its aggregate (reports by
|
|
3
|
+
* conversation RC-D11, SPEC §1): its comparison and its table calculation.
|
|
4
|
+
* The outline, the change resolver, the reducer, the editor and
|
|
5
|
+
* semaphor_analyze read and write them through these exports only.
|
|
6
|
+
*/
|
|
7
|
+
export { explicitComparisonSchema, measureComparisonSchema, measureTransformSchema, transformOrderSchema, MEASURE_CALCULATION_SUMMARIES, type AnalyzeMeasureCalculations, type ExplicitComparison, type MeasureCalculations, type MeasureComparison, type MeasureTransform, type TransformOrder, } from './schemas.js';
|
|
8
|
+
export { toStoredComparison } from './comparison.js';
|
|
9
|
+
export { readMeasureCalculations, type MeasureCalculationsRead } from './read.js';
|
|
10
|
+
export { readComparisonDates, readDefaultComparisonDates, type ComparisonCompilation, type ComparisonDates } from './dates.js';
|
|
11
|
+
export { measureCalculationOptions, transformGroupings, PUBLIC_TRANSFORM_KIND, type CalculationOffer, type CalculationRefusalCode, type MeasureCalculationOptions, type TransformGrouping, } from './options.js';
|
|
12
|
+
export { resolveMeasureCalculations, type MeasureCalculationContext, type MeasureCalculationsResolution, type MeasureCalculationsUpdate, type ResolvedMeasureCalculations, type StatedMeasureCalculations, } from './resolve.js';
|
|
13
|
+
export { applyMeasureCalculations, type AppliedMeasureCalculations } from './apply.js';
|
|
14
|
+
export { describeMeasureCalculations } from './sentences.js';
|
|
15
|
+
export { setMeasureCalculations } from './set.js';
|
|
16
|
+
export { readStoredTransform, readTransform, resolveMeasureTransform, type KeyedWindowTransform, type StoredTransformRead } from './transform.js';
|
|
17
|
+
export { validateAndResolveWindowTransforms, WINDOW_ERROR_CODES, WINDOW_WARNING_CODES, type ResolvedMetricWindowTransform, type WindowErrorCode, type WindowValidationError, type WindowValidationResult, type WindowWarningCode, } from './window-transforms.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { MetricField } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
import { ColumnKey } from '../changes/card-query-part.js';
|
|
4
|
+
import { ComparisonDates } from './dates.js';
|
|
5
|
+
import { MeasureComparison, MeasureTransform } from './schemas.js';
|
|
6
|
+
export type CalculationRefusalCode = 'comparison_not_for_card' | 'comparison_needs_date' | 'transform_not_for_card';
|
|
7
|
+
export type CalculationOffer = {
|
|
8
|
+
offered: true; /** Choosing it replaces the measure's other calculation (RC-D6). */
|
|
9
|
+
replaces?: 'comparison' | 'transform';
|
|
10
|
+
} | {
|
|
11
|
+
offered: false;
|
|
12
|
+
code: CalculationRefusalCode;
|
|
13
|
+
reason: string;
|
|
14
|
+
};
|
|
15
|
+
export type TransformGrouping = {
|
|
16
|
+
key: ColumnKey;
|
|
17
|
+
label: string;
|
|
18
|
+
isDate: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type MeasureCalculationOptions = {
|
|
21
|
+
comparison: Record<MeasureComparison['kind'], CalculationOffer>;
|
|
22
|
+
transform: {
|
|
23
|
+
kinds: Record<MeasureTransform['kind'], CalculationOffer>;
|
|
24
|
+
/** The groupings a transform may run along or reset by, in card order. */
|
|
25
|
+
groupings: TransformGrouping[];
|
|
26
|
+
/** The grouping a transform runs along when none is stated: the first date grouping; null when the card has none. */
|
|
27
|
+
defaultOrder: ColumnKey | null;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/** The stored function a public transform kind writes. */
|
|
31
|
+
export declare const STORED_TRANSFORM_FUNCTION: {
|
|
32
|
+
readonly running_total: "running_total";
|
|
33
|
+
readonly moving_average: "moving_average";
|
|
34
|
+
readonly difference_from_previous: "previous_period_delta";
|
|
35
|
+
readonly percent_of_total: "percent_of_total";
|
|
36
|
+
};
|
|
37
|
+
/** The public kind of a stored transform function. */
|
|
38
|
+
export declare const PUBLIC_TRANSFORM_KIND: {
|
|
39
|
+
readonly running_total: "running_total";
|
|
40
|
+
readonly moving_average: "moving_average";
|
|
41
|
+
readonly previous_period_delta: "difference_from_previous";
|
|
42
|
+
readonly percent_of_total: "percent_of_total";
|
|
43
|
+
};
|
|
44
|
+
/** The card types that take a comparison or a target, among the eight the tool sets, for `allowed`. */
|
|
45
|
+
export declare function comparisonCardTypes(kind: 'comparison' | 'target'): string[];
|
|
46
|
+
/** The card types that take a table calculation, among the eight (the server refuses KPIs and detail tables; Matrix has no shelf measures). */
|
|
47
|
+
export declare const TRANSFORM_CARD_TYPES: readonly ["bar", "line", "area", "pie", "table"];
|
|
48
|
+
/** Why a card written in SQL or Python takes neither calculation, as a clause: its query computes its own columns. */
|
|
49
|
+
export declare function writtenInCode(card: TCard): {
|
|
50
|
+
comparison: string;
|
|
51
|
+
transform: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
/** A card's metric column by its key, and its index. */
|
|
54
|
+
export declare function findMeasure(card: TCard, measure: ColumnKey): {
|
|
55
|
+
metric: MetricField;
|
|
56
|
+
index: number;
|
|
57
|
+
} | undefined;
|
|
58
|
+
/** The groupings a transform names, in card order, with the first date grouping as the default order. */
|
|
59
|
+
export declare function transformGroupings(card: TCard): {
|
|
60
|
+
groupings: TransformGrouping[];
|
|
61
|
+
defaultOrder: ColumnKey | null;
|
|
62
|
+
};
|
|
63
|
+
export declare function measureCalculationOptions(card: TCard, measure: ColumnKey, dates: ComparisonDates): MeasureCalculationOptions;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { GroupByField } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
import { FieldRef } from '../changes/dashboard-change.js';
|
|
4
|
+
import { MeasureCalculations } from './schemas.js';
|
|
5
|
+
export type MeasureCalculationsRead =
|
|
6
|
+
/** Aligned with `config.metricColumns`; `{}` for a measure with none. */
|
|
7
|
+
{
|
|
8
|
+
ok: true;
|
|
9
|
+
measures: MeasureCalculations[];
|
|
10
|
+
}
|
|
11
|
+
/** A stored table calculation the server's check can't resolve: the card stays not editable, saying why. */
|
|
12
|
+
| {
|
|
13
|
+
ok: false;
|
|
14
|
+
detail: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function readMeasureCalculations(card: TCard, groupingRef: (grouping: GroupByField) => FieldRef): MeasureCalculationsRead;
|