snyk 1.1141.0 → 1.1143.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.
@@ -4090,10 +4090,10 @@ async function buildDepGraph(root, manifestFilePath, lockfilePath, lockfileVersi
4090
4090
  case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.YarnLockV1:
4091
4091
  return await lockFileParser.parseYarnLockV1Project(manifestFileContents, lockFileContents, options);
4092
4092
  case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.YarnLockV2:
4093
- return lockFileParser.parseYarnLockV2Project(manifestFileContents, lockFileContents, options);
4093
+ return await lockFileParser.parseYarnLockV2Project(manifestFileContents, lockFileContents, options);
4094
4094
  case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.NpmLockV2:
4095
4095
  case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.NpmLockV3:
4096
- return lockFileParser.parseNpmLockV2Project(manifestFileContents, lockFileContents, options);
4096
+ return await lockFileParser.parseNpmLockV2Project(manifestFileContents, lockFileContents, options);
4097
4097
  }
4098
4098
  throw new Error('Failed to build dep graph from current project');
4099
4099
  }
@@ -4247,7 +4247,7 @@ async function processNpmWorkspaces(root, settings, targetFiles) {
4247
4247
  : pathUtil.dirname(packageJsonFileName);
4248
4248
  const rootLockfileName = pathUtil.join(rootDir, 'package-lock.json');
4249
4249
  const lockContent = get_file_contents_1.getFileContents(root, rootLockfileName);
4250
- const res = lockFileParser.parseNpmLockV2Project(packageJson.content, lockContent.content, {
4250
+ const res = await lockFileParser.parseNpmLockV2Project(packageJson.content, lockContent.content, {
4251
4251
  includeDevDeps: settings.dev || false,
4252
4252
  strictOutOfSync: settings.strictOutOfSync || false,
4253
4253
  includeOptionalDeps: false,
@@ -6188,6 +6188,8 @@ const assemble_payloads_1 = __webpack_require__(38080);
6188
6188
  const request_1 = __webpack_require__(52050);
6189
6189
  const spinner_1 = __webpack_require__(86766);
6190
6190
  const dep_graph_1 = __webpack_require__(73399);
6191
+ const common_1 = __webpack_require__(70527);
6192
+ const common_2 = __webpack_require__(53110);
6191
6193
  const debug = debugModule('snyk:run-test');
6192
6194
  // Controls the number of simultaneous test requests that can be in-flight.
6193
6195
  const MAX_CONCURRENCY = 5;
@@ -6295,12 +6297,32 @@ async function sendAndParseResults(payloads, spinnerLbl, root, options) {
6295
6297
  await spinner_1.spinner(spinnerLbl);
6296
6298
  }
6297
6299
  const requests = [];
6298
- for (const payload of payloads) {
6300
+ for (const originalPayload of payloads) {
6299
6301
  const request = async () => {
6300
- /** sendTestPayload() deletes the request.body from the payload once completed. */
6301
- const originalPayload = Object.assign({}, payload);
6302
- const response = await sendTestPayload(payload);
6303
- return { payload, originalPayload, response };
6302
+ let step = 0;
6303
+ let error;
6304
+ while (step < common_2.RETRY_ATTEMPTS) {
6305
+ debug(`sendTestPayload retry step ${step} out of ${common_2.RETRY_ATTEMPTS}`);
6306
+ try {
6307
+ /** sendTestPayload() deletes the request.body from the payload once completed. */
6308
+ const payload = Object.assign({}, originalPayload);
6309
+ const response = await sendTestPayload(payload);
6310
+ return { payload, originalPayload, response };
6311
+ }
6312
+ catch (err) {
6313
+ error = err;
6314
+ step++;
6315
+ if (err instanceof errors_1.InternalServerError ||
6316
+ err instanceof errors_1.BadGatewayError ||
6317
+ err instanceof errors_1.ServiceUnavailableError) {
6318
+ await common_1.sleep(common_2.RETRY_DELAY);
6319
+ }
6320
+ else {
6321
+ break;
6322
+ }
6323
+ }
6324
+ }
6325
+ throw error;
6304
6326
  };
6305
6327
  requests.push(request);
6306
6328
  }
@@ -6489,6 +6511,14 @@ function handleTestHttpErrorResponse(res, body) {
6489
6511
  err = new errors_1.InternalServerError(userMessage);
6490
6512
  err.innerError = body.stack;
6491
6513
  break;
6514
+ case 502:
6515
+ err = new errors_1.BadGatewayError(userMessage);
6516
+ err.innerError = body.stack;
6517
+ break;
6518
+ case 503:
6519
+ err = new errors_1.ServiceUnavailableError(userMessage);
6520
+ err.innerError = body.stack;
6521
+ break;
6492
6522
  default:
6493
6523
  err = new errors_1.FailedToGetVulnerabilitiesError(userMessage, statusCode);
6494
6524
  err.innerError = body.error;