Skip to content

Commit

Permalink
tweak Workflow class
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthachatterjee committed Aug 7, 2024
1 parent fc1bb4d commit 868afab
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions types/defines/rpc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ declare module "cloudflare:workers" {
export type SleepDuration = `${number} ${DurationLabel}${'s' | ''}` | number;


type WorkflowFunctions = {
run: <T extends Serializable>(name: string, callback: () => T) => T | Promise<T>;
type WorkflowStep = {
do: <T extends Serializable>(name: string, callback: () => T) => T | Promise<T>;
sleep:(name: string, duration: SleepDuration) => void | Promise<void>;
}

Expand All @@ -214,12 +214,11 @@ declare module "cloudflare:workers" {
protected env: Env;

run(
batch: {
events: Array<{
params: T
}>
},
fns: WorkflowFunctions
events: Array<{
payload: T,
timestamp: Date
}>,
step: WorkflowStep
): unknown | Promise<unknown>;
}
}

0 comments on commit 868afab

Please sign in to comment.