@journeyapps/cloudcode
Advanced tools
Comparing version 0.0.0-dev.889c810 to 0.0.0-dev.90a7656
@@ -43,3 +43,3 @@ "use strict"; | ||
processId: exports.PROCESS_ID, | ||
message: `Start process. Process trace ID: ${exports.PROCESS_ID}` | ||
message: `Start process. Process trace ID: ${exports.PROCESS_ID}. Revision: ${global.CloudCode.deployInfo.description}.` | ||
}); | ||
@@ -46,0 +46,0 @@ // Default Lambda uncaughtException handler does a process.exit(1), preventing us from logging the error. |
@@ -20,3 +20,2 @@ "use strict"; | ||
} | ||
let blacklisted = false; | ||
for (let re of HOST_BLACKLIST) { | ||
@@ -37,7 +36,7 @@ if (re.test(host)) { | ||
* | ||
* @return {string[]} array of descriptions of open sockets | ||
* @return array of descriptions of open sockets | ||
*/ | ||
function getActiveHandles() { | ||
var results = []; | ||
var handles = process._getActiveHandles(); | ||
let results = []; | ||
const handles = process._getActiveHandles(); | ||
for (let handle of handles) { | ||
@@ -62,5 +61,14 @@ if (isSocket(handle)) { | ||
if (socket._httpMessage) { | ||
if (socket._httpMessage.res && !socket._httpMessage.res.readable) { | ||
// Alternative: `socket._httpMessage.res?._readableState?.ended` | ||
// Even though the socket is still open, the response has been read. | ||
// This is typically the case if the developer did `await response.text()`. This is good enough. | ||
// Alternatively, we could say that even just `await fetch(...)` is good enough. The presence of `.res` | ||
// would be a good indication of that. | ||
continue; | ||
} | ||
message = `HTTP ${socket._httpMessage.method} ${socket._host} ${socket._httpMessage.path}`; | ||
} | ||
else if (socket._host) { | ||
// Note: This could include HTTP requests, where the request hasn't been sent yet. | ||
message = `Socket ${socket._host}`; | ||
@@ -81,3 +89,3 @@ } | ||
function busycheck() { | ||
var handles = getActiveHandles(); | ||
const handles = getActiveHandles(); | ||
if (handles.length > 0) { | ||
@@ -84,0 +92,0 @@ let msg = 'Some requests are still active, and block the response until they complete:'; |
@@ -18,4 +18,11 @@ import { Database } from '@journeyapps/db'; | ||
} | ||
export interface DeployInfo { | ||
readonly revision?: string; | ||
readonly draftId?: string; | ||
readonly branch: string; | ||
readonly description: string; | ||
} | ||
export declare class CloudCodeEnvironment implements EventSources { | ||
readonly task: TaskEnvironment; | ||
readonly deployInfo: DeployInfo; | ||
APP: string; | ||
@@ -22,0 +29,0 @@ EDITOR_TEST: string; |
@@ -20,2 +20,19 @@ "use strict"; | ||
this.task = task; | ||
const revision = process.env.CLOUDCODE_REVISION || 'unknown'; | ||
const branch = process.env.CLOUDCODE_BRANCH || 'unknown'; | ||
const draftId = process.env.CLOUDCODE_DRAFT_ID; | ||
if (draftId) { | ||
this.deployInfo = { | ||
draftId: draftId, | ||
branch: branch, | ||
description: `${branch}/draft/${draftId}` | ||
}; | ||
} | ||
else { | ||
this.deployInfo = { | ||
revision: revision, | ||
branch: branch, | ||
description: `${branch}/${revision}` | ||
}; | ||
} | ||
} | ||
@@ -22,0 +39,0 @@ setTaskContext(context) { |
@@ -89,3 +89,3 @@ 'use strict'; | ||
type: rawRequest.eventSource, | ||
message: `Start '${rawRequest.eventSource}' request. Process trace ID: '${bootstrap_1.PROCESS_ID}'` | ||
message: `Start '${rawRequest.eventSource}' request. Process trace ID: '${bootstrap_1.PROCESS_ID}'. Revision: '${global.CloudCode.deployInfo.description}'.` | ||
}); | ||
@@ -200,3 +200,2 @@ // TODO: Remove these non-webby bits | ||
} | ||
Found module: | ||
@@ -203,0 +202,0 @@ ${util.format(task.module)} |
{ | ||
"name": "@journeyapps/cloudcode", | ||
"version": "0.0.0-dev.889c810", | ||
"version": "0.0.0-dev.90a7656", | ||
"main": "./dist/index", | ||
"types": "./dist/index", | ||
"license": "MIT", | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./entry": "./dist/entry.js", | ||
"./*": "./*" | ||
}, | ||
"files": [ | ||
@@ -8,0 +13,0 @@ "README.md", |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
158710
2772
12