@upstash/workflow 0.2.22-rc → 0.3.0-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/h3.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-CAQSUCHB.mjs";
5
+ } from "./chunk-AGYYZKP7.mjs";
6
6
 
7
7
  // node_modules/defu/dist/defu.mjs
8
8
  function isPlainObject(value) {
@@ -80,21 +80,16 @@ function hasProp(obj, prop) {
80
80
  return false;
81
81
  }
82
82
  }
83
- var __defProp$2 = Object.defineProperty;
84
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
85
- var __publicField$2 = (obj, key, value) => {
86
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
87
- return value;
88
- };
89
83
  var H3Error = class extends Error {
84
+ static __h3_error__ = true;
85
+ statusCode = 500;
86
+ fatal = false;
87
+ unhandled = false;
88
+ statusMessage;
89
+ data;
90
+ cause;
90
91
  constructor(message, opts = {}) {
91
92
  super(message, opts);
92
- __publicField$2(this, "statusCode", 500);
93
- __publicField$2(this, "fatal", false);
94
- __publicField$2(this, "unhandled", false);
95
- __publicField$2(this, "statusMessage");
96
- __publicField$2(this, "data");
97
- __publicField$2(this, "cause");
98
93
  if (opts.cause && !this.cause) {
99
94
  this.cause = opts.cause;
100
95
  }
@@ -113,7 +108,6 @@ var H3Error = class extends Error {
113
108
  return obj;
114
109
  }
115
110
  };
116
- __publicField$2(H3Error, "__h3_error__", true);
117
111
  function createError(input) {
118
112
  if (typeof input === "string") {
119
113
  return new H3Error(input);
@@ -236,6 +230,9 @@ function readRawBody(event, encoding = "utf8") {
236
230
  if (_resolved instanceof URLSearchParams) {
237
231
  return Buffer.from(_resolved.toString());
238
232
  }
233
+ if (_resolved instanceof FormData) {
234
+ return new Response(_resolved).bytes().then((uint8arr) => Buffer.from(uint8arr));
235
+ }
239
236
  return Buffer.from(_resolved);
240
237
  });
241
238
  return encoding ? promise2.then((buff) => buff.toString(encoding)) : promise2;
package/hono.d.mts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { Context } from 'hono';
2
- import { R as RouteFunction, n as PublicServeOptions, y as InvokableWorkflow } from './types-Q3dM0UlR.mjs';
2
+ import { R as RouteFunction, n as PublicServeOptions, y as InvokableWorkflow } from './types-DESkn7K9.mjs';
3
3
  import { Variables } from 'hono/types';
4
- import { s as serveManyBase } from './serve-many-BNusWYgt.mjs';
4
+ import { s as serveManyBase } from './serve-many-DEwKPF6H.mjs';
5
5
  import '@upstash/qstash';
6
6
  import 'zod';
7
- import 'ai';
8
- import '@ai-sdk/openai';
9
7
 
10
8
  type WorkflowBindings = {
11
9
  QSTASH_TOKEN: string;
@@ -23,11 +21,11 @@ type WorkflowBindings = {
23
21
  * @param options workflow options
24
22
  * @returns
25
23
  */
26
- declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = object, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => ((context: Context<{
24
+ declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = Variables, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => ((context: Context<{
27
25
  Bindings: TBindings;
28
26
  Variables: TVariables;
29
27
  }>) => Promise<Response>);
30
- declare const createWorkflow: <TInitialPayload = unknown, TResult = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = object>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>;
28
+ declare const createWorkflow: <TInitialPayload = unknown, TResult = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = Variables>(...params: Parameters<typeof serve<TInitialPayload, TBindings, TVariables, TResult>>) => InvokableWorkflow<TInitialPayload, TResult>;
31
29
  declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => (context: Context<{
32
30
  Bindings: WorkflowBindings;
33
31
  Variables: object;
package/hono.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { Context } from 'hono';
2
- import { R as RouteFunction, n as PublicServeOptions, y as InvokableWorkflow } from './types-Q3dM0UlR.js';
2
+ import { R as RouteFunction, n as PublicServeOptions, y as InvokableWorkflow } from './types-DESkn7K9.js';
3
3
  import { Variables } from 'hono/types';
4
- import { s as serveManyBase } from './serve-many-CXqQP3RI.js';
4
+ import { s as serveManyBase } from './serve-many-DVtHRxeg.js';
5
5
  import '@upstash/qstash';
6
6
  import 'zod';
7
- import 'ai';
8
- import '@ai-sdk/openai';
9
7
 
10
8
  type WorkflowBindings = {
11
9
  QSTASH_TOKEN: string;
@@ -23,11 +21,11 @@ type WorkflowBindings = {
23
21
  * @param options workflow options
24
22
  * @returns
25
23
  */
26
- declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = object, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => ((context: Context<{
24
+ declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = Variables, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => ((context: Context<{
27
25
  Bindings: TBindings;
28
26
  Variables: TVariables;
29
27
  }>) => Promise<Response>);
30
- declare const createWorkflow: <TInitialPayload = unknown, TResult = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = object>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>;
28
+ declare const createWorkflow: <TInitialPayload = unknown, TResult = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = Variables>(...params: Parameters<typeof serve<TInitialPayload, TBindings, TVariables, TResult>>) => InvokableWorkflow<TInitialPayload, TResult>;
31
29
  declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => (context: Context<{
32
30
  Bindings: WorkflowBindings;
33
31
  Variables: object;