snyk 1.1091.0 → 1.1092.0

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/dist/cli/index.js CHANGED
@@ -28162,7 +28162,7 @@ exports.contactSupportMessage = 'If the issue persists contact support@snyk.io';
28162
28162
  In a backwards compatible way.
28163
28163
  */
28164
28164
  Object.defineProperty(exports, "__esModule", ({ value: true }));
28165
- exports.getHiddenApiUrl = exports.getRestApiUrl = exports.getV1ApiUrl = exports.getBaseApiUrl = void 0;
28165
+ exports.getRootUrl = exports.getHiddenApiUrl = exports.getRestApiUrl = exports.getV1ApiUrl = exports.getBaseApiUrl = void 0;
28166
28166
  const path = __webpack_require__(85622);
28167
28167
  const Debug = __webpack_require__(15158);
28168
28168
  const theme_1 = __webpack_require__(86988);
@@ -28273,6 +28273,16 @@ function getHiddenApiUrl(restUrl) {
28273
28273
  return parsedBaseUrl.toString();
28274
28274
  }
28275
28275
  exports.getHiddenApiUrl = getHiddenApiUrl;
28276
+ function getRootUrl(apiUrlString) {
28277
+ // based on https://docs.snyk.io/snyk-processes/data-residency-at-snyk#what-regions-are-available the pattern is as follows
28278
+ // https://app.[region.]snyk.io
28279
+ // given an api url that starts with api means, that we can replace "api" by "app".
28280
+ const apiUrl = new URL(apiUrlString);
28281
+ apiUrl.host = apiUrl.host.replace(/^api\./, '');
28282
+ const rootUrl = apiUrl.protocol + '//' + apiUrl.host;
28283
+ return rootUrl;
28284
+ }
28285
+ exports.getRootUrl = getRootUrl;
28276
28286
 
28277
28287
 
28278
28288
  /***/ }),
@@ -28315,9 +28325,7 @@ if (!config.timeout) {
28315
28325
  // this is a bit of an assumption that our web site origin is the same
28316
28326
  // as our API origin, but for now it's okay - RS 2015-10-16
28317
28327
  if (!config.ROOT) {
28318
- const apiUrl = new URL(config.API);
28319
- apiUrl.host = apiUrl.host.replace(/^ap[pi]\./, '');
28320
- config.ROOT = apiUrl.protocol + '//' + apiUrl.host;
28328
+ config.ROOT = api_url_1.getRootUrl(config.API);
28321
28329
  }
28322
28330
  config.PUBLIC_VULN_DB_URL = 'https://security.snyk.io';
28323
28331
  exports.default = config;