snyk 1.1029.0 → 1.1031.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.
@@ -160683,15 +160683,23 @@ async function getAllDepsOneProject(root, targetFile, options, snykHttpClient, s
160683
160683
  return getTargetProject(subProject, allProjectDeps, allSubProjectNames);
160684
160684
  }
160685
160685
  function getTargetProject(subProject, allProjectDeps, allSubProjectNames) {
160686
- const { projects, defaultProject, versionBuildInfo } = allProjectDeps;
160687
- const targetProject = subProject || defaultProject;
160686
+ const { projects, defaultProject, defaultProjectKey, versionBuildInfo } = allProjectDeps;
160688
160687
  let gradleProjectName = defaultProject;
160689
160688
  if (subProject) {
160689
+ // TODO: we don't want to break the existing implementation of --sub-project using name
160690
+ // we would like a relative path instead to have a unique identifier
160691
+ if (subProject != '.') {
160692
+ subProject =
160693
+ allSubProjectNames.find((it) => it === subProject) ||
160694
+ allSubProjectNames.find((it) => it.match(`/${subProject}`)) ||
160695
+ subProject;
160696
+ }
160690
160697
  if (!allProjectDeps.projects || !allProjectDeps.projects[subProject]) {
160691
160698
  throw new errors_1.MissingSubProjectError(subProject, allSubProjectNames);
160692
160699
  }
160693
160700
  gradleProjectName = `${allProjectDeps.defaultProject}/${subProject}`;
160694
160701
  }
160702
+ const targetProject = subProject || defaultProjectKey;
160695
160703
  const { depGraph } = projects[targetProject];
160696
160704
  return {
160697
160705
  depGraph,
@@ -160939,14 +160947,14 @@ ${chalk.red.bold(mainErrorMessage)}`;
160939
160947
  }
160940
160948
  async function processProjectsInExtractedJSON(root, extractedJSON, coordinateMap) {
160941
160949
  for (const projectId in extractedJSON.projects) {
160942
- const { defaultProject } = extractedJSON;
160950
+ const { defaultProject, defaultProjectKey } = extractedJSON;
160943
160951
  const { snykGraph, projectVersion } = extractedJSON.projects[projectId];
160944
160952
  if (!snykGraph) {
160945
160953
  continue;
160946
160954
  }
160947
160955
  const invalidValues = [null, undefined, ''];
160948
160956
  const isValidRootDir = invalidValues.indexOf(root) === -1;
160949
- const isSubProject = projectId !== defaultProject;
160957
+ const isSubProject = projectId !== defaultProjectKey;
160950
160958
  let projectName = isValidRootDir ? path.basename(root) : defaultProject;
160951
160959
  if (isSubProject) {
160952
160960
  projectName = isValidRootDir
@@ -161075,7 +161083,8 @@ async function getMavenPackageInfo(sha1, depCoords, snykHttpClient) {
161075
161083
  var _a;
161076
161084
  const { res, body } = await snykHttpClient({
161077
161085
  method: 'get',
161078
- path: `/rest/packages`,
161086
+ // base URL defaults to SNYK_API_REST_URL="https://api.snyk.io/rest"
161087
+ path: `/packages`,
161079
161088
  qs: {
161080
161089
  version: PACKAGE_SEARCH_VERSION,
161081
161090
  /* eslint-disable @typescript-eslint/camelcase */