How to use the @graphql-codegen/plugin-helpers.isUsingTypes function in @graphql-codegen/plugin-helpers

To help you get started, we’ve selected a few @graphql-codegen/plugin-helpers 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
});
            }

            config.externalFragments.push({
              level,
              isExternal: true,
              importFrom: fragmentImportPath,
              name: fragmentName,
              onType: fragmentDetails.onType,
              node: fragmentDetails.node,
            });
          }
        }

        if (
          isUsingTypes(
            documentFile.content,
            config.externalFragments.map(m => m.name),
            schemaObject
          )
        ) {
          plugins.unshift({ add: `import * as ${importTypesNamespace} from '${relativeImportPath}';\n` });
        }

        return {
          filename: generatedFilePath,
          plugins,
          pluginMap,
          config,
          schema: options.schema,
          schemaAst: schemaObject,
          documents: [documentFile],
github dotansimha / graphql-code-generator / packages / presets / import-types / src / index.ts View on Github external
options.documents.map(documentFile => {
      if (
        isUsingTypes(
          documentFile.content,
          config.externalFragments.map(m => m.name),
          options.schemaAst
        )
      ) {
        plugins.unshift({ add: `import * as ${importTypesNamespace} from '${options.presetConfig.typesPath}';\n` });
      }
    });
    return [