How to use the @graphql-codegen/visitor-plugin-common.BaseVisitor function in @graphql-codegen/visitor-plugin-common

To help you get started, we’ve selected a few @graphql-codegen/visitor-plugin-common 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 dotansimha / graphql-code-generator / packages / presets / near-operation-file / src / index.ts View on Github external
buildGeneratesSection: options => {
    const schemaObject: GraphQLSchema = options.schemaAst ? options.schemaAst : buildASTSchema(options.schema);
    const baseVisitor = new BaseVisitor(options.config, {
      scalars: buildScalars(schemaObject, options.config.scalars),
    });

    const getAllFragmentSubTypes = (possbileTypes: string[], name: string, suffix: string): string[] => {
      if (possbileTypes.length === 0) {
        return [];
      } else if (possbileTypes.length === 1) {
        return [
          baseVisitor.convertName(name, {
            useTypesPrefix: true,
            suffix: suffix,
          }),
        ];
      } else {
        return possbileTypes.map(typeName =>
          baseVisitor.convertName(name, {