Sha256: 55fed8e0fd0f8d9e6c456448d68789d8c79ff05279061d5a48809f217ecc6b2c
Contents?: true
Size: 1.65 KB
Versions: 4
Compression:
Stored size: 1.65 KB
Contents
require "active_support/core_ext/object/json" require "graphql" require "graphiti" require "graphiti_graphql/version" require "graphiti_graphql/graphiti_schema/wrapper" require "graphiti_graphql/graphiti_schema/sideload" require "graphiti_graphql/graphiti_schema/resource" require "graphiti_graphql/errors" require "graphiti_graphql/schema" require "graphiti_graphql/runner" require "graphiti_graphql/util" module GraphitiGraphQL class Configuration attr_accessor :schema_reloading def initialize self.schema_reloading = true end def define_context(&blk) @define_context = blk end def get_context obj = Graphiti.context[:object] if @define_context @define_context.call(obj) else {object: obj} end end end module Runnable def gql(query, variables) runner = ::GraphitiGraphQL::Runner.new runner.execute(query, variables, GraphitiGraphQL.schemas.graphql) end end class SchemaProxy def graphql generated.schema end def graphiti generated.graphiti_schema end def generated @generated ||= GraphitiGraphQL::Schema.generate end def generate!(entrypoint_resources = nil) @generated = GraphitiGraphQL::Schema.generate(entrypoint_resources) end def generated? !!@generated end def clear! @generated = nil end end class << self attr_accessor :schema_class end def self.config @config ||= Configuration.new end def self.schemas @schemas ||= SchemaProxy.new end end Graphiti.extend(GraphitiGraphQL::Runnable) if defined?(::Rails) require "graphiti_graphql/engine" end
Version data entries
4 entries across 4 versions & 1 rubygems