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



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elastic_graph/apollo/graphql/engine_extension.rb', line 38

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



52
53
54
55
56
57
# File 'lib/elastic_graph/apollo/graphql/engine_extension.rb', line 52

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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elastic_graph/apollo/graphql/engine_extension.rb', line 22

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