@velajs/vela 0.4.3 → 0.5.1
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/dist/cache/cache.module.d.ts +4 -1
- package/dist/cache/cache.module.js +51 -9
- package/dist/config/config.module.d.ts +4 -1
- package/dist/config/config.module.js +40 -3
- package/dist/config/config.types.d.ts +1 -0
- package/dist/constants.d.ts +8 -2
- package/dist/constants.js +6 -0
- package/dist/container/container.d.ts +2 -0
- package/dist/container/container.js +51 -16
- package/dist/container/decorators.d.ts +3 -1
- package/dist/container/decorators.js +27 -6
- package/dist/container/index.d.ts +4 -2
- package/dist/container/index.js +4 -2
- package/dist/container/mixin.d.ts +24 -0
- package/dist/container/mixin.js +26 -0
- package/dist/container/module-ref.d.ts +21 -0
- package/dist/container/module-ref.js +48 -0
- package/dist/container/types.d.ts +9 -3
- package/dist/container/types.js +9 -0
- package/dist/cors/cors.module.js +2 -2
- package/dist/errors/http-exception.d.ts +20 -20
- package/dist/errors/http-exception.js +47 -41
- package/dist/factory.js +11 -2
- package/dist/fetch/fetch.module.d.ts +6 -0
- package/dist/fetch/fetch.module.js +77 -0
- package/dist/fetch/fetch.service.d.ts +24 -0
- package/dist/fetch/fetch.service.js +145 -0
- package/dist/fetch/fetch.types.d.ts +24 -0
- package/dist/fetch/fetch.types.js +1 -0
- package/dist/fetch/index.d.ts +3 -0
- package/dist/fetch/index.js +2 -0
- package/dist/health/health.service.js +2 -2
- package/dist/http/decorators.d.ts +65 -0
- package/dist/http/decorators.js +91 -2
- package/dist/http/index.d.ts +3 -1
- package/dist/http/index.js +2 -1
- package/dist/http/middleware-consumer.d.ts +36 -0
- package/dist/http/middleware-consumer.js +71 -0
- package/dist/http/route.manager.d.ts +4 -0
- package/dist/http/route.manager.js +91 -6
- package/dist/http/types.d.ts +1 -0
- package/dist/index.d.ts +11 -6
- package/dist/index.js +7 -4
- package/dist/metadata.d.ts +1 -1
- package/dist/module/decorators.d.ts +1 -0
- package/dist/module/decorators.js +24 -8
- package/dist/module/index.d.ts +2 -2
- package/dist/module/index.js +1 -1
- package/dist/module/module-loader.d.ts +5 -1
- package/dist/module/module-loader.js +54 -10
- package/dist/module/types.d.ts +13 -3
- package/dist/pipeline/index.d.ts +3 -2
- package/dist/pipeline/index.js +1 -1
- package/dist/pipeline/pipes.d.ts +22 -0
- package/dist/pipeline/pipes.js +50 -0
- package/dist/pipeline/tokens.d.ts +1 -1
- package/dist/pipeline/tokens.js +1 -1
- package/dist/pipeline/types.d.ts +16 -0
- package/dist/registry/metadata.registry.d.ts +7 -6
- package/dist/registry/metadata.registry.js +13 -0
- package/dist/registry/types.d.ts +1 -0
- package/dist/schedule/schedule.module.d.ts +4 -1
- package/dist/schedule/schedule.module.js +39 -7
- package/dist/testing/testing.builder.js +5 -5
- package/dist/throttler/throttler.module.d.ts +2 -1
- package/dist/throttler/throttler.module.js +47 -9
- package/dist/validation/validation.pipe.js +1 -1
- package/package.json +1 -1
|
@@ -5,14 +5,18 @@ import { APP_GUARD } from "../pipeline/tokens.js";
|
|
|
5
5
|
import { ThrottlerGuard } from "./throttler.guard.js";
|
|
6
6
|
import { ThrottlerStorage } from "./throttler.storage.js";
|
|
7
7
|
import { THROTTLER_OPTIONS, THROTTLER_STORAGE } from "./throttler.tokens.js";
|
|
8
|
+
function makeThrottlerModuleClass() {
|
|
9
|
+
const moduleClass = class ThrottlerDynamicModule {
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(moduleClass, 'name', {
|
|
12
|
+
value: 'ThrottlerModule'
|
|
13
|
+
});
|
|
14
|
+
defineMetadata(METADATA_KEYS.MODULE, true, moduleClass);
|
|
15
|
+
return moduleClass;
|
|
16
|
+
}
|
|
8
17
|
export class ThrottlerModule {
|
|
9
18
|
static forRoot(options) {
|
|
10
|
-
const moduleClass =
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(moduleClass, 'name', {
|
|
13
|
-
value: 'ThrottlerModule'
|
|
14
|
-
});
|
|
15
|
-
defineMetadata(METADATA_KEYS.MODULE, true, moduleClass);
|
|
19
|
+
const moduleClass = makeThrottlerModuleClass();
|
|
16
20
|
MetadataRegistry.setModuleOptions(moduleClass, {
|
|
17
21
|
exports: [
|
|
18
22
|
THROTTLER_OPTIONS,
|
|
@@ -22,16 +26,50 @@ export class ThrottlerModule {
|
|
|
22
26
|
});
|
|
23
27
|
const providers = [
|
|
24
28
|
{
|
|
25
|
-
|
|
29
|
+
provide: THROTTLER_OPTIONS,
|
|
26
30
|
useValue: options
|
|
27
31
|
},
|
|
28
32
|
{
|
|
29
|
-
|
|
33
|
+
provide: THROTTLER_STORAGE,
|
|
30
34
|
useValue: options.storage ?? new ThrottlerStorage()
|
|
31
35
|
},
|
|
32
36
|
ThrottlerGuard,
|
|
33
37
|
{
|
|
34
|
-
|
|
38
|
+
provide: APP_GUARD,
|
|
39
|
+
useExisting: ThrottlerGuard
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
return {
|
|
43
|
+
module: moduleClass,
|
|
44
|
+
providers
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static forRootAsync(options) {
|
|
48
|
+
const moduleClass = makeThrottlerModuleClass();
|
|
49
|
+
MetadataRegistry.setModuleOptions(moduleClass, {
|
|
50
|
+
imports: options.imports ?? [],
|
|
51
|
+
exports: [
|
|
52
|
+
THROTTLER_OPTIONS,
|
|
53
|
+
THROTTLER_STORAGE,
|
|
54
|
+
ThrottlerGuard
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
const providers = [
|
|
58
|
+
{
|
|
59
|
+
provide: THROTTLER_OPTIONS,
|
|
60
|
+
useFactory: options.useFactory,
|
|
61
|
+
inject: options.inject ?? []
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
provide: THROTTLER_STORAGE,
|
|
65
|
+
useFactory: (opts)=>opts.storage ?? new ThrottlerStorage(),
|
|
66
|
+
inject: [
|
|
67
|
+
THROTTLER_OPTIONS
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
ThrottlerGuard,
|
|
71
|
+
{
|
|
72
|
+
provide: APP_GUARD,
|
|
35
73
|
useExisting: ThrottlerGuard
|
|
36
74
|
}
|
|
37
75
|
];
|
|
@@ -7,7 +7,7 @@ export class ValidationPipe {
|
|
|
7
7
|
return metatype.schema.parse(value);
|
|
8
8
|
} catch (error) {
|
|
9
9
|
if (error && typeof error === 'object' && 'issues' in error && Array.isArray(error.issues)) {
|
|
10
|
-
throw new BadRequestException(
|
|
10
|
+
throw new BadRequestException({
|
|
11
11
|
statusCode: 400,
|
|
12
12
|
message: 'Validation failed',
|
|
13
13
|
errors: error.issues
|