@socketsecurity/sdk 3.3.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 +10 -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 +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +310 -142
- package/dist/socket-sdk-class.d.ts +130 -25
- package/dist/types-strict.d.ts +47 -2
- package/dist/types.d.ts +6 -5
- package/package.json +6 -7
- package/types/api.d.ts +1250 -105
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ 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
|
+
|
|
7
17
|
## [3.3.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.3.0) - 2026-01-25
|
|
8
18
|
|
|
9
19
|
### Added
|
|
@@ -342,8 +352,6 @@ Strict types now mark guaranteed API fields as required instead of optional, imp
|
|
|
342
352
|
|
|
343
353
|
- File-upload methods automatically skip unreadable files with warnings instead of failing
|
|
344
354
|
|
|
345
|
-
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.
|
|
346
|
-
|
|
347
355
|
## [2.0.7](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.7) - 2025-10-22
|
|
348
356
|
|
|
349
357
|
### Changed
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://socket.dev/npm/package/@socketsecurity/sdk)
|
|
4
4
|
[](https://github.com/SocketDev/socket-sdk-js/actions/workflows/ci.yml)
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
[](https://twitter.com/SocketSecurity)
|
|
8
8
|
[](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(`
|
|
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
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -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" | "recentlyPublished" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "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
|
+
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>;
|
package/dist/http-client.d.ts
CHANGED
|
@@ -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,7 +75,7 @@ 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
80
|
* Create DELETE request with automatic retry logic.
|
|
80
81
|
* Retries on network errors and 5xx responses.
|
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, GetRepositoryOptions, 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 };
|