docs: [7/n] generate core-flows reference (#8788)

This commit is contained in:
Shahed Nasser
2024-08-27 12:22:27 +03:00
committed by GitHub
parent 6e7438a2cb
commit 275b5b2af5
50 changed files with 1094 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
---
slug: /references/medusa-workflows/createOrderShipmentWorkflow
sidebar_label: createOrderShipmentWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# createOrderShipmentWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `createOrderShipmentWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow creates a shipment for an order.
## Steps
<WorkflowDiagram workflow={{"name":"createOrderShipmentWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/v2/advanced-development/modules/remote-query).\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#useremotequerystep","depth":1},{"type":"step","name":"createShipmentValidateOrder","description":"This step validates that a shipment can be created for an order.","link":"../../../../core_flows.Workflows_Order/page.mdx#createshipmentvalidateorder","depth":2},{"type":"workflow","name":"createShipmentWorkflow","description":"This workflow creates shipments for a fulfillment.","link":"../../../../core_flows.Workflows_Fulfillment/page.mdx#createshipmentworkflow","depth":3},{"type":"step","name":"registerOrderShipmentStep","description":"This step registers a shipment for an order.","link":"../../../../core_flows.Steps_Order/page.mdx#registerordershipmentstep","depth":3},{"type":"step","name":"emitEventStep","description":"Emit an event.\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#emiteventstep","depth":4},{"type":"hook","name":"shipmentCreated","description":"This step is a hook that you can inject custom functionality into.\n\n","link":"#shipmentCreated","depth":5}]}} />
## Input
<TypeList types={[{"name":"CreateOrderShipmentWorkflowInput & AdditionalData","type":"`CreateOrderShipmentWorkflowInput` & [AdditionalData](../../../../../types/HttpTypes/types/types.HttpTypes.AdditionalData/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"CreateOrderShipmentWorkflowInput","type":"`CreateOrderShipmentWorkflowInput`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]},{"name":"AdditionalData","type":"[AdditionalData](../../../../../types/HttpTypes/types/types.HttpTypes.AdditionalData/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"additional_data","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createOrderShipmentWorkflow"/>
## Output
<TypeList types={[{"name":"undefined","type":"`undefined`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"undefined","type":"`undefined`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createOrderShipmentWorkflow"/>
## Hooks
### shipmentCreated
#### Example
```ts
import { createOrderShipmentWorkflow } from "@medusajs/core-flows"
createOrderShipmentWorkflow.hooks.shipmentCreated(
async (({ shipment, additional_data }, { container }) => {
//TODO
})
)
```
#### Input
Handlers consuming this hook accept the following input.
<TypeList types={[{"name":"input","type":"object","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"shipment","type":"[FulfillmentDTO](../../../../../fulfillment/interfaces/fulfillment.FulfillmentDTO/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"location_id","type":"`string`","description":"The associated location's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"packed_at","type":"`null` \\| `Date`","description":"The date the fulfillment was packed.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"shipped_at","type":"`null` \\| `Date`","description":"The date the fulfillment was shipped.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"delivered_at","type":"`null` \\| `Date`","description":"The date the fulfillment was delivered.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"canceled_at","type":"`null` \\| `Date`","description":"The date the fulfillment was canceled.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`null` \\| `Record<string, unknown>`","description":"The data necessary for the fulfillment provider to process\nthe fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"provider_id","type":"`string`","description":"The associated fulfillment provider's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_option_id","type":"`null` \\| `string`","description":"The associated shipping option's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Holds custom data in key-value pairs.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_option","type":"`null` \\| [ShippingOptionDTO](../../../../../fulfillment/interfaces/fulfillment.ShippingOptionDTO/page.mdx)","description":"The associated shipping option.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"provider","type":"[FulfillmentProviderDTO](../../../../../fulfillment/interfaces/fulfillment.FulfillmentProviderDTO/page.mdx)","description":"The associated fulfillment provider.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"delivery_address","type":"[FulfillmentAddressDTO](../../../../../fulfillment/interfaces/fulfillment.FulfillmentAddressDTO/page.mdx)","description":"The associated fulfillment address used for delivery.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"items","type":"[FulfillmentItemDTO](../../../../../fulfillment/interfaces/fulfillment.FulfillmentItemDTO/page.mdx)[]","description":"The items of the fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"labels","type":"[FulfillmentLabelDTO](../../../../../fulfillment/interfaces/fulfillment.FulfillmentLabelDTO/page.mdx)[]","description":"The labels of the fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`Date`","description":"The creation date of the fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`Date`","description":"The update date of the fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `Date`","description":"The deletion date of the fulfillment.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"additional_data","type":"`Record<string, unknown> | undefined`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="shipmentCreated"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/declineOrderChangeWorkflow
sidebar_label: declineOrderChangeWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# declineOrderChangeWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `declineOrderChangeWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow declines an order change.
## Steps
<WorkflowDiagram workflow={{"name":"declineOrderChangeWorkflow","steps":[{"type":"step","name":"declineOrderChangeStep","description":"This step declines an order change.","link":"../../../../core_flows.Steps_Order/page.mdx#declineorderchangestep","depth":1}]}} />
## Input
<TypeList types={[{"name":"DeclineOrderChangeDTO","type":"[DeclineOrderChangeDTO](../../../../../order/interfaces/order.DeclineOrderChangeDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the order change.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"declined_by","type":"`string`","description":"The user or customer who declined the order change.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Holds custom data in key-value pairs.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="declineOrderChangeWorkflow"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/deleteOrderChangeActionsWorkflow
sidebar_label: deleteOrderChangeActionsWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# deleteOrderChangeActionsWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `deleteOrderChangeActionsWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow deletes one or more order change actions.
## Steps
<WorkflowDiagram workflow={{"name":"deleteOrderChangeActionsWorkflow","steps":[{"type":"step","name":"deleteOrderChangeActionsStep","description":"This step deletes order change actions.","link":"../../../../core_flows.Steps_Order/page.mdx#deleteorderchangeactionsstep","depth":1}]}} />
## Input
<TypeList types={[{"name":"ids","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteOrderChangeActionsWorkflow"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/deleteOrderChangeWorkflow
sidebar_label: deleteOrderChangeWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# deleteOrderChangeWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `deleteOrderChangeWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow deletes one or more order changes.
## Steps
<WorkflowDiagram workflow={{"name":"deleteOrderChangeWorkflow","steps":[{"type":"step","name":"deleteOrderChangesStep","description":"This step deletes order changes.","link":"../../../../core_flows.Steps_Order/page.mdx#deleteorderchangesstep","depth":1}]}} />
## Input
<TypeList types={[{"name":"ids","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteOrderChangeWorkflow"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/deleteOrderPaymentCollections
sidebar_label: deleteOrderPaymentCollections
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# deleteOrderPaymentCollections - Medusa Workflows API Reference
This documentation provides a reference to the `deleteOrderPaymentCollections`. It belongs to the `@medusajs/core-flows` package.
This workflow deletes one or more invites.
## Steps
<WorkflowDiagram workflow={{"name":"deleteOrderPaymentCollections","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/v2/advanced-development/modules/remote-query).\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#useremotequerystep","depth":1},{"type":"step","name":"throwUnlessStatusIsNotPaid","description":"This step validates that the order doesn't have an active payment collection.","link":"../../../../core_flows.Workflows_Order/page.mdx#throwunlessstatusisnotpaid","depth":2},{"type":"step","name":"removeRemoteLinkStep","description":"This step deletes linked records of a record.\n\nLearn more in the [Remote Link documentation](https://docs.medusajs.com/v2/advanced-development/modules/remote-link#cascade-delete-linked-records)\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#removeremotelinkstep","depth":3}]}} />
## Input
<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="deleteOrderPaymentCollections"/>

View File

@@ -0,0 +1,24 @@
---
slug: /references/medusa-workflows/getOrderDetailWorkflow
sidebar_label: getOrderDetailWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# getOrderDetailWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `getOrderDetailWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow retrieves an order's details.
## Steps
<WorkflowDiagram workflow={{"name":"getOrderDetailWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/v2/advanced-development/modules/remote-query).\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#useremotequerystep","depth":1}]}} />
## Input
<TypeList types={[{"name":"fields","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"order_id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getOrderDetailWorkflow"/>
## Output
<TypeList types={[{"name":"OrderDetailDTO","type":"`OrderDetailDTO`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getOrderDetailWorkflow"/>

View File

@@ -0,0 +1,24 @@
---
slug: /references/medusa-workflows/receiveAndCompleteReturnOrderWorkflow
sidebar_label: receiveAndCompleteReturnOrderWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# receiveAndCompleteReturnOrderWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `receiveAndCompleteReturnOrderWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow marks a return as received and completes it.
## Steps
<WorkflowDiagram workflow={{"name":"receiveAndCompleteReturnOrderWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/v2/advanced-development/modules/remote-query).\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#useremotequerystep","depth":1},{"type":"step","name":"receiveCompleteReturnValidationStep","description":"This step validates that a return can be received and completed.","link":"../../../../core_flows.Workflows_Order/page.mdx#receivecompletereturnvalidationstep","depth":2}]}} />
## Input
<TypeList types={[{"name":"ReceiveCompleteOrderReturnWorkflowInput","type":"`ReceiveCompleteOrderReturnWorkflowInput`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="receiveAndCompleteReturnOrderWorkflow"/>
## Output
<TypeList types={[{"name":"undefined \\| ReturnDTO","type":"`undefined` \\| [ReturnDTO](../../../../../fulfillment/interfaces/fulfillment.ReturnDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"undefined \\| ReturnDTO","type":"`undefined` \\| [ReturnDTO](../../../../../fulfillment/interfaces/fulfillment.ReturnDTO/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="receiveAndCompleteReturnOrderWorkflow"/>

View File

@@ -0,0 +1,16 @@
---
slug: /references/medusa-workflows/receiveCompleteReturnValidationStep
sidebar_label: receiveCompleteReturnValidationStep
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# receiveCompleteReturnValidationStep - Medusa Workflows API Reference
This documentation provides a reference to the `receiveCompleteReturnValidationStep`. It belongs to the `@medusajs/core-flows` package.
This step validates that a return can be received and completed.
## Input
<TypeList types={[{"name":"orderReturn","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"input","type":"`ReceiveCompleteOrderReturnWorkflowInput`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="receiveCompleteReturnValidationStep"/>