UNPKG

1.97 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 * Register Ws Adapter which will be used inside Gateways.
21 * Use when you want to override default `socket.io` library.
22 *
23 * @param {WebSocketAdapter} adapter
24 * @returns {this}
25 */
26 useWebSocketAdapter(adapter: WebSocketAdapter): this;
27 /**
28 * Registers exception filters as global filters (will be used within every message pattern handler)
29 *
30 * @param {...ExceptionFilter} filters
31 */
32 useGlobalFilters(...filters: ExceptionFilter[]): this;
33 /**
34 * Registers pipes as global pipes (will be used within every message pattern handler)
35 *
36 * @param {...PipeTransform} pipes
37 */
38 useGlobalPipes(...pipes: PipeTransform<any>[]): this;
39 /**
40 * Registers interceptors as global interceptors (will be used within every message pattern handler)
41 *
42 * @param {...NestInterceptor} interceptors
43 */
44 useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
45 /**
46 * Registers guards as global guards (will be used within every message pattern handler)
47 *
48 * @param {...CanActivate} guards
49 */
50 useGlobalGuards(...guards: CanActivate[]): this;
51 /**
52 * Terminates the application
53 *
54 * @returns {Promise<void>}
55 */
56 close(): Promise<void>;
57}