@medusajs/core-flows
Version:
Set of workflow definitions for Medusa
51 lines • 2.61 kB
TypeScript
import { AdditionalData, ProductTypes } from "@medusajs/framework/types";
import { WorkflowData } from "@medusajs/framework/workflows-sdk";
/**
* The details of the collection to create, along with custom data that's passed to the workflow's hooks.
*/
export type CreateCollectionsWorkflowInput = {
/**
* The collections to create.
*/
collections: ProductTypes.CreateProductCollectionDTO[];
} & AdditionalData;
export declare const createCollectionsWorkflowId = "create-collections";
/**
* This workflow creates one or more collections. It's used by the
* [Create Collection Admin API Route](https://docs.medusajs.com/api/admin#collections_postcollections).
*
* This workflow has a hook that allows you to perform custom actions on the created collections. For example, you can pass under `additional_data` custom data that
* allows you to create custom data models linked to the product collections.
*
* You can also use this workflow within your own custom workflows, allowing you to wrap custom logic around product-collection creation.
*
* @example
* const { result } = await createCollectionsWorkflow(container)
* .run({
* input: {
* collections: [
* {
* title: "Summer Clothing"
* }
* ],
* additional_data: {
* erp_id: "123"
* }
* }
* })
*
* @summary
*
* Create one or more product collections.
*
* @property hooks.collectionsCreated - This hook is executed after the collections are created. You can consume this hook to perform custom actions on the created collections.
*/
export declare const createCollectionsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateCollectionsWorkflowInput, ProductTypes.ProductCollectionDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"collectionsCreated", {
collections: (ProductTypes.ProductCollectionDTO | WorkflowData<ProductTypes.ProductCollectionDTO>)[] & ProductTypes.ProductCollectionDTO[] & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<ProductTypes.ProductCollectionDTO[]> & {
config(config: {
name?: string;
} & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<ProductTypes.ProductCollectionDTO[]>;
} & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<ProductTypes.ProductCollectionDTO[]>;
additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined;
}, unknown>]>;
//# sourceMappingURL=create-collections.d.ts.map