import { PackageURL } from "packageurl-js"; export default class CycloneDxSbom { sbomObject: any; rootComponent: any; components: any[]; dependencies: any[]; sourceManifestForAuditTrail: any; constructor(); /** * @param {PackageURL} root - add main/root component for sbom * @param {string|Array} [licenses] - optional license(s) for the root component * @return {CycloneDxSbom} the CycloneDxSbom Sbom Object */ addRoot(root: PackageURL, licenses?: string | any[]): CycloneDxSbom; /** * @return {{{"bom-ref": string, name, purl: string, type, version}}} root component of sbom. */ getRoot(): {}; /** * Adds a dependency relationship between two components in the SBOM * @param {PackageURL} sourceRef - The source component (parent) * @param {PackageURL} targetRef - The target component (dependency) * @param {string} [scope] - Scope of the dependency * @param {Array<{alg: string, content: string}>} [targetHashes] - Optional hashes for the target component * @return {CycloneDxSbom} The updated SBOM */ addDependency(sourceRef: PackageURL, targetRef: PackageURL, scope?: string, targetHashes?: Array<{ alg: string; content: string; }>): CycloneDxSbom; /** * Attach hashes to already-added components by matching their PURL. This is a * post-processing step so ecosystem-specific hash sources (e.g. Maven reading * the local .m2 cache) can enrich the SBOM without threading their concern * through the shared dependency-tree parser. Components without a matching * entry, or whose hashes are already set, are left untouched. * @param {Map>} hashMap - PURL→hashes map * @return {CycloneDxSbom} the updated SBOM */ attachHashes(hashMap: Map>): CycloneDxSbom; /** @param {{}} opts - various options, settings and configuration of application. * @return String CycloneDx Sbom json object in a string format */ getAsJsonString(opts: {}): string; /** * * @param {String} dependency - purl string of the component. * @return {int} - the index of the dependency in dependencies Array, returns -1 if not found. */ getDependencyIndex(dependency: string): int; /** * * @param {component} theComponent - Component Object with purl field. * @return {int} index of the found component entry, if not found returns -1. * @private */ private getComponentIndex; /** This method gets a PackageUrl, and returns a Component of CycloneDx Sbom * @param purl {PackageURL} * @return component */ purlToComponent(purl: PackageURL): { "bom-ref": string; name: any; purl: string; type: any; version: any; scope: any; licenses?: any; hashes?: any; }; /** * This method gets an array of dependencies to be ignored, and remove all of them from CycloneDx Sbom * @param {Array[PackageURL]} dependencies to be removed from sbom * @return {CycloneDxSbom} without ignored dependencies */ filterIgnoredDeps(deps: any): CycloneDxSbom; /** * This method gets an array of dependencies with versions( purl string format) to be ignored, and remove all of them from CycloneDx Sbom * @param {Array} dependencies to be removed from sbom * @return {CycloneDxSbom} without ignored dependencies */ filterIgnoredDepsIncludingVersion(deps: any): CycloneDxSbom; /** This method gets a component object, and a string name, and checks if the name is a substring of the component' purl. * @param {} component to search in its dependencies * @param {String} name to be checked. * * @return {boolean} */ checkIfPackageInsideDependsOnList(component: any, name: string): boolean; /** * Checks if any entry in the dependsOn list of sourceRef starts with the given purl prefix. * @param {PackageURL} sourceRef - The source component * @param {string} purlPrefix - The purl prefix to match (e.g. "pkg:npm/minimist@") * @return {boolean} */ checkDependsOnByPurlPrefix(sourceRef: PackageURL, purlPrefix: string): boolean; /** Removes the root component from the sbom */ removeRootComponent(): void; setSourceManifest(manifestData: any): void; }