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:
Adrien de Peretti
2024-09-26 10:18:26 +02:00
committed by GitHub
parent f294c99c92
commit fba78c0fb1
7 changed files with 84 additions and 1003 deletions

View File

@@ -1,4 +1,3 @@
import { makeExecutableSchema } from "@graphql-tools/schema"
import { MedusaModule } from "@medusajs/framework/modules-sdk"
import {
IndexTypes,
@@ -22,7 +21,7 @@ export const CustomDirectives = {
export function makeSchemaExecutable(inputSchema: string) {
const { schema: cleanedSchema } = GraphQLUtils.cleanGraphQLSchema(inputSchema)
return makeExecutableSchema({ typeDefs: cleanedSchema })
return GraphQLUtils.makeExecutableSchema({ typeDefs: cleanedSchema })
}
function extractNameFromAlias(

View File

@@ -1,6 +1,5 @@
import { isObject, isString } from "@medusajs/framework/utils"
import { isObject, isString, GraphQLUtils } from "@medusajs/utils"
import { IndexTypes } from "@medusajs/framework/types"
import { GraphQLList } from "graphql"
import { Knex } from "knex"
import { OrderBy, QueryFormat, QueryOptions, Select } from "@types"
@@ -62,7 +61,7 @@ export class QueryBuilder {
let currentType = fieldRef.type
let isArray = false
while (currentType.ofType) {
if (currentType instanceof GraphQLList) {
if (currentType instanceof GraphQLUtils.GraphQLList) {
isArray = true
}