chore: remove direct usage from graphql (#9316)
**What** Remove direct usage of graphql toold and instead consume it from utils to have a single entry point to graphql tooling
This commit is contained in:
committed by
GitHub
parent
f294c99c92
commit
fba78c0fb1
@@ -1,13 +1,15 @@
|
||||
import { mergeTypeDefs } from "@graphql-tools/merge"
|
||||
import { makeExecutableSchema } from "@graphql-tools/schema"
|
||||
import { cleanGraphQLSchema } from "@medusajs/utils"
|
||||
import { GraphQLUtils } from "@medusajs/utils"
|
||||
|
||||
export function getEntitiesMap(loadedSchema): Map<string, any> {
|
||||
const defaultMedusaSchema = `
|
||||
scalar DateTime
|
||||
scalar JSON
|
||||
`
|
||||
const { schema } = cleanGraphQLSchema(defaultMedusaSchema + loadedSchema)
|
||||
const mergedSchema = mergeTypeDefs(schema)
|
||||
return makeExecutableSchema({ typeDefs: mergedSchema }).getTypeMap() as any
|
||||
const { schema } = GraphQLUtils.cleanGraphQLSchema(
|
||||
defaultMedusaSchema + loadedSchema
|
||||
)
|
||||
const mergedSchema = GraphQLUtils.mergeTypeDefs(schema)
|
||||
return GraphQLUtils.makeExecutableSchema({
|
||||
typeDefs: mergedSchema,
|
||||
}).getTypeMap() as any
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user