-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.ts
48 lines (44 loc) · 1.18 KB
/
module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Annotator, Type, TypeDecorator } from '../utils/annotations';
import { Provider } from '@neoskop/injector';
import { Router } from 'express';
/**
* Type of NemModule decorator
*/
export interface NemModuleDecorator {
(obj? : NemModule) : TypeDecorator;
new (obj?: NemModule) : NemModule;
}
/**
* Type of NemModule metadata
* @see {@link NemModuleDecorator}
*/
export interface NemModule {
modules?: ([ string|RegExp, Type<any> | NemModuleWithProviders ] | Type<any> | NemModuleWithProviders)[];
providers?: Provider[];
middlewares?: (any|any[])[];
router?: [ string|RegExp, Router ][];
controller?: [ string|RegExp, Type<any>][];
}
export const NemModule : NemModuleDecorator = Annotator.makeCtorDecorator('NemModule', (options : NemModule) => options);
/**
* Type of module factory return value
* @example
* ```
*
* @NemModule()
* export class TestModule {
* static forValue(value : any) {
* return {
* nemModule: TestModule,
* providers: [
* { provide: 'VALUE', useValue: value }
* ]
* }
* }
* }
* ```
*/
export interface NemModuleWithProviders {
nemModule: Type<any>;
providers?: Provider[];
}