@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 CHANGED
@@ -4,6 +4,38 @@ 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
+ ## [3.3.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.3.1) - 2026-03-03
8
+
9
+ ### Changed
10
+
11
+ - **createRepository**: Now requires `repoSlug` as second parameter with typed options including `workspace`, `visibility`, `homepage`, `archived`, `default_branch`, and `description`
12
+
13
+ ### Added
14
+
15
+ - New API endpoints from OpenAPI sync: CSV/PDF export for full scans, delete triage alerts, new alert types
16
+
17
+ ## [3.3.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.3.0) - 2026-01-25
18
+
19
+ ### Added
20
+
21
+ - New SDK convenience methods for OpenAPI v3.3.0 endpoints:
22
+ - `batchOrgPackageFetch(orgSlug, components, options)` - Organization-scoped PURL batch lookup with security policy label support
23
+ - `exportOpenVEX(orgSlug, id, options)` - Export vulnerability exploitability data as OpenVEX v0.2.0 documents (includes patch data and reachability analysis)
24
+ - `getOrgAlertFullScans(orgSlug, options)` - List full scans associated with specific alerts
25
+ - `rescanFullScan(orgSlug, fullScanId, options)` - Rescan existing full scans with shallow (policy reapplication) or deep (dependency resolution rerun) modes
26
+ - Repository endpoints now support optional `workspace` parameter for workspace-scoped operations:
27
+ - `createRepository(orgSlug, params, { workspace })`
28
+ - `deleteRepository(orgSlug, repoSlug, { workspace })`
29
+ - `getRepository(orgSlug, repoSlug, { workspace })`
30
+ - `updateRepository(orgSlug, repoSlug, params, { workspace })`
31
+
32
+ ### Changed
33
+
34
+ - Updated `@socketsecurity/lib` to v5.5.3
35
+ - TypeScript: Auto-generated strict types from OpenAPI schema for improved type safety
36
+ - TypeScript: All optional properties now explicitly include `| undefined` for better null checking
37
+ - Synced OpenAPI type definitions with latest API specification
38
+
7
39
  ## [3.2.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.2.0) - 2025-12-08
8
40
 
9
41
  ### Added
@@ -320,8 +352,6 @@ Strict types now mark guaranteed API fields as required instead of optional, imp
320
352
 
321
353
  - File-upload methods automatically skip unreadable files with warnings instead of failing
322
354
 
323
- See [docs/migration-v3.md](./docs/migration-v3.md) and [docs/when-to-use-what.md](./docs/when-to-use-what.md) for migration guidance.
324
-
325
355
  ## [2.0.7](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.7) - 2025-10-22
326
356
 
