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

Proposal: Expose isGlobal field #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions lib/agenda.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ export class AgendaService extends Agenda {}
export class AgendaModule {
static register(options: AgendaModuleOptions): DynamicModule {
return {
isGlobal: options.isGlobal,
module: AgendaModule,
providers: createAgendaProvider(options),
};
}

static registerAsync(options: AgendaModuleAsyncOptions): DynamicModule {
return {
isGlobal: options.isGlobal,
module: AgendaModule,
imports: options.imports || [],
providers: this.createAsyncProviders(options),
Expand Down
5 changes: 4 additions & 1 deletion lib/interfaces/agenda-module-options.interface.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import * as Agenda from 'agenda';

export interface AgendaModuleOptions extends Agenda.AgendaConfiguration {}
export interface AgendaModuleOptions extends Agenda.AgendaConfiguration {
isGlobal: boolean,
}

export interface AgendaOptionsFactory {
createAgendaOptions(): Promise<AgendaModuleOptions> | AgendaModuleOptions;
}

export interface AgendaModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
isGlobal: boolean,
useExisting?: Type<AgendaOptionsFactory>;
useClass?: Type<AgendaOptionsFactory>;
useFactory?: (...args: any[]) => Promise<AgendaModuleOptions> | AgendaModuleOptions;
Expand Down