Skip to content

Commit 51a12ca

Browse files
committed
chore: rename Exhort to Trustify DA
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
1 parent f9025c1 commit 51a12ca

File tree

14 files changed

+109
-109
lines changed

14 files changed

+109
-109
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: Lint and test project
2121
strategy:
2222
matrix:
23-
node: ['18', '20', '24', 'latest']
23+
node: ['24', 'latest']
2424
env:
2525
MAIN_NODE_VER: '24'
2626
steps:
@@ -88,8 +88,7 @@ jobs:
8888
env:
8989
TRUSTIFY_DA_PYTHON3_PATH: "${{steps.python-location.outputs.python-bin-location}}/python3"
9090
TRUSTIFY_DA_PIP3_PATH: "${{steps.python-location.outputs.python-bin-location}}/pip3"
91-
TRUSTIFY_DA_DEV_MODE: 'true'
92-
DEV_TRUSTIFY_DA_BACKEND_URL: 'https://exhort.stage.devshift.net'
91+
TRUSTIFY_DA_BACKEND_URL: 'https://exhort.stage.devshift.net'
9392
run: npm run test
9493

9594
- name: Compile project
@@ -98,15 +97,13 @@ jobs:
9897
- name: Run integration tests
9998
run: npm run integration-tests
10099
env:
101-
TRUSTIFY_DA_DEV_MODE: 'true'
102-
DEV_TRUSTIFY_DA_BACKEND_URL: 'https://exhort.stage.devshift.net'
100+
TRUSTIFY_DA_BACKEND_URL: 'https://exhort.stage.devshift.net'
103101

104102
- name: Run integration tests cli
105103
working-directory: integration
106104
run: bash ./run_its.sh
107105
env:
108-
TRUSTIFY_DA_DEV_MODE: 'true'
109-
DEV_TRUSTIFY_DA_BACKEND_URL: 'https://exhort.stage.devshift.net'
106+
TRUSTIFY_DA_BACKEND_URL: 'https://exhort.stage.devshift.net'
110107

111108
- name: Upload coverage reports
112109
if: ${{ matrix.node == env.MAIN_NODE_VER }}

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,5 @@ contribution. See the [DCO](DCO) file for details.
119119

120120
<!-- Real links -->
121121
[0]: https://www.conventionalcommits.org/en/v1.0.0/
122-
[1]: https://github.com/guacsec/exhort/blob/0.1.x/src/main/resources/META-INF/openapi.yaml
123-
124122
<!-- Badge links -->
125123
[10]: https://badgen.net/badge/NodeJS%20Version/18/68a063

README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Exhort JavaScript API<br/>![latest-no-snapshot][0] ![latest-snapshot][1]
1+
# Trustify Dependency Analytics JavaScript Client<br/>![latest-no-snapshot][0] ![latest-snapshot][1]
22

