Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce extra providers for for root async #2428

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/bull/lib/bull.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ export class BullModule {
global: true,
module: BullModule,
imports,
providers,
providers: asyncSharedBullConfig.extraProviders
? [...providers, ...asyncSharedBullConfig.extraProviders]
: providers,
exports: providers,
};
}
Expand Down
13 changes: 11 additions & 2 deletions packages/bull/lib/interfaces/shared-bull-config.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { FactoryProvider, ModuleMetadata, Type } from '@nestjs/common';
import * as Bull from 'bull';
import {
FactoryProvider,
ModuleMetadata,
Provider,
Type,
} from '@nestjs/common';
import { BullRootModuleOptions } from './bull-module-options.interface';

export interface SharedBullConfigurationFactory {
Expand Down Expand Up @@ -31,4 +35,9 @@ export interface SharedBullAsyncConfiguration
* Optional list of providers to be injected into the context of the Factory function.
*/
inject?: FactoryProvider['inject'];

/**
* Extra providers to be registered in the module context.
*/
extraProviders?: Provider[];
}
4 changes: 3 additions & 1 deletion packages/bullmq/lib/bull.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export class BullModule {
global: true,
module: BullModule,
imports,
providers,
providers: asyncSharedBullConfig.extraProviders
? [...providers, ...asyncSharedBullConfig.extraProviders]
: providers,
exports: providers,
};
}
Expand Down
12 changes: 11 additions & 1 deletion packages/bullmq/lib/interfaces/shared-bull-config.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { FactoryProvider, ModuleMetadata, Type } from '@nestjs/common';
import {
FactoryProvider,
ModuleMetadata,
Provider,
Type,
} from '@nestjs/common';
import * as Bull from 'bullmq';

export interface BullModuleExtraOptions {
Expand Down Expand Up @@ -47,4 +52,9 @@ export interface SharedBullAsyncConfiguration
* Extra options for the Bull module.
*/
extraOptions?: BullModuleExtraOptions;

/**
* Extra providers to be registered in the module context.
*/
extraProviders?: Provider[];
}