docs: [23/n] generate core-flows reference (#8807)

This commit is contained in:
Shahed Nasser
2024-08-27 12:25:39 +03:00
committed by GitHub
parent 2b67b87137
commit 6470168526
26 changed files with 639 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/addShippingMethodToWorkflow
sidebar_label: addShippingMethodToWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# addShippingMethodToWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `addShippingMethodToWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow adds shipping methods to a cart.
## Steps
<WorkflowDiagram workflow={{"name":"addShippingMethodToWorkflow","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":"validateCartShippingOptionsStep","description":"This step validates shipping options to ensure they can be applied on a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#validatecartshippingoptionsstep","depth":2},{"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":3},{"type":"step","name":"removeShippingMethodFromCartStep","description":"This step removes shipping methods from a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#removeshippingmethodfromcartstep","depth":4},{"type":"step","name":"addShippingMethodToCartStep","description":"This step adds shipping methods to a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#addshippingmethodtocartstep","depth":5},{"type":"workflow","name":"updateTaxLinesWorkflow","description":"This workflow updates a cart's tax lines.","link":"../../../../core_flows.Workflows_Cart/page.mdx#updatetaxlinesworkflow","depth":6},{"type":"workflow","name":"updateCartPromotionsWorkflow","description":"This workflow updates a cart's promotions.","link":"../../../../core_flows.Workflows_Cart/page.mdx#updatecartpromotionsworkflow","depth":7}]}} />
## Input
<TypeList types={[{"name":"AddShippingMethodToCartWorkflowInput","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"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="addShippingMethodToWorkflow"/>

View File

@@ -0,0 +1,24 @@
---
slug: /references/medusa-workflows/confirmVariantInventoryWorkflow
sidebar_label: confirmVariantInventoryWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# confirmVariantInventoryWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `confirmVariantInventoryWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow confirms for one or more variants that their inventory has a required quantity.
## Steps
<WorkflowDiagram workflow={{"name":"confirmVariantInventoryWorkflow","steps":[{"type":"step","name":"confirmInventoryStep","description":"This step confirms for one or more variants that their inventory has a required quantity.","link":"../../../../core_flows.Steps_Cart/page.mdx#confirminventorystep","depth":1}]}} />
## Input
<TypeList types={[{"name":"ConfirmVariantInventoryWorkflowInputDTO","type":"`ConfirmVariantInventoryWorkflowInputDTO`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="confirmVariantInventoryWorkflow"/>
## Output
<TypeList types={[{"name":"ConfirmVariantInventoryWorkflowOutput","type":"[ConfirmVariantInventoryWorkflowOutput](../../../../interfaces/core_flows.ConfirmVariantInventoryWorkflowOutput/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"items","type":"`object`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"inventory_item_id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"required_quantity","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"allow_backorder","type":"`boolean`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"quantity","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"location_ids","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="confirmVariantInventoryWorkflow"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/createPaymentCollectionForCartWorkflow
sidebar_label: createPaymentCollectionForCartWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# createPaymentCollectionForCartWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `createPaymentCollectionForCartWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow creates a payment collection for a cart.
## Steps
<WorkflowDiagram workflow={{"name":"createPaymentCollectionForCartWorkflow","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":"validateExistingPaymentCollectionStep","description":"This step validates that a cart doesn't have a payment collection.","link":"../../../../core_flows.Workflows_Cart/page.mdx#validateexistingpaymentcollectionstep","depth":2},{"type":"step","name":"createPaymentCollectionsStep","description":"This step creates payment collections in a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#createpaymentcollectionsstep","depth":3},{"type":"step","name":"createRemoteLinkStep","description":"This step creates remote links between two records of linked data models.\n\nLearn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/advanced-development/modules/remote-link#create-link).\n\n","link":"../../../../core_flows.Steps_Common/page.mdx#createremotelinkstep","depth":4}]}} />
## Input
<TypeList types={[{"name":"CreatePaymentCollectionForCartWorkflowInputDTO","type":"`CreatePaymentCollectionForCartWorkflowInputDTO`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createPaymentCollectionForCartWorkflow"/>

View File

@@ -0,0 +1,24 @@
---
slug: /references/medusa-workflows/listShippingOptionsForCartWorkflow
sidebar_label: listShippingOptionsForCartWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# listShippingOptionsForCartWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `listShippingOptionsForCartWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow lists the shipping options of a cart.
## Steps
<WorkflowDiagram workflow={{"name":"listShippingOptionsForCartWorkflow","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":"ListShippingOptionsForCartWorkflowInputDTO","type":"`ListShippingOptionsForCartWorkflowInputDTO`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="listShippingOptionsForCartWorkflow"/>
## Output
<TypeList types={[{"name":"any[]","type":"`any`[]","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"any","type":"`any`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="listShippingOptionsForCartWorkflow"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/refreshPaymentCollectionForCartWorkflow
sidebar_label: refreshPaymentCollectionForCartWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# refreshPaymentCollectionForCartWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `refreshPaymentCollectionForCartWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow refreshes the payment collections of a cart.
## Steps
<WorkflowDiagram workflow={{"name":"refreshPaymentCollectionForCartWorkflow","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":"when","condition":"{\n const valueIsEqual = MathBN.eq(\n cart.payment_collection?.raw_amount ?? -1,\n cart.raw_total\n )\n\n if (valueIsEqual) {\n return cart.payment_collection.currency_code !== cart.currency_code\n }\n\n return true\n }","depth":"2","steps":[{"type":"workflow","name":"deletePaymentSessionsWorkflow","description":"This workflow deletes one or more payment sessions.","link":"../../../../core_flows.Workflows_Payment_Collection/page.mdx#deletepaymentsessionsworkflow","depth":2},{"type":"step","name":"updatePaymentCollectionStep","description":"This step updates payment collections matching the specified filters.","link":"../../../../core_flows.Steps_Payment_Collection/page.mdx#updatepaymentcollectionstep","depth":2}]}]}} />
## Input
<TypeList types={[{"name":"RefreshPaymentCollectionForCartWorklowInput","type":"[RefreshPaymentCollectionForCartWorklowInput](../../../../types/core_flows.RefreshPaymentCollectionForCartWorklowInput/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"cart_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="refreshPaymentCollectionForCartWorkflow"/>

View File

@@ -0,0 +1,20 @@
---
slug: /references/medusa-workflows/updateCartPromotionsWorkflow
sidebar_label: updateCartPromotionsWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# updateCartPromotionsWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `updateCartPromotionsWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow updates a cart's promotions.
## Steps
<WorkflowDiagram workflow={{"name":"updateCartPromotionsWorkflow","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":"getPromotionCodesToApply","description":"This step retrieves the promotion codes to apply on a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#getpromotioncodestoapply","depth":2},{"type":"step","name":"getActionsToComputeFromPromotionsStep","description":"This step retrieves the actions to compute based on the promotions\napplied on a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#getactionstocomputefrompromotionsstep","depth":3},{"type":"step","name":"prepareAdjustmentsFromPromotionActionsStep","description":"This step prepares the line item or shipping method adjustments using\nactions computed by the Promotion Module.","link":"../../../../core_flows.Steps_Cart/page.mdx#prepareadjustmentsfrompromotionactionsstep","depth":4},{"type":"step","name":"removeLineItemAdjustmentsStep","description":"This step removes line item adjustments from a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#removelineitemadjustmentsstep","depth":5},{"type":"step","name":"removeShippingMethodAdjustmentsStep","description":"This step removes shipping method adjustments from a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#removeshippingmethodadjustmentsstep","depth":5},{"type":"step","name":"createLineItemAdjustmentsStep","description":"This step creates line item adjustments in a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#createlineitemadjustmentsstep","depth":5},{"type":"step","name":"createShippingMethodAdjustmentsStep","description":"This step creates shipping method adjustments for a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#createshippingmethodadjustmentsstep","depth":5},{"type":"step","name":"updateCartPromotionsStep","description":"This step updates the promotions applied on a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#updatecartpromotionsstep","depth":5}]}} />
## Input
<TypeList types={[{"name":"UpdateCartPromotionsWorkflowInput","type":"[UpdateCartPromotionsWorkflowInput](../../../../types/core_flows.UpdateCartPromotionsWorkflowInput/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"promo_codes","type":"`string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"action","type":"[ADD](../../../../../utils/PromotionUtils/enums/utils.PromotionUtils.PromotionActions/page.mdx#add) \\| [REMOVE](../../../../../utils/PromotionUtils/enums/utils.PromotionUtils.PromotionActions/page.mdx#remove) \\| [REPLACE](../../../../../utils/PromotionUtils/enums/utils.PromotionUtils.PromotionActions/page.mdx#replace)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="updateCartPromotionsWorkflow"/>

View File

@@ -0,0 +1,46 @@
---
slug: /references/medusa-workflows/updateCartWorkflow
sidebar_label: updateCartWorkflow
---
import { TypeList, WorkflowDiagram } from "docs-ui"
# updateCartWorkflow - Medusa Workflows API Reference
This documentation provides a reference to the `updateCartWorkflow`. It belongs to the `@medusajs/core-flows` package.
This workflow updates a cart.
## Steps
<WorkflowDiagram workflow={{"name":"updateCartWorkflow","steps":[{"type":"step","name":"findSalesChannelStep","description":"This step either retrieves a sales channel either using the ID provided as an input, or, if no ID\nis provided, the default sales channel of the first store.","link":"../../../../core_flows.Steps_Cart/page.mdx#findsaleschannelstep","depth":1},{"type":"step","name":"findOneOrAnyRegionStep","description":"This step retrieves a region either by the provided ID or the first region in the first store.","link":"../../../../core_flows.Steps_Cart/page.mdx#findoneoranyregionstep","depth":1},{"type":"step","name":"findOrCreateCustomerStep","description":"This step either finds a customer matching the specified ID, or finds / create a customer \nmatching the specified email. If both ID and email are provided, ID takes precedence.","link":"../../../../core_flows.Steps_Cart/page.mdx#findorcreatecustomerstep","depth":1},{"type":"step","name":"updateCartsStep","description":"This step updates a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#updatecartsstep","depth":2},{"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":3},{"type":"step","name":"refreshCartShippingMethodsStep","description":"This step refreshes the shipping methods of a cart.","link":"../../../../core_flows.Steps_Cart/page.mdx#refreshcartshippingmethodsstep","depth":4},{"type":"workflow","name":"updateTaxLinesWorkflow","description":"This workflow updates a cart's tax lines.","link":"../../../../core_flows.Workflows_Cart/page.mdx#updatetaxlinesworkflow","depth":4},{"type":"workflow","name":"updateCartPromotionsWorkflow","description":"This workflow updates a cart's promotions.","link":"../../../../core_flows.Workflows_Cart/page.mdx#updatecartpromotionsworkflow","depth":5},{"type":"workflow","name":"refreshPaymentCollectionForCartWorkflow","description":"This workflow refreshes the payment collections of a cart.","link":"../../../../core_flows.Workflows_Cart/page.mdx#refreshpaymentcollectionforcartworkflow","depth":6},{"type":"hook","name":"cartUpdated","description":"This step is a hook that you can inject custom functionality into.\n\n","link":"#cartUpdated","depth":7}]}} />
## Input
<TypeList types={[{"name":"UpdateCartWorkflowInputDTO & AdditionalData","type":"`UpdateCartWorkflowInputDTO` & [AdditionalData](../../../../../types/HttpTypes/types/types.HttpTypes.AdditionalData/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"UpdateCartWorkflowInputDTO","type":"`UpdateCartWorkflowInputDTO`","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="updateCartWorkflow"/>
## 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="updateCartWorkflow"/>
## Hooks
### cartUpdated
#### Example
```ts
import { updateCartWorkflow } from "@medusajs/core-flows"
updateCartWorkflow.hooks.cartUpdated(
async (({ cart, 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":"cart","type":"`any`","description":"","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="cartUpdated"/>

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# addShippingMethodToCartWorkflowId
`Const` **addShippingMethodToCartWorkflowId**: `"add-shipping-method-to-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# addToCartWorkflowId
`Const` **addToCartWorkflowId**: `"add-to-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# completeCartWorkflowId
`Const` **completeCartWorkflowId**: `"complete-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# confirmVariantInventoryWorkflowId
`Const` **confirmVariantInventoryWorkflowId**: `"confirm-item-inventory"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# createCartWorkflowId
`Const` **createCartWorkflowId**: `"create-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# createPaymentCollectionForCartWorkflowId
`Const` **createPaymentCollectionForCartWorkflowId**: `"create-payment-collection-for-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# listShippingOptionsForCartWorkflowId
`Const` **listShippingOptionsForCartWorkflowId**: `"list-shipping-options-for-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# refreshPaymentCollectionForCartWorkflowId
`Const` **refreshPaymentCollectionForCartWorkflowId**: `"refresh-payment-collection-for-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# updateCartPromotionsWorkflowId
`Const` **updateCartPromotionsWorkflowId**: `"update-cart-promotions"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# updateCartWorkflowId
`Const` **updateCartWorkflowId**: `"update-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# updateLineItemInCartWorkflowId
`Const` **updateLineItemInCartWorkflowId**: `"update-line-item-in-cart"`

View File

@@ -0,0 +1,5 @@
import { TypeList, WorkflowDiagram } from "docs-ui"
# updateTaxLinesWorkflowId
`Const` **updateTaxLinesWorkflowId**: `"update-tax-lines"`

File diff suppressed because one or more lines are too long