@medusajs/core-flows
Version:
Set of workflow definitions for Medusa
55 lines • 2.83 kB
TypeScript
import { AdditionalData, ProductTypes } from "@medusajs/framework/types";
import { WorkflowData } from "@medusajs/framework/workflows-sdk";
/**
* The data to update one or more product options, along with custom data that's passed to the workflow's hooks.
*/
export type UpdateProductOptionsWorkflowInput = {
/**
* The filters to select the product options to update.
*/
selector: ProductTypes.FilterableProductOptionProps;
/**
* The data to update in the product options.
*/
update: ProductTypes.UpdateProductOptionDTO;
} & AdditionalData;
export declare const updateProductOptionsWorkflowId = "update-product-options";
/**
* This workflow updates one or more product options. It's used by the [Update Product Option Admin API Route](https://docs.medusajs.com/api/admin#products_postproductsidvariantsvariant_id).
*
* This workflow has a hook that allows you to perform custom actions on the updated product options. For example, you can pass under `additional_data` custom data that
* allows you to update custom data models linked to the product options.
*
* You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around product-option update.
*
* @example
* const { result } = await updateProductOptionsWorkflow(container)
* .run({
* input: {
* selector: {
* title: "Color"
* },
* update: {
* values: ["Red", "Blue", "Green"]
* },
* additional_data: {
* erp_id: "123"
* }
* }
* })
*
* @summary
*
* Update one or more product options.
*
* @property hooks.productOptionsUpdated - This hook is executed after the product options are updated. You can consume this hook to perform custom actions on the updated product options.
*/
export declare const updateProductOptionsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<UpdateProductOptionsWorkflowInput, ProductTypes.ProductOptionDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"productOptionsUpdated", {
product_options: (ProductTypes.ProductOptionDTO | WorkflowData<ProductTypes.ProductOptionDTO>)[] & ProductTypes.ProductOptionDTO[] & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<ProductTypes.ProductOptionDTO[]> & {
config(config: {
name?: string;
} & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<ProductTypes.ProductOptionDTO[]>;
} & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<ProductTypes.ProductOptionDTO[]>;
additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined;
}, unknown>]>;
//# sourceMappingURL=update-product-options.d.ts.map