Skip to content

Commit 1060d84

Browse files
committed
Cleanup createBatchGenerator
1 parent 4cd946c commit 1060d84

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/utils/alert/artifact.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const {
103103
ALERT_TYPE_MEDIUM_CVE,
104104
ALERT_TYPE_MILD_CVE,
105105
ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,
106+
API_V0_URL,
106107
CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER,
107108
CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,
108109
abortSignal
@@ -113,15 +114,20 @@ async function* createBatchGenerator(
113114
): AsyncGenerator<CompactSocketArtifact> {
114115
// Adds the first 'abort' listener to abortSignal.
115116
const req = https
116-
// Lazily access constants.BATCH_PURL_ENDPOINT.
117-
.request(constants.BATCH_PURL_ENDPOINT, {
118-
method: 'POST',
119-
headers: {
120-
Authorization: `Basic ${btoa(`${getPublicToken()}:`)}`
117+
.request(
118+
`${API_V0_URL}purl?${new URLSearchParams([
119+
['alerts', 'true'],
120+
['compact', 'true']
121+
])}`,
122+
{
123+
method: 'POST',
124+
headers: {
125+
Authorization: `Basic ${btoa(`${getPublicToken()}:`)}`
126+
}
127+
// TODO: Fix to not abort process on network abort.
128+
// signal: abortSignal
121129
}
122-
// TODO: Fix to not abort process on network abort.
123-
// signal: abortSignal
124-
})
130+
)
125131
.end(
126132
JSON.stringify({
127133
components: chunk.map(id => ({ purl: `pkg:npm/${id}` }))

0 commit comments

Comments
 (0)