@deepcode/tsc
Advanced tools
Comparing version 2.0.14 to 2.0.15
@@ -0,1 +1,4 @@ | ||
## [2.0.15] - 2020-12-08 | ||
- Add Username param to analyzeGit | ||
## [2.0.14] - 2020-12-07 | ||
@@ -2,0 +5,0 @@ - New fields with timing and file coverage |
import { AnalysisSeverity, IGitBundle, IFileBundle, IBundleResult } from './interfaces/analysis-result.interface'; | ||
export declare function analyzeBundle({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, }: { | ||
export declare function analyzeBundle({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, username, }: { | ||
baseURL: string; | ||
@@ -9,5 +9,6 @@ sessionToken: string; | ||
oAuthToken?: string; | ||
username?: 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, oAuthToken?: string): Promise<IGitBundle>; | ||
export declare function analyzeGit(baseURL: string | undefined, sessionToken: string | undefined, includeLint: boolean | undefined, severity: AnalysisSeverity | undefined, gitUri: string, sarif?: boolean, oAuthToken?: string, username?: string): Promise<IGitBundle>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const sleep = (duration) => new Promise(resolve => setTimeout(resolve, duration)); | ||
async function pollAnalysis({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, }) { | ||
async function pollAnalysis({ baseURL, sessionToken, includeLint, severity, bundleId, oAuthToken, username, }) { | ||
let analysisResponse; | ||
@@ -31,2 +31,3 @@ let analysisData; | ||
oAuthToken, | ||
username, | ||
bundleId, | ||
@@ -59,5 +60,5 @@ includeLint, | ||
} | ||
async function analyzeBundle({ baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, bundleId, oAuthToken, }) { | ||
async function analyzeBundle({ baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, bundleId, oAuthToken, username, }) { | ||
// Call remote bundle for analysis results and emit intermediate progress | ||
const analysisData = await pollAnalysis({ baseURL, sessionToken, oAuthToken, bundleId, includeLint, severity }); | ||
const analysisData = await pollAnalysis({ baseURL, sessionToken, oAuthToken, username, bundleId, includeLint, severity }); | ||
if (analysisData.type === 'error') { | ||
@@ -164,4 +165,4 @@ throw analysisData.error; | ||
exports.extendAnalysis = extendAnalysis; | ||
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 }); | ||
async function analyzeGit(baseURL = constants_1.defaultBaseURL, sessionToken = '', includeLint = false, severity = analysis_result_interface_1.AnalysisSeverity.info, gitUri, sarif = false, oAuthToken, username) { | ||
const bundleResponse = await http_1.createGitBundle({ baseURL, sessionToken, oAuthToken, username, gitUri }); | ||
if (bundleResponse.type === 'error') { | ||
@@ -171,3 +172,3 @@ throw bundleResponse.error; | ||
const { bundleId } = bundleResponse.value; | ||
const analysisData = await analyzeBundle({ baseURL, sessionToken, oAuthToken, includeLint, severity, bundleId }); | ||
const analysisData = await analyzeBundle({ baseURL, sessionToken, oAuthToken, username, includeLint, severity, bundleId }); | ||
const result = { | ||
@@ -174,0 +175,0 @@ baseURL, |
@@ -63,2 +63,3 @@ import { AxiosError } from 'axios'; | ||
readonly oAuthToken?: string; | ||
readonly username?: string; | ||
readonly gitUri: string; | ||
@@ -99,2 +100,3 @@ }): Promise<IResult<RemoteBundle, CreateGitBundleErrorCodes>>; | ||
readonly oAuthToken?: string; | ||
readonly username?: string; | ||
readonly bundleId: string; | ||
@@ -101,0 +103,0 @@ readonly includeLint?: boolean; |
@@ -207,3 +207,3 @@ "use strict"; | ||
async function createGitBundle(options) { | ||
const { baseURL, sessionToken, oAuthToken, gitUri } = options; | ||
const { baseURL, sessionToken, oAuthToken, username, gitUri } = options; | ||
const headers = { 'Session-Token': sessionToken }; | ||
@@ -213,2 +213,5 @@ if (oAuthToken) { | ||
} | ||
if (username) { | ||
headers['X-UserName'] = username; | ||
} | ||
const config = { | ||
@@ -272,3 +275,3 @@ headers, | ||
async function getAnalysis(options) { | ||
const { baseURL, sessionToken, oAuthToken, bundleId, includeLint, severity } = options; | ||
const { baseURL, sessionToken, oAuthToken, username, bundleId, includeLint, severity } = options; | ||
// ?linters=false is still a truthy query value, if(includeLint === false) we have to avoid sending the value altogether | ||
@@ -280,2 +283,5 @@ const params = { severity, linters: includeLint || undefined }; | ||
} | ||
if (username) { | ||
headers['X-UserName'] = username; | ||
} | ||
const config = { | ||
@@ -282,0 +288,0 @@ headers, |
{ | ||
"name": "@deepcode/tsc", | ||
"version": "2.0.14", | ||
"version": "2.0.15", | ||
"description": "Typescript consumer of Deepcode public API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118658
1683