@socketsecurity/sdk 2.0.3 → 2.0.5
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 +14 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +13 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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.5](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.5) - 2025-10-22
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `SocketSdkData<T>` type helper for extracting data from SDK operation results
|
|
11
|
+
- `SocketSdkArrayElement<T, K>` type helper for extracting array element types from SDK operations
|
|
12
|
+
|
|
13
|
+
## [2.0.4](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.4) - 2025-10-22
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Support for `Retry-After` header in rate limit responses (HTTP 429)
|
|
17
|
+
- Automatically respects server-specified retry delays
|
|
18
|
+
- Parses both delay-seconds (numeric) and HTTP-date formats
|
|
19
|
+
- Uses server delay instead of exponential backoff when available
|
|
20
|
+
|
|
7
21
|
## [2.0.3](https://github.com/SocketDev/socket-sdk-js/releases/tag/v2.0.3) - 2025-10-22
|
|
8
22
|
|
|
9
23
|
### Fixed
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { createRequestBodyForFilepaths, createRequestBodyForJson, createUploadRe
|
|
|
8
8
|
export { createDeleteRequest, createGetRequest, createRequestWithJson, getErrorResponseBody, getHttpModule, getResponse, getResponseJson, isResponseOk, ResponseError, reshapeArtifactForPublicPolicy, } from './http-client';
|
|
9
9
|
export { calculateTotalQuotaCost, getAllMethodRequirements, getMethodRequirements, getMethodsByPermissions, getMethodsByQuotaCost, getQuotaCost, getQuotaUsageSummary, getRequiredPermissions, hasQuotaForMethods, } from './quota-utils';
|
|
10
10
|
export { SocketSdk } from './socket-sdk-class';
|
|
11
|
-
export type { ALERT_ACTION, ALERT_TYPE, Agent, ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CompactSocketArtifact, CompactSocketArtifactAlert, CreateDependenciesSnapshotOptions, CreateOrgFullScanOptions, CreateScanFromFilepathsOptions, CustomResponseType, Entitlement, EntitlementsResponse, GetOptions, GotOptions, HeadersRecord, PatchFile, PatchRecord, PatchViewResponse, QueryParams, RequestOptions, SecurityAlert, SendMethod, SendOptions, SocketArtifact, SocketArtifactAlert, SocketArtifactWithExtras, SocketId, SocketMetricSchema, SocketSdkErrorResult, SocketSdkGenericResult, SocketSdkOperations, SocketSdkOptions, SocketSdkResult, SocketSdkSuccessResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesResponse, UploadManifestFilesReturnType, Vulnerability, } from './types';
|
|
11
|
+
export type { ALERT_ACTION, ALERT_TYPE, Agent, ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CompactSocketArtifact, CompactSocketArtifactAlert, CreateDependenciesSnapshotOptions, CreateOrgFullScanOptions, CreateScanFromFilepathsOptions, CustomResponseType, Entitlement, EntitlementsResponse, GetOptions, GotOptions, HeadersRecord, PatchFile, PatchRecord, PatchViewResponse, QueryParams, RequestOptions, 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
12
|
export { createUserAgentFromPkgJson } from './user-agent';
|
|
13
13
|
export { normalizeBaseUrl, promiseWithResolvers, queryToSearchParams, resolveAbsPaths, resolveBasePath, };
|
|
14
14
|
export { DEFAULT_USER_AGENT, httpAgentNames, publicPolicy };
|
package/dist/types.d.ts
CHANGED
|
@@ -122,6 +122,19 @@ export type SocketSdkErrorResult<T extends SocketSdkOperations> = {
|
|
|
122
122
|
_operation?: T;
|
|
123
123
|
};
|
|
124
124
|
export type SocketSdkResult<T extends SocketSdkOperations> = SocketSdkSuccessResult<T> | SocketSdkErrorResult<T>;
|
|
125
|
+
/**
|
|
126
|
+
* Helper type to extract the data from a successful SDK operation result.
|
|
127
|
+
* @example
|
|
128
|
+
* type RepoData = SocketSdkData<'getOrgRepoList'>
|
|
129
|
+
*/
|
|
130
|
+
export type SocketSdkData<T extends SocketSdkOperations> = OpReturnType<operations[T]>;
|
|
131
|
+
/**
|
|
132
|
+
* Helper type to extract array element type from SDK operation results.
|
|
133
|
+
* Useful for typing items from paginated results.
|
|
134
|
+
* @example
|
|
135
|
+
* type RepoItem = SocketSdkArrayElement<'getOrgRepoList', 'results'>
|
|
136
|
+
*/
|
|
137
|
+
export type SocketSdkArrayElement<T extends SocketSdkOperations, K extends keyof SocketSdkData<T>> = SocketSdkData<T>[K] extends (infer U)[] ? U : never;
|
|
125
138
|
export type SocketSdkGenericResult<T> = {
|
|
126
139
|
cause?: undefined;
|
|
127
140
|
data: T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "SDK for the Socket API client",
|
|
6
6
|
"author": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@dotenvx/dotenvx": "1.49.0",
|
|
66
66
|
"@eslint/compat": "1.3.2",
|
|
67
67
|
"@eslint/js": "9.35.0",
|
|
68
|
-
"@socketsecurity/lib": "1.0.
|
|
68
|
+
"@socketsecurity/lib": "1.0.5",
|
|
69
69
|
"@socketsecurity/registry": "1.5.3",
|
|
70
70
|
"@types/node": "24.6.2",
|
|
71
71
|
"@typescript/native-preview": "7.0.0-dev.20250926.1",
|