Module: ElasticGraph::Apollo::GraphQL::EngineExtension

Defined in:
lib/elastic_graph/apollo/graphql/engine_extension.rb

Overview

ElasticGraph application extension module designed to hook into the ElasticGraph GraphQL engine in order to support Apollo-specific fields.

Instance Method Summary collapse

Instance Method Details

#graphql_gem_pluginsObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/elastic_graph/apollo/graphql/engine_extension.rb', line 30

def graphql_gem_plugins
  @graphql_gem_plugins ||= begin
    require "apollo-federation/tracing/proto"
    require "apollo-federation/tracing/node_map"
    require "apollo-federation/tracing/tracer"
    require "apollo-federation/tracing"

    # @type var options: ::Hash[::Symbol, untyped]
    options = {}
    super.merge(ApolloFederation::Tracing => options)
  end
end

#graphql_http_endpointObject



43
44
45
46
47
48
# File 'lib/elastic_graph/apollo/graphql/engine_extension.rb', line 43

def graphql_http_endpoint
  @graphql_http_endpoint ||= super.tap do |endpoint|
    require "elastic_graph/apollo/graphql/http_endpoint_extension"
    endpoint.extend HTTPEndpointExtension
  end
end

#graphql_resolversObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/elastic_graph/apollo/graphql/engine_extension.rb', line 15

def graphql_resolvers
  @graphql_resolvers ||= begin
    require "elastic_graph/apollo/graphql/entities_field_resolver"
    require "elastic_graph/apollo/graphql/service_field_resolver"

    [
      EntitiesFieldResolver.new(
        datastore_query_builder: datastore_query_builder,
        schema_element_names: .schema_element_names
      ),
      ServiceFieldResolver.new
    ] + super
  end
end