Skip to main content
Creates sellers (defaulting status to pending_approval), then runs createMemberInvitesWorkflow to invite each seller’s initial member with the seller administration role. Triggered by POST /admin/sellers. Emits seller.created and member_invite.created.

Usage

import { createSellersWorkflow } from "@mercurjs/core/workflows"

const { result } = await createSellersWorkflow(container).run({
  input: {
    sellers: [
      {
        name: "Acme",
        email: "hello@acme.co",
        currency_code: "usd",
        member: { email: "owner@acme.co" },
      },
    ],
  },
})

Input

sellers
object[]
required
Sellers to create.
additional_data
object
Custom data passed through to the workflow hooks.

Result

result
SellerDTO[]
The created sellers.

Hooks

  • validate — runs before creation with { input }.
  • sellersCreated — runs after creation with { sellers, additional_data }.
createSellersWorkflow.hooks.sellersCreated(async ({ sellers, additional_data }) => {
  // react to new sellers
})