@workflow/web 5.0.0-beta.56 → 5.0.0-beta.58
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/build/client/assets/{arrow-up-right-XpJjI06G.js → arrow-up-right-jHPcOZmb.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-DA3N01jE.js → highlighted-body-B3W2YXNL-CBBI0JQ-.js} +1 -1
- package/build/client/assets/{home-CLktiGIz.js → home-BcIEUw9E.js} +33 -12
- package/build/client/assets/{loader-circle-Cj8CH5bR.js → loader-circle-HeezuKOU.js} +1 -1
- package/build/client/assets/{manifest-3ffb4984.js → manifest-a541ae9e.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-DG0Grjgm.js → mermaid-3ZIDBTTL-ClcCzUqi.js} +62 -8
- package/build/client/assets/{root-3gE7cfR2.js → root-DLS5V7HU.js} +3 -3
- package/build/client/assets/{run-detail-gOfjBB1S.js → run-detail-DWoMKBqC.js} +37 -11
- package/build/client/assets/{workflow-graph-viewer-Cg3Lr_h8.js → workflow-graph-viewer-syfKq6DB.js} +29 -9
- package/build/client/assets/{zstd-browser-decoder-CEJ92wdJ.js → zstd-browser-decoder-D2p6f8lN.js} +1 -1
- package/build/server/assets/{app-Bl4MnK_A.js → app-CEqDw6uM.js} +23169 -12284
- package/build/server/assets/{highlighted-body-B3W2YXNL-DEO_Ibma.js → highlighted-body-B3W2YXNL-C2u3JoU4.js} +7 -2
- package/build/server/assets/{index-bN9Oj_dl.js → index-BG8LHWgA.js} +71 -64
- package/build/server/assets/{index-B_qUqg3k.js → index-BrFZB5-R.js} +1 -1
- package/build/server/assets/{mermaid-3ZIDBTTL-Dr7Wk8Bh.js → mermaid-3ZIDBTTL-BZ2gmvHb.js} +7 -2
- package/build/server/assets/{token-CUWJi08Y.js → token-KvMwAySl.js} +1 -1
- package/build/server/assets/{token-util-B4OMKRZB.js → token-util-DGBKzRwD.js} +1 -1
- package/build/server/assets/{wrapper-Cs9Wzu7M.js → wrapper-CBRVXtq2.js} +12 -14
- package/build/server/assets/{zstd-browser-decoder-DSPBib47.js → zstd-browser-decoder-BxTIaNvq.js} +7 -2
- package/build/server/index.js +8 -4
- package/handler.js +13 -96
- package/package.json +9 -10
- package/server.d.ts +5 -1
- package/server.js +32 -39
- package/static.js +86 -0
- package/build/server/assets/websocket-server-FV9R_mnP.js +0 -3669
- package/build/server/assets/ws-transport-B4h16CAX.js +0 -551
|
@@ -2,7 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import {
|
|
5
|
+
import { b9 as reactExports, ba as R, bb as Ks, bc as jsxRuntimeExports, bd as Qe } from "./app-CEqDw6uM.js";
|
|
6
6
|
import "node:stream";
|
|
7
7
|
import "stream";
|
|
8
8
|
import "util";
|
|
@@ -47,7 +47,12 @@ import "os";
|
|
|
47
47
|
import "assert/strict";
|
|
48
48
|
import "net";
|
|
49
49
|
import "node:assert/strict";
|
|
50
|
-
import "
|
|
50
|
+
import "https";
|
|
51
|
+
import "http";
|
|
52
|
+
import "tls";
|
|
53
|
+
import "url";
|
|
54
|
+
import "zlib";
|
|
55
|
+
import "buffer";
|
|
51
56
|
var L = ({ code: s, language: t, raw: e, className: n, ...d$1 }) => {
|
|
52
57
|
let { shikiTheme: l } = reactExports.useContext(R), o = Ks(), [m, i] = reactExports.useState(e);
|
|
53
58
|
return reactExports.useEffect(() => {
|
|
@@ -2,8 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import { H as HookSchema } from "./app-
|
|
6
|
-
import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, B, s, t, u, v, C, D, w, E, x, y, z, F, G, I, J, K, L, M, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6 } from "./app-
|
|
5
|
+
import { H as HookSchema } from "./app-CEqDw6uM.js";
|
|
6
|
+
import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, B, s, t, u, v, C, D, w, E, x, y, z, F, G, I, J, K, L, M, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8 } from "./app-CEqDw6uM.js";
|
|
7
7
|
import "node:stream";
|
|
8
8
|
import "stream";
|
|
9
9
|
import "util";
|
|
@@ -48,7 +48,12 @@ import "os";
|
|
|
48
48
|
import "assert/strict";
|
|
49
49
|
import "net";
|
|
50
50
|
import "node:assert/strict";
|
|
51
|
-
import "
|
|
51
|
+
import "https";
|
|
52
|
+
import "http";
|
|
53
|
+
import "tls";
|
|
54
|
+
import "url";
|
|
55
|
+
import "zlib";
|
|
56
|
+
import "buffer";
|
|
52
57
|
export {
|
|
53
58
|
A as ANALYTICS_EVENTS_GET_MANY_LIMIT,
|
|
54
59
|
a as ANALYTICS_MAX_ATTRIBUTE_FILTERS,
|
|
@@ -113,65 +118,67 @@ export {
|
|
|
113
118
|
a7 as SPEC_VERSION_SUPPORTS_ATTRIBUTES,
|
|
114
119
|
a8 as SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT,
|
|
115
120
|
a9 as SPEC_VERSION_SUPPORTS_COMPRESSION,
|
|
116
|
-
aa as
|
|
117
|
-
ab as
|
|
118
|
-
ac as
|
|
119
|
-
ad as
|
|
120
|
-
ae as
|
|
121
|
-
af as
|
|
122
|
-
ag as
|
|
123
|
-
ah as
|
|
124
|
-
ai as
|
|
125
|
-
aj as
|
|
126
|
-
ak as
|
|
127
|
-
al as
|
|
128
|
-
am as
|
|
129
|
-
an as
|
|
130
|
-
ao as
|
|
131
|
-
ap as
|
|
132
|
-
aq as
|
|
133
|
-
ar as
|
|
134
|
-
as as
|
|
135
|
-
at as
|
|
136
|
-
au as
|
|
137
|
-
av as
|
|
138
|
-
aw as
|
|
139
|
-
ax as
|
|
140
|
-
ay as
|
|
141
|
-
az as
|
|
142
|
-
aA as
|
|
143
|
-
aB as
|
|
144
|
-
aC as
|
|
145
|
-
aD as
|
|
146
|
-
aE as
|
|
147
|
-
aF as
|
|
148
|
-
aG as
|
|
149
|
-
aH as
|
|
150
|
-
aI as
|
|
151
|
-
aJ as
|
|
152
|
-
aK as
|
|
153
|
-
aL as
|
|
154
|
-
aM as
|
|
155
|
-
aN as
|
|
156
|
-
aO as
|
|
157
|
-
aP as
|
|
158
|
-
aQ as
|
|
159
|
-
aR as
|
|
160
|
-
aS as
|
|
161
|
-
aT as
|
|
162
|
-
aU as
|
|
163
|
-
aV as
|
|
164
|
-
aW as
|
|
165
|
-
aX as
|
|
166
|
-
aY as
|
|
167
|
-
aZ as
|
|
168
|
-
a_ as
|
|
169
|
-
a$ as
|
|
170
|
-
b0 as
|
|
171
|
-
b1 as
|
|
172
|
-
b2 as
|
|
173
|
-
b3 as
|
|
174
|
-
b4 as
|
|
175
|
-
b5 as
|
|
176
|
-
b6 as
|
|
121
|
+
aa as SPEC_VERSION_SUPPORTS_EVENT_SOURCING,
|
|
122
|
+
ab as SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM,
|
|
123
|
+
ac as SPEC_VERSION_SUPPORTS_SLOT_IDENTITY,
|
|
124
|
+
ad as STEP_EVENT_TYPES,
|
|
125
|
+
ae as SerializedDataSchema,
|
|
126
|
+
af as StepSchema,
|
|
127
|
+
ag as StepStatusSchema,
|
|
128
|
+
ah as StructuredErrorSchema,
|
|
129
|
+
ai as TERMINAL_EVENT_CLASSES,
|
|
130
|
+
aj as TERMINAL_RUN_EVENT_TYPES,
|
|
131
|
+
ak as TERMINAL_STEP_EVENT_TYPES,
|
|
132
|
+
al as TERMINAL_STEP_STATUSES,
|
|
133
|
+
am as TERMINAL_WORKFLOW_RUN_STATUSES,
|
|
134
|
+
an as TerminalRunEventTypeSchema,
|
|
135
|
+
ao as TerminalStepStatusSchema,
|
|
136
|
+
ap as TerminalWorkflowRunStatusSchema,
|
|
137
|
+
aq as ValidQueueName,
|
|
138
|
+
ar as WAIT_EVENT_TYPES,
|
|
139
|
+
as as WaitSchema,
|
|
140
|
+
at as WaitStatusSchema,
|
|
141
|
+
au as WorkflowInvokePayloadSchema,
|
|
142
|
+
av as WorkflowRunBaseSchema,
|
|
143
|
+
aw as WorkflowRunSchema,
|
|
144
|
+
ax as WorkflowRunStatusSchema,
|
|
145
|
+
ay as applyAttributeChanges,
|
|
146
|
+
az as classifyEntityEvent,
|
|
147
|
+
aA as entityEventClass,
|
|
148
|
+
aB as entityResolveData,
|
|
149
|
+
aC as envFlag,
|
|
150
|
+
aD as envNumber,
|
|
151
|
+
aE as eventIdToSlot,
|
|
152
|
+
aF as getEventDataPayloadField,
|
|
153
|
+
aG as getEventDataRefFields,
|
|
154
|
+
aH as getMaxEventsPerRun,
|
|
155
|
+
aI as getQueueTopicPrefix,
|
|
156
|
+
aJ as isChildEntityCreationEvent,
|
|
157
|
+
aK as isChildEntityCreationEventType,
|
|
158
|
+
aL as isHookEventRequiringExistence,
|
|
159
|
+
aM as isHookLifecycleEventType,
|
|
160
|
+
aN as isLegacySpecVersion,
|
|
161
|
+
aO as isNodeHttpEnabled,
|
|
162
|
+
aP as isSealedNoopEvent,
|
|
163
|
+
aQ as isSlotBody,
|
|
164
|
+
aR as isSlotEventId,
|
|
165
|
+
aS as isStepEventType,
|
|
166
|
+
aT as isTerminalRunEventType,
|
|
167
|
+
aU as isTerminalStepEventType,
|
|
168
|
+
aV as isTerminalStepStatus,
|
|
169
|
+
aW as isTerminalWorkflowRunStatus,
|
|
170
|
+
aX as isWaitEventType,
|
|
171
|
+
aY as mintedSpecVersion,
|
|
172
|
+
aZ as parseQueueName,
|
|
173
|
+
a_ as readRunRetention,
|
|
174
|
+
a$ as reenqueueActiveRuns,
|
|
175
|
+
b0 as requiresNewerWorld,
|
|
176
|
+
b1 as resolveQueueNamespace,
|
|
177
|
+
b2 as slotToEventId,
|
|
178
|
+
b3 as stripEventDataRefs,
|
|
179
|
+
b4 as ulidToDate,
|
|
180
|
+
b5 as validateAttributeChanges,
|
|
181
|
+
b6 as validateAttributeEventDataSize,
|
|
182
|
+
b7 as validateUlidTimestamp,
|
|
183
|
+
b8 as workflowRunIdSchema
|
|
177
184
|
};
|
|
@@ -1137,7 +1137,7 @@ function requireWebsocket() {
|
|
|
1137
1137
|
const DEFAULT_MAX_PAYLOAD = 256 * 1024;
|
|
1138
1138
|
async function loadWebSocketServer() {
|
|
1139
1139
|
try {
|
|
1140
|
-
const ws = await import("./wrapper-
|
|
1140
|
+
const ws = await import("./wrapper-CBRVXtq2.js");
|
|
1141
1141
|
return ws.WebSocketServer;
|
|
1142
1142
|
} catch {
|
|
1143
1143
|
throw new Error(
|
|
@@ -2,7 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import { N as Nt } from "./app-
|
|
5
|
+
import { N as Nt } from "./app-CEqDw6uM.js";
|
|
6
6
|
import "node:stream";
|
|
7
7
|
import "stream";
|
|
8
8
|
import "util";
|
|
@@ -47,7 +47,12 @@ import "os";
|
|
|
47
47
|
import "assert/strict";
|
|
48
48
|
import "net";
|
|
49
49
|
import "node:assert/strict";
|
|
50
|
-
import "
|
|
50
|
+
import "https";
|
|
51
|
+
import "http";
|
|
52
|
+
import "tls";
|
|
53
|
+
import "url";
|
|
54
|
+
import "zlib";
|
|
55
|
+
import "buffer";
|
|
51
56
|
export {
|
|
52
57
|
Nt as Mermaid
|
|
53
58
|
};
|
|
@@ -2,7 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import {
|
|
5
|
+
import { bp as requireTokenError, bo as requireTokenUtil, bn as getDefaultExportFromCjs } from "./app-CEqDw6uM.js";
|
|
6
6
|
function _mergeNamespaces(n, m) {
|
|
7
7
|
for (var i = 0; i < m.length; i++) {
|
|
8
8
|
const e = m[i];
|
|
@@ -2,7 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import {
|
|
5
|
+
import { bn as getDefaultExportFromCjs, bo as requireTokenUtil } from "./app-CEqDw6uM.js";
|
|
6
6
|
function _mergeNamespaces(n, m) {
|
|
7
7
|
for (var i = 0; i < m.length; i++) {
|
|
8
8
|
const e = m[i];
|
|
@@ -2,9 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "./app-Bl4MnK_A.js";
|
|
5
|
+
import { bf as WebSocket } from "./app-CEqDw6uM.js";
|
|
6
|
+
import { bg, bh, bi, bj, bk, bl, bm } from "./app-CEqDw6uM.js";
|
|
8
7
|
import "node:stream";
|
|
9
8
|
import "stream";
|
|
10
9
|
import "util";
|
|
@@ -49,21 +48,20 @@ import "os";
|
|
|
49
48
|
import "assert/strict";
|
|
50
49
|
import "net";
|
|
51
50
|
import "node:assert/strict";
|
|
52
|
-
import "express";
|
|
53
|
-
import "http";
|
|
54
|
-
import "buffer";
|
|
55
|
-
import "zlib";
|
|
56
51
|
import "https";
|
|
52
|
+
import "http";
|
|
57
53
|
import "tls";
|
|
58
54
|
import "url";
|
|
55
|
+
import "zlib";
|
|
56
|
+
import "buffer";
|
|
59
57
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
bg as PerMessageDeflate,
|
|
59
|
+
bh as Receiver,
|
|
60
|
+
bi as Sender,
|
|
63
61
|
WebSocket,
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
bj as WebSocketServer,
|
|
63
|
+
bk as createWebSocketStream,
|
|
66
64
|
WebSocket as default,
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
bl as extension,
|
|
66
|
+
bm as subprotocol
|
|
69
67
|
};
|
package/build/server/assets/{zstd-browser-decoder-DSPBib47.js → zstd-browser-decoder-BxTIaNvq.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import {
|
|
5
|
+
import { be as registerZstdDecoder } from "./app-CEqDw6uM.js";
|
|
6
6
|
import "node:stream";
|
|
7
7
|
import "stream";
|
|
8
8
|
import "util";
|
|
@@ -47,7 +47,12 @@ import "os";
|
|
|
47
47
|
import "assert/strict";
|
|
48
48
|
import "net";
|
|
49
49
|
import "node:assert/strict";
|
|
50
|
-
import "
|
|
50
|
+
import "https";
|
|
51
|
+
import "http";
|
|
52
|
+
import "tls";
|
|
53
|
+
import "url";
|
|
54
|
+
import "zlib";
|
|
55
|
+
import "buffer";
|
|
51
56
|
let registered = false;
|
|
52
57
|
let modulePromise;
|
|
53
58
|
function loadWasmModule() {
|
package/build/server/index.js
CHANGED
|
@@ -2,8 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
2
2
|
if (typeof require === "undefined") {
|
|
3
3
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
4
4
|
}
|
|
5
|
-
import {
|
|
6
|
-
import "express";
|
|
5
|
+
import { bq } from "./assets/app-CEqDw6uM.js";
|
|
7
6
|
import "node:stream";
|
|
8
7
|
import "stream";
|
|
9
8
|
import "util";
|
|
@@ -48,7 +47,12 @@ import "os";
|
|
|
48
47
|
import "assert/strict";
|
|
49
48
|
import "net";
|
|
50
49
|
import "node:assert/strict";
|
|
50
|
+
import "https";
|
|
51
|
+
import "http";
|
|
52
|
+
import "tls";
|
|
53
|
+
import "url";
|
|
54
|
+
import "zlib";
|
|
55
|
+
import "buffer";
|
|
51
56
|
export {
|
|
52
|
-
|
|
53
|
-
by as createFetchHandler
|
|
57
|
+
bq as createFetchHandler
|
|
54
58
|
};
|
package/handler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Framework-agnostic, in-process entry point for @workflow/web.
|
|
3
3
|
*
|
|
4
|
-
* Unlike `server.js` (which starts a standalone
|
|
4
|
+
* Unlike `server.js` (which starts a standalone HTTP server of its own), this
|
|
5
5
|
* exports a single Web-standard fetch handler that another server can mount
|
|
6
6
|
* under an arbitrary base path — e.g. `@workflow/nitro` mounting the dashboard
|
|
7
7
|
* at `/_workflow` without spawning a second server/port.
|
|
@@ -17,41 +17,16 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { existsSync } from 'node:fs';
|
|
20
|
-
import { readFile, stat } from 'node:fs/promises';
|
|
21
20
|
import path from 'node:path';
|
|
22
21
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
23
22
|
import { recordDashboard } from './registry.js';
|
|
23
|
+
import { createStaticHandler } from './static.js';
|
|
24
24
|
|
|
25
25
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
26
26
|
const buildDir = path.resolve(__dirname, 'build');
|
|
27
27
|
const clientDir = path.join(buildDir, 'client');
|
|
28
28
|
const serverEntry = path.join(buildDir, 'server', 'index.js');
|
|
29
29
|
|
|
30
|
-
// Minimal extension -> MIME map for serving the static client build. A wrong
|
|
31
|
-
// Content-Type on the entry module breaks the whole app, so be explicit.
|
|
32
|
-
const MIME_TYPES = {
|
|
33
|
-
'.js': 'text/javascript',
|
|
34
|
-
'.mjs': 'text/javascript',
|
|
35
|
-
'.css': 'text/css',
|
|
36
|
-
'.json': 'application/json',
|
|
37
|
-
'.map': 'application/json',
|
|
38
|
-
'.html': 'text/html',
|
|
39
|
-
'.ico': 'image/x-icon',
|
|
40
|
-
'.svg': 'image/svg+xml',
|
|
41
|
-
'.png': 'image/png',
|
|
42
|
-
'.jpg': 'image/jpeg',
|
|
43
|
-
'.jpeg': 'image/jpeg',
|
|
44
|
-
'.gif': 'image/gif',
|
|
45
|
-
'.webp': 'image/webp',
|
|
46
|
-
'.avif': 'image/avif',
|
|
47
|
-
'.woff': 'font/woff',
|
|
48
|
-
'.woff2': 'font/woff2',
|
|
49
|
-
'.ttf': 'font/ttf',
|
|
50
|
-
'.otf': 'font/otf',
|
|
51
|
-
'.txt': 'text/plain',
|
|
52
|
-
'.wasm': 'application/wasm',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
30
|
/** Normalize a mount path: `/` or empty -> "" (root); otherwise strip trailing slash. */
|
|
56
31
|
function normalizeBasename(basename) {
|
|
57
32
|
if (!basename || basename === '/') return '';
|
|
@@ -94,6 +69,16 @@ async function buildHandler(basename) {
|
|
|
94
69
|
);
|
|
95
70
|
}
|
|
96
71
|
const ssr = mod.createFetchHandler(basename || '/');
|
|
72
|
+
const serveStatic = createStaticHandler({
|
|
73
|
+
dir: clientDir,
|
|
74
|
+
basename,
|
|
75
|
+
// The host owns the connection and may compress the response itself. Even
|
|
76
|
+
// where it doesn't, this runs inside someone else's process — spending its
|
|
77
|
+
// CPU and libuv threads on brotli for what is almost always a localhost
|
|
78
|
+
// dev server is a bad trade. `server.js` leaves compression on, since it
|
|
79
|
+
// can be self-hosted over a real network.
|
|
80
|
+
compress: false,
|
|
81
|
+
});
|
|
97
82
|
|
|
98
83
|
return async (request) => {
|
|
99
84
|
// Advertise this dashboard so the CLI can defer to it (best-effort, once).
|
|
@@ -111,76 +96,8 @@ async function buildHandler(basename) {
|
|
|
111
96
|
// ignore — registration must never affect request handling
|
|
112
97
|
}
|
|
113
98
|
|
|
114
|
-
const staticResponse = await
|
|
99
|
+
const staticResponse = await serveStatic(request);
|
|
115
100
|
if (staticResponse) return staticResponse;
|
|
116
101
|
return ssr(request);
|
|
117
102
|
};
|
|
118
103
|
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Resolve a request to a path-within-the-client-build (relative to `clientDir`),
|
|
122
|
-
* stripping `basename` and guarding against traversal. Returns null when the
|
|
123
|
-
* request can't map to a client file (so it should fall through to the SSR
|
|
124
|
-
* handler) — e.g. the index, a directory, or an out-of-tree path.
|
|
125
|
-
*/
|
|
126
|
-
function resolveClientFile(request, basename) {
|
|
127
|
-
if (request.method !== 'GET' && request.method !== 'HEAD') return null;
|
|
128
|
-
|
|
129
|
-
let pathname;
|
|
130
|
-
try {
|
|
131
|
-
pathname = decodeURIComponent(new URL(request.url).pathname);
|
|
132
|
-
} catch {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (basename) {
|
|
137
|
-
if (!pathname.startsWith(`${basename}/`)) return null; // index/other -> SSR
|
|
138
|
-
pathname = pathname.slice(basename.length);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const relative = pathname.replace(/^\/+/, '');
|
|
142
|
-
if (!relative || relative.endsWith('/')) return null;
|
|
143
|
-
|
|
144
|
-
const filePath = path.join(clientDir, relative);
|
|
145
|
-
// Guard against path traversal escaping the client build directory.
|
|
146
|
-
if (filePath !== clientDir && !filePath.startsWith(clientDir + path.sep)) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
return { filePath, relative };
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Serve a file from the prebuilt client bundle if the request maps to one;
|
|
154
|
-
* otherwise return null so the request falls through to the SSR handler.
|
|
155
|
-
*/
|
|
156
|
-
async function tryServeStatic(request, basename) {
|
|
157
|
-
const resolved = resolveClientFile(request, basename);
|
|
158
|
-
if (!resolved) return null;
|
|
159
|
-
const { filePath, relative } = resolved;
|
|
160
|
-
|
|
161
|
-
let stats;
|
|
162
|
-
try {
|
|
163
|
-
stats = await stat(filePath);
|
|
164
|
-
} catch {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
if (!stats.isFile()) return null;
|
|
168
|
-
|
|
169
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
170
|
-
const headers = new Headers({
|
|
171
|
-
'Content-Type': MIME_TYPES[ext] ?? 'application/octet-stream',
|
|
172
|
-
// Hashed assets are content-addressed and safe to cache forever; other
|
|
173
|
-
// client files (e.g. favicon) get a short cache.
|
|
174
|
-
'Cache-Control': relative.startsWith('assets/')
|
|
175
|
-
? 'public, max-age=31536000, immutable'
|
|
176
|
-
: 'public, max-age=3600',
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (request.method === 'HEAD') {
|
|
180
|
-
headers.set('Content-Length', String(stats.size));
|
|
181
|
-
return new Response(null, { status: 200, headers });
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const body = await readFile(filePath);
|
|
185
|
-
return new Response(body, { status: 200, headers });
|
|
186
|
-
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/web",
|
|
3
3
|
"description": "Workflow Observability UI",
|
|
4
|
-
"version": "5.0.0-beta.
|
|
4
|
+
"version": "5.0.0-beta.58",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"handler.d.ts",
|
|
13
13
|
"registry.js",
|
|
14
14
|
"registry.d.ts",
|
|
15
|
+
"static.js",
|
|
15
16
|
"package.json"
|
|
16
17
|
],
|
|
17
18
|
"exports": {
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"directory": "packages/web"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
43
|
-
"
|
|
43
|
+
"@workflow/world-local": "5.0.0-beta.49",
|
|
44
|
+
"srvx": "^0.12.4",
|
|
44
45
|
"swr": "^2.3.6"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
@@ -56,21 +57,19 @@
|
|
|
56
57
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
57
58
|
"@radix-ui/react-tooltip": "1.2.8",
|
|
58
59
|
"@react-router/dev": "7.13.1",
|
|
59
|
-
"@react-router/express": "7.13.1",
|
|
60
60
|
"@react-router/node": "7.13.1",
|
|
61
61
|
"@tailwindcss/vite": "4",
|
|
62
62
|
"@testing-library/react": "^16.3.0",
|
|
63
|
-
"@types/express": "^5",
|
|
64
63
|
"@types/node": "22.19.0",
|
|
65
64
|
"@types/react": "19",
|
|
66
65
|
"@types/react-dom": "19",
|
|
67
66
|
"@vercel/react-router": "1.2.6",
|
|
68
|
-
"@workflow/core": "5.0.0-beta.
|
|
69
|
-
"@workflow/errors": "5.0.0-beta.
|
|
67
|
+
"@workflow/core": "5.0.0-beta.58",
|
|
68
|
+
"@workflow/errors": "5.0.0-beta.25",
|
|
70
69
|
"@workflow/utils": "5.0.0-beta.10",
|
|
71
|
-
"@workflow/web-shared": "5.0.0-beta.
|
|
72
|
-
"@workflow/world": "5.0.0-beta.
|
|
73
|
-
"@workflow/world-vercel": "5.0.0-beta.
|
|
70
|
+
"@workflow/web-shared": "5.0.0-beta.58",
|
|
71
|
+
"@workflow/world": "5.0.0-beta.40",
|
|
72
|
+
"@workflow/world-vercel": "5.0.0-beta.53",
|
|
74
73
|
"@xyflow/react": "12.10.1",
|
|
75
74
|
"cbor-x": "^1",
|
|
76
75
|
"class-variance-authority": "0.7.1",
|
package/server.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import type { Server } from '
|
|
1
|
+
import type { Server } from 'srvx';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Start the standalone observability UI server on `port` (defaults to `PORT`, then 3000),
|
|
5
|
+
* and resolve once it is listening.
|
|
6
|
+
*/
|
|
3
7
|
export function startServer(port?: number): Promise<Server>;
|
package/server.js
CHANGED
|
@@ -10,57 +10,50 @@
|
|
|
10
10
|
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
13
|
-
import
|
|
13
|
+
import { serve } from 'srvx';
|
|
14
|
+
import { createStaticHandler } from './static.js';
|
|
14
15
|
|
|
15
16
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
17
|
const buildDir = path.resolve(__dirname, 'build');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Import the compiled server build, which exports { app } (an Express app
|
|
20
|
-
// with the React Router request handler already mounted by server/app.ts)
|
|
21
|
-
const { app } = await import(
|
|
22
|
-
pathToFileURL(path.join(buildDir, 'server/index.js')).href
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
// Add static file serving in front of the React Router handler.
|
|
26
|
-
// We create a wrapper app so static middleware runs first.
|
|
27
|
-
const server = express();
|
|
28
|
-
|
|
29
|
-
// Serve immutable assets with long-lived cache
|
|
30
|
-
server.use(
|
|
31
|
-
'/assets',
|
|
32
|
-
express.static(path.join(buildDir, 'client/assets'), {
|
|
33
|
-
immutable: true,
|
|
34
|
-
maxAge: '1y',
|
|
35
|
-
})
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
// Serve static client files with short cache
|
|
39
|
-
server.use(express.static(path.join(buildDir, 'client'), { maxAge: '1h' }));
|
|
40
|
-
|
|
41
|
-
// Mount the React Router app
|
|
42
|
-
server.use(app);
|
|
43
|
-
|
|
44
|
-
return server;
|
|
45
|
-
}
|
|
18
|
+
const clientDir = path.join(buildDir, 'client');
|
|
19
|
+
const serverEntry = path.join(buildDir, 'server', 'index.js');
|
|
46
20
|
|
|
47
21
|
/**
|
|
48
22
|
* Start the production HTTP server.
|
|
49
23
|
*
|
|
50
24
|
* @param {number} [port] - Port to listen on. Defaults to PORT env or 3000.
|
|
51
|
-
* @returns {Promise<import("
|
|
25
|
+
* @returns {Promise<import("srvx").Server>} The listening server. The
|
|
26
|
+
* underlying Node `http.Server` remains reachable via `server.node.server`.
|
|
52
27
|
*/
|
|
53
28
|
export async function startServer(port) {
|
|
54
|
-
|
|
55
|
-
|
|
29
|
+
// Import the compiled server build, which exports `createFetchHandler` (the
|
|
30
|
+
// React Router request handler, as a Web `Request` -> `Response` function).
|
|
31
|
+
const { createFetchHandler } = await import(pathToFileURL(serverEntry).href);
|
|
32
|
+
|
|
33
|
+
// Static assets are resolved before the SSR handler ever runs. Compression is
|
|
34
|
+
// left on here (unlike the embedded handler): this server can be self-hosted
|
|
35
|
+
// over a real network, where trading CPU for bytes is worth it.
|
|
36
|
+
const serveStatic = createStaticHandler({ dir: clientDir });
|
|
37
|
+
const ssr = createFetchHandler('/');
|
|
56
38
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
39
|
+
const server = serve({
|
|
40
|
+
port: port ?? parseInt(process.env.PORT || '3000', 10),
|
|
41
|
+
async fetch(request) {
|
|
42
|
+
return (await serveStatic(request)) ?? ssr(request);
|
|
43
|
+
},
|
|
44
|
+
// Safety net — prevents an unhandled error from taking down the server when
|
|
45
|
+
// the React Router error boundary cannot render (e.g. during SSR).
|
|
46
|
+
error(error) {
|
|
47
|
+
console.error('Unhandled request error:', error);
|
|
48
|
+
return new Response('Internal Server Error', { status: 500 });
|
|
49
|
+
},
|
|
50
|
+
// We print our own listening line below.
|
|
51
|
+
silent: true,
|
|
63
52
|
});
|
|
53
|
+
|
|
54
|
+
await server.ready();
|
|
55
|
+
console.log(`@workflow/web server listening on ${server.url}`);
|
|
56
|
+
return server;
|
|
64
57
|
}
|
|
65
58
|
|
|
66
59
|
// When run directly, start the server
|