snyk 1.840.0 → 1.844.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.
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "API": "https://snyk.io/api/v1",
3
+ "API_V3_URL": "https://api.snyk.io/v3",
3
4
  "devDeps": false,
4
5
  "PRUNE_DEPS_THRESHOLD": 40000,
5
6
  "MAX_PATH_COUNT": 1500000,
@@ -5992,7 +5992,8 @@ exports.validatePayload = validatePayload;
5992
5992
  "use strict";
5993
5993
 
5994
5994
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5995
- exports.makeRequest = void 0;
5995
+ exports.makeRequestV3 = exports.makeRequest = void 0;
5996
+ const api_token_1 = __webpack_require__(95181);
5996
5997
  const request = __webpack_require__(52050);
5997
5998
  async function makeRequest(payload) {
5998
5999
  return new Promise((resolve, reject) => {
@@ -6011,6 +6012,35 @@ async function makeRequest(payload) {
6011
6012
  });
6012
6013
  }
6013
6014
  exports.makeRequest = makeRequest;
6015
+ /**
6016
+ * All v3 request will essentially be the same and are JSON by default
6017
+ * Thus if no headers provided default headers are used
6018
+ * @param {any} payload for the request
6019
+ * @returns
6020
+ */
6021
+ async function makeRequestV3(payload) {
6022
+ return new Promise((resolve, reject) => {
6023
+ var _a;
6024
+ payload.headers = (_a = payload.headers) !== null && _a !== void 0 ? _a : {
6025
+ 'Content-Type': 'application/vnd.api+json',
6026
+ authorization: api_token_1.getAuthHeader(),
6027
+ };
6028
+ payload.json = true;
6029
+ request.makeRequest(payload, (error, res, body) => {
6030
+ if (error) {
6031
+ return reject(error);
6032
+ }
6033
+ if (res.statusCode >= 400) {
6034
+ return reject({
6035
+ code: res.statusCode,
6036
+ body: JSON.parse(body),
6037
+ });
6038
+ }
6039
+ resolve(JSON.parse(body));
6040
+ });
6041
+ });
6042
+ }
6043
+ exports.makeRequestV3 = makeRequestV3;
6014
6044
 
6015
6045
 
6016
6046
  /***/ }),