bdy 1.12.10-dev-pipeline-run → 1.12.10-dev
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/distTs/package.json +13 -12
- package/distTs/src/agent.js +302 -0
- package/distTs/src/api/agent.js +99 -0
- package/distTs/src/api/buddy.js +139 -0
- package/distTs/src/api/socket.js +159 -0
- package/distTs/src/cfg.js +234 -0
- package/distTs/src/command/config.js +17 -0
- package/distTs/src/command/http.js +30 -0
- package/distTs/src/command/start.js +28 -0
- package/distTs/src/command/tcp.js +30 -0
- package/distTs/src/command/tls.js +30 -0
- package/distTs/src/command/ut/upload.js +17 -7
- package/distTs/src/command/vt/compare.js +2 -2
- package/distTs/src/command/vt/exec.js +4 -3
- package/distTs/src/command/vt/storybook.js +4 -3
- package/distTs/src/format.js +0 -19
- package/distTs/src/index.js +0 -2
- package/distTs/src/input.js +17 -139
- package/distTs/src/output/interactive/tunnel.js +860 -0
- package/distTs/src/output/noninteractive/agent/tunnels.js +43 -0
- package/distTs/src/output/noninteractive/config/tunnel.js +65 -0
- package/distTs/src/output/noninteractive/config/tunnels.js +18 -0
- package/distTs/src/output/noninteractive/tunnel.js +59 -0
- package/distTs/src/output.js +0 -6
- package/distTs/src/server/cert.js +52 -0
- package/distTs/src/server/http1.js +75 -0
- package/distTs/src/server/http2.js +78 -0
- package/distTs/src/server/sftp.js +497 -0
- package/distTs/src/server/ssh.js +446 -0
- package/distTs/src/server/tls.js +41 -0
- package/distTs/src/ssh/client.js +197 -0
- package/distTs/src/texts.js +7 -100
- package/distTs/src/tunnel/html/503.html +338 -0
- package/distTs/src/tunnel/tunnel.js +31 -13
- package/distTs/src/tunnel.js +656 -0
- package/distTs/src/unitTest/ci.js +12 -8
- package/distTs/src/utils.js +17 -13
- package/distTs/src/visualTest/context.js +4 -4
- package/distTs/src/visualTest/exec.js +0 -24
- package/distTs/src/visualTest/resources.js +18 -8
- package/package.json +13 -12
- package/distTs/src/api/client.js +0 -112
- package/distTs/src/command/pipeline/run.js +0 -136
- package/distTs/src/command/pipeline.js +0 -12
package/distTs/src/input.js
CHANGED
|
@@ -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
|
};
|
|
@@ -215,138 +225,6 @@ class Input {
|
|
|
215
225
|
}
|
|
216
226
|
return type;
|
|
217
227
|
}
|
|
218
|
-
static restApiToken(token) {
|
|
219
|
-
let t = process.env.BUDDY_TOKEN;
|
|
220
|
-
if (token)
|
|
221
|
-
t = token;
|
|
222
|
-
if (!t) {
|
|
223
|
-
output_1.default.exitError(texts_1.ERR_REST_API_TOKEN);
|
|
224
|
-
}
|
|
225
|
-
return t;
|
|
226
|
-
}
|
|
227
|
-
static pipelineRunPriority(priority) {
|
|
228
|
-
if (!priority)
|
|
229
|
-
return null;
|
|
230
|
-
if (['LOW', 'NORMAL', 'HIGH'].includes(priority))
|
|
231
|
-
return priority;
|
|
232
|
-
output_1.default.exitError(texts_1.ERR_RUN_PIPELINE_WRONG_PRIORITY);
|
|
233
|
-
}
|
|
234
|
-
static pipelineRunAction(actions) {
|
|
235
|
-
if (!actions.length)
|
|
236
|
-
return null;
|
|
237
|
-
const list = [];
|
|
238
|
-
actions.forEach((str) => {
|
|
239
|
-
try {
|
|
240
|
-
const id = parseInt(str, 10);
|
|
241
|
-
if (!isNaN(id)) {
|
|
242
|
-
list.push(id);
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
catch {
|
|
247
|
-
// do nothing
|
|
248
|
-
}
|
|
249
|
-
output_1.default.exitError((0, texts_1.ERR_RUN_PIPELINE_WRONG_ACTION)(str));
|
|
250
|
-
});
|
|
251
|
-
return list;
|
|
252
|
-
}
|
|
253
|
-
static pipelineRunDelay(delay) {
|
|
254
|
-
if (!delay)
|
|
255
|
-
return null;
|
|
256
|
-
try {
|
|
257
|
-
let d = new Date(delay);
|
|
258
|
-
if (!isNaN(d.getTime())) {
|
|
259
|
-
return d.toISOString();
|
|
260
|
-
}
|
|
261
|
-
let h = 0;
|
|
262
|
-
let m = 0;
|
|
263
|
-
let s = 0;
|
|
264
|
-
const rh = delay.match(/(\d+)h/);
|
|
265
|
-
if (rh)
|
|
266
|
-
h = parseInt(rh[1], 10);
|
|
267
|
-
const rm = delay.match(/(\d+)m/);
|
|
268
|
-
if (rm)
|
|
269
|
-
m = parseInt(rm[1], 10);
|
|
270
|
-
const rs = delay.match(/(\d+)s/);
|
|
271
|
-
if (rs)
|
|
272
|
-
s = parseInt(rs[1], 10);
|
|
273
|
-
if (h || m || s) {
|
|
274
|
-
d = new Date();
|
|
275
|
-
d.setTime(d.getTime() + ((h * 60 + m) * 60 + s) * 1000);
|
|
276
|
-
return d.toISOString();
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
catch {
|
|
280
|
-
// do nothing
|
|
281
|
-
}
|
|
282
|
-
output_1.default.exitError(texts_1.ERR_RUN_PIPELINE_WRONG_DELAY);
|
|
283
|
-
}
|
|
284
|
-
static pipelineRunVariable(variable, encrypted) {
|
|
285
|
-
const list = [];
|
|
286
|
-
variable.forEach((v) => {
|
|
287
|
-
const s = v.split(':');
|
|
288
|
-
if (s.length < 2) {
|
|
289
|
-
output_1.default.exitError((0, texts_1.ERR_RUN_PIPELINE_WRONG_VARIABLE)(v));
|
|
290
|
-
}
|
|
291
|
-
list.push({
|
|
292
|
-
key: s.shift() || '',
|
|
293
|
-
value: s.join(':'),
|
|
294
|
-
encrypted,
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
return list;
|
|
298
|
-
}
|
|
299
|
-
static restApiBaseUrl(api, region) {
|
|
300
|
-
let u = process.env.BUDDY_API_ENDPOINT;
|
|
301
|
-
if (api)
|
|
302
|
-
u = api;
|
|
303
|
-
if (!u) {
|
|
304
|
-
let r = process.env.BUDDY_REGION;
|
|
305
|
-
if (region)
|
|
306
|
-
r = region;
|
|
307
|
-
if (r === 'eu')
|
|
308
|
-
u = 'api.eu.buddy.works';
|
|
309
|
-
else if (r === 'us')
|
|
310
|
-
u = 'api.buddy.works';
|
|
311
|
-
}
|
|
312
|
-
if (!u)
|
|
313
|
-
u = 'api.buddy.works';
|
|
314
|
-
u = u.replace(/^https?:\/\//g, '');
|
|
315
|
-
try {
|
|
316
|
-
return new URL(`https://${u}`);
|
|
317
|
-
}
|
|
318
|
-
catch {
|
|
319
|
-
output_1.default.exitError(texts_1.ERR_REST_API_URL);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
static pipelineRunWaitTime(time) {
|
|
323
|
-
let t = Number.parseInt(time, 10);
|
|
324
|
-
if (!t)
|
|
325
|
-
t = 30;
|
|
326
|
-
else if (t < 0)
|
|
327
|
-
t = 1;
|
|
328
|
-
else if (t > 1000)
|
|
329
|
-
t = 1000;
|
|
330
|
-
return t;
|
|
331
|
-
}
|
|
332
|
-
static restApiWorkspace(workspace) {
|
|
333
|
-
let w = process.env.BUDDY_WORKSPACE;
|
|
334
|
-
if (workspace)
|
|
335
|
-
w = workspace;
|
|
336
|
-
if (!w) {
|
|
337
|
-
output_1.default.exitError(texts_1.ERR_REST_API_WORKSPACE);
|
|
338
|
-
}
|
|
339
|
-
return w;
|
|
340
|
-
}
|
|
341
|
-
static restApiProject(project) {
|
|
342
|
-
let p = process.env.BUDDY_PROJECT;
|
|
343
|
-
if (project)
|
|
344
|
-
p = project;
|
|
345
|
-
if (!p) {
|
|
346
|
-
output_1.default.exitError(texts_1.ERR_REST_API_PROJECT);
|
|
347
|
-
}
|
|
348
|
-
return p;
|
|
349
|
-
}
|
|
350
228
|
static name(name) {
|
|
351
229
|
if (name.includes('*')) {
|
|
352
230
|
output_1.default.exitError(texts_1.ERR_NAME_WITHOUT_ASTERISK);
|