bdy 1.18.5-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.
Files changed (62) hide show
  1. package/distTs/package.json +1 -1
  2. package/distTs/src/agent/manager.js +20 -18
  3. package/distTs/src/autocomplete.js +10 -5
  4. package/distTs/src/command/agent/debug.js +6 -6
  5. package/distTs/src/command/agent/disable.js +2 -2
  6. package/distTs/src/command/agent/enable.js +2 -2
  7. package/distTs/src/command/agent/install.js +31 -26
  8. package/distTs/src/command/agent/proxy/disable.js +2 -2
  9. package/distTs/src/command/agent/proxy/enable.js +2 -2
  10. package/distTs/src/command/agent/proxy/status.js +2 -2
  11. package/distTs/src/command/agent/restart.js +6 -6
  12. package/distTs/src/command/agent/run.js +3 -3
  13. package/distTs/src/command/agent/start.js +7 -7
  14. package/distTs/src/command/agent/stop.js +6 -6
  15. package/distTs/src/command/agent/tags/get.js +2 -2
  16. package/distTs/src/command/agent/tags/set.js +2 -2
  17. package/distTs/src/command/agent/target/disable.js +2 -2
  18. package/distTs/src/command/agent/target/enable.js +2 -2
  19. package/distTs/src/command/agent/target/status.js +2 -2
  20. package/distTs/src/command/agent/tunnel/disable.js +2 -2
  21. package/distTs/src/command/agent/tunnel/enable.js +2 -2
  22. package/distTs/src/command/agent/tunnel/http.js +7 -7
  23. package/distTs/src/command/agent/tunnel/list.js +2 -2
  24. package/distTs/src/command/agent/tunnel/remove.js +2 -2
  25. package/distTs/src/command/agent/tunnel/start.js +5 -5
  26. package/distTs/src/command/agent/tunnel/status.js +4 -4
  27. package/distTs/src/command/agent/tunnel/tcp.js +7 -7
  28. package/distTs/src/command/agent/tunnel/tls.js +7 -7
  29. package/distTs/src/command/agent/uninstall.js +12 -12
  30. package/distTs/src/command/agent/update.js +9 -9
  31. package/distTs/src/command/api/info.js +2 -1
  32. package/distTs/src/command/api/list.js +2 -1
  33. package/distTs/src/command/api/request.js +2 -2
  34. package/distTs/src/command/login.js +8 -6
  35. package/distTs/src/command/package/create.js +2 -2
  36. package/distTs/src/command/package/download.js +5 -37
  37. package/distTs/src/command/package/publish.js +7 -6
  38. package/distTs/src/command/pre.js +5 -5
  39. package/distTs/src/command/project/link.js +4 -3
  40. package/distTs/src/command/sandbox/cp.js +7 -39
  41. package/distTs/src/command/sandbox/create.js +2 -2
  42. package/distTs/src/command/sandbox/snapshot/create.js +2 -2
  43. package/distTs/src/command/scrape.js +15 -14
  44. package/distTs/src/command/tunnel/http.js +8 -8
  45. package/distTs/src/command/tunnel/start.js +9 -9
  46. package/distTs/src/command/tunnel/tcp.js +8 -8
  47. package/distTs/src/command/tunnel/tls.js +8 -8
  48. package/distTs/src/command/ut/upload.js +16 -48
  49. package/distTs/src/command/vt/close.js +5 -5
  50. package/distTs/src/command/vt/compare.js +18 -16
  51. package/distTs/src/command/vt/exec.js +28 -28
  52. package/distTs/src/command/vt/installBrowser.js +2 -2
  53. package/distTs/src/command/vt/storybook.js +14 -14
  54. package/distTs/src/input.js +8 -7
  55. package/distTs/src/logger.js +3 -3
  56. package/distTs/src/openapi.js +24 -0
  57. package/distTs/src/output.js +21 -16
  58. package/distTs/src/sshKeygen.js +9 -0
  59. package/distTs/src/tunnel/cfg.js +17 -20
  60. package/distTs/src/tunnel/tunnel.js +2 -1
  61. package/distTs/src/utils.js +1 -27
  62. package/package.json +1 -1
