@socketsecurity/cli 0.14.31 → 0.14.33

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.
@@ -43,7 +43,7 @@ var arborist = {};
43
43
  var ttyServer$1 = {};
44
44
 
45
45
  var name = "@socketsecurity/cli";
46
- var version = "0.14.31";
46
+ var version = "0.14.33";
47
47
  var description = "CLI tool for Socket.dev";
48
48
  var homepage = "http://github.com/SocketDev/socket-cli";
49
49
  var license = "MIT";
@@ -883,20 +883,16 @@ async function getPackagesAlerts(safeArb, _registry, pkgs, output) {
883
883
  });
884
884
  // Before we ask about problematic issues, check to see if they
885
885
  // already existed in the old version if they did, be quiet.
886
- const pkg = pkgs.find(p => p.pkgid === id && p.existing?.startsWith(`${name}@`));
887
- if (pkg?.existing) {
886
+ const existing = pkgs.find(p => p.existing?.startsWith(`${name}@`))?.existing;
887
+ if (existing) {
888
888
  const oldArtifact =
889
889
  // eslint-disable-next-line no-await-in-loop
890
- (await batchScan([pkg.existing]).next()).value;
891
- console.log('oldArtifact', oldArtifact);
892
- // if (oldArtifact.type === 'success') {
893
- // issues = issues.filter(
894
- // ({ type }) =>
895
- // oldPkgData.value.issues.find(
896
- // oldIssue => oldIssue.type === type
897
- // ) === undefined
898
- // )
899
- // }
890
+ (await batchScan([existing]).next()).value;
891
+ if (oldArtifact?.alerts?.length) {
892
+ alerts = alerts.filter(({
893
+ type
894
+ }) => !oldArtifact.alerts?.find(a => a.type === type));
895
+ }
900
896
  }
901
897
  }
902
898
  }
@@ -959,23 +955,31 @@ function walk(diff_, needInfoOn = []) {
959
955
  if (!diff) {
960
956
  continue;
961
957
  }
962
- if (diff.action) {
963
- const sameVersion = diff.actual?.package.version === diff.ideal?.package.version;
958
+ const {
959
+ action
960
+ } = diff;
961
+ if (action) {
962
+ const oldNode = diff.actual;
963
+ const oldPkgid = oldNode?.pkgid;
964
+ const pkgNode = diff.ideal;
965
+ const pkgid = pkgNode?.pkgid;
966
+ let existing;
964
967
  let keep = false;
965
- let existing = null;
966
- if (diff.action === 'CHANGE') {
967
- if (!sameVersion) {
968
- existing = diff.actual.pkgid;
968
+ if (action === 'CHANGE') {
969
+ if (pkgNode?.package.version !== oldNode?.package.version) {
969
970
  keep = true;
971
+ if (oldNode?.package.name && oldNode.package.name === pkgNode?.package.name) {
972
+ existing = oldPkgid;
973
+ }
970
974
  }
971
975
  } else {
972
- keep = diff.action !== 'REMOVE';
976
+ keep = action !== 'REMOVE';
973
977
  }
974
- if (keep && diff.ideal?.pkgid && diff.ideal.resolved && (!diff.actual || diff.actual.resolved)) {
978
+ if (keep && pkgid && pkgNode.resolved && (!oldNode || oldNode.resolved)) {
975
979
  needInfoOn.push({
976
980
  existing,
977
- pkgid: diff.ideal.pkgid,
978
- repository_url: toRepoUrl(diff.ideal.resolved)
981
+ pkgid,
982
+ repository_url: toRepoUrl(pkgNode.resolved)
979
983
  });
980
984
  }
981
985
  }
@@ -42,7 +42,7 @@ var arborist = {};
42
42
  var ttyServer$1 = {};
43
43
 
44
44
  var name = "@socketsecurity/cli";
45
- var version = "0.14.31";
45
+ var version = "0.14.33";
46
46
  var description = "CLI tool for Socket.dev";
47
47
  var homepage = "http://github.com/SocketDev/socket-cli";
48
48
  var license = "MIT";
@@ -882,20 +882,16 @@ async function getPackagesAlerts(safeArb, _registry, pkgs, output) {
882
882
  });
883
883
  // Before we ask about problematic issues, check to see if they
884
884
  // already existed in the old version if they did, be quiet.
885
- const pkg = pkgs.find(p => p.pkgid === id && p.existing?.startsWith(`${name}@`));
886
- if (pkg?.existing) {
885
+ const existing = pkgs.find(p => p.existing?.startsWith(`${name}@`))?.existing;
886
+ if (existing) {
887
887
  const oldArtifact =
888
888
  // eslint-disable-next-line no-await-in-loop
889
- (await batchScan([pkg.existing]).next()).value;
890
- console.log('oldArtifact', oldArtifact);
891
- // if (oldArtifact.type === 'success') {
892
- // issues = issues.filter(
893
- // ({ type }) =>
894
- // oldPkgData.value.issues.find(
895
- // oldIssue => oldIssue.type === type
896
- // ) === undefined
897
- // )
898
- // }
889
+ (await batchScan([existing]).next()).value;
890
+ if (oldArtifact?.alerts?.length) {
891
+ alerts = alerts.filter(({
892
+ type
893
+ }) => !oldArtifact.alerts?.find(a => a.type === type));
894
+ }
899
895
  }
900
896
  }
901
897
  }
@@ -958,23 +954,31 @@ function walk(diff_, needInfoOn = []) {
958
954
  if (!diff) {
959
955
  continue;
960
956
  }
961
- if (diff.action) {
962
- const sameVersion = diff.actual?.package.version === diff.ideal?.package.version;
957
+ const {
958
+ action
959
+ } = diff;
960
+ if (action) {
961
+ const oldNode = diff.actual;
962
+ const oldPkgid = oldNode?.pkgid;
963
+ const pkgNode = diff.ideal;
964
+ const pkgid = pkgNode?.pkgid;
965
+ let existing;
963
966
  let keep = false;
964
- let existing = null;
965
- if (diff.action === 'CHANGE') {
966
- if (!sameVersion) {
967
- existing = diff.actual.pkgid;
967
+ if (action === 'CHANGE') {
968
+ if (pkgNode?.package.version !== oldNode?.package.version) {
968
969
  keep = true;
970
+ if (oldNode?.package.name && oldNode.package.name === pkgNode?.package.name) {
971
+ existing = oldPkgid;
972
+ }
969
973
  }
970
974
  } else {
971
- keep = diff.action !== 'REMOVE';
975
+ keep = action !== 'REMOVE';
972
976
  }
973
- if (keep && diff.ideal?.pkgid && diff.ideal.resolved && (!diff.actual || diff.actual.resolved)) {
977
+ if (keep && pkgid && pkgNode.resolved && (!oldNode || oldNode.resolved)) {
974
978
  needInfoOn.push({
975
979
  existing,
976
- pkgid: diff.ideal.pkgid,
977
- repository_url: toRepoUrl(diff.ideal.resolved)
980
+ pkgid,
981
+ repository_url: toRepoUrl(pkgNode.resolved)
978
982
  });
979
983
  }
980
984
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/cli",
3
- "version": "0.14.31",
3
+ "version": "0.14.33",
4
4
  "description": "CLI tool for Socket.dev",
5
5
  "homepage": "http://github.com/SocketDev/socket-cli",
6
6
  "license": "MIT",