badmfck-api-server 1.6.9 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,6 +29,7 @@ export interface APIServiceOptions {
29
29
  login: string;
30
30
  password: string;
31
31
  }[];
32
+ appVersion?: string;
32
33
  }
33
34
  export declare function getDefaultOptions(): APIServiceOptions;
34
35
  export declare const REQ_CREATE_NET_LOG: Req<void, APIServiceNetworkLogItem>;
@@ -47,7 +47,7 @@ async function Initializer(services) {
47
47
  exports.Initializer = Initializer;
48
48
  class APIService extends BaseService_1.BaseService {
49
49
  static nextLogID = 0;
50
- version = "1.6.8";
50
+ version = "1.6.9";
51
51
  options;
52
52
  monitor;
53
53
  monitorIndexFile;
@@ -248,8 +248,10 @@ class APIService extends BaseService_1.BaseService {
248
248
  }
249
249
  sendResponse(res, data, requestTime, endpoint, log) {
250
250
  data.responseTime = (+new Date()) - requestTime;
251
- data.version = this.version;
251
+ data.core = this.version;
252
252
  data.endpoint = endpoint ?? "no_endpoint";
253
+ if (this.options.appVersion)
254
+ data.version = this.options.appVersion;
253
255
  if (this.monitor)
254
256
  this.monitor.registrateResponse(data.endpoint, data.responseTime);
255
257
  if (log)
@@ -0,0 +1,10 @@
1
+ import { BaseEndpoint } from "../BaseEndpoint";
2
+ import { HTTPRequestVO, TransferPacketVO } from "../structures/Interfaces";
3
+ export declare class Deployment extends BaseEndpoint {
4
+ hash: string;
5
+ constructor({ login, password }: {
6
+ login: string;
7
+ password: string;
8
+ });
9
+ deploymentHistory(req: HTTPRequestVO): Promise<TransferPacketVO<any>>;
10
+ }
@@ -0,0 +1,24 @@
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
+ exports.Deployment = void 0;
7
+ const BaseEndpoint_1 = require("../BaseEndpoint");
8
+ const crypto_1 = __importDefault(require("crypto"));
9
+ const LogService_1 = require("../LogService");
10
+ class Deployment extends BaseEndpoint_1.BaseEndpoint {
11
+ hash;
12
+ constructor({ login, password }) {
13
+ super("sys-deployment");
14
+ this.hash = crypto_1.default.createHash("sha256").update(login + password).digest().toString("hex");
15
+ (0, LogService_1.logWarn)("Deployment initialized at: sys-deployment/" + this.hash);
16
+ this.registerEndpoints([
17
+ { ignoreInterceptor: true, endpoint: this.hash, handler: this.deploymentHistory },
18
+ ]);
19
+ }
20
+ async deploymentHistory(req) {
21
+ return {};
22
+ }
23
+ }
24
+ exports.Deployment = Deployment;
@@ -3,6 +3,7 @@ export interface TransferPacketVO<T> {
3
3
  error?: IError | null;
4
4
  responseTime?: number;
5
5
  version?: string;
6
+ core?: string;
6
7
  endpoint?: string;
7
8
  httpStatus?: number;
8
9
  redirect?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",