Socket
Socket
Sign inDemoInstall

@snyk/code-client

Package Overview
Dependencies
Maintainers
1
Versions
102
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.23.3 to 4.23.4

24

dist/http.js

@@ -19,5 +19,5 @@ "use strict";

}
function generateError(errorCode, messages, apiName, errorMessage, jsonApiError) {
if (jsonApiError) {
return httpUtils_1.generateErrorWithDetail(jsonApiError, errorCode, apiName);
function generateError(errorCode, messages, apiName, errorMessage, errors) {
if (errors) {
return httpUtils_1.generateErrorWithDetail(errors[0], errorCode, apiName);
}

@@ -130,3 +130,3 @@ if (!isSubsetErrorCode(errorCode, messages)) {

}
return generateError(res.errorCode, GENERIC_ERROR_MESSAGES, apiName, undefined, res.jsonApiError);
return generateError(res.errorCode, GENERIC_ERROR_MESSAGES, apiName, undefined, res.errors);
}

@@ -175,3 +175,3 @@ exports.getFilters = getFilters;

}
return generateError(res.errorCode, CREATE_BUNDLE_ERROR_MESSAGES, 'createBundle', undefined, res.jsonApiError);
return generateError(res.errorCode, CREATE_BUNDLE_ERROR_MESSAGES, 'createBundle', undefined, res.errors);
}

@@ -202,3 +202,3 @@ exports.createBundle = createBundle;

return { type: 'success', value: res.body };
return generateError(res.errorCode, CHECK_BUNDLE_ERROR_MESSAGES, 'checkBundle', undefined, res.jsonApiError);
return generateError(res.errorCode, CHECK_BUNDLE_ERROR_MESSAGES, 'checkBundle', undefined, res.errors);
}

@@ -236,3 +236,3 @@ exports.checkBundle = checkBundle;

return { type: 'success', value: res.body };
return generateError(res.errorCode, EXTEND_BUNDLE_ERROR_MESSAGES, 'extendBundle', undefined, res.jsonApiError);
return generateError(res.errorCode, EXTEND_BUNDLE_ERROR_MESSAGES, 'extendBundle', undefined, res.errors);
}

@@ -286,3 +286,3 @@ exports.extendBundle = extendBundle;

}
return generateError(res.errorCode, GET_ANALYSIS_ERROR_MESSAGES, 'getAnalysis', undefined, res.jsonApiError);
return generateError(res.errorCode, GET_ANALYSIS_ERROR_MESSAGES, 'getAnalysis', undefined, res.errors);
}

@@ -334,3 +334,3 @@ exports.getAnalysis = getAnalysis;

return { type: 'success', value: res.body.reportId };
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport', undefined, res.jsonApiError);
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport', undefined, res.errors);
}

@@ -360,3 +360,3 @@ exports.initReport = initReport;

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

@@ -392,3 +392,3 @@ exports.getReport = getReport;

return { type: 'success', value: res.body.testId };
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport', undefined, res.jsonApiError);
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport', undefined, res.errors);
}

@@ -418,5 +418,5 @@ exports.initScmReport = initScmReport;

return { type: 'success', value: res.body };
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message, res.jsonApiError);
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message, res.errors);
}
exports.getScmReport = getScmReport;
//# sourceMappingURL=http.js.map

@@ -1,2 +0,15 @@

export declare type JsonApiError = {
declare enum Classification {
UNEXPECTED = "UNEXPECTED",
ACTIONABLE = "ACTIONABLE",
UNSUPPORTED = "UNSUPPORTED"
}
declare type JsonApiErrorSource = {
pointer: string;
} | {
parameter: string;
} | {
header: string;
};
export declare type JsonApiErrorObject = {
id?: string;
links?: {

@@ -9,2 +22,10 @@ about?: string;

detail: string;
source?: JsonApiErrorSource;
meta: {
[x: string]: any;
isErrorCatalogError: boolean;
classification?: Classification;
logs?: string[];
};
};
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Classification;
(function (Classification) {
Classification["UNEXPECTED"] = "UNEXPECTED";
Classification["ACTIONABLE"] = "ACTIONABLE";
Classification["UNSUPPORTED"] = "UNSUPPORTED";
})(Classification || (Classification = {}));
//# sourceMappingURL=json-api.js.map

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

import * as querystring from 'querystring';
import { JsonApiError } from './interfaces/json-api';
import { JsonApiErrorObject } from './interfaces/json-api';
export declare interface Global extends NodeJS.Global {

@@ -28,5 +28,5 @@ ignoreUnknownCA: boolean;

error: Error | undefined;
jsonApiError?: JsonApiError | undefined;
errors?: JsonApiErrorObject[] | undefined;
};
export declare function makeRequest<T = void>(payload: Payload, attempts?: number): Promise<SuccessResponse<T> | FailedResponse>;
export {};

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

const constants_1 = require("./constants");
const httpUtils_1 = require("./utils/httpUtils");
const sleep = (duration) => new Promise(resolve => setTimeout(resolve, duration));

@@ -83,3 +82,2 @@ const TIMEOUT_DEFAULT = 600000;

let error;
let jsonApiError;
let response;

@@ -103,5 +101,2 @@ try {

const errors = (_b = response === null || response === void 0 ? void 0 : response.body) === null || _b === void 0 ? void 0 : _b.errors;
if (httpUtils_1.isJsonApiErrors(errors)) {
jsonApiError = errors[0];
}
if (errorMessage) {

@@ -126,3 +121,3 @@ error = error !== null && error !== void 0 ? error : new Error(errorMessage);

attempts = 0;
return { success: false, errorCode, error, jsonApiError };
return { success: false, errorCode, error, errors };
}

@@ -129,0 +124,0 @@ } while (attempts > 0);

@@ -1,5 +0,4 @@

import { JsonApiError } from '../interfaces/json-api';
import { JsonApiErrorObject } from '../interfaces/json-api';
import { ResultError } from '../http';
export declare function getURL(baseURL: string, path: string, orgId?: string): string;
export declare function isJsonApiErrors(input: unknown): input is JsonApiError[];
export declare function generateErrorWithDetail<E>(error: JsonApiError, statusCode: number, apiName: string): ResultError<E>;
export declare function generateErrorWithDetail<E>(error: JsonApiErrorObject, statusCode: number, apiName: string): ResultError<E>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateErrorWithDetail = exports.isJsonApiErrors = exports.getURL = void 0;
exports.generateErrorWithDetail = exports.getURL = void 0;
const constants_1 = require("../constants");

@@ -21,18 +21,2 @@ function getURL(baseURL, path, orgId) {

}
function isJsonApiErrors(input) {
if (!Array.isArray(input) || input.length < 1) {
return false;
}
for (const element of input) {
if (typeof element !== 'object' ||
!('status' in element) ||
!('code' in element) ||
!('title' in element) ||
!('detail' in element)) {
return false;
}
}
return true;
}
exports.isJsonApiErrors = isJsonApiErrors;
function generateErrorWithDetail(error, statusCode, apiName) {

@@ -39,0 +23,0 @@ var _a;

@@ -94,3 +94,3 @@ {

},
"version": "4.23.3"
"version": "4.23.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

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