Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/utils/alerts-map.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { arrayUnique } from '@socketsecurity/registry/lib/arrays'
import { debugFn } from '@socketsecurity/registry/lib/debug'
Comment thread
pvdz marked this conversation as resolved.
import { logger } from '@socketsecurity/registry/lib/logger'

import { extractPurlsFromPnpmLockfile } from './pnpm.mts'
import { getPublicToken, setupSdk } from './sdk.mts'
import { addArtifactToAlertsMap } from './socket-package-alert.mts'
import constants from '../constants.mts'

import type { CompactSocketArtifact } from './alert/artifact.mts'
import type {
Expand All @@ -12,6 +15,7 @@ import type {
import type { LockfileObject } from '@pnpm/lockfile.fs'
import type { Spinner } from '@socketsecurity/registry/lib/spinner'


Comment thread
jdalton marked this conversation as resolved.
Outdated
export type GetAlertsMapFromPnpmLockfileOptions = {
consolidate?: boolean | undefined
include?: AlertIncludeFilter | undefined
Expand Down Expand Up @@ -117,6 +121,19 @@ export async function getAlertsMapFromPurls(
throw new Error(
`Socket API server error (${statusCode}): ${statusMessage}`,
)
} else {
if (batchResult.status >= 300 && batchResult.status !== 400) {
Comment thread
jdalton marked this conversation as resolved.
Outdated
const { spinner } = constants
Comment thread
pvdz marked this conversation as resolved.
Outdated
spinner.stop()
Comment thread
pvdz marked this conversation as resolved.
Outdated
debugFn('Received a result=false:', batchResult)
logger.fail(
`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
batchResult.error,
batchResult.cause ? `( ${batchResult.cause} )` : '',
)
Comment thread
pvdz marked this conversation as resolved.
Outdated
break
Comment thread
pvdz marked this conversation as resolved.
Outdated
}
debugFn('Received a result=false:', batchResult)
}
remaining -= 1
if (spinner && remaining > 0) {
Expand Down