@medusajs/core-flows
Version:
Set of workflow definitions for Medusa
55 lines • 2.79 kB
TypeScript
import { AdditionalData, ProductTypes } from "@medusajs/framework/types";
import { WorkflowData } from "@medusajs/framework/workflows-sdk";
/**
* The data to create one or more product options, along with custom data that's passed to the workflow's hooks.
*/
export type CreateProductOptionsWorkflowInput = {
/**
* The product options to create.
*/
product_options: ProductTypes.CreateProductOptionDTO[];
} & AdditionalData;
export declare const createProductOptionsWorkflowId = "create-product-options";
/**
* This workflow creates one or more product options. It's used by the [Create Product Option Admin API Route](https://docs.medusajs.com/api/admin#products_postproductsidoptions).
*
* This workflow has a hook that allows you to perform custom actions on the created product options. For example, you can pass under `additional_data` custom data that
* allows you to create 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 creation.
*
* @example
* const { result } = await createProductOptionsWorkflow(container)
* .run({
* input: {
* product_options: [
* {
* title: "Size",
* values: ["S", "M", "L", "XL"]
* },
* {
* title: "Color",
* values: ["Red", "Blue", "Green"]
* }
* ],
* additional_data: {
* erp_id: "123"
* }
* }
* })
*
* @summary
*
* Create one or more product options.
*
* @property hooks.productOptionsCreated - This hook is executed after the product options are created. You can consume this hook to perform custom actions on the created product options.
*/
export declare const createProductOptionsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateProductOptionsWorkflowInput, ProductTypes.ProductOptionDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"productOptionsCreated", {
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=create-product-options.d.ts.map