/** * The allowlisted, safe-to-log shape produced by `sanitizeError` for anything error-like. * Every field is optional because the input is `any` — a rejected promise can carry anything. */ export interface SanitizedError { name?: string; message?: string; stack?: string; code?: string; method?: string; url?: string; status?: number; statusText?: string; } /** * True for anything that must be reduced before it reaches a log sink: a real Error, an AxiosError, * or a plain object carrying BOTH a string `stack` and a string `message` — the shape `sanitizeError` * and the protector produce, and the shape `err.toJSON()` produces. * * Both fields are required on purpose. A payload that merely happens to carry a `stack` field would * otherwise be reduced to that one key, silently dropping everything the caller wanted logged. This * is deliberately stricter than pino's own test (`typeof err.message === 'string'`). */ export declare function isErrorLike(value: any): boolean; /** * Reduce one error-like value to a small allowlist that is safe to log. * * Errors carry far more than a message. An AxiosError holds the request config (bearer token, * request body), the raw ClientRequest (the token again, twice) and the response body. Our own * GraphQLMutationError holds `rawData` — the full record being saved — because TypeScript's * `private` is compile-time only. Anything spread or JSON-serialised into a log line takes all * of that with it, so we keep a fixed set of fields and drop everything else. * * `response.data` is deliberately NOT kept: it is upstream-controlled content and can echo the * request payload back at us. `toSafeAxiosError` in the protector adds it back for the value that * is *thrown* to the custom function developer, which is not a log. * * Pure, DI-free and axios-free on purpose: it is safe to call from any catch block, and the * utilities barrel is required at build time by mex-custom-function-builder. The axios check is * therefore a duck-type, not `axios.isAxiosError`. * * Non-error values (plain objects, strings, null) are returned unchanged: this function only * knows how to make errors safe, and silently mangling a caller's log payload would be worse. * * Reading each axios field from both the nested and the flat position makes this idempotent, so a * second pass over its own output (or over the protector's flat thrown object) keeps `url` and * `status` instead of dropping them. */ export declare function sanitizeError(value: any): any; /** * The single "make anything safe to log" entry point: a depth-bounded walk that reduces every * error-like value it finds, at any nesting level, inside objects or arrays. * * Custom functions are customer-written and cannot be audited, so `{ ctx: { err } }`, `{ errs: [err] }` * and printf tail args all have to be closed at one choke point rather than per call site. * * Fails closed everywhere: the depth cap emits a marker rather than the raw value, and an unknown * object type is walked rather than trusted. */ export declare function sanitizeForLog(value: any, depth?: number, seen?: WeakSet): any; //# sourceMappingURL=errorUtils.d.ts.map