How to use the @graphql-codegen/plugin-helpers.isComplexPluginOutput 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 / graphql-codegen-core / src / codegen.ts View on Github external
name,
          config: execConfig,
          parentConfig: options.config,
          schema,
          schemaAst: options.schemaAst,
          documents: options.documents,
          outputFilename: options.filename,
          allPlugins: options.plugins,
          skipDocumentsValidation: options.skipDocumentsValidation,
        },
        pluginPackage
      );

      if (typeof result === 'string') {
        return result || '';
      } else if (isComplexPluginOutput(result)) {
        if (result.append && result.append.length > 0) {
          for (const item of result.append) {
            append.add(item);
          }
        }

        if (result.prepend && result.prepend.length > 0) {
          for (const item of result.prepend) {
            prepend.add(item);
          }
        }
        return result.content || '';
      }

      return '';
    })