@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
38 lines (37 loc) • 1.92 kB
TypeScript
import { AdaptableLogger } from '../agGrid/AdaptableLogger';
export interface DeprecatedStateKeyInfo {
/** AdapTable major version in which the key was removed from `AdaptableState`. */
removedInVersion: number;
/**
* Optional short pointer to the replacement feature(s). Only appended to the
* info message when the deprecated slice actually had content (i.e. the
* value is a non-empty object). Empty slices — e.g. someone leaving
* `Schedule: {}` in their `initialState` — get the base message only, since
* they have nothing to migrate.
*/
replacement?: string;
}
/**
* Top-level `AdaptableState` keys that used to exist but have since been
* removed from AdapTable's state shape.
*
* On load, `stripDeprecatedStateKeys` quietly removes any of these keys from
* the incoming state and logs a single friendly `info` line per key — instead
* of letting Redux's `combineReducers` surface its more alarming
* `Unexpected key "…" found in previous state received by the reducer` warning.
*
* When you drop a top-level state slice, add it here so upgrading users with
* either an older persisted state or a stale `initialState` block in their
* `AdaptableOptions` see a soft, actionable message rather than a raw Redux
* dev-tools warning.
*/
export declare const DEPRECATED_TOP_LEVEL_STATE_KEYS: Readonly<Record<string, DeprecatedStateKeyInfo>>;
/**
* Remove any known-deprecated top-level keys from an incoming state object and
* log a friendly `info` message per stripped key. Unknown keys are left alone
* so Redux still surfaces genuinely unexpected state entries.
*
* Returns a shallow-cloned state with the deprecated keys removed, or the
* original state reference when nothing needed stripping.
*/
export declare function stripDeprecatedStateKeys<T extends Record<string, any>>(state: T, logger?: Pick<AdaptableLogger, 'consoleInfo'>): T;