@trustify-da/trustify-da-javascript-client 0.3.0-ea.c2f6c64 → 0.3.0-ea.c300d9f

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.
Files changed (86) hide show
  1. package/README.md +199 -11
  2. package/dist/package.json +30 -26
  3. package/dist/src/analysis.d.ts +14 -7
  4. package/dist/src/analysis.js +32 -14
  5. package/dist/src/cli.js +188 -6
  6. package/dist/src/config.d.ts +120 -0
  7. package/dist/src/config.js +260 -0
  8. package/dist/src/cyclone_dx_sbom.d.ts +20 -1
  9. package/dist/src/cyclone_dx_sbom.js +68 -9
  10. package/dist/src/index.d.ts +79 -15
  11. package/dist/src/index.js +90 -34
  12. package/dist/src/license/index.d.ts +3 -3
  13. package/dist/src/license/index.js +4 -1
  14. package/dist/src/license/license_utils.js +4 -1
  15. package/dist/src/license/licenses_api.d.ts +2 -2
  16. package/dist/src/oci_image/images.d.ts +1 -1
  17. package/dist/src/oci_image/images.js +15 -1
  18. package/dist/src/oci_image/utils.d.ts +5 -5
  19. package/dist/src/package_version.d.ts +8 -0
  20. package/dist/src/package_version.js +31 -0
  21. package/dist/src/provider.d.ts +4 -3
  22. package/dist/src/provider.js +8 -2
  23. package/dist/src/providers/base_java.d.ts +67 -12
  24. package/dist/src/providers/base_java.js +82 -61
  25. package/dist/src/providers/base_javascript.d.ts +74 -9
  26. package/dist/src/providers/base_javascript.js +116 -7
  27. package/dist/src/providers/base_pyproject.d.ts +42 -31
  28. package/dist/src/providers/base_pyproject.js +121 -78
  29. package/dist/src/providers/containerfile_parser.d.ts +5 -0
  30. package/dist/src/providers/containerfile_parser.js +20 -0
  31. package/dist/src/providers/golang_gomodules.d.ts +11 -1
  32. package/dist/src/providers/golang_gomodules.js +114 -15
  33. package/dist/src/providers/java_gradle.d.ts +67 -0
  34. package/dist/src/providers/java_gradle.js +312 -20
  35. package/dist/src/providers/java_gradle_groovy.d.ts +1 -1
  36. package/dist/src/providers/java_gradle_kotlin.d.ts +1 -1
  37. package/dist/src/providers/java_maven.d.ts +37 -9
  38. package/dist/src/providers/java_maven.js +269 -11
  39. package/dist/src/providers/javascript_bun.d.ts +22 -0
  40. package/dist/src/providers/javascript_bun.js +141 -0
  41. package/dist/src/providers/javascript_npm.d.ts +19 -0
  42. package/dist/src/providers/javascript_npm.js +61 -1
  43. package/dist/src/providers/javascript_pnpm.d.ts +13 -0
  44. package/dist/src/providers/javascript_pnpm.js +53 -3
  45. package/dist/src/providers/javascript_yarn.d.ts +12 -0
  46. package/dist/src/providers/javascript_yarn.js +75 -2
  47. package/dist/src/providers/manifest.js +6 -3
  48. package/dist/src/providers/marker_evaluator.d.ts +14 -0
  49. package/dist/src/providers/marker_evaluator.js +191 -0
  50. package/dist/src/providers/oci_dockerfile.d.ts +51 -0
  51. package/dist/src/providers/oci_dockerfile.js +177 -0
  52. package/dist/src/providers/processors/yarn_berry_processor.d.ts +6 -2
  53. package/dist/src/providers/processors/yarn_berry_processor.js +9 -4
  54. package/dist/src/providers/processors/yarn_classic_processor.d.ts +6 -2
  55. package/dist/src/providers/processors/yarn_classic_processor.js +8 -6
  56. package/dist/src/providers/python_controller.d.ts +5 -1
  57. package/dist/src/providers/python_controller.js +69 -8
  58. package/dist/src/providers/python_pip.d.ts +5 -0
  59. package/dist/src/providers/python_pip.js +5 -5
  60. package/dist/src/providers/python_pip_pyproject.d.ts +61 -0
  61. package/dist/src/providers/python_pip_pyproject.js +146 -0
  62. package/dist/src/providers/python_poetry.d.ts +64 -8
  63. package/dist/src/providers/python_poetry.js +165 -25
  64. package/dist/src/providers/python_uv.d.ts +22 -2
  65. package/dist/src/providers/python_uv.js +157 -6
  66. package/dist/src/providers/requirements_parser.js +1 -1
  67. package/dist/src/providers/rust_cargo.d.ts +6 -2
  68. package/dist/src/providers/rust_cargo.js +101 -33
  69. package/dist/src/providers/tree-sitter-containerfile.wasm +0 -0
  70. package/dist/src/remediate.d.ts +120 -0
  71. package/dist/src/remediate.js +253 -0
  72. package/dist/src/remediation.d.ts +57 -0
  73. package/dist/src/remediation.js +436 -0
  74. package/dist/src/remediation_report.d.ts +40 -0
  75. package/dist/src/remediation_report.js +159 -0
  76. package/dist/src/sbom.d.ts +18 -1
  77. package/dist/src/sbom.js +14 -2
  78. package/dist/src/tools.d.ts +37 -13
  79. package/dist/src/tools.js +92 -13
  80. package/dist/src/updaters/maven_updater.d.ts +58 -0
  81. package/dist/src/updaters/maven_updater.js +345 -0
  82. package/dist/src/updaters/toml_updater.d.ts +62 -0
  83. package/dist/src/updaters/toml_updater.js +276 -0
  84. package/dist/src/workspace.d.ts +11 -1
  85. package/dist/src/workspace.js +3 -2
  86. package/package.json +31 -27
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Resolve ignore globs for workspace discovery: defaults + `TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE` + `opts.workspaceDiscoveryIgnore`.
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={}]
@@ -42,6 +43,15 @@ export function discoverWorkspacePackages(workspaceRoot: string, opts?: {
42
43
  TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE?: string;
43
44
  [key: string]: unknown;
44
45
  }): Promise<string[]>;
