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,4 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { SentenceClause } from '../operations/operation-sentences.js';
|
|
3
|
+
import { MeasureCalculationsUpdate } from './resolve.js';
|
|
4
|
+
export declare function describeMeasureCalculations(before: TCard, update: MeasureCalculationsUpdate): SentenceClause[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { ChangeDiagnostic } from '../changes/diagnostics.js';
|
|
3
|
+
import { MeasureCalculationContext, StatedMeasureCalculations } from './resolve.js';
|
|
4
|
+
export declare function setMeasureCalculations(card: TCard, stated: readonly StatedMeasureCalculations[], context: MeasureCalculationContext): {
|
|
5
|
+
ok: true;
|
|
6
|
+
card: TCard;
|
|
7
|
+
warnings: ChangeDiagnostic[];
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
problems: ChangeDiagnostic[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { CardConfig, GroupByField, WindowTransform } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
import { FieldRef } from '../changes/dashboard-change.js';
|
|
4
|
+
import { ColumnKey } from '../changes/card-query-part.js';
|
|
5
|
+
import { MeasureTransform } from './schemas.js';
|
|
6
|
+
import { ResolvedMetricWindowTransform } from './window-transforms.js';
|
|
7
|
+
/** A WindowTransform whose groupings are named by key, not id (SPEC §4). */
|
|
8
|
+
export type KeyedWindowTransform = Omit<WindowTransform, 'orderBy' | 'partitionByFieldIds'> & {
|
|
9
|
+
orderBy?: {
|
|
10
|
+
grouping: ColumnKey;
|
|
11
|
+
direction: 'asc' | 'desc';
|
|
12
|
+
};
|
|
13
|
+
partitionBy: ColumnKey[];
|
|
14
|
+
};
|
|
15
|
+
/** The kinds that run along an order (all but a percent of total). */
|
|
16
|
+
export declare const ORDERED_KINDS: ReadonlySet<MeasureTransform['kind']>;
|
|
17
|
+
/**
|
|
18
|
+
* The stored form for public words, groupings already matched to keys: the
|
|
19
|
+
* order (a percent of total has none) and the partitions (omitted: every
|
|
20
|
+
* grouping other than the order; a percent of the grand total: none).
|
|
21
|
+
*/
|
|
22
|
+
export declare function toKeyedTransform(transform: MeasureTransform, groupings: {
|
|
23
|
+
order: ColumnKey | undefined;
|
|
24
|
+
resetBy: ColumnKey[] | undefined;
|
|
25
|
+
all: readonly ColumnKey[];
|
|
26
|
+
}): KeyedWindowTransform;
|
|
27
|
+
/** A keyed transform with the card's grouping ids filled in; undefined when a named grouping isn't on the card. */
|
|
28
|
+
export declare function toStoredTransform(keyed: KeyedWindowTransform, groupings: readonly GroupByField[]): WindowTransform | undefined;
|
|
29
|
+
/** The server's resolution of a measure's transform on a card, or undefined when it can't be resolved. */
|
|
30
|
+
export declare function resolveMeasureTransform(config: CardConfig, cardType: string, metricId: string): ResolvedMetricWindowTransform | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a stated transform means what a measure stores (S-7): both resolved
|
|
33
|
+
* by the server's check on the card, equal but for the measure id.
|
|
34
|
+
*/
|
|
35
|
+
export declare function sameTransform(card: TCard, metricIndex: number, stated: WindowTransform | undefined): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A stored table calculation as its controls hold it: the public words, the
|
|
38
|
+
* grouping it runs along and the ones it starts over for by id, and its
|
|
39
|
+
* direction even when its order grouping is gone.
|
|
40
|
+
*/
|
|
41
|
+
export type StoredTransformRead = {
|
|
42
|
+
transform: MeasureTransform;
|
|
43
|
+
/** The id of the grouping it runs along, when that grouping is on the card. */
|
|
44
|
+
order?: string;
|
|
45
|
+
direction?: 'asc' | 'desc';
|
|
46
|
+
/** The ids of the groupings it starts over for, those still on the card; absent when it takes the default. */
|
|
47
|
+
resetBy?: string[];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The one reading of a stored table calculation, total (ledger P3-12): the
|
|
51
|
+
* server's resolution where the calculation runs (every default filled in),
|
|
52
|
+
* else the stored fields as they are, so a calculation a shelf change broke
|
|
53
|
+
* keeps its settings while it is repaired. Groupings no longer on the card are
|
|
54
|
+
* left out. Undefined only without a calculation, or with a function the
|
|
55
|
+
* server doesn't know.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readTransform(card: TCard, metricId: string, groupingRef: (grouping: GroupByField) => FieldRef): StoredTransformRead | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* The public words for a stored transform, every field present (SPEC "How the
|
|
60
|
+
* outline reads them"): `readTransform` where the server's check resolves it;
|
|
61
|
+
* undefined where it can't, so the card stays not editable through the MCP.
|
|
62
|
+
*/
|
|
63
|
+
export declare function readStoredTransform(card: TCard, metricId: string, groupingRef: (grouping: GroupByField) => FieldRef): MeasureTransform | undefined;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CardConfig, WindowFunction } from '../../../lib/types/explorer-types.js';
|
|
2
|
+
export declare const WINDOW_ERROR_CODES: {
|
|
3
|
+
readonly INVALID_WINDOW_TRANSFORM: "INVALID_WINDOW_TRANSFORM";
|
|
4
|
+
readonly WINDOW_REQUIRES_GROUP_BY: "WINDOW_REQUIRES_GROUP_BY";
|
|
5
|
+
readonly WINDOW_ORDER_FIELD_INVALID: "WINDOW_ORDER_FIELD_INVALID";
|
|
6
|
+
readonly WINDOW_NUMERIC_METRIC_REQUIRED: "WINDOW_NUMERIC_METRIC_REQUIRED";
|
|
7
|
+
readonly WINDOW_COMPARISON_CONFLICT: "WINDOW_COMPARISON_CONFLICT";
|
|
8
|
+
readonly WINDOW_UNSUPPORTED_CARD_TYPE: "WINDOW_UNSUPPORTED_CARD_TYPE";
|
|
9
|
+
};
|
|
10
|
+
export type WindowErrorCode = (typeof WINDOW_ERROR_CODES)[keyof typeof WINDOW_ERROR_CODES];
|
|
11
|
+
export declare const WINDOW_WARNING_CODES: {
|
|
12
|
+
readonly WINDOW_NON_DATE_ORDER: "WINDOW_NON_DATE_ORDER";
|
|
13
|
+
readonly WINDOW_DIRECTION_NORMALIZED_ASC: "WINDOW_DIRECTION_NORMALIZED_ASC";
|
|
14
|
+
};
|
|
15
|
+
export type WindowWarningCode = (typeof WINDOW_WARNING_CODES)[keyof typeof WINDOW_WARNING_CODES];
|
|
16
|
+
export interface WindowValidationError {
|
|
17
|
+
code: WindowErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
metricId?: string;
|
|
20
|
+
}
|
|
21
|
+
interface ResolvedWindowTransformBase {
|
|
22
|
+
metricId: string;
|
|
23
|
+
function: WindowFunction;
|
|
24
|
+
partitionByFieldIds: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ResolvedRunningTotalTransform extends ResolvedWindowTransformBase {
|
|
27
|
+
function: 'running_total';
|
|
28
|
+
orderByFieldId: string;
|
|
29
|
+
orderByDirection: 'asc' | 'desc';
|
|
30
|
+
frame: 'unbounded_preceding';
|
|
31
|
+
}
|
|
32
|
+
export interface ResolvedMovingAverageTransform extends ResolvedWindowTransformBase {
|
|
33
|
+
function: 'moving_average';
|
|
34
|
+
orderByFieldId: string;
|
|
35
|
+
orderByDirection: 'asc' | 'desc';
|
|
36
|
+
windowSize: number;
|
|
37
|
+
minPeriods: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ResolvedPreviousPeriodDeltaTransform extends ResolvedWindowTransformBase {
|
|
40
|
+
function: 'previous_period_delta';
|
|
41
|
+
orderByFieldId: string;
|
|
42
|
+
orderByDirection: 'asc' | 'desc';
|
|
43
|
+
mode: 'absolute' | 'percent';
|
|
44
|
+
}
|
|
45
|
+
export interface ResolvedPercentOfTotalTransform extends ResolvedWindowTransformBase {
|
|
46
|
+
function: 'percent_of_total';
|
|
47
|
+
scope: 'grand_total' | 'partition_total';
|
|
48
|
+
output: 'fraction' | 'percent';
|
|
49
|
+
}
|
|
50
|
+
export type ResolvedMetricWindowTransform = ResolvedRunningTotalTransform | ResolvedMovingAverageTransform | ResolvedPreviousPeriodDeltaTransform | ResolvedPercentOfTotalTransform;
|
|
51
|
+
export interface WindowValidationResult {
|
|
52
|
+
errors: WindowValidationError[];
|
|
53
|
+
warnings: WindowWarningCode[];
|
|
54
|
+
resolvedTransforms: ResolvedMetricWindowTransform[];
|
|
55
|
+
}
|
|
56
|
+
export declare function validateAndResolveWindowTransforms({ cardConfig, cardType, }: {
|
|
57
|
+
cardConfig: CardConfig;
|
|
58
|
+
cardType?: string;
|
|
59
|
+
}): WindowValidationResult;
|
|
60
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TCard } from '../../lib/types/common-types.js';
|
|
1
|
+
import { TCard, TextCardRichContent } from '../../lib/types/common-types.js';
|
|
2
2
|
/**
|
|
3
3
|
* The type a card starts as before anyone picks one: a table shows any mix of
|
|
4
4
|
* fields, where a chart needs a specific shape (P4-11). Clear returns a card
|
|
@@ -8,3 +8,14 @@ export declare const NEW_CARD_TYPE = "table";
|
|
|
8
8
|
export type NewCardInput = Pick<TCard, 'id' | 'title'> & Partial<Pick<TCard, 'description' | 'tabTitle' | 'connectionId' | 'dataSource' | 'preferences'>>;
|
|
9
9
|
/** The one assembly of an empty card; callers pass their differences in. */
|
|
10
10
|
export declare function createNewCard({ preferences, ...input }: NewCardInput): TCard;
|
|
11
|
+
/**
|
|
12
|
+
* A text card a change adds (building a report SPEC §3): its words as rich
|
|
13
|
+
* text and nothing else, so it never renders as dynamic text. A description
|
|
14
|
+
* is its subtitle when it shows in tabs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createTextCard(input: {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
richContent: TextCardRichContent;
|
|
21
|
+
}): TCard;
|
|
@@ -7,7 +7,8 @@ export type { CardUpdate, CreatedEntity, DashboardOperation, DashboardOperationR
|
|
|
7
7
|
* saved document for these edits: the editor stores, the change resolver's
|
|
8
8
|
* dry run and the server's apply all call it. It writes only the document; it
|
|
9
9
|
* returns what it created, one plain sentence per change, and the runtime
|
|
10
|
-
* effects a live editor applies to its own state (DE-D49)
|
|
10
|
+
* effects a live editor applies to its own state (DE-D49), and the existing
|
|
11
|
+
* cards it changed (`touched`, watch page P1-20). It never mints ids
|
|
11
12
|
* and never reads the clock (S-INV-1).
|
|
12
13
|
*/
|
|
13
14
|
export declare function applyDashboardOperations(dashboard: TDashboard, operations: readonly DashboardOperation[], context: OperationContext): DashboardOperationResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TCardPreferences } from '../../../lib/types/common-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The plain sentences the reducer returns for what it did (MCP dashboard
|
|
4
|
+
* editing SPEC 3.8). The reducer writes one clause per thing that changed;
|
|
5
|
+
* the clauses of one public change join into one sentence, in the order
|
|
6
|
+
* type, query, rename, description, columns, display, highlight, detached. Sentences never name the
|
|
7
|
+
* product.
|
|
8
|
+
*/
|
|
9
|
+
export type ClauseKind = 'add' | 'remove' | 'type' | 'query' | 'calculation' | 'rename' | 'description' | 'columns' | 'display' | 'highlight' | 'dashboard' | 'sheet' | 'detached' | 'commit' | 'filter' | 'layout';
|
|
10
|
+
export type SentenceClause = {
|
|
11
|
+
kind: ClauseKind;
|
|
12
|
+
/** How the clause reads when it opens the sentence. */
|
|
13
|
+
lead: string;
|
|
14
|
+
/** How it reads after another clause of the same change. */
|
|
15
|
+
follow: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function joinClauses(clauses: readonly SentenceClause[]): string;
|
|
18
|
+
export declare const quoted: (text: string | undefined) => string;
|
|
19
|
+
/** The short type name a new card's sentence carries: "(bar)", "(detail table)", "(KPI)". */
|
|
20
|
+
export declare function cardTypeShortName(chartType: string | undefined): string;
|
|
21
|
+
/** "x axis settings", "tooltip settings": a dropped chart preference as a person reads it. */
|
|
22
|
+
export declare function preferenceLabel(key: keyof TCardPreferences | string): string;
|
|
23
|
+
export declare function listPhrase(items: readonly string[]): string;
|
|
24
|
+
export declare const clauses: {
|
|
25
|
+
added(title: string | undefined, chartType: string, sheet: string, detail?: string, place?: string): SentenceClause;
|
|
26
|
+
/** Arrange (responsive layouts SPEC §6.5). */
|
|
27
|
+
arranged(sheet: string, keepOrder: boolean, empty: boolean): SentenceClause;
|
|
28
|
+
removed(title: string | undefined, sheet: string): SentenceClause;
|
|
29
|
+
renamed(previous: string | undefined, next: string): SentenceClause;
|
|
30
|
+
described(title: string | undefined, removed: boolean): SentenceClause;
|
|
31
|
+
retyped(title: string | undefined, chartType: string, dropped: readonly string[]): SentenceClause;
|
|
32
|
+
/** A column's label returned to the model's (card appearance CA-D5). */
|
|
33
|
+
labelReturned(title: string | undefined, from: string | undefined, to: string): SentenceClause;
|
|
34
|
+
/** Each relabelled column by the label it showed, so the person approving sees which one (card appearance CA-D13). */
|
|
35
|
+
relabeled(title: string | undefined, labels: ReadonlyArray<{
|
|
36
|
+
from: string | undefined;
|
|
37
|
+
to: string;
|
|
38
|
+
}>): SentenceClause;
|
|
39
|
+
queried(title: string | undefined, detail: string): SentenceClause;
|
|
40
|
+
/** Rules whose column a change removes (conditional formatting store CR-D5). */
|
|
41
|
+
droppedRules(title: string | undefined, names: readonly string[]): SentenceClause;
|
|
42
|
+
detached(title: string | undefined): SentenceClause;
|
|
43
|
+
detachedTile(): SentenceClause;
|
|
44
|
+
committed(title: string | undefined): SentenceClause;
|
|
45
|
+
plain(kind: ClauseKind, text: string): SentenceClause;
|
|
46
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { EmbeddedFilterDashboardInput, TDashboard, TFrame } from '../../../lib/types/common-types.js';
|
|
1
|
+
import { EmbeddedFilterDashboardInput, TDashboard, TFrame, TextCardRichContent } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { ResolvedCardSettings } from '../card-settings/resolved.js';
|
|
3
|
+
import { MeasureCalculationsUpdate } from '../measure-calculations/resolve.js';
|
|
2
4
|
import { FilterSettingsChange, FilterValueEffect } from '../../../lib/dashboard-inputs/filter-settings.js';
|
|
3
5
|
import { DashboardFilterBoundCardApplication } from '../dashboard-filter-mapping-types.js';
|
|
4
6
|
import { Field } from '../../../lib/types/explorer-types.js';
|
|
@@ -40,6 +42,26 @@ export type CardUpdate =
|
|
|
40
42
|
| {
|
|
41
43
|
kind: 'relabel';
|
|
42
44
|
labels: StatedLabel[];
|
|
45
|
+
}
|
|
46
|
+
/** How the card's columns read and show, resolved by the card settings owner (card appearance CA-D10, SPEC 3.6). */
|
|
47
|
+
| {
|
|
48
|
+
kind: 'settings';
|
|
49
|
+
settings: ResolvedCardSettings;
|
|
50
|
+
}
|
|
51
|
+
/** A measure's comparison and transform, resolved by the measure calculations owner (reports by conversation RC-D11, SPEC §4). */
|
|
52
|
+
| {
|
|
53
|
+
kind: 'calculations';
|
|
54
|
+
calculations: MeasureCalculationsUpdate;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A text card's words as rich text, resolved by the words owner (building a
|
|
58
|
+
* report SPEC §3): the older runs go, and the older words in `description`
|
|
59
|
+
* too when `clearsLegacy` (BR-D12).
|
|
60
|
+
*/
|
|
61
|
+
| {
|
|
62
|
+
kind: 'text';
|
|
63
|
+
richContent: TextCardRichContent;
|
|
64
|
+
clearsLegacy: boolean;
|
|
43
65
|
};
|
|
44
66
|
/** Everything the editor's "Done", Save & Apply and Apply Local commit persists, as one operation (DE-D13). */
|
|
45
67
|
export type FrameCommit = {
|
|
@@ -105,6 +127,37 @@ export type DashboardOperation = ({
|
|
|
105
127
|
op: 'filter.exclude';
|
|
106
128
|
filterId: string;
|
|
107
129
|
cardId: string;
|
|
130
|
+
}
|
|
131
|
+
/** The dashboard's own title and description (card appearance); a null description removes it. */
|
|
132
|
+
| {
|
|
133
|
+
op: 'dashboard.update';
|
|
134
|
+
title?: string;
|
|
135
|
+
description?: string | null;
|
|
136
|
+
}
|
|
137
|
+
/** A sheet at the end, its id from the resolver (building a report SPEC §4.1); the editor adds Document sheets too. */
|
|
138
|
+
| {
|
|
139
|
+
op: 'sheet.add';
|
|
140
|
+
sheet: {
|
|
141
|
+
id: string;
|
|
142
|
+
title: string;
|
|
143
|
+
kind?: 'document';
|
|
144
|
+
};
|
|
145
|
+
} | {
|
|
146
|
+
op: 'sheet.update';
|
|
147
|
+
sheetId: string;
|
|
148
|
+
title: string;
|
|
149
|
+
}
|
|
150
|
+
/** Cards in one spot as tabs, the first named shown (building a report SPEC §4.3). */
|
|
151
|
+
| {
|
|
152
|
+
op: 'layout.tabs';
|
|
153
|
+
sheetId: string;
|
|
154
|
+
cardIds: string[];
|
|
155
|
+
}
|
|
156
|
+
/** A tab in a spot of its own beside its tabs; the new spot's id from the resolver (S-2). */
|
|
157
|
+
| {
|
|
158
|
+
op: 'layout.untab';
|
|
159
|
+
cardId: string;
|
|
160
|
+
newFrameId: string;
|
|
108
161
|
}) & {
|
|
109
162
|
/** Set by the resolver: the public change this operation came from. Descriptions group by it. */
|
|
110
163
|
changeIndex?: number;
|
|
@@ -114,7 +167,7 @@ export type OperationContext = {
|
|
|
114
167
|
calendar: CalendarContext | null;
|
|
115
168
|
};
|
|
116
169
|
export type CreatedEntity = {
|
|
117
|
-
kind: 'card' | 'filter';
|
|
170
|
+
kind: 'card' | 'filter' | 'sheet';
|
|
118
171
|
id: string;
|
|
119
172
|
title: string;
|
|
120
173
|
changeIndex?: number;
|
|
@@ -155,6 +208,8 @@ export type DashboardRuntimeEffect =
|
|
|
155
208
|
inputId: string;
|
|
156
209
|
};
|
|
157
210
|
export type OperationFailureCode = 'sheet_not_found'
|
|
211
|
+
/** A sheet with that id is already on the dashboard (building a report SPEC §4.2). */
|
|
212
|
+
| 'sheet_id_taken'
|
|
158
213
|
/** A document sheet places cards through its document, not its grid. */
|
|
159
214
|
| 'sheet_not_a_grid' | 'frame_id_taken' | 'frame_not_found' | 'card_not_found' | 'filter_not_found' | 'filter_id_taken'
|
|
160
215
|
/** The filter settings or mapping fail the input contract; `details.issues` has the core's issues. */
|
|
@@ -168,14 +223,29 @@ export type OperationFailureCode = 'sheet_not_found'
|
|
|
168
223
|
/** A conversion asked for more ids than the operation carries. */
|
|
169
224
|
| 'ids_exhausted'
|
|
170
225
|
/** A retype across the Matrix boundary without a catalog. */
|
|
171
|
-
| 'catalog_loading'
|
|
226
|
+
| 'catalog_loading'
|
|
227
|
+
/** A card settings operation names a column the card no longer has (card appearance SPEC 4.3): a defect, since apply runs after the staleness check. */
|
|
228
|
+
| 'setting_target_missing';
|
|
172
229
|
export type DashboardOperationResult = {
|
|
173
230
|
ok: true;
|
|
174
231
|
dashboard: TDashboard;
|
|
175
232
|
created: CreatedEntity[];
|
|
233
|
+
/**
|
|
234
|
+
* The existing cards the operations changed in place, in order, each once
|
|
235
|
+
* (watch page P1-20): a live editor shows the person the first one. A
|
|
236
|
+
* removed card isn't listed, nor are changes to no card (filters, sheets,
|
|
237
|
+
* the dashboard's title, arranging).
|
|
238
|
+
*/
|
|
239
|
+
touched: string[];
|
|
176
240
|
/** One plain sentence per public change (or per operation without a changeIndex). */
|
|
177
241
|
descriptions: OperationDescription[];
|
|
178
242
|
runtimeEffects: DashboardRuntimeEffect[];
|
|
243
|
+
/**
|
|
244
|
+
* An edit made a card that showed a library visual the dashboard's own:
|
|
245
|
+
* never applied without a yes (card appearance P2-36). From each
|
|
246
|
+
* operation's outcome; its sentence says so too, but is never read for it.
|
|
247
|
+
*/
|
|
248
|
+
detaches: boolean;
|
|
179
249
|
} | {
|
|
180
250
|
ok: false;
|
|
181
251
|
failedAt: {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DashboardRelationshipReachResolver } from '../../../lib/query-context/dashboard-filter-mapping-resolution.js';
|
|
2
2
|
import { TDashboard } from '../../../lib/types/common-types.js';
|
|
3
3
|
import { FrameWidth } from '../../layouts/index.js';
|
|
4
|
+
import { TextBlocks } from '../text-card-words/index.js';
|
|
5
|
+
import { CardTypeProperties } from '../changes/card-types.js';
|
|
6
|
+
import { CardSettingsView } from '../card-settings/views.js';
|
|
4
7
|
import { NotEditableReason, OutlineCardSource } from '../changes/read-card-query.js';
|
|
5
8
|
import { CardQuery, MatrixColumns } from '../changes/dashboard-change.js';
|
|
6
9
|
import { OutlineFilter } from './outline-filters.js';
|
|
@@ -34,10 +37,10 @@ export type OutlineViewer = {
|
|
|
34
37
|
*/
|
|
35
38
|
relationshipReach?: DashboardRelationshipReachResolver;
|
|
36
39
|
};
|
|
37
|
-
export type OutlineCard = {
|
|
40
|
+
export type OutlineCard = ({
|
|
38
41
|
cardId: string;
|
|
39
42
|
title: string;
|
|
40
|
-
/** The public type name (DE-D43). */
|
|
43
|
+
/** The public type name (DE-D43): one of the eight, a variant as properties beside it (card appearance CA-D6). */
|
|
41
44
|
type: string;
|
|
42
45
|
source: OutlineCardSource;
|
|
43
46
|
/** Shows a library visual; changing it makes it local (DE-D50). */
|
|
@@ -46,7 +49,9 @@ export type OutlineCard = {
|
|
|
46
49
|
/** Absent only when the outline is truncated. */
|
|
47
50
|
query?: CardQuery;
|
|
48
51
|
matrix?: MatrixColumns;
|
|
49
|
-
}
|
|
52
|
+
} & CardTypeProperties &
|
|
53
|
+
/** How the card reads and shows, in the shape a change takes; absent when the outline is truncated (card appearance SPEC 3.2). */
|
|
54
|
+
Partial<CardSettingsView>) | OutlineTextCard | ({
|
|
50
55
|
cardId: string;
|
|
51
56
|
title: string;
|
|
52
57
|
type: string;
|
|
@@ -58,6 +63,17 @@ export type OutlineCard = {
|
|
|
58
63
|
message: string;
|
|
59
64
|
detail?: string;
|
|
60
65
|
};
|
|
66
|
+
} & CardTypeProperties);
|
|
67
|
+
/** A text card's words, in the subset a change takes (building a report SPEC §2.3, read by the words owner, S-10). */
|
|
68
|
+
export type OutlineTextCard = {
|
|
69
|
+
cardId: string;
|
|
70
|
+
title: string;
|
|
71
|
+
type: 'text';
|
|
72
|
+
editable: true;
|
|
73
|
+
text: TextBlocks;
|
|
74
|
+
/** In the editor's words: what the stored words hold that the blocks can't state; kept as stored (BR-INV-7). */
|
|
75
|
+
editorOnly?: string[];
|
|
76
|
+
linkedVisualId?: string;
|
|
61
77
|
};
|
|
62
78
|
export type OutlineSheet = {
|
|
63
79
|
sheetId: string;
|
|
@@ -83,6 +99,8 @@ export type OutlineLayoutRow = {
|
|
|
83
99
|
export type DashboardOutline = {
|
|
84
100
|
dashboardId: string;
|
|
85
101
|
title: string;
|
|
102
|
+
/** The dashboard's description, when it has one: what `dashboard.update` sets. */
|
|
103
|
+
description?: string;
|
|
86
104
|
updatedAt: string;
|
|
87
105
|
access: {
|
|
88
106
|
canEdit: boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A text card's words as a change and the outline give them (building a
|
|
3
|
+
* report SPEC §2.4, BR-D11 as revised by OQ-1): blocks shaped like the
|
|
4
|
+
* stored rich text, with shorter names. Text is taken literally: nothing is
|
|
5
|
+
* parsed or printed, so `**` in a run is two asterisks.
|
|
6
|
+
*/
|
|
7
|
+
/** Plain text, or one run of text or a variable with its emphasis and link. */
|
|
8
|
+
export type TextRun = string | {
|
|
9
|
+
text?: string;
|
|
10
|
+
variable?: string;
|
|
11
|
+
bold?: boolean;
|
|
12
|
+
italic?: boolean;
|
|
13
|
+
link?: string;
|
|
14
|
+
};
|
|
15
|
+
export type TextBlock = {
|
|
16
|
+
type: 'heading';
|
|
17
|
+
level: 1 | 2;
|
|
18
|
+
content: TextRun[];
|
|
19
|
+
} | {
|
|
20
|
+
type: 'paragraph';
|
|
21
|
+
content: TextRun[];
|
|
22
|
+
} | {
|
|
23
|
+
type: 'list';
|
|
24
|
+
style: 'bulleted' | 'numbered';
|
|
25
|
+
items: TextRun[][];
|
|
26
|
+
};
|
|
27
|
+
/** At most 200 blocks and 10,000 characters of text (SPEC §2.2). */
|
|
28
|
+
export type TextBlocks = TextBlock[];
|
|
29
|
+
/** A run as an object: exactly one of `text` or `variable`, only the flags that are on. */
|
|
30
|
+
export type TextRunObject = {
|
|
31
|
+
text?: string;
|
|
32
|
+
variable?: string;
|
|
33
|
+
bold?: true;
|
|
34
|
+
italic?: true;
|
|
35
|
+
link?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A run as an object. A string is plain text; a run naming a variable is
|
|
39
|
+
* that variable (`name` alone is `name.label`); `false` flags are dropped.
|
|
40
|
+
*/
|
|
41
|
+
export declare function runObject(run: TextRun): TextRunObject;
|
|
42
|
+
/**
|
|
43
|
+
* Runs in their one form (SPEC §2.4): empty text dropped, neighbouring text
|
|
44
|
+
* of one emphasis and link joined, and a run with no emphasis or link a
|
|
45
|
+
* string.
|
|
46
|
+
*/
|
|
47
|
+
export declare function oneFormRuns(runs: readonly TextRun[]): TextRun[];
|
|
48
|
+
/** Blocks in their one form: what the outline reads, and what a change is compared and stored as. */
|
|
49
|
+
export declare function oneForm(blocks: readonly TextBlock[]): TextBlocks;
|
|
50
|
+
/** A block's runs, with each one's path under the block's own. */
|
|
51
|
+
export declare function blockRuns(block: TextBlock, at: string): Array<{
|
|
52
|
+
run: TextRun;
|
|
53
|
+
path: string;
|
|
54
|
+
}>;
|
|
55
|
+
/** The characters of text in the blocks (variables count none). */
|
|
56
|
+
export declare function textLength(blocks: readonly TextBlock[]): number;
|
|
57
|
+
/** The first words of a text card, for the sentence that adds it. */
|
|
58
|
+
export declare function blocksExcerpt(blocks: readonly TextBlock[], length?: number): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TCard, TDashboard, TextCardRichContent } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { ChangeDiagnostic } from '../changes/diagnostics.js';
|
|
3
|
+
import { TextBlocks } from './blocks.js';
|
|
4
|
+
export { hasTextCardRichWords, isTextCardRichContent, sanitizeTextCardUrl } from './rich-content.js';
|
|
5
|
+
export type { TextBlock, TextBlocks, TextRun } from './blocks.js';
|
|
6
|
+
/**
|
|
7
|
+
* The one reader and writer of a text card's words for a change (building a
|
|
8
|
+
* report S-10, BR-D11, BR-D12, SPEC §5.3, §5.4): the outline reads them here,
|
|
9
|
+
* and the resolver resolves a change to them here. The words are blocks
|
|
10
|
+
* shaped like the stored rich text (SPEC §2.4), read and written field by
|
|
11
|
+
* field; variables are the card's own (S-9); a change keeps every block it
|
|
12
|
+
* leaves as it reads (S-8). Pure: no DOM, no Markdown package (V-7).
|
|
13
|
+
*/
|
|
14
|
+
export type TextCardWordsForm = 'rich' | 'legacy_runs' | 'legacy_html' | 'empty';
|
|
15
|
+
export type TextCardWordsRead = {
|
|
16
|
+
editable: true;
|
|
17
|
+
form: TextCardWordsForm;
|
|
18
|
+
text: TextBlocks;
|
|
19
|
+
editorOnly: string[];
|
|
20
|
+
} | {
|
|
21
|
+
editable: false;
|
|
22
|
+
form: 'dynamic';
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const DYNAMIC_TEXT_MESSAGE = "Its words come from a query. Change it in the editor.";
|
|
26
|
+
/** At most this many characters of text in a change (SPEC §2.2). */
|
|
27
|
+
export declare const MAX_TEXT_WORDS = 10000;
|
|
28
|
+
type Inputs = TDashboard['inputs'];
|
|
29
|
+
export declare function readTextCardWords(card: TCard, inputs: Inputs): TextCardWordsRead;
|
|
30
|
+
export type TextWordsResolution = {
|
|
31
|
+
ok: true;
|
|
32
|
+
unchanged: true;
|
|
33
|
+
} | {
|
|
34
|
+
ok: true;
|
|
35
|
+
unchanged: false;
|
|
36
|
+
richContent: TextCardRichContent;
|
|
37
|
+
clearsLegacy: boolean;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
problems: ChangeDiagnostic[];
|
|
41
|
+
};
|
|
42
|
+
export declare function resolveTextCardWords(request: {
|
|
43
|
+
text: TextBlocks;
|
|
44
|
+
card?: TCard;
|
|
45
|
+
inputs: Inputs;
|
|
46
|
+
path: string;
|
|
47
|
+
/**
|
|
48
|
+
* Store an older card's words as rich text even when they come back as
|
|
49
|
+
* read: a change that makes its description the subtitle needs the words
|
|
50
|
+
* out of it first (BR-D12).
|
|
51
|
+
*/
|
|
52
|
+
storeAsRichText?: boolean;
|
|
53
|
+
}): TextWordsResolution;
|
|
54
|
+
/** The first words of rich content, for the sentence that adds or changes a card. */
|
|
55
|
+
export declare function textCardExcerpt(content: TextCardRichContent | undefined, inputs?: Inputs): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TextCardRichContent } from '../../../lib/types/common-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A text card's stored rich content (`preferences.textVisualOptions.richContent`):
|
|
4
|
+
* the shape check and the link rule, pure and server-safe, so the renderer
|
|
5
|
+
* (`src/lib/dashboard-inputs/text-card-rich-content.ts`), the editor and the
|
|
6
|
+
* words owner (building a report SPEC §1) read them from one place.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isTextCardRichContent(value: unknown): value is TextCardRichContent;
|
|
9
|
+
/** Whether the content holds any words: a paragraph of only spacing holds none (V-8). */
|
|
10
|
+
export declare function hasTextCardRichWords(value: unknown): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The editor's link rule. Mirrors the DOMPurify default URL policy: http(s),
|
|
13
|
+
* mailto, tel, relative and protocol-relative; a bare host gets https;
|
|
14
|
+
* javascript:, data:, file: and anything else are dropped. Returns the URL
|
|
15
|
+
* to link, or '' to drop the link and keep its words.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sanitizeTextCardUrl(rawUrl: string): string;
|
|
18
|
+
export declare function isDashboardInputExportKey(value: unknown): value is 'label' | 'value' | 'start' | 'end' | 'range';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TDashboard } from '../../lib/types/common-types.js';
|
|
2
|
+
import { BookmarkUsage } from './viewer-contract.js';
|
|
3
|
+
export type BookmarkImpactItem = {
|
|
4
|
+
readonly target: 'input' | 'sheet' | 'table' | 'column';
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** For a column: its table. */
|
|
7
|
+
readonly cardId?: string;
|
|
8
|
+
/** From the saved dashboard, where the removed part still has its name. */
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly bookmarks: number;
|
|
11
|
+
/** Viewers with remembered settings that name it (tables and columns). */
|
|
12
|
+
readonly remembered: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* What an edit removes that saved bookmarks or remembered settings use: parts
|
|
16
|
+
* of the saved dashboard that the draft no longer has, with how many use each.
|
|
17
|
+
* Removed parts don't break anything (opening reports a note, PLAN B24); this
|
|
18
|
+
* tells the author before they save. "No longer has" is decided by the same
|
|
19
|
+
* checks a bookmark is reconciled with when it opens. Builder table columns
|
|
20
|
+
* only: a SQL or Python table's columns are known only from a result. Pure.
|
|
21
|
+
*/
|
|
22
|
+
export declare function describeBookmarkImpact(input: {
|
|
23
|
+
readonly saved: TDashboard;
|
|
24
|
+
readonly draft: TDashboard;
|
|
25
|
+
readonly usage: BookmarkUsage;
|
|
26
|
+
}): readonly BookmarkImpactItem[];
|
|
27
|
+
/** How the editor names an affected part and what uses it: ("Revenue", "2 bookmarks, 1 remembered layout"). */
|
|
28
|
+
export declare function describeBookmarkImpactItem(item: BookmarkImpactItem): {
|
|
29
|
+
name: string;
|
|
30
|
+
uses: string;
|
|
31
|
+
};
|
|
32
|
+
/** One sentence for a proposal: what it removes that viewers saved, in the editor's words (card appearance CA-D17). */
|
|
33
|
+
export declare function bookmarkImpactSentence(item: BookmarkImpactItem): string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Document print contract (Document PDF reliability C1 to C4): what a
|
|
3
|
+
* printing Document tells the PDF worker, read by the package, the app and
|
|
4
|
+
* the worker alike. Pure: no React, no stores. The worker bundles it into its
|
|
5
|
+
* own adapter (`semaphor-report-scheduler/scripts/document-print-entry.mjs`).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The one page-fit rule (DPR-D13): a page overflows when
|
|
9
|
+
* `Math.ceil(scroll) - Math.ceil(client)` exceeds this on either axis. React's
|
|
10
|
+
* fit check and the worker's last check read the same constant.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DOCUMENT_PAGE_FIT_TOLERANCE_PX = 1;
|
|
13
|
+
declare const DOCUMENT_PRINT_LAYOUT_STAGES: readonly ["loading", "measuring", "checking", "laidOut"];
|
|
14
|
+
/** Where a printing Document's layout is (C4). A failure is not a stage: it travels as a code (C1). */
|
|
15
|
+
export type DocumentPrintLayoutStage = (typeof DOCUMENT_PRINT_LAYOUT_STAGES)[number];
|
|
16
|
+
/** The page stack's `data-document-print-layout`, in print only (C4). */
|
|
17
|
+
export type DocumentPrintLayout = {
|
|
18
|
+
stage: DocumentPrintLayoutStage;
|
|
19
|
+
/** Defined row heights across the paginated sections. */
|
|
20
|
+
measuredRowCount: number;
|
|
21
|
+
/** Null while any paginated section has no settled count. */
|
|
22
|
+
totalRowCount: number | null;
|
|
23
|
+
/** The final plan's page count; null before `checking`. */
|
|
24
|
+
pageCount: number | null;
|
|
25
|
+
};
|
|
26
|
+
/** Every reason a Document cannot print (C1). Lowercase, as the page and the worker report them. */
|
|
27
|
+
export declare const DOCUMENT_PRINT_FAILURE_CODES: readonly ["document_matrix_too_large", "document_matrix_unavailable", "document_matrix_too_wide", "document_kpi_value_overflow", "print_inputs_not_captured", "document_section_setup", "document_input_missing", "document_section_query_failed", "document_table_completeness_unverified", "document_row_limit_exceeded", "document_section_render_failed", "document_page_overflow", "document_sheet_not_found", "document_print_timed_out"];
|
|
28
|
+
export type DocumentPrintFailureCode = (typeof DOCUMENT_PRINT_FAILURE_CODES)[number];
|
|
29
|
+
export declare function isDocumentPrintFailureCode(value: unknown): value is DocumentPrintFailureCode;
|
|
30
|
+
/**
|
|
31
|
+
* What a failure says beyond its code (C3): ids, counts, geometry, the stage
|
|
32
|
+
* and authored labels, never row values, SQL, server text or URLs (DPR-INV-7).
|
|
33
|
+
* The bounds keep the serialized facts under 1 KB.
|
|
34
|
+
*/
|
|
35
|
+
export type DocumentPrintFailureFacts = {
|
|
36
|
+
/** At most 64 characters. */
|
|
37
|
+
sectionId?: string;
|
|
38
|
+
/** Authored, trimmed, at most 120 characters. */
|
|
39
|
+
sectionTitle?: string;
|
|
40
|
+
/** 1-based. */
|
|
41
|
+
pageNumber?: number;
|
|
42
|
+
/** 0 or more. */
|
|
43
|
+
rowCount?: number;
|
|
44
|
+
/** More than 0. */
|
|
45
|
+
rowLimit?: number;
|
|
46
|
+
/** Authored labels, at most 3, each at most 80 characters. */
|
|
47
|
+
inputLabels?: string[];
|
|
48
|
+
overflowAxis?: 'height' | 'width';
|
|
49
|
+
/** Logs and the author's detail only. */
|
|
50
|
+
overflowPx?: number;
|
|
51
|
+
matrixLimit?: 'rows' | 'bytes';
|
|
52
|
+
/** W1 only: where the layout was when the deadline passed. */
|
|
53
|
+
layoutStage?: DocumentPrintLayoutStage | 'noPageStack' | 'unknown';
|
|
54
|
+
/** W1 only. */
|
|
55
|
+
loadingSectionCount?: number;
|
|
56
|
+
/** W1 only. */
|
|
57
|
+
measuredRowCount?: number;
|
|
58
|
+
/** W1 only. */
|
|
59
|
+
totalRowCount?: number;
|
|
60
|
+
/** W1 only. */
|
|
61
|
+
pageCount?: number;
|
|
62
|
+
};
|
|
63
|
+
/** What a source passes to the attribute writer (C1). */
|
|
64
|
+
export type DocumentPrintFailure = {
|
|
65
|
+
code: DocumentPrintFailureCode;
|
|
66
|
+
facts: DocumentPrintFailureFacts;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The one facts parser (C3): reads the attribute's JSON (or an object), drops
|
|
70
|
+
* unknown fields, wrong types and out-of-range values, and truncates strings
|
|
71
|
+
* to their limits. Every reader parses with it; every writer writes its output.
|
|
72
|
+
*/
|
|
73
|
+
export declare function readDocumentPrintFailureFacts(value: unknown): DocumentPrintFailureFacts;
|
|
74
|
+
/**
|
|
75
|
+
* Internal English for logs and the author-only delivery detail, built from
|
|
76
|
+
* the code and facts only (C1), so no server error text, SQL or row value can
|
|
77
|
+
* reach it. Customers read the app's catalog line instead (C2).
|
|
78
|
+
*/
|
|
79
|
+
export declare function describeDocumentPrintFailure(failure: DocumentPrintFailure): string;
|
|
80
|
+
/** Reads the attribute value (or an already parsed object); undefined when absent or malformed. */
|
|
81
|
+
export declare function readDocumentPrintLayout(value: unknown): DocumentPrintLayout | undefined;
|
|
82
|
+
export {};
|