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

@deepcode/tsc

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepcode/tsc - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

3

CHANGELOG.md

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

## [2.0.6] - 2020-10-26
- Added a possibility to supply custom oAuthToken for private repository analysis
## [2.0.5] - 2020-10-23

@@ -2,0 +5,0 @@ - Upgraded axios to v0.21.0

import { AnalysisSeverity, IGitBundle, IFileBundle, IBundleResult } from './interfaces/analysis-result.interface';
export declare function analyzeBundle(baseURL: string | undefined, sessionToken: string | undefined, includeLint: boolean | undefined, severity: AnalysisSeverity | undefined, bundleId: string): Promise<IBundleResult>;
export declare function analyzeBundle({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, }: {
baseURL: string;
sessionToken: string;
includeLint: boolean;
severity: AnalysisSeverity;
bundleId: string;
oAuthToken?: string;
}): Promise<IBundleResult>;
export declare function analyzeFolders(baseURL: string | undefined, sessionToken: string | undefined, includeLint: boolean | undefined, severity: AnalysisSeverity | undefined, paths: string[], symlinksEnabled?: boolean, maxPayload?: number, defaultFileIgnores?: string[]): Promise<IFileBundle>;
export declare function extendAnalysis(bundle: IFileBundle, filePaths: string[], maxPayload?: number): Promise<IFileBundle | null>;
export declare function analyzeGit(baseURL: string | undefined, sessionToken: string | undefined, includeLint: boolean | undefined, severity: AnalysisSeverity | undefined, gitUri: string, sarif?: boolean): Promise<IGitBundle>;
export declare function analyzeGit(baseURL: string | undefined, sessionToken: string | undefined, includeLint: boolean | undefined, severity: AnalysisSeverity | undefined, gitUri: string, sarif?: boolean, oAuthToken?: string): Promise<IGitBundle>;

37

dist/analysis.js

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

const files_1 = require("./files");
const gitUtils_1 = __importDefault(require("./gitUtils"));
const http_1 = require("./http");

@@ -17,3 +16,3 @@ const emitter_1 = __importDefault(require("./emitter"));

