1 | import { ShutdownSignal } from '../enums/shutdown-signal.enum';
|
2 | import { LoggerService, LogLevel } from '../services/logger.service';
|
3 | import { Abstract } from './abstract.interface';
|
4 | import { DynamicModule } from './modules';
|
5 | import { Type } from './type.interface';
|
6 | /**
|
7 | * Interface defining NestApplicationContext.
|
8 | *
|
9 | * @publicApi
|
10 | */
|
11 | export interface INestApplicationContext {
|
12 | /**
|
13 | * Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module.
|
14 | * @returns {INestApplicationContext}
|
15 | */
|
16 | select<T>(module: Type<T> | DynamicModule): INestApplicationContext;
|
17 | /**
|
18 | * Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
19 | * @returns {TResult}
|
20 | */
|
21 | get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol, options?: {
|
22 | strict: boolean;
|
23 | }): TResult;
|
24 | /**
|
25 | * Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.
|
26 | * @returns {Promise<TResult>}
|
27 | */
|
28 | resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol, contextId?: {
|
29 | id: number;
|
30 | }, options?: {
|
31 | strict: boolean;
|
32 | }): Promise<TResult>;
|
33 | /**
|
34 | * Registers the request/context object for a given context ID (DI container sub-tree).
|
35 | * @returns {void}
|
36 | */
|
37 | registerRequestByContextId<T = any>(request: T, contextId: {
|
38 | id: number;
|
39 | }): void;
|
40 | /**
|
41 | * Terminates the application
|
42 | * @returns {Promise<void>}
|
43 | */
|
44 | close(): Promise<void>;
|
45 | /**
|
46 | * Sets custom logger service
|
47 | * @returns {void}
|
48 | */
|
49 | useLogger(logger: LoggerService | LogLevel[] | false): void;
|
50 | /**
|
51 | * Prints buffered logs and detaches buffer.
|
52 | * @returns {void}
|
53 | */
|
54 | flushLogs(): void;
|
55 | /**
|
56 | * Enables the usage of shutdown hooks. Will call the
|
57 | * `onApplicationShutdown` function of a provider if the
|
58 | * process receives a shutdown signal.
|
59 | *
|
60 | * @returns {this} The Nest application context instance
|
61 | */
|
62 | enableShutdownHooks(signals?: ShutdownSignal[] | string[]): this;
|
63 | /**
|
64 | * Initalizes the Nest application.
|
65 | * Calls the Nest lifecycle events.
|
66 | * It isn't mandatory to call this method directly.
|
67 | *
|
68 | * @returns {Promise<this>} The NestApplicationContext instance as Promise
|
69 | */
|
70 | init(): Promise<this>;
|
71 | }
|