From c81f59ece0b693fa35277de7d7b67736ad392ab1 Mon Sep 17 00:00:00 2001 From: Ujjwal Gupta Date: Sun, 17 May 2020 18:42:26 +0530 Subject: [PATCH] release v - 1.14.0 --- dist/fort.js | 7816 ++++++++++++++++++---------------------------- dist/fort.js.map | 2 +- package.json | 2 +- 3 files changed, 3128 insertions(+), 4692 deletions(-) diff --git a/dist/fort.js b/dist/fort.js index 0e5780e3..8231cf04 100644 --- a/dist/fort.js +++ b/dist/fort.js @@ -1,5 +1,5 @@ /*! - * @license :fortjs - V1.13.1 - 17/05/2020 + * @license :fortjs - V1.14.0 - 17/05/2020 * https://github.com/ujjwalguptaofficial/fortjs * Copyright (c) 2020 @Ujjwal Gupta; Licensed MIT */ @@ -87,270 +87,365 @@ module.exports = /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts"); +/******/ return __webpack_require__(__webpack_require__.s = 13); /******/ }) /************************************************************************/ -/******/ ({ - -/***/ "./src/abstracts/controller.ts": -/*!*************************************!*\ - !*** ./src/abstracts/controller.ts ***! - \*************************************/ -/*! exports provided: Controller */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Controller", function() { return Controller; }); -/* harmony import */ var _test_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../test_helpers */ "./src/test_helpers/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); +module.exports = require("path"); +/***/ }), +/* 1 */ +/***/ (function(module, exports) { -var Controller = /** @class */ (function () { - function Controller() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - } - Object.defineProperty(Controller.prototype, "logger", { - get: function () { - return _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].logger; - }, - enumerable: true, - configurable: true - }); - Controller.prototype.initialize = function (data) { - Object(_test_helpers__WEBPACK_IMPORTED_MODULE_0__["initController"])(this, data); - }; - return Controller; -}()); +module.exports = require("fs-extra"); +/***/ }), +/* 2 */ +/***/ (function(module, exports) { +module.exports = require("negotiator"); /***/ }), +/* 3 */ +/***/ (function(module, exports) { -/***/ "./src/abstracts/guard.ts": -/*!********************************!*\ - !*** ./src/abstracts/guard.ts ***! - \********************************/ -/*! exports provided: Guard */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +module.exports = require("fs"); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Guard", function() { return Guard; }); -/* harmony import */ var _test_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../test_helpers */ "./src/test_helpers/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); +/***/ }), +/* 4 */ +/***/ (function(module, exports) { +module.exports = require("url"); -var Guard = /** @class */ (function () { - function Guard() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - } - Object.defineProperty(Guard.prototype, "logger", { - get: function () { - return _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].logger; - }, - enumerable: true, - configurable: true - }); - Guard.prototype.initialize = function (data) { - return Object(_test_helpers__WEBPACK_IMPORTED_MODULE_0__["initGuard"])(this, data); - }; - return Guard; -}()); +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + +module.exports = require("etag"); +/***/ }), +/* 6 */ +/***/ (function(module, exports) { +module.exports = require("fresh"); /***/ }), +/* 7 */ +/***/ (function(module, exports) { -/***/ "./src/abstracts/index.ts": -/*!********************************!*\ - !*** ./src/abstracts/index.ts ***! - \********************************/ -/*! exports provided: Controller, Shield, SessionProvider, Guard, ViewEngine, Wall, XmlParser, ResultMapper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +module.exports = require("content-type"); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./controller */ "./src/abstracts/controller.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Controller", function() { return _controller__WEBPACK_IMPORTED_MODULE_0__["Controller"]; }); +/***/ }), +/* 8 */ +/***/ (function(module, exports) { -/* harmony import */ var _shield__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shield */ "./src/abstracts/shield.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Shield", function() { return _shield__WEBPACK_IMPORTED_MODULE_1__["Shield"]; }); +module.exports = require("querystring"); -/* harmony import */ var _session_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./session_provider */ "./src/abstracts/session_provider.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SessionProvider", function() { return _session_provider__WEBPACK_IMPORTED_MODULE_2__["SessionProvider"]; }); +/***/ }), +/* 9 */ +/***/ (function(module, exports) { -/* harmony import */ var _guard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./guard */ "./src/abstracts/guard.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Guard", function() { return _guard__WEBPACK_IMPORTED_MODULE_3__["Guard"]; }); +module.exports = require("multiparty"); -/* harmony import */ var _view_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./view_engine */ "./src/abstracts/view_engine.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViewEngine", function() { return _view_engine__WEBPACK_IMPORTED_MODULE_4__["ViewEngine"]; }); +/***/ }), +/* 10 */ +/***/ (function(module, exports) { -/* harmony import */ var _wall__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./wall */ "./src/abstracts/wall.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wall", function() { return _wall__WEBPACK_IMPORTED_MODULE_5__["Wall"]; }); +module.exports = require("mustache"); -/* harmony import */ var _xml_parser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./xml_parser */ "./src/abstracts/xml_parser.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "XmlParser", function() { return _xml_parser__WEBPACK_IMPORTED_MODULE_6__["XmlParser"]; }); +/***/ }), +/* 11 */ +/***/ (function(module, exports) { -/* harmony import */ var _result_mapper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./result_mapper */ "./src/abstracts/result_mapper.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ResultMapper", function() { return _result_mapper__WEBPACK_IMPORTED_MODULE_7__["ResultMapper"]; }); +module.exports = require("uniqid"); +/***/ }), +/* 12 */ +/***/ (function(module, exports) { +module.exports = require("http"); +/***/ }), +/* 13 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +__webpack_require__.r(__webpack_exports__); +// CONCATENATED MODULE: ./src/enums/mime_type.ts +var MIME_TYPE; +(function (MIME_TYPE) { + MIME_TYPE["Text"] = "text/plain"; + MIME_TYPE["Json"] = "application/json"; + MIME_TYPE["Html"] = "text/html"; + MIME_TYPE["FormUrlEncoded"] = "application/x-www-form-urlencoded"; + MIME_TYPE["Css"] = "text/css"; + MIME_TYPE["Csv"] = "text/csv"; + MIME_TYPE["Js"] = "application/javascript"; + MIME_TYPE["Bmp"] = "image/bmp"; + MIME_TYPE["Jpeg"] = "image/jpeg"; + MIME_TYPE["Gif"] = "image/gif"; + MIME_TYPE["Ico"] = "image/x-icon"; + MIME_TYPE["Png"] = "image/png"; + MIME_TYPE["Pdf"] = "application/pdf"; + MIME_TYPE["Svg"] = "image/svg+xml"; + MIME_TYPE["Rtf"] = "application/rtf"; + MIME_TYPE["Xml"] = "application/xml"; + MIME_TYPE["Xls"] = "application/vnd.ms-excel"; + MIME_TYPE["Xlsx"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + MIME_TYPE["Ttf"] = "font/ttf"; + MIME_TYPE["Woff"] = "font/woff"; + MIME_TYPE["Woff2"] = "font/woff2"; + MIME_TYPE["Eot"] = "application/vnd.ms-fontobject"; + MIME_TYPE["Otf"] = "font/otf"; + MIME_TYPE["Swf"] = "application/x-shockwave-flash"; + MIME_TYPE["Avi"] = "video/avi"; + MIME_TYPE["FormMultiPart"] = "multipart/form-data"; +})(MIME_TYPE || (MIME_TYPE = {})); +// CONCATENATED MODULE: ./src/enums/http_method.ts +var HTTP_METHOD; +(function (HTTP_METHOD) { + HTTP_METHOD["Get"] = "GET"; + HTTP_METHOD["Post"] = "POST"; + HTTP_METHOD["Put"] = "PUT"; + HTTP_METHOD["Patch"] = "PATCH"; + HTTP_METHOD["Delete"] = "DELETE"; + HTTP_METHOD["Options"] = "OPTIONS"; + HTTP_METHOD["Head"] = "HEAD"; +})(HTTP_METHOD || (HTTP_METHOD = {})); +// CONCATENATED MODULE: ./src/enums/http_status_code.ts +var HTTP_STATUS_CODE; +(function (HTTP_STATUS_CODE) { + HTTP_STATUS_CODE[HTTP_STATUS_CODE["BadRequest"] = 400] = "BadRequest"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["Unauthorized"] = 401] = "Unauthorized"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["Forbidden"] = 403] = "Forbidden"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["NotFound"] = 404] = "NotFound"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["Ok"] = 200] = "Ok"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["Created"] = 201] = "Created"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["NoContent"] = 204] = "NoContent"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["Redirect"] = 302] = "Redirect"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["NotModified"] = 304] = "NotModified"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["NotAcceptable"] = 406] = "NotAcceptable"; + HTTP_STATUS_CODE[HTTP_STATUS_CODE["InternalServerError"] = 500] = "InternalServerError"; +})(HTTP_STATUS_CODE || (HTTP_STATUS_CODE = {})); +// CONCATENATED MODULE: ./src/enums/etag_type.ts +var ETag_Type; +(function (ETag_Type) { + ETag_Type["Strong"] = "strong"; + ETag_Type["Weak"] = "weak"; +})(ETag_Type || (ETag_Type = {})); +// CONCATENATED MODULE: ./src/enums/error_type.ts +var ERROR_TYPE; +(function (ERROR_TYPE) { + ERROR_TYPE["InvalidControllerName"] = "invalid_controller_name"; + ERROR_TYPE["InvalidContentType"] = "invalid_content_type"; + ERROR_TYPE["PortInUse"] = "port_in_use"; + ERROR_TYPE["UndefinedViewEngine"] = "undefined_view_engine"; +})(ERROR_TYPE || (ERROR_TYPE = {})); +// CONCATENATED MODULE: ./src/enums/data_type.ts +var DATA_TYPE; +(function (DATA_TYPE) { + DATA_TYPE["String"] = "string"; + DATA_TYPE["Number"] = "number"; + DATA_TYPE["Array"] = "array"; + DATA_TYPE["Object"] = "object"; + DATA_TYPE["Function"] = "function"; +})(DATA_TYPE || (DATA_TYPE = {})); -/***/ }), +// CONCATENATED MODULE: ./src/enums/index.ts -/***/ "./src/abstracts/result_mapper.ts": -/*!****************************************!*\ - !*** ./src/abstracts/result_mapper.ts ***! - \****************************************/ -/*! exports provided: ResultMapper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResultMapper", function() { return ResultMapper; }); -var ResultMapper = /** @class */ (function () { - function ResultMapper() { - } - return ResultMapper; -}()); -/***/ }), -/***/ "./src/abstracts/session_provider.ts": -/*!*******************************************!*\ - !*** ./src/abstracts/session_provider.ts ***! - \*******************************************/ -/*! exports provided: SessionProvider */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SessionProvider", function() { return SessionProvider; }); -/* harmony import */ var uniqid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uniqid */ "uniqid"); -/* harmony import */ var uniqid__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(uniqid__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); +// CONCATENATED MODULE: ./src/helpers/json_result.ts -var SessionProvider = /** @class */ (function () { - function SessionProvider() { - } - SessionProvider.prototype.createSession = function (sessionId) { - var now = new Date(); - this.sessionId = sessionId != null ? sessionId : uniqid__WEBPACK_IMPORTED_MODULE_0__(); - this.cookie.addCookie({ - name: _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].appSessionIdentifier, - value: this.sessionId, - httpOnly: true, - path: "/", - expires: new Date(now.setMinutes(now.getMinutes() + _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].sessionTimeOut)), - maxAge: _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].sessionTimeOut * 60 - }); - }; - SessionProvider.prototype.destroySession = function () { - var cookie = this.cookie.getCookie(_fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].appSessionIdentifier); - cookie.httpOnly = true; - cookie.path = "/"; - this.cookie.removeCookie(cookie); +var jsonResult = function (value, statusCode) { + return { + contentType: MIME_TYPE.Json, + responseData: value, + statusCode: statusCode || HTTP_STATUS_CODE.Ok }; - return SessionProvider; -}()); +}; +// CONCATENATED MODULE: ./src/helpers/text_result.ts -/***/ }), +var textResult = function (text, statusCode) { + return { + contentType: MIME_TYPE.Text, + responseData: text, + statusCode: statusCode || HTTP_STATUS_CODE.Ok + }; +}; -/***/ "./src/abstracts/shield.ts": -/*!*********************************!*\ - !*** ./src/abstracts/shield.ts ***! - \*********************************/ -/*! exports provided: Shield */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/helpers/html_result.ts -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Shield", function() { return Shield; }); -/* harmony import */ var _test_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../test_helpers */ "./src/test_helpers/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); +var htmlResult = function (html, statusCode) { + return { + contentType: MIME_TYPE.Html, + responseData: html, + statusCode: statusCode || HTTP_STATUS_CODE.Ok + }; +}; -var Shield = /** @class */ (function () { - function Shield() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } +// CONCATENATED MODULE: ./src/fort_global.ts +var isDevelopment = process.env.NODE_ENV === 'development'; +var isProduction = process.env.NODE_ENV === "production"; +var FortGlobal = /** @class */ (function () { + function FortGlobal() { } - Object.defineProperty(Shield.prototype, "logger", { + Object.defineProperty(FortGlobal, "isDevelopment", { get: function () { - return _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].logger; + return isDevelopment; }, enumerable: true, configurable: true }); - Shield.prototype.initialize = function (data) { - return Object(_test_helpers__WEBPACK_IMPORTED_MODULE_0__["initShield"])(this, data); - }; - return Shield; + Object.defineProperty(FortGlobal, "isProduction", { + get: function () { + return isProduction; + }, + enumerable: true, + configurable: true + }); + FortGlobal.walls = []; + return FortGlobal; }()); +// CONCATENATED MODULE: ./src/helpers/log_helper.ts -/***/ }), - -/***/ "./src/abstracts/view_engine.ts": -/*!**************************************!*\ - !*** ./src/abstracts/view_engine.ts ***! - \**************************************/ -/*! exports provided: ViewEngine */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewEngine", function() { return ViewEngine; }); -var ViewEngine = /** @class */ (function () { - function ViewEngine() { +var log_helper_LogHelper = /** @class */ (function () { + function LogHelper(type, info) { + this.type = type; + this.info_ = info; + this.message = this.getMsg_(); } - return ViewEngine; -}()); - - - -/***/ }), - -/***/ "./src/abstracts/wall.ts": -/*!*******************************!*\ - !*** ./src/abstracts/wall.ts ***! - \*******************************/ -/*! exports provided: Wall */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Wall", function() { return Wall; }); -/* harmony import */ var _test_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../test_helpers */ "./src/test_helpers/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + LogHelper.prototype.throw = function () { + var errMsg = this.get(); + throw JSON.stringify(errMsg); + }; + LogHelper.log = function (msg) { + console.log(msg); + }; + LogHelper.prototype.logError = function () { + console.error(this.get()); + }; + LogHelper.prototype.logWarning = function () { + console.warn(this.get()); + }; + LogHelper.prototype.get = function () { + return { + message: this.message, + type: this.type + }; + }; + LogHelper.prototype.getMsg_ = function () { + var errMsg; + switch (this.type) { + case ERROR_TYPE.InvalidControllerName: + errMsg = "Invalid controller name - '" + this.info_ + "'. Controller name must contain 'controller'."; + break; + case ERROR_TYPE.InvalidContentType: + errMsg = "Content type - '" + this.info_ + "' is not valid. Please create an issue if you think this is valid type."; + break; + case ERROR_TYPE.PortInUse: + errMsg = "Port " + this.info_ + " is being used by another process."; + break; + case ERROR_TYPE.UndefinedViewEngine: + errMsg = "View engine is not initiated.Initiate the view engine where fort is created."; + break; + default: + errMsg = this.message; + break; + } + return errMsg; + }; + return LogHelper; +}()); + + +// CONCATENATED MODULE: ./src/helpers/render_view.ts + + + +var renderView; +if (FortGlobal.isProduction === true) { + renderView = function (viewName, model) { + return FortGlobal.viewEngine.render({ + view: viewName, + model: model + }); + }; +} +else { + renderView = function (viewName, model) { + if (FortGlobal.viewEngine == null) { + new log_helper_LogHelper(ERROR_TYPE.UndefinedViewEngine).throw(); + } + return FortGlobal.viewEngine.render({ + view: viewName, + model: model + }); + }; +} + +// CONCATENATED MODULE: ./src/helpers/download_result.ts + +var downloadResult = function (filePath, downloadFileName) { + return { + statusCode: HTTP_STATUS_CODE.Ok, + file: { + filePath: filePath, + shouldDownload: true, + alias: downloadFileName + } + }; +}; + +// CONCATENATED MODULE: ./src/helpers/file_result.ts + +var fileResult = function (filePath) { + return { + statusCode: HTTP_STATUS_CODE.Ok, + file: { + filePath: filePath + } + }; +}; + +// CONCATENATED MODULE: ./src/helpers/redirect_result.ts + + +var redirectResult = function (url) { + return { + contentType: MIME_TYPE.Text, + responseData: url, + statusCode: HTTP_STATUS_CODE.Redirect, + shouldRedirect: true + }; +}; + +// CONCATENATED MODULE: ./src/helpers/view_result.ts +var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; @@ -381,1695 +476,683 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; +var view_result_this = undefined; -var Wall = /** @class */ (function () { - function Wall() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; +var viewResult = function (viewName, model) { return __awaiter(view_result_this, void 0, void 0, function () { + var viewData; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, renderView(viewName, model)]; + case 1: + viewData = _a.sent(); + return [2 /*return*/, { + contentType: MIME_TYPE.Html, + responseData: viewData, + statusCode: HTTP_STATUS_CODE.Ok + }]; } - } - Object.defineProperty(Wall.prototype, "logger", { - get: function () { - return _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].logger; - }, - enumerable: true, - configurable: true }); - Wall.prototype.onOutgoing = function (finalResult) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; +}); }; + +// EXTERNAL MODULE: external "fs-extra" +var external_fs_extra_ = __webpack_require__(1); + +// EXTERNAL MODULE: external "path" +var external_path_ = __webpack_require__(0); + +// CONCATENATED MODULE: ./src/helpers/get_view_from_file.ts +var get_view_from_file_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var get_view_from_file_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var get_view_from_file_this = undefined; + + + +var viewCache = {}; +var getViewFromFile; +var readView = function (option) { return get_view_from_file_awaiter(get_view_from_file_this, void 0, void 0, function () { + var pathOfView, result; + return get_view_from_file_generator(this, function (_a) { + switch (_a.label) { + case 0: + pathOfView = external_path_["join"](FortGlobal.viewPath, option.fileLocation); + return [4 /*yield*/, Object(external_fs_extra_["readFile"])(pathOfView, { + encoding: 'utf8' + })]; + case 1: + result = _a.sent(); + if (option.mapView != null) { + return [2 /*return*/, option.mapView(result)]; + } + return [2 /*return*/, result]; } - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/, null]; + }); +}); }; +if (FortGlobal.isProduction === true) { + getViewFromFile = function (option) { + return get_view_from_file_awaiter(this, void 0, void 0, function () { + var _a, _b; + return get_view_from_file_generator(this, function (_c) { + switch (_c.label) { + case 0: + if (!(viewCache[option.fileLocation] == null)) return [3 /*break*/, 2]; + _a = viewCache; + _b = option.fileLocation; + return [4 /*yield*/, readView(option)]; + case 1: + _a[_b] = _c.sent(); + _c.label = 2; + case 2: return [2 /*return*/, viewCache[option.fileLocation]]; + } }); }); }; - Wall.prototype.initialize = function (data) { - return Object(_test_helpers__WEBPACK_IMPORTED_MODULE_0__["initWall"])(this, data); +} +else { + getViewFromFile = function (option) { + return get_view_from_file_awaiter(this, void 0, void 0, function () { + return get_view_from_file_generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, readView(option)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); }; - return Wall; -}()); +} +// CONCATENATED MODULE: ./src/helpers/promise.ts +var promise = function (callBack) { + return new Promise(callBack); +}; +// CONCATENATED MODULE: ./src/helpers/get_mime_type_from_extension.ts -/***/ }), +var getMimeTypeFromExtension = function (ext) { + switch (ext) { + case ".htm": + case ".html": + return MIME_TYPE.Html; + case ".css": + return MIME_TYPE.Css; + case ".js": + return MIME_TYPE.Js; + case ".png": + return MIME_TYPE.Png; + case ".woff": + return MIME_TYPE.Woff; + case ".woff2": + return MIME_TYPE.Woff2; + case ".json": + return MIME_TYPE.Json; + case ".txt": + return MIME_TYPE.Text; + case ".jpg": + case ".jpeg": + return MIME_TYPE.Jpeg; + case ".rtf": + return MIME_TYPE.Rtf; + case ".ttf": + return MIME_TYPE.Ttf; + case ".eot": + return MIME_TYPE.Eot; + case '.otf': + return MIME_TYPE.Otf; + case ".swf": + return MIME_TYPE.Swf; + case ".avi": + return MIME_TYPE.Avi; + case ".Svg": + return MIME_TYPE.Svg; + case ".pdf": + return MIME_TYPE.Pdf; + case ".xml": + return MIME_TYPE.Xml; + case ".csv": + return MIME_TYPE.Csv; + case ".xls": + return MIME_TYPE.Xls; + case ".xlsx": + return MIME_TYPE.Xlsx; + case ".bmp": + return MIME_TYPE.Bmp; + case ".gif": + return MIME_TYPE.Gif; + default: + return "application/octet-stream"; + } +}; -/***/ "./src/abstracts/xml_parser.ts": -/*!*************************************!*\ - !*** ./src/abstracts/xml_parser.ts ***! - \*************************************/ -/*! exports provided: XmlParser */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/utils/is_null_or_empty.ts +var isNullOrEmpty = function (value) { + return value == null || value.length === 0; +}; -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XmlParser", function() { return XmlParser; }); -var XmlParser = /** @class */ (function () { - function XmlParser() { - } - return XmlParser; -}()); +// CONCATENATED MODULE: ./src/utils/is_null.ts +var isNull = function (value) { + return value == null; +}; +// CONCATENATED MODULE: ./src/utils/is_array.ts +var isArray = function (value) { + return Array.isArray(value); +}; +// CONCATENATED MODULE: ./src/utils/index.ts -/***/ }), -/***/ "./src/constant.ts": -/*!*************************!*\ - !*** ./src/constant.ts ***! - \*************************/ -/*! exports provided: __ContentType, __AppName, __Cookie, __SetCookie, __CurrentPath, __ContentLength, __Constructor */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__ContentType", function() { return __ContentType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__AppName", function() { return __AppName; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__Cookie", function() { return __Cookie; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__SetCookie", function() { return __SetCookie; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__CurrentPath", function() { return __CurrentPath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__ContentLength", function() { return __ContentLength; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__Constructor", function() { return __Constructor; }); -/* tslint:disable */ -var __ContentType = "Content-Type"; -var __AppName = "fort"; -var __Cookie = "Cookie"; -var __SetCookie = 'Set-Cookie'; -var __CurrentPath = process.cwd(); -var __ContentLength = "Content-Length"; -var __Constructor = "const_constructor"; - - -/***/ }), -/***/ "./src/decorators/assign.ts": -/*!**********************************!*\ - !*** ./src/decorators/assign.ts ***! - \**********************************/ -/*! exports provided: Assign */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/handlers/route_handler.ts -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return Assign; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -// tslint:disable-next-line -var Assign = function (value) { - return function (target, methodName, paramIndex) { - var className = target.name || target.constructor.name; - if (methodName == null) { - methodName = _constant__WEBPACK_IMPORTED_MODULE_1__["__Constructor"]; - } - _handlers__WEBPACK_IMPORTED_MODULE_0__["InjectorHandler"].addWorkerValue(className, methodName, paramIndex, value); - }; +var routerCollection = {}; +var pushRouterIntoCollection = function (route) { + var routeObj = new RouteInfo(); + routeObj.init(route); + routerCollection[route.controllerName] = routeObj; }; - - -/***/ }), - -/***/ "./src/decorators/default_worker.ts": -/*!******************************************!*\ - !*** ./src/decorators/default_worker.ts ***! - \******************************************/ -/*! exports provided: DefaultWorker */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultWorker", function() { return DefaultWorker; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _route__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./route */ "./src/decorators/route.ts"); -/* harmony import */ var _worker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./worker */ "./src/decorators/worker.ts"); - - - -// tslint:disable-next-line -var DefaultWorker = function (allowedMethods) { - return function (target, methodName, descriptor) { - var className = target.constructor.name; - var actionInfo = { - workerName: methodName, - methodsAllowed: allowedMethods == null ? [_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Get] : allowedMethods, - guards: [], - pattern: "/", - values: [] - }; - // RouteHandler.addWorker(actionInfo, className); - Object(_worker__WEBPACK_IMPORTED_MODULE_2__["Worker"])(allowedMethods == null ? [_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Get] : allowedMethods)(target, methodName, descriptor); - Object(_route__WEBPACK_IMPORTED_MODULE_1__["Route"])("/")(target, methodName, descriptor); - }; +var getActionPattern = function (parentRoute, pattern) { + return (isNull(parentRoute.path) || parentRoute.path === "/*") ? pattern : "" + parentRoute.path + pattern; }; - - -/***/ }), - -/***/ "./src/decorators/expect_body.ts": -/*!***************************************!*\ - !*** ./src/decorators/expect_body.ts ***! - \***************************************/ -/*! exports provided: ExpectBody */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpectBody", function() { return ExpectBody; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -/* harmony import */ var _enums_data_type__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../enums/data_type */ "./src/enums/data_type.ts"); - - - -function ExpectBody(value) { - return function (target, methodName, descriptor) { - var className = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["getClassName"])(target); - var type = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["getDataType"])(value); - switch (type) { - case _enums_data_type__WEBPACK_IMPORTED_MODULE_2__["DATA_TYPE"].Function: - var valueClassName = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["getClassName"])(value); - if (valueClassName != null) { - value = new value(); - } - case _enums_data_type__WEBPACK_IMPORTED_MODULE_2__["DATA_TYPE"].Object: - value = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["removeMethodAndNullFromObject"])(value); - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addExpected("body", className, methodName, value); - break; - default: - throw new Error("expected body should be always an object but found " + type); - } - }; -} - - -/***/ }), - -/***/ "./src/decorators/expect_query.ts": -/*!****************************************!*\ - !*** ./src/decorators/expect_query.ts ***! - \****************************************/ -/*! exports provided: ExpectQuery */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpectQuery", function() { return ExpectQuery; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); -/* harmony import */ var _enums_data_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/data_type */ "./src/enums/data_type.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); - - - -function ExpectQuery(value) { - return function (target, methodName, descriptor) { - var className = Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["getClassName"])(target); - var type = Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["getDataType"])(value); - switch (type) { - case _enums_data_type__WEBPACK_IMPORTED_MODULE_1__["DATA_TYPE"].Function: - var valueClassName = Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["getClassName"])(value); - if (valueClassName != null) { - value = new value(); - } - case _enums_data_type__WEBPACK_IMPORTED_MODULE_1__["DATA_TYPE"].Object: - value = Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["removeMethodAndNullFromObject"])(value); - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addExpected("query", className, methodName, value); - break; - default: - throw new Error("expected query should be always an object but found " + type); +var route_handler_RouteHandler = /** @class */ (function () { + function RouteHandler() { + } + Object.defineProperty(RouteHandler, "routerCollection", { + get: function () { + return routerCollection; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RouteHandler, "routesAsArray", { + get: function () { + return Object.keys(routerCollection).map(function (workerName) { + return routerCollection[workerName]; + }); + }, + enumerable: true, + configurable: true + }); + RouteHandler.findControllerFromPath = function (urlParts) { + var _loop_1 = function (controllerName) { + var isMatched = false; + var controller = routerCollection[controllerName]; + var patternSplit = controller.path.split("/"); + patternSplit.every(function (patternPart, i) { + isMatched = patternPart === urlParts[i]; + return isMatched; + }); + if (isMatched === true) { + return { value: controller }; + } + }; + for (var controllerName in routerCollection) { + var state_1 = _loop_1(controllerName); + if (typeof state_1 === "object") + return state_1.value; } }; -} - - -/***/ }), - -/***/ "./src/decorators/guards.ts": -/*!**********************************!*\ - !*** ./src/decorators/guards.ts ***! - \**********************************/ -/*! exports provided: Guards */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Guards", function() { return Guards; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); - -// tslint:disable-next-line -var Guards = function (value) { - return (function (target, methodName, descriptor) { - var className = target.constructor.name; - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addGuards(value, className, methodName); + Object.defineProperty(RouteHandler, "defaultRoute", { + get: function () { + return routerCollection[RouteHandler.defaultRouteControllerName]; + }, + enumerable: true, + configurable: true }); -}; - - -/***/ }), - -/***/ "./src/decorators/index.ts": -/*!*********************************!*\ - !*** ./src/decorators/index.ts ***! - \*********************************/ -/*! exports provided: Worker, Shields, Guards, Route, DefaultWorker, Assign, Singleton, ExpectBody, ExpectQuery */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./worker */ "./src/decorators/worker.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Worker", function() { return _worker__WEBPACK_IMPORTED_MODULE_0__["Worker"]; }); - -/* harmony import */ var _shields__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shields */ "./src/decorators/shields.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Shields", function() { return _shields__WEBPACK_IMPORTED_MODULE_1__["Shields"]; }); - -/* harmony import */ var _guards__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./guards */ "./src/decorators/guards.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Guards", function() { return _guards__WEBPACK_IMPORTED_MODULE_2__["Guards"]; }); - -/* harmony import */ var _route__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./route */ "./src/decorators/route.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return _route__WEBPACK_IMPORTED_MODULE_3__["Route"]; }); - -/* harmony import */ var _default_worker__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./default_worker */ "./src/decorators/default_worker.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DefaultWorker", function() { return _default_worker__WEBPACK_IMPORTED_MODULE_4__["DefaultWorker"]; }); - -/* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./assign */ "./src/decorators/assign.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return _assign__WEBPACK_IMPORTED_MODULE_5__["Assign"]; }); - -/* harmony import */ var _singleton__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./singleton */ "./src/decorators/singleton.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Singleton", function() { return _singleton__WEBPACK_IMPORTED_MODULE_6__["Singleton"]; }); - -/* harmony import */ var _expect_body__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./expect_body */ "./src/decorators/expect_body.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ExpectBody", function() { return _expect_body__WEBPACK_IMPORTED_MODULE_7__["ExpectBody"]; }); - -/* harmony import */ var _expect_query__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./expect_query */ "./src/decorators/expect_query.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ExpectQuery", function() { return _expect_query__WEBPACK_IMPORTED_MODULE_8__["ExpectQuery"]; }); - - - - - - - - - - - - -/***/ }), - -/***/ "./src/decorators/route.ts": -/*!*********************************!*\ - !*** ./src/decorators/route.ts ***! - \*********************************/ -/*! exports provided: Route */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return Route; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); - - -// tslint:disable-next-line -var Route = function (format) { - return (function (target, methodName, descriptor) { - var className = target.constructor.name; - // remove / from route - if (format != null) { - format = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["removeLastSlash"])(format); + RouteHandler.addToRouterCollection = function (value) { + var route = routerCollection[value.controller.name]; + if (route == null) { + pushRouterIntoCollection({ + workers: {}, + controller: value.controller, + controllerName: value.controller.name, + path: value.path, + shields: [], + values: [] + }); + } + else { + route.controller = value.controller; + route.path = value.path; + // change pattern value since we have controller name now. + for (var workerName in route.workers) { + var actionInfo = route.workers[workerName]; + actionInfo.pattern = getActionPattern(value, actionInfo.pattern); + } } - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addPattern(format, className, methodName); - }); -}; - - -/***/ }), - -/***/ "./src/decorators/shields.ts": -/*!***********************************!*\ - !*** ./src/decorators/shields.ts ***! - \***********************************/ -/*! exports provided: Shields */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Shields", function() { return Shields; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); - -// tslint:disable-next-line -var Shields = function (shieldsValue) { - return function (target) { - var className = target.name; - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addShields(shieldsValue, className); }; -}; - - -/***/ }), - -/***/ "./src/decorators/singleton.ts": -/*!*************************************!*\ - !*** ./src/decorators/singleton.ts ***! - \*************************************/ -/*! exports provided: Singleton */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Singleton", function() { return Singleton; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); - - -// tslint:disable-next-line -var Singleton = function (value) { - return function (target, methodName, paramIndex) { - var className = target.name || target.constructor.name; - if (methodName == null || methodName === 'constructor') { - methodName = _constant__WEBPACK_IMPORTED_MODULE_1__["__Constructor"]; + RouteHandler.addShields = function (shields, className) { + var route = routerCollection[className]; + if (route == null) { + pushRouterIntoCollection({ + workers: {}, + controller: null, + controllerName: className, + shields: shields, + path: null, + values: [] + }); + } + else { + route.shields = shields; } - _handlers__WEBPACK_IMPORTED_MODULE_0__["InjectorHandler"].addSingleton(className, methodName, paramIndex, value); }; -}; - - -/***/ }), - -/***/ "./src/decorators/worker.ts": -/*!**********************************!*\ - !*** ./src/decorators/worker.ts ***! - \**********************************/ -/*! exports provided: Worker */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Worker", function() { return Worker; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); - - -// tslint:disable-next-line -var Worker = function (allowedMethods) { - return function (target, methodName, descriptor) { - var className = target.constructor.name; - var actionInfo = { - workerName: methodName, - methodsAllowed: allowedMethods == null ? [ - _enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Delete, _enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Get, _enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Post, _enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Patch, _enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_METHOD"].Put - ] : allowedMethods, - guards: [], - pattern: "/" + methodName.toLowerCase(), - values: [] - }; - _handlers__WEBPACK_IMPORTED_MODULE_1__["RouteHandler"].addWorker(actionInfo, className); - }; -}; - - -/***/ }), - -/***/ "./src/enums/data_type.ts": -/*!********************************!*\ - !*** ./src/enums/data_type.ts ***! - \********************************/ -/*! exports provided: DATA_TYPE */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DATA_TYPE", function() { return DATA_TYPE; }); -var DATA_TYPE; -(function (DATA_TYPE) { - DATA_TYPE["String"] = "string"; - DATA_TYPE["Number"] = "number"; - DATA_TYPE["Array"] = "array"; - DATA_TYPE["Object"] = "object"; - DATA_TYPE["Function"] = "function"; -})(DATA_TYPE || (DATA_TYPE = {})); - - -/***/ }), - -/***/ "./src/enums/error_type.ts": -/*!*********************************!*\ - !*** ./src/enums/error_type.ts ***! - \*********************************/ -/*! exports provided: ERROR_TYPE */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_TYPE", function() { return ERROR_TYPE; }); -var ERROR_TYPE; -(function (ERROR_TYPE) { - ERROR_TYPE["InvalidControllerName"] = "invalid_controller_name"; - ERROR_TYPE["InvalidContentType"] = "invalid_content_type"; - ERROR_TYPE["PortInUse"] = "port_in_use"; - ERROR_TYPE["UndefinedViewEngine"] = "undefined_view_engine"; -})(ERROR_TYPE || (ERROR_TYPE = {})); - - -/***/ }), - -/***/ "./src/enums/etag_type.ts": -/*!********************************!*\ - !*** ./src/enums/etag_type.ts ***! - \********************************/ -/*! exports provided: ETag_Type */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ETag_Type", function() { return ETag_Type; }); -var ETag_Type; -(function (ETag_Type) { - ETag_Type["Strong"] = "strong"; - ETag_Type["Weak"] = "weak"; -})(ETag_Type || (ETag_Type = {})); - - -/***/ }), - -/***/ "./src/enums/http_method.ts": -/*!**********************************!*\ - !*** ./src/enums/http_method.ts ***! - \**********************************/ -/*! exports provided: HTTP_METHOD */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTTP_METHOD", function() { return HTTP_METHOD; }); -var HTTP_METHOD; -(function (HTTP_METHOD) { - HTTP_METHOD["Get"] = "GET"; - HTTP_METHOD["Post"] = "POST"; - HTTP_METHOD["Put"] = "PUT"; - HTTP_METHOD["Patch"] = "PATCH"; - HTTP_METHOD["Delete"] = "DELETE"; - HTTP_METHOD["Options"] = "OPTIONS"; - HTTP_METHOD["Head"] = "HEAD"; -})(HTTP_METHOD || (HTTP_METHOD = {})); - - -/***/ }), - -/***/ "./src/enums/http_status_code.ts": -/*!***************************************!*\ - !*** ./src/enums/http_status_code.ts ***! - \***************************************/ -/*! exports provided: HTTP_STATUS_CODE */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTTP_STATUS_CODE", function() { return HTTP_STATUS_CODE; }); -var HTTP_STATUS_CODE; -(function (HTTP_STATUS_CODE) { - HTTP_STATUS_CODE[HTTP_STATUS_CODE["BadRequest"] = 400] = "BadRequest"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["Unauthorized"] = 401] = "Unauthorized"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["Forbidden"] = 403] = "Forbidden"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["NotFound"] = 404] = "NotFound"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["Ok"] = 200] = "Ok"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["Created"] = 201] = "Created"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["NoContent"] = 204] = "NoContent"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["Redirect"] = 302] = "Redirect"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["NotModified"] = 304] = "NotModified"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["MethodNotAllowed"] = 405] = "MethodNotAllowed"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["NotAcceptable"] = 406] = "NotAcceptable"; - HTTP_STATUS_CODE[HTTP_STATUS_CODE["InternalServerError"] = 500] = "InternalServerError"; -})(HTTP_STATUS_CODE || (HTTP_STATUS_CODE = {})); - - -/***/ }), - -/***/ "./src/enums/index.ts": -/*!****************************!*\ - !*** ./src/enums/index.ts ***! - \****************************/ -/*! exports provided: MIME_TYPE, HTTP_METHOD, HTTP_STATUS_CODE, ETag_Type, ERROR_TYPE, DATA_TYPE */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _mime_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mime_type */ "./src/enums/mime_type.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MIME_TYPE", function() { return _mime_type__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"]; }); - -/* harmony import */ var _http_method__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./http_method */ "./src/enums/http_method.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTTP_METHOD", function() { return _http_method__WEBPACK_IMPORTED_MODULE_1__["HTTP_METHOD"]; }); - -/* harmony import */ var _http_status_code__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http_status_code */ "./src/enums/http_status_code.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTTP_STATUS_CODE", function() { return _http_status_code__WEBPACK_IMPORTED_MODULE_2__["HTTP_STATUS_CODE"]; }); - -/* harmony import */ var _etag_type__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./etag_type */ "./src/enums/etag_type.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ETag_Type", function() { return _etag_type__WEBPACK_IMPORTED_MODULE_3__["ETag_Type"]; }); - -/* harmony import */ var _error_type__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error_type */ "./src/enums/error_type.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_TYPE", function() { return _error_type__WEBPACK_IMPORTED_MODULE_4__["ERROR_TYPE"]; }); - -/* harmony import */ var _data_type__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./data_type */ "./src/enums/data_type.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DATA_TYPE", function() { return _data_type__WEBPACK_IMPORTED_MODULE_5__["DATA_TYPE"]; }); - - - - - - - - - -/***/ }), - -/***/ "./src/enums/mime_type.ts": -/*!********************************!*\ - !*** ./src/enums/mime_type.ts ***! - \********************************/ -/*! exports provided: MIME_TYPE */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MIME_TYPE", function() { return MIME_TYPE; }); -var MIME_TYPE; -(function (MIME_TYPE) { - MIME_TYPE["Text"] = "text/plain"; - MIME_TYPE["Json"] = "application/json"; - MIME_TYPE["Html"] = "text/html"; - MIME_TYPE["FormUrlEncoded"] = "application/x-www-form-urlencoded"; - MIME_TYPE["Css"] = "text/css"; - MIME_TYPE["Csv"] = "text/csv"; - MIME_TYPE["Js"] = "application/javascript"; - MIME_TYPE["Bmp"] = "image/bmp"; - MIME_TYPE["Jpeg"] = "image/jpeg"; - MIME_TYPE["Gif"] = "image/gif"; - MIME_TYPE["Ico"] = "image/x-icon"; - MIME_TYPE["Png"] = "image/png"; - MIME_TYPE["Pdf"] = "application/pdf"; - MIME_TYPE["Svg"] = "image/svg+xml"; - MIME_TYPE["Rtf"] = "application/rtf"; - MIME_TYPE["Xml"] = "application/xml"; - MIME_TYPE["Xls"] = "application/vnd.ms-excel"; - MIME_TYPE["Xlsx"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; - MIME_TYPE["Ttf"] = "font/ttf"; - MIME_TYPE["Woff"] = "font/woff"; - MIME_TYPE["Woff2"] = "font/woff2"; - MIME_TYPE["Eot"] = "application/vnd.ms-fontobject"; - MIME_TYPE["Otf"] = "font/otf"; - MIME_TYPE["Swf"] = "application/x-shockwave-flash"; - MIME_TYPE["Avi"] = "video/avi"; - MIME_TYPE["FormMultiPart"] = "multipart/form-data"; -})(MIME_TYPE || (MIME_TYPE = {})); - - -/***/ }), - -/***/ "./src/extra/index.ts": -/*!****************************!*\ - !*** ./src/extra/index.ts ***! - \****************************/ -/*! exports provided: MustacheViewEngine, MemorySessionProvider */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _mustache_view_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mustache_view_engine */ "./src/extra/mustache_view_engine.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MustacheViewEngine", function() { return _mustache_view_engine__WEBPACK_IMPORTED_MODULE_0__["MustacheViewEngine"]; }); - -/* harmony import */ var _memory_session_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./memory_session_provider */ "./src/extra/memory_session_provider.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MemorySessionProvider", function() { return _memory_session_provider__WEBPACK_IMPORTED_MODULE_1__["MemorySessionProvider"]; }); - - - - - -/***/ }), - -/***/ "./src/extra/memory_session_provider.ts": -/*!**********************************************!*\ - !*** ./src/extra/memory_session_provider.ts ***! - \**********************************************/ -/*! exports provided: MemorySessionProvider */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MemorySessionProvider", function() { return MemorySessionProvider; }); -/* harmony import */ var _abstracts_session_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abstracts/session_provider */ "./src/abstracts/session_provider.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - -var sessionValues = {}; -var MemorySessionProvider = /** @class */ (function (_super) { - __extends(MemorySessionProvider, _super); - function MemorySessionProvider() { - return _super !== null && _super.apply(this, arguments) || this; - } - MemorySessionProvider.prototype.get = function (key) { - return __awaiter(this, void 0, void 0, function () { - var savedSession; - return __generator(this, function (_a) { - savedSession = sessionValues[this.sessionId]; - return [2 /*return*/, savedSession != null ? savedSession[key] : null]; - }); - }); - }; - MemorySessionProvider.prototype.isExist = function (key) { - return __awaiter(this, void 0, void 0, function () { - var savedValue; - return __generator(this, function (_a) { - savedValue = sessionValues[this.sessionId]; - return [2 /*return*/, savedValue == null ? false : savedValue[key] != null]; - }); - }); - }; - MemorySessionProvider.prototype.getAll = function () { - return __awaiter(this, void 0, void 0, function () { - var savedValue; - return __generator(this, function (_a) { - savedValue = sessionValues[this.sessionId]; - return [2 /*return*/, savedValue == null ? {} : savedValue]; - }); - }); - }; - MemorySessionProvider.prototype.set = function (key, val) { - return __awaiter(this, void 0, void 0, function () { - var _a, savedValue; - return __generator(this, function (_b) { - savedValue = sessionValues[this.sessionId]; - if (savedValue == null) { - this.createSession(); - sessionValues[this.sessionId] = (_a = {}, - _a[key] = val, - _a); - } - else { - savedValue[key] = val; - } - return [2 /*return*/]; - }); - }); - }; - MemorySessionProvider.prototype.setMany = function (values) { - var _this = this; - return Promise.all(Object.keys(values).map(function (key) { - return _this.set(key, values[key]); - })); - }; - MemorySessionProvider.prototype.remove = function (key) { - return __awaiter(this, void 0, void 0, function () { - var savedValue; - return __generator(this, function (_a) { - savedValue = sessionValues[this.sessionId]; - if (savedValue != null) { - savedValue[key] = null; - } - return [2 /*return*/]; - }); - }); - }; - MemorySessionProvider.prototype.clear = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - // remove session values - delete sessionValues[this.sessionId]; - // expire cookie in browser - this.destroySession(); - return [2 /*return*/]; - }); - }); - }; - return MemorySessionProvider; -}(_abstracts_session_provider__WEBPACK_IMPORTED_MODULE_0__["SessionProvider"])); - - - -/***/ }), - -/***/ "./src/extra/mustache_view_engine.ts": -/*!*******************************************!*\ - !*** ./src/extra/mustache_view_engine.ts ***! - \*******************************************/ -/*! exports provided: MustacheViewEngine */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MustacheViewEngine", function() { return MustacheViewEngine; }); -/* harmony import */ var mustache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mustache */ "mustache"); -/* harmony import */ var mustache__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(mustache__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - -var MustacheViewEngine = /** @class */ (function () { - function MustacheViewEngine() { - } - MustacheViewEngine.prototype.render = function (value) { - return __awaiter(this, void 0, void 0, function () { - var viewData; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["getViewFromFile"])({ - fileLocation: value.view - })]; - case 1: - viewData = _a.sent(); - return [2 /*return*/, mustache__WEBPACK_IMPORTED_MODULE_0__["render"](viewData, value.model)]; - } - }); - }); - }; - return MustacheViewEngine; -}()); - - - -/***/ }), - -/***/ "./src/fort_global.ts": -/*!****************************!*\ - !*** ./src/fort_global.ts ***! - \****************************/ -/*! exports provided: FortGlobal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FortGlobal", function() { return FortGlobal; }); -var isDevelopment = process.env.NODE_ENV === 'development'; -var isProduction = process.env.NODE_ENV === "production"; -var FortGlobal = /** @class */ (function () { - function FortGlobal() { - } - Object.defineProperty(FortGlobal, "isDevelopment", { - get: function () { - return isDevelopment; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FortGlobal, "isProduction", { - get: function () { - return isProduction; - }, - enumerable: true, - configurable: true - }); - FortGlobal.walls = []; - return FortGlobal; -}()); - - - -/***/ }), - -/***/ "./src/generics/generic_controller.ts": -/*!********************************************!*\ - !*** ./src/generics/generic_controller.ts ***! - \********************************************/ -/*! exports provided: GenericController */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericController", function() { return GenericController; }); -/* harmony import */ var _abstracts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abstracts */ "./src/abstracts/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - -var GenericController = /** @class */ (function (_super) { - __extends(GenericController, _super); - function GenericController() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return _super.call(this) || this; - } - return GenericController; -}(_abstracts__WEBPACK_IMPORTED_MODULE_0__["Controller"])); - - - -/***/ }), - -/***/ "./src/generics/generic_guard.ts": -/*!***************************************!*\ - !*** ./src/generics/generic_guard.ts ***! - \***************************************/ -/*! exports provided: GenericGuard */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericGuard", function() { return GenericGuard; }); -/* harmony import */ var _abstracts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abstracts */ "./src/abstracts/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - -var GenericGuard = /** @class */ (function (_super) { - __extends(GenericGuard, _super); - function GenericGuard() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return _super.call(this) || this; - } - GenericGuard.prototype.check = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return null; - }; - return GenericGuard; -}(_abstracts__WEBPACK_IMPORTED_MODULE_0__["Guard"])); - - - -/***/ }), - -/***/ "./src/generics/generic_session_provider.ts": -/*!**************************************************!*\ - !*** ./src/generics/generic_session_provider.ts ***! - \**************************************************/ -/*! exports provided: GenericSessionProvider */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericSessionProvider", function() { return GenericSessionProvider; }); -/* harmony import */ var _abstracts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abstracts */ "./src/abstracts/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - -var GenericSessionProvider = /** @class */ (function (_super) { - __extends(GenericSessionProvider, _super); - function GenericSessionProvider() { - return _super !== null && _super.apply(this, arguments) || this; - } - GenericSessionProvider.prototype.get = function () { - return null; - }; - GenericSessionProvider.prototype.getAll = function () { - return null; - }; - GenericSessionProvider.prototype.set = function (key, value) { - return null; - }; - GenericSessionProvider.prototype.isExist = function (key) { - return null; - }; - GenericSessionProvider.prototype.remove = function (key) { - return null; - }; - GenericSessionProvider.prototype.setMany = function (values) { - return null; - }; - GenericSessionProvider.prototype.clear = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; - }); - }); - }; - return GenericSessionProvider; -}(_abstracts__WEBPACK_IMPORTED_MODULE_0__["SessionProvider"])); - - - -/***/ }), - -/***/ "./src/generics/generic_shield.ts": -/*!****************************************!*\ - !*** ./src/generics/generic_shield.ts ***! - \****************************************/ -/*! exports provided: GenericShield */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericShield", function() { return GenericShield; }); -/* harmony import */ var _abstracts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abstracts */ "./src/abstracts/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - -var GenericShield = /** @class */ (function (_super) { - __extends(GenericShield, _super); - function GenericShield() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return _super.call(this) || this; - } - GenericShield.prototype.protect = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return null; - }; - return GenericShield; -}(_abstracts__WEBPACK_IMPORTED_MODULE_0__["Shield"])); - - - -/***/ }), - -/***/ "./src/generics/generic_wall.ts": -/*!**************************************!*\ - !*** ./src/generics/generic_wall.ts ***! - \**************************************/ -/*! exports provided: GenericWall */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericWall", function() { return GenericWall; }); -/* harmony import */ var _abstracts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abstracts */ "./src/abstracts/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - -var GenericWall = /** @class */ (function (_super) { - __extends(GenericWall, _super); - function GenericWall() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return _super.call(this) || this; - } - GenericWall.prototype.onIncoming = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return null; - }; - return GenericWall; -}(_abstracts__WEBPACK_IMPORTED_MODULE_0__["Wall"])); - - - -/***/ }), - -/***/ "./src/generics/generic_xml_parser.ts": -/*!********************************************!*\ - !*** ./src/generics/generic_xml_parser.ts ***! - \********************************************/ -/*! exports provided: GenericXmlParser */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericXmlParser", function() { return GenericXmlParser; }); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var GenericXmlParser = /** @class */ (function () { - function GenericXmlParser() { - } - GenericXmlParser.prototype.parse = function (xml) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - // tslint:disable-next-line - throw { - message: "no xml parser configured" - }; - }); - }); - }; - return GenericXmlParser; -}()); - - - -/***/ }), - -/***/ "./src/generics/index.ts": -/*!*******************************!*\ - !*** ./src/generics/index.ts ***! - \*******************************/ -/*! exports provided: GenericGuard, GenericShield, GenericSessionProvider, GenericWall, GenericController, GenericXmlParser */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _generic_guard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./generic_guard */ "./src/generics/generic_guard.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericGuard", function() { return _generic_guard__WEBPACK_IMPORTED_MODULE_0__["GenericGuard"]; }); - -/* harmony import */ var _generic_shield__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./generic_shield */ "./src/generics/generic_shield.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericShield", function() { return _generic_shield__WEBPACK_IMPORTED_MODULE_1__["GenericShield"]; }); - -/* harmony import */ var _generic_session_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generic_session_provider */ "./src/generics/generic_session_provider.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericSessionProvider", function() { return _generic_session_provider__WEBPACK_IMPORTED_MODULE_2__["GenericSessionProvider"]; }); - -/* harmony import */ var _generic_wall__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./generic_wall */ "./src/generics/generic_wall.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericWall", function() { return _generic_wall__WEBPACK_IMPORTED_MODULE_3__["GenericWall"]; }); - -/* harmony import */ var _generic_controller__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_controller */ "./src/generics/generic_controller.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericController", function() { return _generic_controller__WEBPACK_IMPORTED_MODULE_4__["GenericController"]; }); - -/* harmony import */ var _generic_xml_parser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./generic_xml_parser */ "./src/generics/generic_xml_parser.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericXmlParser", function() { return _generic_xml_parser__WEBPACK_IMPORTED_MODULE_5__["GenericXmlParser"]; }); - - - - - - - - - -/***/ }), - -/***/ "./src/handlers/controller_result_handler.ts": -/*!***************************************************!*\ - !*** ./src/handlers/controller_result_handler.ts ***! - \***************************************************/ -/*! exports provided: ControllerResultHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerResultHandler", function() { return ControllerResultHandler; }); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _file_handler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./file_handler */ "./src/handlers/file_handler.ts"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! path */ "path"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - - - -var ControllerResultHandler = /** @class */ (function (_super) { - __extends(ControllerResultHandler, _super); - function ControllerResultHandler() { - return _super !== null && _super.apply(this, arguments) || this; - } - ControllerResultHandler.prototype.endResponse_ = function (negotiateMimeType) { + RouteHandler.addWorker = function (newWorker, className) { var _a; - var data; - try { - data = Object(_helpers__WEBPACK_IMPORTED_MODULE_4__["getResultBasedOnMiMe"])(negotiateMimeType, this.controllerResult_.responseData, function (type) { - negotiateMimeType = type; + var workerName = newWorker.workerName; + var route = routerCollection[className]; + if (route == null) { + pushRouterIntoCollection({ + workers: (_a = {}, + _a[workerName] = newWorker, + _a), + controller: null, + controllerName: className, + shields: [], + path: null, + values: [] }); } - catch (ex) { - this.onErrorOccured(ex); - return; + else { + var savedAction = route.workers[workerName]; + if (savedAction == null) { + newWorker.pattern = getActionPattern(route, newWorker.pattern); + route.workers[workerName] = newWorker; + } + else { + savedAction.methodsAllowed = newWorker.methodsAllowed; + savedAction.pattern = getActionPattern(route, savedAction.pattern); + // route.path == null ? savedAction.pattern : `/${route.path}${savedAction.pattern}`; + } } - this.response.writeHead(this.controllerResult_.statusCode || _enums__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Ok, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_0__["__ContentType"]] = negotiateMimeType, _a)); - this.response.end(data); - }; - ControllerResultHandler.prototype.handleRedirectResult_ = function () { - // this.response.setHeader('Location', this.controllerResult_.responseData); - this.response.writeHead(this.controllerResult_.statusCode || _enums__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Ok, { 'Location': this.controllerResult_.responseData }); - this.response.end(); }; - ControllerResultHandler.prototype.handleFormatResult_ = function () { - var negotiateMimeType = this.getContentTypeFromNegotiationHavingMultipleTypes(Object.keys(this.controllerResult_.responseFormat)); - var key = Object.keys(this.controllerResult_.responseFormat).find(function (qry) { return qry === negotiateMimeType; }); - if (key != null) { - this.controllerResult_.responseData = this.controllerResult_.responseFormat[key](); - this.endResponse_(negotiateMimeType); + RouteHandler.addGuards = function (guards, className, workerName) { + var _a; + var route = routerCollection[className]; + var pattern = workerName.toLowerCase(); + if (route == null) { + pushRouterIntoCollection({ + workers: (_a = {}, + _a[workerName] = { + workerName: workerName, + guards: guards, + methodsAllowed: null, + pattern: pattern, + values: [] + }, + _a), + controller: null, + controllerName: className, + shields: [], + path: null, + values: [] + }); } else { - this.onNotAcceptableRequest(); - } - }; - ControllerResultHandler.prototype.handleFileResult_ = function () { - var result = this.controllerResult_; - var parsedPath = path__WEBPACK_IMPORTED_MODULE_3__["parse"](result.file.filePath); - if (result.file.shouldDownload === true) { - var fileName = result.file.alias == null ? parsedPath.name : result.file.alias; - this.response.setHeader("content-disposition", "attachment;filename=" + fileName + parsedPath.ext); + var savedAction = route.workers[workerName]; + if (savedAction == null) { + route.workers[workerName] = { + workerName: workerName, + guards: guards, + methodsAllowed: null, + pattern: pattern, + values: [] + }; + } + else { + savedAction.guards = guards; + } } - this.handleFileRequestFromAbsolutePath(result.file.filePath, parsedPath.ext); }; - ControllerResultHandler.prototype.onTerminationFromWall = function (result) { - this.controllerResult_ = result; - this.handleFinalResult_(); - }; - ControllerResultHandler.prototype.handleFinalResult_ = function () { - var _this = this; - var result = this.controllerResult_; - this.cookieManager.responseCookie_.forEach(function (value) { - _this.response.setHeader(_constant__WEBPACK_IMPORTED_MODULE_0__["__SetCookie"], value); - }); - if (result.shouldRedirect === true) { - this.handleRedirectResult_(); + RouteHandler.addPattern = function (pattern, className, workerName) { + var _a; + var route = routerCollection[className]; + if (route == null) { + pushRouterIntoCollection({ + workers: (_a = {}, + _a[workerName] = { + workerName: workerName, + guards: [], + methodsAllowed: null, + pattern: pattern, + values: [] + }, + _a), + controller: null, + controllerName: className, + shields: [], + path: null, + values: [] + }); } else { - if (result.responseFormat == null) { - if (result.file == null) { - var contentType = result.contentType || _enums__WEBPACK_IMPORTED_MODULE_1__["MIME_TYPE"].Text; - var negotiateMimeType = this.getContentTypeFromNegotiation(contentType); - if (negotiateMimeType != null) { - this.endResponse_(negotiateMimeType); - } - else { - this.onNotAcceptableRequest(); - } - } - else { - this.handleFileResult_(); - } + var savedAction = route.workers[workerName]; + pattern = getActionPattern(route, pattern); + if (savedAction == null) { + route.workers[workerName] = { + workerName: workerName, + guards: [], + methodsAllowed: null, + pattern: pattern, + values: [] + }; } else { - this.handleFormatResult_(); + savedAction.pattern = pattern; } } }; - ControllerResultHandler.prototype.onResultFromController = function (result) { - return __awaiter(this, void 0, void 0, function () { - var ex_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.controllerResult_ = result || Object(_helpers__WEBPACK_IMPORTED_MODULE_4__["textResult"])(""); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 2: - _a.sent(); - return [3 /*break*/, 4]; - case 3: - ex_1 = _a.sent(); - this.onErrorOccured(ex_1); - return [2 /*return*/]; - case 4: - this.handleFinalResult_(); - return [2 /*return*/]; - } + RouteHandler.addExpected = function (type, className, workerName, expectedValue) { + var _a; + for (var prop in expectedValue) { + var propValue = expectedValue[prop]; + expectedValue[prop] = getDataType(propValue); + } + var isQuery = type === 'query'; + var pattern = workerName.toLowerCase(); + var router = routerCollection[className]; + var worker = { + workerName: workerName, + guards: [], + methodsAllowed: null, + pattern: pattern, + values: [], + expectedQuery: isQuery ? expectedValue : null, + expectedBody: isQuery ? null : expectedValue + }; + if (router == null) { + pushRouterIntoCollection({ + workers: (_a = {}, + _a[workerName] = worker, + _a), + controller: null, + controllerName: className, + shields: [], + path: null, + values: [] }); - }); + } + else { + var savedAction = router.workers[workerName]; + if (savedAction == null) { + router.workers[workerName] = worker; + } + else { + savedAction.expectedQuery = worker.expectedQuery; + savedAction.expectedBody = worker.expectedBody; + } + } }; - return ControllerResultHandler; -}(_file_handler__WEBPACK_IMPORTED_MODULE_2__["FileHandler"])); - - - -/***/ }), - -/***/ "./src/handlers/file_handler.ts": -/*!**************************************!*\ - !*** ./src/handlers/file_handler.ts ***! - \**************************************/ -/*! exports provided: FileHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileHandler", function() { return FileHandler; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -/* harmony import */ var _request_handler_helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./request_handler_helper */ "./src/handlers/request_handler_helper.ts"); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! fs */ "fs"); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -/* harmony import */ var etag__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! etag */ "etag"); -/* harmony import */ var etag__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(etag__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var fresh__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! fresh */ "fresh"); -/* harmony import */ var fresh__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(fresh__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); + RouteHandler.getExpectedQuery = function (controllerName, workerName) { + return routerCollection[controllerName].workers[workerName].expectedQuery; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + RouteHandler.getExpectedBody = function (controllerName, workerName) { + return routerCollection[controllerName].workers[workerName].expectedBody; }; -})(); - - - - - - + return RouteHandler; +}()); +// CONCATENATED MODULE: ./src/helpers/parse_match_route.ts -var FileHandler = /** @class */ (function (_super) { - __extends(FileHandler, _super); - function FileHandler() { - return _super !== null && _super.apply(this, arguments) || this; - } - FileHandler.prototype.getFileInfoFromUrl_ = function (urlPath) { - var splittedValue = urlPath.split("/"); - var fileInfo = { - file: "" - }; - if (splittedValue.length > 2 || !Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNullOrEmpty"])(path__WEBPACK_IMPORTED_MODULE_2__["parse"](urlPath).ext)) { - fileInfo.folder = splittedValue[1]; - fileInfo.file = splittedValue.splice(2).join("/"); - return fileInfo; - } - fileInfo.folder = splittedValue[1]; - return fileInfo; +var regex1 = /{(.*)}(?!.)/; +var regex2 = /{(.*)}\.(\w+)(?!.)/; +var checkRouteInWorker = function (route, httpMethod, urlParts) { + var matchedRoute = { + allowedHttpMethod: [], + controller: route.controller, + controllerName: route.controllerName }; - FileHandler.prototype.getFileStats_ = function (filePath) { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_6__["promise"])(function (res, rej) { - fs__WEBPACK_IMPORTED_MODULE_5__["lstat"](filePath, function (err, status) { - if (err) { - if (err.code === 'ENOENT') { - res(null); + var urlPartLength = urlParts.length; + var _loop_1 = function (workerName) { + var worker = route.workers[workerName]; + var patternSplit = worker.pattern.split("/"); + if (urlPartLength === patternSplit.length) { + var isMatched_1 = true; + var params_1 = {}; + urlParts.every(function (urlPart, i) { + // if not equal then check for regex match + if (urlPart !== patternSplit[i]) { + var regMatch1 = patternSplit[i].match(regex1); + var regMatch2 = patternSplit[i].match(regex2); + if (regMatch1 != null) { + params_1[regMatch1[1]] = urlPart; + } + else if (regMatch2 != null) { + var splitByDot = urlPart.split("."); + if (splitByDot[1] === regMatch2[2]) { + params_1[regMatch2[1]] = splitByDot[0]; + } + else { + isMatched_1 = false; + } } else { - rej(err); + isMatched_1 = false; } } - else { - res(status); - } + // means its direct match + return isMatched_1; }); - }); - }; - FileHandler.prototype.handleFileRequestFromAbsolutePath = function (absolutePath, fileType) { - var _this = this; - this.getFileStats_(absolutePath).then(function (fileInfo) { - if (fileInfo != null) { - if (fileInfo.isDirectory() === true) { - _this.handleFileRequestForFolderPath_(absolutePath); + if (isMatched_1 === true) { + if (worker.methodsAllowed.indexOf(httpMethod) >= 0) { + matchedRoute.workerInfo = worker; + matchedRoute.params = params_1; + matchedRoute.shields = route.shields; + return "break"; } else { - _this.sendFile_(absolutePath, fileType, fileInfo); + matchedRoute.allowedHttpMethod = matchedRoute.allowedHttpMethod.concat(worker.methodsAllowed); } } - else { - _this.onNotFound(); - } - }).catch(function (ex) { - _this.onErrorOccured(ex); - }); - }; - FileHandler.prototype.checkForFolderAllowAndReturnPath_ = function (urlPath) { - var fileInfo = this.getFileInfoFromUrl_(urlPath); - var getAbsPath = function () { - var folder = _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].folders.find(function (qry) { return qry.alias === fileInfo.folder; }); - if (folder != null) { - return path__WEBPACK_IMPORTED_MODULE_2__["join"](folder.path, fileInfo.file); - } - return null; - }; - var absPath = getAbsPath(); - if (absPath == null) { - fileInfo.folder = "/"; - fileInfo.file = urlPath; - absPath = getAbsPath(); } - return absPath; }; - FileHandler.prototype.handleFileRequest = function (urlPath) { - var extension = path__WEBPACK_IMPORTED_MODULE_2__["parse"](urlPath).ext; - var absFilePath = this.checkForFolderAllowAndReturnPath_(urlPath); - if (absFilePath != null) { - this.handleFileRequestFromAbsolutePath(absFilePath, extension); + for (var workerName in route.workers) { + var state_1 = _loop_1(workerName); + if (state_1 === "break") + break; + } + if (matchedRoute.workerInfo == null && matchedRoute.allowedHttpMethod.length === 0) { + return null; + } + return matchedRoute; +}; +function parseAndMatchRoute(url, httpMethod) { + url = removeLastSlash(url); + var urlParts = url.split("/"); + var route = route_handler_RouteHandler.findControllerFromPath(urlParts); + return route == null ? checkRouteInWorker(route_handler_RouteHandler.defaultRoute, httpMethod, urlParts) : + checkRouteInWorker(route, httpMethod, urlParts); +} + +// CONCATENATED MODULE: ./src/helpers/parse_cookie.ts + +var parseCookie = function (cookie) { + var value = {}; + if (!isNullOrEmpty(cookie)) { + cookie.split(';').forEach(function (val) { + var parts = val.split('='); + value[parts.shift().trim()] = decodeURI(parts.join('=')); + }); + } + return value; +}; + +// CONCATENATED MODULE: ./src/helpers/json_helper.ts +var JsonHelper = /** @class */ (function () { + function JsonHelper() { + } + JsonHelper.parse = function (value) { + try { + return JSON.parse(value); } - else { - this.onNotFound(); + catch (ex) { + // tslint:disable-next-line + throw { + message: "Post data is invalid" + }; } }; - /** - * process folders handling asuuming path is folder. - * Please check whether the file is folder before calling this function - * - * @private - * @param {string} filePath - * @param {Fs.Stats} fileInfo - * @returns - * @memberof FileHandler - */ - FileHandler.prototype.handleFileRequestForFolderPath_ = function (absolutePath) { - var _this = this; - absolutePath = path__WEBPACK_IMPORTED_MODULE_2__["join"](absolutePath, "index.html"); - this.getFileStats_(absolutePath).then(function (fileInfo) { - if (fileInfo != null) { - var fileType = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html; - _this.sendFile_(absolutePath, fileType, fileInfo); - } - else { - _this.onNotFound(); - } - }).catch(this.onErrorOccured.bind(this)); - }; - FileHandler.prototype.isClientHasFreshFile_ = function (lastModified, etagValue) { - return fresh__WEBPACK_IMPORTED_MODULE_8__(this.request.headers, { - 'etag': etagValue, - 'last-modified': lastModified - }); - }; - FileHandler.prototype.sendFileAsResponse_ = function (filePath, mimeType) { - var _this = this; - var _a; - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].Ok, (_a = {}, - _a[_constant__WEBPACK_IMPORTED_MODULE_3__["__ContentType"]] = mimeType, - _a)); - var readStream = fs__WEBPACK_IMPORTED_MODULE_5__["createReadStream"](filePath); - // Handle non-existent file - readStream.on('error', this.onErrorOccured.bind(this)); - readStream.on('open', function () { - readStream.pipe(_this.response); - }); - }; - FileHandler.prototype.getMimeTypeFromFileType_ = function (fileType) { - return fileType[0] === '.' ? Object(_helpers__WEBPACK_IMPORTED_MODULE_6__["getMimeTypeFromExtension"])(fileType) : - fileType; + JsonHelper.stringify = function (value) { + return JSON.stringify(value); }; - return FileHandler; -}(_request_handler_helper__WEBPACK_IMPORTED_MODULE_4__["RequestHandlerHelper"])); + return JsonHelper; +}()); -if (_fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].isProduction) { - FileHandler.prototype.sendFile_ = function (filePath, fileType, fileInfo) { - var _this = this; - this.runWallOutgoing().then(function () { - var lastModified = fileInfo.mtime.toUTCString(); - var eTagValue = etag__WEBPACK_IMPORTED_MODULE_7__(fileInfo, { - weak: _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].eTag.type === _enums__WEBPACK_IMPORTED_MODULE_0__["ETag_Type"].Weak - }); - if (_this.isClientHasFreshFile_(lastModified, eTagValue)) { // client has fresh file - _this.response.statusCode = _enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].NotModified; - _this.response.end(); + +// CONCATENATED MODULE: ./src/helpers/remove_last_slash.ts +var removeLastSlash = function (url) { + var urlLength = url.length; + // removing / from url; + if (url[urlLength - 1] === "/") { + return url.substr(0, urlLength - 1); + } + return url; +}; + +// CONCATENATED MODULE: ./src/helpers/remove_first_slash.ts +var removeFirstSlash = function (value) { + // remove / from string at 0th index + if (value[0] === "/") { + return value.substr(1); + } + return value; +}; + +// CONCATENATED MODULE: ./src/helpers/reverse_loop.ts +var reverseLoop = function (values, cb) { + for (var length_1 = values.length, i = length_1 - 1; i >= 0; i--) { + cb(values[i], i); + } +}; + +// CONCATENATED MODULE: ./src/helpers/get_data_type.ts + +var getDataType = function (value) { + var type = typeof value; + switch (type) { + case 'object': + if (Array.isArray(value)) { + return DATA_TYPE.Array; } - else { - _this.response.setHeader('Etag', eTagValue); - _this.response.setHeader('Last-Modified', lastModified); - _this.sendFileAsResponse_(filePath, _this.getMimeTypeFromFileType_(fileType)); + default: + return type; + } +}; + +// CONCATENATED MODULE: ./src/helpers/compar_expected_and_remove_unnecessary.ts + + +var compareExpectedAndRemoveUnnecessary = function (expected, actual, isQuery) { + var result = {}; + for (var prop in expected) { + if (isQuery === true && expected[prop] === DATA_TYPE.Number) { + result[prop] = Number(actual[prop]); + if (isNaN(result[prop]) === true) { + return null; } - }).catch(this.onErrorOccured.bind(this)); - }; -} -else { - FileHandler.prototype.sendFile_ = function (filePath, fileType, fileInfo) { - var _this = this; - this.runWallOutgoing().then(function () { - _this.sendFileAsResponse_(filePath, _this.getMimeTypeFromFileType_(fileType)); - }).catch(this.onErrorOccured.bind(this)); - }; + } + else { + result[prop] = actual[prop]; + } + if (expected[prop] !== getDataType(result[prop])) { + return null; + } + } + return result; +}; + +// CONCATENATED MODULE: ./src/helpers/get_class_name.ts +var getClassName = function (target) { + return target.name || (target.constructor && target.constructor.name); +}; + +// CONCATENATED MODULE: ./src/helpers/remove_method_and_null_from_object.ts + + +var removeMethodAndNullFromObject = function (value) { + var outputValue = {}; + for (var prop in value) { + var type = getDataType(value[prop]); + if (!(value[prop] == null || type === DATA_TYPE.Function)) { + outputValue[prop] = value[prop]; + } + } + return outputValue; +}; + +// CONCATENATED MODULE: ./src/helpers/get_result_based_on_mime.ts + +var getResultBasedOnMiMe; +function setResultMapper(mapper) { + if (mapper) { + getResultBasedOnMiMe = function (type, result, callBack) { + return new mapper().map(type, result, callBack); + }; + } + else { + getResultBasedOnMiMe = function (type, result, callBack) { + switch (type) { + case MIME_TYPE.Json: + case MIME_TYPE.Text: + case MIME_TYPE.Html: + case MIME_TYPE.Xml: + if (typeof result === 'object' === true) { + callBack(MIME_TYPE.Json); + return JSON.stringify(result); + } + } + return result; + }; + } } +// CONCATENATED MODULE: ./src/helpers/index.ts -/***/ }), -/***/ "./src/handlers/index.ts": -/*!*******************************!*\ - !*** ./src/handlers/index.ts ***! - \*******************************/ -/*! exports provided: RouteHandler, RequestHandler, FileHandler, RequestHandlerHelper, ControllerResultHandler, PostHandler, InjectorHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _route_handler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./route_handler */ "./src/handlers/route_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RouteHandler", function() { return _route_handler__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"]; }); -/* harmony import */ var _request_handler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./request_handler */ "./src/handlers/request_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RequestHandler", function() { return _request_handler__WEBPACK_IMPORTED_MODULE_1__["RequestHandler"]; }); -/* harmony import */ var _file_handler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./file_handler */ "./src/handlers/file_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FileHandler", function() { return _file_handler__WEBPACK_IMPORTED_MODULE_2__["FileHandler"]; }); -/* harmony import */ var _request_handler_helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./request_handler_helper */ "./src/handlers/request_handler_helper.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RequestHandlerHelper", function() { return _request_handler_helper__WEBPACK_IMPORTED_MODULE_3__["RequestHandlerHelper"]; }); -/* harmony import */ var _controller_result_handler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./controller_result_handler */ "./src/handlers/controller_result_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerResultHandler", function() { return _controller_result_handler__WEBPACK_IMPORTED_MODULE_4__["ControllerResultHandler"]; }); -/* harmony import */ var _post_handler__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./post_handler */ "./src/handlers/post_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PostHandler", function() { return _post_handler__WEBPACK_IMPORTED_MODULE_5__["PostHandler"]; }); -/* harmony import */ var _injector_handler__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./injector_handler */ "./src/handlers/injector_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InjectorHandler", function() { return _injector_handler__WEBPACK_IMPORTED_MODULE_6__["InjectorHandler"]; }); @@ -2080,19 +1163,98 @@ __webpack_require__.r(__webpack_exports__); -/***/ }), -/***/ "./src/handlers/injector_handler.ts": -/*!******************************************!*\ - !*** ./src/handlers/injector_handler.ts ***! - \******************************************/ -/*! exports provided: InjectorHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectorHandler", function() { return InjectorHandler; }); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); + + + +// CONCATENATED MODULE: ./src/models/error_handler.ts + +var error_handler_ErrorHandler = /** @class */ (function () { + function ErrorHandler() { + } + ErrorHandler.prototype.onServerError = function (ex) { + return promise(function (resolve, reject) { + var errMessage = "

internal server error

\n

message : " + ex.message + "

"; + if (ex.stack) { + errMessage += "

stacktrace: " + ex.stack + "

"; + } + if (ex.type) { + errMessage += "

type: " + ex.type + "

"; + } + resolve(errMessage); + }); + }; + ErrorHandler.prototype.onBadRequest = function (ex) { + return promise(function (resolve, reject) { + var errMessage = "

Bad Request

"; + if (ex.message) { + errMessage += "

message : " + ex.message + "

"; + } + if (ex.stack) { + errMessage += "

stacktrace: " + ex.stack + "

"; + } + if (ex.type) { + errMessage += "

type: " + ex.type + "

"; + } + resolve(errMessage); + }); + }; + ErrorHandler.prototype.onForbiddenRequest = function () { + return promise(function (resolve, reject) { + var errMessage = "

Forbidden

"; + resolve(errMessage); + }); + }; + ErrorHandler.prototype.onNotAcceptableRequest = function () { + return promise(function (resolve, reject) { + var errMessage = "

Not Acceptable

"; + resolve(errMessage); + }); + }; + ErrorHandler.prototype.onMethodNotAllowed = function () { + return promise(function (resolve, reject) { + var errMessage = "

Method Not allowed.

"; + resolve(errMessage); + }); + }; + ErrorHandler.prototype.onNotFound = function (url) { + return promise(function (resolve, reject) { + var errMessage = "

The requested resource " + url + " was not found.

"; + resolve(errMessage); + }); + }; + return ErrorHandler; +}()); + + +// CONCATENATED MODULE: ./src/models/http_cookie.ts +var HttpCookie = /** @class */ (function () { + function HttpCookie(name, value) { + this.name = name; + this.value = value; + } + return HttpCookie; +}()); + + +// EXTERNAL MODULE: external "url" +var external_url_ = __webpack_require__(4); + +// CONCATENATED MODULE: ./src/constant.ts +/* tslint:disable */ +var __ContentType = "Content-Type"; +var __AppName = "fort"; +var __Cookie = "Cookie"; +var __SetCookie = 'Set-Cookie'; +var __CurrentPath = process.cwd(); +var __ContentLength = "Content-Length"; +var __Constructor = "const_constructor"; + +// EXTERNAL MODULE: external "negotiator" +var external_negotiator_ = __webpack_require__(2); + +// CONCATENATED MODULE: ./src/handlers/injector_handler.ts // this stores information of injector values that are available per class & worker var injectorStoreInfos = []; @@ -2100,7 +1262,7 @@ var injectorStoreInfos = []; var injectorValues = []; // this stores the singletons name & their respective index in injector values var singletons = {}; -var InjectorHandler = /** @class */ (function () { +var injector_handler_InjectorHandler = /** @class */ (function () { function InjectorHandler() { } InjectorHandler.addWorkerValue = function (className, methodName, paramIndex, paramValue, shouldFindIndex) { @@ -2127,254 +1289,46 @@ var InjectorHandler = /** @class */ (function () { injectorStoreInfos.push(value); } else { - // const savedMethod = savedValue.methods[methodName]; - if (savedValue.methods[methodName] == null) { - savedValue.methods[methodName] = []; - } - savedValue.methods[methodName][paramIndex] = paramValue; - } - return paramValue; - }; - InjectorHandler.getConstructorValues = function (className) { - return this.getMethodValues(className, _constant__WEBPACK_IMPORTED_MODULE_0__["__Constructor"]); - }; - InjectorHandler.getMethodValues = function (className, methodName) { - var savedValue = injectorStoreInfos.find(function (qry) { return qry.className === className; }); - if (savedValue != null) { - var methodArgs = savedValue.methods[methodName]; - if (methodArgs != null) { - return methodArgs.map(function (injectorValueIndex) { - return injectorValues[injectorValueIndex]; - }); - } - } - return []; - }; - InjectorHandler.addSingleton = function (className, methodName, paramIndex, paramValue) { - var singletonClassName = paramValue.name; - if (singletonClassName) { - if (singletons[singletonClassName] == null) { - singletons[singletonClassName] = InjectorHandler.addWorkerValue(className, methodName, paramIndex, new paramValue()); - } - else { - InjectorHandler.addWorkerValue(className, methodName, paramIndex, singletons[singletonClassName], false); - } - } - }; - return InjectorHandler; -}()); - - - -/***/ }), - -/***/ "./src/handlers/post_handler.ts": -/*!**************************************!*\ - !*** ./src/handlers/post_handler.ts ***! - \**************************************/ -/*! exports provided: PostHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostHandler", function() { return PostHandler; }); -/* harmony import */ var _controller_result_handler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./controller_result_handler */ "./src/handlers/controller_result_handler.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var content_type__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! content-type */ "content-type"); -/* harmony import */ var content_type__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(content_type__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! querystring */ "querystring"); -/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var multiparty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! multiparty */ "multiparty"); -/* harmony import */ var multiparty__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(multiparty__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../models */ "./src/models/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - - - - - - - -var PostHandler = /** @class */ (function (_super) { - __extends(PostHandler, _super); - function PostHandler() { - return _super !== null && _super.apply(this, arguments) || this; - } - PostHandler.prototype.getPostRawData_ = function () { - var _this = this; - var body = []; - return Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["promise"])(function (res, rej) { - _this.request.on('data', function (chunk) { - body.push(chunk); - }).on('end', function () { - var bodyBuffer = Buffer.concat(body); - res(bodyBuffer.toString()); - }).on("error", function (err) { - rej(err); - }); - }); - }; - PostHandler.prototype.parseMultiPartData_ = function () { - var _this = this; - return Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["promise"])(function (res, rej) { - new multiparty__WEBPACK_IMPORTED_MODULE_6__["Form"]().parse(_this.request, function (err, fields, files) { - if (err) { - rej(err); - } - else { - var result = { - field: {}, - file: {} - }; - for (var field in fields) { - result.field[field] = fields[field].length === 1 ? fields[field][0] : fields[field]; - } - for (var file in files) { - result.file[file] = files[file].length === 1 ? files[file][0] : files[file]; - } - res(result); - } - }); - }); - }; - PostHandler.prototype.parsePostData = function () { - return __awaiter(this, void 0, void 0, function () { - var postData, contentType, result, bodyDataAsString; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - contentType = this.request.headers[_constant__WEBPACK_IMPORTED_MODULE_2__["__ContentType"]] || this.request.headers["content-type"]; - if (contentType != null) { - contentType = content_type__WEBPACK_IMPORTED_MODULE_4__["parse"](contentType).type; - } - if (!(contentType === _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"].FormMultiPart)) return [3 /*break*/, 2]; - return [4 /*yield*/, this.parseMultiPartData_()]; - case 1: - result = _a.sent(); - postData = result.field; - this.file = new _models__WEBPACK_IMPORTED_MODULE_7__["FileManager"](result.file); - return [3 /*break*/, 4]; - case 2: - this.file = new _models__WEBPACK_IMPORTED_MODULE_7__["FileManager"]({}); - return [4 /*yield*/, this.getPostRawData_()]; - case 3: - bodyDataAsString = _a.sent(); - switch (contentType) { - case _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"].Json: - postData = _helpers__WEBPACK_IMPORTED_MODULE_1__["JsonHelper"].parse(bodyDataAsString); - break; - case _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"].Text: - case _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"].Html: - postData = bodyDataAsString; - break; - case _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"].FormUrlEncoded: - postData = querystring__WEBPACK_IMPORTED_MODULE_5__["parse"](bodyDataAsString); - break; - case _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"].Xml: - postData = new _fort_global__WEBPACK_IMPORTED_MODULE_8__["FortGlobal"].xmlParser().parse(bodyDataAsString); - break; - default: - postData = {}; - } - _a.label = 4; - case 4: return [2 /*return*/, postData]; - } - }); - }); + // const savedMethod = savedValue.methods[methodName]; + if (savedValue.methods[methodName] == null) { + savedValue.methods[methodName] = []; + } + savedValue.methods[methodName][paramIndex] = paramValue; + } + return paramValue; }; - return PostHandler; -}(_controller_result_handler__WEBPACK_IMPORTED_MODULE_0__["ControllerResultHandler"])); - - - -/***/ }), - -/***/ "./src/handlers/request_handler.ts": -/*!*****************************************!*\ - !*** ./src/handlers/request_handler.ts ***! - \*****************************************/ -/*! exports provided: RequestHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequestHandler", function() { return RequestHandler; }); -/* harmony import */ var url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! url */ "url"); -/* harmony import */ var url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../models */ "./src/models/index.ts"); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _post_handler__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./post_handler */ "./src/handlers/post_handler.ts"); -/* harmony import */ var _injector_handler__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./injector_handler */ "./src/handlers/injector_handler.ts"); -/* harmony import */ var _route_handler__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./route_handler */ "./src/handlers/route_handler.ts"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); + InjectorHandler.getConstructorValues = function (className) { + return this.getMethodValues(className, __Constructor); }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + InjectorHandler.getMethodValues = function (className, methodName) { + var savedValue = injectorStoreInfos.find(function (qry) { return qry.className === className; }); + if (savedValue != null) { + var methodArgs = savedValue.methods[methodName]; + if (methodArgs != null) { + return methodArgs.map(function (injectorValueIndex) { + return injectorValues[injectorValueIndex]; + }); + } + } + return []; }; -})(); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + InjectorHandler.addSingleton = function (className, methodName, paramIndex, paramValue) { + var singletonClassName = paramValue.name; + if (singletonClassName) { + if (singletons[singletonClassName] == null) { + singletons[singletonClassName] = InjectorHandler.addWorkerValue(className, methodName, paramIndex, new paramValue()); + } + else { + InjectorHandler.addWorkerValue(className, methodName, paramIndex, singletons[singletonClassName], false); + } + } + }; + return InjectorHandler; +}()); + + +// CONCATENATED MODULE: ./src/handlers/request_handler_helper.ts +var request_handler_helper_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } @@ -2382,7 +1336,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { +var request_handler_helper_generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } @@ -2415,402 +1369,612 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod +var request_handler_helper_RequestHandlerHelper = /** @class */ (function () { + function RequestHandlerHelper() { + this.wallInstances = []; + this.controllerResult_ = {}; + } + RequestHandlerHelper.prototype.runWallOutgoing = function () { + var _this = this; + var outgoingResults = []; + reverseLoop(this.wallInstances, function (value) { + var methodArgsValues = injector_handler_InjectorHandler.getMethodValues(value.constructor.name, 'onOutgoing'); + methodArgsValues.shift(); + outgoingResults.push(value.onOutgoing.apply(value, [_this.controllerResult_].concat(methodArgsValues))); + }); + return Promise.all(outgoingResults); + }; + RequestHandlerHelper.prototype.getContentTypeFromNegotiation = function (type) { + var negotiator = new external_negotiator_(this.request); + var availableTypes = this.getAvailableTypes_(type); + if (availableTypes == null) { + availableTypes = [type]; + } + return negotiator.mediaType(availableTypes); + }; + RequestHandlerHelper.prototype.getContentTypeFromNegotiationHavingMultipleTypes = function (types) { + var negotiator = new external_negotiator_(this.request); + return negotiator.mediaType(types); + }; + RequestHandlerHelper.prototype.getAvailableTypes_ = function (type) { + switch (type) { + case MIME_TYPE.Json: + case MIME_TYPE.Xml: + return [MIME_TYPE.Json, MIME_TYPE.Xml]; + case MIME_TYPE.Html: + case MIME_TYPE.Css: + case MIME_TYPE.Csv: + case MIME_TYPE.Js: + case MIME_TYPE.Rtf: + case MIME_TYPE.Text: + return [MIME_TYPE.Text, MIME_TYPE.Html, MIME_TYPE.Js, + MIME_TYPE.Css, MIME_TYPE.Rtf, MIME_TYPE.Csv]; + } + return null; + }; + RequestHandlerHelper.prototype.onBadRequest = function (error) { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, errMessage, ex_1; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 3, , 4]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 1: + _b.sent(); + return [4 /*yield*/, new FortGlobal.errorHandler().onBadRequest(error)]; + case 2: + errMessage = _b.sent(); + return [3 /*break*/, 4]; + case 3: + ex_1 = _b.sent(); + return [2 /*return*/, this.onErrorOccured(ex_1)]; + case 4: + this.response.writeHead(HTTP_STATUS_CODE.BadRequest, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(errMessage); + return [2 /*return*/]; + } + }); + }); + }; + RequestHandlerHelper.prototype.onForbiddenRequest = function () { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, errMessage, ex_2; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 3, , 4]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 1: + _b.sent(); + return [4 /*yield*/, new FortGlobal.errorHandler().onForbiddenRequest()]; + case 2: + errMessage = _b.sent(); + return [3 /*break*/, 4]; + case 3: + ex_2 = _b.sent(); + return [2 /*return*/, this.onErrorOccured(ex_2)]; + case 4: + this.response.writeHead(HTTP_STATUS_CODE.Forbidden, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(errMessage); + return [2 /*return*/]; + } + }); + }); + }; + RequestHandlerHelper.prototype.onNotAcceptableRequest = function () { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, errMessage, ex_3; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 3, , 4]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 1: + _b.sent(); + return [4 /*yield*/, new FortGlobal.errorHandler().onNotAcceptableRequest()]; + case 2: + errMessage = _b.sent(); + return [3 /*break*/, 4]; + case 3: + ex_3 = _b.sent(); + return [2 /*return*/, this.onErrorOccured(ex_3)]; + case 4: + this.response.writeHead(HTTP_STATUS_CODE.NotAcceptable, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(errMessage); + return [2 /*return*/]; + } + }); + }); + }; + RequestHandlerHelper.prototype.onNotFound = function () { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, errMessage, ex_4; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 3, , 4]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 1: + _b.sent(); + return [4 /*yield*/, new FortGlobal.errorHandler().onNotFound(this.request.url)]; + case 2: + errMessage = _b.sent(); + return [3 /*break*/, 4]; + case 3: + ex_4 = _b.sent(); + return [2 /*return*/, this.onErrorOccured(ex_4)]; + case 4: + this.response.writeHead(HTTP_STATUS_CODE.NotFound, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(errMessage); + return [2 /*return*/]; + } + }); + }); + }; + RequestHandlerHelper.prototype.onMethodNotAllowed = function (allowedMethods) { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, errMessage, ex_5; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 3, , 4]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 1: + _b.sent(); + return [4 /*yield*/, new FortGlobal.errorHandler().onMethodNotAllowed()]; + case 2: + errMessage = _b.sent(); + return [3 /*break*/, 4]; + case 3: + ex_5 = _b.sent(); + return [2 /*return*/, this.onErrorOccured(ex_5)]; + case 4: + this.response.setHeader("Allow", allowedMethods.join(",")); + this.response.writeHead(HTTP_STATUS_CODE.MethodNotAllowed, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(errMessage); + return [2 /*return*/]; + } + }); + }); + }; + RequestHandlerHelper.prototype.onErrorOccured = function (error) { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, errMessage, ex_6; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + if (typeof error === 'string') { + error = { + message: error + }; + } + _b.label = 1; + case 1: + _b.trys.push([1, 4, , 5]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 2: + _b.sent(); + return [4 /*yield*/, new FortGlobal.errorHandler().onServerError(error)]; + case 3: + errMessage = _b.sent(); + return [3 /*break*/, 5]; + case 4: + ex_6 = _b.sent(); + errMessage = JsonHelper.stringify(ex_6); + return [3 /*break*/, 5]; + case 5: + this.response.writeHead(HTTP_STATUS_CODE.InternalServerError, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(errMessage); + return [2 /*return*/]; + } + }); + }); + }; + RequestHandlerHelper.prototype.onRequestOptions = function (allowedMethods) { + return request_handler_helper_awaiter(this, void 0, void 0, function () { + var _a, ex_7; + return request_handler_helper_generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.runWallOutgoing()]; + case 1: + _b.sent(); + return [3 /*break*/, 3]; + case 2: + ex_7 = _b.sent(); + return [2 /*return*/, this.onErrorOccured(ex_7)]; + case 3: + this.response.setHeader("Allow", allowedMethods.join(",")); + this.response.writeHead(HTTP_STATUS_CODE.Ok, (_a = {}, _a[__ContentType] = MIME_TYPE.Html, _a)); + this.response.end(""); + return [2 /*return*/]; + } + }); + }); + }; + return RequestHandlerHelper; +}()); + + +// EXTERNAL MODULE: external "fs" +var external_fs_ = __webpack_require__(3); + +// EXTERNAL MODULE: external "etag" +var external_etag_ = __webpack_require__(5); + +// EXTERNAL MODULE: external "fresh" +var external_fresh_ = __webpack_require__(6); + +// CONCATENATED MODULE: ./src/handlers/file_handler.ts +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + + + + + -var RequestHandler = /** @class */ (function (_super) { - __extends(RequestHandler, _super); - function RequestHandler(request, response) { - var _this = _super.call(this) || this; - _this.data_ = {}; - _this.request = request; - _this.response = response; - _this.registerEvents_(); - return _this; + +var file_handler_FileHandler = /** @class */ (function (_super) { + __extends(FileHandler, _super); + function FileHandler() { + return _super !== null && _super.apply(this, arguments) || this; } - RequestHandler.prototype.registerEvents_ = function () { - this.request.on('error', this.onBadRequest.bind(this)); - this.response.on('error', this.onErrorOccured.bind(this)); + FileHandler.prototype.getFileInfoFromUrl_ = function (urlPath) { + var splittedValue = urlPath.split("/"); + var fileInfo = { + file: "" + }; + if (splittedValue.length > 2 || !isNullOrEmpty(external_path_["parse"](urlPath).ext)) { + fileInfo.folder = splittedValue[1]; + fileInfo.file = splittedValue.splice(2).join("/"); + return fileInfo; + } + fileInfo.folder = splittedValue[1]; + return fileInfo; }; - RequestHandler.prototype.executeWallIncoming_ = function () { - var _this = this; - return Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["promise"])(function (res) { - var index = 0; - var wallLength = _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].walls.length; - var executeWallIncomingByIndex = function () { return __awaiter(_this, void 0, void 0, function () { - var wall, constructorArgsValues, wallObj, methodArgsValues, result, ex_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(wallLength > index)) return [3 /*break*/, 5]; - wall = _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].walls[index++]; - constructorArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getConstructorValues(wall.name); - wallObj = new (wall.bind.apply(wall, [void 0].concat(constructorArgsValues)))(); - wallObj.cookie = this.cookieManager; - wallObj.session = this.session_; - wallObj.request = this.request; - wallObj.response = this.response; - wallObj.data = this.data_; - wallObj.query = this.query_; - this.wallInstances.push(wallObj); - methodArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getMethodValues(wall.name, 'onIncoming'); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, wallObj.onIncoming.apply(wallObj, methodArgsValues)]; - case 2: - result = _a.sent(); - if (result == null) { - executeWallIncomingByIndex(); - } - else { - res(false); - this.onTerminationFromWall(result); - } - return [3 /*break*/, 4]; - case 3: - ex_1 = _a.sent(); - this.onErrorOccured(ex_1); - res(false); - return [3 /*break*/, 4]; - case 4: return [3 /*break*/, 6]; - case 5: - res(true); - _a.label = 6; - case 6: return [2 /*return*/]; + FileHandler.prototype.getFileStats_ = function (filePath) { + return promise(function (res, rej) { + external_fs_["lstat"](filePath, function (err, status) { + if (err) { + if (err.code === 'ENOENT') { + res(null); } - }); - }); }; - executeWallIncomingByIndex(); + else { + rej(err); + } + } + else { + res(status); + } + }); }); }; - RequestHandler.prototype.executeShieldsProtection_ = function () { + FileHandler.prototype.handleFileRequestFromAbsolutePath = function (absolutePath, fileType) { var _this = this; - return Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["promise"])(function (res) { - var index = 0; - var shieldLength = _this.routeMatchInfo_.shields.length; - var executeShieldByIndex = function () { return __awaiter(_this, void 0, void 0, function () { - var shield, constructorArgsValues, shieldObj, methodArgsValues, result, ex_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(shieldLength > index)) return [3 /*break*/, 5]; - shield = this.routeMatchInfo_.shields[index++]; - constructorArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getConstructorValues(shield.name); - shieldObj = new (shield.bind.apply(shield, [void 0].concat(constructorArgsValues)))(); - shieldObj.cookie = this.cookieManager; - shieldObj.query = this.query_; - shieldObj.session = this.session_; - shieldObj.request = this.request; - shieldObj.response = this.response; - shieldObj.data = this.data_; - shieldObj.workerName = this.routeMatchInfo_.workerInfo.workerName; - methodArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getMethodValues(shield.name, 'protect'); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, shieldObj.protect.apply(shieldObj, methodArgsValues)]; - case 2: - result = _a.sent(); - if (result == null) { - executeShieldByIndex(); - } - else { - res(false); - this.onResultFromController(result); - } - return [3 /*break*/, 4]; - case 3: - ex_2 = _a.sent(); - this.onErrorOccured(ex_2); - res(false); - return [3 /*break*/, 4]; - case 4: return [3 /*break*/, 6]; - case 5: - res(true); - _a.label = 6; - case 6: return [2 /*return*/]; - } - }); - }); }; - executeShieldByIndex(); + this.getFileStats_(absolutePath).then(function (fileInfo) { + if (fileInfo != null) { + if (fileInfo.isDirectory() === true) { + _this.handleFileRequestForFolderPath_(absolutePath); + } + else { + _this.sendFile_(absolutePath, fileType, fileInfo); + } + } + else { + _this.onNotFound(); + } + }).catch(function (ex) { + _this.onErrorOccured(ex); }); }; - RequestHandler.prototype.executeGuardsCheck_ = function (guards) { + FileHandler.prototype.checkForFolderAllowAndReturnPath_ = function (urlPath) { + var fileInfo = this.getFileInfoFromUrl_(urlPath); + var getAbsPath = function () { + var folder = FortGlobal.folders.find(function (qry) { return qry.alias === fileInfo.folder; }); + if (folder != null) { + return external_path_["join"](folder.path, fileInfo.file); + } + return null; + }; + var absPath = getAbsPath(); + if (absPath == null) { + fileInfo.folder = "/"; + fileInfo.file = urlPath; + absPath = getAbsPath(); + } + return absPath; + }; + FileHandler.prototype.handleFileRequest = function (urlPath) { + var extension = external_path_["parse"](urlPath).ext; + var absFilePath = this.checkForFolderAllowAndReturnPath_(urlPath); + if (absFilePath != null) { + this.handleFileRequestFromAbsolutePath(absFilePath, extension); + } + else { + this.onNotFound(); + } + }; + /** + * process folders handling asuuming path is folder. + * Please check whether the file is folder before calling this function + * + * @private + * @param {string} filePath + * @param {Fs.Stats} fileInfo + * @returns + * @memberof FileHandler + */ + FileHandler.prototype.handleFileRequestForFolderPath_ = function (absolutePath) { var _this = this; - return Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["promise"])(function (res) { - var index = 0; - var shieldLength = guards.length; - var executeGuardByIndex = function () { return __awaiter(_this, void 0, void 0, function () { - var guard, constructorArgsValues, guardObj, methodArgsValues, result, ex_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(shieldLength > index)) return [3 /*break*/, 5]; - guard = guards[index++]; - constructorArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getConstructorValues(guard.name); - guardObj = new (guard.bind.apply(guard, [void 0].concat(constructorArgsValues)))(); - guardObj.body = this.body; - guardObj.cookie = this.cookieManager; - guardObj.query = this.query_; - guardObj.session = this.session_; - guardObj.request = this.request; - guardObj.response = this.response; - guardObj.data = this.data_; - guardObj.file = this.file; - guardObj.param = this.routeMatchInfo_.params; - methodArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getMethodValues(guard.name, 'check'); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, guardObj.check.apply(guardObj, methodArgsValues)]; - case 2: - result = _a.sent(); - if (result == null) { - executeGuardByIndex(); - } - else { - res(false); - this.onResultFromController(result); - } - return [3 /*break*/, 4]; - case 3: - ex_3 = _a.sent(); - this.onErrorOccured(ex_3); - res(false); - return [3 /*break*/, 4]; - case 4: return [3 /*break*/, 6]; - case 5: - res(true); - _a.label = 6; - case 6: return [2 /*return*/]; - } - }); - }); }; - executeGuardByIndex(); + absolutePath = external_path_["join"](absolutePath, "index.html"); + this.getFileStats_(absolutePath).then(function (fileInfo) { + if (fileInfo != null) { + var fileType = MIME_TYPE.Html; + _this.sendFile_(absolutePath, fileType, fileInfo); + } + else { + _this.onNotFound(); + } + }).catch(this.onErrorOccured.bind(this)); + }; + FileHandler.prototype.isClientHasFreshFile_ = function (lastModified, etagValue) { + return external_fresh_(this.request.headers, { + 'etag': etagValue, + 'last-modified': lastModified }); }; - RequestHandler.prototype.parseCookieFromRequest_ = function () { - if (_fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].shouldParseCookie === true) { - var rawCookie = (this.request.headers[_constant__WEBPACK_IMPORTED_MODULE_1__["__Cookie"]] || this.request.headers["cookie"]); - var parsedCookies = void 0; - try { - parsedCookies = Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["parseCookie"])(rawCookie); + FileHandler.prototype.sendFileAsResponse_ = function (filePath, mimeType) { + var _this = this; + var _a; + this.response.writeHead(HTTP_STATUS_CODE.Ok, (_a = {}, + _a[__ContentType] = mimeType, + _a)); + var readStream = external_fs_["createReadStream"](filePath); + // Handle non-existent file + readStream.on('error', this.onErrorOccured.bind(this)); + readStream.on('open', function () { + readStream.pipe(_this.response); + }); + }; + FileHandler.prototype.getMimeTypeFromFileType_ = function (fileType) { + return fileType[0] === '.' ? getMimeTypeFromExtension(fileType) : + fileType; + }; + return FileHandler; +}(request_handler_helper_RequestHandlerHelper)); + +if (FortGlobal.isProduction) { + file_handler_FileHandler.prototype.sendFile_ = function (filePath, fileType, fileInfo) { + var _this = this; + this.runWallOutgoing().then(function () { + var lastModified = fileInfo.mtime.toUTCString(); + var eTagValue = external_etag_(fileInfo, { + weak: FortGlobal.eTag.type === ETag_Type.Weak + }); + if (_this.isClientHasFreshFile_(lastModified, eTagValue)) { // client has fresh file + _this.response.statusCode = HTTP_STATUS_CODE.NotModified; + _this.response.end(); } - catch (ex) { - this.onErrorOccured(ex); - return false; + else { + _this.response.setHeader('Etag', eTagValue); + _this.response.setHeader('Last-Modified', lastModified); + _this.sendFileAsResponse_(filePath, _this.getMimeTypeFromFileType_(fileType)); + } + }).catch(this.onErrorOccured.bind(this)); + }; +} +else { + file_handler_FileHandler.prototype.sendFile_ = function (filePath, fileType, fileInfo) { + var _this = this; + this.runWallOutgoing().then(function () { + _this.sendFileAsResponse_(filePath, _this.getMimeTypeFromFileType_(fileType)); + }).catch(this.onErrorOccured.bind(this)); + }; +} + +// CONCATENATED MODULE: ./src/handlers/controller_result_handler.ts +var controller_result_handler_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var controller_result_handler_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var controller_result_handler_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; } - this.session_ = new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].sessionProvider(); - this.session_.cookie = this.cookieManager = new _models__WEBPACK_IMPORTED_MODULE_4__["CookieManager"](parsedCookies); - this.session_.sessionId = parsedCookies[_fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].appSessionIdentifier]; + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; + + + + + +var controller_result_handler_ControllerResultHandler = /** @class */ (function (_super) { + controller_result_handler_extends(ControllerResultHandler, _super); + function ControllerResultHandler() { + return _super !== null && _super.apply(this, arguments) || this; + } + ControllerResultHandler.prototype.endResponse_ = function (negotiateMimeType) { + var _a; + var data; + try { + data = getResultBasedOnMiMe(negotiateMimeType, this.controllerResult_.responseData, function (type) { + negotiateMimeType = type; + }); } - else { - this.cookieManager = new _models__WEBPACK_IMPORTED_MODULE_4__["CookieManager"]({}); + catch (ex) { + this.onErrorOccured(ex); + return; } - return true; + this.response.writeHead(this.controllerResult_.statusCode || HTTP_STATUS_CODE.Ok, (_a = {}, _a[__ContentType] = negotiateMimeType, _a)); + this.response.end(data); }; - RequestHandler.prototype.setPreHeader_ = function () { - this.response.setHeader('X-Powered-By', _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].appName); - this.response.setHeader('Vary', 'Accept-Encoding'); - this.response.sendDate = true; + ControllerResultHandler.prototype.handleRedirectResult_ = function () { + // this.response.setHeader('Location', this.controllerResult_.responseData); + this.response.writeHead(this.controllerResult_.statusCode || HTTP_STATUS_CODE.Ok, { 'Location': this.controllerResult_.responseData }); + this.response.end(); }; - RequestHandler.prototype.checkExpectedQuery_ = function () { - var expectedQuery = _route_handler__WEBPACK_IMPORTED_MODULE_8__["RouteHandler"].getExpectedQuery(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName); - if (expectedQuery != null) { - this.query_ = Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["compareExpectedAndRemoveUnnecessary"])(expectedQuery, this.query_, true); + ControllerResultHandler.prototype.handleFormatResult_ = function () { + var negotiateMimeType = this.getContentTypeFromNegotiationHavingMultipleTypes(Object.keys(this.controllerResult_.responseFormat)); + var key = Object.keys(this.controllerResult_.responseFormat).find(function (qry) { return qry === negotiateMimeType; }); + if (key != null) { + this.controllerResult_.responseData = this.controllerResult_.responseFormat[key](); + this.endResponse_(negotiateMimeType); + } + else { + this.onNotAcceptableRequest(); } }; - RequestHandler.prototype.checkExpectedBody_ = function () { - var expectedBody = _route_handler__WEBPACK_IMPORTED_MODULE_8__["RouteHandler"].getExpectedBody(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName); - if (expectedBody != null) { - this.body = Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["compareExpectedAndRemoveUnnecessary"])(expectedBody, this.body, false); + ControllerResultHandler.prototype.handleFileResult_ = function () { + var result = this.controllerResult_; + var parsedPath = external_path_["parse"](result.file.filePath); + if (result.file.shouldDownload === true) { + var fileName = result.file.alias == null ? parsedPath.name : result.file.alias; + this.response.setHeader("content-disposition", "attachment;filename=" + fileName + parsedPath.ext); } + this.handleFileRequestFromAbsolutePath(result.file.filePath, parsedPath.ext); }; - RequestHandler.prototype.onRouteMatched_ = function () { - return __awaiter(this, void 0, void 0, function () { - var actionInfo, shouldExecuteNextComponent; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - actionInfo = this.routeMatchInfo_.workerInfo; - if (!(actionInfo == null)) return [3 /*break*/, 1]; - if (this.request.method === _enums__WEBPACK_IMPORTED_MODULE_5__["HTTP_METHOD"].Options) { - this.onRequestOptions(this.routeMatchInfo_.allowedHttpMethod); - } - else { - this.onMethodNotAllowed(this.routeMatchInfo_.allowedHttpMethod); - } - return [3 /*break*/, 5]; - case 1: - this.checkExpectedQuery_(); - if (this.query_ == null) { - this.onBadRequest({ - message: "Bad query string data - query string data does not match with expected value" - }); - return [2 /*return*/]; - } - return [4 /*yield*/, this.executeShieldsProtection_()]; - case 2: - shouldExecuteNextComponent = _a.sent(); - if (!(shouldExecuteNextComponent === true)) return [3 /*break*/, 5]; - return [4 /*yield*/, this.handlePostData()]; - case 3: - shouldExecuteNextComponent = _a.sent(); - if (!(shouldExecuteNextComponent === true)) return [3 /*break*/, 5]; - this.checkExpectedBody_(); - if (this.body == null) { - this.onBadRequest({ - message: "Bad body data - body data does not match with expected value" - }); - return [2 /*return*/]; - } - return [4 /*yield*/, this.executeGuardsCheck_(actionInfo.guards)]; - case 4: - shouldExecuteNextComponent = _a.sent(); - if (shouldExecuteNextComponent === true) { - this.runController_(); - } - _a.label = 5; - case 5: return [2 /*return*/]; - } - }); - }); + ControllerResultHandler.prototype.onTerminationFromWall = function (result) { + this.controllerResult_ = result; + this.handleFinalResult_(); }; - RequestHandler.prototype.execute_ = function () { - return __awaiter(this, void 0, void 0, function () { - var urlDetail, shouldExecuteNextProcess, pathUrl, requestMethod; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - urlDetail = url__WEBPACK_IMPORTED_MODULE_0__["parse"](this.request.url, true); - this.query_ = urlDetail.query; - shouldExecuteNextProcess = this.parseCookieFromRequest_(); - if (!(shouldExecuteNextProcess === true)) return [3 /*break*/, 2]; - return [4 /*yield*/, this.executeWallIncoming_()]; - case 1: - shouldExecuteNextProcess = _a.sent(); - if (shouldExecuteNextProcess === true) { - pathUrl = urlDetail.pathname; - requestMethod = this.request.method; - try { - this.routeMatchInfo_ = Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["parseAndMatchRoute"])(pathUrl.toLowerCase(), requestMethod); - } - catch (ex) { - this.onErrorOccured(ex); - return [2 /*return*/]; - } - if (this.routeMatchInfo_ == null) { // no route matched - // it may be a file or folder then - this.handleFileRequest(pathUrl); - } - else { - this.onRouteMatched_(); - } - } - _a.label = 2; - case 2: return [2 /*return*/]; - } - }); + ControllerResultHandler.prototype.handleFinalResult_ = function () { + var _this = this; + var result = this.controllerResult_; + this.cookieManager.responseCookie_.forEach(function (value) { + _this.response.setHeader(__SetCookie, value); }); + if (result.shouldRedirect === true) { + this.handleRedirectResult_(); + } + else { + if (result.responseFormat == null) { + if (result.file == null) { + var contentType = result.contentType || MIME_TYPE.Text; + var negotiateMimeType = this.getContentTypeFromNegotiation(contentType); + if (negotiateMimeType != null) { + this.endResponse_(negotiateMimeType); + } + else { + this.onNotAcceptableRequest(); + } + } + else { + this.handleFileResult_(); + } + } + else { + this.handleFormatResult_(); + } + } }; - RequestHandler.prototype.handlePostData = function () { - return __awaiter(this, void 0, void 0, function () { - var _a, ex_4; - return __generator(this, function (_b) { - switch (_b.label) { + ControllerResultHandler.prototype.onResultFromController = function (result) { + return controller_result_handler_awaiter(this, void 0, void 0, function () { + var ex_1; + return controller_result_handler_generator(this, function (_a) { + switch (_a.label) { case 0: - if (!(this.request.method === _enums__WEBPACK_IMPORTED_MODULE_5__["HTTP_METHOD"].Get)) return [3 /*break*/, 1]; - this.body = {}; - this.file = new _models__WEBPACK_IMPORTED_MODULE_4__["FileManager"]({}); - return [3 /*break*/, 5]; + this.controllerResult_ = result || textResult(""); + _a.label = 1; case 1: - if (!(_fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].shouldParsePost === true)) return [3 /*break*/, 5]; - _b.label = 2; + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.runWallOutgoing()]; case 2: - _b.trys.push([2, 4, , 5]); - _a = this; - return [4 /*yield*/, this.parsePostData()]; + _a.sent(); + return [3 /*break*/, 4]; case 3: - _a.body = _b.sent(); - return [3 /*break*/, 5]; - case 4: - ex_4 = _b.sent(); - this.onBadRequest(ex_4); - return [2 /*return*/, false]; - case 5: return [2 /*return*/, true]; - } - }); - }); - }; - RequestHandler.prototype.handle = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - this.setPreHeader_(); - this.execute_(); - return [2 /*return*/]; + ex_1 = _a.sent(); + this.onErrorOccured(ex_1); + return [2 /*return*/]; + case 4: + this.handleFinalResult_(); + return [2 /*return*/]; + } }); }); }; - RequestHandler.prototype.setControllerProps_ = function () { - var _a; - var constructorValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getConstructorValues(this.routeMatchInfo_.controller.name); - var controllerObj = new ((_a = this.routeMatchInfo_.controller).bind.apply(_a, [void 0].concat(constructorValues)))(); - controllerObj.request = this.request; - controllerObj.response = this.response; - controllerObj.query = this.query_; - controllerObj.body = this.body; - controllerObj.session = this.session_; - controllerObj.cookie = this.cookieManager; - controllerObj.param = this.routeMatchInfo_.params; - controllerObj.data = this.data_; - controllerObj.file = this.file; - var methodArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_7__["InjectorHandler"].getMethodValues(this.routeMatchInfo_.controller.name, this.routeMatchInfo_.workerInfo.workerName); - return controllerObj[this.routeMatchInfo_.workerInfo.workerName].apply(controllerObj, methodArgsValues); - }; - return RequestHandler; -}(_post_handler__WEBPACK_IMPORTED_MODULE_6__["PostHandler"])); + return ControllerResultHandler; +}(file_handler_FileHandler)); -if (_fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].isProduction) { - RequestHandler.prototype.runController_ = function () { - this.setControllerProps_().then(this.onResultFromController.bind(this)).catch(this.onErrorOccured.bind(this)); - }; -} -else { - RequestHandler.prototype.runController_ = function () { - var result = this.setControllerProps_(); - if (Promise.resolve(result) !== result) { - this.onErrorOccured({ - message: "Wrong implementation - worker does not return promise" - }); - } - else { - result.then(this.onResultFromController.bind(this)).catch(this.onErrorOccured.bind(this)); - } - }; -} +// EXTERNAL MODULE: external "content-type" +var external_content_type_ = __webpack_require__(7); -/***/ }), +// EXTERNAL MODULE: external "querystring" +var external_querystring_ = __webpack_require__(8); -/***/ "./src/handlers/request_handler_helper.ts": -/*!************************************************!*\ - !*** ./src/handlers/request_handler_helper.ts ***! - \************************************************/ -/*! exports provided: RequestHandlerHelper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// EXTERNAL MODULE: external "multiparty" +var external_multiparty_ = __webpack_require__(9); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequestHandlerHelper", function() { return RequestHandlerHelper; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -/* harmony import */ var negotiator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! negotiator */ "negotiator"); -/* harmony import */ var negotiator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(negotiator__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -/* harmony import */ var _injector_handler__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./injector_handler */ "./src/handlers/injector_handler.ts"); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { +// CONCATENATED MODULE: ./src/handlers/post_handler.ts +var post_handler_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var post_handler_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } @@ -2818,7 +1982,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { +var post_handler_generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } @@ -2851,761 +2015,648 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod -var RequestHandlerHelper = /** @class */ (function () { - function RequestHandlerHelper() { - this.wallInstances = []; - this.controllerResult_ = {}; + + + +var post_handler_PostHandler = /** @class */ (function (_super) { + post_handler_extends(PostHandler, _super); + function PostHandler() { + return _super !== null && _super.apply(this, arguments) || this; } - RequestHandlerHelper.prototype.runWallOutgoing = function () { + PostHandler.prototype.getPostRawData_ = function () { var _this = this; - var outgoingResults = []; - Object(_helpers__WEBPACK_IMPORTED_MODULE_4__["reverseLoop"])(this.wallInstances, function (value) { - var methodArgsValues = _injector_handler__WEBPACK_IMPORTED_MODULE_5__["InjectorHandler"].getMethodValues(value.constructor.name, 'onOutgoing'); - methodArgsValues.shift(); - outgoingResults.push(value.onOutgoing.apply(value, [_this.controllerResult_].concat(methodArgsValues))); - }); - return Promise.all(outgoingResults); - }; - RequestHandlerHelper.prototype.getContentTypeFromNegotiation = function (type) { - var negotiator = new negotiator__WEBPACK_IMPORTED_MODULE_3__(this.request); - var availableTypes = this.getAvailableTypes_(type); - if (availableTypes == null) { - availableTypes = [type]; - } - return negotiator.mediaType(availableTypes); - }; - RequestHandlerHelper.prototype.getContentTypeFromNegotiationHavingMultipleTypes = function (types) { - var negotiator = new negotiator__WEBPACK_IMPORTED_MODULE_3__(this.request); - return negotiator.mediaType(types); - }; - RequestHandlerHelper.prototype.getAvailableTypes_ = function (type) { - switch (type) { - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Json: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Xml: - return [_enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Json, _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Xml]; - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Css: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Csv: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Js: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Rtf: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Text: - return [_enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Text, _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Js, - _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Css, _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Rtf, _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Csv]; - } - return null; - }; - RequestHandlerHelper.prototype.onBadRequest = function (error) { - return __awaiter(this, void 0, void 0, function () { - var _a, errMessage, ex_1; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 3, , 4]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 1: - _b.sent(); - return [4 /*yield*/, new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].errorHandler().onBadRequest(error)]; - case 2: - errMessage = _b.sent(); - return [3 /*break*/, 4]; - case 3: - ex_1 = _b.sent(); - return [2 /*return*/, this.onErrorOccured(ex_1)]; - case 4: - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].BadRequest, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(errMessage); - return [2 /*return*/]; - } - }); - }); - }; - RequestHandlerHelper.prototype.onForbiddenRequest = function () { - return __awaiter(this, void 0, void 0, function () { - var _a, errMessage, ex_2; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 3, , 4]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 1: - _b.sent(); - return [4 /*yield*/, new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].errorHandler().onForbiddenRequest()]; - case 2: - errMessage = _b.sent(); - return [3 /*break*/, 4]; - case 3: - ex_2 = _b.sent(); - return [2 /*return*/, this.onErrorOccured(ex_2)]; - case 4: - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].Forbidden, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(errMessage); - return [2 /*return*/]; - } - }); - }); - }; - RequestHandlerHelper.prototype.onNotAcceptableRequest = function () { - return __awaiter(this, void 0, void 0, function () { - var _a, errMessage, ex_3; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 3, , 4]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 1: - _b.sent(); - return [4 /*yield*/, new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].errorHandler().onNotAcceptableRequest()]; - case 2: - errMessage = _b.sent(); - return [3 /*break*/, 4]; - case 3: - ex_3 = _b.sent(); - return [2 /*return*/, this.onErrorOccured(ex_3)]; - case 4: - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].NotAcceptable, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(errMessage); - return [2 /*return*/]; - } + var body = []; + return promise(function (res, rej) { + _this.request.on('data', function (chunk) { + body.push(chunk); + }).on('end', function () { + var bodyBuffer = Buffer.concat(body); + res(bodyBuffer.toString()); + }).on("error", function (err) { + rej(err); }); }); }; - RequestHandlerHelper.prototype.onNotFound = function () { - return __awaiter(this, void 0, void 0, function () { - var _a, errMessage, ex_4; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 3, , 4]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 1: - _b.sent(); - return [4 /*yield*/, new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].errorHandler().onNotFound(this.request.url)]; - case 2: - errMessage = _b.sent(); - return [3 /*break*/, 4]; - case 3: - ex_4 = _b.sent(); - return [2 /*return*/, this.onErrorOccured(ex_4)]; - case 4: - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].NotFound, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(errMessage); - return [2 /*return*/]; + PostHandler.prototype.parseMultiPartData_ = function () { + var _this = this; + return promise(function (res, rej) { + new external_multiparty_["Form"]().parse(_this.request, function (err, fields, files) { + if (err) { + rej(err); } - }); - }); - }; - RequestHandlerHelper.prototype.onMethodNotAllowed = function (allowedMethods) { - return __awaiter(this, void 0, void 0, function () { - var _a, errMessage, ex_5; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 3, , 4]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 1: - _b.sent(); - return [4 /*yield*/, new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].errorHandler().onMethodNotAllowed()]; - case 2: - errMessage = _b.sent(); - return [3 /*break*/, 4]; - case 3: - ex_5 = _b.sent(); - return [2 /*return*/, this.onErrorOccured(ex_5)]; - case 4: - this.response.setHeader("Allow", allowedMethods.join(",")); - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].MethodNotAllowed, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(errMessage); - return [2 /*return*/]; + else { + var result = { + field: {}, + file: {} + }; + for (var field in fields) { + result.field[field] = fields[field].length === 1 ? fields[field][0] : fields[field]; + } + for (var file in files) { + result.file[file] = files[file].length === 1 ? files[file][0] : files[file]; + } + res(result); } }); }); }; - RequestHandlerHelper.prototype.onErrorOccured = function (error) { - return __awaiter(this, void 0, void 0, function () { - var _a, errMessage, ex_6; - return __generator(this, function (_b) { - switch (_b.label) { + PostHandler.prototype.parsePostData = function () { + return post_handler_awaiter(this, void 0, void 0, function () { + var postData, contentType, result, bodyDataAsString; + return post_handler_generator(this, function (_a) { + switch (_a.label) { case 0: - if (typeof error === 'string') { - error = { - message: error - }; + contentType = this.request.headers[__ContentType] || this.request.headers["content-type"]; + if (contentType != null) { + contentType = external_content_type_["parse"](contentType).type; } - _b.label = 1; - case 1: - _b.trys.push([1, 4, , 5]); - return [4 /*yield*/, this.runWallOutgoing()]; - case 2: - _b.sent(); - return [4 /*yield*/, new _fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].errorHandler().onServerError(error)]; - case 3: - errMessage = _b.sent(); - return [3 /*break*/, 5]; - case 4: - ex_6 = _b.sent(); - errMessage = _helpers__WEBPACK_IMPORTED_MODULE_4__["JsonHelper"].stringify(ex_6); - return [3 /*break*/, 5]; - case 5: - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].InternalServerError, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(errMessage); - return [2 /*return*/]; - } - }); - }); - }; - RequestHandlerHelper.prototype.onRequestOptions = function (allowedMethods) { - return __awaiter(this, void 0, void 0, function () { - var _a, ex_7; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.runWallOutgoing()]; + if (!(contentType === MIME_TYPE.FormMultiPart)) return [3 /*break*/, 2]; + return [4 /*yield*/, this.parseMultiPartData_()]; case 1: - _b.sent(); - return [3 /*break*/, 3]; + result = _a.sent(); + postData = result.field; + this.file = new file_manager_FileManager(result.file); + return [3 /*break*/, 4]; case 2: - ex_7 = _b.sent(); - return [2 /*return*/, this.onErrorOccured(ex_7)]; + this.file = new file_manager_FileManager({}); + return [4 /*yield*/, this.getPostRawData_()]; case 3: - this.response.setHeader("Allow", allowedMethods.join(",")); - this.response.writeHead(_enums__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].Ok, (_a = {}, _a[_constant__WEBPACK_IMPORTED_MODULE_1__["__ContentType"]] = _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, _a)); - this.response.end(""); - return [2 /*return*/]; + bodyDataAsString = _a.sent(); + switch (contentType) { + case MIME_TYPE.Json: + postData = JsonHelper.parse(bodyDataAsString); + break; + case MIME_TYPE.Text: + case MIME_TYPE.Html: + postData = bodyDataAsString; + break; + case MIME_TYPE.FormUrlEncoded: + postData = external_querystring_["parse"](bodyDataAsString); + break; + case MIME_TYPE.Xml: + postData = new FortGlobal.xmlParser().parse(bodyDataAsString); + break; + default: + postData = {}; + } + _a.label = 4; + case 4: return [2 /*return*/, postData]; } }); }); }; - return RequestHandlerHelper; -}()); + return PostHandler; +}(controller_result_handler_ControllerResultHandler)); +// CONCATENATED MODULE: ./src/handlers/request_handler.ts +var request_handler_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var request_handler_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var request_handler_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; -/***/ }), -/***/ "./src/handlers/route_handler.ts": -/*!***************************************!*\ - !*** ./src/handlers/route_handler.ts ***! - \***************************************/ -/*! exports provided: RouteHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteHandler", function() { return RouteHandler; }); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts"); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../models */ "./src/models/index.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -var routerCollection = {}; -var pushRouterIntoCollection = function (route) { - var routeObj = new _models__WEBPACK_IMPORTED_MODULE_1__["RouteInfo"](); - routeObj.init(route); - routerCollection[route.controllerName] = routeObj; -}; -var getActionPattern = function (parentRoute, pattern) { - return (Object(_utils__WEBPACK_IMPORTED_MODULE_0__["isNull"])(parentRoute.path) || parentRoute.path === "/*") ? pattern : "" + parentRoute.path + pattern; -}; -var RouteHandler = /** @class */ (function () { - function RouteHandler() { + + + +var request_handler_RequestHandler = /** @class */ (function (_super) { + request_handler_extends(RequestHandler, _super); + function RequestHandler(request, response) { + var _this = _super.call(this) || this; + _this.data_ = {}; + _this.request = request; + _this.response = response; + _this.registerEvents_(); + return _this; } - Object.defineProperty(RouteHandler, "routerCollection", { - get: function () { - return routerCollection; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RouteHandler, "routesAsArray", { - get: function () { - return Object.keys(routerCollection).map(function (workerName) { - return routerCollection[workerName]; - }); - }, - enumerable: true, - configurable: true - }); - RouteHandler.findControllerFromPath = function (urlParts) { - var _loop_1 = function (controllerName) { - var isMatched = false; - var controller = routerCollection[controllerName]; - var patternSplit = controller.path.split("/"); - patternSplit.every(function (patternPart, i) { - isMatched = patternPart === urlParts[i]; - return isMatched; - }); - if (isMatched === true) { - return { value: controller }; - } - }; - for (var controllerName in routerCollection) { - var state_1 = _loop_1(controllerName); - if (typeof state_1 === "object") - return state_1.value; - } + RequestHandler.prototype.registerEvents_ = function () { + this.request.on('error', this.onBadRequest.bind(this)); + this.response.on('error', this.onErrorOccured.bind(this)); + }; + RequestHandler.prototype.executeWallIncoming_ = function () { + var _this = this; + return promise(function (res) { + var index = 0; + var wallLength = FortGlobal.walls.length; + var executeWallIncomingByIndex = function () { return request_handler_awaiter(_this, void 0, void 0, function () { + var wall, constructorArgsValues, wallObj, methodArgsValues, result, ex_1; + return request_handler_generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(wallLength > index)) return [3 /*break*/, 5]; + wall = FortGlobal.walls[index++]; + constructorArgsValues = injector_handler_InjectorHandler.getConstructorValues(wall.name); + wallObj = new (wall.bind.apply(wall, [void 0].concat(constructorArgsValues)))(); + wallObj.cookie = this.cookieManager; + wallObj.session = this.session_; + wallObj.request = this.request; + wallObj.response = this.response; + wallObj.data = this.data_; + wallObj.query = this.query_; + this.wallInstances.push(wallObj); + methodArgsValues = injector_handler_InjectorHandler.getMethodValues(wall.name, 'onIncoming'); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, wallObj.onIncoming.apply(wallObj, methodArgsValues)]; + case 2: + result = _a.sent(); + if (result == null) { + executeWallIncomingByIndex(); + } + else { + res(false); + this.onTerminationFromWall(result); + } + return [3 /*break*/, 4]; + case 3: + ex_1 = _a.sent(); + this.onErrorOccured(ex_1); + res(false); + return [3 /*break*/, 4]; + case 4: return [3 /*break*/, 6]; + case 5: + res(true); + _a.label = 6; + case 6: return [2 /*return*/]; + } + }); + }); }; + executeWallIncomingByIndex(); + }); + }; + RequestHandler.prototype.executeShieldsProtection_ = function () { + var _this = this; + return promise(function (res) { + var index = 0; + var shieldLength = _this.routeMatchInfo_.shields.length; + var executeShieldByIndex = function () { return request_handler_awaiter(_this, void 0, void 0, function () { + var shield, constructorArgsValues, shieldObj, methodArgsValues, result, ex_2; + return request_handler_generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(shieldLength > index)) return [3 /*break*/, 5]; + shield = this.routeMatchInfo_.shields[index++]; + constructorArgsValues = injector_handler_InjectorHandler.getConstructorValues(shield.name); + shieldObj = new (shield.bind.apply(shield, [void 0].concat(constructorArgsValues)))(); + shieldObj.cookie = this.cookieManager; + shieldObj.query = this.query_; + shieldObj.session = this.session_; + shieldObj.request = this.request; + shieldObj.response = this.response; + shieldObj.data = this.data_; + shieldObj.workerName = this.routeMatchInfo_.workerInfo.workerName; + methodArgsValues = injector_handler_InjectorHandler.getMethodValues(shield.name, 'protect'); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, shieldObj.protect.apply(shieldObj, methodArgsValues)]; + case 2: + result = _a.sent(); + if (result == null) { + executeShieldByIndex(); + } + else { + res(false); + this.onResultFromController(result); + } + return [3 /*break*/, 4]; + case 3: + ex_2 = _a.sent(); + this.onErrorOccured(ex_2); + res(false); + return [3 /*break*/, 4]; + case 4: return [3 /*break*/, 6]; + case 5: + res(true); + _a.label = 6; + case 6: return [2 /*return*/]; + } + }); + }); }; + executeShieldByIndex(); + }); + }; + RequestHandler.prototype.executeGuardsCheck_ = function (guards) { + var _this = this; + return promise(function (res) { + var index = 0; + var shieldLength = guards.length; + var executeGuardByIndex = function () { return request_handler_awaiter(_this, void 0, void 0, function () { + var guard, constructorArgsValues, guardObj, methodArgsValues, result, ex_3; + return request_handler_generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(shieldLength > index)) return [3 /*break*/, 5]; + guard = guards[index++]; + constructorArgsValues = injector_handler_InjectorHandler.getConstructorValues(guard.name); + guardObj = new (guard.bind.apply(guard, [void 0].concat(constructorArgsValues)))(); + guardObj.body = this.body; + guardObj.cookie = this.cookieManager; + guardObj.query = this.query_; + guardObj.session = this.session_; + guardObj.request = this.request; + guardObj.response = this.response; + guardObj.data = this.data_; + guardObj.file = this.file; + guardObj.param = this.routeMatchInfo_.params; + methodArgsValues = injector_handler_InjectorHandler.getMethodValues(guard.name, 'check'); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, guardObj.check.apply(guardObj, methodArgsValues)]; + case 2: + result = _a.sent(); + if (result == null) { + executeGuardByIndex(); + } + else { + res(false); + this.onResultFromController(result); + } + return [3 /*break*/, 4]; + case 3: + ex_3 = _a.sent(); + this.onErrorOccured(ex_3); + res(false); + return [3 /*break*/, 4]; + case 4: return [3 /*break*/, 6]; + case 5: + res(true); + _a.label = 6; + case 6: return [2 /*return*/]; + } + }); + }); }; + executeGuardByIndex(); + }); }; - Object.defineProperty(RouteHandler, "defaultRoute", { - get: function () { - return routerCollection[RouteHandler.defaultRouteControllerName]; - }, - enumerable: true, - configurable: true - }); - RouteHandler.addToRouterCollection = function (value) { - var route = routerCollection[value.controller.name]; - if (route == null) { - pushRouterIntoCollection({ - workers: {}, - controller: value.controller, - controllerName: value.controller.name, - path: value.path, - shields: [], - values: [] - }); - } - else { - route.controller = value.controller; - route.path = value.path; - // change pattern value since we have controller name now. - for (var workerName in route.workers) { - var actionInfo = route.workers[workerName]; - actionInfo.pattern = getActionPattern(value, actionInfo.pattern); + RequestHandler.prototype.parseCookieFromRequest_ = function () { + if (FortGlobal.shouldParseCookie === true) { + var rawCookie = (this.request.headers[__Cookie] || this.request.headers["cookie"]); + var parsedCookies = void 0; + try { + parsedCookies = parseCookie(rawCookie); } - } - }; - RouteHandler.addShields = function (shields, className) { - var route = routerCollection[className]; - if (route == null) { - pushRouterIntoCollection({ - workers: {}, - controller: null, - controllerName: className, - shields: shields, - path: null, - values: [] - }); + catch (ex) { + this.onErrorOccured(ex); + return false; + } + this.session_ = new FortGlobal.sessionProvider(); + this.session_.cookie = this.cookieManager = new CookieManager(parsedCookies); + this.session_.sessionId = parsedCookies[FortGlobal.appSessionIdentifier]; } else { - route.shields = shields; + this.cookieManager = new CookieManager({}); } + return true; }; - RouteHandler.addWorker = function (newWorker, className) { - var _a; - var workerName = newWorker.workerName; - var route = routerCollection[className]; - if (route == null) { - pushRouterIntoCollection({ - workers: (_a = {}, - _a[workerName] = newWorker, - _a), - controller: null, - controllerName: className, - shields: [], - path: null, - values: [] - }); - } - else { - var savedAction = route.workers[workerName]; - if (savedAction == null) { - newWorker.pattern = getActionPattern(route, newWorker.pattern); - route.workers[workerName] = newWorker; - } - else { - savedAction.methodsAllowed = newWorker.methodsAllowed; - savedAction.pattern = getActionPattern(route, savedAction.pattern); - // route.path == null ? savedAction.pattern : `/${route.path}${savedAction.pattern}`; - } - } + RequestHandler.prototype.setPreHeader_ = function () { + this.response.setHeader('X-Powered-By', FortGlobal.appName); + this.response.setHeader('Vary', 'Accept-Encoding'); + this.response.sendDate = true; }; - RouteHandler.addGuards = function (guards, className, workerName) { - var _a; - var route = routerCollection[className]; - var pattern = workerName.toLowerCase(); - if (route == null) { - pushRouterIntoCollection({ - workers: (_a = {}, - _a[workerName] = { - workerName: workerName, - guards: guards, - methodsAllowed: null, - pattern: pattern, - values: [] - }, - _a), - controller: null, - controllerName: className, - shields: [], - path: null, - values: [] - }); + RequestHandler.prototype.checkExpectedQuery_ = function () { + var expectedQuery = route_handler_RouteHandler.getExpectedQuery(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName); + if (expectedQuery != null) { + this.query_ = compareExpectedAndRemoveUnnecessary(expectedQuery, this.query_, true); } - else { - var savedAction = route.workers[workerName]; - if (savedAction == null) { - route.workers[workerName] = { - workerName: workerName, - guards: guards, - methodsAllowed: null, - pattern: pattern, - values: [] - }; - } - else { - savedAction.guards = guards; - } + }; + RequestHandler.prototype.checkExpectedBody_ = function () { + var expectedBody = route_handler_RouteHandler.getExpectedBody(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName); + if (expectedBody != null) { + this.body = compareExpectedAndRemoveUnnecessary(expectedBody, this.body, false); } }; - RouteHandler.addPattern = function (pattern, className, workerName) { - var _a; - var route = routerCollection[className]; - if (route == null) { - pushRouterIntoCollection({ - workers: (_a = {}, - _a[workerName] = { - workerName: workerName, - guards: [], - methodsAllowed: null, - pattern: pattern, - values: [] - }, - _a), - controller: null, - controllerName: className, - shields: [], - path: null, - values: [] + RequestHandler.prototype.onRouteMatched_ = function () { + return request_handler_awaiter(this, void 0, void 0, function () { + var actionInfo, shouldExecuteNextComponent; + return request_handler_generator(this, function (_a) { + switch (_a.label) { + case 0: + actionInfo = this.routeMatchInfo_.workerInfo; + if (!(actionInfo == null)) return [3 /*break*/, 1]; + if (this.request.method === HTTP_METHOD.Options) { + this.onRequestOptions(this.routeMatchInfo_.allowedHttpMethod); + } + else { + this.onMethodNotAllowed(this.routeMatchInfo_.allowedHttpMethod); + } + return [3 /*break*/, 5]; + case 1: + this.checkExpectedQuery_(); + if (this.query_ == null) { + this.onBadRequest({ + message: "Bad query string data - query string data does not match with expected value" + }); + return [2 /*return*/]; + } + return [4 /*yield*/, this.executeShieldsProtection_()]; + case 2: + shouldExecuteNextComponent = _a.sent(); + if (!(shouldExecuteNextComponent === true)) return [3 /*break*/, 5]; + return [4 /*yield*/, this.handlePostData()]; + case 3: + shouldExecuteNextComponent = _a.sent(); + if (!(shouldExecuteNextComponent === true)) return [3 /*break*/, 5]; + this.checkExpectedBody_(); + if (this.body == null) { + this.onBadRequest({ + message: "Bad body data - body data does not match with expected value" + }); + return [2 /*return*/]; + } + return [4 /*yield*/, this.executeGuardsCheck_(actionInfo.guards)]; + case 4: + shouldExecuteNextComponent = _a.sent(); + if (shouldExecuteNextComponent === true) { + this.runController_(); + } + _a.label = 5; + case 5: return [2 /*return*/]; + } }); - } - else { - var savedAction = route.workers[workerName]; - pattern = getActionPattern(route, pattern); - if (savedAction == null) { - route.workers[workerName] = { - workerName: workerName, - guards: [], - methodsAllowed: null, - pattern: pattern, - values: [] - }; - } - else { - savedAction.pattern = pattern; - } - } + }); }; - RouteHandler.addExpected = function (type, className, workerName, expectedValue) { - var _a; - for (var prop in expectedValue) { - var propValue = expectedValue[prop]; - expectedValue[prop] = Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["getDataType"])(propValue); - } - var isQuery = type === 'query'; - var pattern = workerName.toLowerCase(); - var router = routerCollection[className]; - var worker = { - workerName: workerName, - guards: [], - methodsAllowed: null, - pattern: pattern, - values: [], - expectedQuery: isQuery ? expectedValue : null, - expectedBody: isQuery ? null : expectedValue - }; - if (router == null) { - pushRouterIntoCollection({ - workers: (_a = {}, - _a[workerName] = worker, - _a), - controller: null, - controllerName: className, - shields: [], - path: null, - values: [] + RequestHandler.prototype.execute_ = function () { + return request_handler_awaiter(this, void 0, void 0, function () { + var urlDetail, shouldExecuteNextProcess, pathUrl, requestMethod; + return request_handler_generator(this, function (_a) { + switch (_a.label) { + case 0: + urlDetail = external_url_["parse"](this.request.url, true); + this.query_ = urlDetail.query; + shouldExecuteNextProcess = this.parseCookieFromRequest_(); + if (!(shouldExecuteNextProcess === true)) return [3 /*break*/, 2]; + return [4 /*yield*/, this.executeWallIncoming_()]; + case 1: + shouldExecuteNextProcess = _a.sent(); + if (shouldExecuteNextProcess === true) { + pathUrl = urlDetail.pathname; + requestMethod = this.request.method; + try { + this.routeMatchInfo_ = parseAndMatchRoute(pathUrl.toLowerCase(), requestMethod); + } + catch (ex) { + this.onErrorOccured(ex); + return [2 /*return*/]; + } + if (this.routeMatchInfo_ == null) { // no route matched + // it may be a file or folder then + this.handleFileRequest(pathUrl); + } + else { + this.onRouteMatched_(); + } + } + _a.label = 2; + case 2: return [2 /*return*/]; + } }); - } - else { - var savedAction = router.workers[workerName]; - if (savedAction == null) { - router.workers[workerName] = worker; - } - else { - savedAction.expectedQuery = worker.expectedQuery; - savedAction.expectedBody = worker.expectedBody; - } - } + }); }; - RouteHandler.getExpectedQuery = function (controllerName, workerName) { - return routerCollection[controllerName].workers[workerName].expectedQuery; + RequestHandler.prototype.handlePostData = function () { + return request_handler_awaiter(this, void 0, void 0, function () { + var _a, ex_4; + return request_handler_generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!(this.request.method === HTTP_METHOD.Get)) return [3 /*break*/, 1]; + this.body = {}; + this.file = new file_manager_FileManager({}); + return [3 /*break*/, 5]; + case 1: + if (!(FortGlobal.shouldParsePost === true)) return [3 /*break*/, 5]; + _b.label = 2; + case 2: + _b.trys.push([2, 4, , 5]); + _a = this; + return [4 /*yield*/, this.parsePostData()]; + case 3: + _a.body = _b.sent(); + return [3 /*break*/, 5]; + case 4: + ex_4 = _b.sent(); + this.onBadRequest(ex_4); + return [2 /*return*/, false]; + case 5: return [2 /*return*/, true]; + } + }); + }); }; - RouteHandler.getExpectedBody = function (controllerName, workerName) { - return routerCollection[controllerName].workers[workerName].expectedBody; + RequestHandler.prototype.handle = function () { + return request_handler_awaiter(this, void 0, void 0, function () { + return request_handler_generator(this, function (_a) { + this.setPreHeader_(); + this.execute_(); + return [2 /*return*/]; + }); + }); }; - return RouteHandler; -}()); - - - -/***/ }), - -/***/ "./src/helpers/compar_expected_and_remove_unnecessary.ts": -/*!***************************************************************!*\ - !*** ./src/helpers/compar_expected_and_remove_unnecessary.ts ***! - \***************************************************************/ -/*! exports provided: compareExpectedAndRemoveUnnecessary */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareExpectedAndRemoveUnnecessary", function() { return compareExpectedAndRemoveUnnecessary; }); -/* harmony import */ var _get_data_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./get_data_type */ "./src/helpers/get_data_type.ts"); -/* harmony import */ var _enums_data_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/data_type */ "./src/enums/data_type.ts"); - + RequestHandler.prototype.setControllerProps_ = function () { + var _a; + var constructorValues = injector_handler_InjectorHandler.getConstructorValues(this.routeMatchInfo_.controller.name); + var controllerObj = new ((_a = this.routeMatchInfo_.controller).bind.apply(_a, [void 0].concat(constructorValues)))(); + controllerObj.request = this.request; + controllerObj.response = this.response; + controllerObj.query = this.query_; + controllerObj.body = this.body; + controllerObj.session = this.session_; + controllerObj.cookie = this.cookieManager; + controllerObj.param = this.routeMatchInfo_.params; + controllerObj.data = this.data_; + controllerObj.file = this.file; + var methodArgsValues = injector_handler_InjectorHandler.getMethodValues(this.routeMatchInfo_.controller.name, this.routeMatchInfo_.workerInfo.workerName); + return controllerObj[this.routeMatchInfo_.workerInfo.workerName].apply(controllerObj, methodArgsValues); + }; + return RequestHandler; +}(post_handler_PostHandler)); -var compareExpectedAndRemoveUnnecessary = function (expected, actual, isQuery) { - var result = {}; - for (var prop in expected) { - if (isQuery === true && expected[prop] === _enums_data_type__WEBPACK_IMPORTED_MODULE_1__["DATA_TYPE"].Number) { - result[prop] = Number(actual[prop]); - if (isNaN(result[prop]) === true) { - return null; - } +if (FortGlobal.isProduction) { + request_handler_RequestHandler.prototype.runController_ = function () { + this.setControllerProps_().then(this.onResultFromController.bind(this)).catch(this.onErrorOccured.bind(this)); + }; +} +else { + request_handler_RequestHandler.prototype.runController_ = function () { + var result = this.setControllerProps_(); + if (Promise.resolve(result) !== result) { + this.onErrorOccured({ + message: "Wrong implementation - worker does not return promise" + }); } else { - result[prop] = actual[prop]; - } - if (expected[prop] !== Object(_get_data_type__WEBPACK_IMPORTED_MODULE_0__["getDataType"])(result[prop])) { - return null; - } - } - return result; -}; - - -/***/ }), - -/***/ "./src/helpers/download_result.ts": -/*!****************************************!*\ - !*** ./src/helpers/download_result.ts ***! - \****************************************/ -/*! exports provided: downloadResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "downloadResult", function() { return downloadResult; }); -/* harmony import */ var _enums_http_status_code__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums/http_status_code */ "./src/enums/http_status_code.ts"); - -var downloadResult = function (filePath, downloadFileName) { - return { - statusCode: _enums_http_status_code__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].Ok, - file: { - filePath: filePath, - shouldDownload: true, - alias: downloadFileName + result.then(this.onResultFromController.bind(this)).catch(this.onErrorOccured.bind(this)); } }; -}; - - -/***/ }), - -/***/ "./src/helpers/file_result.ts": -/*!************************************!*\ - !*** ./src/helpers/file_result.ts ***! - \************************************/ -/*! exports provided: fileResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fileResult", function() { return fileResult; }); -/* harmony import */ var _enums_http_status_code__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums/http_status_code */ "./src/enums/http_status_code.ts"); +} -var fileResult = function (filePath) { - return { - statusCode: _enums_http_status_code__WEBPACK_IMPORTED_MODULE_0__["HTTP_STATUS_CODE"].Ok, - file: { - filePath: filePath - } - }; -}; +// CONCATENATED MODULE: ./src/handlers/index.ts -/***/ }), -/***/ "./src/helpers/get_class_name.ts": -/*!***************************************!*\ - !*** ./src/helpers/get_class_name.ts ***! - \***************************************/ -/*! exports provided: getClassName */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClassName", function() { return getClassName; }); -var getClassName = function (target) { - return target.name || (target.constructor && target.constructor.name); -}; -/***/ }), -/***/ "./src/helpers/get_data_type.ts": -/*!**************************************!*\ - !*** ./src/helpers/get_data_type.ts ***! - \**************************************/ -/*! exports provided: getDataType */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDataType", function() { return getDataType; }); -/* harmony import */ var _enums_data_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums/data_type */ "./src/enums/data_type.ts"); +// EXTERNAL MODULE: external "mustache" +var external_mustache_ = __webpack_require__(10); -var getDataType = function (value) { - var type = typeof value; - switch (type) { - case 'object': - if (Array.isArray(value)) { - return _enums_data_type__WEBPACK_IMPORTED_MODULE_0__["DATA_TYPE"].Array; - } - default: - return type; - } +// CONCATENATED MODULE: ./src/extra/mustache_view_engine.ts +var mustache_view_engine_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); }; - - -/***/ }), - -/***/ "./src/helpers/get_mime_type_from_extension.ts": -/*!*****************************************************!*\ - !*** ./src/helpers/get_mime_type_from_extension.ts ***! - \*****************************************************/ -/*! exports provided: getMimeTypeFromExtension */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMimeTypeFromExtension", function() { return getMimeTypeFromExtension; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); - -var getMimeTypeFromExtension = function (ext) { - switch (ext) { - case ".htm": - case ".html": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html; - case ".css": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Css; - case ".js": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Js; - case ".png": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Png; - case ".woff": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Woff; - case ".woff2": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Woff2; - case ".json": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Json; - case ".txt": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Text; - case ".jpg": - case ".jpeg": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Jpeg; - case ".rtf": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Rtf; - case ".ttf": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Ttf; - case ".eot": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Eot; - case '.otf': - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Otf; - case ".swf": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Swf; - case ".avi": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Avi; - case ".Svg": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Svg; - case ".pdf": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Pdf; - case ".xml": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Xml; - case ".csv": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Csv; - case ".xls": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Xls; - case ".xlsx": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Xlsx; - case ".bmp": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Bmp; - case ".gif": - return _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Gif; - default: - return "application/octet-stream"; +var mustache_view_engine_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -/***/ }), - -/***/ "./src/helpers/get_result_based_on_mime.ts": -/*!*************************************************!*\ - !*** ./src/helpers/get_result_based_on_mime.ts ***! - \*************************************************/ -/*! exports provided: getResultBasedOnMiMe, setResultMapper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResultBasedOnMiMe", function() { return getResultBasedOnMiMe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setResultMapper", function() { return setResultMapper; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); - -var getResultBasedOnMiMe; -function setResultMapper(mapper) { - if (mapper) { - getResultBasedOnMiMe = function (type, result, callBack) { - return new mapper().map(type, result, callBack); - }; - } - else { - getResultBasedOnMiMe = function (type, result, callBack) { - switch (type) { - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Json: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Text: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html: - case _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Xml: - if (typeof result === 'object' === true) { - callBack(_enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Json); - return JSON.stringify(result); - } - } - return result; - }; +var mustache_view_engine_MustacheViewEngine = /** @class */ (function () { + function MustacheViewEngine() { } -} + MustacheViewEngine.prototype.render = function (value) { + return mustache_view_engine_awaiter(this, void 0, void 0, function () { + var viewData; + return mustache_view_engine_generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, getViewFromFile({ + fileLocation: value.view + })]; + case 1: + viewData = _a.sent(); + return [2 /*return*/, external_mustache_["render"](viewData, value.model)]; + } + }); + }); + }; + return MustacheViewEngine; +}()); -/***/ }), +// EXTERNAL MODULE: external "uniqid" +var external_uniqid_ = __webpack_require__(11); -/***/ "./src/helpers/get_view_from_file.ts": -/*!*******************************************!*\ - !*** ./src/helpers/get_view_from_file.ts ***! - \*******************************************/ -/*! exports provided: getViewFromFile */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/abstracts/session_provider.ts -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getViewFromFile", function() { return getViewFromFile; }); -/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs-extra */ "fs-extra"); -/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + +var session_provider_SessionProvider = /** @class */ (function () { + function SessionProvider() { + } + SessionProvider.prototype.createSession = function (sessionId) { + var now = new Date(); + this.sessionId = sessionId != null ? sessionId : external_uniqid_(); + this.cookie.addCookie({ + name: FortGlobal.appSessionIdentifier, + value: this.sessionId, + httpOnly: true, + path: "/", + expires: new Date(now.setMinutes(now.getMinutes() + FortGlobal.sessionTimeOut)), + maxAge: FortGlobal.sessionTimeOut * 60 + }); + }; + SessionProvider.prototype.destroySession = function () { + var cookie = this.cookie.getCookie(FortGlobal.appSessionIdentifier); + cookie.httpOnly = true; + cookie.path = "/"; + this.cookie.removeCookie(cookie); + }; + return SessionProvider; +}()); + + +// CONCATENATED MODULE: ./src/extra/memory_session_provider.ts +var memory_session_provider_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var memory_session_provider_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } @@ -3613,7 +2664,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { +var memory_session_provider_generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } @@ -3640,646 +2691,579 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -var _this = undefined; - - -var viewCache = {}; -var getViewFromFile; -var readView = function (option) { return __awaiter(_this, void 0, void 0, function () { - var pathOfView, result; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - pathOfView = path__WEBPACK_IMPORTED_MODULE_1__["join"](_fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].viewPath, option.fileLocation); - return [4 /*yield*/, Object(fs_extra__WEBPACK_IMPORTED_MODULE_0__["readFile"])(pathOfView, { - encoding: 'utf8' - })]; - case 1: - result = _a.sent(); - if (option.mapView != null) { - return [2 /*return*/, option.mapView(result)]; - } - return [2 /*return*/, result]; - } - }); -}); }; -if (_fort_global__WEBPACK_IMPORTED_MODULE_2__["FortGlobal"].isProduction === true) { - getViewFromFile = function (option) { - return __awaiter(this, void 0, void 0, function () { - var _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - if (!(viewCache[option.fileLocation] == null)) return [3 /*break*/, 2]; - _a = viewCache; - _b = option.fileLocation; - return [4 /*yield*/, readView(option)]; - case 1: - _a[_b] = _c.sent(); - _c.label = 2; - case 2: return [2 /*return*/, viewCache[option.fileLocation]]; - } +var sessionValues = {}; +var MemorySessionProvider = /** @class */ (function (_super) { + memory_session_provider_extends(MemorySessionProvider, _super); + function MemorySessionProvider() { + return _super !== null && _super.apply(this, arguments) || this; + } + MemorySessionProvider.prototype.get = function (key) { + return memory_session_provider_awaiter(this, void 0, void 0, function () { + var savedSession; + return memory_session_provider_generator(this, function (_a) { + savedSession = sessionValues[this.sessionId]; + return [2 /*return*/, savedSession != null ? savedSession[key] : null]; }); }); }; -} -else { - getViewFromFile = function (option) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, readView(option)]; - case 1: return [2 /*return*/, _a.sent()]; - } + MemorySessionProvider.prototype.isExist = function (key) { + return memory_session_provider_awaiter(this, void 0, void 0, function () { + var savedValue; + return memory_session_provider_generator(this, function (_a) { + savedValue = sessionValues[this.sessionId]; + return [2 /*return*/, savedValue == null ? false : savedValue[key] != null]; }); }); }; -} - - -/***/ }), - -/***/ "./src/helpers/html_result.ts": -/*!************************************!*\ - !*** ./src/helpers/html_result.ts ***! - \************************************/ -/*! exports provided: htmlResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "htmlResult", function() { return htmlResult; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/http_status_code */ "./src/enums/http_status_code.ts"); - - -var htmlResult = function (html, statusCode) { - return { - contentType: _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Html, - responseData: html, - statusCode: statusCode || _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Ok + MemorySessionProvider.prototype.getAll = function () { + return memory_session_provider_awaiter(this, void 0, void 0, function () { + var savedValue; + return memory_session_provider_generator(this, function (_a) { + savedValue = sessionValues[this.sessionId]; + return [2 /*return*/, savedValue == null ? {} : savedValue]; + }); + }); }; -}; - - -/***/ }), - -/***/ "./src/helpers/index.ts": -/*!******************************!*\ - !*** ./src/helpers/index.ts ***! - \******************************/ -/*! exports provided: jsonResult, textResult, htmlResult, renderView, downloadResult, fileResult, redirectResult, viewResult, getViewFromFile, promise, LogHelper, getMimeTypeFromExtension, parseAndMatchRoute, parseCookie, JsonHelper, removeLastSlash, removeFirstSlash, reverseLoop, compareExpectedAndRemoveUnnecessary, getDataType, getClassName, removeMethodAndNullFromObject, getResultBasedOnMiMe, setResultMapper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _json_result__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./json_result */ "./src/helpers/json_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "jsonResult", function() { return _json_result__WEBPACK_IMPORTED_MODULE_0__["jsonResult"]; }); - -/* harmony import */ var _text_result__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./text_result */ "./src/helpers/text_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "textResult", function() { return _text_result__WEBPACK_IMPORTED_MODULE_1__["textResult"]; }); - -/* harmony import */ var _html_result__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./html_result */ "./src/helpers/html_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "htmlResult", function() { return _html_result__WEBPACK_IMPORTED_MODULE_2__["htmlResult"]; }); - -/* harmony import */ var _render_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./render_view */ "./src/helpers/render_view.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "renderView", function() { return _render_view__WEBPACK_IMPORTED_MODULE_3__["renderView"]; }); - -/* harmony import */ var _download_result__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./download_result */ "./src/helpers/download_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "downloadResult", function() { return _download_result__WEBPACK_IMPORTED_MODULE_4__["downloadResult"]; }); - -/* harmony import */ var _file_result__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./file_result */ "./src/helpers/file_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fileResult", function() { return _file_result__WEBPACK_IMPORTED_MODULE_5__["fileResult"]; }); - -/* harmony import */ var _redirect_result__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./redirect_result */ "./src/helpers/redirect_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "redirectResult", function() { return _redirect_result__WEBPACK_IMPORTED_MODULE_6__["redirectResult"]; }); - -/* harmony import */ var _view_result__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./view_result */ "./src/helpers/view_result.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "viewResult", function() { return _view_result__WEBPACK_IMPORTED_MODULE_7__["viewResult"]; }); - -/* harmony import */ var _get_view_from_file__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./get_view_from_file */ "./src/helpers/get_view_from_file.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getViewFromFile", function() { return _get_view_from_file__WEBPACK_IMPORTED_MODULE_8__["getViewFromFile"]; }); - -/* harmony import */ var _promise__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./promise */ "./src/helpers/promise.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "promise", function() { return _promise__WEBPACK_IMPORTED_MODULE_9__["promise"]; }); - -/* harmony import */ var _log_helper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./log_helper */ "./src/helpers/log_helper.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LogHelper", function() { return _log_helper__WEBPACK_IMPORTED_MODULE_10__["LogHelper"]; }); - -/* harmony import */ var _get_mime_type_from_extension__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get_mime_type_from_extension */ "./src/helpers/get_mime_type_from_extension.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMimeTypeFromExtension", function() { return _get_mime_type_from_extension__WEBPACK_IMPORTED_MODULE_11__["getMimeTypeFromExtension"]; }); - -/* harmony import */ var _parse_match_route__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./parse_match_route */ "./src/helpers/parse_match_route.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseAndMatchRoute", function() { return _parse_match_route__WEBPACK_IMPORTED_MODULE_12__["parseAndMatchRoute"]; }); - -/* harmony import */ var _parse_cookie__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse_cookie */ "./src/helpers/parse_cookie.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseCookie", function() { return _parse_cookie__WEBPACK_IMPORTED_MODULE_13__["parseCookie"]; }); - -/* harmony import */ var _json_helper__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./json_helper */ "./src/helpers/json_helper.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonHelper", function() { return _json_helper__WEBPACK_IMPORTED_MODULE_14__["JsonHelper"]; }); - -/* harmony import */ var _remove_last_slash__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./remove_last_slash */ "./src/helpers/remove_last_slash.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeLastSlash", function() { return _remove_last_slash__WEBPACK_IMPORTED_MODULE_15__["removeLastSlash"]; }); - -/* harmony import */ var _remove_first_slash__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./remove_first_slash */ "./src/helpers/remove_first_slash.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeFirstSlash", function() { return _remove_first_slash__WEBPACK_IMPORTED_MODULE_16__["removeFirstSlash"]; }); - -/* harmony import */ var _reverse_loop__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./reverse_loop */ "./src/helpers/reverse_loop.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reverseLoop", function() { return _reverse_loop__WEBPACK_IMPORTED_MODULE_17__["reverseLoop"]; }); - -/* harmony import */ var _compar_expected_and_remove_unnecessary__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./compar_expected_and_remove_unnecessary */ "./src/helpers/compar_expected_and_remove_unnecessary.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "compareExpectedAndRemoveUnnecessary", function() { return _compar_expected_and_remove_unnecessary__WEBPACK_IMPORTED_MODULE_18__["compareExpectedAndRemoveUnnecessary"]; }); - -/* harmony import */ var _get_data_type__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./get_data_type */ "./src/helpers/get_data_type.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDataType", function() { return _get_data_type__WEBPACK_IMPORTED_MODULE_19__["getDataType"]; }); - -/* harmony import */ var _get_class_name__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./get_class_name */ "./src/helpers/get_class_name.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getClassName", function() { return _get_class_name__WEBPACK_IMPORTED_MODULE_20__["getClassName"]; }); - -/* harmony import */ var _remove_method_and_null_from_object__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./remove_method_and_null_from_object */ "./src/helpers/remove_method_and_null_from_object.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeMethodAndNullFromObject", function() { return _remove_method_and_null_from_object__WEBPACK_IMPORTED_MODULE_21__["removeMethodAndNullFromObject"]; }); - -/* harmony import */ var _get_result_based_on_mime__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./get_result_based_on_mime */ "./src/helpers/get_result_based_on_mime.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getResultBasedOnMiMe", function() { return _get_result_based_on_mime__WEBPACK_IMPORTED_MODULE_22__["getResultBasedOnMiMe"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setResultMapper", function() { return _get_result_based_on_mime__WEBPACK_IMPORTED_MODULE_22__["setResultMapper"]; }); - - - - - - - - - - - - - - - - - - - - - - - - - - -/***/ }), - -/***/ "./src/helpers/json_helper.ts": -/*!************************************!*\ - !*** ./src/helpers/json_helper.ts ***! - \************************************/ -/*! exports provided: JsonHelper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonHelper", function() { return JsonHelper; }); -var JsonHelper = /** @class */ (function () { - function JsonHelper() { - } - JsonHelper.parse = function (value) { - try { - return JSON.parse(value); - } - catch (ex) { - // tslint:disable-next-line - throw { - message: "Post data is invalid" - }; - } + MemorySessionProvider.prototype.set = function (key, val) { + return memory_session_provider_awaiter(this, void 0, void 0, function () { + var _a, savedValue; + return memory_session_provider_generator(this, function (_b) { + savedValue = sessionValues[this.sessionId]; + if (savedValue == null) { + this.createSession(); + sessionValues[this.sessionId] = (_a = {}, + _a[key] = val, + _a); + } + else { + savedValue[key] = val; + } + return [2 /*return*/]; + }); + }); }; - JsonHelper.stringify = function (value) { - return JSON.stringify(value); + MemorySessionProvider.prototype.setMany = function (values) { + var _this = this; + return Promise.all(Object.keys(values).map(function (key) { + return _this.set(key, values[key]); + })); }; - return JsonHelper; -}()); - - - -/***/ }), - -/***/ "./src/helpers/json_result.ts": -/*!************************************!*\ - !*** ./src/helpers/json_result.ts ***! - \************************************/ -/*! exports provided: jsonResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsonResult", function() { return jsonResult; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/http_status_code */ "./src/enums/http_status_code.ts"); - - -var jsonResult = function (value, statusCode) { - return { - contentType: _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Json, - responseData: value, - statusCode: statusCode || _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Ok + MemorySessionProvider.prototype.remove = function (key) { + return memory_session_provider_awaiter(this, void 0, void 0, function () { + var savedValue; + return memory_session_provider_generator(this, function (_a) { + savedValue = sessionValues[this.sessionId]; + if (savedValue != null) { + savedValue[key] = null; + } + return [2 /*return*/]; + }); + }); }; -}; - - -/***/ }), + MemorySessionProvider.prototype.clear = function () { + return memory_session_provider_awaiter(this, void 0, void 0, function () { + return memory_session_provider_generator(this, function (_a) { + // remove session values + delete sessionValues[this.sessionId]; + // expire cookie in browser + this.destroySession(); + return [2 /*return*/]; + }); + }); + }; + return MemorySessionProvider; +}(session_provider_SessionProvider)); -/***/ "./src/helpers/log_helper.ts": -/*!***********************************!*\ - !*** ./src/helpers/log_helper.ts ***! - \***********************************/ -/*! exports provided: LogHelper */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogHelper", function() { return LogHelper; }); -/* harmony import */ var _enums_error_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums/error_type */ "./src/enums/error_type.ts"); +// CONCATENATED MODULE: ./src/extra/index.ts -var LogHelper = /** @class */ (function () { - function LogHelper(type, info) { - this.type = type; - this.info_ = info; - this.message = this.getMsg_(); + + +// EXTERNAL MODULE: external "http" +var external_http_ = __webpack_require__(12); + +// CONCATENATED MODULE: ./src/test_helpers/http_response_stub.ts +var HttpResponseStub = /** @class */ (function () { + function HttpResponseStub(headers) { + this.headers_ = headers; } - LogHelper.prototype.throw = function () { - var errMsg = this.get(); - throw JSON.stringify(errMsg); + HttpResponseStub.prototype.getHeader = function (name) { + return this.headers_[name]; }; - LogHelper.log = function (msg) { - console.log(msg); + HttpResponseStub.prototype.hasHeader = function (name) { + return this.headers_[name] != null; }; - LogHelper.prototype.logError = function () { - console.error(this.get()); + HttpResponseStub.prototype.setHeader = function (name, value) { + this.headers_[name] = value; }; - LogHelper.prototype.logWarning = function () { - console.warn(this.get()); + HttpResponseStub.prototype.getHeaders = function () { + return this.headers_; }; - LogHelper.prototype.get = function () { - return { - message: this.message, - type: this.type - }; + HttpResponseStub.prototype.getHeaderNames = function () { + return Object.keys[this.headers_]; }; - LogHelper.prototype.getMsg_ = function () { - var errMsg; - switch (this.type) { - case _enums_error_type__WEBPACK_IMPORTED_MODULE_0__["ERROR_TYPE"].InvalidControllerName: - errMsg = "Invalid controller name - '" + this.info_ + "'. Controller name must contain 'controller'."; - break; - case _enums_error_type__WEBPACK_IMPORTED_MODULE_0__["ERROR_TYPE"].InvalidContentType: - errMsg = "Content type - '" + this.info_ + "' is not valid. Please create an issue if you think this is valid type."; - break; - case _enums_error_type__WEBPACK_IMPORTED_MODULE_0__["ERROR_TYPE"].PortInUse: - errMsg = "Port " + this.info_ + " is being used by another process."; - break; - case _enums_error_type__WEBPACK_IMPORTED_MODULE_0__["ERROR_TYPE"].UndefinedViewEngine: - errMsg = "View engine is not initiated.Initiate the view engine where fort is created."; - break; - default: - errMsg = this.message; - break; - } - return errMsg; + HttpResponseStub.prototype.removeHeader = function (name) { + delete this.headers_[name]; }; - return LogHelper; + return HttpResponseStub; }()); +// CONCATENATED MODULE: ./src/test_helpers/http_request_stub.ts +var HttpRequestStub = /** @class */ (function () { + function HttpRequestStub(headers) { + this.headers = headers; + } + return HttpRequestStub; +}()); -/***/ }), -/***/ "./src/helpers/parse_cookie.ts": -/*!*************************************!*\ - !*** ./src/helpers/parse_cookie.ts ***! - \*************************************/ -/*! exports provided: parseCookie */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/test_helpers/init_controller.ts -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseCookie", function() { return parseCookie; }); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts"); -var parseCookie = function (cookie) { - var value = {}; - if (!Object(_utils__WEBPACK_IMPORTED_MODULE_0__["isNullOrEmpty"])(cookie)) { - cookie.split(';').forEach(function (val) { - var parts = val.split('='); - value[parts.shift().trim()] = decodeURI(parts.join('=')); - }); - } - return value; + + +var initController = function (controllerInstance, data) { + data = data || {}; + var parsedCookies = data.cookieValue || {}; + var headers = (data.request && data.request.headers) || {}; + controllerInstance.request = new HttpRequestStub(headers); + controllerInstance.response = new HttpResponseStub(headers); + controllerInstance.query = data.query || {}; + controllerInstance.body = data.body || {}; + controllerInstance.cookie = new CookieManager(parsedCookies); + var session = new FortGlobal.sessionProvider(); + session.cookie = controllerInstance.cookie; + session.sessionId = parsedCookies[FortGlobal.appSessionIdentifier]; + controllerInstance.session = session; + controllerInstance.param = data.param || {}; + controllerInstance.data = data.data || {}; + controllerInstance.file = new file_manager_FileManager(data.file || {}); + return controllerInstance; }; +// CONCATENATED MODULE: ./src/test_helpers/init_guard.ts -/***/ }), +var initGuard = function (guardInstance, data) { + return initController(guardInstance, data); +}; -/***/ "./src/helpers/parse_match_route.ts": -/*!******************************************!*\ - !*** ./src/helpers/parse_match_route.ts ***! - \******************************************/ -/*! exports provided: parseAndMatchRoute */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/test_helpers/init_shield.ts -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseAndMatchRoute", function() { return parseAndMatchRoute; }); -/* harmony import */ var _handlers_route_handler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers/route_handler */ "./src/handlers/route_handler.ts"); -/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! . */ "./src/helpers/index.ts"); +var initShield = function (shieldInstance, data) { + var value = initController(shieldInstance, data); + value.workerName = data && data.workerName; + return value; +}; +// CONCATENATED MODULE: ./src/test_helpers/init_wall.ts -var regex1 = /{(.*)}(?!.)/; -var regex2 = /{(.*)}\.(\w+)(?!.)/; -var checkRouteInWorker = function (route, httpMethod, urlParts) { - var matchedRoute = { - allowedHttpMethod: [], - controller: route.controller, - controllerName: route.controllerName - }; - var urlPartLength = urlParts.length; - var _loop_1 = function (workerName) { - var worker = route.workers[workerName]; - var patternSplit = worker.pattern.split("/"); - if (urlPartLength === patternSplit.length) { - var isMatched_1 = true; - var params_1 = {}; - urlParts.every(function (urlPart, i) { - // if not equal then check for regex match - if (urlPart !== patternSplit[i]) { - var regMatch1 = patternSplit[i].match(regex1); - var regMatch2 = patternSplit[i].match(regex2); - if (regMatch1 != null) { - params_1[regMatch1[1]] = urlPart; - } - else if (regMatch2 != null) { - var splitByDot = urlPart.split("."); - if (splitByDot[1] === regMatch2[2]) { - params_1[regMatch2[1]] = splitByDot[0]; - } - else { - isMatched_1 = false; - } - } - else { - isMatched_1 = false; - } - } - // means its direct match - return isMatched_1; - }); - if (isMatched_1 === true) { - if (worker.methodsAllowed.indexOf(httpMethod) >= 0) { - matchedRoute.workerInfo = worker; - matchedRoute.params = params_1; - matchedRoute.shields = route.shields; - return "break"; - } - else { - matchedRoute.allowedHttpMethod = matchedRoute.allowedHttpMethod.concat(worker.methodsAllowed); - } - } - } - }; - for (var workerName in route.workers) { - var state_1 = _loop_1(workerName); - if (state_1 === "break") - break; - } - if (matchedRoute.workerInfo == null && matchedRoute.allowedHttpMethod.length === 0) { - return null; - } - return matchedRoute; +var initWall = function (wallInstance, data) { + return initController(wallInstance, data); }; -function parseAndMatchRoute(url, httpMethod) { - url = Object(___WEBPACK_IMPORTED_MODULE_1__["removeLastSlash"])(url); - var urlParts = url.split("/"); - var route = _handlers_route_handler__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].findControllerFromPath(urlParts); - return route == null ? checkRouteInWorker(_handlers_route_handler__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].defaultRoute, httpMethod, urlParts) : - checkRouteInWorker(route, httpMethod, urlParts); -} +// CONCATENATED MODULE: ./src/test_helpers/index.ts -/***/ }), -/***/ "./src/helpers/promise.ts": -/*!********************************!*\ - !*** ./src/helpers/promise.ts ***! - \********************************/ -/*! exports provided: promise */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "promise", function() { return promise; }); -var promise = function (callBack) { - return new Promise(callBack); -}; -/***/ }), +// CONCATENATED MODULE: ./src/abstracts/controller.ts -/***/ "./src/helpers/redirect_result.ts": -/*!****************************************!*\ - !*** ./src/helpers/redirect_result.ts ***! - \****************************************/ -/*! exports provided: redirectResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redirectResult", function() { return redirectResult; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/http_status_code */ "./src/enums/http_status_code.ts"); +var controller_Controller = /** @class */ (function () { + function Controller() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + } + Object.defineProperty(Controller.prototype, "logger", { + get: function () { + return FortGlobal.logger; + }, + enumerable: true, + configurable: true + }); + Controller.prototype.initialize = function (data) { + initController(this, data); + }; + return Controller; +}()); -var redirectResult = function (url) { - return { - contentType: _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Text, - responseData: url, - statusCode: _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Redirect, - shouldRedirect: true +// CONCATENATED MODULE: ./src/abstracts/shield.ts + + +var shield_Shield = /** @class */ (function () { + function Shield() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + } + Object.defineProperty(Shield.prototype, "logger", { + get: function () { + return FortGlobal.logger; + }, + enumerable: true, + configurable: true + }); + Shield.prototype.initialize = function (data) { + return initShield(this, data); }; -}; + return Shield; +}()); -/***/ }), +// CONCATENATED MODULE: ./src/abstracts/guard.ts -/***/ "./src/helpers/remove_first_slash.ts": -/*!*******************************************!*\ - !*** ./src/helpers/remove_first_slash.ts ***! - \*******************************************/ -/*! exports provided: removeFirstSlash */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFirstSlash", function() { return removeFirstSlash; }); -var removeFirstSlash = function (value) { - // remove / from string at 0th index - if (value[0] === "/") { - return value.substr(1); +var guard_Guard = /** @class */ (function () { + function Guard() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + } + Object.defineProperty(Guard.prototype, "logger", { + get: function () { + return FortGlobal.logger; + }, + enumerable: true, + configurable: true + }); + Guard.prototype.initialize = function (data) { + return initGuard(this, data); + }; + return Guard; +}()); + + +// CONCATENATED MODULE: ./src/abstracts/view_engine.ts +var ViewEngine = /** @class */ (function () { + function ViewEngine() { + } + return ViewEngine; +}()); + + +// CONCATENATED MODULE: ./src/abstracts/wall.ts +var wall_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var wall_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } - return value; }; -/***/ }), +var wall_Wall = /** @class */ (function () { + function Wall() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + } + Object.defineProperty(Wall.prototype, "logger", { + get: function () { + return FortGlobal.logger; + }, + enumerable: true, + configurable: true + }); + Wall.prototype.onOutgoing = function (finalResult) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return wall_awaiter(this, void 0, void 0, function () { + return wall_generator(this, function (_a) { + return [2 /*return*/, null]; + }); + }); + }; + Wall.prototype.initialize = function (data) { + return initWall(this, data); + }; + return Wall; +}()); -/***/ "./src/helpers/remove_last_slash.ts": -/*!******************************************!*\ - !*** ./src/helpers/remove_last_slash.ts ***! - \******************************************/ -/*! exports provided: removeLastSlash */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeLastSlash", function() { return removeLastSlash; }); -var removeLastSlash = function (url) { - var urlLength = url.length; - // removing / from url; - if (url[urlLength - 1] === "/") { - return url.substr(0, urlLength - 1); +// CONCATENATED MODULE: ./src/abstracts/xml_parser.ts +var XmlParser = /** @class */ (function () { + function XmlParser() { } - return url; -}; + return XmlParser; +}()); -/***/ }), +// CONCATENATED MODULE: ./src/abstracts/result_mapper.ts +var ResultMapper = /** @class */ (function () { + function ResultMapper() { + } + return ResultMapper; +}()); -/***/ "./src/helpers/remove_method_and_null_from_object.ts": -/*!***********************************************************!*\ - !*** ./src/helpers/remove_method_and_null_from_object.ts ***! - \***********************************************************/ -/*! exports provided: removeMethodAndNullFromObject */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeMethodAndNullFromObject", function() { return removeMethodAndNullFromObject; }); -/* harmony import */ var _get_data_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./get_data_type */ "./src/helpers/get_data_type.ts"); -/* harmony import */ var _enums_data_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/data_type */ "./src/enums/data_type.ts"); +// CONCATENATED MODULE: ./src/abstracts/index.ts -var removeMethodAndNullFromObject = function (value) { - var outputValue = {}; - for (var prop in value) { - var type = Object(_get_data_type__WEBPACK_IMPORTED_MODULE_0__["getDataType"])(value[prop]); - if (!(value[prop] == null || type === _enums_data_type__WEBPACK_IMPORTED_MODULE_1__["DATA_TYPE"].Function)) { - outputValue[prop] = value[prop]; - } - } - return outputValue; -}; -/***/ }), -/***/ "./src/helpers/render_view.ts": -/*!************************************!*\ - !*** ./src/helpers/render_view.ts ***! - \************************************/ -/*! exports provided: renderView */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderView", function() { return renderView; }); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -/* harmony import */ var _log_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./log_helper */ "./src/helpers/log_helper.ts"); -/* harmony import */ var _enums_error_type__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../enums/error_type */ "./src/enums/error_type.ts"); -var renderView; -if (_fort_global__WEBPACK_IMPORTED_MODULE_0__["FortGlobal"].isProduction === true) { - renderView = function (viewName, model) { - return _fort_global__WEBPACK_IMPORTED_MODULE_0__["FortGlobal"].viewEngine.render({ - view: viewName, - model: model - }); +// CONCATENATED MODULE: ./src/generics/generic_guard.ts +var generic_guard_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); }; -} -else { - renderView = function (viewName, model) { - if (_fort_global__WEBPACK_IMPORTED_MODULE_0__["FortGlobal"].viewEngine == null) { - new _log_helper__WEBPACK_IMPORTED_MODULE_1__["LogHelper"](_enums_error_type__WEBPACK_IMPORTED_MODULE_2__["ERROR_TYPE"].UndefinedViewEngine).throw(); - } - return _fort_global__WEBPACK_IMPORTED_MODULE_0__["FortGlobal"].viewEngine.render({ - view: viewName, - model: model - }); + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -} +})(); +var GenericGuard = /** @class */ (function (_super) { + generic_guard_extends(GenericGuard, _super); + function GenericGuard() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return _super.call(this) || this; + } + GenericGuard.prototype.check = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return null; + }; + return GenericGuard; +}(guard_Guard)); -/***/ }), -/***/ "./src/helpers/reverse_loop.ts": -/*!*************************************!*\ - !*** ./src/helpers/reverse_loop.ts ***! - \*************************************/ -/*! exports provided: reverseLoop */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/generics/generic_shield.ts +var generic_shield_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reverseLoop", function() { return reverseLoop; }); -var reverseLoop = function (values, cb) { - for (var length_1 = values.length, i = length_1 - 1; i >= 0; i--) { - cb(values[i], i); +var GenericShield = /** @class */ (function (_super) { + generic_shield_extends(GenericShield, _super); + function GenericShield() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return _super.call(this) || this; } -}; + GenericShield.prototype.protect = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return null; + }; + return GenericShield; +}(shield_Shield)); -/***/ }), +// CONCATENATED MODULE: ./src/generics/generic_session_provider.ts +var generic_session_provider_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var generic_session_provider_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var generic_session_provider_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; -/***/ "./src/helpers/text_result.ts": -/*!************************************!*\ - !*** ./src/helpers/text_result.ts ***! - \************************************/ -/*! exports provided: textResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var GenericSessionProvider = /** @class */ (function (_super) { + generic_session_provider_extends(GenericSessionProvider, _super); + function GenericSessionProvider() { + return _super !== null && _super.apply(this, arguments) || this; + } + GenericSessionProvider.prototype.get = function () { + return null; + }; + GenericSessionProvider.prototype.getAll = function () { + return null; + }; + GenericSessionProvider.prototype.set = function (key, value) { + return null; + }; + GenericSessionProvider.prototype.isExist = function (key) { + return null; + }; + GenericSessionProvider.prototype.remove = function (key) { + return null; + }; + GenericSessionProvider.prototype.setMany = function (values) { + return null; + }; + GenericSessionProvider.prototype.clear = function () { + return generic_session_provider_awaiter(this, void 0, void 0, function () { + return generic_session_provider_generator(this, function (_a) { + return [2 /*return*/]; + }); + }); + }; + return GenericSessionProvider; +}(session_provider_SessionProvider)); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "textResult", function() { return textResult; }); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums/http_status_code */ "./src/enums/http_status_code.ts"); +// CONCATENATED MODULE: ./src/generics/generic_wall.ts +var generic_wall_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); -var textResult = function (text, statusCode) { - return { - contentType: _enums__WEBPACK_IMPORTED_MODULE_0__["MIME_TYPE"].Text, - responseData: text, - statusCode: statusCode || _enums_http_status_code__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Ok +var GenericWall = /** @class */ (function (_super) { + generic_wall_extends(GenericWall, _super); + function GenericWall() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return _super.call(this) || this; + } + GenericWall.prototype.onIncoming = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return null; }; -}; + return GenericWall; +}(wall_Wall)); -/***/ }), +// CONCATENATED MODULE: ./src/generics/generic_controller.ts +var generic_controller_extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); -/***/ "./src/helpers/view_result.ts": -/*!************************************!*\ - !*** ./src/helpers/view_result.ts ***! - \************************************/ -/*! exports provided: viewResult */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var GenericController = /** @class */ (function (_super) { + generic_controller_extends(GenericController, _super); + function GenericController() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return _super.call(this) || this; + } + return GenericController; +}(controller_Controller)); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "viewResult", function() { return viewResult; }); -/* harmony import */ var _render_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./render_view */ "./src/helpers/render_view.ts"); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + +// CONCATENATED MODULE: ./src/generics/generic_xml_parser.ts +var generic_xml_parser_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } @@ -4287,7 +3271,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { +var generic_xml_parser_generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } @@ -4299,459 +3283,83 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var _this = undefined; - - -var viewResult = function (viewName, model) { return __awaiter(_this, void 0, void 0, function () { - var viewData; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, Object(_render_view__WEBPACK_IMPORTED_MODULE_0__["renderView"])(viewName, model)]; - case 1: - viewData = _a.sent(); - return [2 /*return*/, { - contentType: _enums__WEBPACK_IMPORTED_MODULE_1__["MIME_TYPE"].Html, - responseData: viewData, - statusCode: _enums__WEBPACK_IMPORTED_MODULE_1__["HTTP_STATUS_CODE"].Ok - }]; - } - }); -}); }; - - -/***/ }), - -/***/ "./src/index.ts": -/*!**********************!*\ - !*** ./src/index.ts ***! - \**********************/ -/*! exports provided: ErrorHandler, HttpCookie, Fort, Router, CookieManager, FileManager, HttpFile, Logger, RouteInfo, Controller, Shield, SessionProvider, Guard, ViewEngine, Wall, XmlParser, ResultMapper, Worker, Shields, Guards, Route, DefaultWorker, Assign, Singleton, ExpectBody, ExpectQuery, MIME_TYPE, HTTP_METHOD, HTTP_STATUS_CODE, ETag_Type, ERROR_TYPE, DATA_TYPE, jsonResult, textResult, htmlResult, renderView, downloadResult, fileResult, redirectResult, viewResult, getViewFromFile, promise, LogHelper, getMimeTypeFromExtension, parseAndMatchRoute, parseCookie, JsonHelper, removeLastSlash, removeFirstSlash, reverseLoop, compareExpectedAndRemoveUnnecessary, getDataType, getClassName, removeMethodAndNullFromObject, getResultBasedOnMiMe, setResultMapper, MustacheViewEngine, MemorySessionProvider */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./models */ "./src/models/index.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["ErrorHandler"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpCookie", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["HttpCookie"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fort", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["Fort"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["Router"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CookieManager", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["CookieManager"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FileManager", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["FileManager"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpFile", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["HttpFile"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["Logger"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RouteInfo", function() { return _models__WEBPACK_IMPORTED_MODULE_0__["RouteInfo"]; }); - -/* harmony import */ var _abstracts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abstracts */ "./src/abstracts/index.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Controller", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["Controller"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Shield", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["Shield"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SessionProvider", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["SessionProvider"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Guard", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["Guard"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViewEngine", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["ViewEngine"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wall", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["Wall"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "XmlParser", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["XmlParser"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ResultMapper", function() { return _abstracts__WEBPACK_IMPORTED_MODULE_1__["ResultMapper"]; }); - -/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decorators */ "./src/decorators/index.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Worker", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["Worker"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Shields", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["Shields"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Guards", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["Guards"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["Route"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DefaultWorker", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["DefaultWorker"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["Assign"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Singleton", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["Singleton"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ExpectBody", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["ExpectBody"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ExpectQuery", function() { return _decorators__WEBPACK_IMPORTED_MODULE_2__["ExpectQuery"]; }); - -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enums */ "./src/enums/index.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MIME_TYPE", function() { return _enums__WEBPACK_IMPORTED_MODULE_3__["MIME_TYPE"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTTP_METHOD", function() { return _enums__WEBPACK_IMPORTED_MODULE_3__["HTTP_METHOD"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTTP_STATUS_CODE", function() { return _enums__WEBPACK_IMPORTED_MODULE_3__["HTTP_STATUS_CODE"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ETag_Type", function() { return _enums__WEBPACK_IMPORTED_MODULE_3__["ETag_Type"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_TYPE", function() { return _enums__WEBPACK_IMPORTED_MODULE_3__["ERROR_TYPE"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DATA_TYPE", function() { return _enums__WEBPACK_IMPORTED_MODULE_3__["DATA_TYPE"]; }); - -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers */ "./src/helpers/index.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "jsonResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["jsonResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "textResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["textResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "htmlResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["htmlResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "renderView", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["renderView"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "downloadResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["downloadResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fileResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["fileResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "redirectResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["redirectResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "viewResult", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["viewResult"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getViewFromFile", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["getViewFromFile"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "promise", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["promise"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LogHelper", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["LogHelper"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMimeTypeFromExtension", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["getMimeTypeFromExtension"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseAndMatchRoute", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["parseAndMatchRoute"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseCookie", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["parseCookie"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonHelper", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["JsonHelper"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeLastSlash", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["removeLastSlash"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeFirstSlash", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["removeFirstSlash"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reverseLoop", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["reverseLoop"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "compareExpectedAndRemoveUnnecessary", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["compareExpectedAndRemoveUnnecessary"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDataType", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["getDataType"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getClassName", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["getClassName"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeMethodAndNullFromObject", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["removeMethodAndNullFromObject"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getResultBasedOnMiMe", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["getResultBasedOnMiMe"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setResultMapper", function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__["setResultMapper"]; }); - -/* harmony import */ var _extra__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./extra */ "./src/extra/index.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MustacheViewEngine", function() { return _extra__WEBPACK_IMPORTED_MODULE_5__["MustacheViewEngine"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MemorySessionProvider", function() { return _extra__WEBPACK_IMPORTED_MODULE_5__["MemorySessionProvider"]; }); - - - - - - - - - -/***/ }), - -/***/ "./src/models/cookie_manager.ts": -/*!**************************************!*\ - !*** ./src/models/cookie_manager.ts ***! - \**************************************/ -/*! exports provided: CookieManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CookieManager", function() { return CookieManager; }); -var CookieManager = /** @class */ (function () { - function CookieManager(parsedValue) { - this.responseCookie_ = []; - this.cookieCollection_ = parsedValue; - } - /** - * return cookie by name - * - * @param {string} name - * @returns - * @memberof CookieManager - */ - CookieManager.prototype.getCookie = function (name) { - return { - name: name, - value: this.cookieCollection_[name] - }; - }; - /** - * add cookie - * - * @param {HttpCookie} cookie - * @memberof CookieManager - */ - CookieManager.prototype.addCookie = function (cookie) { - this.cookieCollection_[cookie.name] = cookie.value; - this.responseCookie_.push(this.getCookieStringFromCookie_(cookie)); - }; - /** - * remove cookie - * - * @param {HttpCookie} cookie - * @memberof CookieManager - */ - CookieManager.prototype.removeCookie = function (cookie) { - this.cookieCollection_[cookie.name] = null; - cookie.expires = new Date('Thu, 01 Jan 1970 00:00:00 GMT'); - cookie.maxAge = -1; - this.responseCookie_.push(this.getCookieStringFromCookie_(cookie)); - }; - Object.defineProperty(CookieManager.prototype, "cookieCollection", { - /** - * collection of http cookie - * - * @readonly - * @memberof CookieManager - */ - get: function () { - return this.cookieCollection_; - }, - enumerable: true, - configurable: true - }); - /** - * determine whether value exist or not - * - * @param {string} name - * @returns - * @memberof CookieManager - */ - CookieManager.prototype.isExist = function (name) { - return this.cookieCollection_[name] != null; - }; - CookieManager.prototype.getCookieStringFromCookie_ = function (cookie) { - var cookies = []; - cookies.push(cookie.name + "=" + cookie.value); - if (cookie.expires) { - cookies.push("Expires=" + cookie.expires.toUTCString()); - } - if (cookie.httpOnly === true) { - cookies.push("HttpOnly"); - } - if (cookie.maxAge != null) { - cookies.push("Max-Age=" + cookie.maxAge); - } - if (cookie.path) { - cookies.push("Path=" + cookie.path); - } - if (cookie.domain) { - cookies.push("Domain=" + cookie.domain); - } - return cookies.join('; '); - }; - return CookieManager; -}()); - - - -/***/ }), - -/***/ "./src/models/error_handler.ts": -/*!*************************************!*\ - !*** ./src/models/error_handler.ts ***! - \*************************************/ -/*! exports provided: ErrorHandler */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return ErrorHandler; }); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); - -var ErrorHandler = /** @class */ (function () { - function ErrorHandler() { - } - ErrorHandler.prototype.onServerError = function (ex) { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["promise"])(function (resolve, reject) { - var errMessage = "

internal server error

\n

message : " + ex.message + "

"; - if (ex.stack) { - errMessage += "

stacktrace: " + ex.stack + "

"; - } - if (ex.type) { - errMessage += "

type: " + ex.type + "

"; - } - resolve(errMessage); - }); - }; - ErrorHandler.prototype.onBadRequest = function (ex) { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["promise"])(function (resolve, reject) { - var errMessage = "

Bad Request

"; - if (ex.message) { - errMessage += "

message : " + ex.message + "

"; - } - if (ex.stack) { - errMessage += "

stacktrace: " + ex.stack + "

"; - } - if (ex.type) { - errMessage += "

type: " + ex.type + "

"; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; } - resolve(errMessage); - }); - }; - ErrorHandler.prototype.onForbiddenRequest = function () { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["promise"])(function (resolve, reject) { - var errMessage = "

Forbidden

"; - resolve(errMessage); - }); - }; - ErrorHandler.prototype.onNotAcceptableRequest = function () { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["promise"])(function (resolve, reject) { - var errMessage = "

Not Acceptable

"; - resolve(errMessage); - }); - }; - ErrorHandler.prototype.onMethodNotAllowed = function () { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["promise"])(function (resolve, reject) { - var errMessage = "

Method Not allowed.

"; - resolve(errMessage); - }); - }; - ErrorHandler.prototype.onNotFound = function (url) { - return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["promise"])(function (resolve, reject) { - var errMessage = "

The requested resource " + url + " was not found.

"; - resolve(errMessage); + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var GenericXmlParser = /** @class */ (function () { + function GenericXmlParser() { + } + GenericXmlParser.prototype.parse = function (xml) { + return generic_xml_parser_awaiter(this, void 0, void 0, function () { + return generic_xml_parser_generator(this, function (_a) { + // tslint:disable-next-line + throw { + message: "no xml parser configured" + }; + }); }); }; - return ErrorHandler; + return GenericXmlParser; }()); +// CONCATENATED MODULE: ./src/generics/index.ts -/***/ }), -/***/ "./src/models/file_manager.ts": -/*!************************************!*\ - !*** ./src/models/file_manager.ts ***! - \************************************/ -/*! exports provided: FileManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileManager", function() { return FileManager; }); -/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs-extra */ "fs-extra"); -/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_0__); -var FileManager = /** @class */ (function () { - function FileManager(value) { - this.files_ = value; + + + +// CONCATENATED MODULE: ./src/models/logger.ts +var Logger = /** @class */ (function () { + function Logger() { } - Object.defineProperty(FileManager.prototype, "count", { - /** - * get total no of files - * - * @returns - number - * @memberof FileManager - */ - get: function () { - return Object.keys(this.files_).length; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(FileManager.prototype, "files", { - get: function () { - var _this = this; - return Object.keys(this.files_).map(function (fileId) { - return _this.files_[fileId]; - }); - }, - enumerable: true, - configurable: true - }); - /** - * check for existance of file - * - * @param {string} fieldName - * @returns - * @memberof FileManager - */ - FileManager.prototype.isExist = function (fieldName) { - return this.files_[fieldName] != null; + Logger.prototype.info = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this.debug(args); }; - /** - * return the file - * - * @param {string} fieldName - * @returns - * @memberof FileManager - */ - FileManager.prototype.getFile = function (fieldName) { - return this.files_[fieldName]; + Logger.prototype.error = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this.debug(args); }; - /** - * saves file to supplied path - * - * @param {string} fieldName - * @param {string} pathToSave - * @returns - * @memberof FileManager - */ - FileManager.prototype.saveTo = function (fieldName, pathToSave) { - return fs_extra__WEBPACK_IMPORTED_MODULE_0__["copy"](this.files_[fieldName].path, pathToSave); + Logger.prototype.log = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this.debug(args); }; - return FileManager; + Logger.prototype.debug = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + console.log.apply(console, args); + }; + return Logger; }()); - -/***/ }), - -/***/ "./src/models/fort.ts": -/*!****************************!*\ - !*** ./src/models/fort.ts ***! - \****************************/ -/*! exports provided: Fort */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fort", function() { return Fort; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -/* harmony import */ var _extra__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extra */ "./src/extra/index.ts"); -/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! . */ "./src/models/index.ts"); -/* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constant */ "./src/constant.ts"); -/* harmony import */ var http__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! http */ "http"); -/* harmony import */ var http__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(http__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../enums */ "./src/enums/index.ts"); -/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts"); -/* harmony import */ var _generics__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../generics */ "./src/generics/index.ts"); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts"); -/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./logger */ "./src/models/logger.ts"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! path */ "path"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_11__); +// CONCATENATED MODULE: ./src/models/fort.ts @@ -4764,43 +3372,43 @@ __webpack_require__.r(__webpack_exports__); -var Fort = /** @class */ (function () { +var fort_Fort = /** @class */ (function () { function Fort() { this.routes = []; this.walls = []; } Fort.prototype.saveAppOption_ = function (option) { var defaultEtagConfig = { - type: _enums__WEBPACK_IMPORTED_MODULE_6__["ETag_Type"].Weak + type: ETag_Type.Weak }; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].port = option.port == null ? 4000 : option.port; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].shouldParseCookie = option.shouldParseCookie == null ? true : option.shouldParseCookie; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].shouldParsePost = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(option.shouldParsePost) ? true : option.shouldParsePost; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].sessionTimeOut = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(option.sessionTimeOut) ? 60 : option.sessionTimeOut; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].folders = option.folders == null ? [] : option.folders; - if (Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isArray"])(_fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].folders) === false) { + FortGlobal.port = option.port == null ? 4000 : option.port; + FortGlobal.shouldParseCookie = option.shouldParseCookie == null ? true : option.shouldParseCookie; + FortGlobal.shouldParsePost = isNull(option.shouldParsePost) ? true : option.shouldParsePost; + FortGlobal.sessionTimeOut = isNull(option.sessionTimeOut) ? 60 : option.sessionTimeOut; + FortGlobal.folders = option.folders == null ? [] : option.folders; + if (isArray(FortGlobal.folders) === false) { throw new Error("Option folders should be an array"); } - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].appName = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNullOrEmpty"])(option.appName) === true ? _constant__WEBPACK_IMPORTED_MODULE_4__["__AppName"] : option.appName; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].appSessionIdentifier = _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].appName + "_session_id"; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].eTag = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(option.eTag) ? defaultEtagConfig : option.eTag; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].walls = this.walls; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].viewEngine = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(this.viewEngine) ? new _extra__WEBPACK_IMPORTED_MODULE_2__["MustacheViewEngine"]() : new this.viewEngine(); - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].sessionProvider = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(this.sessionProvider) ? _extra__WEBPACK_IMPORTED_MODULE_2__["MemorySessionProvider"] : + FortGlobal.appName = isNullOrEmpty(option.appName) === true ? __AppName : option.appName; + FortGlobal.appSessionIdentifier = FortGlobal.appName + "_session_id"; + FortGlobal.eTag = isNull(option.eTag) ? defaultEtagConfig : option.eTag; + FortGlobal.walls = this.walls; + FortGlobal.viewEngine = isNull(this.viewEngine) ? new mustache_view_engine_MustacheViewEngine() : new this.viewEngine(); + FortGlobal.sessionProvider = isNull(this.sessionProvider) ? MemorySessionProvider : this.sessionProvider; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].errorHandler = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(this.errorHandler) ? ___WEBPACK_IMPORTED_MODULE_3__["ErrorHandler"] : this.errorHandler; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].xmlParser = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(this.xmlParser) ? _generics__WEBPACK_IMPORTED_MODULE_8__["GenericXmlParser"] : this.xmlParser; - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].viewPath = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNull"])(option.viewPath) ? path__WEBPACK_IMPORTED_MODULE_11__["join"](_constant__WEBPACK_IMPORTED_MODULE_4__["__CurrentPath"], "views") : option.viewPath; - Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["setResultMapper"])(this.resultMapper); + FortGlobal.errorHandler = isNull(this.errorHandler) ? error_handler_ErrorHandler : this.errorHandler; + FortGlobal.xmlParser = isNull(this.xmlParser) ? GenericXmlParser : this.xmlParser; + FortGlobal.viewPath = isNull(option.viewPath) ? external_path_["join"](__CurrentPath, "views") : option.viewPath; + setResultMapper(this.resultMapper); if (this.logger) { if (typeof this.logger === 'function') { this.logger = new this.logger(); } } else { - this.logger = new _logger__WEBPACK_IMPORTED_MODULE_10__["Logger"](); + this.logger = new Logger(); } - _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].logger = this.logger; + FortGlobal.logger = this.logger; }; Fort.prototype.create = function (option) { var _this = this; @@ -4812,271 +3420,80 @@ var Fort = /** @class */ (function () { } var isDefaultRouteExist = false; // removing / from routes - this.routes.forEach(function (route) { - // route.path = removeFirstSlash(route.path); - route.path = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["removeLastSlash"])(route.path); - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addToRouterCollection(route); - if (route.path === "/*") { - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].defaultRouteControllerName = route.controller.name; - isDefaultRouteExist = true; - } - }); - if (isDefaultRouteExist === false) { - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].defaultRouteControllerName = _generics__WEBPACK_IMPORTED_MODULE_8__["GenericController"].name; - _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].addToRouterCollection({ - controller: _generics__WEBPACK_IMPORTED_MODULE_8__["GenericController"], - path: "/*" - }); - } - if (option.folders != null) { - // remove / from files routes - option.folders.forEach(function (folder) { - var length = folder.alias.length; - if (length > 1) { - folder.alias = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["removeFirstSlash"])(folder.alias); - folder.alias = Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["removeLastSlash"])(folder.alias); - } - }); - } - this.saveAppOption_(option); - if (this.httpServer != null) { - return; - } - return Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["promise"])(function (res, rej) { - _this.httpServer = http__WEBPACK_IMPORTED_MODULE_5__["createServer"](_this.onNewRequest).once("error", function (err) { - if (err.code === 'EADDRINUSE') { - var error = new _helpers__WEBPACK_IMPORTED_MODULE_7__["LogHelper"](_enums__WEBPACK_IMPORTED_MODULE_6__["ERROR_TYPE"].PortInUse, _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].port).get(); - rej(error); - } - else { - rej(err); - } - }).once('listening', function () { - // set default route - // RouteHandler.defaultRouteControllerName = RouteHandler.getDefaultRoute(); - res(); - }).listen(_fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].port); - }); - }; - Fort.prototype.onNewRequest = function (request, response) { - new _handlers__WEBPACK_IMPORTED_MODULE_0__["RequestHandler"](request, response).handle(); - }; - Fort.prototype.destroy = function () { - var _this = this; - return Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["promise"])(function (res, rej) { - _this.httpServer.close(res); - }); - }; - return Fort; -}()); - - - -/***/ }), - -/***/ "./src/models/http_cookie.ts": -/*!***********************************!*\ - !*** ./src/models/http_cookie.ts ***! - \***********************************/ -/*! exports provided: HttpCookie */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpCookie", function() { return HttpCookie; }); -var HttpCookie = /** @class */ (function () { - function HttpCookie(name, value) { - this.name = name; - this.value = value; - } - return HttpCookie; -}()); - - - -/***/ }), - -/***/ "./src/models/http_file.ts": -/*!*********************************!*\ - !*** ./src/models/http_file.ts ***! - \*********************************/ -/*! exports provided: HttpFile */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpFile", function() { return HttpFile; }); -var HttpFile = /** @class */ (function () { - function HttpFile() { - } - return HttpFile; -}()); - - - -/***/ }), - -/***/ "./src/models/index.ts": -/*!*****************************!*\ - !*** ./src/models/index.ts ***! - \*****************************/ -/*! exports provided: ErrorHandler, HttpCookie, Fort, Router, CookieManager, FileManager, HttpFile, Logger, RouteInfo */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _error_handler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error_handler */ "./src/models/error_handler.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return _error_handler__WEBPACK_IMPORTED_MODULE_0__["ErrorHandler"]; }); - -/* harmony import */ var _http_cookie__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./http_cookie */ "./src/models/http_cookie.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpCookie", function() { return _http_cookie__WEBPACK_IMPORTED_MODULE_1__["HttpCookie"]; }); - -/* harmony import */ var _fort__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fort */ "./src/models/fort.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fort", function() { return _fort__WEBPACK_IMPORTED_MODULE_2__["Fort"]; }); - -/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./router */ "./src/models/router.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return _router__WEBPACK_IMPORTED_MODULE_3__["Router"]; }); - -/* harmony import */ var _cookie_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cookie_manager */ "./src/models/cookie_manager.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CookieManager", function() { return _cookie_manager__WEBPACK_IMPORTED_MODULE_4__["CookieManager"]; }); - -/* harmony import */ var _file_manager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./file_manager */ "./src/models/file_manager.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FileManager", function() { return _file_manager__WEBPACK_IMPORTED_MODULE_5__["FileManager"]; }); - -/* harmony import */ var _http_file__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./http_file */ "./src/models/http_file.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpFile", function() { return _http_file__WEBPACK_IMPORTED_MODULE_6__["HttpFile"]; }); - -/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./logger */ "./src/models/logger.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return _logger__WEBPACK_IMPORTED_MODULE_7__["Logger"]; }); - -/* harmony import */ var _route_info__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./route_info */ "./src/models/route_info.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RouteInfo", function() { return _route_info__WEBPACK_IMPORTED_MODULE_8__["RouteInfo"]; }); - - - - - - - - - - - - -/***/ }), - -/***/ "./src/models/logger.ts": -/*!******************************!*\ - !*** ./src/models/logger.ts ***! - \******************************/ -/*! exports provided: Logger */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return Logger; }); -var Logger = /** @class */ (function () { - function Logger() { - } - Logger.prototype.info = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; + this.routes.forEach(function (route) { + // route.path = removeFirstSlash(route.path); + route.path = removeLastSlash(route.path); + route_handler_RouteHandler.addToRouterCollection(route); + if (route.path === "/*") { + route_handler_RouteHandler.defaultRouteControllerName = route.controller.name; + isDefaultRouteExist = true; + } + }); + if (isDefaultRouteExist === false) { + route_handler_RouteHandler.defaultRouteControllerName = GenericController.name; + route_handler_RouteHandler.addToRouterCollection({ + controller: GenericController, + path: "/*" + }); } - this.debug(args); - }; - Logger.prototype.error = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; + if (option.folders != null) { + // remove / from files routes + option.folders.forEach(function (folder) { + var length = folder.alias.length; + if (length > 1) { + folder.alias = removeFirstSlash(folder.alias); + folder.alias = removeLastSlash(folder.alias); + } + }); } - this.debug(args); - }; - Logger.prototype.log = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; + this.saveAppOption_(option); + if (this.httpServer != null) { + return; } - this.debug(args); + return promise(function (res, rej) { + _this.httpServer = external_http_["createServer"](_this.onNewRequest).once("error", function (err) { + if (err.code === 'EADDRINUSE') { + var error = new log_helper_LogHelper(ERROR_TYPE.PortInUse, FortGlobal.port).get(); + rej(error); + } + else { + rej(err); + } + }).once('listening', function () { + // set default route + // RouteHandler.defaultRouteControllerName = RouteHandler.getDefaultRoute(); + res(); + }).listen(FortGlobal.port); + }); }; - Logger.prototype.debug = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - console.log.apply(console, args); + Fort.prototype.onNewRequest = function (request, response) { + new request_handler_RequestHandler(request, response).handle(); }; - return Logger; -}()); - - - -/***/ }), - -/***/ "./src/models/route_info.ts": -/*!**********************************!*\ - !*** ./src/models/route_info.ts ***! - \**********************************/ -/*! exports provided: RouteInfo */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteInfo", function() { return RouteInfo; }); -var RouteInfo = /** @class */ (function () { - function RouteInfo() { - } - Object.defineProperty(RouteInfo.prototype, "workersAsArray", { - get: function () { - var _this = this; - return Object.keys(this.workers).map(function (workerName) { - return _this.workers[workerName]; - return _this.workers[workerName]; - }); - }, - enumerable: true, - configurable: true - }); - RouteInfo.prototype.init = function (value) { - this.controllerName = value.controllerName; - this.controller = value.controller; - this.path = value.path; - this.shields = value.shields; - this.values = value.values; - this.workers = value.workers; + Fort.prototype.destroy = function () { + var _this = this; + return promise(function (res, rej) { + _this.httpServer.close(res); + }); }; - return RouteInfo; + return Fort; }()); +// CONCATENATED MODULE: ./src/models/router.ts -/***/ }), - -/***/ "./src/models/router.ts": -/*!******************************!*\ - !*** ./src/models/router.ts ***! - \******************************/ -/*! exports provided: Router */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return Router; }); -/* harmony import */ var _handlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handlers */ "./src/handlers/index.ts"); - -var Router = /** @class */ (function () { +var router_Router = /** @class */ (function () { function Router() { } Object.defineProperty(Router.prototype, "routes", { get: function () { - return _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].routerCollection; + return route_handler_RouteHandler.routerCollection; }, enumerable: true, configurable: true }); Object.defineProperty(Router.prototype, "routesAsArray", { get: function () { - return _handlers__WEBPACK_IMPORTED_MODULE_0__["RouteHandler"].routesAsArray; + return route_handler_RouteHandler.routesAsArray; }, enumerable: true, configurable: true @@ -5085,415 +3502,434 @@ var Router = /** @class */ (function () { }()); - -/***/ }), - -/***/ "./src/test_helpers/http_request_stub.ts": -/*!***********************************************!*\ - !*** ./src/test_helpers/http_request_stub.ts ***! - \***********************************************/ -/*! exports provided: HttpRequestStub */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpRequestStub", function() { return HttpRequestStub; }); -var HttpRequestStub = /** @class */ (function () { - function HttpRequestStub(headers) { - this.headers = headers; +// CONCATENATED MODULE: ./src/models/cookie_manager.ts +var CookieManager = /** @class */ (function () { + function CookieManager(parsedValue) { + this.responseCookie_ = []; + this.cookieCollection_ = parsedValue; } - return HttpRequestStub; + /** + * return cookie by name + * + * @param {string} name + * @returns + * @memberof CookieManager + */ + CookieManager.prototype.getCookie = function (name) { + return { + name: name, + value: this.cookieCollection_[name] + }; + }; + /** + * add cookie + * + * @param {HttpCookie} cookie + * @memberof CookieManager + */ + CookieManager.prototype.addCookie = function (cookie) { + this.cookieCollection_[cookie.name] = cookie.value; + this.responseCookie_.push(this.getCookieStringFromCookie_(cookie)); + }; + /** + * remove cookie + * + * @param {HttpCookie} cookie + * @memberof CookieManager + */ + CookieManager.prototype.removeCookie = function (cookie) { + this.cookieCollection_[cookie.name] = null; + cookie.expires = new Date('Thu, 01 Jan 1970 00:00:00 GMT'); + cookie.maxAge = -1; + this.responseCookie_.push(this.getCookieStringFromCookie_(cookie)); + }; + Object.defineProperty(CookieManager.prototype, "cookieCollection", { + /** + * collection of http cookie + * + * @readonly + * @memberof CookieManager + */ + get: function () { + return this.cookieCollection_; + }, + enumerable: true, + configurable: true + }); + /** + * determine whether value exist or not + * + * @param {string} name + * @returns + * @memberof CookieManager + */ + CookieManager.prototype.isExist = function (name) { + return this.cookieCollection_[name] != null; + }; + CookieManager.prototype.getCookieStringFromCookie_ = function (cookie) { + var cookies = []; + cookies.push(cookie.name + "=" + cookie.value); + if (cookie.expires) { + cookies.push("Expires=" + cookie.expires.toUTCString()); + } + if (cookie.httpOnly === true) { + cookies.push("HttpOnly"); + } + if (cookie.maxAge != null) { + cookies.push("Max-Age=" + cookie.maxAge); + } + if (cookie.path) { + cookies.push("Path=" + cookie.path); + } + if (cookie.domain) { + cookies.push("Domain=" + cookie.domain); + } + return cookies.join('; '); + }; + return CookieManager; }()); +// CONCATENATED MODULE: ./src/models/file_manager.ts -/***/ }), - -/***/ "./src/test_helpers/http_response_stub.ts": -/*!************************************************!*\ - !*** ./src/test_helpers/http_response_stub.ts ***! - \************************************************/ -/*! exports provided: HttpResponseStub */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponseStub", function() { return HttpResponseStub; }); -var HttpResponseStub = /** @class */ (function () { - function HttpResponseStub(headers) { - this.headers_ = headers; +var file_manager_FileManager = /** @class */ (function () { + function FileManager(value) { + this.files_ = value; } - HttpResponseStub.prototype.getHeader = function (name) { - return this.headers_[name]; - }; - HttpResponseStub.prototype.hasHeader = function (name) { - return this.headers_[name] != null; - }; - HttpResponseStub.prototype.setHeader = function (name, value) { - this.headers_[name] = value; - }; - HttpResponseStub.prototype.getHeaders = function () { - return this.headers_; + Object.defineProperty(FileManager.prototype, "count", { + /** + * get total no of files + * + * @returns - number + * @memberof FileManager + */ + get: function () { + return Object.keys(this.files_).length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FileManager.prototype, "files", { + get: function () { + var _this = this; + return Object.keys(this.files_).map(function (fileId) { + return _this.files_[fileId]; + }); + }, + enumerable: true, + configurable: true + }); + /** + * check for existance of file + * + * @param {string} fieldName + * @returns + * @memberof FileManager + */ + FileManager.prototype.isExist = function (fieldName) { + return this.files_[fieldName] != null; }; - HttpResponseStub.prototype.getHeaderNames = function () { - return Object.keys[this.headers_]; + /** + * return the file + * + * @param {string} fieldName + * @returns + * @memberof FileManager + */ + FileManager.prototype.getFile = function (fieldName) { + return this.files_[fieldName]; }; - HttpResponseStub.prototype.removeHeader = function (name) { - delete this.headers_[name]; + /** + * saves file to supplied path + * + * @param {string} fieldName + * @param {string} pathToSave + * @returns + * @memberof FileManager + */ + FileManager.prototype.saveTo = function (fieldName, pathToSave) { + return external_fs_extra_["copy"](this.files_[fieldName].path, pathToSave); }; - return HttpResponseStub; + return FileManager; }()); +// CONCATENATED MODULE: ./src/models/http_file.ts +var HttpFile = /** @class */ (function () { + function HttpFile() { + } + return HttpFile; +}()); -/***/ }), - -/***/ "./src/test_helpers/index.ts": -/*!***********************************!*\ - !*** ./src/test_helpers/index.ts ***! - \***********************************/ -/*! exports provided: initController, initGuard, initShield, initWall */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _init_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./init_controller */ "./src/test_helpers/init_controller.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initController", function() { return _init_controller__WEBPACK_IMPORTED_MODULE_0__["initController"]; }); - -/* harmony import */ var _init_guard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./init_guard */ "./src/test_helpers/init_guard.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initGuard", function() { return _init_guard__WEBPACK_IMPORTED_MODULE_1__["initGuard"]; }); -/* harmony import */ var _init_shield__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./init_shield */ "./src/test_helpers/init_shield.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initShield", function() { return _init_shield__WEBPACK_IMPORTED_MODULE_2__["initShield"]; }); +// CONCATENATED MODULE: ./src/models/route_info.ts +var RouteInfo = /** @class */ (function () { + function RouteInfo() { + } + Object.defineProperty(RouteInfo.prototype, "workersAsArray", { + get: function () { + var _this = this; + return Object.keys(this.workers).map(function (workerName) { + return _this.workers[workerName]; + return _this.workers[workerName]; + }); + }, + enumerable: true, + configurable: true + }); + RouteInfo.prototype.init = function (value) { + this.controllerName = value.controllerName; + this.controller = value.controller; + this.path = value.path; + this.shields = value.shields; + this.values = value.values; + this.workers = value.workers; + }; + return RouteInfo; +}()); -/* harmony import */ var _init_wall__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./init_wall */ "./src/test_helpers/init_wall.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initWall", function() { return _init_wall__WEBPACK_IMPORTED_MODULE_3__["initWall"]; }); +// CONCATENATED MODULE: ./src/models/index.ts -/***/ }), -/***/ "./src/test_helpers/init_controller.ts": -/*!*********************************************!*\ - !*** ./src/test_helpers/init_controller.ts ***! - \*********************************************/ -/*! exports provided: initController */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initController", function() { return initController; }); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../models */ "./src/models/index.ts"); -/* harmony import */ var _fort_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../fort_global */ "./src/fort_global.ts"); -/* harmony import */ var _http_response_stub__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http_response_stub */ "./src/test_helpers/http_response_stub.ts"); -/* harmony import */ var _http_request_stub__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./http_request_stub */ "./src/test_helpers/http_request_stub.ts"); +// CONCATENATED MODULE: ./src/decorators/worker.ts -var initController = function (controllerInstance, data) { - data = data || {}; - var parsedCookies = data.cookieValue || {}; - var headers = (data.request && data.request.headers) || {}; - controllerInstance.request = new _http_request_stub__WEBPACK_IMPORTED_MODULE_3__["HttpRequestStub"](headers); - controllerInstance.response = new _http_response_stub__WEBPACK_IMPORTED_MODULE_2__["HttpResponseStub"](headers); - controllerInstance.query = data.query || {}; - controllerInstance.body = data.body || {}; - controllerInstance.cookie = new _models__WEBPACK_IMPORTED_MODULE_0__["CookieManager"](parsedCookies); - var session = new _fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].sessionProvider(); - session.cookie = controllerInstance.cookie; - session.sessionId = parsedCookies[_fort_global__WEBPACK_IMPORTED_MODULE_1__["FortGlobal"].appSessionIdentifier]; - controllerInstance.session = session; - controllerInstance.param = data.param || {}; - controllerInstance.data = data.data || {}; - controllerInstance.file = new _models__WEBPACK_IMPORTED_MODULE_0__["FileManager"](data.file || {}); - return controllerInstance; +// tslint:disable-next-line +var Worker = function (allowedMethods) { + return function (target, methodName, descriptor) { + var className = target.constructor.name; + var actionInfo = { + workerName: methodName, + methodsAllowed: allowedMethods == null ? [ + HTTP_METHOD.Delete, HTTP_METHOD.Get, HTTP_METHOD.Post, HTTP_METHOD.Patch, HTTP_METHOD.Put + ] : allowedMethods, + guards: [], + pattern: "/" + methodName.toLowerCase(), + values: [] + }; + route_handler_RouteHandler.addWorker(actionInfo, className); + }; }; +// CONCATENATED MODULE: ./src/decorators/shields.ts -/***/ }), - -/***/ "./src/test_helpers/init_guard.ts": -/*!****************************************!*\ - !*** ./src/test_helpers/init_guard.ts ***! - \****************************************/ -/*! exports provided: initGuard */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initGuard", function() { return initGuard; }); -/* harmony import */ var _init_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./init_controller */ "./src/test_helpers/init_controller.ts"); - -var initGuard = function (guardInstance, data) { - return Object(_init_controller__WEBPACK_IMPORTED_MODULE_0__["initController"])(guardInstance, data); +// tslint:disable-next-line +var Shields = function (shieldsValue) { + return function (target) { + var className = target.name; + route_handler_RouteHandler.addShields(shieldsValue, className); + }; }; +// CONCATENATED MODULE: ./src/decorators/guards.ts -/***/ }), - -/***/ "./src/test_helpers/init_shield.ts": -/*!*****************************************!*\ - !*** ./src/test_helpers/init_shield.ts ***! - \*****************************************/ -/*! exports provided: initShield */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initShield", function() { return initShield; }); -/* harmony import */ var _init_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./init_controller */ "./src/test_helpers/init_controller.ts"); - -var initShield = function (shieldInstance, data) { - var value = Object(_init_controller__WEBPACK_IMPORTED_MODULE_0__["initController"])(shieldInstance, data); - value.workerName = data && data.workerName; - return value; +// tslint:disable-next-line +var Guards = function (value) { + return (function (target, methodName, descriptor) { + var className = target.constructor.name; + route_handler_RouteHandler.addGuards(value, className, methodName); + }); }; +// CONCATENATED MODULE: ./src/decorators/route.ts -/***/ }), - -/***/ "./src/test_helpers/init_wall.ts": -/*!***************************************!*\ - !*** ./src/test_helpers/init_wall.ts ***! - \***************************************/ -/*! exports provided: initWall */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initWall", function() { return initWall; }); -/* harmony import */ var _init_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./init_controller */ "./src/test_helpers/init_controller.ts"); -var initWall = function (wallInstance, data) { - return Object(_init_controller__WEBPACK_IMPORTED_MODULE_0__["initController"])(wallInstance, data); +// tslint:disable-next-line +var Route = function (format) { + return (function (target, methodName, descriptor) { + var className = target.constructor.name; + // remove / from route + if (format != null) { + format = removeLastSlash(format); + } + route_handler_RouteHandler.addPattern(format, className, methodName); + }); }; - -/***/ }), - -/***/ "./src/utils/index.ts": -/*!****************************!*\ - !*** ./src/utils/index.ts ***! - \****************************/ -/*! exports provided: isNullOrEmpty, isNull, isArray */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _is_null_or_empty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is_null_or_empty */ "./src/utils/is_null_or_empty.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNullOrEmpty", function() { return _is_null_or_empty__WEBPACK_IMPORTED_MODULE_0__["isNullOrEmpty"]; }); - -/* harmony import */ var _is_null__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is_null */ "./src/utils/is_null.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return _is_null__WEBPACK_IMPORTED_MODULE_1__["isNull"]; }); - -/* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./is_array */ "./src/utils/is_array.ts"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return _is_array__WEBPACK_IMPORTED_MODULE_2__["isArray"]; }); - +// CONCATENATED MODULE: ./src/decorators/default_worker.ts - - -/***/ }), - -/***/ "./src/utils/is_array.ts": -/*!*******************************!*\ - !*** ./src/utils/is_array.ts ***! - \*******************************/ -/*! exports provided: isArray */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return isArray; }); -var isArray = function (value) { - return Array.isArray(value); +// tslint:disable-next-line +var DefaultWorker = function (allowedMethods) { + return function (target, methodName, descriptor) { + var className = target.constructor.name; + var actionInfo = { + workerName: methodName, + methodsAllowed: allowedMethods == null ? [HTTP_METHOD.Get] : allowedMethods, + guards: [], + pattern: "/", + values: [] + }; + // RouteHandler.addWorker(actionInfo, className); + Worker(allowedMethods == null ? [HTTP_METHOD.Get] : allowedMethods)(target, methodName, descriptor); + Route("/")(target, methodName, descriptor); + }; }; +// CONCATENATED MODULE: ./src/decorators/assign.ts -/***/ }), - -/***/ "./src/utils/is_null.ts": -/*!******************************!*\ - !*** ./src/utils/is_null.ts ***! - \******************************/ -/*! exports provided: isNull */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return isNull; }); -var isNull = function (value) { - return value == null; +// tslint:disable-next-line +var Assign = function (value) { + return function (target, methodName, paramIndex) { + var className = target.name || target.constructor.name; + if (methodName == null) { + methodName = __Constructor; + } + injector_handler_InjectorHandler.addWorkerValue(className, methodName, paramIndex, value); + }; }; +// CONCATENATED MODULE: ./src/decorators/singleton.ts -/***/ }), - -/***/ "./src/utils/is_null_or_empty.ts": -/*!***************************************!*\ - !*** ./src/utils/is_null_or_empty.ts ***! - \***************************************/ -/*! exports provided: isNullOrEmpty */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNullOrEmpty", function() { return isNullOrEmpty; }); -var isNullOrEmpty = function (value) { - return value == null || value.length === 0; +// tslint:disable-next-line +var Singleton = function (value) { + return function (target, methodName, paramIndex) { + var className = target.name || target.constructor.name; + if (methodName == null || methodName === 'constructor') { + methodName = __Constructor; + } + injector_handler_InjectorHandler.addSingleton(className, methodName, paramIndex, value); + }; }; +// CONCATENATED MODULE: ./src/decorators/expect_body.ts -/***/ }), - -/***/ "content-type": -/*!*******************************!*\ - !*** external "content-type" ***! - \*******************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("content-type"); - -/***/ }), - -/***/ "etag": -/*!***********************!*\ - !*** external "etag" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("etag"); - -/***/ }), - -/***/ "fresh": -/*!************************!*\ - !*** external "fresh" ***! - \************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("fresh"); - -/***/ }), - -/***/ "fs": -/*!*********************!*\ - !*** external "fs" ***! - \*********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), - -/***/ "fs-extra": -/*!***************************!*\ - !*** external "fs-extra" ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("fs-extra"); -/***/ }), -/***/ "http": -/*!***********************!*\ - !*** external "http" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { +function ExpectBody(value) { + return function (target, methodName, descriptor) { + var className = getClassName(target); + var type = getDataType(value); + switch (type) { + case DATA_TYPE.Function: + var valueClassName = getClassName(value); + if (valueClassName != null) { + value = new value(); + } + case DATA_TYPE.Object: + value = removeMethodAndNullFromObject(value); + route_handler_RouteHandler.addExpected("body", className, methodName, value); + break; + default: + throw new Error("expected body should be always an object but found " + type); + } + }; +} -module.exports = require("http"); +// CONCATENATED MODULE: ./src/decorators/expect_query.ts -/***/ }), -/***/ "multiparty": -/*!*****************************!*\ - !*** external "multiparty" ***! - \*****************************/ -/*! no static exports found */ -/***/ (function(module, exports) { -module.exports = require("multiparty"); +function ExpectQuery(value) { + return function (target, methodName, descriptor) { + var className = getClassName(target); + var type = getDataType(value); + switch (type) { + case DATA_TYPE.Function: + var valueClassName = getClassName(value); + if (valueClassName != null) { + value = new value(); + } + case DATA_TYPE.Object: + value = removeMethodAndNullFromObject(value); + route_handler_RouteHandler.addExpected("query", className, methodName, value); + break; + default: + throw new Error("expected query should be always an object but found " + type); + } + }; +} -/***/ }), +// CONCATENATED MODULE: ./src/decorators/index.ts -/***/ "mustache": -/*!***************************!*\ - !*** external "mustache" ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports) { -module.exports = require("mustache"); -/***/ }), -/***/ "negotiator": -/*!*****************************!*\ - !*** external "negotiator" ***! - \*****************************/ -/*! no static exports found */ -/***/ (function(module, exports) { -module.exports = require("negotiator"); -/***/ }), -/***/ "path": -/*!***********************!*\ - !*** external "path" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { -module.exports = require("path"); -/***/ }), -/***/ "querystring": -/*!******************************!*\ - !*** external "querystring" ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports) { +// CONCATENATED MODULE: ./src/index.ts +/* concated harmony reexport ErrorHandler */__webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return error_handler_ErrorHandler; }); +/* concated harmony reexport HttpCookie */__webpack_require__.d(__webpack_exports__, "HttpCookie", function() { return HttpCookie; }); +/* concated harmony reexport Fort */__webpack_require__.d(__webpack_exports__, "Fort", function() { return fort_Fort; }); +/* concated harmony reexport Router */__webpack_require__.d(__webpack_exports__, "Router", function() { return router_Router; }); +/* concated harmony reexport CookieManager */__webpack_require__.d(__webpack_exports__, "CookieManager", function() { return CookieManager; }); +/* concated harmony reexport FileManager */__webpack_require__.d(__webpack_exports__, "FileManager", function() { return file_manager_FileManager; }); +/* concated harmony reexport HttpFile */__webpack_require__.d(__webpack_exports__, "HttpFile", function() { return HttpFile; }); +/* concated harmony reexport Logger */__webpack_require__.d(__webpack_exports__, "Logger", function() { return Logger; }); +/* concated harmony reexport RouteInfo */__webpack_require__.d(__webpack_exports__, "RouteInfo", function() { return RouteInfo; }); +/* concated harmony reexport Controller */__webpack_require__.d(__webpack_exports__, "Controller", function() { return controller_Controller; }); +/* concated harmony reexport Shield */__webpack_require__.d(__webpack_exports__, "Shield", function() { return shield_Shield; }); +/* concated harmony reexport SessionProvider */__webpack_require__.d(__webpack_exports__, "SessionProvider", function() { return session_provider_SessionProvider; }); +/* concated harmony reexport Guard */__webpack_require__.d(__webpack_exports__, "Guard", function() { return guard_Guard; }); +/* concated harmony reexport ViewEngine */__webpack_require__.d(__webpack_exports__, "ViewEngine", function() { return ViewEngine; }); +/* concated harmony reexport Wall */__webpack_require__.d(__webpack_exports__, "Wall", function() { return wall_Wall; }); +/* concated harmony reexport XmlParser */__webpack_require__.d(__webpack_exports__, "XmlParser", function() { return XmlParser; }); +/* concated harmony reexport ResultMapper */__webpack_require__.d(__webpack_exports__, "ResultMapper", function() { return ResultMapper; }); +/* concated harmony reexport Worker */__webpack_require__.d(__webpack_exports__, "Worker", function() { return Worker; }); +/* concated harmony reexport Shields */__webpack_require__.d(__webpack_exports__, "Shields", function() { return Shields; }); +/* concated harmony reexport Guards */__webpack_require__.d(__webpack_exports__, "Guards", function() { return Guards; }); +/* concated harmony reexport Route */__webpack_require__.d(__webpack_exports__, "Route", function() { return Route; }); +/* concated harmony reexport DefaultWorker */__webpack_require__.d(__webpack_exports__, "DefaultWorker", function() { return DefaultWorker; }); +/* concated harmony reexport Assign */__webpack_require__.d(__webpack_exports__, "Assign", function() { return Assign; }); +/* concated harmony reexport Singleton */__webpack_require__.d(__webpack_exports__, "Singleton", function() { return Singleton; }); +/* concated harmony reexport ExpectBody */__webpack_require__.d(__webpack_exports__, "ExpectBody", function() { return ExpectBody; }); +/* concated harmony reexport ExpectQuery */__webpack_require__.d(__webpack_exports__, "ExpectQuery", function() { return ExpectQuery; }); +/* concated harmony reexport MIME_TYPE */__webpack_require__.d(__webpack_exports__, "MIME_TYPE", function() { return MIME_TYPE; }); +/* concated harmony reexport HTTP_METHOD */__webpack_require__.d(__webpack_exports__, "HTTP_METHOD", function() { return HTTP_METHOD; }); +/* concated harmony reexport HTTP_STATUS_CODE */__webpack_require__.d(__webpack_exports__, "HTTP_STATUS_CODE", function() { return HTTP_STATUS_CODE; }); +/* concated harmony reexport ETag_Type */__webpack_require__.d(__webpack_exports__, "ETag_Type", function() { return ETag_Type; }); +/* concated harmony reexport ERROR_TYPE */__webpack_require__.d(__webpack_exports__, "ERROR_TYPE", function() { return ERROR_TYPE; }); +/* concated harmony reexport DATA_TYPE */__webpack_require__.d(__webpack_exports__, "DATA_TYPE", function() { return DATA_TYPE; }); +/* concated harmony reexport jsonResult */__webpack_require__.d(__webpack_exports__, "jsonResult", function() { return jsonResult; }); +/* concated harmony reexport textResult */__webpack_require__.d(__webpack_exports__, "textResult", function() { return textResult; }); +/* concated harmony reexport htmlResult */__webpack_require__.d(__webpack_exports__, "htmlResult", function() { return htmlResult; }); +/* concated harmony reexport renderView */__webpack_require__.d(__webpack_exports__, "renderView", function() { return renderView; }); +/* concated harmony reexport downloadResult */__webpack_require__.d(__webpack_exports__, "downloadResult", function() { return downloadResult; }); +/* concated harmony reexport fileResult */__webpack_require__.d(__webpack_exports__, "fileResult", function() { return fileResult; }); +/* concated harmony reexport redirectResult */__webpack_require__.d(__webpack_exports__, "redirectResult", function() { return redirectResult; }); +/* concated harmony reexport viewResult */__webpack_require__.d(__webpack_exports__, "viewResult", function() { return viewResult; }); +/* concated harmony reexport getViewFromFile */__webpack_require__.d(__webpack_exports__, "getViewFromFile", function() { return getViewFromFile; }); +/* concated harmony reexport promise */__webpack_require__.d(__webpack_exports__, "promise", function() { return promise; }); +/* concated harmony reexport LogHelper */__webpack_require__.d(__webpack_exports__, "LogHelper", function() { return log_helper_LogHelper; }); +/* concated harmony reexport getMimeTypeFromExtension */__webpack_require__.d(__webpack_exports__, "getMimeTypeFromExtension", function() { return getMimeTypeFromExtension; }); +/* concated harmony reexport parseAndMatchRoute */__webpack_require__.d(__webpack_exports__, "parseAndMatchRoute", function() { return parseAndMatchRoute; }); +/* concated harmony reexport parseCookie */__webpack_require__.d(__webpack_exports__, "parseCookie", function() { return parseCookie; }); +/* concated harmony reexport JsonHelper */__webpack_require__.d(__webpack_exports__, "JsonHelper", function() { return JsonHelper; }); +/* concated harmony reexport removeLastSlash */__webpack_require__.d(__webpack_exports__, "removeLastSlash", function() { return removeLastSlash; }); +/* concated harmony reexport removeFirstSlash */__webpack_require__.d(__webpack_exports__, "removeFirstSlash", function() { return removeFirstSlash; }); +/* concated harmony reexport reverseLoop */__webpack_require__.d(__webpack_exports__, "reverseLoop", function() { return reverseLoop; }); +/* concated harmony reexport compareExpectedAndRemoveUnnecessary */__webpack_require__.d(__webpack_exports__, "compareExpectedAndRemoveUnnecessary", function() { return compareExpectedAndRemoveUnnecessary; }); +/* concated harmony reexport getDataType */__webpack_require__.d(__webpack_exports__, "getDataType", function() { return getDataType; }); +/* concated harmony reexport getClassName */__webpack_require__.d(__webpack_exports__, "getClassName", function() { return getClassName; }); +/* concated harmony reexport removeMethodAndNullFromObject */__webpack_require__.d(__webpack_exports__, "removeMethodAndNullFromObject", function() { return removeMethodAndNullFromObject; }); +/* concated harmony reexport getResultBasedOnMiMe */__webpack_require__.d(__webpack_exports__, "getResultBasedOnMiMe", function() { return getResultBasedOnMiMe; }); +/* concated harmony reexport setResultMapper */__webpack_require__.d(__webpack_exports__, "setResultMapper", function() { return setResultMapper; }); +/* concated harmony reexport MustacheViewEngine */__webpack_require__.d(__webpack_exports__, "MustacheViewEngine", function() { return mustache_view_engine_MustacheViewEngine; }); +/* concated harmony reexport MemorySessionProvider */__webpack_require__.d(__webpack_exports__, "MemorySessionProvider", function() { return MemorySessionProvider; }); -module.exports = require("querystring"); -/***/ }), -/***/ "uniqid": -/*!*************************!*\ - !*** external "uniqid" ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports) { -module.exports = require("uniqid"); -/***/ }), -/***/ "url": -/*!**********************!*\ - !*** external "url" ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports) { -module.exports = require("url"); /***/ }) - -/******/ }); +/******/ ]); //# sourceMappingURL=fort.js.map \ No newline at end of file diff --git a/dist/fort.js.map b/dist/fort.js.map index fa213e45..7cb5e6a3 100644 --- a/dist/fort.js.map +++ b/dist/fort.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://FortJs/webpack/bootstrap","webpack://FortJs/./src/abstracts/controller.ts","webpack://FortJs/./src/abstracts/guard.ts","webpack://FortJs/./src/abstracts/index.ts","webpack://FortJs/./src/abstracts/result_mapper.ts","webpack://FortJs/./src/abstracts/session_provider.ts","webpack://FortJs/./src/abstracts/shield.ts","webpack://FortJs/./src/abstracts/view_engine.ts","webpack://FortJs/./src/abstracts/wall.ts","webpack://FortJs/./src/abstracts/xml_parser.ts","webpack://FortJs/./src/constant.ts","webpack://FortJs/./src/decorators/assign.ts","webpack://FortJs/./src/decorators/default_worker.ts","webpack://FortJs/./src/decorators/expect_body.ts","webpack://FortJs/./src/decorators/expect_query.ts","webpack://FortJs/./src/decorators/guards.ts","webpack://FortJs/./src/decorators/index.ts","webpack://FortJs/./src/decorators/route.ts","webpack://FortJs/./src/decorators/shields.ts","webpack://FortJs/./src/decorators/singleton.ts","webpack://FortJs/./src/decorators/worker.ts","webpack://FortJs/./src/enums/data_type.ts","webpack://FortJs/./src/enums/error_type.ts","webpack://FortJs/./src/enums/etag_type.ts","webpack://FortJs/./src/enums/http_method.ts","webpack://FortJs/./src/enums/http_status_code.ts","webpack://FortJs/./src/enums/index.ts","webpack://FortJs/./src/enums/mime_type.ts","webpack://FortJs/./src/extra/index.ts","webpack://FortJs/./src/extra/memory_session_provider.ts","webpack://FortJs/./src/extra/mustache_view_engine.ts","webpack://FortJs/./src/fort_global.ts","webpack://FortJs/./src/generics/generic_controller.ts","webpack://FortJs/./src/generics/generic_guard.ts","webpack://FortJs/./src/generics/generic_session_provider.ts","webpack://FortJs/./src/generics/generic_shield.ts","webpack://FortJs/./src/generics/generic_wall.ts","webpack://FortJs/./src/generics/generic_xml_parser.ts","webpack://FortJs/./src/generics/index.ts","webpack://FortJs/./src/handlers/controller_result_handler.ts","webpack://FortJs/./src/handlers/file_handler.ts","webpack://FortJs/./src/handlers/index.ts","webpack://FortJs/./src/handlers/injector_handler.ts","webpack://FortJs/./src/handlers/post_handler.ts","webpack://FortJs/./src/handlers/request_handler.ts","webpack://FortJs/./src/handlers/request_handler_helper.ts","webpack://FortJs/./src/handlers/route_handler.ts","webpack://FortJs/./src/helpers/compar_expected_and_remove_unnecessary.ts","webpack://FortJs/./src/helpers/download_result.ts","webpack://FortJs/./src/helpers/file_result.ts","webpack://FortJs/./src/helpers/get_class_name.ts","webpack://FortJs/./src/helpers/get_data_type.ts","webpack://FortJs/./src/helpers/get_mime_type_from_extension.ts","webpack://FortJs/./src/helpers/get_result_based_on_mime.ts","webpack://FortJs/./src/helpers/get_view_from_file.ts","webpack://FortJs/./src/helpers/html_result.ts","webpack://FortJs/./src/helpers/index.ts","webpack://FortJs/./src/helpers/json_helper.ts","webpack://FortJs/./src/helpers/json_result.ts","webpack://FortJs/./src/helpers/log_helper.ts","webpack://FortJs/./src/helpers/parse_cookie.ts","webpack://FortJs/./src/helpers/parse_match_route.ts","webpack://FortJs/./src/helpers/promise.ts","webpack://FortJs/./src/helpers/redirect_result.ts","webpack://FortJs/./src/helpers/remove_first_slash.ts","webpack://FortJs/./src/helpers/remove_last_slash.ts","webpack://FortJs/./src/helpers/remove_method_and_null_from_object.ts","webpack://FortJs/./src/helpers/render_view.ts","webpack://FortJs/./src/helpers/reverse_loop.ts","webpack://FortJs/./src/helpers/text_result.ts","webpack://FortJs/./src/helpers/view_result.ts","webpack://FortJs/./src/index.ts","webpack://FortJs/./src/models/cookie_manager.ts","webpack://FortJs/./src/models/error_handler.ts","webpack://FortJs/./src/models/file_manager.ts","webpack://FortJs/./src/models/fort.ts","webpack://FortJs/./src/models/http_cookie.ts","webpack://FortJs/./src/models/http_file.ts","webpack://FortJs/./src/models/index.ts","webpack://FortJs/./src/models/logger.ts","webpack://FortJs/./src/models/route_info.ts","webpack://FortJs/./src/models/router.ts","webpack://FortJs/./src/test_helpers/http_request_stub.ts","webpack://FortJs/./src/test_helpers/http_response_stub.ts","webpack://FortJs/./src/test_helpers/index.ts","webpack://FortJs/./src/test_helpers/init_controller.ts","webpack://FortJs/./src/test_helpers/init_guard.ts","webpack://FortJs/./src/test_helpers/init_shield.ts","webpack://FortJs/./src/test_helpers/init_wall.ts","webpack://FortJs/./src/utils/index.ts","webpack://FortJs/./src/utils/is_array.ts","webpack://FortJs/./src/utils/is_null.ts","webpack://FortJs/./src/utils/is_null_or_empty.ts","webpack://FortJs/external \"content-type\"","webpack://FortJs/external \"etag\"","webpack://FortJs/external \"fresh\"","webpack://FortJs/external \"fs\"","webpack://FortJs/external \"fs-extra\"","webpack://FortJs/external \"http\"","webpack://FortJs/external \"multiparty\"","webpack://FortJs/external \"mustache\"","webpack://FortJs/external \"negotiator\"","webpack://FortJs/external \"path\"","webpack://FortJs/external \"querystring\"","webpack://FortJs/external \"uniqid\"","webpack://FortJs/external \"url\""],"names":[],"mappings":";;;;;;;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAg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,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;;;;;;;;;;;;ACFF,yC;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,kC;;;;;;;;;;;ACAA,+B;;;;;;;;;;;ACAA,qC;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,uC;;;;;;;;;;;ACAA,qC;;;;;;;;;;;ACAA,uC;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,wC;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,gC","file":"fort.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import { HttpRequest, HttpResponse, ControllerTestData } from \"../types\";\nimport { CookieManager, FileManager, Logger } from \"../models\";\nimport { SessionProvider } from \".\";\nimport { initController } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\n\nexport abstract class Controller {\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: any };\n body?: { [key: string]: any };\n session: SessionProvider;\n cookie: CookieManager;\n param?: { [key: string]: string };\n data: { [key: string]: any };\n\n file?: FileManager;\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n constructor(...args) {\n\n }\n\n initialize(data?: ControllerTestData) {\n initController(this, data);\n }\n}","import { HttpRequest, HttpResponse, HttpResult } from \"../types\";\nimport { CookieManager, FileManager, Logger } from \"../models\";\nimport { Controller } from \"./controller\";\nimport { SessionProvider } from \"./session_provider\";\nimport { GuardTestData, initGuard } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\nexport abstract class Guard implements Controller {\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: any };\n body: { [key: string]: any };\n session: SessionProvider;\n cookie: CookieManager;\n param?: { [key: string]: string };\n data: { [key: string]: any };\n file: FileManager;\n abstract check(...args): Promise;\n\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n constructor(...args) {\n\n }\n\n initialize(data?: GuardTestData) {\n return initGuard(this, data);\n }\n}","export * from './controller';\nexport * from './shield';\nexport * from './session_provider';\nexport * from './guard';\nexport * from './view_engine';\nexport * from './wall';\nexport * from \"./xml_parser\";\nexport * from './result_mapper';","import { MIME_TYPE } from \"../enums\";\n\nexport abstract class ResultMapper {\n abstract map(type: MIME_TYPE, result, setMimeType?: (type) => void): any;\n}","import { CookieManager } from \"../models\";\nimport * as getUniqId from \"uniqid\";\nimport { FortGlobal } from \"../fort_global\";\nimport { SessionValue } from \"../types\";\n\nexport abstract class SessionProvider {\n\n sessionId: string;\n protected cookie: CookieManager;\n\n abstract get(key: string): Promise;\n abstract isExist(key: string): Promise;\n abstract getAll(): Promise<{ [key: string]: any }>;\n abstract set(key: string, val: any): Promise;\n abstract setMany(values: { [key: string]: any }): Promise;\n abstract remove(key: string): Promise;\n\n abstract clear(): Promise;\n\n protected createSession(sessionId?) {\n const now = new Date();\n this.sessionId = sessionId != null ? sessionId : getUniqId();\n this.cookie.addCookie({\n name: FortGlobal.appSessionIdentifier,\n value: this.sessionId,\n httpOnly: true,\n path: \"/\",\n expires: new Date(now.setMinutes(now.getMinutes() + FortGlobal.sessionTimeOut)),\n maxAge: FortGlobal.sessionTimeOut * 60\n });\n }\n\n protected destroySession() {\n const cookie = this.cookie.getCookie(FortGlobal.appSessionIdentifier);\n cookie.httpOnly = true;\n cookie.path = \"/\";\n this.cookie.removeCookie(cookie);\n }\n}\n\n","import { HttpRequest, HttpResponse, HttpResult } from \"../types\";\nimport { CookieManager, Logger } from \"../models\";\nimport { SessionProvider, Controller } from \".\";\nimport { ShieldTestData, initShield } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\nexport abstract class Shield implements Controller {\n workerName: string;\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: any };\n\n session: SessionProvider;\n cookie: CookieManager;\n\n data: { [key: string]: any };\n\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n abstract protect(...args): Promise;\n\n constructor(...args) {\n\n }\n\n initialize(data?: ShieldTestData) {\n return initShield(this, data);\n }\n}\n\n","import { ViewEngineData } from \"../types\";\n\nexport abstract class ViewEngine {\n abstract render(value: ViewEngineData): Promise;\n}","import { HttpRequest, HttpResponse, HttpResult, HttpFormatResult } from \"../types\";\nimport { CookieManager, Logger } from \"../models\";\nimport { Controller } from \"./controller\";\nimport { SessionProvider } from \"./session_provider\";\nimport { WallTestData, initWall } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\nexport abstract class Wall implements Controller {\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: string };\n session: SessionProvider;\n cookie: CookieManager;\n\n data: { [key: string]: any };\n\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n abstract onIncoming(...args): Promise;\n\n async onOutgoing(finalResult: HttpResult | HttpFormatResult, ...args) {\n return null;\n }\n\n constructor(...args) {\n\n }\n\n initialize(data?: WallTestData) {\n return initWall(this, data);\n }\n}","export abstract class XmlParser {\n abstract async parse(xml: string): Promise;\n}","import { FortGlobal } from \"./fort_global\";\n/* tslint:disable */\nexport const __ContentType = \"Content-Type\";\nexport const __AppName = \"fort\";\nexport const __Cookie = \"Cookie\";\nexport const __SetCookie = 'Set-Cookie';\nexport const __CurrentPath = process.cwd();\nexport const __ContentLength = \"Content-Length\";\nexport const __Constructor = \"const_constructor\";","import { InjectorHandler } from \"../handlers\";\nimport { __Constructor } from \"../constant\";\n\n// tslint:disable-next-line\nexport const Assign = (value): ParameterDecorator => {\n return (target: any, methodName: string, paramIndex: number) => {\n const className: string = target.name || target.constructor.name;\n if (methodName == null) {\n methodName = __Constructor;\n }\n InjectorHandler.addWorkerValue(className, methodName, paramIndex, value);\n };\n};","import { RouteHandler } from \"../handlers\";\nimport { HTTP_METHOD } from \"../enums\";\nimport { WorkerInfo } from \"../types\";\nimport { Route } from \"./route\";\nimport { Worker } from \"./worker\";\n\n// tslint:disable-next-line\nexport const DefaultWorker = (allowedMethods?: HTTP_METHOD[]): MethodDecorator => {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n const actionInfo: WorkerInfo = {\n workerName: methodName,\n methodsAllowed: allowedMethods == null ? [HTTP_METHOD.Get] : allowedMethods,\n guards: [],\n pattern: \"/\",\n values: []\n };\n // RouteHandler.addWorker(actionInfo, className);\n Worker(allowedMethods == null ? [HTTP_METHOD.Get] : allowedMethods)(target, methodName, descriptor);\n Route(\"/\")(target, methodName, descriptor);\n };\n};\n","import { RouteHandler } from \"../handlers\";\nimport { getDataType, getClassName, removeMethodAndNullFromObject } from \"../helpers\";\nimport { DATA_TYPE } from \"../enums/data_type\";\n\nexport function ExpectBody(value: any): MethodDecorator {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className: string = getClassName(target);\n const type = getDataType(value);\n switch (type) {\n case DATA_TYPE.Function:\n const valueClassName = getClassName(value);\n if (valueClassName != null) {\n value = new value();\n }\n case DATA_TYPE.Object:\n value = removeMethodAndNullFromObject(value);\n RouteHandler.addExpected(\"body\", className, methodName, value); break;\n default:\n throw new Error(`expected body should be always an object but found ${type}`);\n }\n\n };\n}","import { RouteHandler } from \"../handlers\";\nimport { DATA_TYPE } from \"../enums/data_type\";\nimport { getClassName, removeMethodAndNullFromObject, getDataType } from \"../helpers\";\n\nexport function ExpectQuery(value: any): MethodDecorator {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className: string = getClassName(target);\n const type = getDataType(value);\n switch (type) {\n case DATA_TYPE.Function:\n const valueClassName = getClassName(value);\n if (valueClassName != null) {\n value = new value();\n }\n case DATA_TYPE.Object:\n value = removeMethodAndNullFromObject(value);\n RouteHandler.addExpected(\"query\", className, methodName, value); break;\n default:\n throw new Error(`expected query should be always an object but found ${type}`);\n }\n };\n}","import { RouteHandler } from \"../handlers\";\nimport { GenericGuard } from \"../generics\";\nimport { Guard } from \"../abstracts/guard\";\n\n// tslint:disable-next-line\nexport const Guards = (value: Array): MethodDecorator => {\n return ((target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n RouteHandler.addGuards(value as Array, className, methodName);\n });\n};","export * from './worker';\nexport * from './shields';\nexport * from './guards';\nexport * from './route';\nexport * from './default_worker';\nexport * from './assign';\nexport * from './singleton';\nexport * from './expect_body';\nexport * from './expect_query';","import { RouteHandler } from \"../handlers\";\nimport { removeLastSlash } from \"../helpers\";\n\n// tslint:disable-next-line\nexport const Route = (format: string): MethodDecorator => {\n return ((target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n // remove / from route\n if (format != null) {\n format = removeLastSlash(format);\n }\n RouteHandler.addPattern(format, className, methodName);\n });\n};","import { Shield } from \"../abstracts\";\nimport { RouteHandler } from \"../handlers\";\nimport { GenericShield } from \"../generics\";\n \n// tslint:disable-next-line\nexport const Shields = (shieldsValue: Array): ClassDecorator => {\n return (target: any) => {\n const className = target.name;\n RouteHandler.addShields(shieldsValue as Array, className);\n };\n};","import { InjectorHandler } from \"../handlers\";\nimport { __Constructor } from \"../constant\";\n\n// tslint:disable-next-line\nexport const Singleton = (value): ParameterDecorator => {\n return (target: any, methodName: string, paramIndex: number) => {\n const className: string = target.name || target.constructor.name;\n if (methodName == null || methodName === 'constructor') {\n methodName = __Constructor;\n }\n InjectorHandler.addSingleton(className, methodName, paramIndex, value);\n };\n};","import { HTTP_METHOD } from \"../enums\";\nimport { RouteHandler } from \"../handlers\";\nimport { WorkerInfo } from \"../types\";\n\n// tslint:disable-next-line\nexport const Worker = (allowedMethods?: HTTP_METHOD[]): MethodDecorator => {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n const actionInfo: WorkerInfo = {\n workerName: methodName,\n methodsAllowed: allowedMethods == null ? [\n HTTP_METHOD.Delete, HTTP_METHOD.Get, HTTP_METHOD.Post, HTTP_METHOD.Patch, HTTP_METHOD.Put\n ] : allowedMethods,\n guards: [],\n pattern: `/${methodName.toLowerCase()}`,\n values: []\n };\n RouteHandler.addWorker(actionInfo, className);\n };\n};\n","export enum DATA_TYPE {\n String = \"string\",\n Number = \"number\",\n Array = \"array\",\n Object = \"object\",\n Function = \"function\"\n}","export enum ERROR_TYPE {\n InvalidControllerName = \"invalid_controller_name\",\n InvalidContentType = \"invalid_content_type\",\n PortInUse = \"port_in_use\",\n UndefinedViewEngine = \"undefined_view_engine\"\n}","export enum ETag_Type {\n Strong = \"strong\",\n Weak = \"weak\"\n}","export enum HTTP_METHOD {\n Get = \"GET\",\n Post = \"POST\",\n Put = \"PUT\",\n Patch = \"PATCH\",\n Delete = \"DELETE\",\n Options = \"OPTIONS\",\n Head = \"HEAD\"\n}","export enum HTTP_STATUS_CODE {\n BadRequest = 400,\n Unauthorized = 401,\n Forbidden = 403,\n NotFound = 404,\n Ok = 200,\n Created = 201,\n NoContent = 204,\n Redirect = 302,\n NotModified = 304,\n MethodNotAllowed = 405,\n NotAcceptable = 406,\n InternalServerError = 500,\n}","export * from './mime_type';\nexport * from './http_method';\nexport * from './http_status_code';\nexport * from \"./etag_type\";\nexport * from \"./error_type\";\nexport * from \"./data_type\";","export enum MIME_TYPE {\n Text = \"text/plain\",\n Json = \"application/json\",\n Html = \"text/html\",\n FormUrlEncoded = \"application/x-www-form-urlencoded\",\n Css = \"text/css\",\n Csv = \"text/csv\",\n Js = \"application/javascript\",\n Bmp = \"image/bmp\",\n Jpeg = \"image/jpeg\",\n Gif = \"image/gif\",\n Ico = \"image/x-icon\",\n Png = \"image/png\",\n Pdf = \"application/pdf\",\n Svg = \"image/svg+xml\",\n Rtf = \"application/rtf\",\n Xml = \"application/xml\",\n Xls = \"application/vnd.ms-excel\",\n Xlsx = \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n Ttf = \"font/ttf\",\n Woff = \"font/woff\",\n Woff2 = \"font/woff2\",\n Eot = \"application/vnd.ms-fontobject\",\n Otf = \"font/otf\",\n Swf = \"application/x-shockwave-flash\",\n Avi = \"video/avi\",\n FormMultiPart = \"multipart/form-data\"\n\n}","export * from './mustache_view_engine';\nexport * from \"./memory_session_provider\";","import { SessionProvider } from \"../abstracts/session_provider\";\n\nconst sessionValues: { [identifier: string]: any } = {};\n\nexport class MemorySessionProvider extends SessionProvider {\n\n async get(key: string) {\n const savedSession = sessionValues[this.sessionId];\n return savedSession != null ? savedSession[key] : null;\n }\n\n async isExist(key: string) {\n const savedValue = sessionValues[this.sessionId];\n return savedValue == null ? false : savedValue[key] != null;\n }\n\n async getAll() {\n const savedValue = sessionValues[this.sessionId];\n return savedValue == null ? {} : savedValue;\n }\n\n async set(key: string, val: any) {\n const savedValue = sessionValues[this.sessionId];\n if (savedValue == null) {\n this.createSession();\n sessionValues[this.sessionId] = {\n [key]: val\n };\n }\n else {\n savedValue[key] = val;\n }\n }\n\n setMany(values: { [key: string]: any }) {\n return Promise.all(\n Object.keys(values).map((key) => {\n return this.set(key, values[key]);\n })\n );\n }\n\n async remove(key: string) {\n const savedValue = sessionValues[this.sessionId];\n if (savedValue != null) {\n savedValue[key] = null;\n }\n }\n\n async clear() {\n // remove session values\n delete sessionValues[this.sessionId];\n // expire cookie in browser\n this.destroySession();\n }\n}","import * as Mustache from \"mustache\";\nimport { ViewEngineData } from \"../types\";\nimport { getViewFromFile } from \"../helpers\";\nimport { ViewEngine } from \"../abstracts\";\n\nexport class MustacheViewEngine implements ViewEngine {\n\n async render(value: ViewEngineData) {\n const viewData = await getViewFromFile({\n fileLocation: value.view\n });\n return Mustache.render(viewData, value.model);\n }\n}","import { ErrorHandler, Logger } from \"./models\";\nimport { ViewEngine, XmlParser } from \"./abstracts\";\nimport { EtagOption, FolderMap } from \"./types\";\nimport { GenericSessionProvider, GenericWall } from \"./generics\";\n\nconst isDevelopment = process.env.NODE_ENV === 'development';\nconst isProduction = process.env.NODE_ENV === \"production\";\nexport class FortGlobal {\n static port: number;\n static viewPath: string;\n static shouldParseCookie: boolean;\n static shouldParsePost: boolean;\n static sessionProvider: typeof GenericSessionProvider;\n static sessionTimeOut?: number;\n static viewEngine: ViewEngine;\n static walls: Array = [];\n static errorHandler: typeof ErrorHandler;\n static connectonKeepAliveTimeout?: number;\n\n static appName?: string;\n\n static eTag?: EtagOption;\n\n static folders?: FolderMap[];\n static appSessionIdentifier: string;\n static xmlParser: typeof XmlParser;\n\n static logger: Logger;\n\n static get isDevelopment() {\n return isDevelopment;\n }\n\n static get isProduction() {\n return isProduction;\n }\n}","import { Controller } from \"../abstracts\";\n\nexport class GenericController extends Controller {\n constructor(...args) {\n super();\n }\n}","import { Guard } from \"../abstracts\";\nimport { HttpResult } from \"../types\";\n\nexport class GenericGuard extends Guard {\n\n constructor(...args) {\n super();\n }\n\n check(...args): Promise {\n return null;\n }\n}","import { SessionProvider } from \"../abstracts\";\nimport { SessionValue } from \"../types\";\nimport { CookieManager } from \"../models\";\n\n\nexport class GenericSessionProvider extends SessionProvider {\n sessionId: string;\n\n cookie: CookieManager;\n get() {\n return null;\n }\n\n getAll() {\n return null;\n }\n\n set(key, value) {\n return null;\n }\n\n isExist(key) {\n return null;\n }\n\n remove(key) {\n return null;\n }\n\n setMany(values: SessionValue[]): Promise {\n return null;\n }\n\n async clear() {\n\n }\n}","import { Shield } from \"../abstracts\";\nimport { HttpResult } from \"../types\";\n\nexport class GenericShield extends Shield {\n constructor(...args) {\n super();\n }\n \n protect(...args): Promise {\n return null;\n }\n}","import { Wall } from \"../abstracts\";\nimport { HttpResult } from \"../types\";\n\nexport class GenericWall extends Wall {\n constructor(...args) {\n super();\n }\n onIncoming(...args): Promise {\n return null;\n }\n}","import { XmlParser } from \"../abstracts\";\nimport { IException } from \"../interfaces\";\n\nexport class GenericXmlParser implements XmlParser {\n async parse(xml: string): Promise {\n // tslint:disable-next-line\n throw {\n message: \"no xml parser configured\"\n } as IException;\n }\n}","export * from './generic_guard';\nexport * from './generic_shield';\nexport * from './generic_session_provider';\nexport * from \"./generic_wall\";\nexport * from \"./generic_controller\";\nexport * from './generic_xml_parser';","\nimport { HttpResult, HttpFormatResult } from \"../types\";\nimport { __SetCookie, __ContentType } from \"../constant\";\nimport { MIME_TYPE, HTTP_STATUS_CODE } from \"../enums\";\nimport { FileHandler } from \"./file_handler\";\nimport * as path from 'path';\nimport { textResult, getResultBasedOnMiMe } from \"../helpers\";\n\nexport class ControllerResultHandler extends FileHandler {\n\n\n private endResponse_(negotiateMimeType: MIME_TYPE) {\n let data;\n try {\n data = getResultBasedOnMiMe(negotiateMimeType,\n (this.controllerResult_ as HttpResult).responseData\n , (type: MIME_TYPE) => {\n negotiateMimeType = type;\n }\n );\n }\n catch (ex) {\n this.onErrorOccured(ex);\n return;\n }\n\n this.response.writeHead(this.controllerResult_.statusCode || HTTP_STATUS_CODE.Ok,\n { [__ContentType]: negotiateMimeType });\n this.response.end(data);\n }\n\n private handleRedirectResult_() {\n // this.response.setHeader('Location', this.controllerResult_.responseData);\n this.response.writeHead(this.controllerResult_.statusCode || HTTP_STATUS_CODE.Ok,\n { 'Location': (this.controllerResult_ as HttpResult).responseData });\n this.response.end();\n }\n\n private handleFormatResult_() {\n const negotiateMimeType = this.getContentTypeFromNegotiationHavingMultipleTypes(Object.keys((this.controllerResult_ as HttpFormatResult).responseFormat) as MIME_TYPE[]);\n const key = Object.keys((this.controllerResult_ as HttpFormatResult).responseFormat).find(qry => qry === negotiateMimeType);\n if (key != null) {\n (this.controllerResult_ as HttpResult).responseData = (this.controllerResult_ as HttpFormatResult).responseFormat[key]();\n this.endResponse_(negotiateMimeType);\n }\n else {\n this.onNotAcceptableRequest();\n }\n }\n\n private handleFileResult_() {\n const result = this.controllerResult_ as HttpResult;\n const parsedPath = path.parse(result.file.filePath);\n if (result.file.shouldDownload === true) {\n const fileName = result.file.alias == null ? parsedPath.name : result.file.alias;\n this.response.setHeader(\n \"content-disposition\",\n `attachment;filename=${fileName}${parsedPath.ext}`\n );\n }\n this.handleFileRequestFromAbsolutePath(result.file.filePath, parsedPath.ext);\n }\n\n onTerminationFromWall(result: HttpResult | HttpFormatResult) {\n this.controllerResult_ = result;\n this.handleFinalResult_();\n }\n\n private handleFinalResult_() {\n const result = this.controllerResult_;\n ((this.cookieManager as any).responseCookie_ as string[]).forEach(value => {\n this.response.setHeader(__SetCookie, value);\n });\n\n if ((result as HttpResult).shouldRedirect === true) {\n this.handleRedirectResult_();\n }\n else {\n if ((result as HttpFormatResult).responseFormat == null) {\n if ((result as HttpResult).file == null) {\n const contentType = (result as HttpResult).contentType || MIME_TYPE.Text;\n const negotiateMimeType = this.getContentTypeFromNegotiation(contentType) as MIME_TYPE;\n if (negotiateMimeType != null) {\n this.endResponse_(negotiateMimeType);\n }\n else {\n this.onNotAcceptableRequest();\n }\n }\n else {\n this.handleFileResult_();\n }\n }\n else {\n this.handleFormatResult_();\n }\n }\n }\n\n\n async onResultFromController(result: HttpResult | HttpFormatResult) {\n this.controllerResult_ = result || textResult(\"\");\n try {\n await this.runWallOutgoing();\n } catch (ex) {\n this.onErrorOccured(ex);\n return;\n }\n this.handleFinalResult_();\n }\n}","import { HTTP_STATUS_CODE, MIME_TYPE, ETag_Type } from \"../enums\";\nimport { FortGlobal } from \"../fort_global\";\nimport * as path from \"path\";\nimport { __ContentType } from \"../constant\";\nimport { RequestHandlerHelper } from \"./request_handler_helper\";\nimport * as Fs from \"fs\";\nimport { getMimeTypeFromExtension, promise } from \"../helpers\";\nimport * as etag from \"etag\";\nimport * as fresh from \"fresh\";\nimport { isNullOrEmpty } from \"../utils\";\n\ntype FileInfo = {\n folder: string,\n file: string;\n};\nexport class FileHandler extends RequestHandlerHelper {\n\n private getFileInfoFromUrl_(urlPath: string) {\n const splittedValue = urlPath.split(\"/\");\n const fileInfo = {\n file: \"\"\n } as FileInfo;\n if (splittedValue.length > 2 || !isNullOrEmpty(path.parse(urlPath).ext)) {\n fileInfo.folder = splittedValue[1];\n fileInfo.file = splittedValue.splice(2).join(\"/\");\n return fileInfo;\n }\n fileInfo.folder = splittedValue[1];\n return fileInfo;\n\n }\n\n private getFileStats_(filePath) {\n return promise((res, rej) => {\n Fs.lstat(filePath, (err, status) => {\n if (err) {\n if (err.code === 'ENOENT') {\n res(null);\n }\n else {\n rej(err);\n }\n }\n else {\n res(status);\n }\n });\n });\n }\n\n protected handleFileRequestFromAbsolutePath(absolutePath: string, fileType: string) {\n this.getFileStats_(absolutePath).then(fileInfo => {\n if (fileInfo != null) {\n if (fileInfo.isDirectory() === true) {\n this.handleFileRequestForFolderPath_(absolutePath);\n }\n else {\n this.sendFile_(absolutePath, fileType, fileInfo);\n }\n }\n else {\n this.onNotFound();\n }\n }).catch(ex => {\n this.onErrorOccured(ex);\n });\n }\n\n private checkForFolderAllowAndReturnPath_(urlPath: string) {\n const fileInfo = this.getFileInfoFromUrl_(urlPath);\n const getAbsPath = function () {\n const folder = FortGlobal.folders.find(qry => qry.alias === fileInfo.folder);\n if (folder != null) {\n return path.join(folder.path, fileInfo.file);\n }\n return null;\n };\n let absPath = getAbsPath();\n if (absPath == null) {\n fileInfo.folder = \"/\";\n fileInfo.file = urlPath;\n absPath = getAbsPath();\n }\n return absPath;\n }\n\n protected handleFileRequest(urlPath: string) {\n const extension = path.parse(urlPath).ext;\n const absFilePath = this.checkForFolderAllowAndReturnPath_(urlPath);\n if (absFilePath != null) {\n this.handleFileRequestFromAbsolutePath(absFilePath, extension);\n }\n else {\n this.onNotFound();\n }\n }\n\n /**\n * process folders handling asuuming path is folder.\n * Please check whether the file is folder before calling this function\n *\n * @private\n * @param {string} filePath\n * @param {Fs.Stats} fileInfo\n * @returns\n * @memberof FileHandler\n */\n private handleFileRequestForFolderPath_(absolutePath: string) {\n absolutePath = path.join(absolutePath, \"index.html\");\n this.getFileStats_(absolutePath).then(fileInfo => {\n if (fileInfo != null) {\n const fileType = MIME_TYPE.Html;\n this.sendFile_(absolutePath, fileType, fileInfo);\n }\n else {\n this.onNotFound();\n }\n }).catch(this.onErrorOccured.bind(this));\n }\n\n private isClientHasFreshFile_(lastModified: string, etagValue: string) {\n return fresh(this.request.headers, {\n 'etag': etagValue,\n 'last-modified': lastModified\n });\n }\n\n private sendFileAsResponse_(filePath: string, mimeType: MIME_TYPE) {\n this.response.writeHead(HTTP_STATUS_CODE.Ok, {\n [__ContentType]: mimeType\n });\n const readStream = Fs.createReadStream(filePath);\n // Handle non-existent file\n readStream.on('error', this.onErrorOccured.bind(this));\n readStream.on('open', () => {\n readStream.pipe(this.response);\n });\n }\n\n private getMimeTypeFromFileType_(fileType: string) {\n return fileType[0] === '.' ? getMimeTypeFromExtension(fileType) :\n fileType as MIME_TYPE;\n }\n\n sendFile_: (filePath: string, fileType: string, fileInfo: Fs.Stats) => any;\n}\n\nif (FortGlobal.isProduction) {\n FileHandler.prototype.sendFile_ = function (filePath: string, fileType: string, fileInfo: Fs.Stats) {\n this.runWallOutgoing().then(() => {\n const lastModified = fileInfo.mtime.toUTCString();\n const eTagValue = etag(fileInfo, {\n weak: FortGlobal.eTag.type === ETag_Type.Weak\n });\n if (this.isClientHasFreshFile_(lastModified, eTagValue)) { // client has fresh file\n this.response.statusCode = HTTP_STATUS_CODE.NotModified;\n this.response.end();\n }\n else {\n this.response.setHeader('Etag', eTagValue);\n this.response.setHeader('Last-Modified', lastModified);\n this.sendFileAsResponse_(filePath, this.getMimeTypeFromFileType_(fileType));\n }\n }).catch(this.onErrorOccured.bind(this));\n };\n}\nelse {\n FileHandler.prototype.sendFile_ = function (filePath: string, fileType: string, fileInfo: Fs.Stats) {\n this.runWallOutgoing().then(() => {\n this.sendFileAsResponse_(filePath, this.getMimeTypeFromFileType_(fileType));\n }).catch(this.onErrorOccured.bind(this));\n };\n}","export * from \"./route_handler\";\nexport * from \"./request_handler\";\nexport * from \"./file_handler\";\nexport * from \"./request_handler_helper\";\nexport * from \"./controller_result_handler\";\nexport * from \"./post_handler\";\nexport * from './injector_handler';","import { __Constructor } from \"../constant\";\n\ntype InjectorStoreInfo = {\n className: string;\n methods: {\n [methodName: string]: any[]\n }\n};\n// this stores information of injector values that are available per class & worker\nconst injectorStoreInfos: InjectorStoreInfo[] = [];\n// this stores injector values\nconst injectorValues: any[] = [];\n// this stores the singletons name & their respective index in injector values\nconst singletons: {\n [className: string]: number\n} = {};\nexport class InjectorHandler {\n\n static addWorkerValue(className: string, methodName: string, paramIndex, paramValue, shouldFindIndex = true): number {\n\n if (shouldFindIndex === true) {\n const paramValueIndex = injectorValues.indexOf(paramValue);\n if (paramValueIndex < 0) {\n paramValue = injectorValues.push(paramValue) - 1;\n }\n else {\n paramValue = paramValueIndex;\n }\n }\n \n\n const savedValue = injectorStoreInfos.find(x => x.className === className);\n const value: InjectorStoreInfo = {\n className: className,\n methods: {\n [methodName]: []\n }\n };\n if (savedValue == null) {\n value.methods[methodName][paramIndex] = paramValue;\n injectorStoreInfos.push(value);\n }\n else {\n // const savedMethod = savedValue.methods[methodName];\n if (savedValue.methods[methodName] == null) {\n savedValue.methods[methodName] = [];\n }\n savedValue.methods[methodName][paramIndex] = paramValue;\n }\n\n return paramValue;\n }\n\n static getConstructorValues(className: string) {\n return this.getMethodValues(className, __Constructor);\n }\n\n static getMethodValues(className: string, methodName: string) {\n const savedValue = injectorStoreInfos.find(qry => qry.className === className);\n if (savedValue != null) {\n const methodArgs = savedValue.methods[methodName];\n if (methodArgs != null) {\n return methodArgs.map(injectorValueIndex => {\n return injectorValues[injectorValueIndex];\n });\n }\n }\n return [];\n }\n\n static addSingleton(className: string, methodName: string, paramIndex, paramValue) {\n const singletonClassName = paramValue.name;\n if (singletonClassName) {\n if (singletons[singletonClassName] == null) {\n singletons[singletonClassName] = InjectorHandler.addWorkerValue(className, methodName, paramIndex, new paramValue());\n }\n else {\n InjectorHandler.addWorkerValue(className, methodName, paramIndex, singletons[singletonClassName], false);\n }\n }\n }\n}","import { ControllerResultHandler } from \"./controller_result_handler\";\nimport { promise, JsonHelper } from \"../helpers\";\nimport { __ContentType } from \"../constant\";\nimport { MIME_TYPE } from \"../enums\";\nimport * as ContentType from \"content-type\";\nimport * as QueryString from 'querystring';\nimport * as Multiparty from \"multiparty\";\nimport { MultiPartParseResult } from \"../types\";\nimport { FileManager } from \"../models\";\nimport { FortGlobal } from \"../fort_global\";\n\n\nexport class PostHandler extends ControllerResultHandler {\n protected body: any;\n protected file: FileManager;\n\n private getPostRawData_(): Promise {\n const body = [];\n return promise((res, rej) => {\n this.request.on('data', (chunk) => {\n body.push(chunk);\n }).on('end', () => {\n const bodyBuffer = Buffer.concat(body);\n res(bodyBuffer.toString());\n }).on(\"error\", function (err) {\n rej(err);\n });\n });\n }\n\n private parseMultiPartData_(): Promise {\n return promise((res, rej) => {\n new Multiparty.Form().parse(this.request, (err, fields, files) => {\n if (err) {\n rej(err);\n }\n else {\n const result: MultiPartParseResult = {\n field: {},\n file: {}\n };\n for (const field in fields) {\n result.field[field] = fields[field].length === 1 ? fields[field][0] : fields[field];\n }\n for (const file in files) {\n result.file[file] = files[file].length === 1 ? files[file][0] : files[file];\n }\n res(result);\n }\n });\n });\n }\n\n protected async parsePostData() {\n\n let postData;\n\n let contentType = this.request.headers[__ContentType] || this.request.headers[\"content-type\"];\n if (contentType != null) {\n contentType = ContentType.parse(contentType as string).type;\n }\n if (contentType === MIME_TYPE.FormMultiPart) {\n const result = await this.parseMultiPartData_();\n postData = result.field;\n this.file = new FileManager(result.file);\n }\n else {\n this.file = new FileManager({});\n const bodyDataAsString = await this.getPostRawData_();\n switch (contentType) {\n case MIME_TYPE.Json:\n postData = JsonHelper.parse(bodyDataAsString);\n break;\n case MIME_TYPE.Text:\n case MIME_TYPE.Html:\n postData = bodyDataAsString; break;\n case MIME_TYPE.FormUrlEncoded:\n postData = QueryString.parse(bodyDataAsString); break;\n case MIME_TYPE.Xml:\n postData = new (FortGlobal as any).xmlParser().parse(bodyDataAsString);\n break;\n default:\n postData = {};\n }\n }\n\n return postData;\n\n }\n}","import * as http from \"http\";\nimport * as url from 'url';\nimport { Controller } from \"../abstracts\";\nimport { __ContentType, __AppName, __Cookie, __SetCookie } from \"../constant\";\nimport { FortGlobal } from \"../fort_global\";\nimport { parseCookie, parseAndMatchRoute, promise, compareExpectedAndRemoveUnnecessary } from \"../helpers\";\nimport { CookieManager, FileManager } from \"../models\";\nimport { GenericSessionProvider, GenericGuard } from \"../generics\";\nimport { RouteMatch, HttpRequest, HttpResponse } from \"../types\";\nimport { HTTP_METHOD } from \"../enums\";\nimport { PostHandler } from \"./post_handler\";\nimport { InjectorHandler } from \"./injector_handler\";\nimport { RouteHandler } from \"./route_handler\";\nimport { IException } from \"../interfaces\";\n\n\nexport class RequestHandler extends PostHandler {\n\n private session_: GenericSessionProvider;\n private query_: any;\n private data_ = {};\n private routeMatchInfo_: RouteMatch;\n\n\n constructor(request: http.IncomingMessage, response: http.ServerResponse) {\n super();\n this.request = request;\n this.response = response;\n this.registerEvents_();\n }\n\n private registerEvents_() {\n this.request.on('error', this.onBadRequest.bind(this));\n this.response.on('error', this.onErrorOccured.bind(this));\n }\n\n private executeWallIncoming_(): Promise {\n return promise((res) => {\n let index = 0;\n const wallLength = FortGlobal.walls.length;\n const executeWallIncomingByIndex = async () => {\n if (wallLength > index) {\n const wall = FortGlobal.walls[index++];\n const constructorArgsValues = InjectorHandler.getConstructorValues(wall.name);\n const wallObj = new wall(...constructorArgsValues);\n wallObj.cookie = this.cookieManager;\n wallObj.session = this.session_;\n wallObj.request = this.request as HttpRequest;\n wallObj.response = this.response as HttpResponse;\n wallObj.data = this.data_;\n wallObj.query = this.query_;\n\n this.wallInstances.push(wallObj);\n const methodArgsValues = InjectorHandler.getMethodValues(wall.name, 'onIncoming');\n try {\n const result = await wallObj.onIncoming(...methodArgsValues);\n if (result == null) {\n executeWallIncomingByIndex();\n }\n else {\n res(false);\n this.onTerminationFromWall(result);\n }\n } catch (ex) {\n this.onErrorOccured(ex);\n res(false);\n }\n }\n else {\n res(true);\n }\n };\n executeWallIncomingByIndex();\n });\n }\n\n runController_;\n\n private executeShieldsProtection_(): Promise {\n return promise((res) => {\n let index = 0;\n const shieldLength = this.routeMatchInfo_.shields.length;\n const executeShieldByIndex = async () => {\n if (shieldLength > index) {\n const shield = this.routeMatchInfo_.shields[index++];\n const constructorArgsValues = InjectorHandler.getConstructorValues(shield.name);\n const shieldObj = new shield(...constructorArgsValues);\n shieldObj.cookie = this.cookieManager;\n shieldObj.query = this.query_;\n shieldObj.session = this.session_;\n shieldObj.request = this.request as HttpRequest;\n shieldObj.response = this.response as HttpResponse;\n shieldObj.data = this.data_;\n shieldObj.workerName = this.routeMatchInfo_.workerInfo.workerName;\n\n const methodArgsValues = InjectorHandler.getMethodValues(shield.name, 'protect');\n\n try {\n const result = await shieldObj.protect(...methodArgsValues);\n if (result == null) {\n executeShieldByIndex();\n }\n else {\n res(false);\n this.onResultFromController(result);\n }\n } catch (ex) {\n this.onErrorOccured(ex);\n res(false);\n }\n }\n else {\n res(true);\n }\n };\n executeShieldByIndex();\n });\n }\n\n private executeGuardsCheck_(guards: Array): Promise {\n return promise((res) => {\n let index = 0;\n const shieldLength = guards.length;\n const executeGuardByIndex = async () => {\n if (shieldLength > index) {\n const guard = guards[index++];\n const constructorArgsValues = InjectorHandler.getConstructorValues(guard.name);\n const guardObj = new guard(...constructorArgsValues);\n guardObj.body = this.body;\n guardObj.cookie = this.cookieManager;\n guardObj.query = this.query_;\n guardObj.session = this.session_;\n guardObj.request = this.request as HttpRequest;\n guardObj.response = this.response as HttpResponse;\n guardObj.data = this.data_;\n guardObj.file = this.file;\n guardObj.param = this.routeMatchInfo_.params;\n\n const methodArgsValues = InjectorHandler.getMethodValues(guard.name, 'check');\n try {\n const result = await guardObj.check(...methodArgsValues);\n if (result == null) {\n executeGuardByIndex();\n }\n else {\n res(false);\n this.onResultFromController(result);\n }\n } catch (ex) {\n this.onErrorOccured(ex);\n res(false);\n }\n }\n else {\n res(true);\n }\n };\n executeGuardByIndex();\n });\n }\n\n private parseCookieFromRequest_() {\n if (FortGlobal.shouldParseCookie === true) {\n const rawCookie = (this.request.headers[__Cookie] || this.request.headers[\"cookie\"]) as string;\n let parsedCookies;\n try {\n parsedCookies = parseCookie(rawCookie);\n } catch (ex) {\n this.onErrorOccured(ex);\n return false;\n }\n this.session_ = new FortGlobal.sessionProvider();\n this.session_.cookie = this.cookieManager = new CookieManager(parsedCookies);\n this.session_.sessionId = parsedCookies[FortGlobal.appSessionIdentifier];\n }\n else {\n this.cookieManager = new CookieManager({});\n }\n return true;\n }\n\n private setPreHeader_() {\n this.response.setHeader('X-Powered-By', FortGlobal.appName);\n this.response.setHeader('Vary', 'Accept-Encoding');\n this.response.sendDate = true;\n }\n\n private checkExpectedQuery_() {\n const expectedQuery = RouteHandler.getExpectedQuery(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName);\n if (expectedQuery != null) {\n this.query_ = compareExpectedAndRemoveUnnecessary(expectedQuery, this.query_, true);\n }\n }\n\n private checkExpectedBody_() {\n const expectedBody = RouteHandler.getExpectedBody(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName);\n if (expectedBody != null) {\n this.body = compareExpectedAndRemoveUnnecessary(expectedBody, this.body, false);\n }\n }\n\n private async onRouteMatched_() {\n const actionInfo = this.routeMatchInfo_.workerInfo;\n if (actionInfo == null) {\n if (this.request.method === HTTP_METHOD.Options) {\n this.onRequestOptions(this.routeMatchInfo_.allowedHttpMethod);\n }\n else {\n this.onMethodNotAllowed(this.routeMatchInfo_.allowedHttpMethod);\n }\n }\n else {\n this.checkExpectedQuery_();\n if (this.query_ == null) {\n this.onBadRequest({\n message: \"Bad query string data - query string data does not match with expected value\"\n } as IException);\n return;\n }\n let shouldExecuteNextComponent = await this.executeShieldsProtection_();\n if (shouldExecuteNextComponent === true) {\n shouldExecuteNextComponent = await this.handlePostData();\n if (shouldExecuteNextComponent === true) {\n this.checkExpectedBody_();\n if (this.body == null) {\n this.onBadRequest({\n message: \"Bad body data - body data does not match with expected value\"\n } as IException);\n return;\n }\n shouldExecuteNextComponent = await this.executeGuardsCheck_(actionInfo.guards);\n if (shouldExecuteNextComponent === true) {\n this.runController_();\n }\n }\n }\n }\n }\n\n private async execute_() {\n const urlDetail = url.parse(this.request.url, true);\n this.query_ = urlDetail.query;\n let shouldExecuteNextProcess = this.parseCookieFromRequest_();\n if (shouldExecuteNextProcess === true) {\n shouldExecuteNextProcess = await this.executeWallIncoming_();\n if (shouldExecuteNextProcess === true) {\n const pathUrl = urlDetail.pathname;\n const requestMethod = this.request.method as HTTP_METHOD;\n try {\n this.routeMatchInfo_ = parseAndMatchRoute(pathUrl.toLowerCase(), requestMethod);\n }\n catch (ex) {\n this.onErrorOccured(ex);\n return;\n }\n if (this.routeMatchInfo_ == null) { // no route matched\n // it may be a file or folder then\n this.handleFileRequest(pathUrl);\n }\n else {\n this.onRouteMatched_();\n }\n }\n }\n }\n\n async handlePostData() {\n if (this.request.method === HTTP_METHOD.Get) {\n this.body = {};\n this.file = new FileManager({});\n }\n else if (FortGlobal.shouldParsePost === true) {\n try {\n this.body = await this.parsePostData();\n } catch (ex) {\n this.onBadRequest(ex);\n return false;\n }\n }\n return true;\n }\n\n async handle() {\n this.setPreHeader_();\n this.execute_();\n }\n\n setControllerProps_() {\n const constructorValues = InjectorHandler.getConstructorValues(this.routeMatchInfo_.controller.name);\n const controllerObj: Controller = new this.routeMatchInfo_.controller(...constructorValues);\n controllerObj.request = this.request as HttpRequest;\n controllerObj.response = this.response;\n controllerObj.query = this.query_;\n controllerObj.body = this.body;\n controllerObj.session = this.session_;\n controllerObj.cookie = this.cookieManager;\n controllerObj.param = this.routeMatchInfo_.params;\n controllerObj.data = this.data_;\n controllerObj.file = this.file;\n const methodArgsValues = InjectorHandler.getMethodValues(this.routeMatchInfo_.controller.name, this.routeMatchInfo_.workerInfo.workerName);\n return controllerObj[this.routeMatchInfo_.workerInfo.workerName](...methodArgsValues);\n }\n}\nif (FortGlobal.isProduction) {\n RequestHandler.prototype.runController_ = function () {\n this.setControllerProps_().then(\n this.onResultFromController.bind(this)\n ).catch(this.onErrorOccured.bind(this));\n };\n}\nelse {\n RequestHandler.prototype.runController_ = function () {\n const result = this.setControllerProps_();\n if (Promise.resolve(result) !== result) {\n this.onErrorOccured({\n message: \"Wrong implementation - worker does not return promise\"\n } as IException);\n }\n else {\n result.then(\n this.onResultFromController.bind(this)\n ).catch(this.onErrorOccured.bind(this));\n }\n };\n}","import { HTTP_STATUS_CODE, MIME_TYPE, HTTP_METHOD } from \"../enums\";\nimport * as http from \"http\";\nimport { __ContentType } from \"../constant\";\nimport { FortGlobal } from \"../fort_global\";\nimport * as Negotiator from \"negotiator\";\nimport { CookieManager } from \"../models\";\nimport { Wall } from \"../abstracts\";\nimport { IException } from \"../interfaces\";\nimport { JsonHelper, reverseLoop } from \"../helpers\";\nimport { isNull } from \"../utils\";\nimport { InjectorHandler } from \"./injector_handler\";\nimport { HttpResult, HttpFormatResult } from \"../types\";\n\n\nexport class RequestHandlerHelper {\n protected cookieManager: CookieManager;\n protected response: http.ServerResponse;\n protected request: http.IncomingMessage;\n\n protected wallInstances: Wall[] = [];\n\n protected controllerResult_: HttpResult | HttpFormatResult = {} as any;\n\n protected runWallOutgoing() {\n const outgoingResults: Array> = [];\n reverseLoop(this.wallInstances, (value: Wall) => {\n const methodArgsValues = InjectorHandler.getMethodValues(value.constructor.name, 'onOutgoing');\n methodArgsValues.shift();\n outgoingResults.push(value.onOutgoing(this.controllerResult_, ...methodArgsValues));\n });\n return Promise.all(outgoingResults);\n }\n\n protected getContentTypeFromNegotiation(type: MIME_TYPE) {\n const negotiator = new Negotiator(this.request);\n let availableTypes: MIME_TYPE[] = this.getAvailableTypes_(type);\n if (availableTypes == null) {\n availableTypes = [type];\n }\n return negotiator.mediaType(availableTypes) as MIME_TYPE;\n }\n\n protected getContentTypeFromNegotiationHavingMultipleTypes(types: MIME_TYPE[]) {\n const negotiator = new Negotiator(this.request);\n return negotiator.mediaType(types) as MIME_TYPE;\n }\n\n private getAvailableTypes_(type: MIME_TYPE) {\n switch (type) {\n case MIME_TYPE.Json:\n case MIME_TYPE.Xml:\n return [MIME_TYPE.Json, MIME_TYPE.Xml];\n case MIME_TYPE.Html:\n case MIME_TYPE.Css:\n case MIME_TYPE.Csv:\n case MIME_TYPE.Js:\n case MIME_TYPE.Rtf:\n case MIME_TYPE.Text:\n return [MIME_TYPE.Text, MIME_TYPE.Html, MIME_TYPE.Js,\n MIME_TYPE.Css, MIME_TYPE.Rtf, MIME_TYPE.Csv];\n }\n return null;\n }\n\n protected async onBadRequest(error) {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onBadRequest(error);\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.BadRequest, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onForbiddenRequest() {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onForbiddenRequest();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.Forbidden, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onNotAcceptableRequest() {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onNotAcceptableRequest();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.NotAcceptable, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onNotFound() {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onNotFound(this.request.url);\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.NotFound, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onMethodNotAllowed(allowedMethods: HTTP_METHOD[]) {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onMethodNotAllowed();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.setHeader(\"Allow\", allowedMethods.join(\",\"));\n this.response.writeHead(HTTP_STATUS_CODE.MethodNotAllowed, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onErrorOccured(error) {\n if (typeof error === 'string') {\n error = {\n message: error\n } as IException;\n }\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onServerError(error);\n }\n catch (ex) {\n errMessage = JsonHelper.stringify(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.InternalServerError, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onRequestOptions(allowedMethods: HTTP_METHOD[]) {\n try {\n await this.runWallOutgoing();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.setHeader(\"Allow\", allowedMethods.join(\",\"));\n this.response.writeHead(HTTP_STATUS_CODE.Ok, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(\"\");\n }\n}","import { WorkerInfo, ParentRoute } from \"../types\";\nimport { GenericShield, GenericGuard } from \"../generics\";\nimport { isNull } from \"../utils\";\nimport { RouteInfo } from \"../models\";\nimport { IRouteInfo } from \"../interfaces\";\nimport { getDataType } from \"../helpers\";\n\nconst routerCollection: {\n [controllerName: string]: RouteInfo\n} = {};\n\nconst pushRouterIntoCollection = (route: IRouteInfo) => {\n const routeObj = new RouteInfo();\n routeObj.init(route);\n routerCollection[route.controllerName] = routeObj;\n};\n\nconst getActionPattern = (parentRoute: ParentRoute, pattern: string) => {\n return (isNull(parentRoute.path) || parentRoute.path === \"/*\") ? pattern : `${parentRoute.path}${pattern}`;\n};\n\nexport class RouteHandler {\n\n static get routerCollection() {\n return routerCollection;\n }\n\n static get routesAsArray() {\n return Object.keys(routerCollection).map(workerName => {\n return routerCollection[workerName];\n });\n }\n\n static findControllerFromPath(urlParts: string[]) {\n for (const controllerName in routerCollection) {\n let isMatched: boolean = false as any;\n const controller = routerCollection[controllerName];\n const patternSplit = controller.path.split(\"/\");\n\n patternSplit.every((patternPart, i) => {\n isMatched = patternPart === urlParts[i];\n return isMatched;\n });\n if (isMatched === true) {\n return controller;\n }\n }\n }\n\n static get defaultRoute() {\n return routerCollection[RouteHandler.defaultRouteControllerName];\n }\n\n static defaultRouteControllerName: string;\n\n static addToRouterCollection(value: ParentRoute) {\n const route = routerCollection[value.controller.name];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {},\n controller: value.controller as any,\n controllerName: value.controller.name,\n path: value.path,\n shields: [],\n values: []\n });\n }\n else {\n route.controller = value.controller as any;\n route.path = value.path;\n // change pattern value since we have controller name now.\n for (const workerName in route.workers) {\n const actionInfo = route.workers[workerName];\n actionInfo.pattern = getActionPattern(value, actionInfo.pattern);\n }\n }\n }\n\n static addShields(shields: Array, className: string) {\n const route = routerCollection[className];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {},\n controller: null,\n controllerName: className,\n shields: shields,\n path: null,\n values: []\n });\n }\n else {\n route.shields = shields;\n }\n }\n\n static addWorker(newWorker: WorkerInfo, className: string) {\n\n const workerName = newWorker.workerName;\n const route = routerCollection[className];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: newWorker\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = route.workers[workerName];\n if (savedAction == null) {\n newWorker.pattern = getActionPattern(route, newWorker.pattern);\n route.workers[workerName] = newWorker;\n }\n else {\n savedAction.methodsAllowed = newWorker.methodsAllowed;\n savedAction.pattern = getActionPattern(route, savedAction.pattern);\n // route.path == null ? savedAction.pattern : `/${route.path}${savedAction.pattern}`;\n }\n }\n }\n\n static addGuards(guards: Array, className: string, workerName: string) {\n\n const route = routerCollection[className];\n const pattern = workerName.toLowerCase();\n if (route == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: {\n workerName: workerName,\n guards: guards,\n methodsAllowed: null,\n pattern: pattern,\n values: []\n }\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = route.workers[workerName];\n if (savedAction == null) {\n route.workers[workerName] = {\n workerName: workerName,\n guards: guards,\n methodsAllowed: null,\n pattern: pattern,\n values: []\n };\n }\n else {\n savedAction.guards = guards;\n }\n }\n }\n\n static addPattern(pattern: string, className: string, workerName: string) {\n const route = routerCollection[className];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: {\n workerName: workerName,\n guards: [],\n methodsAllowed: null,\n pattern: pattern,\n values: []\n }\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = route.workers[workerName];\n pattern = getActionPattern(route, pattern);\n if (savedAction == null) {\n route.workers[workerName] = {\n workerName: workerName,\n guards: [],\n methodsAllowed: null,\n pattern: pattern,\n values: []\n };\n }\n else {\n savedAction.pattern = pattern;\n }\n }\n }\n\n static addExpected(type: string, className: string, workerName: string, expectedValue: any) {\n\n for (const prop in expectedValue) {\n const propValue = expectedValue[prop];\n expectedValue[prop] = getDataType(propValue);\n }\n\n const isQuery = type === 'query';\n const pattern = workerName.toLowerCase();\n const router = routerCollection[className];\n const worker = {\n workerName: workerName,\n guards: [],\n methodsAllowed: null,\n pattern: pattern,\n values: [],\n expectedQuery: isQuery ? expectedValue : null,\n expectedBody: isQuery ? null : expectedValue\n };\n if (router == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: worker\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = router.workers[workerName];\n if (savedAction == null) {\n router.workers[workerName] = worker;\n }\n else {\n savedAction.expectedQuery = worker.expectedQuery;\n savedAction.expectedBody = worker.expectedBody;\n }\n }\n }\n\n static getExpectedQuery(controllerName: string, workerName: string) {\n return routerCollection[controllerName].workers[workerName].expectedQuery;\n }\n\n static getExpectedBody(controllerName: string, workerName: string) {\n return routerCollection[controllerName].workers[workerName].expectedBody;\n }\n\n}","import { getDataType } from \"./get_data_type\";\nimport { DATA_TYPE } from \"../enums/data_type\";\n\nexport const compareExpectedAndRemoveUnnecessary = (expected, actual, isQuery) => {\n const result = {};\n for (const prop in expected) {\n if (isQuery === true && expected[prop] === DATA_TYPE.Number) {\n result[prop] = Number(actual[prop]);\n if (isNaN(result[prop]) === true) {\n return null;\n }\n }\n else {\n result[prop] = actual[prop];\n }\n if (expected[prop] !== getDataType(result[prop])) {\n return null;\n }\n }\n return result;\n};","\nimport { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const downloadResult = (filePath: string, downloadFileName?: string) => {\n return {\n statusCode: HTTP_STATUS_CODE.Ok,\n file: {\n filePath: filePath,\n shouldDownload: true,\n alias: downloadFileName\n }\n } as HttpResult;\n};","\nimport { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const fileResult = (filePath: string) => {\n return {\n statusCode: HTTP_STATUS_CODE.Ok,\n file: {\n filePath: filePath\n }\n } as HttpResult;\n};","export const getClassName = (target): string => {\n return target.name || (target.constructor && target.constructor.name);\n};","import { DATA_TYPE } from \"../enums/data_type\";\n\nexport const getDataType = (value) => {\n const type = typeof value;\n switch (type) {\n case 'object':\n if (Array.isArray(value)) {\n return DATA_TYPE.Array;\n }\n default:\n return type;\n }\n};","import { MIME_TYPE } from \"../enums\";\n\nexport const getMimeTypeFromExtension = (ext: string): MIME_TYPE => {\n switch (ext) {\n case \".htm\":\n case \".html\":\n return MIME_TYPE.Html;\n case \".css\":\n return MIME_TYPE.Css;\n case \".js\":\n return MIME_TYPE.Js;\n case \".png\":\n return MIME_TYPE.Png;\n case \".woff\":\n return MIME_TYPE.Woff;\n case \".woff2\":\n return MIME_TYPE.Woff2;\n case \".json\":\n return MIME_TYPE.Json;\n case \".txt\":\n return MIME_TYPE.Text;\n case \".jpg\":\n case \".jpeg\":\n return MIME_TYPE.Jpeg;\n case \".rtf\":\n return MIME_TYPE.Rtf;\n case \".ttf\":\n return MIME_TYPE.Ttf;\n case \".eot\":\n return MIME_TYPE.Eot;\n case '.otf':\n return MIME_TYPE.Otf;\n case \".swf\":\n return MIME_TYPE.Swf;\n case \".avi\":\n return MIME_TYPE.Avi;\n case \".Svg\":\n return MIME_TYPE.Svg;\n case \".pdf\":\n return MIME_TYPE.Pdf;\n case \".xml\":\n return MIME_TYPE.Xml;\n case \".csv\":\n return MIME_TYPE.Csv;\n case \".xls\":\n return MIME_TYPE.Xls;\n case \".xlsx\":\n return MIME_TYPE.Xlsx;\n case \".bmp\":\n return MIME_TYPE.Bmp;\n case \".gif\":\n return MIME_TYPE.Gif;\n default:\n return \"application/octet-stream\" as MIME_TYPE;\n }\n};","import { MIME_TYPE } from \"../enums\";\nimport { ResultMapper } from \"../abstracts\";\n\nexport let getResultBasedOnMiMe: (type: MIME_TYPE, result, setMimeType?: (type) => void) => any;\n\nexport function setResultMapper(mapper: typeof ResultMapper) {\n if (mapper) {\n getResultBasedOnMiMe = (type, result, callBack) => {\n return new (mapper as any)().map(type, result, callBack);\n };\n }\n else {\n getResultBasedOnMiMe = (type, result, callBack) => {\n switch (type) {\n case MIME_TYPE.Json:\n case MIME_TYPE.Text:\n case MIME_TYPE.Html:\n case MIME_TYPE.Xml:\n if (typeof result === 'object' === true) {\n callBack(MIME_TYPE.Json);\n return JSON.stringify(result);\n }\n }\n return result;\n };\n }\n}","import { readFile } from \"fs-extra\";\nimport * as path from \"path\";\nimport { FortGlobal } from \"../fort_global\";\nimport { __CurrentPath } from \"../constant\";\nimport { ViewReadOption } from \"../types\";\n\nconst viewCache = {\n\n};\n\nexport let getViewFromFile: (option: ViewReadOption) => Promise;\n\nconst readView = async (option: ViewReadOption) => {\n const pathOfView = path.join(FortGlobal.viewPath, option.fileLocation);\n const result = await readFile(pathOfView, {\n encoding: 'utf8'\n });\n if (option.mapView != null) {\n return option.mapView(result);\n }\n return result;\n};\nif (FortGlobal.isProduction === true) {\n getViewFromFile = async function (option: ViewReadOption): Promise {\n if (viewCache[option.fileLocation] == null) {\n viewCache[option.fileLocation] = await readView(option);\n }\n return viewCache[option.fileLocation];\n };\n}\nelse {\n getViewFromFile = async function (option: ViewReadOption): Promise {\n return await readView(option);\n };\n}","import { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const htmlResult = (html: string, statusCode?: HTTP_STATUS_CODE) => {\n return {\n contentType: MIME_TYPE.Html,\n responseData: html,\n statusCode: statusCode || HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","export * from './json_result';\nexport * from './text_result';\nexport * from './html_result';\nexport * from './render_view';\nexport * from './download_result';\nexport * from './file_result';\nexport * from './redirect_result';\nexport * from './view_result';\nexport * from './get_view_from_file';\nexport * from \"./promise\";\nexport * from './log_helper';\nexport * from \"./get_mime_type_from_extension\";\nexport * from \"./parse_match_route\";\nexport * from \"./parse_cookie\";\nexport * from './json_helper';\nexport * from './remove_last_slash';\nexport * from './remove_first_slash';\nexport * from './reverse_loop';\nexport * from './compar_expected_and_remove_unnecessary';\nexport * from './get_data_type';\nexport * from './get_class_name';\nexport * from './remove_method_and_null_from_object';\nexport * from './get_result_based_on_mime';","import { IException } from \"../interfaces\";\n\nexport class JsonHelper {\n static parse(value: string) {\n try {\n return JSON.parse(value);\n }\n catch (ex) {\n // tslint:disable-next-line\n throw {\n message: \"Post data is invalid\"\n } as IException;\n }\n }\n\n static stringify(value) {\n return JSON.stringify(value);\n }\n}","\nimport { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const jsonResult = (value: any, statusCode?: HTTP_STATUS_CODE) => {\n return {\n contentType: MIME_TYPE.Json,\n responseData: value,\n statusCode: statusCode || HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","import { IError } from \"../interfaces/error\";\nimport { ERROR_TYPE } from \"../enums/error_type\";\n\nexport class LogHelper implements IError {\n type: ERROR_TYPE;\n message: string;\n private info_: any;\n\n constructor(type: ERROR_TYPE, info?: any) {\n this.type = type;\n this.info_ = info;\n this.message = this.getMsg_();\n }\n\n throw() {\n const errMsg = this.get();\n throw JSON.stringify(errMsg);\n }\n\n static log(msg) {\n console.log(msg);\n }\n\n logError() {\n console.error(this.get());\n }\n\n logWarning() {\n console.warn(this.get());\n }\n\n get() {\n return {\n message: this.message,\n type: this.type\n } as IError;\n }\n\n private getMsg_() {\n let errMsg: string;\n switch (this.type) {\n case ERROR_TYPE.InvalidControllerName:\n errMsg = `Invalid controller name - '${this.info_}'. Controller name must contain 'controller'.`;\n break;\n case ERROR_TYPE.InvalidContentType:\n errMsg = `Content type - '${this.info_}' is not valid. Please create an issue if you think this is valid type.`;\n break;\n case ERROR_TYPE.PortInUse:\n errMsg = `Port ${this.info_} is being used by another process.`;\n break;\n case ERROR_TYPE.UndefinedViewEngine:\n errMsg = `View engine is not initiated.Initiate the view engine where fort is created.`;\n break;\n default:\n errMsg = this.message;\n break;\n }\n return errMsg;\n }\n}","import { isNullOrEmpty } from \"../utils\";\n\n \n\n\nexport const parseCookie = (cookie: string): { [key: string]: string } => {\n const value = {};\n if (!isNullOrEmpty(cookie)) {\n cookie.split(';').forEach((val) => {\n const parts = val.split('=');\n value[parts.shift().trim()] = decodeURI(parts.join('='));\n });\n }\n return value;\n};","import { RouteHandler } from \"../handlers/route_handler\";\nimport { RouteMatch } from \"../types/route_match\";\nimport { HTTP_METHOD } from \"../enums\";\nimport { removeLastSlash } from \".\";\nimport { RouteInfo } from \"../models\";\n\nconst regex1 = /{(.*)}(?!.)/;\nconst regex2 = /{(.*)}\\.(\\w+)(?!.)/;\n\nconst checkRouteInWorker = (route: RouteInfo, httpMethod: HTTP_METHOD, urlParts: string[]) => {\n const matchedRoute: RouteMatch = {\n allowedHttpMethod: [],\n controller: route.controller,\n controllerName: route.controllerName\n } as RouteMatch;\n\n const urlPartLength = urlParts.length;\n for (const workerName in route.workers) {\n const worker = route.workers[workerName];\n const patternSplit = worker.pattern.split(\"/\");\n if (urlPartLength === patternSplit.length) {\n let isMatched = true;\n const params = {};\n urlParts.every((urlPart, i) => {\n // if not equal then check for regex match\n if (urlPart !== patternSplit[i]) {\n const regMatch1 = patternSplit[i].match(regex1);\n const regMatch2 = patternSplit[i].match(regex2);\n if (regMatch1 != null) {\n params[regMatch1[1]] = urlPart;\n }\n else if (regMatch2 != null) {\n const splitByDot = urlPart.split(\".\");\n if (splitByDot[1] === regMatch2[2]) {\n params[regMatch2[1]] = splitByDot[0];\n }\n else {\n isMatched = false;\n }\n }\n else {\n isMatched = false;\n }\n }\n // means its direct match\n return isMatched;\n });\n if (isMatched === true) {\n if (worker.methodsAllowed.indexOf(httpMethod) >= 0) {\n matchedRoute.workerInfo = worker;\n matchedRoute.params = params;\n matchedRoute.shields = route.shields;\n break;\n }\n else {\n matchedRoute.allowedHttpMethod = [...matchedRoute.allowedHttpMethod, ...worker.methodsAllowed];\n }\n }\n }\n }\n if (matchedRoute.workerInfo == null && matchedRoute.allowedHttpMethod.length === 0) {\n return null;\n }\n return matchedRoute;\n\n};\n\nexport function parseAndMatchRoute(url: string, httpMethod: HTTP_METHOD) {\n url = removeLastSlash(url);\n const urlParts = url.split(\"/\");\n const route = RouteHandler.findControllerFromPath(urlParts);\n return route == null ? checkRouteInWorker(RouteHandler.defaultRoute, httpMethod, urlParts) :\n checkRouteInWorker(route, httpMethod, urlParts);\n}","export const promise = (callBack: (resolve, reject) => void) => {\n return new Promise(callBack);\n};","import { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const redirectResult = (url: string) => {\n return {\n contentType: MIME_TYPE.Text,\n responseData: url,\n statusCode: HTTP_STATUS_CODE.Redirect,\n shouldRedirect: true\n } as HttpResult;\n};","export const removeFirstSlash = function (value: string) {\n // remove / from string at 0th index\n if (value[0] === \"/\") {\n return value.substr(1);\n }\n return value;\n};","export const removeLastSlash = (url: string) => {\n const urlLength = url.length;\n // removing / from url;\n if (url[urlLength - 1] === \"/\") {\n return url.substr(0, urlLength - 1);\n }\n return url;\n};","import { getDataType } from \"./get_data_type\";\nimport { DATA_TYPE } from \"../enums/data_type\";\n\nexport const removeMethodAndNullFromObject = (value: object) => {\n\n const outputValue = {};\n for (const prop in value) {\n const type = getDataType(value[prop]);\n if (!(value[prop] == null || type === DATA_TYPE.Function)) {\n outputValue[prop] = value[prop];\n }\n }\n\n return outputValue;\n};","import { FortGlobal } from \"../fort_global\";\nimport { LogHelper } from \"./log_helper\";\nimport { ERROR_TYPE } from \"../enums/error_type\";\n\nexport let renderView: (viewName: string, model?: any) => Promise;\n\nif (FortGlobal.isProduction === true) {\n renderView = (viewName: string, model?: any) => {\n return FortGlobal.viewEngine.render({\n view: viewName,\n model\n });\n };\n}\nelse {\n renderView = (viewName: string, model?: any) => {\n if (FortGlobal.viewEngine == null) {\n new LogHelper(ERROR_TYPE.UndefinedViewEngine).throw();\n }\n return FortGlobal.viewEngine.render({\n view: viewName,\n model\n });\n };\n}\n","export const reverseLoop = function (values: any[], cb: (value, index: number) => void) {\n for (let length = values.length, i = length - 1; i >= 0; i--) {\n cb(values[i], i);\n }\n};","import { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const textResult = (text: string, statusCode?: HTTP_STATUS_CODE) => {\n return {\n contentType: MIME_TYPE.Text,\n responseData: text,\n statusCode: statusCode || HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","import { renderView } from \"./render_view\";\nimport { HttpResult } from \"../types\";\nimport { MIME_TYPE, HTTP_STATUS_CODE } from \"../enums\";\n\n\nexport const viewResult = async (viewName: string, model?: any) => {\n const viewData = await renderView(viewName, model);\n return {\n contentType: MIME_TYPE.Html,\n responseData: viewData,\n statusCode: HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","export * from './models';\nexport * from './abstracts';\nexport * from './decorators';\nexport * from './enums';\nexport * from './helpers';\nexport * from './types';\nexport * from './extra';\nexport * from './interfaces';","import { HttpCookie } from \"./http_cookie\";\nimport { IHttpCookie } from \"../interfaces\";\n\nexport class CookieManager {\n private responseCookie_: string[] = [];\n private cookieCollection_: { [key: string]: string };\n\n constructor(parsedValue: { [key: string]: string }) {\n this.cookieCollection_ = parsedValue;\n }\n\n /**\n * return cookie by name\n *\n * @param {string} name\n * @returns\n * @memberof CookieManager\n */\n getCookie(name: string): HttpCookie {\n return {\n name: name,\n value: this.cookieCollection_[name]\n } as IHttpCookie;\n }\n\n /**\n * add cookie\n *\n * @param {HttpCookie} cookie\n * @memberof CookieManager\n */\n addCookie(cookie: HttpCookie) {\n this.cookieCollection_[cookie.name] = cookie.value;\n this.responseCookie_.push(this.getCookieStringFromCookie_(cookie));\n }\n\n /**\n * remove cookie\n *\n * @param {HttpCookie} cookie\n * @memberof CookieManager\n */\n removeCookie(cookie: HttpCookie) {\n this.cookieCollection_[cookie.name] = null;\n cookie.expires = new Date('Thu, 01 Jan 1970 00:00:00 GMT');\n cookie.maxAge = -1;\n this.responseCookie_.push(this.getCookieStringFromCookie_(cookie));\n }\n\n /**\n * collection of http cookie\n *\n * @readonly\n * @memberof CookieManager\n */\n get cookieCollection() {\n return this.cookieCollection_;\n }\n\n /**\n * determine whether value exist or not\n *\n * @param {string} name\n * @returns\n * @memberof CookieManager\n */\n isExist(name: string) {\n return this.cookieCollection_[name] != null;\n }\n\n private getCookieStringFromCookie_(cookie: HttpCookie) {\n const cookies = [];\n cookies.push(`${cookie.name}=${cookie.value}`);\n if (cookie.expires) {\n cookies.push(`Expires=${cookie.expires.toUTCString()}`);\n }\n if (cookie.httpOnly === true) {\n cookies.push(\"HttpOnly\");\n }\n if (cookie.maxAge != null) {\n cookies.push(`Max-Age=${cookie.maxAge}`);\n }\n if (cookie.path) {\n cookies.push(`Path=${cookie.path}`);\n }\n if (cookie.domain) {\n cookies.push(`Domain=${cookie.domain}`);\n }\n return cookies.join('; ');\n }\n}","import { IException } from \"../interfaces\";\nimport { promise } from \"../helpers\";\n\nexport class ErrorHandler {\n onServerError(ex: IException): Promise {\n return promise((resolve, reject) => {\n let errMessage = `

internal server error

\n

message : ${ex.message}

`;\n if (ex.stack) {\n errMessage += `

stacktrace: ${ex.stack}

`;\n }\n if (ex.type) {\n errMessage += `

type: ${ex.type}

`;\n }\n resolve(errMessage);\n });\n }\n\n onBadRequest(ex: IException): Promise {\n return promise((resolve, reject) => {\n let errMessage = `

Bad Request

`;\n if (ex.message) {\n errMessage += `

message : ${ex.message}

`;\n }\n if (ex.stack) {\n errMessage += `

stacktrace: ${ex.stack}

`;\n }\n if (ex.type) {\n errMessage += `

type: ${ex.type}

`;\n }\n resolve(errMessage);\n });\n }\n\n onForbiddenRequest(): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

Forbidden

`;\n resolve(errMessage);\n });\n }\n\n onNotAcceptableRequest(): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

Not Acceptable

`;\n resolve(errMessage);\n });\n }\n\n onMethodNotAllowed(): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

Method Not allowed.

`;\n resolve(errMessage);\n });\n }\n\n onNotFound(url: string): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

The requested resource ${url} was not found.

`;\n resolve(errMessage);\n });\n }\n}","import { HttpFile } from \"./http_file\";\nimport * as Fs from \"fs-extra\";\n\nexport class FileManager {\n\n private files_: { [fieldName: string]: HttpFile };\n\n constructor(value) {\n this.files_ = value as any;\n }\n\n /**\n * get total no of files\n *\n * @returns - number\n * @memberof FileManager\n */\n get count() {\n return Object.keys(this.files_).length;\n }\n\n get files() {\n\n return Object.keys(this.files_).map(fileId => {\n return this.files_[fileId];\n });\n }\n\n /**\n * check for existance of file\n *\n * @param {string} fieldName\n * @returns\n * @memberof FileManager\n */\n isExist(fieldName: string) {\n return this.files_[fieldName] != null;\n }\n\n /**\n * return the file\n *\n * @param {string} fieldName\n * @returns\n * @memberof FileManager\n */\n getFile(fieldName: string) {\n return this.files_[fieldName];\n }\n\n /**\n * saves file to supplied path\n *\n * @param {string} fieldName\n * @param {string} pathToSave\n * @returns\n * @memberof FileManager\n */\n saveTo(fieldName: string, pathToSave: string) {\n return Fs.copy(this.files_[fieldName].path, pathToSave);\n }\n}","import { ParentRoute, AppOption, EtagOption } from \"../types\";\nimport { Wall, ViewEngine, SessionProvider, XmlParser, ResultMapper } from \"../abstracts\";\nimport { RouteHandler, RequestHandler } from \"../handlers\";\nimport { FortGlobal } from \"../fort_global\";\nimport { MemorySessionProvider, MustacheViewEngine } from \"../extra\";\nimport { ErrorHandler } from \".\";\nimport { __AppName, __CurrentPath } from \"../constant\";\nimport * as http from \"http\";\nimport { ETag_Type, ERROR_TYPE } from \"../enums\";\nimport { LogHelper, promise, removeLastSlash, removeFirstSlash, setResultMapper } from \"../helpers\";\nimport { GenericSessionProvider, GenericXmlParser, GenericController } from \"../generics\";\nimport { isNull, isNullOrEmpty, isArray } from \"../utils\";\nimport { Logger } from \"./logger\";\nimport * as path from \"path\";\n\nexport class Fort {\n\n logger: Logger;\n routes: ParentRoute[] = [];\n walls: Array = [];\n httpServer: http.Server;\n\n /**\n * view engine use to render the view\n *\n * @type {typeof ViewEngine}\n * @memberof Fort\n */\n viewEngine?: typeof ViewEngine;\n\n /**\n * sessionProvider class, default - MemorySessionProvider\n *\n * @type {typeof SessionProvider}\n */\n sessionProvider?: typeof SessionProvider;\n\n /**\n * Custom error handler class\n *\n * @type {typeof ErrorHandler}\n */\n errorHandler?: typeof ErrorHandler;\n\n /**\n * XmlParser class - used to parse the xml \n *\n * @type {typeof XmlParser}\n * @memberof Fort\n */\n xmlParser?: typeof XmlParser;\n\n resultMapper?: typeof ResultMapper;\n\n private saveAppOption_(option: AppOption) {\n const defaultEtagConfig = {\n type: ETag_Type.Weak\n } as EtagOption;\n\n FortGlobal.port = option.port == null ? 4000 : option.port;\n FortGlobal.shouldParseCookie = option.shouldParseCookie == null ? true : option.shouldParseCookie;\n FortGlobal.shouldParsePost = isNull(option.shouldParsePost) ? true : option.shouldParsePost;\n FortGlobal.sessionTimeOut = isNull(option.sessionTimeOut) ? 60 : option.sessionTimeOut;\n FortGlobal.folders = option.folders == null ? [] : option.folders;\n if (isArray(FortGlobal.folders) === false) {\n throw new Error(`Option folders should be an array`);\n }\n FortGlobal.appName = isNullOrEmpty(option.appName) === true ? __AppName : option.appName;\n FortGlobal.appSessionIdentifier = `${FortGlobal.appName}_session_id`;\n FortGlobal.eTag = isNull(option.eTag) ? defaultEtagConfig : option.eTag;\n FortGlobal.walls = this.walls as any;\n FortGlobal.viewEngine = isNull(this.viewEngine) ? new MustacheViewEngine() : new (this.viewEngine as any)();\n FortGlobal.sessionProvider = isNull(this.sessionProvider) ? MemorySessionProvider as any :\n this.sessionProvider as typeof GenericSessionProvider;\n FortGlobal.errorHandler = isNull(this.errorHandler) ? ErrorHandler : this.errorHandler;\n FortGlobal.xmlParser = isNull(this.xmlParser) ? GenericXmlParser : this.xmlParser;\n FortGlobal.viewPath = isNull(option.viewPath) ? path.join(__CurrentPath, \"views\") : option.viewPath;\n setResultMapper(this.resultMapper);\n if (this.logger) {\n if (typeof this.logger === 'function') {\n this.logger = new (this as any).logger();\n }\n }\n else {\n this.logger = new Logger();\n }\n FortGlobal.logger = this.logger;\n }\n\n create(option?: AppOption): Promise {\n if (option == null) {\n option = {\n\n };\n }\n\n if (this.routes == null) {\n this.routes = [];\n }\n let isDefaultRouteExist = false;\n // removing / from routes\n this.routes.forEach(route => {\n // route.path = removeFirstSlash(route.path);\n route.path = removeLastSlash(route.path);\n RouteHandler.addToRouterCollection(route);\n if (route.path === \"/*\") {\n RouteHandler.defaultRouteControllerName = route.controller.name;\n isDefaultRouteExist = true;\n }\n });\n if (isDefaultRouteExist === false) {\n RouteHandler.defaultRouteControllerName = GenericController.name;\n RouteHandler.addToRouterCollection({\n controller: GenericController,\n path: \"/*\"\n });\n }\n\n if (option.folders != null) {\n // remove / from files routes\n option.folders.forEach(folder => {\n const length = folder.alias.length;\n if (length > 1) {\n folder.alias = removeFirstSlash(folder.alias);\n folder.alias = removeLastSlash(folder.alias);\n }\n\n });\n }\n\n this.saveAppOption_(option);\n if (this.httpServer != null) {\n return;\n }\n return promise((res, rej) => {\n this.httpServer = http.createServer(this.onNewRequest).once(\"error\", (err) => {\n if ((err as any).code === 'EADDRINUSE') {\n const error = new LogHelper(ERROR_TYPE.PortInUse, FortGlobal.port).get();\n rej(error);\n }\n else {\n rej(err);\n }\n }).once('listening', () => {\n // set default route\n // RouteHandler.defaultRouteControllerName = RouteHandler.getDefaultRoute();\n res();\n }).listen(FortGlobal.port);\n });\n }\n\n onNewRequest(request, response) {\n new RequestHandler(request, response).handle();\n }\n\n destroy(): Promise {\n return promise((res, rej) => {\n this.httpServer.close(res);\n });\n }\n\n}\n","import { IHttpCookie } from \"../interfaces\";\n\nexport class HttpCookie implements IHttpCookie {\n name: string;\n value: string;\n maxAge?: number;\n expires?: Date;\n domain?: string;\n httpOnly?: boolean;\n secure?: boolean;\n path?: string;\n\n constructor(name: string, value: string) {\n this.name = name;\n this.value = value;\n }\n}","import { IncomingHttpHeaders } from \"http2\";\n\n \nexport class HttpFile {\n\n /**\n * same as name - the field name for this file\n */\n fieldName: string;\n\n /**\n * the filename that the user reports for the file\n */\n originalFilename: string;\n\n /**\n * the absolute path of the uploaded file on disk\n */\n path: string;\n\n /**\n * the HTTP headers that were sent along with this file\n */\n headers?: IncomingHttpHeaders;\n\n /**\n * size of the file in bytes\n */\n size?: number;\n\n}\n","export * from './error_handler';\nexport * from './http_cookie';\nexport * from './fort';\nexport * from './router';\nexport * from './cookie_manager';\nexport * from \"./file_manager\";\nexport * from \"./http_file\";\nexport * from \"./logger\";\nexport * from './route_info';","export class Logger {\n info?(...args) {\n this.debug(args);\n }\n error?(...args) {\n this.debug(args);\n }\n log?(...args) {\n this.debug(args);\n }\n debug?(...args) {\n console.log(...args);\n }\n}","import { GenericShield, GenericController } from \"../generics\";\nimport { WorkerInfo } from \"../types\";\nimport { IRouteInfo } from \"../interfaces\";\n\nexport class RouteInfo implements IRouteInfo {\n controller: typeof GenericController;\n controllerName: string;\n path: string;\n workers: {\n [workerName: string]: WorkerInfo\n };\n\n get workersAsArray() {\n return Object.keys(this.workers).map(workerName => {\n return this.workers[workerName];\n return this.workers[workerName];\n });\n }\n\n shields: Array;\n values: any[];\n\n init(value: IRouteInfo) {\n this.controllerName = value.controllerName;\n this.controller = value.controller;\n this.path = value.path;\n this.shields = value.shields;\n this.values = value.values;\n this.workers = value.workers;\n }\n}","import { RouteHandler } from \"../handlers\";\nimport { RouteInfo } from \"./route_info\";\n\nexport class Router {\n get routes() {\n return RouteHandler.routerCollection;\n }\n\n get routesAsArray() {\n return RouteHandler.routesAsArray;\n }\n\n}","import { HttpRequest } from \"../types\";\n\nexport class HttpRequestStub implements HttpRequest {\n headers;\n\n constructor(headers) {\n this.headers = headers;\n }\n}","import { HttpResponse } from \"../types\";\n\nexport class HttpResponseStub implements HttpResponse {\n private headers_;\n constructor(headers) {\n this.headers_ = headers;\n }\n\n getHeader(name: string) {\n return this.headers_[name];\n }\n\n\n hasHeader(name: string) {\n return this.headers_[name] != null;\n }\n\n setHeader(name: string, value: number | string | string[]) {\n this.headers_[name] = value;\n }\n\n getHeaders() {\n return this.headers_;\n }\n\n getHeaderNames(): string[] {\n return Object.keys[this.headers_];\n }\n\n removeHeader(name: string) {\n delete this.headers_[name];\n }\n}","export * from './init_controller';\nexport * from './init_guard';\nexport * from './init_shield';\nexport * from './init_wall';","\nimport { CookieManager, FileManager } from \"../models\";\nimport { FortGlobal } from \"../fort_global\";\nimport { ControllerTestData } from \"../types\";\nimport { HttpResponseStub } from \"./http_response_stub\";\nimport { HttpRequestStub } from \"./http_request_stub\";\nimport { Controller } from \"../abstracts\";\n\n\n\nexport const initController = (controllerInstance: Controller, data?: ControllerTestData) => {\n data = data || {};\n const parsedCookies = data.cookieValue || {};\n const headers = (data.request && data.request.headers) || {};\n controllerInstance.request = new HttpRequestStub(headers);\n controllerInstance.response = new HttpResponseStub(headers);\n controllerInstance.query = data.query || {};\n controllerInstance.body = data.body || {};\n controllerInstance.cookie = new CookieManager(parsedCookies);\n const session = new FortGlobal.sessionProvider();\n session.cookie = controllerInstance.cookie;\n session.sessionId = parsedCookies[FortGlobal.appSessionIdentifier];\n controllerInstance.session = session;\n controllerInstance.param = data.param || {};\n controllerInstance.data = data.data || {};\n controllerInstance.file = new FileManager(data.file || {});\n return controllerInstance;\n};","\nimport { initController } from \"./init_controller\";\nimport { ControllerTestData } from \"../types\";\n\nexport type GuardTestData = ControllerTestData;\n\nexport const initGuard = (guardInstance, data?: GuardTestData) => {\n return initController(guardInstance, data);\n};","\nimport { initController } from \"./init_controller\";\nimport { ControllerTestData } from \"../types\";\n\nexport type ShieldTestData = ControllerTestData & {\n workerName?: string;\n};\n\nexport const initShield = (shieldInstance, data?: ShieldTestData) => {\n const value: ShieldTestData = initController(shieldInstance, data) as any;\n value.workerName = data && data.workerName;\n return value;\n};","\nimport { initController } from \"./init_controller\";\nimport { ControllerTestData } from \"../types\";\n\nexport type WallTestData = ControllerTestData;\n\nexport const initWall = (wallInstance, data?: WallTestData) => {\n return initController(wallInstance, data);\n};","export * from './is_null_or_empty';\nexport * from './is_null';\nexport * from './is_array';","export const isArray = (value) => {\n return Array.isArray(value);\n};","export const isNull = (value) => {\n return value == null;\n};","export const isNullOrEmpty = (value: string) => {\n return value == null || value.length === 0;\n};","module.exports = require(\"content-type\");","module.exports = require(\"etag\");","module.exports = require(\"fresh\");","module.exports = require(\"fs\");","module.exports = require(\"fs-extra\");","module.exports = require(\"http\");","module.exports = require(\"multiparty\");","module.exports = require(\"mustache\");","module.exports = require(\"negotiator\");","module.exports = require(\"path\");","module.exports = require(\"querystring\");","module.exports = require(\"uniqid\");","module.exports = require(\"url\");"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://FortJs/webpack/bootstrap","webpack://FortJs/external \"path\"","webpack://FortJs/external \"fs-extra\"","webpack://FortJs/external \"negotiator\"","webpack://FortJs/external \"fs\"","webpack://FortJs/external \"url\"","webpack://FortJs/external \"etag\"","webpack://FortJs/external \"fresh\"","webpack://FortJs/external \"content-type\"","webpack://FortJs/external \"querystring\"","webpack://FortJs/external \"multiparty\"","webpack://FortJs/external \"mustache\"","webpack://FortJs/external \"uniqid\"","webpack://FortJs/external \"http\"","webpack://FortJs/./src/enums/mime_type.ts","webpack://FortJs/./src/enums/http_method.ts","webpack://FortJs/./src/enums/http_status_code.ts","webpack://FortJs/./src/enums/etag_type.ts","webpack://FortJs/./src/enums/error_type.ts","webpack://FortJs/./src/enums/data_type.ts","webpack://FortJs/./src/enums/index.ts","webpack://FortJs/./src/helpers/json_result.ts","webpack://FortJs/./src/helpers/text_result.ts","webpack://FortJs/./src/helpers/html_result.ts","webpack://FortJs/./src/fort_global.ts","webpack://FortJs/./src/helpers/log_helper.ts","webpack://FortJs/./src/helpers/render_view.ts","webpack://FortJs/./src/helpers/download_result.ts","webpack://FortJs/./src/helpers/file_result.ts","webpack://FortJs/./src/helpers/redirect_result.ts","webpack://FortJs/./src/helpers/view_result.ts","webpack://FortJs/./src/helpers/get_view_from_file.ts","webpack://FortJs/./src/helpers/promise.ts","webpack://FortJs/./src/helpers/get_mime_type_from_extension.ts","webpack://FortJs/./src/utils/is_null_or_empty.ts","webpack://FortJs/./src/utils/is_null.ts","webpack://FortJs/./src/utils/is_array.ts","webpack://FortJs/./src/utils/index.ts","webpack://FortJs/./src/handlers/route_handler.ts","webpack://FortJs/./src/helpers/parse_match_route.ts","webpack://FortJs/./src/helpers/parse_cookie.ts","webpack://FortJs/./src/helpers/json_helper.ts","webpack://FortJs/./src/helpers/remove_last_slash.ts","webpack://FortJs/./src/helpers/remove_first_slash.ts","webpack://FortJs/./src/helpers/reverse_loop.ts","webpack://FortJs/./src/helpers/get_data_type.ts","webpack://FortJs/./src/helpers/compar_expected_and_remove_unnecessary.ts","webpack://FortJs/./src/helpers/get_class_name.ts","webpack://FortJs/./src/helpers/remove_method_and_null_from_object.ts","webpack://FortJs/./src/helpers/get_result_based_on_mime.ts","webpack://FortJs/./src/helpers/index.ts","webpack://FortJs/./src/models/error_handler.ts","webpack://FortJs/./src/models/http_cookie.ts","webpack://FortJs/./src/constant.ts","webpack://FortJs/./src/handlers/injector_handler.ts","webpack://FortJs/./src/handlers/request_handler_helper.ts","webpack://FortJs/./src/handlers/file_handler.ts","webpack://FortJs/./src/handlers/controller_result_handler.ts","webpack://FortJs/./src/handlers/post_handler.ts","webpack://FortJs/./src/handlers/request_handler.ts","webpack://FortJs/./src/handlers/index.ts","webpack://FortJs/./src/extra/mustache_view_engine.ts","webpack://FortJs/./src/abstracts/session_provider.ts","webpack://FortJs/./src/extra/memory_session_provider.ts","webpack://FortJs/./src/extra/index.ts","webpack://FortJs/./src/test_helpers/http_response_stub.ts","webpack://FortJs/./src/test_helpers/http_request_stub.ts","webpack://FortJs/./src/test_helpers/init_controller.ts","webpack://FortJs/./src/test_helpers/init_guard.ts","webpack://FortJs/./src/test_helpers/init_shield.ts","webpack://FortJs/./src/test_helpers/init_wall.ts","webpack://FortJs/./src/test_helpers/index.ts","webpack://FortJs/./src/abstracts/controller.ts","webpack://FortJs/./src/abstracts/shield.ts","webpack://FortJs/./src/abstracts/guard.ts","webpack://FortJs/./src/abstracts/view_engine.ts","webpack://FortJs/./src/abstracts/wall.ts","webpack://FortJs/./src/abstracts/xml_parser.ts","webpack://FortJs/./src/abstracts/result_mapper.ts","webpack://FortJs/./src/abstracts/index.ts","webpack://FortJs/./src/generics/generic_guard.ts","webpack://FortJs/./src/generics/generic_shield.ts","webpack://FortJs/./src/generics/generic_session_provider.ts","webpack://FortJs/./src/generics/generic_wall.ts","webpack://FortJs/./src/generics/generic_controller.ts","webpack://FortJs/./src/generics/generic_xml_parser.ts","webpack://FortJs/./src/generics/index.ts","webpack://FortJs/./src/models/logger.ts","webpack://FortJs/./src/models/fort.ts","webpack://FortJs/./src/models/router.ts","webpack://FortJs/./src/models/cookie_manager.ts","webpack://FortJs/./src/models/file_manager.ts","webpack://FortJs/./src/models/http_file.ts","webpack://FortJs/./src/models/route_info.ts","webpack://FortJs/./src/models/index.ts","webpack://FortJs/./src/decorators/worker.ts","webpack://FortJs/./src/decorators/shields.ts","webpack://FortJs/./src/decorators/guards.ts","webpack://FortJs/./src/decorators/route.ts","webpack://FortJs/./src/decorators/default_worker.ts","webpack://FortJs/./src/decorators/assign.ts","webpack://FortJs/./src/decorators/singleton.ts","webpack://FortJs/./src/decorators/expect_body.ts","webpack://FortJs/./src/decorators/expect_query.ts","webpack://FortJs/./src/decorators/index.ts","webpack://FortJs/./src/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+D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CAAC;AACN,CAAC;;;ACrBwB;AACC;AACD;AACD;AACS;AACR;AACG;AACE;AACC;;;ACR/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAyB;AACG;AACC;AACL;AACE;AAEF","file":"fort.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 13);\n","module.exports = require(\"path\");","module.exports = require(\"fs-extra\");","module.exports = require(\"negotiator\");","module.exports = require(\"fs\");","module.exports = require(\"url\");","module.exports = require(\"etag\");","module.exports = require(\"fresh\");","module.exports = require(\"content-type\");","module.exports = require(\"querystring\");","module.exports = require(\"multiparty\");","module.exports = require(\"mustache\");","module.exports = require(\"uniqid\");","module.exports = require(\"http\");","export enum MIME_TYPE {\n Text = \"text/plain\",\n Json = \"application/json\",\n Html = \"text/html\",\n FormUrlEncoded = \"application/x-www-form-urlencoded\",\n Css = \"text/css\",\n Csv = \"text/csv\",\n Js = \"application/javascript\",\n Bmp = \"image/bmp\",\n Jpeg = \"image/jpeg\",\n Gif = \"image/gif\",\n Ico = \"image/x-icon\",\n Png = \"image/png\",\n Pdf = \"application/pdf\",\n Svg = \"image/svg+xml\",\n Rtf = \"application/rtf\",\n Xml = \"application/xml\",\n Xls = \"application/vnd.ms-excel\",\n Xlsx = \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n Ttf = \"font/ttf\",\n Woff = \"font/woff\",\n Woff2 = \"font/woff2\",\n Eot = \"application/vnd.ms-fontobject\",\n Otf = \"font/otf\",\n Swf = \"application/x-shockwave-flash\",\n Avi = \"video/avi\",\n FormMultiPart = \"multipart/form-data\"\n\n}","export enum HTTP_METHOD {\n Get = \"GET\",\n Post = \"POST\",\n Put = \"PUT\",\n Patch = \"PATCH\",\n Delete = \"DELETE\",\n Options = \"OPTIONS\",\n Head = \"HEAD\"\n}","export enum HTTP_STATUS_CODE {\n BadRequest = 400,\n Unauthorized = 401,\n Forbidden = 403,\n NotFound = 404,\n Ok = 200,\n Created = 201,\n NoContent = 204,\n Redirect = 302,\n NotModified = 304,\n MethodNotAllowed = 405,\n NotAcceptable = 406,\n InternalServerError = 500,\n}","export enum ETag_Type {\n Strong = \"strong\",\n Weak = \"weak\"\n}","export enum ERROR_TYPE {\n InvalidControllerName = \"invalid_controller_name\",\n InvalidContentType = \"invalid_content_type\",\n PortInUse = \"port_in_use\",\n UndefinedViewEngine = \"undefined_view_engine\"\n}","export enum DATA_TYPE {\n String = \"string\",\n Number = \"number\",\n Array = \"array\",\n Object = \"object\",\n Function = \"function\"\n}","export * from './mime_type';\nexport * from './http_method';\nexport * from './http_status_code';\nexport * from \"./etag_type\";\nexport * from \"./error_type\";\nexport * from \"./data_type\";","\nimport { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const jsonResult = (value: any, statusCode?: HTTP_STATUS_CODE) => {\n return {\n contentType: MIME_TYPE.Json,\n responseData: value,\n statusCode: statusCode || HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","import { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const textResult = (text: string, statusCode?: HTTP_STATUS_CODE) => {\n return {\n contentType: MIME_TYPE.Text,\n responseData: text,\n statusCode: statusCode || HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","import { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const htmlResult = (html: string, statusCode?: HTTP_STATUS_CODE) => {\n return {\n contentType: MIME_TYPE.Html,\n responseData: html,\n statusCode: statusCode || HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","import { ErrorHandler, Logger } from \"./models\";\nimport { ViewEngine, XmlParser } from \"./abstracts\";\nimport { EtagOption, FolderMap } from \"./types\";\nimport { GenericSessionProvider, GenericWall } from \"./generics\";\n\nconst isDevelopment = process.env.NODE_ENV === 'development';\nconst isProduction = process.env.NODE_ENV === \"production\";\nexport class FortGlobal {\n static port: number;\n static viewPath: string;\n static shouldParseCookie: boolean;\n static shouldParsePost: boolean;\n static sessionProvider: typeof GenericSessionProvider;\n static sessionTimeOut?: number;\n static viewEngine: ViewEngine;\n static walls: Array = [];\n static errorHandler: typeof ErrorHandler;\n static connectonKeepAliveTimeout?: number;\n\n static appName?: string;\n\n static eTag?: EtagOption;\n\n static folders?: FolderMap[];\n static appSessionIdentifier: string;\n static xmlParser: typeof XmlParser;\n\n static logger: Logger;\n\n static get isDevelopment() {\n return isDevelopment;\n }\n\n static get isProduction() {\n return isProduction;\n }\n}","import { IError } from \"../interfaces/error\";\nimport { ERROR_TYPE } from \"../enums/error_type\";\n\nexport class LogHelper implements IError {\n type: ERROR_TYPE;\n message: string;\n private info_: any;\n\n constructor(type: ERROR_TYPE, info?: any) {\n this.type = type;\n this.info_ = info;\n this.message = this.getMsg_();\n }\n\n throw() {\n const errMsg = this.get();\n throw JSON.stringify(errMsg);\n }\n\n static log(msg) {\n console.log(msg);\n }\n\n logError() {\n console.error(this.get());\n }\n\n logWarning() {\n console.warn(this.get());\n }\n\n get() {\n return {\n message: this.message,\n type: this.type\n } as IError;\n }\n\n private getMsg_() {\n let errMsg: string;\n switch (this.type) {\n case ERROR_TYPE.InvalidControllerName:\n errMsg = `Invalid controller name - '${this.info_}'. Controller name must contain 'controller'.`;\n break;\n case ERROR_TYPE.InvalidContentType:\n errMsg = `Content type - '${this.info_}' is not valid. Please create an issue if you think this is valid type.`;\n break;\n case ERROR_TYPE.PortInUse:\n errMsg = `Port ${this.info_} is being used by another process.`;\n break;\n case ERROR_TYPE.UndefinedViewEngine:\n errMsg = `View engine is not initiated.Initiate the view engine where fort is created.`;\n break;\n default:\n errMsg = this.message;\n break;\n }\n return errMsg;\n }\n}","import { FortGlobal } from \"../fort_global\";\nimport { LogHelper } from \"./log_helper\";\nimport { ERROR_TYPE } from \"../enums/error_type\";\n\nexport let renderView: (viewName: string, model?: any) => Promise;\n\nif (FortGlobal.isProduction === true) {\n renderView = (viewName: string, model?: any) => {\n return FortGlobal.viewEngine.render({\n view: viewName,\n model\n });\n };\n}\nelse {\n renderView = (viewName: string, model?: any) => {\n if (FortGlobal.viewEngine == null) {\n new LogHelper(ERROR_TYPE.UndefinedViewEngine).throw();\n }\n return FortGlobal.viewEngine.render({\n view: viewName,\n model\n });\n };\n}\n","\nimport { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const downloadResult = (filePath: string, downloadFileName?: string) => {\n return {\n statusCode: HTTP_STATUS_CODE.Ok,\n file: {\n filePath: filePath,\n shouldDownload: true,\n alias: downloadFileName\n }\n } as HttpResult;\n};","\nimport { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const fileResult = (filePath: string) => {\n return {\n statusCode: HTTP_STATUS_CODE.Ok,\n file: {\n filePath: filePath\n }\n } as HttpResult;\n};","import { MIME_TYPE } from \"../enums\";\nimport { HTTP_STATUS_CODE } from \"../enums/http_status_code\";\nimport { HttpResult } from \"../types/http_result\";\n\nexport const redirectResult = (url: string) => {\n return {\n contentType: MIME_TYPE.Text,\n responseData: url,\n statusCode: HTTP_STATUS_CODE.Redirect,\n shouldRedirect: true\n } as HttpResult;\n};","import { renderView } from \"./render_view\";\nimport { HttpResult } from \"../types\";\nimport { MIME_TYPE, HTTP_STATUS_CODE } from \"../enums\";\n\n\nexport const viewResult = async (viewName: string, model?: any) => {\n const viewData = await renderView(viewName, model);\n return {\n contentType: MIME_TYPE.Html,\n responseData: viewData,\n statusCode: HTTP_STATUS_CODE.Ok\n } as HttpResult;\n};","import { readFile } from \"fs-extra\";\nimport * as path from \"path\";\nimport { FortGlobal } from \"../fort_global\";\nimport { __CurrentPath } from \"../constant\";\nimport { ViewReadOption } from \"../types\";\n\nconst viewCache = {\n\n};\n\nexport let getViewFromFile: (option: ViewReadOption) => Promise;\n\nconst readView = async (option: ViewReadOption) => {\n const pathOfView = path.join(FortGlobal.viewPath, option.fileLocation);\n const result = await readFile(pathOfView, {\n encoding: 'utf8'\n });\n if (option.mapView != null) {\n return option.mapView(result);\n }\n return result;\n};\nif (FortGlobal.isProduction === true) {\n getViewFromFile = async function (option: ViewReadOption): Promise {\n if (viewCache[option.fileLocation] == null) {\n viewCache[option.fileLocation] = await readView(option);\n }\n return viewCache[option.fileLocation];\n };\n}\nelse {\n getViewFromFile = async function (option: ViewReadOption): Promise {\n return await readView(option);\n };\n}","export const promise = (callBack: (resolve, reject) => void) => {\n return new Promise(callBack);\n};","import { MIME_TYPE } from \"../enums\";\n\nexport const getMimeTypeFromExtension = (ext: string): MIME_TYPE => {\n switch (ext) {\n case \".htm\":\n case \".html\":\n return MIME_TYPE.Html;\n case \".css\":\n return MIME_TYPE.Css;\n case \".js\":\n return MIME_TYPE.Js;\n case \".png\":\n return MIME_TYPE.Png;\n case \".woff\":\n return MIME_TYPE.Woff;\n case \".woff2\":\n return MIME_TYPE.Woff2;\n case \".json\":\n return MIME_TYPE.Json;\n case \".txt\":\n return MIME_TYPE.Text;\n case \".jpg\":\n case \".jpeg\":\n return MIME_TYPE.Jpeg;\n case \".rtf\":\n return MIME_TYPE.Rtf;\n case \".ttf\":\n return MIME_TYPE.Ttf;\n case \".eot\":\n return MIME_TYPE.Eot;\n case '.otf':\n return MIME_TYPE.Otf;\n case \".swf\":\n return MIME_TYPE.Swf;\n case \".avi\":\n return MIME_TYPE.Avi;\n case \".Svg\":\n return MIME_TYPE.Svg;\n case \".pdf\":\n return MIME_TYPE.Pdf;\n case \".xml\":\n return MIME_TYPE.Xml;\n case \".csv\":\n return MIME_TYPE.Csv;\n case \".xls\":\n return MIME_TYPE.Xls;\n case \".xlsx\":\n return MIME_TYPE.Xlsx;\n case \".bmp\":\n return MIME_TYPE.Bmp;\n case \".gif\":\n return MIME_TYPE.Gif;\n default:\n return \"application/octet-stream\" as MIME_TYPE;\n }\n};","export const isNullOrEmpty = (value: string) => {\n return value == null || value.length === 0;\n};","export const isNull = (value) => {\n return value == null;\n};","export const isArray = (value) => {\n return Array.isArray(value);\n};","export * from './is_null_or_empty';\nexport * from './is_null';\nexport * from './is_array';","import { WorkerInfo, ParentRoute } from \"../types\";\nimport { GenericShield, GenericGuard } from \"../generics\";\nimport { isNull } from \"../utils\";\nimport { RouteInfo } from \"../models\";\nimport { IRouteInfo } from \"../interfaces\";\nimport { getDataType } from \"../helpers\";\n\nconst routerCollection: {\n [controllerName: string]: RouteInfo\n} = {};\n\nconst pushRouterIntoCollection = (route: IRouteInfo) => {\n const routeObj = new RouteInfo();\n routeObj.init(route);\n routerCollection[route.controllerName] = routeObj;\n};\n\nconst getActionPattern = (parentRoute: ParentRoute, pattern: string) => {\n return (isNull(parentRoute.path) || parentRoute.path === \"/*\") ? pattern : `${parentRoute.path}${pattern}`;\n};\n\nexport class RouteHandler {\n\n static get routerCollection() {\n return routerCollection;\n }\n\n static get routesAsArray() {\n return Object.keys(routerCollection).map(workerName => {\n return routerCollection[workerName];\n });\n }\n\n static findControllerFromPath(urlParts: string[]) {\n for (const controllerName in routerCollection) {\n let isMatched: boolean = false as any;\n const controller = routerCollection[controllerName];\n const patternSplit = controller.path.split(\"/\");\n\n patternSplit.every((patternPart, i) => {\n isMatched = patternPart === urlParts[i];\n return isMatched;\n });\n if (isMatched === true) {\n return controller;\n }\n }\n }\n\n static get defaultRoute() {\n return routerCollection[RouteHandler.defaultRouteControllerName];\n }\n\n static defaultRouteControllerName: string;\n\n static addToRouterCollection(value: ParentRoute) {\n const route = routerCollection[value.controller.name];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {},\n controller: value.controller as any,\n controllerName: value.controller.name,\n path: value.path,\n shields: [],\n values: []\n });\n }\n else {\n route.controller = value.controller as any;\n route.path = value.path;\n // change pattern value since we have controller name now.\n for (const workerName in route.workers) {\n const actionInfo = route.workers[workerName];\n actionInfo.pattern = getActionPattern(value, actionInfo.pattern);\n }\n }\n }\n\n static addShields(shields: Array, className: string) {\n const route = routerCollection[className];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {},\n controller: null,\n controllerName: className,\n shields: shields,\n path: null,\n values: []\n });\n }\n else {\n route.shields = shields;\n }\n }\n\n static addWorker(newWorker: WorkerInfo, className: string) {\n\n const workerName = newWorker.workerName;\n const route = routerCollection[className];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: newWorker\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = route.workers[workerName];\n if (savedAction == null) {\n newWorker.pattern = getActionPattern(route, newWorker.pattern);\n route.workers[workerName] = newWorker;\n }\n else {\n savedAction.methodsAllowed = newWorker.methodsAllowed;\n savedAction.pattern = getActionPattern(route, savedAction.pattern);\n // route.path == null ? savedAction.pattern : `/${route.path}${savedAction.pattern}`;\n }\n }\n }\n\n static addGuards(guards: Array, className: string, workerName: string) {\n\n const route = routerCollection[className];\n const pattern = workerName.toLowerCase();\n if (route == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: {\n workerName: workerName,\n guards: guards,\n methodsAllowed: null,\n pattern: pattern,\n values: []\n }\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = route.workers[workerName];\n if (savedAction == null) {\n route.workers[workerName] = {\n workerName: workerName,\n guards: guards,\n methodsAllowed: null,\n pattern: pattern,\n values: []\n };\n }\n else {\n savedAction.guards = guards;\n }\n }\n }\n\n static addPattern(pattern: string, className: string, workerName: string) {\n const route = routerCollection[className];\n if (route == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: {\n workerName: workerName,\n guards: [],\n methodsAllowed: null,\n pattern: pattern,\n values: []\n }\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = route.workers[workerName];\n pattern = getActionPattern(route, pattern);\n if (savedAction == null) {\n route.workers[workerName] = {\n workerName: workerName,\n guards: [],\n methodsAllowed: null,\n pattern: pattern,\n values: []\n };\n }\n else {\n savedAction.pattern = pattern;\n }\n }\n }\n\n static addExpected(type: string, className: string, workerName: string, expectedValue: any) {\n\n for (const prop in expectedValue) {\n const propValue = expectedValue[prop];\n expectedValue[prop] = getDataType(propValue);\n }\n\n const isQuery = type === 'query';\n const pattern = workerName.toLowerCase();\n const router = routerCollection[className];\n const worker = {\n workerName: workerName,\n guards: [],\n methodsAllowed: null,\n pattern: pattern,\n values: [],\n expectedQuery: isQuery ? expectedValue : null,\n expectedBody: isQuery ? null : expectedValue\n };\n if (router == null) {\n pushRouterIntoCollection({\n workers: {\n [workerName]: worker\n },\n controller: null,\n controllerName: className,\n shields: [],\n path: null,\n values: []\n });\n }\n else {\n const savedAction = router.workers[workerName];\n if (savedAction == null) {\n router.workers[workerName] = worker;\n }\n else {\n savedAction.expectedQuery = worker.expectedQuery;\n savedAction.expectedBody = worker.expectedBody;\n }\n }\n }\n\n static getExpectedQuery(controllerName: string, workerName: string) {\n return routerCollection[controllerName].workers[workerName].expectedQuery;\n }\n\n static getExpectedBody(controllerName: string, workerName: string) {\n return routerCollection[controllerName].workers[workerName].expectedBody;\n }\n\n}","import { RouteHandler } from \"../handlers/route_handler\";\nimport { RouteMatch } from \"../types/route_match\";\nimport { HTTP_METHOD } from \"../enums\";\nimport { removeLastSlash } from \".\";\nimport { RouteInfo } from \"../models\";\n\nconst regex1 = /{(.*)}(?!.)/;\nconst regex2 = /{(.*)}\\.(\\w+)(?!.)/;\n\nconst checkRouteInWorker = (route: RouteInfo, httpMethod: HTTP_METHOD, urlParts: string[]) => {\n const matchedRoute: RouteMatch = {\n allowedHttpMethod: [],\n controller: route.controller,\n controllerName: route.controllerName\n } as RouteMatch;\n\n const urlPartLength = urlParts.length;\n for (const workerName in route.workers) {\n const worker = route.workers[workerName];\n const patternSplit = worker.pattern.split(\"/\");\n if (urlPartLength === patternSplit.length) {\n let isMatched = true;\n const params = {};\n urlParts.every((urlPart, i) => {\n // if not equal then check for regex match\n if (urlPart !== patternSplit[i]) {\n const regMatch1 = patternSplit[i].match(regex1);\n const regMatch2 = patternSplit[i].match(regex2);\n if (regMatch1 != null) {\n params[regMatch1[1]] = urlPart;\n }\n else if (regMatch2 != null) {\n const splitByDot = urlPart.split(\".\");\n if (splitByDot[1] === regMatch2[2]) {\n params[regMatch2[1]] = splitByDot[0];\n }\n else {\n isMatched = false;\n }\n }\n else {\n isMatched = false;\n }\n }\n // means its direct match\n return isMatched;\n });\n if (isMatched === true) {\n if (worker.methodsAllowed.indexOf(httpMethod) >= 0) {\n matchedRoute.workerInfo = worker;\n matchedRoute.params = params;\n matchedRoute.shields = route.shields;\n break;\n }\n else {\n matchedRoute.allowedHttpMethod = [...matchedRoute.allowedHttpMethod, ...worker.methodsAllowed];\n }\n }\n }\n }\n if (matchedRoute.workerInfo == null && matchedRoute.allowedHttpMethod.length === 0) {\n return null;\n }\n return matchedRoute;\n\n};\n\nexport function parseAndMatchRoute(url: string, httpMethod: HTTP_METHOD) {\n url = removeLastSlash(url);\n const urlParts = url.split(\"/\");\n const route = RouteHandler.findControllerFromPath(urlParts);\n return route == null ? checkRouteInWorker(RouteHandler.defaultRoute, httpMethod, urlParts) :\n checkRouteInWorker(route, httpMethod, urlParts);\n}","import { isNullOrEmpty } from \"../utils\";\n\n \n\n\nexport const parseCookie = (cookie: string): { [key: string]: string } => {\n const value = {};\n if (!isNullOrEmpty(cookie)) {\n cookie.split(';').forEach((val) => {\n const parts = val.split('=');\n value[parts.shift().trim()] = decodeURI(parts.join('='));\n });\n }\n return value;\n};","import { IException } from \"../interfaces\";\n\nexport class JsonHelper {\n static parse(value: string) {\n try {\n return JSON.parse(value);\n }\n catch (ex) {\n // tslint:disable-next-line\n throw {\n message: \"Post data is invalid\"\n } as IException;\n }\n }\n\n static stringify(value) {\n return JSON.stringify(value);\n }\n}","export const removeLastSlash = (url: string) => {\n const urlLength = url.length;\n // removing / from url;\n if (url[urlLength - 1] === \"/\") {\n return url.substr(0, urlLength - 1);\n }\n return url;\n};","export const removeFirstSlash = function (value: string) {\n // remove / from string at 0th index\n if (value[0] === \"/\") {\n return value.substr(1);\n }\n return value;\n};","export const reverseLoop = function (values: any[], cb: (value, index: number) => void) {\n for (let length = values.length, i = length - 1; i >= 0; i--) {\n cb(values[i], i);\n }\n};","import { DATA_TYPE } from \"../enums/data_type\";\n\nexport const getDataType = (value) => {\n const type = typeof value;\n switch (type) {\n case 'object':\n if (Array.isArray(value)) {\n return DATA_TYPE.Array;\n }\n default:\n return type;\n }\n};","import { getDataType } from \"./get_data_type\";\nimport { DATA_TYPE } from \"../enums/data_type\";\n\nexport const compareExpectedAndRemoveUnnecessary = (expected, actual, isQuery) => {\n const result = {};\n for (const prop in expected) {\n if (isQuery === true && expected[prop] === DATA_TYPE.Number) {\n result[prop] = Number(actual[prop]);\n if (isNaN(result[prop]) === true) {\n return null;\n }\n }\n else {\n result[prop] = actual[prop];\n }\n if (expected[prop] !== getDataType(result[prop])) {\n return null;\n }\n }\n return result;\n};","export const getClassName = (target): string => {\n return target.name || (target.constructor && target.constructor.name);\n};","import { getDataType } from \"./get_data_type\";\nimport { DATA_TYPE } from \"../enums/data_type\";\n\nexport const removeMethodAndNullFromObject = (value: object) => {\n\n const outputValue = {};\n for (const prop in value) {\n const type = getDataType(value[prop]);\n if (!(value[prop] == null || type === DATA_TYPE.Function)) {\n outputValue[prop] = value[prop];\n }\n }\n\n return outputValue;\n};","import { MIME_TYPE } from \"../enums\";\nimport { ResultMapper } from \"../abstracts\";\n\nexport let getResultBasedOnMiMe: (type: MIME_TYPE, result, setMimeType?: (type) => void) => any;\n\nexport function setResultMapper(mapper: typeof ResultMapper) {\n if (mapper) {\n getResultBasedOnMiMe = (type, result, callBack) => {\n return new (mapper as any)().map(type, result, callBack);\n };\n }\n else {\n getResultBasedOnMiMe = (type, result, callBack) => {\n switch (type) {\n case MIME_TYPE.Json:\n case MIME_TYPE.Text:\n case MIME_TYPE.Html:\n case MIME_TYPE.Xml:\n if (typeof result === 'object' === true) {\n callBack(MIME_TYPE.Json);\n return JSON.stringify(result);\n }\n }\n return result;\n };\n }\n}","export * from './json_result';\nexport * from './text_result';\nexport * from './html_result';\nexport * from './render_view';\nexport * from './download_result';\nexport * from './file_result';\nexport * from './redirect_result';\nexport * from './view_result';\nexport * from './get_view_from_file';\nexport * from \"./promise\";\nexport * from './log_helper';\nexport * from \"./get_mime_type_from_extension\";\nexport * from \"./parse_match_route\";\nexport * from \"./parse_cookie\";\nexport * from './json_helper';\nexport * from './remove_last_slash';\nexport * from './remove_first_slash';\nexport * from './reverse_loop';\nexport * from './compar_expected_and_remove_unnecessary';\nexport * from './get_data_type';\nexport * from './get_class_name';\nexport * from './remove_method_and_null_from_object';\nexport * from './get_result_based_on_mime';","import { IException } from \"../interfaces\";\nimport { promise } from \"../helpers\";\n\nexport class ErrorHandler {\n onServerError(ex: IException): Promise {\n return promise((resolve, reject) => {\n let errMessage = `

internal server error

\n

message : ${ex.message}

`;\n if (ex.stack) {\n errMessage += `

stacktrace: ${ex.stack}

`;\n }\n if (ex.type) {\n errMessage += `

type: ${ex.type}

`;\n }\n resolve(errMessage);\n });\n }\n\n onBadRequest(ex: IException): Promise {\n return promise((resolve, reject) => {\n let errMessage = `

Bad Request

`;\n if (ex.message) {\n errMessage += `

message : ${ex.message}

`;\n }\n if (ex.stack) {\n errMessage += `

stacktrace: ${ex.stack}

`;\n }\n if (ex.type) {\n errMessage += `

type: ${ex.type}

`;\n }\n resolve(errMessage);\n });\n }\n\n onForbiddenRequest(): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

Forbidden

`;\n resolve(errMessage);\n });\n }\n\n onNotAcceptableRequest(): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

Not Acceptable

`;\n resolve(errMessage);\n });\n }\n\n onMethodNotAllowed(): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

Method Not allowed.

`;\n resolve(errMessage);\n });\n }\n\n onNotFound(url: string): Promise {\n return promise((resolve, reject) => {\n const errMessage = `

The requested resource ${url} was not found.

`;\n resolve(errMessage);\n });\n }\n}","import { IHttpCookie } from \"../interfaces\";\n\nexport class HttpCookie implements IHttpCookie {\n name: string;\n value: string;\n maxAge?: number;\n expires?: Date;\n domain?: string;\n httpOnly?: boolean;\n secure?: boolean;\n path?: string;\n\n constructor(name: string, value: string) {\n this.name = name;\n this.value = value;\n }\n}","import { FortGlobal } from \"./fort_global\";\n/* tslint:disable */\nexport const __ContentType = \"Content-Type\";\nexport const __AppName = \"fort\";\nexport const __Cookie = \"Cookie\";\nexport const __SetCookie = 'Set-Cookie';\nexport const __CurrentPath = process.cwd();\nexport const __ContentLength = \"Content-Length\";\nexport const __Constructor = \"const_constructor\";","import { __Constructor } from \"../constant\";\n\ntype InjectorStoreInfo = {\n className: string;\n methods: {\n [methodName: string]: any[]\n }\n};\n// this stores information of injector values that are available per class & worker\nconst injectorStoreInfos: InjectorStoreInfo[] = [];\n// this stores injector values\nconst injectorValues: any[] = [];\n// this stores the singletons name & their respective index in injector values\nconst singletons: {\n [className: string]: number\n} = {};\nexport class InjectorHandler {\n\n static addWorkerValue(className: string, methodName: string, paramIndex, paramValue, shouldFindIndex = true): number {\n\n if (shouldFindIndex === true) {\n const paramValueIndex = injectorValues.indexOf(paramValue);\n if (paramValueIndex < 0) {\n paramValue = injectorValues.push(paramValue) - 1;\n }\n else {\n paramValue = paramValueIndex;\n }\n }\n \n\n const savedValue = injectorStoreInfos.find(x => x.className === className);\n const value: InjectorStoreInfo = {\n className: className,\n methods: {\n [methodName]: []\n }\n };\n if (savedValue == null) {\n value.methods[methodName][paramIndex] = paramValue;\n injectorStoreInfos.push(value);\n }\n else {\n // const savedMethod = savedValue.methods[methodName];\n if (savedValue.methods[methodName] == null) {\n savedValue.methods[methodName] = [];\n }\n savedValue.methods[methodName][paramIndex] = paramValue;\n }\n\n return paramValue;\n }\n\n static getConstructorValues(className: string) {\n return this.getMethodValues(className, __Constructor);\n }\n\n static getMethodValues(className: string, methodName: string) {\n const savedValue = injectorStoreInfos.find(qry => qry.className === className);\n if (savedValue != null) {\n const methodArgs = savedValue.methods[methodName];\n if (methodArgs != null) {\n return methodArgs.map(injectorValueIndex => {\n return injectorValues[injectorValueIndex];\n });\n }\n }\n return [];\n }\n\n static addSingleton(className: string, methodName: string, paramIndex, paramValue) {\n const singletonClassName = paramValue.name;\n if (singletonClassName) {\n if (singletons[singletonClassName] == null) {\n singletons[singletonClassName] = InjectorHandler.addWorkerValue(className, methodName, paramIndex, new paramValue());\n }\n else {\n InjectorHandler.addWorkerValue(className, methodName, paramIndex, singletons[singletonClassName], false);\n }\n }\n }\n}","import { HTTP_STATUS_CODE, MIME_TYPE, HTTP_METHOD } from \"../enums\";\nimport * as http from \"http\";\nimport { __ContentType } from \"../constant\";\nimport { FortGlobal } from \"../fort_global\";\nimport * as Negotiator from \"negotiator\";\nimport { CookieManager } from \"../models\";\nimport { Wall } from \"../abstracts\";\nimport { IException } from \"../interfaces\";\nimport { JsonHelper, reverseLoop } from \"../helpers\";\nimport { isNull } from \"../utils\";\nimport { InjectorHandler } from \"./injector_handler\";\nimport { HttpResult, HttpFormatResult } from \"../types\";\n\n\nexport class RequestHandlerHelper {\n protected cookieManager: CookieManager;\n protected response: http.ServerResponse;\n protected request: http.IncomingMessage;\n\n protected wallInstances: Wall[] = [];\n\n protected controllerResult_: HttpResult | HttpFormatResult = {} as any;\n\n protected runWallOutgoing() {\n const outgoingResults: Array> = [];\n reverseLoop(this.wallInstances, (value: Wall) => {\n const methodArgsValues = InjectorHandler.getMethodValues(value.constructor.name, 'onOutgoing');\n methodArgsValues.shift();\n outgoingResults.push(value.onOutgoing(this.controllerResult_, ...methodArgsValues));\n });\n return Promise.all(outgoingResults);\n }\n\n protected getContentTypeFromNegotiation(type: MIME_TYPE) {\n const negotiator = new Negotiator(this.request);\n let availableTypes: MIME_TYPE[] = this.getAvailableTypes_(type);\n if (availableTypes == null) {\n availableTypes = [type];\n }\n return negotiator.mediaType(availableTypes) as MIME_TYPE;\n }\n\n protected getContentTypeFromNegotiationHavingMultipleTypes(types: MIME_TYPE[]) {\n const negotiator = new Negotiator(this.request);\n return negotiator.mediaType(types) as MIME_TYPE;\n }\n\n private getAvailableTypes_(type: MIME_TYPE) {\n switch (type) {\n case MIME_TYPE.Json:\n case MIME_TYPE.Xml:\n return [MIME_TYPE.Json, MIME_TYPE.Xml];\n case MIME_TYPE.Html:\n case MIME_TYPE.Css:\n case MIME_TYPE.Csv:\n case MIME_TYPE.Js:\n case MIME_TYPE.Rtf:\n case MIME_TYPE.Text:\n return [MIME_TYPE.Text, MIME_TYPE.Html, MIME_TYPE.Js,\n MIME_TYPE.Css, MIME_TYPE.Rtf, MIME_TYPE.Csv];\n }\n return null;\n }\n\n protected async onBadRequest(error) {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onBadRequest(error);\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.BadRequest, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onForbiddenRequest() {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onForbiddenRequest();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.Forbidden, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onNotAcceptableRequest() {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onNotAcceptableRequest();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.NotAcceptable, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onNotFound() {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onNotFound(this.request.url);\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.NotFound, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onMethodNotAllowed(allowedMethods: HTTP_METHOD[]) {\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onMethodNotAllowed();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.setHeader(\"Allow\", allowedMethods.join(\",\"));\n this.response.writeHead(HTTP_STATUS_CODE.MethodNotAllowed, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onErrorOccured(error) {\n if (typeof error === 'string') {\n error = {\n message: error\n } as IException;\n }\n let errMessage;\n try {\n await this.runWallOutgoing();\n errMessage = await new FortGlobal.errorHandler().onServerError(error);\n }\n catch (ex) {\n errMessage = JsonHelper.stringify(ex);\n }\n this.response.writeHead(HTTP_STATUS_CODE.InternalServerError, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(errMessage);\n }\n\n protected async onRequestOptions(allowedMethods: HTTP_METHOD[]) {\n try {\n await this.runWallOutgoing();\n }\n catch (ex) {\n return this.onErrorOccured(ex);\n }\n this.response.setHeader(\"Allow\", allowedMethods.join(\",\"));\n this.response.writeHead(HTTP_STATUS_CODE.Ok, { [__ContentType]: MIME_TYPE.Html });\n this.response.end(\"\");\n }\n}","import { HTTP_STATUS_CODE, MIME_TYPE, ETag_Type } from \"../enums\";\nimport { FortGlobal } from \"../fort_global\";\nimport * as path from \"path\";\nimport { __ContentType } from \"../constant\";\nimport { RequestHandlerHelper } from \"./request_handler_helper\";\nimport * as Fs from \"fs\";\nimport { getMimeTypeFromExtension, promise } from \"../helpers\";\nimport * as etag from \"etag\";\nimport * as fresh from \"fresh\";\nimport { isNullOrEmpty } from \"../utils\";\n\ntype FileInfo = {\n folder: string,\n file: string;\n};\nexport class FileHandler extends RequestHandlerHelper {\n\n private getFileInfoFromUrl_(urlPath: string) {\n const splittedValue = urlPath.split(\"/\");\n const fileInfo = {\n file: \"\"\n } as FileInfo;\n if (splittedValue.length > 2 || !isNullOrEmpty(path.parse(urlPath).ext)) {\n fileInfo.folder = splittedValue[1];\n fileInfo.file = splittedValue.splice(2).join(\"/\");\n return fileInfo;\n }\n fileInfo.folder = splittedValue[1];\n return fileInfo;\n\n }\n\n private getFileStats_(filePath) {\n return promise((res, rej) => {\n Fs.lstat(filePath, (err, status) => {\n if (err) {\n if (err.code === 'ENOENT') {\n res(null);\n }\n else {\n rej(err);\n }\n }\n else {\n res(status);\n }\n });\n });\n }\n\n protected handleFileRequestFromAbsolutePath(absolutePath: string, fileType: string) {\n this.getFileStats_(absolutePath).then(fileInfo => {\n if (fileInfo != null) {\n if (fileInfo.isDirectory() === true) {\n this.handleFileRequestForFolderPath_(absolutePath);\n }\n else {\n this.sendFile_(absolutePath, fileType, fileInfo);\n }\n }\n else {\n this.onNotFound();\n }\n }).catch(ex => {\n this.onErrorOccured(ex);\n });\n }\n\n private checkForFolderAllowAndReturnPath_(urlPath: string) {\n const fileInfo = this.getFileInfoFromUrl_(urlPath);\n const getAbsPath = function () {\n const folder = FortGlobal.folders.find(qry => qry.alias === fileInfo.folder);\n if (folder != null) {\n return path.join(folder.path, fileInfo.file);\n }\n return null;\n };\n let absPath = getAbsPath();\n if (absPath == null) {\n fileInfo.folder = \"/\";\n fileInfo.file = urlPath;\n absPath = getAbsPath();\n }\n return absPath;\n }\n\n protected handleFileRequest(urlPath: string) {\n const extension = path.parse(urlPath).ext;\n const absFilePath = this.checkForFolderAllowAndReturnPath_(urlPath);\n if (absFilePath != null) {\n this.handleFileRequestFromAbsolutePath(absFilePath, extension);\n }\n else {\n this.onNotFound();\n }\n }\n\n /**\n * process folders handling asuuming path is folder.\n * Please check whether the file is folder before calling this function\n *\n * @private\n * @param {string} filePath\n * @param {Fs.Stats} fileInfo\n * @returns\n * @memberof FileHandler\n */\n private handleFileRequestForFolderPath_(absolutePath: string) {\n absolutePath = path.join(absolutePath, \"index.html\");\n this.getFileStats_(absolutePath).then(fileInfo => {\n if (fileInfo != null) {\n const fileType = MIME_TYPE.Html;\n this.sendFile_(absolutePath, fileType, fileInfo);\n }\n else {\n this.onNotFound();\n }\n }).catch(this.onErrorOccured.bind(this));\n }\n\n private isClientHasFreshFile_(lastModified: string, etagValue: string) {\n return fresh(this.request.headers, {\n 'etag': etagValue,\n 'last-modified': lastModified\n });\n }\n\n private sendFileAsResponse_(filePath: string, mimeType: MIME_TYPE) {\n this.response.writeHead(HTTP_STATUS_CODE.Ok, {\n [__ContentType]: mimeType\n });\n const readStream = Fs.createReadStream(filePath);\n // Handle non-existent file\n readStream.on('error', this.onErrorOccured.bind(this));\n readStream.on('open', () => {\n readStream.pipe(this.response);\n });\n }\n\n private getMimeTypeFromFileType_(fileType: string) {\n return fileType[0] === '.' ? getMimeTypeFromExtension(fileType) :\n fileType as MIME_TYPE;\n }\n\n sendFile_: (filePath: string, fileType: string, fileInfo: Fs.Stats) => any;\n}\n\nif (FortGlobal.isProduction) {\n FileHandler.prototype.sendFile_ = function (filePath: string, fileType: string, fileInfo: Fs.Stats) {\n this.runWallOutgoing().then(() => {\n const lastModified = fileInfo.mtime.toUTCString();\n const eTagValue = etag(fileInfo, {\n weak: FortGlobal.eTag.type === ETag_Type.Weak\n });\n if (this.isClientHasFreshFile_(lastModified, eTagValue)) { // client has fresh file\n this.response.statusCode = HTTP_STATUS_CODE.NotModified;\n this.response.end();\n }\n else {\n this.response.setHeader('Etag', eTagValue);\n this.response.setHeader('Last-Modified', lastModified);\n this.sendFileAsResponse_(filePath, this.getMimeTypeFromFileType_(fileType));\n }\n }).catch(this.onErrorOccured.bind(this));\n };\n}\nelse {\n FileHandler.prototype.sendFile_ = function (filePath: string, fileType: string, fileInfo: Fs.Stats) {\n this.runWallOutgoing().then(() => {\n this.sendFileAsResponse_(filePath, this.getMimeTypeFromFileType_(fileType));\n }).catch(this.onErrorOccured.bind(this));\n };\n}","\nimport { HttpResult, HttpFormatResult } from \"../types\";\nimport { __SetCookie, __ContentType } from \"../constant\";\nimport { MIME_TYPE, HTTP_STATUS_CODE } from \"../enums\";\nimport { FileHandler } from \"./file_handler\";\nimport * as path from 'path';\nimport { textResult, getResultBasedOnMiMe } from \"../helpers\";\n\nexport class ControllerResultHandler extends FileHandler {\n\n\n private endResponse_(negotiateMimeType: MIME_TYPE) {\n let data;\n try {\n data = getResultBasedOnMiMe(negotiateMimeType,\n (this.controllerResult_ as HttpResult).responseData\n , (type: MIME_TYPE) => {\n negotiateMimeType = type;\n }\n );\n }\n catch (ex) {\n this.onErrorOccured(ex);\n return;\n }\n\n this.response.writeHead(this.controllerResult_.statusCode || HTTP_STATUS_CODE.Ok,\n { [__ContentType]: negotiateMimeType });\n this.response.end(data);\n }\n\n private handleRedirectResult_() {\n // this.response.setHeader('Location', this.controllerResult_.responseData);\n this.response.writeHead(this.controllerResult_.statusCode || HTTP_STATUS_CODE.Ok,\n { 'Location': (this.controllerResult_ as HttpResult).responseData });\n this.response.end();\n }\n\n private handleFormatResult_() {\n const negotiateMimeType = this.getContentTypeFromNegotiationHavingMultipleTypes(Object.keys((this.controllerResult_ as HttpFormatResult).responseFormat) as MIME_TYPE[]);\n const key = Object.keys((this.controllerResult_ as HttpFormatResult).responseFormat).find(qry => qry === negotiateMimeType);\n if (key != null) {\n (this.controllerResult_ as HttpResult).responseData = (this.controllerResult_ as HttpFormatResult).responseFormat[key]();\n this.endResponse_(negotiateMimeType);\n }\n else {\n this.onNotAcceptableRequest();\n }\n }\n\n private handleFileResult_() {\n const result = this.controllerResult_ as HttpResult;\n const parsedPath = path.parse(result.file.filePath);\n if (result.file.shouldDownload === true) {\n const fileName = result.file.alias == null ? parsedPath.name : result.file.alias;\n this.response.setHeader(\n \"content-disposition\",\n `attachment;filename=${fileName}${parsedPath.ext}`\n );\n }\n this.handleFileRequestFromAbsolutePath(result.file.filePath, parsedPath.ext);\n }\n\n onTerminationFromWall(result: HttpResult | HttpFormatResult) {\n this.controllerResult_ = result;\n this.handleFinalResult_();\n }\n\n private handleFinalResult_() {\n const result = this.controllerResult_;\n ((this.cookieManager as any).responseCookie_ as string[]).forEach(value => {\n this.response.setHeader(__SetCookie, value);\n });\n\n if ((result as HttpResult).shouldRedirect === true) {\n this.handleRedirectResult_();\n }\n else {\n if ((result as HttpFormatResult).responseFormat == null) {\n if ((result as HttpResult).file == null) {\n const contentType = (result as HttpResult).contentType || MIME_TYPE.Text;\n const negotiateMimeType = this.getContentTypeFromNegotiation(contentType) as MIME_TYPE;\n if (negotiateMimeType != null) {\n this.endResponse_(negotiateMimeType);\n }\n else {\n this.onNotAcceptableRequest();\n }\n }\n else {\n this.handleFileResult_();\n }\n }\n else {\n this.handleFormatResult_();\n }\n }\n }\n\n\n async onResultFromController(result: HttpResult | HttpFormatResult) {\n this.controllerResult_ = result || textResult(\"\");\n try {\n await this.runWallOutgoing();\n } catch (ex) {\n this.onErrorOccured(ex);\n return;\n }\n this.handleFinalResult_();\n }\n}","import { ControllerResultHandler } from \"./controller_result_handler\";\nimport { promise, JsonHelper } from \"../helpers\";\nimport { __ContentType } from \"../constant\";\nimport { MIME_TYPE } from \"../enums\";\nimport * as ContentType from \"content-type\";\nimport * as QueryString from 'querystring';\nimport * as Multiparty from \"multiparty\";\nimport { MultiPartParseResult } from \"../types\";\nimport { FileManager } from \"../models\";\nimport { FortGlobal } from \"../fort_global\";\n\n\nexport class PostHandler extends ControllerResultHandler {\n protected body: any;\n protected file: FileManager;\n\n private getPostRawData_(): Promise {\n const body = [];\n return promise((res, rej) => {\n this.request.on('data', (chunk) => {\n body.push(chunk);\n }).on('end', () => {\n const bodyBuffer = Buffer.concat(body);\n res(bodyBuffer.toString());\n }).on(\"error\", function (err) {\n rej(err);\n });\n });\n }\n\n private parseMultiPartData_(): Promise {\n return promise((res, rej) => {\n new Multiparty.Form().parse(this.request, (err, fields, files) => {\n if (err) {\n rej(err);\n }\n else {\n const result: MultiPartParseResult = {\n field: {},\n file: {}\n };\n for (const field in fields) {\n result.field[field] = fields[field].length === 1 ? fields[field][0] : fields[field];\n }\n for (const file in files) {\n result.file[file] = files[file].length === 1 ? files[file][0] : files[file];\n }\n res(result);\n }\n });\n });\n }\n\n protected async parsePostData() {\n\n let postData;\n\n let contentType = this.request.headers[__ContentType] || this.request.headers[\"content-type\"];\n if (contentType != null) {\n contentType = ContentType.parse(contentType as string).type;\n }\n if (contentType === MIME_TYPE.FormMultiPart) {\n const result = await this.parseMultiPartData_();\n postData = result.field;\n this.file = new FileManager(result.file);\n }\n else {\n this.file = new FileManager({});\n const bodyDataAsString = await this.getPostRawData_();\n switch (contentType) {\n case MIME_TYPE.Json:\n postData = JsonHelper.parse(bodyDataAsString);\n break;\n case MIME_TYPE.Text:\n case MIME_TYPE.Html:\n postData = bodyDataAsString; break;\n case MIME_TYPE.FormUrlEncoded:\n postData = QueryString.parse(bodyDataAsString); break;\n case MIME_TYPE.Xml:\n postData = new (FortGlobal as any).xmlParser().parse(bodyDataAsString);\n break;\n default:\n postData = {};\n }\n }\n\n return postData;\n\n }\n}","import * as http from \"http\";\nimport * as url from 'url';\nimport { Controller } from \"../abstracts\";\nimport { __ContentType, __AppName, __Cookie, __SetCookie } from \"../constant\";\nimport { FortGlobal } from \"../fort_global\";\nimport { parseCookie, parseAndMatchRoute, promise, compareExpectedAndRemoveUnnecessary } from \"../helpers\";\nimport { CookieManager, FileManager } from \"../models\";\nimport { GenericSessionProvider, GenericGuard } from \"../generics\";\nimport { RouteMatch, HttpRequest, HttpResponse } from \"../types\";\nimport { HTTP_METHOD } from \"../enums\";\nimport { PostHandler } from \"./post_handler\";\nimport { InjectorHandler } from \"./injector_handler\";\nimport { RouteHandler } from \"./route_handler\";\nimport { IException } from \"../interfaces\";\n\n\nexport class RequestHandler extends PostHandler {\n\n private session_: GenericSessionProvider;\n private query_: any;\n private data_ = {};\n private routeMatchInfo_: RouteMatch;\n\n\n constructor(request: http.IncomingMessage, response: http.ServerResponse) {\n super();\n this.request = request;\n this.response = response;\n this.registerEvents_();\n }\n\n private registerEvents_() {\n this.request.on('error', this.onBadRequest.bind(this));\n this.response.on('error', this.onErrorOccured.bind(this));\n }\n\n private executeWallIncoming_(): Promise {\n return promise((res) => {\n let index = 0;\n const wallLength = FortGlobal.walls.length;\n const executeWallIncomingByIndex = async () => {\n if (wallLength > index) {\n const wall = FortGlobal.walls[index++];\n const constructorArgsValues = InjectorHandler.getConstructorValues(wall.name);\n const wallObj = new wall(...constructorArgsValues);\n wallObj.cookie = this.cookieManager;\n wallObj.session = this.session_;\n wallObj.request = this.request as HttpRequest;\n wallObj.response = this.response as HttpResponse;\n wallObj.data = this.data_;\n wallObj.query = this.query_;\n\n this.wallInstances.push(wallObj);\n const methodArgsValues = InjectorHandler.getMethodValues(wall.name, 'onIncoming');\n try {\n const result = await wallObj.onIncoming(...methodArgsValues);\n if (result == null) {\n executeWallIncomingByIndex();\n }\n else {\n res(false);\n this.onTerminationFromWall(result);\n }\n } catch (ex) {\n this.onErrorOccured(ex);\n res(false);\n }\n }\n else {\n res(true);\n }\n };\n executeWallIncomingByIndex();\n });\n }\n\n runController_;\n\n private executeShieldsProtection_(): Promise {\n return promise((res) => {\n let index = 0;\n const shieldLength = this.routeMatchInfo_.shields.length;\n const executeShieldByIndex = async () => {\n if (shieldLength > index) {\n const shield = this.routeMatchInfo_.shields[index++];\n const constructorArgsValues = InjectorHandler.getConstructorValues(shield.name);\n const shieldObj = new shield(...constructorArgsValues);\n shieldObj.cookie = this.cookieManager;\n shieldObj.query = this.query_;\n shieldObj.session = this.session_;\n shieldObj.request = this.request as HttpRequest;\n shieldObj.response = this.response as HttpResponse;\n shieldObj.data = this.data_;\n shieldObj.workerName = this.routeMatchInfo_.workerInfo.workerName;\n\n const methodArgsValues = InjectorHandler.getMethodValues(shield.name, 'protect');\n\n try {\n const result = await shieldObj.protect(...methodArgsValues);\n if (result == null) {\n executeShieldByIndex();\n }\n else {\n res(false);\n this.onResultFromController(result);\n }\n } catch (ex) {\n this.onErrorOccured(ex);\n res(false);\n }\n }\n else {\n res(true);\n }\n };\n executeShieldByIndex();\n });\n }\n\n private executeGuardsCheck_(guards: Array): Promise {\n return promise((res) => {\n let index = 0;\n const shieldLength = guards.length;\n const executeGuardByIndex = async () => {\n if (shieldLength > index) {\n const guard = guards[index++];\n const constructorArgsValues = InjectorHandler.getConstructorValues(guard.name);\n const guardObj = new guard(...constructorArgsValues);\n guardObj.body = this.body;\n guardObj.cookie = this.cookieManager;\n guardObj.query = this.query_;\n guardObj.session = this.session_;\n guardObj.request = this.request as HttpRequest;\n guardObj.response = this.response as HttpResponse;\n guardObj.data = this.data_;\n guardObj.file = this.file;\n guardObj.param = this.routeMatchInfo_.params;\n\n const methodArgsValues = InjectorHandler.getMethodValues(guard.name, 'check');\n try {\n const result = await guardObj.check(...methodArgsValues);\n if (result == null) {\n executeGuardByIndex();\n }\n else {\n res(false);\n this.onResultFromController(result);\n }\n } catch (ex) {\n this.onErrorOccured(ex);\n res(false);\n }\n }\n else {\n res(true);\n }\n };\n executeGuardByIndex();\n });\n }\n\n private parseCookieFromRequest_() {\n if (FortGlobal.shouldParseCookie === true) {\n const rawCookie = (this.request.headers[__Cookie] || this.request.headers[\"cookie\"]) as string;\n let parsedCookies;\n try {\n parsedCookies = parseCookie(rawCookie);\n } catch (ex) {\n this.onErrorOccured(ex);\n return false;\n }\n this.session_ = new FortGlobal.sessionProvider();\n this.session_.cookie = this.cookieManager = new CookieManager(parsedCookies);\n this.session_.sessionId = parsedCookies[FortGlobal.appSessionIdentifier];\n }\n else {\n this.cookieManager = new CookieManager({});\n }\n return true;\n }\n\n private setPreHeader_() {\n this.response.setHeader('X-Powered-By', FortGlobal.appName);\n this.response.setHeader('Vary', 'Accept-Encoding');\n this.response.sendDate = true;\n }\n\n private checkExpectedQuery_() {\n const expectedQuery = RouteHandler.getExpectedQuery(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName);\n if (expectedQuery != null) {\n this.query_ = compareExpectedAndRemoveUnnecessary(expectedQuery, this.query_, true);\n }\n }\n\n private checkExpectedBody_() {\n const expectedBody = RouteHandler.getExpectedBody(this.routeMatchInfo_.controllerName, this.routeMatchInfo_.workerInfo.workerName);\n if (expectedBody != null) {\n this.body = compareExpectedAndRemoveUnnecessary(expectedBody, this.body, false);\n }\n }\n\n private async onRouteMatched_() {\n const actionInfo = this.routeMatchInfo_.workerInfo;\n if (actionInfo == null) {\n if (this.request.method === HTTP_METHOD.Options) {\n this.onRequestOptions(this.routeMatchInfo_.allowedHttpMethod);\n }\n else {\n this.onMethodNotAllowed(this.routeMatchInfo_.allowedHttpMethod);\n }\n }\n else {\n this.checkExpectedQuery_();\n if (this.query_ == null) {\n this.onBadRequest({\n message: \"Bad query string data - query string data does not match with expected value\"\n } as IException);\n return;\n }\n let shouldExecuteNextComponent = await this.executeShieldsProtection_();\n if (shouldExecuteNextComponent === true) {\n shouldExecuteNextComponent = await this.handlePostData();\n if (shouldExecuteNextComponent === true) {\n this.checkExpectedBody_();\n if (this.body == null) {\n this.onBadRequest({\n message: \"Bad body data - body data does not match with expected value\"\n } as IException);\n return;\n }\n shouldExecuteNextComponent = await this.executeGuardsCheck_(actionInfo.guards);\n if (shouldExecuteNextComponent === true) {\n this.runController_();\n }\n }\n }\n }\n }\n\n private async execute_() {\n const urlDetail = url.parse(this.request.url, true);\n this.query_ = urlDetail.query;\n let shouldExecuteNextProcess = this.parseCookieFromRequest_();\n if (shouldExecuteNextProcess === true) {\n shouldExecuteNextProcess = await this.executeWallIncoming_();\n if (shouldExecuteNextProcess === true) {\n const pathUrl = urlDetail.pathname;\n const requestMethod = this.request.method as HTTP_METHOD;\n try {\n this.routeMatchInfo_ = parseAndMatchRoute(pathUrl.toLowerCase(), requestMethod);\n }\n catch (ex) {\n this.onErrorOccured(ex);\n return;\n }\n if (this.routeMatchInfo_ == null) { // no route matched\n // it may be a file or folder then\n this.handleFileRequest(pathUrl);\n }\n else {\n this.onRouteMatched_();\n }\n }\n }\n }\n\n async handlePostData() {\n if (this.request.method === HTTP_METHOD.Get) {\n this.body = {};\n this.file = new FileManager({});\n }\n else if (FortGlobal.shouldParsePost === true) {\n try {\n this.body = await this.parsePostData();\n } catch (ex) {\n this.onBadRequest(ex);\n return false;\n }\n }\n return true;\n }\n\n async handle() {\n this.setPreHeader_();\n this.execute_();\n }\n\n setControllerProps_() {\n const constructorValues = InjectorHandler.getConstructorValues(this.routeMatchInfo_.controller.name);\n const controllerObj: Controller = new this.routeMatchInfo_.controller(...constructorValues);\n controllerObj.request = this.request as HttpRequest;\n controllerObj.response = this.response;\n controllerObj.query = this.query_;\n controllerObj.body = this.body;\n controllerObj.session = this.session_;\n controllerObj.cookie = this.cookieManager;\n controllerObj.param = this.routeMatchInfo_.params;\n controllerObj.data = this.data_;\n controllerObj.file = this.file;\n const methodArgsValues = InjectorHandler.getMethodValues(this.routeMatchInfo_.controller.name, this.routeMatchInfo_.workerInfo.workerName);\n return controllerObj[this.routeMatchInfo_.workerInfo.workerName](...methodArgsValues);\n }\n}\nif (FortGlobal.isProduction) {\n RequestHandler.prototype.runController_ = function () {\n this.setControllerProps_().then(\n this.onResultFromController.bind(this)\n ).catch(this.onErrorOccured.bind(this));\n };\n}\nelse {\n RequestHandler.prototype.runController_ = function () {\n const result = this.setControllerProps_();\n if (Promise.resolve(result) !== result) {\n this.onErrorOccured({\n message: \"Wrong implementation - worker does not return promise\"\n } as IException);\n }\n else {\n result.then(\n this.onResultFromController.bind(this)\n ).catch(this.onErrorOccured.bind(this));\n }\n };\n}","export * from \"./route_handler\";\nexport * from \"./request_handler\";\nexport * from \"./file_handler\";\nexport * from \"./request_handler_helper\";\nexport * from \"./controller_result_handler\";\nexport * from \"./post_handler\";\nexport * from './injector_handler';","import * as Mustache from \"mustache\";\nimport { ViewEngineData } from \"../types\";\nimport { getViewFromFile } from \"../helpers\";\nimport { ViewEngine } from \"../abstracts\";\n\nexport class MustacheViewEngine implements ViewEngine {\n\n async render(value: ViewEngineData) {\n const viewData = await getViewFromFile({\n fileLocation: value.view\n });\n return Mustache.render(viewData, value.model);\n }\n}","import { CookieManager } from \"../models\";\nimport * as getUniqId from \"uniqid\";\nimport { FortGlobal } from \"../fort_global\";\nimport { SessionValue } from \"../types\";\n\nexport abstract class SessionProvider {\n\n sessionId: string;\n protected cookie: CookieManager;\n\n abstract get(key: string): Promise;\n abstract isExist(key: string): Promise;\n abstract getAll(): Promise<{ [key: string]: any }>;\n abstract set(key: string, val: any): Promise;\n abstract setMany(values: { [key: string]: any }): Promise;\n abstract remove(key: string): Promise;\n\n abstract clear(): Promise;\n\n protected createSession(sessionId?) {\n const now = new Date();\n this.sessionId = sessionId != null ? sessionId : getUniqId();\n this.cookie.addCookie({\n name: FortGlobal.appSessionIdentifier,\n value: this.sessionId,\n httpOnly: true,\n path: \"/\",\n expires: new Date(now.setMinutes(now.getMinutes() + FortGlobal.sessionTimeOut)),\n maxAge: FortGlobal.sessionTimeOut * 60\n });\n }\n\n protected destroySession() {\n const cookie = this.cookie.getCookie(FortGlobal.appSessionIdentifier);\n cookie.httpOnly = true;\n cookie.path = \"/\";\n this.cookie.removeCookie(cookie);\n }\n}\n\n","import { SessionProvider } from \"../abstracts/session_provider\";\n\nconst sessionValues: { [identifier: string]: any } = {};\n\nexport class MemorySessionProvider extends SessionProvider {\n\n async get(key: string) {\n const savedSession = sessionValues[this.sessionId];\n return savedSession != null ? savedSession[key] : null;\n }\n\n async isExist(key: string) {\n const savedValue = sessionValues[this.sessionId];\n return savedValue == null ? false : savedValue[key] != null;\n }\n\n async getAll() {\n const savedValue = sessionValues[this.sessionId];\n return savedValue == null ? {} : savedValue;\n }\n\n async set(key: string, val: any) {\n const savedValue = sessionValues[this.sessionId];\n if (savedValue == null) {\n this.createSession();\n sessionValues[this.sessionId] = {\n [key]: val\n };\n }\n else {\n savedValue[key] = val;\n }\n }\n\n setMany(values: { [key: string]: any }) {\n return Promise.all(\n Object.keys(values).map((key) => {\n return this.set(key, values[key]);\n })\n );\n }\n\n async remove(key: string) {\n const savedValue = sessionValues[this.sessionId];\n if (savedValue != null) {\n savedValue[key] = null;\n }\n }\n\n async clear() {\n // remove session values\n delete sessionValues[this.sessionId];\n // expire cookie in browser\n this.destroySession();\n }\n}","export * from './mustache_view_engine';\nexport * from \"./memory_session_provider\";","import { HttpResponse } from \"../types\";\n\nexport class HttpResponseStub implements HttpResponse {\n private headers_;\n constructor(headers) {\n this.headers_ = headers;\n }\n\n getHeader(name: string) {\n return this.headers_[name];\n }\n\n\n hasHeader(name: string) {\n return this.headers_[name] != null;\n }\n\n setHeader(name: string, value: number | string | string[]) {\n this.headers_[name] = value;\n }\n\n getHeaders() {\n return this.headers_;\n }\n\n getHeaderNames(): string[] {\n return Object.keys[this.headers_];\n }\n\n removeHeader(name: string) {\n delete this.headers_[name];\n }\n}","import { HttpRequest } from \"../types\";\n\nexport class HttpRequestStub implements HttpRequest {\n headers;\n\n constructor(headers) {\n this.headers = headers;\n }\n}","\nimport { CookieManager, FileManager } from \"../models\";\nimport { FortGlobal } from \"../fort_global\";\nimport { ControllerTestData } from \"../types\";\nimport { HttpResponseStub } from \"./http_response_stub\";\nimport { HttpRequestStub } from \"./http_request_stub\";\nimport { Controller } from \"../abstracts\";\n\n\n\nexport const initController = (controllerInstance: Controller, data?: ControllerTestData) => {\n data = data || {};\n const parsedCookies = data.cookieValue || {};\n const headers = (data.request && data.request.headers) || {};\n controllerInstance.request = new HttpRequestStub(headers);\n controllerInstance.response = new HttpResponseStub(headers);\n controllerInstance.query = data.query || {};\n controllerInstance.body = data.body || {};\n controllerInstance.cookie = new CookieManager(parsedCookies);\n const session = new FortGlobal.sessionProvider();\n session.cookie = controllerInstance.cookie;\n session.sessionId = parsedCookies[FortGlobal.appSessionIdentifier];\n controllerInstance.session = session;\n controllerInstance.param = data.param || {};\n controllerInstance.data = data.data || {};\n controllerInstance.file = new FileManager(data.file || {});\n return controllerInstance;\n};","\nimport { initController } from \"./init_controller\";\nimport { ControllerTestData } from \"../types\";\n\nexport type GuardTestData = ControllerTestData;\n\nexport const initGuard = (guardInstance, data?: GuardTestData) => {\n return initController(guardInstance, data);\n};","\nimport { initController } from \"./init_controller\";\nimport { ControllerTestData } from \"../types\";\n\nexport type ShieldTestData = ControllerTestData & {\n workerName?: string;\n};\n\nexport const initShield = (shieldInstance, data?: ShieldTestData) => {\n const value: ShieldTestData = initController(shieldInstance, data) as any;\n value.workerName = data && data.workerName;\n return value;\n};","\nimport { initController } from \"./init_controller\";\nimport { ControllerTestData } from \"../types\";\n\nexport type WallTestData = ControllerTestData;\n\nexport const initWall = (wallInstance, data?: WallTestData) => {\n return initController(wallInstance, data);\n};","export * from './init_controller';\nexport * from './init_guard';\nexport * from './init_shield';\nexport * from './init_wall';","import { HttpRequest, HttpResponse, ControllerTestData } from \"../types\";\nimport { CookieManager, FileManager, Logger } from \"../models\";\nimport { SessionProvider } from \".\";\nimport { initController } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\n\nexport abstract class Controller {\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: any };\n body?: { [key: string]: any };\n session: SessionProvider;\n cookie: CookieManager;\n param?: { [key: string]: string };\n data: { [key: string]: any };\n\n file?: FileManager;\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n constructor(...args) {\n\n }\n\n initialize(data?: ControllerTestData) {\n initController(this, data);\n }\n}","import { HttpRequest, HttpResponse, HttpResult } from \"../types\";\nimport { CookieManager, Logger } from \"../models\";\nimport { SessionProvider, Controller } from \".\";\nimport { ShieldTestData, initShield } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\nexport abstract class Shield implements Controller {\n workerName: string;\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: any };\n\n session: SessionProvider;\n cookie: CookieManager;\n\n data: { [key: string]: any };\n\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n abstract protect(...args): Promise;\n\n constructor(...args) {\n\n }\n\n initialize(data?: ShieldTestData) {\n return initShield(this, data);\n }\n}\n\n","import { HttpRequest, HttpResponse, HttpResult } from \"../types\";\nimport { CookieManager, FileManager, Logger } from \"../models\";\nimport { Controller } from \"./controller\";\nimport { SessionProvider } from \"./session_provider\";\nimport { GuardTestData, initGuard } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\nexport abstract class Guard implements Controller {\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: any };\n body: { [key: string]: any };\n session: SessionProvider;\n cookie: CookieManager;\n param?: { [key: string]: string };\n data: { [key: string]: any };\n file: FileManager;\n abstract check(...args): Promise;\n\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n constructor(...args) {\n\n }\n\n initialize(data?: GuardTestData) {\n return initGuard(this, data);\n }\n}","import { ViewEngineData } from \"../types\";\n\nexport abstract class ViewEngine {\n abstract render(value: ViewEngineData): Promise;\n}","import { HttpRequest, HttpResponse, HttpResult, HttpFormatResult } from \"../types\";\nimport { CookieManager, Logger } from \"../models\";\nimport { Controller } from \"./controller\";\nimport { SessionProvider } from \"./session_provider\";\nimport { WallTestData, initWall } from \"../test_helpers\";\nimport { FortGlobal } from \"../fort_global\";\n\nexport abstract class Wall implements Controller {\n request: HttpRequest;\n response: HttpResponse;\n query: { [key: string]: string };\n session: SessionProvider;\n cookie: CookieManager;\n\n data: { [key: string]: any };\n\n get logger(): Logger {\n return FortGlobal.logger;\n }\n\n abstract onIncoming(...args): Promise;\n\n async onOutgoing(finalResult: HttpResult | HttpFormatResult, ...args) {\n return null;\n }\n\n constructor(...args) {\n\n }\n\n initialize(data?: WallTestData) {\n return initWall(this, data);\n }\n}","export abstract class XmlParser {\n abstract async parse(xml: string): Promise;\n}","import { MIME_TYPE } from \"../enums\";\n\nexport abstract class ResultMapper {\n abstract map(type: MIME_TYPE, result, setMimeType?: (type) => void): any;\n}","export * from './controller';\nexport * from './shield';\nexport * from './session_provider';\nexport * from './guard';\nexport * from './view_engine';\nexport * from './wall';\nexport * from \"./xml_parser\";\nexport * from './result_mapper';","import { Guard } from \"../abstracts\";\nimport { HttpResult } from \"../types\";\n\nexport class GenericGuard extends Guard {\n\n constructor(...args) {\n super();\n }\n\n check(...args): Promise {\n return null;\n }\n}","import { Shield } from \"../abstracts\";\nimport { HttpResult } from \"../types\";\n\nexport class GenericShield extends Shield {\n constructor(...args) {\n super();\n }\n \n protect(...args): Promise {\n return null;\n }\n}","import { SessionProvider } from \"../abstracts\";\nimport { SessionValue } from \"../types\";\nimport { CookieManager } from \"../models\";\n\n\nexport class GenericSessionProvider extends SessionProvider {\n sessionId: string;\n\n cookie: CookieManager;\n get() {\n return null;\n }\n\n getAll() {\n return null;\n }\n\n set(key, value) {\n return null;\n }\n\n isExist(key) {\n return null;\n }\n\n remove(key) {\n return null;\n }\n\n setMany(values: SessionValue[]): Promise {\n return null;\n }\n\n async clear() {\n\n }\n}","import { Wall } from \"../abstracts\";\nimport { HttpResult } from \"../types\";\n\nexport class GenericWall extends Wall {\n constructor(...args) {\n super();\n }\n onIncoming(...args): Promise {\n return null;\n }\n}","import { Controller } from \"../abstracts\";\n\nexport class GenericController extends Controller {\n constructor(...args) {\n super();\n }\n}","import { XmlParser } from \"../abstracts\";\nimport { IException } from \"../interfaces\";\n\nexport class GenericXmlParser implements XmlParser {\n async parse(xml: string): Promise {\n // tslint:disable-next-line\n throw {\n message: \"no xml parser configured\"\n } as IException;\n }\n}","export * from './generic_guard';\nexport * from './generic_shield';\nexport * from './generic_session_provider';\nexport * from \"./generic_wall\";\nexport * from \"./generic_controller\";\nexport * from './generic_xml_parser';","export class Logger {\n info?(...args) {\n this.debug(args);\n }\n error?(...args) {\n this.debug(args);\n }\n log?(...args) {\n this.debug(args);\n }\n debug?(...args) {\n console.log(...args);\n }\n}","import { ParentRoute, AppOption, EtagOption } from \"../types\";\nimport { Wall, ViewEngine, SessionProvider, XmlParser, ResultMapper } from \"../abstracts\";\nimport { RouteHandler, RequestHandler } from \"../handlers\";\nimport { FortGlobal } from \"../fort_global\";\nimport { MemorySessionProvider, MustacheViewEngine } from \"../extra\";\nimport { ErrorHandler } from \".\";\nimport { __AppName, __CurrentPath } from \"../constant\";\nimport * as http from \"http\";\nimport { ETag_Type, ERROR_TYPE } from \"../enums\";\nimport { LogHelper, promise, removeLastSlash, removeFirstSlash, setResultMapper } from \"../helpers\";\nimport { GenericSessionProvider, GenericXmlParser, GenericController } from \"../generics\";\nimport { isNull, isNullOrEmpty, isArray } from \"../utils\";\nimport { Logger } from \"./logger\";\nimport * as path from \"path\";\n\nexport class Fort {\n\n logger: Logger;\n routes: ParentRoute[] = [];\n walls: Array = [];\n httpServer: http.Server;\n\n /**\n * view engine use to render the view\n *\n * @type {typeof ViewEngine}\n * @memberof Fort\n */\n viewEngine?: typeof ViewEngine;\n\n /**\n * sessionProvider class, default - MemorySessionProvider\n *\n * @type {typeof SessionProvider}\n */\n sessionProvider?: typeof SessionProvider;\n\n /**\n * Custom error handler class\n *\n * @type {typeof ErrorHandler}\n */\n errorHandler?: typeof ErrorHandler;\n\n /**\n * XmlParser class - used to parse the xml \n *\n * @type {typeof XmlParser}\n * @memberof Fort\n */\n xmlParser?: typeof XmlParser;\n\n resultMapper?: typeof ResultMapper;\n\n private saveAppOption_(option: AppOption) {\n const defaultEtagConfig = {\n type: ETag_Type.Weak\n } as EtagOption;\n\n FortGlobal.port = option.port == null ? 4000 : option.port;\n FortGlobal.shouldParseCookie = option.shouldParseCookie == null ? true : option.shouldParseCookie;\n FortGlobal.shouldParsePost = isNull(option.shouldParsePost) ? true : option.shouldParsePost;\n FortGlobal.sessionTimeOut = isNull(option.sessionTimeOut) ? 60 : option.sessionTimeOut;\n FortGlobal.folders = option.folders == null ? [] : option.folders;\n if (isArray(FortGlobal.folders) === false) {\n throw new Error(`Option folders should be an array`);\n }\n FortGlobal.appName = isNullOrEmpty(option.appName) === true ? __AppName : option.appName;\n FortGlobal.appSessionIdentifier = `${FortGlobal.appName}_session_id`;\n FortGlobal.eTag = isNull(option.eTag) ? defaultEtagConfig : option.eTag;\n FortGlobal.walls = this.walls as any;\n FortGlobal.viewEngine = isNull(this.viewEngine) ? new MustacheViewEngine() : new (this.viewEngine as any)();\n FortGlobal.sessionProvider = isNull(this.sessionProvider) ? MemorySessionProvider as any :\n this.sessionProvider as typeof GenericSessionProvider;\n FortGlobal.errorHandler = isNull(this.errorHandler) ? ErrorHandler : this.errorHandler;\n FortGlobal.xmlParser = isNull(this.xmlParser) ? GenericXmlParser : this.xmlParser;\n FortGlobal.viewPath = isNull(option.viewPath) ? path.join(__CurrentPath, \"views\") : option.viewPath;\n setResultMapper(this.resultMapper);\n if (this.logger) {\n if (typeof this.logger === 'function') {\n this.logger = new (this as any).logger();\n }\n }\n else {\n this.logger = new Logger();\n }\n FortGlobal.logger = this.logger;\n }\n\n create(option?: AppOption): Promise {\n if (option == null) {\n option = {\n\n };\n }\n\n if (this.routes == null) {\n this.routes = [];\n }\n let isDefaultRouteExist = false;\n // removing / from routes\n this.routes.forEach(route => {\n // route.path = removeFirstSlash(route.path);\n route.path = removeLastSlash(route.path);\n RouteHandler.addToRouterCollection(route);\n if (route.path === \"/*\") {\n RouteHandler.defaultRouteControllerName = route.controller.name;\n isDefaultRouteExist = true;\n }\n });\n if (isDefaultRouteExist === false) {\n RouteHandler.defaultRouteControllerName = GenericController.name;\n RouteHandler.addToRouterCollection({\n controller: GenericController,\n path: \"/*\"\n });\n }\n\n if (option.folders != null) {\n // remove / from files routes\n option.folders.forEach(folder => {\n const length = folder.alias.length;\n if (length > 1) {\n folder.alias = removeFirstSlash(folder.alias);\n folder.alias = removeLastSlash(folder.alias);\n }\n\n });\n }\n\n this.saveAppOption_(option);\n if (this.httpServer != null) {\n return;\n }\n return promise((res, rej) => {\n this.httpServer = http.createServer(this.onNewRequest).once(\"error\", (err) => {\n if ((err as any).code === 'EADDRINUSE') {\n const error = new LogHelper(ERROR_TYPE.PortInUse, FortGlobal.port).get();\n rej(error);\n }\n else {\n rej(err);\n }\n }).once('listening', () => {\n // set default route\n // RouteHandler.defaultRouteControllerName = RouteHandler.getDefaultRoute();\n res();\n }).listen(FortGlobal.port);\n });\n }\n\n onNewRequest(request, response) {\n new RequestHandler(request, response).handle();\n }\n\n destroy(): Promise {\n return promise((res, rej) => {\n this.httpServer.close(res);\n });\n }\n\n}\n","import { RouteHandler } from \"../handlers\";\nimport { RouteInfo } from \"./route_info\";\n\nexport class Router {\n get routes() {\n return RouteHandler.routerCollection;\n }\n\n get routesAsArray() {\n return RouteHandler.routesAsArray;\n }\n\n}","import { HttpCookie } from \"./http_cookie\";\nimport { IHttpCookie } from \"../interfaces\";\n\nexport class CookieManager {\n private responseCookie_: string[] = [];\n private cookieCollection_: { [key: string]: string };\n\n constructor(parsedValue: { [key: string]: string }) {\n this.cookieCollection_ = parsedValue;\n }\n\n /**\n * return cookie by name\n *\n * @param {string} name\n * @returns\n * @memberof CookieManager\n */\n getCookie(name: string): HttpCookie {\n return {\n name: name,\n value: this.cookieCollection_[name]\n } as IHttpCookie;\n }\n\n /**\n * add cookie\n *\n * @param {HttpCookie} cookie\n * @memberof CookieManager\n */\n addCookie(cookie: HttpCookie) {\n this.cookieCollection_[cookie.name] = cookie.value;\n this.responseCookie_.push(this.getCookieStringFromCookie_(cookie));\n }\n\n /**\n * remove cookie\n *\n * @param {HttpCookie} cookie\n * @memberof CookieManager\n */\n removeCookie(cookie: HttpCookie) {\n this.cookieCollection_[cookie.name] = null;\n cookie.expires = new Date('Thu, 01 Jan 1970 00:00:00 GMT');\n cookie.maxAge = -1;\n this.responseCookie_.push(this.getCookieStringFromCookie_(cookie));\n }\n\n /**\n * collection of http cookie\n *\n * @readonly\n * @memberof CookieManager\n */\n get cookieCollection() {\n return this.cookieCollection_;\n }\n\n /**\n * determine whether value exist or not\n *\n * @param {string} name\n * @returns\n * @memberof CookieManager\n */\n isExist(name: string) {\n return this.cookieCollection_[name] != null;\n }\n\n private getCookieStringFromCookie_(cookie: HttpCookie) {\n const cookies = [];\n cookies.push(`${cookie.name}=${cookie.value}`);\n if (cookie.expires) {\n cookies.push(`Expires=${cookie.expires.toUTCString()}`);\n }\n if (cookie.httpOnly === true) {\n cookies.push(\"HttpOnly\");\n }\n if (cookie.maxAge != null) {\n cookies.push(`Max-Age=${cookie.maxAge}`);\n }\n if (cookie.path) {\n cookies.push(`Path=${cookie.path}`);\n }\n if (cookie.domain) {\n cookies.push(`Domain=${cookie.domain}`);\n }\n return cookies.join('; ');\n }\n}","import { HttpFile } from \"./http_file\";\nimport * as Fs from \"fs-extra\";\n\nexport class FileManager {\n\n private files_: { [fieldName: string]: HttpFile };\n\n constructor(value) {\n this.files_ = value as any;\n }\n\n /**\n * get total no of files\n *\n * @returns - number\n * @memberof FileManager\n */\n get count() {\n return Object.keys(this.files_).length;\n }\n\n get files() {\n\n return Object.keys(this.files_).map(fileId => {\n return this.files_[fileId];\n });\n }\n\n /**\n * check for existance of file\n *\n * @param {string} fieldName\n * @returns\n * @memberof FileManager\n */\n isExist(fieldName: string) {\n return this.files_[fieldName] != null;\n }\n\n /**\n * return the file\n *\n * @param {string} fieldName\n * @returns\n * @memberof FileManager\n */\n getFile(fieldName: string) {\n return this.files_[fieldName];\n }\n\n /**\n * saves file to supplied path\n *\n * @param {string} fieldName\n * @param {string} pathToSave\n * @returns\n * @memberof FileManager\n */\n saveTo(fieldName: string, pathToSave: string) {\n return Fs.copy(this.files_[fieldName].path, pathToSave);\n }\n}","import { IncomingHttpHeaders } from \"http2\";\n\n \nexport class HttpFile {\n\n /**\n * same as name - the field name for this file\n */\n fieldName: string;\n\n /**\n * the filename that the user reports for the file\n */\n originalFilename: string;\n\n /**\n * the absolute path of the uploaded file on disk\n */\n path: string;\n\n /**\n * the HTTP headers that were sent along with this file\n */\n headers?: IncomingHttpHeaders;\n\n /**\n * size of the file in bytes\n */\n size?: number;\n\n}\n","import { GenericShield, GenericController } from \"../generics\";\nimport { WorkerInfo } from \"../types\";\nimport { IRouteInfo } from \"../interfaces\";\n\nexport class RouteInfo implements IRouteInfo {\n controller: typeof GenericController;\n controllerName: string;\n path: string;\n workers: {\n [workerName: string]: WorkerInfo\n };\n\n get workersAsArray() {\n return Object.keys(this.workers).map(workerName => {\n return this.workers[workerName];\n return this.workers[workerName];\n });\n }\n\n shields: Array;\n values: any[];\n\n init(value: IRouteInfo) {\n this.controllerName = value.controllerName;\n this.controller = value.controller;\n this.path = value.path;\n this.shields = value.shields;\n this.values = value.values;\n this.workers = value.workers;\n }\n}","export * from './error_handler';\nexport * from './http_cookie';\nexport * from './fort';\nexport * from './router';\nexport * from './cookie_manager';\nexport * from \"./file_manager\";\nexport * from \"./http_file\";\nexport * from \"./logger\";\nexport * from './route_info';","import { HTTP_METHOD } from \"../enums\";\nimport { RouteHandler } from \"../handlers\";\nimport { WorkerInfo } from \"../types\";\n\n// tslint:disable-next-line\nexport const Worker = (allowedMethods?: HTTP_METHOD[]): MethodDecorator => {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n const actionInfo: WorkerInfo = {\n workerName: methodName,\n methodsAllowed: allowedMethods == null ? [\n HTTP_METHOD.Delete, HTTP_METHOD.Get, HTTP_METHOD.Post, HTTP_METHOD.Patch, HTTP_METHOD.Put\n ] : allowedMethods,\n guards: [],\n pattern: `/${methodName.toLowerCase()}`,\n values: []\n };\n RouteHandler.addWorker(actionInfo, className);\n };\n};\n","import { Shield } from \"../abstracts\";\nimport { RouteHandler } from \"../handlers\";\nimport { GenericShield } from \"../generics\";\n \n// tslint:disable-next-line\nexport const Shields = (shieldsValue: Array): ClassDecorator => {\n return (target: any) => {\n const className = target.name;\n RouteHandler.addShields(shieldsValue as Array, className);\n };\n};","import { RouteHandler } from \"../handlers\";\nimport { GenericGuard } from \"../generics\";\nimport { Guard } from \"../abstracts/guard\";\n\n// tslint:disable-next-line\nexport const Guards = (value: Array): MethodDecorator => {\n return ((target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n RouteHandler.addGuards(value as Array, className, methodName);\n });\n};","import { RouteHandler } from \"../handlers\";\nimport { removeLastSlash } from \"../helpers\";\n\n// tslint:disable-next-line\nexport const Route = (format: string): MethodDecorator => {\n return ((target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n // remove / from route\n if (format != null) {\n format = removeLastSlash(format);\n }\n RouteHandler.addPattern(format, className, methodName);\n });\n};","import { RouteHandler } from \"../handlers\";\nimport { HTTP_METHOD } from \"../enums\";\nimport { WorkerInfo } from \"../types\";\nimport { Route } from \"./route\";\nimport { Worker } from \"./worker\";\n\n// tslint:disable-next-line\nexport const DefaultWorker = (allowedMethods?: HTTP_METHOD[]): MethodDecorator => {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className = (target.constructor.name as string);\n const actionInfo: WorkerInfo = {\n workerName: methodName,\n methodsAllowed: allowedMethods == null ? [HTTP_METHOD.Get] : allowedMethods,\n guards: [],\n pattern: \"/\",\n values: []\n };\n // RouteHandler.addWorker(actionInfo, className);\n Worker(allowedMethods == null ? [HTTP_METHOD.Get] : allowedMethods)(target, methodName, descriptor);\n Route(\"/\")(target, methodName, descriptor);\n };\n};\n","import { InjectorHandler } from \"../handlers\";\nimport { __Constructor } from \"../constant\";\n\n// tslint:disable-next-line\nexport const Assign = (value): ParameterDecorator => {\n return (target: any, methodName: string, paramIndex: number) => {\n const className: string = target.name || target.constructor.name;\n if (methodName == null) {\n methodName = __Constructor;\n }\n InjectorHandler.addWorkerValue(className, methodName, paramIndex, value);\n };\n};","import { InjectorHandler } from \"../handlers\";\nimport { __Constructor } from \"../constant\";\n\n// tslint:disable-next-line\nexport const Singleton = (value): ParameterDecorator => {\n return (target: any, methodName: string, paramIndex: number) => {\n const className: string = target.name || target.constructor.name;\n if (methodName == null || methodName === 'constructor') {\n methodName = __Constructor;\n }\n InjectorHandler.addSingleton(className, methodName, paramIndex, value);\n };\n};","import { RouteHandler } from \"../handlers\";\nimport { getDataType, getClassName, removeMethodAndNullFromObject } from \"../helpers\";\nimport { DATA_TYPE } from \"../enums/data_type\";\n\nexport function ExpectBody(value: any): MethodDecorator {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className: string = getClassName(target);\n const type = getDataType(value);\n switch (type) {\n case DATA_TYPE.Function:\n const valueClassName = getClassName(value);\n if (valueClassName != null) {\n value = new value();\n }\n case DATA_TYPE.Object:\n value = removeMethodAndNullFromObject(value);\n RouteHandler.addExpected(\"body\", className, methodName, value); break;\n default:\n throw new Error(`expected body should be always an object but found ${type}`);\n }\n\n };\n}","import { RouteHandler } from \"../handlers\";\nimport { DATA_TYPE } from \"../enums/data_type\";\nimport { getClassName, removeMethodAndNullFromObject, getDataType } from \"../helpers\";\n\nexport function ExpectQuery(value: any): MethodDecorator {\n return (target: any, methodName: string, descriptor: PropertyDescriptor) => {\n const className: string = getClassName(target);\n const type = getDataType(value);\n switch (type) {\n case DATA_TYPE.Function:\n const valueClassName = getClassName(value);\n if (valueClassName != null) {\n value = new value();\n }\n case DATA_TYPE.Object:\n value = removeMethodAndNullFromObject(value);\n RouteHandler.addExpected(\"query\", className, methodName, value); break;\n default:\n throw new Error(`expected query should be always an object but found ${type}`);\n }\n };\n}","export * from './worker';\nexport * from './shields';\nexport * from './guards';\nexport * from './route';\nexport * from './default_worker';\nexport * from './assign';\nexport * from './singleton';\nexport * from './expect_body';\nexport * from './expect_query';","export * from './models';\nexport * from './abstracts';\nexport * from './decorators';\nexport * from './enums';\nexport * from './helpers';\nexport * from './types';\nexport * from './extra';\nexport * from './interfaces';"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 41682835..91351220 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fortjs", - "version": "1.13.1", + "version": "1.14.0", "description": "Component based MVC web framework for nodejs targeting good code structures & modularity.", "main": "dist/fort.js", "types": "dist/ts/index.d.ts",