UNPKG

@dudousxd/nestjs-diagnostics

Version:

A standard convention for @dudousxd/nestjs-* libs to emit observability events over node:diagnostics_channel.

11 lines • 532 B
/** Metadata key under which a method's @OnDiagnostic subscriptions accumulate. */ export const ON_DIAGNOSTIC_META = Symbol('diagnostics:on'); export function OnDiagnostic(lib, event) { return (target, key) => { const existing = Reflect.getMetadata(ON_DIAGNOSTIC_META, target, key) ?? []; const meta = { lib, ...(event !== undefined ? { event } : {}) }; Reflect.defineMetadata(ON_DIAGNOSTIC_META, [...existing, meta], target, key); }; } //# sourceMappingURL=on-diagnostic.decorator.js.map