chore(workflows-sdk): fix examples in TSDocs (#11689)
This commit is contained in:
@@ -334,21 +334,21 @@ function wrapConditionalStep(
|
||||
* createStep,
|
||||
* StepResponse
|
||||
* } from "@medusajs/framework/workflows-sdk"
|
||||
*
|
||||
*
|
||||
* interface CreateProductInput {
|
||||
* title: string
|
||||
* }
|
||||
*
|
||||
*
|
||||
* export const createProductStep = createStep(
|
||||
* "createProductStep",
|
||||
* async function (
|
||||
* input: CreateProductInput,
|
||||
* context
|
||||
* { container }
|
||||
* ) {
|
||||
* const productService = context.container.resolve(
|
||||
* "productService"
|
||||
* const productModuleService = container.resolve(
|
||||
* "product"
|
||||
* )
|
||||
* const product = await productService.createProducts(input)
|
||||
* const product = await productModuleService.createProducts(input)
|
||||
* return new StepResponse({
|
||||
* product
|
||||
* }, {
|
||||
@@ -357,12 +357,15 @@ function wrapConditionalStep(
|
||||
* },
|
||||
* async function (
|
||||
* input,
|
||||
* context
|
||||
* { container }
|
||||
* ) {
|
||||
* const productService = context.container.resolve(
|
||||
* "productService"
|
||||
* if (!input) {
|
||||
* return
|
||||
* }
|
||||
* const productModuleService = container.resolve(
|
||||
* "product"
|
||||
* )
|
||||
* await productService.deleteProducts(input.product_id)
|
||||
* await productModuleService.deleteProducts([input.product_id])
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
|
||||
@@ -46,25 +46,23 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
|
||||
* import {
|
||||
* createProductStep,
|
||||
* getProductStep,
|
||||
* createPricesStep
|
||||
* } from "./steps"
|
||||
*
|
||||
*
|
||||
* interface WorkflowInput {
|
||||
* title: string
|
||||
* }
|
||||
*
|
||||
*
|
||||
* 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 new WorkflowResponse(getProductStep(product.id))
|
||||
* }
|
||||
* )
|
||||
*
|
||||
*
|
||||
* export async function GET(
|
||||
* req: MedusaRequest,
|
||||
* res: MedusaResponse
|
||||
@@ -75,7 +73,7 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
|
||||
* title: "Shirt"
|
||||
* }
|
||||
* })
|
||||
*
|
||||
*
|
||||
* res.json({
|
||||
* product
|
||||
* })
|
||||
|
||||
@@ -16,27 +16,28 @@ import { OrchestrationUtils } from "@medusajs/utils"
|
||||
* } from "@medusajs/framework/workflows-sdk"
|
||||
* import {
|
||||
* createProductStep,
|
||||
* getProductStep,
|
||||
* createPricesStep,
|
||||
* attachProductToSalesChannelStep
|
||||
* } from "./steps"
|
||||
*
|
||||
*
|
||||
* interface WorkflowInput {
|
||||
* title: string
|
||||
* }
|
||||
*
|
||||
*
|
||||
* const myWorkflow = createWorkflow(
|
||||
* "my-workflow",
|
||||
* (input: WorkflowInput) => {
|
||||
* const product = createProductStep(input)
|
||||
*
|
||||
*
|
||||
* const [prices, productSalesChannel] = parallelize(
|
||||
* createPricesStep(product),
|
||||
* attachProductToSalesChannelStep(product)
|
||||
* )
|
||||
*
|
||||
* const id = product.id
|
||||
* return new WorkflowResponse(getProductStep(product.id))
|
||||
*
|
||||
* return new WorkflowResponse({
|
||||
* prices,
|
||||
* productSalesChannel
|
||||
* })
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@ type ThenFunc = <ThenResolver extends () => any>(
|
||||
* } from "@medusajs/framework/workflows-sdk"
|
||||
* // step imports...
|
||||
*
|
||||
* const workflow = createWorkflow(
|
||||
* export const workflow = createWorkflow(
|
||||
* "workflow",
|
||||
* function (input: {
|
||||
* is_active: boolean
|
||||
|
||||
Reference in New Issue
Block a user