-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behavior
Specifies you can define a workflow like this:
import { defineWorkflow } from "openworkflow";
export const sendWelcomeEmail = defineWorkflow(
{ name: "send-welcome-email" },
async ({ input, step }) => {
const user = await step.run({ name: "fetch-user" }, async () => {
return await db.users.findOne({ id: input.userId });
});
await step.run({ name: "send-email" }, async () => {
await emailService.send({
to: user.email,
subject: "Welcome!",
body: "Thanks for signing up.",
});
});
return { sent: true };
},
);and run it like this:
import { sendWelcomeEmail } from "./workflows/send-welcome-email";
const handle = await sendWelcomeEmail.run({ userId: "user_123" });Actual Behavior
however, when I do that, i get an error that run is not defined. I looked at the code, and that appears to be correct:
| export interface Workflow<Input, Output, RawInput> { |
I don't see a run function anywhere. I suspect this might be documentation for an old version?
Steps to Reproduce
- Install openworkflow with these versions
pnpm ls | grep openworkflow
@openworkflow/backend-postgres 0.6.0
openworkflow 0.6.7
@openworkflow/cli 0.4.0
- Write out the example.
- See the error:
Property 'run' does not exist on type 'Workflow<...>'.ts(2339)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working