@tsed/di 6.104.0 → 6.105.2
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.
|
@@ -12,16 +12,24 @@ const InjectablePropertyType_1 = require("../domain/InjectablePropertyType");
|
|
|
12
12
|
* @decorator
|
|
13
13
|
*/
|
|
14
14
|
function Intercept(interceptor, options) {
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
return (...args) => {
|
|
16
|
+
const [target, propertyKey, descriptor] = args;
|
|
17
|
+
const type = (0, core_1.decoratorTypeOf)(args);
|
|
18
|
+
switch (type) {
|
|
19
|
+
case core_1.DecoratorTypes.CLASS:
|
|
20
|
+
(0, core_1.decorateMethodsOf)(target, Intercept(interceptor, options));
|
|
21
|
+
break;
|
|
22
|
+
case core_1.DecoratorTypes.METHOD:
|
|
23
|
+
core_1.Store.from(target).merge(constants_1.INJECTABLE_PROP, {
|
|
24
|
+
[propertyKey]: {
|
|
25
|
+
options,
|
|
26
|
+
propertyKey,
|
|
27
|
+
useType: interceptor,
|
|
28
|
+
bindingType: InjectablePropertyType_1.InjectablePropertyType.INTERCEPTOR
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return descriptor;
|
|
32
|
+
}
|
|
25
33
|
};
|
|
26
34
|
}
|
|
27
35
|
exports.Intercept = Intercept;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../src/decorators/intercept.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../src/decorators/intercept.ts"],"names":[],"mappings":";;;AAAA,qCAAgH;AAChH,sDAAuD;AACvD,6EAAwE;AAIxE;;;;;;GAMG;AACH,SAAgB,SAAS,CAA+B,WAAoB,EAAE,OAAa;IACzF,OAAO,CAAC,GAAG,IAAyB,EAAE,EAAE;QACtC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QAC/C,MAAM,IAAI,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC;QACnC,QAAQ,IAAI,EAAE;YACZ,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,MAAM,EAAE,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC3D,MAAM;YACR,KAAK,qBAAc,CAAC,MAAM;gBACxB,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,2BAAe,EAAE;oBACxC,CAAC,WAAW,CAAC,EAAE;wBACb,OAAO;wBACP,WAAW;wBACX,OAAO,EAAE,WAAW;wBACpB,WAAW,EAAE,+CAAsB,CAAC,WAAW;qBAChD;iBACsB,CAAC,CAAC;gBAE3B,OAAO,UAAU,CAAC;SACrB;IACH,CAAC,CAAC;AACJ,CAAC;AArBD,8BAqBC","sourcesContent":["import {decorateMethodsOf, DecoratorParameters, decoratorTypeOf, DecoratorTypes, Store, Type} from \"@tsed/core\";\nimport {INJECTABLE_PROP} from \"../constants/constants\";\nimport {InjectablePropertyType} from \"../domain/InjectablePropertyType\";\nimport type {InterceptorMethods} from \"../interfaces/InterceptorMethods\";\nimport type {InjectableProperties} from \"../interfaces/InjectableProperties\";\n\n/**\n * Attaches interceptor to method call and executes the before and after methods\n *\n * @param interceptor\n * @param options\n * @decorator\n */\nexport function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any): any {\n return (...args: DecoratorParameters) => {\n const [target, propertyKey, descriptor] = args;\n const type = decoratorTypeOf(args);\n switch (type) {\n case DecoratorTypes.CLASS:\n decorateMethodsOf(target, Intercept(interceptor, options));\n break;\n case DecoratorTypes.METHOD:\n Store.from(target).merge(INJECTABLE_PROP, {\n [propertyKey]: {\n options,\n propertyKey,\n useType: interceptor,\n bindingType: InjectablePropertyType.INTERCEPTOR\n }\n } as InjectableProperties);\n\n return descriptor;\n }\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Store } from "@tsed/core";
|
|
1
|
+
import { decorateMethodsOf, decoratorTypeOf, DecoratorTypes, Store } from "@tsed/core";
|
|
2
2
|
import { INJECTABLE_PROP } from "../constants/constants.js";
|
|
3
3
|
import { InjectablePropertyType } from "../domain/InjectablePropertyType.js";
|
|
4
4
|
/**
|
|
@@ -9,16 +9,24 @@ import { InjectablePropertyType } from "../domain/InjectablePropertyType.js";
|
|
|
9
9
|
* @decorator
|
|
10
10
|
*/
|
|
11
11
|
export function Intercept(interceptor, options) {
|
|
12
|
-
return (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
return (...args) => {
|
|
13
|
+
const [target, propertyKey, descriptor] = args;
|
|
14
|
+
const type = decoratorTypeOf(args);
|
|
15
|
+
switch (type) {
|
|
16
|
+
case DecoratorTypes.CLASS:
|
|
17
|
+
decorateMethodsOf(target, Intercept(interceptor, options));
|
|
18
|
+
break;
|
|
19
|
+
case DecoratorTypes.METHOD:
|
|
20
|
+
Store.from(target).merge(INJECTABLE_PROP, {
|
|
21
|
+
[propertyKey]: {
|
|
22
|
+
options,
|
|
23
|
+
propertyKey,
|
|
24
|
+
useType: interceptor,
|
|
25
|
+
bindingType: InjectablePropertyType.INTERCEPTOR
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return descriptor;
|
|
29
|
+
}
|
|
22
30
|
};
|
|
23
31
|
}
|
|
24
32
|
//# sourceMappingURL=intercept.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../src/decorators/intercept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../src/decorators/intercept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAuB,eAAe,EAAE,cAAc,EAAE,KAAK,EAAO,MAAM,YAAY,CAAC;AAChH,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAC,sBAAsB,EAAC,MAAM,kCAAkC,CAAC;AAIxE;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAA+B,WAAoB,EAAE,OAAa;IACzF,OAAO,CAAC,GAAG,IAAyB,EAAE,EAAE;QACtC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QAC/C,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACnC,QAAQ,IAAI,EAAE;YACZ,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC3D,MAAM;YACR,KAAK,cAAc,CAAC,MAAM;gBACxB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE;oBACxC,CAAC,WAAW,CAAC,EAAE;wBACb,OAAO;wBACP,WAAW;wBACX,OAAO,EAAE,WAAW;wBACpB,WAAW,EAAE,sBAAsB,CAAC,WAAW;qBAChD;iBACsB,CAAC,CAAC;gBAE3B,OAAO,UAAU,CAAC;SACrB;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {decorateMethodsOf, DecoratorParameters, decoratorTypeOf, DecoratorTypes, Store, Type} from \"@tsed/core\";\nimport {INJECTABLE_PROP} from \"../constants/constants\";\nimport {InjectablePropertyType} from \"../domain/InjectablePropertyType\";\nimport type {InterceptorMethods} from \"../interfaces/InterceptorMethods\";\nimport type {InjectableProperties} from \"../interfaces/InjectableProperties\";\n\n/**\n * Attaches interceptor to method call and executes the before and after methods\n *\n * @param interceptor\n * @param options\n * @decorator\n */\nexport function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any): any {\n return (...args: DecoratorParameters) => {\n const [target, propertyKey, descriptor] = args;\n const type = decoratorTypeOf(args);\n switch (type) {\n case DecoratorTypes.CLASS:\n decorateMethodsOf(target, Intercept(interceptor, options));\n break;\n case DecoratorTypes.METHOD:\n Store.from(target).merge(INJECTABLE_PROP, {\n [propertyKey]: {\n options,\n propertyKey,\n useType: interceptor,\n bindingType: InjectablePropertyType.INTERCEPTOR\n }\n } as InjectableProperties);\n\n return descriptor;\n }\n };\n}\n"]}
|
|
@@ -7,4 +7,4 @@ import type { InterceptorMethods } from "../interfaces/InterceptorMethods";
|
|
|
7
7
|
* @param options
|
|
8
8
|
* @decorator
|
|
9
9
|
*/
|
|
10
|
-
export declare function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any):
|
|
10
|
+
export declare function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/di",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.105.2",
|
|
4
4
|
"description": "DI module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"tslib": "2.2.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@tsed/core": "6.
|
|
26
|
+
"@tsed/core": "6.105.2",
|
|
27
27
|
"@tsed/logger": ">=6.1.0",
|
|
28
|
-
"@tsed/schema": "6.
|
|
28
|
+
"@tsed/schema": "6.105.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@tsed/core": "^6.
|
|
31
|
+
"@tsed/core": "^6.105.2",
|
|
32
32
|
"@tsed/logger": ">=6.1.0",
|
|
33
|
-
"@tsed/schema": "^6.
|
|
33
|
+
"@tsed/schema": "^6.105.2"
|
|
34
34
|
},
|
|
35
35
|
"repository": "https://github.com/tsedio/tsed",
|
|
36
36
|
"bugs": {
|