@grandlinex/kernel 0.26.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/Kernel.d.ts +2 -2
  3. package/dist/Kernel.js +20 -49
  4. package/dist/KernelModule.js +18 -72
  5. package/dist/actions/ApiAuthTestAction.d.ts +2 -2
  6. package/dist/actions/ApiAuthTestAction.js +11 -59
  7. package/dist/actions/ApiVersionAction.d.ts +2 -2
  8. package/dist/actions/ApiVersionAction.js +13 -61
  9. package/dist/actions/GetTokenAction.d.ts +2 -2
  10. package/dist/actions/GetTokenAction.js +33 -89
  11. package/dist/actions/index.js +3 -3
  12. package/dist/api/KernelEndpoint.js +3 -23
  13. package/dist/api/index.js +1 -1
  14. package/dist/classes/BaseAction.d.ts +3 -3
  15. package/dist/classes/BaseAction.js +45 -106
  16. package/dist/classes/BaseApiAction.js +14 -32
  17. package/dist/classes/BaseAuthProvider.d.ts +3 -3
  18. package/dist/classes/BaseAuthProvider.js +2 -5
  19. package/dist/classes/BaseEndpoint.d.ts +6 -3
  20. package/dist/classes/BaseEndpoint.js +41 -49
  21. package/dist/classes/BaseKernelModule.js +3 -23
  22. package/dist/classes/index.d.ts +2 -2
  23. package/dist/classes/index.js +20 -7
  24. package/dist/classes/timing/ExpressServerTiming.d.ts +3 -3
  25. package/dist/classes/timing/ExpressServerTiming.js +29 -61
  26. package/dist/classes/timing/ServerTiming.js +16 -52
  27. package/dist/classes/timing/ServerTimingElement.js +7 -8
  28. package/dist/classes/timing/index.js +3 -3
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +3 -2
  31. package/dist/lib/express.d.ts +6 -0
  32. package/dist/lib/express.js +2 -0
  33. package/dist/lib/index.d.ts +5 -4
  34. package/dist/modules/crypto/CryptoClient.d.ts +2 -2
  35. package/dist/modules/crypto/CryptoClient.js +60 -119
  36. package/dist/modules/crypto/index.js +1 -1
  37. package/dist/modules/crypto/utils/cors.d.ts +2 -2
  38. package/dist/modules/crypto/utils/cors.js +1 -1
  39. package/package.json +6 -6
@@ -1,29 +1,9 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var BaseEndpoint_1 = __importDefault(require("../classes/BaseEndpoint"));
22
- var KernelEndpoint = /** @class */ (function (_super) {
23
- __extends(KernelEndpoint, _super);
24
- function KernelEndpoint() {
25
- return _super !== null && _super.apply(this, arguments) || this;
26
- }
27
- return KernelEndpoint;
28
- }(BaseEndpoint_1.default));
6
+ const BaseEndpoint_1 = __importDefault(require("../classes/BaseEndpoint"));
7
+ class KernelEndpoint extends BaseEndpoint_1.default {
8
+ }
29
9
  exports.default = KernelEndpoint;
package/dist/api/index.js CHANGED
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.KernelEndpoint = void 0;
7
- var KernelEndpoint_1 = __importDefault(require("./KernelEndpoint"));
7
+ const KernelEndpoint_1 = __importDefault(require("./KernelEndpoint"));
8
8
  exports.KernelEndpoint = KernelEndpoint_1.default;
@@ -1,8 +1,8 @@
1
- import { Request, Response } from 'express';
2
1
  import { CoreAction, IDataBase } from '@grandlinex/core';
3
2
  import { IBaseAction, IBaseCache, IBaseClient, IBaseKernelModule, IBasePresenter, IKernel } from '../lib';
4
3
  import { JwtToken } from './BaseAuthProvider';
5
4
  import { IExtensionInterface } from './timing/ExpressServerTiming';