3-
* Looking for the OpenAPI Spec? Try [Exhort API Spec](https://github.com/trustify-da/trustify-da-api-model)
4-
* Looking for our Java API? Try [Exhort Java API](https://github.com/guacsec/exhort-java-api).
5-
* Looking for our Backend implementation? Try [Exhort](https://github.com/guacsec/exhort).
3+
* Looking for the OpenAPI Spec? Try [Trustify Dependency Analytics API](https://github.com/guacsec/trustify-da-api-spec)
4+
* Looking for our Java API? Try [Trustify Dependency Analytics Java Client](https://github.com/guacsec/trustify-da-java-client).
5+
* Looking for our Backend implementation? Try [Trustify Dependency Analytics](https://github.com/guacsec/trustify-dependency-analytics).
66

77
<h3>Usage</h3>
88
<p>
99

10+
<strong>Prerequisites:</strong> The <code>TRUSTIFY_DA_BACKEND_URL</code> environment variable must be set to the URL of the Trustify Dependency Analytics backend service. You can set it as an environment variable or pass it in the options object (see <a href="#customization">Customization</a> section).
11+
1012
<ul>
1113
<li>
1214
Use as ESM Module from an ESM module
@@ -15,16 +17,21 @@ Use as ESM Module from an ESM module
1517
npm install @trustify-da/trustify-da-javascript-client
1618
```
1719

20+
```shell
21+
# Set the mandatory backend URL
22+
export TRUSTIFY_DA_BACKEND_URL=https://trustify-da.example.com
23+
```
24+
1825
```javascript
19-
import exhort from '@trustify-da/trustify-da-javascript-client'
26+
import client from '@trustify-da/trustify-da-javascript-client'
2027
import fs from 'node:fs'
2128

2229
// Get stack analysis in JSON format
23-
let stackAnalysis = await exhort.stackAnalysis('/path/to/pom.xml')
30+
let stackAnalysis = await client.stackAnalysis('/path/to/pom.xml')
2431
// Get stack analysis in HTML format (string)
25-
let stackAnalysisHtml = await exhort.stackAnalysis('/path/to/pom.xml', true)
32+
let stackAnalysisHtml = await client.stackAnalysis('/path/to/pom.xml', true)
2633
// Get component analysis in JSON format
27-
let componentAnalysis = await exhort.componentAnalysis('/path/to/pom.xml')
34+
let componentAnalysis = await client.componentAnalysis('/path/to/pom.xml')
2835
```
2936
</li>
3037
</ul>
@@ -37,16 +44,16 @@ npm install @trustify-da/trustify-da-javascript-client
3744
```
3845

3946
```javascript
40-
async function loadExhort()
47+
async function loadTrustifyDa()
4148
{
4249
// dynamic import is the only way to import ESM module into commonJS module
43-
const { default: exhort } = await import('@trustify-da/trustify-da-javascript-client');
44-
return exhort
50+
const { default: client } = await import('@trustify-da/trustify-da-javascript-client');
51+
return client
4552
}
46-
const runExhort = (manifestPath) => {
53+
const runTrustifyDa = (manifestPath) => {
4754
return new Promise(async ( resolve, reject) => {
4855
try {
49-
let stackAnalysisReport = await (await loadExhort()).stackAnalysis(manifestPath,false)
56+
let stackAnalysisReport = await (await loadTrustifyDa()).stackAnalysis(manifestPath,false)
5057
resolve(stackAnalysisReport)
5158

5259
} catch (error)
@@ -56,7 +63,7 @@ const runExhort = (manifestPath) => {
5663
});
5764
};
5865

59-
runExhort("./path/to/manifest").then(resp => console.log(JSON.stringify(resp,null,4)))
66+
runTrustifyDa("./path/to/manifest").then(resp => console.log(JSON.stringify(resp,null,4)))
6067
```
6168
</li>
6269

@@ -256,17 +263,21 @@ All of the 5 above examples are valid for marking a package to be ignored
256263

257264
<h3>Customization</h3>
258265
<p>
259-
There are 2 approaches for customizing <em>Exhort JavaScript API</em>. Whether you're using this API as a
266+
There are 2 approaches for customizing <em>Trustify Dependency Analytics JavaScript Client</em>. Whether you're using this API as a
260267
<em>Global Module</em>, a <em>Remote Script</em>, or an <em>ESM Module</em>, you can use <em>Environment Variables</em>
261268
for various customization.
262269

270+
<strong>Note:</strong> The <code>TRUSTIFY_DA_BACKEND_URL</code> environment variable is <strong>mandatory</strong> and must be set to the URL of the Trustify Dependency Analytics backend service. Without this variable, the API will throw an error.
271+
263272
However, <em>ESM Module</em> users, can opt for customizing programmatically:
264273

265274
```javascript
266-
import exhort from '@trustify-da/trustify-da-javascript-client'
275+
import client from '@trustify-da/trustify-da-javascript-client'
267276
import fs from 'node:fs'
268277

269278
let options = {
279+
// Mandatory: Backend URL for Trustify Dependency Analytics service
280+
'TRUSTIFY_DA_BACKEND_URL': 'https://api.trustify.dev',
270281
'TRUSTIFY_DA_MVN_PATH': '/path/to/my/mvn',
271282
'TRUSTIFY_DA_NPM_PATH': '/path/to/npm',
272283
'TRUSTIFY_DA_PNPM_PATH': '/path/to/pnpm',
@@ -282,12 +293,12 @@ let options = {
282293
}
283294

284295
// Get stack analysis in JSON format ( all package managers, pom.xml is as an example here)
285-
let stackAnalysis = await exhort.stackAnalysis('/path/to/pom.xml', false, options)
296+
let stackAnalysis = await client.stackAnalysis('/path/to/pom.xml', false, options)
286297
// Get stack analysis in HTML format in string ( all package managers, pom.xml is as an example here)
287-
let stackAnalysisHtml = await exhort.stackAnalysis('/path/to/pom.xml', true, options)
298+
let stackAnalysisHtml = await client.stackAnalysis('/path/to/pom.xml', true, options)
288299

289300
// Get component analysis in JSON format
290-
let componentAnalysis = await exhort.componentAnalysis('/path/to/pom.xml', options)
301+
let componentAnalysis = await client.componentAnalysis('/path/to/pom.xml', options)
291302
```
292303
**_Environment variables takes precedence._**
293304
</p>

integration/testers/javascript/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env node
22

3-
import exhort from '@trustify-da/trustify-da-javascript-client'
3+
import client from '@trustify-da/trustify-da-javascript-client'
44
import process from 'node:process'
55

66
const [,, ...args] = process.argv
77

88
if ('stack' === args[0]) {
99
// arg[1] = manifest path; arg[2] = is html boolean
1010
let html = args[2] === 'true'
11-
let res = await exhort.stackAnalysis(args[1], html)
11+
let res = await client.stackAnalysis(args[1], html)
1212
console.log(html ? res : JSON.stringify(res, null, 2))
1313
process.exit(0)
1414
}
1515
if ('component' === args[0]) {
1616
// arg[1] = manifest path
17-
let res = await exhort.componentAnalysis(args[1])
17+
let res = await client.componentAnalysis(args[1])
1818
console.log(JSON.stringify(res, null, 2))
1919
process.exit(0)
2020
}
@@ -24,7 +24,7 @@ if ('validateToken' === args[0]) {
2424
let tokens = {
2525
"TRUSTIFY_DA_SNYK_TOKEN" : args[1]
2626
}
27-
let res = await exhort.validateToken(tokens)
27+
let res = await client.validateToken(tokens)
2828
console.log(res)
2929
process.exit(0)
3030
}

integration/testers/typescript/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
#!/usr/bin/env node
22

3-
import exhort from '@guacsec/trustify-da-javascript-client'
4-
import process from 'node:process'
5-
import { AnalysisReport } from '@trustify-da/trustify-da-api-model/model/v5/AnalysisReport'
3+
import client from '@trustify-da/trustify-da-javascript-client';
4+
import process from 'node:process';
5+
import type { AnalysisReport } from '@trustify-da/trustify-da-api-model/model/v5/AnalysisReport';
66

7-
const [,, ...args] = process.argv
7+
const args = process.argv.slice(2);
88

99
if ('stack' === args[0]) {
1010
// arg[1] = manifest path; arg[2] = is html boolean
1111
let html = args[2] === 'true'
12-
let res = await exhort.stackAnalysis(args[1], html)
12+
let res = await client.stackAnalysis(args[1], html)
1313
console.log(html ? res as string : JSON.stringify(res as AnalysisReport, null, 2))
1414
process.exit(0)
1515
}
1616
if ('component' === args[0]) {
1717
// arg[1] = manifest path
18-
let res = await exhort.componentAnalysis(args[1])
18+
let res = await client.componentAnalysis(args[1])
1919
console.log(JSON.stringify(res as AnalysisReport, null, 2))
2020
process.exit(0)
2121
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"exhort",
1313
"secure",
1414
"supply-chain",
15-
"vulnerability"
15+
"vulnerability",
16+
"trustify",
17+
"dependency analytics"
1618
],
1719
"engines": {
1820
"node": ">= 20.0.0",

src/analysis.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const rhdaPackageManagerHeader = "rhda-pkg-manager"
1818
/**
1919
* Adds proxy agent configuration to fetch options if a proxy URL is specified
2020
* @param {RequestInit} options - The base fetch options
21-
* @param {import("index.js").Options} opts - The exhort options that may contain proxy configuration
21+
* @param {import("index.js").Options} opts - The trustify DA options that may contain proxy configuration
2222
* @returns {RequestInit} The fetch options with proxy agent if applicable
2323
*/
2424
function addProxyAgent(options, opts) {
@@ -47,7 +47,7 @@ async function requestStack(provider, manifest, url, html = false, opts = {}) {
4747
let startTime = new Date()
4848
let endTime
4949
if (process.env["TRUSTIFY_DA_DEBUG"] === "true") {
50-
console.log("Starting time of sending stack analysis request to exhort server= " + startTime)
50+
console.log("Starting time of sending stack analysis request to the dependency analytics server= " + startTime)
5151
}
5252
opts[rhdaPackageManagerHeader.toUpperCase().replaceAll("-", "_")] = provided.ecosystem
5353

@@ -80,15 +80,15 @@ async function requestStack(provider, manifest, url, html = false, opts = {}) {
8080
console.log("Unique Identifier associated with this request - ex-request-id=" + exRequestId)
8181
}
8282
endTime = new Date()
83-
console.log("Response body received from exhort server : " + EOL + EOL)
83+
console.log("Response body received from Trustify DA backend server : " + EOL + EOL)
8484
console.log(console.log(JSON.stringify(result, null, 4)))
85-
console.log("Ending time of sending stack analysis request to exhort server= " + endTime)
85+
console.log("Ending time of sending stack analysis request to Trustify DA backend server= " + endTime)
8686
let time = (endTime - startTime) / 1000
8787
console.log("Total Time in seconds: " + time)
8888

8989
}
9090
} else {
91-
throw new Error(`Got error response from exhort backend - http return code : ${resp.status}, error message => ${await resp.text()}`)
91+
throw new Error(`Got error response from Trustify DA backend - http return code : ${resp.status}, error message => ${await resp.text()}`)
9292
}
9393

9494
return Promise.resolve(result)
@@ -109,7 +109,7 @@ async function requestComponent(provider, manifest, url, opts = {}) {
109109
opts["source-manifest"] = ""
110110
opts[rhdaOperationTypeHeader.toUpperCase().replaceAll("-", "_")] = "component-analysis"
111111
if (process.env["TRUSTIFY_DA_DEBUG"] === "true") {
112-
console.log("Starting time of sending component analysis request to exhort server= " + new Date())
112+
console.log("Starting time of sending component analysis request to Trustify DA backend server= " + new Date())
113113
}
114114
opts[rhdaPackageManagerHeader.toUpperCase().replaceAll("-", "_")] = provided.ecosystem
115115

@@ -137,14 +137,14 @@ async function requestComponent(provider, manifest, url, opts = {}) {
137137
if (exRequestId) {
138138
console.log("Unique Identifier associated with this request - ex-request-id=" + exRequestId)
139139
}
140-
console.log("Response body received from exhort server : " + EOL + EOL)
140+
console.log("Response body received from Trustify DA backend server : " + EOL + EOL)
141141
console.log(JSON.stringify(result, null, 4))
142-
console.log("Ending time of sending component analysis request to exhort server= " + new Date())
142+
console.log("Ending time of sending component analysis request to Trustify DA backend server= " + new Date())
143143

144144

145145
}
146146
} else {
147-
throw new Error(`Got error response from exhort backend - http return code : ${resp.status}, ex-request-id: ${resp.headers.get("ex-request-id")} error message => ${await resp.text()}`)
147+
throw new Error(`Got error response from Trustify DA backend - http return code : ${resp.status}, ex-request-id: ${resp.headers.get("ex-request-id")} error message => ${await resp.text()}`)
148148
}
149149

150150
return Promise.resolve(result)
@@ -191,13 +191,13 @@ async function requestImages(imageRefs, url, html = false, opts = {}) {
191191
if (exRequestId) {
192192
console.log("Unique Identifier associated with this request - ex-request-id=" + exRequestId)
193193
}
194-
console.log("Response body received from exhort server : " + EOL + EOL)
194+
console.log("Response body received from Trustify DA backend server : " + EOL + EOL)
195195
console.log(JSON.stringify(result, null, 4))
196-
console.log("Ending time of sending component analysis request to exhort server= " + new Date())
196+
console.log("Ending time of sending component analysis request to Trustify DA backend server= " + new Date())
197197
}
198198
return result
199199
} else {
200-
throw new Error(`Got error response from exhort backend - http return code : ${resp.status}, ex-request-id: ${resp.headers.get("ex-request-id")} error message => ${await resp.text()}`)
200+
throw new Error(`Got error response from Trustify DA backend - http return code : ${resp.status}, ex-request-id: ${resp.headers.get("ex-request-id")} error message => ${await resp.text()}`)
201201
}
202202
}
203203

@@ -264,7 +264,7 @@ function getTokenHeaders(opts = {}) {
264264
setRhdaHeader(rhdaTelemetryId, headers, opts);
265265

266266
if (process.env["TRUSTIFY_DA_DEBUG"] === "true") {
267-
console.log("Headers Values to be sent to exhort:" + EOL)
267+
console.log("Headers Values to be sent to Trustify DA backend:" + EOL)
268268
for (const headerKey in headers) {
269269
if (!headerKey.match(RegexNotToBeLogged)) {
270270
console.log(`${headerKey}: ${headers[headerKey]}`)

src/cli.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as path from "path";
55
import yargs from 'yargs'
66
import { hideBin } from 'yargs/helpers'
77

8-
import exhort from './index.js'
8+
import client from './index.js'
99

1010

1111
// command for component analysis take manifest type and content
@@ -22,7 +22,7 @@ const component = {
2222
),
2323
handler: async args => {
2424
let manifestName = args['/path/to/manifest']
25-
let res = await exhort.componentAnalysis(manifestName)
25+
let res = await client.componentAnalysis(manifestName)
2626
console.log(JSON.stringify(res, null, 2))
2727
}
2828
}
@@ -50,7 +50,7 @@ const validateToken = {
5050
let tokenValue = args['tokenValue'].trim()
5151
opts[`TRUSTIFY_DA_${tokenProvider}_TOKEN`] = tokenValue
5252
}
53-
let res = await exhort.validateToken(opts)
53+
let res = await client.validateToken(opts)
5454
console.log(res)
5555
}
5656
}
@@ -86,7 +86,7 @@ const stack = {
8686
let summary = args['summary']
8787
let theProvidersSummary = new Map();
8888
let theProvidersObject ={}
89-
let res = await exhort.stackAnalysis(manifest, html)
89+
let res = await client.stackAnalysis(manifest, html)
9090
if(summary)
9191
{
9292
for (let provider in res.providers ) {

0 commit comments

Comments
 (0)