badmfck-api-server 6.0.1 → 6.0.3
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/README.md +162 -10
- package/dist/apiServer/APIService.js +2 -0
- package/dist/apiServer/deployment/ConfigService.d.ts +23 -66
- package/dist/apiServer/deployment/ConfigService.js +20 -77
- package/dist/apiServer/deployment/Deploy.js +18 -0
- package/dist/apiServer/deployment/Deployer.js +5 -5
- package/dist/apiServer/deployment/DeployerService.d.ts +66 -4
- package/dist/apiServer/deployment/DeployerService.js +408 -43
- package/dist/apiServer/deployment/HashPassword.d.ts +1 -0
- package/dist/apiServer/deployment/HashPassword.js +34 -0
- package/dist/apiServer/deployment/Notifier.d.ts +14 -0
- package/dist/apiServer/deployment/Notifier.js +22 -0
- package/dist/apiServer/deployment/ReviewStore.d.ts +62 -0
- package/dist/apiServer/deployment/ReviewStore.js +186 -0
- package/dist/apiServer/deployment/SecretsInjector.d.ts +21 -0
- package/dist/apiServer/deployment/SecretsInjector.js +188 -0
- package/dist/apiServer/deployment/cli.js +10 -0
- package/dist/apiServer/review/Review.d.ts +23 -0
- package/dist/apiServer/review/Review.js +149 -0
- package/dist/apiServer/review/ReviewAuth.d.ts +56 -0
- package/dist/apiServer/review/ReviewAuth.js +147 -0
- package/dist/apiServer/review/ReviewDiff.d.ts +43 -0
- package/dist/apiServer/review/ReviewDiff.js +175 -0
- package/dist/apiServer/review/index.html +501 -0
- package/package.json +2 -2
|
@@ -5,6 +5,8 @@ import { UploadedFile } from "express-fileupload";
|
|
|
5
5
|
import { ValidationModel } from "../..";
|
|
6
6
|
import { IDeploymentNotifier } from "./Notifier";
|
|
7
7
|
import { IError } from "../structures/Interfaces";
|
|
8
|
+
import net from "net";
|
|
9
|
+
import { IPendingReview, ReviewStore } from "./ReviewStore";
|
|
8
10
|
declare const _TSetup: {
|
|
9
11
|
readonly users: readonly [{
|
|
10
12
|
readonly login: "";
|
|
@@ -19,6 +21,18 @@ declare const _TSetup: {
|
|
|
19
21
|
readonly $__notifier_optional: true;
|
|
20
22
|
readonly status_url: "";
|
|
21
23
|
readonly $__status_url_optional: true;
|
|
24
|
+
readonly allowed_ips: readonly [""];
|
|
25
|
+
readonly $__allowed_ips_optional: true;
|
|
26
|
+
readonly reviewers: readonly [{
|
|
27
|
+
readonly login: "";
|
|
28
|
+
readonly password: "";
|
|
29
|
+
readonly email: "";
|
|
30
|
+
}];
|
|
31
|
+
readonly $__reviewers_optional: true;
|
|
32
|
+
readonly review_url: "";
|
|
33
|
+
readonly $__review_url_optional: true;
|
|
34
|
+
readonly secrets_dir: "";
|
|
35
|
+
readonly $__secrets_dir_optional: true;
|
|
22
36
|
};
|
|
23
37
|
export type TDeployerSetup = ValidationModel<typeof _TSetup>;
|
|
24
38
|
export interface IDeployerServiceOptions {
|
|
@@ -30,6 +44,7 @@ export interface IDeployerServiceOptions {
|
|
|
30
44
|
export declare const REQ_DEPLOYMENT_PROCEED: Req<{
|
|
31
45
|
auth: string;
|
|
32
46
|
authLogin?: string;
|
|
47
|
+
ip?: string;
|
|
33
48
|
name: string;
|
|
34
49
|
token: string;
|
|
35
50
|
files: {
|
|
@@ -39,6 +54,7 @@ export declare const REQ_DEPLOYMENT_PROCEED: Req<{
|
|
|
39
54
|
export declare const REQ_DEPLOYMENT_SWITCH: Req<{
|
|
40
55
|
auth?: string;
|
|
41
56
|
authLogin?: string;
|
|
57
|
+
ip?: string;
|
|
42
58
|
name: string;
|
|
43
59
|
token: string;
|
|
44
60
|
scheme?: "blue" | "green";
|
|
@@ -46,6 +62,7 @@ export declare const REQ_DEPLOYMENT_SWITCH: Req<{
|
|
|
46
62
|
export declare const REQ_DEPLOYMENT_STATUS: Req<{
|
|
47
63
|
auth?: string;
|
|
48
64
|
authLogin?: string;
|
|
65
|
+
ip?: string;
|
|
49
66
|
name?: string;
|
|
50
67
|
}, any>;
|
|
51
68
|
export declare const REQ_DEPLOYMENT_SLOT: Req<{
|
|
@@ -56,11 +73,13 @@ export declare const REQ_DEPLOYMENT_SLOT: Req<{
|
|
|
56
73
|
export declare const REQ_DEPLOYMENT_BACKUPS: Req<{
|
|
57
74
|
auth?: string;
|
|
58
75
|
authLogin?: string;
|
|
76
|
+
ip?: string;
|
|
59
77
|
name: string;
|
|
60
78
|
}, any>;
|
|
61
79
|
export declare const REQ_DEPLOYMENT_RESTORE: Req<{
|
|
62
80
|
auth?: string;
|
|
63
81
|
authLogin?: string;
|
|
82
|
+
ip?: string;
|
|
64
83
|
name: string;
|
|
65
84
|
token: string;
|
|
66
85
|
backup: string;
|
|
@@ -72,16 +91,19 @@ export declare class DeployerService extends BaseService {
|
|
|
72
91
|
setup: TDeployerSetup | null;
|
|
73
92
|
notifier: IDeploymentNotifier | null;
|
|
74
93
|
busy: Map<string, boolean>;
|
|
94
|
+
reviews: ReviewStore;
|
|
75
95
|
private _setupWatchDebounceTimer;
|
|
76
96
|
private _lastSetupHash;
|
|
77
97
|
constructor(options: IDeployerServiceOptions);
|
|
78
98
|
init(): Promise<void>;
|
|
99
|
+
private _checkReviewSetup;
|
|
79
100
|
private _loadSetup;
|
|
80
101
|
private _reloadSetup;
|
|
81
102
|
private _watchSetup;
|
|
82
103
|
proceed(data: {
|
|
83
104
|
auth?: string;
|
|
84
105
|
authLogin?: string;
|
|
106
|
+
ip?: string;
|
|
85
107
|
name: string;
|
|
86
108
|
token: string;
|
|
87
109
|
files: {
|
|
@@ -95,7 +117,6 @@ export declare class DeployerService extends BaseService {
|
|
|
95
117
|
};
|
|
96
118
|
data?: undefined;
|
|
97
119
|
} | {
|
|
98
|
-
error?: undefined;
|
|
99
120
|
data: {
|
|
100
121
|
ok: boolean;
|
|
101
122
|
project: string;
|
|
@@ -104,10 +125,33 @@ export declare class DeployerService extends BaseService {
|
|
|
104
125
|
active: "blue" | "green" | null;
|
|
105
126
|
activeThisDeploy: boolean;
|
|
106
127
|
};
|
|
128
|
+
error?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
error?: undefined;
|
|
131
|
+
data: {
|
|
132
|
+
ok: boolean;
|
|
133
|
+
project: string;
|
|
134
|
+
pendingReview: boolean;
|
|
135
|
+
mode: "all" | "any";
|
|
136
|
+
reviewers: string[];
|
|
137
|
+
notNotified: string[];
|
|
138
|
+
expiresAt: number;
|
|
139
|
+
replacedPrevious: boolean;
|
|
140
|
+
};
|
|
141
|
+
}>;
|
|
142
|
+
private _deploy;
|
|
143
|
+
private _reviewSetup;
|
|
144
|
+
private _queueForReview;
|
|
145
|
+
reviewDecide(project: string, sha256: string, reviewer: string, decision: "accept" | "decline", ip: string | null): Promise<{
|
|
146
|
+
pending?: IPendingReview;
|
|
147
|
+
error?: string;
|
|
107
148
|
}>;
|
|
149
|
+
private _deployApproved;
|
|
150
|
+
private _copyArchive;
|
|
108
151
|
switchSlot(data: {
|
|
109
152
|
auth?: string;
|
|
110
153
|
authLogin?: string;
|
|
154
|
+
ip?: string;
|
|
111
155
|
name: string;
|
|
112
156
|
token: string;
|
|
113
157
|
scheme?: "blue" | "green";
|
|
@@ -130,6 +174,7 @@ export declare class DeployerService extends BaseService {
|
|
|
130
174
|
status(data: {
|
|
131
175
|
auth?: string;
|
|
132
176
|
authLogin?: string;
|
|
177
|
+
ip?: string;
|
|
133
178
|
name?: string;
|
|
134
179
|
}): Promise<{
|
|
135
180
|
data?: undefined;
|
|
@@ -151,6 +196,7 @@ export declare class DeployerService extends BaseService {
|
|
|
151
196
|
listBackups(data: {
|
|
152
197
|
auth?: string;
|
|
153
198
|
authLogin?: string;
|
|
199
|
+
ip?: string;
|
|
154
200
|
name: string;
|
|
155
201
|
}): Promise<{
|
|
156
202
|
data?: undefined;
|
|
@@ -173,16 +219,17 @@ export declare class DeployerService extends BaseService {
|
|
|
173
219
|
restoreBackup(data: {
|
|
174
220
|
auth?: string;
|
|
175
221
|
authLogin?: string;
|
|
222
|
+
ip?: string;
|
|
176
223
|
name: string;
|
|
177
224
|
token: string;
|
|
178
225
|
backup: string;
|
|
179
226
|
}): Promise<{
|
|
180
227
|
data?: undefined;
|
|
181
228
|
error: {
|
|
229
|
+
details?: undefined;
|
|
182
230
|
code: number;
|
|
183
231
|
message: string;
|
|
184
232
|
httpStatus: number;
|
|
185
|
-
details?: undefined;
|
|
186
233
|
};
|
|
187
234
|
} | {
|
|
188
235
|
data?: undefined;
|
|
@@ -229,18 +276,33 @@ export declare class DeployerService extends BaseService {
|
|
|
229
276
|
}>;
|
|
230
277
|
private _statusUrl;
|
|
231
278
|
private _writeBlueGreenFiles;
|
|
279
|
+
static PLAINTEXT_TOKEN_ERROR: string;
|
|
280
|
+
private _projectByToken;
|
|
232
281
|
tokensMatch(a: string | undefined, b: string | undefined): boolean;
|
|
282
|
+
static buildAllowList(entries: readonly string[] | undefined | null): {
|
|
283
|
+
list: net.BlockList | null;
|
|
284
|
+
error?: string;
|
|
285
|
+
};
|
|
286
|
+
isIpAllowed(ip: string | undefined): boolean;
|
|
287
|
+
private _ipAllowed;
|
|
233
288
|
private _warnPlaintextUsers;
|
|
234
289
|
static PLAINTEXT_ERROR: string;
|
|
235
290
|
private _checkUserAuth;
|
|
236
291
|
private static _extractPort;
|
|
237
292
|
private _renderNginx;
|
|
293
|
+
private static _pm2AttributesFor;
|
|
238
294
|
runPM2(found: IConfig, projectState?: IProjectState | null): Promise<IError | null>;
|
|
239
295
|
private _verifyAutorestart;
|
|
240
296
|
private static readonly SKIP_DIRS;
|
|
241
297
|
private static readonly TEMPLATE_EXTENSIONS;
|
|
242
|
-
applyConfig(dir: string, config: Record<string, string
|
|
243
|
-
|
|
298
|
+
applyConfig(dir: string, config: Record<string, string>, ctx?: {
|
|
299
|
+
secretsFile: string | null;
|
|
300
|
+
onDisk: string[];
|
|
301
|
+
}): Promise<void>;
|
|
302
|
+
processFile(filePath: string, config: Record<string, string>, ctx?: {
|
|
303
|
+
secretsFile: string | null;
|
|
304
|
+
onDisk: string[];
|
|
305
|
+
}): Promise<void>;
|
|
244
306
|
private _destinationProblem;
|
|
245
307
|
private static _unsafeArchiveEntry;
|
|
246
308
|
private static _escapingSymlink;
|