@upstash/workflow 0.2.20 → 0.2.22-rc

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/tanstack.mjs ADDED
@@ -0,0 +1,48 @@
1
+ import {
2
+ SDK_TELEMETRY,
3
+ serveBase,
4
+ serveManyBase
5
+ } from "./chunk-CAQSUCHB.mjs";
6
+
7
+ // platforms/tanstack.ts
8
+ var telemetry = {
9
+ sdk: SDK_TELEMETRY,
10
+ framework: "tanstack",
11
+ runtime: `node@${process.version}`
12
+ };
13
+ function serve(routeFunction, options) {
14
+ const POST = (tanstackContext) => {
15
+ const { handler } = serveBase(
16
+ routeFunction,
17
+ telemetry,
18
+ options
19
+ );
20
+ return handler(tanstackContext.request);
21
+ };
22
+ return { POST };
23
+ }
24
+ var createWorkflow = (...params) => {
25
+ const [routeFunction, options = {}] = params;
26
+ return {
27
+ options,
28
+ workflowId: void 0,
29
+ routeFunction
30
+ };
31
+ };
32
+ var serveMany = (workflows, options) => {
33
+ return {
34
+ POST: serveManyBase({
35
+ workflows,
36
+ getUrl(context) {
37
+ return context.request.url;
38
+ },
39
+ serveMethod: (...params) => serve(...params).POST,
40
+ options
41
+ }).handler
42
+ };
43
+ };
44
+ export {
45
+ createWorkflow,
46
+ serve,
47
+ serveMany
48
+ };