UNPKG

ag-grid-community

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

127 lines (126 loc) 8.25 kB
import type { ValidationModuleName } from '../interfaces/iModule'; import type { RowModelType } from '../interfaces/iRowModel'; import type { ErrorId, ErrorMap, GetErrorParams, MissingModuleErrors } from './errorMessages/errorText'; export declare let baseDocLink: string; /** * The ValidationService passes itself in if it has been included. * @param logger */ export declare function provideValidationServiceLogger(logger: <TId extends ErrorId>(id: TId, args: GetErrorParams<TId>) => any[]): void; /** Set by the Framework override to give us accurate links for the framework */ export declare function setValidationDocLink(docLink: string): void; export type Severity = 'error' | 'warning' | 'deprecation'; /** * Whether `severity` is one of the `enabled` severities to act on. An empty list matches nothing. * Shared by the throw-on check and the overlay's severity filter so both honour the same set model. */ export declare function _isSeverityEnabled(severity: Severity, enabled: readonly Severity[]): boolean; /** * A diagnostic captured for the developer overlay (config errors, runtime errors and warnings). */ export interface CapturedDiagnostic { id: ErrorId; params: any; severity: Severity; /** * The grid that emitted this, so a listener surfaces only its own grid's diagnostics. Set when the * emitting bean routes through its grid-scoped log service (or an explicit grid id is threaded in), * and undefined when emitted outside any grid (e.g. a bootstrap failure, or a standalone export). */ gridId?: string; /** Fallback message used when the ValidationModule is not registered to supply the full text. */ defaultMessage?: string; } /** * Stable identity key for deduping captured diagnostics: the same `id` and `params` yield the same key. * Non-serialisable params (functions, circular refs) fall back to `${id}:unserialisable:${fallbackSeed}` * so distinct entries are never collapsed — callers pass a per-call seed (a counter or index) for this. */ export declare function _diagnosticKey(diagnostic: CapturedDiagnostic, fallbackSeed: string | number): string; type DiagnosticListener = (diagnostic: CapturedDiagnostic) => void; /** * Called by the ValidationModule to enable diagnostic capture and set the severities to throw on and/or * the suppressed ids. Core never imports the ValidationModule, so its config is pushed in through this * setter (the same idiom as `provideValidationServiceLogger`) to keep the dependency direction one-way. */ export declare function _configureDiagnostics(config: { capture?: boolean; throwOn?: readonly Severity[]; suppress?: ErrorId[]; }): void; /** * Registers a listener notified of captured diagnostics for `gridId` (plus any not tied to a grid), * used by the error overlay. Pass `gridId: undefined` for a page-level listener that sees everything. * Diagnostics already buffered before it attached (and matching it) are replayed immediately. Returns * a cleanup function that removes the listener and, once the last listener detaches, drops the buffer * so a later grid does not inherit stale diagnostics. */ export declare function _addDiagnosticListener(gridId: string | undefined, listener: DiagnosticListener): () => void; type BootstrapPanelRenderer = (container: HTMLElement, diagnostics: CapturedDiagnostic[]) => void; /** * Pushed in by the ValidationModule (which core never imports) to render a standalone panel of * bootstrap-failure diagnostics, for when grid creation aborts before any bean — and thus the overlay — * exists. Mirrors the provideValidationServiceLogger setter idiom to keep the dependency direction one-way. */ export declare function _provideBootstrapPanelRenderer(renderer: BootstrapPanelRenderer): void; /** * Renders the buffered diagnostics not tied to a grid (e.g. a missing row-model module that aborts grid * creation) into `container`, when the ValidationModule has provided a renderer. No-op otherwise, so core * stays decoupled and production pays nothing. */ export declare function _renderBootstrapPanel(container: HTMLElement): void; /** * The context a single missing-module report carries, matching the id-200 message params. * @knipIgnore Param type of the exported `_reportMissingModule`; also used in tests. */ export interface MissingModuleReportParams { reasonOrId: string | keyof MissingModuleErrors; moduleName: ValidationModuleName | ValidationModuleName[]; gridScoped: boolean; gridId: string; rowModelType: RowModelType; additionalText?: string; isUmd?: boolean; usesAgGridProvider?: boolean; } /** * Accumulates a missing-module report to be flushed as a single combined error after a short debounce, * deduped per grid by module+reason. The console output is always batched (even in production without the * ValidationModule); the overlay capture is added when capture is enabled and the id is not suppressed. * Throw-on-severity stays synchronous and per-module so throw mode keeps its call stack and fails fast. * @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _reportMissingModule(params: MissingModuleReportParams): void; /** * Clears the missing-module batch and its page-wide dedup so a fresh "page" starts clean. For test * harnesses that reuse the module across cases (mirrors clearing the `_doOnce` dedup on reset). * @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _resetMissingModuleReports(): void; /** * Formats a string, or the literal `null`/`undefined`, into a human-readable string. */ export declare function toStringWithNullUndefined(str: string | null | undefined): string; export declare function getErrorLink(errorNum: ErrorId, args: GetErrorParams<any>): string; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _warnWithoutAttribution<TId extends ErrorId, TShowMessageAtCallLocation = ErrorMap[TId]>(...args: GetErrorParams<TId> extends undefined ? [id: TId] : [id: TId, params: GetErrorParams<TId>]): void; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _errorWithoutAttribution<TId extends ErrorId, TShowMessageAtCallLocation = ErrorMap[TId]>(...args: GetErrorParams<TId> extends undefined ? [id: TId] : [id: TId, params: GetErrorParams<TId>]): void; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _warnForGrid(gridId: string, id: ErrorId, params?: any): void; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _deprecatedForGrid(gridId: string, id: ErrorId, params?: any): void; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _errorForGrid(gridId: string, id: ErrorId, params?: any): void; /** Used for messages before the ValidationService has been created */ export declare function _logPreInitErr<TId extends ErrorId, TShowMessageAtCallLocation = ErrorMap[TId]>(id: TId, args: GetErrorParams<TId>, defaultMessage: string): void; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _logPreInitWarn<TId extends ErrorId, TShowMessageAtCallLocation = ErrorMap[TId]>(id: TId, args: GetErrorParams<TId>, defaultMessage: string): void; /** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _errMsg<TId extends ErrorId, TShowMessageAtCallLocation = ErrorMap[TId]>(...args: GetErrorParams<TId> extends undefined ? [id: TId] : [id: TId, params: GetErrorParams<TId>]): string; /** * Used for messages before the ValidationService has been created * @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */ export declare function _preInitErrMsg<TId extends ErrorId, TShowMessageAtCallLocation = ErrorMap[TId]>(...args: GetErrorParams<TId> extends undefined ? [id: TId] : [id: TId, params: GetErrorParams<TId>]): string; export {};