SessionMiddleware.js 1.1 KB

12345678910111213141516171819
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const http_1 = require("../base/http");
  7. const express_session_1 = __importDefault(require("express-session"));
  8. const util_1 = require("../base/util");
  9. class SessionMiddleware extends http_1.Middleware {
  10. constructor() {
  11. var _a, _b, _c, _d;
  12. super(...arguments);
  13. this.order = -98;
  14. this.route = null;
  15. this.action = (0, express_session_1.default)({ secret: ((_a = this.context.options) === null || _a === void 0 ? void 0 : _a.sessionSecret) || util_1.Guid.new(), resave: ((_b = this.context.options) === null || _b === void 0 ? void 0 : _b.sessionResave) || false, saveUninitialized: ((_c = this.context.options) === null || _c === void 0 ? void 0 : _c.sessionSaveUninitialized) || false, cookie: { maxAge: ((_d = this.context.options) === null || _d === void 0 ? void 0 : _d.sessionMaxAge) || 3600000 } });
  16. }
  17. }
  18. exports.default = SessionMiddleware;
  19. //# sourceMappingURL=SessionMiddleware.js.map