@socketsecurity/sdk 1.11.2 → 2.0.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 +37 -0
- package/README.md +53 -81
- package/dist/cacache-BCCSM36H.mjs +2 -0
- package/dist/chunk-3V7KNFWE.mjs +33 -0
- package/dist/chunk-LHGMBIJS.mjs +4 -0
- package/dist/chunk-UKECVIRQ.mjs +2 -0
- package/dist/constants.d.ts +8 -0
- package/dist/file-upload.d.ts +2 -2
- package/dist/http-client.d.ts +4 -2
- package/dist/index.mjs +35 -0
- package/dist/paths-NFJJ5RRD.mjs +2 -0
- package/dist/socket-sdk-class.d.ts +26 -1
- package/dist/testing.mjs +2 -0
- package/dist/types.d.ts +12 -6
- package/package.json +39 -81
- package/types/api-helpers.d.ts +61 -53
- package/types/api.d.ts +810 -899
- package/dist/constants.js +0 -30
- package/dist/file-upload.js +0 -142
- package/dist/http-client.js +0 -405
- package/dist/index.js +0 -47
- package/dist/package.json.js +0 -207
- package/dist/quota-utils.js +0 -175
- package/dist/socket-sdk-class.js +0 -1511
- package/dist/testing.js +0 -387
- package/dist/user-agent.js +0 -21
- package/dist/utils.js +0 -101
- package/requirements.json +0 -232
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,43 @@ 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
|
+
## [2.0.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.1) - 2025-10-21
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Use `@socketsecurity/lib` under the hood
|
|
11
|
+
- Synced OpenAPI type definitions with latest API specification
|
|
12
|
+
- Added documentation for `scan_type` query parameter on manifest upload endpoint (used for categorizing multiple SBOM heads per repository branch)
|
|
13
|
+
- Improved TypeScript helper types (`OpReturnType`, `OpErrorType`) for better type inference and error handling
|
|
14
|
+
|
|
15
|
+
## [2.0.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.0) - 2025-10-10
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **BREAKING**: Migrated to ESM-only module format
|
|
19
|
+
- Package is now ESM-only (`"type": "module"` in package.json)
|
|
20
|
+
- All output files use `.mjs` extension for JavaScript
|
|
21
|
+
- TypeScript declaration files use `.d.mts` extension
|
|
22
|
+
- CommonJS (`require()`) is no longer supported
|
|
23
|
+
- Simplified build process for ESM-only output
|
|
24
|
+
- Updated TypeScript configuration to use ESM module resolution
|
|
25
|
+
- Improved code splitting for better tree-shaking with ESM
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
- **BREAKING**: Removed CommonJS support and exports
|
|
29
|
+
- Removed CommonJS-specific build configurations
|
|
30
|
+
|
|
31
|
+
### Migration Guide
|
|
32
|
+
To migrate from v1.x to v2.0:
|
|
33
|
+
1. Ensure your project supports ESM modules (Node.js 14+ with `"type": "module"` or `.mjs` extensions)
|
|
34
|
+
2. Update imports from CommonJS `require()` to ESM `import` statements:
|
|
35
|
+
```javascript
|
|
36
|
+
// Before (v1.x)
|
|
37
|
+
const { SocketSdk } = require('@socketsecurity/sdk');
|
|
38
|
+
|
|
39
|
+
// After (v2.0)
|
|
40
|
+
import { SocketSdk } from '@socketsecurity/sdk';
|
|
41
|
+
```
|
|
42
|
+
3. If your project still requires CommonJS, consider staying on v1.x or using a transpiler
|
|
43
|
+
|
|
7
44
|
## [1.11.2](https://github.com/SocketDev/socket-sdk-js/releases/tag/v1.11.2) - 2025-10-07
|
|
8
45
|
|
|
9
46
|
### Fixed
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://twitter.com/SocketSecurity)
|
|
7
7
|
[](https://bsky.app/profile/socket.dev)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
JavaScript SDK for [Socket.dev](https://socket.dev/) API - Security analysis, vulnerability scanning, and compliance monitoring for software supply chains.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -14,6 +14,8 @@ Official SDK for [Socket.dev](https://socket.dev/) - Programmatic access to secu
|
|
|
14
14
|
pnpm add @socketsecurity/sdk
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
**Note:** Version 2.0+ is ESM-only. For CommonJS support, use version 1.x.
|
|
18
|
+
|
|
17
19
|
## Quick Start
|
|
18
20
|
|
|
19
21
|
```typescript
|
|
@@ -46,137 +48,107 @@ const batchResult = await client.batchPackageFetch({
|
|
|
46
48
|
})
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
**[→ Configuration
|
|
51
|
+
**[→ Configuration](./docs/guides/api-reference.md#configuration)**
|
|
50
52
|
|
|
51
53
|
## API Methods
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
<summary><strong>Package Analysis</strong> - Quick security checks</summary>
|
|
55
|
+
### Package Analysis
|
|
55
56
|
|
|
56
|
-
`batchPackageFetch()` • `batchPackageStream()` • `getIssuesByNpmPackage()` • `getScoreByNpmPackage()`
|
|
57
|
+
Quick security checks: `batchPackageFetch()` • `batchPackageStream()` • `getIssuesByNpmPackage()` • `getScoreByNpmPackage()`
|
|
57
58
|
|
|
58
|
-
[→ Documentation](./docs/
|
|
59
|
-
</details>
|
|
59
|
+
[→ Documentation](./docs/guides/api-reference.md#package-analysis)
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
<summary><strong>Scanning & Analysis</strong> - Project scanning</summary>
|
|
61
|
+
### Scanning & Analysis
|
|
63
62
|
|
|
64
|
-
`createDependenciesSnapshot()` • `createOrgFullScan()` • `createScanFromFilepaths()` • `getScan()` • `getScanList()` • `getSupportedScanFiles()`
|
|
63
|
+
Project scanning: `createDependenciesSnapshot()` • `createOrgFullScan()` • `createScanFromFilepaths()` • `getScan()` • `getScanList()` • `getSupportedScanFiles()`
|
|
65
64
|
|
|
66
|
-
[→ Documentation](./docs/
|
|
67
|
-
</details>
|
|
65
|
+
[→ Documentation](./docs/guides/api-reference.md#scanning--analysis)
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
<summary><strong>Organization Management</strong> - Orgs and repos</summary>
|
|
67
|
+
### Organization Management
|
|
71
68
|
|
|
72
|
-
`getOrganizations()` • `createOrgRepo()` • `getOrgRepo()` • `getOrgRepoList()` • `updateOrgRepo()` • `deleteOrgRepo()`
|
|
69
|
+
Organizations and repositories: `getOrganizations()` • `createOrgRepo()` • `getOrgRepo()` • `getOrgRepoList()` • `updateOrgRepo()` • `deleteOrgRepo()`
|
|
73
70
|
|
|
74
|
-
[→ Documentation](./docs/
|
|
75
|
-
</details>
|
|
71
|
+
[→ Documentation](./docs/guides/api-reference.md#organization-management)
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
<summary><strong>Policy & Settings</strong> - Security configuration</summary>
|
|
73
|
+
### Policy & Settings
|
|
79
74
|
|
|
80
|
-
`getOrgSecurityPolicy()` • `updateOrgSecurityPolicy()` • `getOrgLicensePolicy()` • `updateOrgLicensePolicy()` • `postSettings()`
|
|
75
|
+
Security configuration: `getOrgSecurityPolicy()` • `updateOrgSecurityPolicy()` • `getOrgLicensePolicy()` • `updateOrgLicensePolicy()` • `postSettings()`
|
|
81
76
|
|
|
82
|
-
[→ Documentation](./docs/
|
|
83
|
-
</details>
|
|
77
|
+
[→ Documentation](./docs/guides/api-reference.md#policy--settings)
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
<summary><strong>Full Scan Management</strong> - Deep analysis</summary>
|
|
79
|
+
### Full Scan Management
|
|
87
80
|
|
|
88
|
-
`getOrgFullScanList()` • `getOrgFullScanMetadata()` • `getOrgFullScanBuffered()` • `streamOrgFullScan()` • `deleteOrgFullScan()`
|
|
81
|
+
Deep analysis: `getOrgFullScanList()` • `getOrgFullScanMetadata()` • `getOrgFullScanBuffered()` • `streamOrgFullScan()` • `deleteOrgFullScan()`
|
|
89
82
|
|
|
90
|
-
[→ Documentation](./docs/
|
|
91
|
-
</details>
|
|
83
|
+
[→ Documentation](./docs/guides/api-reference.md#full-scan-management)
|
|
92
84
|
|
|
93
|
-
|
|
94
|
-
<summary><strong>Diff Scans</strong> - Compare scans</summary>
|
|
85
|
+
### Diff Scans
|
|
95
86
|
|
|
96
|
-
`createOrgDiffScanFromIds()` • `getDiffScanById()` • `listOrgDiffScans()` • `deleteOrgDiffScan()`
|
|
87
|
+
Scan comparison: `createOrgDiffScanFromIds()` • `getDiffScanById()` • `listOrgDiffScans()` • `deleteOrgDiffScan()`
|
|
97
88
|
|
|
98
|
-
[→ Documentation](./docs/
|
|
99
|
-
</details>
|
|
89
|
+
[→ Documentation](./docs/guides/api-reference.md#diff-scans)
|
|
100
90
|
|
|
101
|
-
|
|
102
|
-
<summary><strong>Patches & Vulnerabilities</strong> - Security fixes</summary>
|
|
91
|
+
### Patches & Vulnerabilities
|
|
103
92
|
|
|
104
|
-
`streamPatchesFromScan()` • `viewPatch()`
|
|
93
|
+
Security fixes: `streamPatchesFromScan()` • `viewPatch()`
|
|
105
94
|
|
|
106
|
-
[→ Documentation](./docs/
|
|
107
|
-
</details>
|
|
95
|
+
[→ Documentation](./docs/guides/api-reference.md#patches--vulnerabilities)
|
|
108
96
|
|
|
109
|
-
|
|
110
|
-
<summary><strong>Alert & Triage</strong> - Alert management</summary>
|
|
97
|
+
### Alert & Triage
|
|
111
98
|
|
|
112
|
-
`getOrgTriage()` • `updateOrgAlertTriage()`
|
|
99
|
+
Alert management: `getOrgTriage()` • `updateOrgAlertTriage()`
|
|
113
100
|
|
|
114
|
-
[→ Documentation](./docs/
|
|
115
|
-
</details>
|
|
101
|
+
[→ Documentation](./docs/guides/api-reference.md#alert--triage)
|
|
116
102
|
|
|
117
|
-
|
|
118
|
-
<summary><strong>Export & Integration</strong> - SBOM export</summary>
|
|
103
|
+
### Export & Integration
|
|
119
104
|
|
|
120
|
-
`exportCDX()` • `exportSPDX()` • `searchDependencies()` • `uploadManifestFiles()`
|
|
105
|
+
SBOM export: `exportCDX()` • `exportSPDX()` • `searchDependencies()` • `uploadManifestFiles()`
|
|
121
106
|
|
|
122
|
-
[→ Documentation](./docs/
|
|
123
|
-
</details>
|
|
107
|
+
[→ Documentation](./docs/guides/api-reference.md#export--integration)
|
|
124
108
|
|
|
125
|
-
|
|
126
|
-
<summary><strong>Repository Labels</strong> - Categorization</summary>
|
|
109
|
+
### Repository Labels
|
|
127
110
|
|
|
128
|
-
`createOrgRepoLabel()` • `getOrgRepoLabel()` • `getOrgRepoLabelList()` • `updateOrgRepoLabel()` • `deleteOrgRepoLabel()`
|
|
111
|
+
Categorization: `createOrgRepoLabel()` • `getOrgRepoLabel()` • `getOrgRepoLabelList()` • `updateOrgRepoLabel()` • `deleteOrgRepoLabel()`
|
|
129
112
|
|
|
130
|
-
[→ Documentation](./docs/
|
|
131
|
-
</details>
|
|
113
|
+
[→ Documentation](./docs/guides/api-reference.md#repository-labels)
|
|
132
114
|
|
|
133
|
-
|
|
134
|
-
<summary><strong>Analytics & Monitoring</strong> - Usage metrics</summary>
|
|
115
|
+
### Analytics & Monitoring
|
|
135
116
|
|
|
136
|
-
`getQuota()` • `getOrgAnalytics()` • `getRepoAnalytics()` • `getAuditLogEvents()`
|
|
117
|
+
Usage metrics: `getQuota()` • `getOrgAnalytics()` • `getRepoAnalytics()` • `getAuditLogEvents()`
|
|
137
118
|
|
|
138
|
-
[→ Documentation](./docs/
|
|
139
|
-
</details>
|
|
119
|
+
[→ Documentation](./docs/guides/api-reference.md#analytics--monitoring)
|
|
140
120
|
|
|
141
|
-
|
|
142
|
-
<summary><strong>Authentication & Access</strong> - API tokens</summary>
|
|
121
|
+
### Authentication & Access
|
|
143
122
|
|
|
144
|
-
`getAPITokens()` • `postAPIToken()` • `postAPITokensRotate()` • `postAPITokensRevoke()` • `postAPITokenUpdate()`
|
|
123
|
+
API tokens: `getAPITokens()` • `postAPIToken()` • `postAPITokensRotate()` • `postAPITokensRevoke()` • `postAPITokenUpdate()`
|
|
145
124
|
|
|
146
|
-
[→ Documentation](./docs/
|
|
147
|
-
</details>
|
|
125
|
+
[→ Documentation](./docs/guides/api-reference.md#authentication--access)
|
|
148
126
|
|
|
149
|
-
|
|
150
|
-
<summary><strong>Entitlements</strong> - Feature access</summary>
|
|
127
|
+
### Entitlements
|
|
151
128
|
|
|
152
|
-
`getEnabledEntitlements()` • `getEntitlements()`
|
|
129
|
+
Feature access: `getEnabledEntitlements()` • `getEntitlements()`
|
|
153
130
|
|
|
154
|
-
[→ Documentation](./docs/
|
|
155
|
-
</details>
|
|
131
|
+
[→ Documentation](./docs/guides/api-reference.md#entitlements)
|
|
156
132
|
|
|
157
|
-
|
|
158
|
-
<summary><strong>Quota Utilities</strong> - Cost helpers</summary>
|
|
133
|
+
### Quota Utilities
|
|
159
134
|
|
|
160
|
-
`getQuotaCost()` • `getRequiredPermissions()` • `calculateTotalQuotaCost()` • `hasQuotaForMethods()` • `getMethodsByQuotaCost()` • `getMethodsByPermissions()` • `getQuotaUsageSummary()` • `getAllMethodRequirements()`
|
|
135
|
+
Cost helpers: `getQuotaCost()` • `getRequiredPermissions()` • `calculateTotalQuotaCost()` • `hasQuotaForMethods()` • `getMethodsByQuotaCost()` • `getMethodsByPermissions()` • `getQuotaUsageSummary()` • `getAllMethodRequirements()`
|
|
161
136
|
|
|
162
|
-
[→ Documentation](./docs/
|
|
163
|
-
</details>
|
|
137
|
+
[→ Documentation](./docs/guides/quota-management.md)
|
|
164
138
|
|
|
165
|
-
|
|
166
|
-
<summary><strong>Advanced Query Methods</strong> - Raw API</summary>
|
|
139
|
+
### Advanced Query Methods
|
|
167
140
|
|
|
168
|
-
`getApi()` • `sendApi()`
|
|
141
|
+
Raw API access: `getApi()` • `sendApi()`
|
|
169
142
|
|
|
170
|
-
[→ Documentation](./docs/
|
|
171
|
-
</details>
|
|
143
|
+
[→ Documentation](./docs/guides/api-reference.md#advanced-query-methods)
|
|
172
144
|
|
|
173
|
-
**[→
|
|
145
|
+
**[→ API Reference](./docs/guides/api-reference.md)**
|
|
174
146
|
|
|
175
|
-
**[→
|
|
147
|
+
**[→ Examples](./docs/guides/usage-examples.md)**
|
|
176
148
|
|
|
177
|
-
**[→ Quota Management](./docs/
|
|
149
|
+
**[→ Quota Management](./docs/guides/quota-management.md)** - Cost tiers: 0 (free), 10 (standard), 100 (batch/uploads)
|
|
178
150
|
|
|
179
|
-
**[→ Testing Utilities](./docs/
|
|
151
|
+
**[→ Testing Utilities](./docs/guides/dev/testing.md)** - Mock factories, fixtures, type guards
|
|
180
152
|
|
|
181
153
|
## See Also
|
|
182
154
|
|