@@ -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 type = input_1.default.type(tunnelType);
70
+ const Input = require('../input').default;
71
+ const type = Input.type(tunnelType);
75
72
  const tunnel = {
76
73
  type,
77
- target: input_1.default.target(target, type),
74
+ target: Input.target(target, type),
78
75
  };
79
76
  if (options.region !== undefined)
80
- tunnel.region = input_1.default.region(options.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 = input_1.default.whitelist(options.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 = input_1.default.timeout(options.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 } = input_1.default.auth(options.auth);
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 = input_1.default.ca(options.ca);
102
+ tunnel.ca = Input.ca(options.ca);
106
103
  if (options.serve !== undefined)
107
- tunnel.serve = input_1.default.serve(options.serve);
104
+ tunnel.serve = Input.serve(options.serve);
108
105
  if (options.useragent !== undefined)
109
- tunnel.useragents = input_1.default.useragents(options.useragent);
106
+ tunnel.useragents = Input.useragents(options.useragent);
110
107
  if (options.header !== undefined)
111
- tunnel.headers = input_1.default.headers(options.header);
108
+ tunnel.headers = Input.headers(options.header);
112
109
  if (options.responseHeader !== undefined)
113
- tunnel.responseHeaders = input_1.default.headers(options.responseHeader);
110
+ tunnel.responseHeaders = Input.headers(options.responseHeader);
114
111
  if (options.circuitBreaker !== undefined)
115
- tunnel.circuitBreaker = input_1.default.circuitBreaker(options.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 = input_1.default.terminate(options.terminate);
119
+ tunnel.terminate = Input.terminate(options.terminate);
123
120
  if (options.key !== undefined || options.cert !== undefined) {
124
- const { key, cert } = input_1.default.keyCert(options.key, options.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 = input_1.default.ca(options.ca);
126
+ tunnel.ca = Input.ca(options.ca);
130
127
  }
131
128
  if (options.name !== undefined)
132
- tunnel.name = input_1.default.name(options.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, utils_1.createSshHostKey)();
353
+ sshHostKey = (0, sshKeygen_1.createSshHostKey)();
353
354
  this.agent = agent;
354
355
  this.id = id;
355
356
  this.cipherKey = node_crypto_1.default
@@ -37,14 +37,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
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.createSshHostKey = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = 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
@@ -511,11 +506,6 @@ const getRealTargetHost = (target) => {
511
506
  return target || '';
512
507
  };
513
508
  exports.getRealTargetHost = getRealTargetHost;
514
- const createSshHostKey = () => {
515
- const keys = ssh2_1.default.utils.generateKeyPairSync('ed25519', {});
516
- return keys.private;
517
- };
518
- exports.createSshHostKey = createSshHostKey;
519
509
  const getBasicCommandTcp = () => {
520
510
  const commandTcp = (0, exports.newCommand)('tcp');
521
511
  commandTcp.alias('TCP');
@@ -671,22 +661,6 @@ function getDockerRegistryHostByApiBaseUrl(baseUrl) {
671
661
  return baseUrl.hostname;
672
662
  }
673
663
  }
674
- async function fetchOpenApiSchema(baseUrl) {
675
- try {
676
- const url = getOpenApiEndpointByApiBaseUrl(baseUrl);
677
- const data = await (0, bundle_1.bundle)(url, {
678
- plugins: [(0, node_1.readFiles)(), (0, node_1.fetchUrls)(), (0, node_1.parseYaml)(), (0, node_1.parseJson)()],
679
- treeShake: true,
680
- });
681
- const { schema } = await (0, openapi_parser_1.dereference)(data);
682
- if (schema)
683
- return schema;
684
- }
685
- catch {
686
- // do nothing
687
- }
688
- throw new Error(texts_1.ERR_SCHEMA_FETCH_FAILED);
689
- }
690
664
  function openApiPrepareUrl(url, workspace, project) {
691
665
  let preparedUrl = url.replaceAll('{workspace_domain}', workspace);
692
666
  if (project)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.18.5-dev",
4
+ "version": "1.18.6-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {