import { type IDashboardExportParameter, type IDashboardParameter, type IDashboardTab, type IInsight, type IInsightDefinition, type IInsightParameterValue, type IParameterDefinition, type IParameterMetadataObject, type IdentifierRef, type ObjRef, type ParameterValue } from "@gooddata/sdk-model"; import { type ObjRefMap } from "../../../../_staging/metadata/objRefMap.js"; import { type IInsightWidgetTabContext } from "../layout/layoutSelectors.js"; import { type ITabState } from "../tabsState.js"; import { type IDashboardParameterEntry } from "./parametersState.js"; /** * @internal */ export declare const EMPTY_EXPORT_PARAMETERS_BY_TAB: Record; /** * Walks the insight's metric buckets and returns the parameter refs they reference, * deduped by ref string. The order matches the first occurrence in the measure traversal. * * @internal */ export declare function collectReferencedParameterRefs(insight: IInsightDefinition, measureParameters: Record): IdentifierRef[]; /** * Effective execution parameters, limited to `referencedRefs`. Precedence per ref: the dashboard * `runtimeOverride`, else the insight's own parameter value, else nothing (backend uses the workspace * default). A value from either source that is invalid for the workspace parameter (out of * constraints or of the wrong kind) is replaced by the workspace default (recovery), so the backend * never receives a bad value. * * @internal */ export declare function resolveEffectiveParameterValuesForRefs(entries: IDashboardParameterEntry[], referencedRefs: IdentifierRef[], insightParameterValues: IInsightParameterValue[], workspaceParameterByRef: Map): IInsightParameterValue[]; interface IParameterResolutionContext { entries: IDashboardParameterEntry[]; measureParameters: Record; workspaceParameterByRef: Map; isStringEnabled: boolean; } /** * Effective execution parameters for `insight` given a widget's parameter context: resolves the refs * the insight references, then applies {@link resolveEffectiveParameterValuesForRefs}. * * @internal */ export declare function resolveEffectiveParameterValuesForInsight(context: IParameterResolutionContext | undefined, insight: IInsightDefinition): IInsightParameterValue[]; /** * The value hydration seeds into `runtimeOverride`: the dashboard parameter's `value`, else the * workspace default when the workspace parameter is of the matching type, else `undefined`. * * @internal */ export declare function computeHydratedRuntimeOverride(parameter: IDashboardParameter, workspaceParameter: IParameterMetadataObject | undefined): ParameterValue | undefined; /** * The workspace definition a dashboard parameter binds to: the definition when its type matches * the parameter's own type tag, `undefined` otherwise (removed or incompatible workspace * parameter). The single home of the type-match invariant shared by hydration, reset, * reconciliation, and chip rendering. * * @internal */ export declare function matchingWorkspaceDefinition(parameter: IDashboardParameter, workspaceParameter: IParameterMetadataObject | undefined): IParameterDefinition | undefined; /** * Why a dashboard parameter no longer matches its workspace catalog entry: * - `removed`: the workspace has no parameter for this ref. * - `incompatible`: the workspace parameter is a different type (e.g. STRING, not NUMBER). * - `reset`: same type, but the value is outside the workspace constraints. * * @internal */ export type ParameterReconciliation = "reset" | "removed" | "incompatible"; /** * A mismatched dashboard parameter surfaced to the load-time toast: the ref, a display name, and * the kind of mismatch. * * @internal */ export interface IParameterReconciliationEntry { ref: ObjRef; name: string; kind: ParameterReconciliation; } /** * Classifies one dashboard parameter against its workspace catalog entry — the single source of * truth for the reconciliation kinds. * * Callers must only classify once the catalog is loaded: before load every `workspaceParameter` is * `undefined`, which would classify as `removed` and flag every parameter. The reconciliation * selectors own that gate (`isCatalogLoaded`). * * @internal */ export declare function classifyParameterReconciliation(dashboardParameter: IDashboardParameter, workspaceParameter: IParameterMetadataObject | undefined): ParameterReconciliation | undefined; /** * Collects the entries that no longer reconcile, deduped by ref — the first failing entry per ref * wins, so a ref in range on one tab but out of range on another is still surfaced. Callers pass * entries from a known-loaded catalog. * * @internal */ export declare function collectParameterReconciliations(entries: IDashboardParameterEntry[], workspaceParameters: IParameterMetadataObject[]): IParameterReconciliationEntry[]; /** * A STRING entry persisted while `enableStringParameters` was on. Once the flag is off it must not * reach executions, exports, or reconciliation: the catalog omits STRING definitions, so the chip * is hidden and the value would apply as an invisible override. * * @internal */ export declare function isGatedStringEntry(entry: IDashboardParameterEntry, isStringEnabled: boolean): boolean; /** * The value-shaped twin of {@link isGatedStringEntry}, for insight-level parameter values, which * carry no declared type. * * @internal */ export declare function isGatedStringValue(value: ParameterValue, isStringEnabled: boolean): boolean; /** * The insight-authored parameter values that pass the string gate — the single home of * insight-level gating for both the widget-execution hook path and the selector path. * * @internal */ export declare function ungatedInsightParameterValues(insight: IInsightDefinition, isStringEnabled: boolean): IInsightParameterValue[]; /** * Display title for a dashboard parameter: `parameter.label` → workspace title → `ref.identifier`. * * @internal */ export declare function resolveParameterTitle(parameter: IDashboardParameter, workspaceParameter: IParameterMetadataObject | undefined): string; /** * Indexes the workspace parameter catalog by ref string for O(1) lookup. * * @internal */ export declare function buildWorkspaceParametersByRef(workspaceParameters: IParameterMetadataObject[]): Map; /** * Folds an entry's ephemeral `runtimeOverride` into the persisted parameter shape's `value`. * * @internal */ export declare function applyRuntimeOverride(entry: IDashboardParameterEntry): IDashboardParameter; /** * Resolves a single parameter entry to the export wire shape. Returns `undefined` for entries with * no `runtimeOverride` — the dashboard's persisted parameter state and the workspace default are * applied by the backend on its own, and insight-level `insight.parameters` are applied per-insight * by the backend; sending a row in those cases would override the backend's resolution with a stale * FE snapshot (matches the live-render path in `selectEffectiveParameterValuesForWidget`). * * An out-of-range value is replaced by the workspace default (recovery): unlike the live AFM, an * omitted export override falls back to the *persisted* (bad) value, so the default must be sent * explicitly to override it. * * Title precedence (when a row is emitted): `parameter.label` → workspace title → `ref.identifier`. * * @internal */ export declare function formatDashboardParameter(entry: IDashboardParameterEntry, workspaceParameter: IParameterMetadataObject | undefined): IDashboardExportParameter | undefined; /** * Resolves the persisted shape of a parameter entry against its workspace catalog parameter. * Drops `value` when it equals the workspace default; drops `label` when it equals the workspace title. * * @internal */ export declare function smartPersistResolvedEntry(entry: IDashboardParameterEntry, workspaceParameter: IParameterMetadataObject): IDashboardParameter; /** * Builds the persisted-parameter lookup keyed by tab and then by ref string. Honors V1 → per-tab * migration: when no tab in the persisted dashboard carries `parameters`, the persisted root * `parameters` is used as fallback for every tab. * * @internal */ export declare function buildPersistedByTabAndRef(persistedTabs: ReadonlyArray, rootPersistedParameters: IDashboardParameter[]): Map>; /** * Returns `undefined` when reset would be a no-op: missing/type-mismatched workspace parameter, * or in edit mode when `parameter.value` is unset / already equals the workspace default. * * @internal */ export declare function computeParameterResetValue(entry: IDashboardParameterEntry, workspaceParameter: IParameterMetadataObject | undefined, isInEditMode: boolean): ParameterValue | undefined; /** * Only `mode: "active"` entries with a defined `runtimeOverride` are considered resettable; * HIDDEN and READONLY entries are skipped, and entries with `runtimeOverride === undefined` * (chip hidden, execution falls back to `insight.parameters`) are preserved as-is — symmetric * with per-chip behavior in `DashboardParameterFilter`. * * @internal */ export declare function computeParameterResetTargets(entries: IDashboardParameterEntry[], workspaceParameters: IParameterMetadataObject[], isInEditMode: boolean): { ref: IDashboardParameterEntry["parameter"]["ref"]; value: ParameterValue | undefined; }[]; /** * Folds per-tab ref selections into the wire shape, dropping entries without a * `runtimeOverride`. Each selection pairs a tab with an optional ref restriction: * `allowedRefs === undefined` selects all refs (whole-dashboard scope); a defined set restricts * entries to those refs (widget scope). Tabs that yield no rows are omitted from the result. * * @internal */ export declare function collectExportOverrides(tabRefSelections: ReadonlyArray<{ tab: ITabState; allowedRefs?: Set; }>, workspaceParameterByRef: Map, isStringEnabled: boolean): Record; /** * Builds per-tab ref selections for a widget-scope export: each widget's owning tab is restricted * to refs referenced by the widget's insight metrics. Multiple widgets on the same tab union their * refs. * * @internal */ export declare function buildWidgetScopeTabRefSelections(widgetContexts: ReadonlyArray, widgetIds: ReadonlyArray, insights: ObjRefMap, measureParameters: Record): { tab: ITabState; allowedRefs: Set; }[]; export {}; //# sourceMappingURL=parametersHelpers.d.ts.map