/// /// import { CallHandler, DynamicModule, ExecutionContext, LoggerService as LoggerService$1, MiddlewareConsumer, NestInterceptor, NestModule, RequestMethod } from "@nestjs/common"; import { Reflector } from "@nestjs/core"; //#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/types/internal/Subscription.d.ts /** * Represents a disposable resource, such as the execution of an Observable. A * Subscription has one important method, `unsubscribe`, that takes no argument * and just disposes the resource held by the subscription. * * Additionally, subscriptions may be grouped together through the `add()` * method, which will attach a child Subscription to the current Subscription. * When a Subscription is unsubscribed, all its children (and its grandchildren) * will be unsubscribed as well. */ declare class Subscription implements SubscriptionLike { private initialTeardown?; static EMPTY: Subscription; /** * A flag to indicate whether this Subscription has already been unsubscribed. */ closed: boolean; private _parentage; /** * The list of registered finalizers to execute upon unsubscription. Adding and removing from this * list occurs in the {@link #add} and {@link #remove} methods. */ private _finalizers; /** * @param initialTeardown A function executed first as part of the finalization * process that is kicked off when {@link #unsubscribe} is called. */ constructor(initialTeardown?: (() => void) | undefined); /** * Disposes the resources held by the subscription. May, for instance, cancel * an ongoing Observable execution or cancel any other type of work that * started when the Subscription was created. */ unsubscribe(): void; /** * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called * when this subscription is unsubscribed. If this subscription is already {@link #closed}, * because it has already been unsubscribed, then whatever finalizer is passed to it * will automatically be executed (unless the finalizer itself is also a closed subscription). * * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed * subscription to a any subscription will result in no operation. (A noop). * * Adding a subscription to itself, or adding `null` or `undefined` will not perform any * operation at all. (A noop). * * `Subscription` instances that are added to this instance will automatically remove themselves * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove * will need to be removed manually with {@link #remove} * * @param teardown The finalization logic to add to this subscription. */ add(teardown: TeardownLogic): void; /** * Checks to see if a this subscription already has a particular parent. * This will signal that this subscription has already been added to the parent in question. * @param parent the parent to check for */ private _hasParent; /** * Adds a parent to this subscription so it can be removed from the parent if it * unsubscribes on it's own. * * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED. * @param parent The parent subscription to add */ private _addParent; /** * Called on a child when it is removed via {@link #remove}. * @param parent The parent to remove */ private _removeParent; /** * Removes a finalizer from this subscription that was previously added with the {@link #add} method. * * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves * from every other `Subscription` they have been added to. This means that using the `remove` method * is not a common thing and should be used thoughtfully. * * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance * more than once, you will need to call `remove` the same number of times to remove all instances. * * All finalizer instances are removed to free up memory upon unsubscription. * * @param teardown The finalizer to remove from this subscription */ remove(teardown: Exclude): void; } //#endregion //#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/types/internal/types.d.ts /** * Note: This will add Symbol.observable globally for all TypeScript users, * however, we are no longer polyfilling Symbol.observable */ declare global { interface SymbolConstructor { readonly observable: symbol; } } /** * A function type interface that describes a function that accepts one parameter `T` * and returns another parameter `R`. * * Usually used to describe {@link OperatorFunction} - it always takes a single * parameter (the source Observable) and returns another Observable. */ interface UnaryFunction { (source: T): R; } interface OperatorFunction extends UnaryFunction, Observable> {} interface Unsubscribable { unsubscribe(): void; } declare type TeardownLogic = Subscription | Unsubscribable | (() => void) | void; interface SubscriptionLike extends Unsubscribable { unsubscribe(): void; readonly closed: boolean; } /** OBSERVABLE INTERFACES */ interface Subscribable { subscribe(observer: Partial>): Unsubscribable; } /** * An object interface that defines a set of callback functions a user can use to get * notified of any set of {@link Observable} * {@link guide/glossary-and-semantics#notification notification} events. * * For more info, please refer to {@link guide/observer this guide}. */ interface Observer { /** * A callback function that gets called by the producer during the subscription when * the producer "has" the `value`. It won't be called if `error` or `complete` callback * functions have been called, nor after the consumer has unsubscribed. * * For more info, please refer to {@link guide/glossary-and-semantics#next this guide}. */ next: (value: T) => void; /** * A callback function that gets called by the producer if and when it encountered a * problem of any kind. The errored value will be provided through the `err` parameter. * This callback can't be called more than one time, it can't be called if the * `complete` callback function have been called previously, nor it can't be called if * the consumer has unsubscribed. * * For more info, please refer to {@link guide/glossary-and-semantics#error this guide}. */ error: (err: any) => void; /** * A callback function that gets called by the producer if and when it has no more * values to provide (by calling `next` callback function). This means that no error * has happened. This callback can't be called more than one time, it can't be called * if the `error` callback function have been called previously, nor it can't be called * if the consumer has unsubscribed. * * For more info, please refer to {@link guide/glossary-and-semantics#complete this guide}. */ complete: () => void; } //#endregion //#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/types/internal/Subscriber.d.ts /** * Implements the {@link Observer} interface and extends the * {@link Subscription} class. While the {@link Observer} is the public API for * consuming the values of an {@link Observable}, all Observers get converted to * a Subscriber, in order to provide Subscription-like capabilities such as * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for * implementing operators, but it is rarely used as a public API. */ declare class Subscriber extends Subscription implements Observer { /** * A static factory for a Subscriber, given a (potentially partial) definition * of an Observer. * @param next The `next` callback of an Observer. * @param error The `error` callback of an * Observer. * @param complete The `complete` callback of an * Observer. * @return A Subscriber wrapping the (partially defined) * Observer represented by the given arguments. * @deprecated Do not use. Will be removed in v8. There is no replacement for this * method, and there is no reason to be creating instances of `Subscriber` directly. * If you have a specific use case, please file an issue. */ static create(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber; /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ protected isStopped: boolean; /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ protected destination: Subscriber | Observer; /** * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons. */ constructor(destination?: Subscriber | Observer); /** * The {@link Observer} callback to receive notifications of type `next` from * the Observable, with a value. The Observable may call this method 0 or more * times. * @param value The `next` value. */ next(value: T): void; /** * The {@link Observer} callback to receive notifications of type `error` from * the Observable, with an attached `Error`. Notifies the Observer that * the Observable has experienced an error condition. * @param err The `error` exception. */ error(err?: any): void; /** * The {@link Observer} callback to receive a valueless notification of type * `complete` from the Observable. Notifies the Observer that the Observable * has finished sending push-based notifications. */ complete(): void; unsubscribe(): void; protected _next(value: T): void; protected _error(err: any): void; protected _complete(): void; } //#endregion //#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/types/internal/Operator.d.ts /*** * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ interface Operator { call(subscriber: Subscriber, source: any): TeardownLogic; } //#endregion //#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/types/internal/Observable.d.ts /** * A representation of any set of values over any amount of time. This is the most basic building block * of RxJS. */ declare class Observable implements Subscribable { /** * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ source: Observable | undefined; /** * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ operator: Operator | undefined; /** * @param subscribe The function that is called when the Observable is * initially subscribed to. This function is given a Subscriber, to which new values * can be `next`ed, or an `error` method can be called to raise an error, or * `complete` can be called to notify of a successful completion. */ constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic); /** * Creates a new Observable by calling the Observable constructor * @param subscribe the subscriber function to be passed to the Observable constructor * @return A new observable. * @deprecated Use `new Observable()` instead. Will be removed in v8. */ static create: (...args: any[]) => any; /** * Creates a new Observable, with this Observable instance as the source, and the passed * operator defined as the new observable's operator. * @param operator the operator defining the operation to take on the observable * @return A new observable with the Operator applied. * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. * If you have implemented an operator using `lift`, it is recommended that you create an * operator by simply returning `new Observable()` directly. See "Creating new operators from * scratch" section here: https://rxjs.dev/guide/operators */ lift(operator?: Operator): Observable; subscribe(observerOrNext?: Partial> | ((value: T) => void)): Subscription; /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */ subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription; /** * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with * APIs that expect promises, like `async/await`. You cannot unsubscribe from this. * * **WARNING**: Only use this with observables you *know* will complete. If the source * observable does not complete, you will end up with a promise that is hung up, and * potentially all of the state of an async function hanging out in memory. To avoid * this situation, look into adding something like {@link timeout}, {@link take}, * {@link takeWhile}, or {@link takeUntil} amongst others. * * #### Example * * ```ts * import { interval, take } from 'rxjs'; * * const source$ = interval(1000).pipe(take(4)); * * async function getTotal() { * let total = 0; * * await source$.forEach(value => { * total += value; * console.log('observable -> ' + value); * }); * * return total; * } * * getTotal().then( * total => console.log('Total: ' + total) * ); * * // Expected: * // 'observable -> 0' * // 'observable -> 1' * // 'observable -> 2' * // 'observable -> 3' * // 'Total: 6' * ``` * * @param next A handler for each value emitted by the observable. * @return A promise that either resolves on observable completion or * rejects with the handled error. */ forEach(next: (value: T) => void): Promise; /** * @param next a handler for each value emitted by the observable * @param promiseCtor a constructor function used to instantiate the Promise * @return a promise that either resolves on observable completion or * rejects with the handled error * @deprecated Passing a Promise constructor will no longer be available * in upcoming versions of RxJS. This is because it adds weight to the library, for very * little benefit. If you need this functionality, it is recommended that you either * polyfill Promise, or you create an adapter to convert the returned native promise * to whatever promise implementation you wanted. Will be removed in v8. */ forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise; pipe(): Observable; pipe(op1: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction, op9: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction, op9: OperatorFunction, ...operations: OperatorFunction[]): Observable; /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */ toPromise(): Promise; /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */ toPromise(PromiseCtor: typeof Promise): Promise; /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */ toPromise(PromiseCtor: PromiseConstructorLike): Promise; } //#endregion //#region src/types/index.d.ts type LogLevel = "error" | "warn" | "info" | "debug" | "verbose"; type LogFormat = "json" | "text" | "pino"; interface LogEntry { readonly level: LogLevel; readonly message: string; readonly timestamp: Date; readonly context?: string; readonly metadata?: Record; readonly trace?: string; readonly traceId?: string; readonly spanId?: string; } interface LogOptions { message: string; context?: string; metadata?: Record; trace?: string; traceId?: string; spanId?: string; } interface HttpRequest { readonly id: string; readonly method: string; readonly url: string; readonly query: Record; readonly params: Record; readonly headers: Record; readonly remoteAddress: string; readonly remotePort?: number; readonly body?: unknown; } interface HttpResponse { readonly statusCode: number; readonly headers: Record; } interface HttpRequestLogEntry { readonly level: number; readonly time: number; readonly pid: number; readonly hostname: string; readonly req: HttpRequest; readonly res: HttpResponse; readonly responseTime: number; readonly msg: string; readonly traceId?: string; readonly spanId?: string; } interface ExcludeOption { method: RequestMethod; path: string; } interface LoggerConfiguration { readonly level: LogLevel; readonly timestamp: boolean; readonly colors: boolean; readonly context?: string; readonly format: LogFormat; readonly sensitiveFields: readonly string[]; readonly exclude: readonly ExcludeOption[]; readonly logRequests?: boolean; } //#endregion //#region src/contracts/index.d.ts interface ILogger { log(options: LogOptions): void; error(options: LogOptions): void; warn(options: LogOptions): void; debug(options: LogOptions): void; verbose(options: LogOptions): void; logHttpRequest(entry: HttpRequestLogEntry): void; } interface ILogFormatter { format(entry: LogEntry): string; formatHttpRequest(entry: HttpRequestLogEntry): string; } interface ILogWriter { write(formattedLog: string, level?: LogLevel): void; } interface IContextResolver { resolve(): string; } interface IDataSanitizer { sanitize(data: unknown): unknown; } interface IRequestIdGenerator { generate(): string; } //#endregion //#region src/core/trace-context.service.d.ts declare class TraceContextService { /** * Sets trace-id for the current async context. * Affects all subsequent logs within the same request/async scope. */ setTraceId(traceId: string): void; /** * Returns the current trace-id from the async context. */ getTraceId(): string | undefined; /** * Runs a callback in a new isolated async context with the given trace-id. * Does not affect the parent context. */ runWithTraceId(traceId: string, fn: () => T): T; } //#endregion //#region src/core/logger.service.d.ts declare class LoggerService implements LoggerService$1, ILogger { private readonly config; private readonly formatter; private readonly writer; private readonly contextResolver; private readonly traceContextService; private context?; constructor(config: LoggerConfiguration, formatter: ILogFormatter, writer: ILogWriter, contextResolver: IContextResolver, traceContextService: TraceContextService); setContext(context: string): void; log(options: LogOptions): void; error(options: LogOptions): void; warn(options: LogOptions): void; debug(options: LogOptions): void; verbose(options: LogOptions): void; logHttpRequest(entry: HttpRequestLogEntry): void; private writeLog; private resolveTraceIds; } //#endregion //#region src/core/http-logger.interceptor.d.ts declare class HttpLoggerInterceptor implements NestInterceptor { private readonly logger; private readonly dataSanitizer; private readonly requestIdGenerator; private readonly config; private readonly reflector; private readonly hostname; private readonly pid; constructor(logger: LoggerService, dataSanitizer: IDataSanitizer, requestIdGenerator: IRequestIdGenerator, config: LoggerConfiguration, reflector: Reflector); intercept(context: ExecutionContext, next: CallHandler): Observable; private createHttpLogEntry; private createLogEntry; private getClientIp; private sanitizeHeaders; private getRequestMethod; private shouldExcludeRequest; private extractErrorMessage; private extractErrorTrace; } //#endregion //#region src/core/logger.di-tokens.d.ts declare const InjectLogger: (context?: string) => PropertyDecorator & ParameterDecorator; //#endregion //#region src/core/logger.module.d.ts interface LoggerModuleOptions { level?: "error" | "warn" | "info" | "debug" | "verbose"; timestamp?: boolean; colors?: boolean; context?: string; format?: "json" | "text" | "pino"; sensitiveFields?: string[]; exclude?: ExcludeOption[]; logRequests?: boolean; } declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: LoggerModuleOptions & Partial<{ global: boolean; }>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions & Partial<{ global: boolean; }>; declare class LoggerModule extends ConfigurableModuleClass implements NestModule { configure(consumer: MiddlewareConsumer): void; static forRoot(options?: typeof OPTIONS_TYPE): DynamicModule; static forRootAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule; private static readonly BASE_EXPORTS; private static createConfigProvider; private static createCoreProviders; private static createDynamicContextProviders; } //#endregion //#region src/constants/index.d.ts declare const LOGGER_CONTEXT_METADATA: unique symbol; declare const LOGGER_METADATA_METADATA: unique symbol; declare const LOGGER_EXCLUDE_METADATA: unique symbol; //#endregion //#region src/decorators/index.d.ts declare const LogContext: (context: string) => import("@nestjs/common").CustomDecorator; declare const LogMetadata: (metadata: Record) => import("@nestjs/common").CustomDecorator; declare const ExcludeLogging: () => import("@nestjs/common").CustomDecorator; //#endregion export { ExcludeLogging, HttpLoggerInterceptor, InjectLogger, LogContext, LogMetadata, LoggerModule, LoggerService, TraceContextService }; //# sourceMappingURL=index.d.mts.map