UNPKG

@medusajs/core-flows

Version:

Set of workflow definitions for Medusa

51 lines 2.7 kB
import { AdditionalData, CreateCustomerDTO } from "@medusajs/framework/types"; import { WorkflowData } from "@medusajs/framework/workflows-sdk"; /** * The data to create one or more customers, along with custom data that's passed to the workflow's hooks. */ export type CreateCustomersWorkflowInput = { /** * The customers to create. */ customersData: CreateCustomerDTO[]; } & AdditionalData; export declare const createCustomersWorkflowId = "create-customers"; /** * This workflow creates one or more customers. It's used by the [Create Customer Admin API Route](https://docs.medusajs.com/api/admin#customers_postcustomers). * * This workflow has a hook that allows you to perform custom actions on the created customer. You can see an example in [this guide](https://docs.medusajs.com/resources/commerce-modules/customer/extend). * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around creating customers. * * @example * const { result } = await createCustomersWorkflow(container) * .run({ * input: { * customersData: [ * { * first_name: "John", * last_name: "Doe", * email: "john.doe@example.com", * }, * ], * additional_data: { * position_name: "Editor", * } * } * }) * * @summary * * Create one or more customers. * * @property hooks.customersCreated - This hook is executed after the customers are created. You can consume this hook to perform custom actions on the created customers. */ export declare const createCustomersWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateCustomersWorkflowInput, import("@medusajs/framework/types").CustomerDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"customersCreated", { customers: (import("@medusajs/framework/types").CustomerDTO | WorkflowData<import("@medusajs/framework/types").CustomerDTO>)[] & import("@medusajs/framework/types").CustomerDTO[] & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<import("@medusajs/framework/types").CustomerDTO[]> & { config(config: { name?: string; } & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<import("@medusajs/framework/types").CustomerDTO[]>; } & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<import("@medusajs/framework/types").CustomerDTO[]>; additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined; }, unknown>]>; //# sourceMappingURL=create-customers.d.ts.map