docs: fix imports across docs

This commit is contained in:
Shahed Nasser committed 2024-12-09 15:10:38 +02:00
1 parent 8dedb97e40
commit f4b45b8080
21 files changed
+61 -61

No files matched your search

@@ -54,7 +54,7 @@ export const highlights = [
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -192,7 +192,7 @@ export const middlewareHighlights = [
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -128,7 +128,7 @@ To pass the `custom_name` in the `additional_data` parameter, you must add a val
Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -384,7 +384,7 @@ The `updateCartWorkflow` is executed by the [Update Cart API route](!api!/store#
To allow passing `custom_name` in the `additional_data` parameter of the update cart route, add in `src/api/middlewares.ts` a new route middleware configuration object:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -134,7 +134,7 @@ To pass the `custom_name` in the `additional_data` parameter, you must add a val
Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -396,7 +396,7 @@ The `updateCustomersWorkflow` is executed by the [Update Customer API route](!ap
To allow passing `custom_name` in the `additional_data` parameter of the update customer route, add in `src/api/middlewares.ts` a new route middleware configuration object:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -290,7 +290,7 @@ export async function POST(
```ts
import { NextResponse } from "next/server"
import { PriceListType } from "@medusajs/medusa"
import { PriceListType } from "@medusajs/framework/utils"
import { initialize as initializePricingModule } from "@medusajs/medusa/pricing"
import { PriceListType } from "@medusajs/framework/utils"
@@ -134,7 +134,7 @@ To pass the `custom_name` in the `additional_data` parameter, you must add a val
Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -402,7 +402,7 @@ The `updateProductsWorkflow` is executed by the [Update Product API route](!api!
To allow passing `custom_name` in the `additional_data` parameter of the update product route, add in `src/api/middlewares.ts` a new route middleware configuration object:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -134,7 +134,7 @@ To pass the `custom_name` in the `additional_data` parameter, you must add a val
Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -408,7 +408,7 @@ The `updatePromotionsWorkflow` is executed by the [Update Promotion API route](!
To allow passing `custom_name` in the `additional_data` parameter of the update promotion route, add in `src/api/middlewares.ts` a new route middleware configuration object:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
+12 -10
View File
@@ -244,11 +244,11 @@ A middleware is a function executed when a request is sent to an API Route.
Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import type {
MedusaNextFunction,
MedusaRequest,
MedusaResponse,
defineMiddlewares,
} from "@medusajs/framework/http"
export default defineMiddlewares({
@@ -296,11 +296,11 @@ export const middlewareMethodHighlights = [
]
```ts title="src/api/middlewares.ts" highlights={middlewareMethodHighlights}
import { defineMiddlewares } from "@medusajs/medusa"
import type {
MedusaNextFunction,
MedusaRequest,
MedusaResponse,
defineMiddlewares,
} from "@medusajs/framework/http"
export default defineMiddlewares({
@@ -331,9 +331,11 @@ export const PostStoreCustomSchema = z.object({
2. Add a validation middleware to the custom route in `src/api/middlewares.ts`:
```ts title="src/api/middlewares.ts" highlights={[["11", "validateAndTransformBody"]]}
import { defineMiddlewares } from "@medusajs/medusa"
import { validateAndTransformBody } from "@medusajs/framework/utils"
```ts title="src/api/middlewares.ts" highlights={[["13", "validateAndTransformBody"]]}
import {
validateAndTransformBody,
defineMiddlewares
} from "@medusajs/framework/http"
import { PostStoreCustomSchema } from "./custom/validators"
export default defineMiddlewares({
@@ -385,7 +387,7 @@ Find this example in details in [this documentation](!docs!/learn/customization/
1. Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts" highlights={[["10", "brand_id", "Replace with your custom field."]]}
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
export default defineMiddlewares({
@@ -444,7 +446,7 @@ Add the following middleware in `src/api/middlewares.ts`:
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -473,7 +475,7 @@ Add the following middleware in `src/api/middlewares.ts`:
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -623,11 +625,11 @@ By default, Medusa configures CORS for all routes starting with `/admin`, `/stor
To configure CORS for routes under other prefixes, create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import type {
MedusaNextFunction,
MedusaRequest,
MedusaResponse,
defineMiddlewares
} from "@medusajs/framework/http"
import { ConfigModule } from "@medusajs/framework/types"
import { parseCorsOrigins } from "@medusajs/framework/utils"
@@ -3444,7 +3446,7 @@ export async function POST(
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -704,10 +704,10 @@ This defines the expected request body schema.
Finally, create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import {
defineMiddlewares,
validateAndTransformBody,
} from "@medusajs/framework"
} from "@medusajs/framework/http"
import { createDigitalProductsSchema } from "./validation-schemas"
export default defineMiddlewares({
@@ -345,7 +345,7 @@ For example, suppose an administrator changes the product data in the ERP system
Then, create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts"
import { defineMiddlewares } from "@medusajs/medusa"
import { defineMiddlewares } from "@medusajs/framework/http"
import { raw } from "body-parser"
export default defineMiddlewares({
@@ -967,7 +967,7 @@ Create the file `src/api/middlewares.ts` with the following content:
import {
authenticate,
defineMiddlewares,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -2646,7 +2646,7 @@ Then, create the file `src/api/deliveries/[id]/middlewares.ts` with the followin
import {
authenticate,
defineMiddlewares,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { isDeliveryRestaurant } from "../../utils/is-delivery-restaurant"
export default defineMiddlewares({
@@ -468,7 +468,7 @@ Next, create the file `src/api/middlewares.ts` with the following content:
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
export default defineMiddlewares({
routes: [
@@ -723,10 +723,8 @@ Finally, in `src/api/middlewares.ts`, apply a middleware on the create products
import {
defineMiddlewares,
authenticate,
} from "@medusajs/medusa"
import {
validateAndTransformBody,
} from "@medusajs/framework/utils"
} from "@medusajs/framework/http"
import {
AdminCreateProduct,
} from "@medusajs/medusa/api/admin/products/validators"
+12 -12
View File
@@ -61,7 +61,7 @@ export const generatedEditDates = {
"app/commerce-modules/pricing/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/pricing/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/pricing/concepts/page.mdx": "2024-10-09T13:37:25.678Z",
"app/commerce-modules/pricing/examples/page.mdx": "2024-10-09T13:32:48.501Z",
"app/commerce-modules/pricing/examples/page.mdx": "2024-12-09T13:04:57.713Z",
"app/commerce-modules/pricing/price-calculation/page.mdx": "2024-10-09T13:43:14.038Z",
"app/commerce-modules/pricing/price-rules/page.mdx": "2024-10-09T13:38:47.112Z",
"app/commerce-modules/pricing/tax-inclusive-pricing/page.mdx": "2024-10-09T13:48:23.261Z",
@@ -126,11 +126,11 @@ export const generatedEditDates = {
"app/nextjs-starter/page.mdx": "2024-07-01T10:21:19+03:00",
"app/recipes/b2b/page.mdx": "2024-10-03T13:07:44.153Z",
"app/recipes/commerce-automation/page.mdx": "2024-10-16T08:52:01.585Z",
"app/recipes/digital-products/examples/standard/page.mdx": "2024-10-16T08:52:12.991Z",
"app/recipes/digital-products/examples/standard/page.mdx": "2024-12-09T12:57:50.356Z",
"app/recipes/digital-products/page.mdx": "2024-10-03T13:07:44.147Z",
"app/recipes/ecommerce/page.mdx": "2024-10-22T11:01:01.218Z",
"app/recipes/integrate-ecommerce-stack/page.mdx": "2024-10-16T08:52:16.760Z",
"app/recipes/marketplace/examples/vendors/page.mdx": "2024-11-27T10:30:50.653Z",
"app/recipes/integrate-ecommerce-stack/page.mdx": "2024-12-09T13:03:35.846Z",
"app/recipes/marketplace/examples/vendors/page.mdx": "2024-12-09T13:03:48.165Z",
"app/recipes/marketplace/page.mdx": "2024-10-03T13:07:44.153Z",
"app/recipes/multi-region-store/page.mdx": "2024-10-03T13:07:13.813Z",
"app/recipes/omnichannel/page.mdx": "2024-10-03T13:07:14.384Z",
@@ -208,9 +208,9 @@ export const generatedEditDates = {
"app/commerce-modules/auth/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/auth/auth-flows/page.mdx": "2024-09-05T08:50:11.671Z",
"app/commerce-modules/auth/_events/page.mdx": "2024-07-03T19:27:13+03:00",
"app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx": "2024-10-08T07:08:43.428Z",
"app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx": "2024-12-09T13:04:01.129Z",
"app/commerce-modules/api-key/page.mdx": "2024-10-07T13:57:33.042Z",
"app/commerce-modules/auth/create-actor-type/page.mdx": "2024-10-08T07:31:11.256Z",
"app/commerce-modules/auth/create-actor-type/page.mdx": "2024-12-09T13:04:00.460Z",
"app/architectural-modules/page.mdx": "2024-05-28T13:25:03+03:00",
"app/architectural-modules/workflow-engine/redis/page.mdx": "2024-10-15T12:50:59.507Z",
"app/commerce-modules/api-key/examples/page.mdx": "2024-10-15T14:58:58.994Z",
@@ -624,7 +624,7 @@ export const generatedEditDates = {
"app/medusa-cli/commands/start/page.mdx": "2024-08-28T10:44:19.952Z",
"app/medusa-cli/commands/telemtry/page.mdx": "2024-08-28T11:25:08.553Z",
"app/medusa-cli/commands/user/page.mdx": "2024-08-28T10:44:52.489Z",
"app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-10-16T08:52:21.948Z",
"app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-12-09T13:03:42.960Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateCustomerGroup/page.mdx": "2024-10-23T07:15:27.984Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateReservation/page.mdx": "2024-08-30T00:11:02.342Z",
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCustomerGroup/page.mdx": "2024-10-23T07:15:27.980Z",
@@ -2197,15 +2197,15 @@ export const generatedEditDates = {
"app/commerce-modules/auth/reset-password/page.mdx": "2024-11-27T13:33:55.940Z",
"app/storefront-development/customers/reset-password/page.mdx": "2024-09-25T10:21:46.647Z",
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2024-10-08T08:05:36.596Z",
"app/commerce-modules/cart/extend/page.mdx": "2024-10-08T11:22:22.523Z",
"app/commerce-modules/cart/extend/page.mdx": "2024-12-09T13:03:59.728Z",
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2024-10-08T08:22:35.190Z",
"app/commerce-modules/customer/extend/page.mdx": "2024-10-08T14:18:55.407Z",
"app/commerce-modules/customer/extend/page.mdx": "2024-12-09T13:03:59.045Z",
"app/commerce-modules/fulfillment/links-to-other-modules/page.mdx": "2024-10-08T14:58:24.935Z",
"app/commerce-modules/inventory/links-to-other-modules/page.mdx": "2024-10-08T15:18:30.109Z",
"app/commerce-modules/pricing/links-to-other-modules/page.mdx": "2024-10-09T13:51:49.986Z",
"app/commerce-modules/product/extend/page.mdx": "2024-10-09T14:43:54.303Z",
"app/commerce-modules/product/extend/page.mdx": "2024-12-09T13:03:58.313Z",
"app/commerce-modules/product/links-to-other-modules/page.mdx": "2024-10-09T14:14:09.401Z",
"app/commerce-modules/promotion/extend/page.mdx": "2024-10-09T15:17:01.513Z",
"app/commerce-modules/promotion/extend/page.mdx": "2024-12-09T13:03:57.544Z",
"app/commerce-modules/promotion/links-to-other-modules/page.mdx": "2024-10-09T14:51:37.194Z",
"app/commerce-modules/order/edit/page.mdx": "2024-10-09T08:50:05.334Z",
"app/commerce-modules/order/links-to-other-modules/page.mdx": "2024-10-09T11:23:05.488Z",
@@ -2267,7 +2267,7 @@ export const generatedEditDates = {
"app/commerce-modules/sales-channel/links-to-other-modules/page.mdx": "2024-10-15T14:25:29.097Z",
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2024-10-15T14:33:11.483Z",
"app/commerce-modules/store/links-to-other-modules/page.mdx": "2024-06-26T07:19:49.931Z",
"app/examples/page.mdx": "2024-10-16T15:47:38.345Z",
"app/examples/page.mdx": "2024-12-09T13:03:13.773Z",
"app/medusa-cli/commands/build/page.mdx": "2024-11-11T11:00:49.665Z",
"app/js-sdk/page.mdx": "2024-10-16T12:12:34.512Z",
"references/js_sdk/admin/Admin/properties/js_sdk.admin.Admin.apiKey/page.mdx": "2024-10-25T15:35:28.397Z",