@albertoielpo/ielpify 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -4
- package/dist/cjs/decorators/injectable.decorator.d.ts +4 -4
- package/dist/cjs/decorators/injectable.decorator.d.ts.map +1 -1
- package/dist/cjs/decorators/injectable.decorator.js +1 -1
- package/dist/cjs/decorators/injectable.decorator.js.map +1 -1
- package/dist/cjs/decorators/timeout.decorator.d.ts.map +1 -1
- package/dist/cjs/decorators/timeout.decorator.js.map +1 -1
- package/dist/esm/decorators/injectable.decorator.d.ts +4 -4
- package/dist/esm/decorators/injectable.decorator.d.ts.map +1 -1
- package/dist/esm/decorators/injectable.decorator.js +1 -1
- package/dist/esm/decorators/injectable.decorator.js.map +1 -1
- package/dist/esm/decorators/timeout.decorator.d.ts.map +1 -1
- package/dist/esm/decorators/timeout.decorator.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @albertoielpo/ielpify
|
|
2
2
|
|
|
3
|
-
TypeScript decorators for Fastify: controllers, routing, and simple dependency injection.
|
|
3
|
+
TypeScript decorators for Fastify: controllers, routing, scheduling, and simple dependency injection.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -19,14 +19,122 @@ npm install reflect-metadata fastify # peer dependencies
|
|
|
19
19
|
### Dependency Injection
|
|
20
20
|
|
|
21
21
|
- `@Injectable()` - Mark a class as a singleton service
|
|
22
|
-
- `@Inject(ServiceClass)` - Inject a dependency
|
|
22
|
+
- `@Inject(ServiceClass)` - Inject a singleton dependency into a constructor parameter
|
|
23
23
|
|
|
24
|
-
###
|
|
24
|
+
### Scheduling
|
|
25
25
|
|
|
26
|
-
-
|
|
26
|
+
- `@Timeout(options)` - Schedule a method to run after a delay, optionally repeating
|
|
27
|
+
|
|
28
|
+
## API Reference
|
|
29
|
+
|
|
30
|
+
### Routing functions
|
|
31
|
+
|
|
32
|
+
#### `registerController(fastify, ControllerClass)`
|
|
33
|
+
|
|
34
|
+
Registers a controller with a Fastify instance. Creates the controller instance (with DI) and sets up all routes.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
registerController(fastify, HomeController);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### `getControllerInstances()`
|
|
41
|
+
|
|
42
|
+
Returns all registered controller instances. Useful for applying lifecycle operations such as `startTimeouts`.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const instances = getControllerInstances();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Dependency Injection functions
|
|
49
|
+
|
|
50
|
+
#### `resolveService(ServiceClass)`
|
|
51
|
+
|
|
52
|
+
Resolves a singleton service from the DI container. Creates the instance on first call, then returns the same instance on subsequent calls. Throws if the class is not decorated with `@Injectable()`.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const service = resolveService(MyService);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### `registerService(ServiceClass)`
|
|
59
|
+
|
|
60
|
+
Manually registers a service in the DI container (alias for `resolveService` that discards the return value).
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
registerService(MyService);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### `createWithInjection(TargetClass)`
|
|
67
|
+
|
|
68
|
+
Creates an instance of a class with all `@Inject()`-decorated constructor parameters resolved automatically.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const instance = createWithInjection(MyClass);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### `isInjectable(TargetClass)`
|
|
75
|
+
|
|
76
|
+
Returns `true` if the class is decorated with `@Injectable()`.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
if (isInjectable(MyService)) { ... }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### `getContainerInstances()`
|
|
83
|
+
|
|
84
|
+
Returns all service instances currently stored in the DI container. Useful for applying lifecycle operations such as `startTimeouts`.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const instances = getContainerInstances();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Scheduling functions
|
|
91
|
+
|
|
92
|
+
#### `startTimeouts(instance)`
|
|
93
|
+
|
|
94
|
+
Starts all `@Timeout`-decorated methods on a given instance. Call this after all controllers and services are registered.
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
[...getControllerInstances(), ...getContainerInstances()].forEach(startTimeouts);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### `TimeoutOptions`
|
|
101
|
+
|
|
102
|
+
| Property | Type | Default | Description |
|
|
103
|
+
|----------|----------|---------|--------------------------------------------------|
|
|
104
|
+
| `ms` | `number` | — | Delay in milliseconds between each execution |
|
|
105
|
+
| `times` | `number` | `1` | Number of executions. Use `-1` for infinite loop |
|
|
27
106
|
|
|
28
107
|
## Example
|
|
29
108
|
|
|
109
|
+
```ts
|
|
110
|
+
import { Injectable, Injectable, Inject, Timeout } from "@albertoielpo/ielpify";
|
|
111
|
+
|
|
112
|
+
@Injectable()
|
|
113
|
+
class MyService {
|
|
114
|
+
@Timeout({ ms: 5000, times: 3 })
|
|
115
|
+
poll() {
|
|
116
|
+
console.log("polling...");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@Controller("hello")
|
|
121
|
+
class HelloController {
|
|
122
|
+
constructor(
|
|
123
|
+
@Inject(MyService) private myService: MyService
|
|
124
|
+
) {}
|
|
125
|
+
|
|
126
|
+
@Get("world")
|
|
127
|
+
helloWorld(req: FastifyRequest, res: FastifyReply) {
|
|
128
|
+
return res.send({ message: "Hello, world!" });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const fastify = Fastify();
|
|
133
|
+
registerController(fastify, HelloController);
|
|
134
|
+
[...getControllerInstances(), ...getContainerInstances()].forEach(startTimeouts);
|
|
135
|
+
fastify.listen({ port: 3000 });
|
|
136
|
+
```
|
|
137
|
+
|
|
30
138
|
See the [example/](./example) folder for a complete working demo.
|
|
31
139
|
|
|
32
140
|
```bash
|
|
@@ -10,13 +10,13 @@ export declare function Injectable(): ClassDecorator;
|
|
|
10
10
|
* @param target - The class to check
|
|
11
11
|
* @returns True if the class is injectable, false otherwise
|
|
12
12
|
*/
|
|
13
|
-
export declare function isInjectable(target: new () => object): boolean;
|
|
13
|
+
export declare function isInjectable(target: new (...args: any[]) => object): boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Registers a service in the DI container.
|
|
16
16
|
* If the service is not already registered, it will be instantiated.
|
|
17
17
|
* @param serviceClass - The service class to register
|
|
18
18
|
*/
|
|
19
|
-
export declare function registerService<T extends object>(serviceClass: new () => T): void;
|
|
19
|
+
export declare function registerService<T extends object>(serviceClass: new (...args: any[]) => T): void;
|
|
20
20
|
/**
|
|
21
21
|
* Resolves a service from the DI container.
|
|
22
22
|
* Creates a new instance if the service is not already registered.
|
|
@@ -24,13 +24,13 @@ export declare function registerService<T extends object>(serviceClass: new () =
|
|
|
24
24
|
* @returns The singleton instance of the service
|
|
25
25
|
* @throws Error if the class is not decorated with @Injectable()
|
|
26
26
|
*/
|
|
27
|
-
export declare function resolveService<T extends object>(serviceClass: new () => T): T;
|
|
27
|
+
export declare function resolveService<T extends object>(serviceClass: new (...args: any[]) => T): T;
|
|
28
28
|
/**
|
|
29
29
|
* Marks a constructor parameter for dependency injection.
|
|
30
30
|
* @param serviceClass - The service class to inject
|
|
31
31
|
* @returns A parameter decorator
|
|
32
32
|
*/
|
|
33
|
-
export declare function Inject(serviceClass: new () => object): ParameterDecorator;
|
|
33
|
+
export declare function Inject(serviceClass: new (...args: any[]) => object): ParameterDecorator;
|
|
34
34
|
/**
|
|
35
35
|
* Creates an instance of a class with its dependencies automatically injected.
|
|
36
36
|
* @param targetClass - The class to instantiate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectable.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"injectable.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,OAAO,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC5C,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACxC,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC3C,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACxC,CAAC,CAUH;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAClB,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAC7C,kBAAkB,CAOpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAChD,WAAW,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACvC,CAAC,CAWH;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD"}
|
|
@@ -50,7 +50,7 @@ function resolveService(serviceClass) {
|
|
|
50
50
|
throw new Error(`${serviceClass.name} is not injectable. Add @Injectable() decorator.`);
|
|
51
51
|
}
|
|
52
52
|
if (!container.has(serviceClass)) {
|
|
53
|
-
container.set(serviceClass,
|
|
53
|
+
container.set(serviceClass, createWithInjection(serviceClass));
|
|
54
54
|
}
|
|
55
55
|
return container.get(serviceClass);
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectable.decorator.js","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":";;AAYA,gCAIC;AAOD,oCAEC;AAOD,0CAIC;AASD,
|
|
1
|
+
{"version":3,"file":"injectable.decorator.js","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":";;AAYA,gCAIC;AAOD,oCAEC;AAOD,0CAIC;AASD,wCAYC;AAOD,wBASC;AAOD,kDAaC;AAOD,sDAEC;AAtGD,4CAA4C;AAC5C,MAAM,SAAS,GAAG,IAAI,GAAG,EAA0C,CAAC;AAEpE,iDAAiD;AACjD,MAAM,mBAAmB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,SAAgB,UAAU;IACtB,OAAO,CAAC,MAAM,EAAE,EAAE;QACd,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,MAAsC;IAC/D,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAC3B,YAAuC;IAEvC,cAAc,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAC1B,YAAuC;IAEvC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACX,GAAG,YAAY,CAAC,IAAI,kDAAkD,CACzE,CAAC;IACN,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;Q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MAAM,cAAc,GAAG;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"timeout.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,CAYhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CA0BpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.decorator.js","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":";;AA2BA,
|
|
1
|
+
{"version":3,"file":"timeout.decorator.js","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":";;AA2BA,0BAYC;AAOD,sCA0BC;AA1DD,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAO3C;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC3C,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,UAA8B,EAAE,EAAE;QAC3D,MAAM,gBAAgB,GAClB,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACpE,gBAAgB,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,cAAc,CAClB,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,CAAC,WAAW,CACrB,CAAC;QACF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAAgB;IAC1C,MAAM,QAAQ,GACV,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAEtE,KAAK,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAI,QAA6C,CACzD,WAAW,CACd,CAAC;QACF,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;YACjC,IAAI,cAAc,GAAG,CAAC,CAAC;YAEvB,MAAM,OAAO,GAAG,GAAG,EAAE;gBACjB,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,cAAc,GAAG,KAAK,EAAE,CAAC;oBACzC,cAAc,EAAE,CAAC;oBACjB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAEtB,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,cAAc,GAAG,KAAK,EAAE,CAAC;wBACzC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;oBACpC,CAAC;gBACL,CAAC;YACL,CAAC,CAAC;YAEF,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -10,13 +10,13 @@ export declare function Injectable(): ClassDecorator;
|
|
|
10
10
|
* @param target - The class to check
|
|
11
11
|
* @returns True if the class is injectable, false otherwise
|
|
12
12
|
*/
|
|
13
|
-
export declare function isInjectable(target: new () => object): boolean;
|
|
13
|
+
export declare function isInjectable(target: new (...args: any[]) => object): boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Registers a service in the DI container.
|
|
16
16
|
* If the service is not already registered, it will be instantiated.
|
|
17
17
|
* @param serviceClass - The service class to register
|
|
18
18
|
*/
|
|
19
|
-
export declare function registerService<T extends object>(serviceClass: new () => T): void;
|
|
19
|
+
export declare function registerService<T extends object>(serviceClass: new (...args: any[]) => T): void;
|
|
20
20
|
/**
|
|
21
21
|
* Resolves a service from the DI container.
|
|
22
22
|
* Creates a new instance if the service is not already registered.
|
|
@@ -24,13 +24,13 @@ export declare function registerService<T extends object>(serviceClass: new () =
|
|
|
24
24
|
* @returns The singleton instance of the service
|
|
25
25
|
* @throws Error if the class is not decorated with @Injectable()
|
|
26
26
|
*/
|
|
27
|
-
export declare function resolveService<T extends object>(serviceClass: new () => T): T;
|
|
27
|
+
export declare function resolveService<T extends object>(serviceClass: new (...args: any[]) => T): T;
|
|
28
28
|
/**
|
|
29
29
|
* Marks a constructor parameter for dependency injection.
|
|
30
30
|
* @param serviceClass - The service class to inject
|
|
31
31
|
* @returns A parameter decorator
|
|
32
32
|
*/
|
|
33
|
-
export declare function Inject(serviceClass: new () => object): ParameterDecorator;
|
|
33
|
+
export declare function Inject(serviceClass: new (...args: any[]) => object): ParameterDecorator;
|
|
34
34
|
/**
|
|
35
35
|
* Creates an instance of a class with its dependencies automatically injected.
|
|
36
36
|
* @param targetClass - The class to instantiate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectable.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"injectable.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,OAAO,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC5C,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACxC,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC3C,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACxC,CAAC,CAUH;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAClB,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAC7C,kBAAkB,CAOpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAChD,WAAW,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACvC,CAAC,CAWH;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD"}
|
|
@@ -50,7 +50,7 @@ function resolveService(serviceClass) {
|
|
|
50
50
|
throw new Error(`${serviceClass.name} is not injectable. Add @Injectable() decorator.`);
|
|
51
51
|
}
|
|
52
52
|
if (!container.has(serviceClass)) {
|
|
53
|
-
container.set(serviceClass,
|
|
53
|
+
container.set(serviceClass, createWithInjection(serviceClass));
|
|
54
54
|
}
|
|
55
55
|
return container.get(serviceClass);
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectable.decorator.js","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":";;AAYA,gCAIC;AAOD,oCAEC;AAOD,0CAIC;AASD,
|
|
1
|
+
{"version":3,"file":"injectable.decorator.js","sourceRoot":"","sources":["../../../src/decorators/injectable.decorator.ts"],"names":[],"mappings":";;AAYA,gCAIC;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AAI,GAAG,EAAE,CAAC;QAC3D,kBAAkB,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QACrD,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAC/B,WAAsC;IAEtC,MAAM,UAAU,GACZ,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IAEhE,8CAA8C;IAC9C,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,UAAU,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB;IACjC,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"timeout.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,CAYhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CA0BpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.decorator.js","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":";;AA2BA,
|
|
1
|
+
{"version":3,"file":"timeout.decorator.js","sourceRoot":"","sources":["../../../src/decorators/timeout.decorator.ts"],"names":[],"mappings":";;AA2BA,0BAYC;AAOD,sCA0BC;AA1DD,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAO3C;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC3C,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,UAA8B,EAAE,EAAE;QAC3D,MAAM,gBAAgB,GAClB,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACpE,gBAAgB,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,cAAc,CAClB,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,CAAC,WAAW,CACrB,CAAC;QACF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAAgB;IAC1C,MAAM,QAAQ,GACV,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAEtE,KAAK,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC9C,MAAM,MAAM,G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