@socketsecurity/sdk 3.1.3 → 3.3.0
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.
- package/CHANGELOG.md +51 -3
- package/README.md +5 -129
- package/dist/constants.d.ts +4 -1
- package/dist/file-upload.d.ts +7 -8
- package/dist/http-client.d.ts +31 -27
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2964 -22582
- package/dist/promise-queue.d.ts +9 -9
- package/dist/socket-sdk-class.d.ts +556 -172
- package/dist/testing.d.ts +9 -9
- package/dist/testing.js +0 -1
- package/dist/types-strict.d.ts +180 -144
- package/dist/types.d.ts +71 -12
- package/dist/utils.d.ts +61 -0
- package/package.json +14 -5
- package/types/api.d.ts +2690 -234
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, PatchViewResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types';
|
|
2
|
-
import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict';
|
|
1
|
+
import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, PatchViewResponse, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types';
|
|
2
|
+
import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict';
|
|
3
3
|
import type { IncomingMessage } from 'node:http';
|
|
4
4
|
/**
|
|
5
5
|
* Socket SDK for programmatic access to Socket.dev security analysis APIs.
|
|
@@ -12,6 +12,45 @@ export declare class SocketSdk {
|
|
|
12
12
|
* Sets up authentication, base URL, HTTP client options, retry behavior, and caching.
|
|
13
13
|
*/
|
|
14
14
|
constructor(apiToken: string, options?: SocketSdkOptions | undefined);
|
|
15
|
+
/**
|
|
16
|
+
* Get package metadata and alerts by PURL strings for a specific organization.
|
|
17
|
+
* Organization-scoped version of batchPackageFetch with security policy label support.
|
|
18
|
+
*
|
|
19
|
+
* @param orgSlug - Organization identifier
|
|
20
|
+
* @param componentsObj - Object containing array of components with PURL strings
|
|
21
|
+
* @param queryParams - Optional query parameters including labels, alerts, compact, etc.
|
|
22
|
+
* @returns Package metadata and alerts for the requested PURLs
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const result = await sdk.batchOrgPackageFetch('my-org',
|
|
27
|
+
* {
|
|
28
|
+
* components: [
|
|
29
|
+
* { purl: 'pkg:npm/express@4.19.2' },
|
|
30
|
+
* { purl: 'pkg:pypi/django@5.0.6' }
|
|
31
|
+
* ]
|
|
32
|
+
* },
|
|
33
|
+
* { labels: ['production'], alerts: true }
|
|
34
|
+
* )
|
|
35
|
+
*
|
|
36
|
+
* if (result.success) {
|
|
37
|
+
* for (const artifact of result.data) {
|
|
38
|
+
* console.log(`${artifact.name}@${artifact.version}`)
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @see https://docs.socket.dev/reference/batchpackagefetchbyorg
|
|
44
|
+
* @apiEndpoint POST /orgs/{org_slug}/purl
|
|
45
|
+
* @quota 100 units
|
|
46
|
+
* @scopes packages:list
|
|
47
|
+
* @throws {Error} When server returns 5xx status codes
|
|
48
|
+
*/
|
|
49
|
+
batchOrgPackageFetch(orgSlug: string, componentsObj: {
|
|
50
|
+
components: Array<{
|
|
51
|
+
purl: string;
|
|
52
|
+
}>;
|
|
53
|
+
}, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'batchPackageFetchByOrg'>>;
|
|
15
54
|
/**
|
|
16
55
|
* Fetch package analysis data for multiple packages in a single batch request.
|
|
17
56
|
* Returns all results at once after processing is complete.
|
|
@@ -41,13 +80,6 @@ export declare class SocketSdk {
|
|
|
41
80
|
* @throws {Error} When server returns 5xx status codes
|
|
42
81
|
*/
|
|
43
82
|
createDependenciesSnapshot(filepaths: string[], options?: CreateDependenciesSnapshotOptions | undefined): Promise<SocketSdkResult<'createDependenciesSnapshot'>>;
|
|
44
|
-
/**
|
|
45
|
-
* Create a diff scan from two full scan IDs.
|
|
46
|
-
* Compares two existing full scans to identify changes.
|
|
47
|
-
*
|
|
48
|
-
* @throws {Error} When server returns 5xx status codes
|
|
49
|
-
*/
|
|
50
|
-
createOrgDiffScanFromIds(orgSlug: string, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'createOrgDiffScanFromIds'>>;
|
|
51
83
|
/**
|
|
52
84
|
* Create a full security scan for an organization.
|
|
53
85
|
*
|
|
@@ -85,6 +117,60 @@ export declare class SocketSdk {
|
|
|
85
117
|
* @throws {Error} When server returns 5xx status codes
|
|
86
118
|
*/
|
|
87
119
|
createFullScan(orgSlug: string, filepaths: string[], options: CreateFullScanOptions): Promise<FullScanResult | StrictErrorResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Create a diff scan from two full scan IDs.
|
|
122
|
+
* Compares two existing full scans to identify changes.
|
|
123
|
+
*
|
|
124
|
+
* @throws {Error} When server returns 5xx status codes
|
|
125
|
+
*/
|
|
126
|
+
createOrgDiffScanFromIds(orgSlug: string, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'createOrgDiffScanFromIds'>>;
|
|
127
|
+
/**
|
|
128
|
+
* Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip).
|
|
129
|
+
* Uploads and scans a compressed archive of project files.
|
|
130
|
+
*
|
|
131
|
+
* @param orgSlug - Organization identifier
|
|
132
|
+
* @param archivePath - Path to the archive file to upload
|
|
133
|
+
* @param options - Scan configuration options including repo, branch, and metadata
|
|
134
|
+
* @returns Created full scan details with scan ID and status
|
|
135
|
+
*
|
|
136
|
+
* @throws {Error} When server returns 5xx status codes or file cannot be read
|
|
137
|
+
*/
|
|
138
|
+
createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: {
|
|
139
|
+
branch?: string | undefined;
|
|
140
|
+
commit_hash?: string | undefined;
|
|
141
|
+
commit_message?: string | undefined;
|
|
142
|
+
committers?: string | undefined;
|
|
143
|
+
integration_org_slug?: string | undefined;
|
|
144
|
+
integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined;
|
|
145
|
+
make_default_branch?: boolean | undefined;
|
|
146
|
+
pull_request?: number | undefined;
|
|
147
|
+
repo: string;
|
|
148
|
+
scan_type?: string | undefined;
|
|
149
|
+
set_as_pending_head?: boolean | undefined;
|
|
150
|
+
tmp?: boolean | undefined;
|
|
151
|
+
workspace?: string | undefined;
|
|
152
|
+
}): Promise<SocketSdkResult<'CreateOrgFullScanArchive'>>;
|
|
153
|
+
/**
|
|
154
|
+
* Create a new webhook for an organization.
|
|
155
|
+
* Webhooks allow you to receive HTTP POST notifications when specific events occur.
|
|
156
|
+
*
|
|
157
|
+
* @param orgSlug - Organization identifier
|
|
158
|
+
* @param webhookData - Webhook configuration including name, URL, secret, and events
|
|
159
|
+
* @returns Created webhook details including webhook ID
|
|
160
|
+
*
|
|
161
|
+
* @throws {Error} When server returns 5xx status codes
|
|
162
|
+
*/
|
|
163
|
+
createOrgWebhook(orgSlug: string, webhookData: {
|
|
164
|
+
description?: null | string | undefined;
|
|
165
|
+
events: string[];
|
|
166
|
+
filters?: {
|
|
167
|
+
repositoryIds: null | string[];
|
|
168
|
+
} | null | undefined;
|
|
169
|
+
headers?: null | Record<string, unknown> | undefined;
|
|
170
|
+
name: string;
|
|
171
|
+
secret: string;
|
|
172
|
+
url: string;
|
|
173
|
+
}): Promise<SocketSdkResult<'createOrgWebhook'>>;
|
|
88
174
|
/**
|
|
89
175
|
* Create a new repository in an organization.
|
|
90
176
|
*
|
|
@@ -140,13 +226,6 @@ export declare class SocketSdk {
|
|
|
140
226
|
* @throws {Error} When server returns 5xx status codes
|
|
141
227
|
*/
|
|
142
228
|
createRepositoryLabel(orgSlug: string, labelData: QueryParams): Promise<RepositoryLabelResult | StrictErrorResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Delete a diff scan from an organization.
|
|
145
|
-
* Permanently removes diff scan data and results.
|
|
146
|
-
*
|
|
147
|
-
* @throws {Error} When server returns 5xx status codes
|
|
148
|
-
*/
|
|
149
|
-
deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'deleteOrgDiffScan'>>;
|
|
150
229
|
/**
|
|
151
230
|
* Delete a full scan from an organization.
|
|
152
231
|
*
|
|
@@ -172,6 +251,24 @@ export declare class SocketSdk {
|
|
|
172
251
|
* @throws {Error} When server returns 5xx status codes
|
|
173
252
|
*/
|
|
174
253
|
deleteFullScan(orgSlug: string, scanId: string): Promise<DeleteResult | StrictErrorResult>;
|
|
254
|
+
/**
|
|
255
|
+
* Delete a diff scan from an organization.
|
|
256
|
+
* Permanently removes diff scan data and results.
|
|
257
|
+
*
|
|
258
|
+
* @throws {Error} When server returns 5xx status codes
|
|
259
|
+
*/
|
|
260
|
+
deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'deleteOrgDiffScan'>>;
|
|
261
|
+
/**
|
|
262
|
+
* Delete a webhook from an organization.
|
|
263
|
+
* This will stop all future webhook deliveries to the webhook URL.
|
|
264
|
+
*
|
|
265
|
+
* @param orgSlug - Organization identifier
|
|
266
|
+
* @param webhookId - Webhook ID to delete
|
|
267
|
+
* @returns Success status
|
|
268
|
+
*
|
|
269
|
+
* @throws {Error} When server returns 5xx status codes
|
|
270
|
+
*/
|
|
271
|
+
deleteOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'deleteOrgWebhook'>>;
|
|
175
272
|
/**
|
|
176
273
|
* Delete a repository from an organization.
|
|
177
274
|
*
|
|
@@ -179,6 +276,7 @@ export declare class SocketSdk {
|
|
|
179
276
|
*
|
|
180
277
|
* @param orgSlug - Organization identifier
|
|
181
278
|
* @param repoSlug - Repository slug/name to delete
|
|
279
|
+
* @param options - Optional parameters including workspace
|
|
182
280
|
* @returns Success confirmation
|
|
183
281
|
*
|
|
184
282
|
* @example
|
|
@@ -196,7 +294,7 @@ export declare class SocketSdk {
|
|
|
196
294
|
* @scopes repo:write
|
|
197
295
|
* @throws {Error} When server returns 5xx status codes
|
|
198
296
|
*/
|
|
199
|
-
deleteRepository(orgSlug: string, repoSlug: string): Promise<DeleteResult | StrictErrorResult>;
|
|
297
|
+
deleteRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise<DeleteResult | StrictErrorResult>;
|
|
200
298
|
/**
|
|
201
299
|
* Delete a repository label from an organization.
|
|
202
300
|
*
|
|
@@ -224,6 +322,55 @@ export declare class SocketSdk {
|
|
|
224
322
|
deleteRepositoryLabel(orgSlug: string, labelId: string): Promise<DeleteRepositoryLabelResult | StrictErrorResult>;
|
|
225
323
|
/**
|
|
226
324
|
* Delete a legacy scan report permanently.
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Download patch file content by hash.
|
|
328
|
+
*
|
|
329
|
+
* Downloads the actual patched file content from the public Socket blob store.
|
|
330
|
+
* This is used after calling viewPatch() to get the patch metadata.
|
|
331
|
+
* No authentication is required as patch blobs are publicly accessible.
|
|
332
|
+
*
|
|
333
|
+
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
334
|
+
* @param options - Optional configuration
|
|
335
|
+
* @param options.baseUrl - Override blob store URL (for testing)
|
|
336
|
+
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
337
|
+
* @throws Error if blob not found (404) or download fails
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```typescript
|
|
341
|
+
* const sdk = new SocketSdk('your-api-token')
|
|
342
|
+
* // First get patch metadata
|
|
343
|
+
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
344
|
+
* // Then download the actual patched file
|
|
345
|
+
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise<SocketSdkResult<'downloadOrgFullScanFilesAsTar'>>;
|
|
349
|
+
/**
|
|
350
|
+
* Download patch file content from Socket blob storage.
|
|
351
|
+
* Retrieves patched file contents using SSRI hash or hex hash.
|
|
352
|
+
*
|
|
353
|
+
* This is a low-level utility method - you'll typically use this after calling
|
|
354
|
+
* `viewPatch()` to get patch metadata, then download individual patched files.
|
|
355
|
+
*
|
|
356
|
+
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
357
|
+
* @param options - Optional configuration
|
|
358
|
+
* @param options.baseUrl - Override blob store URL (for testing)
|
|
359
|
+
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
360
|
+
* @throws Error if blob not found (404) or download fails
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* const sdk = new SocketSdk('your-api-token')
|
|
365
|
+
* // First get patch metadata
|
|
366
|
+
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
367
|
+
* // Then download the actual patched file
|
|
368
|
+
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
downloadPatch(hash: string, options?: {
|
|
372
|
+
baseUrl?: string | undefined;
|
|
373
|
+
} | undefined): Promise<string>;
|
|
227
374
|
/**
|
|
228
375
|
* Export scan results in CycloneDX SBOM format.
|
|
229
376
|
* Returns Software Bill of Materials compliant with CycloneDX standard.
|
|
@@ -231,6 +378,39 @@ export declare class SocketSdk {
|
|
|
231
378
|
* @throws {Error} When server returns 5xx status codes
|
|
232
379
|
*/
|
|
233
380
|
exportCDX(orgSlug: string, fullScanId: string): Promise<SocketSdkResult<'exportCDX'>>;
|
|
381
|
+
/**
|
|
382
|
+
* Export vulnerability exploitability data as an OpenVEX v0.2.0 document.
|
|
383
|
+
* Includes patch data and reachability analysis for vulnerability assessment.
|
|
384
|
+
*
|
|
385
|
+
* @param orgSlug - Organization identifier
|
|
386
|
+
* @param id - Full scan or SBOM report ID
|
|
387
|
+
* @param options - Optional parameters including author, role, and document_id
|
|
388
|
+
* @returns OpenVEX document with vulnerability exploitability information
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* const result = await sdk.exportOpenVEX('my-org', 'scan-id', {
|
|
393
|
+
* author: 'Security Team',
|
|
394
|
+
* role: 'VEX Generator'
|
|
395
|
+
* })
|
|
396
|
+
*
|
|
397
|
+
* if (result.success) {
|
|
398
|
+
* console.log('VEX Version:', result.data.version)
|
|
399
|
+
* console.log('Statements:', result.data.statements.length)
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @see https://docs.socket.dev/reference/exportopenvex
|
|
404
|
+
* @apiEndpoint GET /orgs/{org_slug}/export/openvex/{id}
|
|
405
|
+
* @quota 1 unit
|
|
406
|
+
* @scopes report:read
|
|
407
|
+
* @throws {Error} When server returns 5xx status codes
|
|
408
|
+
*/
|
|
409
|
+
exportOpenVEX(orgSlug: string, id: string, options?: {
|
|
410
|
+
author?: string | undefined;
|
|
411
|
+
document_id?: string | undefined;
|
|
412
|
+
role?: string | undefined;
|
|
413
|
+
} | undefined): Promise<SocketSdkResult<'exportOpenVEX'>>;
|
|
234
414
|
/**
|
|
235
415
|
* Export scan results in SPDX SBOM format.
|
|
236
416
|
* Returns Software Bill of Materials compliant with SPDX standard.
|
|
@@ -281,44 +461,6 @@ export declare class SocketSdk {
|
|
|
281
461
|
* an organization, returning the complete list with their status.
|
|
282
462
|
*/
|
|
283
463
|
getEntitlements(orgSlug: string): Promise<Entitlement[]>;
|
|
284
|
-
/**
|
|
285
|
-
* Get security issues for a specific npm package and version.
|
|
286
|
-
* Returns detailed vulnerability and security alert information.
|
|
287
|
-
*
|
|
288
|
-
* @throws {Error} When server returns 5xx status codes
|
|
289
|
-
*/
|
|
290
|
-
getIssuesByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getIssuesByNPMPackage'>>;
|
|
291
|
-
/**
|
|
292
|
-
* Get analytics data for organization usage patterns and security metrics.
|
|
293
|
-
* Returns statistical analysis for specified time period.
|
|
294
|
-
*
|
|
295
|
-
* @throws {Error} When server returns 5xx status codes
|
|
296
|
-
*/
|
|
297
|
-
getOrgAnalytics(time: string): Promise<SocketSdkResult<'getOrgAnalytics'>>;
|
|
298
|
-
/**
|
|
299
|
-
* List all organizations accessible to the current user.
|
|
300
|
-
*
|
|
301
|
-
* Returns organization details and access permissions with guaranteed required fields.
|
|
302
|
-
*
|
|
303
|
-
* @returns List of organizations with metadata
|
|
304
|
-
*
|
|
305
|
-
* @example
|
|
306
|
-
* ```typescript
|
|
307
|
-
* const result = await sdk.listOrganizations()
|
|
308
|
-
*
|
|
309
|
-
* if (result.success) {
|
|
310
|
-
* result.data.organizations.forEach(org => {
|
|
311
|
-
* console.log(org.name, org.slug) // Guaranteed fields
|
|
312
|
-
* })
|
|
313
|
-
* }
|
|
314
|
-
* ```
|
|
315
|
-
*
|
|
316
|
-
* @see https://docs.socket.dev/reference/getorganizations
|
|
317
|
-
* @apiEndpoint GET /organizations
|
|
318
|
-
* @quota 1 unit
|
|
319
|
-
* @throws {Error} When server returns 5xx status codes
|
|
320
|
-
*/
|
|
321
|
-
listOrganizations(): Promise<OrganizationsResult | StrictErrorResult>;
|
|
322
464
|
/**
|
|
323
465
|
* Get complete full scan results buffered in memory.
|
|
324
466
|
*
|
|
@@ -347,70 +489,227 @@ export declare class SocketSdk {
|
|
|
347
489
|
*/
|
|
348
490
|
getFullScan(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
|
|
349
491
|
/**
|
|
350
|
-
*
|
|
492
|
+
* Get metadata for a specific full scan.
|
|
351
493
|
*
|
|
352
|
-
* Returns
|
|
353
|
-
* for
|
|
494
|
+
* Returns scan configuration, status, and summary information without full artifact data.
|
|
495
|
+
* Useful for checking scan status without downloading complete results.
|
|
354
496
|
*
|
|
355
497
|
* @param orgSlug - Organization identifier
|
|
356
|
-
* @param
|
|
357
|
-
* @returns
|
|
498
|
+
* @param scanId - Full scan identifier
|
|
499
|
+
* @returns Scan metadata including status and configuration
|
|
358
500
|
*
|
|
359
501
|
* @example
|
|
360
502
|
* ```typescript
|
|
361
|
-
* const result = await sdk.
|
|
362
|
-
* branch: 'main',
|
|
363
|
-
* per_page: 50,
|
|
364
|
-
* use_cursor: true
|
|
365
|
-
* })
|
|
503
|
+
* const result = await sdk.getFullScanMetadata('my-org', 'scan_123')
|
|
366
504
|
*
|
|
367
505
|
* if (result.success) {
|
|
368
|
-
* result.data.
|
|
369
|
-
*
|
|
370
|
-
* })
|
|
506
|
+
* console.log('Scan state:', result.data.scan_state)
|
|
507
|
+
* console.log('Branch:', result.data.branch)
|
|
371
508
|
* }
|
|
372
509
|
* ```
|
|
373
510
|
*
|
|
374
|
-
* @see https://docs.socket.dev/reference/
|
|
375
|
-
* @apiEndpoint GET /orgs/{org_slug}/full-scans
|
|
511
|
+
* @see https://docs.socket.dev/reference/getorgfullscanmetadata
|
|
512
|
+
* @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata
|
|
376
513
|
* @quota 1 unit
|
|
377
514
|
* @scopes full-scans:list
|
|
378
515
|
* @throws {Error} When server returns 5xx status codes
|
|
379
516
|
*/
|
|
380
|
-
|
|
517
|
+
getFullScanMetadata(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
|
|
381
518
|
/**
|
|
382
|
-
* Get
|
|
519
|
+
* Get security issues for a specific npm package and version.
|
|
520
|
+
* Returns detailed vulnerability and security alert information.
|
|
383
521
|
*
|
|
384
|
-
*
|
|
385
|
-
|
|
522
|
+
* @throws {Error} When server returns 5xx status codes
|
|
523
|
+
*/
|
|
524
|
+
getIssuesByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getIssuesByNPMPackage'>>;
|
|
525
|
+
/**
|
|
526
|
+
* List full scans associated with a specific alert.
|
|
527
|
+
* Returns paginated full scan references for alert investigation.
|
|
386
528
|
*
|
|
387
529
|
* @param orgSlug - Organization identifier
|
|
388
|
-
* @param
|
|
389
|
-
* @returns
|
|
530
|
+
* @param options - Query parameters including alertKey, range, pagination
|
|
531
|
+
* @returns Paginated array of full scans associated with the alert
|
|
390
532
|
*
|
|
391
533
|
* @example
|
|
392
534
|
* ```typescript
|
|
393
|
-
* const result = await sdk.
|
|
535
|
+
* const result = await sdk.getOrgAlertFullScans('my-org', {
|
|
536
|
+
* alertKey: 'npm/lodash/cve-2021-23337',
|
|
537
|
+
* range: '-7d',
|
|
538
|
+
* per_page: 50
|
|
539
|
+
* })
|
|
394
540
|
*
|
|
395
541
|
* if (result.success) {
|
|
396
|
-
*
|
|
397
|
-
*
|
|
542
|
+
* for (const item of result.data.items) {
|
|
543
|
+
* console.log('Full Scan ID:', item.fullScanId)
|
|
544
|
+
* }
|
|
398
545
|
* }
|
|
399
546
|
* ```
|
|
400
547
|
*
|
|
401
|
-
* @see https://docs.socket.dev/reference/
|
|
402
|
-
* @apiEndpoint GET /orgs/{org_slug}/full-
|
|
403
|
-
* @quota
|
|
404
|
-
* @scopes
|
|
548
|
+
* @see https://docs.socket.dev/reference/alertfullscans
|
|
549
|
+
* @apiEndpoint GET /orgs/{org_slug}/alert-full-scan-search
|
|
550
|
+
* @quota 10 units
|
|
551
|
+
* @scopes alerts:list
|
|
405
552
|
* @throws {Error} When server returns 5xx status codes
|
|
406
553
|
*/
|
|
407
|
-
|
|
554
|
+
getOrgAlertFullScans(orgSlug: string, options: {
|
|
555
|
+
alertKey: string;
|
|
556
|
+
per_page?: number | undefined;
|
|
557
|
+
range?: string | undefined;
|
|
558
|
+
startAfterCursor?: string | undefined;
|
|
559
|
+
}): Promise<SocketSdkResult<'alertFullScans'>>;
|
|
560
|
+
/**
|
|
561
|
+
* List latest alerts for an organization (Beta).
|
|
562
|
+
* Returns paginated alerts with comprehensive filtering options.
|
|
563
|
+
*
|
|
564
|
+
* @param orgSlug - Organization identifier
|
|
565
|
+
* @param options - Optional query parameters for pagination and filtering
|
|
566
|
+
* @returns Paginated list of alerts with cursor-based pagination
|
|
567
|
+
*
|
|
568
|
+
* @throws {Error} When server returns 5xx status codes
|
|
569
|
+
*/
|
|
570
|
+
getOrgAlertsList(orgSlug: string, options?: {
|
|
571
|
+
'filters.alertAction'?: string | undefined;
|
|
572
|
+
'filters.alertAction.notIn'?: string | undefined;
|
|
573
|
+
'filters.alertCategory'?: string | undefined;
|
|
574
|
+
'filters.alertCategory.notIn'?: string | undefined;
|
|
575
|
+
'filters.alertCveId'?: string | undefined;
|
|
576
|
+
'filters.alertCveId.notIn'?: string | undefined;
|
|
577
|
+
'filters.alertCveTitle'?: string | undefined;
|
|
578
|
+
'filters.alertCveTitle.notIn'?: string | undefined;
|
|
579
|
+
'filters.alertCweId'?: string | undefined;
|
|
580
|
+
'filters.alertCweId.notIn'?: string | undefined;
|
|
581
|
+
'filters.alertCweName'?: string | undefined;
|
|
582
|
+
'filters.alertCweName.notIn'?: string | undefined;
|
|
583
|
+
'filters.alertEPSS'?: string | undefined;
|
|
584
|
+
'filters.alertEPSS.notIn'?: string | undefined;
|
|
585
|
+
'filters.alertFixType'?: string | undefined;
|
|
586
|
+
'filters.alertFixType.notIn'?: string | undefined;
|
|
587
|
+
'filters.alertKEV'?: boolean | undefined;
|
|
588
|
+
'filters.alertKEV.notIn'?: boolean | undefined;
|
|
589
|
+
'filters.alertPriority'?: string | undefined;
|
|
590
|
+
'filters.alertPriority.notIn'?: string | undefined;
|
|
591
|
+
'filters.alertReachabilityType'?: string | undefined;
|
|
592
|
+
'filters.alertReachabilityType.notIn'?: string | undefined;
|
|
593
|
+
'filters.alertSeverity'?: string | undefined;
|
|
594
|
+
'filters.alertSeverity.notIn'?: string | undefined;
|
|
595
|
+
'filters.alertStatus'?: string | undefined;
|
|
596
|
+
'filters.alertStatus.notIn'?: string | undefined;
|
|
597
|
+
'filters.alertType'?: string | undefined;
|
|
598
|
+
'filters.alertType.notIn'?: string | undefined;
|
|
599
|
+
'filters.alertUpdatedAt.eq'?: string | undefined;
|
|
600
|
+
'filters.alertUpdatedAt.gt'?: string | undefined;
|
|
601
|
+
'filters.alertUpdatedAt.gte'?: string | undefined;
|
|
602
|
+
'filters.alertUpdatedAt.lt'?: string | undefined;
|
|
603
|
+
'filters.alertUpdatedAt.lte'?: string | undefined;
|
|
604
|
+
'filters.repoFullName'?: string | undefined;
|
|
605
|
+
'filters.repoFullName.notIn'?: string | undefined;
|
|
606
|
+
'filters.repoLabels'?: string | undefined;
|
|
607
|
+
'filters.repoLabels.notIn'?: string | undefined;
|
|
608
|
+
'filters.repoSlug'?: string | undefined;
|
|
609
|
+
'filters.repoSlug.notIn'?: string | undefined;
|
|
610
|
+
per_page?: number | undefined;
|
|
611
|
+
startAfterCursor?: string | undefined;
|
|
612
|
+
} | undefined): Promise<SocketSdkResult<'alertsList'>>;
|
|
613
|
+
/**
|
|
614
|
+
* Get analytics data for organization usage patterns and security metrics.
|
|
615
|
+
* Returns statistical analysis for specified time period.
|
|
616
|
+
*
|
|
617
|
+
* @throws {Error} When server returns 5xx status codes
|
|
618
|
+
*/
|
|
619
|
+
getOrgAnalytics(time: string): Promise<SocketSdkResult<'getOrgAnalytics'>>;
|
|
620
|
+
/**
|
|
621
|
+
* Fetch available fixes for vulnerabilities in a repository or scan.
|
|
622
|
+
* Returns fix recommendations including version upgrades and update types.
|
|
623
|
+
*
|
|
624
|
+
* @param orgSlug - Organization identifier
|
|
625
|
+
* @param options - Fix query options including repo_slug or full_scan_id, vulnerability IDs, and preferences
|
|
626
|
+
* @returns Fix details for requested vulnerabilities with upgrade recommendations
|
|
627
|
+
*
|
|
628
|
+
* @throws {Error} When server returns 5xx status codes
|
|
629
|
+
*/
|
|
630
|
+
getOrgFixes(orgSlug: string, options: {
|
|
631
|
+
allow_major_updates: boolean;
|
|
632
|
+
full_scan_id?: string | undefined;
|
|
633
|
+
include_details?: boolean | undefined;
|
|
634
|
+
include_responsible_direct_dependencies?: boolean | undefined;
|
|
635
|
+
minimum_release_age?: string | undefined;
|
|
636
|
+
repo_slug?: string | undefined;
|
|
637
|
+
vulnerability_ids: string;
|
|
638
|
+
}): Promise<SocketSdkResult<'fetch-fixes'>>;
|
|
408
639
|
/**
|
|
409
640
|
* Get organization's license policy configuration.* Returns allowed, restricted, and monitored license types.
|
|
410
641
|
*
|
|
411
642
|
* @throws {Error} When server returns 5xx status codes
|
|
412
643
|
*/
|
|
413
644
|
getOrgLicensePolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgLicensePolicy'>>;
|
|
645
|
+
/**
|
|
646
|
+
* Get organization's security policy configuration.* Returns alert rules, severity thresholds, and enforcement settings.
|
|
647
|
+
*
|
|
648
|
+
* @throws {Error} When server returns 5xx status codes
|
|
649
|
+
*/
|
|
650
|
+
getOrgSecurityPolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgSecurityPolicy'>>;
|
|
651
|
+
/**
|
|
652
|
+
* Get organization's telemetry configuration.
|
|
653
|
+
* Returns whether telemetry is enabled for the organization.
|
|
654
|
+
*
|
|
655
|
+
* @param orgSlug - Organization identifier
|
|
656
|
+
* @returns Telemetry configuration with enabled status
|
|
657
|
+
*
|
|
658
|
+
* @throws {Error} When server returns 5xx status codes
|
|
659
|
+
*/
|
|
660
|
+
getOrgTelemetryConfig(orgSlug: string): Promise<SocketSdkResult<'getOrgTelemetryConfig'>>;
|
|
661
|
+
/**
|
|
662
|
+
* Get organization triage settings and status.
|
|
663
|
+
* Returns alert triage configuration and current state.
|
|
664
|
+
*
|
|
665
|
+
* @throws {Error} When server returns 5xx status codes
|
|
666
|
+
*/
|
|
667
|
+
getOrgTriage(orgSlug: string): Promise<SocketSdkResult<'getOrgTriage'>>;
|
|
668
|
+
/**
|
|
669
|
+
* Get details of a specific webhook.
|
|
670
|
+
* Returns webhook configuration including events, URL, and filters.
|
|
671
|
+
*
|
|
672
|
+
* @param orgSlug - Organization identifier
|
|
673
|
+
* @param webhookId - Webhook ID to retrieve
|
|
674
|
+
* @returns Webhook details
|
|
675
|
+
*
|
|
676
|
+
* @throws {Error} When server returns 5xx status codes
|
|
677
|
+
*/
|
|
678
|
+
getOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'getOrgWebhook'>>;
|
|
679
|
+
/**
|
|
680
|
+
* List all webhooks for an organization.
|
|
681
|
+
* Supports pagination and sorting options.
|
|
682
|
+
*
|
|
683
|
+
* @param orgSlug - Organization identifier
|
|
684
|
+
* @param options - Optional query parameters for pagination and sorting
|
|
685
|
+
* @returns List of webhooks with pagination info
|
|
686
|
+
*
|
|
687
|
+
* @throws {Error} When server returns 5xx status codes
|
|
688
|
+
*/
|
|
689
|
+
getOrgWebhooksList(orgSlug: string, options?: {
|
|
690
|
+
direction?: string | undefined;
|
|
691
|
+
page?: number | undefined;
|
|
692
|
+
per_page?: number | undefined;
|
|
693
|
+
sort?: string | undefined;
|
|
694
|
+
} | undefined): Promise<SocketSdkResult<'getOrgWebhooksList'>>;
|
|
695
|
+
/**
|
|
696
|
+
* Get current API quota usage and limits.
|
|
697
|
+
* Returns remaining requests, rate limits, and quota reset times.
|
|
698
|
+
*
|
|
699
|
+
* @throws {Error} When server returns 5xx status codes
|
|
700
|
+
*/
|
|
701
|
+
getQuota(): Promise<SocketSdkResult<'getQuota'>>;
|
|
702
|
+
/**
|
|
703
|
+
* Get analytics data for a specific repository.
|
|
704
|
+
* Returns security metrics, dependency trends, and vulnerability statistics.
|
|
705
|
+
*
|
|
706
|
+
* @throws {Error} When server returns 5xx status codes
|
|
707
|
+
*/
|
|
708
|
+
getRepoAnalytics(repo: string, time: string): Promise<SocketSdkResult<'getRepoAnalytics'>>;
|
|
709
|
+
/**
|
|
710
|
+
* Get detailed results for a legacy scan report.
|
|
711
|
+
/**
|
|
712
|
+
|
|
414
713
|
/**
|
|
415
714
|
* Get details for a specific repository.
|
|
416
715
|
*
|
|
@@ -418,6 +717,7 @@ export declare class SocketSdk {
|
|
|
418
717
|
*
|
|
419
718
|
* @param orgSlug - Organization identifier
|
|
420
719
|
* @param repoSlug - Repository slug/name
|
|
720
|
+
* @param options - Optional parameters including workspace
|
|
421
721
|
* @returns Repository details with configuration
|
|
422
722
|
*
|
|
423
723
|
* @example
|
|
@@ -437,7 +737,7 @@ export declare class SocketSdk {
|
|
|
437
737
|
* @scopes repo:read
|
|
438
738
|
* @throws {Error} When server returns 5xx status codes
|
|
439
739
|
*/
|
|
440
|
-
getRepository(orgSlug: string, repoSlug: string): Promise<RepositoryResult | StrictErrorResult>;
|
|
740
|
+
getRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
441
741
|
/**
|
|
442
742
|
* Get details for a specific repository label.
|
|
443
743
|
*
|
|
@@ -466,33 +766,82 @@ export declare class SocketSdk {
|
|
|
466
766
|
*/
|
|
467
767
|
getRepositoryLabel(orgSlug: string, labelId: string): Promise<RepositoryLabelResult | StrictErrorResult>;
|
|
468
768
|
/**
|
|
469
|
-
*
|
|
769
|
+
* Get security score for a specific npm package and version.
|
|
770
|
+
* Returns numerical security rating and scoring breakdown.
|
|
470
771
|
*
|
|
471
|
-
*
|
|
772
|
+
* @throws {Error} When server returns 5xx status codes
|
|
773
|
+
*/
|
|
774
|
+
getScoreByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getScoreByNPMPackage'>>;
|
|
775
|
+
/**
|
|
776
|
+
* Get list of file types and formats supported for scanning.
|
|
777
|
+
* Returns supported manifest files, lockfiles, and configuration formats.
|
|
778
|
+
*
|
|
779
|
+
* @throws {Error} When server returns 5xx status codes
|
|
780
|
+
*/
|
|
781
|
+
getSupportedScanFiles(): Promise<SocketSdkResult<'getReportSupportedFiles'>>;
|
|
782
|
+
/**
|
|
783
|
+
* List all full scans for an organization.
|
|
784
|
+
*
|
|
785
|
+
* Returns paginated list of full scan metadata with guaranteed required fields
|
|
786
|
+
* for improved TypeScript autocomplete.
|
|
472
787
|
*
|
|
473
788
|
* @param orgSlug - Organization identifier
|
|
474
|
-
* @param options -
|
|
475
|
-
* @returns List of
|
|
789
|
+
* @param options - Filtering and pagination options
|
|
790
|
+
* @returns List of full scans with metadata
|
|
476
791
|
*
|
|
477
792
|
* @example
|
|
478
793
|
* ```typescript
|
|
479
|
-
* const result = await sdk.
|
|
794
|
+
* const result = await sdk.listFullScans('my-org', {
|
|
795
|
+
* branch: 'main',
|
|
796
|
+
* per_page: 50,
|
|
797
|
+
* use_cursor: true
|
|
798
|
+
* })
|
|
480
799
|
*
|
|
481
800
|
* if (result.success) {
|
|
482
|
-
* result.data.results.forEach(
|
|
483
|
-
* console.log(
|
|
484
|
-
* console.log('Associated repos:', label.repository_ids?.length || 0)
|
|
801
|
+
* result.data.results.forEach(scan => {
|
|
802
|
+
* console.log(scan.id, scan.created_at) // Guaranteed fields
|
|
485
803
|
* })
|
|
486
804
|
* }
|
|
487
805
|
* ```
|
|
488
806
|
*
|
|
489
|
-
* @see https://docs.socket.dev/reference/
|
|
490
|
-
* @apiEndpoint GET /orgs/{org_slug}/
|
|
807
|
+
* @see https://docs.socket.dev/reference/getorgfullscanlist
|
|
808
|
+
* @apiEndpoint GET /orgs/{org_slug}/full-scans
|
|
491
809
|
* @quota 1 unit
|
|
492
|
-
* @scopes
|
|
810
|
+
* @scopes full-scans:list
|
|
493
811
|
* @throws {Error} When server returns 5xx status codes
|
|
494
812
|
*/
|
|
495
|
-
|
|
813
|
+
listFullScans(orgSlug: string, options?: ListFullScansOptions | undefined): Promise<FullScanListResult | StrictErrorResult>;
|
|
814
|
+
/**
|
|
815
|
+
* List all organizations accessible to the current user.
|
|
816
|
+
*
|
|
817
|
+
* Returns organization details and access permissions with guaranteed required fields.
|
|
818
|
+
*
|
|
819
|
+
* @returns List of organizations with metadata
|
|
820
|
+
*
|
|
821
|
+
* @example
|
|
822
|
+
* ```typescript
|
|
823
|
+
* const result = await sdk.listOrganizations()
|
|
824
|
+
*
|
|
825
|
+
* if (result.success) {
|
|
826
|
+
* result.data.organizations.forEach(org => {
|
|
827
|
+
* console.log(org.name, org.slug) // Guaranteed fields
|
|
828
|
+
* })
|
|
829
|
+
* }
|
|
830
|
+
* ```
|
|
831
|
+
*
|
|
832
|
+
* @see https://docs.socket.dev/reference/getorganizations
|
|
833
|
+
* @apiEndpoint GET /organizations
|
|
834
|
+
* @quota 1 unit
|
|
835
|
+
* @throws {Error} When server returns 5xx status codes
|
|
836
|
+
*/
|
|
837
|
+
listOrganizations(): Promise<OrganizationsResult | StrictErrorResult>;
|
|
838
|
+
/**
|
|
839
|
+
* List all diff scans for an organization.
|
|
840
|
+
* Returns paginated list of diff scan metadata and status.
|
|
841
|
+
*
|
|
842
|
+
* @throws {Error} When server returns 5xx status codes
|
|
843
|
+
*/
|
|
844
|
+
listOrgDiffScans(orgSlug: string): Promise<SocketSdkResult<'listOrgDiffScans'>>;
|
|
496
845
|
/**
|
|
497
846
|
* List all repositories in an organization.
|
|
498
847
|
*
|
|
@@ -525,56 +874,33 @@ export declare class SocketSdk {
|
|
|
525
874
|
*/
|
|
526
875
|
listRepositories(orgSlug: string, options?: ListRepositoriesOptions | undefined): Promise<RepositoriesListResult | StrictErrorResult>;
|
|
527
876
|
/**
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
* @throws {Error} When server returns 5xx status codes
|
|
531
|
-
*/
|
|
532
|
-
getOrgSecurityPolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgSecurityPolicy'>>;
|
|
533
|
-
/**
|
|
534
|
-
* Get organization triage settings and status.
|
|
535
|
-
* Returns alert triage configuration and current state.
|
|
536
|
-
*
|
|
537
|
-
* @throws {Error} When server returns 5xx status codes
|
|
538
|
-
*/
|
|
539
|
-
getOrgTriage(orgSlug: string): Promise<SocketSdkResult<'getOrgTriage'>>;
|
|
540
|
-
/**
|
|
541
|
-
* Get current API quota usage and limits.
|
|
542
|
-
* Returns remaining requests, rate limits, and quota reset times.
|
|
877
|
+
* List all repository labels for an organization.
|
|
543
878
|
*
|
|
544
|
-
*
|
|
545
|
-
*/
|
|
546
|
-
getQuota(): Promise<SocketSdkResult<'getQuota'>>;
|
|
547
|
-
/**
|
|
548
|
-
* Get analytics data for a specific repository.
|
|
549
|
-
* Returns security metrics, dependency trends, and vulnerability statistics.
|
|
879
|
+
* Returns paginated list of labels configured for repository organization and policy management.
|
|
550
880
|
*
|
|
551
|
-
* @
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Get detailed results for a legacy scan report.
|
|
556
|
-
/**
|
|
557
|
-
/**
|
|
558
|
-
* Get security score for a specific npm package and version.
|
|
559
|
-
* Returns numerical security rating and scoring breakdown.
|
|
881
|
+
* @param orgSlug - Organization identifier
|
|
882
|
+
* @param options - Pagination options
|
|
883
|
+
* @returns List of labels with guaranteed id and name fields
|
|
560
884
|
*
|
|
561
|
-
* @
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Get list of file types and formats supported for scanning.
|
|
566
|
-
* Returns supported manifest files, lockfiles, and configuration formats.
|
|
885
|
+
* @example
|
|
886
|
+
* ```typescript
|
|
887
|
+
* const result = await sdk.listRepositoryLabels('my-org', { per_page: 50, page: 1 })
|
|
567
888
|
*
|
|
568
|
-
*
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
*
|
|
573
|
-
*
|
|
889
|
+
* if (result.success) {
|
|
890
|
+
* result.data.results.forEach(label => {
|
|
891
|
+
* console.log('Label:', label.name)
|
|
892
|
+
* console.log('Associated repos:', label.repository_ids?.length || 0)
|
|
893
|
+
* })
|
|
894
|
+
* }
|
|
895
|
+
* ```
|
|
574
896
|
*
|
|
897
|
+
* @see https://docs.socket.dev/reference/getorgrepolabellist
|
|
898
|
+
* @apiEndpoint GET /orgs/{org_slug}/repos/labels
|
|
899
|
+
* @quota 1 unit
|
|
900
|
+
* @scopes repo-label:list
|
|
575
901
|
* @throws {Error} When server returns 5xx status codes
|
|
576
902
|
*/
|
|
577
|
-
|
|
903
|
+
listRepositoryLabels(orgSlug: string, options?: QueryParams | undefined): Promise<RepositoryLabelsListResult | StrictErrorResult>;
|
|
578
904
|
/**
|
|
579
905
|
* Create a new API token for an organization.
|
|
580
906
|
* Generates API token with specified scopes and metadata.
|
|
@@ -603,6 +929,17 @@ export declare class SocketSdk {
|
|
|
603
929
|
* @throws {Error} When server returns 5xx status codes
|
|
604
930
|
*/
|
|
605
931
|
postAPITokenUpdate(orgSlug: string, tokenId: string, updateData: QueryParams): Promise<SocketSdkResult<'postAPITokenUpdate'>>;
|
|
932
|
+
/**
|
|
933
|
+
* Post telemetry data for an organization.
|
|
934
|
+
* Sends telemetry events and analytics data for monitoring and analysis.
|
|
935
|
+
*
|
|
936
|
+
* @param orgSlug - Organization identifier
|
|
937
|
+
* @param telemetryData - Telemetry payload containing events and metrics
|
|
938
|
+
* @returns Empty object on successful submission
|
|
939
|
+
*
|
|
940
|
+
* @throws {Error} When server returns 5xx status codes
|
|
941
|
+
*/
|
|
942
|
+
postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise<SocketSdkGenericResult<PostOrgTelemetryResponse>>;
|
|
606
943
|
/**
|
|
607
944
|
* Update user or organization settings.
|
|
608
945
|
* Configures preferences, notifications, and security policies.
|
|
@@ -612,6 +949,42 @@ export declare class SocketSdk {
|
|
|
612
949
|
postSettings(selectors: Array<{
|
|
613
950
|
organization?: string | undefined;
|
|
614
951
|
}>): Promise<SocketSdkResult<'postSettings'>>;
|
|
952
|
+
/**
|
|
953
|
+
* Create a new full scan by rescanning an existing scan.
|
|
954
|
+
* Supports shallow (policy reapplication) and deep (dependency resolution rerun) modes.
|
|
955
|
+
*
|
|
956
|
+
* @param orgSlug - Organization identifier
|
|
957
|
+
* @param fullScanId - Full scan ID to rescan
|
|
958
|
+
* @param options - Rescan options including mode (shallow or deep)
|
|
959
|
+
* @returns New scan ID and status
|
|
960
|
+
*
|
|
961
|
+
* @example
|
|
962
|
+
* ```typescript
|
|
963
|
+
* // Shallow rescan (reapply policies to cached data)
|
|
964
|
+
* const result = await sdk.rescanFullScan('my-org', 'scan_123', {
|
|
965
|
+
* mode: 'shallow'
|
|
966
|
+
* })
|
|
967
|
+
*
|
|
968
|
+
* if (result.success) {
|
|
969
|
+
* console.log('New Scan ID:', result.data.id)
|
|
970
|
+
* console.log('Status:', result.data.status)
|
|
971
|
+
* }
|
|
972
|
+
*
|
|
973
|
+
* // Deep rescan (rerun dependency resolution)
|
|
974
|
+
* const deepResult = await sdk.rescanFullScan('my-org', 'scan_123', {
|
|
975
|
+
* mode: 'deep'
|
|
976
|
+
* })
|
|
977
|
+
* ```
|
|
978
|
+
*
|
|
979
|
+
* @see https://docs.socket.dev/reference/rescanorgfullscan
|
|
980
|
+
* @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/rescan
|
|
981
|
+
* @quota 1 unit
|
|
982
|
+
* @scopes full-scans:create
|
|
983
|
+
* @throws {Error} When server returns 5xx status codes
|
|
984
|
+
*/
|
|
985
|
+
rescanFullScan(orgSlug: string, fullScanId: string, options?: {
|
|
986
|
+
mode?: 'shallow' | 'deep' | undefined;
|
|
987
|
+
} | undefined): Promise<SocketSdkResult<'rescanOrgFullScan'>>;
|
|
615
988
|
/**
|
|
616
989
|
* Search for dependencies across monitored projects.
|
|
617
990
|
* Returns matching packages with security information and usage patterns.
|
|
@@ -683,6 +1056,47 @@ export declare class SocketSdk {
|
|
|
683
1056
|
* @throws {Error} When server returns 5xx status codes
|
|
684
1057
|
*/
|
|
685
1058
|
updateOrgLicensePolicy(orgSlug: string, policyData: QueryParams, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'updateOrgLicensePolicy'>>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Update organization's security policy configuration.* Modifies alert rules, severity thresholds, and enforcement settings.
|
|
1061
|
+
*
|
|
1062
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1063
|
+
*/
|
|
1064
|
+
updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise<SocketSdkResult<'updateOrgSecurityPolicy'>>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Update organization's telemetry configuration.
|
|
1067
|
+
* Enables or disables telemetry for the organization.
|
|
1068
|
+
*
|
|
1069
|
+
* @param orgSlug - Organization identifier
|
|
1070
|
+
* @param telemetryData - Telemetry configuration with enabled flag
|
|
1071
|
+
* @returns Updated telemetry configuration
|
|
1072
|
+
*
|
|
1073
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1074
|
+
*/
|
|
1075
|
+
updateOrgTelemetryConfig(orgSlug: string, telemetryData: {
|
|
1076
|
+
enabled?: boolean | undefined;
|
|
1077
|
+
}): Promise<SocketSdkResult<'updateOrgTelemetryConfig'>>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Update an existing webhook's configuration.
|
|
1080
|
+
* All fields are optional - only provided fields will be updated.
|
|
1081
|
+
*
|
|
1082
|
+
* @param orgSlug - Organization identifier
|
|
1083
|
+
* @param webhookId - Webhook ID to update
|
|
1084
|
+
* @param webhookData - Updated webhook configuration
|
|
1085
|
+
* @returns Updated webhook details
|
|
1086
|
+
*
|
|
1087
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1088
|
+
*/
|
|
1089
|
+
updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: {
|
|
1090
|
+
description?: null | string | undefined;
|
|
1091
|
+
events?: string[] | undefined;
|
|
1092
|
+
filters?: {
|
|
1093
|
+
repositoryIds: null | string[];
|
|
1094
|
+
} | null | undefined;
|
|
1095
|
+
headers?: null | Record<string, unknown> | undefined;
|
|
1096
|
+
name?: string | undefined;
|
|
1097
|
+
secret?: null | string | undefined;
|
|
1098
|
+
url?: string | undefined;
|
|
1099
|
+
}): Promise<SocketSdkResult<'updateOrgWebhook'>>;
|
|
686
1100
|
/**
|
|
687
1101
|
* Update configuration for a repository.
|
|
688
1102
|
*
|
|
@@ -691,6 +1105,7 @@ export declare class SocketSdk {
|
|
|
691
1105
|
* @param orgSlug - Organization identifier
|
|
692
1106
|
* @param repoSlug - Repository slug/name
|
|
693
1107
|
* @param params - Configuration updates (description, homepage, default_branch, etc.)
|
|
1108
|
+
* @param options - Optional parameters including workspace
|
|
694
1109
|
* @returns Updated repository details
|
|
695
1110
|
*
|
|
696
1111
|
* @example
|
|
@@ -711,7 +1126,7 @@ export declare class SocketSdk {
|
|
|
711
1126
|
* @scopes repo:write
|
|
712
1127
|
* @throws {Error} When server returns 5xx status codes
|
|
713
1128
|
*/
|
|
714
|
-
updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
1129
|
+
updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined, options?: GetRepositoryOptions | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
715
1130
|
/**
|
|
716
1131
|
* Update a repository label for an organization.
|
|
717
1132
|
*
|
|
@@ -739,12 +1154,6 @@ export declare class SocketSdk {
|
|
|
739
1154
|
* @throws {Error} When server returns 5xx status codes
|
|
740
1155
|
*/
|
|
741
1156
|
updateRepositoryLabel(orgSlug: string, labelId: string, labelData: QueryParams): Promise<RepositoryLabelResult | StrictErrorResult>;
|
|
742
|
-
/**
|
|
743
|
-
* Update organization's security policy configuration.* Modifies alert rules, severity thresholds, and enforcement settings.
|
|
744
|
-
*
|
|
745
|
-
* @throws {Error} When server returns 5xx status codes
|
|
746
|
-
*/
|
|
747
|
-
updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise<SocketSdkResult<'updateOrgSecurityPolicy'>>;
|
|
748
1157
|
/**
|
|
749
1158
|
* Upload manifest files for dependency analysis.
|
|
750
1159
|
* Processes package files to create dependency snapshots and security analysis.
|
|
@@ -759,29 +1168,4 @@ export declare class SocketSdk {
|
|
|
759
1168
|
* vulnerabilities, description, license, and tier information.
|
|
760
1169
|
*/
|
|
761
1170
|
viewPatch(orgSlug: string, uuid: string): Promise<PatchViewResponse>;
|
|
762
|
-
/**
|
|
763
|
-
* Download patch file content by hash.
|
|
764
|
-
*
|
|
765
|
-
* Downloads the actual patched file content from the public Socket blob store.
|
|
766
|
-
* This is used after calling viewPatch() to get the patch metadata.
|
|
767
|
-
* No authentication is required as patch blobs are publicly accessible.
|
|
768
|
-
*
|
|
769
|
-
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
770
|
-
* @param options - Optional configuration
|
|
771
|
-
* @param options.baseUrl - Override blob store URL (for testing)
|
|
772
|
-
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
773
|
-
* @throws Error if blob not found (404) or download fails
|
|
774
|
-
*
|
|
775
|
-
* @example
|
|
776
|
-
* ```typescript
|
|
777
|
-
* const sdk = new SocketSdk('your-api-token')
|
|
778
|
-
* // First get patch metadata
|
|
779
|
-
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
780
|
-
* // Then download the actual patched file
|
|
781
|
-
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
782
|
-
* ```
|
|
783
|
-
*/
|
|
784
|
-
downloadPatch(hash: string, options?: {
|
|
785
|
-
baseUrl?: string;
|
|
786
|
-
}): Promise<string>;
|
|
787
1171
|
}
|