-
Notifications
You must be signed in to change notification settings - Fork 48
Update docs to use ow.runWorkflow #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,7 @@ You can cancel workflow runs that are pending, running, or sleeping. | |||||
| Use the `cancel()` method on a workflow run handle: | ||||||
|
|
||||||
| ```ts | ||||||
| import { ow } from "./openworkflow/client"; | ||||||
|
||||||
| import { ow } from "./openworkflow/client"; | |
| import { ow } from "./openworkflow/client.js"; |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,9 +15,10 @@ is even enqueued — preventing invalid data from entering your system. | |||||||||
| When you define a workflow, you can provide a `schema`. OpenWorkflow uses this | ||||||||||
| schema to: | ||||||||||
|
|
||||||||||
| 1. **Validate inputs at runtime**: When `workflow.run()` is called, the input is | ||||||||||
| validated immediately. If validation fails, an error is thrown before the | ||||||||||
| workflow is enqueued, preventing invalid data from entering your system. | ||||||||||
| 1. **Validate inputs at runtime**: When you start a run (for example, with | ||||||||||
| `ow.runWorkflow(workflow.spec, input)`), the input is validated immediately. | ||||||||||
| If validation fails, an error is thrown before the workflow is enqueued, | ||||||||||
| preventing invalid data from entering your system. | ||||||||||
| 2. **Type Safety**: The `input` parameter in your workflow function is | ||||||||||
| automatically typed based on your schema. | ||||||||||
|
|
||||||||||
|
|
@@ -141,10 +142,11 @@ When validation fails, OpenWorkflow throws a detailed error that includes | |||||||||
| information about what went wrong: | ||||||||||
|
|
||||||||||
| ```ts | ||||||||||
| import { ow } from "./openworkflow/client"; | ||||||||||
| import { sendEmail } from "./workflows/send-email"; | ||||||||||
|
Comment on lines
+145
to
146
|
||||||||||
| import { ow } from "./openworkflow/client"; | |
| import { sendEmail } from "./workflows/send-email"; | |
| import { ow } from "./openworkflow/client.js"; | |
| import { sendEmail } from "./workflows/send-email.js"; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -43,25 +43,34 @@ A workflow consists of: | |||||
|
|
||||||
| ## Running a Workflow | ||||||
|
|
||||||
| Start a workflow by calling `.run()`: | ||||||
| Start a workflow by calling `ow.runWorkflow()` with the workflow's `spec`: | ||||||
|
|
||||||
| ```ts | ||||||
| import { ow } from "./openworkflow/client"; | ||||||
|
||||||
| import { ow } from "./openworkflow/client"; | |
| import { ow } from "./openworkflow/client.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This page now uses
ow.runWorkflow(...)in code blocks, butowis not defined or imported anywhere in the document. Add a brief setup snippet (e.g., importing/constructingow) or clarify thatowrefers to yourOpenWorkflowclient instance before these examples.