UNPKG

@dudousxd/nestjs-telescope

Version:

Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.

28 lines 1.71 kB
import { type Entry } from '../entry/entry.js'; export type Tagger = (entry: Entry) => string[]; /** Default threshold (ms) above which an entry is tagged 'slow'. */ export declare const SLOW_THRESHOLD_MS = 1000; /** Tags request entries with their HTTP status (`status:NNN`). Type-gated to * request entries so a non-request content type that happens to carry a * `statusCode` field is never mistaken for an HTTP response. */ export declare const statusTagger: Tagger; export declare const slowTagger: Tagger; /** * The `user:<id>` tag for a raw user value, or `null` when no usable identity is * present. Prefers `id`, then `_id`, then `email` — so Passport (`id`), Mongo * (`_id`), and email-keyed identities all pivot to the SAME `user:` namespace * the dashboard's User filter reads. Shared by `userTagger` (request entries) * and the client-error controller so a browser-reported error tags identically * to a server request. Cheap property reads only; never throws. */ export declare function userIdentityTag(user: unknown): string | null; /** Tags request entries with the authenticated user's identity (`user:<id>`). * Reads `content.user` via {@link userIdentityTag} (preferring `id`/`_id`/ * `email`). Type-gated to request entries and built from cheap property reads * only (hot path); any non-object content or missing user yields no tag and * never throws. */ export declare const userTagger: Tagger; export declare const BUILTIN_TAGGERS: readonly Tagger[]; /** Returns the entry's existing tags plus all tagger outputs, de-duplicated, order-preserving. */ export declare function runTaggers(entry: Entry, taggers: Tagger[]): string[]; //# sourceMappingURL=tagger.d.ts.map