From f4b45b80800883aca276fce27a8be3b4f5b3a972 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 9 Dec 2024 15:10:38 +0200 Subject: [PATCH] docs: fix imports across docs --- .../extend-create-product/page.mdx | 2 +- .../api-routes/additional-data/page.mdx | 2 +- .../fundamentals/api-routes/cors/page.mdx | 2 +- .../api-routes/middlewares/page.mdx | 10 ++++---- .../api-routes/protected-routes/page.mdx | 2 +- .../api-routes/validation/page.mdx | 4 ++-- .../fundamentals/module-links/query/page.mdx | 2 +- www/apps/book/generated/edit-dates.mjs | 14 +++++------ .../auth-identity-and-actor-types/page.mdx | 2 +- .../auth/create-actor-type/page.mdx | 2 +- .../app/commerce-modules/cart/extend/page.mdx | 4 ++-- .../commerce-modules/customer/extend/page.mdx | 4 ++-- .../pricing/examples/page.mdx | 2 +- .../commerce-modules/product/extend/page.mdx | 4 ++-- .../promotion/extend/page.mdx | 4 ++-- www/apps/resources/app/examples/page.mdx | 22 +++++++++-------- .../examples/standard/page.mdx | 4 ++-- .../integrate-ecommerce-stack/page.mdx | 2 +- .../examples/restaurant-delivery/page.mdx | 4 ++-- .../marketplace/examples/vendors/page.mdx | 6 ++--- www/apps/resources/generated/edit-dates.mjs | 24 +++++++++---------- 21 files changed, 61 insertions(+), 61 deletions(-) diff --git a/www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx b/www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx index 512744fdd4..d15925a15c 100644 --- a/www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx +++ b/www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx @@ -176,7 +176,7 @@ You configure the properties accepted in `additional_data` in the `src/api/middl ![Directory structure after adding the middelwares file](https://res.cloudinary.com/dza7lstvk/image/upload/v1733386868/Medusa%20Book/brands-middleware-dir-overview_uczos1.jpg) ```ts title="src/api/middlewares.ts" -import { defineMiddlewares } from "@medusajs/medusa" +import { defineMiddlewares } from "@medusajs/framework/http" import { z } from "zod" export default defineMiddlewares({ diff --git a/www/apps/book/app/learn/fundamentals/api-routes/additional-data/page.mdx b/www/apps/book/app/learn/fundamentals/api-routes/additional-data/page.mdx index 86d9c4cf0b..e57debb477 100644 --- a/www/apps/book/app/learn/fundamentals/api-routes/additional-data/page.mdx +++ b/www/apps/book/app/learn/fundamentals/api-routes/additional-data/page.mdx @@ -64,7 +64,7 @@ To do that, use the middleware route object defined in `src/api/middlewares.ts`. For example, 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({ diff --git a/www/apps/book/app/learn/fundamentals/api-routes/cors/page.mdx b/www/apps/book/app/learn/fundamentals/api-routes/cors/page.mdx index 98f935959a..52ec1528c1 100644 --- a/www/apps/book/app/learn/fundamentals/api-routes/cors/page.mdx +++ b/www/apps/book/app/learn/fundamentals/api-routes/cors/page.mdx @@ -81,7 +81,7 @@ For example: export const highlights = [["25", "parseCorsOrigins", "A utility function that parses the CORS configurations in `medusa-config.ts`"]] ```ts title="src/api/middlewares.ts" highlights={highlights} collapsibleLines="1-10" expandButtonLabel="Show Imports" -import { defineMiddlewares } from "@medusajs/medusa" +import { defineMiddlewares } from "@medusajs/framework/http" import type { MedusaNextFunction, MedusaRequest, diff --git a/www/apps/book/app/learn/fundamentals/api-routes/middlewares/page.mdx b/www/apps/book/app/learn/fundamentals/api-routes/middlewares/page.mdx index ebdf7be382..60a2d247e0 100644 --- a/www/apps/book/app/learn/fundamentals/api-routes/middlewares/page.mdx +++ b/www/apps/book/app/learn/fundamentals/api-routes/middlewares/page.mdx @@ -22,13 +22,13 @@ As Medusa's server is based on Express, you can use any [Express middleware](htt ## How to Create a Middleware? -Middlewares are defined in the special file `src/api/middlewares.ts`. Use the `defineMiddlewares` function imported from `@medusajs/medusa` to define the middlewares, and export its value. +Middlewares are defined in the special file `src/api/middlewares.ts`. Use the `defineMiddlewares` function from the Medusa Framework to define the middlewares, and export its value. For example: ```ts title="src/api/middlewares.ts" -import { defineMiddlewares } from "@medusajs/medusa" import type { + defineMiddlewares, MedusaNextFunction, MedusaRequest, MedusaResponse, @@ -118,11 +118,11 @@ For example: export const pathParamHighlights = [["11", ":id", "Indicates that the API route accepts an `id` path parameter."]] ```ts title="src/api/middlewares.ts" collapsibleLines="1-7" expandMoreLabel="Show Imports" highlights={pathParamHighlights} -import { defineMiddlewares } from "@medusajs/medusa" import type { MedusaNextFunction, MedusaRequest, MedusaResponse, + defineMiddlewares, } from "@medusajs/framework/http" export default defineMiddlewares({ @@ -150,11 +150,11 @@ For example: export const highlights = [["12", "method", "Apply the middleware only on `POST` requests"]] ```ts title="src/api/middlewares.ts" highlights={highlights} collapsibleLines="1-7" expandButtonLabel="Show Imports" -import { defineMiddlewares } from "@medusajs/medusa" import type { MedusaNextFunction, MedusaRequest, MedusaResponse, + defineMiddlewares, } from "@medusajs/framework/http" export default defineMiddlewares({ @@ -183,11 +183,11 @@ A middleware whose `matcher` pattern doesn't end with a backslash won't be appli For example, consider you have the following middleware: ```ts collapsibleLines="1-7" expandMoreLabel="Show Imports" -import { defineMiddlewares } from "@medusajs/medusa" import type { MedusaNextFunction, MedusaRequest, MedusaResponse, + defineMiddlewares, } from "@medusajs/framework/http" export default defineMiddlewares({ diff --git a/www/apps/book/app/learn/fundamentals/api-routes/protected-routes/page.mdx b/www/apps/book/app/learn/fundamentals/api-routes/protected-routes/page.mdx index 920cb66a4e..f3a9765e8a 100644 --- a/www/apps/book/app/learn/fundamentals/api-routes/protected-routes/page.mdx +++ b/www/apps/book/app/learn/fundamentals/api-routes/protected-routes/page.mdx @@ -49,7 +49,7 @@ export const highlights = [ import { defineMiddlewares, authenticate, -} from "@medusajs/medusa" +} from "@medusajs/framework/http" export default defineMiddlewares({ routes: [ diff --git a/www/apps/book/app/learn/fundamentals/api-routes/validation/page.mdx b/www/apps/book/app/learn/fundamentals/api-routes/validation/page.mdx index ca6203b2a0..da66e40201 100644 --- a/www/apps/book/app/learn/fundamentals/api-routes/validation/page.mdx +++ b/www/apps/book/app/learn/fundamentals/api-routes/validation/page.mdx @@ -53,8 +53,8 @@ To use this schema for validating the body parameters of requests to `/custom`, For example, 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/http" import { PostStoreCustomSchema } from "./custom/validators" @@ -183,9 +183,9 @@ Next, you'll use the schema to validate incoming requests' query parameters to t Add the `validateAndTransformQuery` middleware to the API route in the file `src/api/middlewares.ts`: ```ts title="src/api/middlewares.ts" -import { defineMiddlewares } from "@medusajs/medusa" import { validateAndTransformQuery, + defineMiddlewares } from "@medusajs/framework/http" import { PostStoreCustomSchema } from "./custom/validators" diff --git a/www/apps/book/app/learn/fundamentals/module-links/query/page.mdx b/www/apps/book/app/learn/fundamentals/module-links/query/page.mdx index df971ce06e..35e4316dcb 100644 --- a/www/apps/book/app/learn/fundamentals/module-links/query/page.mdx +++ b/www/apps/book/app/learn/fundamentals/module-links/query/page.mdx @@ -298,9 +298,9 @@ Using this middleware allows you to have default configurations for retrieved fi The first step is to use the `validateAndTransformQuery` middleware on the `GET` route. You add the middleware in `src/api/middlewares.ts`: ```ts title="src/api/middlewares.ts" -import { defineMiddlewares } from "@medusajs/medusa" import { validateAndTransformQuery, + defineMiddlewares } from "@medusajs/framework/http" import { createFindParams } from "@medusajs/medusa/api/utils/validators" diff --git a/www/apps/book/generated/edit-dates.mjs b/www/apps/book/generated/edit-dates.mjs index de0b8b6712..7fc0e5bf7d 100644 --- a/www/apps/book/generated/edit-dates.mjs +++ b/www/apps/book/generated/edit-dates.mjs @@ -26,7 +26,7 @@ export const generatedEditDates = { "app/learn/fundamentals/admin/widgets/page.mdx": "2024-12-04T11:02:57.133Z", "app/learn/fundamentals/data-models/page.mdx": "2024-12-09T11:34:51.065Z", "app/learn/fundamentals/modules/remote-link/page.mdx": "2024-09-30T08:43:53.127Z", - "app/learn/fundamentals/api-routes/protected-routes/page.mdx": "2024-11-13T10:44:04.225Z", + "app/learn/fundamentals/api-routes/protected-routes/page.mdx": "2024-12-09T13:04:03.071Z", "app/learn/fundamentals/workflows/add-workflow-hook/page.mdx": "2024-10-21T13:30:21.371Z", "app/learn/fundamentals/events-and-subscribers/data-payload/page.mdx": "2024-10-21T13:30:21.369Z", "app/learn/fundamentals/data-models/default-properties/page.mdx": "2024-10-21T13:30:21.368Z", @@ -51,9 +51,9 @@ export const generatedEditDates = { "app/learn/fundamentals/api-routes/parameters/page.mdx": "2024-11-19T16:37:47.251Z", "app/learn/fundamentals/api-routes/http-methods/page.mdx": "2024-10-21T13:30:21.367Z", "app/learn/fundamentals/admin/tips/page.mdx": "2024-11-19T16:43:01.662Z", - "app/learn/fundamentals/api-routes/cors/page.mdx": "2024-10-21T13:30:21.366Z", + "app/learn/fundamentals/api-routes/cors/page.mdx": "2024-12-09T13:04:04.357Z", "app/learn/fundamentals/admin/ui-routes/page.mdx": "2024-12-04T11:02:57.133Z", - "app/learn/fundamentals/api-routes/middlewares/page.mdx": "2024-10-21T13:30:21.367Z", + "app/learn/fundamentals/api-routes/middlewares/page.mdx": "2024-12-09T13:04:03.712Z", "app/learn/fundamentals/modules/isolation/page.mdx": "2024-12-09T11:02:38.087Z", "app/learn/fundamentals/data-models/configure-properties/page.mdx": "2024-10-21T13:30:21.368Z", "app/learn/fundamentals/data-models/index/page.mdx": "2024-10-21T13:30:21.368Z", @@ -67,7 +67,7 @@ export const generatedEditDates = { "app/learn/debugging-and-testing/testing-tools/unit-tests/page.mdx": "2024-09-02T11:03:26.997Z", "app/learn/fundamentals/modules/service-constraints/page.mdx": "2024-11-19T16:37:47.253Z", "app/learn/fundamentals/api-routes/responses/page.mdx": "2024-10-21T13:30:21.367Z", - "app/learn/fundamentals/api-routes/validation/page.mdx": "2024-12-09T11:02:38.397Z", + "app/learn/fundamentals/api-routes/validation/page.mdx": "2024-12-09T13:04:02.426Z", "app/learn/fundamentals/api-routes/errors/page.mdx": "2024-10-21T13:30:21.367Z", "app/learn/fundamentals/admin/constraints/page.mdx": "2024-10-21T13:30:21.366Z", "app/learn/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-10-16T08:50:03.061Z", @@ -75,18 +75,18 @@ export const generatedEditDates = { "app/learn/fundamentals/module-links/custom-columns/page.mdx": "2024-11-20T14:32:09.764Z", "app/learn/fundamentals/module-links/directions/page.mdx": "2024-10-21T13:30:21.369Z", "app/learn/fundamentals/module-links/page.mdx": "2024-10-28T04:22:27.541Z", - "app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T10:38:41.169Z", + "app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T13:04:01.779Z", "app/learn/fundamentals/module-links/remote-link/page.mdx": "2024-10-28T04:22:21.328Z", "app/learn/fundamentals/modules/db-operations/page.mdx": "2024-12-04T11:02:57.134Z", "app/learn/fundamentals/modules/multiple-services/page.mdx": "2024-10-21T13:30:21.370Z", "app/learn/fundamentals/modules/page.mdx": "2024-12-09T11:02:37.696Z", "app/learn/debugging-and-testing/instrumentation/page.mdx": "2024-09-17T08:53:15.910Z", - "app/learn/fundamentals/api-routes/additional-data/page.mdx": "2024-12-09T10:46:28.589Z", + "app/learn/fundamentals/api-routes/additional-data/page.mdx": "2024-12-09T13:04:04.995Z", "app/learn/fundamentals/workflows/variable-manipulation/page.mdx": "2024-11-19T16:43:01.663Z", "app/learn/customization/custom-features/api-route/page.mdx": "2024-12-09T10:39:30.046Z", "app/learn/customization/custom-features/module/page.mdx": "2024-12-09T11:02:39.826Z", "app/learn/customization/custom-features/workflow/page.mdx": "2024-12-09T10:46:47.051Z", - "app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-12-09T11:02:39.423Z", + "app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-12-09T12:59:23.364Z", "app/learn/customization/custom-features/page.mdx": "2024-12-09T10:46:28.593Z", "app/learn/customization/customize-admin/page.mdx": "2024-12-09T11:02:38.801Z", "app/learn/customization/customize-admin/route/page.mdx": "2024-12-09T11:02:38.969Z", diff --git a/www/apps/resources/app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx index 0b0eab7c64..8f56549f37 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx @@ -54,7 +54,7 @@ export const highlights = [ import { defineMiddlewares, authenticate, -} from "@medusajs/medusa" +} from "@medusajs/framework/http" export default defineMiddlewares({ routes: [ diff --git a/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx b/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx index 978e51adeb..c0cfa65c6e 100644 --- a/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx @@ -192,7 +192,7 @@ export const middlewareHighlights = [ import { defineMiddlewares, authenticate, -} from "@medusajs/medusa" +} from "@medusajs/framework/http" export default defineMiddlewares({ routes: [ diff --git a/www/apps/resources/app/commerce-modules/cart/extend/page.mdx b/www/apps/resources/app/commerce-modules/cart/extend/page.mdx index 4f1e117252..c78ed65379 100644 --- a/www/apps/resources/app/commerce-modules/cart/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/extend/page.mdx @@ -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({ diff --git a/www/apps/resources/app/commerce-modules/customer/extend/page.mdx b/www/apps/resources/app/commerce-modules/customer/extend/page.mdx index d94fdb6ee5..2aaf0dda9f 100644 --- a/www/apps/resources/app/commerce-modules/customer/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/customer/extend/page.mdx @@ -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({ diff --git a/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx b/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx index 3564d99a8b..5284571f5f 100644 --- a/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx @@ -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" diff --git a/www/apps/resources/app/commerce-modules/product/extend/page.mdx b/www/apps/resources/app/commerce-modules/product/extend/page.mdx index ba9c52021d..d869fe6f1e 100644 --- a/www/apps/resources/app/commerce-modules/product/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/extend/page.mdx @@ -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({ diff --git a/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx b/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx index 0486882101..f8d773c3c8 100644 --- a/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx @@ -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({ diff --git a/www/apps/resources/app/examples/page.mdx b/www/apps/resources/app/examples/page.mdx index 3c5d490524..4737f9afb0 100644 --- a/www/apps/resources/app/examples/page.mdx +++ b/www/apps/resources/app/examples/page.mdx @@ -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: [ diff --git a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx index 7c99384d00..4c3243f8a3 100644 --- a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx @@ -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({ diff --git a/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx b/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx index 25ff01910b..46dd536223 100644 --- a/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx +++ b/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx @@ -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({ diff --git a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx index 0e776852d3..1961ee6266 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx @@ -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({ diff --git a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx index 37daae80e5..a97fcff307 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx @@ -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" diff --git a/www/apps/resources/generated/edit-dates.mjs b/www/apps/resources/generated/edit-dates.mjs index 2dd53d2d3b..2e86e056a1 100644 --- a/www/apps/resources/generated/edit-dates.mjs +++ b/www/apps/resources/generated/edit-dates.mjs @@ -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",