How to use the @graphback/core.filterInterfaceTypes function in @graphback/core

To help you get started, we’ve selected a few @graphback/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerogear / graphback / packages / graphback-codegen-schema / src / targetSchemaContext.ts View on Github external
});


  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))]
    }
  });