diff --git a/package-lock.json b/package-lock.json index ba702fd0..d50a1755 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@amplitude/analytics-node": "^1.5.54", "@apollo/client": "^4.1.9", "@cyclonedx/cdxgen": "^12.2.0", - "@herodevs/eol-shared": "github:herodevs/eol-shared#v0.1.19", + "@herodevs/eol-shared": "github:herodevs/eol-shared#v0.1.20", "@inquirer/prompts": "^8.0.2", "@oclif/core": "^4.10.5", "@oclif/plugin-help": "^6.2.32", @@ -2339,7 +2339,7 @@ }, "node_modules/@herodevs/eol-shared": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/herodevs/eol-shared.git#bb572272344d3ee53d5c7c30b9c619442051daa2", + "resolved": "git+ssh://git@github.com/herodevs/eol-shared.git#9e1ada64643ff801113d9361f14a49fabd067cdc", "license": "ISC", "dependencies": { "@cyclonedx/cyclonedx-library": "^9.4.1", diff --git a/package.json b/package.json index 3fd8c6c9..45115e08 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@amplitude/analytics-node": "^1.5.54", "@apollo/client": "^4.1.9", "@cyclonedx/cdxgen": "^12.2.0", - "@herodevs/eol-shared": "github:herodevs/eol-shared#v0.1.19", + "@herodevs/eol-shared": "github:herodevs/eol-shared#v0.1.20", "@inquirer/prompts": "^8.0.2", "@oclif/core": "^4.10.5", "@oclif/plugin-help": "^6.2.32", diff --git a/src/api/gql-operations.ts b/src/api/gql-operations.ts index 070fd530..c19c5743 100644 --- a/src/api/gql-operations.ts +++ b/src/api/gql-operations.ts @@ -30,6 +30,7 @@ query GetEolReport($input: GetEolReportInput) { } } } + remediations } page totalRecords diff --git a/test/service/file.svc.test.ts b/test/service/file.svc.test.ts index 5e60da30..24f29c10 100644 --- a/test/service/file.svc.test.ts +++ b/test/service/file.svc.test.ts @@ -225,6 +225,33 @@ describe('file.svc', () => { expect(outputPath.includes(tempDir)).toBe(true); }); + it('should preserve per-component remediations in the saved report', async () => { + tempDir = createTempDir(); + + const reportWithRemediations: EolReport = { + ...mockReport, + components: [ + { + purl: 'pkg:npm/bootstrap@3.1.1', + metadata: null, + remediations: [ + { + type: 'nes_available', + description: 'Secured, supported, drop-in replacement', + action: { type: 'direct', url: 'https://www.herodevs.com/support/bootstrap-nes' }, + target: { purl: 'pkg:npm/bootstrap@3.1.1', version: '3.1.1' }, + }, + ], + }, + ], + }; + + const outputPath = saveArtifactToFile(tempDir, { kind: 'report', payload: reportWithRemediations }); + + const parsed = JSON.parse(fs.readFileSync(outputPath, 'utf8')); + expect(parsed.components[0].remediations).toEqual(reportWithRemediations.components[0].remediations); + }); + it('should save report to a custom path', async () => { tempDir = createTempDir(); const customDir = join(tempDir, 'nested');