@trustify-da/trustify-da-javascript-client 0.3.0-ea.61444d4 → 0.3.0-ea.62b88e5
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 +22 -8
- package/dist/package.json +6 -5
- package/dist/src/analysis.d.ts +40 -19
- package/dist/src/analysis.js +41 -5
- package/dist/src/cli.js +95 -17
- package/dist/src/config.d.ts +120 -0
- package/dist/src/config.js +260 -0
- package/dist/src/cyclone_dx_sbom.d.ts +13 -0
- package/dist/src/cyclone_dx_sbom.js +39 -1
- package/dist/src/index.d.ts +23 -23
- package/dist/src/index.js +23 -39
- package/dist/src/license/index.d.ts +2 -2
- package/dist/src/license/index.js +9 -6
- package/dist/src/license/licenses_api.d.ts +2 -2
- package/dist/src/license/licenses_api.js +1 -1
- package/dist/src/package_version.d.ts +8 -0
- package/dist/src/package_version.js +31 -0
- package/dist/src/providers/base_java.d.ts +53 -0
- package/dist/src/providers/base_java.js +64 -17
- package/dist/src/providers/base_javascript.d.ts +54 -0
- package/dist/src/providers/base_javascript.js +106 -4
- package/dist/src/providers/golang_gomodules.js +6 -5
- package/dist/src/providers/java_gradle.d.ts +48 -0
- package/dist/src/providers/java_gradle.js +204 -20
- package/dist/src/providers/java_maven.d.ts +28 -8
- package/dist/src/providers/java_maven.js +104 -10
- package/dist/src/providers/javascript_bun.d.ts +12 -0
- package/dist/src/providers/javascript_bun.js +42 -1
- package/dist/src/providers/javascript_npm.d.ts +13 -0
- package/dist/src/providers/javascript_npm.js +40 -1
- package/dist/src/providers/javascript_pnpm.d.ts +13 -0
- package/dist/src/providers/javascript_pnpm.js +47 -1
- package/dist/src/providers/javascript_yarn.d.ts +12 -0
- package/dist/src/providers/javascript_yarn.js +75 -2
- package/dist/src/providers/manifest.js +6 -3
- package/dist/src/providers/processors/yarn_berry_processor.d.ts +5 -1
- package/dist/src/providers/processors/yarn_berry_processor.js +3 -2
- package/dist/src/providers/processors/yarn_classic_processor.d.ts +5 -1
- package/dist/src/providers/processors/yarn_classic_processor.js +8 -6
- package/dist/src/providers/python_uv.js +6 -0
- package/dist/src/providers/requirements_parser.js +1 -1
- package/dist/src/providers/rust_cargo.js +34 -52
- package/dist/src/remediate.d.ts +90 -4
- package/dist/src/remediate.js +153 -58
- package/dist/src/remediation.d.ts +54 -30
- package/dist/src/remediation.js +92 -53
- package/dist/src/remediation_report.d.ts +3 -20
- package/dist/src/remediation_report.js +37 -16
- package/dist/src/sbom.d.ts +11 -0
- package/dist/src/sbom.js +10 -0
- package/dist/src/tools.d.ts +9 -11
- package/dist/src/tools.js +34 -13
- package/dist/src/updaters/maven_updater.d.ts +40 -8
- package/dist/src/updaters/maven_updater.js +26 -3
- package/dist/src/updaters/toml_updater.d.ts +42 -13
- package/dist/src/updaters/toml_updater.js +36 -4
- package/dist/src/workspace.d.ts +2 -1
- package/dist/src/workspace.js +2 -1
- package/package.json +7 -6
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One entry in {@link updateMavenVersions}' `applied` list: a version that was changed and
|
|
3
|
+
* where. `type` discriminates the edit site — `'direct'` for a dependency's own `<version>`,
|
|
4
|
+
* `'property'` for a `${property}` reference (then `property` names the resolved property).
|
|
5
|
+
* @typedef {{
|
|
6
|
+
* groupId: string,
|
|
7
|
+
* artifactId: string,
|
|
8
|
+
* newVersion: string,
|
|
9
|
+
* type: ('direct'|'property'),
|
|
10
|
+
* property?: string
|
|
11
|
+
* }} MavenAppliedChange
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Stable edit-site key for a Maven change: same key => same commit/PR. Deps whose versions
|
|
15
|
+
* resolve to one `${property}` share the property key and are therefore inseparable.
|
|
16
|
+
* @param {string} manifestPath
|
|
17
|
+
* @param {MavenAppliedChange} applied
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
export function mavenChangeKey(manifestPath: string, applied: MavenAppliedChange): string;
|
|
1
21
|
/**
|
|
2
22
|
* Updates dependency versions in a Maven pom.xml while preserving file formatting.
|
|
3
23
|
*
|
|
@@ -10,17 +30,29 @@
|
|
|
10
30
|
* and updates the terminal property value in `<properties>` instead.
|
|
11
31
|
*
|
|
12
32
|
* @param {string} pomContent - the raw pom.xml file content
|
|
13
|
-
* @param {
|
|
14
|
-
*
|
|
15
|
-
* @returns {{content: string, applied: Array, skipped: Array}} the updated content and
|
|
33
|
+
* @param {import('../remediate.js').VersionChangeRequest[]} versionChanges - list of version changes to apply
|
|
34
|
+
* @returns {{content: string, applied: MavenAppliedChange[], skipped: Array<{groupId: string, artifactId: string, newVersion: string, reason: string}>}} the updated content and
|
|
16
35
|
* lists of applied and skipped changes
|
|
17
36
|
*/
|
|
18
|
-
export function updateMavenVersions(pomContent: string, versionChanges:
|
|
37
|
+
export function updateMavenVersions(pomContent: string, versionChanges: import("../remediate.js").VersionChangeRequest[]): {
|
|
38
|
+
content: string;
|
|
39
|
+
applied: MavenAppliedChange[];
|
|
40
|
+
skipped: Array<{
|
|
41
|
+
groupId: string;
|
|
42
|
+
artifactId: string;
|
|
43
|
+
newVersion: string;
|
|
44
|
+
reason: string;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* One entry in {@link updateMavenVersions}' `applied` list: a version that was changed and
|
|
49
|
+
* where. `type` discriminates the edit site — `'direct'` for a dependency's own `<version>`,
|
|
50
|
+
* `'property'` for a `${property}` reference (then `property` names the resolved property).
|
|
51
|
+
*/
|
|
52
|
+
export type MavenAppliedChange = {
|
|
19
53
|
groupId: string;
|
|
20
54
|
artifactId: string;
|
|
21
55
|
newVersion: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
applied: any[];
|
|
25
|
-
skipped: any[];
|
|
56
|
+
type: ("direct" | "property");
|
|
57
|
+
property?: string;
|
|
26
58
|
};
|
|
@@ -160,6 +160,30 @@ function resolvePropertyChain(propName, properties, visited = new Set()) {
|
|
|
160
160
|
}
|
|
161
161
|
return { terminalPropName: propName, resolvedValue: valueStr };
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* One entry in {@link updateMavenVersions}' `applied` list: a version that was changed and
|
|
165
|
+
* where. `type` discriminates the edit site — `'direct'` for a dependency's own `<version>`,
|
|
166
|
+
* `'property'` for a `${property}` reference (then `property` names the resolved property).
|
|
167
|
+
* @typedef {{
|
|
168
|
+
* groupId: string,
|
|
169
|
+
* artifactId: string,
|
|
170
|
+
* newVersion: string,
|
|
171
|
+
* type: ('direct'|'property'),
|
|
172
|
+
* property?: string
|
|
173
|
+
* }} MavenAppliedChange
|
|
174
|
+
*/
|
|
175
|
+
/**
|
|
176
|
+
* Stable edit-site key for a Maven change: same key => same commit/PR. Deps whose versions
|
|
177
|
+
* resolve to one `${property}` share the property key and are therefore inseparable.
|
|
178
|
+
* @param {string} manifestPath
|
|
179
|
+
* @param {MavenAppliedChange} applied
|
|
180
|
+
* @returns {string}
|
|
181
|
+
*/
|
|
182
|
+
export function mavenChangeKey(manifestPath, applied) {
|
|
183
|
+
return applied.type === 'property'
|
|
184
|
+
? `mvn:prop:${manifestPath}:${applied.property}`
|
|
185
|
+
: `mvn:direct:${manifestPath}:${applied.groupId}:${applied.artifactId}`;
|
|
186
|
+
}
|
|
163
187
|
/**
|
|
164
188
|
* Updates dependency versions in a Maven pom.xml while preserving file formatting.
|
|
165
189
|
*
|
|
@@ -172,9 +196,8 @@ function resolvePropertyChain(propName, properties, visited = new Set()) {
|
|
|
172
196
|
* and updates the terminal property value in `<properties>` instead.
|
|
173
197
|
*
|
|
174
198
|
* @param {string} pomContent - the raw pom.xml file content
|
|
175
|
-
* @param {
|
|
176
|
-
*
|
|
177
|
-
* @returns {{content: string, applied: Array, skipped: Array}} the updated content and
|
|
199
|
+
* @param {import('../remediate.js').VersionChangeRequest[]} versionChanges - list of version changes to apply
|
|
200
|
+
* @returns {{content: string, applied: MavenAppliedChange[], skipped: Array<{groupId: string, artifactId: string, newVersion: string, reason: string}>}} the updated content and
|
|
178
201
|
* lists of applied and skipped changes
|
|
179
202
|
*/
|
|
180
203
|
export function updateMavenVersions(pomContent, versionChanges) {
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One entry in {@link updateTomlVersions}' `applied` list: a version that was changed and where.
|
|
3
|
+
* `type` discriminates the edit site — `'ref'` for a `[libraries]` entry pointing at a shared
|
|
4
|
+
* `[versions]` alias via `version.ref` (then `versionRef` names that alias), `'inline'` for a
|
|
5
|
+
* version declared directly on the library. `alias` is the library's catalog key in both cases.
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* groupId: string,
|
|
8
|
+
* artifactId: string,
|
|
9
|
+
* newVersion: string,
|
|
10
|
+
* oldVersion: string,
|
|
11
|
+
* type: ('ref'|'inline'),
|
|
12
|
+
* alias: string,
|
|
13
|
+
* versionRef?: string
|
|
14
|
+
* }} TomlAppliedChange
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Stable edit-site key for a TOML (Gradle version catalog) change: same key => same commit/PR.
|
|
18
|
+
* Deps sharing one `[versions]` alias via `version.ref` share the ref key and are inseparable.
|
|
19
|
+
* @param {string} manifestPath
|
|
20
|
+
* @param {TomlAppliedChange} applied
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
export function tomlChangeKey(manifestPath: string, applied: TomlAppliedChange): string;
|
|
1
24
|
/**
|
|
2
25
|
* Updates dependency versions in a Gradle version catalog (libs.versions.toml) file.
|
|
3
26
|
*
|
|
@@ -9,21 +32,12 @@
|
|
|
9
32
|
* on the raw content to preserve formatting and comments.
|
|
10
33
|
*
|
|
11
34
|
* @param {string} tomlContent - raw TOML file content
|
|
12
|
-
* @param {
|
|
13
|
-
* @returns {{content: string, applied:
|
|
35
|
+
* @param {import('../remediate.js').VersionChangeRequest[]} versionChanges
|
|
36
|
+
* @returns {{content: string, applied: TomlAppliedChange[], skipped: Array<{groupId: string, artifactId: string, newVersion: string, reason: string}>}}
|
|
14
37
|
*/
|
|
15
|
-
export function updateTomlVersions(tomlContent: string, versionChanges:
|
|
16
|
-
groupId: string;
|
|
17
|
-
artifactId: string;
|
|
18
|
-
newVersion: string;
|
|
19
|
-
}>): {
|
|
38
|
+
export function updateTomlVersions(tomlContent: string, versionChanges: import("../remediate.js").VersionChangeRequest[]): {
|
|
20
39
|
content: string;
|
|
21
|
-
applied:
|
|
22
|
-
groupId: string;
|
|
23
|
-
artifactId: string;
|
|
24
|
-
newVersion: string;
|
|
25
|
-
oldVersion: string;
|
|
26
|
-
}>;
|
|
40
|
+
applied: TomlAppliedChange[];
|
|
27
41
|
skipped: Array<{
|
|
28
42
|
groupId: string;
|
|
29
43
|
artifactId: string;
|
|
@@ -31,3 +45,18 @@ export function updateTomlVersions(tomlContent: string, versionChanges: Array<{
|
|
|
31
45
|
reason: string;
|
|
32
46
|
}>;
|
|
33
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* One entry in {@link updateTomlVersions}' `applied` list: a version that was changed and where.
|
|
50
|
+
* `type` discriminates the edit site — `'ref'` for a `[libraries]` entry pointing at a shared
|
|
51
|
+
* `[versions]` alias via `version.ref` (then `versionRef` names that alias), `'inline'` for a
|
|
52
|
+
* version declared directly on the library. `alias` is the library's catalog key in both cases.
|
|
53
|
+
*/
|
|
54
|
+
export type TomlAppliedChange = {
|
|
55
|
+
groupId: string;
|
|
56
|
+
artifactId: string;
|
|
57
|
+
newVersion: string;
|
|
58
|
+
oldVersion: string;
|
|
59
|
+
type: ("ref" | "inline");
|
|
60
|
+
alias: string;
|
|
61
|
+
versionRef?: string;
|
|
62
|
+
};
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { parse as parseToml } from 'smol-toml';
|
|
2
|
+
/**
|
|
3
|
+
* One entry in {@link updateTomlVersions}' `applied` list: a version that was changed and where.
|
|
4
|
+
* `type` discriminates the edit site — `'ref'` for a `[libraries]` entry pointing at a shared
|
|
5
|
+
* `[versions]` alias via `version.ref` (then `versionRef` names that alias), `'inline'` for a
|
|
6
|
+
* version declared directly on the library. `alias` is the library's catalog key in both cases.
|
|
7
|
+
* @typedef {{
|
|
8
|
+
* groupId: string,
|
|
9
|
+
* artifactId: string,
|
|
10
|
+
* newVersion: string,
|
|
11
|
+
* oldVersion: string,
|
|
12
|
+
* type: ('ref'|'inline'),
|
|
13
|
+
* alias: string,
|
|
14
|
+
* versionRef?: string
|
|
15
|
+
* }} TomlAppliedChange
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Stable edit-site key for a TOML (Gradle version catalog) change: same key => same commit/PR.
|
|
19
|
+
* Deps sharing one `[versions]` alias via `version.ref` share the ref key and are inseparable.
|
|
20
|
+
* @param {string} manifestPath
|
|
21
|
+
* @param {TomlAppliedChange} applied
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
export function tomlChangeKey(manifestPath, applied) {
|
|
25
|
+
return applied.type === 'ref'
|
|
26
|
+
? `toml:ref:${manifestPath}:${applied.versionRef}`
|
|
27
|
+
: `toml:inline:${manifestPath}:${applied.alias}`;
|
|
28
|
+
}
|
|
2
29
|
/**
|
|
3
30
|
* Updates dependency versions in a Gradle version catalog (libs.versions.toml) file.
|
|
4
31
|
*
|
|
@@ -10,8 +37,8 @@ import { parse as parseToml } from 'smol-toml';
|
|
|
10
37
|
* on the raw content to preserve formatting and comments.
|
|
11
38
|
*
|
|
12
39
|
* @param {string} tomlContent - raw TOML file content
|
|
13
|
-
* @param {
|
|
14
|
-
* @returns {{content: string, applied:
|
|
40
|
+
* @param {import('../remediate.js').VersionChangeRequest[]} versionChanges
|
|
41
|
+
* @returns {{content: string, applied: TomlAppliedChange[], skipped: Array<{groupId: string, artifactId: string, newVersion: string, reason: string}>}}
|
|
15
42
|
*/
|
|
16
43
|
export function updateTomlVersions(tomlContent, versionChanges) {
|
|
17
44
|
const applied = [];
|
|
@@ -77,7 +104,10 @@ export function updateTomlVersions(tomlContent, versionChanges) {
|
|
|
77
104
|
groupId: change.groupId,
|
|
78
105
|
artifactId: change.artifactId,
|
|
79
106
|
newVersion: change.newVersion,
|
|
80
|
-
oldVersion
|
|
107
|
+
oldVersion,
|
|
108
|
+
type: 'ref',
|
|
109
|
+
versionRef,
|
|
110
|
+
alias
|
|
81
111
|
});
|
|
82
112
|
}
|
|
83
113
|
else {
|
|
@@ -107,7 +137,9 @@ export function updateTomlVersions(tomlContent, versionChanges) {
|
|
|
107
137
|
groupId: change.groupId,
|
|
108
138
|
artifactId: change.artifactId,
|
|
109
139
|
newVersion: change.newVersion,
|
|
110
|
-
oldVersion: inlineVersion
|
|
140
|
+
oldVersion: inlineVersion,
|
|
141
|
+
type: 'inline',
|
|
142
|
+
alias
|
|
111
143
|
});
|
|
112
144
|
}
|
|
113
145
|
else {
|
package/dist/src/workspace.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolve ignore globs for workspace discovery
|
|
2
|
+
* Resolve ignore globs for workspace discovery. Unlike scalar options, ignore patterns are additive:
|
|
3
|
+
* defaults + `opts.TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE`/environment + `opts.workspaceDiscoveryIgnore`.
|
|
3
4
|
* Patterns are fast-glob / micromatch style, relative to the workspace root (forward slashes).
|
|
4
5
|
*
|
|
5
6
|
* @param {{ workspaceDiscoveryIgnore?: string[], TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE?: string, [key: string]: unknown }} [opts={}]
|
package/dist/src/workspace.js
CHANGED
|
@@ -10,7 +10,8 @@ const DEFAULT_WORKSPACE_DISCOVERY_IGNORE = [
|
|
|
10
10
|
'**/.git/**',
|
|
11
11
|
];
|
|
12
12
|
/**
|
|
13
|
-
* Resolve ignore globs for workspace discovery
|
|
13
|
+
* Resolve ignore globs for workspace discovery. Unlike scalar options, ignore patterns are additive:
|
|
14
|
+
* defaults + `opts.TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE`/environment + `opts.workspaceDiscoveryIgnore`.
|
|
14
15
|
* Patterns are fast-glob / micromatch style, relative to the workspace root (forward slashes).
|
|
15
16
|
*
|
|
16
17
|
* @param {{ workspaceDiscoveryIgnore?: string[], TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE?: string, [key: string]: unknown }} [opts={}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustify-da/trustify-da-javascript-client",
|
|
3
|
-
"version": "0.3.0-ea.
|
|
3
|
+
"version": "0.3.0-ea.62b88e5",
|
|
4
4
|
"description": "Code-Ready Dependency Analytics JavaScript API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/guacsec/trustify-da-javascript-client#README.md",
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
|
-
"bin":
|
|
28
|
+
"bin": {
|
|
29
|
+
"trustify-da": "dist/src/cli.js"
|
|
30
|
+
},
|
|
29
31
|
"main": "dist/src/index.js",
|
|
30
32
|
"module": "dist/src/index.js",
|
|
31
33
|
"types": "dist/src/index.d.ts",
|
|
@@ -47,8 +49,7 @@
|
|
|
47
49
|
"postcompile": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm dist/src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm dist/src/providers/tree-sitter-gomod.wasm && cp node_modules/tree-sitter-containerfile/tree-sitter-containerfile.wasm dist/src/providers/tree-sitter-containerfile.wasm"
|
|
48
50
|
},
|
|
49
51
|
"dependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@cyclonedx/cyclonedx-library": "^10.0.0",
|
|
52
|
+
"@yarnpkg/parsers": "^3.1.0",
|
|
52
53
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
53
54
|
"fast-glob": "^3.3.3",
|
|
54
55
|
"fast-xml-parser": "^5.3.4",
|
|
@@ -68,12 +69,12 @@
|
|
|
68
69
|
"yargs": "^18.0.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
|
-
"@
|
|
72
|
+
"@cyclonedx/cyclonedx-library": "^10.2.0",
|
|
72
73
|
"@eslint/js": "^10.0.0",
|
|
73
74
|
"@trustify-da/trustify-da-api-model": "^2.0.12",
|
|
74
75
|
"@types/node": "^25.9.1",
|
|
75
76
|
"@types/which": "^3.0.4",
|
|
76
|
-
"
|
|
77
|
+
"ajv": "^8.20.0",
|
|
77
78
|
"c8": "^11.0.0",
|
|
78
79
|
"chai": "^6.2.2",
|
|
79
80
|
"eslint": "^10.4.1",
|