badmfck-api-server 3.3.9 → 3.4.0

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.
@@ -95,7 +95,7 @@ async function Initializer(services) {
95
95
  exports.Initializer = Initializer;
96
96
  class APIService extends BaseService_1.BaseService {
97
97
  static nextLogID = 0;
98
- version = "3.3.8";
98
+ version = "3.4.0";
99
99
  options;
100
100
  monitor = null;
101
101
  started = new Date();
@@ -146,7 +146,7 @@ class APIService extends BaseService_1.BaseService {
146
146
  ep = ep.replaceAll("//", "/");
147
147
  if (ep === req.endpoint) {
148
148
  req.internalCall = true;
149
- const response = await i.execute(req);
149
+ const response = await i.__execute(req);
150
150
  if (response.error)
151
151
  return response.error;
152
152
  return response.data;
@@ -286,7 +286,7 @@ class APIService extends BaseService_1.BaseService {
286
286
  if (!ignoreInterceptor) {
287
287
  let interceptorResult;
288
288
  if (this.options.interceptor) {
289
- interceptorResult = await this.options.interceptor.execute(httpRequest);
289
+ interceptorResult = await this.options.interceptor.__execute(httpRequest);
290
290
  if (interceptorResult.error && !allowInterceptorError) {
291
291
  this.sendResponse(req.get("Referer") ?? "", res, interceptorResult, tme, ep, log, httpRequest);
292
292
  return;
@@ -294,13 +294,13 @@ class APIService extends BaseService_1.BaseService {
294
294
  httpRequest.interceptorResult = interceptorResult;
295
295
  }
296
296
  }
297
- const precheck = await i.precheck(httpRequest);
297
+ const precheck = await i.__precheck(httpRequest);
298
298
  if (precheck && precheck.error) {
299
299
  this.sendResponse(req.get("Referer") ?? "", res, precheck, tme, ep, log, httpRequest);
300
300
  return;
301
301
  }
302
302
  httpRequest.precheck = precheck;
303
- result = await i.execute(httpRequest);
303
+ result = await i.__execute(httpRequest);
304
304
  }
305
305
  catch (e) {
306
306
  console.error(e);
@@ -1,8 +1,8 @@
1
1
  import { HTTPRequestVO, TransferPacketVO } from "./structures/Interfaces";
2
2
  export interface IBaseEndpoint {
3
3
  endpoints?: IEndpointHandler[];
4
- execute: (req: HTTPRequestVO) => Promise<TransferPacketVO<any>>;
5
- precheck: (req: HTTPRequestVO) => Promise<TransferPacketVO<any> | null>;
4
+ __execute: (req: HTTPRequestVO) => Promise<TransferPacketVO<any>>;
5
+ __precheck: (req: HTTPRequestVO) => Promise<TransferPacketVO<any> | null>;
6
6
  init: () => Promise<void>;
7
7
  ignoreHttpLogging: boolean;
8
8
  }
@@ -48,8 +48,8 @@ export declare class BaseEndpoint implements IBaseEndpoint {
48
48
  registerEndpoints(endpoints: IEndpointHandler[]): void;
49
49
  init(): Promise<void>;
50
50
  getInitalizedEndpointNames(): String[];
51
- precheck(req: HTTPRequestVO): Promise<TransferPacketVO<any> | null>;
52
- execute(req: HTTPRequestVO): Promise<TransferPacketVO<any>>;
51
+ __precheck(req: HTTPRequestVO): Promise<TransferPacketVO<any> | null>;
52
+ __execute(req: HTTPRequestVO): Promise<TransferPacketVO<any>>;
53
53
  protected validateStructure(structure: any, req: HTTPRequestVO): Promise<void>;
54
54
  protected createStream(req: HTTPRequestVO): HTTPRequestVO;
55
55
  }
@@ -67,8 +67,8 @@ class BaseEndpoint {
67
67
  getInitalizedEndpointNames() {
68
68
  return this.inializedEndpointNames;
69
69
  }
70
- async precheck(req) { return null; }
71
- async execute(req) {
70
+ async __precheck(req) { return null; }
71
+ async __execute(req) {
72
72
  if (this.endpoints && this.endpoints.length > 0) {
73
73
  for (let i of this.endpoints) {
74
74
  let targetEP = BaseEndpoint.entrypoint + i.endpoint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "3.3.9",
3
+ "version": "3.4.0",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",