Comparing version 1.0.16 to 1.0.17
@@ -7,5 +7,5 @@ "use strict"; | ||
var _exports = require("vweb-core/lib/exports"); | ||
var _vwebCore = require("vweb-core"); | ||
var assert = _exports.util.assert; | ||
var assert = _vwebCore.util.assert; | ||
/** | ||
@@ -21,3 +21,3 @@ * 视图控制器 | ||
var set = function set(target, property) { | ||
(0, _exports.onlyClass)(property); | ||
(0, _vwebCore.onlyClass)(property); | ||
@@ -30,3 +30,3 @@ if (Array.isArray(name)) { | ||
if (Array.isArray(dependencies)) { | ||
(0, _exports.setAnnotation)(target, { | ||
(0, _vwebCore.setAnnotation)(target, { | ||
dependencies: dependencies | ||
@@ -37,3 +37,3 @@ }); | ||
var annotation = { | ||
name: name || _exports.util.uncapitalize(target.name), | ||
name: name || _vwebCore.util.uncapitalize(target.name), | ||
type: 'controller', | ||
@@ -43,3 +43,3 @@ component: true, | ||
}; | ||
(0, _exports.setAnnotation)(target, annotation); | ||
(0, _vwebCore.setAnnotation)(target, annotation); | ||
}; | ||
@@ -98,3 +98,3 @@ | ||
(0, _exports.setAnnotation)(target, annotation); | ||
(0, _vwebCore.setAnnotation)(target, annotation); | ||
}; | ||
@@ -174,3 +174,3 @@ | ||
return function (target, property, descriptor) { | ||
(0, _exports.onlyClass)(property); | ||
(0, _vwebCore.onlyClass)(property); | ||
@@ -183,3 +183,3 @@ if (Array.isArray(name)) { | ||
if (Array.isArray(dependencies)) { | ||
(0, _exports.setAnnotation)(target, { | ||
(0, _vwebCore.setAnnotation)(target, { | ||
dependencies: dependencies | ||
@@ -190,3 +190,3 @@ }); | ||
var annotation = { | ||
name: name || _exports.util.uncapitalize(target.name), | ||
name: name || _vwebCore.util.uncapitalize(target.name), | ||
type: 'interceptor', | ||
@@ -197,3 +197,3 @@ path: path, | ||
}; | ||
(0, _exports.setAnnotation)(target, annotation); | ||
(0, _vwebCore.setAnnotation)(target, annotation); | ||
}; | ||
@@ -213,5 +213,5 @@ } | ||
return function (target, property, descriptor) { | ||
(0, _exports.onlyClass)(property); | ||
(0, _vwebCore.onlyClass)(property); | ||
var annotation = { | ||
name: name || _exports.util.uncapitalize(target.name), | ||
name: name || _vwebCore.util.uncapitalize(target.name), | ||
type: 'appScope', | ||
@@ -221,3 +221,3 @@ component: true, | ||
}; | ||
(0, _exports.setAnnotation)(target, annotation); | ||
(0, _vwebCore.setAnnotation)(target, annotation); | ||
}; | ||
@@ -257,3 +257,3 @@ } | ||
validators[property] = validator; | ||
(0, _exports.setAnnotation)(target, { | ||
(0, _vwebCore.setAnnotation)(target, { | ||
validators: validators | ||
@@ -295,3 +295,3 @@ }); | ||
converters[property] = converter; | ||
(0, _exports.setAnnotation)(target, { | ||
(0, _vwebCore.setAnnotation)(target, { | ||
converters: converters | ||
@@ -326,3 +326,3 @@ }); | ||
}; | ||
(0, _exports.setAnnotation)(target, annotation); | ||
(0, _vwebCore.setAnnotation)(target, annotation); | ||
}; | ||
@@ -329,0 +329,0 @@ |
@@ -43,13 +43,25 @@ "use strict"; | ||
var requestParams = {}; | ||
{ | ||
var ip = req.ip; | ||
var arr = ip.match(/[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}/g); | ||
if (Array.isArray(arr)) { | ||
ip = arr[0]; | ||
} | ||
req.remote = { | ||
ip: ip, | ||
device: req.headers['user-agent'] | ||
}; | ||
} | ||
var params = _objectSpread(_objectSpread(_objectSpread({}, req.params), req.query), req.body); | ||
var _loop = function _loop(_key) { | ||
_key = _key.replace(/\[\w+\]/g, function (key) { | ||
Reflect.ownKeys(params).forEach(function (key) { | ||
key = key.replace(/\[\w+\]/g, function (key) { | ||
return "." + key.substring(1, key.length - 1); | ||
}); | ||
var rp = params[_key]; | ||
var rp = params[key]; | ||
var tmp = requestParams; | ||
_key.split('.').forEach(function (e, i, arr) { | ||
key.split('.').forEach(function (e, i, arr) { | ||
if (arr.length - 1 === i) { | ||
@@ -66,10 +78,3 @@ if (tmp[e] && tmp instanceof Array) { | ||
}); | ||
key = _key; | ||
}; | ||
for (var key in params) { | ||
_loop(key); | ||
} | ||
}); | ||
return requestParams; | ||
@@ -76,0 +81,0 @@ }; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var _exports = require("vweb-core/lib/exports"); | ||
var _vwebCore = require("vweb-core"); | ||
@@ -13,3 +13,3 @@ var _ParameterValidError = _interopRequireDefault(require("./ParameterValidError")); | ||
var requestError = function requestError(res, err, logger) { | ||
if (err instanceof _exports.LogicError || err.code) { | ||
if (err instanceof _vwebCore.LogicError || err.code) { | ||
logger.debug(err); | ||
@@ -16,0 +16,0 @@ res.send(new _model.Fail(err.message, err.code || 'LogicError')); |
@@ -18,3 +18,3 @@ "use strict"; | ||
var _exports = require("vweb-core/lib/exports"); | ||
var _vwebCore = require("vweb-core"); | ||
@@ -40,5 +40,5 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
return ParameterValidError; | ||
}(_exports.LogicError); | ||
}(_vwebCore.LogicError); | ||
var _default = ParameterValidError; | ||
exports["default"] = _default; |
{ | ||
"name": "vweb-mvc", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "mvc ", | ||
@@ -30,3 +30,3 @@ "main": "./lib/index", | ||
"@babel/plugin-transform-runtime": "^7.7.6", | ||
"@babel/preset-env": "^7.15.4", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/register": "^7.7.7", | ||
@@ -37,3 +37,3 @@ "@babel/runtime": "^7.15.4", | ||
"redis": "^3.1.2", | ||
"vweb-core": "^1.0.42" | ||
"vweb-core": "^1.0.45" | ||
}, | ||
@@ -40,0 +40,0 @@ "dependencies": { |
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
62046
1531