UNPKG

auditjs

Version:

Audit dependencies to identify known vulnerabilities and maintenance problems

57 lines 2.25 kB
"use strict"; /* * Copyright 2019-Present Sonatype Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Vulnerability = exports.OssIndexServerResult = void 0; class OssIndexServerResult { constructor(result) { this.coordinates = result.coordinates; this.description = result.description; this.reference = result.reference; this.vulnerabilities = result.vulnerabilities.map((x) => { return new Vulnerability(x); }); } toAuditLog() { return `${this.coordinates.replace('%40', '@')} - ${this.vulnerabilityMessage()}`; } vulnerabilityMessage() { var _a, _b; if (this.vulnerabilities && ((_a = this.vulnerabilities) === null || _a === void 0 ? void 0 : _a.length) > 1) { return `${this.vulnerabilities.length} vulnerabilities found!`; } else if (this.vulnerabilities && ((_b = this.vulnerabilities) === null || _b === void 0 ? void 0 : _b.length) === 1) { return `${this.vulnerabilities.length} vulnerability found!`; } else { return `No vulnerabilities found!`; } } } exports.OssIndexServerResult = OssIndexServerResult; class Vulnerability { constructor(vulnerability) { this.id = vulnerability.id; this.title = vulnerability.title; this.description = vulnerability.description; this.cvssScore = vulnerability.cvssScore; this.cvssVector = vulnerability.cvssVector; this.cve = vulnerability.cve; this.reference = vulnerability.reference; } } exports.Vulnerability = Vulnerability; //# sourceMappingURL=OssIndexServerResult.js.map