@melaya/runner 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connection.js +3 -2
- package/dist/localRelay.d.ts +1 -0
- package/dist/localRelay.js +4 -0
- package/package.json +1 -1
package/dist/connection.js
CHANGED
|
@@ -17,7 +17,7 @@ import { spawn } from "child_process";
|
|
|
17
17
|
import { writeFileSync, mkdirSync } from "fs";
|
|
18
18
|
import { join } from "path";
|
|
19
19
|
import { tmpdir } from "os";
|
|
20
|
-
import { startLocalRelay } from "./localRelay.js";
|
|
20
|
+
import { startLocalRelay, setActiveProject } from "./localRelay.js";
|
|
21
21
|
import { ensureSharedModules, getSharedDir } from "./sharedVendor.js";
|
|
22
22
|
const HEARTBEAT_INTERVAL = 30_000;
|
|
23
23
|
const activeProcesses = new Map();
|
|
@@ -80,7 +80,8 @@ export async function connect(opts) {
|
|
|
80
80
|
}
|
|
81
81
|
// Ensure shared modules are cached
|
|
82
82
|
await ensureSharedModules(opts.serverUrl, payload.sharedVersion);
|
|
83
|
-
// Register run in DB
|
|
83
|
+
// Register run in DB + set active project for event relay
|
|
84
|
+
setActiveProject(payload.project);
|
|
84
85
|
socket.emit("runner:registerRun", {
|
|
85
86
|
runId: payload.runId,
|
|
86
87
|
project: payload.project,
|
package/dist/localRelay.d.ts
CHANGED
package/dist/localRelay.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import crypto from "crypto";
|
|
13
13
|
import http from "http";
|
|
14
|
+
let _activeProject = null;
|
|
15
|
+
export function setActiveProject(project) { _activeProject = project; }
|
|
14
16
|
export function startLocalRelay(socket, verbose) {
|
|
15
17
|
const nonce = crypto.randomUUID().replace(/-/g, "");
|
|
16
18
|
return new Promise((resolve, reject) => {
|
|
@@ -26,6 +28,8 @@ export function startLocalRelay(socket, verbose) {
|
|
|
26
28
|
req.on("end", () => {
|
|
27
29
|
try {
|
|
28
30
|
const payload = JSON.parse(body);
|
|
31
|
+
if (_activeProject && !payload.project)
|
|
32
|
+
payload.project = _activeProject;
|
|
29
33
|
socket.emit("runner:event", payload);
|
|
30
34
|
if (verbose) {
|
|
31
35
|
const type = payload.event_type || "unknown";
|