5
+ import { XNextFc, XRequest, XResponse } from '../lib/express';
6
6
  export declare enum ActionMode {
7
7
  'DEFAULT' = 0,
8
8
  'DMZ' = 1,
@@ -11,8 +11,8 @@ export declare enum ActionMode {
11
11
  export default abstract class BaseAction<K extends IKernel = IKernel, T extends IDataBase<any, any> | null = any, P extends IBaseClient | null = any, C extends IBaseCache | null = any, E extends IBasePresenter | null = any> extends CoreAction<K, T, P, C, E> implements IBaseAction<K, T, P, C, E> {
12
12
  mode: ActionMode;
13
13
  constructor(chanel: string, module: IBaseKernelModule<K, T, P, C, E>);
14
- abstract handler(req: Request, res: Response, next: () => void, data: JwtToken | null, extension: IExtensionInterface): Promise<void>;
15
- secureHandler(req: Request, res: Response, next: () => void): Promise<void>;
14
+ abstract handler(req: XRequest, res: XResponse, next: XNextFc, data: JwtToken | null, extension: IExtensionInterface): Promise<void>;
15
+ secureHandler(req: XRequest, res: XResponse, next: () => void): Promise<void>;
16
16
  setMode(mode: ActionMode): void;
17
17
  abstract register(): void;
18
18
  private initExtension;
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,112 +8,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
24
9
  });
25
10
  };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
11
  Object.defineProperty(exports, "__esModule", { value: true });
54
12
  exports.ActionMode = void 0;
55
- var core_1 = require("@grandlinex/core");
56
- var timing_1 = require("./timing");
13
+ const core_1 = require("@grandlinex/core");
14
+ const timing_1 = require("./timing");
57
15
  var ActionMode;
58
16
  (function (ActionMode) {
59
17
  ActionMode[ActionMode["DEFAULT"] = 0] = "DEFAULT";
60
18
  ActionMode[ActionMode["DMZ"] = 1] = "DMZ";
61
19
  ActionMode[ActionMode["DMZ_WITH_USER"] = 2] = "DMZ_WITH_USER";
62
20
  })(ActionMode = exports.ActionMode || (exports.ActionMode = {}));
