1 | import { ConfigurableModuleAsyncOptions } from './configurable-module-async-options.interface';
|
2 | import { ConfigurableModuleCls } from './configurable-module-cls.interface';
|
3 | /**
|
4 | * Configurable module host. See properties for more details
|
5 | *
|
6 | * @publicApi
|
7 | */
|
8 | export interface ConfigurableModuleHost<ModuleOptions = Record<string, unknown>, MethodKey extends string = string, FactoryClassMethodKey extends string = string, ExtraModuleDefinitionOptions = {}> {
|
9 | /**
|
10 | * Class that represents a blueprint/prototype for a configurable Nest module.
|
11 | * This class provides static methods for constructing dynamic modules. Their names
|
12 | * can be controlled through the "MethodKey" type argument.
|
13 | *
|
14 | * Your module class should inherit from this class to make the static methods available.
|
15 | *
|
16 | * @example
|
17 | * ```typescript
|
18 | * @Module({})
|
19 | * class IntegrationModule extends ConfigurableModuleCls {
|
20 | * // ...
|
21 | * }
|
22 | * ```
|
23 | */
|
24 | ConfigurableModuleClass: ConfigurableModuleCls<ModuleOptions, MethodKey, FactoryClassMethodKey, ExtraModuleDefinitionOptions>;
|
25 | /**
|
26 | * Module options provider token. Can be used to inject the "options object" to
|
27 | * providers registered within the host module.
|
28 | */
|
29 | MODULE_OPTIONS_TOKEN: string | symbol;
|
30 | /**
|
31 | * Can be used to auto-infer the compound "async module options" type.
|
32 | * Note: this property is not supposed to be used as a value.
|
33 | *
|
34 | * @example
|
35 | * ```typescript
|
36 | * @Module({})
|
37 | * class IntegrationModule extends ConfigurableModuleCls {
|
38 | * static module = initializer(IntegrationModule);
|
39 | *
|
40 | * static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule {
|
41 | * return super.registerAsync(options);
|
42 | * }
|
43 | * ```
|
44 | */
|
45 | ASYNC_OPTIONS_TYPE: ConfigurableModuleAsyncOptions<ModuleOptions, FactoryClassMethodKey> & Partial<ExtraModuleDefinitionOptions>;
|
46 | /**
|
47 | * Can be used to auto-infer the compound "module options" type (options interface + extra module definition options).
|
48 | * Note: this property is not supposed to be used as a value.
|
49 | *
|
50 | * @example
|
51 | * ```typescript
|
52 | * @Module({})
|
53 | * class IntegrationModule extends ConfigurableModuleCls {
|
54 | * static module = initializer(IntegrationModule);
|
55 | *
|
56 | * static register(options: typeof OPTIONS_TYPE): DynamicModule {
|
57 | * return super.register(options);
|
58 | * }
|
59 | * ```
|
60 | */
|
61 | OPTIONS_TYPE: ModuleOptions & Partial<ExtraModuleDefinitionOptions>;
|
62 | }
|