How to use the type-graphql/dist/metadata/getMetadataStorage.getMetadataStorage function in type-graphql

To help you get started, we’ve selected a few type-graphql 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 wemaintain / auto-relay / packages / sorting / src / graphql / graphql.generator.ts View on Github external
protected findGqlfieldsOfType(type: ClassType): SortableField[] {
    const gqlFields: SortableField[] = []
    const resolvers: any[] = []

    for (const field of (getMetadataStorage() as any).fields as FieldMetadata[]) {
      if (field.target === type) gqlFields.push({
        name: field.name,
        schemaName: field.schemaName,
        type: field.target as any
      })
    }

    for (const resolver of (getMetadataStorage() as any).resolverClasses) {
      if (resolver.getObjectType() === type) resolvers.push(resolver.target)
    }

    for (const fieldResolver of getMetadataStorage().fieldResolvers) {
      if (resolvers.includes(fieldResolver.target)) gqlFields.push({
        name: fieldResolver.methodName,
        schemaName: fieldResolver.schemaName,
        type: fieldResolver.target as any
github wemaintain / auto-relay / packages / sorting / src / graphql / graphql.generator.ts View on Github external
const gqlFields: SortableField[] = []
    const resolvers: any[] = []

    for (const field of (getMetadataStorage() as any).fields as FieldMetadata[]) {
      if (field.target === type) gqlFields.push({
        name: field.name,
        schemaName: field.schemaName,
        type: field.target as any
      })
    }

    for (const resolver of (getMetadataStorage() as any).resolverClasses) {
      if (resolver.getObjectType() === type) resolvers.push(resolver.target)
    }

    for (const fieldResolver of getMetadataStorage().fieldResolvers) {
      if (resolvers.includes(fieldResolver.target)) gqlFields.push({
        name: fieldResolver.methodName,
        schemaName: fieldResolver.schemaName,
        type: fieldResolver.target as any
      })
    }

    return gqlFields
  }
github wemaintain / auto-relay / packages / sorting / src / graphql / graphql.generator.spec.ts View on Github external
beforeEach(async () => {
    getMetadataStorage().clear()
    registerEnumType(OrderingDirection, {
      name: "OrderingDirection",
      description: "Direction when sorting a column",
    });
    const schema = createSchema()
    EntityA = schema.EntityA
    ResolverA = schema.ResolverA

    generator = new GQLSortingGenerator()
  })