@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/nextjs.mjs
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_TELEMETRY,
|
|
3
|
-
serveBase
|
|
4
|
-
|
|
3
|
+
serveBase,
|
|
4
|
+
serveManyBase
|
|
5
|
+
} from "./chunk-IPXJZU3K.mjs";
|
|
5
6
|
|
|
6
7
|
// platforms/nextjs.ts
|
|
8
|
+
var appTelemetry = {
|
|
9
|
+
sdk: SDK_TELEMETRY,
|
|
10
|
+
framework: "nextjs",
|
|
11
|
+
runtime: `node@${process.version}`
|
|
12
|
+
};
|
|
13
|
+
var pagesTelemetry = {
|
|
14
|
+
sdk: SDK_TELEMETRY,
|
|
15
|
+
framework: "nextjs-pages",
|
|
16
|
+
runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
|
|
17
|
+
};
|
|
7
18
|
var serve = (routeFunction, options) => {
|
|
8
19
|
const { handler: serveHandler } = serveBase(
|
|
9
20
|
routeFunction,
|
|
10
|
-
|
|
11
|
-
sdk: SDK_TELEMETRY,
|
|
12
|
-
framework: "nextjs",
|
|
13
|
-
runtime: `node@${process.version}`
|
|
14
|
-
},
|
|
21
|
+
appTelemetry,
|
|
15
22
|
options
|
|
16
23
|
);
|
|
17
24
|
return {
|
|
@@ -20,16 +27,28 @@ var serve = (routeFunction, options) => {
|
|
|
20
27
|
}
|
|
21
28
|
};
|
|
22
29
|
};
|
|
23
|
-
var
|
|
24
|
-
const
|
|
30
|
+
var createWorkflow = (...params) => {
|
|
31
|
+
const [routeFunction, options = {}] = params;
|
|
32
|
+
return {
|
|
25
33
|
routeFunction,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
options,
|
|
35
|
+
workflowId: void 0
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
var serveMany = (workflows, options) => {
|
|
39
|
+
return {
|
|
40
|
+
POST: serveManyBase({
|
|
41
|
+
workflows,
|
|
42
|
+
getUrl(params) {
|
|
43
|
+
return params.url;
|
|
44
|
+
},
|
|
45
|
+
serveMethod: (...params) => serve(...params).POST,
|
|
46
|
+
options
|
|
47
|
+
}).handler
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var servePagesRouter = (routeFunction, options) => {
|
|
51
|
+
const { handler: serveHandler } = serveBase(routeFunction, pagesTelemetry, options);
|
|
33
52
|
const handler = async (request_, res) => {
|
|
34
53
|
if (request_.method?.toUpperCase() !== "POST") {
|
|
35
54
|
res.status(405).json("Only POST requests are allowed in worklfows");
|
|
@@ -48,9 +67,36 @@ var servePagesRouter = (routeFunction, options) => {
|
|
|
48
67
|
const response = await serveHandler(request);
|
|
49
68
|
res.status(response.status).json(await response.json());
|
|
50
69
|
};
|
|
51
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
handler
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var createWorkflowPagesRouter = (...params) => {
|
|
75
|
+
const [routeFunction, options = {}] = params;
|
|
76
|
+
return {
|
|
77
|
+
routeFunction,
|
|
78
|
+
options,
|
|
79
|
+
workflowId: void 0
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
var serveManyPagesRouter = (workflows, options) => {
|
|
83
|
+
return serveManyBase({
|
|
84
|
+
workflows,
|
|
85
|
+
getUrl(request_) {
|
|
86
|
+
const protocol = request_.headers["x-forwarded-proto"];
|
|
87
|
+
const host = request_.headers.host;
|
|
88
|
+
const baseUrl = `${protocol}://${host}`;
|
|
89
|
+
return `${baseUrl}${request_.url}`;
|
|
90
|
+
},
|
|
91
|
+
serveMethod: (...params) => servePagesRouter(...params).handler,
|
|
92
|
+
options
|
|
93
|
+
});
|
|
52
94
|
};
|
|
53
95
|
export {
|
|
96
|
+
createWorkflow,
|
|
97
|
+
createWorkflowPagesRouter,
|
|
54
98
|
serve,
|
|
99
|
+
serveMany,
|
|
100
|
+
serveManyPagesRouter,
|
|
55
101
|
servePagesRouter
|
|
56
102
|
};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@upstash/workflow","version":"v0.2.
|
|
1
|
+
{"name":"@upstash/workflow","version":"v0.2.10-hono-generics","description":"Durable, Reliable and Performant Serverless Functions","main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./*"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./dist/nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./h3":{"import":"./h3.mjs","require":"./h3.js"},"./svelte":{"import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"import":"./workflow.mjs","require":"./workflow.js"},"./hono":{"import":"./hono.mjs","require":"./hono.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./astro":{"import":"./astro.mjs","require":"./astro.js"},"./express":{"import":"./express.mjs","require":"./express.js"}},"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test src","fmt":"prettier --write .","lint":"tsc && eslint \"{src,platforms}/**/*.{js,ts,tsx}\" --quiet --fix","check-exports":"bun run build && cd dist && attw -P"},"repository":{"type":"git","url":"git+https://github.com/upstash/workflow-ts.git"},"keywords":["upstash","qstash","workflow","serverless"],"author":"Cahid Arda Oz","license":"MIT","bugs":{"url":"https://github.com/upstash/workflow-ts/issues"},"homepage":"https://github.com/upstash/workflow-ts#readme","devDependencies":{"@commitlint/cli":"^19.5.0","@commitlint/config-conventional":"^19.5.0","@eslint/js":"^9.11.1","@solidjs/start":"^1.0.8","@sveltejs/kit":"^2.6.1","@types/bun":"^1.1.10","@types/express":"^5.0.0","astro":"^4.16.7","eslint":"^9.11.1","eslint-plugin-unicorn":"^55.0.0","express":"^4.21.1","globals":"^15.10.0","h3":"^1.12.0","hono":"^4.6.20","husky":"^9.1.6","next":"^14.2.14","prettier":"3.3.3","tsup":"^8.3.0","typescript":"^5.7.2","typescript-eslint":"^8.18.0"},"dependencies":{"@ai-sdk/openai":"^1.0.15","@upstash/qstash":"^2.7.22","ai":"^4.0.30","zod":"^3.24.1"},"directories":{"example":"examples"}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { k as PublicServeOptions, R as RouteFunction, t as InvokableWorkflow } from './types-CYhDXnf8.mjs';
|
|
2
|
+
|
|
3
|
+
type OmitOptionsInServeMany<TOptions> = Omit<TOptions, "env" | "url" | "schema" | "initialPayloadParser">;
|
|
4
|
+
declare const serveManyBase: <THandler extends (...params: any[]) => any, TOptions extends OmitOptionsInServeMany<PublicServeOptions> = OmitOptionsInServeMany<PublicServeOptions>, TServeParams extends [routeFunction: RouteFunction<any, any>, options: TOptions] = [routeFunction: RouteFunction<any, any>, options: TOptions]>({ workflows, getUrl, serveMethod, options, }: {
|
|
5
|
+
workflows: Record<string, InvokableWorkflow<any, any>>;
|
|
6
|
+
getUrl: (...params: Parameters<THandler>) => string;
|
|
7
|
+
serveMethod: (...params: TServeParams) => THandler;
|
|
8
|
+
options?: TOptions;
|
|
9
|
+
}) => {
|
|
10
|
+
handler: (...params: Parameters<THandler>) => Promise<any>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { serveManyBase as s };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { k as PublicServeOptions, R as RouteFunction, t as InvokableWorkflow } from './types-CYhDXnf8.js';
|
|
2
|
+
|
|
3
|
+
type OmitOptionsInServeMany<TOptions> = Omit<TOptions, "env" | "url" | "schema" | "initialPayloadParser">;
|
|
4
|
+
declare const serveManyBase: <THandler extends (...params: any[]) => any, TOptions extends OmitOptionsInServeMany<PublicServeOptions> = OmitOptionsInServeMany<PublicServeOptions>, TServeParams extends [routeFunction: RouteFunction<any, any>, options: TOptions] = [routeFunction: RouteFunction<any, any>, options: TOptions]>({ workflows, getUrl, serveMethod, options, }: {
|
|
5
|
+
workflows: Record<string, InvokableWorkflow<any, any>>;
|
|
6
|
+
getUrl: (...params: Parameters<THandler>) => string;
|
|
7
|
+
serveMethod: (...params: TServeParams) => THandler;
|
|
8
|
+
options?: TOptions;
|
|
9
|
+
}) => {
|
|
10
|
+
handler: (...params: Parameters<THandler>) => Promise<any>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { serveManyBase as s };
|
package/solidjs.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions } from './types-
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions } from './types-CYhDXnf8.mjs';
|
|
3
3
|
import '@upstash/qstash';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'ai';
|
|
6
6
|
import '@ai-sdk/openai';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Serve method to serve a Upstash Workflow in a
|
|
9
|
+
* Serve method to serve a Upstash Workflow in a SolidJS project
|
|
10
10
|
*
|
|
11
11
|
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ import '@ai-sdk/openai';
|
|
|
14
14
|
* @param options workflow options
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
|
-
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
17
|
+
declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
18
18
|
POST: (event: APIEvent) => Promise<Response>;
|
|
19
19
|
};
|
|
20
20
|
|
package/solidjs.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions } from './types-
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions } from './types-CYhDXnf8.js';
|
|
3
3
|
import '@upstash/qstash';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'ai';
|
|
6
6
|
import '@ai-sdk/openai';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Serve method to serve a Upstash Workflow in a
|
|
9
|
+
* Serve method to serve a Upstash Workflow in a SolidJS project
|
|
10
10
|
*
|
|
11
11
|
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ import '@ai-sdk/openai';
|
|
|
14
14
|
* @param options workflow options
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
|
-
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
17
|
+
declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
18
18
|
POST: (event: APIEvent) => Promise<Response>;
|
|
19
19
|
};
|
|
20
20
|
|