createStep - Workflows API Reference

This documentation provides a reference to the createStep . It belongs to the @medusajs/framework/workflows-sdk package.

This function creates a StepFunction that can be used as a step in a workflow constructed by the createWorkflow function.

Example#

Code
1import {2  createStep,3  StepResponse4} from "@medusajs/framework/workflows-sdk"5
6interface CreateProductInput {7  title: string8}9
10export const createProductStep = createStep(11  "createProductStep",12  async function (13    input: CreateProductInput,14    context15  ) {16    const productService = context.container.resolve(17      "productService"18    )19    const product = await productService.createProducts(input)20    return new StepResponse({21      product22    }, {23      product_id: product.id24    })25  },26  async function (27    input,28    context29  ) {30    const productService = context.container.resolve(31      "productService"32    )33    await productService.deleteProducts(input.product_id)34  }35)

Type Parameters#

Loading...

Parameters#

Loading...

Returns#

Loading...
Was this page helpful?