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

@snyk/code-client

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snyk/code-client - npm Package Compare versions

Comparing version 4.12.2 to 4.12.3

2

dist/http.d.ts

@@ -34,2 +34,3 @@ /// <reference types="node" />

}
export declare function setBase64Encoding(options: ConnectionOptions): boolean;
export declare function compressAndEncode(payload: any): Promise<Buffer>;

@@ -94,2 +95,3 @@ export declare function startSession(options: StartSessionOptions): StartSessionResponseDto;

export declare function getAnalysis(options: GetAnalysisOptions): Promise<Result<GetAnalysisResponseDto, GetAnalysisErrorCodes>>;
export declare function getVerifyCallbackUrl(authHost: string): string;
export {};

41

dist/http.js

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getAnalysis = exports.AnalysisStatus = exports.extendBundle = exports.checkBundle = exports.createBundle = exports.getFilters = exports.checkSession = exports.getIpFamily = exports.startSession = exports.compressAndEncode = void 0;
exports.getVerifyCallbackUrl = exports.getAnalysis = exports.AnalysisStatus = exports.extendBundle = exports.checkBundle = exports.createBundle = exports.getFilters = exports.checkSession = exports.getIpFamily = exports.startSession = exports.compressAndEncode = exports.setBase64Encoding = void 0;
const uuid_1 = require("uuid");

@@ -14,2 +14,3 @@ const lodash_pick_1 = __importDefault(require("lodash.pick"));

const needle_1 = require("./needle");
const url_1 = require("url");
// The trick to typecast union type alias

@@ -45,2 +46,18 @@ function isSubsetErrorCode(code, messages) {

};
function setBase64Encoding(options) {
if (!options.base64Encoding) {
const { hostname } = new url_1.URL(options.baseURL);
const rg = new RegExp('^(|dev.)snyk.io');
if (rg.test(hostname.slice(hostname.indexOf('.') + 1))) {
return options.base64Encoding;
}
else {
return true;
}
}
else {
return options.base64Encoding;
}
}
exports.setBase64Encoding = setBase64Encoding;
async function compressAndEncode(payload) {

@@ -71,3 +88,3 @@ // encode payload and compress;

const res = await (0, needle_1.makeRequest)({
url: `${authHost}/verify/callback`,
url: getVerifyCallbackUrl(authHost),
method: 'post',

@@ -91,3 +108,3 @@ family, // family param forces the handler to dispatch a request using IP at "family" version

const res = await (0, needle_1.makeRequest)({
url: `${options.authHost}/api/v1/verify/callback`,
url: getVerifyCallbackUrl(options.authHost),
body: {

@@ -137,4 +154,5 @@ token: options.draftToken,

async function createBundle(options) {
const base64Encoding = setBase64Encoding(options);
let payloadBody;
if (options.base64Encoding) {
if (base64Encoding) {
payloadBody = await compressAndEncode(options.files);

@@ -150,3 +168,3 @@ }

...(options.requestId && { 'snyk-request-id': options.requestId }),
...(options.base64Encoding ? { 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' } : null),
...(base64Encoding ? { 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' } : null),
},

@@ -156,3 +174,3 @@ url: `${options.baseURL}/bundle`,

body: payloadBody,
isJson: options.base64Encoding ? false : true,
isJson: base64Encoding ? false : true,
};

@@ -196,4 +214,5 @@ const res = await (0, needle_1.makeRequest)(payload);

async function extendBundle(options) {
const base64Encoding = setBase64Encoding(options);
let payloadBody;
if (options.base64Encoding) {
if (base64Encoding) {
payloadBody = await compressAndEncode((0, lodash_pick_1.default)(options, ['files', 'removedFiles']));

@@ -209,3 +228,3 @@ }

...(options.requestId && { 'snyk-request-id': options.requestId }),
...(options.base64Encoding ? { 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' } : null),
...(base64Encoding ? { 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' } : null),
},

@@ -215,3 +234,3 @@ url: `${options.baseURL}/bundle/${options.bundleHash}`,

body: payloadBody,
isJson: options.base64Encoding ? false : true,
isJson: base64Encoding ? false : true,
});

@@ -266,2 +285,6 @@ if (res.success)

exports.getAnalysis = getAnalysis;
function getVerifyCallbackUrl(authHost) {
return `${authHost}/api/verify/callback`;
}
exports.getVerifyCallbackUrl = getVerifyCallbackUrl;
//# sourceMappingURL=http.js.map
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import { OutgoingHttpHeaders } from 'http';

@@ -3,0 +7,0 @@ import needle from 'needle';

@@ -86,3 +86,3 @@ {

},
"version": "4.12.2"
"version": "4.12.3"
}

Sorry, the diff of this file is not supported yet

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