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 2.4.1 to 3.0.0

8

dist/analysis.js

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

analysisData = await analyzeBundle({
baseURL: baseURL,
sessionToken: sessionToken,
includeLint: includeLint,
severity: severity,
baseURL,
sessionToken,
includeLint,
severity,
bundleId: remoteBundle.bundleId,

@@ -193,0 +193,0 @@ source,

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

const emitter_1 = __importDefault(require("./emitter"));
const { NODE_ENV } = process.env;
const axios_ = axios_1.default.create({

@@ -11,0 +10,0 @@ responseType: 'json',

@@ -18,3 +18,2 @@ export declare const MAX_PAYLOAD: number;

};
export declare let LOGGING: boolean;
export declare enum ErrorCodes {

@@ -21,0 +20,0 @@ loginInProgress = 304,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_ERROR_MESSAGES = exports.ErrorCodes = exports.LOGGING = exports.DCIGNORE_DRAFTS = exports.IGNORE_FILES_NAMES = exports.IGNORES_DEFAULT = exports.MAX_UPLOAD_ATTEMPTS = exports.CACHE_KEY = exports.EXCLUDED_NAMES = exports.DCIGNORE_FILENAME = exports.GITIGNORE_FILENAME = exports.GIT_FILENAME = exports.ENCODE_TYPE = exports.HASH_ALGORITHM = exports.apiPath = exports.defaultBaseURL = exports.MAX_PAYLOAD = void 0;
exports.DEFAULT_ERROR_MESSAGES = exports.ErrorCodes = exports.DCIGNORE_DRAFTS = exports.IGNORE_FILES_NAMES = exports.IGNORES_DEFAULT = exports.MAX_UPLOAD_ATTEMPTS = exports.CACHE_KEY = exports.EXCLUDED_NAMES = exports.DCIGNORE_FILENAME = exports.GITIGNORE_FILENAME = exports.GIT_FILENAME = exports.ENCODE_TYPE = exports.HASH_ALGORITHM = exports.apiPath = exports.defaultBaseURL = exports.MAX_PAYLOAD = void 0;
const dcignore_1 = require("@deepcode/dcignore");

@@ -22,3 +22,2 @@ exports.MAX_PAYLOAD = 4 * 1024 * 1024;

};
exports.LOGGING = false;
// eslint-disable-next-line no-shadow

@@ -25,0 +24,0 @@ var ErrorCodes;

@@ -20,14 +20,14 @@ import { AxiosError } from 'axios';

declare type StartSessionResponseDto = {
readonly sessionToken: string;
readonly draftToken: string;
readonly loginURL: string;
};
export declare function startSession(options: {
readonly baseURL: string;
readonly authHost: string;
readonly source: string;
}): Promise<IResult<StartSessionResponseDto, GenericErrorTypes>>;
}): StartSessionResponseDto;
declare type CheckSessionErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.loginInProgress;
export declare function checkSession(options: {
readonly baseURL: string;
readonly sessionToken: string;
}): Promise<IResult<boolean, CheckSessionErrorCodes>>;
readonly authHost: string;
readonly draftToken: string;
}): Promise<IResult<string, CheckSessionErrorCodes>>;
export declare function getFilters(baseURL: string, source: string): Promise<IResult<ISupportedFiles, GenericErrorTypes>>;

@@ -34,0 +34,0 @@ export declare type RemoteBundle = {

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

exports.reportEvent = exports.reportError = exports.getAnalysis = exports.AnalysisStatus = exports.uploadFiles = exports.createGitBundle = exports.extendBundle = exports.checkBundle = exports.createBundle = exports.getFilters = exports.checkSession = exports.startSession = exports.determineErrorCode = void 0;
const uuid_1 = require("uuid");
const constants_1 = require("./constants");

@@ -64,19 +65,9 @@ const axios_1 = __importDefault(require("./axios"));

};
async function startSession(options) {
const apiName = 'login';
const { source, baseURL } = options;
const config = {
url: `${baseURL}${constants_1.apiPath}/${apiName}`,
method: 'POST',
data: {
source,
},
function startSession(options) {
const { source, authHost } = options;
const draftToken = uuid_1.v4();
return {
draftToken,
loginURL: `${authHost}/login?token=${draftToken}&utm_medium=${source}&utm_source=${source}&utm_campaign=${source}&docker=false`,
};
try {
const response = await axios_1.default.request(config);
return { type: 'success', value: response.data };
}
catch (error) {
return generateError(error, GENERIC_ERROR_MESSAGES, apiName);
}
}

@@ -90,20 +81,27 @@ exports.startSession = startSession;

async function checkSession(options) {
const { sessionToken, baseURL } = options;
var _a;
const { draftToken, authHost } = options;
const config = {
headers: { 'Session-Token': sessionToken },
url: `${baseURL}${constants_1.apiPath}/session?cache=${Math.random() * 1000000}`,
method: 'GET',
url: `${authHost}/api/v1/verify/callback`,
method: 'POST',
data: {
token: draftToken,
},
};
// deepcode ignore PromiseNotCaughtGeneral: typescript makes it all a bit complex here
return axios_1.default
.request(config)
.catch((err) => {
if (err.response && [304, 400, 401].includes(err.response.status)) {
return { type: 'success', value: false };
try {
const response = await axios_1.default.request(config);
return {
type: 'success',
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
value: (response.status === 200 && response.data.ok && response.data.api) || '',
};
}
catch (err) {
if ([constants_1.ErrorCodes.loginInProgress, constants_1.ErrorCodes.unauthorizedContent, constants_1.ErrorCodes.unauthorizedUser].includes((_a =
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
err.response) === null || _a === void 0 ? void 0 : _a.status)) {
return { type: 'success', value: '' };
}
return generateError(err, CHECK_SESSION_ERROR_MESSAGES, 'checkSession');
})
.then((response) => {
return { type: 'success', value: response.status === 200 };
});
}
}

@@ -110,0 +108,0 @@ exports.checkSession = checkSession;

@@ -69,5 +69,7 @@ {

"micromatch": "^4.0.2",
"flat-cache": "^3.0.4"
"flat-cache": "^3.0.4",
"@types/uuid": "^8.3.0",
"uuid": "^8.3.2"
},
"version": "2.4.1"
"version": "3.0.0"
}

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