@upstash/workflow 0.2.8-rc-invoke → 0.2.9

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,11 +1,8 @@
1
- import {
2
- createInvokeCallback,
3
- serveManyBase
4
- } from "./chunk-LCZMBGEM.mjs";
5
1
  import {
6
2
  SDK_TELEMETRY,
7
- serveBase
8
- } from "./chunk-IWAW7GIG.mjs";
3
+ serveBase,
4
+ serveManyBase
5
+ } from "./chunk-IPXJZU3K.mjs";
9
6
 
10
7
  // platforms/astro.ts
11
8
  var telemetry = {
@@ -25,21 +22,26 @@ function serve(routeFunction, options) {
25
22
  return { POST };
26
23
  }
27
24
  var createWorkflow = (...params) => {
28
- const { POST: handler } = serve(...params);
25
+ const [routeFunction, options = {}] = params;
29
26
  return {
30
- callback: createInvokeCallback(telemetry),
31
- handler,
32
- workflowId: void 0
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
33
34
  };
34
35
  };
35
- var serveMany = (workflows) => {
36
+ var serveMany = (workflows, options) => {
36
37
  return {
37
38
  POST: serveManyBase({
38
39
  workflows,
39
- getWorkflowId(...params) {
40
- const components = params[0].request.url.split("/");
41
- return components[components.length - 1];
42
- }
40
+ getUrl(...params) {
41
+ return params[0].request.url;
42
+ },
43
+ serveMethod: (...params) => serve(...params).POST,
44
+ options
43
45
  }).handler
44
46
  };
45
47
  };