chore: use framework sub paths everywhere (#9253)
This commit is contained in:
committed by
GitHub
parent
48bea267dc
commit
a8e19faf8d
@@ -2,12 +2,12 @@ import {
|
||||
AuthenticationInput,
|
||||
ConfigModule,
|
||||
IAuthModuleService,
|
||||
} from "@medusajs/types"
|
||||
} from "@medusajs/framework/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
MedusaError,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
|
||||
import { generateJwtTokenForAuthIdentity } from "../../../utils/generate-jwt-token"
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ import {
|
||||
AuthenticationInput,
|
||||
ConfigModule,
|
||||
IAuthModuleService,
|
||||
} from "@medusajs/types"
|
||||
} from "@medusajs/framework/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
MedusaError,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
|
||||
import { generateJwtTokenForAuthIdentity } from "../../../utils/generate-jwt-token"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { generateResetPasswordTokenWorkflow } from "@medusajs/core-flows"
|
||||
import { ContainerRegistrationKeys } from "@medusajs/utils"
|
||||
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
|
||||
@@ -2,12 +2,12 @@ import {
|
||||
AuthenticationInput,
|
||||
ConfigModule,
|
||||
IAuthModuleService,
|
||||
} from "@medusajs/types"
|
||||
} from "@medusajs/framework/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
MedusaError,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
} from "@medusajs/framework/utils"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../types/routing"
|
||||
import { generateJwtTokenForAuthIdentity } from "../../utils/generate-jwt-token"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AuthenticatedMedusaRequest } from "@medusajs/framework"
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import { MedusaError, Modules } from "@medusajs/utils"
|
||||
import { AuthenticatedMedusaRequest } from "@medusajs/framework/http"
|
||||
import { IAuthModuleService } from "@medusajs/framework/types"
|
||||
import { MedusaError, Modules } from "@medusajs/framework/utils"
|
||||
import { MedusaResponse } from "../../../../../types/routing"
|
||||
|
||||
export const POST = async (
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { MiddlewareRoute } from "@medusajs/framework"
|
||||
import { authenticate } from "../../utils/middlewares/authenticate-middleware"
|
||||
import { authenticate, MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { validateScopeProviderAssociation } from "./utils/validate-scope-provider-association"
|
||||
import { validateToken } from "./utils/validate-token"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import { ContainerRegistrationKeys, Modules } from "@medusajs/utils"
|
||||
import { IAuthModuleService } from "@medusajs/framework/types"
|
||||
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AuthIdentityDTO } from "@medusajs/types"
|
||||
import { generateJwtToken } from "@medusajs/utils"
|
||||
import { AuthIdentityDTO } from "@medusajs/framework/types"
|
||||
import { generateJwtToken } from "@medusajs/framework/utils"
|
||||
|
||||
export function generateJwtTokenForAuthIdentity(
|
||||
{
|
||||
|
||||
@@ -2,9 +2,12 @@ import {
|
||||
MedusaNextFunction,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework"
|
||||
import { ConfigModule } from "@medusajs/types"
|
||||
import { ContainerRegistrationKeys, MedusaError } from "@medusajs/utils"
|
||||
} from "@medusajs/framework/http"
|
||||
import { ConfigModule } from "@medusajs/framework/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
MedusaError,
|
||||
} from "@medusajs/framework/utils"
|
||||
|
||||
// Middleware to validate that a scope is associated with a provider
|
||||
export const validateScopeProviderAssociation = () => {
|
||||
|
||||
@@ -3,10 +3,10 @@ import {
|
||||
MedusaNextFunction,
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework"
|
||||
import { ConfigModule, IAuthModuleService } from "@medusajs/types"
|
||||
import { ContainerRegistrationKeys, Modules } from "@medusajs/utils"
|
||||
import { JwtPayload, decode, verify } from "jsonwebtoken"
|
||||
} from "@medusajs/framework/http"
|
||||
import { ConfigModule, IAuthModuleService } from "@medusajs/framework/types"
|
||||
import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils"
|
||||
import { decode, JwtPayload, verify } from "jsonwebtoken"
|
||||
|
||||
// Middleware to validate that a token is valid
|
||||
export const validateToken = () => {
|
||||
@@ -31,7 +31,7 @@ export const validateToken = () => {
|
||||
|
||||
const authModule = req.scope.resolve<IAuthModuleService>(Modules.AUTH)
|
||||
|
||||
let decoded = decode(token as string) as JwtPayload
|
||||
const decoded = decode(token as string) as JwtPayload
|
||||
|
||||
const [providerIdentity] = await authModule.listProviderIdentities(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user