@upstash/workflow 0.1.0
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/LICENSE +21 -0
- package/README.md +3 -0
- package/chunk-JDMP6KKR.mjs +2006 -0
- package/cloudflare.d.mts +33 -0
- package/cloudflare.d.ts +33 -0
- package/cloudflare.js +2017 -0
- package/cloudflare.mjs +37 -0
- package/h3.d.mts +10 -0
- package/h3.d.ts +10 -0
- package/h3.js +2328 -0
- package/h3.mjs +348 -0
- package/hono.d.mts +25 -0
- package/hono.d.ts +25 -0
- package/hono.js +2002 -0
- package/hono.mjs +22 -0
- package/index.d.mts +57 -0
- package/index.d.ts +57 -0
- package/index.js +2038 -0
- package/index.mjs +18 -0
- package/nextjs.d.mts +18 -0
- package/nextjs.d.ts +18 -0
- package/nextjs.js +2022 -0
- package/nextjs.mjs +41 -0
- package/package.json +99 -0
- package/solidjs.d.mts +16 -0
- package/solidjs.d.ts +16 -0
- package/solidjs.js +2001 -0
- package/solidjs.mjs +21 -0
- package/svelte.d.mts +18 -0
- package/svelte.d.ts +18 -0
- package/svelte.js +1995 -0
- package/svelte.mjs +15 -0
- package/types-CfN1Epuj.d.mts +616 -0
- package/types-CfN1Epuj.d.ts +616 -0
package/hono.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serve
|
|
3
|
+
} from "./chunk-JDMP6KKR.mjs";
|
|
4
|
+
|
|
5
|
+
// platforms/hono.ts
|
|
6
|
+
var serve2 = (routeFunction, options) => {
|
|
7
|
+
const handler = async (context) => {
|
|
8
|
+
const environment = context.env;
|
|
9
|
+
const request = context.req.raw;
|
|
10
|
+
const serveHandler = serve(routeFunction, {
|
|
11
|
+
// when hono is used without cf workers, it sends a DebugHTTPServer
|
|
12
|
+
// object in `context.env`. don't pass env if this is the case:
|
|
13
|
+
env: "QSTASH_TOKEN" in environment ? environment : void 0,
|
|
14
|
+
...options
|
|
15
|
+
});
|
|
16
|
+
return await serveHandler(request);
|
|
17
|
+
};
|
|
18
|
+
return handler;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
serve2 as serve
|
|
22
|
+
};
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { R as RouteFunction, W as WorkflowServeOptions, N as NotifyResponse, S as Step } from './types-CfN1Epuj.mjs';
|
|
2
|
+
export { A as AsyncStepFunction, i as FailureFunctionPayload, F as FinishCondition, L as LogLevel, P as ParallelCallState, f as RawStep, j as RequiredExceptFields, h as StepFunction, e as StepType, d as StepTypes, g as SyncStepFunction, m as WaitRequest, k as WaitResult, n as WaitStepResponse, l as Waiter, b as WorkflowClient, a as WorkflowContext, p as WorkflowLogger, o as WorkflowLoggerOptions, c as WorkflowReceiver } from './types-CfN1Epuj.mjs';
|
|
3
|
+
import { Client as Client$1, QstashError } from '@upstash/qstash';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates an async method that handles incoming requests and runs the provided
|
|
7
|
+
* route function as a workflow.
|
|
8
|
+
*
|
|
9
|
+
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
10
|
+
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
11
|
+
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
12
|
+
*/
|
|
13
|
+
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(routeFunction: RouteFunction<TInitialPayload>, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => ((request: TRequest) => Promise<TResponse>);
|
|
14
|
+
|
|
15
|
+
type ClientConfig = ConstructorParameters<typeof Client$1>[0];
|
|
16
|
+
declare class Client {
|
|
17
|
+
private client;
|
|
18
|
+
constructor(clientConfig: ClientConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Cancel an ongoing workflow
|
|
21
|
+
*
|
|
22
|
+
* @param workflowRunId run id of the workflow to delete
|
|
23
|
+
* @returns true if workflow is succesfully deleted. Otherwise throws QStashError
|
|
24
|
+
*/
|
|
25
|
+
cancel({ workflowRunId }: {
|
|
26
|
+
workflowRunId: string;
|
|
27
|
+
}): Promise<true | {
|
|
28
|
+
error: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Notify a workflow run waiting for an event
|
|
32
|
+
*
|
|
33
|
+
* @param eventId event id to notify
|
|
34
|
+
* @param notifyData data to provide to the workflow
|
|
35
|
+
*/
|
|
36
|
+
notify({ eventId, notifyBody, }: {
|
|
37
|
+
eventId: string;
|
|
38
|
+
notifyBody?: string;
|
|
39
|
+
}): Promise<NotifyResponse[]>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Error raised during Workflow execution
|
|
44
|
+
*/
|
|
45
|
+
declare class QStashWorkflowError extends QstashError {
|
|
46
|
+
constructor(message: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Raised when the workflow executes a function and aborts
|
|
50
|
+
*/
|
|
51
|
+
declare class QStashWorkflowAbort extends Error {
|
|
52
|
+
stepInfo?: Step;
|
|
53
|
+
stepName: string;
|
|
54
|
+
constructor(stepName: string, stepInfo?: Step);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Client, NotifyResponse, QStashWorkflowAbort, QStashWorkflowError, RouteFunction, Step, WorkflowServeOptions, serve };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { R as RouteFunction, W as WorkflowServeOptions, N as NotifyResponse, S as Step } from './types-CfN1Epuj.js';
|
|
2
|
+
export { A as AsyncStepFunction, i as FailureFunctionPayload, F as FinishCondition, L as LogLevel, P as ParallelCallState, f as RawStep, j as RequiredExceptFields, h as StepFunction, e as StepType, d as StepTypes, g as SyncStepFunction, m as WaitRequest, k as WaitResult, n as WaitStepResponse, l as Waiter, b as WorkflowClient, a as WorkflowContext, p as WorkflowLogger, o as WorkflowLoggerOptions, c as WorkflowReceiver } from './types-CfN1Epuj.js';
|
|
3
|
+
import { Client as Client$1, QstashError } from '@upstash/qstash';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates an async method that handles incoming requests and runs the provided
|
|
7
|
+
* route function as a workflow.
|
|
8
|
+
*
|
|
9
|
+
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
10
|
+
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
11
|
+
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
12
|
+
*/
|
|
13
|
+
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(routeFunction: RouteFunction<TInitialPayload>, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => ((request: TRequest) => Promise<TResponse>);
|
|
14
|
+
|
|
15
|
+
type ClientConfig = ConstructorParameters<typeof Client$1>[0];
|
|
16
|
+
declare class Client {
|
|
17
|
+
private client;
|
|
18
|
+
constructor(clientConfig: ClientConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Cancel an ongoing workflow
|
|
21
|
+
*
|
|
22
|
+
* @param workflowRunId run id of the workflow to delete
|
|
23
|
+
* @returns true if workflow is succesfully deleted. Otherwise throws QStashError
|
|
24
|
+
*/
|
|
25
|
+
cancel({ workflowRunId }: {
|
|
26
|
+
workflowRunId: string;
|
|
27
|
+
}): Promise<true | {
|
|
28
|
+
error: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Notify a workflow run waiting for an event
|
|
32
|
+
*
|
|
33
|
+
* @param eventId event id to notify
|
|
34
|
+
* @param notifyData data to provide to the workflow
|
|
35
|
+
*/
|
|
36
|
+
notify({ eventId, notifyBody, }: {
|
|
37
|
+
eventId: string;
|
|
38
|
+
notifyBody?: string;
|
|
39
|
+
}): Promise<NotifyResponse[]>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Error raised during Workflow execution
|
|
44
|
+
*/
|
|
45
|
+
declare class QStashWorkflowError extends QstashError {
|
|
46
|
+
constructor(message: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Raised when the workflow executes a function and aborts
|
|
50
|
+
*/
|
|
51
|
+
declare class QStashWorkflowAbort extends Error {
|
|
52
|
+
stepInfo?: Step;
|
|
53
|
+
stepName: string;
|
|
54
|
+
constructor(stepName: string, stepInfo?: Step);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Client, NotifyResponse, QStashWorkflowAbort, QStashWorkflowError, RouteFunction, Step, WorkflowServeOptions, serve };
|