node-rigorous
Version:
Rigorous Framework
166 lines (137 loc) • 6.64 kB
JavaScript
;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
/* eslint class-methods-use-this: 0 */
var RigorousRoute = require('../RigorousRoute');
var Route =
/*#__PURE__*/
function (_RigorousRoute) {
_inherits(Route, _RigorousRoute);
// No process because should be redirected before
function Route(middlewares) {
_classCallCheck(this, Route);
return _possibleConstructorReturn(this, _getPrototypeOf(Route).call(this, middlewares, {}));
}
_createClass(Route, [{
key: "secureInput",
value: function () {
var _secureInput = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(req) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case "end":
return _context.stop();
}
}
}, _callee);
}));
function secureInput(_x) {
return _secureInput.apply(this, arguments);
}
return secureInput;
}()
}, {
key: "checkConformityInput",
value: function () {
var _checkConformityInput = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(inputs) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
function checkConformityInput(_x2) {
return _checkConformityInput.apply(this, arguments);
}
return checkConformityInput;
}()
}, {
key: "checkAuthorization",
value: function () {
var _checkAuthorization = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee3(checker) {
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
function checkAuthorization(_x3) {
return _checkAuthorization.apply(this, arguments);
}
return checkAuthorization;
}()
}, {
key: "processData",
value: function () {
var _processData = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(inputs, checker) {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
return _context4.abrupt("return", {
result: null,
notificationParam: null
});
case 1:
case "end":
return _context4.stop();
}
}
}, _callee4);
}));
function processData(_x4, _x5) {
return _processData.apply(this, arguments);
}
return processData;
}()
}, {
key: "sendNotification",
value: function () {
var _sendNotification = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee5(inputs, notificationParam) {
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
case "end":
return _context5.stop();
}
}
}, _callee5);
}));
function sendNotification(_x6, _x7) {
return _sendNotification.apply(this, arguments);
}
return sendNotification;
}()
}]);
return Route;
}(RigorousRoute);
module.exports = Route;