chore(docs): Generated References (automated) (#9436)
Co-authored-by: kodiakhq <kodiakhq@users.noreply.github.com> Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
This commit is contained in:
637 files changed
+340776
-501155
No files matched your search
@@ -23,7 +23,7 @@ import {
|
||||
createHook,
|
||||
createWorkflow,
|
||||
WorkflowResponse,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { createProductStep } from "./steps/create-product"
|
||||
|
||||
export const myWorkflow = createWorkflow(
|
||||
|
||||
@@ -16,10 +16,8 @@ This function creates a [StepFunction](../../types/workflows.StepFunction/page.m
|
||||
```ts
|
||||
import {
|
||||
createStep,
|
||||
StepResponse,
|
||||
StepExecutionContext,
|
||||
WorkflowData
|
||||
} from "@medusajs/workflows-sdk"
|
||||
StepResponse
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
|
||||
interface CreateProductInput {
|
||||
title: string
|
||||
|
||||
@@ -17,8 +17,11 @@ invoke the exported workflow, then run its `run` method.
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import { createWorkflow } from "@medusajs/workflows-sdk"
|
||||
import { MedusaRequest, MedusaResponse, Product } from "@medusajs/medusa"
|
||||
import {
|
||||
createWorkflow,
|
||||
WorkflowResponse
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import {
|
||||
createProductStep,
|
||||
getProductStep,
|
||||
@@ -29,16 +32,15 @@ interface WorkflowInput {
|
||||
title: string
|
||||
}
|
||||
|
||||
const myWorkflow = createWorkflow<
|
||||
WorkflowInput,
|
||||
Product
|
||||
>("my-workflow", (input) => {
|
||||
const myWorkflow = createWorkflow(
|
||||
"my-workflow",
|
||||
(input: WorkflowInput) => {
|
||||
// Everything here will be executed and resolved later
|
||||
// during the execution. Including the data access.
|
||||
|
||||
const product = createProductStep(input)
|
||||
const prices = createPricesStep(product)
|
||||
return getProductStep(product.id)
|
||||
return new WorkflowResponse(getProductStep(product.id))
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@ This function is used to run multiple steps in parallel. The result of each step
|
||||
```ts
|
||||
import {
|
||||
createWorkflow,
|
||||
parallelize
|
||||
} from "@medusajs/workflows-sdk"
|
||||
parallelize,
|
||||
WorkflowResponse
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import {
|
||||
createProductStep,
|
||||
getProductStep,
|
||||
@@ -29,10 +30,9 @@ interface WorkflowInput {
|
||||
title: string
|
||||
}
|
||||
|
||||
const myWorkflow = createWorkflow<
|
||||
WorkflowInput,
|
||||
Product
|
||||
>("my-workflow", (input) => {
|
||||
const myWorkflow = createWorkflow(
|
||||
"my-workflow",
|
||||
(input: WorkflowInput) => {
|
||||
const product = createProductStep(input)
|
||||
|
||||
const [prices, productSalesChannel] = parallelize(
|
||||
@@ -41,7 +41,7 @@ const myWorkflow = createWorkflow<
|
||||
)
|
||||
|
||||
const id = product.id
|
||||
return getProductStep(product.id)
|
||||
return new WorkflowResponse(getProductStep(product.id))
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
@@ -23,32 +23,27 @@ If you're also retrieving the output of a hook and want to check if its value is
|
||||
```ts
|
||||
import {
|
||||
createWorkflow,
|
||||
transform
|
||||
} from "@medusajs/workflows-sdk"
|
||||
transform,
|
||||
WorkflowResponse
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { step1, step2 } from "./steps"
|
||||
|
||||
type WorkflowInput = {
|
||||
name: string
|
||||
}
|
||||
|
||||
type WorkflowOutput = {
|
||||
message: string
|
||||
}
|
||||
|
||||
const myWorkflow = createWorkflow<
|
||||
WorkflowInput,
|
||||
WorkflowOutput
|
||||
>
|
||||
("hello-world", (input) => {
|
||||
const myWorkflow = createWorkflow(
|
||||
"hello-world",
|
||||
(input: WorkflowInput) => {
|
||||
const str1 = step1(input)
|
||||
const str2 = step2(input)
|
||||
|
||||
return transform({
|
||||
const message = transform({
|
||||
str1,
|
||||
str2
|
||||
}, (input) => ({
|
||||
message: `${input.str1}${input.str2}`
|
||||
}))
|
||||
}, (input) => `${input.str1}${input.str2}`)
|
||||
|
||||
return new WorkflowResponse(message)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user