@trustify-da/trustify-da-javascript-client 0.3.0-ea.6549d2a → 0.3.0-ea.68905d3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +368 -14
- package/dist/package.json +39 -26
- package/dist/src/analysis.d.ts +28 -5
- package/dist/src/analysis.js +78 -13
- package/dist/src/batch_opts.d.ts +24 -0
- package/dist/src/batch_opts.js +35 -0
- package/dist/src/cli.js +287 -5
- package/dist/src/cyclone_dx_sbom.d.ts +27 -1
- package/dist/src/cyclone_dx_sbom.js +84 -10
- package/dist/src/index.d.ts +145 -8
- package/dist/src/index.js +362 -28
- package/dist/src/license/index.d.ts +5 -5
- package/dist/src/license/index.js +8 -5
- package/dist/src/license/license_utils.d.ts +40 -0
- package/dist/src/license/license_utils.js +137 -0
- package/dist/src/license/licenses_api.d.ts +2 -2
- package/dist/src/license/licenses_api.js +9 -2
- package/dist/src/license/project_license.d.ts +1 -6
- package/dist/src/license/project_license.js +4 -81
- package/dist/src/oci_image/images.d.ts +1 -1
- package/dist/src/oci_image/images.js +15 -1
- package/dist/src/oci_image/utils.d.ts +5 -5
- package/dist/src/oci_image/utils.js +11 -2
- package/dist/src/package_version.d.ts +8 -0
- package/dist/src/package_version.js +31 -0
- package/dist/src/provider.d.ts +8 -4
- package/dist/src/provider.js +18 -5
- package/dist/src/providers/base_java.d.ts +67 -12
- package/dist/src/providers/base_java.js +82 -61
- package/dist/src/providers/base_javascript.d.ts +91 -10
- package/dist/src/providers/base_javascript.js +220 -28
- package/dist/src/providers/base_pyproject.d.ts +158 -0
- package/dist/src/providers/base_pyproject.js +322 -0
- package/dist/src/providers/containerfile_parser.d.ts +5 -0
- package/dist/src/providers/containerfile_parser.js +20 -0
- package/dist/src/providers/golang_gomodules.d.ts +23 -13
- package/dist/src/providers/golang_gomodules.js +210 -121
- package/dist/src/providers/gomod_parser.d.ts +4 -0
- package/dist/src/providers/gomod_parser.js +16 -0
- package/dist/src/providers/java_gradle.d.ts +67 -0
- package/dist/src/providers/java_gradle.js +314 -21
- package/dist/src/providers/java_gradle_groovy.d.ts +1 -1
- package/dist/src/providers/java_gradle_kotlin.d.ts +1 -1
- package/dist/src/providers/java_maven.d.ts +38 -10
- package/dist/src/providers/java_maven.js +279 -20
- package/dist/src/providers/javascript_bun.d.ts +22 -0
- package/dist/src/providers/javascript_bun.js +141 -0
- package/dist/src/providers/javascript_npm.d.ts +19 -0
- package/dist/src/providers/javascript_npm.js +61 -1
- package/dist/src/providers/javascript_pnpm.d.ts +14 -1
- package/dist/src/providers/javascript_pnpm.js +55 -5
- package/dist/src/providers/javascript_yarn.d.ts +12 -0
- package/dist/src/providers/javascript_yarn.js +75 -2
- package/dist/src/providers/manifest.d.ts +2 -0
- package/dist/src/providers/manifest.js +28 -7
- package/dist/src/providers/marker_evaluator.d.ts +14 -0
- package/dist/src/providers/marker_evaluator.js +191 -0
- package/dist/src/providers/oci_dockerfile.d.ts +51 -0
- package/dist/src/providers/oci_dockerfile.js +177 -0
- package/dist/src/providers/processors/yarn_berry_processor.d.ts +6 -2
- package/dist/src/providers/processors/yarn_berry_processor.js +91 -7
- package/dist/src/providers/processors/yarn_classic_processor.d.ts +6 -2
- package/dist/src/providers/processors/yarn_classic_processor.js +8 -6
- package/dist/src/providers/python_controller.d.ts +5 -1
- package/dist/src/providers/python_controller.js +69 -8
- package/dist/src/providers/python_pip.d.ts +5 -0
- package/dist/src/providers/python_pip.js +8 -7
- package/dist/src/providers/python_pip_pyproject.d.ts +61 -0
- package/dist/src/providers/python_pip_pyproject.js +146 -0
- package/dist/src/providers/python_poetry.d.ts +98 -0
- package/dist/src/providers/python_poetry.js +286 -0
- package/dist/src/providers/python_uv.d.ts +46 -0
- package/dist/src/providers/python_uv.js +269 -0
- package/dist/src/providers/requirements_parser.js +5 -4
- package/dist/src/providers/rust_cargo.d.ts +56 -0
- package/dist/src/providers/rust_cargo.js +682 -0
- package/dist/src/providers/tree-sitter-containerfile.wasm +0 -0
- package/dist/src/providers/tree-sitter-gomod.wasm +0 -0
- package/dist/src/providers/tree-sitter-requirements.wasm +0 -0
- package/dist/src/remediate.d.ts +117 -0
- package/dist/src/remediate.js +249 -0
- package/dist/src/remediation.d.ts +57 -0
- package/dist/src/remediation.js +436 -0
- package/dist/src/remediation_report.d.ts +40 -0
- package/dist/src/remediation_report.js +159 -0
- package/dist/src/sbom.d.ts +25 -1
- package/dist/src/sbom.js +23 -2
- package/dist/src/tools.d.ts +28 -2
- package/dist/src/tools.js +82 -1
- package/dist/src/updaters/maven_updater.d.ts +58 -0
- package/dist/src/updaters/maven_updater.js +345 -0
- package/dist/src/updaters/toml_updater.d.ts +62 -0
- package/dist/src/updaters/toml_updater.js +276 -0
- package/dist/src/workspace.d.ts +70 -0
- package/dist/src/workspace.js +256 -0
- package/package.json +40 -27
- package/dist/src/license/compatibility.d.ts +0 -18
- package/dist/src/license/compatibility.js +0 -45
|
@@ -18,9 +18,27 @@ export default class CycloneDxSbom {
|
|
|
18
18
|
* Adds a dependency relationship between two components in the SBOM
|
|
19
19
|
* @param {PackageURL} sourceRef - The source component (parent)
|
|
20
20
|
* @param {PackageURL} targetRef - The target component (dependency)
|
|
21
|
+
* @param {string} [scope] - Scope of the dependency
|
|
22
|
+
* @param {Array<{alg: string, content: string}>} [targetHashes] - Optional hashes for the target component
|
|
21
23
|
* @return {CycloneDxSbom} The updated SBOM
|
|
22
24
|
*/
|
|
23
|
-
addDependency(sourceRef: PackageURL, targetRef: PackageURL, scope
|
|
25
|
+
addDependency(sourceRef: PackageURL, targetRef: PackageURL, scope?: string, targetHashes?: Array<{
|
|
26
|
+
alg: string;
|
|
27
|
+
content: string;
|
|
28
|
+
}>): CycloneDxSbom;
|
|
29
|
+
/**
|
|
30
|
+
* Attach hashes to already-added components by matching their PURL. This is a
|
|
31
|
+
* post-processing step so ecosystem-specific hash sources (e.g. Maven reading
|
|
32
|
+
* the local .m2 cache) can enrich the SBOM without threading their concern
|
|
33
|
+
* through the shared dependency-tree parser. Components without a matching
|
|
34
|
+
* entry, or whose hashes are already set, are left untouched.
|
|
35
|
+
* @param {Map<string, Array<{alg: string, content: string}>>} hashMap - PURL→hashes map
|
|
36
|
+
* @return {CycloneDxSbom} the updated SBOM
|
|
37
|
+
*/
|
|
38
|
+
attachHashes(hashMap: Map<string, Array<{
|
|
39
|
+
alg: string;
|
|
40
|
+
content: string;
|
|
41
|
+
}>>): CycloneDxSbom;
|
|
24
42
|
/** @param {{}} opts - various options, settings and configuration of application.
|
|
25
43
|
* @return String CycloneDx Sbom json object in a string format
|
|
26
44
|
*/
|
|
@@ -50,6 +68,7 @@ export default class CycloneDxSbom {
|
|
|
50
68
|
version: any;
|
|
51
69
|
scope: any;
|
|
52
70
|
licenses?: any;
|
|
71
|
+
hashes?: any;
|
|
53
72
|
};
|
|
54
73
|
/**
|
|
55
74
|
* This method gets an array of dependencies to be ignored, and remove all of them from CycloneDx Sbom
|
|
@@ -70,6 +89,13 @@ export default class CycloneDxSbom {
|
|
|
70
89
|
* @return {boolean}
|
|
71
90
|
*/
|
|
72
91
|
checkIfPackageInsideDependsOnList(component: any, name: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if any entry in the dependsOn list of sourceRef starts with the given purl prefix.
|
|
94
|
+
* @param {PackageURL} sourceRef - The source component
|
|
95
|
+
* @param {string} purlPrefix - The purl prefix to match (e.g. "pkg:npm/minimist@")
|
|
96
|
+
* @return {boolean}
|
|
97
|
+
*/
|
|
98
|
+
checkDependsOnByPurlPrefix(sourceRef: PackageURL, purlPrefix: string): boolean;
|
|
73
99
|
/** Removes the root component from the sbom
|
|
74
100
|
*/
|
|
75
101
|
removeRootComponent(): void;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { EOL } from "os";
|
|
2
2
|
import { PackageURL } from "packageurl-js";
|
|
3
|
+
import { getPackageVersion } from "./package_version.js";
|
|
4
|
+
/**
|
|
5
|
+
* This client's version, read once at module load, used to populate
|
|
6
|
+
* metadata.tools.components[].version in the generated SBOM.
|
|
7
|
+
* @type {string|undefined}
|
|
8
|
+
*/
|
|
9
|
+
const PACKAGE_VERSION = getPackageVersion();
|
|
3
10
|
/**
|
|
4
11
|
*
|
|
5
12
|
* @param component {PackageURL}
|
|
6
13
|
* @param type type of package - application or library
|
|
7
14
|
* @param scope scope of the component - runtime or compile
|
|
8
15
|
* @param licenses optional license string or array of licenses for the component
|
|
9
|
-
* @
|
|
16
|
+
* @param hashes optional array of hash objects for the component, e.g. [{alg: "SHA-256", content: "..."}]
|
|
17
|
+
* @return {{"bom-ref": string, name, purl: string, type, version, scope, licenses?, hashes?}}
|
|
10
18
|
* @private
|
|
11
19
|
*/
|
|
12
|
-
function getComponent(component, type, scope, licenses) {
|
|
20
|
+
function getComponent(component, type, scope, licenses, hashes) {
|
|
13
21
|
let componentObject;
|
|
14
22
|
if (component instanceof PackageURL) {
|
|
15
23
|
if (component.namespace) {
|
|
@@ -40,12 +48,24 @@ function getComponent(component, type, scope, licenses) {
|
|
|
40
48
|
// Add licenses if provided (CycloneDX format). Callers must provide valid SPDX identifiers.
|
|
41
49
|
if (licenses) {
|
|
42
50
|
const licenseArray = Array.isArray(licenses) ? licenses : [licenses];
|
|
43
|
-
|
|
51
|
+
const validLicenses = licenseArray
|
|
52
|
+
.map(lic => {
|
|
44
53
|
if (typeof lic === 'string') {
|
|
45
54
|
return { license: { id: lic } };
|
|
46
55
|
}
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
if (typeof lic === 'object' && lic !== null && ('license' in lic || 'expression' in lic)) {
|
|
57
|
+
return lic;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
})
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
if (validLicenses.length > 0) {
|
|
63
|
+
componentObject.licenses = validLicenses;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Add hashes if provided (CycloneDX 1.4 format).
|
|
67
|
+
if (hashes && hashes.length > 0) {
|
|
68
|
+
componentObject.hashes = hashes;
|
|
49
69
|
}
|
|
50
70
|
return componentObject;
|
|
51
71
|
}
|
|
@@ -86,16 +106,24 @@ export default class CycloneDxSbom {
|
|
|
86
106
|
* Adds a dependency relationship between two components in the SBOM
|
|
87
107
|
* @param {PackageURL} sourceRef - The source component (parent)
|
|
88
108
|
* @param {PackageURL} targetRef - The target component (dependency)
|
|
109
|
+
* @param {string} [scope] - Scope of the dependency
|
|
110
|
+
* @param {Array<{alg: string, content: string}>} [targetHashes] - Optional hashes for the target component
|
|
89
111
|
* @return {CycloneDxSbom} The updated SBOM
|
|
90
112
|
*/
|
|
91
|
-
addDependency(sourceRef, targetRef, scope) {
|
|
113
|
+
addDependency(sourceRef, targetRef, scope, targetHashes) {
|
|
92
114
|
const sourcePurl = sourceRef.toString();
|
|
93
115
|
const targetPurl = targetRef.toString();
|
|
94
116
|
// Ensure both components exist in the components list
|
|
95
117
|
[sourceRef, targetRef].forEach((ref, index) => {
|
|
96
118
|
const purl = index === 0 ? sourcePurl : targetPurl;
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
const existingIndex = this.getComponentIndex(purl);
|
|
120
|
+
if (existingIndex < 0) {
|
|
121
|
+
const hashes = index === 1 ? targetHashes : undefined;
|
|
122
|
+
this.components.push(getComponent(ref, "library", scope, undefined, hashes));
|
|
123
|
+
}
|
|
124
|
+
else if (index === 1 && targetHashes && targetHashes.length > 0 && !this.components[existingIndex].hashes) {
|
|
125
|
+
// Update hashes if the component was first seen without them (e.g. as a source)
|
|
126
|
+
this.components[existingIndex].hashes = targetHashes;
|
|
99
127
|
}
|
|
100
128
|
});
|
|
101
129
|
// Ensure source dependency exists
|
|
@@ -114,22 +142,54 @@ export default class CycloneDxSbom {
|
|
|
114
142
|
}
|
|
115
143
|
return this;
|
|
116
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Attach hashes to already-added components by matching their PURL. This is a
|
|
147
|
+
* post-processing step so ecosystem-specific hash sources (e.g. Maven reading
|
|
148
|
+
* the local .m2 cache) can enrich the SBOM without threading their concern
|
|
149
|
+
* through the shared dependency-tree parser. Components without a matching
|
|
150
|
+
* entry, or whose hashes are already set, are left untouched.
|
|
151
|
+
* @param {Map<string, Array<{alg: string, content: string}>>} hashMap - PURL→hashes map
|
|
152
|
+
* @return {CycloneDxSbom} the updated SBOM
|
|
153
|
+
*/
|
|
154
|
+
attachHashes(hashMap) {
|
|
155
|
+
if (!hashMap || hashMap.size === 0) {
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
for (const component of this.components) {
|
|
159
|
+
if (component.hashes) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const hashes = hashMap.get(component.purl);
|
|
163
|
+
if (hashes && hashes.length > 0) {
|
|
164
|
+
component.hashes = hashes;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
117
169
|
/** @param {{}} opts - various options, settings and configuration of application.
|
|
118
170
|
* @return String CycloneDx Sbom json object in a string format
|
|
119
171
|
*/
|
|
120
172
|
getAsJsonString(opts) {
|
|
121
173
|
let manifestType = opts["manifest-type"];
|
|
122
174
|
this.setSourceManifest(opts["source-manifest"]);
|
|
175
|
+
const rootPurl = this.rootComponent?.purl;
|
|
123
176
|
this.sbomObject = {
|
|
124
177
|
"bomFormat": "CycloneDX",
|
|
125
|
-
"specVersion": "1.
|
|
178
|
+
"specVersion": "1.6",
|
|
126
179
|
"version": 1,
|
|
127
180
|
"metadata": {
|
|
128
181
|
"timestamp": new Date(),
|
|
129
182
|
"component": this.rootComponent,
|
|
183
|
+
"tools": {
|
|
184
|
+
"components": [{
|
|
185
|
+
"type": "application",
|
|
186
|
+
"name": "trustify-da-javascript-client",
|
|
187
|
+
"version": PACKAGE_VERSION
|
|
188
|
+
}]
|
|
189
|
+
},
|
|
130
190
|
"properties": new Array()
|
|
131
191
|
},
|
|
132
|
-
"components": this.components,
|
|
192
|
+
"components": this.components.filter(c => c.purl !== rootPurl),
|
|
133
193
|
"dependencies": this.dependencies
|
|
134
194
|
};
|
|
135
195
|
if (this.rootComponent === undefined) {
|
|
@@ -241,6 +301,20 @@ export default class CycloneDxSbom {
|
|
|
241
301
|
return false;
|
|
242
302
|
}
|
|
243
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Checks if any entry in the dependsOn list of sourceRef starts with the given purl prefix.
|
|
306
|
+
* @param {PackageURL} sourceRef - The source component
|
|
307
|
+
* @param {string} purlPrefix - The purl prefix to match (e.g. "pkg:npm/minimist@")
|
|
308
|
+
* @return {boolean}
|
|
309
|
+
*/
|
|
310
|
+
checkDependsOnByPurlPrefix(sourceRef, purlPrefix) {
|
|
311
|
+
const sourcePurl = sourceRef.toString();
|
|
312
|
+
const depIndex = this.getDependencyIndex(sourcePurl);
|
|
313
|
+
if (depIndex < 0) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
return this.dependencies[depIndex].dependsOn.some(dep => dep.startsWith(purlPrefix));
|
|
317
|
+
}
|
|
244
318
|
/** Removes the root component from the sbom
|
|
245
319
|
*/
|
|
246
320
|
removeRootComponent() {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,16 +13,29 @@ export function selectTrustifyDABackend(opts?: {
|
|
|
13
13
|
TRUSTIFY_DA_DEBUG?: string | undefined;
|
|
14
14
|
TRUSTIFY_DA_BACKEND_URL?: string | undefined;
|
|
15
15
|
}): string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a CycloneDX SBOM from a manifest file. No backend HTTP request is made.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} manifestPath - path to the manifest file (e.g. pom.xml, package.json)
|
|
20
|
+
* @param {Options} [opts={}] - optional options (e.g. workspace dir, tool paths)
|
|
21
|
+
* @returns {Promise<object>} parsed CycloneDX SBOM JSON object
|
|
22
|
+
* @throws {Error} if the manifest is unsupported or SBOM generation fails
|
|
23
|
+
*/
|
|
24
|
+
export function generateSbom(manifestPath: string, opts?: Options): Promise<object>;
|
|
16
25
|
export { parseImageRef } from "./oci_image/utils.js";
|
|
17
26
|
export { ImageRef } from "./oci_image/images.js";
|
|
27
|
+
export { extractRemediations } from "./remediation.js";
|
|
18
28
|
declare namespace _default {
|
|
19
29
|
export { componentAnalysis };
|
|
20
30
|
export { stackAnalysis };
|
|
31
|
+
export { stackAnalysisBatch };
|
|
21
32
|
export { imageAnalysis };
|
|
22
33
|
export { validateToken };
|
|
34
|
+
export { generateSbom };
|
|
23
35
|
}
|
|
24
36
|
export default _default;
|
|
25
37
|
export type Options = {
|
|
38
|
+
TRUSTIFY_DA_CARGO_PATH?: string | undefined;
|
|
26
39
|
TRUSTIFY_DA_DOCKER_PATH?: string | undefined;
|
|
27
40
|
TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED?: string | undefined;
|
|
28
41
|
TRUSTIFY_DA_GO_PATH?: string | undefined;
|
|
@@ -41,18 +54,53 @@ export type Options = {
|
|
|
41
54
|
TRUSTIFY_DA_PYTHON_PATH?: string | undefined;
|
|
42
55
|
TRUSTIFY_DA_PYTHON_VIRTUAL_ENV?: string | undefined;
|
|
43
56
|
TRUSTIFY_DA_PYTHON3_PATH?: string | undefined;
|
|
44
|
-
|
|
57
|
+
TRUSTIFY_DA_PROVIDERS?: string | undefined;
|
|
58
|
+
TRUSTIFY_DA_RECOMMEND?: string | undefined;
|
|
59
|
+
TRUSTIFY_DA_SOURCES?: string | undefined;
|
|
45
60
|
TRUSTIFY_DA_SKOPEO_CONFIG_PATH?: string | undefined;
|
|
46
61
|
TRUSTIFY_DA_SKOPEO_PATH?: string | undefined;
|
|
47
62
|
TRUSTIFY_DA_SYFT_CONFIG_PATH?: string | undefined;
|
|
48
63
|
TRUSTIFY_DA_SYFT_PATH?: string | undefined;
|
|
49
64
|
TRUSTIFY_DA_YARN_PATH?: string | undefined;
|
|
65
|
+
TRUSTIFY_DA_WORKSPACE_DIR?: string | undefined;
|
|
50
66
|
TRUSTIFY_DA_LICENSE_CHECK?: string | undefined;
|
|
51
67
|
MATCH_MANIFEST_VERSIONS?: string | undefined;
|
|
52
68
|
TRUSTIFY_DA_SOURCE?: string | undefined;
|
|
53
69
|
TRUSTIFY_DA_TOKEN?: string | undefined;
|
|
54
70
|
TRUSTIFY_DA_TELEMETRY_ID?: string | undefined;
|
|
55
|
-
|
|
71
|
+
TRUSTIFY_DA_WORKSPACE_DIR?: string | undefined;
|
|
72
|
+
batchConcurrency?: number | undefined;
|
|
73
|
+
TRUSTIFY_DA_BATCH_CONCURRENCY?: string | undefined;
|
|
74
|
+
workspaceDiscoveryIgnore?: string[] | undefined;
|
|
75
|
+
TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE?: string | undefined;
|
|
76
|
+
continueOnError?: boolean | undefined;
|
|
77
|
+
TRUSTIFY_DA_CONTINUE_ON_ERROR?: string | undefined;
|
|
78
|
+
batchMetadata?: boolean | undefined;
|
|
79
|
+
TRUSTIFY_DA_BATCH_METADATA?: string | undefined;
|
|
80
|
+
TRUSTIFY_DA_UV_PATH?: string | undefined;
|
|
81
|
+
TRUSTIFY_DA_POETRY_PATH?: string | undefined;
|
|
82
|
+
[key: string]: string | number | boolean | string[] | undefined;
|
|
83
|
+
};
|
|
84
|
+
export type BatchAnalysisMetadata = {
|
|
85
|
+
workspaceRoot: string;
|
|
86
|
+
ecosystem: "javascript" | "cargo" | "pyproject" | "unknown";
|
|
87
|
+
total: number;
|
|
88
|
+
successful: number;
|
|
89
|
+
failed: number;
|
|
90
|
+
errors: Array<{
|
|
91
|
+
manifestPath: string;
|
|
92
|
+
phase: "validation" | "sbom";
|
|
93
|
+
reason: string;
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
96
|
+
export type SbomResult = {
|
|
97
|
+
ok: true;
|
|
98
|
+
purl: string;
|
|
99
|
+
sbom: object;
|
|
100
|
+
} | {
|
|
101
|
+
ok: false;
|
|
102
|
+
manifestPath: string;
|
|
103
|
+
reason: string;
|
|
56
104
|
};
|
|
57
105
|
/**
|
|
58
106
|
* Get component analysis report for a manifest content.
|
|
@@ -61,7 +109,7 @@ export type Options = {
|
|
|
61
109
|
* @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>}
|
|
62
110
|
* @throws {Error} if no matching provider, failed to get create content, or backend request failed
|
|
63
111
|
*/
|
|
64
|
-
declare function componentAnalysis(manifest: string, opts?: Options): Promise<
|
|
112
|
+
declare function componentAnalysis(manifest: string, opts?: Options): Promise<any>;
|
|
65
113
|
/**
|
|
66
114
|
* @overload
|
|
67
115
|
* @param {string} manifest
|
|
@@ -79,7 +127,7 @@ declare function stackAnalysis(manifest: string, html: true, opts?: Options | un
|
|
|
79
127
|
* @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>}
|
|
80
128
|
* @throws {Error}
|
|
81
129
|
*/
|
|
82
|
-
declare function stackAnalysis(manifest: string, html: false, opts?: Options | undefined): Promise<
|
|
130
|
+
declare function stackAnalysis(manifest: string, html: false, opts?: Options | undefined): Promise<any>;
|
|
83
131
|
/**
|
|
84
132
|
* Get stack analysis report for a manifest file.
|
|
85
133
|
* @overload
|
|
@@ -90,7 +138,82 @@ declare function stackAnalysis(manifest: string, html: false, opts?: Options | u
|
|
|
90
138
|
* @throws {Error} if manifest inaccessible, no matching provider, failed to get create content,
|
|
91
139
|
* or backend request failed
|
|
92
140
|
*/
|
|
93
|
-
declare function stackAnalysis(manifest: string, html?: boolean | undefined, opts?: Options | undefined): Promise<string |
|
|
141
|
+
declare function stackAnalysis(manifest: string, html?: boolean | undefined, opts?: Options | undefined): Promise<string | any>;
|
|
142
|
+
/**
|
|
143
|
+
* @overload
|
|
144
|
+
* @param {string} workspaceRoot
|
|
145
|
+
* @param {true} html
|
|
146
|
+
* @param {Options & { batchMetadata: true }} opts
|
|
147
|
+
* @returns {Promise<{ analysis: string, metadata: BatchAnalysisMetadata }>}
|
|
148
|
+
* @throws {Error}
|
|
149
|
+
*/
|
|
150
|
+
declare function stackAnalysisBatch(workspaceRoot: string, html: true, opts: Options & {
|
|
151
|
+
batchMetadata: true;
|
|
152
|
+
}): Promise<{
|
|
153
|
+
analysis: string;
|
|
154
|
+
metadata: BatchAnalysisMetadata;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* @overload
|
|
158
|
+
* @param {string} workspaceRoot
|
|
159
|
+
* @param {true} html
|
|
160
|
+
* @param {Options & { batchMetadata?: false }} [opts={}]
|
|
161
|
+
* @returns {Promise<string>}
|
|
162
|
+
* @throws {Error}
|
|
163
|
+
*/
|
|
164
|
+
declare function stackAnalysisBatch(workspaceRoot: string, html: true, opts?: (Options & {
|
|
165
|
+
batchMetadata?: false;
|
|
166
|
+
}) | undefined): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* @overload
|
|
169
|
+
* @param {string} workspaceRoot
|
|
170
|
+
* @param {false} html
|
|
171
|
+
* @param {Options & { batchMetadata: true }} opts
|
|
172
|
+
* @returns {Promise<{ analysis: Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>, metadata: BatchAnalysisMetadata }>}
|
|
173
|
+
* @throws {Error}
|
|
174
|
+
*/
|
|
175
|
+
declare function stackAnalysisBatch(workspaceRoot: string, html: false, opts: Options & {
|
|
176
|
+
batchMetadata: true;
|
|
177
|
+
}): Promise<{
|
|
178
|
+
analysis: {
|
|
179
|
+
[x: string]: any;
|
|
180
|
+
};
|
|
181
|
+
metadata: BatchAnalysisMetadata;
|
|
182
|
+
}>;
|
|
183
|
+
/**
|
|
184
|
+
* @overload
|
|
185
|
+
* @param {string} workspaceRoot
|
|
186
|
+
* @param {false} html
|
|
187
|
+
* @param {Options & { batchMetadata?: false }} [opts={}]
|
|
188
|
+
* @returns {Promise<Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>>}
|
|
189
|
+
* @throws {Error}
|
|
190
|
+
*/
|
|
191
|
+
declare function stackAnalysisBatch(workspaceRoot: string, html: false, opts?: (Options & {
|
|
192
|
+
batchMetadata?: false;
|
|
193
|
+
}) | undefined): Promise<{
|
|
194
|
+
[x: string]: any;
|
|
195
|
+
}>;
|
|
196
|
+
/**
|
|
197
|
+
* Get stack analysis for all workspace packages/crates (batch).
|
|
198
|
+
* Detects ecosystem from workspace root: Cargo (Cargo.toml + Cargo.lock) or JS/TS (package.json + lock file).
|
|
199
|
+
* SBOMs are generated in parallel (see `batchConcurrency`) unless `continueOnError: false` (fail-fast sequential).
|
|
200
|
+
* With `opts.batchMetadata` / `TRUSTIFY_DA_BATCH_METADATA`, returns `{ analysis, metadata }` including validation and SBOM errors.
|
|
201
|
+
*
|
|
202
|
+
* @overload
|
|
203
|
+
* @param {string} workspaceRoot - Path to workspace root (containing lock file and workspace config)
|
|
204
|
+
* @param {boolean} [html=false] - true returns HTML, false returns JSON report
|
|
205
|
+
* @param {Options} [opts={}] - `batchConcurrency`, discovery ignores, `continueOnError` (default true), `batchMetadata` (default false)
|
|
206
|
+
* @returns {Promise<string|Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>|{ analysis: string|Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>, metadata: BatchAnalysisMetadata }>}
|
|
207
|
+
* @throws {Error} if workspace root invalid, no manifests found, no packages pass validation, no SBOMs produced, or backend request failed. When `opts.batchMetadata` is set, `error.batchMetadata` may be set on thrown errors.
|
|
208
|
+
*/
|
|
209
|
+
declare function stackAnalysisBatch(workspaceRoot: string, html?: boolean | undefined, opts?: Options | undefined): Promise<string | {
|
|
210
|
+
[x: string]: any;
|
|
211
|
+
} | {
|
|
212
|
+
analysis: string | {
|
|
213
|
+
[x: string]: any;
|
|
214
|
+
};
|
|
215
|
+
metadata: BatchAnalysisMetadata;
|
|
216
|
+
}>;
|
|
94
217
|
/**
|
|
95
218
|
* @overload
|
|
96
219
|
* @param {Array<string>} imageRefs
|
|
@@ -109,7 +232,7 @@ declare function imageAnalysis(imageRefs: Array<string>, html: true, opts?: Opti
|
|
|
109
232
|
* @throws {Error}
|
|
110
233
|
*/
|
|
111
234
|
declare function imageAnalysis(imageRefs: Array<string>, html: false, opts?: Options | undefined): Promise<{
|
|
112
|
-
[x: string]:
|
|
235
|
+
[x: string]: any;
|
|
113
236
|
}>;
|
|
114
237
|
/**
|
|
115
238
|
* Get image analysis report for a set of OCI image references.
|
|
@@ -122,7 +245,7 @@ declare function imageAnalysis(imageRefs: Array<string>, html: false, opts?: Opt
|
|
|
122
245
|
* or backend request failed
|
|
123
246
|
*/
|
|
124
247
|
declare function imageAnalysis(imageRefs: Array<string>, html?: boolean | undefined, opts?: Options | undefined): Promise<string | {
|
|
125
|
-
[x: string]:
|
|
248
|
+
[x: string]: any;
|
|
126
249
|
}>;
|
|
127
250
|
/**
|
|
128
251
|
* Validates the Exhort token.
|
|
@@ -131,4 +254,18 @@ declare function imageAnalysis(imageRefs: Array<string>, html?: boolean | undefi
|
|
|
131
254
|
* @throws {Error} if the backend request failed.
|
|
132
255
|
*/
|
|
133
256
|
declare function validateToken(opts?: Options): Promise<object>;
|
|
134
|
-
|
|
257
|
+
import { discoverMavenModules } from './providers/java_maven.js';
|
|
258
|
+
import { discoverGradleSubprojects } from './providers/java_gradle.js';
|
|
259
|
+
import { discoverGoWorkspaceModules } from './providers/golang_gomodules.js';
|
|
260
|
+
import { discoverUvWorkspaceMembers } from './providers/python_uv.js';
|
|
261
|
+
import { discoverWorkspacePackages } from './workspace.js';
|
|
262
|
+
import { discoverWorkspaceCrates } from './workspace.js';
|
|
263
|
+
import { validatePackageJson } from './workspace.js';
|
|
264
|
+
import { resolveWorkspaceDiscoveryIgnore } from './workspace.js';
|
|
265
|
+
import { filterManifestPathsByDiscoveryIgnore } from './workspace.js';
|
|
266
|
+
import { resolveContinueOnError } from './batch_opts.js';
|
|
267
|
+
import { resolveBatchMetadata } from './batch_opts.js';
|
|
268
|
+
export { discoverMavenModules, discoverGradleSubprojects, discoverGoWorkspaceModules, discoverUvWorkspaceMembers, discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson, resolveWorkspaceDiscoveryIgnore, filterManifestPathsByDiscoveryIgnore, resolveContinueOnError, resolveBatchMetadata };
|
|
269
|
+
export { getProjectLicense, findLicenseFilePath, identifyLicense, getLicenseDetails, licensesFromReport, normalizeLicensesResponse, runLicenseCheck, getCompatibility } from "./license/index.js";
|
|
270
|
+
export { generateReport, generateDeduplicationKey } from "./remediation_report.js";
|
|
271
|
+
export { runRemediation, findManifests } from "./remediate.js";
|