@socketsecurity/sdk 3.2.0 → 3.3.1
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 +32 -2
- package/README.md +2 -15
- package/data/api-method-quota-and-permissions.json +20 -0
- package/dist/constants.d.ts +1 -1
- package/dist/http-client.d.ts +24 -23
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1572 -1163
- package/dist/promise-queue.d.ts +9 -9
- package/dist/socket-sdk-class.d.ts +655 -402
- package/dist/testing.d.ts +9 -9
- package/dist/types-strict.d.ts +225 -144
- package/dist/types.d.ts +20 -19
- package/dist/utils.d.ts +42 -42
- package/package.json +7 -6
- package/types/api.d.ts +2352 -574
|
@@ -1,5 +1,5 @@
|
|
|
1
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, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict';
|
|
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
|
*
|
|
@@ -80,26 +112,120 @@ export declare class SocketSdk {
|
|
|
80
112
|
*
|
|
81
113
|
* @see https://docs.socket.dev/reference/createorgfullscan
|
|
82
114
|
* @apiEndpoint POST /orgs/{org_slug}/full-scans
|
|
83
|
-
* @quota
|
|
115
|
+
* @quota 0 units
|
|
84
116
|
* @scopes full-scans:create
|
|
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
|
+
* @param orgSlug - Organization identifier
|
|
125
|
+
* @param options - Diff scan creation options
|
|
126
|
+
* @param options.after - ID of the after/head full scan (newer)
|
|
127
|
+
* @param options.before - ID of the before/base full scan (older)
|
|
128
|
+
* @param options.description - Description of the diff scan
|
|
129
|
+
* @param options.external_href - External URL to associate with the diff scan
|
|
130
|
+
* @param options.merge - Set true for merged commits, false for open PR diffs
|
|
131
|
+
* @returns Diff scan details
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const result = await sdk.createOrgDiffScanFromIds('my-org', {
|
|
136
|
+
* before: 'scan-id-1',
|
|
137
|
+
* after: 'scan-id-2',
|
|
138
|
+
* description: 'Compare versions',
|
|
139
|
+
* merge: false
|
|
140
|
+
* })
|
|
141
|
+
*
|
|
142
|
+
* if (result.success) {
|
|
143
|
+
* console.log('Diff scan created:', result.data.diff_scan.id)
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @see https://docs.socket.dev/reference/createorgdiffscanfromids
|
|
148
|
+
* @apiEndpoint POST /orgs/{org_slug}/diff-scans/from-ids
|
|
149
|
+
* @quota 0 units
|
|
150
|
+
* @scopes diff-scans:create, full-scans:list
|
|
151
|
+
* @throws {Error} When server returns 5xx status codes
|
|
152
|
+
*/
|
|
153
|
+
createOrgDiffScanFromIds(orgSlug: string, options: {
|
|
154
|
+
after: string;
|
|
155
|
+
before: string;
|
|
156
|
+
description?: string | undefined;
|
|
157
|
+
external_href?: string | undefined;
|
|
158
|
+
merge?: boolean | undefined;
|
|
159
|
+
}): Promise<SocketSdkResult<'createOrgDiffScanFromIds'>>;
|
|
160
|
+
/**
|
|
161
|
+
* Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip).
|
|
162
|
+
* Uploads and scans a compressed archive of project files.
|
|
163
|
+
*
|
|
164
|
+
* @param orgSlug - Organization identifier
|
|
165
|
+
* @param archivePath - Path to the archive file to upload
|
|
166
|
+
* @param options - Scan configuration options including repo, branch, and metadata
|
|
167
|
+
* @returns Created full scan details with scan ID and status
|
|
168
|
+
*
|
|
169
|
+
* @throws {Error} When server returns 5xx status codes or file cannot be read
|
|
170
|
+
*/
|
|
171
|
+
createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: {
|
|
172
|
+
branch?: string | undefined;
|
|
173
|
+
commit_hash?: string | undefined;
|
|
174
|
+
commit_message?: string | undefined;
|
|
175
|
+
committers?: string | undefined;
|
|
176
|
+
integration_org_slug?: string | undefined;
|
|
177
|
+
integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined;
|
|
178
|
+
make_default_branch?: boolean | undefined;
|
|
179
|
+
pull_request?: number | undefined;
|
|
180
|
+
repo: string;
|
|
181
|
+
scan_type?: string | undefined;
|
|
182
|
+
set_as_pending_head?: boolean | undefined;
|
|
183
|
+
tmp?: boolean | undefined;
|
|
184
|
+
workspace?: string | undefined;
|
|
185
|
+
}): Promise<SocketSdkResult<'CreateOrgFullScanArchive'>>;
|
|
186
|
+
/**
|
|
187
|
+
* Create a new webhook for an organization.
|
|
188
|
+
* Webhooks allow you to receive HTTP POST notifications when specific events occur.
|
|
189
|
+
*
|
|
190
|
+
* @param orgSlug - Organization identifier
|
|
191
|
+
* @param webhookData - Webhook configuration including name, URL, secret, and events
|
|
192
|
+
* @returns Created webhook details including webhook ID
|
|
193
|
+
*
|
|
194
|
+
* @throws {Error} When server returns 5xx status codes
|
|
195
|
+
*/
|
|
196
|
+
createOrgWebhook(orgSlug: string, webhookData: {
|
|
197
|
+
description?: null | string | undefined;
|
|
198
|
+
events: string[];
|
|
199
|
+
filters?: {
|
|
200
|
+
repositoryIds: null | string[];
|
|
201
|
+
} | null | undefined;
|
|
202
|
+
headers?: null | Record<string, unknown> | undefined;
|
|
203
|
+
name: string;
|
|
204
|
+
secret: string;
|
|
205
|
+
url: string;
|
|
206
|
+
}): Promise<SocketSdkResult<'createOrgWebhook'>>;
|
|
88
207
|
/**
|
|
89
208
|
* Create a new repository in an organization.
|
|
90
209
|
*
|
|
91
210
|
* Registers a repository for monitoring and security scanning.
|
|
92
211
|
*
|
|
93
212
|
* @param orgSlug - Organization identifier
|
|
94
|
-
* @param
|
|
213
|
+
* @param repoSlug - Repository name/slug
|
|
214
|
+
* @param params - Additional repository configuration
|
|
215
|
+
* @param params.archived - Whether the repository is archived
|
|
216
|
+
* @param params.default_branch - Default branch of the repository
|
|
217
|
+
* @param params.description - Description of the repository
|
|
218
|
+
* @param params.homepage - Homepage URL of the repository
|
|
219
|
+
* @param params.visibility - Visibility setting ('public' or 'private')
|
|
220
|
+
* @param params.workspace - Workspace of the repository
|
|
95
221
|
* @returns Created repository details
|
|
96
222
|
*
|
|
97
223
|
* @example
|
|
98
224
|
* ```typescript
|
|
99
|
-
* const result = await sdk.createRepository('my-org', {
|
|
100
|
-
* name: 'my-repo',
|
|
225
|
+
* const result = await sdk.createRepository('my-org', 'my-repo', {
|
|
101
226
|
* description: 'My project repository',
|
|
102
|
-
* homepage: 'https://example.com'
|
|
227
|
+
* homepage: 'https://example.com',
|
|
228
|
+
* visibility: 'private'
|
|
103
229
|
* })
|
|
104
230
|
*
|
|
105
231
|
* if (result.success) {
|
|
@@ -109,11 +235,18 @@ export declare class SocketSdk {
|
|
|
109
235
|
*
|
|
110
236
|
* @see https://docs.socket.dev/reference/createorgrepo
|
|
111
237
|
* @apiEndpoint POST /orgs/{org_slug}/repos
|
|
112
|
-
* @quota
|
|
238
|
+
* @quota 0 units
|
|
113
239
|
* @scopes repo:write
|
|
114
240
|
* @throws {Error} When server returns 5xx status codes
|
|
115
241
|
*/
|
|
116
|
-
createRepository(orgSlug: string,
|
|
242
|
+
createRepository(orgSlug: string, repoSlug: string, params?: {
|
|
243
|
+
archived?: boolean | undefined;
|
|
244
|
+
default_branch?: null | string | undefined;
|
|
245
|
+
description?: null | string | undefined;
|
|
246
|
+
homepage?: null | string | undefined;
|
|
247
|
+
visibility?: 'private' | 'public' | undefined;
|
|
248
|
+
workspace?: string | undefined;
|
|
249
|
+
} | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
117
250
|
/**
|
|
118
251
|
* Create a new repository label for an organization.
|
|
119
252
|
*
|
|
@@ -135,44 +268,11 @@ export declare class SocketSdk {
|
|
|
135
268
|
*
|
|
136
269
|
* @see https://docs.socket.dev/reference/createorgrepolabel
|
|
137
270
|
* @apiEndpoint POST /orgs/{org_slug}/repos/labels
|
|
138
|
-
* @quota
|
|
271
|
+
* @quota 0 units
|
|
139
272
|
* @scopes repo-label:create
|
|
140
273
|
* @throws {Error} When server returns 5xx status codes
|
|
141
274
|
*/
|
|
142
275
|
createRepositoryLabel(orgSlug: string, labelData: QueryParams): Promise<RepositoryLabelResult | StrictErrorResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip).
|
|
145
|
-
* Uploads and scans a compressed archive of project files.
|
|
146
|
-
*
|
|
147
|
-
* @param orgSlug - Organization identifier
|
|
148
|
-
* @param archivePath - Path to the archive file to upload
|
|
149
|
-
* @param options - Scan configuration options including repo, branch, and metadata
|
|
150
|
-
* @returns Created full scan details with scan ID and status
|
|
151
|
-
*
|
|
152
|
-
* @throws {Error} When server returns 5xx status codes or file cannot be read
|
|
153
|
-
*/
|
|
154
|
-
createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: {
|
|
155
|
-
branch?: string | undefined;
|
|
156
|
-
commit_hash?: string | undefined;
|
|
157
|
-
commit_message?: string | undefined;
|
|
158
|
-
committers?: string | undefined;
|
|
159
|
-
integration_org_slug?: string | undefined;
|
|
160
|
-
integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined;
|
|
161
|
-
make_default_branch?: boolean | undefined;
|
|
162
|
-
pull_request?: number | undefined;
|
|
163
|
-
repo: string;
|
|
164
|
-
scan_type?: string | undefined;
|
|
165
|
-
set_as_pending_head?: boolean | undefined;
|
|
166
|
-
tmp?: boolean | undefined;
|
|
167
|
-
workspace?: string | undefined;
|
|
168
|
-
}): Promise<SocketSdkResult<'CreateOrgFullScanArchive'>>;
|
|
169
|
-
/**
|
|
170
|
-
* Delete a diff scan from an organization.
|
|
171
|
-
* Permanently removes diff scan data and results.
|
|
172
|
-
*
|
|
173
|
-
* @throws {Error} When server returns 5xx status codes
|
|
174
|
-
*/
|
|
175
|
-
deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'deleteOrgDiffScan'>>;
|
|
176
276
|
/**
|
|
177
277
|
* Delete a full scan from an organization.
|
|
178
278
|
*
|
|
@@ -193,11 +293,29 @@ export declare class SocketSdk {
|
|
|
193
293
|
*
|
|
194
294
|
* @see https://docs.socket.dev/reference/deleteorgfullscan
|
|
195
295
|
* @apiEndpoint DELETE /orgs/{org_slug}/full-scans/{full_scan_id}
|
|
196
|
-
* @quota
|
|
296
|
+
* @quota 0 units
|
|
197
297
|
* @scopes full-scans:delete
|
|
198
298
|
* @throws {Error} When server returns 5xx status codes
|
|
199
299
|
*/
|
|
200
300
|
deleteFullScan(orgSlug: string, scanId: string): Promise<DeleteResult | StrictErrorResult>;
|
|
301
|
+
/**
|
|
302
|
+
* Delete a diff scan from an organization.
|
|
303
|
+
* Permanently removes diff scan data and results.
|
|
304
|
+
*
|
|
305
|
+
* @throws {Error} When server returns 5xx status codes
|
|
306
|
+
*/
|
|
307
|
+
deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'deleteOrgDiffScan'>>;
|
|
308
|
+
/**
|
|
309
|
+
* Delete a webhook from an organization.
|
|
310
|
+
* This will stop all future webhook deliveries to the webhook URL.
|
|
311
|
+
*
|
|
312
|
+
* @param orgSlug - Organization identifier
|
|
313
|
+
* @param webhookId - Webhook ID to delete
|
|
314
|
+
* @returns Success status
|
|
315
|
+
*
|
|
316
|
+
* @throws {Error} When server returns 5xx status codes
|
|
317
|
+
*/
|
|
318
|
+
deleteOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'deleteOrgWebhook'>>;
|
|
201
319
|
/**
|
|
202
320
|
* Delete a repository from an organization.
|
|
203
321
|
*
|
|
@@ -205,6 +323,7 @@ export declare class SocketSdk {
|
|
|
205
323
|
*
|
|
206
324
|
* @param orgSlug - Organization identifier
|
|
207
325
|
* @param repoSlug - Repository slug/name to delete
|
|
326
|
+
* @param options - Optional parameters including workspace
|
|
208
327
|
* @returns Success confirmation
|
|
209
328
|
*
|
|
210
329
|
* @example
|
|
@@ -218,11 +337,11 @@ export declare class SocketSdk {
|
|
|
218
337
|
*
|
|
219
338
|
* @see https://docs.socket.dev/reference/deleteorgrepo
|
|
220
339
|
* @apiEndpoint DELETE /orgs/{org_slug}/repos/{repo_slug}
|
|
221
|
-
* @quota
|
|
340
|
+
* @quota 0 units
|
|
222
341
|
* @scopes repo:write
|
|
223
342
|
* @throws {Error} When server returns 5xx status codes
|
|
224
343
|
*/
|
|
225
|
-
deleteRepository(orgSlug: string, repoSlug: string): Promise<DeleteResult | StrictErrorResult>;
|
|
344
|
+
deleteRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise<DeleteResult | StrictErrorResult>;
|
|
226
345
|
/**
|
|
227
346
|
* Delete a repository label from an organization.
|
|
228
347
|
*
|
|
@@ -243,13 +362,62 @@ export declare class SocketSdk {
|
|
|
243
362
|
*
|
|
244
363
|
* @see https://docs.socket.dev/reference/deleteorgrepolabel
|
|
245
364
|
* @apiEndpoint DELETE /orgs/{org_slug}/repos/labels/{label_id}
|
|
246
|
-
* @quota
|
|
365
|
+
* @quota 0 units
|
|
247
366
|
* @scopes repo-label:delete
|
|
248
367
|
* @throws {Error} When server returns 5xx status codes
|
|
249
368
|
*/
|
|
250
369
|
deleteRepositoryLabel(orgSlug: string, labelId: string): Promise<DeleteRepositoryLabelResult | StrictErrorResult>;
|
|
251
370
|
/**
|
|
252
371
|
* Delete a legacy scan report permanently.
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Download patch file content by hash.
|
|
375
|
+
*
|
|
376
|
+
* Downloads the actual patched file content from the public Socket blob store.
|
|
377
|
+
* This is used after calling viewPatch() to get the patch metadata.
|
|
378
|
+
* No authentication is required as patch blobs are publicly accessible.
|
|
379
|
+
*
|
|
380
|
+
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
381
|
+
* @param options - Optional configuration
|
|
382
|
+
* @param options.baseUrl - Override blob store URL (for testing)
|
|
383
|
+
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
384
|
+
* @throws Error if blob not found (404) or download fails
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```typescript
|
|
388
|
+
* const sdk = new SocketSdk('your-api-token')
|
|
389
|
+
* // First get patch metadata
|
|
390
|
+
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
391
|
+
* // Then download the actual patched file
|
|
392
|
+
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise<SocketSdkResult<'downloadOrgFullScanFilesAsTar'>>;
|
|
396
|
+
/**
|
|
397
|
+
* Download patch file content from Socket blob storage.
|
|
398
|
+
* Retrieves patched file contents using SSRI hash or hex hash.
|
|
399
|
+
*
|
|
400
|
+
* This is a low-level utility method - you'll typically use this after calling
|
|
401
|
+
* `viewPatch()` to get patch metadata, then download individual patched files.
|
|
402
|
+
*
|
|
403
|
+
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
404
|
+
* @param options - Optional configuration
|
|
405
|
+
* @param options.baseUrl - Override blob store URL (for testing)
|
|
406
|
+
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
407
|
+
* @throws Error if blob not found (404) or download fails
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const sdk = new SocketSdk('your-api-token')
|
|
412
|
+
* // First get patch metadata
|
|
413
|
+
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
414
|
+
* // Then download the actual patched file
|
|
415
|
+
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
downloadPatch(hash: string, options?: {
|
|
419
|
+
baseUrl?: string | undefined;
|
|
420
|
+
} | undefined): Promise<string>;
|
|
253
421
|
/**
|
|
254
422
|
* Export scan results in CycloneDX SBOM format.
|
|
255
423
|
* Returns Software Bill of Materials compliant with CycloneDX standard.
|
|
@@ -257,6 +425,39 @@ export declare class SocketSdk {
|
|
|
257
425
|
* @throws {Error} When server returns 5xx status codes
|
|
258
426
|
*/
|
|
259
427
|
exportCDX(orgSlug: string, fullScanId: string): Promise<SocketSdkResult<'exportCDX'>>;
|
|
428
|
+
/**
|
|
429
|
+
* Export vulnerability exploitability data as an OpenVEX v0.2.0 document.
|
|
430
|
+
* Includes patch data and reachability analysis for vulnerability assessment.
|
|
431
|
+
*
|
|
432
|
+
* @param orgSlug - Organization identifier
|
|
433
|
+
* @param id - Full scan or SBOM report ID
|
|
434
|
+
* @param options - Optional parameters including author, role, and document_id
|
|
435
|
+
* @returns OpenVEX document with vulnerability exploitability information
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```typescript
|
|
439
|
+
* const result = await sdk.exportOpenVEX('my-org', 'scan-id', {
|
|
440
|
+
* author: 'Security Team',
|
|
441
|
+
* role: 'VEX Generator'
|
|
442
|
+
* })
|
|
443
|
+
*
|
|
444
|
+
* if (result.success) {
|
|
445
|
+
* console.log('VEX Version:', result.data.version)
|
|
446
|
+
* console.log('Statements:', result.data.statements.length)
|
|
447
|
+
* }
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* @see https://docs.socket.dev/reference/exportopenvex
|
|
451
|
+
* @apiEndpoint GET /orgs/{org_slug}/export/openvex/{id}
|
|
452
|
+
* @quota 0 units
|
|
453
|
+
* @scopes report:read
|
|
454
|
+
* @throws {Error} When server returns 5xx status codes
|
|
455
|
+
*/
|
|
456
|
+
exportOpenVEX(orgSlug: string, id: string, options?: {
|
|
457
|
+
author?: string | undefined;
|
|
458
|
+
document_id?: string | undefined;
|
|
459
|
+
role?: string | undefined;
|
|
460
|
+
} | undefined): Promise<SocketSdkResult<'exportOpenVEX'>>;
|
|
260
461
|
/**
|
|
261
462
|
* Export scan results in SPDX SBOM format.
|
|
262
463
|
* Returns Software Bill of Materials compliant with SPDX standard.
|
|
@@ -293,6 +494,35 @@ export declare class SocketSdk {
|
|
|
293
494
|
* @throws {Error} When server returns 5xx status codes
|
|
294
495
|
*/
|
|
295
496
|
getDiffScanById(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'getDiffScanById'>>;
|
|
497
|
+
/**
|
|
498
|
+
* Get GitHub-flavored markdown comments for a diff scan.
|
|
499
|
+
* Returns dependency overview and alert comments suitable for pull requests.
|
|
500
|
+
*
|
|
501
|
+
* @param orgSlug - Organization identifier
|
|
502
|
+
* @param diffScanId - Diff scan identifier
|
|
503
|
+
* @param options - Optional query parameters
|
|
504
|
+
* @param options.github_installation_id - GitHub installation ID for settings
|
|
505
|
+
* @returns Diff scan metadata with formatted markdown comments
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```typescript
|
|
509
|
+
* const result = await sdk.getDiffScanGfm('my-org', 'diff-scan-id')
|
|
510
|
+
*
|
|
511
|
+
* if (result.success) {
|
|
512
|
+
* console.log(result.data.dependency_overview_comment)
|
|
513
|
+
* console.log(result.data.dependency_alert_comment)
|
|
514
|
+
* }
|
|
515
|
+
* ```
|
|
516
|
+
*
|
|
517
|
+
* @see https://docs.socket.dev/reference/getdiffscangfm
|
|
518
|
+
* @apiEndpoint GET /orgs/{org_slug}/diff-scans/{diff_scan_id}/gfm
|
|
519
|
+
* @quota 0 units
|
|
520
|
+
* @scopes diff-scans:list
|
|
521
|
+
* @throws {Error} When server returns 5xx status codes
|
|
522
|
+
*/
|
|
523
|
+
getDiffScanGfm(orgSlug: string, diffScanId: string, options?: {
|
|
524
|
+
github_installation_id?: string | undefined;
|
|
525
|
+
} | undefined): Promise<SocketSdkResult<'GetDiffScanGfm'>>;
|
|
296
526
|
/**
|
|
297
527
|
* Retrieve the enabled entitlements for an organization.
|
|
298
528
|
*
|
|
@@ -308,27 +538,116 @@ export declare class SocketSdk {
|
|
|
308
538
|
*/
|
|
309
539
|
getEntitlements(orgSlug: string): Promise<Entitlement[]>;
|
|
310
540
|
/**
|
|
311
|
-
* Get
|
|
312
|
-
*
|
|
541
|
+
* Get complete full scan results buffered in memory.
|
|
542
|
+
*
|
|
543
|
+
* Returns entire scan data as JSON for programmatic processing.
|
|
544
|
+
* For large scans, consider using streamFullScan() instead.
|
|
545
|
+
*
|
|
546
|
+
* @param orgSlug - Organization identifier
|
|
547
|
+
* @param scanId - Full scan identifier
|
|
548
|
+
* @returns Complete full scan data including all artifacts
|
|
313
549
|
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```typescript
|
|
552
|
+
* const result = await sdk.getFullScan('my-org', 'scan_123')
|
|
553
|
+
*
|
|
554
|
+
* if (result.success) {
|
|
555
|
+
* console.log('Scan status:', result.data.scan_state)
|
|
556
|
+
* console.log('Repository:', result.data.repository_slug)
|
|
557
|
+
* }
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
* @see https://docs.socket.dev/reference/getorgfullscan
|
|
561
|
+
* @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}
|
|
562
|
+
* @quota 0 units
|
|
563
|
+
* @scopes full-scans:list
|
|
314
564
|
* @throws {Error} When server returns 5xx status codes
|
|
315
565
|
*/
|
|
316
|
-
|
|
566
|
+
getFullScan(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
|
|
317
567
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
568
|
+
* Get metadata for a specific full scan.
|
|
569
|
+
*
|
|
570
|
+
* Returns scan configuration, status, and summary information without full artifact data.
|
|
571
|
+
* Useful for checking scan status without downloading complete results.
|
|
320
572
|
*
|
|
321
573
|
* @param orgSlug - Organization identifier
|
|
322
|
-
* @param
|
|
323
|
-
* @returns
|
|
574
|
+
* @param scanId - Full scan identifier
|
|
575
|
+
* @returns Scan metadata including status and configuration
|
|
324
576
|
*
|
|
325
|
-
* @
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
577
|
+
* @example
|
|
578
|
+
* ```typescript
|
|
579
|
+
* const result = await sdk.getFullScanMetadata('my-org', 'scan_123')
|
|
580
|
+
*
|
|
581
|
+
* if (result.success) {
|
|
582
|
+
* console.log('Scan state:', result.data.scan_state)
|
|
583
|
+
* console.log('Branch:', result.data.branch)
|
|
584
|
+
* }
|
|
585
|
+
* ```
|
|
586
|
+
*
|
|
587
|
+
* @see https://docs.socket.dev/reference/getorgfullscanmetadata
|
|
588
|
+
* @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata
|
|
589
|
+
* @quota 0 units
|
|
590
|
+
* @scopes full-scans:list
|
|
591
|
+
* @throws {Error} When server returns 5xx status codes
|
|
592
|
+
*/
|
|
593
|
+
getFullScanMetadata(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
|
|
594
|
+
/**
|
|
595
|
+
* Get security issues for a specific npm package and version.
|
|
596
|
+
* Returns detailed vulnerability and security alert information.
|
|
597
|
+
*
|
|
598
|
+
* @throws {Error} When server returns 5xx status codes
|
|
599
|
+
*/
|
|
600
|
+
getIssuesByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getIssuesByNPMPackage'>>;
|
|
601
|
+
/**
|
|
602
|
+
* List full scans associated with a specific alert.
|
|
603
|
+
* Returns paginated full scan references for alert investigation.
|
|
604
|
+
*
|
|
605
|
+
* @param orgSlug - Organization identifier
|
|
606
|
+
* @param options - Query parameters including alertKey, range, pagination
|
|
607
|
+
* @returns Paginated array of full scans associated with the alert
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```typescript
|
|
611
|
+
* const result = await sdk.getOrgAlertFullScans('my-org', {
|
|
612
|
+
* alertKey: 'npm/lodash/cve-2021-23337',
|
|
613
|
+
* range: '-7d',
|
|
614
|
+
* per_page: 50
|
|
615
|
+
* })
|
|
616
|
+
*
|
|
617
|
+
* if (result.success) {
|
|
618
|
+
* for (const item of result.data.items) {
|
|
619
|
+
* console.log('Full Scan ID:', item.fullScanId)
|
|
620
|
+
* }
|
|
621
|
+
* }
|
|
622
|
+
* ```
|
|
623
|
+
*
|
|
624
|
+
* @see https://docs.socket.dev/reference/alertfullscans
|
|
625
|
+
* @apiEndpoint GET /orgs/{org_slug}/alert-full-scan-search
|
|
626
|
+
* @quota 10 units
|
|
627
|
+
* @scopes alerts:list
|
|
628
|
+
* @throws {Error} When server returns 5xx status codes
|
|
629
|
+
*/
|
|
630
|
+
getOrgAlertFullScans(orgSlug: string, options: {
|
|
631
|
+
alertKey: string;
|
|
632
|
+
per_page?: number | undefined;
|
|
633
|
+
range?: string | undefined;
|
|
634
|
+
startAfterCursor?: string | undefined;
|
|
635
|
+
}): Promise<SocketSdkResult<'alertFullScans'>>;
|
|
636
|
+
/**
|
|
637
|
+
* List latest alerts for an organization (Beta).
|
|
638
|
+
* Returns paginated alerts with comprehensive filtering options.
|
|
639
|
+
*
|
|
640
|
+
* @param orgSlug - Organization identifier
|
|
641
|
+
* @param options - Optional query parameters for pagination and filtering
|
|
642
|
+
* @returns Paginated list of alerts with cursor-based pagination
|
|
643
|
+
*
|
|
644
|
+
* @throws {Error} When server returns 5xx status codes
|
|
645
|
+
*/
|
|
646
|
+
getOrgAlertsList(orgSlug: string, options?: {
|
|
647
|
+
'filters.alertAction'?: string | undefined;
|
|
648
|
+
'filters.alertAction.notIn'?: string | undefined;
|
|
649
|
+
'filters.alertCategory'?: string | undefined;
|
|
650
|
+
'filters.alertCategory.notIn'?: string | undefined;
|
|
332
651
|
'filters.alertCveId'?: string | undefined;
|
|
333
652
|
'filters.alertCveId.notIn'?: string | undefined;
|
|
334
653
|
'filters.alertCveTitle'?: string | undefined;
|
|
@@ -366,7 +685,7 @@ export declare class SocketSdk {
|
|
|
366
685
|
'filters.repoSlug.notIn'?: string | undefined;
|
|
367
686
|
per_page?: number | undefined;
|
|
368
687
|
startAfterCursor?: string | undefined;
|
|
369
|
-
}): Promise<SocketSdkResult<'alertsList'>>;
|
|
688
|
+
} | undefined): Promise<SocketSdkResult<'alertsList'>>;
|
|
370
689
|
/**
|
|
371
690
|
* Get analytics data for organization usage patterns and security metrics.
|
|
372
691
|
* Returns statistical analysis for specified time period.
|
|
@@ -375,140 +694,98 @@ export declare class SocketSdk {
|
|
|
375
694
|
*/
|
|
376
695
|
getOrgAnalytics(time: string): Promise<SocketSdkResult<'getOrgAnalytics'>>;
|
|
377
696
|
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* Returns organization details and access permissions with guaranteed required fields.
|
|
381
|
-
*
|
|
382
|
-
* @returns List of organizations with metadata
|
|
697
|
+
* Fetch available fixes for vulnerabilities in a repository or scan.
|
|
698
|
+
* Returns fix recommendations including version upgrades and update types.
|
|
383
699
|
*
|
|
384
|
-
* @
|
|
385
|
-
*
|
|
386
|
-
*
|
|
700
|
+
* @param orgSlug - Organization identifier
|
|
701
|
+
* @param options - Fix query options including repo_slug or full_scan_id, vulnerability IDs, and preferences
|
|
702
|
+
* @returns Fix details for requested vulnerabilities with upgrade recommendations
|
|
387
703
|
*
|
|
388
|
-
*
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
704
|
+
* @throws {Error} When server returns 5xx status codes
|
|
705
|
+
*/
|
|
706
|
+
getOrgFixes(orgSlug: string, options: {
|
|
707
|
+
allow_major_updates: boolean;
|
|
708
|
+
full_scan_id?: string | undefined;
|
|
709
|
+
include_details?: boolean | undefined;
|
|
710
|
+
include_responsible_direct_dependencies?: boolean | undefined;
|
|
711
|
+
minimum_release_age?: string | undefined;
|
|
712
|
+
repo_slug?: string | undefined;
|
|
713
|
+
vulnerability_ids: string;
|
|
714
|
+
}): Promise<SocketSdkResult<'fetch-fixes'>>;
|
|
715
|
+
/**
|
|
716
|
+
* Get organization's license policy configuration.* Returns allowed, restricted, and monitored license types.
|
|
394
717
|
*
|
|
395
|
-
* @see https://docs.socket.dev/reference/getorganizations
|
|
396
|
-
* @apiEndpoint GET /organizations
|
|
397
|
-
* @quota 1 unit
|
|
398
718
|
* @throws {Error} When server returns 5xx status codes
|
|
399
719
|
*/
|
|
400
|
-
|
|
720
|
+
getOrgLicensePolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgLicensePolicy'>>;
|
|
401
721
|
/**
|
|
402
|
-
* Get
|
|
722
|
+
* Get organization's security policy configuration.* Returns alert rules, severity thresholds, and enforcement settings.
|
|
403
723
|
*
|
|
404
|
-
*
|
|
405
|
-
|
|
724
|
+
* @throws {Error} When server returns 5xx status codes
|
|
725
|
+
*/
|
|
726
|
+
getOrgSecurityPolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgSecurityPolicy'>>;
|
|
727
|
+
/**
|
|
728
|
+
* Get organization's telemetry configuration.
|
|
729
|
+
* Returns whether telemetry is enabled for the organization.
|
|
406
730
|
*
|
|
407
731
|
* @param orgSlug - Organization identifier
|
|
408
|
-
* @
|
|
409
|
-
* @returns Complete full scan data including all artifacts
|
|
410
|
-
*
|
|
411
|
-
* @example
|
|
412
|
-
* ```typescript
|
|
413
|
-
* const result = await sdk.getFullScan('my-org', 'scan_123')
|
|
414
|
-
*
|
|
415
|
-
* if (result.success) {
|
|
416
|
-
* console.log('Scan status:', result.data.scan_state)
|
|
417
|
-
* console.log('Repository:', result.data.repository_slug)
|
|
418
|
-
* }
|
|
419
|
-
* ```
|
|
732
|
+
* @returns Telemetry configuration with enabled status
|
|
420
733
|
*
|
|
421
|
-
* @see https://docs.socket.dev/reference/getorgfullscan
|
|
422
|
-
* @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}
|
|
423
|
-
* @quota 1 unit
|
|
424
|
-
* @scopes full-scans:list
|
|
425
734
|
* @throws {Error} When server returns 5xx status codes
|
|
426
735
|
*/
|
|
427
|
-
|
|
736
|
+
getOrgTelemetryConfig(orgSlug: string): Promise<SocketSdkResult<'getOrgTelemetryConfig'>>;
|
|
428
737
|
/**
|
|
429
|
-
*
|
|
738
|
+
* Get organization triage settings and status.
|
|
739
|
+
* Returns alert triage configuration and current state.
|
|
430
740
|
*
|
|
431
|
-
*
|
|
432
|
-
|
|
741
|
+
* @throws {Error} When server returns 5xx status codes
|
|
742
|
+
*/
|
|
743
|
+
getOrgTriage(orgSlug: string): Promise<SocketSdkResult<'getOrgTriage'>>;
|
|
744
|
+
/**
|
|
745
|
+
* Get details of a specific webhook.
|
|
746
|
+
* Returns webhook configuration including events, URL, and filters.
|
|
433
747
|
*
|
|
434
748
|
* @param orgSlug - Organization identifier
|
|
435
|
-
* @param
|
|
436
|
-
* @returns
|
|
437
|
-
*
|
|
438
|
-
* @example
|
|
439
|
-
* ```typescript
|
|
440
|
-
* const result = await sdk.listFullScans('my-org', {
|
|
441
|
-
* branch: 'main',
|
|
442
|
-
* per_page: 50,
|
|
443
|
-
* use_cursor: true
|
|
444
|
-
* })
|
|
445
|
-
*
|
|
446
|
-
* if (result.success) {
|
|
447
|
-
* result.data.results.forEach(scan => {
|
|
448
|
-
* console.log(scan.id, scan.created_at) // Guaranteed fields
|
|
449
|
-
* })
|
|
450
|
-
* }
|
|
451
|
-
* ```
|
|
749
|
+
* @param webhookId - Webhook ID to retrieve
|
|
750
|
+
* @returns Webhook details
|
|
452
751
|
*
|
|
453
|
-
* @see https://docs.socket.dev/reference/getorgfullscanlist
|
|
454
|
-
* @apiEndpoint GET /orgs/{org_slug}/full-scans
|
|
455
|
-
* @quota 1 unit
|
|
456
|
-
* @scopes full-scans:list
|
|
457
752
|
* @throws {Error} When server returns 5xx status codes
|
|
458
753
|
*/
|
|
459
|
-
|
|
754
|
+
getOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'getOrgWebhook'>>;
|
|
460
755
|
/**
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
* Returns scan configuration, status, and summary information without full artifact data.
|
|
464
|
-
* Useful for checking scan status without downloading complete results.
|
|
756
|
+
* List all webhooks for an organization.
|
|
757
|
+
* Supports pagination and sorting options.
|
|
465
758
|
*
|
|
466
759
|
* @param orgSlug - Organization identifier
|
|
467
|
-
* @param
|
|
468
|
-
* @returns
|
|
469
|
-
*
|
|
470
|
-
* @example
|
|
471
|
-
* ```typescript
|
|
472
|
-
* const result = await sdk.getFullScanMetadata('my-org', 'scan_123')
|
|
473
|
-
*
|
|
474
|
-
* if (result.success) {
|
|
475
|
-
* console.log('Scan state:', result.data.scan_state)
|
|
476
|
-
* console.log('Branch:', result.data.branch)
|
|
477
|
-
* }
|
|
478
|
-
* ```
|
|
760
|
+
* @param options - Optional query parameters for pagination and sorting
|
|
761
|
+
* @returns List of webhooks with pagination info
|
|
479
762
|
*
|
|
480
|
-
* @see https://docs.socket.dev/reference/getorgfullscanmetadata
|
|
481
|
-
* @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata
|
|
482
|
-
* @quota 1 unit
|
|
483
|
-
* @scopes full-scans:list
|
|
484
763
|
* @throws {Error} When server returns 5xx status codes
|
|
485
764
|
*/
|
|
486
|
-
|
|
765
|
+
getOrgWebhooksList(orgSlug: string, options?: {
|
|
766
|
+
direction?: string | undefined;
|
|
767
|
+
page?: number | undefined;
|
|
768
|
+
per_page?: number | undefined;
|
|
769
|
+
sort?: string | undefined;
|
|
770
|
+
} | undefined): Promise<SocketSdkResult<'getOrgWebhooksList'>>;
|
|
487
771
|
/**
|
|
488
|
-
*
|
|
489
|
-
* Returns
|
|
490
|
-
*
|
|
491
|
-
* @param orgSlug - Organization identifier
|
|
492
|
-
* @param options - Fix query options including repo_slug or full_scan_id, vulnerability IDs, and preferences
|
|
493
|
-
* @returns Fix details for requested vulnerabilities with upgrade recommendations
|
|
772
|
+
* Get current API quota usage and limits.
|
|
773
|
+
* Returns remaining requests, rate limits, and quota reset times.
|
|
494
774
|
*
|
|
495
775
|
* @throws {Error} When server returns 5xx status codes
|
|
496
776
|
*/
|
|
497
|
-
|
|
498
|
-
allow_major_updates: boolean;
|
|
499
|
-
full_scan_id?: string | undefined;
|
|
500
|
-
include_details?: boolean | undefined;
|
|
501
|
-
include_responsible_direct_dependencies?: boolean | undefined;
|
|
502
|
-
minimum_release_age?: string | undefined;
|
|
503
|
-
repo_slug?: string | undefined;
|
|
504
|
-
vulnerability_ids: string;
|
|
505
|
-
}): Promise<SocketSdkResult<'fetch-fixes'>>;
|
|
777
|
+
getQuota(): Promise<SocketSdkResult<'getQuota'>>;
|
|
506
778
|
/**
|
|
507
|
-
* Get
|
|
779
|
+
* Get analytics data for a specific repository.
|
|
780
|
+
* Returns security metrics, dependency trends, and vulnerability statistics.
|
|
508
781
|
*
|
|
509
782
|
* @throws {Error} When server returns 5xx status codes
|
|
510
783
|
*/
|
|
511
|
-
|
|
784
|
+
getRepoAnalytics(repo: string, time: string): Promise<SocketSdkResult<'getRepoAnalytics'>>;
|
|
785
|
+
/**
|
|
786
|
+
* Get detailed results for a legacy scan report.
|
|
787
|
+
/**
|
|
788
|
+
|
|
512
789
|
/**
|
|
513
790
|
* Get details for a specific repository.
|
|
514
791
|
*
|
|
@@ -516,6 +793,7 @@ export declare class SocketSdk {
|
|
|
516
793
|
*
|
|
517
794
|
* @param orgSlug - Organization identifier
|
|
518
795
|
* @param repoSlug - Repository slug/name
|
|
796
|
+
* @param options - Optional parameters including workspace
|
|
519
797
|
* @returns Repository details with configuration
|
|
520
798
|
*
|
|
521
799
|
* @example
|
|
@@ -531,11 +809,11 @@ export declare class SocketSdk {
|
|
|
531
809
|
*
|
|
532
810
|
* @see https://docs.socket.dev/reference/getorgrepo
|
|
533
811
|
* @apiEndpoint GET /orgs/{org_slug}/repos/{repo_slug}
|
|
534
|
-
* @quota
|
|
812
|
+
* @quota 0 units
|
|
535
813
|
* @scopes repo:read
|
|
536
814
|
* @throws {Error} When server returns 5xx status codes
|
|
537
815
|
*/
|
|
538
|
-
getRepository(orgSlug: string, repoSlug: string): Promise<RepositoryResult | StrictErrorResult>;
|
|
816
|
+
getRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
539
817
|
/**
|
|
540
818
|
* Get details for a specific repository label.
|
|
541
819
|
*
|
|
@@ -558,39 +836,117 @@ export declare class SocketSdk {
|
|
|
558
836
|
*
|
|
559
837
|
* @see https://docs.socket.dev/reference/getorgrepolabel
|
|
560
838
|
* @apiEndpoint GET /orgs/{org_slug}/repos/labels/{label_id}
|
|
561
|
-
* @quota
|
|
839
|
+
* @quota 0 units
|
|
562
840
|
* @scopes repo-label:list
|
|
563
841
|
* @throws {Error} When server returns 5xx status codes
|
|
564
842
|
*/
|
|
565
843
|
getRepositoryLabel(orgSlug: string, labelId: string): Promise<RepositoryLabelResult | StrictErrorResult>;
|
|
566
844
|
/**
|
|
567
|
-
*
|
|
845
|
+
* Get security score for a specific npm package and version.
|
|
846
|
+
* Returns numerical security rating and scoring breakdown.
|
|
568
847
|
*
|
|
569
|
-
*
|
|
848
|
+
* @throws {Error} When server returns 5xx status codes
|
|
849
|
+
*/
|
|
850
|
+
getScoreByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getScoreByNPMPackage'>>;
|
|
851
|
+
/**
|
|
852
|
+
* Get list of supported file types for full scan generation.
|
|
853
|
+
* Returns glob patterns for supported manifest files, lockfiles, and configuration formats.
|
|
854
|
+
*
|
|
855
|
+
* Files whose names match the patterns returned by this endpoint can be uploaded
|
|
856
|
+
* for report generation. Examples include `package.json`, `package-lock.json`, and `yarn.lock`.
|
|
570
857
|
*
|
|
571
858
|
* @param orgSlug - Organization identifier
|
|
572
|
-
* @
|
|
573
|
-
* @returns List of labels with guaranteed id and name fields
|
|
859
|
+
* @returns Nested object with environment and file type patterns
|
|
574
860
|
*
|
|
575
861
|
* @example
|
|
576
862
|
* ```typescript
|
|
577
|
-
* const result = await sdk.
|
|
863
|
+
* const result = await sdk.getSupportedFiles('my-org')
|
|
578
864
|
*
|
|
579
865
|
* if (result.success) {
|
|
580
|
-
* result.data.
|
|
581
|
-
*
|
|
582
|
-
*
|
|
866
|
+
* console.log('NPM patterns:', result.data.NPM)
|
|
867
|
+
* console.log('PyPI patterns:', result.data.PyPI)
|
|
868
|
+
* }
|
|
869
|
+
* ```
|
|
870
|
+
*
|
|
871
|
+
* @see https://docs.socket.dev/reference/getsupportedfiles
|
|
872
|
+
* @apiEndpoint GET /orgs/{org_slug}/supported-files
|
|
873
|
+
* @quota 0 units
|
|
874
|
+
* @scopes No scopes required, but authentication is required
|
|
875
|
+
* @throws {Error} When server returns 5xx status codes
|
|
876
|
+
*/
|
|
877
|
+
getSupportedFiles(orgSlug: string): Promise<SocketSdkResult<'getSupportedFiles'>>;
|
|
878
|
+
/**
|
|
879
|
+
* Get list of file types and formats supported for scanning.
|
|
880
|
+
* Returns supported manifest files, lockfiles, and configuration formats.
|
|
881
|
+
*
|
|
882
|
+
* @deprecated Use getSupportedFiles() instead. This endpoint has been deprecated
|
|
883
|
+
* since 2023-01-15 and now uses the /report/supported endpoint.
|
|
884
|
+
* @throws {Error} When server returns 5xx status codes
|
|
885
|
+
*/
|
|
886
|
+
getSupportedScanFiles(): Promise<SocketSdkResult<'getReportSupportedFiles'>>;
|
|
887
|
+
/**
|
|
888
|
+
* List all full scans for an organization.
|
|
889
|
+
*
|
|
890
|
+
* Returns paginated list of full scan metadata with guaranteed required fields
|
|
891
|
+
* for improved TypeScript autocomplete.
|
|
892
|
+
*
|
|
893
|
+
* @param orgSlug - Organization identifier
|
|
894
|
+
* @param options - Filtering and pagination options
|
|
895
|
+
* @returns List of full scans with metadata
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```typescript
|
|
899
|
+
* const result = await sdk.listFullScans('my-org', {
|
|
900
|
+
* branch: 'main',
|
|
901
|
+
* per_page: 50,
|
|
902
|
+
* use_cursor: true
|
|
903
|
+
* })
|
|
904
|
+
*
|
|
905
|
+
* if (result.success) {
|
|
906
|
+
* result.data.results.forEach(scan => {
|
|
907
|
+
* console.log(scan.id, scan.created_at) // Guaranteed fields
|
|
583
908
|
* })
|
|
584
909
|
* }
|
|
585
910
|
* ```
|
|
586
911
|
*
|
|
587
|
-
* @see https://docs.socket.dev/reference/
|
|
588
|
-
* @apiEndpoint GET /orgs/{org_slug}/
|
|
589
|
-
* @quota
|
|
590
|
-
* @scopes
|
|
912
|
+
* @see https://docs.socket.dev/reference/getorgfullscanlist
|
|
913
|
+
* @apiEndpoint GET /orgs/{org_slug}/full-scans
|
|
914
|
+
* @quota 0 units
|
|
915
|
+
* @scopes full-scans:list
|
|
591
916
|
* @throws {Error} When server returns 5xx status codes
|
|
592
917
|
*/
|
|
593
|
-
|
|
918
|
+
listFullScans(orgSlug: string, options?: ListFullScansOptions | undefined): Promise<FullScanListResult | StrictErrorResult>;
|
|
919
|
+
/**
|
|
920
|
+
* List all organizations accessible to the current user.
|
|
921
|
+
*
|
|
922
|
+
* Returns organization details and access permissions with guaranteed required fields.
|
|
923
|
+
*
|
|
924
|
+
* @returns List of organizations with metadata
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```typescript
|
|
928
|
+
* const result = await sdk.listOrganizations()
|
|
929
|
+
*
|
|
930
|
+
* if (result.success) {
|
|
931
|
+
* result.data.organizations.forEach(org => {
|
|
932
|
+
* console.log(org.name, org.slug) // Guaranteed fields
|
|
933
|
+
* })
|
|
934
|
+
* }
|
|
935
|
+
* ```
|
|
936
|
+
*
|
|
937
|
+
* @see https://docs.socket.dev/reference/getorganizations
|
|
938
|
+
* @apiEndpoint GET /organizations
|
|
939
|
+
* @quota 0 units
|
|
940
|
+
* @throws {Error} When server returns 5xx status codes
|
|
941
|
+
*/
|
|
942
|
+
listOrganizations(): Promise<OrganizationsResult | StrictErrorResult>;
|
|
943
|
+
/**
|
|
944
|
+
* List all diff scans for an organization.
|
|
945
|
+
* Returns paginated list of diff scan metadata and status.
|
|
946
|
+
*
|
|
947
|
+
* @throws {Error} When server returns 5xx status codes
|
|
948
|
+
*/
|
|
949
|
+
listOrgDiffScans(orgSlug: string): Promise<SocketSdkResult<'listOrgDiffScans'>>;
|
|
594
950
|
/**
|
|
595
951
|
* List all repositories in an organization.
|
|
596
952
|
*
|
|
@@ -617,62 +973,39 @@ export declare class SocketSdk {
|
|
|
617
973
|
*
|
|
618
974
|
* @see https://docs.socket.dev/reference/getorgrepolist
|
|
619
975
|
* @apiEndpoint GET /orgs/{org_slug}/repos
|
|
620
|
-
* @quota
|
|
976
|
+
* @quota 0 units
|
|
621
977
|
* @scopes repo:list
|
|
622
978
|
* @throws {Error} When server returns 5xx status codes
|
|
623
979
|
*/
|
|
624
980
|
listRepositories(orgSlug: string, options?: ListRepositoriesOptions | undefined): Promise<RepositoriesListResult | StrictErrorResult>;
|
|
625
981
|
/**
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
* @throws {Error} When server returns 5xx status codes
|
|
629
|
-
*/
|
|
630
|
-
getOrgSecurityPolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgSecurityPolicy'>>;
|
|
631
|
-
/**
|
|
632
|
-
* Get organization triage settings and status.
|
|
633
|
-
* Returns alert triage configuration and current state.
|
|
634
|
-
*
|
|
635
|
-
* @throws {Error} When server returns 5xx status codes
|
|
636
|
-
*/
|
|
637
|
-
getOrgTriage(orgSlug: string): Promise<SocketSdkResult<'getOrgTriage'>>;
|
|
638
|
-
/**
|
|
639
|
-
* Get current API quota usage and limits.
|
|
640
|
-
* Returns remaining requests, rate limits, and quota reset times.
|
|
982
|
+
* List all repository labels for an organization.
|
|
641
983
|
*
|
|
642
|
-
*
|
|
643
|
-
*/
|
|
644
|
-
getQuota(): Promise<SocketSdkResult<'getQuota'>>;
|
|
645
|
-
/**
|
|
646
|
-
* Get analytics data for a specific repository.
|
|
647
|
-
* Returns security metrics, dependency trends, and vulnerability statistics.
|
|
984
|
+
* Returns paginated list of labels configured for repository organization and policy management.
|
|
648
985
|
*
|
|
649
|
-
* @
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* Get detailed results for a legacy scan report.
|
|
654
|
-
/**
|
|
655
|
-
/**
|
|
656
|
-
* Get security score for a specific npm package and version.
|
|
657
|
-
* Returns numerical security rating and scoring breakdown.
|
|
986
|
+
* @param orgSlug - Organization identifier
|
|
987
|
+
* @param options - Pagination options
|
|
988
|
+
* @returns List of labels with guaranteed id and name fields
|
|
658
989
|
*
|
|
659
|
-
* @
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
/**
|
|
663
|
-
* Get list of file types and formats supported for scanning.
|
|
664
|
-
* Returns supported manifest files, lockfiles, and configuration formats.
|
|
990
|
+
* @example
|
|
991
|
+
* ```typescript
|
|
992
|
+
* const result = await sdk.listRepositoryLabels('my-org', { per_page: 50, page: 1 })
|
|
665
993
|
*
|
|
666
|
-
*
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
*
|
|
671
|
-
*
|
|
994
|
+
* if (result.success) {
|
|
995
|
+
* result.data.results.forEach(label => {
|
|
996
|
+
* console.log('Label:', label.name)
|
|
997
|
+
* console.log('Associated repos:', label.repository_ids?.length || 0)
|
|
998
|
+
* })
|
|
999
|
+
* }
|
|
1000
|
+
* ```
|
|
672
1001
|
*
|
|
1002
|
+
* @see https://docs.socket.dev/reference/getorgrepolabellist
|
|
1003
|
+
* @apiEndpoint GET /orgs/{org_slug}/repos/labels
|
|
1004
|
+
* @quota 0 units
|
|
1005
|
+
* @scopes repo-label:list
|
|
673
1006
|
* @throws {Error} When server returns 5xx status codes
|
|
674
1007
|
*/
|
|
675
|
-
|
|
1008
|
+
listRepositoryLabels(orgSlug: string, options?: QueryParams | undefined): Promise<RepositoryLabelsListResult | StrictErrorResult>;
|
|
676
1009
|
/**
|
|
677
1010
|
* Create a new API token for an organization.
|
|
678
1011
|
* Generates API token with specified scopes and metadata.
|
|
@@ -701,6 +1034,17 @@ export declare class SocketSdk {
|
|
|
701
1034
|
* @throws {Error} When server returns 5xx status codes
|
|
702
1035
|
*/
|
|
703
1036
|
postAPITokenUpdate(orgSlug: string, tokenId: string, updateData: QueryParams): Promise<SocketSdkResult<'postAPITokenUpdate'>>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Post telemetry data for an organization.
|
|
1039
|
+
* Sends telemetry events and analytics data for monitoring and analysis.
|
|
1040
|
+
*
|
|
1041
|
+
* @param orgSlug - Organization identifier
|
|
1042
|
+
* @param telemetryData - Telemetry payload containing events and metrics
|
|
1043
|
+
* @returns Empty object on successful submission
|
|
1044
|
+
*
|
|
1045
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1046
|
+
*/
|
|
1047
|
+
postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise<SocketSdkGenericResult<PostOrgTelemetryResponse>>;
|
|
704
1048
|
/**
|
|
705
1049
|
* Update user or organization settings.
|
|
706
1050
|
* Configures preferences, notifications, and security policies.
|
|
@@ -710,6 +1054,42 @@ export declare class SocketSdk {
|
|
|
710
1054
|
postSettings(selectors: Array<{
|
|
711
1055
|
organization?: string | undefined;
|
|
712
1056
|
}>): Promise<SocketSdkResult<'postSettings'>>;
|
|
1057
|
+
/**
|
|
1058
|
+
* Create a new full scan by rescanning an existing scan.
|
|
1059
|
+
* Supports shallow (policy reapplication) and deep (dependency resolution rerun) modes.
|
|
1060
|
+
*
|
|
1061
|
+
* @param orgSlug - Organization identifier
|
|
1062
|
+
* @param fullScanId - Full scan ID to rescan
|
|
1063
|
+
* @param options - Rescan options including mode (shallow or deep)
|
|
1064
|
+
* @returns New scan ID and status
|
|
1065
|
+
*
|
|
1066
|
+
* @example
|
|
1067
|
+
* ```typescript
|
|
1068
|
+
* // Shallow rescan (reapply policies to cached data)
|
|
1069
|
+
* const result = await sdk.rescanFullScan('my-org', 'scan_123', {
|
|
1070
|
+
* mode: 'shallow'
|
|
1071
|
+
* })
|
|
1072
|
+
*
|
|
1073
|
+
* if (result.success) {
|
|
1074
|
+
* console.log('New Scan ID:', result.data.id)
|
|
1075
|
+
* console.log('Status:', result.data.status)
|
|
1076
|
+
* }
|
|
1077
|
+
*
|
|
1078
|
+
* // Deep rescan (rerun dependency resolution)
|
|
1079
|
+
* const deepResult = await sdk.rescanFullScan('my-org', 'scan_123', {
|
|
1080
|
+
* mode: 'deep'
|
|
1081
|
+
* })
|
|
1082
|
+
* ```
|
|
1083
|
+
*
|
|
1084
|
+
* @see https://docs.socket.dev/reference/rescanorgfullscan
|
|
1085
|
+
* @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/rescan
|
|
1086
|
+
* @quota 0 units
|
|
1087
|
+
* @scopes full-scans:create
|
|
1088
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1089
|
+
*/
|
|
1090
|
+
rescanFullScan(orgSlug: string, fullScanId: string, options?: {
|
|
1091
|
+
mode?: 'shallow' | 'deep' | undefined;
|
|
1092
|
+
} | undefined): Promise<SocketSdkResult<'rescanOrgFullScan'>>;
|
|
713
1093
|
/**
|
|
714
1094
|
* Search for dependencies across monitored projects.
|
|
715
1095
|
* Returns matching packages with security information and usage patterns.
|
|
@@ -754,7 +1134,7 @@ export declare class SocketSdk {
|
|
|
754
1134
|
*
|
|
755
1135
|
* @see https://docs.socket.dev/reference/getorgfullscan
|
|
756
1136
|
* @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}
|
|
757
|
-
* @quota
|
|
1137
|
+
* @quota 0 units
|
|
758
1138
|
* @scopes full-scans:list
|
|
759
1139
|
* @throws {Error} When server returns 5xx status codes
|
|
760
1140
|
*/
|
|
@@ -781,6 +1161,47 @@ export declare class SocketSdk {
|
|
|
781
1161
|
* @throws {Error} When server returns 5xx status codes
|
|
782
1162
|
*/
|
|
783
1163
|
updateOrgLicensePolicy(orgSlug: string, policyData: QueryParams, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'updateOrgLicensePolicy'>>;
|
|
1164
|
+
/**
|
|
1165
|
+
* Update organization's security policy configuration.* Modifies alert rules, severity thresholds, and enforcement settings.
|
|
1166
|
+
*
|
|
1167
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1168
|
+
*/
|
|
1169
|
+
updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise<SocketSdkResult<'updateOrgSecurityPolicy'>>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Update organization's telemetry configuration.
|
|
1172
|
+
* Enables or disables telemetry for the organization.
|
|
1173
|
+
*
|
|
1174
|
+
* @param orgSlug - Organization identifier
|
|
1175
|
+
* @param telemetryData - Telemetry configuration with enabled flag
|
|
1176
|
+
* @returns Updated telemetry configuration
|
|
1177
|
+
*
|
|
1178
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1179
|
+
*/
|
|
1180
|
+
updateOrgTelemetryConfig(orgSlug: string, telemetryData: {
|
|
1181
|
+
enabled?: boolean | undefined;
|
|
1182
|
+
}): Promise<SocketSdkResult<'updateOrgTelemetryConfig'>>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Update an existing webhook's configuration.
|
|
1185
|
+
* All fields are optional - only provided fields will be updated.
|
|
1186
|
+
*
|
|
1187
|
+
* @param orgSlug - Organization identifier
|
|
1188
|
+
* @param webhookId - Webhook ID to update
|
|
1189
|
+
* @param webhookData - Updated webhook configuration
|
|
1190
|
+
* @returns Updated webhook details
|
|
1191
|
+
*
|
|
1192
|
+
* @throws {Error} When server returns 5xx status codes
|
|
1193
|
+
*/
|
|
1194
|
+
updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: {
|
|
1195
|
+
description?: null | string | undefined;
|
|
1196
|
+
events?: string[] | undefined;
|
|
1197
|
+
filters?: {
|
|
1198
|
+
repositoryIds: null | string[];
|
|
1199
|
+
} | null | undefined;
|
|
1200
|
+
headers?: null | Record<string, unknown> | undefined;
|
|
1201
|
+
name?: string | undefined;
|
|
1202
|
+
secret?: null | string | undefined;
|
|
1203
|
+
url?: string | undefined;
|
|
1204
|
+
}): Promise<SocketSdkResult<'updateOrgWebhook'>>;
|
|
784
1205
|
/**
|
|
785
1206
|
* Update configuration for a repository.
|
|
786
1207
|
*
|
|
@@ -789,6 +1210,7 @@ export declare class SocketSdk {
|
|
|
789
1210
|
* @param orgSlug - Organization identifier
|
|
790
1211
|
* @param repoSlug - Repository slug/name
|
|
791
1212
|
* @param params - Configuration updates (description, homepage, default_branch, etc.)
|
|
1213
|
+
* @param options - Optional parameters including workspace
|
|
792
1214
|
* @returns Updated repository details
|
|
793
1215
|
*
|
|
794
1216
|
* @example
|
|
@@ -805,11 +1227,11 @@ export declare class SocketSdk {
|
|
|
805
1227
|
*
|
|
806
1228
|
* @see https://docs.socket.dev/reference/updateorgrepo
|
|
807
1229
|
* @apiEndpoint POST /orgs/{org_slug}/repos/{repo_slug}
|
|
808
|
-
* @quota
|
|
1230
|
+
* @quota 0 units
|
|
809
1231
|
* @scopes repo:write
|
|
810
1232
|
* @throws {Error} When server returns 5xx status codes
|
|
811
1233
|
*/
|
|
812
|
-
updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
1234
|
+
updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined, options?: GetRepositoryOptions | undefined): Promise<RepositoryResult | StrictErrorResult>;
|
|
813
1235
|
/**
|
|
814
1236
|
* Update a repository label for an organization.
|
|
815
1237
|
*
|
|
@@ -832,17 +1254,11 @@ export declare class SocketSdk {
|
|
|
832
1254
|
*
|
|
833
1255
|
* @see https://docs.socket.dev/reference/updateorgrepolabel
|
|
834
1256
|
* @apiEndpoint PUT /orgs/{org_slug}/repos/labels/{label_id}
|
|
835
|
-
* @quota
|
|
1257
|
+
* @quota 0 units
|
|
836
1258
|
* @scopes repo-label:update
|
|
837
1259
|
* @throws {Error} When server returns 5xx status codes
|
|
838
1260
|
*/
|
|
839
1261
|
updateRepositoryLabel(orgSlug: string, labelId: string, labelData: QueryParams): Promise<RepositoryLabelResult | StrictErrorResult>;
|
|
840
|
-
/**
|
|
841
|
-
* Update organization's security policy configuration.* Modifies alert rules, severity thresholds, and enforcement settings.
|
|
842
|
-
*
|
|
843
|
-
* @throws {Error} When server returns 5xx status codes
|
|
844
|
-
*/
|
|
845
|
-
updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise<SocketSdkResult<'updateOrgSecurityPolicy'>>;
|
|
846
1262
|
/**
|
|
847
1263
|
* Upload manifest files for dependency analysis.
|
|
848
1264
|
* Processes package files to create dependency snapshots and security analysis.
|
|
@@ -857,167 +1273,4 @@ export declare class SocketSdk {
|
|
|
857
1273
|
* vulnerabilities, description, license, and tier information.
|
|
858
1274
|
*/
|
|
859
1275
|
viewPatch(orgSlug: string, uuid: string): Promise<PatchViewResponse>;
|
|
860
|
-
/**
|
|
861
|
-
* Download patch file content by hash.
|
|
862
|
-
*
|
|
863
|
-
* Downloads the actual patched file content from the public Socket blob store.
|
|
864
|
-
* This is used after calling viewPatch() to get the patch metadata.
|
|
865
|
-
* No authentication is required as patch blobs are publicly accessible.
|
|
866
|
-
*
|
|
867
|
-
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
868
|
-
* @param options - Optional configuration
|
|
869
|
-
* @param options.baseUrl - Override blob store URL (for testing)
|
|
870
|
-
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
871
|
-
* @throws Error if blob not found (404) or download fails
|
|
872
|
-
*
|
|
873
|
-
* @example
|
|
874
|
-
* ```typescript
|
|
875
|
-
* const sdk = new SocketSdk('your-api-token')
|
|
876
|
-
* // First get patch metadata
|
|
877
|
-
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
878
|
-
* // Then download the actual patched file
|
|
879
|
-
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
880
|
-
* ```
|
|
881
|
-
*/
|
|
882
|
-
downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise<SocketSdkResult<'downloadOrgFullScanFilesAsTar'>>;
|
|
883
|
-
/**
|
|
884
|
-
* Download patch file content from Socket blob storage.
|
|
885
|
-
* Retrieves patched file contents using SSRI hash or hex hash.
|
|
886
|
-
*
|
|
887
|
-
* This is a low-level utility method - you'll typically use this after calling
|
|
888
|
-
* `viewPatch()` to get patch metadata, then download individual patched files.
|
|
889
|
-
*
|
|
890
|
-
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
891
|
-
* @param options - Optional configuration
|
|
892
|
-
* @param options.baseUrl - Override blob store URL (for testing)
|
|
893
|
-
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
894
|
-
* @throws Error if blob not found (404) or download fails
|
|
895
|
-
*
|
|
896
|
-
* @example
|
|
897
|
-
* ```typescript
|
|
898
|
-
* const sdk = new SocketSdk('your-api-token')
|
|
899
|
-
* // First get patch metadata
|
|
900
|
-
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
901
|
-
* // Then download the actual patched file
|
|
902
|
-
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
903
|
-
* ```
|
|
904
|
-
*/
|
|
905
|
-
downloadPatch(hash: string, options?: {
|
|
906
|
-
baseUrl?: string;
|
|
907
|
-
}): Promise<string>;
|
|
908
|
-
/**
|
|
909
|
-
* Update organization's telemetry configuration.
|
|
910
|
-
* Enables or disables telemetry for the organization.
|
|
911
|
-
*
|
|
912
|
-
* @param orgSlug - Organization identifier
|
|
913
|
-
* @param telemetryData - Telemetry configuration with enabled flag
|
|
914
|
-
* @returns Updated telemetry configuration
|
|
915
|
-
*
|
|
916
|
-
* @throws {Error} When server returns 5xx status codes
|
|
917
|
-
*/
|
|
918
|
-
updateOrgTelemetryConfig(orgSlug: string, telemetryData: {
|
|
919
|
-
enabled?: boolean | undefined;
|
|
920
|
-
}): Promise<SocketSdkResult<'updateOrgTelemetryConfig'>>;
|
|
921
|
-
/**
|
|
922
|
-
* Get organization's telemetry configuration.
|
|
923
|
-
* Returns whether telemetry is enabled for the organization.
|
|
924
|
-
*
|
|
925
|
-
* @param orgSlug - Organization identifier
|
|
926
|
-
* @returns Telemetry configuration with enabled status
|
|
927
|
-
*
|
|
928
|
-
* @throws {Error} When server returns 5xx status codes
|
|
929
|
-
*/
|
|
930
|
-
getOrgTelemetryConfig(orgSlug: string): Promise<SocketSdkResult<'getOrgTelemetryConfig'>>;
|
|
931
|
-
/**
|
|
932
|
-
* Post telemetry data for an organization.
|
|
933
|
-
* Sends telemetry events and analytics data for monitoring and analysis.
|
|
934
|
-
*
|
|
935
|
-
* @param orgSlug - Organization identifier
|
|
936
|
-
* @param telemetryData - Telemetry payload containing events and metrics
|
|
937
|
-
* @returns Empty object on successful submission
|
|
938
|
-
*
|
|
939
|
-
* @throws {Error} When server returns 5xx status codes
|
|
940
|
-
*/
|
|
941
|
-
postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise<SocketSdkGenericResult<PostOrgTelemetryResponse>>;
|
|
942
|
-
/**
|
|
943
|
-
* Create a new webhook for an organization.
|
|
944
|
-
* Webhooks allow you to receive HTTP POST notifications when specific events occur.
|
|
945
|
-
*
|
|
946
|
-
* @param orgSlug - Organization identifier
|
|
947
|
-
* @param webhookData - Webhook configuration including name, URL, secret, and events
|
|
948
|
-
* @returns Created webhook details including webhook ID
|
|
949
|
-
*
|
|
950
|
-
* @throws {Error} When server returns 5xx status codes
|
|
951
|
-
*/
|
|
952
|
-
createOrgWebhook(orgSlug: string, webhookData: {
|
|
953
|
-
description?: null | string | undefined;
|
|
954
|
-
events: string[];
|
|
955
|
-
filters?: {
|
|
956
|
-
repositoryIds: null | string[];
|
|
957
|
-
} | null | undefined;
|
|
958
|
-
headers?: null | Record<string, unknown> | undefined;
|
|
959
|
-
name: string;
|
|
960
|
-
secret: string;
|
|
961
|
-
url: string;
|
|
962
|
-
}): Promise<SocketSdkResult<'createOrgWebhook'>>;
|
|
963
|
-
/**
|
|
964
|
-
* Delete a webhook from an organization.
|
|
965
|
-
* This will stop all future webhook deliveries to the webhook URL.
|
|
966
|
-
*
|
|
967
|
-
* @param orgSlug - Organization identifier
|
|
968
|
-
* @param webhookId - Webhook ID to delete
|
|
969
|
-
* @returns Success status
|
|
970
|
-
*
|
|
971
|
-
* @throws {Error} When server returns 5xx status codes
|
|
972
|
-
*/
|
|
973
|
-
deleteOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'deleteOrgWebhook'>>;
|
|
974
|
-
/**
|
|
975
|
-
* Get details of a specific webhook.
|
|
976
|
-
* Returns webhook configuration including events, URL, and filters.
|
|
977
|
-
*
|
|
978
|
-
* @param orgSlug - Organization identifier
|
|
979
|
-
* @param webhookId - Webhook ID to retrieve
|
|
980
|
-
* @returns Webhook details
|
|
981
|
-
*
|
|
982
|
-
* @throws {Error} When server returns 5xx status codes
|
|
983
|
-
*/
|
|
984
|
-
getOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'getOrgWebhook'>>;
|
|
985
|
-
/**
|
|
986
|
-
* List all webhooks for an organization.
|
|
987
|
-
* Supports pagination and sorting options.
|
|
988
|
-
*
|
|
989
|
-
* @param orgSlug - Organization identifier
|
|
990
|
-
* @param options - Optional query parameters for pagination and sorting
|
|
991
|
-
* @returns List of webhooks with pagination info
|
|
992
|
-
*
|
|
993
|
-
* @throws {Error} When server returns 5xx status codes
|
|
994
|
-
*/
|
|
995
|
-
getOrgWebhooksList(orgSlug: string, options?: {
|
|
996
|
-
direction?: string | undefined;
|
|
997
|
-
page?: number | undefined;
|
|
998
|
-
per_page?: number | undefined;
|
|
999
|
-
sort?: string | undefined;
|
|
1000
|
-
}): Promise<SocketSdkResult<'getOrgWebhooksList'>>;
|
|
1001
|
-
/**
|
|
1002
|
-
* Update an existing webhook's configuration.
|
|
1003
|
-
* All fields are optional - only provided fields will be updated.
|
|
1004
|
-
*
|
|
1005
|
-
* @param orgSlug - Organization identifier
|
|
1006
|
-
* @param webhookId - Webhook ID to update
|
|
1007
|
-
* @param webhookData - Updated webhook configuration
|
|
1008
|
-
* @returns Updated webhook details
|
|
1009
|
-
*
|
|
1010
|
-
* @throws {Error} When server returns 5xx status codes
|
|
1011
|
-
*/
|
|
1012
|
-
updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: {
|
|
1013
|
-
description?: null | string | undefined;
|
|
1014
|
-
events?: string[] | undefined;
|
|
1015
|
-
filters?: {
|
|
1016
|
-
repositoryIds: null | string[];
|
|
1017
|
-
} | null | undefined;
|
|
1018
|
-
headers?: null | Record<string, unknown> | undefined;
|
|
1019
|
-
name?: string | undefined;
|
|
1020
|
-
secret?: null | string | undefined;
|
|
1021
|
-
url?: string | undefined;
|
|
1022
|
-
}): Promise<SocketSdkResult<'updateOrgWebhook'>>;
|
|
1023
1276
|
}
|