@backtrace/browser
Version:
Backtrace-JavaScript web browser integration
40 lines (39 loc) • 1.93 kB
TypeScript
import type { Action, Middleware } from 'redux';
import { BacktraceClient } from '../BacktraceClient.js';
export interface BacktraceReduxMiddlewareOptions {
/**
* A function that can be used to skip an action or filter out information from a dispatched action, such as PII,
* that shouldn't be sent to Backtrace. Return undefined to skip an action, otherwise whatever
* (potentially modified) action returned will be sent to Backtrace.
*/
readonly interceptAction?: (action: Action) => Action | undefined;
/**
* Middleware mode. Can be one of:
* * `all` - include everything by default,
* * `omit-values` - add the breadcrumb, but omit the values,
* * `off` - disable the middleware.
*
* @default 'omit-values'
*/
readonly mode?: 'all' | 'omit-values' | 'off';
}
/**
*
* @param client BacktraceClient used to send breadcrumbs
* @param interceptAction A function that can be used to skip an action or filter out information from a dispatched action, such as PII,
* that shouldn't be sent to Backtrace. Return undefined to skip an action, otherwise whatever
* (potentially modified) action returned will be sent to Backtrace.
*/
export declare function createBacktraceReduxMiddleware(client: BacktraceClient, interceptAction?: (action: Action) => Action | undefined): Middleware;
/**
*
* @param client BacktraceClient used to send breadcrumbs
* @param options Middleware options.
*/
export declare function createBacktraceReduxMiddleware(client: BacktraceClient, options?: BacktraceReduxMiddlewareOptions): Middleware;
/**
*
* @param client BacktraceClient used to send breadcrumbs
* @param options Middleware options or intercept action function.
*/
export declare function createBacktraceReduxMiddleware(client: BacktraceClient, interceptActionOrOptions?: BacktraceReduxMiddlewareOptions | ((action: Action) => Action | undefined)): Middleware;