* Register the instance for the TriggerDev client asynchronously. * * 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
(
options: typeof ASYNC_OPTIONS_TYPE,
path: string = "/api/trigger",
customProviderToken: InjectionToken = TriggerClientRef
)
| 110 | * @param customProviderToken The token to use for the provider (default: {@link TriggerClientRef}) |
| 111 | */ |
| 112 | static registerAsync( |
| 113 | options: typeof ASYNC_OPTIONS_TYPE, |
| 114 | path: string = "/api/trigger", |
| 115 | customProviderToken: InjectionToken = TriggerClientRef |
| 116 | ): DynamicModule { |
| 117 | const { providers, ...rest } = ConfigurableModuleClass.registerAsync(options); |
| 118 | const controller = createControllerByPath(customProviderToken, path); |
| 119 | |
| 120 | return { |
| 121 | ...rest, |
| 122 | controllers: [controller], |
| 123 | providers: [ |
| 124 | ...(providers || []), |
| 125 | { |
| 126 | provide: customProviderToken, |
| 127 | inject: [MODULE_OPTIONS_TOKEN], |
| 128 | useFactory: (options: TriggerClientOptions) => { |
| 129 | return new TriggerClient(options); |
| 130 | }, |
| 131 | }, |
| 132 | ], |
| 133 | exports: [customProviderToken], |
| 134 | }; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /** |
no test coverage detected