UNPKG

@nestjstools/messaging-bootstrap

Version:

A lightweight NestJS utility to bootstrap messaging-based apps with HTTP and microservice modes, built on top of @nestjstools/messaging.

25 lines (24 loc) 1.53 kB
import { MicroserviceOptions } from '@nestjs/microservices'; import { DynamicModule, ForwardReference, INestApplication, INestMicroservice, NestApplicationOptions, Type } from '@nestjs/common'; import { MessagingModuleOptions } from '@nestjstools/messaging/lib/config'; import { AbstractHttpAdapter } from '@nestjs/core/adapters/http-adapter'; import { NestMicroserviceOptions } from '@nestjs/common/interfaces/microservices/nest-microservice-options.interface'; type IEntryNestModule = Type<any> | DynamicModule | ForwardReference | Promise<IEntryNestModule>; type Config = Omit<MessagingModuleOptions, 'global'>; export type MessagingModuleConfig = Config & { extensions?: IEntryNestModule[]; }; export interface MessagingOptions { messaging?: MessagingModuleConfig; } export interface MicroserviceMessagingOptions extends MessagingOptions { nestMicroserviceOptions?: NestMicroserviceOptions & MicroserviceOptions; } export interface MessagingNestServerOptions extends MessagingOptions { nestApplicationOptions?: NestApplicationOptions; } export declare class MessagingBootstrap { static createNestMicroserviceWithMessagingConsumer<T extends object>(module: IEntryNestModule, options?: MicroserviceMessagingOptions & T): Promise<INestMicroservice>; static createNestApplicationWithMessaging<T extends INestApplication = INestApplication>(module: IEntryNestModule, httpAdapterOrOptions?: AbstractHttpAdapter | MessagingNestServerOptions, maybeOptions?: MessagingNestServerOptions): Promise<T>; } export {};