327
357
  ### Changed
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Socket Badge](https://socket.dev/api/badge/npm/package/@socketsecurity/sdk)](https://socket.dev/npm/package/@socketsecurity/sdk)
4
4
  [![CI](https://github.com/SocketDev/socket-sdk-js/actions/workflows/ci.yml/badge.svg)](https://github.com/SocketDev/socket-sdk-js/actions/workflows/ci.yml)
5
- ![Coverage](https://img.shields.io/badge/coverage-79.95%25-green)
5
+ ![Coverage](https://img.shields.io/badge/coverage-40%25-orange)
6
6
 
7
7
  [![Follow @SocketSecurity](https://img.shields.io/twitter/follow/SocketSecurity?style=social)](https://twitter.com/SocketSecurity)
8
8
  [![Follow @socket.dev on Bluesky](https://img.shields.io/badge/Follow-@socket.dev-1DA1F2?style=social&logo=bluesky)](https://bsky.app/profile/socket.dev)
@@ -35,7 +35,7 @@ if (quota.success) {
35
35
  // Analyze a package
36
36
  const result = await client.getScoreByNpmPackage('express', '4.18.0')
37
37
  if (result.success) {
38
- console.log(`Security Score: ${result.data.score}/100`)
38
+ console.log(`Dependency Score: ${result.data.depscore}`)
39
39
  }
40
40
 
41
41
  // Batch analyze multiple packages
@@ -51,21 +51,8 @@ const batchResult = await client.batchPackageFetch({
51
51
 
52
52
  | Guide | Description |
53
53
  |-------|-------------|
54
- | **[Getting Started](./docs/getting-started.md)** | Quick start for contributors (5 min setup) |
55
54
  | **[API Reference](./docs/api-reference.md)** | Complete API method documentation |
56
- | **[Usage Examples](./docs/usage-examples.md)** | Real-world patterns and code samples |
57
55
  | **[Quota Management](./docs/quota-management.md)** | Cost tiers (0/10/100) and utilities |
58
- | **[Testing Guide](./docs/dev/testing.md)** | Test helpers, fixtures, and patterns |
59
- | **[Method Reference](./docs/when-to-use-what.md)** | Quick method selection guide |
60
-
61
- ## Examples
62
-
63
- See **[usage-examples.md](./docs/usage-examples.md)** for complete examples including:
64
- - Package security analysis
65
- - Batch operations
66
- - Full scans with SBOM
67
- - Policy management
68
- - Quota planning
69
56
 
70
57
  ## License
71
58
 
@@ -12,6 +12,10 @@
12
12
  "quota": 100,
13
13
  "permissions": ["report:write"]
14
14
  },
15
+ "createFullScan": {
16
+ "quota": 0,
17
+ "permissions": ["full-scans:create"]
18
+ },
15
19
  "createOrgFullScan": {
16
20
  "quota": 0,
17
21
  "permissions": ["full-scans:create"]
@@ -227,6 +231,22 @@
227
231
  "sendApi": {
228
232
  "quota": 0,
229
233
  "permissions": []
234
+ },
235
+ "batchOrgPackageFetch": {
236
+ "quota": 100,
237
+ "permissions": ["packages:list"]
238
+ },
239
+ "exportOpenVEX": {
240
+ "quota": 0,
241
+ "permissions": ["report:read"]
242
+ },
243
+ "getOrgAlertFullScans": {
244
+ "quota": 10,
245
+ "permissions": ["alerts:list"]
246
+ },
247
+ "rescanFullScan": {
248
+ "quota": 0,
249
+ "permissions": ["full-scans:create"]
230
250
  }
231
251
  }
232
252
  }
@@ -13,4 +13,4 @@ export declare const MAX_RESPONSE_SIZE: number;
13
13
  export declare const MAX_STREAM_SIZE: number;
14
14
  export declare const SOCKET_PUBLIC_BLOB_STORE_URL = "https://socketusercontent.com";
15
15
  export declare const httpAgentNames: Set<string>;
16
- export declare const publicPolicy: Map<"ambiguousClassifier" | "badEncoding" | "badSemver" | "badSemverDependency" | "bidi" | "binScriptConfusion" | "chromeContentScript" | "chromeHostPermission" | "chromePermission" | "chromeWildcardHostPermission" | "chronoAnomaly" | "compromisedSSHKey" | "copyleftLicense" | "criticalCVE" | "cve" | "debugAccess" | "deprecated" | "deprecatedException" | "deprecatedLicense" | "didYouMean" | "dynamicRequire" | "emptyPackage" | "envVars" | "explicitlyUnlicensedItem" | "extraneousDependency" | "fileDependency" | "filesystemAccess" | "floatingDependency" | "generic" | "ghaArgToEnv" | "ghaArgToOutput" | "ghaArgToSink" | "ghaContextToEnv" | "ghaContextToOutput" | "ghaContextToSink" | "ghaEnvToSink" | "gitDependency" | "gitHubDependency" | "gptAnomaly" | "gptDidYouMean" | "gptMalware" | "gptSecurity" | "hasNativeCode" | "highEntropyStrings" | "homoglyphs" | "httpDependency" | "installScripts" | "invalidPackageJSON" | "invisibleChars" | "licenseChange" | "licenseException" | "licenseSpdxDisj" | "longStrings" | "majorRefactor" | "malware" | "manifestConfusion" | "mediumCVE" | "mildCVE" | "minifiedFile" | "miscLicenseIssues" | "missingAuthor" | "missingDependency" | "missingLicense" | "missingTarball" | "mixedLicense" | "modifiedException" | "modifiedLicense" | "networkAccess" | "newAuthor" | "noAuthorData" | "noBugTracker" | "noLicenseFound" | "noREADME" | "noRepository" | "noTests" | "noV1" | "noWebsite" | "nonOSILicense" | "nonSPDXLicense" | "nonpermissiveLicense" | "notice" | "obfuscatedFile" | "obfuscatedRequire" | "peerDependency" | "potentialVulnerability" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "socketUpgradeAvailable" | "suspiciousStarActivity" | "suspiciousString" | "telemetry" | "trivialPackage" | "troll" | "typeModuleCompatibility" | "uncaughtOptionalDependency" | "unclearLicense" | "unidentifiedLicense" | "unmaintained" | "unpopularPackage" | "unpublished" | "unresolvedRequire" | "unsafeCopyright" | "unstableOwnership" | "unusedDependency" | "urlStrings" | "usesEval" | "vsxActivationWildcard" | "vsxDebuggerContribution" | "vsxExtensionDependency" | "vsxExtensionPack" | "vsxProposedApiUsage" | "vsxUntrustedWorkspaceSupported" | "vsxVirtualWorkspaceSupported" | "vsxWebviewContribution" | "vsxWorkspaceContainsActivation" | "zeroWidth", ALERT_ACTION>;
16
+ export declare const publicPolicy: Map<"ambiguousClassifier" | "badEncoding" | "badSemver" | "badSemverDependency" | "bidi" | "binScriptConfusion" | "chromeContentScript" | "chromeHostPermission" | "chromePermission" | "chromeWildcardHostPermission" | "chronoAnomaly" | "compromisedSSHKey" | "copyleftLicense" | "criticalCVE" | "cve" | "debugAccess" | "deprecated" | "deprecatedException" | "deprecatedLicense" | "didYouMean" | "dynamicRequire" | "emptyPackage" | "envVars" | "explicitlyUnlicensedItem" | "extraneousDependency" | "fileDependency" | "filesystemAccess" | "floatingDependency" | "generic" | "ghaArgToEnv" | "ghaArgToOutput" | "ghaArgToSink" | "ghaContextToEnv" | "ghaContextToOutput" | "ghaContextToSink" | "ghaEnvToSink" | "gitDependency" | "gitHubDependency" | "gptAnomaly" | "gptDidYouMean" | "gptMalware" | "gptSecurity" | "hasNativeCode" | "highEntropyStrings" | "homoglyphs" | "httpDependency" | "installScripts" | "invalidPackageJSON" | "invisibleChars" | "licenseChange" | "licenseException" | "licenseSpdxDisj" | "longStrings" | "majorRefactor" | "malware" | "manifestConfusion" | "mediumCVE" | "mildCVE" | "minifiedFile" | "miscLicenseIssues" | "missingAuthor" | "missingDependency" | "missingLicense" | "missingTarball" | "mixedLicense" | "modifiedException" | "modifiedLicense" | "networkAccess" | "newAuthor" | "noAuthorData" | "noBugTracker" | "noLicenseFound" | "noREADME" | "noRepository" | "noTests" | "noV1" | "noWebsite" | "nonOSILicense" | "nonSPDXLicense" | "nonpermissiveLicense" | "notice" | "obfuscatedFile" | "obfuscatedRequire" | "peerDependency" | "potentialVulnerability" | "recentlyPublished" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "skillAutonomyAbuse" | "skillCommandInjection" | "skillDataExfiltration" | "skillDiscoveryAbuse" | "skillHardcodedSecrets" | "skillObfuscation" | "skillPromptInjection" | "skillResourceAbuse" | "skillSupplyChain" | "skillToolAbuse" | "skillToolChaining" | "skillTransitiveTrust" | "socketUpgradeAvailable" | "suspiciousStarActivity" | "suspiciousString" | "telemetry" | "tooManyFiles" | "trivialPackage" | "troll" | "typeModuleCompatibility" | "uncaughtOptionalDependency" | "unclearLicense" | "unidentifiedLicense" | "unmaintained" | "unpopularPackage" | "unpublished" | "unresolvedRequire" | "unsafeCopyright" | "unstableOwnership" | "unusedDependency" | "urlStrings" | "usesEval" | "vsxActivationWildcard" | "vsxDebuggerContribution" | "vsxExtensionDependency" | "vsxExtensionPack" | "vsxProposedApiUsage" | "vsxUntrustedWorkspaceSupported" | "vsxVirtualWorkspaceSupported" | "vsxWebviewContribution" | "vsxWorkspaceContainsActivation" | "zeroWidth", ALERT_ACTION>;
@@ -16,11 +16,12 @@ import type { ClientRequest, IncomingMessage } from 'node:http';
16
16
  */
17
17
  export declare class ResponseError extends Error {
18
18
  response: IncomingMessage;
19
+ url?: string | undefined;
19
20
  /**
20
21
  * Create a new ResponseError from an HTTP response.
21
22
  * Automatically formats error message with status code and message.
22
23
  */
23
- constructor(response: IncomingMessage, message?: string);
24
+ constructor(response: IncomingMessage, message?: string, url?: string | undefined);
24
25
  }
25
26
  /**
26
27
  * Create and execute an HTTP DELETE request.
@@ -74,28 +75,15 @@ export declare function getResponse(req: ClientRequest): Promise<IncomingMessage
74
75
  * @throws {ResponseError} When response has non-2xx status code
75
76
  * @throws {SyntaxError} When response body contains invalid JSON
76
77
  */
77
- export declare function getResponseJson(response: IncomingMessage, method?: string | undefined): Promise<JsonValue | undefined>;
78
+ export declare function getResponseJson(response: IncomingMessage, method?: string | undefined, url?: string | undefined): Promise<JsonValue | undefined>;
78
79
  /**
79
- * Check if HTTP response has a successful status code (2xx range).
80
- * Returns true for status codes between 200-299, false otherwise.
81
- */
82
- export declare function isResponseOk(response: IncomingMessage): boolean;
83
- /**
84
- * Transform artifact data based on authentication status.
85
- * Filters and compacts response data for public/free-tier users.
86
- */
87
- export declare function reshapeArtifactForPublicPolicy<T extends Record<string, unknown>>(data: T, isAuthenticated: boolean, actions?: string | undefined): T;
88
- /**
89
- * Retry helper for HTTP requests with exponential backoff.
90
- * Wraps any async HTTP function and retries on failure.
80
+ * Create DELETE request with automatic retry logic.
81
+ * Retries on network errors and 5xx responses.
91
82
  *
92
- * @param fn - Async function to retry
93
83
  * @param retries - Number of retry attempts (default: 0, retries disabled)
94
84
  * @param retryDelay - Initial delay in ms (default: 100)
95
- * @returns Result of the function call
96
- * @throws {Error} Last error if all retries exhausted
97
85
  */
98
- export declare function withRetry<T>(fn: () => Promise<T>, retries?: number, retryDelay?: number): Promise<T>;
86
+ export declare function createDeleteRequestWithRetry(baseUrl: string, urlPath: string, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
99
87
  /**
100
88
  * Create GET request with automatic retry logic.
101
89
  * Retries on network errors and 5xx responses.
@@ -105,18 +93,31 @@ export declare function withRetry<T>(fn: () => Promise<T>, retries?: number, ret
105
93
  */
106
94
  export declare function createGetRequestWithRetry(baseUrl: string, urlPath: string, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
107
95
  /**
108
- * Create DELETE request with automatic retry logic.
96
+ * Create request with JSON payload and automatic retry logic.
109
97
  * Retries on network errors and 5xx responses.
110
98
  *
111
99
  * @param retries - Number of retry attempts (default: 0, retries disabled)
112
100
  * @param retryDelay - Initial delay in ms (default: 100)
113
101
  */
114
- export declare function createDeleteRequestWithRetry(baseUrl: string, urlPath: string, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
102
+ export declare function createRequestWithJsonAndRetry(method: SendMethod, baseUrl: string, urlPath: string, json: unknown, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
115
103
  /**
116
- * Create request with JSON payload and automatic retry logic.
117
- * Retries on network errors and 5xx responses.
104
+ * Check if HTTP response has a successful status code (2xx range).
105
+ * Returns true for status codes between 200-299, false otherwise.
106
+ */
107
+ export declare function isResponseOk(response: IncomingMessage): boolean;
108
+ /**
109
+ * Transform artifact data based on authentication status.
110
+ * Filters and compacts response data for public/free-tier users.
111
+ */
112
+ export declare function reshapeArtifactForPublicPolicy<T extends Record<string, unknown>>(data: T, isAuthenticated: boolean, actions?: string | undefined): T;
113
+ /**
114
+ * Retry helper for HTTP requests with exponential backoff.
115
+ * Wraps any async HTTP function and retries on failure.
118
116
  *
117
+ * @param fn - Async function to retry
119
118
  * @param retries - Number of retry attempts (default: 0, retries disabled)
120
119
  * @param retryDelay - Initial delay in ms (default: 100)
120
+ * @returns Result of the function call
121
+ * @throws {Error} Last error if all retries exhausted
121
122
  */
122
- export declare function createRequestWithJsonAndRetry(method: SendMethod, baseUrl: string, urlPath: string, json: unknown, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
123
+ export declare function withRetry<T>(fn: () => Promise<T>, retries?: number, retryDelay?: number): Promise<T>;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { createDeleteRequest, createGetRequest, createRequestWithJson, getErrorR
9
9
  export { calculateTotalQuotaCost, getAllMethodRequirements, getMethodRequirements, getMethodsByPermissions, getMethodsByQuotaCost, getQuotaCost, getQuotaUsageSummary, getRequiredPermissions, hasQuotaForMethods, } from './quota-utils';
10
10
  export { SocketSdk } from './socket-sdk-class';
11
11
  export type { ALERT_ACTION, ALERT_TYPE, Agent, ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CompactSocketArtifact, CompactSocketArtifactAlert, CreateDependenciesSnapshotOptions, CreateOrgFullScanOptions, CreateScanFromFilepathsOptions, CustomResponseType, Entitlement, EntitlementsResponse, FileValidationCallback, FileValidationResult, GetOptions, GotOptions, HeadersRecord, PatchFile, PatchRecord, PatchViewResponse, TelemetryConfig, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, RequestInfo, RequestOptions, RequestOptionsWithHooks, ResponseInfo, SecurityAlert, SendMethod, SendOptions, SocketArtifact, SocketArtifactAlert, SocketArtifactWithExtras, SocketId, SocketMetricSchema, SocketSdkArrayElement, SocketSdkData, SocketSdkErrorResult, SocketSdkGenericResult, SocketSdkOperations, SocketSdkOptions, SocketSdkResult, SocketSdkSuccessResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesResponse, UploadManifestFilesReturnType, Vulnerability, } from './types';
12
- export type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanItem, FullScanListData, FullScanListResult, FullScanResult, ListFullScansOptions, ListRepositoriesOptions, OrganizationItem, OrganizationsResult, RepositoriesListData, RepositoriesListResult, RepositoryItem, RepositoryLabelItem, RepositoryLabelResult, RepositoryLabelsListData, RepositoryLabelsListResult, RepositoryResult, StreamFullScanOptions, StrictErrorResult, StrictResult, } from './types-strict';
12
+ export type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanItem, FullScanListData, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationItem, OrganizationsResult, RepositoriesListData, RepositoriesListResult, RepositoryItem, RepositoryLabelItem, RepositoryLabelResult, RepositoryLabelsListData, RepositoryLabelsListResult, RepositoryListItem, RepositoryResult, StreamFullScanOptions, StrictErrorResult, StrictResult, } from './types-strict';
13
13
  export { createUserAgentFromPkgJson } from './user-agent';
14
14
  export { calculateWordSetSimilarity, filterRedundantCause, normalizeBaseUrl, promiseWithResolvers, queryToSearchParams, resolveAbsPaths, resolveBasePath, shouldOmitReason, };
15
15
  export { DEFAULT_USER_AGENT, httpAgentNames, publicPolicy };