const analysis_result_interface_1 = require("./interfaces/analysis-result.interface");
async function pollAnalysis(baseURL, sessionToken, bundleId, useLinters, severity) {
async function pollAnalysis({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, }) {
let analysisResponse;

@@ -31,4 +30,5 @@ let analysisData;

sessionToken,
oAuthToken,
bundleId,
useLinters,
includeLint,
severity,

@@ -57,5 +57,5 @@ });

}
async function analyzeBundle(baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, bundleId) {
async function analyzeBundle({ baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, bundleId, oAuthToken, }) {
// Call remote bundle for analysis results and emit intermediate progress
const analysisData = await pollAnalysis(baseURL, sessionToken, bundleId, includeLint, severity);
const analysisData = await pollAnalysis({ baseURL, sessionToken, oAuthToken, bundleId, includeLint, severity });
if (analysisData.type === 'error') {

@@ -119,3 +119,9 @@ throw analysisData.error;

}
const analysisData = await analyzeBundle(baseURL, sessionToken, includeLint, severity, bundleResponse.value.bundleId);
const analysisData = await analyzeBundle({
baseURL,
sessionToken,
includeLint,
severity,
bundleId: bundleResponse.value.bundleId,
});
analysisData.analysisResults.files = normalizeResultFiles(analysisData.analysisResults.files, baseDir);

@@ -154,3 +160,9 @@ // Create bundle instance to handle extensions

}
const analysisData = await analyzeBundle(bundle.baseURL, bundle.sessionToken, bundle.includeLint, bundle.severity, bundleResponse.value.bundleId);
const analysisData = await analyzeBundle({
baseURL: bundle.baseURL,
sessionToken: bundle.sessionToken,
includeLint: bundle.includeLint,
severity: bundle.severity,
bundleId: bundleResponse.value.bundleId,
});
analysisData.analysisResults.files = normalizeResultFiles(analysisData.analysisResults.files, bundle.baseDir);

@@ -164,8 +176,4 @@ // Create bundle instance to handle extensions

exports.extendAnalysis = extendAnalysis;
async function analyzeGit(baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, gitUri, sarif = false) {
const repoKey = gitUtils_1.default(gitUri);
if (!repoKey) {
throw new Error('Failed to parse git uri');
}
const bundleResponse = await http_1.createGitBundle({ baseURL, sessionToken, ...repoKey });
async function analyzeGit(baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, gitUri, sarif = false, oAuthToken) {
const bundleResponse = await http_1.createGitBundle({ baseURL, sessionToken, oAuthToken, gitUri });
if (bundleResponse.type === 'error') {

@@ -175,6 +183,7 @@ throw bundleResponse.error;

const { bundleId } = bundleResponse.value;
const analysisData = await analyzeBundle(baseURL, sessionToken, includeLint, severity, bundleId);
const analysisData = await analyzeBundle({ baseURL, sessionToken, oAuthToken, includeLint, severity, bundleId });
const result = {
baseURL,
sessionToken,
oAuthToken,
includeLint,

@@ -181,0 +190,0 @@ severity,

@@ -62,6 +62,4 @@ import { AxiosError } from 'axios';

readonly sessionToken: string;
readonly platform: string;
readonly owner: string;
readonly repo: string;
readonly oid?: string;
readonly oAuthToken?: string;
readonly gitUri: string;
}): Promise<IResult<RemoteBundle, CreateGitBundleErrorCodes>>;

@@ -99,4 +97,5 @@ declare type UploadBundleErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.unauthorizedContent | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.notFound | ErrorCodes.bigPayload;

readonly sessionToken: string;
readonly oAuthToken?: string;
readonly bundleId: string;
readonly useLinters?: boolean;
readonly includeLint?: boolean;
readonly severity: number;

@@ -103,0 +102,0 @@ }): Promise<IResult<GetAnalysisResponseDto, GetAnalysisErrorCodes>>;

@@ -203,13 +203,10 @@ "use strict";

async function createGitBundle(options) {
const { baseURL, sessionToken, platform, owner, repo, oid } = options;
const { baseURL, sessionToken, oAuthToken, gitUri } = options;
const params = { oAuthToken };
const config = {
headers: { 'Session-Token': sessionToken },
params,
url: `${baseURL}${constants_1.apiPath}/bundle`,
method: 'POST',
data: {
platform,
owner,
repo,
oid,
},
data: { gitURI: gitUri },
};

@@ -267,7 +264,12 @@ try {

async function getAnalysis(options) {
const { baseURL, sessionToken, bundleId, useLinters, severity } = options;
const params = { severity, linters: useLinters };
const { baseURL, sessionToken, oAuthToken, bundleId, includeLint, severity } = options;
// ?linters=false is still a truthy query value, if(includeLint === false) we have to avoid sending the value altogether
const params = { severity, linters: includeLint || undefined };
const headers = { 'Session-Token': sessionToken };
if (oAuthToken) {
headers['X-OAuthToken'] = oAuthToken;
}
const config = {
headers: { 'Session-Token': sessionToken },
...params,
headers,
params,
url: `${baseURL}${constants_1.apiPath}/analysis/${bundleId}`,

@@ -274,0 +276,0 @@ method: 'GET',

@@ -0,3 +1,3 @@

import { Log } from 'sarif';
import { ISupportedFiles } from './files.interface';
import { Log } from "sarif";
export declare type Point = [number, number];

@@ -57,2 +57,3 @@ export declare enum AnalysisSeverity {

readonly sessionToken: string;
readonly oAuthToken?: string;
readonly includeLint: boolean;

@@ -59,0 +60,0 @@ readonly severity: AnalysisSeverity;

{
"name": "@deepcode/tsc",
"version": "2.0.5",
"version": "2.0.6",
"description": "Typescript consumer of Deepcode public API",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -124,2 +124,3 @@ # tsc

// readonly sessionToken: string;
// readonly oAuthToken?: string;
// readonly includeLint: boolean;

@@ -130,2 +131,3 @@ // readonly severity: AnalysisSeverity;

// readonly analysisURL: string;
// readonly sarifResults?: Log;
// readonly gitUri: string;

@@ -132,0 +134,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

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