chore(workflows-sdk): fix examples in TSDocs (#11689)

This commit is contained in:
Shahed Nasser
2025-03-03 12:20:21 +02:00
committed by GitHub
parent d1efad9bf0
commit 61a0e4f3cf
4 changed files with 27 additions and 25 deletions
@@ -343,12 +343,12 @@ function wrapConditionalStep(
* "createProductStep", * "createProductStep",
* async function ( * async function (
* input: CreateProductInput, * input: CreateProductInput,
* context * { container }
* ) { * ) {
* const productService = context.container.resolve( * const productModuleService = container.resolve(
* "productService" * "product"
* ) * )
* const product = await productService.createProducts(input) * const product = await productModuleService.createProducts(input)
* return new StepResponse({ * return new StepResponse({
* product * product
* }, { * }, {
@@ -357,12 +357,15 @@ function wrapConditionalStep(
* }, * },
* async function ( * async function (
* input, * input,
* context * { container }
* ) { * ) {
* const productService = context.container.resolve( * if (!input) {
* "productService" * return
* }
* const productModuleService = container.resolve(
* "product"
* ) * )
* await productService.deleteProducts(input.product_id) * await productModuleService.deleteProducts([input.product_id])
* } * }
* ) * )
*/ */
@@ -46,7 +46,6 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
* import { * import {
* createProductStep, * createProductStep,
* getProductStep, * getProductStep,
* createPricesStep
* } from "./steps" * } from "./steps"
* *
* interface WorkflowInput { * interface WorkflowInput {
@@ -60,7 +59,6 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
* // during the execution. Including the data access. * // during the execution. Including the data access.
* *
* const product = createProductStep(input) * const product = createProductStep(input)
* const prices = createPricesStep(product)
* return new WorkflowResponse(getProductStep(product.id)) * return new WorkflowResponse(getProductStep(product.id))
* } * }
* ) * )
@@ -16,7 +16,6 @@ import { OrchestrationUtils } from "@medusajs/utils"
* } from "@medusajs/framework/workflows-sdk" * } from "@medusajs/framework/workflows-sdk"
* import { * import {
* createProductStep, * createProductStep,
* getProductStep,
* createPricesStep, * createPricesStep,
* attachProductToSalesChannelStep * attachProductToSalesChannelStep
* } from "./steps" * } from "./steps"
@@ -35,8 +34,10 @@ import { OrchestrationUtils } from "@medusajs/utils"
* attachProductToSalesChannelStep(product) * attachProductToSalesChannelStep(product)
* ) * )
* *
* const id = product.id * return new WorkflowResponse({
* return new WorkflowResponse(getProductStep(product.id)) * prices,
* productSalesChannel
* })
* } * }
* ) * )
*/ */
@@ -36,7 +36,7 @@ type ThenFunc = <ThenResolver extends () => any>(
* } from "@medusajs/framework/workflows-sdk" * } from "@medusajs/framework/workflows-sdk"
* // step imports... * // step imports...
* *
* const workflow = createWorkflow( * export const workflow = createWorkflow(
* "workflow", * "workflow",
* function (input: { * function (input: {
* is_active: boolean * is_active: boolean