breaking: move shared HTTP utils to the framework (#9402)
Fixes: FRMW-2728, FRMW-2729 After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path. - applyParamsAsFilters - clearFiltersByKey - applyDefaultFilters - setContext - getQueryConfig - httpCompression - maybeApplyLinkFilter - refetchEntities - unlessPath - validateBody - validateQuery Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
co-authored by
Adrien de Peretti
parent
193f93464f
commit
48e00169d2
@@ -2,7 +2,7 @@ import { revokeApiKeysWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminRevokeApiKeyType } from "../../validators"
|
||||
import { refetchApiKey } from "../../helpers"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
import { refetchApiKey } from "../helpers"
|
||||
import { AdminUpdateApiKeyType } from "../validators"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ApiKeyType, MedusaError } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchApiKey } from "../../helpers"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import * as QueryConfig from "./query-config"
|
||||
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import {
|
||||
AdminCreateApiKey,
|
||||
AdminGetApiKeyParams,
|
||||
@@ -9,7 +12,6 @@ import {
|
||||
AdminRevokeApiKey,
|
||||
AdminUpdateApiKey,
|
||||
} from "./validators"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { createLinkBody } from "../../utils/validators"
|
||||
|
||||
export const adminApiKeyRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminCreateApiKeyType } from "./validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
import { addOrRemoveCampaignPromotionsWorkflow } from "@medusajs/core-flows"
|
||||
import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import {
|
||||
deleteCampaignsWorkflow,
|
||||
updateCampaignsWorkflow,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import { createLinkBody } from "../../utils/validators"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { createCampaignsWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostCancelClaimReqSchemaType } from "../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsItemsActionReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimItemsReqSchemaType } from "../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
import { refetchEntity } from "../../../../../../utils/refetch-entity"
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostReturnsRequestItemsActionReqSchemaType } from "../../../../../returns/validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config"
|
||||
import { AdminPostReturnsRequestItemsReqSchemaType } from "../../../../returns/validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostClaimsShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config"
|
||||
import { AdminPostReturnsShippingReqSchemaType } from "../../../../returns/validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsItemsActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsAddItemsReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsShippingReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../returns/query-config"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
import { refetchEntity } from "../../../utils/refetch-entity"
|
||||
import { AdminClaimResponse } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminGetOrdersOrderParams,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderClaimsReqSchemaType } from "./validators"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchCollection } from "../../helpers"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import {
|
||||
deleteCollectionsWorkflow,
|
||||
updateCollectionsWorkflow,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import * as QueryConfig from "./query-config"
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import {
|
||||
AdminCreateCollection,
|
||||
AdminGetCollectionParams,
|
||||
AdminGetCollectionsParams,
|
||||
AdminUpdateCollection,
|
||||
} from "./validators"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { createLinkBody } from "../../utils/validators"
|
||||
|
||||
export const adminCollectionRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
import { createCollectionsWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
MedusaError,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import { validateAndTransformQuery } from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import { AdminGetCurrencyParams, AdminGetCurrenciesParams } from "./validators"
|
||||
import { AdminGetCurrenciesParams, AdminGetCurrencyParams } from "./validators"
|
||||
|
||||
export const adminCurrencyRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -2,7 +2,7 @@ import { linkCustomersToCustomerGroupWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types"
|
||||
import { refetchCustomerGroup } from "../../helpers"
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
import { refetchCustomerGroup } from "../helpers"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import { createLinkBody } from "../../utils/validators"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { createCustomerGroupsWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import {
|
||||
deleteCustomerAddressesWorkflow,
|
||||
updateCustomerAddressesWorkflow,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createCustomerAddressesWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { MedusaError } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchCustomer } from "../helpers"
|
||||
import { AdminUpdateCustomerType } from "../validators"
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ import {
|
||||
} from "./validators"
|
||||
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
|
||||
export const adminCustomerRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchCustomer } from "./helpers"
|
||||
import { AdminCreateCustomerType } from "./validators"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { refetchOrder } from "../helpers"
|
||||
import { defaultAdminOrderFields } from "../query-config"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import { validateAndTransformBody } from "@medusajs/framework"
|
||||
import { validateAndTransformQuery } from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminCreateDraftOrder,
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminCreateDraftOrderType } from "./validators"
|
||||
import { refetchOrder } from "./helpers"
|
||||
import {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from "zod"
|
||||
import { AddressPayload, BigNumberInput } from "../../utils/common-validators"
|
||||
import {
|
||||
WithAdditionalData,
|
||||
createFindParams,
|
||||
createSelectParams,
|
||||
WithAdditionalData,
|
||||
} from "../../utils/validators"
|
||||
|
||||
export type AdminGetOrderParamsType = z.infer<typeof AdminGetOrderParams>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostCancelExchangeReqSchemaType } from "../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
import { refetchEntity } from "../../../../../../utils/refetch-entity"
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostExchangesRequestItemsReturnActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config"
|
||||
import { AdminPostExchangesReturnRequestItemsReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { AdminOrderPreview, HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config"
|
||||
import { AdminPostReturnsShippingReqSchemaType } from "../../../../returns/validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesItemsActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesAddItemsReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesShippingReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../returns/query-config"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -3,8 +3,8 @@ import { MedusaError } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
import { refetchEntity } from "../../../utils/refetch-entity"
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminGetOrdersOrderParams,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderExchangesReqSchemaType } from "./validators"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import { maybeApplyLinkFilter } from "@medusajs/framework/http"
|
||||
import { validateAndTransformQuery } from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import { AdminFulfillmentProvidersParams } from "./validators"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminGetFulfillmentProvidersParams>,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminUpdateFulfillmentSetServiceZonesType } from "../../../validators"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createServiceZonesWorkflow } from "@medusajs/core-flows"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { AdminCreateFulfillmentSetServiceZonesType } from "../../validators"
|
||||
import { refetchFulfillmentSet } from "../../helpers"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminCreateFulfillmentSetServiceZonesSchema,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cancelFulfillmentWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchFulfillment } from "../../helpers"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchFulfillment } from "../../helpers"
|
||||
import { AdminCreateShipmentType } from "../../validators"
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminCreateFulfillment,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { refetchFulfillment } from "./helpers"
|
||||
import { AdminCreateFulfillmentType } from "./validators"
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import {
|
||||
MedusaError,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
|
||||
import {
|
||||
deleteInventoryLevelsWorkflow,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
AdminCreateInventoryLocationLevelType,
|
||||
AdminUpdateInventoryLocationLevelType,
|
||||
} from "../../../validators"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
|
||||
import { bulkCreateDeleteLevelsWorkflow } from "@medusajs/core-flows"
|
||||
import { BatchMethodRequest } from "@medusajs/framework/types"
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
|
||||
import { createInventoryLevelsWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import {
|
||||
deleteInventoryItemWorkflow,
|
||||
updateInventoryItemsWorkflow,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import * as QueryConfig from "./query-config"
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import { MiddlewareRoute, unlessPath } from "@medusajs/framework/http"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import {
|
||||
AdminCreateInventoryItem,
|
||||
AdminCreateInventoryLocationLevel,
|
||||
@@ -11,9 +14,7 @@ import {
|
||||
AdminUpdateInventoryItem,
|
||||
AdminUpdateInventoryLocationLevel,
|
||||
} from "./validators"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { createBatchBody } from "../../utils/validators"
|
||||
import { unlessPath } from "../../utils/unless-path"
|
||||
|
||||
export const adminInventoryRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
|
||||
import { refreshInviteTokensWorkflow } from "@medusajs/core-flows"
|
||||
import { refetchInvite } from "../../helpers"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
|
||||
import { deleteInvitesWorkflow } from "@medusajs/core-flows"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { MedusaError } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminInviteAcceptType } from "../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -10,8 +10,10 @@ import {
|
||||
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { authenticate } from "../../../utils/middlewares/authenticate-middleware"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
|
||||
// TODO: Due to issues with our routing (and using router.use for applying middlewares), we have to opt-out of global auth in all routes, and then reapply it here.
|
||||
// See https://medusacorp.slack.com/archives/C025KMS13SA/p1716455350491879 for details.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminGetNotificationParamsType } from "../validators"
|
||||
import { refetchEntity } from "../../../utils/refetch-entity"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformQuery } from "../../utils/validate-query"
|
||||
import { validateAndTransformQuery } from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminGetNotificationParams,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
import { refetchEntities } from "../../utils/refetch-entity"
|
||||
refetchEntities,
|
||||
} from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderEditsItemsActionReqSchemaType } from "../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderEditsUpdateItemQuantityReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -4,7 +4,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderEditsAddItemsReqSchemaType } from "../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderEditsShippingActionReqSchemaType } from "../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderEditsShippingReqSchemaType } from "../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||
import { validateAndTransformBody } from "@medusajs/framework"
|
||||
import {
|
||||
AdminPostOrderEditsAddItemsReqSchema,
|
||||
AdminPostOrderEditsItemsActionReqSchema,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderEditsReqSchemaType } from "./validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdditionalData>,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminOrderCancelFulfillmentType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
import { refetchEntity } from "../../../../../../utils/refetch-entity"
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminOrderCreateShipmentType } from "../../../../validators"
|
||||
import { AdditionalData, HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminOrderCreateFulfillmentType } from "../../validators"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Modules } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../types/routing"
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user