react-semaphor 0.1.560 → 0.1.562
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 +450 -423
- 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-CHLxsPfX.js → analytics-base-schemas-BaIQrEzX.js} +221 -188
- package/dist/chunks/{assistant-chat-Bu2fFm_I.js → assistant-chat-R_yT8xH4.js} +116 -117
- package/dist/chunks/bookmark-impact-D4Kl4amw.js +75 -0
- package/dist/chunks/bookmark-state-CWeoGbrx.js +743 -0
- package/dist/chunks/{braces-Da41xfUd.js → braces-DzgoQC64.js} +1 -1
- package/dist/chunks/{comparison-window-caption-4FNkMrzE.js → comparison-window-caption-D1EUXzaR.js} +550 -425
- package/dist/chunks/{context-BgPDzLHZ.js → context-R31TSL5V.js} +1 -1
- package/dist/chunks/{dashboard-_MeBuy67.js → dashboard-Bp1y5oun.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CEi4Pr_v.js → dashboard-briefing-launcher-S5FB3aUW.js} +236 -236
- package/dist/chunks/dashboard-controls-CfC_6Ztn.js +2277 -0
- package/dist/chunks/{dashboard-json-B1mU_OMa.js → dashboard-json-gYZT7ZQY.js} +5 -5
- package/dist/chunks/dates-DFY7Gfss.js +91 -0
- package/dist/chunks/{edit-dashboard-visual-0CJN31Y3.js → edit-dashboard-visual-u7OI_g8Q.js} +7119 -7198
- package/dist/chunks/filter-reach-copy-CvV7W5dd.js +3965 -0
- package/dist/chunks/{filter-value-text-CRC-K_l_.js → filter-value-text-CPwFkrMz.js} +11 -10
- package/dist/chunks/global-date-filter-utils-N1kcsOFE.js +16722 -0
- package/dist/chunks/{index-DtHidOPV.js → index-CNGkfUp4.js} +269 -264
- package/dist/chunks/{layout-grid-BvsH4RY2.js → layout-grid-BM65viQh.js} +1 -1
- package/dist/chunks/{list-filter-Dg0otx5E.js → list-filter-BoeLBfL3.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-CM18W8w6.js → matrix-analytical-definition-hEucouWM.js} +4 -4
- package/dist/chunks/{matrix-card-HPskLaPy.js → matrix-card-CCh9JjP1.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-Bbrfrke4.js → matrix-member-presentation-DsAUbuoL.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-WPv4R-H_.js → matrix-operation-contract-DsLdFdSa.js} +365 -349
- package/dist/chunks/{metric-comparison-ljMKYZKa.js → metric-comparison-Bnso1cm1.js} +6 -6
- package/dist/chunks/{model-change-Ccn1zaxl.js → model-change-T1cRkh3m.js} +1 -1
- package/dist/chunks/{palette-Bsh376zO.js → palette-p1XSJFgB.js} +1 -1
- package/dist/chunks/pivot-result-contract-expectations-B53jqszr.js +56 -0
- package/dist/chunks/{pivot-result-identity-vS9TSh4f.js → pivot-result-identity-Dq5jm-EC.js} +1 -1
- package/dist/chunks/{zoned-wall-clock-B1n_WjW3.js → raw-temporal-value-Bqz8wc7L.js} +97 -46
- package/dist/chunks/{report-preferences-dialog-BV8L0SeS.js → report-preferences-dialog-C4RAR8u5.js} +68 -63
- package/dist/chunks/{report-runtime-context-BZQh9ywy.js → report-runtime-context-BITkNSDa.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-DaDrZGuA.js +8214 -0
- package/dist/chunks/{save-B5EAsgQF.js → save-CHV1B1fL.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-n2Wn11cV.js → saved-dashboard-context-DFYBrE6O.js} +93 -94
- package/dist/chunks/{selection-filter-compiler-BKXmyLrS.js → selection-filter-compiler-CUDRnUxc.js} +19 -18
- package/dist/chunks/{selection-reducer-D0YnaAD9.js → selection-reducer-Bz5aywT4.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-XLBLOJ2V.js → semaphor-ready-indicator-Cfuafnem.js} +38188 -40344
- package/dist/chunks/{shelf-drop-preview-context-DHMa54a-.js → shelf-drop-preview-context-BR2GEYog.js} +81 -82
- package/dist/chunks/{source-entity-resolution-dUG5VWRm.js → source-entity-resolution-DdDVXFB8.js} +6 -6
- package/dist/chunks/{switch-ByxH4M7t.js → switch-BW4yXSYs.js} +3 -3
- package/dist/chunks/{table-export-sheet-C_GdeTYU.js → table-export-sheet-bSXxGn-v.js} +1 -1
- package/dist/chunks/temporal-input-presentation-sk9gqLi6.js +4960 -0
- package/dist/chunks/{token-types-CQtXUVMy.js → token-types-BUK06hU2.js} +1 -1
- package/dist/chunks/{upload-wbR-NVzq.js → upload-BnmuyPqW.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CEBaLOKC.js → use-create-flow-overlay-state-DyzhWvRJ.js} +6 -6
- package/dist/chunks/{validators-CXTneCA4.js → validators-BIM0FE31.js} +774 -895
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2477 -2685
- package/dist/data-app-sdk/index.js +30 -30
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +25 -25
- package/dist/format-utils/index.js +274 -267
- package/dist/index.js +59 -59
- 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/dashboard/summary-number-formatter.d.ts +6 -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 +50 -51
- package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
- 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/stores/editor-store.d.ts +9 -1
- package/dist/types/lib/stores/table-actions.d.ts +0 -2
- 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 +13 -1
- package/dist/types/shared/analytics-protocol/contracts.d.ts +9 -40
- package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
- 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/apply-card-settings.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +76 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-polarity-write.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +117 -0
- package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +51 -0
- package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +30 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +3402 -4313
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +49 -8
- 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 +52 -2
- 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/kpi.d.ts +1 -8
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +20 -20
- package/dist/types/shared/dashboard-authoring/detail-date-presentation.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +11 -6
- package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
- 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 +73 -3
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -3
- 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/dashboard-viewer/bookmark-impact.d.ts +33 -0
- package/dist/types/shared/format-utils/document-print.d.ts +82 -0
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +8 -1
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +18 -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 +2 -2
- package/dist/chunks/bookmark-state-BFY9oNmr.js +0 -111
- package/dist/chunks/custom-visual-inputs-Dz-enUNR.js +0 -292
- package/dist/chunks/dashboard-controls-Bi7fyG-4.js +0 -2339
- package/dist/chunks/document-dashboard-inputs-CkWfDB8c.js +0 -3010
- package/dist/chunks/filter-reach-copy-BF4w4kI2.js +0 -3738
- package/dist/chunks/global-date-filter-utils-D8365uPH.js +0 -12889
- package/dist/chunks/pivot-result-contract-expectations-Bl5suy4-.js +0 -1832
- package/dist/chunks/raw-temporal-presentation-BHm7s-hz.js +0 -540
- package/dist/chunks/resolve-dashboard-input-context-CAMiWvyR.js +0 -5280
- package/dist/chunks/table-settings-Imz0FgWi.js +0 -637
- package/dist/chunks/temporal-input-presentation-uvNK_tM0.js +0 -3228
- 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
|
@@ -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;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { MetricComparisonConfig } from '../../analytics-protocol/metric-comparison.js';
|
|
3
|
+
import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
|
|
4
|
+
import { ColumnKey } from '../changes/card-query-part.js';
|
|
5
|
+
import { ChangeDiagnostic } from '../changes/diagnostics.js';
|
|
6
|
+
import { ComparisonDates } from './dates.js';
|
|
7
|
+
import { MeasureCalculations } from './schemas.js';
|
|
8
|
+
import { KeyedWindowTransform } from './transform.js';
|
|
9
|
+
/** One measure's words as a change states them. */
|
|
10
|
+
export type StatedMeasureCalculations = MeasureCalculations & {
|
|
11
|
+
/** The measure on the working card. */
|
|
12
|
+
measure: ColumnKey;
|
|
13
|
+
/** Where it was stated, for problem paths: `changes[2].query.measures[1]`. */
|
|
14
|
+
path: string;
|
|
15
|
+
/**
|
|
16
|
+
* The groupings the transform runs along and starts over for, by key, from
|
|
17
|
+
* a caller that names a grouping itself (the editor's controls). They take
|
|
18
|
+
* the place of matching `orderBy` and `resetBy` by field, which can't tell
|
|
19
|
+
* two groupings of one field apart (a date by year and by month).
|
|
20
|
+
*/
|
|
21
|
+
groupings?: {
|
|
22
|
+
order?: ColumnKey;
|
|
23
|
+
resetBy?: ColumnKey[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type MeasureCalculationContext = {
|
|
27
|
+
/** Where the change sits in the request (`changes[3]`), for problems not tied to one measure. */
|
|
28
|
+
path: string;
|
|
29
|
+
/** The card as the change names it (an id or a `$handle`), for suggested changes; '' where there is none. */
|
|
30
|
+
cardRef: string;
|
|
31
|
+
dates: ComparisonDates;
|
|
32
|
+
/**
|
|
33
|
+
* Which table calculations must run as they will be stored: every one on
|
|
34
|
+
* the card (`card`, the default: the change resolver, after a query or type
|
|
35
|
+
* change that may break a kept one), or only those this update writes
|
|
36
|
+
* (`stated`: an editor control that changes one measure, so another
|
|
37
|
+
* measure's calculation a shelf change already broke doesn't block
|
|
38
|
+
* removing this one; ledger P3-05).
|
|
39
|
+
*/
|
|
40
|
+
check?: 'card' | 'stated';
|
|
41
|
+
};
|
|
42
|
+
/** One measure's stored writes. Absent fields leave the stored field as it is. */
|
|
43
|
+
export type ResolvedMeasureCalculations = {
|
|
44
|
+
/** The measure on the card as the change's query leaves it. */
|
|
45
|
+
measure: ColumnKey;
|
|
46
|
+
/** The stored comparison to write; null removes it. */
|
|
47
|
+
comparison?: MetricComparisonConfig | null;
|
|
48
|
+
/** The stored transform to write, its groupings named by key; null removes it. */
|
|
49
|
+
transform?: KeyedWindowTransform | null;
|
|
50
|
+
/** RC-D14: the column format the transform brings or takes away. */
|
|
51
|
+
format?: {
|
|
52
|
+
write: SemaphorValueFormat;
|
|
53
|
+
} | {
|
|
54
|
+
removeIf: SemaphorValueFormat;
|
|
55
|
+
};
|
|
56
|
+
/** What this write replaces, for its sentence (RC-D6, RC-INV-3). */
|
|
57
|
+
replaces?: 'comparison' | 'transform';
|
|
58
|
+
};
|
|
59
|
+
/** One `calculations` card update: the measures it changes, in card order. */
|
|
60
|
+
export type MeasureCalculationsUpdate = {
|
|
61
|
+
measures: ResolvedMeasureCalculations[];
|
|
62
|
+
};
|
|
63
|
+
export type MeasureCalculationsResolution = {
|
|
64
|
+
ok: true;
|
|
65
|
+
update: MeasureCalculationsUpdate | null;
|
|
66
|
+
warnings: ChangeDiagnostic[];
|
|
67
|
+
} | {
|
|
68
|
+
ok: false;
|
|
69
|
+
problems: ChangeDiagnostic[];
|
|
70
|
+
};
|
|
71
|
+
/** An output's written format (RC-D14): a share stored as 25 shows as 25%, one stored as 0.25 too. */
|
|
72
|
+
export declare const shareFormat: (output: "percent" | "fraction") => SemaphorValueFormat;
|
|
73
|
+
export declare function resolveMeasureCalculations(input: {
|
|
74
|
+
/** The working card: the change's query and type already applied, its calculations not. */
|
|
75
|
+
card: TCard;
|
|
76
|
+
/** The measures whose calculations the change states; may be empty, so a query or type change still has its kept transforms checked. */
|
|
77
|
+
stated: readonly StatedMeasureCalculations[];
|
|
78
|
+
context: MeasureCalculationContext;
|
|
79
|
+
}): MeasureCalculationsResolution;
|