//#region src/types/paths.d.ts interface PublicWildcardSegment { readonly any: true; } interface PublicRecursiveWildcardSegment { readonly anyDepth: true; } type PathSegments = readonly (string | number | RegExp | IgnorePathSegment | PublicWildcardSegment | PublicRecursiveWildcardSegment)[]; interface FunctionCensorContext { readonly matchedPath: PathSegments; /** * The path segments of the rule that produced this redaction. * When an inherited policy is active (e.g. a parent key rule with `retainStructure: true`), * this reflects the ancestor rule's key or path — not the current node's own key. */ readonly rulePath: PathSegments; readonly rootInput: unknown; readonly terminalKey?: string | number; } type Censor = string | ((value: unknown, context: FunctionCensorContext) => unknown); type RegexPathSegment = RegExp; interface IgnorePathSegment { readonly ignore: string | number | RegexPathSegment; } type StructuredPathSegment = string | number | RegexPathSegment | IgnorePathSegment; type StructuredPathSelector = readonly StructuredPathSegment[]; type PathSelector = string | StructuredPathSelector; interface PathRule { readonly path: PathSelector; readonly censor?: Censor; readonly remove?: boolean; readonly retainStructure?: boolean; readonly replaceStringByLength?: boolean; } type PathEntry = PathSelector | PathRule; //#endregion //#region src/types/diagnostics.d.ts interface DiagnosticEvent { readonly details?: Record; readonly event: string; readonly message: string; readonly path: string; readonly valueType: string; } type DiagnosticSink = (event: DiagnosticEvent) => void; interface DiagnosticsOptions { readonly sink?: DiagnosticSink; } //#endregion //#region src/types/ignored-value-types.d.ts interface IgnoredValueTypesOption { readonly bigint?: boolean; readonly Date?: boolean; readonly Error?: boolean; readonly Map?: boolean; readonly RegExp?: boolean; readonly Set?: boolean; readonly URL?: boolean; } //#endregion //#region src/types/transformers.d.ts type Transformer = (value: unknown) => unknown; interface CustomConstructorTransformerRegistration { readonly constructor: abstract new (...args: never[]) => object; readonly transformers: readonly Transformer[]; } interface TransformersByType { readonly bigint?: readonly Transformer[]; readonly object?: readonly Transformer[]; } interface TransformersByConstructor { readonly Date?: readonly Transformer[]; /** * User `Error` transformers run BEFORE regular traversal, in both serialise modes: an `Error` * (or subclass such as `AxiosError`) is converted to the plain object you return, which is then * scrubbed by `keys`/`paths` rules. Register `Error` subclasses here, not under `custom`. */ readonly Error?: readonly Transformer[]; readonly Map?: readonly Transformer[]; readonly RegExp?: readonly Transformer[]; readonly Set?: readonly Transformer[]; readonly URL?: readonly Transformer[]; /** * Per-class transformers for arbitrary class instances. These run BEFORE regular traversal, in * both serialise modes: the matched instance is converted to the plain object you return, which * is then scrubbed by `keys`/`paths` rules. Built-in constructors (`Object`, `Array`, `Date`, * `Error`, `Map`, `RegExp`, `Set`, `URL`) are rejected — register `Error` subclasses under * `Error`. */ readonly custom?: readonly CustomConstructorTransformerRegistration[]; } /** * How runtime types are represented. User per-class transformers — `byConstructor.custom` and * `byConstructor.Error` — run BEFORE regular traversal (in both serialise modes), converting a * class instance to a plain object that `keys`/`paths` redaction then scrubs. Every other bucket * (`byType`, `fallback`, and user `byConstructor.{Date,Map,RegExp,Set,URL}`) runs only during the * serialise pass; relying on that serialise-only behaviour — where the transformer output escapes * redaction — is deprecated in favour of the per-class buckets above. */ interface TransformersOption { readonly byType?: TransformersByType; readonly byConstructor?: TransformersByConstructor; /** * @deprecated Relying on a transformer that takes effect only during the serialise pass — its * output escaping `keys`/`paths` redaction — is deprecated. Prefer `byConstructor.custom` (for * arbitrary classes) or `byConstructor.Error`, which run before traversal so the converted value * is redacted. `fallback` output is still emitted at serialise time and is not redacted. */ readonly fallback?: readonly Transformer[]; } //#endregion //#region src/types/config.d.ts type SerialiseOption = boolean | ((value: unknown) => string); type BudgetOverflowMode = 'throw' | 'truncate'; interface KeyRule { readonly key: string | RegExp; readonly fuzzyKeyMatch?: boolean; readonly caseSensitiveKeyMatch?: boolean; readonly censor?: Censor; readonly remove?: boolean; readonly retainStructure?: boolean; readonly replaceStringByLength?: boolean; } type KeySelector = string | RegExp | KeyRule; type StringTest = RegExp | SubstringRule; type ValueTypeName = 'string' | 'number' | 'bigint' | 'boolean' | 'object' | 'function' | 'symbol' | 'undefined'; interface SubstringRule { readonly pattern: RegExp; readonly replacer: (value: string, pattern: RegExp) => string; } interface DeepRedactOptions { readonly caseSensitiveKeyMatch?: boolean; readonly censor?: Censor; readonly diagnostics?: DiagnosticsOptions; readonly fuzzyKeyMatch?: boolean; readonly keys?: readonly KeySelector[]; readonly maxDepth?: number; readonly maxNodes?: number; readonly onBudgetExceeded?: BudgetOverflowMode; readonly paths?: readonly PathEntry[]; readonly remove?: boolean; readonly retainStructure?: boolean; readonly serialise?: SerialiseOption; readonly stringTests?: readonly StringTest[]; readonly transformers?: TransformersOption; readonly types?: readonly ValueTypeName[]; readonly ignoredValueTypes?: IgnoredValueTypesOption; readonly replaceStringByLength?: boolean; } //#endregion //#region src/types/public.d.ts type Redactor = (value: unknown) => unknown; type RedactorFactory = (options?: DeepRedactOptions) => Redactor; //#endregion export { StructuredPathSegment as A, PathEntry as C, PublicRecursiveWildcardSegment as D, PathSelector as E, PublicWildcardSegment as O, IgnorePathSegment as S, PathSegments as T, DiagnosticEvent as _, KeyRule as a, Censor as b, StringTest as c, CustomConstructorTransformerRegistration as d, Transformer as f, IgnoredValueTypesOption as g, TransformersOption as h, DeepRedactOptions as i, StructuredPathSelector as j, RegexPathSegment as k, SubstringRule as l, TransformersByType as m, RedactorFactory as n, KeySelector as o, TransformersByConstructor as p, BudgetOverflowMode as r, SerialiseOption as s, Redactor as t, ValueTypeName as u, DiagnosticSink as v, PathRule as w, FunctionCensorContext as x, DiagnosticsOptions as y };