@ontemper/platform 0.1.1 → 0.1.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.
- package/dist/index.d.ts +7 -4
- package/dist/index.js +4 -19
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,11 @@ declare class TemperContext {
|
|
|
32
32
|
/** Set a durable state value. */
|
|
33
33
|
set<T>(key: string, value: T): Promise<void>;
|
|
34
34
|
}
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
export interface TemperWorkflow {
|
|
36
|
+
/** Restate service name (wf_{WORKFLOW_ID}) */
|
|
37
|
+
workflowName: string;
|
|
38
|
+
/** Fetch handler — pass requests from your HTTP server to this */
|
|
39
|
+
fetch: (req: Request) => Promise<Response>;
|
|
40
|
+
}
|
|
41
|
+
export declare function createWorkflow({ handler }: CreateWorkflowOptions): TemperWorkflow;
|
|
39
42
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -116,24 +116,9 @@ export function createWorkflow({ handler }) {
|
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
118
|
});
|
|
119
|
-
// Start Bun HTTP server with Restate endpoint + health check
|
|
120
|
-
const port = Number(process.env.PORT);
|
|
121
|
-
if (!port)
|
|
122
|
-
throw new Error("PORT env var required");
|
|
123
119
|
const restateHandler = endpoint().bind(workflow).handler();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const url = new URL(req.url);
|
|
129
|
-
if (url.pathname === "/health" || url.pathname === "/healthcheck") {
|
|
130
|
-
return new Response(JSON.stringify({ status: "ok" }), {
|
|
131
|
-
headers: { "Content-Type": "application/json" },
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return restateHandler.fetch(req);
|
|
135
|
-
},
|
|
136
|
-
});
|
|
120
|
+
return {
|
|
121
|
+
workflowName,
|
|
122
|
+
fetch: (req) => restateHandler.fetch(req),
|
|
123
|
+
};
|
|
137
124
|
}
|
|
138
|
-
// Customer-facing API (backward-compatible module shape)
|
|
139
|
-
export const temper = { createWorkflow };
|