@snyk/code-client
Advanced tools
Comparing version 4.21.0 to 4.22.0
@@ -13,2 +13,3 @@ "use strict"; | ||
const needle_1 = require("./needle"); | ||
const httpUtils_1 = require("./utils/httpUtils"); | ||
// The trick to typecast union type alias | ||
@@ -111,5 +112,12 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const apiName = 'filters'; | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(baseURL, '/' + apiName, 'no-org-for-filters'); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, apiName); | ||
} | ||
const res = await needle_1.makeRequest({ | ||
headers: { source, ...(requestId && { 'snyk-request-id': requestId }) }, | ||
url: `${baseURL}/${apiName}`, | ||
url, | ||
method: 'get', | ||
@@ -142,2 +150,9 @@ }, attempts); | ||
const payloadBody = await compressAndEncode(options.files); | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, '/bundle', options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'createBundle'); | ||
} | ||
const payload = { | ||
@@ -149,3 +164,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/bundle`, | ||
url, | ||
method: 'post', | ||
@@ -169,2 +184,9 @@ body: payloadBody, | ||
async function checkBundle(options) { | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, `/bundle/${options.bundleHash}`, options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'checkBundle'); | ||
} | ||
const res = await needle_1.makeRequest({ | ||
@@ -174,3 +196,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/bundle/${options.bundleHash}`, | ||
url, | ||
method: 'get', | ||
@@ -193,2 +215,9 @@ }); | ||
const payloadBody = await compressAndEncode(lodash_pick_1.default(options, ['files', 'removedFiles'])); | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, `/bundle/${options.bundleHash}`, options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'extendBundle'); | ||
} | ||
const res = await needle_1.makeRequest({ | ||
@@ -200,3 +229,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/bundle/${options.bundleHash}`, | ||
url, | ||
method: 'put', | ||
@@ -230,2 +259,9 @@ body: payloadBody, | ||
async function getAnalysis(options) { | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, '/analysis', options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'getAnalysis'); | ||
} | ||
const config = { | ||
@@ -235,3 +271,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/analysis`, | ||
url, | ||
method: 'post', | ||
@@ -266,2 +302,9 @@ body: { | ||
async function initReport(options) { | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, `/report`, options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'initReport'); | ||
} | ||
const config = { | ||
@@ -271,3 +314,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/report`, | ||
url, | ||
method: 'post', | ||
@@ -301,2 +344,9 @@ body: { | ||
var _a; | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, `/report/${options.pollId}`, options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'getReport'); | ||
} | ||
const config = { | ||
@@ -306,3 +356,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/report/${options.pollId}`, | ||
url, | ||
method: 'get', | ||
@@ -320,2 +370,9 @@ }; | ||
async function initScmReport(options) { | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, `/test`, options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'initReport'); | ||
} | ||
const config = { | ||
@@ -325,3 +382,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/test`, | ||
url, | ||
method: 'post', | ||
@@ -347,2 +404,9 @@ body: { | ||
var _a; | ||
let url; | ||
try { | ||
url = httpUtils_1.getURL(options.baseURL, `/test/${options.pollId}`, options.org); | ||
} | ||
catch (err) { | ||
return generateError(400, err.message, 'getReport'); | ||
} | ||
const config = { | ||
@@ -352,3 +416,3 @@ headers: { | ||
}, | ||
url: `${options.baseURL}/test/${options.pollId}`, | ||
url, | ||
method: 'get', | ||
@@ -355,0 +419,0 @@ }; |
@@ -94,3 +94,3 @@ { | ||
}, | ||
"version": "4.21.0" | ||
"version": "4.22.0" | ||
} |
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
179389
48
2552