@worldsibu/convector-core-controller
Advanced tools
Comparing version 1.3.9-0-alpha.4f71c94c to 1.3.9-0-alpha.6a210870
export * from './param.decorator'; | ||
export * from './invokable.decorator'; | ||
export * from './optional.decorator'; | ||
export * from './controller.decorator'; | ||
export * from './convector-controller'; |
@@ -6,4 +6,5 @@ "use strict"; | ||
tslib_1.__exportStar(require("./invokable.decorator"), exports); | ||
tslib_1.__exportStar(require("./optional.decorator"), exports); | ||
tslib_1.__exportStar(require("./controller.decorator"), exports); | ||
tslib_1.__exportStar(require("./convector-controller"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
var param_decorator_1 = require("./param.decorator"); | ||
var optional_decorator_1 = require("./optional.decorator"); | ||
var controller_decorator_1 = require("./controller.decorator"); | ||
@@ -27,3 +28,3 @@ exports.invokableMetadataKey = g.ConvectorInvokableMetadataKey || Symbol('invokable'); | ||
var _this = this; | ||
var internalCall, schemas, namespace, ctx, e_1, error; | ||
var internalCall, schemas, optionals_1, namespace, ctx, response, e_1, error; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -34,9 +35,11 @@ switch (_a.label) { | ||
if ('_internal_invokable' in this) { | ||
args = [_, args, extras].concat(rest).filter(function (param) { return param !== undefined; }); | ||
internalCall = true; | ||
args = [_, args, extras].concat(rest).filter(function (param) { return param !== undefined; }); | ||
extras = {}; | ||
} | ||
schemas = Reflect.getOwnMetadata(param_decorator_1.paramMetadataKey, target, key); | ||
if (!schemas) return [3, 2]; | ||
if (schemas.length !== args.length) { | ||
throw new convector_core_errors_1.ControllerInvalidInvokeError(key, args.length, schemas.length); | ||
optionals_1 = Reflect.getOwnMetadata(optional_decorator_1.optionalMetadataKey, target, key) || []; | ||
if (schemas.length - optionals_1.length > args.length) { | ||
throw new convector_core_errors_1.ControllerInvalidInvokeError(key, args.length, schemas.length - optionals_1.length); | ||
} | ||
@@ -50,15 +53,22 @@ return [4, schemas.reduce(function (result, _a, index) { | ||
case 0: | ||
_b.trys.push([0, 4, , 5]); | ||
if (!opts.update) return [3, 1]; | ||
if (!(args[index] === undefined)) return [3, 2]; | ||
if (optionals_1.indexOf(index) === -1) { | ||
throw new convector_core_errors_1.ControllerUndefinedArgumentError(index); | ||
} | ||
return [4, result]; | ||
case 1: return [2, (_b.sent()).concat([undefined])]; | ||
case 2: | ||
_b.trys.push([2, 6, , 7]); | ||
if (!opts.update) return [3, 3]; | ||
paramResult = schema.cast(args[index], opts); | ||
return [3, 3]; | ||
case 1: return [4, schema.validate(args[index], opts)]; | ||
case 2: | ||
return [3, 5]; | ||
case 3: return [4, schema.validate(args[index], opts)]; | ||
case 4: | ||
paramResult = _b.sent(); | ||
_b.label = 3; | ||
case 3: return [3, 5]; | ||
case 4: | ||
_b.label = 5; | ||
case 5: return [3, 7]; | ||
case 6: | ||
e_2 = _b.sent(); | ||
throw new convector_core_errors_1.ControllerInvalidArgumentError(e_2, index, args[index]); | ||
case 5: | ||
case 7: | ||
if (model) { | ||
@@ -73,3 +83,3 @@ try { | ||
return [4, result]; | ||
case 6: return [2, (_b.sent()).concat([paramResult])]; | ||
case 8: return [2, (_b.sent()).concat([paramResult])]; | ||
} | ||
@@ -89,3 +99,5 @@ }); | ||
return [4, fn.call.apply(fn, [ctx].concat(args))]; | ||
case 4: return [2, _a.sent()]; | ||
case 4: | ||
response = _a.sent(); | ||
return [2, typeof response === 'object' ? JSON.parse(JSON.stringify(response)) : response]; | ||
case 5: | ||
@@ -92,0 +104,0 @@ e_1 = _a.sent(); |
{ | ||
"name": "@worldsibu/convector-core-controller", | ||
"version": "1.3.9-0-alpha.4f71c94c", | ||
"version": "1.3.9-0-alpha.6a210870", | ||
"description": "Convector Controller base class", | ||
@@ -53,4 +53,4 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@worldsibu/convector-core-errors": "1.3.9-0-alpha.4f71c94c", | ||
"@worldsibu/convector-core-model": "1.3.9-0-alpha.4f71c94c", | ||
"@worldsibu/convector-core-errors": "1.3.9-0-alpha.6a210870", | ||
"@worldsibu/convector-core-model": "1.3.9-0-alpha.6a210870", | ||
"tslib": "^1.9.0", | ||
@@ -57,0 +57,0 @@ "window-or-global": "^1.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32092
21
233
+ Added@worldsibu/convector-core-errors@1.3.9-0-alpha.6a210870(transitive)
+ Added@worldsibu/convector-core-model@1.3.9-0-alpha.6a210870(transitive)
+ Added@worldsibu/convector-core-storage@1.3.9-0-alpha.6a210870(transitive)
- Removed@worldsibu/convector-core-errors@1.3.9-0-alpha.4f71c94c(transitive)
- Removed@worldsibu/convector-core-model@1.3.9-0-alpha.4f71c94c(transitive)
- Removed@worldsibu/convector-core-storage@1.3.9-0-alpha.4f71c94c(transitive)
Updated@worldsibu/convector-core-errors@1.3.9-0-alpha.6a210870
Updated@worldsibu/convector-core-model@1.3.9-0-alpha.6a210870