@socketsecurity/cli-with-sentry 0.15.45 → 0.15.47

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.js CHANGED
@@ -3702,10 +3702,10 @@ function getSocketBranchPattern(options) {
3702
3702
  ...options
3703
3703
  };
3704
3704
  const purlObj = purl ? utils.getPurlObject(purl) : null;
3705
- const escType = purlObj ? regexps.escapeRegExp(purlObj.type) : '[^_]+';
3706
- const escWorkspace = workspace ? `${regexps.escapeRegExp(formatBranchName(workspace))}` : '[^_]+';
3705
+ const escType = purlObj ? regexps.escapeRegExp(purlObj.type) : '[^/]+';
3706
+ const escWorkspace = workspace ? `${regexps.escapeRegExp(formatBranchName(workspace))}` : '.+';
3707
3707
  const escMaybeNamespace = purlObj?.namespace ? `${regexps.escapeRegExp(formatBranchName(purlObj.namespace))}--` : '';
3708
- const escFullName = purlObj ? `${escMaybeNamespace}${regexps.escapeRegExp(formatBranchName(purlObj.name))}` : '[^_]+';
3708
+ const escFullName = purlObj ? `${escMaybeNamespace}${regexps.escapeRegExp(formatBranchName(purlObj.name))}` : '[^/_]+';
3709
3709
  const escVersion = purlObj ? regexps.escapeRegExp(formatBranchName(purlObj.version)) : '[^_]+';
3710
3710
  const escNewVersion = newVersion ? regexps.escapeRegExp(formatBranchName(newVersion)) : '[^_]+';
3711
3711
  return new RegExp(`^socket/(${escType})/(${escWorkspace})/(${escFullName})_(${escVersion})_(${escNewVersion})$`);
@@ -4392,6 +4392,11 @@ async function npmFix(pkgEnvDetails, {
4392
4392
  activeBranches.push(parsedBranch);
4393
4393
  }
4394
4394
  }
4395
+ if (activeBranches.length) {
4396
+ debug.debugFn(`found: ${activeBranches.length} active branches\n`, activeBranches);
4397
+ } else if (openPrs.length) {
4398
+ debug.debugFn('miss: 0 active branches found');
4399
+ }
4395
4400
  infos = infos.filter(info => !activeBranches.find(b => b.newVersion === info.firstPatchedVersionIdentifier));
4396
4401
  }
4397
4402
  if (!infos.length) {
@@ -4877,13 +4882,16 @@ async function pnpmFix(pkgEnvDetails, {
4877
4882
  const activeBranches = [];
4878
4883
  for (const pr of openPrs) {
4879
4884
  const parsedBranch = branchParser(pr.headRefName);
4885
+ debug.debugFn(`parse: ${pr.headRefName}\n`, parsedBranch);
4886
+ debug.debugFn(`check: branchPurlType ${branchPurlType} === ${parsedBranch?.type}`);
4887
+ debug.debugFn(`check: branchFullName ${branchFullName} === ${parsedBranch?.fullName}`);
4880
4888
  if (branchPurlType === parsedBranch?.type && branchFullName === parsedBranch?.fullName) {
4881
4889
  activeBranches.push(parsedBranch);
4882
4890
  }
4883
4891
  }
4884
4892
  if (activeBranches.length) {
4885
4893
  debug.debugFn(`found: ${activeBranches.length} active branches\n`, activeBranches);
4886
- } else {
4894
+ } else if (openPrs.length) {
4887
4895
  debug.debugFn('miss: 0 active branches found');
4888
4896
  }
4889
4897
  infos = infos.filter(info => !activeBranches.find(b => b.newVersion === info.firstPatchedVersionIdentifier));
@@ -11654,8 +11662,9 @@ async function testAndDownloadManifestFile({
11654
11662
  repoApiUrl,
11655
11663
  tmpDir
11656
11664
  }) {
11657
- debug.debugFn('test: file', file);
11665
+ debug.debugFn('testing: file', file);
11658
11666
  if (!SUPPORTED_FILE_PATTERNS.some(regex => regex.test(file))) {
11667
+ debug.debugFn(' - skip: not a known pattern');
11659
11668
  // Not an error.
11660
11669
  return {
11661
11670
  ok: true,
@@ -11664,7 +11673,7 @@ async function testAndDownloadManifestFile({
11664
11673
  }
11665
11674
  };
11666
11675
  }
11667
- debug.debugFn('found: manifest file', file);
11676
+ debug.debugFn('found: manifest file, going to attempt to download it;', file);
11668
11677
  const result = await downloadManifestFile({
11669
11678
  file,
11670
11679
  tmpDir,
@@ -11733,7 +11742,8 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11733
11742
  try {
11734
11743
  response = await fetch(downloadUrl);
11735
11744
  if (!response.ok) {
11736
- const errorMsg = `Download failed: ${response.status} ${response.statusText} for ${downloadUrl}`;
11745
+ const errorMsg = `Download failed due to bad server response: ${response.status} ${response.statusText} for ${downloadUrl}`;
11746
+ logger.logger.fail(errorMsg);
11737
11747
  return {
11738
11748
  ok: false,
11739
11749
  message: 'Download Failed',
@@ -11741,6 +11751,7 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11741
11751
  };
11742
11752
  }
11743
11753
  if (!response.body) {
11754
+ logger.logger.fail(`Download failed because the server response was empty, for ${downloadUrl}`);
11744
11755
  return {
11745
11756
  ok: false,
11746
11757
  message: 'Download Failed',
@@ -11759,7 +11770,10 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11759
11770
  data: localPath
11760
11771
  };
11761
11772
  } catch (error) {
11762
- logger.logger.fail('An error occurred trying to download the file...');
11773
+ logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
11774
+ debug.debugFn('Raw error:');
11775
+ debug.debugFn(error);
11776
+
11763
11777
  // If an error occurs and fileStream was created, attempt to clean up.
11764
11778
  if (fs$1.existsSync(localPath)) {
11765
11779
  // Check if fileStream was even opened before trying to delete
@@ -11780,6 +11794,7 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11780
11794
  // If error was due to bad HTTP status
11781
11795
  detailedError += ` (HTTP Status: ${response.status} ${response.statusText})`;
11782
11796
  }
11797
+ debug.debugFn(detailedError);
11783
11798
  return {
11784
11799
  ok: false,
11785
11800
  message: 'Download Failed',
@@ -14260,5 +14275,5 @@ void (async () => {
14260
14275
  await utils.captureException(e);
14261
14276
  }
14262
14277
  })();
14263
- //# debugId=a7078a69-7665-417e-a14a-4c06fdddafa4
14278
+ //# debugId=7ed4fffc-f660-40e2-8f0b-b1981857752e
14264
14279
  //# sourceMappingURL=cli.js.map