@ironflow/node 0.1.0-test.2

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.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Internal error classes for step execution (Node.js specific)
3
+ */
4
+ /**
5
+ * Yield information union type
6
+ */
7
+ export type YieldInfo = SleepYieldInfo | WaitEventYieldInfo;
8
+ /**
9
+ * Sleep yield information
10
+ */
11
+ export interface SleepYieldInfo {
12
+ step_id: string;
13
+ type: "sleep";
14
+ until: string;
15
+ }
16
+ /**
17
+ * Wait for event yield information
18
+ */
19
+ export interface WaitEventYieldInfo {
20
+ step_id: string;
21
+ type: "wait_for_event";
22
+ event_filter: {
23
+ event: string;
24
+ match?: string;
25
+ timeout?: string;
26
+ };
27
+ }
28
+ /**
29
+ * Internal signal to yield execution (not a real error).
30
+ * Used internally to implement sleep and waitForEvent.
31
+ *
32
+ * @internal
33
+ */
34
+ export declare class YieldSignal extends Error {
35
+ /** Information about the yield operation */
36
+ readonly yieldInfo: YieldInfo;
37
+ constructor(yieldInfo: YieldInfo);
38
+ }
39
+ /**
40
+ * Check if an error is a YieldSignal
41
+ *
42
+ * @param error - The error to check
43
+ * @returns true if the error is a YieldSignal
44
+ * @internal
45
+ */
46
+ export declare function isYieldSignal(error: unknown): error is YieldSignal;
47
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAElB,SAAS,EAAE,SAAS;CAKjC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Internal error classes for step execution (Node.js specific)
3
+ */
4
+ /**
5
+ * Internal signal to yield execution (not a real error).
6
+ * Used internally to implement sleep and waitForEvent.
7
+ *
8
+ * @internal
9
+ */
10
+ export class YieldSignal extends Error {
11
+ /** Information about the yield operation */
12
+ yieldInfo;
13
+ constructor(yieldInfo) {
14
+ super("Yield signal");
15
+ this.name = "YieldSignal";
16
+ this.yieldInfo = yieldInfo;
17
+ }
18
+ }
19
+ /**
20
+ * Check if an error is a YieldSignal
21
+ *
22
+ * @param error - The error to check
23
+ * @returns true if the error is a YieldSignal
24
+ * @internal
25
+ */
26
+ export function isYieldSignal(error) {
27
+ return error instanceof YieldSignal;
28
+ }
29
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6BH;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,4CAA4C;IACnC,SAAS,CAAY;IAE9B,YAAY,SAAoB;QAC9B,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,KAAK,YAAY,WAAW,CAAC;AACtC,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Universal HTTP Serve Handler
3
+ *
4
+ * Provides a universal handler that works with:
5
+ * - Next.js App Router (export const POST = serve(...))
6
+ * - Express (app.post("/api/ironflow", serve(...)))
7
+ * - Hono (app.post("/api/ironflow", serve(...)))
8
+ * - Generic Fetch API (native Request/Response)
9
+ */
10
+ import type { ServeConfig } from "./types.js";
11
+ /**
12
+ * Node.js IncomingMessage-like object
13
+ * @internal
14
+ */
15
+ interface NodeRequest {
16
+ method?: string;
17
+ url?: string;
18
+ headers: Record<string, string | string[] | undefined>;
19
+ on?(event: string, callback: (data: unknown) => void): void;
20
+ body?: string | Buffer | unknown;
21
+ }
22
+ /**
23
+ * Node.js ServerResponse-like object
24
+ * @internal
25
+ */
26
+ interface NodeResponse {
27
+ statusCode?: number;
28
+ setHeader?(name: string, value: string): void;
29
+ end?(data: string): void;
30
+ writeHead?(statusCode: number, headers: Record<string, string>): void;
31
+ }
32
+ /**
33
+ * Universal handler function signature
34
+ */
35
+ type UniversalHandler = (request: Request | NodeRequest, responseOrContext?: NodeResponse | unknown) => Promise<Response | void>;
36
+ /**
37
+ * Create a universal HTTP handler for Ironflow functions
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Next.js App Router
42
+ * import { serve } from "@ironflow/node/serve";
43
+ * import { processOrder } from "./functions/process-order";
44
+ *
45
+ * export const POST = serve({
46
+ * functions: [processOrder],
47
+ * signingKey: process.env.IRONFLOW_SIGNING_KEY,
48
+ * });
49
+ * ```
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // Express
54
+ * import { serve } from "@ironflow/node/serve";
55
+ *
56
+ * app.post("/api/ironflow", serve({
57
+ * functions: [processOrder],
58
+ * signingKey: process.env.IRONFLOW_SIGNING_KEY,
59
+ * }));
60
+ * ```
61
+ */
62
+ export declare function serve(config: ServeConfig): UniversalHandler;
63
+ /**
64
+ * Create handler helper (alias for serve)
65
+ */
66
+ export declare const createHandler: typeof serve;
67
+ /**
68
+ * Default export
69
+ */
70
+ export default serve;
71
+ //# sourceMappingURL=serve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9C;;;GAGG;AACH,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACvD,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5D,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CACvE;AAED;;GAEG;AACH,KAAK,gBAAgB,GAAG,CACtB,OAAO,EAAE,OAAO,GAAG,WAAW,EAC9B,iBAAiB,CAAC,EAAE,YAAY,GAAG,OAAO,KACvC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,CAiG3D;AAmLD;;GAEG;AACH,eAAO,MAAM,aAAa,cAAQ,CAAC;AAEnC;;GAEG;AACH,eAAe,KAAK,CAAC"}
package/dist/serve.js ADDED
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Universal HTTP Serve Handler
3
+ *
4
+ * Provides a universal handler that works with:
5
+ * - Next.js App Router (export const POST = serve(...))
6
+ * - Express (app.post("/api/ironflow", serve(...)))
7
+ * - Hono (app.post("/api/ironflow", serve(...)))
8
+ * - Generic Fetch API (native Request/Response)
9
+ */
10
+ import { IronflowError, FunctionNotFoundError, isRetryable, PushRequestSchema, createLogger, createNoopLogger, } from "@ironflow/core";
11
+ import { ExecutionContext } from "./internal/context.js";
12
+ import { createStepClient } from "./step.js";
13
+ import { isYieldSignal } from "./internal/errors.js";
14
+ /**
15
+ * Create a universal HTTP handler for Ironflow functions
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Next.js App Router
20
+ * import { serve } from "@ironflow/node/serve";
21
+ * import { processOrder } from "./functions/process-order";
22
+ *
23
+ * export const POST = serve({
24
+ * functions: [processOrder],
25
+ * signingKey: process.env.IRONFLOW_SIGNING_KEY,
26
+ * });
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Express
32
+ * import { serve } from "@ironflow/node/serve";
33
+ *
34
+ * app.post("/api/ironflow", serve({
35
+ * functions: [processOrder],
36
+ * signingKey: process.env.IRONFLOW_SIGNING_KEY,
37
+ * }));
38
+ * ```
39
+ */
40
+ export function serve(config) {
41
+ // Build function map for fast lookup
42
+ const functionMap = new Map();
43
+ for (const fn of config.functions) {
44
+ functionMap.set(fn.config.id, fn);
45
+ }
46
+ // Initialize logger
47
+ let logger;
48
+ if (config.logger === false) {
49
+ logger = createNoopLogger();
50
+ }
51
+ else if (config.logger) {
52
+ logger = config.logger;
53
+ }
54
+ else {
55
+ logger = createLogger({ prefix: "[ironflow-serve]" });
56
+ }
57
+ // The universal handler
58
+ const handler = async (requestOrReq, resOrContext) => {
59
+ // Detect environment and normalize request
60
+ const { request, sendResponse } = normalizeRequest(requestOrReq, resOrContext);
61
+ try {
62
+ // Read body
63
+ const body = await request.text();
64
+ // Verify signature (unless skipped for dev)
65
+ if (config.signingKey && !config.skipVerification) {
66
+ const signature = request.headers.get("x-ironflow-signature");
67
+ if (!signature) {
68
+ return sendResponse(401, {
69
+ error: { message: "Missing signature", code: "SIGNATURE_MISSING" },
70
+ });
71
+ }
72
+ // TODO: Implement signature verification
73
+ // verifySignature(body, signature, config.signingKey);
74
+ }
75
+ // Parse and validate request
76
+ let pushRequest;
77
+ try {
78
+ const parsed = JSON.parse(body);
79
+ const result = PushRequestSchema.safeParse(parsed);
80
+ if (!result.success) {
81
+ const issues = result.error.issues
82
+ .map((i) => `${i.path.join(".")}: ${i.message}`)
83
+ .join(", ");
84
+ return sendResponse(400, {
85
+ error: {
86
+ message: `Invalid request body: ${issues}`,
87
+ code: "VALIDATION_ERROR",
88
+ },
89
+ });
90
+ }
91
+ pushRequest = result.data;
92
+ }
93
+ catch {
94
+ return sendResponse(400, {
95
+ error: { message: "Invalid JSON body", code: "INVALID_JSON" },
96
+ });
97
+ }
98
+ // Find function
99
+ const fn = functionMap.get(pushRequest.function_id);
100
+ if (!fn) {
101
+ return sendResponse(404, {
102
+ error: {
103
+ message: `Function not found: ${pushRequest.function_id}`,
104
+ code: "FUNCTION_NOT_FOUND",
105
+ },
106
+ });
107
+ }
108
+ // Execute function
109
+ const response = await executeHandler(fn, pushRequest);
110
+ return sendResponse(200, response);
111
+ }
112
+ catch (error) {
113
+ // Unexpected error
114
+ logger.error("Unexpected error in serve handler", {
115
+ error: error instanceof Error ? error.message : String(error),
116
+ });
117
+ return sendResponse(500, {
118
+ error: {
119
+ message: error instanceof Error ? error.message : "Internal server error",
120
+ code: "INTERNAL_ERROR",
121
+ },
122
+ });
123
+ }
124
+ };
125
+ return handler;
126
+ }
127
+ /**
128
+ * Execute a function handler and build the response
129
+ */
130
+ async function executeHandler(fn, request) {
131
+ // Create execution context
132
+ const ctx = new ExecutionContext(request);
133
+ // Create step client
134
+ const step = createStepClient(ctx);
135
+ // Build function context
136
+ const functionContext = {
137
+ event: ctx.event,
138
+ step,
139
+ run: ctx.runInfo,
140
+ logger: ctx.logger,
141
+ };
142
+ try {
143
+ // Execute the function handler
144
+ const result = await fn.handler(functionContext);
145
+ // Function completed successfully
146
+ return {
147
+ status: "completed",
148
+ steps: ctx.getExecutedSteps(),
149
+ result,
150
+ };
151
+ }
152
+ catch (error) {
153
+ // Check if this is a yield signal (sleep/waitForEvent)
154
+ if (isYieldSignal(error)) {
155
+ return {
156
+ status: "yielded",
157
+ steps: ctx.getExecutedSteps(),
158
+ yield: error.yieldInfo,
159
+ };
160
+ }
161
+ // Handle actual errors
162
+ const errorMessage = error instanceof Error ? error.message : String(error);
163
+ const errorStack = error instanceof Error ? error.stack : undefined;
164
+ const errorCode = error instanceof IronflowError ? error.code : "ERROR";
165
+ const retryable = isRetryable(error);
166
+ // Get step ID if it's a step error
167
+ let stepId;
168
+ if (error instanceof FunctionNotFoundError) {
169
+ stepId = undefined;
170
+ }
171
+ else if (error instanceof IronflowError && error.details?.["stepId"]) {
172
+ stepId = error.details["stepId"];
173
+ }
174
+ ctx.logger.error(`Function failed: ${errorMessage}`, {
175
+ code: errorCode,
176
+ retryable,
177
+ stepId,
178
+ });
179
+ return {
180
+ status: "failed",
181
+ steps: ctx.getExecutedSteps(),
182
+ error: {
183
+ message: errorMessage,
184
+ code: errorCode,
185
+ step_id: stepId,
186
+ retryable,
187
+ stack: errorStack,
188
+ },
189
+ };
190
+ }
191
+ }
192
+ /**
193
+ * Normalize different request types into a common interface
194
+ */
195
+ function normalizeRequest(request, responseOrContext) {
196
+ // Check if it's a native Fetch Request
197
+ if (request instanceof Request) {
198
+ return {
199
+ request: {
200
+ text: () => request.text(),
201
+ headers: {
202
+ get: (name) => request.headers.get(name),
203
+ },
204
+ },
205
+ sendResponse: (status, body) => {
206
+ return new Response(JSON.stringify(body), {
207
+ status,
208
+ headers: { "Content-Type": "application/json" },
209
+ });
210
+ },
211
+ };
212
+ }
213
+ // It's a Node.js-style request
214
+ const nodeReq = request;
215
+ const nodeRes = responseOrContext;
216
+ return {
217
+ request: {
218
+ text: async () => {
219
+ // If body is already parsed (e.g., by express.json())
220
+ if (typeof nodeReq.body === "string") {
221
+ return nodeReq.body;
222
+ }
223
+ if (Buffer.isBuffer(nodeReq.body)) {
224
+ return nodeReq.body.toString("utf-8");
225
+ }
226
+ if (typeof nodeReq.body === "object" && nodeReq.body !== null) {
227
+ return JSON.stringify(nodeReq.body);
228
+ }
229
+ // Read from stream
230
+ return new Promise((resolve, reject) => {
231
+ const chunks = [];
232
+ nodeReq.on?.("data", (chunk) => {
233
+ if (chunk instanceof Uint8Array || Buffer.isBuffer(chunk)) {
234
+ chunks.push(chunk);
235
+ }
236
+ else if (typeof chunk === "string") {
237
+ chunks.push(Buffer.from(chunk));
238
+ }
239
+ });
240
+ nodeReq.on?.("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
241
+ nodeReq.on?.("error", reject);
242
+ });
243
+ },
244
+ headers: {
245
+ get: (name) => {
246
+ const value = nodeReq.headers[name.toLowerCase()];
247
+ if (Array.isArray(value)) {
248
+ return value[0] ?? null;
249
+ }
250
+ return value ?? null;
251
+ },
252
+ },
253
+ },
254
+ sendResponse: (status, body) => {
255
+ if (nodeRes) {
256
+ if (nodeRes.writeHead) {
257
+ nodeRes.writeHead(status, { "Content-Type": "application/json" });
258
+ }
259
+ else {
260
+ nodeRes.statusCode = status;
261
+ nodeRes.setHeader?.("Content-Type", "application/json");
262
+ }
263
+ nodeRes.end?.(JSON.stringify(body));
264
+ return;
265
+ }
266
+ return new Response(JSON.stringify(body), {
267
+ status,
268
+ headers: { "Content-Type": "application/json" },
269
+ });
270
+ },
271
+ };
272
+ }
273
+ /**
274
+ * Create handler helper (alias for serve)
275
+ */
276
+ export const createHandler = serve;
277
+ /**
278
+ * Default export
279
+ */
280
+ export default serve;
281
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GAEjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAiCrD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,KAAK,CAAC,MAAmB;IACvC,qCAAqC;IACrC,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QAClC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,oBAAoB;IACpB,IAAI,MAAc,CAAC;IACnB,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QAC5B,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,wBAAwB;IACxB,MAAM,OAAO,GAAqB,KAAK,EACrC,YAAmC,EACnC,YAAqC,EACX,EAAE;QAC5B,2CAA2C;QAC3C,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,gBA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
2
+ * Step Execution Client
3
+ *
4
+ * Implements durable step primitives: run, sleep, sleepUntil, waitForEvent, parallel, map
5
+ */
6
+ import type { StepClient } from "@ironflow/core";
7
+ import type { ExecutionContext } from "./internal/context.js";
8
+ /**
9
+ * Create a step client for the given execution context
10
+ */
11
+ export declare function createStepClient(ctx: ExecutionContext): StepClient;
12
+ //# sourceMappingURL=step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../src/step.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAKV,UAAU,EAGX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAwB9D;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU,CAElE"}