fabric8-analytics-lsp-server
Advanced tools
Comparing version 0.4.25 to 0.4.26
@@ -21,2 +21,4 @@ /* -------------------------------------------------------------------------------------------- | ||
this.golang_executable = process.env.GOLANG_EXECUTABLE || 'go'; | ||
this.utm_source = process.env.UTM_SOURCE || ""; | ||
this.telemetry_id = process.env.TELEMETRY_ID || ""; | ||
} | ||
@@ -23,0 +25,0 @@ } |
@@ -40,2 +40,4 @@ /* -------------------------------------------------------------------------------------------- | ||
const fs = __importStar(require("fs")); | ||
const uuid = __importStar(require("uuid")); | ||
const crypto = __importStar(require("crypto")); | ||
const vscode_languageserver_1 = require("vscode-languageserver"); | ||
@@ -169,3 +171,3 @@ const node_fetch_1 = __importDefault(require("node-fetch")); | ||
/* Fetch Vulnerabilities by component-analysis batch api-call */ | ||
const fetchVulnerabilities = (reqData) => __awaiter(void 0, void 0, void 0, function* () { | ||
const fetchVulnerabilities = (reqData, manifestHash, requestId) => __awaiter(void 0, void 0, void 0, function* () { | ||
let url = config_1.config.server_url; | ||
@@ -181,6 +183,14 @@ if (config_1.config.three_scale_user_token) { | ||
'Authorization': 'Bearer ' + config_1.config.api_token, | ||
'X-Request-Id': requestId, | ||
}; | ||
url += `&utm_content=${manifestHash}`; | ||
if (config_1.config.utm_source) { | ||
url += `&utm_source=${config_1.config.utm_source}`; | ||
} | ||
if (config_1.config.uuid) { | ||
headers['uuid'] = config_1.config.uuid; | ||
} | ||
if (config_1.config.telemetry_id) { | ||
headers['X-Telemetry-Id'] = config_1.config.telemetry_id; | ||
} | ||
try { | ||
@@ -273,2 +283,4 @@ const response = yield node_fetch_1.default(url, { | ||
const start = new Date().getTime(); | ||
const manifestHash = crypto.createHash("sha256").update(diagnosticFilePath).digest("hex"); | ||
const requestId = uuid.v4(); | ||
// Closure which captures common arg to runPipeline. | ||
@@ -291,3 +303,3 @@ const pipeline = response => runPipeline(response, diagnostics, packageAggregator, diagnosticFilePath, pkgMap, totalCount); | ||
const allRequests = slicePayload(requestPayload, batchSize, ecosystem). | ||
map(request => fetchVulnerabilities(request).then(cacheAndRunPipeline)); | ||
map(request => fetchVulnerabilities(request, manifestHash, requestId).then(cacheAndRunPipeline)); | ||
yield Promise.allSettled(allRequests); | ||
@@ -294,0 +306,0 @@ const end = new Date().getTime(); |
{ | ||
"name": "fabric8-analytics-lsp-server", | ||
"description": "LSP Server for Dependency Analytics", | ||
"version": "0.4.25", | ||
"version": "0.4.26", | ||
"author": "Pavel Odvody", | ||
@@ -50,2 +50,3 @@ "contributors": [ | ||
"@types/node-fetch": "^2.5.7", | ||
"@types/uuid": "^8.3.0", | ||
"chai": "^4.2.0", | ||
@@ -52,0 +53,0 @@ "fake-exec": "^1.1.0", |
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
111638
1158
15