bdy 1.17.3-dev → 1.17.4-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.17.3-dev",
4
+ "version": "1.17.4-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "@scalar/json-magic": "0.9.4",
34
34
  "@scalar/types": "0.5.10",
35
35
  "@scalar/openapi-types": "0.5.3",
36
- "fastify": "4.28.1",
36
+ "fastify": "4.29.1",
37
37
  "fdir": "6.5.0",
38
38
  "open": "11.0.0",
39
39
  "fflate": "0.8.2",
@@ -259,7 +259,18 @@ const outputRequestBody = (data, schema) => {
259
259
  }
260
260
  };
261
261
  const outputUrl = (url, method, data, workspace, project, requestSchema, responseSchema) => {
262
- output_1.default.normal(`${method} ${url}`);
262
+ const m = (method || 'get').toUpperCase();
263
+ if (m === 'GET')
264
+ output_1.default.cyan(m, false);
265
+ else if (m === 'POST')
266
+ output_1.default.green(m, false);
267
+ else if (m === 'PATCH')
268
+ output_1.default.blue(m, false);
269
+ else if (m === 'PUT')
270
+ output_1.default.yellow(m, false);
271
+ else if (m === 'DELETE')
272
+ output_1.default.error(m, false);
273
+ output_1.default.normal(` ${url}`);
263
274
  if (data.summary)
264
275
  output_1.default.gray(data.summary, false);
265
276
  const scopes = getRequiredScopes(data);
@@ -290,7 +301,7 @@ commandApiInfo.action(async (fm, filterUrl, options) => {
290
301
  const workspace = input_1.default.restApiWorkspace(options.workspace);
291
302
  const project = input_1.default.restApiProject(options.project, true);
292
303
  const filterMethod = input_1.default.restApiMethod(fm, false);
293
- const client = input_1.default.restApiTokenClient(options.api, options.region, options.token);
304
+ const client = input_1.default.restApiTokenClient(options.api, options.region, options.token, true);
294
305
  const schema = await (0, utils_1.fetchOpenApiSchema)(client.baseUrl);
295
306
  const paths = schema.paths || {};
296
307
  Object.keys(paths).forEach((url) => {
@@ -8,7 +8,20 @@ const texts_1 = require("../../texts");
8
8
  const input_1 = __importDefault(require("../../input"));
9
9
  const output_1 = __importDefault(require("../../output"));
10
10
  const outputUrl = (url, method, data, workspace, project) => {
11
- output_1.default.normal(`${method} ${(0, utils_1.openApiPrepareUrl)(url, workspace, project)}`);
11
+ const m = (method || 'get').toUpperCase();
12
+ if (m === 'GET')
13
+ output_1.default.cyan(m, false);
14
+ else if (m === 'POST')
15
+ output_1.default.green(m, false);
16
+ else if (m === 'PATCH')
17
+ output_1.default.blue(m, false);
18
+ else if (m === 'PUT')
19
+ output_1.default.yellow(m, false);
20
+ else if (m === 'DELETE')
21
+ output_1.default.error(m, false);
22
+ else
23
+ output_1.default.blue(m, false);
24
+ output_1.default.normal(` ${(0, utils_1.openApiPrepareUrl)(url, workspace, project)}`);
12
25
  if (data.summary)
13
26
  output_1.default.gray(data.summary);
14
27
  };
@@ -26,7 +39,7 @@ commandApiList.action(async (options) => {
26
39
  const project = input_1.default.restApiProject(options.project, true);
27
40
  const filterMethod = input_1.default.restApiMethod(options.method);
28
41
  const filter = options.search;
29
- const client = input_1.default.restApiTokenClient(options.api, options.region, options.token);
42
+ const client = input_1.default.restApiTokenClient(options.api, options.region, options.token, true);
30
43
  const schema = await (0, utils_1.fetchOpenApiSchema)(client.baseUrl);
31
44
  const paths = schema.paths || {};
32
45
  Object.keys(paths).forEach((url) => {
@@ -23,11 +23,14 @@ commandSandboxList.action(async (options) => {
23
23
  if (sandboxes.length === 0) {
24
24
  output_1.default.exitNormal('No sandboxes found');
25
25
  }
26
- const data = [['NAME', 'STATUS', 'ID', 'IDENTIFIER', 'URL']];
26
+ const data = [
27
+ ['NAME', 'STATUS', 'SETUP STATUS', 'ID', 'IDENTIFIER', 'URL'],
28
+ ];
27
29
  for (const sandbox of sandboxes) {
28
30
  data.push([
29
31
  sandbox.name || '-',
30
32
  sandbox.status || '-',
33
+ sandbox.setup_status || '-',
31
34
  sandbox.id || '-',
32
35
  sandbox.identifier || '-',
33
36
  sandbox.html_url || '-',
@@ -301,7 +301,7 @@ class Input {
301
301
  }
302
302
  return type;
303
303
  }
304
- static restApiToken(token) {
304
+ static restApiToken(token, allowNoToken = false) {
305
305
  let t = process.env.BUDDY_TOKEN;
306
306
  let rf = '';
307
307
  let cid = '';
@@ -316,20 +316,20 @@ class Input {
316
316
  cs = cfg_1.default.getApiClientSecret();
317
317
  ct = cfg_1.default.getApiClientToken();
318
318
  }
319
- if (!t) {
319
+ if (!t && !allowNoToken) {
320
320
  output_1.default.exitError(texts_1.ERR_REST_API_TOKEN);
321
321
  }
322
322
  return {
323
- token: t,
323
+ token: t || '',
324
324
  refreshToken: rf,
325
325
  clientId: cid,
326
326
  clientSecret: cs,
327
327
  clientToken: ct,
328
328
  };
329
329
  }
330
- static restApiTokenClient(optionsApi, optionsRegion, optionsToken) {
330
+ static restApiTokenClient(optionsApi, optionsRegion, optionsToken, allowNoToken = false) {
331
331
  const baseUrl = this.restApiBaseUrl(optionsApi, optionsRegion);
332
- const { token: t, refreshToken, clientId, clientToken, clientSecret, } = this.restApiToken(optionsToken);
332
+ const { token: t, refreshToken, clientId, clientToken, clientSecret, } = this.restApiToken(optionsToken, allowNoToken);
333
333
  return new client_1.default(baseUrl, t, refreshToken, clientId, clientSecret, clientToken);
334
334
  }
335
335
  static packageType(type) {
@@ -65,6 +65,18 @@ class Output {
65
65
  msg += '\n';
66
66
  terminal.blue(msg);
67
67
  }
68
+ static yellow(txt, newLine = true) {
69
+ let msg = txt;
70
+ if (newLine)
71
+ msg += '\n';
72
+ terminal.yellow(msg);
73
+ }
74
+ static cyan(txt, newLine = true) {
75
+ let msg = txt;
76
+ if (newLine)
77
+ msg += '\n';
78
+ terminal.cyan(msg);
79
+ }
68
80
  static debug(txt) {
69
81
  if (context_1.debug) {
70
82
  this.normal(txt);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.3-dev",
4
+ "version": "1.17.4-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "@scalar/json-magic": "0.9.4",
34
34
  "@scalar/types": "0.5.10",
35
35
  "@scalar/openapi-types": "0.5.3",
36
- "fastify": "4.28.1",
36
+ "fastify": "4.29.1",
37
37
  "fdir": "6.5.0",
38
38
  "open": "11.0.0",
39
39
  "fflate": "0.8.2",