@cyclonedx/cyclonedx-library
Version:
Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).
136 lines (132 loc) • 5.36 kB
JavaScript
"use strict";
/*!
This file is part of CycloneDX JavaScript Library.
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.
SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports._Spec = void 0;
const models_1 = require("../models");
class _Spec {
#version;
#formats;
#componentTypes;
#hashAlgorithms;
#hashValuePattern;
#externalReferenceTypes;
#vulnerabilityRatingMethods;
#supportsDependencyGraph;
#supportsToolReferences;
#requiresComponentVersion;
#supportsProperties;
#supportsVulnerabilities;
#supportsComponentEvidence;
#supportsMetadataLifecycles;
#supportsMetadataLicenses;
#supportsMetadataProperties;
#supportsExternalReferenceHashes;
#supportsLicenseAcknowledgement;
#supportsServices;
#supportsToolsComponentsServices;
#supportsLicenseProperties;
constructor(version, formats, componentTypes, hashAlgorithms, hashValuePattern, externalReferenceTypes, supportsDependencyGraph, supportsToolReferences, requiresComponentVersion, supportsProperties, supportsVulnerabilities, vulnerabilityRatingMethods, supportsComponentEvidence, supportsMetadataLifecycles, supportsMetadataLicenses, supportsMetadataProperties, supportsExternalReferenceHashes, supportsLicenseAcknowledgement, supportsServices, supportsToolsComponentsServices, supportsLicenseProperties) {
this.#version = version;
this.#formats = new Set(formats);
this.#componentTypes = new Set(componentTypes);
this.#hashAlgorithms = new Set(hashAlgorithms);
this.#hashValuePattern = hashValuePattern;
this.#externalReferenceTypes = new Set(externalReferenceTypes);
this.#supportsDependencyGraph = supportsDependencyGraph;
this.#supportsToolReferences = supportsToolReferences;
this.#requiresComponentVersion = requiresComponentVersion;
this.#supportsProperties = supportsProperties;
this.#supportsVulnerabilities = supportsVulnerabilities;
this.#vulnerabilityRatingMethods = new Set(vulnerabilityRatingMethods);
this.#supportsComponentEvidence = supportsComponentEvidence;
this.#supportsMetadataLifecycles = supportsMetadataLifecycles;
this.#supportsMetadataLicenses = supportsMetadataLicenses;
this.#supportsMetadataProperties = supportsMetadataProperties;
this.#supportsExternalReferenceHashes = supportsExternalReferenceHashes;
this.#supportsLicenseAcknowledgement = supportsLicenseAcknowledgement;
this.#supportsServices = supportsServices;
this.#supportsToolsComponentsServices = supportsToolsComponentsServices;
this.#supportsLicenseProperties = supportsLicenseProperties;
}
get version() {
return this.#version;
}
supportsFormat(f) {
return this.#formats.has(f);
}
supportsComponentType(ct) {
return this.#componentTypes.has(ct);
}
supportsHashAlgorithm(ha) {
return this.#hashAlgorithms.has(ha);
}
supportsHashValue(hv) {
return typeof hv === 'string' &&
this.#hashValuePattern.test(hv);
}
supportsExternalReferenceType(ert) {
return this.#externalReferenceTypes.has(ert);
}
get supportsDependencyGraph() {
return this.#supportsDependencyGraph;
}
get supportsToolReferences() {
return this.#supportsToolReferences;
}
get requiresComponentVersion() {
return this.#requiresComponentVersion;
}
supportsProperties(model) {
switch (true) {
case model instanceof models_1.NamedLicense || model instanceof models_1.SpdxLicense:
return this.#supportsLicenseProperties;
default:
return this.#supportsProperties;
}
}
get supportsVulnerabilities() {
return this.#supportsVulnerabilities;
}
supportsVulnerabilityRatingMethod(rm) {
return this.#vulnerabilityRatingMethods.has(rm);
}
get supportsComponentEvidence() {
return this.#supportsComponentEvidence;
}
get supportsMetadataLifecycles() {
return this.#supportsMetadataLifecycles;
}
get supportsMetadataLicenses() {
return this.#supportsMetadataLicenses;
}
get supportsMetadataProperties() {
return this.#supportsMetadataProperties;
}
get supportsExternalReferenceHashes() {
return this.#supportsExternalReferenceHashes;
}
get supportsLicenseAcknowledgement() {
return this.#supportsLicenseAcknowledgement;
}
get supportsServices() {
return this.#supportsServices;
}
get supportsToolsComponentsServices() {
return this.#supportsToolsComponentsServices;
}
}
exports._Spec = _Spec;
//# sourceMappingURL=_protocol.js.map