@exaudeus/workrail 3.59.6 → 3.59.8
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/cli/commands/index.d.ts +0 -1
- package/dist/cli/commands/index.js +1 -3
- package/dist/cli-worktrain.js +2 -51
- package/dist/console/standalone-console.js +1 -1
- package/dist/console-ui/assets/{index-xMwhHmR2.js → index-CtUfpXCx.js} +1 -1
- package/dist/console-ui/index.html +1 -1
- package/dist/daemon/workflow-runner.js +1 -1
- package/dist/manifest.json +21 -37
- package/dist/trigger/polling-scheduler.js +1 -1
- package/dist/v2/usecases/console-routes.d.ts +1 -3
- package/dist/v2/usecases/console-routes.js +28 -107
- package/docs/design/dispatch-dedup-prealloc-bypass-implementation-plan.md +2 -0
- package/docs/ideas/backlog.md +91 -0
- package/package.json +1 -1
- package/dist/cli/commands/worktrain-trigger-poll.d.ts +0 -23
- package/dist/cli/commands/worktrain-trigger-poll.js +0 -94
- package/dist/trigger/daemon-console.d.ts +0 -28
- package/dist/trigger/daemon-console.js +0 -120
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.startDaemonConsole = startDaemonConsole;
|
|
40
|
-
require("reflect-metadata");
|
|
41
|
-
const express_1 = __importDefault(require("express"));
|
|
42
|
-
const cors_1 = __importDefault(require("cors"));
|
|
43
|
-
const http = __importStar(require("node:http"));
|
|
44
|
-
const fs = __importStar(require("node:fs/promises"));
|
|
45
|
-
const path = __importStar(require("node:path"));
|
|
46
|
-
const os = __importStar(require("node:os"));
|
|
47
|
-
const result_js_1 = require("../runtime/result.js");
|
|
48
|
-
const DEFAULT_CONSOLE_PORT = 3456;
|
|
49
|
-
async function startDaemonConsole(ctx, options = {}) {
|
|
50
|
-
const port = options.port ?? DEFAULT_CONSOLE_PORT;
|
|
51
|
-
const lockFilePath = options.lockFilePath ?? path.join(os.homedir(), '.workrail', 'daemon-console.lock');
|
|
52
|
-
const app = (0, express_1.default)();
|
|
53
|
-
app.use((0, cors_1.default)({
|
|
54
|
-
origin: '*',
|
|
55
|
-
methods: ['GET', 'HEAD', 'OPTIONS', 'POST', 'DELETE'],
|
|
56
|
-
allowedHeaders: ['Content-Type', 'If-None-Match'],
|
|
57
|
-
}));
|
|
58
|
-
app.set('etag', 'strong');
|
|
59
|
-
const { ConsoleService } = await Promise.resolve().then(() => __importStar(require('../v2/usecases/console-service.js')));
|
|
60
|
-
const { mountConsoleRoutes } = await Promise.resolve().then(() => __importStar(require('../v2/usecases/console-routes.js')));
|
|
61
|
-
if (!ctx.v2.dataDir || !ctx.v2.directoryListing) {
|
|
62
|
-
return (0, result_js_1.err)({ kind: 'io_error', message: 'V2 data dir or directory listing not available' });
|
|
63
|
-
}
|
|
64
|
-
const consoleService = new ConsoleService({
|
|
65
|
-
directoryListing: ctx.v2.directoryListing,
|
|
66
|
-
dataDir: ctx.v2.dataDir,
|
|
67
|
-
sessionStore: ctx.v2.sessionStore,
|
|
68
|
-
snapshotStore: ctx.v2.snapshotStore,
|
|
69
|
-
pinnedWorkflowStore: ctx.v2.pinnedStore,
|
|
70
|
-
});
|
|
71
|
-
const stopWatcher = mountConsoleRoutes(app, consoleService, options.workflowService, undefined, undefined, options.serverVersion, ctx, options.triggerRouter, options.steerRegistry, options.pollingScheduler);
|
|
72
|
-
app.use((req, res) => {
|
|
73
|
-
res.status(404).json({ success: false, error: 'Not found', path: req.path });
|
|
74
|
-
});
|
|
75
|
-
return new Promise((resolve) => {
|
|
76
|
-
const server = http.createServer(app);
|
|
77
|
-
server.on('error', (error) => {
|
|
78
|
-
try {
|
|
79
|
-
stopWatcher();
|
|
80
|
-
}
|
|
81
|
-
catch { }
|
|
82
|
-
if (error.code === 'EADDRINUSE') {
|
|
83
|
-
resolve((0, result_js_1.err)({ kind: 'port_conflict', port }));
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
resolve((0, result_js_1.err)({ kind: 'io_error', message: error.message }));
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
server.listen(port, '127.0.0.1', () => {
|
|
90
|
-
const addr = server.address();
|
|
91
|
-
const actualPort = (addr && typeof addr === 'object') ? addr.port : port;
|
|
92
|
-
const lockDir = path.dirname(lockFilePath);
|
|
93
|
-
void fs.mkdir(lockDir, { recursive: true })
|
|
94
|
-
.then(() => fs.writeFile(lockFilePath, JSON.stringify({ pid: process.pid, port: actualPort }), 'utf-8'))
|
|
95
|
-
.catch((writeErr) => {
|
|
96
|
-
console.warn('[DaemonConsole] Could not write lock file:', writeErr instanceof Error ? writeErr.message : String(writeErr));
|
|
97
|
-
});
|
|
98
|
-
console.log(`[DaemonConsole] Console available at http://localhost:${actualPort}/console`);
|
|
99
|
-
let stopped = false;
|
|
100
|
-
const stop = () => {
|
|
101
|
-
if (stopped)
|
|
102
|
-
return Promise.resolve();
|
|
103
|
-
stopped = true;
|
|
104
|
-
return new Promise((res) => {
|
|
105
|
-
try {
|
|
106
|
-
stopWatcher();
|
|
107
|
-
}
|
|
108
|
-
catch { }
|
|
109
|
-
server.close(() => {
|
|
110
|
-
void fs.unlink(lockFilePath)
|
|
111
|
-
.catch(() => { })
|
|
112
|
-
.finally(() => res());
|
|
113
|
-
});
|
|
114
|
-
setTimeout(() => res(), 5000);
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
resolve((0, result_js_1.ok)({ port: actualPort, stop }));
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|