@socketsecurity/sdk 3.0.15 → 3.0.16
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 -0
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/types/api.d.ts +62 -0
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.0.16](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.0.16) - 2025-10-29
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Updated OpenAPI types with new alert filtering capabilities:
|
|
12
|
+
- Added `github_installation_id` query parameter to diff scan endpoints for GitHub installation-specific settings
|
|
13
|
+
- Added KEV (Known Exploited Vulnerability) filter support (`filters.alertKEV`)
|
|
14
|
+
- Added EPSS (Exploit Prediction Scoring System) severity filter support (`filters.alertEPSS`)
|
|
15
|
+
- Updated aggregation fields to include `alertKEV` and `alertEPSS` options
|
|
16
|
+
|
|
7
17
|
## [3.0.15](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.0.15) - 2025-10-29
|
|
8
18
|
|
|
9
19
|
### Changed
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Socket SDK ESM - Built with esbuild */
|
|
2
|
-
var K={name:"@socketsecurity/sdk",version:"3.0.
|
|
2
|
+
var K={name:"@socketsecurity/sdk",version:"3.0.16",license:"MIT",description:"SDK for the Socket API client",author:{name:"Socket Inc",email:"eng@socket.dev",url:"https://socket.dev"},homepage:"https://github.com/SocketDev/socket-sdk-js",repository:{type:"git",url:"git://github.com/SocketDev/socket-sdk-js.git"},type:"module",main:"./dist/index.mjs",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.mjs"},"./package.json":"./package.json","./testing":{types:"./dist/testing.d.ts",default:"./dist/testing.mjs"},"./types/api":{types:"./types/api.d.ts",default:"./types/api.d.ts"},"./types/api-helpers":{types:"./types/api-helpers.d.ts",default:"./types/api-helpers.d.ts"}},scripts:{build:"node scripts/build.mjs",bump:"node scripts/bump.mjs",check:"node scripts/check.mjs",clean:"node scripts/clean.mjs",cover:"node scripts/cover.mjs",fix:"node scripts/lint.mjs --fix","generate-sdk":"node scripts/generate-sdk.mjs",lint:"node scripts/lint.mjs",precommit:"pnpm run check --lint --staged",prepare:"husky",prepublishOnly:"echo 'ERROR: Use GitHub Actions workflow for publishing' && exit 1",publish:"node scripts/publish.mjs",claude:"node scripts/claude.mjs",test:"node scripts/test.mjs",type:"tsgo --noEmit -p .config/tsconfig.check.json",update:"node scripts/update.mjs"},dependencies:{"@socketsecurity/lib":"2.8.1"},devDependencies:{"@babel/parser":"7.26.3","@babel/traverse":"7.26.4","@babel/types":"7.26.3","@biomejs/biome":"2.2.4","@dotenvx/dotenvx":"1.49.0","@eslint/compat":"1.3.2","@eslint/js":"9.35.0","@types/node":"24.6.2","@typescript/native-preview":"7.0.0-dev.20250926.1","@vitest/coverage-v8":"4.0.3",del:"8.0.1","dev-null-cli":"2.0.0",esbuild:"0.25.10",eslint:"9.35.0","eslint-import-resolver-typescript":"4.4.4","eslint-plugin-import-x":"4.16.1","eslint-plugin-jsdoc":"57.0.8","eslint-plugin-n":"17.23.1","eslint-plugin-sort-destructure-keys":"2.0.0","eslint-plugin-unicorn":"56.0.1","fast-glob":"3.3.3",globals:"16.4.0","http2-wrapper":"2.2.1",husky:"9.1.7","magic-string":"0.30.14",nock:"14.0.10","npm-run-all2":"8.0.4","openapi-typescript":"6.7.6",semver:"7.7.2",taze:"19.6.0","type-coverage":"2.29.7","typescript-eslint":"8.44.1",vitest:"4.0.3","yoctocolors-cjs":"2.1.3"},pnpm:{ignoredBuiltDependencies:["esbuild","unrs-resolver"],overrides:{vite:"7.1.12"}},engines:{node:">=18",pnpm:">=10.16.0"},files:["CHANGELOG.md","data/*.json","dist/*.d.ts","dist/*.js","dist/*.mjs","types/*.d.ts"],typeCoverage:{cache:!0,atLeast:99,ignoreAsAssertion:!0,ignoreCatch:!0,ignoreEmptyType:!0,"ignore-non-null-assertion":!0,"ignore-type-assertion":!0,"ignore-files":"test/*",strict:!0}};function L(a){let{homepage:e}=a;return`${a.name.replace("@","").replace("/","-")}/${a.version}${e?` (${e})`:""}`}var _=L(K),Z=3e4,ee=3,te=1e3,B=300*1e3,N=5e3,j=10*1024*1024,C=100*1024*1024,se="https://socketusercontent.com",Q=new Set(["http","https","http2"]),ge=new Map([["malware","error"],["criticalCVE","warn"],["didYouMean","warn"],["gitDependency","warn"],["httpDependency","warn"],["licenseSpdxDisj","warn"],["obfuscatedFile","warn"],["troll","warn"],["deprecated","monitor"],["mediumCVE","monitor"],["mildCVE","monitor"],["shrinkwrap","monitor"],["telemetry","monitor"],["unpopularPackage","monitor"],["unstableOwnership","monitor"],["ambiguousClassifier","ignore"],["badEncoding","ignore"],["badSemver","ignore"],["badSemverDependency","ignore"],["bidi","ignore"],["binScriptConfusion","ignore"],["chromeContentScript","ignore"],["chromeHostPermission","ignore"],["chromePermission","ignore"],["chromeWildcardHostPermission","ignore"],["chronoAnomaly","ignore"],["compromisedSSHKey","ignore"],["copyleftLicense","ignore"],["cve","ignore"],["debugAccess","ignore"],["deprecatedLicense","ignore"],["deprecatedException","ignore"],["dynamicRequire","ignore"],["emptyPackage","ignore"],["envVars","ignore"],["explicitlyUnlicensedItem","ignore"],["extraneousDependency","ignore"],["fileDependency","ignore"],["filesystemAccess","ignore"],["floatingDependency","ignore"],["gitHubDependency","ignore"],["gptAnomaly","ignore"],["gptDidYouMean","ignore"],["gptMalware","ignore"],["gptSecurity","ignore"],["hasNativeCode","ignore"],["highEntropyStrings","ignore"],["homoglyphs","ignore"],["installScripts","ignore"],["invalidPackageJSON","ignore"],["invisibleChars","ignore"],["licenseChange","ignore"],["licenseException","ignore"],["longStrings","ignore"],["majorRefactor","ignore"],["manifestConfusion","ignore"],["minifiedFile","ignore"],["miscLicenseIssues","ignore"],["missingAuthor","ignore"],["missingDependency","ignore"],["missingLicense","ignore"],["missingTarball","ignore"],["mixedLicense","ignore"],["modifiedException","ignore"],["modifiedLicense","ignore"],["networkAccess","ignore"],["newAuthor","ignore"],["noAuthorData","ignore"],["noBugTracker","ignore"],["noLicenseFound","ignore"],["noREADME","ignore"],["noRepository","ignore"],["noTests","ignore"],["noV1","ignore"],["noWebsite","ignore"],["nonOSILicense","ignore"],["nonSPDXLicense","ignore"],["nonpermissiveLicense","ignore"],["notice","ignore"],["obfuscatedRequire","ignore"],["peerDependency","ignore"],["potentialVulnerability","ignore"],["semverAnomaly","ignore"],["shellAccess","ignore"],["shellScriptOverride","ignore"],["socketUpgradeAvailable","ignore"],["suspiciousStarActivity","ignore"],["suspiciousString","ignore"],["trivialPackage","ignore"],["typeModuleCompatibility","ignore"],["uncaughtOptionalDependency","ignore"],["unclearLicense","ignore"],["unidentifiedLicense","ignore"],["unmaintained","ignore"],["unpublished","ignore"],["unresolvedRequire","ignore"],["unsafeCopyright","ignore"],["unusedDependency","ignore"],["urlStrings","ignore"],["usesEval","ignore"],["zeroWidth","ignore"]]);import re from"node:path";import{memoize as me}from"@socketsecurity/lib/memoization";import{normalizePath as ne}from"@socketsecurity/lib/path";var G=me(a=>a.endsWith("/")?a:`${a}/`,{name:"normalizeBaseUrl"});function z(){if(Promise.withResolvers)return Promise.withResolvers();let a={};return a.promise=new Promise((e,t)=>{a.resolve=e,a.reject=t}),a}function S(a){let e=new URLSearchParams(a),t={__proto__:null},s=e.entries();for(let r of s){let n=r[0],o=r[1];n==="defaultBranch"?n="default_branch":n==="perPage"&&(n="per_page"),o&&(t[n]=o)}return new URLSearchParams(t)}function U(a,e){let t=E(e);return a.map(s=>ne(re.resolve(t,s)))}function E(a="."){return ne(re.resolve(process.cwd(),a))}import J from"node:events";import{createReadStream as Re}from"node:fs";import M from"node:path";import{Readable as Se}from"node:stream";import{normalizePath as we}from"@socketsecurity/lib/path";import he from"node:http";import ye from"node:https";import{debugLog as ae}from"@socketsecurity/lib/debug";import{jsonParse as fe}from"@socketsecurity/lib/json";import{perfTimer as W}from"@socketsecurity/lib/performance";var R=class a extends Error{response;constructor(e,t=""){let s=e.statusCode??"unknown",r=e.statusMessage??"No status message";super(`Socket API ${t||"Request failed"} (${s}): ${r}`),this.name="ResponseError",this.response=e,Error.captureStackTrace(this,a)}};async function I(a,e,t){let s=P(a).request(`${a}${e}`,{method:"DELETE",...t}).end();return await k(s)}async function l(a,e,t){let s=W("http:get",{urlPath:e});try{let r=P(a).request(`${a}${e}`,{method:"GET",...t}).end(),n=await k(r);return s({statusCode:n.statusCode}),n}catch(r){throw s({error:!0}),r}}async function y(a,e,t,s,r){let n=W(`http:${a.toLowerCase()}`,{urlPath:t});try{let o=JSON.stringify(s),i=P(e).request(`${e}${t}`,{method:a,...r,headers:{...r.headers,"Content-Length":Buffer.byteLength(o,"utf8"),"Content-Type":"application/json"}});i.write(o),i.end();let u=await k(i);return n({statusCode:u.statusCode}),u}catch(o){throw n({error:!0}),o}}async function x(a){return await new Promise((e,t)=>{let s="",r=0;a.setEncoding("utf8"),a.on("data",n=>{let o=Buffer.byteLength(n,"utf8");if(r+=o,r>j){a.destroy(),t(new Error(`Response exceeds maximum size limit of ${j} bytes`));return}s+=n}),a.on("end",()=>e(s)),a.on("error",n=>t(n))})}function P(a){return a.startsWith("https:")?ye:he}async function k(a){return await new Promise((e,t)=>{let s=!1;a.on("response",r=>{s||e(r)}),a.on("timeout",()=>{s=!0,a.destroy(),t(new Error("Request timed out"))}),a.on("error",r=>{s||t(r)})})}async function c(a,e){let t=W("http:parse-json");try{if(!O(a))throw new R(a,e?`${e} Request failed`:void 0);let s=await x(a);if(s==="")return ae("API response: empty response treated as {}"),t({success:!0}),{};try{let r=fe(s);return ae("API response:",r),t({success:!0}),r}catch(r){if(t({error:!0}),r instanceof SyntaxError){let o=new Error(`Socket API - Invalid JSON response:
|
|
3
3
|
${s}
|
|
4
4
|
\u2192 ${r.message}`,{cause:r});throw o.name="SyntaxError",o.originalResponse=s,Object.setPrototypeOf(o,SyntaxError.prototype),o}if(r instanceof Error)throw r;let n=new Error("Unknown JSON parsing error",{cause:r});throw n.name="SyntaxError",n.originalResponse=s,Object.setPrototypeOf(n,SyntaxError.prototype),n}}catch(s){throw t({error:!0}),s}}function O(a){let{statusCode:e}=a;return e?e>=200&&e<300:!1}function v(a,e,t){if(!e){let s=t?t.split(","):void 0,r=n=>({name:n.name,version:n.version,size:n.size,author:n.author,type:n.type,supplyChainRisk:n.supplyChainRisk,scorecards:n.scorecards,topLevelAncestors:n.topLevelAncestors,alerts:n.alerts?.filter(o=>!(o.severity==="low"||s&&o.action&&!s.includes(o.action))).map(o=>({type:o.type,severity:o.severity,key:o.key}))});if(a.artifacts){let n=a.artifacts;return{...a,artifacts:Array.isArray(n)?n.map(r):n}}if(a.alerts)return r(a)}return a}function $(a,e){let t=[];for(let s of a){let r=we(M.relative(e,s)),n=M.basename(s);t.push([`Content-Disposition: form-data; name="${r}"; filename="${n}"\r
|
|
5
5
|
`,`Content-Type: application/octet-stream\r
|
package/package.json
CHANGED
package/types/api.d.ts
CHANGED
|
@@ -4906,6 +4906,8 @@ export interface operations {
|
|
|
4906
4906
|
use_cursor?: boolean
|
|
4907
4907
|
/** @description A Unix timestamp in seconds that filters full-scans prior to the date. */
|
|
4908
4908
|
from?: string
|
|
4909
|
+
/** @description A repository workspace to filter full-scans by. */
|
|
4910
|
+
workspace?: string
|
|
4909
4911
|
/** @description A repository slug to filter full-scans by. */
|
|
4910
4912
|
repo?: string
|
|
4911
4913
|
/** @description A branch name to filter full-scans by. */
|
|
@@ -4954,6 +4956,8 @@ export interface operations {
|
|
|
4954
4956
|
/** @default */
|
|
4955
4957
|
api_url?: string | null
|
|
4956
4958
|
/** @default */
|
|
4959
|
+
workspace?: string
|
|
4960
|
+
/** @default */
|
|
4957
4961
|
repo?: string
|
|
4958
4962
|
/** @default */
|
|
4959
4963
|
html_report_url?: string
|
|
@@ -5009,6 +5013,8 @@ export interface operations {
|
|
|
5009
5013
|
query: {
|
|
5010
5014
|
/** @description The slug of the repository to associate the full-scan with. */
|
|
5011
5015
|
repo: string
|
|
5016
|
+
/** @description The workspace of the repository to associate the full-scan with. */
|
|
5017
|
+
workspace?: string
|
|
5012
5018
|
/** @description The branch name to associate the full-scan with. Branch names must follow Git branch name rules: be 1–255 characters long; cannot be exactly @; cannot begin or end with /, ., or .lock; cannot contain "//", "..", or "@{"; and cannot include control characters, spaces, or any of ~^:?*[. */
|
|
5013
5019
|
branch?: string
|
|
5014
5020
|
/** @description The commit message to associate the full-scan with. */
|
|
@@ -5077,6 +5083,8 @@ export interface operations {
|
|
|
5077
5083
|
/** @default */
|
|
5078
5084
|
api_url?: string | null
|
|
5079
5085
|
/** @default */
|
|
5086
|
+
workspace?: string
|
|
5087
|
+
/** @default */
|
|
5080
5088
|
repo?: string
|
|
5081
5089
|
/** @default */
|
|
5082
5090
|
html_report_url?: string
|
|
@@ -5236,6 +5244,8 @@ export interface operations {
|
|
|
5236
5244
|
/** @default */
|
|
5237
5245
|
api_url?: string | null
|
|
5238
5246
|
/** @default */
|
|
5247
|
+
workspace?: string
|
|
5248
|
+
/** @default */
|
|
5239
5249
|
repo?: string
|
|
5240
5250
|
/** @default */
|
|
5241
5251
|
html_report_url?: string
|
|
@@ -6015,6 +6025,8 @@ export interface operations {
|
|
|
6015
6025
|
integration_org_slug?: string
|
|
6016
6026
|
/** @description Set to true when running a diff between a merged commit and its parent commit in the same branch. Set to false when running diffs in an open PR between unmerged commits. */
|
|
6017
6027
|
merge?: boolean
|
|
6028
|
+
/** @description The workspace of the repository. */
|
|
6029
|
+
workspace?: string
|
|
6018
6030
|
}
|
|
6019
6031
|
path: {
|
|
6020
6032
|
/** @description The slug of the organization */
|
|
@@ -6486,6 +6498,11 @@ export interface operations {
|
|
|
6486
6498
|
* @default main
|
|
6487
6499
|
*/
|
|
6488
6500
|
default_branch?: string | null
|
|
6501
|
+
/**
|
|
6502
|
+
* @description The workspace of the repository
|
|
6503
|
+
* @default
|
|
6504
|
+
*/
|
|
6505
|
+
workspace?: string
|
|
6489
6506
|
}>
|
|
6490
6507
|
/** @default 0 */
|
|
6491
6508
|
nextPage: number | null
|
|
@@ -6551,6 +6568,11 @@ export interface operations {
|
|
|
6551
6568
|
* @default main
|
|
6552
6569
|
*/
|
|
6553
6570
|
default_branch?: string | null
|
|
6571
|
+
/**
|
|
6572
|
+
* @description The workspace of the repository
|
|
6573
|
+
* @default
|
|
6574
|
+
*/
|
|
6575
|
+
workspace?: string
|
|
6554
6576
|
}
|
|
6555
6577
|
}
|
|
6556
6578
|
}
|
|
@@ -6641,6 +6663,11 @@ export interface operations {
|
|
|
6641
6663
|
* @default main
|
|
6642
6664
|
*/
|
|
6643
6665
|
default_branch?: string | null
|
|
6666
|
+
/**
|
|
6667
|
+
* @description The workspace of the repository
|
|
6668
|
+
* @default
|
|
6669
|
+
*/
|
|
6670
|
+
workspace?: string
|
|
6644
6671
|
}
|
|
6645
6672
|
}
|
|
6646
6673
|
}
|
|
@@ -6662,6 +6689,10 @@ export interface operations {
|
|
|
6662
6689
|
*/
|
|
6663
6690
|
getOrgRepo: {
|
|
6664
6691
|
parameters: {
|
|
6692
|
+
query?: {
|
|
6693
|
+
/** @description The workspace of the repository */
|
|
6694
|
+
workspace?: string
|
|
6695
|
+
}
|
|
6665
6696
|
path: {
|
|
6666
6697
|
/** @description The slug of the organization */
|
|
6667
6698
|
org_slug: string
|
|
@@ -6756,6 +6787,11 @@ export interface operations {
|
|
|
6756
6787
|
* @default main
|
|
6757
6788
|
*/
|
|
6758
6789
|
default_branch: string | null
|
|
6790
|
+
/**
|
|
6791
|
+
* @description The workspace of the repository
|
|
6792
|
+
* @default
|
|
6793
|
+
*/
|
|
6794
|
+
workspace: string
|
|
6759
6795
|
/**
|
|
6760
6796
|
* @description The slug of the repository. This typo is intentionally preserved for backwards compatibility reasons.
|
|
6761
6797
|
* @default
|
|
@@ -6782,6 +6818,10 @@ export interface operations {
|
|
|
6782
6818
|
*/
|
|
6783
6819
|
updateOrgRepo: {
|
|
6784
6820
|
parameters: {
|
|
6821
|
+
query?: {
|
|
6822
|
+
/** @description The workspace of the repository */
|
|
6823
|
+
workspace?: string
|
|
6824
|
+
}
|
|
6785
6825
|
path: {
|
|
6786
6826
|
/** @description The slug of the organization */
|
|
6787
6827
|
org_slug: string
|
|
@@ -6823,6 +6863,11 @@ export interface operations {
|
|
|
6823
6863
|
* @default main
|
|
6824
6864
|
*/
|
|
6825
6865
|
default_branch?: string | null
|
|
6866
|
+
/**
|
|
6867
|
+
* @description The workspace of the repository
|
|
6868
|
+
* @default
|
|
6869
|
+
*/
|
|
6870
|
+
workspace?: string
|
|
6826
6871
|
}
|
|
6827
6872
|
}
|
|
6828
6873
|
}
|
|
@@ -6913,6 +6958,11 @@ export interface operations {
|
|
|
6913
6958
|
* @default main
|
|
6914
6959
|
*/
|
|
6915
6960
|
default_branch?: string | null
|
|
6961
|
+
/**
|
|
6962
|
+
* @description The workspace of the repository
|
|
6963
|
+
* @default
|
|
6964
|
+
*/
|
|
6965
|
+
workspace?: string
|
|
6916
6966
|
}
|
|
6917
6967
|
}
|
|
6918
6968
|
}
|
|
@@ -6934,6 +6984,10 @@ export interface operations {
|
|
|
6934
6984
|
*/
|
|
6935
6985
|
deleteOrgRepo: {
|
|
6936
6986
|
parameters: {
|
|
6987
|
+
query?: {
|
|
6988
|
+
/** @description The workspace of the repository */
|
|
6989
|
+
workspace?: string
|
|
6990
|
+
}
|
|
6937
6991
|
path: {
|
|
6938
6992
|
/** @description The slug of the organization */
|
|
6939
6993
|
org_slug: string
|
|
@@ -14824,6 +14878,12 @@ export interface operations {
|
|
|
14824
14878
|
* - report:write
|
|
14825
14879
|
*/
|
|
14826
14880
|
createReport: {
|
|
14881
|
+
parameters: {
|
|
14882
|
+
query?: {
|
|
14883
|
+
/** @description The workspace of the repository to associate the full-scan with. */
|
|
14884
|
+
workspace?: string
|
|
14885
|
+
}
|
|
14886
|
+
}
|
|
14827
14887
|
requestBody?: {
|
|
14828
14888
|
content: {
|
|
14829
14889
|
'multipart/form-data': {
|
|
@@ -14925,6 +14985,8 @@ export interface operations {
|
|
|
14925
14985
|
github_full_name: string
|
|
14926
14986
|
/** @default */
|
|
14927
14987
|
organization_id: string | null
|
|
14988
|
+
/** @default */
|
|
14989
|
+
workspace: string
|
|
14928
14990
|
latest_project_report?: {
|
|
14929
14991
|
/** @default */
|
|
14930
14992
|
id: string
|