moost 0.3.1 → 0.3.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.
- package/dist/index.cjs +26 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +26 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -627,6 +627,24 @@ exports.TPipePriority = void 0;
|
|
|
627
627
|
TPipePriority[TPipePriority["AFTER_VALIDATE"] = 8] = "AFTER_VALIDATE";
|
|
628
628
|
})(exports.TPipePriority || (exports.TPipePriority = {}));
|
|
629
629
|
|
|
630
|
+
/**
|
|
631
|
+
* ## Pipe
|
|
632
|
+
* ### @Decorator
|
|
633
|
+
* Attach pipe
|
|
634
|
+
* @param handler pipe handler
|
|
635
|
+
* @param priority pipe priority
|
|
636
|
+
* @returns
|
|
637
|
+
*/
|
|
638
|
+
function Pipe(handler, priority) {
|
|
639
|
+
if (typeof priority !== 'number') {
|
|
640
|
+
priority =
|
|
641
|
+
typeof handler.priority === 'number'
|
|
642
|
+
? handler.priority
|
|
643
|
+
: exports.TPipePriority.TRANSFORM;
|
|
644
|
+
}
|
|
645
|
+
return getMoostMate().decorate('pipes', { handler, priority }, true);
|
|
646
|
+
}
|
|
647
|
+
|
|
630
648
|
/**
|
|
631
649
|
* ### Define Interceptor Function
|
|
632
650
|
*
|
|
@@ -1055,7 +1073,7 @@ function defineMoostEventHandler(options) {
|
|
|
1055
1073
|
catch (e) {
|
|
1056
1074
|
options.logErrors && logger.error(e);
|
|
1057
1075
|
response = e;
|
|
1058
|
-
return endWithResponse();
|
|
1076
|
+
return endWithResponse(true);
|
|
1059
1077
|
}
|
|
1060
1078
|
}
|
|
1061
1079
|
let args = [];
|
|
@@ -1070,7 +1088,7 @@ function defineMoostEventHandler(options) {
|
|
|
1070
1088
|
catch (e) {
|
|
1071
1089
|
options.logErrors && logger.error(e);
|
|
1072
1090
|
response = e;
|
|
1073
|
-
return endWithResponse();
|
|
1091
|
+
return endWithResponse(true);
|
|
1074
1092
|
}
|
|
1075
1093
|
}
|
|
1076
1094
|
if (interceptorHandler) {
|
|
@@ -1095,8 +1113,9 @@ function defineMoostEventHandler(options) {
|
|
|
1095
1113
|
catch (e) {
|
|
1096
1114
|
options.logErrors && logger.error(e);
|
|
1097
1115
|
response = e;
|
|
1116
|
+
return endWithResponse(true);
|
|
1098
1117
|
}
|
|
1099
|
-
function endWithResponse() {
|
|
1118
|
+
function endWithResponse(raise = false) {
|
|
1100
1119
|
var _a;
|
|
1101
1120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1102
1121
|
// fire after interceptors
|
|
@@ -1120,6 +1139,9 @@ function defineMoostEventHandler(options) {
|
|
|
1120
1139
|
if ((_a = options.hooks) === null || _a === void 0 ? void 0 : _a.end) {
|
|
1121
1140
|
yield options.hooks.end(hookOptions);
|
|
1122
1141
|
}
|
|
1142
|
+
if (raise) {
|
|
1143
|
+
throw response;
|
|
1144
|
+
}
|
|
1123
1145
|
return response;
|
|
1124
1146
|
});
|
|
1125
1147
|
}
|
|
@@ -1161,6 +1183,7 @@ exports.Moost = Moost;
|
|
|
1161
1183
|
exports.Optional = Optional;
|
|
1162
1184
|
exports.Param = Param;
|
|
1163
1185
|
exports.Params = Params;
|
|
1186
|
+
exports.Pipe = Pipe;
|
|
1164
1187
|
exports.Provide = Provide;
|
|
1165
1188
|
exports.Required = Required;
|
|
1166
1189
|
exports.Resolve = Resolve;
|
package/dist/index.d.ts
CHANGED
|
@@ -334,6 +334,16 @@ export declare function Param(name: string): MethodDecorator & ClassDecorator &
|
|
|
334
334
|
*/
|
|
335
335
|
export declare function Params(): ParameterDecorator & PropertyDecorator;
|
|
336
336
|
|
|
337
|
+
/**
|
|
338
|
+
* ## Pipe
|
|
339
|
+
* ### @Decorator
|
|
340
|
+
* Attach pipe
|
|
341
|
+
* @param handler pipe handler
|
|
342
|
+
* @param priority pipe priority
|
|
343
|
+
* @returns
|
|
344
|
+
*/
|
|
345
|
+
export declare function Pipe(handler: TPipeFn, priority?: TPipePriority): ClassDecorator & MethodDecorator & ParameterDecorator;
|
|
346
|
+
|
|
337
347
|
/**
|
|
338
348
|
* ## Provide
|
|
339
349
|
* ### @Decorator
|
package/dist/index.mjs
CHANGED
|
@@ -627,6 +627,24 @@ var TPipePriority;
|
|
|
627
627
|
TPipePriority[TPipePriority["AFTER_VALIDATE"] = 8] = "AFTER_VALIDATE";
|
|
628
628
|
})(TPipePriority || (TPipePriority = {}));
|
|
629
629
|
|
|
630
|
+
/**
|
|
631
|
+
* ## Pipe
|
|
632
|
+
* ### @Decorator
|
|
633
|
+
* Attach pipe
|
|
634
|
+
* @param handler pipe handler
|
|
635
|
+
* @param priority pipe priority
|
|
636
|
+
* @returns
|
|
637
|
+
*/
|
|
638
|
+
function Pipe(handler, priority) {
|
|
639
|
+
if (typeof priority !== 'number') {
|
|
640
|
+
priority =
|
|
641
|
+
typeof handler.priority === 'number'
|
|
642
|
+
? handler.priority
|
|
643
|
+
: TPipePriority.TRANSFORM;
|
|
644
|
+
}
|
|
645
|
+
return getMoostMate().decorate('pipes', { handler, priority }, true);
|
|
646
|
+
}
|
|
647
|
+
|
|
630
648
|
/**
|
|
631
649
|
* ### Define Interceptor Function
|
|
632
650
|
*
|
|
@@ -1055,7 +1073,7 @@ function defineMoostEventHandler(options) {
|
|
|
1055
1073
|
catch (e) {
|
|
1056
1074
|
options.logErrors && logger.error(e);
|
|
1057
1075
|
response = e;
|
|
1058
|
-
return endWithResponse();
|
|
1076
|
+
return endWithResponse(true);
|
|
1059
1077
|
}
|
|
1060
1078
|
}
|
|
1061
1079
|
let args = [];
|
|
@@ -1070,7 +1088,7 @@ function defineMoostEventHandler(options) {
|
|
|
1070
1088
|
catch (e) {
|
|
1071
1089
|
options.logErrors && logger.error(e);
|
|
1072
1090
|
response = e;
|
|
1073
|
-
return endWithResponse();
|
|
1091
|
+
return endWithResponse(true);
|
|
1074
1092
|
}
|
|
1075
1093
|
}
|
|
1076
1094
|
if (interceptorHandler) {
|
|
@@ -1095,8 +1113,9 @@ function defineMoostEventHandler(options) {
|
|
|
1095
1113
|
catch (e) {
|
|
1096
1114
|
options.logErrors && logger.error(e);
|
|
1097
1115
|
response = e;
|
|
1116
|
+
return endWithResponse(true);
|
|
1098
1117
|
}
|
|
1099
|
-
function endWithResponse() {
|
|
1118
|
+
function endWithResponse(raise = false) {
|
|
1100
1119
|
var _a;
|
|
1101
1120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1102
1121
|
// fire after interceptors
|
|
@@ -1120,6 +1139,9 @@ function defineMoostEventHandler(options) {
|
|
|
1120
1139
|
if ((_a = options.hooks) === null || _a === void 0 ? void 0 : _a.end) {
|
|
1121
1140
|
yield options.hooks.end(hookOptions);
|
|
1122
1141
|
}
|
|
1142
|
+
if (raise) {
|
|
1143
|
+
throw response;
|
|
1144
|
+
}
|
|
1123
1145
|
return response;
|
|
1124
1146
|
});
|
|
1125
1147
|
}
|
|
@@ -1127,4 +1149,4 @@ function defineMoostEventHandler(options) {
|
|
|
1127
1149
|
});
|
|
1128
1150
|
}
|
|
1129
1151
|
|
|
1130
|
-
export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, Injectable, Intercept, InterceptorHandler, Label, Moost, Optional, Param, Params, Provide, Required, Resolve, TInterceptorPriority, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, useControllerContext };
|
|
1152
|
+
export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, Injectable, Intercept, InterceptorHandler, Label, Moost, Optional, Param, Params, Pipe, Provide, Required, Resolve, TInterceptorPriority, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, useControllerContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moost",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "moost",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@prostojs/infact": "^0.1.13",
|
|
34
34
|
"@prostojs/mate": "^0.2.1",
|
|
35
35
|
"@prostojs/logger": "^0.3.4",
|
|
36
|
-
"@wooksjs/event-core": "^0.4.
|
|
37
|
-
"wooks": "^0.4.
|
|
36
|
+
"@wooksjs/event-core": "^0.4.4",
|
|
37
|
+
"wooks": "^0.4.4"
|
|
38
38
|
},
|
|
39
39
|
"author": "Artem Maltsev",
|
|
40
40
|
"license": "MIT",
|