* Register the instance for the TriggerDev client. * * Hint: If you want to have multiple instances of the client, you can use the `customProviderToken` to create multiple instances. * * @param options The options to use for the client * @param path The path to use for the controller
(
options: typeof OPTIONS_TYPE,
path: string = "/api/trigger",
customProviderToken: InjectionToken = TriggerClientRef
)
| 76 | * @param customProviderToken The token to use for the provider (default: {@link TriggerClientRef}) |
| 77 | */ |
| 78 | static register( |
| 79 | options: typeof OPTIONS_TYPE, |
| 80 | path: string = "/api/trigger", |
| 81 | customProviderToken: InjectionToken = TriggerClientRef |
| 82 | ): DynamicModule { |
| 83 | const { providers, ...rest } = ConfigurableModuleClass.register(options); |
| 84 | const controller = createControllerByPath(customProviderToken, path); |
| 85 | |
| 86 | return { |
| 87 | ...rest, |
| 88 | controllers: [controller], |
| 89 | providers: [ |
| 90 | ...(providers || []), |
| 91 | { |
| 92 | provide: customProviderToken, |
| 93 | inject: [MODULE_OPTIONS_TOKEN], |
| 94 | useFactory: (options: TriggerClientOptions) => { |
| 95 | return new TriggerClient(options); |
| 96 | }, |
| 97 | }, |
| 98 | ], |
| 99 | exports: [customProviderToken], |
| 100 | }; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Register the instance for the TriggerDev client asynchronously. |
no test coverage detected