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