Inventory Levels Update Workflow (workflows/update-inventory-levels.ts)

medusa · packages/core/core-flows/src/inventory/workflows/update-inventory-levels.ts · typescript · MIT
database, integration, automation, pos, payments, lang:typescript, tag:medusa

Medusa workflow that updates one or more inventory levels and emits corresponding events. Reuse when managing inventory adjustments in an e-commerce backend.

// Source: https://github.com/medusajs/medusa | License: MIT | Copyright 2021 Medusajs
// Provided via justclaw.it.com; keep this notice with the code.
import type {
  InventoryLevelDTO,
  InventoryTypes,
} from "@medusajs/framework/types"
import {
  WorkflowData,
  WorkflowResponse,
  createWorkflow,
  transform,
} from "@medusajs/framework/workflows-sdk"
import { InventoryLevelWorkflowEvents } from "@medusajs/framework/utils"

import { emitEventStep } from "../../common"
import { updateInventoryLevelsStep } from "../steps/update-inventory-levels"

/**
 * The data to update the inventory levels.
 */
export interface UpdateInventoryLevelsWorkflowInput {
  /**
   * The inventory levels to update.
   */
  updates: InventoryTypes.UpdateInventoryLevelInput[]
}

/**
 * The updated inventory lev

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key