@coana-tech/cli 14.9.23 → 14.9.24

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.
Files changed (2) hide show
  1. package/cli.mjs +14 -7
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -212320,7 +212320,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
212320
212320
  }
212321
212321
 
212322
212322
  // dist/version.js
212323
- var version2 = "14.9.23";
212323
+ var version2 = "14.9.24";
212324
212324
 
212325
212325
  // ../../node_modules/.pnpm/axios@1.9.0/node_modules/axios/lib/helpers/bind.js
212326
212326
  function bind2(fn2, thisArg) {
@@ -215646,14 +215646,20 @@ async function scanForVulnerabilitiesSocketMode(dependencyTree) {
215646
215646
  const data2 = {
215647
215647
  components: Object.keys(purlStringsToIdentifier).map((purl) => ({ purl }))
215648
215648
  };
215649
- const componentsString = (await axios_default2.post(url3, data2, {
215649
+ const componentsResponse = (await axios_default2.post(url3, data2, {
215650
215650
  headers: {
215651
215651
  "Content-Type": "application/json",
215652
215652
  Accept: "application/json",
215653
215653
  Authorization: `Basic ${btoa(`${process.env.SOCKET_CLI_API_TOKEN}:`)}`
215654
215654
  }
215655
215655
  })).data;
215656
- components = JSON.parse(`[${componentsString.trim().replace(/\n/g, ",")}]`);
215656
+ if (typeof componentsResponse === "object") {
215657
+ components = [componentsResponse];
215658
+ } else if (typeof componentsResponse === "string") {
215659
+ components = JSON.parse(`[${componentsResponse.trim().replace(/\n/g, ",")}]`);
215660
+ } else {
215661
+ throw new Error(`Unexpected response type from Socket API: ${typeof componentsResponse}`);
215662
+ }
215657
215663
  } catch (e) {
215658
215664
  logger.error("Failed to scan for vulnerabilities in socket mode");
215659
215665
  logger.error("error", e);
@@ -215816,7 +215822,7 @@ function toSocketFacts(report, dependencyTrees, subPjToWsPathToDirectDependencie
215816
215822
  const components = [];
215817
215823
  const purlToIndex = /* @__PURE__ */ new Map();
215818
215824
  for (const dependencyTree of dependencyTrees) {
215819
- const depIdentifierToPurl = Object.fromEntries(Object.entries(dependencyTree.dependencyTree.transitiveDependencies).map(([depIdentifier, dep]) => {
215825
+ const depIdentifierToPurl = Object.fromEntries(Object.entries(dependencyTree.dependencyTree.transitiveDependencies).filter(([_depIdentifier, dep]) => dep.purlObj).map(([depIdentifier, dep]) => {
215820
215826
  const purl = dep.purlObj.purlString;
215821
215827
  if (purl && !purlToIndex.has(purl)) {
215822
215828
  purlToIndex.set(purl, components.length);
@@ -215842,11 +215848,14 @@ function toSocketFacts(report, dependencyTrees, subPjToWsPathToDirectDependencie
215842
215848
  }));
215843
215849
  for (const [depIdentifier, purl] of Object.entries(depIdentifierToPurl)) {
215844
215850
  const depTreeNode = dependencyTree.dependencyTree.transitiveDependencies[depIdentifier];
215851
+ if (!depTreeNode.purlObj) {
215852
+ continue;
215853
+ }
215845
215854
  const component = components[purlToIndex.get(purl)];
215846
215855
  depTreeNode.dependencies?.forEach((dep) => {
215847
215856
  const depPurl = depIdentifierToPurl[dep];
215848
215857
  const depIndex = purlToIndex.get(depPurl);
215849
- if (!component.dependencies?.includes(depIndex.toString())) {
215858
+ if (depIndex && !component.dependencies?.includes(depIndex.toString())) {
215850
215859
  component.dependencies.push(depIndex.toString());
215851
215860
  }
215852
215861
  });
@@ -216326,8 +216335,6 @@ var CliCore = class {
216326
216335
  ];
216327
216336
  } catch (e) {
216328
216337
  logger.error(`Scanning for vulnerabilities failed for subproject ${subprojectPath} in workspace ${workspacePath}`);
216329
- logger.error(JSON.stringify(dependencyTree, null, 2));
216330
- await new Promise((resolve25) => setTimeout(resolve25, 1e4));
216331
216338
  throw e;
216332
216339
  } finally {
216333
216340
  this.sendProgress("SCAN_FOR_VULNERABILITIES", false, subprojectPath, workspacePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.9.23",
3
+ "version": "14.9.24",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {