@medusajs/core-flows
Version:
Set of workflow definitions for Medusa
53 lines • 2.85 kB
TypeScript
import { AdditionalData, CustomerUpdatableFields, FilterableCustomerProps } from "@medusajs/framework/types";
import { WorkflowData } from "@medusajs/framework/workflows-sdk";
/**
* The data to update one or more customers, along with custom data that's passed to the workflow's hooks.
*/
export type UpdateCustomersWorkflowInput = {
/**
* The filters to select the customers to update.
*/
selector: FilterableCustomerProps;
/**
* The data to update in the customers.
*/
update: CustomerUpdatableFields;
} & AdditionalData;
export declare const updateCustomersWorkflowId = "update-customers";
/**
* This workflow updates one or more customers. It's used by the [Update Customer Admin API Route](https://docs.medusajs.com/api/admin#customers_postcustomersid) and
* the [Update Customer Store API Route](https://docs.medusajs.com/api/store#customers_postcustomersme).
*
* This workflow has a hook that allows you to perform custom actions on the updated customer. For example, you can pass under `additional_data` custom data to update
* custom data models linked to the customers.
*
* You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around updating customers.
*
* @example
* const { result } = await updateCustomersWorkflow(container)
* .run({
* input: {
* selector: {
* id: ["cus_123"]
* },
* update: {
* first_name: "John"
* }
* }
* })
*
* @summary
*
* Update one or more customers.
*
* @property hooks.customersUpdated - This hook is executed after the customers are updated. You can consume this hook to perform custom actions on the updated customers.
*/
export declare const updateCustomersWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<UpdateCustomersWorkflowInput, import("@medusajs/framework/types").CustomerDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"customersUpdated", {
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=update-customers.d.ts.map