Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@socketsecurity/sdk

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socketsecurity/sdk - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

10

index.d.ts

@@ -52,2 +52,12 @@ export type SocketSdkOperations = keyof import('./types/api').operations;

}): Promise<SocketSdkResultType<'updateOrgRepo'>>;
batchPackageFetch(queryParams: {
[key: string]: string;
}, components: {
components: {
purl: string;
}[];
}): Promise<SocketSdkResultType<'batchPackageFetch'>>;
searchDependencies(params: {
[key: string]: number;
}): Promise<SocketSdkResultType<'searchDependencies'>>;
postSettings(selectors: Array<{

@@ -54,0 +64,0 @@ organization?: string;

@@ -496,2 +496,39 @@ 'use strict'

/**
* @param {{[key: string]: string }} queryParams
* @param {{components: {purl: string}[] }} components
* @returns {Promise<SocketSdkResultType<'batchPackageFetch'>>}
*/
async batchPackageFetch (queryParams, components) {
const formattedQueryParam = new URLSearchParams(queryParams)
try {
const client = await this.#getClient()
const data = await client.post(`purl?${formattedQueryParam}`, { json: components })
// Parse the ndjson response
const /** @type {{[key: string]: any}[]} */ resp_json = []
const ndjson = data.body.split('\n')
ndjson.map(o => o && resp_json.push(JSON.parse(o)))
return { success: true, status: 200, data: resp_json }
} catch (err) {
return /** @type {SocketSdkErrorType<'batchPackageFetch'>} */ (this.#handleApiError(err))
}
}
/**
* @param {{[key: string]: number }} params
* @returns {Promise<SocketSdkResultType<'searchDependencies'>>}
*/
async searchDependencies (params) {
try {
const client = await this.#getClient()
const data = await client.post('dependencies/search', { json: params }).json()
return { success: true, status: 200, data }
} catch (err) {
return /** @type {SocketSdkErrorType<'searchDependencies'>} */ (this.#handleApiError(err))
}
}
/**
* @param {Array<{ organization?: string }>} selectors

@@ -498,0 +535,0 @@ * @returns {Promise<SocketSdkResultType<'postSettings'>>}

2

package.json
{
"name": "@socketsecurity/sdk",
"version": "1.1.1",
"version": "1.2.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "SDK for the Socket API client",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc