UNPKG

@medusajs/core-flows

Version:

Set of workflow definitions for Medusa

111 lines 5.53 kB
import { AdditionalData, FulfillmentDTO, OrderDTO, OrderWorkflow } from "@medusajs/framework/types"; import { WorkflowData } from "@medusajs/framework/workflows-sdk"; export type CreateShipmentValidateOrderStepInput = { /** * The order to create the shipment for. */ order: OrderDTO; /** * The shipment creation details. */ input: OrderWorkflow.CreateOrderShipmentWorkflowInput; }; /** * This step validates that a shipment can be created for an order. If the order is cancelled, * the items don't exist in the order, or the fulfillment doesn't exist in the order, * the step will throw 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 = createShipmentValidateOrder({ * order: { * id: "order_123", * // other order details... * }, * input: { * order_id: "order_123", * fulfillment_id: "ful_123", * items: [ * { * id: "orli_123", * quantity: 1 * } * ] * } * }) */ export declare const createShipmentValidateOrder: import("@medusajs/framework/workflows-sdk").StepFunction<CreateShipmentValidateOrderStepInput, unknown>; /** * The data to create a shipment for an order, along with custom data that's passed to the workflow's hooks. */ export type CreateOrderShipmentWorkflowInput = OrderWorkflow.CreateOrderShipmentWorkflowInput & AdditionalData; export declare const createOrderShipmentWorkflowId = "create-order-shipment"; /** * This workflow creates a shipment for an order. It's used by the [Create Order Shipment Admin API Route](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idshipments). * * This workflow has a hook that allows you to perform custom actions on the created shipment. For example, you can pass under `additional_data` custom data that * allows you to create custom data models linked to the shipment. * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around creating a shipment. * * @example * const { result } = await createOrderShipmentWorkflow(container) * .run({ * input: { * order_id: "order_123", * fulfillment_id: "fulfillment_123", * items: [ * { * id: "orli_123", * quantity: 1 * } * ], * additional_data: { * oms_id: "123" * } * } * }) * * @summary * * Creates a shipment for an order. * * @property hooks.shipmentCreated - This hook is executed after the shipment is created. You can consume this hook to perform custom actions on the created shipment. */ export declare const createOrderShipmentWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateOrderShipmentWorkflowInput, undefined, [import("@medusajs/framework/workflows-sdk").Hook<"shipmentCreated", { shipment: { 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; } & FulfillmentDTO & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<FulfillmentDTO> & { config(config: { name?: string; } & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<FulfillmentDTO>; } & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<FulfillmentDTO>; additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined; }, unknown>]>; //# sourceMappingURL=create-shipment.d.ts.map