UNPKG

@brianveltman/sonatype-mcp

Version:

Model Context Protocol server for Sonatype Nexus Repository Manager

42 lines 1.82 kB
export class QuarantineService { firewallClient; constructor(firewallClient) { this.firewallClient = firewallClient; } async getQuarantinedComponents(purl) { const params = {}; if (purl) { params.purl = purl; } const response = await this.firewallClient.get('/api/v2/reports/components/quarantined', { params }); return response; } async releaseFromQuarantine(quarantineId, request = {}) { const response = await this.firewallClient.post(`/api/v2/repositories/quarantine/${encodeURIComponent(quarantineId)}/release`, request); return response; } async getQuarantinedComponentsByRepository(repositoryName) { const allQuarantined = await this.getQuarantinedComponents(); if (!allQuarantined.repositoryQuarantineSummary) { return null; } const repoSummary = allQuarantined.repositoryQuarantineSummary.find(repo => repo.repository === repositoryName); return repoSummary || null; } async searchQuarantinedComponents(purlPattern) { const allQuarantined = await this.getQuarantinedComponents(); if (!allQuarantined.repositoryQuarantineSummary) { return []; } const matchingComponents = []; for (const repoSummary of allQuarantined.repositoryQuarantineSummary) { if (repoSummary.components) { const filtered = repoSummary.components.filter(component => component.packageUrl?.toLowerCase().includes(purlPattern.toLowerCase()) || component.displayName?.toLowerCase().includes(purlPattern.toLowerCase())); matchingComponents.push(...filtered); } } return matchingComponents; } } //# sourceMappingURL=quarantine.js.map