feat(medusa,types): add enabled plugins route (#11876)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
||||
import { isString } from "lodash"
|
||||
|
||||
export const GET = async (
|
||||
req: MedusaRequest<unknown>,
|
||||
res: MedusaResponse<HttpTypes.AdminPluginsListResponse>
|
||||
) => {
|
||||
const configModule = req.scope.resolve(
|
||||
ContainerRegistrationKeys.CONFIG_MODULE
|
||||
)
|
||||
|
||||
const configPlugins = configModule.plugins ?? []
|
||||
|
||||
const plugins = configPlugins.map((plugin) => ({
|
||||
name: isString(plugin) ? plugin : plugin.resolve,
|
||||
}))
|
||||
|
||||
res.json({
|
||||
plugins,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user