@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.d.mts +8 -3
- package/astro.d.ts +8 -3
- package/astro.js +393 -82
- package/astro.mjs +36 -8
- package/{chunk-BPUSHNSD.mjs → chunk-IPXJZU3K.mjs} +1226 -943
- package/cloudflare.d.mts +9 -4
- package/cloudflare.d.ts +9 -4
- package/cloudflare.js +392 -88
- package/cloudflare.mjs +35 -14
- package/express.d.mts +7 -3
- package/express.d.ts +7 -3
- package/express.js +400 -92
- package/express.mjs +43 -18
- package/h3.d.mts +9 -7
- package/h3.d.ts +9 -7
- package/h3.js +397 -95
- package/h3.mjs +40 -21
- package/hono.d.mts +10 -4
- package/hono.d.ts +10 -4
- package/hono.js +391 -90
- package/hono.mjs +34 -16
- package/index.d.mts +47 -33
- package/index.d.ts +47 -33
- package/index.js +315 -92
- package/index.mjs +32 -30
- package/nextjs.d.mts +14 -5
- package/nextjs.d.ts +14 -5
- package/nextjs.js +408 -77
- package/nextjs.mjs +63 -17
- package/package.json +1 -1
- package/serve-many-BVDpPsF-.d.mts +13 -0
- package/serve-many-e4zufyXN.d.ts +13 -0
- package/solidjs.d.mts +3 -3
- package/solidjs.d.ts +3 -3
- package/solidjs.js +289 -71
- package/solidjs.mjs +7 -10
- package/svelte.d.mts +13 -6
- package/svelte.d.ts +13 -6
- package/svelte.js +391 -88
- package/svelte.mjs +34 -14
- package/{types-B62AnIU3.d.mts → types-CYhDXnf8.d.mts} +74 -8
- package/{types-B62AnIU3.d.ts → types-CYhDXnf8.d.ts} +74 -8
package/h3.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_TELEMETRY,
|
|
3
|
-
serveBase
|
|
4
|
-
|
|
3
|
+
serveBase,
|
|
4
|
+
serveManyBase
|
|
5
|
+
} from "./chunk-IPXJZU3K.mjs";
|
|
5
6
|
|
|
6
7
|
// node_modules/defu/dist/defu.mjs
|
|
7
8
|
function isPlainObject(value) {
|
|
@@ -323,38 +324,56 @@ function transformHeaders(headers) {
|
|
|
323
324
|
]);
|
|
324
325
|
return formattedHeaders;
|
|
325
326
|
}
|
|
327
|
+
function getUrl(event) {
|
|
328
|
+
const request_ = event.node.req;
|
|
329
|
+
const protocol = request_.headers["x-forwarded-proto"];
|
|
330
|
+
const host = request_.headers.host;
|
|
331
|
+
const url = `${protocol}://${host}${event.path}`;
|
|
332
|
+
return url;
|
|
333
|
+
}
|
|
334
|
+
var telemetry = {
|
|
335
|
+
sdk: SDK_TELEMETRY,
|
|
336
|
+
framework: "h3",
|
|
337
|
+
runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
|
|
338
|
+
};
|
|
326
339
|
var serve = (routeFunction, options) => {
|
|
327
340
|
const handler = defineEventHandler(async (event) => {
|
|
328
341
|
const method = event.node.req.method;
|
|
329
342
|
if (method?.toUpperCase() !== "POST") {
|
|
330
|
-
return {
|
|
331
|
-
status: 405
|
|
332
|
-
|
|
333
|
-
};
|
|
343
|
+
return new Response("Only POST requests are allowed in worklfows", {
|
|
344
|
+
status: 405
|
|
345
|
+
});
|
|
334
346
|
}
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
const host = request_.headers.host;
|
|
338
|
-
const url = `${protocol}://${host}${event.path}`;
|
|
339
|
-
const headers = transformHeaders(request_.headers);
|
|
347
|
+
const url = getUrl(event);
|
|
348
|
+
const headers = transformHeaders(event.node.req.headers);
|
|
340
349
|
const request = new Request(url, {
|
|
341
350
|
headers,
|
|
342
351
|
body: await readRawBody(event),
|
|
343
352
|
method: "POST"
|
|
344
353
|
});
|
|
345
|
-
const { handler: serveHandler } = serveBase(
|
|
346
|
-
routeFunction,
|
|
347
|
-
{
|
|
348
|
-
sdk: SDK_TELEMETRY,
|
|
349
|
-
framework: "h3",
|
|
350
|
-
runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
|
|
351
|
-
},
|
|
352
|
-
options
|
|
353
|
-
);
|
|
354
|
+
const { handler: serveHandler } = serveBase(routeFunction, telemetry, options);
|
|
354
355
|
return await serveHandler(request);
|
|
355
356
|
});
|
|
356
357
|
return { handler };
|
|
357
358
|
};
|
|
359
|
+
var createWorkflow = (...params) => {
|
|
360
|
+
const [routeFunction, options = {}] = params;
|
|
361
|
+
return {
|
|
362
|
+
routeFunction,
|
|
363
|
+
options,
|
|
364
|
+
workflowId: void 0
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
var serveMany = (workflows, options) => {
|
|
368
|
+
return serveManyBase({
|
|
369
|
+
workflows,
|
|
370
|
+
getUrl,
|
|
371
|
+
serveMethod: (...params) => serve(...params).handler,
|
|
372
|
+
options
|
|
373
|
+
});
|
|
374
|
+
};
|
|
358
375
|
export {
|
|
359
|
-
|
|
376
|
+
createWorkflow,
|
|
377
|
+
serve,
|
|
378
|
+
serveMany
|
|
360
379
|
};
|
package/hono.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from 'hono';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions } from './types-
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-CYhDXnf8.mjs';
|
|
3
3
|
import { Variables } from 'hono/types';
|
|
4
|
+
import { s as serveManyBase } from './serve-many-BVDpPsF-.mjs';
|
|
4
5
|
import '@upstash/qstash';
|
|
5
6
|
import 'zod';
|
|
6
7
|
import 'ai';
|
|
@@ -14,7 +15,7 @@ type WorkflowBindings = {
|
|
|
14
15
|
UPSTASH_WORKFLOW_URL?: string;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
|
-
* Serve method to serve a Upstash Workflow in a
|
|
18
|
+
* Serve method to serve a Upstash Workflow in a Hono project
|
|
18
19
|
*
|
|
19
20
|
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
20
21
|
*
|
|
@@ -22,9 +23,14 @@ type WorkflowBindings = {
|
|
|
22
23
|
* @param options workflow options
|
|
23
24
|
* @returns
|
|
24
25
|
*/
|
|
25
|
-
declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = object>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => ((context: Context<{
|
|
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<{
|
|
26
27
|
Bindings: TBindings;
|
|
27
28
|
Variables: TVariables;
|
|
28
29
|
}>) => 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>;
|
|
31
|
+
declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => (context: Context<{
|
|
32
|
+
Bindings: WorkflowBindings;
|
|
33
|
+
Variables: object;
|
|
34
|
+
}, any, {}>) => Promise<any>;
|
|
29
35
|
|
|
30
|
-
export { type WorkflowBindings, serve };
|
|
36
|
+
export { type WorkflowBindings, createWorkflow, serve, serveMany };
|
package/hono.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from 'hono';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions } from './types-
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-CYhDXnf8.js';
|
|
3
3
|
import { Variables } from 'hono/types';
|
|
4
|
+
import { s as serveManyBase } from './serve-many-e4zufyXN.js';
|
|
4
5
|
import '@upstash/qstash';
|
|
5
6
|
import 'zod';
|
|
6
7
|
import 'ai';
|
|
@@ -14,7 +15,7 @@ type WorkflowBindings = {
|
|
|
14
15
|
UPSTASH_WORKFLOW_URL?: string;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
|
-
* Serve method to serve a Upstash Workflow in a
|
|
18
|
+
* Serve method to serve a Upstash Workflow in a Hono project
|
|
18
19
|
*
|
|
19
20
|
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
20
21
|
*
|
|
@@ -22,9 +23,14 @@ type WorkflowBindings = {
|
|
|
22
23
|
* @param options workflow options
|
|
23
24
|
* @returns
|
|
24
25
|
*/
|
|
25
|
-
declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings, TVariables extends Variables = object>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => ((context: Context<{
|
|
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<{
|
|
26
27
|
Bindings: TBindings;
|
|
27
28
|
Variables: TVariables;
|
|
28
29
|
}>) => 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>;
|
|
31
|
+
declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => (context: Context<{
|
|
32
|
+
Bindings: WorkflowBindings;
|
|
33
|
+
Variables: object;
|
|
34
|
+
}, any, {}>) => Promise<any>;
|
|
29
35
|
|
|
30
|
-
export { type WorkflowBindings, serve };
|
|
36
|
+
export { type WorkflowBindings, createWorkflow, serve, serveMany };
|