bdy 1.16.22-dev → 1.16.23-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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.16.22-dev",
4
+ "version": "1.16.23-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -58,7 +58,7 @@ class ApiClient {
58
58
  }
59
59
  return false;
60
60
  }
61
- async request({ method = 'GET', path, body = null, headers = {}, parseResponseBody = false, rawResponseBody = false, httpUrlEncoded = false, tryRefreshingToken = true, }) {
61
+ async request({ method = 'GET', path, query, body = null, headers = {}, parseResponseBody = false, rawResponseBody = false, httpUrlEncoded = false, tryRefreshingToken = true, }) {
62
62
  if (!headers)
63
63
  headers = {};
64
64
  if (this.token && !headers.authorization) {
@@ -87,6 +87,7 @@ class ApiClient {
87
87
  const opts = {
88
88
  method,
89
89
  path,
90
+ query,
90
91
  headers,
91
92
  body: bodyParsed,
92
93
  };
@@ -284,6 +285,7 @@ class ApiClient {
284
285
  return await this.request({
285
286
  method: 'POST',
286
287
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/start`,
288
+ body: {},
287
289
  parseResponseBody: true,
288
290
  });
289
291
  }
@@ -291,6 +293,7 @@ class ApiClient {
291
293
  return await this.request({
292
294
  method: 'POST',
293
295
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/stop`,
296
+ body: {},
294
297
  parseResponseBody: true,
295
298
  });
296
299
  }
@@ -348,6 +351,7 @@ class ApiClient {
348
351
  return await this.request({
349
352
  method: 'POST',
350
353
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/restart`,
354
+ body: {},
351
355
  parseResponseBody: true,
352
356
  });
353
357
  }
@@ -388,10 +392,10 @@ class ApiClient {
388
392
  return await this.request({
389
393
  method: 'POST',
390
394
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/commands/${encodeURIComponent(commandId)}/terminate`,
395
+ body: {},
391
396
  parseResponseBody: true,
392
397
  });
393
398
  }
394
- // Snapshot methods
395
399
  async listSandboxSnapshots(workspace, sandboxId) {
396
400
  return await this.request({
397
401
  method: 'GET',
@@ -399,6 +403,17 @@ class ApiClient {
399
403
  parseResponseBody: true,
400
404
  });
401
405
  }
406
+ async listProjectSnapshots(workspace, project) {
407
+ const query = {};
408
+ if (project)
409
+ query.project_name = encodeURIComponent(project);
410
+ return await this.request({
411
+ method: 'GET',
412
+ path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/snapshots`,
413
+ query,
414
+ parseResponseBody: true
415
+ });
416
+ }
402
417
  async createSandboxSnapshot(workspace, sandboxId, body) {
403
418
  return await this.request({
404
419
  method: 'POST',
@@ -21,9 +21,14 @@ commandProjectList.action(async (options) => {
21
21
  if (!response.projects || response.projects.length === 0) {
22
22
  output_1.default.exitError(texts_1.ERR_PROJECT_NO_PROJECTS);
23
23
  }
24
- const data = [['NAME', 'DISPLAY NAME', 'STATUS']];
24
+ const data = [['NAME', 'DISPLAY NAME', 'STATUS', 'URL']];
25
25
  for (const proj of response.projects) {
26
- data.push([proj.name, proj.display_name, proj.status]);
26
+ data.push([
27
+ proj.name,
28
+ proj.display_name,
29
+ proj.status,
30
+ (0, utils_1.getAppProjectUrl)(baseUrl, workspace, proj.name),
31
+ ]);
27
32
  }
28
33
  output_1.default.table(data);
29
34
  output_1.default.exitNormal();
@@ -38,12 +38,9 @@ commandSandboxCreate.option('--run-command <command>', texts_1.OPTION_SANDBOX_RU
38
38
  commandSandboxCreate.option('--app-dir <directory>', texts_1.OPTION_SANDBOX_APP_DIR);
39
39
  commandSandboxCreate.option('--app-type <type>', texts_1.OPTION_SANDBOX_APP_TYPE);
40
40
  commandSandboxCreate.option('--tag <tags...>', texts_1.OPTION_SANDBOX_TAGS);
41
- commandSandboxCreate.option('--wait-for-running', texts_1.OPTION_SANDBOX_WAIT_RUNNING);
42
- commandSandboxCreate.option('--wait-for-running-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
43
- commandSandboxCreate.option('--wait-for-configured', texts_1.OPTION_SANDBOX_WAIT_CONFIGURED);
44
- commandSandboxCreate.option('--wait-for-configured-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
45
- commandSandboxCreate.option('--wait-for-app', texts_1.OPTION_SANDBOX_WAIT_APP);
46
- commandSandboxCreate.option('--wait-for-app-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
41
+ commandSandboxCreate.option('--wait-for-running [seconds]', texts_1.OPTION_SANDBOX_WAIT_RUNNING);
42
+ commandSandboxCreate.option('--wait-for-configured [seconds]', texts_1.OPTION_SANDBOX_WAIT_CONFIGURED);
43
+ commandSandboxCreate.option('--wait-for-app [seconds]', texts_1.OPTION_SANDBOX_WAIT_APP);
47
44
  commandSandboxCreate.action(async (options) => {
48
45
  const baseUrl = input_1.default.restApiBaseUrl(options.api, options.region);
49
46
  const workspace = input_1.default.restApiWorkspace(options.workspace);
@@ -103,7 +100,7 @@ commandSandboxCreate.action(async (options) => {
103
100
  const sandboxId = result.id;
104
101
  if (options.waitForRunning) {
105
102
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_RUNNING);
106
- const timeout = parseInt(options.waitForRunningTimeout, 10) || 300;
103
+ const timeout = parseInt(options.waitForRunning, 10) || 300;
107
104
  try {
108
105
  const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
109
106
  if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
@@ -116,7 +113,7 @@ commandSandboxCreate.action(async (options) => {
116
113
  }
117
114
  if (options.waitForConfigured) {
118
115
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_SETUP);
119
- const timeout = parseInt(options.waitForConfiguredTimeout, 10) || 300;
116
+ const timeout = parseInt(options.waitForConfigured, 10) || 300;
120
117
  try {
121
118
  const status = await client.sandboxWaitForConfigured(workspace, sandboxId, timeout);
122
119
  if (status !== utils_1.SANDBOX_SETUP_STATUS.SUCCESS) {
@@ -129,7 +126,7 @@ commandSandboxCreate.action(async (options) => {
129
126
  }
130
127
  if (options.waitForApp) {
131
128
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_APP);
132
- const timeout = parseInt(options.waitForAppTimeout, 10) || 300;
129
+ const timeout = parseInt(options.waitForApp, 10) || 300;
133
130
  try {
134
131
  const status = await client.sandboxWaitForApp(workspace, sandboxId, timeout);
135
132
  if (status !== utils_1.SANDBOX_APP_STATUS.RUNNING) {
@@ -24,13 +24,14 @@ commandSandboxList.action(async (options) => {
24
24
  if (sandboxes.length === 0) {
25
25
  output_1.default.exitNormal('No sandboxes found');
26
26
  }
27
- const data = [['IDENTIFIER', 'NAME', 'STATUS', 'ID']];
27
+ const data = [['NAME', 'STATUS', 'ID', 'IDENTIFIER', 'URL']];
28
28
  for (const sandbox of sandboxes) {
29
29
  data.push([
30
- sandbox.identifier || '-',
31
30
  sandbox.name || '-',
32
31
  sandbox.status || '-',
33
32
  sandbox.id || '-',
33
+ sandbox.identifier || '-',
34
+ (0, utils_1.getAppSandboxUrl)(baseUrl, workspace, project, sandbox.id)
34
35
  ]);
35
36
  }
36
37
  output_1.default.table(data);
@@ -13,8 +13,7 @@ commandSandboxRestart.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
13
13
  commandSandboxRestart.option('--region <region>', texts_1.OPTION_REST_API_REGION);
14
14
  commandSandboxRestart.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
15
15
  commandSandboxRestart.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
16
- commandSandboxRestart.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
17
- commandSandboxRestart.option('--wait-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
16
+ commandSandboxRestart.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
18
17
  commandSandboxRestart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
19
18
  commandSandboxRestart.action(async (identifier, options) => {
20
19
  const baseUrl = input_1.default.restApiBaseUrl(options.api, options.region);
@@ -30,7 +29,7 @@ commandSandboxRestart.action(async (identifier, options) => {
30
29
  await client.restartSandbox(workspace, found.id);
31
30
  if (options.wait) {
32
31
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
33
- const timeout = parseInt(options.waitTimeout, 10) || 300;
32
+ const timeout = parseInt(options.wait, 10) || 300;
34
33
  try {
35
34
  const status = await client.sandboxWaitForRunning(workspace, found.id, timeout);
36
35
  if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
@@ -16,8 +16,7 @@ commandSandboxSnapshotCreate.option('-w, --workspace <domain>', texts_1.OPTION_R
16
16
  commandSandboxSnapshotCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
17
17
  commandSandboxSnapshotCreate.option('-n, --name <name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME);
18
18
  commandSandboxSnapshotCreate.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
19
- commandSandboxSnapshotCreate.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
20
- commandSandboxSnapshotCreate.option('--wait-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
19
+ commandSandboxSnapshotCreate.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
21
20
  commandSandboxSnapshotCreate.action(async (identifier, options) => {
22
21
  const baseUrl = input_1.default.restApiBaseUrl(options.api, options.region);
23
22
  const workspace = input_1.default.restApiWorkspace(options.workspace);
@@ -38,7 +37,7 @@ commandSandboxSnapshotCreate.action(async (identifier, options) => {
38
37
  const snapshotId = snapshot.id;
39
38
  if (options.wait) {
40
39
  output_1.default.normal(texts_1.TXT_SANDBOX_SNAPSHOT_WAITING);
41
- const timeout = parseInt(options.waitTimeout, 10) || 300;
40
+ const timeout = parseInt(options.wait, 10) || 300;
42
41
  try {
43
42
  const status = await client.sandboxWaitForSnapshot(workspace, found.id, snapshotId, timeout);
44
43
  if (status !== utils_1.SANDBOX_SNAPSHOT_STATUS.CREATED) {
@@ -45,6 +45,7 @@ commandSandboxSnapshotGet.action(async (identifier, snapshotName, options) => {
45
45
  snapshot.creator.name || snapshot.creator.email || '-',
46
46
  ]);
47
47
  }
48
+ data.push(['URL', snapshot.html_url]);
48
49
  output_1.default.table(data);
49
50
  output_1.default.exitNormal();
50
51
  });
@@ -8,34 +8,43 @@ const texts_1 = require("../../../texts");
8
8
  const output_1 = __importDefault(require("../../../output"));
9
9
  const input_1 = __importDefault(require("../../../input"));
10
10
  const commandSandboxSnapshotList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST);
11
+ commandSandboxSnapshotList.alias('ls');
11
12
  commandSandboxSnapshotList.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
12
13
  commandSandboxSnapshotList.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
13
14
  commandSandboxSnapshotList.option('--region <region>', texts_1.OPTION_REST_API_REGION);
14
15
  commandSandboxSnapshotList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
15
16
  commandSandboxSnapshotList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
16
- commandSandboxSnapshotList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
17
+ commandSandboxSnapshotList.argument('[identifier]', texts_1.OPTION_SANDBOX_IDENTIFIER);
17
18
  commandSandboxSnapshotList.action(async (identifier, options) => {
18
19
  const baseUrl = input_1.default.restApiBaseUrl(options.api, options.region);
19
20
  const workspace = input_1.default.restApiWorkspace(options.workspace);
20
21
  const project = input_1.default.restApiProject(options.project);
21
22
  const client = input_1.default.restApiTokenClient(baseUrl, options.token);
22
- const result = await client.listSandboxes(workspace, project);
23
- const sandboxes = result.sandboxes || [];
24
- const found = sandboxes.find((s) => s.identifier === identifier);
25
- if (!found) {
26
- output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
23
+ let snapshots;
24
+ if (identifier) {
25
+ const result = await client.listSandboxes(workspace, project);
26
+ const sandboxes = result.sandboxes || [];
27
+ const found = sandboxes.find((s) => s.identifier === identifier);
28
+ if (!found) {
29
+ output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
30
+ }
31
+ const snapshotsResult = await client.listSandboxSnapshots(workspace, found.id);
32
+ snapshots = snapshotsResult.snapshots || [];
33
+ }
34
+ else {
35
+ const result = await client.listProjectSnapshots(workspace, project);
36
+ snapshots = result.snapshots || [];
27
37
  }
28
- const snapshotsResult = await client.listSandboxSnapshots(workspace, found.id);
29
- const snapshots = snapshotsResult.snapshots || [];
30
38
  if (snapshots.length === 0) {
31
39
  output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND);
32
40
  }
33
- const data = [['Name', 'Status', 'Created']];
41
+ const data = [['Name', 'Status', 'Created', 'URL']];
34
42
  for (const snapshot of snapshots) {
35
43
  data.push([
36
44
  snapshot.name || '-',
37
45
  snapshot.status || '-',
38
46
  snapshot.create_date || '-',
47
+ snapshot.html_url || '-'
39
48
  ]);
40
49
  }
41
50
  output_1.default.table(data);
@@ -13,8 +13,7 @@ commandSandboxStart.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
13
13
  commandSandboxStart.option('--region <region>', texts_1.OPTION_REST_API_REGION);
14
14
  commandSandboxStart.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
15
15
  commandSandboxStart.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
16
- commandSandboxStart.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
17
- commandSandboxStart.option('--wait-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
16
+ commandSandboxStart.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
18
17
  commandSandboxStart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
19
18
  commandSandboxStart.action(async (identifier, options) => {
20
19
  const baseUrl = input_1.default.restApiBaseUrl(options.api, options.region);
@@ -30,7 +29,7 @@ commandSandboxStart.action(async (identifier, options) => {
30
29
  await client.startSandbox(workspace, found.id);
31
30
  if (options.wait) {
32
31
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
33
- const timeout = parseInt(options.waitTimeout, 10) || 300;
32
+ const timeout = parseInt(options.wait, 10) || 300;
34
33
  try {
35
34
  const status = await client.sandboxWaitForRunning(workspace, found.id, timeout);
36
35
  if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
@@ -27,9 +27,10 @@ commandSandboxStatus.action(async (identifier, options) => {
27
27
  }
28
28
  const sandbox = await client.getSandbox(workspace, found.id);
29
29
  output_1.default.table([
30
+ ['Type', 'Status'],
30
31
  ['Status', sandbox.status || 'UNKNOWN'],
31
32
  ['Setup', sandbox.setup_status || 'UNKNOWN'],
32
- ['App', sandbox.app_status || 'UNKNOWN'],
33
+ ['App', sandbox.app_status || 'UNKNOWN']
33
34
  ]);
34
35
  output_1.default.exitNormal();
35
36
  });
@@ -13,8 +13,7 @@ commandSandboxStop.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
13
13
  commandSandboxStop.option('--region <region>', texts_1.OPTION_REST_API_REGION);
14
14
  commandSandboxStop.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
15
15
  commandSandboxStop.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
16
- commandSandboxStop.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
17
- commandSandboxStop.option('--wait-timeout <seconds>', texts_1.OPTION_SANDBOX_WAIT_TIMEOUT, '300');
16
+ commandSandboxStop.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
18
17
  commandSandboxStop.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
19
18
  commandSandboxStop.action(async (identifier, options) => {
20
19
  const baseUrl = input_1.default.restApiBaseUrl(options.api, options.region);
@@ -30,7 +29,7 @@ commandSandboxStop.action(async (identifier, options) => {
30
29
  await client.stopSandbox(workspace, found.id);
31
30
  if (options.wait) {
32
31
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_STOP);
33
- const timeout = parseInt(options.waitTimeout, 10) || 300;
32
+ const timeout = parseInt(options.wait, 10) || 300;
34
33
  try {
35
34
  const status = await client.sandboxWaitForRunning(workspace, found.id, timeout);
36
35
  if (status !== utils_1.SANDBOX_STATUS.STOPPED) {
@@ -20,9 +20,9 @@ commandWorkspaceList.action(async (options) => {
20
20
  output_1.default.normal('No workspaces found.');
21
21
  output_1.default.exitNormal();
22
22
  }
23
- const data = [['NAME', 'DOMAIN']];
23
+ const data = [['NAME', 'DOMAIN', 'URL']];
24
24
  for (const ws of response.workspaces) {
25
- data.push([ws.name, ws.domain]);
25
+ data.push([ws.name, ws.domain, (0, utils_1.getAppWorkspaceUrl)(baseUrl, ws.domain)]);
26
26
  }
27
27
  output_1.default.table(data);
28
28
  output_1.default.exitNormal();
@@ -59,6 +59,12 @@ class Output {
59
59
  msg += '\n';
60
60
  terminal.green(msg);
61
61
  }
62
+ static blue(txt, newLine = true) {
63
+ let msg = txt;
64
+ if (newLine)
65
+ msg += '\n';
66
+ terminal.blue(msg);
67
+ }
62
68
  static debug(txt) {
63
69
  if (context_1.debug) {
64
70
  this.normal(txt);
@@ -128,6 +134,12 @@ class Output {
128
134
  else
129
135
  this.tunnelNonInteractive(tunnel);
130
136
  }
137
+ static object(data) {
138
+ Object.keys(data).forEach((key) => {
139
+ this.blue(`${key}: `, false);
140
+ this.normal(data[key]);
141
+ });
142
+ }
131
143
  static table(data) {
132
144
  // apply padding
133
145
  for (let i = 0; i < data.length; i += 1) {
@@ -142,6 +154,8 @@ class Output {
142
154
  }
143
155
  terminal.table(data, {
144
156
  fit: false,
157
+ hasBorder: false,
158
+ firstRowTextAttr: { color: 'blue' }
145
159
  });
146
160
  }
147
161
  static configTunnels(tunnels) {
@@ -8,9 +8,9 @@ exports.OPTION_REST_API_WORKSPACE = exports.OPTION_PIPELINE_RUN_WAIT = exports.O
8
8
  exports.OPTION_COMPARE_WAIT_FOR = exports.OPTION_COMPARE_DELAY = exports.OPTION_COMPARE_HEADER = exports.OPTION_COMPARE_COOKIE = exports.OPTION_COMPARE_IGNORE = exports.OPTION_COMPARE_IGNORE_URLS = exports.OPTION_COMPARE_DRY_RUN = exports.OPTION_COMPARE_URLS_FILE = exports.OPTION_COMPARE_SITEMAP = exports.OPTION_COMPARE_URLS = exports.OPTION_COMPARE_RESPECT_ROBOTS = exports.OPTION_COMPARE_FOLLOW = exports.OPTION_EXEC_PARALLEL = exports.OPTION_EXEC_ONE_BY_ONE = exports.OPTION_EXEC_SKIP_DISCOVERY = exports.OPTION_EXEC_COMMAND = exports.OPTION_AGENT_DEBUG = exports.OPTION_AGENT_PORT = exports.OPTION_AGENT_TARGET = exports.OPTION_PASS = exports.OPTION_APP = exports.OPTION_USER = exports.OPTION_AGENT_TOKEN = exports.OPTION_AGENT_START = exports.OPTION_AGENT_ID = exports.OPTION_ID = exports.OPTION_NAME = exports.OPTION_TARGET = exports.OPTION_TLS_TERMINATE = exports.OPTION_TLS_CA = exports.OPTION_TLS_CERT = exports.OPTION_TLS_KEY = exports.OPTION_HTTP_CIRCUIT_BREAKER = exports.OPTION_HTTP_COMPRESSION = exports.OPTION_HTTP_2 = exports.OPTION_HTTP_VERIFY = exports.OPTION_HTTP_LOG = exports.OPTION_HTTP_AUTH_BUDDY = exports.OPTION_HTTP_AUTH = exports.OPTION_HTTP_HOST = exports.OPTION_FORCE = exports.OPTION_TOKEN = exports.OPTION_TIMEOUT = exports.OPTION_FOLLOW = exports.OPTION_SERVE = exports.OPTION_HEADER_USER_AGENT = exports.OPTION_RESPONSE_HEADER = exports.OPTION_HEADER = exports.OPTION_WHITELIST = exports.OPTION_REST_API_PROJECT = void 0;
9
9
  exports.LOG_HTTP1_CONNECTION = exports.LOG_ERROR = exports.LOG_STOPPING_TUNNEL = exports.LOG_STARTING_TUNNEL = exports.LOG_ENABLING_AGENT_TARGET = exports.LOG_DISABLING_AGENT_TARGET = exports.LOG_REMOVING_TUNNEL = exports.LOG_TUNNEL_REGISTERED = exports.LOG_ERROR_WHILE_REFRESHING_AGENT = exports.LOG_REGISTERING_TUNNEL = exports.LOG_GETTING_AGENT = exports.LOG_UNREGISTERING_AGENT = exports.LOG_REGION_DETECTED = exports.LOG_AGENT_REGISTERED = exports.LOG_SOCKET_DISCONNECTED = exports.LOG_SOCKET_CONNECTED = exports.LOG_AGENT_NSSM_CLEARING = exports.LOG_AGENT_NSSM_EXTRACTING = exports.LOG_AGENT_NSSM_DOWNLOADING = exports.LOG_AGENT_ENABLED = exports.LOG_AGENT_STARTING_SYSTEM = exports.LOG_AGENT_STOPPING_SYSTEM = exports.LOG_AGENT_ENABLING_SYSTEM = exports.LOG_AGENT_SYSTEM_SERVICE_CONFIG = exports.LOG_AGENT_EXTRACTING_ARCHIVE = exports.LOG_AGENT_DOWNLOADING_ARCHIVE = exports.LOG_AGENT_SYSTEM_DIR = exports.LOG_ERROR_SAVING_AGENT_LOCAL_CONFIG = exports.LOG_ERROR_REMOVING_AGENT_STANDALONE_LOCK_FILE = exports.LOG_ERROR_SAVING_AGENT_STANDALONE_CONFIG = exports.LOG_ERROR_SAVING_AGENT_SYSTEM_CONFIG = exports.LOG_SAVING_AGENT_LOCAL_CONFIG = exports.LOG_REMOVING_AGENT_PROC_ID = exports.LOG_SAVING_AGENT_PROC_ID = exports.LOG_SAVING_AGENT_SYSTEM_CONFIG = exports.LOG_REGISTERING_AGENT = exports.OPTION_SCRAPE_OUTPUT_DIR = exports.OPTION_SCRAPE_DELAY = exports.OPTION_SCRAPE_DARK_MODE = exports.OPTION_SCRAPE_WAIT_FOR_ELEMENT = exports.OPTION_SCRAPE_DEVICE_PIXEL_RATIO = exports.OPTION_SCRAPE_VIEWPORT = exports.OPTION_SCRAPE_BROWSER = exports.OPTION_SCRAPE_XPATH_SELECTOR = exports.OPTION_SCRAPE_CSS_SELECTOR = exports.OPTION_SCRAPE_FULL_PAGE = exports.OPTION_SCRAPE_QUALITY = exports.OPTION_SCRAPE_OUTPUT_TYPE = exports.OPTION_SCRAPE_FOLLOW = exports.OPTION_SCRAPE_URL = void 0;
10
10
  exports.DESC_COMMAND_SANDBOX_EXEC = exports.DESC_COMMAND_SANDBOX_STATUS = exports.DESC_COMMAND_SANDBOX_RESTART = exports.DESC_COMMAND_SANDBOX_STOP = exports.DESC_COMMAND_SANDBOX_START = exports.DESC_COMMAND_SANDBOX_DESTROY = exports.DESC_COMMAND_SANDBOX_GET = exports.DESC_COMMAND_SANDBOX_LIST = exports.DESC_COMMAND_SANDBOX_CREATE = exports.DESC_COMMAND_SANDBOX = exports.DEBUG_WAIT_FOR_IDLE_TIMEOUT = exports.DEBUG_WAIT_FOR_IDLE = exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = exports.DEBUG_AUTO_WIDTH = exports.DEBUG_AUTO_SCROLL = exports.DEBUG_RESOURCE_SCRAPPING_URL = exports.DEBUG_SNAPSHOT_PROCESSING = exports.DEBUG_SNAPSHOTS_PROCESSING = exports.DEBUG_EXEC_COMMAND = exports.DEBUG_EXEC_TEST_COMMAND = exports.LOG_INSTALLED_BROWSER = exports.LOG_SESSION_LINK = exports.LOG_SENDING_DATA = exports.LOG_SENDING_REQUEST = exports.LOG_PROCESSING_SNAPSHOTS = exports.LOG_RUNNING_EXEC_COMMAND = exports.LOG_TUNNEL_SSH_STREAM = exports.LOG_TUNNEL_TLS_AGENT_STREAM = exports.LOG_TUNNEL_TLS_REGION_STREAM = exports.LOG_TUNNEL_TLS_TARGET_STREAM = exports.LOG_TUNNEL_HTTP2_STREAM = exports.LOG_TUNNEL_HTTP1_STREAM = exports.LOG_TUNNEL_TCP_STREAM = exports.LOG_TUNNEL_HTTP_WRONG_USER_AGENTS = exports.LOG_TUNNEL_HTTP_CIRCUIT_BREAKER_OPEN = exports.LOG_TUNNEL_HTTP_RATE_LIMIT = exports.LOG_TUNNEL_HTTP_WRON_AUTH = exports.LOG_TUNNEL_IDENTIFIED = exports.LOG_TUNNEL_DISCONNECTED = exports.LOG_TUNNEL_FAILED = exports.LOG_TUNNEL_CONNECTED = exports.LOG_AGENT_STARTED = exports.LOG_AGENT_SERVER_STARTED = exports.LOG_ERROR_STARTING_AGENT_SERVER = exports.LOG_SSH_CONNECTION = exports.LOG_WRONG_STREAM = exports.LOG_DETECTED_STREAM = exports.LOG_HTTP2_REQUEST = exports.LOG_HTTP2_CONNECTION = exports.LOG_HTTP1_REQUEST = void 0;
11
- exports.OPTION_SANDBOX_SNAPSHOT_NAME_ARG = exports.OPTION_SANDBOX_SNAPSHOT_NAME = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_GET = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST = exports.DESC_COMMAND_SANDBOX_SNAPSHOT = exports.TXT_SANDBOX_COMMAND_KILLED = exports.OPTION_SANDBOX_COMMAND_ID = exports.DESC_COMMAND_SANDBOX_EXEC_KILL = exports.DESC_COMMAND_SANDBOX_EXEC_LOGS = exports.DESC_COMMAND_SANDBOX_EXEC_STATUS = exports.DESC_COMMAND_SANDBOX_EXEC_LIST = exports.TXT_SANDBOX_WAITING_START = exports.TXT_SANDBOX_WAITING_STOP = exports.TXT_SANDBOX_WAITING_APP = exports.TXT_SANDBOX_WAITING_SETUP = exports.TXT_SANDBOX_WAITING_RUNNING = exports.TXT_SANDBOX_STOPPED = exports.TXT_SANDBOX_STARTED = exports.TXT_SANDBOX_DESTROYED = exports.TXT_SANDBOX_CREATED = exports.TXT_SANDBOX_CREATING = exports.OPTION_SANDBOX_WAIT_TIMEOUT = exports.OPTION_SANDBOX_WAIT = exports.OPTION_SANDBOX_WAIT_APP = exports.OPTION_SANDBOX_WAIT_CONFIGURED = exports.OPTION_SANDBOX_WAIT_RUNNING = exports.ERR_SANDBOX_STOP_FAILED = exports.ERR_SANDBOX_NO_COMMANDS = exports.ERR_SANDBOX_RUNNING_FAILED = exports.ERR_SANDBOX_STOP_TIMEOUT = exports.ERR_SANDBOX_SNAPSHOT_TIMEOUT = exports.ERR_SANDBOX_RUNNING_TIMEOUT = exports.ERR_SANDBOX_APP_TIMEOUT = exports.ERR_SANDBOX_SETUP_TIMEOUT = exports.ERR_SANDBOX_APP_FAILED = exports.ERR_SANDBOX_SETUP_FAILED = exports.ERR_SANDBOX_INVALID_RESOURCES = exports.ERR_SANDBOX_NOT_FOUND = exports.OPTION_SANDBOX_RUNTIME = exports.OPTION_SANDBOX_APP_TYPE = exports.OPTION_SANDBOX_APP_DIR = exports.OPTION_SANDBOX_RUN_COMMAND = exports.OPTION_SANDBOX_TAGS = exports.OPTION_SANDBOX_INSTALL_COMMANDS = exports.OPTION_SANDBOX_RESOURCES = exports.OPTION_SANDBOX_OS = exports.OPTION_SANDBOX_NAME = exports.OPTION_SANDBOX_IDENTIFIER = void 0;
12
- exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_WHOAMI_LOGOUT = exports.TXT_WHOAMI_NO_PROJECT = exports.TXT_WHOAMI_NO_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = exports.TXT_SANDBOX_EXEC_SUCCESS = exports.TXT_SANDBOX_EXEC_BACKGROUND = exports.TXT_SANDBOX_EXEC_ID = exports.ERR_SANDBOX_CP_INVALID_DEST = exports.ERR_SANDBOX_CP_SOURCE_NOT_FOUND = exports.TXT_SANDBOX_CP_DONE = exports.TXT_SANDBOX_CP_PROGRESS = exports.OPTION_SANDBOX_CP_SILENT = exports.OPTION_SANDBOX_CP_DEST = exports.OPTION_SANDBOX_CP_SOURCE = exports.DESC_COMMAND_SANDBOX_CP = exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_EXISTS = exports.TXT_SANDBOX_ENDPOINT_DELETED = exports.TXT_SANDBOX_ENDPOINT_ADDED = exports.OPTION_SANDBOX_ENDPOINT_TYPE = exports.OPTION_SANDBOX_ENDPOINT_PORT = exports.OPTION_SANDBOX_ENDPOINT_NAME_ARG = exports.OPTION_SANDBOX_ENDPOINT_NAME = exports.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE = exports.DESC_COMMAND_SANDBOX_ENDPOINT_ADD = exports.DESC_COMMAND_SANDBOX_ENDPOINT_GET = exports.DESC_COMMAND_SANDBOX_ENDPOINT_LIST = exports.DESC_COMMAND_SANDBOX_ENDPOINT = exports.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_FAILED = exports.TXT_SANDBOX_SNAPSHOT_WAITING = exports.TXT_SANDBOX_SNAPSHOT_DELETED = exports.TXT_SANDBOX_SNAPSHOT_CREATED = exports.OPTION_SANDBOX_FROM_SNAPSHOT = void 0;
13
- exports.TXT_PROJECT_NONE = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_PROJECT_SET_CLEARED = exports.TXT_PROJECT_SET_SUCCESS = exports.DESC_COMMAND_PROJECT_GET = exports.ARG_COMMAND_PROJECT_NAME = exports.DESC_COMMAND_PROJECT_SET = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_LIST = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_PROJECT_FOUND = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = exports.TXT_LOGIN_SELECT_WORKSPACE = void 0;
11
+ exports.OPTION_SANDBOX_FROM_SNAPSHOT = exports.OPTION_SANDBOX_SNAPSHOT_NAME_ARG = exports.OPTION_SANDBOX_SNAPSHOT_NAME = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_GET = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST = exports.DESC_COMMAND_SANDBOX_SNAPSHOT = exports.TXT_SANDBOX_COMMAND_KILLED = exports.OPTION_SANDBOX_COMMAND_ID = exports.DESC_COMMAND_SANDBOX_EXEC_KILL = exports.DESC_COMMAND_SANDBOX_EXEC_LOGS = exports.DESC_COMMAND_SANDBOX_EXEC_STATUS = exports.DESC_COMMAND_SANDBOX_EXEC_LIST = exports.TXT_SANDBOX_WAITING_START = exports.TXT_SANDBOX_WAITING_STOP = exports.TXT_SANDBOX_WAITING_APP = exports.TXT_SANDBOX_WAITING_SETUP = exports.TXT_SANDBOX_WAITING_RUNNING = exports.TXT_SANDBOX_STOPPED = exports.TXT_SANDBOX_STARTED = exports.TXT_SANDBOX_DESTROYED = exports.TXT_SANDBOX_CREATED = exports.TXT_SANDBOX_CREATING = exports.OPTION_SANDBOX_WAIT = exports.OPTION_SANDBOX_WAIT_APP = exports.OPTION_SANDBOX_WAIT_CONFIGURED = exports.OPTION_SANDBOX_WAIT_RUNNING = exports.ERR_SANDBOX_STOP_FAILED = exports.ERR_SANDBOX_NO_COMMANDS = exports.ERR_SANDBOX_RUNNING_FAILED = exports.ERR_SANDBOX_STOP_TIMEOUT = exports.ERR_SANDBOX_SNAPSHOT_TIMEOUT = exports.ERR_SANDBOX_RUNNING_TIMEOUT = exports.ERR_SANDBOX_APP_TIMEOUT = exports.ERR_SANDBOX_SETUP_TIMEOUT = exports.ERR_SANDBOX_APP_FAILED = exports.ERR_SANDBOX_SETUP_FAILED = exports.ERR_SANDBOX_INVALID_RESOURCES = exports.ERR_SANDBOX_NOT_FOUND = exports.OPTION_SANDBOX_RUNTIME = exports.OPTION_SANDBOX_APP_TYPE = exports.OPTION_SANDBOX_APP_DIR = exports.OPTION_SANDBOX_RUN_COMMAND = exports.OPTION_SANDBOX_TAGS = exports.OPTION_SANDBOX_INSTALL_COMMANDS = exports.OPTION_SANDBOX_RESOURCES = exports.OPTION_SANDBOX_OS = exports.OPTION_SANDBOX_NAME = exports.OPTION_SANDBOX_IDENTIFIER = void 0;
12
+ exports.TXT_LOGIN_SELECT_WORKSPACE = exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_WHOAMI_LOGOUT = exports.TXT_WHOAMI_NO_PROJECT = exports.TXT_WHOAMI_NO_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = exports.TXT_SANDBOX_EXEC_SUCCESS = exports.TXT_SANDBOX_EXEC_BACKGROUND = exports.TXT_SANDBOX_EXEC_ID = exports.ERR_SANDBOX_CP_INVALID_DEST = exports.ERR_SANDBOX_CP_SOURCE_NOT_FOUND = exports.TXT_SANDBOX_CP_DONE = exports.TXT_SANDBOX_CP_PROGRESS = exports.OPTION_SANDBOX_CP_SILENT = exports.OPTION_SANDBOX_CP_DEST = exports.OPTION_SANDBOX_CP_SOURCE = exports.DESC_COMMAND_SANDBOX_CP = exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_EXISTS = exports.TXT_SANDBOX_ENDPOINT_DELETED = exports.TXT_SANDBOX_ENDPOINT_ADDED = exports.OPTION_SANDBOX_ENDPOINT_TYPE = exports.OPTION_SANDBOX_ENDPOINT_PORT = exports.OPTION_SANDBOX_ENDPOINT_NAME_ARG = exports.OPTION_SANDBOX_ENDPOINT_NAME = exports.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE = exports.DESC_COMMAND_SANDBOX_ENDPOINT_ADD = exports.DESC_COMMAND_SANDBOX_ENDPOINT_GET = exports.DESC_COMMAND_SANDBOX_ENDPOINT_LIST = exports.DESC_COMMAND_SANDBOX_ENDPOINT = exports.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_FAILED = exports.TXT_SANDBOX_SNAPSHOT_WAITING = exports.TXT_SANDBOX_SNAPSHOT_DELETED = exports.TXT_SANDBOX_SNAPSHOT_CREATED = void 0;
13
+ exports.TXT_PROJECT_NONE = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_PROJECT_SET_CLEARED = exports.TXT_PROJECT_SET_SUCCESS = exports.DESC_COMMAND_PROJECT_GET = exports.ARG_COMMAND_PROJECT_NAME = exports.DESC_COMMAND_PROJECT_SET = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_LIST = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_PROJECT_FOUND = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = void 0;
14
14
  const utils_1 = require("./utils");
15
15
  exports.ERR_REST_API_GENERAL_ERROR = 'Something went wrong';
16
16
  exports.ERR_REST_API_NOT_RESPONDING = 'Api endpoint not responding. Try again later...';
@@ -519,7 +519,6 @@ exports.OPTION_SANDBOX_WAIT_RUNNING = 'wait until sandbox is running';
519
519
  exports.OPTION_SANDBOX_WAIT_CONFIGURED = 'wait until sandbox ran setup commands';
520
520
  exports.OPTION_SANDBOX_WAIT_APP = 'wait until sandbox ran ran app commands';
521
521
  exports.OPTION_SANDBOX_WAIT = 'wait until operation completes';
522
- exports.OPTION_SANDBOX_WAIT_TIMEOUT = 'timeout in seconds (default: 300)';
523
522
  // Sandbox success messages
524
523
  const TXT_SANDBOX_CREATING = (name, identifier) => `Creating sandbox: ${name} (${identifier})`;
525
524
  exports.TXT_SANDBOX_CREATING = TXT_SANDBOX_CREATING;
@@ -635,39 +634,18 @@ exports.ERR_LOGIN_NO_WORKSPACE_FOUND = 'Provided workspace has been not found';
635
634
  exports.ERR_LOGIN_NO_PROJECT_FOUND = 'Provided project has been not found';
636
635
  exports.ERR_LOGIN_INVALID_BASE_URL = 'Invalid URL format';
637
636
  const ERR_API_MESSAGE_REPLACER = (message, path, baseUrl) => {
638
- let workspace = null;
639
- let appUrl = null;
640
- if (path) {
637
+ let workspaceUrl = null;
638
+ if (path && baseUrl) {
641
639
  const m = /\/workspaces\/([^/]+)\//.exec(path);
642
640
  if (m) {
643
- workspace = m[1];
644
- }
645
- }
646
- if (baseUrl) {
647
- if (baseUrl.hostname.includes('api.buddy.works')) {
648
- appUrl = 'app.buddy.works';
649
- }
650
- else if (baseUrl.hostname.includes('api.eu.buddy.works')) {
651
- appUrl = 'eu.buddy.works';
652
- }
653
- else if (baseUrl.hostname.includes('api.as.buddy.works')) {
654
- appUrl = 'as.buddy.works';
655
- }
656
- else if (baseUrl.hostname.includes('api.awsdev.net')) {
657
- appUrl = 'app.awsdev.net';
658
- }
659
- else if (baseUrl.hostname.includes('api.awsstage.net')) {
660
- appUrl = 'app.awsstage.net';
661
- }
662
- else {
663
- appUrl = baseUrl.hostname;
641
+ workspaceUrl = (0, utils_1.getAppWorkspaceSettingsUrl)(baseUrl, m[1]);
664
642
  }
665
643
  }
666
644
  if (message === 'API is disabled in this workspace') {
667
645
  message =
668
646
  'API is disabled in this workspace. To enable it, ask a workspace admin to update the settings';
669
- if (appUrl || workspace) {
670
- message += `: https://${appUrl}/${workspace}/-/workspace`;
647
+ if (workspaceUrl) {
648
+ message += `: ${workspaceUrl}`;
671
649
  }
672
650
  }
673
651
  return message;
@@ -40,6 +40,12 @@ exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.get
40
40
  exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.createSshHostKey = exports.getRealTargetHost = exports.isWindows = void 0;
41
41
  exports.apiErrorCodeToClass = apiErrorCodeToClass;
42
42
  exports.isFile = isFile;
43
+ exports.getAppWorkspaceUrl = getAppWorkspaceUrl;
44
+ exports.getAppWorkspaceSettingsUrl = getAppWorkspaceSettingsUrl;
45
+ exports.getAppProjectUrl = getAppProjectUrl;
46
+ exports.getAppSandboxUrl = getAppSandboxUrl;
47
+ exports.getAppUrl = getAppUrl;
48
+ exports.getAppHostByApiBaseUrl = getAppHostByApiBaseUrl;
43
49
  exports.asyncWait = asyncWait;
44
50
  const node_path_1 = __importStar(require("node:path"));
45
51
  const node_fs_1 = require("node:fs");
@@ -534,6 +540,83 @@ function isFile(path) {
534
540
  return false;
535
541
  }
536
542
  }
543
+ function getAppWorkspaceUrl(baseUrl, workspace) {
544
+ return getAppUrl(baseUrl, `/${encodeURIComponent(workspace)}`);
545
+ }
546
+ function getAppWorkspaceSettingsUrl(baseUrl, workspace) {
547
+ return `${getAppWorkspaceUrl(baseUrl, workspace)}/-/workspace`;
548
+ }
549
+ function getAppProjectUrl(baseUrl, workspace, project) {
550
+ return `${getAppWorkspaceUrl(baseUrl, workspace)}/${encodeURIComponent(project)}`;
551
+ }
552
+ function getAppSandboxUrl(baseUrl, workspace, project, sandboxId) {
553
+ return `${getAppProjectUrl(baseUrl, workspace, project)}/sandboxes/${encodeURIComponent(sandboxId)}`;
554
+ }
555
+ function getAppUrl(baseUrl, path) {
556
+ return `https://${getAppHostByApiBaseUrl(baseUrl)}${path}`;
557
+ }
558
+ function getAppHostByApiBaseUrl(baseUrl) {
559
+ if (baseUrl.hostname.includes('api.buddy.works')) {
560
+ return 'app.buddy.works';
561
+ }
562
+ else if (baseUrl.hostname.includes('api.eu.buddy.works')) {
563
+ return 'eu.buddy.works';
564
+ }
565
+ else if (baseUrl.hostname.includes('api.as.buddy.works')) {
566
+ return 'as.buddy.works';
567
+ }
568
+ else if (baseUrl.hostname.includes('api.awsdev.net')) {
569
+ return 'app.awsdev.net';
570
+ }
571
+ else if (baseUrl.hostname.includes('api.awsstage.net')) {
572
+ return 'app.awsstage.net';
573
+ }
574
+ else if (baseUrl.hostname.includes('api.buddysd.com')) {
575
+ return 'app.buddysd.com';
576
+ }
577
+ else if (baseUrl.hostname.includes('api.e2e.com')) {
578
+ return 'app.e2e.com';
579
+ }
580
+ else if (baseUrl.hostname.includes('api.sd1.com')) {
581
+ return 'app.sd1.com';
582
+ }
583
+ else if (baseUrl.hostname.includes('api.sd2.com')) {
584
+ return 'app.sd2.com';
585
+ }
586
+ else if (baseUrl.hostname.includes('api.sd3.com')) {
587
+ return 'app.sd3.com';
588
+ }
589
+ else if (baseUrl.hostname.includes('api.sd4.com')) {
590
+ return 'app.sd4.com';
591
+ }
592
+ else if (baseUrl.hostname.includes('api.sd5.com')) {
593
+ return 'app.sd5.com';
594
+ }
595
+ else if (baseUrl.hostname.includes('api.sd6.com')) {
596
+ return 'app.sd6.com';
597
+ }
598
+ else if (baseUrl.hostname.includes('api.sd7.com')) {
599
+ return 'app.sd7.com';
600
+ }
601
+ else if (baseUrl.hostname.includes('api.sd8.com')) {
602
+ return 'app.sd8.com';
603
+ }
604
+ else if (baseUrl.hostname.includes('api.sd9.com')) {
605
+ return 'app.sd9.com';
606
+ }
607
+ else if (baseUrl.hostname.includes('api.eu.awsstage.net')) {
608
+ return 'eu.awsstage.net';
609
+ }
610
+ else if (baseUrl.hostname.includes('api.awsmaster.net')) {
611
+ return 'app.awsmaster.net';
612
+ }
613
+ else if (baseUrl.hostname.includes('api.buddy.mom')) {
614
+ return 'app.buddy.mom';
615
+ }
616
+ else {
617
+ return baseUrl.hostname;
618
+ }
619
+ }
537
620
  async function asyncWait(ms) {
538
621
  return new Promise((resolve) => {
539
622
  setTimeout(resolve, ms);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.16.22-dev",
4
+ "version": "1.16.23-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {