@socketsecurity/sdk 1.11.0 → 1.11.2
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 +18 -0
- package/README.md +153 -312
- package/dist/constants.js +23 -117
- package/dist/file-upload.js +118 -127
- package/dist/http-client.d.ts +3 -0
- package/dist/http-client.js +269 -211
- package/dist/index.js +43 -48
- package/dist/package.json.js +207 -0
- package/dist/quota-utils.d.ts +13 -6
- package/dist/quota-utils.js +128 -105
- package/dist/socket-sdk-class.js +1488 -1430
- package/dist/testing.d.ts +453 -0
- package/dist/testing.js +387 -0
- package/dist/user-agent.js +11 -7
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +68 -60
- package/package.json +47 -31
- package/requirements.json +2 -2
- package/types/api-helpers.d.ts +5 -0
- package/dist/promise-queue.js +0 -91
- package/dist/types.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [1.11.2](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.2) - 2025-10-07
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Fixed typos in requirements.json
|
|
11
|
+
- Updated @socketsecurity/registry to fix bugs related to inlined runtime-dependent expressions
|
|
12
|
+
|
|
13
|
+
## [1.11.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.1) - 2025-10-06
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Performance optimizations with memoization for `normalizeBaseUrl` and quota utility functions
|
|
17
|
+
- Performance tracking to HTTP client functions
|
|
18
|
+
- Comprehensive error handling tests for SDK methods across organization, scanning, and batch APIs
|
|
19
|
+
- Reusable assertion helpers for SDK tests
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- Improved test coverage and reliability with additional test cases
|
|
23
|
+
- Streamlined documentation (README, TESTING.md, QUOTA.md, EXAMPLES.md) for better clarity and discoverability
|
|
24
|
+
|
|
7
25
|
## [1.11.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.0) - 2025-10-04
|
|
8
26
|
|
|
9
27
|
### Added
|
package/README.md
CHANGED
|
@@ -6,343 +6,184 @@
|
|
|
6
6
|
[](https://twitter.com/SocketSecurity)
|
|
7
7
|
[](https://bsky.app/profile/socket.dev)
|
|
8
8
|
|
|
9
|
-
Official SDK for Socket.dev - Programmatic access to security analysis, vulnerability scanning, and compliance monitoring for your software supply chain.
|
|
9
|
+
Official SDK for [Socket.dev](https://socket.dev/) - Programmatic access to security analysis, vulnerability scanning, and compliance monitoring for your software supply chain.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
pnpm add @socketsecurity/sdk
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Quick Start
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```typescript
|
|
20
20
|
import { SocketSdk } from '@socketsecurity/sdk'
|
|
21
21
|
|
|
22
|
-
const client = new SocketSdk('
|
|
23
|
-
retries: 3, // Retry failed requests up to 3 times
|
|
24
|
-
retryDelay: 1000, // Start with 1s delay, exponential backoff
|
|
25
|
-
timeout: 30000, //
|
|
22
|
+
const client = new SocketSdk('your-api-key', {
|
|
23
|
+
retries: 3, // Retry failed requests up to 3 times
|
|
24
|
+
retryDelay: 1000, // Start with 1s delay, exponential backoff
|
|
25
|
+
timeout: 30000, // 30 second timeout
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
// Check your quota
|
|
29
|
+
const quota = await client.getQuota()
|
|
30
|
+
if (quota.success) {
|
|
31
|
+
console.log(`Available quota: ${quota.data.quota} units`)
|
|
32
|
+
}
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
// Analyze a package
|
|
35
|
+
const result = await client.getScoreByNpmPackage('express', '4.18.0')
|
|
36
|
+
if (result.success) {
|
|
37
|
+
console.log(`Security Score: ${result.data.score}/100`)
|
|
33
38
|
}
|
|
39
|
+
|
|
40
|
+
// Batch analyze multiple packages
|
|
41
|
+
const batchResult = await client.batchPackageFetch({
|
|
42
|
+
components: [
|
|
43
|
+
{ purl: 'pkg:npm/express@4.18.0' },
|
|
44
|
+
{ purl: 'pkg:npm/react@18.0.0' }
|
|
45
|
+
]
|
|
46
|
+
})
|
|
34
47
|
```
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
**[→ Configuration Options](./docs/API.md#configuration)**
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
## API Methods
|
|
39
52
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
baseUrl?: string // API base URL (default: 'https://api.socket.dev/v0/')
|
|
43
|
-
timeout?: number // Request timeout in milliseconds
|
|
44
|
-
retries?: number // Number of retry attempts for failed requests (default: 0, disabled)
|
|
45
|
-
retryDelay?: number // Initial retry delay in ms, with exponential backoff (default: 100)
|
|
46
|
-
userAgent?: string // Custom user agent string
|
|
47
|
-
agent?: Agent // Custom HTTP agent for advanced networking
|
|
48
|
-
}
|
|
49
|
-
```
|
|
53
|
+
<details>
|
|
54
|
+
<summary><strong>Package Analysis</strong> - Quick security checks</summary>
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
- **Disabled by default** (opt-in pattern following Node.js fs.rm() convention)
|
|
53
|
-
- Set `retries: 3` (recommended for production) to enable automatic retries
|
|
54
|
-
- Retries transient network errors and 5xx server responses
|
|
55
|
-
- Uses exponential backoff: 100ms, 200ms, 400ms, 800ms... (configurable via `retryDelay`)
|
|
56
|
-
- Does NOT retry 401/403 authentication errors (immediate failure)
|
|
57
|
-
|
|
58
|
-
### Quota Management Example
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
import {
|
|
62
|
-
SocketSdk,
|
|
63
|
-
getQuotaCost,
|
|
64
|
-
calculateTotalQuotaCost,
|
|
65
|
-
hasQuotaForMethods
|
|
66
|
-
} from '@socketsecurity/sdk'
|
|
67
|
-
|
|
68
|
-
const client = new SocketSdk('your-api-key')
|
|
69
|
-
|
|
70
|
-
// Check quota cost before making API calls
|
|
71
|
-
const batchCost = getQuotaCost('batchPackageFetch') // Returns: 100
|
|
72
|
-
const analyticsCost = getQuotaCost('getOrgAnalytics') // Returns: 10
|
|
73
|
-
|
|
74
|
-
// Calculate total cost for multiple operations
|
|
75
|
-
const operations = ['batchPackageFetch', 'getOrgAnalytics', 'uploadManifestFiles']
|
|
76
|
-
const totalCost = calculateTotalQuotaCost(operations) // Returns: 210
|
|
77
|
-
|
|
78
|
-
// Check if you have sufficient quota
|
|
79
|
-
const quotaRes = await client.getQuota()
|
|
80
|
-
if (quotaRes.success && hasQuotaForMethods(quotaRes.data.quota, operations)) {
|
|
81
|
-
// Proceed with API calls
|
|
82
|
-
console.log(`Sufficient quota available: ${quotaRes.data.quota} units`)
|
|
83
|
-
} else {
|
|
84
|
-
console.log('Insufficient quota - consider using free alternatives')
|
|
85
|
-
}
|
|
86
|
-
```
|
|
56
|
+
`batchPackageFetch()` • `batchPackageStream()` • `getIssuesByNpmPackage()` • `getScoreByNpmPackage()`
|
|
87
57
|
|
|
88
|
-
|
|
58
|
+
[→ Documentation](./docs/API.md#package-analysis)
|
|
59
|
+
</details>
|
|
89
60
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
```
|
|
61
|
+
<details>
|
|
62
|
+
<summary><strong>Scanning & Analysis</strong> - Project scanning</summary>
|
|
93
63
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
The Socket SDK provides programmatic access to Socket.dev's security analysis platform through 60+ API methods organized into functional categories:
|
|
97
|
-
|
|
98
|
-
### Package Analysis
|
|
99
|
-
- **Package Security**: Get vulnerability reports, security scores, and issue details for npm packages
|
|
100
|
-
- **Batch Processing**: Analyze multiple packages efficiently with streaming and concurrent processing
|
|
101
|
-
- **PURL Support**: Process Package URLs for comprehensive package identification
|
|
102
|
-
|
|
103
|
-
### Organization Management
|
|
104
|
-
- **Organizations**: List, manage, and configure organization settings
|
|
105
|
-
- **Repositories**: Create, update, and delete organization repositories
|
|
106
|
-
- **Labels**: Manage repository categorization and tagging systems
|
|
107
|
-
|
|
108
|
-
### Security Scanning & Analysis
|
|
109
|
-
- **Full Scans**: Create comprehensive security scans from manifest files
|
|
110
|
-
- **Diff Scans**: Compare scans to identify changes and new vulnerabilities
|
|
111
|
-
- **Dependencies**: Upload and analyze project dependency files
|
|
112
|
-
- **Reports**: Generate, retrieve, and manage detailed security reports
|
|
113
|
-
|
|
114
|
-
### Policy & Compliance
|
|
115
|
-
- **Security Policies**: Configure and update organization security policies
|
|
116
|
-
- **License Policies**: Manage allowed/restricted license types
|
|
117
|
-
- **Alert Triage**: Review and manage security alert statuses
|
|
118
|
-
- **Audit Logs**: Access chronological security and administrative events
|
|
119
|
-
|
|
120
|
-
### Data Export & Integration
|
|
121
|
-
- **SBOM Export**: Generate CycloneDX and SPDX Software Bill of Materials
|
|
122
|
-
- **Streaming**: Efficient data streaming for large datasets
|
|
123
|
-
- **Analytics**: Access usage metrics and security trend data
|
|
124
|
-
|
|
125
|
-
### Authentication & Access
|
|
126
|
-
- **API Tokens**: Create, rotate, update, and revoke organization API tokens
|
|
127
|
-
- **Entitlements**: View enabled Socket products and features
|
|
128
|
-
- **Quota Management**: Monitor API usage limits, quotas, and plan method calls
|
|
129
|
-
- **Quota Utilities**: Pre-calculate costs, check permissions, and optimize API usage
|
|
130
|
-
|
|
131
|
-
### Advanced Features
|
|
132
|
-
- **Patches**: View and stream security patches for vulnerabilities
|
|
133
|
-
- **Custom Queries**: Raw API access with configurable response handling
|
|
134
|
-
- **Cross-platform**: Full Windows, macOS, and Linux compatibility
|
|
135
|
-
|
|
136
|
-
## SocketSdk Methods
|
|
137
|
-
|
|
138
|
-
### Package Analysis Methods
|
|
139
|
-
|
|
140
|
-
* `batchPackageFetch(componentsObj, queryParams?)` - Analyze multiple packages in batch
|
|
141
|
-
* Returns all results at once after processing is complete
|
|
142
|
-
* `batchPackageStream(componentsObj, options?)` - Stream package analysis with concurrency control
|
|
143
|
-
* Returns results as they become available via async generator
|
|
144
|
-
* `getIssuesByNpmPackage(packageName, version)` - Get security issues for a specific npm package
|
|
145
|
-
* Returns detailed vulnerability and security alert information
|
|
146
|
-
* `getScoreByNpmPackage(packageName, version)` - Get security score for a package
|
|
147
|
-
* Returns numerical security rating and scoring breakdown
|
|
148
|
-
|
|
149
|
-
### Scanning & Analysis Methods
|
|
150
|
-
|
|
151
|
-
* `createDependenciesSnapshot(filepaths, pathsRelativeTo='.', queryParams?)` - Create dependency snapshot
|
|
152
|
-
* Analyzes dependency files to generate comprehensive security report
|
|
153
|
-
* `createOrgFullScan(orgSlug, filepaths, pathsRelativeTo='.', queryParams?)` - Create full organization scan
|
|
154
|
-
* Uploads project files and initiates complete security analysis
|
|
155
|
-
* `createScanFromFilepaths(filePaths, pathsRelativeTo='.', issueRules?)` - Create security scan from files
|
|
156
|
-
* Analyzes uploaded files for security vulnerabilities and policy violations
|
|
157
|
-
* `getScan(id)` - Get detailed scan results
|
|
158
|
-
* Returns complete scan analysis including vulnerabilities and alerts
|
|
159
|
-
* `getScanList()` - List all accessible scans
|
|
160
|
-
* Returns paginated list of scan metadata and status
|
|
161
|
-
* `getSupportedScanFiles()` - Get supported file formats
|
|
162
|
-
* Returns supported manifest files, lockfiles, and configuration formats
|
|
163
|
-
|
|
164
|
-
### Organization Management Methods
|
|
165
|
-
|
|
166
|
-
* `createOrgRepo(orgSlug, queryParams?)` - Create new repository
|
|
167
|
-
* Registers repository for monitoring and security scanning
|
|
168
|
-
* `deleteOrgRepo(orgSlug, repoSlug)` - Delete repository
|
|
169
|
-
* Removes repository monitoring and associated scan data
|
|
170
|
-
* `getOrganizations()` - List accessible organizations
|
|
171
|
-
* Returns organization details and access permissions
|
|
172
|
-
* `getOrgRepo(orgSlug, repoSlug)` - Get repository details
|
|
173
|
-
* Returns repository configuration, monitoring status, and metadata
|
|
174
|
-
* `getOrgRepoList(orgSlug, queryParams?)` - List organization repositories
|
|
175
|
-
* Returns paginated list of repository metadata and status
|
|
176
|
-
* `updateOrgRepo(orgSlug, repoSlug, queryParams?)` - Update repository configuration
|
|
177
|
-
* Modifies monitoring settings, branch configuration, and scan preferences
|
|
178
|
-
|
|
179
|
-
### Full Scan Management Methods
|
|
180
|
-
|
|
181
|
-
* `deleteOrgFullScan(orgSlug, fullScanId)` - Delete full scan
|
|
182
|
-
* Permanently removes scan data and results
|
|
183
|
-
* `getOrgFullScanBuffered(orgSlug, fullScanId)` - Get complete scan results in memory
|
|
184
|
-
* Returns entire scan data as JSON for programmatic processing
|
|
185
|
-
* `getOrgFullScanList(orgSlug, queryParams?)` - List organization full scans
|
|
186
|
-
* Returns paginated list of scan metadata and status
|
|
187
|
-
* `getOrgFullScanMetadata(orgSlug, fullScanId)` - Get scan metadata
|
|
188
|
-
* Returns scan configuration, status, and summary information
|
|
189
|
-
* `streamOrgFullScan(orgSlug, fullScanId, output?)` - Stream scan results
|
|
190
|
-
* Provides efficient streaming for large scan datasets to file or stdout
|
|
191
|
-
|
|
192
|
-
### Policy & Settings Methods
|
|
193
|
-
|
|
194
|
-
* `getOrgLicensePolicy(orgSlug)` - Get license policy configuration
|
|
195
|
-
* Returns allowed, restricted, and monitored license types
|
|
196
|
-
* `getOrgSecurityPolicy(orgSlug)` - Get organization security policy
|
|
197
|
-
* Returns alert rules, severity thresholds, and enforcement settings
|
|
198
|
-
* `postSettings(selectors)` - Update user or organization settings
|
|
199
|
-
* Configures preferences, notifications, and security policies
|
|
200
|
-
* `updateOrgLicensePolicy(orgSlug, policyData, queryParams?)` - Update license policy
|
|
201
|
-
* Modifies allowed, restricted, and monitored license types
|
|
202
|
-
* `updateOrgSecurityPolicy(orgSlug, policyData)` - Update security policy
|
|
203
|
-
* Modifies alert rules, severity thresholds, and enforcement settings
|
|
204
|
-
|
|
205
|
-
### Analytics & Monitoring Methods
|
|
206
|
-
|
|
207
|
-
* `getAuditLogEvents(orgSlug, queryParams?)` - Get audit log events
|
|
208
|
-
* Returns chronological log of security and administrative actions
|
|
209
|
-
* `getOrgAnalytics(time)` - Get organization analytics
|
|
210
|
-
* Returns statistical analysis for specified time period
|
|
211
|
-
* `getQuota()` - Get current API quota usage
|
|
212
|
-
* Returns remaining requests, rate limits, and quota reset times
|
|
213
|
-
|
|
214
|
-
### Quota Utility Functions
|
|
215
|
-
* `getQuotaCost(methodName)` - Get quota cost for any SDK method
|
|
216
|
-
* `getRequiredPermissions(methodName)` - Get required permissions for SDK method
|
|
217
|
-
* `calculateTotalQuotaCost(methodNames[])` - Calculate total cost for multiple methods
|
|
218
|
-
* `hasQuotaForMethods(availableQuota, methodNames[])` - Check if quota is sufficient
|
|
219
|
-
* `getMethodsByQuotaCost(cost)` - Find methods by quota cost (0, 10, 100 units)
|
|
220
|
-
* `getMethodsByPermissions(permissions[])` - Find methods requiring specific permissions
|
|
221
|
-
* `getQuotaUsageSummary()` - Get summary of all methods grouped by quota cost
|
|
222
|
-
* `getAllMethodRequirements()` - Get complete mapping of methods to costs and permissions
|
|
223
|
-
* `getRepoAnalytics(repo, time)` - Get repository analytics
|
|
224
|
-
* Returns security metrics, dependency trends, and vulnerability statistics
|
|
225
|
-
|
|
226
|
-
### Authentication & Access Methods
|
|
227
|
-
|
|
228
|
-
* `getAPITokens(orgSlug)` - List organization API tokens
|
|
229
|
-
* Returns organization API tokens with metadata and permissions
|
|
230
|
-
* `postAPIToken(orgSlug, tokenData)` - Create new API token
|
|
231
|
-
* Generates API token with specified scopes and metadata
|
|
232
|
-
* `postAPITokensRevoke(orgSlug, tokenId)` - Revoke API token
|
|
233
|
-
* Permanently disables the token and removes access
|
|
234
|
-
* `postAPITokensRotate(orgSlug, tokenId)` - Rotate API token
|
|
235
|
-
* Generates new token value while preserving token metadata
|
|
236
|
-
* `postAPITokenUpdate(orgSlug, tokenId, updateData)` - Update API token
|
|
237
|
-
* Modifies token metadata, scopes, or other properties
|
|
238
|
-
|
|
239
|
-
### Export & Integration Methods
|
|
240
|
-
|
|
241
|
-
* `exportCDX(orgSlug, fullScanId)` - Export CycloneDX SBOM
|
|
242
|
-
* Returns Software Bill of Materials compliant with CycloneDX standard
|
|
243
|
-
* `exportSPDX(orgSlug, fullScanId)` - Export SPDX SBOM
|
|
244
|
-
* Returns Software Bill of Materials compliant with SPDX standard
|
|
245
|
-
* `searchDependencies(queryParams?)` - Search monitored dependencies
|
|
246
|
-
* Returns matching packages with security information and usage patterns
|
|
247
|
-
* `uploadManifestFiles(orgSlug, filepaths, pathsRelativeTo='.')` - Upload manifest files
|
|
248
|
-
* Processes package files to create dependency snapshots and security analysis
|
|
249
|
-
|
|
250
|
-
### Alert & Triage Methods
|
|
251
|
-
|
|
252
|
-
* `getOrgTriage(orgSlug)` - Get organization triage settings
|
|
253
|
-
* Returns alert triage configuration and current state
|
|
254
|
-
* `updateOrgAlertTriage(orgSlug, alertId, triageData)` - Update alert triage
|
|
255
|
-
* Modifies alert resolution status and triage decisions
|
|
256
|
-
|
|
257
|
-
### Repository Label Methods
|
|
258
|
-
|
|
259
|
-
* `createOrgRepoLabel(orgSlug, repoSlug, labelData)` - Create repository label
|
|
260
|
-
* Adds label for repository categorization and management
|
|
261
|
-
* `deleteOrgRepoLabel(orgSlug, repoSlug, labelSlug)` - Delete repository label
|
|
262
|
-
* Removes label and associated configuration
|
|
263
|
-
* `getOrgRepoLabel(orgSlug, repoSlug, labelSlug)` - Get label details
|
|
264
|
-
* Returns label configuration and metadata
|
|
265
|
-
* `getOrgRepoLabelList(orgSlug, repoSlug)` - List repository labels
|
|
266
|
-
* Returns all labels configured for repository management
|
|
267
|
-
* `updateOrgRepoLabel(orgSlug, repoSlug, labelSlug, labelData)` - Update repository label
|
|
268
|
-
* Modifies label properties and configuration
|
|
269
|
-
|
|
270
|
-
### Diff Scan Methods
|
|
271
|
-
|
|
272
|
-
* `createOrgDiffScanFromIds(orgSlug, queryParams?)` - Create diff scan from IDs
|
|
273
|
-
* Compares two existing full scans to identify changes
|
|
274
|
-
* `deleteOrgDiffScan(orgSlug, diffScanId)` - Delete diff scan
|
|
275
|
-
* Permanently removes diff scan data and results
|
|
276
|
-
* `getDiffScanById(orgSlug, diffScanId)` - Get diff scan details
|
|
277
|
-
* Returns comparison between two full scans with artifact changes
|
|
278
|
-
* `listOrgDiffScans(orgSlug)` - List organization diff scans
|
|
279
|
-
* Returns paginated list of diff scan metadata and status
|
|
280
|
-
|
|
281
|
-
### Patch & Vulnerability Methods
|
|
282
|
-
|
|
283
|
-
* `streamPatchesFromScan(orgSlug, scanId)` - Stream patches from scan
|
|
284
|
-
* Returns ReadableStream for processing large patch datasets
|
|
285
|
-
* `viewPatch(orgSlug, uuid)` - View patch details
|
|
286
|
-
* Retrieves comprehensive patch information including files and vulnerabilities
|
|
287
|
-
|
|
288
|
-
### Entitlement Methods
|
|
289
|
-
|
|
290
|
-
* `getEnabledEntitlements(orgSlug)` - Get enabled entitlements
|
|
291
|
-
* Returns array of enabled Socket product keys
|
|
292
|
-
* `getEntitlements(orgSlug)` - Get all organization entitlements
|
|
293
|
-
* Returns complete list of entitlements with their status
|
|
294
|
-
|
|
295
|
-
### Advanced Query Methods
|
|
296
|
-
|
|
297
|
-
* `getApi<T>(urlPath, options?)` - Execute raw GET request
|
|
298
|
-
* Direct API access with configurable response type (response, json, text)
|
|
299
|
-
* `sendApi<T>(urlPath, options?)` - Send POST/PUT with JSON body
|
|
300
|
-
* Direct API access for POST/PUT operations with JSON responses
|
|
301
|
-
|
|
302
|
-
### Legacy Methods (Deprecated Names)
|
|
303
|
-
|
|
304
|
-
* `createReportFromFilepaths()` → Use `createScanFromFilepaths()`
|
|
305
|
-
* `deleteReport(reportId)` → Use scan-specific delete methods
|
|
306
|
-
* `getReport(id)` → Use `getScan(id)`
|
|
307
|
-
* `getReportList()` → Use `getScanList()`
|
|
308
|
-
* `getReportSupportedFiles()` → Use `getSupportedScanFiles()`
|
|
309
|
-
|
|
310
|
-
## Additional exports
|
|
311
|
-
|
|
312
|
-
* `createUserAgentFromPkgJson(pkgJson)`
|
|
313
|
-
* `pkgJson`: The content of the `package.json` you want to create a `User-Agent` string for
|
|
314
|
-
|
|
315
|
-
## Advanced
|
|
316
|
-
|
|
317
|
-
### Specifying custom user agent
|
|
318
|
-
|
|
319
|
-
The `SocketSdk` constructor accepts an `options` object as its second argument and there a `userAgent` key with a string value can be specified. If specified then that user agent will be prepended to the SDK user agent. See this example:
|
|
320
|
-
|
|
321
|
-
```js
|
|
322
|
-
const client = new SocketSdk('yourApiKeyHere', {
|
|
323
|
-
userAgent: 'example/1.2.3 (http://example.com/)'
|
|
324
|
-
})
|
|
325
|
-
```
|
|
64
|
+
`createDependenciesSnapshot()` • `createOrgFullScan()` • `createScanFromFilepaths()` • `getScan()` • `getScanList()` • `getSupportedScanFiles()`
|
|
326
65
|
|
|
327
|
-
|
|
66
|
+
[→ Documentation](./docs/API.md#scanning--analysis)
|
|
67
|
+
</details>
|
|
328
68
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
```
|
|
69
|
+
<details>
|
|
70
|
+
<summary><strong>Organization Management</strong> - Orgs and repos</summary>
|
|
332
71
|
|
|
333
|
-
|
|
72
|
+
`getOrganizations()` • `createOrgRepo()` • `getOrgRepo()` • `getOrgRepoList()` • `updateOrgRepo()` • `deleteOrgRepo()`
|
|
334
73
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
74
|
+
[→ Documentation](./docs/API.md#organization-management)
|
|
75
|
+
</details>
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary><strong>Policy & Settings</strong> - Security configuration</summary>
|
|
79
|
+
|
|
80
|
+
`getOrgSecurityPolicy()` • `updateOrgSecurityPolicy()` • `getOrgLicensePolicy()` • `updateOrgLicensePolicy()` • `postSettings()`
|
|
81
|
+
|
|
82
|
+
[→ Documentation](./docs/API.md#policy--settings)
|
|
83
|
+
</details>
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary><strong>Full Scan Management</strong> - Deep analysis</summary>
|
|
87
|
+
|
|
88
|
+
`getOrgFullScanList()` • `getOrgFullScanMetadata()` • `getOrgFullScanBuffered()` • `streamOrgFullScan()` • `deleteOrgFullScan()`
|
|
89
|
+
|
|
90
|
+
[→ Documentation](./docs/API.md#full-scan-management)
|
|
91
|
+
</details>
|
|
92
|
+
|
|
93
|
+
<details>
|
|
94
|
+
<summary><strong>Diff Scans</strong> - Compare scans</summary>
|
|
95
|
+
|
|
96
|
+
`createOrgDiffScanFromIds()` • `getDiffScanById()` • `listOrgDiffScans()` • `deleteOrgDiffScan()`
|
|
97
|
+
|
|
98
|
+
[→ Documentation](./docs/API.md#diff-scans)
|
|
99
|
+
</details>
|
|
100
|
+
|
|
101
|
+
<details>
|
|
102
|
+
<summary><strong>Patches & Vulnerabilities</strong> - Security fixes</summary>
|
|
103
|
+
|
|
104
|
+
`streamPatchesFromScan()` • `viewPatch()`
|
|
105
|
+
|
|
106
|
+
[→ Documentation](./docs/API.md#patches--vulnerabilities)
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary><strong>Alert & Triage</strong> - Alert management</summary>
|
|
111
|
+
|
|
112
|
+
`getOrgTriage()` • `updateOrgAlertTriage()`
|
|
113
|
+
|
|
114
|
+
[→ Documentation](./docs/API.md#alert--triage)
|
|
115
|
+
</details>
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary><strong>Export & Integration</strong> - SBOM export</summary>
|
|
119
|
+
|
|
120
|
+
`exportCDX()` • `exportSPDX()` • `searchDependencies()` • `uploadManifestFiles()`
|
|
121
|
+
|
|
122
|
+
[→ Documentation](./docs/API.md#export--integration)
|
|
123
|
+
</details>
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary><strong>Repository Labels</strong> - Categorization</summary>
|
|
127
|
+
|
|
128
|
+
`createOrgRepoLabel()` • `getOrgRepoLabel()` • `getOrgRepoLabelList()` • `updateOrgRepoLabel()` • `deleteOrgRepoLabel()`
|
|
129
|
+
|
|
130
|
+
[→ Documentation](./docs/API.md#repository-labels)
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
<details>
|
|
134
|
+
<summary><strong>Analytics & Monitoring</strong> - Usage metrics</summary>
|
|
135
|
+
|
|
136
|
+
`getQuota()` • `getOrgAnalytics()` • `getRepoAnalytics()` • `getAuditLogEvents()`
|
|
137
|
+
|
|
138
|
+
[→ Documentation](./docs/API.md#analytics--monitoring)
|
|
139
|
+
</details>
|
|
140
|
+
|
|
141
|
+
<details>
|
|
142
|
+
<summary><strong>Authentication & Access</strong> - API tokens</summary>
|
|
143
|
+
|
|
144
|
+
`getAPITokens()` • `postAPIToken()` • `postAPITokensRotate()` • `postAPITokensRevoke()` • `postAPITokenUpdate()`
|
|
145
|
+
|
|
146
|
+
[→ Documentation](./docs/API.md#authentication--access)
|
|
147
|
+
</details>
|
|
148
|
+
|
|
149
|
+
<details>
|
|
150
|
+
<summary><strong>Entitlements</strong> - Feature access</summary>
|
|
151
|
+
|
|
152
|
+
`getEnabledEntitlements()` • `getEntitlements()`
|
|
153
|
+
|
|
154
|
+
[→ Documentation](./docs/API.md#entitlements)
|
|
155
|
+
</details>
|
|
156
|
+
|
|
157
|
+
<details>
|
|
158
|
+
<summary><strong>Quota Utilities</strong> - Cost helpers</summary>
|
|
159
|
+
|
|
160
|
+
`getQuotaCost()` • `getRequiredPermissions()` • `calculateTotalQuotaCost()` • `hasQuotaForMethods()` • `getMethodsByQuotaCost()` • `getMethodsByPermissions()` • `getQuotaUsageSummary()` • `getAllMethodRequirements()`
|
|
161
|
+
|
|
162
|
+
[→ Documentation](./docs/QUOTA.md)
|
|
163
|
+
</details>
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><strong>Advanced Query Methods</strong> - Raw API</summary>
|
|
167
|
+
|
|
168
|
+
`getApi()` • `sendApi()`
|
|
169
|
+
|
|
170
|
+
[→ Documentation](./docs/API.md#advanced-query-methods)
|
|
171
|
+
</details>
|
|
172
|
+
|
|
173
|
+
**[→ Complete API Reference](./docs/API.md)**
|
|
174
|
+
|
|
175
|
+
**[→ Usage Examples](./docs/EXAMPLES.md)**
|
|
176
|
+
|
|
177
|
+
**[→ Quota Management](./docs/QUOTA.md)** - Cost tiers: 0 units (free), 10 units (standard), 100 units (batch/uploads)
|
|
178
|
+
|
|
179
|
+
**[→ Testing Utilities](./docs/TESTING.md)** - Mock factories, fixtures, and type guards for SDK testing
|
|
180
|
+
|
|
181
|
+
## See Also
|
|
340
182
|
|
|
341
|
-
|
|
183
|
+
- [Socket.dev API Reference](https://docs.socket.dev/reference) - Official API documentation
|
|
184
|
+
- [Socket CLI](https://github.com/SocketDev/socket-cli) - Command-line interface
|
|
185
|
+
- [Socket GitHub App](https://github.com/apps/socket-security) - GitHub integration
|
|
342
186
|
|
|
343
|
-
##
|
|
187
|
+
## License
|
|
344
188
|
|
|
345
|
-
|
|
346
|
-
* [Socket.dev](https://socket.dev/)
|
|
347
|
-
* [Socket GitHub App](https://github.com/apps/socket-security)
|
|
348
|
-
* [Socket CLI](https://github.com/SocketDev/socket-cli-js)
|
|
189
|
+
MIT
|