@dudousxd/nestjs-telescope
Version:
Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.
24 lines • 1.11 kB
TypeScript
import type { ClientExceptionContent } from '../entry/content.js';
/**
* The successful parse result. We DELIBERATELY do not echo the raw payload back
* to the client on failure (see {@link validateClientErrorBody}) — the caller
* gets a generic 400 with a fixed reason, never a reflection of what it sent.
*/
export type ClientErrorValidation = {
ok: true;
value: Omit<ClientExceptionContent, 'clientIp'>;
} | {
ok: false;
reason: string;
};
/**
* Structurally validate an UNTRUSTED client-error body WITHOUT adding a schema
* dependency. Rules: `message` is a required non-empty string; every other field
* is optional with a type check and a length cap; `user` is passed through as-is
* (redacted at record time) and `extra` must be a plain object if present (its
* contents are bounded by redaction, not here). On any violation returns a
* generic reason and NO echo of the payload, so the endpoint never reflects
* attacker input.
*/
export declare function validateClientErrorBody(body: unknown): ClientErrorValidation;
//# sourceMappingURL=client-error-validation.d.ts.map