feat(sdk): bump socket-cli v1.x to @socketsecurity/sdk 4.x (SURF-1446 + SURF-742)#1427
Open
John-David Dalton (jdalton) wants to merge 1 commit into
Open
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…, SURF-742)
Bumps @socketsecurity/sdk 1.4.96 -> 4.0.3 and migrates every call site to
the 4.x API. SDK v4 renamed most org-scoped methods (getOrgFullScan* ->
getFullScan/streamFullScan/listFullScans, *OrgRepo -> *Repository,
getOrganizations -> listOrganizations, getSupportedScanFiles ->
getSupportedFiles) and reshaped several option/result types.
- Repository, scan, org and audit-log fetchers updated to the renamed
methods and new option shapes; result annotations retargeted to the new
operation-name keys so they stay type-safe.
- getSupportedFiles is org-scoped now: fetchSupportedScanFileNames takes an
orgSlug (threaded from callers, getDefaultOrgSlug fallback).
- createFullScan drops the positional cwd for options.pathsRelativeTo and a
numeric pull_request; uploadManifestFiles takes { pathsRelativeTo }.
- setupSdk clamps SOCKET_CLI_API_TIMEOUT into [5000, 300000] before
forwarding (v4 throws a TypeError outside that range; the CLI default of
0/unset is invalid).
- ALL_ECOSYSTEMS gains clawhub + socket for the PURL_Type exhaustiveness
check against 4.x.
- handleApiCall / handleApiCallNoSpinner infer the whole result union and
derive success data via a distributive conditional so the SDK 4.x strict
result types (OrganizationsResult, RepositoryResult, DeleteResult, ...)
stay assignable under exactOptionalPropertyTypes; callers drop explicit
operation type args.
SURF-742: socket scan view (default and --json non-stream) reads cached
immutable results via ?cached=true with 202->200 backoff polling; --stream
stays on the streaming method. Adds fetch-scan.test.mts.
John-David Dalton (jdalton)
force-pushed
the
jdalton/surf-1446-bump-socket-cli-v1x-to-socket-sdk-js-4x
branch
from
July 24, 2026 21:49
3679ad4 to
39d4f2c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bumps
@socketsecurity/sdk1.4.96 → 4.0.2 on thev1.xline and migrates every call site. This PR is SURF-1446 (v1.x → latest SDK) and delivers SURF-742 (cachedscan view) by riding the bump. Ported againstmain, which is already on SDK 4.x.SDK 4.x deltas handled
4.x renamed most org-scoped methods and reshaped option/result types:
getOrgFullScan*→getFullScan/streamFullScan/listFullScans/getFullScanMetadata/deleteFullScancreateOrgRepo/getOrgRepo/getOrgRepoList/updateOrgRepo/deleteOrgRepo→createRepository/getRepository/listRepositories/updateRepository/deleteRepositorygetOrganizations→listOrganizations;getSupportedScanFiles→getSupportedFilescreateFullScan: positionalcwd→options.pathsRelativeTo;pull_requestnow numericuploadManifestFiles: positional string →{ pathsRelativeTo }Blast radius: 40 source files across scan/repository/organization/audit-log/package + utils. All
SocketSdkSuccessResult<'op'>annotations retargeted to the new operation keys so they stay type-safe (stale keys silently resolve toanyin 4.x).Notable behavior/compat fixes:
getSupportedFilesis org-scoped in v4 —fetchSupportedScanFileNamesnow takes anorgSlug(threaded from callers,getDefaultOrgSlugfallback).setupSdkonly forwards atimeoutwhen set — v4 validates[5000, 300000]ms and the CLI default (0/unset) is invalid, which otherwise threw on every call.ALL_ECOSYSTEMSgainsclawhub+socketto satisfy thePURL_Typeexhaustiveness check against 4.x.SURF-742 — cached scan view
socket scan viewdefault +--json(non-stream) now read pre-computed results via...full-scans/{id}?cached=true, polling 202→200 with exponential backoff (1s→10s, 10min budget) and parsing the 200 ndjson (queryApiSafeTextWithStatus, matching howmain's CLI does it — the SDK'sgetFullScanreturns scan metadata, not the artifact list).--stream --jsonstays on the streaming method (streamFullScan).No casts/shims to force compilation — the one adaptation cast (
enabledState) is for a__proto__: nullliteral against v4's widenedALERT_TYPE.Verification
tsgo: clean (0 errors; baseline was clean, so all 39 initial errors were bump-driven and resolved)eslint+oxlint+biome: cleanfetch-scan.test.mts(5, nock, incl. 202→200 poll),api.test.mts(10), plus repository/organization/audit-log/package/scan command + output + util suites — all green (~200 tests across touched areas). Updated one v1.x integration test (cmd-scan-create"no manifest files") since an invalid token now fails at the org-scoped supported-files fetch.Don't merge yet.
Note
High Risk
Major dependency jump with broad changes to scan create/view, uploads, and org/repo APIs; cached scan polling and org-scoped manifest discovery alter failure modes and timing for core CLI workflows.
Overview
Upgrades
@socketsecurity/sdkfrom 1.4.96 to 4.0.2 and updates every call site to match 4.x method names and payloads (repos, full scans, org list, supported files, manifest upload/create scan).API migration highlights:
getOrganizations→listOrganizations; repo CRUD/list →createRepository/getRepository/listRepositories/ etc.; full-scan ops →createFullScan,listFullScans,deleteFullScan,getFullScanMetadata;getSupportedScanFiles→getSupportedFiles(orgSlug)withorgSlugthreaded through scan/fix/GitHub flows. Upload/create paths use{ pathsRelativeTo }instead of a positional cwd; pagination and flags are numbers/booleans rather than stringified query params.setupSdkonly passestimeoutwhen set so v4’s[5000, 300000]validation does not reject the CLI default of0.Scan view (SURF-742):
fetchScanloads artifacts via?cached=true, polls 202 with exponential backoff (newqueryApiSafeTextWithStatus), and fails fast on bad NDJSON; streaming usesstreamFullScan. Addsfetch-scan.test.mts(nock).ALL_ECOSYSTEMSaddsclawhubandsocketfor SDK type exhaustiveness.Tests and typings are aligned to new
SocketSdkSuccessResult<'…'>operation keys; one integration test tolerates auth failing earlier on org-scoped supported-files lookup.Reviewed by Cursor Bugbot for commit d684814. Configure here.