docs: update imports of middlewares and http types (#9440)

This commit is contained in:
Shahed Nasser
2024-10-03 15:56:58 +00:00
committed by GitHub
parent a461e21ae7
commit 00a51b59b1
71 changed files with 213 additions and 213 deletions
@@ -180,7 +180,7 @@ export const restockModelHighlights = [
import type {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import RestockNotificationModuleService
from "../../../modules/restock-notification/service"
@@ -242,7 +242,7 @@ export const subscriberHighlights = [
import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/medusa"
} from "@medusajs/framework"
import {
IInventoryService,
INotificationModuleService,
@@ -762,7 +762,7 @@ The `order.placed` event is currently not emitted.
import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/medusa"
} from "@medusajs/framework"
import {
Modules,
} from "@medusajs/framework/utils"
@@ -876,7 +876,7 @@ export const newsletterHighlights = [
import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/medusa"
} from "@medusajs/framework"
import {
Modules,
} from "@medusajs/framework/utils"
@@ -287,7 +287,7 @@ Create the file `src/api/admin/digital-products/route.ts` with the following con
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
export const GET = async (
@@ -690,7 +690,7 @@ Finally, create the file `src/api/middlewares.ts` with the following content:
import { defineMiddlewares } from "@medusajs/medusa"
import {
validateAndTransformBody,
} from "@medusajs/medusa/api/utils/validate-body"
} from "@medusajs/framework/utils"
import { createDigitalProductsSchema } from "./validation-schemas"
export default defineMiddlewares({
@@ -743,7 +743,7 @@ export const uploadHighlights = [
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { uploadFilesWorkflow } from "@medusajs/medusa/core-flows"
import { MedusaError } from "@medusajs/framework/utils"
@@ -1780,7 +1780,7 @@ The workflow returns the Medusa order and the digital product order, if created.
Next, create the file `src/api/store/carts/[id]/complete/route.ts` with the following content:
```ts title="src/api/store/carts/[id]/complete/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import createDigitalProductOrderWorkflow from "../../../../../workflows/create-digital-product-order"
export const POST = async (
@@ -2039,7 +2039,7 @@ Create the file `src/subscribers/handle-digital-order.ts` with the following con
import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/medusa"
} from "@medusajs/framework"
import {
fulfillDigitalOrderWorkflow,
} from "../workflows/fulfill-digital-order"
@@ -2091,7 +2091,7 @@ export const previewRouteHighlights = [
import {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
Modules,
} from "@medusajs/framework/utils"
@@ -2157,7 +2157,7 @@ export const purchasedDpHighlights = [
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
ContainerRegistrationKeys,
} from "@medusajs/framework/utils"
@@ -2213,7 +2213,7 @@ export const downloadUrlHighlights = [
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
Modules,
ContainerRegistrationKeys,
@@ -259,7 +259,7 @@ export const workflowHighlights = [
import type {
SubscriberConfig,
SubscriberArgs,
} from "@medusajs/medusa"
} from "@medusajs/framework"
import createProductWorkflow from "../workflows/create-product"
export default async function handleProductUpdate({
@@ -309,7 +309,7 @@ For example, suppose an administrator changes the product data in the ERP system
import {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
IProductModuleService,
UpdateProductDTO
@@ -553,7 +553,7 @@ export const createRestaurantRouteHighlights = [
]
```ts title="src/api/restaurants/route.ts" highlights={createRestaurantRouteHighlights} collapsibleLines="1-10" expandMoreLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import {
CreateRestaurantDTO,
@@ -629,7 +629,7 @@ In the file `src/api/restaurants/route.ts` add the following API route:
```ts title="src/api/restaurants/route.ts"
// other imports...
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import {
ContainerRegistrationKeys,
QueryContext,
@@ -908,7 +908,7 @@ Then, create the file `src/api/users/route.ts` with the following content:
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
createUserWorkflow,
CreateUserWorkflowInput,
@@ -1175,7 +1175,7 @@ Finally, add the API route that uses the workflow at `src/api/restaurants/[id]/a
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
deleteRestaurantAdminWorkflow,
} from "../../../../../workflows/restaurant/workflows/delete-restaurant-admin"
@@ -1311,7 +1311,7 @@ In the workflow, you:
Create the file `src/api/restaurants/[id]/products/route.ts` with the following content:
```ts title="src/api/restaurants/[id]/products/route.ts" collapsibleLines="1-9" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import {
AdminCreateProduct,
} from "@medusajs/medusa/api/admin/products/validators"
@@ -2080,7 +2080,7 @@ export const createDeliveryRouteHighlights = [
]
```ts title="src/api/store/deliveries/route.ts" highlights={createDeliveryRouteHighlights} collapsibleLines="1-7" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import zod from "zod"
import { DELIVERY_MODULE } from "../../../modules/delivery"
@@ -2509,7 +2509,7 @@ export const acceptRouteHighlights = [
]
```ts title="src/api/deliveries/[id]/accept/route.ts" highlights={acceptRouteHighlights} collapsibleLines="1-6" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { DeliveryStatus } from "../../../../modules/delivery/types"
import { notifyRestaurantStepId } from "../../../../workflows/delivery/steps/notify-restaurant"
@@ -2574,7 +2574,7 @@ import {
AuthenticatedMedusaRequest,
MedusaNextFunction,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
ContainerRegistrationKeys,
} from "@medusajs/framework/utils"
@@ -2755,7 +2755,7 @@ import {
AuthenticatedMedusaRequest,
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
claimDeliveryWorkflow,
} from "../../../../workflows/delivery/workflows/claim-delivery"
@@ -2843,7 +2843,7 @@ export const prepareRouteHighlights = [
]
```ts title="src/api/deliveries/[id]/prepare/route.ts" highlights={prepareRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { DeliveryStatus } from "../../../../modules/delivery/types"
import {
@@ -2933,7 +2933,7 @@ export const readyRouteHighlights = [
]
```ts title="src/api/deliveries/[id]/ready/route.ts" highlights={readyRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { DeliveryStatus } from "../../../../modules/delivery/types"
import {
@@ -3025,7 +3025,7 @@ export const pickUpRouteHighlights = [
]
```ts title="src/api/deliveries/[id]/pick-up/route.ts" highlights={pickUpRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { DeliveryStatus } from "../../../../modules/delivery/types"
import {
@@ -3076,7 +3076,7 @@ import {
AuthenticatedMedusaRequest,
MedusaNextFunction,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { DELIVERY_MODULE } from "../../modules/delivery"
export const isDeliveryDriver = async (
@@ -3165,7 +3165,7 @@ export const completeRouteHighlights = [
]
```ts title="src/api/deliveries/[id]/complete/route.ts" highlights={completeRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { DeliveryStatus } from "../../../../modules/delivery/types"
import {
@@ -3258,7 +3258,7 @@ So, create the file `src/api/deliveries/subscribe/route.ts` with the following c
import {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
Modules,
} from "@medusajs/framework/utils"
@@ -3337,7 +3337,7 @@ The storefront UI will also need to retrieve the delivery. So, youll create a
Create the file `src/api/deliveries/[id]/route.ts` with the following content:
```ts title="src/api/deliveries/[id]/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { DELIVERY_MODULE } from "../../../../modules/delivery"
export async function GET(req: MedusaRequest, res: MedusaResponse) {
@@ -359,7 +359,7 @@ export const vendorRouteSchemaHighlights = [
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { z } from "zod"
import MarketplaceModuleService from "../../modules/marketplace/service"
@@ -567,7 +567,7 @@ export const retrieveProductHighlights = [
]
```ts title="src/api/vendors/products/route.ts" highlights={retrieveProductHighlights}
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import {
ContainerRegistrationKeys,
} from "@medusajs/framework/utils"
@@ -712,7 +712,7 @@ import {
} from "@medusajs/medusa"
import {
validateAndTransformBody,
} from "@medusajs/medusa/api/utils/validate-body"
} from "@medusajs/framework/utils"
import {
AdminCreateProduct,
} from "@medusajs/medusa/api/admin/products/validators"
@@ -1205,7 +1205,7 @@ Create the file `src/api/store/carts/[id]/complete/route.ts` with the following
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import createVendorOrdersWorkflow from "../../../../../workflows/marketplace/create-vendor-orders"
export const POST = async (
@@ -1249,7 +1249,7 @@ export const getOrderHighlights = [
]
```ts title="src/api/vendors/orders/route.ts" highlights={getOrderHighlights} collapsibleLines="1-6" expandMoreLabel="Show Imports"
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
import { getOrdersListWorkflow } from "@medusajs/medusa/core-flows"
import MarketplaceModuleService from "../../../modules/marketplace/service"
+1 -1
View File
@@ -76,7 +76,7 @@ Heres an example of creating a custom API Route at `/store/pos/search-barcode
import type {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { Modules } from "@medusajs/framework/utils"
import { IProductModuleService } from "@medusajs/framework/types"
@@ -662,7 +662,7 @@ export const completeCartHighlights = [
import {
MedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import {
ContainerRegistrationKeys,
MedusaError,
@@ -977,7 +977,7 @@ export const listSubscriptionsAdminHighlight = [
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
export const GET = async (
@@ -1038,7 +1038,7 @@ export const getSubscriptionsAdminHighlight = [
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
export const GET = async (
@@ -2119,7 +2119,7 @@ Create the file `src/api/store/customers/me/subscriptions/route.ts` with the fol
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
export const GET = async (
@@ -2183,7 +2183,7 @@ Then, create the file `src/api/store/customers/me/subscriptions/[id]/route.ts` w
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/medusa"
} from "@medusajs/framework/http"
import SubscriptionModuleService from "../../../../../../modules/subscription/service"
import {
SUBSCRIPTION_MODULE,