UNPKG

2.14 kBTypeScriptView Raw
1import { ExceptionFilter } from './exceptions/exception-filter.interface';
2import { CanActivate } from './features/can-activate.interface';
3import { NestInterceptor } from './features/nest-interceptor.interface';
4import { PipeTransform } from './features/pipe-transform.interface';
5import { INestApplicationContext } from './nest-application-context.interface';
6import { WebSocketAdapter } from './websockets/web-socket-adapter.interface';
7/**
8 * Interface describing Microservice Context.
9 *
10 * @publicApi
11 */
12export interface INestMicroservice extends INestApplicationContext {
13 /**
14 * Starts the microservice.
15 *
16 * @returns {void}
17 */
18 listen(): Promise<any>;
19 /**
20 * Starts the microservice (can be awaited).
21 * @deprecated use "listen" instead.
22 *
23 * @returns {Promise}
24 */
25 listenAsync(): Promise<any>;
26 /**
27 * Register Ws Adapter which will be used inside Gateways.
28 * Use when you want to override default `socket.io` library.
29 *
30 * @param {WebSocketAdapter} adapter
31 * @returns {this}
32 */
33 useWebSocketAdapter(adapter: WebSocketAdapter): this;
34 /**
35 * Registers exception filters as global filters (will be used within every message pattern handler)
36 *
37 * @param {...ExceptionFilter} filters
38 */
39 useGlobalFilters(...filters: ExceptionFilter[]): this;
40 /**
41 * Registers pipes as global pipes (will be used within every message pattern handler)
42 *
43 * @param {...PipeTransform} pipes
44 */
45 useGlobalPipes(...pipes: PipeTransform<any>[]): this;
46 /**
47 * Registers interceptors as global interceptors (will be used within every message pattern handler)
48 *
49 * @param {...NestInterceptor} interceptors
50 */
51 useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
52 /**
53 * Registers guards as global guards (will be used within every message pattern handler)
54 *
55 * @param {...CanActivate} guards
56 */
57 useGlobalGuards(...guards: CanActivate[]): this;
58 /**
59 * Terminates the application
60 *
61 * @returns {Promise<void>}
62 */
63 close(): Promise<void>;
64}