docs: fix imports across docs
This commit is contained in:
+1
-1
@@ -176,7 +176,7 @@ You configure the properties accepted in `additional_data` in the `src/api/middl
|
||||

|
||||
|
||||
```ts title="src/api/middlewares.ts"
|
||||
import { defineMiddlewares } from "@medusajs/medusa"
|
||||
import { defineMiddlewares } from "@medusajs/framework/http"
|
||||
import { z } from "zod"
|
||||
|
||||
export default defineMiddlewares({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -49,7 +49,7 @@ export const highlights = [
|
||||
import {
|
||||
defineMiddlewares,
|
||||
authenticate,
|
||||
} from "@medusajs/medusa"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export default defineMiddlewares({
|
||||
routes: [
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user