How to use the @graphql-codegen/plugin-helpers.ApolloFederation 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 / plugins / other / visitor-plugin-common / src / base-resolvers-visitor.ts View on Github external
federation: getConfigValue(rawConfig.federation, false),
      resolverTypeWrapperSignature: getConfigValue(rawConfig.resolverTypeWrapperSignature, 'Promise | T'),
      enumValues: parseEnumValues(_schema, rawConfig.enumValues),
      addUnderscoreToArgsType: getConfigValue(rawConfig.addUnderscoreToArgsType, false),
      contextType: parseMapper(rawConfig.contextType || 'any', 'ContextType'),
      fieldContextTypes: getConfigValue(rawConfig.fieldContextTypes, []),
      rootValueType: parseMapper(rawConfig.rootValueType || '{}', 'RootValueType'),
      avoidOptionals: getConfigValue(rawConfig.avoidOptionals, false),
      defaultMapper: rawConfig.defaultMapper ? parseMapper(rawConfig.defaultMapper || 'any', 'DefaultMapperType') : null,
      mappers: transformMappers(rawConfig.mappers || {}),
      scalars: buildScalars(_schema, rawConfig.scalars, defaultScalars),
      ...(additionalConfig || {}),
    } as TPluginConfig);

    autoBind(this);
    this._federation = new ApolloFederation({ enabled: this.config.federation, schema: this.schema });
    this._rootTypeNames = getRootTypeNames(_schema);
    this._variablesTransfomer = new OperationVariablesToObject(this.scalars, this.convertName);
    this._resolversTypes = this.createResolversFields(type => this.applyResolverTypeWrapper(type), type => this.clearResolverTypeWrapper(type), name => this.getTypeToUse(name));
    this._resolversParentTypes = this.createResolversFields(type => type, type => type, name => this.getParentTypeToUse(name));
    this._fieldContextTypeMap = this.createFieldContextTypeMap();
  }