@tsed/di 6.105.0 → 6.105.3
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.
|
@@ -13,23 +13,22 @@ const InjectablePropertyType_1 = require("../domain/InjectablePropertyType");
|
|
|
13
13
|
*/
|
|
14
14
|
function Intercept(interceptor, options) {
|
|
15
15
|
return (...args) => {
|
|
16
|
+
const [target, propertyKey, descriptor] = args;
|
|
16
17
|
const type = (0, core_1.decoratorTypeOf)(args);
|
|
17
|
-
console.log("===", args);
|
|
18
18
|
switch (type) {
|
|
19
19
|
case core_1.DecoratorTypes.CLASS:
|
|
20
|
-
|
|
21
|
-
(0, core_1.decorateMethodsOf)(args[0], Intercept(interceptor, options));
|
|
20
|
+
(0, core_1.decorateMethodsOf)(target, Intercept(interceptor, options));
|
|
22
21
|
break;
|
|
23
22
|
case core_1.DecoratorTypes.METHOD:
|
|
24
|
-
core_1.Store.from(
|
|
25
|
-
[
|
|
26
|
-
|
|
27
|
-
propertyKey
|
|
23
|
+
core_1.Store.from(target).merge(constants_1.INJECTABLE_PROP, {
|
|
24
|
+
[propertyKey]: {
|
|
25
|
+
options,
|
|
26
|
+
propertyKey,
|
|
28
27
|
useType: interceptor,
|
|
29
|
-
|
|
28
|
+
bindingType: InjectablePropertyType_1.InjectablePropertyType.INTERCEPTOR
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
|
-
return
|
|
31
|
+
return descriptor;
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"]}
|
|
@@ -10,23 +10,22 @@ import { InjectablePropertyType } from "../domain/InjectablePropertyType.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export function Intercept(interceptor, options) {
|
|
12
12
|
return (...args) => {
|
|
13
|
+
const [target, propertyKey, descriptor] = args;
|
|
13
14
|
const type = decoratorTypeOf(args);
|
|
14
|
-
console.log("===", args);
|
|
15
15
|
switch (type) {
|
|
16
16
|
case DecoratorTypes.CLASS:
|
|
17
|
-
|
|
18
|
-
decorateMethodsOf(args[0], Intercept(interceptor, options));
|
|
17
|
+
decorateMethodsOf(target, Intercept(interceptor, options));
|
|
19
18
|
break;
|
|
20
19
|
case DecoratorTypes.METHOD:
|
|
21
|
-
Store.from(
|
|
22
|
-
[
|
|
23
|
-
|
|
24
|
-
propertyKey
|
|
20
|
+
Store.from(target).merge(INJECTABLE_PROP, {
|
|
21
|
+
[propertyKey]: {
|
|
22
|
+
options,
|
|
23
|
+
propertyKey,
|
|
25
24
|
useType: interceptor,
|
|
26
|
-
|
|
25
|
+
bindingType: InjectablePropertyType.INTERCEPTOR
|
|
27
26
|
}
|
|
28
27
|
});
|
|
29
|
-
return
|
|
28
|
+
return descriptor;
|
|
30
29
|
}
|
|
31
30
|
};
|
|
32
31
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/di",
|
|
3
|
-
"version": "6.105.
|
|
3
|
+
"version": "6.105.3",
|
|
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.105.
|
|
26
|
+
"@tsed/core": "6.105.3",
|
|
27
27
|
"@tsed/logger": ">=6.1.0",
|
|
28
|
-
"@tsed/schema": "6.105.
|
|
28
|
+
"@tsed/schema": "6.105.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@tsed/core": "^6.105.
|
|
31
|
+
"@tsed/core": "^6.105.3",
|
|
32
32
|
"@tsed/logger": ">=6.1.0",
|
|
33
|
-
"@tsed/schema": "^6.105.
|
|
33
|
+
"@tsed/schema": "^6.105.3"
|
|
34
34
|
},
|
|
35
35
|
"repository": "https://github.com/tsedio/tsed",
|
|
36
36
|
"bugs": {
|