@upstash/workflow 0.2.8 → 0.2.10-hono-generics

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/astro.mjs CHANGED
@@ -1,24 +1,52 @@
1
1
  import {
2
2
  SDK_TELEMETRY,
3
- serveBase
4
- } from "./chunk-BPUSHNSD.mjs";
3
+ serveBase,
4
+ serveManyBase
5
+ } from "./chunk-IPXJZU3K.mjs";
5
6
 
6
7
  // platforms/astro.ts
8
+ var telemetry = {
9
+ sdk: SDK_TELEMETRY,
10
+ framework: "astro",
11
+ runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
12
+ };
7
13
  function serve(routeFunction, options) {
8
14
  const POST = (apiContext) => {
9
15
  const { handler } = serveBase(
10
16
  (workflowContext) => routeFunction(workflowContext, apiContext),
11
- {
12
- sdk: SDK_TELEMETRY,
13
- framework: "astro",
14
- runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
15
- },
17
+ telemetry,
16
18
  options
17
19
  );
18
20
  return handler(apiContext.request);
19
21
  };
20
22
  return { POST };
21
23
  }
24
+ var createWorkflow = (...params) => {
25
+ const [routeFunction, options = {}] = params;
26
+ return {
27
+ workflowId: void 0,
28
+ // @ts-expect-error because astro route function has another parameeter,
29
+ // the RouteFunction type can't cover this. We need to make RouteFunction
30
+ // accept more variables than simply the context. Until then, ignoring the
31
+ // error here. Tested the usage in astro project and it's fine. TODO.
32
+ routeFunction,
33
+ options
34
+ };
35
+ };
36
+ var serveMany = (workflows, options) => {
37
+ return {
38
+ POST: serveManyBase({
39
+ workflows,
40
+ getUrl(...params) {
41
+ return params[0].request.url;
42
+ },
43
+ serveMethod: (...params) => serve(...params).POST,
44
+ options
45
+ }).handler
46
+ };
47
+ };
22
48
  export {
23
- serve
49
+ createWorkflow,
50
+ serve,
51
+ serveMany
24
52
  };