46
+ /**
47
+ * Convert workspace glob patterns to manifest-file glob patterns,
48
+ * correctly handling negation prefixes.
49
+ *
50
+ * @param {string[]} patterns - Workspace glob patterns (may include negations)
51
+ * @param {string} manifestFileName - e.g. 'package.json' or 'Cargo.toml'
52
+ * @returns {string[]}
53
+ */
54
+ export function toManifestGlobPatterns(patterns: string[], manifestFileName: string): string[];
45
55
  /**
46
56
  * Discover all Cargo.toml manifest paths in a Cargo workspace.
47
57
  * Uses `cargo metadata` to get workspace members.
@@ -10,7 +10,8 @@ const DEFAULT_WORKSPACE_DISCOVERY_IGNORE = [
10
10
  '**/.git/**',
11
11
  ];
12
12
  /**
13
- * Resolve ignore globs for workspace discovery: defaults + `TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE` + `opts.workspaceDiscoveryIgnore`.
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={}]
@@ -172,7 +173,7 @@ function parsePnpmPackages(content) {
172
173
  * @param {string} manifestFileName - e.g. 'package.json' or 'Cargo.toml'
173
174
  * @returns {string[]}
174
175
  */
175
- function toManifestGlobPatterns(patterns, manifestFileName) {
176
+ export function toManifestGlobPatterns(patterns, manifestFileName) {
176
177
  return patterns.map(p => {
177
178
  if (p.startsWith('!')) {
178
179
  return `!${p.slice(1)}/${manifestFileName}`;
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.c2f6c64",
3
+ "version": "0.3.0-ea.c300d9f",
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": "dist/src/cli.js",
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",
@@ -35,56 +37,57 @@
35
37
  "config/**/*"
36
38
  ],
37
39
  "scripts": {
38
- "lint": "eslint src test --ext js",
39
- "lint:fix": "eslint src test --ext js --fix",
40
+ "lint": "eslint src test",
41
+ "lint:fix": "eslint src test --fix",
40
42
  "test": "c8 npm run tests",
41
43
  "tests": "mocha --config .mocharc.json",
42
44
  "tests:rep": "mocha --reporter-option maxDiffSize=0 --reporter json > unit-tests-result.json",
43
- "pretest": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm src/providers/tree-sitter-gomod.wasm",
45
+ "pretest": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm src/providers/tree-sitter-gomod.wasm && cp node_modules/tree-sitter-containerfile/tree-sitter-containerfile.wasm src/providers/tree-sitter-containerfile.wasm",
44
46
  "precompile": "rm -rf dist",
45
47
  "compile": "tsc -p tsconfig.json",
46
48
  "compile:dev": "tsc -p tsconfig.dev.json",
47
- "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"
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
- "@babel/core": "^7.23.2",
51
- "@cyclonedx/cyclonedx-library": "^6.13.0",
52
+ "@yarnpkg/parsers": "^3.1.0",
52
53
  "eslint-import-resolver-typescript": "^4.4.4",
53
54
  "fast-glob": "^3.3.3",
54
- "fast-toml": "^0.5.4",
55
55
  "fast-xml-parser": "^5.3.4",
56
56
  "help": "^3.0.2",
57
- "https-proxy-agent": "^7.0.6",
57
+ "https-proxy-agent": "^9.0.0",
58
58
  "js-yaml": "^4.1.1",
59
+ "jsonc-parser": "^3.3.1",
59
60
  "micromatch": "^4.0.8",
60
61
  "node-fetch": "^3.3.2",
61
- "p-limit": "^4.0.0",
62
+ "p-limit": "^7.3.0",
62
63
  "packageurl-js": "~1.0.2",
63
64
  "smol-toml": "^1.6.0",
65
+ "tree-sitter-containerfile": "^0.8.1",
64
66
  "tree-sitter-gomod": "github:strum355/tree-sitter-go-mod#56326f2ad478892ace58ff247a97d492a3cbcdda",
65
67
  "tree-sitter-requirements": "github:Strum355/tree-sitter-requirements#d0261ee76b84253997fe70d7d397e78c006c3801",
66
68
  "web-tree-sitter": "^0.26.7",
67
69
  "yargs": "^18.0.0"
68
70
  },
69
71
  "devDependencies": {
70
- "@babel/core": "^7.23.2",
71
- "@trustify-da/trustify-da-api-model": "^2.0.7",
72
- "@types/node": "^20.17.30",
72
+ "@cyclonedx/cyclonedx-library": "^10.2.0",
73
+ "@eslint/js": "^10.0.0",
74
+ "@trustify-da/trustify-da-api-model": "^2.0.12",
75
+ "@types/node": "^25.9.1",
73
76
  "@types/which": "^3.0.4",
74
- "babel-plugin-rewire": "^1.2.0",
77
+ "ajv": "^8.20.0",
75
78
  "c8": "^11.0.0",
76
- "chai": "^4.3.7",
77
- "eslint": "^8.42.0",
79
+ "chai": "^6.2.2",
80
+ "eslint": "^10.4.1",
78
81
  "eslint-import-resolver-typescript": "^4.4.4",
79
- "eslint-plugin-editorconfig": "^4.0.3",
80
- "eslint-plugin-import": "^2.29.1",
82
+ "eslint-plugin-import-x": "^4.16.2",
81
83
  "esmock": "^2.6.2",
82
- "mocha": "^10.2.0",
84
+ "globals": "^17.6.0",
85
+ "mocha": "^11.7.6",
83
86
  "msw": "^2.12.7",
84
- "sinon": "^15.1.2",
85
- "sinon-chai": "^3.7.0",
86
- "typescript": "^5.1.3",
87
- "which": "^5.0.0"
87
+ "sinon": "^22.0.0",
88
+ "sinon-chai": "^4.0.1",
89
+ "typescript": "^6.0.3",
90
+ "which": "^7.0.0"
88
91
  },
89
92
  "mocha": {
90
93
  "check-leaks": false,
@@ -112,12 +115,13 @@
112
115
  "reporter": [
113
116
  "html",
114
117
  "json",
118
+ "lcov",
115
119
  "text"
116
120
  ]
117
121
  },
118
- "eslintIgnore": [
119
- "index.js"
120
- ],
122
+ "overrides": {
123
+ "tree-sitter": "0.22.4"
124
+ },
121
125
  "resolutions": {
122
126
  "@hapi/joi": "17.1.1"
123
127
  }