bdy 1.19.4-dev-pipeline → 1.19.5-dev-pipeline

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.19.4-dev-pipeline",
4
+ "version": "1.19.5-dev-pipeline",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -334,8 +334,8 @@ class Input {
334
334
  }
335
335
  static restApiTokenClient(allowNoToken = false, api = '', region = '', token = '') {
336
336
  const ApiClient = require('./api/client').default;
337
- const baseUrl = this.restApiBaseUrl(api, region);
338
337
  const { token: t, refreshToken, clientId, clientToken, clientSecret, } = this.restApiToken(allowNoToken, token);
338
+ const baseUrl = this.restApiBaseUrl(api, region, t);
339
339
  return new ApiClient(baseUrl, t, refreshToken, clientId, clientSecret, clientToken);
340
340
  }
341
341
  static artifactType(type) {
@@ -442,8 +442,26 @@ class Input {
442
442
  output_1.default.exitError(texts_1.ERR_REST_API_REGION);
443
443
  }
444
444
  }
445
- static restApiBaseUrl(api = '', region = '') {
446
- let u = api || process.env.BUDDY_API_ENDPOINT;
445
+ static restApiBaseUrlFromToken(token) {
446
+ // bdy_sb_us_aHR0cHM6Ly9hcGkuc2Q1LmNvbQ_f92ml8f1p27nzo45806vczm6c78d0
447
+ const s = (token || '').split('_');
448
+ if (s.length > 1) {
449
+ const base = s[s.length - 2];
450
+ try {
451
+ return Buffer.from(base, 'base64').toString('utf8');
452
+ }
453
+ catch {
454
+ // do nothing
455
+ }
456
+ }
457
+ return null;
458
+ }
459
+ static restApiBaseUrl(api = '', region = '', token = '') {
460
+ let u = api;
461
+ if (!u)
462
+ u = this.restApiBaseUrlFromToken(token);
463
+ if (!u)
464
+ u = process.env.BUDDY_API_ENDPOINT || null;
447
465
  if (!u)
448
466
  u = cfg_1.default.getBaseUrl();
449
467
  if (!u) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.19.4-dev-pipeline",
4
+ "version": "1.19.5-dev-pipeline",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {