@medusajs/core-flows
Version:
Set of workflow definitions for Medusa
109 lines • 5.69 kB
TypeScript
import { AdditionalData, OrderDTO, OrderWorkflow } from "@medusajs/framework/types";
import { WorkflowData } from "@medusajs/framework/workflows-sdk";
/**
* The data to validate the order fulfillment creation.
*/
export type CreateFulfillmentValidateOrderStepInput = {
/**
* The order to create the fulfillment for.
*/
order: OrderDTO;
/**
* The items to fulfill.
*/
inputItems: OrderWorkflow.CreateOrderFulfillmentWorkflowInput["items"];
};
/**
* This step validates that a fulfillment can be created for an order. If the order
* is canceled, the items don't exist in the order, or the items aren't grouped by
* shipping requirement, the step throws an error.
*
* :::note
*
* You can retrieve an order's details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),
* or [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).
*
* :::
*
* @example
* const data = createFulfillmentValidateOrder({
* order: {
* id: "order_123",
* // other order details...
* },
* inputItems: [
* {
* id: "orli_123",
* quantity: 1,
* }
* ]
* })
*/
export declare const createFulfillmentValidateOrder: import("@medusajs/framework/workflows-sdk").StepFunction<CreateFulfillmentValidateOrderStepInput, unknown>;
/**
* The details of the fulfillment to create, along with custom data that's passed to the workflow's hooks.
*/
export type CreateOrderFulfillmentWorkflowInput = OrderWorkflow.CreateOrderFulfillmentWorkflowInput & AdditionalData;
export declare const createOrderFulfillmentWorkflowId = "create-order-fulfillment";
/**
* This workflow creates a fulfillment for an order. It's used by the [Create Order Fulfillment Admin API Route](https://docs.medusajs.com/api/admin#orders_postordersidfulfillments).
*
* This workflow has a hook that allows you to perform custom actions on the created fulfillment. For example, you can pass under `additional_data` custom data that
* allows you to create custom data models linked to the fulfillment.
*
* You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around creating a fulfillment.
*
* @example
* const { result } = await createOrderFulfillmentWorkflow(container)
* .run({
* input: {
* order_id: "order_123",
* items: [
* {
* id: "orli_123",
* quantity: 1,
* }
* ],
* additional_data: {
* send_oms: true
* }
* }
* })
*
* @summary
*
* Creates a fulfillment for an order.
*
* @property hooks.fulfillmentCreated - This hook is executed after the fulfillment is created. You can consume this hook to perform custom actions on the created fulfillment.
*/
export declare const createOrderFulfillmentWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateOrderFulfillmentWorkflowInput, import("@medusajs/framework/types").FulfillmentDTO, [import("@medusajs/framework/workflows-sdk").Hook<"fulfillmentCreated", {
fulfillment: {
id: string | WorkflowData<string>;
location_id: string | WorkflowData<string>;
packed_at: Date | WorkflowData<Date | null> | null;
shipped_at: Date | WorkflowData<Date | null> | null;
delivered_at: Date | WorkflowData<Date | null> | null;
canceled_at: Date | WorkflowData<Date | null> | null;
marked_shipped_by?: string | WorkflowData<string | null | undefined> | null | undefined;
created_by?: string | WorkflowData<string | null | undefined> | null | undefined;
data: Record<string, unknown> | WorkflowData<Record<string, unknown> | null> | null;
provider_id: string | WorkflowData<string>;
shipping_option_id: string | WorkflowData<string | null> | null;
metadata: Record<string, unknown> | WorkflowData<Record<string, unknown> | null> | null;
shipping_option: import("@medusajs/framework/types").ShippingOptionDTO | WorkflowData<import("@medusajs/framework/types").ShippingOptionDTO | null> | null;
requires_shipping: boolean | WorkflowData<boolean>;
provider: import("@medusajs/framework/types").FulfillmentProviderDTO | WorkflowData<import("@medusajs/framework/types").FulfillmentProviderDTO>;
delivery_address: import("@medusajs/framework/types").FulfillmentAddressDTO | WorkflowData<import("@medusajs/framework/types").FulfillmentAddressDTO>;
items: import("@medusajs/framework/types").FulfillmentItemDTO[] | WorkflowData<import("@medusajs/framework/types").FulfillmentItemDTO[]>;
labels: import("@medusajs/framework/types").FulfillmentLabelDTO[] | WorkflowData<import("@medusajs/framework/types").FulfillmentLabelDTO[]>;
created_at: Date | WorkflowData<Date>;
updated_at: Date | WorkflowData<Date>;
deleted_at: Date | WorkflowData<Date | null> | null;
} & import("@medusajs/framework/types").FulfillmentDTO & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<import("@medusajs/framework/types").FulfillmentDTO> & {
config(config: {
name?: string;
} & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<import("@medusajs/framework/types").FulfillmentDTO>;
} & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<import("@medusajs/framework/types").FulfillmentDTO>;
additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined;
}, unknown>]>;
//# sourceMappingURL=create-fulfillment.d.ts.map