@tsed/platform-middlewares 7.3.1 → 7.4.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/lib/cjs/domain/PlatformMiddlewareSettings.js.map +1 -1
- package/lib/cjs/utils/getMiddlewaresForHook.js +1 -16
- package/lib/cjs/utils/getMiddlewaresForHook.js.map +1 -1
- package/lib/esm/domain/PlatformMiddlewareSettings.js.map +1 -1
- package/lib/esm/utils/getMiddlewaresForHook.js +1 -16
- package/lib/esm/utils/getMiddlewaresForHook.js.map +1 -1
- package/lib/types/domain/PlatformMiddlewareSettings.d.ts +3 -2
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformMiddlewareSettings.js","sourceRoot":"","sources":["../../../src/domain/PlatformMiddlewareSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Env, Type} from \"@tsed/core\";\n\nexport type PlatformMiddlewareLoadingOptions = {env?: Env; use: Function | Type<any
|
|
1
|
+
{"version":3,"file":"PlatformMiddlewareSettings.js","sourceRoot":"","sources":["../../../src/domain/PlatformMiddlewareSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Env, Type} from \"@tsed/core\";\n\nexport type PlatformMiddlewareLoadingOptions = {env?: Env; use: Function | Type<any> | string; hook?: string; options?: any};\nexport type PlatformMiddlewareSettings = Function | Type<any> | PlatformMiddlewareLoadingOptions | string | any;\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n /**\n * Load middlewares on the $beforeRoutesInit hook (or on the specified hook event name).\n */\n middlewares: PlatformMiddlewareSettings[];\n }\n }\n}\n"]}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMiddlewaresForHook = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
4
|
function getMiddlewaresForHook(hook, settings, defaultHook = "") {
|
|
6
5
|
const env = settings.env;
|
|
7
6
|
const middlewares = settings.get("middlewares", []);
|
|
8
|
-
return middlewares
|
|
9
|
-
.map((middleware) => {
|
|
10
|
-
return (0, core_1.isFunction)(middleware)
|
|
11
|
-
? {
|
|
12
|
-
env,
|
|
13
|
-
hook: defaultHook,
|
|
14
|
-
use: middleware
|
|
15
|
-
}
|
|
16
|
-
: {
|
|
17
|
-
env,
|
|
18
|
-
hook: defaultHook,
|
|
19
|
-
...middleware
|
|
20
|
-
};
|
|
21
|
-
})
|
|
22
|
-
.filter((options) => options.use && options.env === env && options.hook === hook);
|
|
7
|
+
return middlewares.filter((options) => options.use && options.env === env && options.hook === hook);
|
|
23
8
|
}
|
|
24
9
|
exports.getMiddlewaresForHook = getMiddlewaresForHook;
|
|
25
10
|
//# sourceMappingURL=getMiddlewaresForHook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CAAC,IAAY,EAAE,QAAyB,EAAE,WAAW,GAAG,EAAE;IAC7F,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IACzB,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAqC,aAAa,EAAE,EAAE,CAAC,CAAC;IAExF,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtG,CAAC;AALD,sDAKC","sourcesContent":["import {DIConfiguration} from \"@tsed/di\";\nimport {PlatformMiddlewareLoadingOptions} from \"../domain/PlatformMiddlewareSettings\";\n\nexport function getMiddlewaresForHook(hook: string, settings: DIConfiguration, defaultHook = \"\") {\n const env = settings.env;\n const middlewares = settings.get<PlatformMiddlewareLoadingOptions[]>(\"middlewares\", []);\n\n return middlewares.filter((options) => options.use && options.env === env && options.hook === hook);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformMiddlewareSettings.js","sourceRoot":"","sources":["../../../src/domain/PlatformMiddlewareSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Env, Type} from \"@tsed/core\";\n\nexport type PlatformMiddlewareLoadingOptions = {env?: Env; use: Function | Type<any
|
|
1
|
+
{"version":3,"file":"PlatformMiddlewareSettings.js","sourceRoot":"","sources":["../../../src/domain/PlatformMiddlewareSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Env, Type} from \"@tsed/core\";\n\nexport type PlatformMiddlewareLoadingOptions = {env?: Env; use: Function | Type<any> | string; hook?: string; options?: any};\nexport type PlatformMiddlewareSettings = Function | Type<any> | PlatformMiddlewareLoadingOptions | string | any;\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n /**\n * Load middlewares on the $beforeRoutesInit hook (or on the specified hook event name).\n */\n middlewares: PlatformMiddlewareSettings[];\n }\n }\n}\n"]}
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import { isFunction } from "@tsed/core";
|
|
2
1
|
export function getMiddlewaresForHook(hook, settings, defaultHook = "") {
|
|
3
2
|
const env = settings.env;
|
|
4
3
|
const middlewares = settings.get("middlewares", []);
|
|
5
|
-
return middlewares
|
|
6
|
-
.map((middleware) => {
|
|
7
|
-
return isFunction(middleware)
|
|
8
|
-
? {
|
|
9
|
-
env,
|
|
10
|
-
hook: defaultHook,
|
|
11
|
-
use: middleware
|
|
12
|
-
}
|
|
13
|
-
: {
|
|
14
|
-
env,
|
|
15
|
-
hook: defaultHook,
|
|
16
|
-
...middleware
|
|
17
|
-
};
|
|
18
|
-
})
|
|
19
|
-
.filter((options) => options.use && options.env === env && options.hook === hook);
|
|
4
|
+
return middlewares.filter((options) => options.use && options.env === env && options.hook === hook);
|
|
20
5
|
}
|
|
21
6
|
//# sourceMappingURL=getMiddlewaresForHook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAAyB,EAAE,WAAW,GAAG,EAAE;IAC7F,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IACzB,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAqC,aAAa,EAAE,EAAE,CAAC,CAAC;IAExF,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtG,CAAC","sourcesContent":["import {DIConfiguration} from \"@tsed/di\";\nimport {PlatformMiddlewareLoadingOptions} from \"../domain/PlatformMiddlewareSettings\";\n\nexport function getMiddlewaresForHook(hook: string, settings: DIConfiguration, defaultHook = \"\") {\n const env = settings.env;\n const middlewares = settings.get<PlatformMiddlewareLoadingOptions[]>(\"middlewares\", []);\n\n return middlewares.filter((options) => options.use && options.env === env && options.hook === hook);\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Env, Type } from "@tsed/core";
|
|
2
2
|
export declare type PlatformMiddlewareLoadingOptions = {
|
|
3
3
|
env?: Env;
|
|
4
|
-
use: Function | Type<any
|
|
4
|
+
use: Function | Type<any> | string;
|
|
5
5
|
hook?: string;
|
|
6
|
+
options?: any;
|
|
6
7
|
};
|
|
7
|
-
export declare type PlatformMiddlewareSettings = Function | Type<any> | PlatformMiddlewareLoadingOptions | any;
|
|
8
|
+
export declare type PlatformMiddlewareSettings = Function | Type<any> | PlatformMiddlewareLoadingOptions | string | any;
|
|
8
9
|
declare global {
|
|
9
10
|
namespace TsED {
|
|
10
11
|
interface Configuration {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-middlewares",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Middlewares module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"tslib": "2.4.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tsed/core": "7.
|
|
28
|
-
"@tsed/di": "7.
|
|
29
|
-
"@tsed/schema": "7.
|
|
27
|
+
"@tsed/core": "7.4.1",
|
|
28
|
+
"@tsed/di": "7.4.1",
|
|
29
|
+
"@tsed/schema": "7.4.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@tsed/core": "^7.
|
|
33
|
-
"@tsed/di": "^7.
|
|
34
|
-
"@tsed/schema": "^7.
|
|
32
|
+
"@tsed/core": "^7.4.1",
|
|
33
|
+
"@tsed/di": "^7.4.1",
|
|
34
|
+
"@tsed/schema": "^7.4.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@tsed/core": {
|