Skip to content

Commit ab97269

Browse files
committed
Update artifact types
1 parent 3fe86f0 commit ab97269

1 file changed

Lines changed: 17 additions & 31 deletions

File tree

src/utils/alert/artifact.mts

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import constants from '../../constants.mts'
22

33
import type { Remap } from '@socketsecurity/registry/lib/objects'
4-
import type { components, operations } from '@socketsecurity/sdk/types/api'
5-
6-
export type ALERT_ACTION = 'error' | 'monitor' | 'warn' | 'ignore'
7-
8-
export type ALERT_TYPE = keyof NonNullable<
9-
operations['getOrgSecurityPolicy']['responses']['200']['content']['application/json']['securityPolicyRules']
10-
>
4+
import type {
5+
ALERT_ACTION,
6+
ALERT_TYPE,
7+
CompactSocketArtifact,
8+
CompactSocketArtifactAlert,
9+
SocketArtifact,
10+
SocketArtifactAlert
11+
} from '@socketsecurity/sdk'
12+
13+
export type {
14+
ALERT_ACTION,
15+
ALERT_TYPE,
16+
CompactSocketArtifact,
17+
CompactSocketArtifactAlert,
18+
SocketArtifact,
19+
SocketArtifactAlert
20+
}
1121

1222
export type CVE_ALERT_TYPE = 'cve' | 'mediumCVE' | 'mildCVE' | 'criticalCVE'
1323

@@ -30,36 +40,12 @@ export type ArtifactAlertUpgrade = Remap<
3040
}
3141
>
3242

33-
export type CompactSocketArtifactAlert = Remap<
34-
Omit<SocketArtifactAlert, 'category' | 'end' | 'file' | 'severity' | 'start'>
35-
>
36-
37-
export type CompactSocketArtifact = Remap<
38-
Omit<SocketArtifact, 'alerts' | 'batchIndex' | 'size'> & {
39-
alerts: CompactSocketArtifactAlert[]
40-
}
41-
>
42-
4343
export type CveProps = {
4444
firstPatchedVersionIdentifier?: string
4545
vulnerableVersionRange: string
4646
[key: string]: any
4747
}
4848

49-
export type SocketArtifact = Remap<
50-
Omit<components['schemas']['SocketArtifact'], 'alerts'> & {
51-
alerts?: SocketArtifactAlert[]
52-
}
53-
>
54-
55-
export type SocketArtifactAlert = Remap<
56-
Omit<components['schemas']['SocketAlert'], 'action' | 'props' | 'type'> & {
57-
type: ALERT_TYPE
58-
action?: ALERT_ACTION
59-
props?: any | undefined
60-
}
61-
>
62-
6349
export function isArtifactAlertCve(
6450
alert: CompactSocketArtifactAlert,
6551
): alert is ArtifactAlertCve {

0 commit comments

Comments
 (0)