diff --git a/package-lock.json b/package-lock.json index 3dd4a305..67a2e5d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@amplitude/analytics-node": "^1.5.59", "@apollo/client": "^4.1.9", "@cyclonedx/cdxgen": "^12.5.1", - "@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", @@ -2248,7 +2248,7 @@ }, "node_modules/@herodevs/eol-shared": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/herodevs/eol-shared.git#d09fced611e00f141c134909634052674adbeea7", + "resolved": "git+ssh://git@github.com/herodevs/eol-shared.git#9e1ada64643ff801113d9361f14a49fabd067cdc", "license": "ISC", "dependencies": { "@cyclonedx/cyclonedx-library": "^9.4.1", @@ -11619,7 +11619,6 @@ "version": "7.8.2", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", - "dev": true, "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" diff --git a/package.json b/package.json index 15009211..098113a8 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@amplitude/analytics-node": "^1.5.59", "@apollo/client": "^4.1.9", "@cyclonedx/cdxgen": "^12.5.1", - "@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');