badmfck-api-server 4.1.53 → 4.1.57
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.
- package/dist/apiServer/APIService.d.ts +3 -4
- package/dist/apiServer/APIService.js +19 -9
- package/dist/apiServer/BaseEndpoint.d.ts +2 -2
- package/dist/apiServer/LocalRequest.d.ts +1 -1
- package/dist/apiServer/LogService.js +17 -7
- package/dist/apiServer/MonitorService.d.ts +0 -1
- package/dist/apiServer/MonitorService.js +17 -7
- package/dist/apiServer/MysqlService.d.ts +1 -2
- package/dist/apiServer/MysqlService.js +17 -7
- package/dist/apiServer/TimeframeService.js +17 -7
- package/dist/apiServer/db/MysqlAdapter.d.ts +1 -1
- package/dist/apiServer/db/MysqlAdapter.js +37 -12
- package/dist/apiServer/deployment/Activate.js +1 -2
- package/dist/apiServer/deployment/ConfigService.d.ts +26 -26
- package/dist/apiServer/deployment/ConfigService.js +17 -7
- package/dist/apiServer/deployment/Deploy.js +1 -2
- package/dist/apiServer/deployment/DeployerService.d.ts +9 -9
- package/dist/apiServer/deployment/cli.js +37 -14
- package/dist/apiServer/deployment/resolveConfig.js +2 -3
- package/dist/apiServer/documentation/index.html +25 -25
- package/dist/apiServer/external/ExternalService.js +17 -7
- package/dist/apiServer/external/MicroserviceClient.js +17 -7
- package/dist/apiServer/external/MicroserviceHost.js +17 -7
- package/dist/apiServer/external/MicroserviceHostController.js +17 -7
- package/dist/apiServer/helper/JSONStableStringify.js +1 -2
- package/dist/apiServer/helper/YYYYMMDDHH.js +2 -3
- package/dist/apiServer/helper/ZipUtils.d.ts +0 -2
- package/dist/apiServer/monitor/Monitor.d.ts +1 -0
- package/dist/apiServer/monitor/Monitor.js +5 -0
- package/dist/apiServer/monitor/ProcessMonitor.d.ts +45 -1
- package/dist/apiServer/monitor/ProcessMonitor.js +147 -0
- package/dist/apiServer/monitor/SystemInfo.d.ts +7 -8
- package/dist/apiServer/monitor/SystemInfo.js +1 -2
- package/dist/apiServer/monitor/index.html +54 -54
- package/dist/apiServer/structures/Interfaces.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Application, Response } from 'express';
|
|
3
2
|
import { BaseService, IBaseService } from './BaseService';
|
|
4
3
|
import { IBaseEndpoint } from './BaseEndpoint';
|
|
@@ -54,9 +53,9 @@ export interface APIServiceOptions<TInterceptor = unknown> {
|
|
|
54
53
|
fileLimit: number;
|
|
55
54
|
}
|
|
56
55
|
type InferInterceptor<T> = T extends IInterceptor<infer U> ? U : unknown;
|
|
57
|
-
export declare const getDefaultOptions: <I extends IInterceptor<any> | undefined>(overrides?:
|
|
58
|
-
interceptor?: I
|
|
59
|
-
})
|
|
56
|
+
export declare const getDefaultOptions: <I extends IInterceptor<any> | undefined>(overrides?: Omit<Partial<APIServiceOptions<InferInterceptor<NonNullable<I>>>>, "interceptor"> & {
|
|
57
|
+
interceptor?: I;
|
|
58
|
+
}) => APIServiceOptions<InferInterceptor<NonNullable<I>>>;
|
|
60
59
|
export declare const REQ_HTTP_LOG: Req<void, APIServiceNetworkLogItem[]>;
|
|
61
60
|
export declare const REQ_HTTP_REQUESTS_COUNT: Req<void, number>;
|
|
62
61
|
export declare const REQ_HTTP_SERVER: Req<void, {
|
|
@@ -15,18 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.APIService = exports.
|
|
39
|
+
exports.APIService = exports.S_APP_STARTED = exports.REQ_DOC_USERS = exports.REQ_MONITOR_USERS = exports.REQ_INTERNAL_CALL = exports.REQ_HTTP_SERVER = exports.REQ_HTTP_REQUESTS_COUNT = exports.REQ_HTTP_LOG = exports.getDefaultOptions = void 0;
|
|
40
|
+
exports.Initializer = Initializer;
|
|
30
41
|
const express_1 = __importDefault(require("express"));
|
|
31
42
|
const BaseService_1 = require("./BaseService");
|
|
32
43
|
const cors_1 = __importDefault(require("cors"));
|
|
@@ -107,7 +118,6 @@ async function Initializer(services) {
|
|
|
107
118
|
i.applicationReady();
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
|
-
exports.Initializer = Initializer;
|
|
111
121
|
class APIService extends BaseService_1.BaseService {
|
|
112
122
|
version = PACKAGE_VERSION;
|
|
113
123
|
options;
|
|
@@ -73,8 +73,8 @@ export declare class BaseEndpoint implements IBaseEndpoint {
|
|
|
73
73
|
asStream: boolean;
|
|
74
74
|
hasValidationModel: boolean;
|
|
75
75
|
hasResultModel: boolean;
|
|
76
|
-
description?: string
|
|
77
|
-
title?: string
|
|
76
|
+
description?: string;
|
|
77
|
+
title?: string;
|
|
78
78
|
}[];
|
|
79
79
|
};
|
|
80
80
|
__precheck(req: HTTPRequestVO): Promise<TransferPacketVO<any> | null>;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.LogService = exports.REQ_LOG_UNIQUE_SERVICES = exports.REQ_LOG = exports.S_LOG_SET_TEXT_LIMIT = exports.S_LOG_REMOVE_SERVICE_FROM_WATCH = exports.S_LOG_ADD_SERVICE_TO_WATCH = exports.S_LOG_FLUSH = exports.REQ_CURRENT_LOG_LEVEL = exports.S_LOG_CHANGE_LEVEL = exports.S_LOG_CREATED = exports.S_LOG = exports.logAPI = exports.logDB = exports.logError = exports.logCrit = exports.logWarn = exports.logInfo = exports.getDefaultLogOptions = exports.LOG_LEVEL = void 0;
|
|
27
37
|
const badmfck_signal_1 = __importStar(require("badmfck-signal"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { BaseService } from "./BaseService";
|
|
3
2
|
import Signal, { Req } from "badmfck-signal";
|
|
4
3
|
import * as mysql from "mysql2/promise";
|
|
5
4
|
import fs from "fs";
|
|
6
5
|
export declare const DEPRECATED_S_MYSQL_STARTED: Signal<void>;
|
|
7
|
-
export declare const DEPRECATED_REQ_MYSQL_QUERY: Req<MySqlQuery | MySqlQuery
|
|
6
|
+
export declare const DEPRECATED_REQ_MYSQL_QUERY: Req<MySqlQuery[] | MySqlQuery, MysqlResult[]>;
|
|
8
7
|
export declare const DEPRECATED_REQ_MYSQL_TBEGIN: Req<void, number | MysqlError>;
|
|
9
8
|
export declare const DEPRECATED_REQ_MYSQL_TQUERY: Req<{
|
|
10
9
|
query: MySqlQuery;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.TimeframeService = exports.S_TIMEFRAME_TASK_EXECUTED = exports.REQ_TIMEFRAME_TASK_ADD = void 0;
|
|
27
37
|
const badmfck_signal_1 = __importStar(require("badmfck-signal"));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { DBAdapterOptions, IDBBulkQuery, IDBError, IDBQuery, IDBQueryField, IDBResult, IDBStatFrame } from "../DBService";
|
|
3
2
|
import { IDBAdapter } from "./IDBAdapter";
|
|
4
3
|
import mysql from 'mysql2/promise';
|
|
@@ -44,6 +43,7 @@ export declare class MysqlAdapter implements IDBAdapter {
|
|
|
44
43
|
poolConnections: number;
|
|
45
44
|
acquiredPoolConnections: number;
|
|
46
45
|
};
|
|
46
|
+
isCleanupRunning: boolean;
|
|
47
47
|
setupTimers(): void;
|
|
48
48
|
recreatePool(): Promise<boolean>;
|
|
49
49
|
tBegin(): Promise<IDBResult>;
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.MysqlAdapter = void 0;
|
|
7
|
+
exports.isError = isError;
|
|
7
8
|
const promise_1 = __importDefault(require("mysql2/promise"));
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const LogService_1 = require("../LogService");
|
|
@@ -127,15 +128,21 @@ class MysqlAdapter {
|
|
|
127
128
|
acquiredPoolConnections: this.acquiredPoolConnections
|
|
128
129
|
};
|
|
129
130
|
}
|
|
131
|
+
isCleanupRunning = false;
|
|
130
132
|
setupTimers() {
|
|
131
|
-
setInterval(() => {
|
|
133
|
+
setInterval(async () => {
|
|
134
|
+
if (this.isCleanupRunning) {
|
|
135
|
+
(0, LogService_1.logError)("MysqlAdapter", "Cleanup already running, skipping this iteration");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.isCleanupRunning = true;
|
|
132
139
|
const now = Date.now();
|
|
133
140
|
const count = this.transactions.length;
|
|
134
141
|
const removedIDs = [];
|
|
135
142
|
for (let i of this.transactions) {
|
|
136
143
|
if (now - i.timestamp > this.maxTransactionWaitTime) {
|
|
137
144
|
(0, LogService_1.logError)("Release transaction connection due to timeout");
|
|
138
|
-
this.rollbackTransaction(i, true);
|
|
145
|
+
await this.rollbackTransaction(i, true);
|
|
139
146
|
removedIDs.push(i.id);
|
|
140
147
|
}
|
|
141
148
|
}
|
|
@@ -149,6 +156,7 @@ class MysqlAdapter {
|
|
|
149
156
|
this.query({ query: "SELECT 1 @NOLIMIT" });
|
|
150
157
|
}
|
|
151
158
|
}
|
|
159
|
+
this.isCleanupRunning = false;
|
|
152
160
|
}, 1000 * 30);
|
|
153
161
|
setInterval(() => {
|
|
154
162
|
if (!this.failReportFileStream)
|
|
@@ -256,7 +264,7 @@ class MysqlAdapter {
|
|
|
256
264
|
if (result.error) {
|
|
257
265
|
(0, LogService_1.logCrit)("Can't start transaction! " + result.error.message);
|
|
258
266
|
trxRequest.queries.push({ sql: "START TRANSACTION", status: "error" });
|
|
259
|
-
this.rollbackTransaction(trxRequest);
|
|
267
|
+
await this.rollbackTransaction(trxRequest);
|
|
260
268
|
return result;
|
|
261
269
|
}
|
|
262
270
|
trxRequest.queries.push({ sql: "START TRANSACTION", status: "ok" });
|
|
@@ -333,7 +341,16 @@ class MysqlAdapter {
|
|
|
333
341
|
}
|
|
334
342
|
};
|
|
335
343
|
}
|
|
336
|
-
await this.rollbackTransaction(trx);
|
|
344
|
+
const err = await this.rollbackTransaction(trx);
|
|
345
|
+
if (err) {
|
|
346
|
+
return {
|
|
347
|
+
error: err,
|
|
348
|
+
execution: {
|
|
349
|
+
started_at: executionStartTime,
|
|
350
|
+
finished_at: Date.now()
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
337
354
|
return {
|
|
338
355
|
data: true,
|
|
339
356
|
execution: {
|
|
@@ -536,12 +553,10 @@ class MysqlAdapter {
|
|
|
536
553
|
if (!request.transactionID && doCloseConnection)
|
|
537
554
|
this.finalizeConnection(conn);
|
|
538
555
|
else if (request.transactionID && request.throwable) {
|
|
539
|
-
this.rollbackTransaction(this.transactions.find(i => i.id === request.transactionID));
|
|
540
|
-
this.finalizeConnection(conn);
|
|
556
|
+
await this.rollbackTransaction(this.transactions.find(i => i.id === request.transactionID));
|
|
541
557
|
}
|
|
542
558
|
if (request.transactionID && request.rollbackOnFail && !request.throwable) {
|
|
543
|
-
this.rollbackTransaction(this.transactions.find(i => i.id === request.transactionID));
|
|
544
|
-
this.finalizeConnection(conn);
|
|
559
|
+
await this.rollbackTransaction(this.transactions.find(i => i.id === request.transactionID));
|
|
545
560
|
}
|
|
546
561
|
const error = this.createMysqlQueryError(e);
|
|
547
562
|
if (trx)
|
|
@@ -737,6 +752,10 @@ class MysqlAdapter {
|
|
|
737
752
|
}
|
|
738
753
|
async rollbackTransaction(trx, donNotRemove) {
|
|
739
754
|
let err = null;
|
|
755
|
+
if (!trx) {
|
|
756
|
+
(0, LogService_1.logCrit)("MysqlAdapter", "Can't rollback transaction, trx is null");
|
|
757
|
+
return this.createMysqlQueryError(new Error("Transaction is null"));
|
|
758
|
+
}
|
|
740
759
|
try {
|
|
741
760
|
(0, LogService_1.logDB)("Rollback started", trx.conn.threadId);
|
|
742
761
|
await trx.conn.rollback();
|
|
@@ -753,13 +772,20 @@ class MysqlAdapter {
|
|
|
753
772
|
(0, LogService_1.logCrit)("MysqlAdapter", "Can't rollback transaction", trx.queries);
|
|
754
773
|
err = this.createMysqlQueryError(e);
|
|
755
774
|
trx.queries.push({ sql: "ROLLBACK", status: "fail" });
|
|
775
|
+
try {
|
|
776
|
+
trx.conn.destroy();
|
|
777
|
+
}
|
|
778
|
+
catch (e) {
|
|
779
|
+
(0, LogService_1.logCrit)("MysqlAdapter", "Can't destroy broken connection", e);
|
|
780
|
+
}
|
|
781
|
+
this.transactions = this.transactions.filter(i => i.id !== trx.id);
|
|
756
782
|
}
|
|
757
783
|
return err;
|
|
758
784
|
}
|
|
759
785
|
async finish() {
|
|
760
786
|
(0, LogService_1.logInfo)("Finishing mysql service");
|
|
761
|
-
for (
|
|
762
|
-
this.rollbackTransaction(
|
|
787
|
+
for (const trx of [...this.transactions])
|
|
788
|
+
await this.rollbackTransaction(trx);
|
|
763
789
|
if (this.pool) {
|
|
764
790
|
try {
|
|
765
791
|
await this.pool.end();
|
|
@@ -843,7 +869,6 @@ exports.MysqlAdapter = MysqlAdapter;
|
|
|
843
869
|
function isError(obj) {
|
|
844
870
|
return obj && "code" in obj && "errno" in obj && "name" in obj && "message" in obj;
|
|
845
871
|
}
|
|
846
|
-
exports.isError = isError;
|
|
847
872
|
const secret_key = "AKLWkajw%^&dgwqhw#98453i23bfk23rn2knknglrgjeit";
|
|
848
873
|
const secret_iv = "rthadrfk23rn2kn#*FNKA@gt44df3tslrgj##!it";
|
|
849
874
|
const key = (0, crypto_1.createHash)('sha512').update(secret_key).digest('hex').substring(0, 32);
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Activate =
|
|
6
|
+
exports.Activate = Activate;
|
|
7
7
|
const crypto_1 = __importDefault(require("crypto"));
|
|
8
8
|
const __1 = require("../..");
|
|
9
9
|
const resolveConfig_1 = require("./resolveConfig");
|
|
@@ -125,4 +125,3 @@ async function Activate(opt, scheme) {
|
|
|
125
125
|
console.log("");
|
|
126
126
|
return active;
|
|
127
127
|
}
|
|
128
|
-
exports.Activate = Activate;
|
|
@@ -60,21 +60,6 @@ declare const _TConfig: {
|
|
|
60
60
|
};
|
|
61
61
|
export type IConfig = ValidationModel<typeof _TConfig>;
|
|
62
62
|
export declare const REQ_DEPLOYMENT_CONFIG: Req<void, Map<string, {
|
|
63
|
-
pm2_attributes?: string[] | undefined;
|
|
64
|
-
liveness?: string | undefined;
|
|
65
|
-
readiness?: string | undefined;
|
|
66
|
-
bluegreen?: {
|
|
67
|
-
blue_pm2_attributes?: string[] | undefined;
|
|
68
|
-
green_pm2_attributes?: string[] | undefined;
|
|
69
|
-
on_switch?: string[] | undefined;
|
|
70
|
-
blue_config: {};
|
|
71
|
-
green_config: {};
|
|
72
|
-
} | undefined;
|
|
73
|
-
nginx?: {
|
|
74
|
-
config_dir?: string | undefined;
|
|
75
|
-
domain?: string | undefined;
|
|
76
|
-
upstream_name?: string | undefined;
|
|
77
|
-
} | undefined;
|
|
78
63
|
name: string;
|
|
79
64
|
destination: string;
|
|
80
65
|
description: string;
|
|
@@ -84,27 +69,27 @@ export declare const REQ_DEPLOYMENT_CONFIG: Req<void, Map<string, {
|
|
|
84
69
|
backup: boolean;
|
|
85
70
|
install: boolean;
|
|
86
71
|
pm2: boolean;
|
|
72
|
+
pm2_attributes?: string[] | undefined;
|
|
87
73
|
chmod: number;
|
|
88
74
|
email: string[];
|
|
89
75
|
phone: string[];
|
|
90
|
-
config: {};
|
|
91
|
-
}>>;
|
|
92
|
-
export declare const REQ_DEPLOYMENT_CONFIG_ADD: Req<{
|
|
93
|
-
pm2_attributes?: string[] | undefined;
|
|
94
76
|
liveness?: string | undefined;
|
|
95
77
|
readiness?: string | undefined;
|
|
78
|
+
config: {};
|
|
96
79
|
bluegreen?: {
|
|
80
|
+
blue_config: {};
|
|
97
81
|
blue_pm2_attributes?: string[] | undefined;
|
|
82
|
+
green_config: {};
|
|
98
83
|
green_pm2_attributes?: string[] | undefined;
|
|
99
84
|
on_switch?: string[] | undefined;
|
|
100
|
-
blue_config: {};
|
|
101
|
-
green_config: {};
|
|
102
85
|
} | undefined;
|
|
103
86
|
nginx?: {
|
|
104
87
|
config_dir?: string | undefined;
|
|
105
88
|
domain?: string | undefined;
|
|
106
89
|
upstream_name?: string | undefined;
|
|
107
90
|
} | undefined;
|
|
91
|
+
}>>;
|
|
92
|
+
export declare const REQ_DEPLOYMENT_CONFIG_ADD: Req<{
|
|
108
93
|
name: string;
|
|
109
94
|
destination: string;
|
|
110
95
|
description: string;
|
|
@@ -114,26 +99,26 @@ export declare const REQ_DEPLOYMENT_CONFIG_ADD: Req<{
|
|
|
114
99
|
backup: boolean;
|
|
115
100
|
install: boolean;
|
|
116
101
|
pm2: boolean;
|
|
102
|
+
pm2_attributes?: string[] | undefined;
|
|
117
103
|
chmod: number;
|
|
118
104
|
email: string[];
|
|
119
105
|
phone: string[];
|
|
120
|
-
config: {};
|
|
121
|
-
}, IError | {
|
|
122
|
-
pm2_attributes?: string[] | undefined;
|
|
123
106
|
liveness?: string | undefined;
|
|
124
107
|
readiness?: string | undefined;
|
|
108
|
+
config: {};
|
|
125
109
|
bluegreen?: {
|
|
110
|
+
blue_config: {};
|
|
126
111
|
blue_pm2_attributes?: string[] | undefined;
|
|
112
|
+
green_config: {};
|
|
127
113
|
green_pm2_attributes?: string[] | undefined;
|
|
128
114
|
on_switch?: string[] | undefined;
|
|
129
|
-
blue_config: {};
|
|
130
|
-
green_config: {};
|
|
131
115
|
} | undefined;
|
|
132
116
|
nginx?: {
|
|
133
117
|
config_dir?: string | undefined;
|
|
134
118
|
domain?: string | undefined;
|
|
135
119
|
upstream_name?: string | undefined;
|
|
136
120
|
} | undefined;
|
|
121
|
+
}, IError | {
|
|
137
122
|
name: string;
|
|
138
123
|
destination: string;
|
|
139
124
|
description: string;
|
|
@@ -143,10 +128,25 @@ export declare const REQ_DEPLOYMENT_CONFIG_ADD: Req<{
|
|
|
143
128
|
backup: boolean;
|
|
144
129
|
install: boolean;
|
|
145
130
|
pm2: boolean;
|
|
131
|
+
pm2_attributes?: string[] | undefined;
|
|
146
132
|
chmod: number;
|
|
147
133
|
email: string[];
|
|
148
134
|
phone: string[];
|
|
135
|
+
liveness?: string | undefined;
|
|
136
|
+
readiness?: string | undefined;
|
|
149
137
|
config: {};
|
|
138
|
+
bluegreen?: {
|
|
139
|
+
blue_config: {};
|
|
140
|
+
blue_pm2_attributes?: string[] | undefined;
|
|
141
|
+
green_config: {};
|
|
142
|
+
green_pm2_attributes?: string[] | undefined;
|
|
143
|
+
on_switch?: string[] | undefined;
|
|
144
|
+
} | undefined;
|
|
145
|
+
nginx?: {
|
|
146
|
+
config_dir?: string | undefined;
|
|
147
|
+
domain?: string | undefined;
|
|
148
|
+
upstream_name?: string | undefined;
|
|
149
|
+
} | undefined;
|
|
150
150
|
}>;
|
|
151
151
|
export declare const REQ_DEPLOYMENT_CONFIG_DELETE: Req<string, boolean | IError>;
|
|
152
152
|
export declare const S_CONFIG_UPDATED: Signal<void>;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Deploy =
|
|
6
|
+
exports.Deploy = Deploy;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -272,7 +272,6 @@ async function Deploy(opt) {
|
|
|
272
272
|
console.log("");
|
|
273
273
|
return archiveName;
|
|
274
274
|
}
|
|
275
|
-
exports.Deploy = Deploy;
|
|
276
275
|
function run(cmd) {
|
|
277
276
|
try {
|
|
278
277
|
return (0, child_process_1.execSync)(cmd, { encoding: "utf-8" });
|
|
@@ -32,14 +32,14 @@ export declare const REQ_DEPLOYMENT_PROCEED: Req<{
|
|
|
32
32
|
};
|
|
33
33
|
}, any>;
|
|
34
34
|
export declare const REQ_DEPLOYMENT_SWITCH: Req<{
|
|
35
|
-
auth?: string
|
|
35
|
+
auth?: string;
|
|
36
36
|
name: string;
|
|
37
37
|
token: string;
|
|
38
|
-
scheme?: "blue" | "green"
|
|
38
|
+
scheme?: "blue" | "green";
|
|
39
39
|
}, any>;
|
|
40
40
|
export declare const REQ_DEPLOYMENT_STATUS: Req<{
|
|
41
|
-
auth?: string
|
|
42
|
-
name?: string
|
|
41
|
+
auth?: string;
|
|
42
|
+
name?: string;
|
|
43
43
|
}, any>;
|
|
44
44
|
export declare class DeployerService extends BaseService {
|
|
45
45
|
options: IDeployerServiceOptions;
|
|
@@ -68,6 +68,7 @@ export declare class DeployerService extends BaseService {
|
|
|
68
68
|
};
|
|
69
69
|
data?: undefined;
|
|
70
70
|
} | {
|
|
71
|
+
error?: undefined;
|
|
71
72
|
data: {
|
|
72
73
|
ok: boolean;
|
|
73
74
|
project: string;
|
|
@@ -76,7 +77,6 @@ export declare class DeployerService extends BaseService {
|
|
|
76
77
|
active: "blue" | "green" | null;
|
|
77
78
|
activeThisDeploy: boolean;
|
|
78
79
|
};
|
|
79
|
-
error?: undefined;
|
|
80
80
|
}>;
|
|
81
81
|
switchSlot(data: {
|
|
82
82
|
auth?: string;
|
|
@@ -84,38 +84,38 @@ export declare class DeployerService extends BaseService {
|
|
|
84
84
|
token: string;
|
|
85
85
|
scheme?: "blue" | "green";
|
|
86
86
|
}): Promise<{
|
|
87
|
+
data?: undefined;
|
|
87
88
|
error: {
|
|
88
89
|
code: number;
|
|
89
90
|
message: string;
|
|
90
91
|
httpStatus: number;
|
|
91
92
|
};
|
|
92
|
-
data?: undefined;
|
|
93
93
|
} | {
|
|
94
|
+
error?: undefined;
|
|
94
95
|
data: {
|
|
95
96
|
active: "blue" | "green";
|
|
96
97
|
previousActive: "blue" | "green";
|
|
97
98
|
action: "rollback" | "switch";
|
|
98
99
|
hookError: string | null;
|
|
99
100
|
};
|
|
100
|
-
error?: undefined;
|
|
101
101
|
}>;
|
|
102
102
|
status(data: {
|
|
103
103
|
auth?: string;
|
|
104
104
|
name?: string;
|
|
105
105
|
}): Promise<{
|
|
106
|
+
data?: undefined;
|
|
106
107
|
error: {
|
|
107
108
|
code: number;
|
|
108
109
|
message: string;
|
|
109
110
|
httpStatus: number;
|
|
110
111
|
};
|
|
111
|
-
data?: undefined;
|
|
112
112
|
} | {
|
|
113
|
+
error?: undefined;
|
|
113
114
|
data: Record<string, {
|
|
114
115
|
hasBlueGreen: boolean;
|
|
115
116
|
state: IProjectState | null;
|
|
116
117
|
readyToSwitch: boolean;
|
|
117
118
|
}>;
|
|
118
|
-
error?: undefined;
|
|
119
119
|
}>;
|
|
120
120
|
tokensMatch(a: string | undefined, b: string | undefined): boolean;
|
|
121
121
|
private _checkUserAuth;
|