63
- var BaseAction = /** @class */ (function (_super) {
64
- __extends(BaseAction, _super);
65
- function BaseAction(chanel, module) {
66
- var _this = _super.call(this, chanel, module) || this;
67
- _this.secureHandler = _this.secureHandler.bind(_this);
68
- _this.mode = ActionMode.DEFAULT;
69
- return _this;
21
+ class BaseAction extends core_1.CoreAction {
22
+ constructor(chanel, module) {
23
+ super(chanel, module);
24
+ this.secureHandler = this.secureHandler.bind(this);
25
+ this.mode = ActionMode.DEFAULT;
70
26
  }
71
- BaseAction.prototype.secureHandler = function (req, res, next) {
72
- return __awaiter(this, void 0, void 0, function () {
73
- var extension, auth, cc, dat;
74
- var _this = this;
75
- return __generator(this, function (_a) {
76
- switch (_a.label) {
77
- case 0:
78
- extension = this.initExtension(res);
79
- auth = extension.timing.start('auth');
80
- res.on('finish', function () {
81
- _this.getKernel().responseCodeFunction({
82
- code: res.statusCode,
83
- req: req,
84
- });
85
- });
86
- cc = this.getKernel().getCryptoClient();
87
- if (!cc) {
88
- res.status(504).send('internal server error');
89
- return [2 /*return*/];
90
- }
91
- if (!(this.mode === ActionMode.DMZ)) return [3 /*break*/, 2];
92
- auth.stop();
93
- return [4 /*yield*/, this.handler(req, res, next, null, extension)];
94
- case 1:
95
- _a.sent();
96
- return [2 /*return*/];
97
- case 2: return [4 /*yield*/, cc.bearerTokenValidation(req)];
98
- case 3:
99
- dat = _a.sent();
100
- auth.stop();
101
- if (!dat) return [3 /*break*/, 5];
102
- return [4 /*yield*/, this.handler(req, res, next, dat, extension)];
103
- case 4:
104
- _a.sent();
105
- return [3 /*break*/, 8];
106
- case 5:
107
- if (!(this.mode === ActionMode.DMZ_WITH_USER)) return [3 /*break*/, 7];
108
- return [4 /*yield*/, this.handler(req, res, next, null, extension)];
109
- case 6:
110
- _a.sent();
111
- return [3 /*break*/, 8];
112
- case 7:
113
- res.status(401).send('no no no ...');
114
- _a.label = 8;
115
- case 8: return [2 /*return*/];
116
- }
27
+ secureHandler(req, res, next) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const extension = this.initExtension(res);
30
+ const auth = extension.timing.start('auth');
31
+ res.on('finish', () => {
32
+ this.getKernel().responseCodeFunction({
33
+ code: res.statusCode,
34
+ req,
35
+ });
117
36
  });
37
+ const cc = this.getKernel().getCryptoClient();
38
+ if (!cc) {
39
+ res.status(504).send('internal server error');
40
+ return;
41
+ }
42
+ if (this.mode === ActionMode.DMZ) {
43
+ auth.stop();
44
+ yield this.handler(req, res, next, null, extension);
45
+ return;
46
+ }
47
+ const dat = yield cc.bearerTokenValidation(req);
48
+ auth.stop();
49
+ if (dat) {
50
+ yield this.handler(req, res, next, dat, extension);
51
+ }
52
+ else if (this.mode === ActionMode.DMZ_WITH_USER) {
53
+ yield this.handler(req, res, next, null, extension);
54
+ }
55
+ else {
56
+ res.status(401).send('no no no ...');
57
+ }
118
58
  });
119
- };
120
- BaseAction.prototype.setMode = function (mode) {
59
+ }
60
+ setMode(mode) {
121
61
  this.mode = mode;
122
- };
123
- BaseAction.prototype.initExtension = function (res) {
124
- var _a = timing_1.ExpressServerTiming.init(this, res), el = _a[0], fx = _a[1];
62
+ }
63
+ initExtension(res) {
64
+ const [el, fx] = timing_1.ExpressServerTiming.init(this, res);
125
65
  return {
126
- done: function () {
66
+ done: () => {
127
67
  fx();
128
68
  },
129
69
  timing: el,
130
70
  };
131
- };
132
- return BaseAction;
133
- }(core_1.CoreAction));
71
+ }
72
+ }
134
73
  exports.default = BaseAction;
@@ -1,34 +1,17 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var BaseAction_1 = __importDefault(require("./BaseAction"));
22
- var BaseApiAction = /** @class */ (function (_super) {
23
- __extends(BaseApiAction, _super);
24
- function BaseApiAction(type, chanel, module, extMod) {
25
- var _this = _super.call(this, chanel, module) || this;
26
- _this.exmod = extMod;
27
- _this.type = type;
28
- return _this;
6
+ const BaseAction_1 = __importDefault(require("./BaseAction"));
7
+ class BaseApiAction extends BaseAction_1.default {
8
+ constructor(type, chanel, module, extMod) {
9
+ super(chanel, module);
10
+ this.exmod = extMod;
11
+ this.type = type;
29
12
  }
30
- BaseApiAction.prototype.register = function () {
31
- var endpoint;
13
+ register() {
14
+ let endpoint;
32
15
  if (this.exmod) {
33
16
  endpoint = this.exmod.getPresenter();
34
17
  }
@@ -36,8 +19,8 @@ var BaseApiAction = /** @class */ (function (_super) {
36
19
  endpoint = this.getModule().getPresenter();
37
20
  }
38
21
  if (endpoint) {
39
- this.debug("register ".concat(this.type, " ").concat(this.getName()));
40
- var app = endpoint.getApp();
22
+ this.debug(`register ${this.type} ${this.getName()}`);
23
+ const app = endpoint.getApp();
41
24
  switch (this.type) {
42
25
  case 'POST':
43
26
  app.post(this.getName(), this.secureHandler);
@@ -58,10 +41,9 @@ var BaseApiAction = /** @class */ (function (_super) {
58
41
  }
59
42
  }
60
43
  else {
61
- this.error("on register -> ".concat(this.getName()));
62
- this.error("No Endpoint found");
44
+ this.error(`on register -> ${this.getName()}`);
45
+ this.error(`No Endpoint found`);
63
46
  }
64
- };
65
- return BaseApiAction;
66
- }(BaseAction_1.default));
47
+ }
48
+ }
67
49
  exports.default = BaseApiAction;
@@ -1,4 +1,4 @@
1
- import { Request } from 'express';
1
+ import { XRequest } from '../lib/express';
2
2
  export interface JwtTokenData {
3
3
  username: string;
4
4
  userid: string;
@@ -14,10 +14,10 @@ export type AuthResult = {
14
14
  export interface IAuthProvider {
15
15
  authorizeToken(userid: string, token: string, requestType: string): Promise<AuthResult>;
16
16
  validateAccess(token: JwtToken, requestType: string): Promise<boolean>;
17
- bearerTokenValidation(req: Request): Promise<JwtToken | null>;
17
+ bearerTokenValidation(req: XRequest): Promise<JwtToken | null>;
18
18
  }
19
19
  export default abstract class BaseAuthProvider implements IAuthProvider {
20
20
  abstract authorizeToken(username: string, token: string, requestType: string): Promise<AuthResult>;
21
21
  abstract validateAccess(token: JwtToken, requestType: string): Promise<boolean>;
22
- abstract bearerTokenValidation(req: Request): Promise<JwtToken | null>;
22
+ abstract bearerTokenValidation(req: XRequest): Promise<JwtToken | null>;
23
23
  }
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var BaseAuthProvider = /** @class */ (function () {
4
- function BaseAuthProvider() {
5
- }
6
- return BaseAuthProvider;
7
- }());
3
+ class BaseAuthProvider {
4
+ }
8
5
  exports.default = BaseAuthProvider;
@@ -1,12 +1,15 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import express from 'express';
3
4
  import http from 'http';
4
5
  import { CorePresenter, IDataBase } from '@grandlinex/core';
5
6
  import { IBaseCache, IBaseClient, IBaseKernelModule, IBasePresenter, IKernel } from '../lib';
7
+ import { XRequest, XResponse } from '../lib/express';
8
+ export declare function keepRawBody(req: XRequest, res: XResponse, buf: Buffer, encoding: string): void;
6
9
  export default abstract class BaseEndpoint<K extends IKernel = IKernel, T extends IDataBase<any, any> | null = any, P extends IBaseClient | null = any, C extends IBaseCache | null = any, E extends IBasePresenter | null = any> extends CorePresenter<express.Express, K, T, P, C, E> implements IBasePresenter {
7
- private appServer;
8
- private httpServer;
9
- private port;
10
+ protected appServer: express.Express;
11
+ protected httpServer: http.Server;
12
+ protected port: number;
10
13
  constructor(chanel: string, module: IBaseKernelModule<any, any, any, any>, port: number);
11
14
  start(): Promise<boolean>;
12
15
  stop(): Promise<boolean>;
@@ -1,65 +1,57 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var express_1 = __importDefault(require("express"));
22
- var http_1 = __importDefault(require("http"));
23
- var body_parser_1 = require("body-parser");
24
- var core_1 = require("@grandlinex/core");
25
- var BaseEndpoint = /** @class */ (function (_super) {
26
- __extends(BaseEndpoint, _super);
27
- function BaseEndpoint(chanel, module, port) {
28
- var _this = _super.call(this, "endpoint-".concat(chanel), module) || this;
29
- _this.port = port;
30
- _this.appServer = (0, express_1.default)();
31
- _this.appServer.use((0, body_parser_1.json)());
32
- _this.httpServer = http_1.default.createServer(_this.appServer);
33
- return _this;
6
+ exports.keepRawBody = void 0;
7
+ const express_1 = __importDefault(require("express"));
8
+ const http_1 = __importDefault(require("http"));
9
+ const body_parser_1 = require("body-parser");
10
+ const core_1 = require("@grandlinex/core");
11
+ function keepRawBody(req, res, buf, encoding) {
12
+ if (buf && buf.length) {
13
+ try {
14
+ req.rawBody = buf.toString(encoding || 'utf8');
15
+ }
16
+ catch (e) {
17
+ req.rawBody = null;
18
+ }
34
19
  }
35
- BaseEndpoint.prototype.start = function () {
36
- var _this = this;
37
- return new Promise(function (resolve) {
38
- _this.httpServer
39
- .listen(_this.port, function () {
40
- _this.info("Endpoint listen on ".concat(_this.port));
20
+ }
21
+ exports.keepRawBody = keepRawBody;
22
+ class BaseEndpoint extends core_1.CorePresenter {
23
+ constructor(chanel, module, port) {
24
+ super(`endpoint-${chanel}`, module);
25
+ this.port = port;
26
+ this.appServer = (0, express_1.default)();
27
+ this.appServer.use((0, body_parser_1.json)({ verify: keepRawBody }));
28
+ this.httpServer = http_1.default.createServer(this.appServer);
29
+ }
30
+ start() {
31
+ return new Promise((resolve) => {
32
+ this.httpServer
33
+ .listen(this.port, () => {
34
+ this.info(`Endpoint listen on ${this.port}`);
41
35
  resolve(true);
42
36
  })
43
- .on('error', function (err) {
44
- _this.error(err);
37
+ .on('error', (err) => {
38
+ this.error(err);
45
39
  resolve(false);
46
40
  });
47
41
  });
48
- };
49
- BaseEndpoint.prototype.stop = function () {
50
- var _this = this;
51
- return new Promise(function (resolve) {
52
- if (_this.httpServer) {
53
- _this.httpServer.close(function (err) { return (err ? resolve(false) : resolve(true)); });
42
+ }
43
+ stop() {
44
+ return new Promise((resolve) => {
45
+ if (this.httpServer) {
46
+ this.httpServer.close((err) => (err ? resolve(false) : resolve(true)));
54
47
  }
55
48
  });
56
- };
57
- BaseEndpoint.prototype.getApp = function () {
49
+ }
50
+ getApp() {
58
51
  return this.appServer;
59
- };
60
- BaseEndpoint.prototype.getServer = function () {
52
+ }
53
+ getServer() {
61
54
  return this.httpServer;
62
- };
63
- return BaseEndpoint;
64
- }(core_1.CorePresenter));
55
+ }
56
+ }
65
57
  exports.default = BaseEndpoint;
@@ -1,26 +1,6 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
- var core_1 = require("@grandlinex/core");
19
- var BaseKernelModule = /** @class */ (function (_super) {
20
- __extends(BaseKernelModule, _super);
21
- function BaseKernelModule() {
22
- return _super !== null && _super.apply(this, arguments) || this;
23
- }
24
- return BaseKernelModule;
25
- }(core_1.CoreKernelModule));
3
+ const core_1 = require("@grandlinex/core");
4
+ class BaseKernelModule extends core_1.CoreKernelModule {
5
+ }
26
6
  exports.default = BaseKernelModule;
@@ -1,9 +1,9 @@
1
1
  import { CoreBridge as BaseBridge, CoreCache as BaseCache, CoreClient as BaseClient, CoreElement as BaseElement, CoreLoopService as BaseLoopService, CoreService as BaseService } from '@grandlinex/core';
2
2
  import BaseAction from './BaseAction';
3
- import BaseEndpoint from './BaseEndpoint';
3
+ import BaseEndpoint, { keepRawBody } from './BaseEndpoint';
4
4
  import BaseKernelModule from './BaseKernelModule';
5
5
  import BaseApiAction from './BaseApiAction';
6
6
  import BaseAuthProvider from './BaseAuthProvider';
7
7
  export * from './BaseAuthProvider';
8
8
  export * from './timing';
9
- export { BaseLoopService, BaseAuthProvider, BaseKernelModule, BaseService, BaseApiAction, BaseEndpoint, BaseElement, BaseCache, BaseAction, BaseClient, BaseBridge, };
9
+ export { BaseLoopService, BaseAuthProvider, BaseKernelModule, BaseService, BaseApiAction, BaseEndpoint, BaseElement, BaseCache, BaseAction, BaseClient, BaseBridge, keepRawBody, };
@@ -10,6 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
13
25
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
27
  };
@@ -17,23 +29,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
30
  };
19
31
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.BaseBridge = exports.BaseClient = exports.BaseAction = exports.BaseCache = exports.BaseElement = exports.BaseEndpoint = exports.BaseApiAction = exports.BaseService = exports.BaseKernelModule = exports.BaseAuthProvider = exports.BaseLoopService = void 0;
21
- var core_1 = require("@grandlinex/core");
32
+ exports.keepRawBody = exports.BaseBridge = exports.BaseClient = exports.BaseAction = exports.BaseCache = exports.BaseElement = exports.BaseEndpoint = exports.BaseApiAction = exports.BaseService = exports.BaseKernelModule = exports.BaseAuthProvider = exports.BaseLoopService = void 0;
33
+ const core_1 = require("@grandlinex/core");
22
34
  Object.defineProperty(exports, "BaseBridge", { enumerable: true, get: function () { return core_1.CoreBridge; } });
23
35
  Object.defineProperty(exports, "BaseCache", { enumerable: true, get: function () { return core_1.CoreCache; } });
24
36
  Object.defineProperty(exports, "BaseClient", { enumerable: true, get: function () { return core_1.CoreClient; } });
25
37
  Object.defineProperty(exports, "BaseElement", { enumerable: true, get: function () { return core_1.CoreElement; } });
26
38
  Object.defineProperty(exports, "BaseLoopService", { enumerable: true, get: function () { return core_1.CoreLoopService; } });
27
39
  Object.defineProperty(exports, "BaseService", { enumerable: true, get: function () { return core_1.CoreService; } });
28
- var BaseAction_1 = __importDefault(require("./BaseAction"));
40
+ const BaseAction_1 = __importDefault(require("./BaseAction"));
29
41
  exports.BaseAction = BaseAction_1.default;
30
- var BaseEndpoint_1 = __importDefault(require("./BaseEndpoint"));
42
+ const BaseEndpoint_1 = __importStar(require("./BaseEndpoint"));
31
43
  exports.BaseEndpoint = BaseEndpoint_1.default;
32
- var BaseKernelModule_1 = __importDefault(require("./BaseKernelModule"));
44
+ Object.defineProperty(exports, "keepRawBody", { enumerable: true, get: function () { return BaseEndpoint_1.keepRawBody; } });
45
+ const BaseKernelModule_1 = __importDefault(require("./BaseKernelModule"));
33
46
  exports.BaseKernelModule = BaseKernelModule_1.default;
34
- var BaseApiAction_1 = __importDefault(require("./BaseApiAction"));
47
+ const BaseApiAction_1 = __importDefault(require("./BaseApiAction"));
35
48
  exports.BaseApiAction = BaseApiAction_1.default;
36
- var BaseAuthProvider_1 = __importDefault(require("./BaseAuthProvider"));
49
+ const BaseAuthProvider_1 = __importDefault(require("./BaseAuthProvider"));
37
50
  exports.BaseAuthProvider = BaseAuthProvider_1.default;
38
51
  __exportStar(require("./BaseAuthProvider"), exports);
39
52
  __exportStar(require("./timing"), exports);
@@ -1,5 +1,5 @@
1
- import { Response } from 'express';
2
1
  import { CoreElement } from '@grandlinex/core';
2
+ import { XResponse } from '../../lib/express';
3
3
  export type IExtensionInterface = {
4
4
  done: () => void;
5
5
  timing: ExpressServerTiming;
@@ -12,6 +12,6 @@ export default class ExpressServerTiming {
12
12
  startFunc<T>(chanel: string, fc: () => Promise<T>): Promise<T>;
13
13
  dbQuery<T>(fc: () => Promise<T>): Promise<T>;
14
14
  getHeader(): string;
15
- addHeader(res: Response): void;
16
- static init(baseApiAction: CoreElement<any>, res: Response): [ExpressServerTiming, () => void];
15
+ addHeader(res: XResponse): void;
16
+ static init(baseApiAction: CoreElement<any>, res: XResponse): [ExpressServerTiming, () => void];
17
17
  }