@coana-tech/cli 14.12.75 → 14.12.76

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/cli.mjs CHANGED
@@ -201941,7 +201941,7 @@ function getAdvisoryEcosystemFromPurlType(purlType) {
201941
201941
  case "gem" /* GEM */:
201942
201942
  return "RUBYGEMS";
201943
201943
  default:
201944
- throw Error(`Unsupported purl type: ${purlType}`);
201944
+ return void 0;
201945
201945
  }
201946
201946
  }
201947
201947
  function getPurlStrings(dependencyTree) {
@@ -229135,6 +229135,7 @@ var import_packageurl_js = __toESM(require_packageurl_js(), 1);
229135
229135
 
229136
229136
  // dist/cli-upgrade-purl.js
229137
229137
  import { join as join23, relative as relative18, resolve as resolve40 } from "node:path";
229138
+ var import_picomatch10 = __toESM(require_picomatch2(), 1);
229138
229139
 
229139
229140
  // ../project-management/src/project-management/project-manager.ts
229140
229141
  import { relative as relative17, resolve as resolve39 } from "path";
@@ -229564,7 +229565,6 @@ function assertDefined(value2) {
229564
229565
  }
229565
229566
 
229566
229567
  // dist/cli-upgrade-purl.js
229567
- var import_picomatch10 = __toESM(require_picomatch2(), 1);
229568
229568
  var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"];
229569
229569
  async function upgradePurl(rootDir, upgrades, artifacts, options, logFile, cliFixRunId) {
229570
229570
  if (options.rangeStyle && options.rangeStyle !== "pin") {
@@ -229587,7 +229587,7 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
229587
229587
  if (options.manifestsTarHash) {
229588
229588
  const { supportedUpgrades, unsupportedUpgrades } = Array.from(upgrades).reduce((acc, [idx, upgradeVersion]) => {
229589
229589
  const ecosystem = getAdvisoryEcosystemFromPurlType(artifacts[idx].type);
229590
- const target = ECOSYSTEMS_WITH_SOCKET_UPGRADES.includes(ecosystem) ? "supportedUpgrades" : "unsupportedUpgrades";
229590
+ const target = ecosystem && ECOSYSTEMS_WITH_SOCKET_UPGRADES.includes(ecosystem) ? "supportedUpgrades" : "unsupportedUpgrades";
229591
229591
  acc[target].set(idx, upgradeVersion);
229592
229592
  return acc;
229593
229593
  }, { supportedUpgrades: /* @__PURE__ */ new Map(), unsupportedUpgrades: /* @__PURE__ */ new Map() });
@@ -229600,13 +229600,16 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
229600
229600
  try {
229601
229601
  const manifestFiles = await fetchManifestFilesFromManifestsTarHash(options.manifestsTarHash);
229602
229602
  const ecosystemToSocketArtifactUpgrades = /* @__PURE__ */ new Map();
229603
- for (const [idx, upgradeVersion] of upgrades) {
229603
+ for (const [idx, upgradeVersion] of supportedUpgrades) {
229604
229604
  const artifact = artifacts[idx];
229605
229605
  if (!artifact.name)
229606
- return;
229606
+ continue;
229607
229607
  if (!artifact.version)
229608
- return;
229608
+ continue;
229609
229609
  const ecosystem = getAdvisoryEcosystemFromPurlType(artifact.type);
229610
+ if (!ecosystem) {
229611
+ throw new Error(`CLI Assertion error: Attempting to upgrade a purl from an unsupported ecosystem: ${purlToString(artifact)}.`);
229612
+ }
229610
229613
  if (!ecosystemToSocketArtifactUpgrades.has(ecosystem)) {
229611
229614
  ecosystemToSocketArtifactUpgrades.set(ecosystem, /* @__PURE__ */ new Map());
229612
229615
  }
@@ -229671,7 +229674,10 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
229671
229674
  const otherModulesCommunicator = new OtherModulesCommunicator(rootDir, options, {
229672
229675
  type: "missing"
229673
229676
  });
229674
- const ecosystems = Array.from(upgrades).map(([idx]) => getAdvisoryEcosystemFromPurlType(artifacts[idx].type));
229677
+ const ecosystems = Array.from(upgrades).map(([idx]) => getAdvisoryEcosystemFromPurlType(artifacts[idx].type)).filter((ecosystem) => ecosystem !== void 0);
229678
+ if (ecosystems.length === 0) {
229679
+ throw new Error(`No supported ecosystems found in the upgrades. This should not happen.`);
229680
+ }
229675
229681
  const manager = await ProjectManager.create(rootDir, otherModulesCommunicator, ecosystems);
229676
229682
  const { reachabilitySupport, traditionalScaSupport } = manager.getSubprojectsWithWorkspacePaths();
229677
229683
  const supportedSubprojects = reachabilitySupport.concat(traditionalScaSupport).filter((p3) => getPackageManagerSupport(p3.packageManagerName).supportsApplyingFixes);
@@ -230100,8 +230106,12 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
230100
230106
  if (!indices)
230101
230107
  throw Error("Could not find artifacts for purl");
230102
230108
  for (const idx of indices) {
230103
- const ecosystem = getAdvisoryEcosystemFromPurlType(artifacts[idx].type);
230104
230109
  const existingFixedVersion = upgrades.get(idx);
230110
+ const ecosystem = getAdvisoryEcosystemFromPurlType(artifacts[idx].type);
230111
+ if (!ecosystem) {
230112
+ logger.warn(`Skipping upgrade for unsupported ecosystem: ${artifacts[idx].type}`);
230113
+ continue;
230114
+ }
230105
230115
  if (!existingFixedVersion || versionSatisfiesRelation(ecosystem, existingFixedVersion, "<", fix.fixedVersion)) {
230106
230116
  upgrades.set(idx, fix.fixedVersion);
230107
230117
  }
@@ -245884,7 +245894,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
245884
245894
  }
245885
245895
 
245886
245896
  // dist/version.js
245887
- var version2 = "14.12.75";
245897
+ var version2 = "14.12.76";
245888
245898
 
245889
245899
  // dist/cli-core.js
245890
245900
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -245987,10 +245997,9 @@ var CliCore = class {
245987
245997
  });
245988
245998
  if (this.options.purlTypes) {
245989
245999
  this.options.purlTypes.forEach((purlType) => {
245990
- try {
245991
- getAdvisoryEcosystemFromPurlType(purlType);
245992
- } catch (e) {
245993
- throw new Error(`Invalid purl type: ${purlType}. Supported purl types are: ${ECOSYSTEMS_WITH_TRADITIONAL_SCA_SUPPORT.map((ecosystem) => getPurlType(ecosystem)).join(", ")}`);
246000
+ const ecosystem = getAdvisoryEcosystemFromPurlType(purlType);
246001
+ if (!ecosystem) {
246002
+ throw new Error(`Invalid purl type: ${purlType}. Supported purl types are: ${ECOSYSTEMS_WITH_TRADITIONAL_SCA_SUPPORT.map((ecosystem2) => getPurlType(ecosystem2)).join(", ")}`);
245994
246003
  }
245995
246004
  });
245996
246005
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.75",
3
+ "version": "14.12.76",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {