docs: fix incorrect hook details shown (#11225)
This commit is contained in:
1 parent
332ef06534
commit
386ce4b857
13 files changed
+127496
-112779
No files matched your search
+3
-3
@@ -197,9 +197,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { addToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
addToCartWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -210,4 +210,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddToCartWorkflowInputDTO](../../../../../types/interfaces/types.AddToCartWorkflowInputDTO/page.mdx)","description":"The details of adding items to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add items to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"items","type":"[CreateCartCreateLineItemDTO](../../../../../types/interfaces/types.CreateCartCreateLineItemDTO/page.mdx)[]","description":"The items to add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -161,9 +161,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { completeCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
completeCartWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -174,4 +174,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[CompleteCartWorkflowInput](../../../../types/core_flows.CompleteCartWorkflowInput/page.mdx)","description":"The data to complete a cart and place an order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the cart to complete.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -196,9 +196,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { createCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
createCartWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -209,7 +209,7 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"currency_code","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"region_id","type":"`string`","description":"","optional":false,"defaultValue":"data.region.id","expandable":false,"children":[]},{"name":"customer_id","type":"`string`","description":"The ID of the customer associated with the cart.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"sales_channel_id","type":"`string`","description":"The ID of the sales channel through which the cart is created.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"email","type":"`string`","description":"The email address of the cart's customer.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_address_id","type":"`string`","description":"The ID of the associated shipping address.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"billing_address_id","type":"`string`","description":"The ID of the associated billing address.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_address","type":"`string` \\| [CreateCartAddressDTO](../../../../../types/interfaces/types.CreateCartAddressDTO/page.mdx)","description":"The ID of an existing shipping address, or the details of a shipping address to create.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"billing_address","type":"`string` \\| [CreateCartAddressDTO](../../../../../types/interfaces/types.CreateCartAddressDTO/page.mdx)","description":"The ID of an existing billing address, or the details of a billing address to create.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`Record<string, unknown>`","description":"Custom key-value pairs related to the cart.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"items","type":"[CreateCartCreateLineItemDTO](../../../../../types/interfaces/types.CreateCartCreateLineItemDTO/page.mdx)[]","description":"The items to be added to the cart.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"promo_codes","type":"`string`[]","description":"The promotional codes applied on the cart.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"additional_data","type":"`Record<string, unknown>`","description":"Additional data that can be passed through the `additional_data` property in HTTP requests.\n\nLearn more in [this documentation](https://docs.medusajs.com/learn/fundamentals/api-routes/additional-data).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"currency_code","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"region_id","type":"`string`","description":"","optional":false,"defaultValue":"data.region.id","expandable":false,"children":[]},{"name":"items","type":"`any`[]","description":"","optional":false,"defaultValue":"data.lineItems","expandable":false,"children":[]},{"name":"customer_id","type":"`string`","description":"The ID of the customer associated with the cart.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"sales_channel_id","type":"`string`","description":"The ID of the sales channel through which the cart is created.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"email","type":"`string`","description":"The email address of the cart's customer.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_address_id","type":"`string`","description":"The ID of the associated shipping address.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"billing_address_id","type":"`string`","description":"The ID of the associated billing address.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_address","type":"`string` \\| [CreateCartAddressDTO](../../../../../types/interfaces/types.CreateCartAddressDTO/page.mdx)","description":"The ID of an existing shipping address, or the details of a shipping address to create.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"billing_address","type":"`string` \\| [CreateCartAddressDTO](../../../../../types/interfaces/types.CreateCartAddressDTO/page.mdx)","description":"The ID of an existing billing address, or the details of a billing address to create.","optional":true,"defaultValue":"","expandable":false,"childrenLine truncated
|
||||
|
||||
### cartCreated
|
||||
|
||||
|
||||
+3
-3
@@ -158,9 +158,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { refreshCartItemsWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
refreshCartItemsWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -171,4 +171,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[RefreshCartItemsWorkflowInput](../../../../types/core_flows.RefreshCartItemsWorkflowInput/page.mdx)","description":"The details of the cart to refresh.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The cart's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"promo_codes","type":"`string`[]","description":"The promotion codes applied on the cart.\nThese promotion codes will replace previously applied codes.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -149,9 +149,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { refreshCartShippingMethodsWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
refreshCartShippingMethodsWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -162,4 +162,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[RefreshCartShippingMethodsWorkflowInput](../../../../types/core_flows.RefreshCartShippingMethodsWorkflowInput/page.mdx)","description":"The details of the cart to refresh.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The cart's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -153,9 +153,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { refreshPaymentCollectionForCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
refreshPaymentCollectionForCartWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -166,4 +166,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[RefreshPaymentCollectionForCartWorklowInput](../../../../types/core_flows.RefreshPaymentCollectionForCartWorklowInput/page.mdx)","description":"The details of the cart to refresh.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The cart's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -159,9 +159,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { transferCartCustomerWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
transferCartCustomerWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -172,4 +172,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[TransferCartCustomerWorkflowInput](../../../../types/core_flows.TransferCartCustomerWorkflowInput/page.mdx)","description":"The cart ownership transfer details.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The cart's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"customer_id","type":"`string`","description":"The ID of the customer to transfer the cart to.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -162,9 +162,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { updateCartPromotionsWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
updateCartPromotionsWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -175,4 +175,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[UpdateCartPromotionsWorkflowInput](../../../../types/core_flows.UpdateCartPromotionsWorkflowInput/page.mdx)","description":"The details of the promotion updates on a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The cart's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"promo_codes","type":"`string`[]","description":"The promotion codes to add to the cart, remove from the cart,\nor replace all existing promotions in the cart.","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":"The action to perform with the specified promotion codes.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+3
-3
@@ -219,9 +219,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { updateCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
updateCartWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -232,7 +232,7 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"currency_code","type":"`any`","description":"","optional":false,"defaultValue":"data.region.currency_code","expandable":false,"children":[]},{"name":"region_id","type":"`any`","description":"","optional":false,"defaultValue":"data.region.id","expandable":false,"children":[]},{"name":"id","type":"`string`","description":"The ID of the cart to update.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"customer_id","type":"`null` \\| `string`","description":"The ID of the cart's customer.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"sales_channel_id","type":"`null` \\| `string`","description":"The ID of the cart's sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"email","type":"`null` \\| `string`","description":"The email address of the cart's customer.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Custom key-value pairs of data related to the cart.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"shipping_address","type":"`null` \\| [CreateAddressDTO](../../../../../cart/interfaces/cart.CreateAddressDTO/page.mdx) \\| [UpdateAddressDTO](../../../../../cart/interfaces/cart.UpdateAddressDTO/page.mdx)","description":"The cart's shipping address. You can either update the cart's existing shipping address, or create a new one.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"billing_address","type":"`null` \\| [CreateAddressDTO](../../../../../cart/interfaces/cart.CreateAddressDTO/page.mdx) \\| [UpdateAddressDTO](../../../../../cart/interfaces/cart.UpdateAddressDTO/page.mdx)","description":"The cart's billing address. You can either update the cart's existing billing address, or create a new one.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
|
||||
### cartUpdated
|
||||
|
||||
|
||||
+3
-3
@@ -171,9 +171,9 @@ This hook is executed before all operations. You can consume this hook to perfor
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
import { updateLineItemInCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
addShippingMethodToCartWorkflow.hooks.validate(
|
||||
updateLineItemInCartWorkflow.hooks.validate(
|
||||
(async ({ input, cart }, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
@@ -184,4 +184,4 @@ addShippingMethodToCartWorkflow.hooks.validate(
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[AddShippingMethodToCartWorkflowInput](../../../../interfaces/core_flows.AddShippingMethodToCartWorkflowInput/page.mdx)","description":"The data to add a shipping method to a cart.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart to add the shipping method to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object`[]","description":"The shipping options to create the shipping methods from and add to the cart.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
<TypeList types={[{"name":"input","type":"object","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[UpdateLineItemInCartWorkflowInputDTO](../../../../../types/interfaces/types.UpdateLineItemInCartWorkflowInputDTO/page.mdx)","description":"The details of the line item to update.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"cart_id","type":"`string`","description":"The ID of the cart that the line item belongs to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"item_id","type":"`string`","description":"The ID of the line item to update.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"update","type":"Partial<[UpdateLineItemDTO](../../../../../cart/interfaces/cart.UpdateLineItemDTO/page.mdx)>","description":"The details to update in the line item.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
+127439
-112746
File diff suppressed because it is too large.
Load diff
+16
-3
@@ -1,6 +1,6 @@
|
||||
import { MarkdownTheme } from "../../theme.js"
|
||||
import Handlebars from "handlebars"
|
||||
import { SignatureReflection } from "typedoc"
|
||||
import { DeclarationReflection, SignatureReflection } from "typedoc"
|
||||
import { cleanUpHookInput, getProjectChild } from "utils"
|
||||
import beautifyCode from "../../utils/beautify-code.js"
|
||||
|
||||
@@ -25,10 +25,23 @@ export default function (theme: MarkdownTheme) {
|
||||
Handlebars.helpers.incrementCurrentTitleLevel()
|
||||
|
||||
const hooksTitleLevel = Handlebars.helpers.titleLevel()
|
||||
const hookChildrenProperty = this.parent?.getChildByName("hooks")
|
||||
const hookChildren =
|
||||
hookChildrenProperty instanceof DeclarationReflection &&
|
||||
hookChildrenProperty.type?.type === "reflection"
|
||||
? hookChildrenProperty.type.declaration.children || []
|
||||
: []
|
||||
|
||||
hooks.forEach((hook) => {
|
||||
// show the hook's input
|
||||
const hookReflection = getProjectChild(theme.project!, hook.name)
|
||||
const hookReflection =
|
||||
hookChildren.find(
|
||||
(child) => child.name === hook.name && child.signatures?.length
|
||||
) ||
|
||||
((this.parent.getChildByName(hook.name) ||
|
||||
getProjectChild(
|
||||
theme.project!,
|
||||
hook.name
|
||||
)) as DeclarationReflection)
|
||||
|
||||
if (
|
||||
!hookReflection ||
|
||||
|
||||
@@ -296,6 +296,7 @@ class WorkflowsPlugin {
|
||||
inputSymbol: initializer.arguments[1].symbol as ts.Symbol,
|
||||
workflowName: workflowVarName,
|
||||
workflowComments,
|
||||
workflowReflection: workflowReflection.parent,
|
||||
})
|
||||
} else {
|
||||
const initializerReflection = findReflectionInNamespaces(
|
||||
@@ -483,12 +484,14 @@ class WorkflowsPlugin {
|
||||
inputSymbol,
|
||||
workflowName,
|
||||
workflowComments,
|
||||
workflowReflection,
|
||||
}: {
|
||||
stepId: string
|
||||
context: Context
|
||||
inputSymbol: ts.Symbol
|
||||
workflowName: string
|
||||
workflowComments?: CommentTag[]
|
||||
workflowReflection: DeclarationReflection
|
||||
}): DeclarationReflection {
|
||||
const declarationReflection = context.createDeclarationReflection(
|
||||
ReflectionKind.Function,
|
||||
@@ -576,6 +579,14 @@ class WorkflowsPlugin {
|
||||
])
|
||||
)
|
||||
|
||||
const hooksProperty = workflowReflection.getChildByName("hooks")
|
||||
if (
|
||||
hooksProperty?.isDeclaration() &&
|
||||
hooksProperty.type?.type === "reflection"
|
||||
) {
|
||||
hooksProperty.type.declaration.addChild(declarationReflection)
|
||||
}
|
||||
|
||||
return declarationReflection
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user