@stepflowjs/adapter-express 0.0.1
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/index.d.ts +58 -0
- package/dist/index.js +503 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Stepflow } from '@stepflowjs/core';
|
|
2
|
+
import { AuthContext, AuthConfig, EndpointOption, BaseAdapterOptions } from '@stepflowjs/adapter-shared';
|
|
3
|
+
export { AuthConfig, AuthContext, AuthHandler, AuthResult, EndpointConfig, EndpointOption, EndpointPreset, RouteName, allOf, anyOf, createApiKeyAuth, createBearerAuth, isRouteEnabled, resolveEndpoints } from '@stepflowjs/adapter-shared';
|
|
4
|
+
import { Response, Router, RequestHandler } from 'express';
|
|
5
|
+
|
|
6
|
+
/** Express-specific request type for auth handlers */
|
|
7
|
+
type ExpressRequest = {
|
|
8
|
+
header(name: string): string | undefined;
|
|
9
|
+
headers: Record<string, string | string[] | undefined>;
|
|
10
|
+
url: string;
|
|
11
|
+
method: string;
|
|
12
|
+
query(name: string): string | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** Express-specific auth context */
|
|
15
|
+
type ExpressAuthContext = AuthContext<ExpressRequest, Response>;
|
|
16
|
+
/** Express-specific auth config */
|
|
17
|
+
type ExpressAuthConfig = AuthConfig<ExpressRequest, Response>;
|
|
18
|
+
interface MiddlewareOptions {
|
|
19
|
+
/** Base path for Stepflow routes. When set, middleware only handles paths under this base. */
|
|
20
|
+
basePath?: string;
|
|
21
|
+
/** Endpoint configuration - preset or fine-grained */
|
|
22
|
+
endpoints?: EndpointOption;
|
|
23
|
+
/** Authorization configuration */
|
|
24
|
+
auth?: ExpressAuthConfig;
|
|
25
|
+
/** Callback when authorization fails */
|
|
26
|
+
onAuthFailure?: BaseAdapterOptions<ExpressRequest, Response>["onAuthFailure"];
|
|
27
|
+
}
|
|
28
|
+
interface RouterOptions {
|
|
29
|
+
/** Prefix all routes under this base path (e.g. "/api/stepflow"). */
|
|
30
|
+
basePath?: string;
|
|
31
|
+
/** Custom health check function. Defaults to stepflow.healthCheck(). */
|
|
32
|
+
healthCheck?: () => Promise<boolean>;
|
|
33
|
+
/** Endpoint configuration - preset or fine-grained */
|
|
34
|
+
endpoints?: EndpointOption;
|
|
35
|
+
/** Authorization configuration */
|
|
36
|
+
auth?: ExpressAuthConfig;
|
|
37
|
+
/** Callback when authorization fails */
|
|
38
|
+
onAuthFailure?: BaseAdapterOptions<ExpressRequest, Response>["onAuthFailure"];
|
|
39
|
+
}
|
|
40
|
+
interface TriggerRequestBody<TPayload = unknown> {
|
|
41
|
+
payload: TPayload;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
runId?: string;
|
|
44
|
+
delay?: number;
|
|
45
|
+
idempotencyKey?: string;
|
|
46
|
+
}
|
|
47
|
+
interface NotifyRequestBody {
|
|
48
|
+
data: unknown;
|
|
49
|
+
}
|
|
50
|
+
interface ErrorResponseBody {
|
|
51
|
+
error: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare function createStepflowRouter(stepflow: Stepflow, options?: RouterOptions): Router;
|
|
56
|
+
declare function createStepflowMiddleware(stepflow: Stepflow, options?: MiddlewareOptions): RequestHandler;
|
|
57
|
+
|
|
58
|
+
export { type ErrorResponseBody, type ExpressAuthConfig, type ExpressAuthContext, type ExpressRequest, type MiddlewareOptions, type NotifyRequestBody, type RouterOptions, type TriggerRequestBody, createStepflowMiddleware, createStepflowRouter };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
isRouteEnabled,
|
|
4
|
+
runAuth,
|
|
5
|
+
getAuthFailureResponse,
|
|
6
|
+
createErrorBody
|
|
7
|
+
} from "@stepflowjs/adapter-shared";
|
|
8
|
+
import express, {
|
|
9
|
+
Router
|
|
10
|
+
} from "express";
|
|
11
|
+
import {
|
|
12
|
+
createApiKeyAuth,
|
|
13
|
+
createBearerAuth,
|
|
14
|
+
anyOf,
|
|
15
|
+
allOf,
|
|
16
|
+
isRouteEnabled as isRouteEnabled2,
|
|
17
|
+
resolveEndpoints
|
|
18
|
+
} from "@stepflowjs/adapter-shared";
|
|
19
|
+
function normalizeBasePath(basePath) {
|
|
20
|
+
if (!basePath) return "";
|
|
21
|
+
if (basePath === "/") return "";
|
|
22
|
+
return basePath.startsWith("/") ? basePath.replace(/\/$/, "") : `/${basePath}`;
|
|
23
|
+
}
|
|
24
|
+
function getAccessToken(req) {
|
|
25
|
+
const queryToken = req.query.token;
|
|
26
|
+
if (typeof queryToken === "string" && queryToken.length > 0) {
|
|
27
|
+
return queryToken;
|
|
28
|
+
}
|
|
29
|
+
const authHeader = req.header("authorization") ?? req.header("Authorization");
|
|
30
|
+
if (!authHeader) return void 0;
|
|
31
|
+
const match = authHeader.match(/^Bearer\s+(.+)$/i);
|
|
32
|
+
return match?.[1];
|
|
33
|
+
}
|
|
34
|
+
function jsonError(res, status, error, message) {
|
|
35
|
+
const body = message ? { error, message } : { error };
|
|
36
|
+
res.status(status).json(body);
|
|
37
|
+
}
|
|
38
|
+
function jsonAuthError(res, status, code, message) {
|
|
39
|
+
const body = createErrorBody(code, message);
|
|
40
|
+
res.status(status).json(body);
|
|
41
|
+
}
|
|
42
|
+
function getFirstParam(params, name) {
|
|
43
|
+
const value = params[name];
|
|
44
|
+
if (Array.isArray(value)) return value[0] ?? "";
|
|
45
|
+
return value ?? "";
|
|
46
|
+
}
|
|
47
|
+
function parseThrottleMs(value) {
|
|
48
|
+
if (typeof value !== "string") return void 0;
|
|
49
|
+
const ms = Number(value);
|
|
50
|
+
if (!Number.isFinite(ms) || ms < 0) return void 0;
|
|
51
|
+
return ms;
|
|
52
|
+
}
|
|
53
|
+
function createExpressRequest(req) {
|
|
54
|
+
return {
|
|
55
|
+
header: (name) => req.header(name),
|
|
56
|
+
headers: req.headers,
|
|
57
|
+
url: req.url,
|
|
58
|
+
method: req.method,
|
|
59
|
+
query: (name) => {
|
|
60
|
+
const value = req.query[name];
|
|
61
|
+
if (typeof value === "string") return value;
|
|
62
|
+
if (Array.isArray(value) && value.length > 0) return String(value[0]);
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function checkAuth(req, res, route, options, params = {}) {
|
|
68
|
+
const ctx = {
|
|
69
|
+
route,
|
|
70
|
+
request: createExpressRequest(req),
|
|
71
|
+
extra: res,
|
|
72
|
+
...params
|
|
73
|
+
};
|
|
74
|
+
const result = await runAuth(ctx, options.auth);
|
|
75
|
+
if (!result.ok) {
|
|
76
|
+
const { status, code, message } = getAuthFailureResponse(result);
|
|
77
|
+
await options.onAuthFailure?.(ctx, result);
|
|
78
|
+
jsonAuthError(res, status, code, message);
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
function createStepflowRouter(stepflow, options = {}) {
|
|
84
|
+
const basePath = normalizeBasePath(options.basePath);
|
|
85
|
+
const router = Router();
|
|
86
|
+
router.use(express.json());
|
|
87
|
+
if (isRouteEnabled("health", options.endpoints)) {
|
|
88
|
+
router.get(`${basePath}/health`, async (req, res) => {
|
|
89
|
+
if (await checkAuth(req, res, "health", options)) return;
|
|
90
|
+
try {
|
|
91
|
+
const ok = await (options.healthCheck?.() ?? stepflow.healthCheck());
|
|
92
|
+
res.status(200).json({ ok });
|
|
93
|
+
} catch (error) {
|
|
94
|
+
jsonError(res, 500, "Internal server error", error.message);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (isRouteEnabled("trigger", options.endpoints)) {
|
|
99
|
+
router.post(
|
|
100
|
+
`${basePath}/trigger/:workflowId`,
|
|
101
|
+
async (req, res) => {
|
|
102
|
+
const workflowId = getFirstParam(req.params, "workflowId");
|
|
103
|
+
if (await checkAuth(req, res, "trigger", options, { workflowId }))
|
|
104
|
+
return;
|
|
105
|
+
try {
|
|
106
|
+
const body = req.body;
|
|
107
|
+
if (!body || typeof body !== "object") {
|
|
108
|
+
jsonError(res, 400, "Bad request", "Invalid JSON body");
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const result = await stepflow.trigger(
|
|
112
|
+
String(workflowId),
|
|
113
|
+
body.payload,
|
|
114
|
+
{
|
|
115
|
+
runId: body.runId,
|
|
116
|
+
metadata: body.metadata,
|
|
117
|
+
delay: body.delay,
|
|
118
|
+
idempotencyKey: body.idempotencyKey
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
const response = result;
|
|
122
|
+
res.status(200).json(response);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
const message = error.message;
|
|
125
|
+
if (message.includes("Workflow") && message.includes("not found")) {
|
|
126
|
+
jsonError(res, 404, "Not found", message);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
jsonError(res, 500, "Internal server error", message);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
if (isRouteEnabled("runs", options.endpoints)) {
|
|
135
|
+
router.get(
|
|
136
|
+
`${basePath}/runs/:runId`,
|
|
137
|
+
async (req, res) => {
|
|
138
|
+
const runId = getFirstParam(req.params, "runId");
|
|
139
|
+
if (await checkAuth(req, res, "runs", options, { runId })) return;
|
|
140
|
+
try {
|
|
141
|
+
const accessToken = getAccessToken(req);
|
|
142
|
+
const run = await stepflow.getRun(String(runId), { accessToken });
|
|
143
|
+
if (!run) {
|
|
144
|
+
jsonError(res, 404, "Not found", `Run "${runId}" not found`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const response = run;
|
|
148
|
+
res.status(200).json(response);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
const message = error.message;
|
|
151
|
+
if (message === "Invalid access token") {
|
|
152
|
+
jsonError(res, 401, "Unauthorized", message);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
jsonError(res, 500, "Internal server error", message);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
if (isRouteEnabled("runsStream", options.endpoints)) {
|
|
161
|
+
router.get(
|
|
162
|
+
`${basePath}/runs/:runId/stream`,
|
|
163
|
+
async (req, res) => {
|
|
164
|
+
const runId = getFirstParam(req.params, "runId");
|
|
165
|
+
if (await checkAuth(req, res, "runsStream", options, { runId })) return;
|
|
166
|
+
const accessToken = getAccessToken(req);
|
|
167
|
+
if (accessToken) {
|
|
168
|
+
try {
|
|
169
|
+
await stepflow.getRun(String(runId), { accessToken });
|
|
170
|
+
} catch (error) {
|
|
171
|
+
const message = error.message;
|
|
172
|
+
if (message === "Invalid access token") {
|
|
173
|
+
jsonError(res, 401, "Unauthorized", message);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
jsonError(res, 500, "Internal server error", message);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const throttleMs = parseThrottleMs(req.query.throttle);
|
|
181
|
+
res.status(200);
|
|
182
|
+
res.setHeader("Content-Type", "text/event-stream");
|
|
183
|
+
res.setHeader("Cache-Control", "no-cache");
|
|
184
|
+
res.setHeader("Connection", "keep-alive");
|
|
185
|
+
res.setHeader("X-Accel-Buffering", "no");
|
|
186
|
+
res.flushHeaders?.();
|
|
187
|
+
res.write(`: connected
|
|
188
|
+
|
|
189
|
+
`);
|
|
190
|
+
let lastSentAt = 0;
|
|
191
|
+
let executionId;
|
|
192
|
+
let unsubscribeExecution;
|
|
193
|
+
let closed = false;
|
|
194
|
+
const send = (type, data) => {
|
|
195
|
+
if (closed) return;
|
|
196
|
+
if (throttleMs !== void 0) {
|
|
197
|
+
const now = Date.now();
|
|
198
|
+
if (now - lastSentAt < throttleMs) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
lastSentAt = now;
|
|
202
|
+
}
|
|
203
|
+
res.write(`event: ${type}
|
|
204
|
+
`);
|
|
205
|
+
res.write(`data: ${JSON.stringify(data)}
|
|
206
|
+
|
|
207
|
+
`);
|
|
208
|
+
};
|
|
209
|
+
const publishCurrentExecution = async () => {
|
|
210
|
+
const current = await stepflow.getRun(String(runId));
|
|
211
|
+
if (!current) return;
|
|
212
|
+
executionId = current.id;
|
|
213
|
+
send("update", current);
|
|
214
|
+
if (current.status === "completed") {
|
|
215
|
+
send("execution:complete", { result: current.result });
|
|
216
|
+
}
|
|
217
|
+
if (current.status === "failed") {
|
|
218
|
+
send("execution:failed", { error: current.error });
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const handleExecutionEvent = (event) => {
|
|
222
|
+
void (async () => {
|
|
223
|
+
if (!executionId || closed) return;
|
|
224
|
+
const execution = await stepflow.getExecution(executionId);
|
|
225
|
+
if (execution) {
|
|
226
|
+
send("update", execution);
|
|
227
|
+
if (execution.status === "completed") {
|
|
228
|
+
send("execution:complete", { result: execution.result });
|
|
229
|
+
}
|
|
230
|
+
if (execution.status === "failed") {
|
|
231
|
+
send("execution:failed", { error: execution.error });
|
|
232
|
+
}
|
|
233
|
+
if (typeof event === "object" && event !== null && "type" in event && "stepName" in event && typeof event.type === "string" && typeof event.stepName === "string") {
|
|
234
|
+
const type = event.type;
|
|
235
|
+
const stepName = event.stepName;
|
|
236
|
+
if (type === "step:complete") {
|
|
237
|
+
const step = execution.steps.find(
|
|
238
|
+
(s) => s.name === stepName
|
|
239
|
+
);
|
|
240
|
+
if (step) send("step:complete", step);
|
|
241
|
+
}
|
|
242
|
+
if (type === "step:failed") {
|
|
243
|
+
const step = execution.steps.find(
|
|
244
|
+
(s) => s.name === stepName
|
|
245
|
+
);
|
|
246
|
+
if (step) send("step:failed", step);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
})();
|
|
251
|
+
};
|
|
252
|
+
const stop = () => {
|
|
253
|
+
if (closed) return;
|
|
254
|
+
closed = true;
|
|
255
|
+
unsubscribeExecution?.();
|
|
256
|
+
res.end();
|
|
257
|
+
};
|
|
258
|
+
req.on("close", stop);
|
|
259
|
+
try {
|
|
260
|
+
await publishCurrentExecution();
|
|
261
|
+
while (!closed && !executionId) {
|
|
262
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
263
|
+
await publishCurrentExecution();
|
|
264
|
+
}
|
|
265
|
+
if (!executionId || closed) return;
|
|
266
|
+
unsubscribeExecution = stepflow.subscribeToExecution(
|
|
267
|
+
executionId,
|
|
268
|
+
handleExecutionEvent
|
|
269
|
+
);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
if (!closed) {
|
|
272
|
+
send("error", {
|
|
273
|
+
error: "Internal server error",
|
|
274
|
+
message: error.message
|
|
275
|
+
});
|
|
276
|
+
stop();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
if (isRouteEnabled("notify", options.endpoints)) {
|
|
283
|
+
router.post(
|
|
284
|
+
`${basePath}/notify/:eventId`,
|
|
285
|
+
async (req, res) => {
|
|
286
|
+
const eventId = getFirstParam(req.params, "eventId");
|
|
287
|
+
if (await checkAuth(req, res, "notify", options, { eventId })) return;
|
|
288
|
+
try {
|
|
289
|
+
const body = req.body;
|
|
290
|
+
if (!body || typeof body !== "object") {
|
|
291
|
+
jsonError(res, 400, "Bad request", "Invalid JSON body");
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const result = await stepflow.notify(String(eventId), body.data);
|
|
295
|
+
const response = result;
|
|
296
|
+
res.status(200).json(response);
|
|
297
|
+
} catch (error) {
|
|
298
|
+
jsonError(
|
|
299
|
+
res,
|
|
300
|
+
500,
|
|
301
|
+
"Internal server error",
|
|
302
|
+
error.message
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
if (isRouteEnabled("workflowsTrigger", options.endpoints)) {
|
|
309
|
+
router.post(
|
|
310
|
+
`${basePath}/workflows/:workflowId/trigger`,
|
|
311
|
+
async (req, res) => {
|
|
312
|
+
const workflowId = getFirstParam(req.params, "workflowId");
|
|
313
|
+
if (await checkAuth(req, res, "workflowsTrigger", options, { workflowId }))
|
|
314
|
+
return;
|
|
315
|
+
try {
|
|
316
|
+
const body = req.body;
|
|
317
|
+
if (!body || typeof body !== "object") {
|
|
318
|
+
jsonError(res, 400, "Bad request", "Invalid JSON body");
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const result = await stepflow.trigger(
|
|
322
|
+
String(workflowId),
|
|
323
|
+
body.payload,
|
|
324
|
+
{
|
|
325
|
+
runId: body.runId,
|
|
326
|
+
metadata: body.metadata,
|
|
327
|
+
delay: body.delay,
|
|
328
|
+
idempotencyKey: body.idempotencyKey
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
const response = result;
|
|
332
|
+
res.status(200).json(response);
|
|
333
|
+
} catch (error) {
|
|
334
|
+
const message = error.message;
|
|
335
|
+
if (message.includes("Workflow") && message.includes("not found")) {
|
|
336
|
+
jsonError(res, 404, "Not found", message);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
jsonError(res, 500, "Internal server error", message);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
if (isRouteEnabled("eventsNotify", options.endpoints)) {
|
|
345
|
+
router.post(
|
|
346
|
+
`${basePath}/events/:eventId/notify`,
|
|
347
|
+
async (req, res) => {
|
|
348
|
+
const eventId = getFirstParam(req.params, "eventId");
|
|
349
|
+
if (await checkAuth(req, res, "eventsNotify", options, { eventId }))
|
|
350
|
+
return;
|
|
351
|
+
try {
|
|
352
|
+
const body = req.body;
|
|
353
|
+
if (!body || typeof body !== "object") {
|
|
354
|
+
jsonError(res, 400, "Bad request", "Invalid JSON body");
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const result = await stepflow.notify(String(eventId), body.data);
|
|
358
|
+
const response = result;
|
|
359
|
+
res.status(200).json(response);
|
|
360
|
+
} catch (error) {
|
|
361
|
+
jsonError(
|
|
362
|
+
res,
|
|
363
|
+
500,
|
|
364
|
+
"Internal server error",
|
|
365
|
+
error.message
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
if (isRouteEnabled("workflowsStream", options.endpoints)) {
|
|
372
|
+
router.post(
|
|
373
|
+
`${basePath}/workflows/:workflowId/stream`,
|
|
374
|
+
async (req, res) => {
|
|
375
|
+
const workflowId = getFirstParam(req.params, "workflowId");
|
|
376
|
+
if (await checkAuth(req, res, "workflowsStream", options, { workflowId }))
|
|
377
|
+
return;
|
|
378
|
+
try {
|
|
379
|
+
const body = req.body;
|
|
380
|
+
if (!body || typeof body !== "object") {
|
|
381
|
+
jsonError(res, 400, "Bad request", "Invalid JSON body");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const { runId, publicAccessToken } = await stepflow.trigger(
|
|
385
|
+
String(workflowId),
|
|
386
|
+
body.payload
|
|
387
|
+
);
|
|
388
|
+
res.status(200);
|
|
389
|
+
res.setHeader("Content-Type", "text/event-stream");
|
|
390
|
+
res.setHeader("Cache-Control", "no-cache");
|
|
391
|
+
res.setHeader("Connection", "keep-alive");
|
|
392
|
+
res.setHeader("X-Accel-Buffering", "no");
|
|
393
|
+
res.flushHeaders?.();
|
|
394
|
+
res.write(`event: trigger
|
|
395
|
+
`);
|
|
396
|
+
res.write(
|
|
397
|
+
`data: ${JSON.stringify({ runId, accessToken: publicAccessToken })}
|
|
398
|
+
|
|
399
|
+
`
|
|
400
|
+
);
|
|
401
|
+
let executionId;
|
|
402
|
+
let closed = false;
|
|
403
|
+
const stop = () => {
|
|
404
|
+
if (closed) return;
|
|
405
|
+
closed = true;
|
|
406
|
+
res.end();
|
|
407
|
+
};
|
|
408
|
+
req.on("close", stop);
|
|
409
|
+
while (!closed && !executionId) {
|
|
410
|
+
const run = await stepflow.getRun(runId);
|
|
411
|
+
executionId = run?.id;
|
|
412
|
+
if (!executionId) {
|
|
413
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (!executionId || closed) return;
|
|
417
|
+
const unsubscribe = stepflow.subscribeToExecution(executionId, () => {
|
|
418
|
+
void (async () => {
|
|
419
|
+
if (closed) return;
|
|
420
|
+
const execution = await stepflow.getExecution(executionId);
|
|
421
|
+
if (execution) {
|
|
422
|
+
res.write(`event: update
|
|
423
|
+
`);
|
|
424
|
+
res.write(`data: ${JSON.stringify(execution)}
|
|
425
|
+
|
|
426
|
+
`);
|
|
427
|
+
}
|
|
428
|
+
})();
|
|
429
|
+
});
|
|
430
|
+
try {
|
|
431
|
+
await new Promise((r) => setTimeout(r, 60 * 60 * 1e3));
|
|
432
|
+
} finally {
|
|
433
|
+
unsubscribe();
|
|
434
|
+
stop();
|
|
435
|
+
}
|
|
436
|
+
} catch (error) {
|
|
437
|
+
const message = error.message;
|
|
438
|
+
if (message.includes("Workflow") && message.includes("not found")) {
|
|
439
|
+
jsonError(res, 404, "Not found", message);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
jsonError(res, 500, "Internal server error", message);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
router.use(
|
|
448
|
+
(error, _req, res, next) => {
|
|
449
|
+
if (res.headersSent) {
|
|
450
|
+
next(error);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (error instanceof SyntaxError && "status" in error && typeof error.status === "number" && error.status === 400) {
|
|
454
|
+
jsonError(res, 400, "Bad request", "Invalid JSON body");
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
next(error);
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
return router;
|
|
461
|
+
}
|
|
462
|
+
function createStepflowMiddleware(stepflow, options = {}) {
|
|
463
|
+
const basePath = normalizeBasePath(options.basePath);
|
|
464
|
+
const router = createStepflowRouter(stepflow, {
|
|
465
|
+
endpoints: options.endpoints,
|
|
466
|
+
auth: options.auth,
|
|
467
|
+
onAuthFailure: options.onAuthFailure
|
|
468
|
+
});
|
|
469
|
+
return (req, res, next) => {
|
|
470
|
+
if (basePath) {
|
|
471
|
+
const fullPath = `${req.baseUrl}${req.path}`;
|
|
472
|
+
if (!fullPath.startsWith(basePath)) {
|
|
473
|
+
next();
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
if (req.url.startsWith(basePath)) {
|
|
477
|
+
const originalUrl = req.url;
|
|
478
|
+
req.url = req.url.slice(basePath.length) || "/";
|
|
479
|
+
router(req, res, (err) => {
|
|
480
|
+
req.url = originalUrl;
|
|
481
|
+
if (!err) {
|
|
482
|
+
next();
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
next(err instanceof Error ? err : new Error(String(err)));
|
|
486
|
+
});
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
router(req, res, next);
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
export {
|
|
494
|
+
allOf,
|
|
495
|
+
anyOf,
|
|
496
|
+
createApiKeyAuth,
|
|
497
|
+
createBearerAuth,
|
|
498
|
+
createStepflowMiddleware,
|
|
499
|
+
createStepflowRouter,
|
|
500
|
+
isRouteEnabled2 as isRouteEnabled,
|
|
501
|
+
resolveEndpoints
|
|
502
|
+
};
|
|
503
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Execution, NotifyResult, TriggerResult } from \"@stepflowjs/core\";\nimport type { Stepflow } from \"@stepflowjs/core\";\nimport {\n type AuthConfig,\n type AuthContext,\n type BaseAdapterOptions,\n type EndpointOption,\n type RouteName,\n isRouteEnabled,\n runAuth,\n getAuthFailureResponse,\n createErrorBody,\n} from \"@stepflowjs/adapter-shared\";\nimport express, {\n Router,\n type NextFunction,\n type Request,\n type RequestHandler,\n type Response,\n} from \"express\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Express-specific request type for auth handlers */\nexport type ExpressRequest = {\n header(name: string): string | undefined;\n headers: Record<string, string | string[] | undefined>;\n url: string;\n method: string;\n query(name: string): string | undefined;\n};\n\n/** Express-specific auth context */\nexport type ExpressAuthContext = AuthContext<ExpressRequest, Response>;\n\n/** Express-specific auth config */\nexport type ExpressAuthConfig = AuthConfig<ExpressRequest, Response>;\n\nexport interface MiddlewareOptions {\n /** Base path for Stepflow routes. When set, middleware only handles paths under this base. */\n basePath?: string;\n /** Endpoint configuration - preset or fine-grained */\n endpoints?: EndpointOption;\n /** Authorization configuration */\n auth?: ExpressAuthConfig;\n /** Callback when authorization fails */\n onAuthFailure?: BaseAdapterOptions<ExpressRequest, Response>[\"onAuthFailure\"];\n}\n\nexport interface RouterOptions {\n /** Prefix all routes under this base path (e.g. \"/api/stepflow\"). */\n basePath?: string;\n /** Custom health check function. Defaults to stepflow.healthCheck(). */\n healthCheck?: () => Promise<boolean>;\n /** Endpoint configuration - preset or fine-grained */\n endpoints?: EndpointOption;\n /** Authorization configuration */\n auth?: ExpressAuthConfig;\n /** Callback when authorization fails */\n onAuthFailure?: BaseAdapterOptions<ExpressRequest, Response>[\"onAuthFailure\"];\n}\n\nexport interface TriggerRequestBody<TPayload = unknown> {\n payload: TPayload;\n metadata?: Record<string, unknown>;\n runId?: string;\n delay?: number;\n idempotencyKey?: string;\n}\n\nexport interface NotifyRequestBody {\n data: unknown;\n}\n\nexport interface ErrorResponseBody {\n error: string;\n message?: string;\n}\n\n// ============================================================================\n// Re-exports from shared\n// ============================================================================\n\nexport {\n type AuthContext,\n type AuthResult,\n type AuthHandler,\n type AuthConfig,\n type EndpointConfig,\n type EndpointOption,\n type EndpointPreset,\n type RouteName,\n createApiKeyAuth,\n createBearerAuth,\n anyOf,\n allOf,\n isRouteEnabled,\n resolveEndpoints,\n} from \"@stepflowjs/adapter-shared\";\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction normalizeBasePath(basePath: string | undefined): string {\n if (!basePath) return \"\";\n if (basePath === \"/\") return \"\";\n return basePath.startsWith(\"/\")\n ? basePath.replace(/\\/$/, \"\")\n : `/${basePath}`;\n}\n\nfunction getAccessToken(req: Request): string | undefined {\n const queryToken = req.query.token;\n if (typeof queryToken === \"string\" && queryToken.length > 0) {\n return queryToken;\n }\n\n const authHeader = req.header(\"authorization\") ?? req.header(\"Authorization\");\n if (!authHeader) return undefined;\n\n const match = authHeader.match(/^Bearer\\s+(.+)$/i);\n return match?.[1];\n}\n\nfunction jsonError(\n res: Response,\n status: number,\n error: string,\n message?: string,\n): void {\n const body: ErrorResponseBody = message ? { error, message } : { error };\n res.status(status).json(body);\n}\n\nfunction jsonAuthError(\n res: Response,\n status: number,\n code: string,\n message: string,\n): void {\n const body = createErrorBody(code, message);\n res.status(status).json(body);\n}\n\nfunction getFirstParam(params: Request[\"params\"], name: string): string {\n const value = params[name];\n if (Array.isArray(value)) return value[0] ?? \"\";\n return value ?? \"\";\n}\n\nfunction parseThrottleMs(value: unknown): number | undefined {\n if (typeof value !== \"string\") return undefined;\n const ms = Number(value);\n if (!Number.isFinite(ms) || ms < 0) return undefined;\n return ms;\n}\n\n/**\n * Creates an ExpressRequest object from Express Request for auth handlers\n */\nfunction createExpressRequest(req: Request): ExpressRequest {\n return {\n header: (name: string) => req.header(name),\n headers: req.headers as Record<string, string | string[] | undefined>,\n url: req.url,\n method: req.method,\n query: (name: string) => {\n const value = req.query[name];\n if (typeof value === \"string\") return value;\n if (Array.isArray(value) && value.length > 0) return String(value[0]);\n return undefined;\n },\n };\n}\n\n/**\n * Runs authorization check and returns true if denied (response already sent)\n */\nasync function checkAuth(\n req: Request,\n res: Response,\n route: RouteName,\n options: RouterOptions,\n params: { workflowId?: string; eventId?: string; runId?: string } = {},\n): Promise<boolean> {\n const ctx: ExpressAuthContext = {\n route,\n request: createExpressRequest(req),\n extra: res,\n ...params,\n };\n\n const result = await runAuth(ctx, options.auth);\n\n if (!result.ok) {\n const { status, code, message } = getAuthFailureResponse(result);\n await options.onAuthFailure?.(ctx, result);\n jsonAuthError(res, status, code, message);\n return true;\n }\n\n return false;\n}\n\n// ============================================================================\n// Router\n// ============================================================================\n\nexport function createStepflowRouter(\n stepflow: Stepflow,\n options: RouterOptions = {},\n): Router {\n const basePath = normalizeBasePath(options.basePath);\n const router = Router();\n\n router.use(express.json());\n\n // Health check\n if (isRouteEnabled(\"health\", options.endpoints)) {\n router.get(`${basePath}/health`, async (req: Request, res: Response) => {\n if (await checkAuth(req, res, \"health\", options)) return;\n\n try {\n const ok = await (options.healthCheck?.() ?? stepflow.healthCheck());\n res.status(200).json({ ok });\n } catch (error) {\n jsonError(res, 500, \"Internal server error\", (error as Error).message);\n }\n });\n }\n\n // Trigger a workflow\n if (isRouteEnabled(\"trigger\", options.endpoints)) {\n router.post(\n `${basePath}/trigger/:workflowId`,\n async (req: Request, res: Response) => {\n const workflowId = getFirstParam(req.params, \"workflowId\");\n\n if (await checkAuth(req, res, \"trigger\", options, { workflowId }))\n return;\n\n try {\n const body = req.body as TriggerRequestBody | undefined;\n if (!body || typeof body !== \"object\") {\n jsonError(res, 400, \"Bad request\", \"Invalid JSON body\");\n return;\n }\n\n const result = await stepflow.trigger(\n String(workflowId),\n body.payload,\n {\n runId: body.runId,\n metadata: body.metadata,\n delay: body.delay,\n idempotencyKey: body.idempotencyKey,\n },\n );\n\n const response: TriggerResult = result;\n res.status(200).json(response);\n } catch (error) {\n const message = (error as Error).message;\n if (message.includes(\"Workflow\") && message.includes(\"not found\")) {\n jsonError(res, 404, \"Not found\", message);\n return;\n }\n jsonError(res, 500, \"Internal server error\", message);\n }\n },\n );\n }\n\n // Get run status\n if (isRouteEnabled(\"runs\", options.endpoints)) {\n router.get(\n `${basePath}/runs/:runId`,\n async (req: Request, res: Response) => {\n const runId = getFirstParam(req.params, \"runId\");\n\n if (await checkAuth(req, res, \"runs\", options, { runId })) return;\n\n try {\n const accessToken = getAccessToken(req);\n const run = await stepflow.getRun(String(runId), { accessToken });\n\n if (!run) {\n jsonError(res, 404, \"Not found\", `Run \"${runId}\" not found`);\n return;\n }\n\n const response: Execution = run;\n res.status(200).json(response);\n } catch (error) {\n const message = (error as Error).message;\n if (message === \"Invalid access token\") {\n jsonError(res, 401, \"Unauthorized\", message);\n return;\n }\n jsonError(res, 500, \"Internal server error\", message);\n }\n },\n );\n }\n\n // SSE stream for run updates\n if (isRouteEnabled(\"runsStream\", options.endpoints)) {\n router.get(\n `${basePath}/runs/:runId/stream`,\n async (req: Request, res: Response) => {\n const runId = getFirstParam(req.params, \"runId\");\n\n if (await checkAuth(req, res, \"runsStream\", options, { runId })) return;\n\n const accessToken = getAccessToken(req);\n if (accessToken) {\n try {\n await stepflow.getRun(String(runId), { accessToken });\n } catch (error) {\n const message = (error as Error).message;\n if (message === \"Invalid access token\") {\n jsonError(res, 401, \"Unauthorized\", message);\n return;\n }\n jsonError(res, 500, \"Internal server error\", message);\n return;\n }\n }\n\n const throttleMs = parseThrottleMs(req.query.throttle);\n\n res.status(200);\n res.setHeader(\"Content-Type\", \"text/event-stream\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.setHeader(\"Connection\", \"keep-alive\");\n res.setHeader(\"X-Accel-Buffering\", \"no\");\n res.flushHeaders?.();\n\n // Ensure the client receives an initial chunk immediately.\n res.write(`: connected\\n\\n`);\n\n let lastSentAt = 0;\n let executionId: string | undefined;\n let unsubscribeExecution: (() => void) | undefined;\n let closed = false;\n\n const send = (type: string, data: unknown) => {\n if (closed) return;\n\n if (throttleMs !== undefined) {\n const now = Date.now();\n if (now - lastSentAt < throttleMs) {\n return;\n }\n lastSentAt = now;\n }\n\n res.write(`event: ${type}\\n`);\n res.write(`data: ${JSON.stringify(data)}\\n\\n`);\n };\n\n const publishCurrentExecution = async () => {\n const current = await stepflow.getRun(String(runId));\n if (!current) return;\n\n executionId = current.id;\n send(\"update\", current);\n\n if (current.status === \"completed\") {\n send(\"execution:complete\", { result: current.result });\n }\n if (current.status === \"failed\") {\n send(\"execution:failed\", { error: current.error });\n }\n };\n\n const handleExecutionEvent = (event: unknown) => {\n // We cannot await inside the realtime callback.\n void (async () => {\n if (!executionId || closed) return;\n\n const execution = await stepflow.getExecution(executionId);\n if (execution) {\n send(\"update\", execution);\n\n if (execution.status === \"completed\") {\n send(\"execution:complete\", { result: execution.result });\n }\n if (execution.status === \"failed\") {\n send(\"execution:failed\", { error: execution.error });\n }\n\n if (\n typeof event === \"object\" &&\n event !== null &&\n \"type\" in event &&\n \"stepName\" in event &&\n typeof (event as { type: unknown }).type === \"string\" &&\n typeof (event as { stepName: unknown }).stepName === \"string\"\n ) {\n const type = (event as { type: string }).type;\n const stepName = (event as { stepName: string }).stepName;\n\n if (type === \"step:complete\") {\n const step = execution.steps.find(\n (s: { name: string }) => s.name === stepName,\n );\n if (step) send(\"step:complete\", step);\n }\n if (type === \"step:failed\") {\n const step = execution.steps.find(\n (s: { name: string }) => s.name === stepName,\n );\n if (step) send(\"step:failed\", step);\n }\n }\n }\n })();\n };\n\n const stop = () => {\n if (closed) return;\n closed = true;\n unsubscribeExecution?.();\n res.end();\n };\n\n req.on(\"close\", stop);\n\n try {\n await publishCurrentExecution();\n\n // If the run doesn't exist yet, poll until it does.\n while (!closed && !executionId) {\n await new Promise((r) => setTimeout(r, 250));\n await publishCurrentExecution();\n }\n\n if (!executionId || closed) return;\n\n unsubscribeExecution = stepflow.subscribeToExecution(\n executionId,\n handleExecutionEvent,\n );\n } catch (error) {\n if (!closed) {\n send(\"error\", {\n error: \"Internal server error\",\n message: (error as Error).message,\n });\n stop();\n }\n }\n },\n );\n }\n\n // Notify an event\n if (isRouteEnabled(\"notify\", options.endpoints)) {\n router.post(\n `${basePath}/notify/:eventId`,\n async (req: Request, res: Response) => {\n const eventId = getFirstParam(req.params, \"eventId\");\n\n if (await checkAuth(req, res, \"notify\", options, { eventId })) return;\n\n try {\n const body = req.body as NotifyRequestBody | undefined;\n if (!body || typeof body !== \"object\") {\n jsonError(res, 400, \"Bad request\", \"Invalid JSON body\");\n return;\n }\n\n const result = await stepflow.notify(String(eventId), body.data);\n const response: NotifyResult = result;\n res.status(200).json(response);\n } catch (error) {\n jsonError(\n res,\n 500,\n \"Internal server error\",\n (error as Error).message,\n );\n }\n },\n );\n }\n\n // Alias routes for StepflowClient (client-ts) conventions\n\n if (isRouteEnabled(\"workflowsTrigger\", options.endpoints)) {\n router.post(\n `${basePath}/workflows/:workflowId/trigger`,\n async (req: Request, res: Response) => {\n const workflowId = getFirstParam(req.params, \"workflowId\");\n\n if (\n await checkAuth(req, res, \"workflowsTrigger\", options, { workflowId })\n )\n return;\n\n try {\n const body = req.body as\n | {\n payload: unknown;\n metadata?: Record<string, unknown>;\n runId?: string;\n delay?: number;\n idempotencyKey?: string;\n }\n | undefined;\n\n if (!body || typeof body !== \"object\") {\n jsonError(res, 400, \"Bad request\", \"Invalid JSON body\");\n return;\n }\n\n const result = await stepflow.trigger(\n String(workflowId),\n body.payload,\n {\n runId: body.runId,\n metadata: body.metadata,\n delay: body.delay,\n idempotencyKey: body.idempotencyKey,\n },\n );\n\n const response: TriggerResult = result;\n res.status(200).json(response);\n } catch (error) {\n const message = (error as Error).message;\n if (message.includes(\"Workflow\") && message.includes(\"not found\")) {\n jsonError(res, 404, \"Not found\", message);\n return;\n }\n jsonError(res, 500, \"Internal server error\", message);\n }\n },\n );\n }\n\n if (isRouteEnabled(\"eventsNotify\", options.endpoints)) {\n router.post(\n `${basePath}/events/:eventId/notify`,\n async (req: Request, res: Response) => {\n const eventId = getFirstParam(req.params, \"eventId\");\n\n if (await checkAuth(req, res, \"eventsNotify\", options, { eventId }))\n return;\n\n try {\n const body = req.body as NotifyRequestBody | undefined;\n if (!body || typeof body !== \"object\") {\n jsonError(res, 400, \"Bad request\", \"Invalid JSON body\");\n return;\n }\n\n const result = await stepflow.notify(String(eventId), body.data);\n const response: NotifyResult = result;\n res.status(200).json(response);\n } catch (error) {\n jsonError(\n res,\n 500,\n \"Internal server error\",\n (error as Error).message,\n );\n }\n },\n );\n }\n\n // Minimal stream endpoint: trigger + return SSE stream\n if (isRouteEnabled(\"workflowsStream\", options.endpoints)) {\n router.post(\n `${basePath}/workflows/:workflowId/stream`,\n async (req: Request, res: Response) => {\n const workflowId = getFirstParam(req.params, \"workflowId\");\n\n if (\n await checkAuth(req, res, \"workflowsStream\", options, { workflowId })\n )\n return;\n\n try {\n const body = req.body as { payload: unknown } | undefined;\n if (!body || typeof body !== \"object\") {\n jsonError(res, 400, \"Bad request\", \"Invalid JSON body\");\n return;\n }\n\n const { runId, publicAccessToken } = await stepflow.trigger(\n String(workflowId),\n body.payload,\n );\n\n res.status(200);\n res.setHeader(\"Content-Type\", \"text/event-stream\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.setHeader(\"Connection\", \"keep-alive\");\n res.setHeader(\"X-Accel-Buffering\", \"no\");\n res.flushHeaders?.();\n\n res.write(`event: trigger\\n`);\n res.write(\n `data: ${JSON.stringify({ runId, accessToken: publicAccessToken })}\\n\\n`,\n );\n\n let executionId: string | undefined;\n let closed = false;\n\n const stop = () => {\n if (closed) return;\n closed = true;\n res.end();\n };\n\n req.on(\"close\", stop);\n\n // Delegate to the run stream logic by subscribing to the execution.\n // We need executionId; poll until the run exists.\n while (!closed && !executionId) {\n const run = await stepflow.getRun(runId);\n executionId = run?.id;\n if (!executionId) {\n await new Promise((r) => setTimeout(r, 100));\n }\n }\n\n if (!executionId || closed) return;\n\n const unsubscribe = stepflow.subscribeToExecution(executionId, () => {\n void (async () => {\n if (closed) return;\n const execution = await stepflow.getExecution(executionId);\n if (execution) {\n res.write(`event: update\\n`);\n res.write(`data: ${JSON.stringify(execution)}\\n\\n`);\n }\n })();\n });\n\n try {\n // Keep connection open\n await new Promise((r) => setTimeout(r, 60 * 60 * 1000));\n } finally {\n unsubscribe();\n stop();\n }\n } catch (error) {\n const message = (error as Error).message;\n if (message.includes(\"Workflow\") && message.includes(\"not found\")) {\n jsonError(res, 404, \"Not found\", message);\n return;\n }\n jsonError(res, 500, \"Internal server error\", message);\n }\n },\n );\n }\n\n // Error handler (invalid JSON, etc.)\n router.use(\n (error: unknown, _req: Request, res: Response, next: NextFunction) => {\n if (res.headersSent) {\n next(error);\n return;\n }\n\n if (\n error instanceof SyntaxError &&\n \"status\" in error &&\n typeof (error as { status?: unknown }).status === \"number\" &&\n (error as { status: number }).status === 400\n ) {\n jsonError(res, 400, \"Bad request\", \"Invalid JSON body\");\n return;\n }\n\n next(error);\n },\n );\n\n return router;\n}\n\n// ============================================================================\n// Middleware\n// ============================================================================\n\nexport function createStepflowMiddleware(\n stepflow: Stepflow,\n options: MiddlewareOptions = {},\n): RequestHandler {\n const basePath = normalizeBasePath(options.basePath);\n const router = createStepflowRouter(stepflow, {\n endpoints: options.endpoints,\n auth: options.auth,\n onAuthFailure: options.onAuthFailure,\n });\n\n return (req: Request, res: Response, next: NextFunction) => {\n if (basePath) {\n const fullPath = `${req.baseUrl}${req.path}`;\n if (!fullPath.startsWith(basePath)) {\n next();\n return;\n }\n\n // If mounted at root and the request path still includes basePath,\n // strip it so the internal router can match \"/trigger\", \"/runs\", etc.\n if (req.url.startsWith(basePath)) {\n const originalUrl = req.url;\n req.url = req.url.slice(basePath.length) || \"/\";\n router(req, res, (err?: unknown) => {\n req.url = originalUrl;\n if (!err) {\n next();\n return;\n }\n next(err instanceof Error ? err : new Error(String(err)));\n });\n return;\n }\n }\n\n router(req, res, next);\n };\n}\n"],"mappings":";AAEA;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO;AAAA,EACL;AAAA,OAKK;AAkEP;AAAA,EASE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAAA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,kBAAkB,UAAsC;AAC/D,MAAI,CAAC,SA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AK,KAAK;AACV;AAAA,MACF;AAEA,UACE,iBAAiB,eACjB,YAAY,SACZ,OAAQ,MAA+B,WAAW,YACjD,MAA6B,WAAW,KACzC;AACA,kBAAU,KAAK,KAAK,eAAe,mBAAmB;AACtD;AAAA,MACF;AAEA,WAAK,KAAK;AAAA,IACZ;AAAA,EACF;AAEA,SAAO;AACT;AAMO,SAAS,yBACd,UACA,UAA6B,CAAC,GACd;AAChB,QAAM,WAAW,kBAAkB,QAAQ,QAAQ;AACnD,QAAM,SAAS,qBAAqB,UAAU;AAAA,IAC5C,WAAW,QAAQ;AAAA,IACnB,MAAM,QAAQ;AAAA,IACd,eAAe,QAAQ;AAAA,EACzB,CAAC;AAED,SAAO,CAAC,KAAc,KAAe,SAAuB;AAC1D,QAAI,UAAU;AACZ,YAAM,WAAW,GAAG,IAAI,OAAO,GAAG,IAAI,IAAI;AAC1C,UAAI,CAAC,SAAS,WAAW,QAAQ,GAAG;AAClC,aAAK;AACL;AAAA,MACF;AAIA,UAAI,IAAI,IAAI,WAAW,QAAQ,GAAG;AAChC,cAAM,cAAc,IAAI;AACxB,YAAI,MAAM,IAAI,IAAI,MAAM,SAAS,MAAM,KAAK;AAC5C,eAAO,KAAK,KAAK,CAAC,QAAkB;AAClC,cAAI,MAAM;AACV,cAAI,CAAC,KAAK;AACR,iBAAK;AACL;AAAA,UACF;AACA,eAAK,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;AAAA,QAC1D,CAAC;AACD;AAAA,MACF;AAAA,IACF;AAEA,WAAO,KAAK,KAAK,IAAI;AAAA,EACvB;AACF;","names":["isRouteEnabled"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stepflowjs/adapter-express",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Express.js framework adapter for Stepflow workflows",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@stepflowjs/adapter-shared": "0.0.1",
|
|
20
|
+
"@stepflowjs/core": "0.0.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/express": "^5.0.0",
|
|
24
|
+
"@types/supertest": "^6.0.3",
|
|
25
|
+
"express": "^5.1.0",
|
|
26
|
+
"supertest": "^7.1.0",
|
|
27
|
+
"tsup": "^8.5.1",
|
|
28
|
+
"vitest": "^4.0.17"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"express": "^4.0.0 || ^5.0.0",
|
|
32
|
+
"typescript": "^5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"author": "Stepflow Contributors",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://stepflow-production.up.railway.app",
|
|
39
|
+
"directory": "packages/adapters/express"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://stepflow-production.up.railway.app",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://stepflow-production.up.railway.app"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"stepflow",
|
|
47
|
+
"adapter",
|
|
48
|
+
"express",
|
|
49
|
+
"framework",
|
|
50
|
+
"workflow",
|
|
51
|
+
"orchestration"
|
|
52
|
+
],
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsup",
|
|
58
|
+
"dev": "tsup --watch",
|
|
59
|
+
"typecheck": "tsc --noEmit",
|
|
60
|
+
"test": "vitest",
|
|
61
|
+
"clean": "rm -rf dist"
|
|
62
|
+
}
|
|
63
|
+
}
|