Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createCustomSchemaContext = (inputContext: InputModelTypeContext[]) => {
const objectTypes = filterObjectTypes(inputContext);
const queryType = objectTypes.filter((t: InputModelTypeContext) => t.name === 'Query')
let customQueries = []
if (queryType.length) {
customQueries = queryType[0].fields.map(maybeNullFieldArgs)
}
const mutationType = objectTypes.filter((t: InputModelTypeContext) => t.name === 'Mutation')
let customMutations = []
if (mutationType.length) {
customMutations = mutationType[0].fields.map(maybeNullFieldArgs)
}
const subscriptionType = objectTypes.filter((t: InputModelTypeContext) => t.name === 'Subscription')
let customSubscriptions = []
if (subscriptionType.length) {
})
});
const context: TargetContext = {
types: [],
interfaces: [],
inputFields: [],
filterFields: [],
queries: [],
mutations: [],
subscriptions: [],
relations
}
const objectTypes = filterObjectTypes(inputContext);
const interfaceTypes = filterInterfaceTypes(inputContext);
context.types = objectTypes.map((t: InputModelTypeContext) => {
return {
"name": t.name,
"interfaces": t.interfaces.map((i: InputInterfaceType) => i.type),
"fields": [...t.fields.filter((f: InputModelFieldContext, ) => !f.isType).map(maybeNullField), ...new Set(relations.filter((r: RelationInfo) => r.name === t.name).map((r: RelationInfo) => r.relation))]
}
});
context.interfaces = interfaceTypes.map((t: InputModelTypeContext) => {
return {
"name": t.name,
"fields": [...t.fields.filter((f: InputModelFieldContext, ) => !f.isType).map(maybeNullField), ...new Set(relations.filter((r: RelationInfo) => r.name === t.name).map((r: RelationInfo) => r.relation))]
}