@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 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
  [![Follow @SocketSecurity](https://img.shields.io/twitter/follow/SocketSecurity?style=social)](https://twitter.com/SocketSecurity)
7
7
  [![Follow @socket.dev on Bluesky](https://img.shields.io/badge/Follow-@socket.dev-1DA1F2?style=social&logo=bluesky)](https://bsky.app/profile/socket.dev)
8
8
 
9
- Official SDK for [Socket.dev](https://socket.dev/) - Programmatic access to security analysis, vulnerability scanning, and compliance monitoring for your software supply chain.
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 Options](./docs/API.md#configuration)**
51
+ **[→ Configuration](./docs/guides/api-reference.md#configuration)**
50
52
 
51
53
  ## API Methods
52
54
 
53
- <details>
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/API.md#package-analysis)
59
- </details>
59
+ [→ Documentation](./docs/guides/api-reference.md#package-analysis)
60
60
 
61
- <details>
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/API.md#scanning--analysis)
67
- </details>
65
+ [→ Documentation](./docs/guides/api-reference.md#scanning--analysis)
68
66
 
69
- <details>
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/API.md#organization-management)
75
- </details>
71
+ [→ Documentation](./docs/guides/api-reference.md#organization-management)
76
72
 
77
- <details>
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/API.md#policy--settings)
83
- </details>
77
+ [→ Documentation](./docs/guides/api-reference.md#policy--settings)
84
78
 
85
- <details>
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/API.md#full-scan-management)
91
- </details>
83
+ [→ Documentation](./docs/guides/api-reference.md#full-scan-management)
92
84
 
93
- <details>
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/API.md#diff-scans)
99
- </details>
89
+ [→ Documentation](./docs/guides/api-reference.md#diff-scans)
100
90
 
101
- <details>
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/API.md#patches--vulnerabilities)
107
- </details>
95
+ [→ Documentation](./docs/guides/api-reference.md#patches--vulnerabilities)
108
96
 
109
- <details>
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/API.md#alert--triage)
115
- </details>
101
+ [→ Documentation](./docs/guides/api-reference.md#alert--triage)
116
102
 
117
- <details>
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/API.md#export--integration)
123
- </details>
107
+ [→ Documentation](./docs/guides/api-reference.md#export--integration)
124
108
 
125
- <details>
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/API.md#repository-labels)
131
- </details>
113
+ [→ Documentation](./docs/guides/api-reference.md#repository-labels)
132
114
 
133
- <details>
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/API.md#analytics--monitoring)
139
- </details>
119
+ [→ Documentation](./docs/guides/api-reference.md#analytics--monitoring)
140
120
 
141
- <details>
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/API.md#authentication--access)
147
- </details>
125
+ [→ Documentation](./docs/guides/api-reference.md#authentication--access)
148
126
 
149
- <details>
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/API.md#entitlements)
155
- </details>
131
+ [→ Documentation](./docs/guides/api-reference.md#entitlements)
156
132
 
157
- <details>
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/QUOTA.md)
163
- </details>
137
+ [→ Documentation](./docs/guides/quota-management.md)
164
138
 
165
- <details>
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/API.md#advanced-query-methods)
171
- </details>
143
+ [→ Documentation](./docs/guides/api-reference.md#advanced-query-methods)
172
144
 
173
- **[→ Complete API Reference](./docs/API.md)**
145
+ **[→ API Reference](./docs/guides/api-reference.md)**
174
146
 
175
- **[→ Usage Examples](./docs/EXAMPLES.md)**
147
+ **[→ Examples](./docs/guides/usage-examples.md)**
176
148
 
177
- **[→ Quota Management](./docs/QUOTA.md)** - Cost tiers: 0 units (free), 10 units (standard), 100 units (batch/uploads)
149
+ **[→ Quota Management](./docs/guides/quota-management.md)** - Cost tiers: 0 (free), 10 (standard), 100 (batch/uploads)
178
150
 
179
- **[→ Testing Utilities](./docs/TESTING.md)** - Mock factories, fixtures, and type guards for SDK testing
151
+ **[→ Testing Utilities](./docs/guides/dev/testing.md)** - Mock factories, fixtures, type guards
180
152
 
181
153
  ## See Also
182
154
 
@@ -0,0 +1,2 @@
1
+ /* Socket SDK ESM - Built with esbuild */
2
+ import{a}from"./chunk-3V7KNFWE.mjs";import"./chunk-LHGMBIJS.mjs";import"./chunk-UKECVIRQ.mjs";export default a();