bdy 1.18.4-dev → 1.18.6-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 +1 -1
- package/distTs/src/agent/manager.js +20 -18
- package/distTs/src/api/client.js +48 -0
- package/distTs/src/autocomplete.js +10 -5
- package/distTs/src/command/agent/debug.js +6 -6
- package/distTs/src/command/agent/disable.js +2 -2
- package/distTs/src/command/agent/enable.js +2 -2
- package/distTs/src/command/agent/install.js +31 -26
- package/distTs/src/command/agent/proxy/disable.js +2 -2
- package/distTs/src/command/agent/proxy/enable.js +2 -2
- package/distTs/src/command/agent/proxy/status.js +2 -2
- package/distTs/src/command/agent/restart.js +6 -6
- package/distTs/src/command/agent/run.js +3 -3
- package/distTs/src/command/agent/start.js +7 -7
- package/distTs/src/command/agent/stop.js +6 -6
- package/distTs/src/command/agent/tags/get.js +2 -2
- package/distTs/src/command/agent/tags/set.js +2 -2
- package/distTs/src/command/agent/target/disable.js +2 -2
- package/distTs/src/command/agent/target/enable.js +2 -2
- package/distTs/src/command/agent/target/status.js +2 -2
- package/distTs/src/command/agent/tunnel/disable.js +2 -2
- package/distTs/src/command/agent/tunnel/enable.js +2 -2
- package/distTs/src/command/agent/tunnel/http.js +7 -7
- package/distTs/src/command/agent/tunnel/list.js +2 -2
- package/distTs/src/command/agent/tunnel/remove.js +2 -2
- package/distTs/src/command/agent/tunnel/start.js +5 -5
- package/distTs/src/command/agent/tunnel/status.js +4 -4
- package/distTs/src/command/agent/tunnel/tcp.js +7 -7
- package/distTs/src/command/agent/tunnel/tls.js +7 -7
- package/distTs/src/command/agent/uninstall.js +12 -12
- package/distTs/src/command/agent/update.js +9 -9
- package/distTs/src/command/api/info.js +2 -1
- package/distTs/src/command/api/list.js +2 -1
- package/distTs/src/command/api/request.js +2 -2
- package/distTs/src/command/login.js +8 -6
- package/distTs/src/command/package/create.js +2 -2
- package/distTs/src/command/package/download.js +5 -37
- package/distTs/src/command/package/publish.js +7 -6
- package/distTs/src/command/pre.js +5 -5
- package/distTs/src/command/project/link.js +4 -3
- package/distTs/src/command/sandbox/app/list.js +35 -0
- package/distTs/src/command/sandbox/app/logs.js +43 -0
- package/distTs/src/command/sandbox/app/start.js +27 -0
- package/distTs/src/command/sandbox/app/status.js +35 -0
- package/distTs/src/command/sandbox/app/stop.js +27 -0
- package/distTs/src/command/sandbox/app.js +25 -0
- package/distTs/src/command/sandbox/cp.js +7 -39
- package/distTs/src/command/sandbox/create.js +22 -12
- package/distTs/src/command/sandbox/logs.js +26 -0
- package/distTs/src/command/sandbox/snapshot/create.js +2 -2
- package/distTs/src/command/sandbox/update.js +14 -0
- package/distTs/src/command/sandbox.js +4 -0
- package/distTs/src/command/scrape.js +15 -14
- package/distTs/src/command/tunnel/http.js +8 -8
- package/distTs/src/command/tunnel/start.js +9 -9
- package/distTs/src/command/tunnel/tcp.js +8 -8
- package/distTs/src/command/tunnel/tls.js +8 -8
- package/distTs/src/command/ut/upload.js +16 -48
- package/distTs/src/command/vt/close.js +5 -5
- package/distTs/src/command/vt/compare.js +18 -16
- package/distTs/src/command/vt/exec.js +28 -28
- package/distTs/src/command/vt/installBrowser.js +2 -2
- package/distTs/src/command/vt/storybook.js +14 -14
- package/distTs/src/input.js +8 -7
- package/distTs/src/logger.js +3 -3
- package/distTs/src/openapi.js +24 -0
- package/distTs/src/output.js +21 -16
- package/distTs/src/sshKeygen.js +9 -0
- package/distTs/src/texts.js +42 -8
- package/distTs/src/tunnel/cfg.js +17 -20
- package/distTs/src/tunnel/tunnel.js +2 -1
- package/distTs/src/utils.js +9 -28
- package/package.json +1 -1
package/distTs/src/tunnel/cfg.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const path_1 = require("path");
|
|
7
4
|
const fs_1 = require("fs");
|
|
8
5
|
const utils_1 = require("../utils");
|
|
9
|
-
const input_1 = __importDefault(require("../input"));
|
|
10
6
|
const texts_1 = require("../texts");
|
|
11
7
|
const tunnel_1 = require("../types/tunnel");
|
|
12
8
|
class Cfg {
|
|
@@ -71,21 +67,22 @@ class Cfg {
|
|
|
71
67
|
this.json.tunnels = {};
|
|
72
68
|
}
|
|
73
69
|
async prepareTunnel(tunnelType, target, options, useDefaults) {
|
|
74
|
-
const
|
|
70
|
+
const Input = require('../input').default;
|
|
71
|
+
const type = Input.type(tunnelType);
|
|
75
72
|
const tunnel = {
|
|
76
73
|
type,
|
|
77
|
-
target:
|
|
74
|
+
target: Input.target(target, type),
|
|
78
75
|
};
|
|
79
76
|
if (options.region !== undefined)
|
|
80
|
-
tunnel.region =
|
|
77
|
+
tunnel.region = Input.region(options.region);
|
|
81
78
|
else if (useDefaults)
|
|
82
79
|
tunnel.region = this.getRegion();
|
|
83
80
|
if (options.whitelist !== undefined)
|
|
84
|
-
tunnel.whitelist =
|
|
81
|
+
tunnel.whitelist = Input.whitelist(options.whitelist);
|
|
85
82
|
else if (useDefaults)
|
|
86
83
|
tunnel.whitelist = this.getWhitelist();
|
|
87
84
|
if (options.timeout !== undefined)
|
|
88
|
-
tunnel.timeout =
|
|
85
|
+
tunnel.timeout = Input.timeout(options.timeout);
|
|
89
86
|
else if (useDefaults)
|
|
90
87
|
tunnel.timeout = this.getTimeout();
|
|
91
88
|
if (type === tunnel_1.TUNNEL_TYPE.HTTP) {
|
|
@@ -93,7 +90,7 @@ class Cfg {
|
|
|
93
90
|
if (options.host !== undefined)
|
|
94
91
|
tunnel.host = options.host;
|
|
95
92
|
if (options.auth !== undefined) {
|
|
96
|
-
const { password, login } =
|
|
93
|
+
const { password, login } = Input.auth(options.auth);
|
|
97
94
|
tunnel.login = login;
|
|
98
95
|
tunnel.password = password;
|
|
99
96
|
tunnel.authType = tunnel_1.TUNNEL_HTTP_AUTH_TYPE.BASIC;
|
|
@@ -102,34 +99,34 @@ class Cfg {
|
|
|
102
99
|
tunnel.authType = tunnel_1.TUNNEL_HTTP_AUTH_TYPE.BUDDY;
|
|
103
100
|
}
|
|
104
101
|
if (options.ca !== undefined)
|
|
105
|
-
tunnel.ca =
|
|
102
|
+
tunnel.ca = Input.ca(options.ca);
|
|
106
103
|
if (options.serve !== undefined)
|
|
107
|
-
tunnel.serve =
|
|
104
|
+
tunnel.serve = Input.serve(options.serve);
|
|
108
105
|
if (options.useragent !== undefined)
|
|
109
|
-
tunnel.useragents =
|
|
106
|
+
tunnel.useragents = Input.useragents(options.useragent);
|
|
110
107
|
if (options.header !== undefined)
|
|
111
|
-
tunnel.headers =
|
|
108
|
+
tunnel.headers = Input.headers(options.header);
|
|
112
109
|
if (options.responseHeader !== undefined)
|
|
113
|
-
tunnel.responseHeaders =
|
|
110
|
+
tunnel.responseHeaders = Input.headers(options.responseHeader);
|
|
114
111
|
if (options.circuitBreaker !== undefined)
|
|
115
|
-
tunnel.circuitBreaker =
|
|
112
|
+
tunnel.circuitBreaker = Input.circuitBreaker(options.circuitBreaker);
|
|
116
113
|
tunnel.log = !!options.log;
|
|
117
114
|
tunnel.verify = !!options.verify;
|
|
118
115
|
tunnel.http2 = !!options.http2;
|
|
119
116
|
tunnel.compression = !!options.compression;
|
|
120
117
|
}
|
|
121
118
|
else if (type === tunnel_1.TUNNEL_TYPE.TLS) {
|
|
122
|
-
tunnel.terminate =
|
|
119
|
+
tunnel.terminate = Input.terminate(options.terminate);
|
|
123
120
|
if (options.key !== undefined || options.cert !== undefined) {
|
|
124
|
-
const { key, cert } =
|
|
121
|
+
const { key, cert } = Input.keyCert(options.key, options.cert);
|
|
125
122
|
tunnel.key = key;
|
|
126
123
|
tunnel.cert = cert;
|
|
127
124
|
}
|
|
128
125
|
if (options.ca !== undefined)
|
|
129
|
-
tunnel.ca =
|
|
126
|
+
tunnel.ca = Input.ca(options.ca);
|
|
130
127
|
}
|
|
131
128
|
if (options.name !== undefined)
|
|
132
|
-
tunnel.name =
|
|
129
|
+
tunnel.name = Input.name(options.name);
|
|
133
130
|
return tunnel;
|
|
134
131
|
}
|
|
135
132
|
async addTunnel(name, type, target, options) {
|
|
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
const basic_auth_1 = __importDefault(require("basic-auth"));
|
|
40
40
|
const utils_1 = require("../utils");
|
|
41
|
+
const sshKeygen_1 = require("../sshKeygen");
|
|
41
42
|
const latency_1 = __importDefault(require("./latency"));
|
|
42
43
|
const client_1 = __importDefault(require("./ssh/client"));
|
|
43
44
|
const events_1 = __importDefault(require("events"));
|
|
@@ -349,7 +350,7 @@ class Tunnel extends events_1.default {
|
|
|
349
350
|
super();
|
|
350
351
|
this.httpAuthClient = {};
|
|
351
352
|
if (!sshHostKey)
|
|
352
|
-
sshHostKey = (0,
|
|
353
|
+
sshHostKey = (0, sshKeygen_1.createSshHostKey)();
|
|
353
354
|
this.agent = agent;
|
|
354
355
|
this.id = id;
|
|
355
356
|
this.cipherKey = node_crypto_1.default
|
package/distTs/src/utils.js
CHANGED
|
@@ -36,15 +36,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.
|
|
39
|
+
exports.getCurrentVersionWithoutEnv = exports.getVersionWithoutEnv = exports.getVersion = exports.isInstalledByChoco = exports.isInstalledByApt = exports.isInstalledByBrew = exports.isInstalledByNpm = exports.tryGetEmail = exports.execLocally = exports.getHomeDirectory = exports.newCommand = exports.formatBytes = exports.formatHelp = exports.getPlatform = exports.getHostname = exports.isStringRegExp = exports.getWorkingDir = exports.getRootDir = exports.TARGET_ONLY_PORT_REGEX = exports.TARGET_HTTP_REGEX = exports.TARGET_TCP_TLS_REGEX = exports.ApiErrorTunnelsDisabled = exports.ApiErrorWorkspaceFlagged = exports.ApiErrorTunnelLimitReached = exports.ApiErrorAgentLimitReached = exports.ApiErrorDomainRestricted = exports.ApiErrorTargetInvalid = exports.ApiErrorWrongToken = exports.ApiErrorFailedToConnect = exports.ApiErrorAgentNotFound = exports.PACKAGE_AUTH_TYPE = exports.PACKAGE_SCOPE = exports.PACKAGE_TYPE = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_APP_STATUS = exports.SANDBOX_SETUP_STATUS = exports.SANDBOX_EXEC_STATUS = exports.SANDBOX_EXEC_RUNTIME = exports.SANDBOX_STATUS = exports.REST_API_ENDPOINT = exports.REST_API_REGION = exports.SUGGESTED_BROWSER_VERSION = exports.DEFAULT_TIMEOUT = exports.TUNNEL_HTTP_CB_MIN_REQUESTS = exports.TUNNEL_HTTP_CB_WINDOW = exports.TUNNEL_MAX_REQUEST_SIZE_TO_SYNC = exports.TUNNEL_HTTP_LOG_MAX_REQUESTS = exports.TUNNEL_HTTP_LOG_MAX_BODY = exports.TUNNEL_HTTP_RATE_WINDOW = exports.TUNNEL_HTTP_RATE_LIMIT = void 0;
|
|
40
|
+
exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = void 0;
|
|
41
41
|
exports.apiErrorCodeToClass = apiErrorCodeToClass;
|
|
42
42
|
exports.isFile = isFile;
|
|
43
43
|
exports.getAppWorkspaceUrl = getAppWorkspaceUrl;
|
|
44
44
|
exports.getAppWorkspaceSettingsUrl = getAppWorkspaceSettingsUrl;
|
|
45
45
|
exports.getAppUrl = getAppUrl;
|
|
46
46
|
exports.getDockerRegistryHostByApiBaseUrl = getDockerRegistryHostByApiBaseUrl;
|
|
47
|
-
exports.fetchOpenApiSchema = fetchOpenApiSchema;
|
|
48
47
|
exports.openApiPrepareUrl = openApiPrepareUrl;
|
|
49
48
|
exports.getOpenApiEndpointByApiBaseUrl = getOpenApiEndpointByApiBaseUrl;
|
|
50
49
|
exports.isValidDomain = isValidDomain;
|
|
@@ -56,14 +55,10 @@ exports.getAppHostByApiBaseUrl = getAppHostByApiBaseUrl;
|
|
|
56
55
|
const node_path_1 = __importDefault(require("node:path"));
|
|
57
56
|
const node_fs_1 = require("node:fs");
|
|
58
57
|
const texts_1 = require("./texts");
|
|
59
|
-
const ssh2_1 = __importDefault(require("ssh2"));
|
|
60
58
|
const node_sea_1 = require("node:sea");
|
|
61
59
|
const commander_1 = require("commander");
|
|
62
60
|
const node_os_1 = __importStar(require("node:os"));
|
|
63
61
|
const node_child_process_1 = require("node:child_process");
|
|
64
|
-
const bundle_1 = require("@scalar/json-magic/bundle");
|
|
65
|
-
const node_1 = require("@scalar/json-magic/bundle/plugins/node");
|
|
66
|
-
const openapi_parser_1 = require("@scalar/openapi-parser");
|
|
67
62
|
exports.TUNNEL_HTTP_RATE_LIMIT = 2000;
|
|
68
63
|
exports.TUNNEL_HTTP_RATE_WINDOW = 60000;
|
|
69
64
|
exports.TUNNEL_HTTP_LOG_MAX_BODY = 5242880; // 5MB
|
|
@@ -114,6 +109,13 @@ var SANDBOX_SETUP_STATUS;
|
|
|
114
109
|
SANDBOX_SETUP_STATUS["SUCCESS"] = "SUCCESS";
|
|
115
110
|
SANDBOX_SETUP_STATUS["FAILED"] = "FAILED";
|
|
116
111
|
})(SANDBOX_SETUP_STATUS || (exports.SANDBOX_SETUP_STATUS = SANDBOX_SETUP_STATUS = {}));
|
|
112
|
+
var SANDBOX_APP_STATUS;
|
|
113
|
+
(function (SANDBOX_APP_STATUS) {
|
|
114
|
+
SANDBOX_APP_STATUS["NONE"] = "NONE";
|
|
115
|
+
SANDBOX_APP_STATUS["RUNNING"] = "RUNNING";
|
|
116
|
+
SANDBOX_APP_STATUS["ENDED"] = "ENDED";
|
|
117
|
+
SANDBOX_APP_STATUS["FAILED"] = "FAILED";
|
|
118
|
+
})(SANDBOX_APP_STATUS || (exports.SANDBOX_APP_STATUS = SANDBOX_APP_STATUS = {}));
|
|
117
119
|
var SANDBOX_SNAPSHOT_STATUS;
|
|
118
120
|
(function (SANDBOX_SNAPSHOT_STATUS) {
|
|
119
121
|
SANDBOX_SNAPSHOT_STATUS["CREATING"] = "CREATING";
|
|
@@ -504,11 +506,6 @@ const getRealTargetHost = (target) => {
|
|
|
504
506
|
return target || '';
|
|
505
507
|
};
|
|
506
508
|
exports.getRealTargetHost = getRealTargetHost;
|
|
507
|
-
const createSshHostKey = () => {
|
|
508
|
-
const keys = ssh2_1.default.utils.generateKeyPairSync('ed25519', {});
|
|
509
|
-
return keys.private;
|
|
510
|
-
};
|
|
511
|
-
exports.createSshHostKey = createSshHostKey;
|
|
512
509
|
const getBasicCommandTcp = () => {
|
|
513
510
|
const commandTcp = (0, exports.newCommand)('tcp');
|
|
514
511
|
commandTcp.alias('TCP');
|
|
@@ -664,22 +661,6 @@ function getDockerRegistryHostByApiBaseUrl(baseUrl) {
|
|
|
664
661
|
return baseUrl.hostname;
|
|
665
662
|
}
|
|
666
663
|
}
|
|
667
|
-
async function fetchOpenApiSchema(baseUrl) {
|
|
668
|
-
try {
|
|
669
|
-
const url = getOpenApiEndpointByApiBaseUrl(baseUrl);
|
|
670
|
-
const data = await (0, bundle_1.bundle)(url, {
|
|
671
|
-
plugins: [(0, node_1.readFiles)(), (0, node_1.fetchUrls)(), (0, node_1.parseYaml)(), (0, node_1.parseJson)()],
|
|
672
|
-
treeShake: true,
|
|
673
|
-
});
|
|
674
|
-
const { schema } = await (0, openapi_parser_1.dereference)(data);
|
|
675
|
-
if (schema)
|
|
676
|
-
return schema;
|
|
677
|
-
}
|
|
678
|
-
catch {
|
|
679
|
-
// do nothing
|
|
680
|
-
}
|
|
681
|
-
throw new Error(texts_1.ERR_SCHEMA_FETCH_FAILED);
|
|
682
|
-
}
|
|
683
664
|
function openApiPrepareUrl(url, workspace, project) {
|
|
684
665
|
let preparedUrl = url.replaceAll('{workspace_domain}', workspace);
|
|
685
666
|
if (project)
|