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.18.3 to 4.18.4

5

dist/http.d.ts

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

export declare function getAnalysis(options: GetAnalysisOptions): Promise<Result<GetAnalysisResponseDto, GetAnalysisErrorCodes>>;
export type ReportErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.badRequest | ErrorCodes.notFound;
export interface UploadReportOptions extends GetAnalysisOptions {

@@ -107,5 +108,5 @@ report: ReportOptions;

export type UploadReportResponseDto = ReportResult | AnalysisFailedResponse | AnalysisResponseProgress;
export declare function initReport(options: UploadReportOptions): Promise<Result<InitUploadResponseDto, GetAnalysisErrorCodes>>;
export declare function getReport(options: GetReportOptions): Promise<Result<UploadReportResponseDto, GetAnalysisErrorCodes>>;
export declare function initReport(options: UploadReportOptions): Promise<Result<InitUploadResponseDto, ReportErrorCodes>>;
export declare function getReport(options: GetReportOptions): Promise<Result<UploadReportResponseDto, ReportErrorCodes>>;
export declare function getVerifyCallbackUrl(authHost: string): string;
export {};

17

dist/http.js

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

}
function generateError(errorCode, messages, apiName) {
function generateError(errorCode, messages, apiName, error) {
if (!isSubsetErrorCode(errorCode, messages)) {

@@ -26,3 +26,3 @@ throw { errorCode, messages, apiName };

const statusCode = errorCode;
const statusText = messages[errorCode];
const statusText = error !== null && error !== void 0 ? error : messages[errorCode];
return {

@@ -241,2 +241,10 @@ type: 'error',

exports.getAnalysis = getAnalysis;
const REPORT_ERROR_MESSAGES = {
...GENERIC_ERROR_MESSAGES,
[constants_1.ErrorCodes.unauthorizedUser]: constants_1.DEFAULT_ERROR_MESSAGES[constants_1.ErrorCodes.unauthorizedUser],
[constants_1.ErrorCodes.unauthorizedBundleAccess]: constants_1.DEFAULT_ERROR_MESSAGES[constants_1.ErrorCodes.unauthorizedBundleAccess],
[constants_1.ErrorCodes.notFound]: constants_1.DEFAULT_ERROR_MESSAGES[constants_1.ErrorCodes.notFound],
[constants_1.ErrorCodes.badRequest]: constants_1.DEFAULT_ERROR_MESSAGES[constants_1.ErrorCodes.badRequest],
[constants_1.ErrorCodes.serverError]: 'Getting report failed',
};
async function initReport(options) {

@@ -268,6 +276,7 @@ const config = {

return { type: 'success', value: res.body };
return generateError(res.errorCode, GET_ANALYSIS_ERROR_MESSAGES, 'initReport');
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport');
}
exports.initReport = initReport;
async function getReport(options) {
var _a;
const config = {

@@ -283,3 +292,3 @@ headers: {

return { type: 'success', value: res.body };
return generateError(res.errorCode, GET_ANALYSIS_ERROR_MESSAGES, 'getReport');
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message);
}

@@ -286,0 +295,0 @@ exports.getReport = getReport;

@@ -50,2 +50,3 @@ "use strict";

async function makeRequest(payload, attempts = constants_1.MAX_RETRY_ATTEMPTS) {
var _a;
let data;

@@ -99,2 +100,7 @@ if (!payload.isJson && payload.body) {

}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
const errorMessage = (_a = response === null || response === void 0 ? void 0 : response.body) === null || _a === void 0 ? void 0 : _a.error;
if (errorMessage) {
error = error !== null && error !== void 0 ? error : new Error(errorMessage);
}
errorCode = errorCode !== null && errorCode !== void 0 ? errorCode : constants_1.ErrorCodes.serviceUnavailable;

@@ -101,0 +107,0 @@ // Try to avoid breaking requests due to temporary network errors

@@ -14,7 +14,13 @@ "use strict";

var _a, _b;
// Return early if project name is not provided.
const projectName = (_b = (_a = options.report) === null || _a === void 0 ? void 0 : _a.projectName) === null || _b === void 0 ? void 0 : _b.trim();
const projectNameMaxLength = 64;
if (!projectName || projectName.length === 0) {
throw new Error('"project-name" must be provided for "report"');
}
if (projectName.length > projectNameMaxLength) {
throw new Error(`"project-name" must not exceed ${projectNameMaxLength} characters`);
}
if (/[^A-Za-z0-9-_/]/g.test(projectName)) {
throw new Error(`"project-name" must not contain spaces or special characters except [/-_]`);
}
emitter_1.emitter.analyseProgress({

@@ -21,0 +27,0 @@ status: http_1.AnalysisStatus.waiting,

@@ -93,3 +93,3 @@ {

},
"version": "4.18.3"
"version": "4.18.4"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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