Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator';
import { groupBy } from 'lodash';
import { AmqpConnection } from './amqp/connection';
import { RABBIT_CONFIG_TOKEN, RABBIT_HANDLER } from './rabbitmq.constants';
import { RabbitHandlerConfig, RabbitMQConfig } from './rabbitmq.interfaces';
declare var placeholder: IConfigurableDynamicRootModule<
RabbitMQModule,
RabbitMQConfig
>;
@Module({
imports: [DiscoveryModule]
})
export class RabbitMQModule
extends createConfigurableDynamicRootModule(
RABBIT_CONFIG_TOKEN,
{
providers: [
{
provide: AmqpConnection,
useFactory: async (
config: RabbitMQConfig
): Promise => {
const connection = new AmqpConnection(config);
await connection.init();
const logger = new Logger(RabbitMQModule.name);
logger.log('Successfully connected to RabbitMQ');
return connection;
},
inject: [RABBIT_CONFIG_TOKEN]
}
import { createConfigurableDynamicRootModule } from '@golevelup/nestjs-modules';
import { Module } from '@nestjs/common';
import { CONFIG_MODULE_OPTIONS } from './config.constants';
import { ConfigService } from './config.service';
import { ConfigModuleOptions } from './interfaces/config-options.interface';
@Module({
providers: [ConfigService],
exports: [ConfigService],
})
export class ConfigModule extends createConfigurableDynamicRootModule<
ConfigModule,
ConfigModuleOptions
>(CONFIG_MODULE_OPTIONS) {
static Deferred = ConfigModule.externallyConfigured(ConfigModule, 0);
}
import { createConfigurableDynamicRootModule } from '@golevelup/nestjs-modules';
import { Module } from '@nestjs/common';
import { DATABASE_MODULE_OPTIONS } from './database.constants';
import { DatabaseModuleOptions } from './interfaces/database-options.interface';
@Module({
exports: [DATABASE_MODULE_OPTIONS],
})
export class DatabaseCoreModule extends createConfigurableDynamicRootModule<
DatabaseCoreModule,
DatabaseModuleOptions
>(DATABASE_MODULE_OPTIONS) {
static Deferred = DatabaseCoreModule.externallyConfigured(
DatabaseCoreModule,
500,
);
}