source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/callback.rb | Ruby | mit | 190 | master | 5,455 | # frozen_string_literal: true
module Rails
module GraphQL
# = Rails GraphQL Callback
#
# An extra powerful proc that can handle way more situations than the
# original block caller
class Callback
EXCLUSIVE_ARGUMENT = :exclusive_callback
attr_reader :event_name, :block, :target, :filt... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_name.rb | Ruby | mit | 190 | master | 1,267 | # frozen_string_literal: true
require 'active_support/core_ext/module/anonymous'
module Rails
module GraphQL
module Helpers
# Helper module responsible for name stuff
module WithName
NAME_EXP = /GraphQL::(?:Type::\w+::|Directive::)?([:\w]+)\z/.freeze
# Here we define a couple of att... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/attribute_delegator.rb | Ruby | mit | 190 | master | 1,414 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# This is an extra magic on top of the delegator class from the standard
# lib that allows fetching a specific property of the delegated object
class AttributeDelegator < ::BasicObject
undef_method :==
unde... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_namespace.rb | Ruby | mit | 190 | master | 1,342 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold namespaces. It can
# either work as an extension of the superclass using +add_namespace+ or
# it can be reset then set using +namespace+.
module WithNamespace
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/leaf_from_ar.rb | Ruby | mit | 190 | master | 5,892 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module allowing leaf values to be collected direct from
# ActiveRecord. It also helps AR Adapters to define the necessary
# methods and settings to operate with this extractor.
#
# TODO: Implement Acti... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_directives.rb | Ruby | mit | 190 | master | 5,293 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold directives during the
# definition process
module WithDirectives
def self.extended(other)
other.extend(Helpers::InheritedCollection)
other.exten... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_validator.rb | Ruby | mit | 190 | master | 1,561 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper that contains the main exceptions and validation process for a
# value against a type
module WithValidator
delegate :ordinalize, to: 'ActiveSupport::Inflector'
protected
# Run the valid... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_description.rb | Ruby | mit | 190 | master | 2,191 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
module WithDescription
# A getter or setter in the same function
def desc(value = nil)
value.nil? ? description : (self.description = value)
end
# Define and format description
def d... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_arguments.rb | Ruby | mit | 190 | master | 4,575 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold arguments
module WithArguments
def self.extended(other)
other.extend(Helpers::InheritedCollection)
other.extend(WithArguments::ClassMethods)
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_fields.rb | Ruby | mit | 190 | master | 7,213 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold fields during the
# definition process. Works very similar to Arguments, but it's more
# flexible, since the type of the fields can be dynamic defined by the
# class ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_global_id.rb | Ruby | mit | 190 | master | 581 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that is a different implementation of the
# +GlobalID::Identification+, but instead of things being found by the
# class that they are, it uses owners and base classes.
module WithGlobalID
def... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/unregisterable.rb | Ruby | mit | 190 | master | 371 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper that allows unregisterable objects to be both identified and
# removed from type map
module Unregisterable
# Simply remove itself from the type map
def unregister!
GraphQL.type_map.unregi... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_owner.rb | Ruby | mit | 190 | master | 1,485 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper focus on event execution when objects have a owner property,
# pratically allowing resolvers and similar to be called in the owner
module WithOwner
def self.included(other)
other.extend(WithOwner... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_assignment.rb | Ruby | mit | 190 | master | 3,881 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold an +assigned_to+ object
module WithAssignment
# Add extra instance based methods
def self.extended(other)
other.delegate :assigned?, :assigned_to, :safe... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/registerable.rb | Ruby | mit | 190 | master | 2,849 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module responsible for registering the objects to the type map,
# which also checks for the uniqueness of the name of things.
module Registerable
# Here we define a couple of attributes used by registratio... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_schema_fields.rb | Ruby | mit | 190 | master | 12,672 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold schema fields (query,
# mutation, and subscription fields). Works very similar to fields, but
# they are placed in different places regarding their type.
module WithS... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_events.rb | Ruby | mit | 190 | master | 3,102 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allows other objects to hold events, either from a
# singleton point-of-view, or for instances
module WithEvents
def self.extended(other)
other.extend(Helpers::InheritedCollection)
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/instantiable.rb | Ruby | mit | 190 | master | 385 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# This marks an object as instantiable during a requesting, which means it
# will be associated with an event and most of it's information comes from
# the running event.
module Instantiable
delegate_missing_... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/inherited_collection.rb | Ruby | mit | 190 | master | 3,514 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Helper module that allow classes to have specific type of attributes
# that are corretly delt when it is inherited by another class. It keeps
# track of its own value and allow access to all values of the property
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/with_callbacks.rb | Ruby | mit | 190 | master | 2,640 | # frozen_string_literal: true
module Rails
module GraphQL
module Helpers
# Callbacks is an extension of the events which works with the
# {Callback}[rdoc-ref:Rails::GraphQL::Callback] class, then having extra
# powers when actually executing the event against Procs or owner-based
# method... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/inherited_collection/array.rb | Ruby | mit | 190 | master | 1,509 | module Rails
module GraphQL
module Helpers
# A inherited collection of arrays that can be unique when it is a set
class InheritedCollection::Array < InheritedCollection::Base
alias size count
alias to_ary eager
# Provide similar functionality of any? but returns the object ins... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/inherited_collection/hash.rb | Ruby | mit | 190 | master | 2,499 | module Rails
module GraphQL
module Helpers
# A inherited collection of Hash that can contain simple values, arrays,
# or sets
class InheritedCollection::Hash < InheritedCollection::Base
delegate :transform_values, :transform_keys, to: :to_hash
delegate :filter_map, :map, to: :eag... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/helpers/inherited_collection/base.rb | Ruby | mit | 190 | master | 1,446 | module Rails
module GraphQL
module Helpers
# The base class for inherited collections. It helps softly dealing with
# values defined in multiple class instance variables and look up the tree
# to make it possible to iterate over combined result
class InheritedCollection::Base
inclu... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/prepared_data.rb | Ruby | mit | 190 | master | 3,366 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Bypass Data
#
# This class works in collaboration with the prepare stage of a request
# execution. In that stage, the strategy must check if the request already
# have a prepared data for the... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/arguments.rb | Ruby | mit | 190 | master | 1,770 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Arguments
#
# This is an extension of an +OpenStruct+ since argument values can be
# assigned a Proc, which means that in order to collect their value, we
# need to rely on the current operat... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/errors.rb | Ruby | mit | 190 | master | 1,993 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Errors
#
# This class is inspired by +ActiveModel::Errors+. The idea is to hold all
# the errors that happened during the execution of a request. It also
# helps to export such information to... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component.rb | Ruby | mit | 190 | master | 3,992 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Component
#
# Component is an abstraction of any possible type of object represented
# by a not of the document of a request. This class helps building
# cross-component features, like holdin... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/event.rb | Ruby | mit | 190 | master | 4,101 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Event
#
# A small extension of the original event to support extra methods and
# helpers when performing events during a request
class Event < GraphQL::Event
OBJECT_BASED_READERS = %i... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/context.rb | Ruby | mit | 190 | master | 1,468 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Context
#
# This class is used as context for the response while processing fields,
# objects, or any data that it's going to be placed on the response
class Context
attr_reader :curr... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/strategy.rb | Ruby | mit | 190 | master | 11,212 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Strategy
#
# This is the base class for the strategies of resolving a request.
class Strategy
extend ActiveSupport::Autoload
autoload :DynamicInstance
autoload :SequencedS... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/subscription.rb | Ruby | mit | 190 | master | 2,877 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Subscription
#
# A simple object to store information about a generated subscription
# TODO: Maybe add a callback for the schema allowing it to prepare the
# context before saving it into a s... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/backtrace.rb | Ruby | mit | 190 | master | 7,107 | # frozen_string_literal: true
require 'active_support/parameter_filter'
module Rails
module GraphQL
class Request
# = GraphQL Request Backtrace
#
# Display any request errors in a nice way. By default, it won't display
# anything that is internal of this gem, but
module Backtrace
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/strategy/dynamic_instance.rb | Ruby | mit | 190 | master | 1,372 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQl Strategy Dynamic Instance
#
# When an event is call on non-object types, this class allows both
# finding a method on two different places, the interface or union
# definition, or on the currect obje... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/strategy/multi_query_strategy.rb | Ruby | mit | 190 | master | 934 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQl Multi Query Strategy
#
# This is a resolution strategy to solve requests that only contain
# queries, allowing the strategy to collect all the information for all
# the queries in a single step befor... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/strategy/sequenced_strategy.rb | Ruby | mit | 190 | master | 781 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQl Sequenced Strategy
#
# This is the default resolution strategy, where each operation is
# performed in sequece, and they don't relate to each other in any way.
class Strategy::SequencedStrategy < Str... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/strategy/cached_strategy.rb | Ruby | mit | 190 | master | 2,013 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQl Cached Strategy
#
# This strategy will process hard cached operations. Soft cached
# operations are those that only the document is cached in the server and
# processed via its unique identifier (UUI... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/steps/resolvable.rb | Ruby | mit | 190 | master | 1,043 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# Helper methods for the resolve step of a request
module Resolvable
# Resolve the object
def resolve!
resolve
rescue => error
report_exception(error)
end
protected
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/steps/authorizable.rb | Ruby | mit | 190 | master | 3,872 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# Helper methods for the authorize step of a request
module Authorizable
# Event used to perform an authorization step
class Event < GraphQL::Event
# Same behavior as the request event
def same... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/steps/preparable.rb | Ruby | mit | 190 | master | 1,114 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# Helper methods for the prepare step of a request
module Preparable
# Prepare the object
def prepare!
prepare
rescue => error
report_exception(error)
end
# Marks that ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/steps/organizable.rb | Ruby | mit | 190 | master | 7,771 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# Helper methods for the organize step of a request
module Organizable
# Organize the object if it is not already organized
def organize!
organize unless defined?(@organized)
rescue => error
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component/operation.rb | Ruby | mit | 190 | master | 6,674 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Component Operation
#
# This class holds information about a given operation. This will guide
# the validation and execution of it.
class Component::Operation < Component
extend Activ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component/fragment.rb | Ruby | mit | 190 | master | 5,243 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Component Fragment
#
# This class holds information about a given fragment defined using the
# +fragment+ statement during an execution. This will guide the validation
# and execution of it.
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component/spread.rb | Ruby | mit | 190 | master | 5,454 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Component Spread
#
# This class holds information about a given spread that should be
# iterated, which connect to either a fragment or an inline selection
class Component::Spread < Component... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component/typename.rb | Ruby | mit | 190 | master | 2,435 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Component Typename
#
# Extra component which simulates a field that its only purpose is to
# return the name of the parent GraphQL object
class Component::Typename < Component
include... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component/field.rb | Ruby | mit | 190 | master | 8,460 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# = GraphQL Request Component Field
#
# This class holds information about a given field that should be
# collected from the source of where it was requested.
class Component::Field < Component
include A... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/component/operation/subscription.rb | Ruby | mit | 190 | master | 6,102 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
class Component
# = GraphQL Request Component Subscription Operation
#
# Handles a subscription operation inside a request.
class Operation::Subscription < Operation
UNSUBSCRIBED_PAYLOAD = { 'm... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/helpers/directives.rb | Ruby | mit | 190 | master | 3,595 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# Helper module to collect the directives from fragments, operations, and
# fields.
module Directives
# Get the list of listeners from directives set during the request only
def directive_listeners
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/helpers/value_writers.rb | Ruby | mit | 190 | master | 4,040 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# A set of helper methods to write a value to the response
module ValueWriters
# TODO: Maybe move this to a setting so it allow extensions
KIND_WRITERS = {
union: :write_union,
interface: :... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/request/helpers/selection_set.rb | Ruby | mit | 190 | master | 3,920 | # frozen_string_literal: true
module Rails
module GraphQL
class Request
# Helper module to collect the fields from fragments, operations, and also
# other fields.
module SelectionSet
attr_reader :selection
# Build the cache object
def cache_dump
return super u... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/mutation_field.rb | Ruby | mit | 190 | master | 2,626 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Mutation Field
#
# This is an extension of a normal output field, which just add extra
# validation and insurance that the +perform+ step can be executed
#
# ==== Options
#
# * <tt>:call</tt> - The alternative metho... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/output_field.rb | Ruby | mit | 190 | master | 5,856 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Output Field
#
# Most of the fields in a GraphQL operation are output fields or similar or
# proxies of it. They can express both leaf and branch data. They can also
# be the entry point of a GraphQL request.
#
# ==== O... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/scoped_config.rb | Ruby | mit | 190 | master | 773 | # frozen_string_literal: true
module Rails
module GraphQL
# Helper class to be used while configuring a field using a block. An
# instance of this class works as proxy for changes to the actual field.
class Field::ScopedConfig < Struct.new(:field, :receiver)
delegate :argument, :ref_argument, :id_a... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/authorized_field.rb | Ruby | mit | 190 | master | 1,144 | # frozen_string_literal: true
module Rails
module GraphQL
# This provides ways for fields to be authorized, giving a logical level for
# enabling or disabling access to a field. It has a similar structure to
# events, but has a different hierarchy of resolution
module Field::AuthorizedField
mod... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/proxied_field.rb | Ruby | mit | 190 | master | 4,670 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Proxied Field
#
# Proxied fields are a soft way to copy a real field. The good part is that
# if the field changes for any reason all its copies will change as well.
#
# The owner of a proxy field is different from the owne... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/resolved_field.rb | Ruby | mit | 190 | master | 3,157 | # frozen_string_literal: true
module Rails
module GraphQL
# This provides ways for fields to be resolved manually, by adding callbacks
# and additional configurations in order to resolve a field value during a
# request
module Field::ResolvedField
module Proxied # :nodoc: all
def resolv... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/typed_field.rb | Ruby | mit | 190 | master | 4,424 | # frozen_string_literal: true
module Rails
module GraphQL
# This is a helper module that basically works with fields that have an
# assigned type value
module Field::TypedField
module Proxied # :nodoc: all
delegate :type, to: :field
end
attr_reader :type
delegate :input_... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/subscription_field.rb | Ruby | mit | 190 | master | 3,787 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Subscription Field
#
# This is an extension of a normal output field, which will sign
# the request for updates of the field when the scope and arguments
# are the same.
class Field::SubscriptionField < Field::OutputField
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/field/input_field.rb | Ruby | mit | 190 | master | 3,007 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Input Field
#
# An input field works the same way as an argument and they are pretty much
# equivalent. The main difference between an argument and a input field is
# that input fields holds object-like values and they can be i... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/subscription/provider.rb | Ruby | mit | 190 | master | 421 | # frozen_string_literal: true
module Rails
module GraphQL
module Subscription
# = GraphQL Subscription Provider
#
# Subscription provider holds all the possible options for handlers of
# subscriptions, which all should inherit from Provider::Base
module Provider
extend Activ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/subscription/store.rb | Ruby | mit | 190 | master | 468 | # frozen_string_literal: true
module Rails
module GraphQL
module Subscription
# = GraphQL Subscription Store
#
# Subscription store holds all the possible options for storing the
# subscriptions, allowing to segmentation by field, variables, and several
# other things according to t... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/subscription/provider/base.rb | Ruby | mit | 190 | master | 7,508 | # frozen_string_literal: true
module Rails
module GraphQL
module Subscription
module Provider
# = GraphQL Base Subscription Provider
#
# The base class for all the other subscription providers, which defines
# the necessary interfaces to install and stream the subscription t... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/subscription/provider/action_cable.rb | Ruby | mit | 190 | master | 3,350 | # frozen_string_literal: true
require 'action_cable'
module Rails
module GraphQL
module Subscription
module Provider
# = GraphQL Action Cable Subscription Provider
#
# The subscription provider associated with Rails Action Cable, that
# delivers subscription notifications t... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/subscription/store/base.rb | Ruby | mit | 190 | master | 5,406 | # frozen_string_literal: true
module Rails
module GraphQL
module Subscription
module Store
# = GraphQL Base Subscription Store
#
# The base class for all the other subscription stores, which defines
# the necessary interfaces to keep track of all the subscriptions
#
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/subscription/store/memory.rb | Ruby | mit | 190 | master | 4,399 | # frozen_string_literal: true
module Rails
module GraphQL
module Subscription
module Store
# = GraphQL Memory Subscription Store
#
# This store will save all the subscriptions in a very similar way that
# the TypeMap works, using nested concurrent maps that points out to
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/collectors/hash_collector.rb | Ruby | mit | 190 | master | 2,979 | # frozen_string_literal: true
module Rails
module GraphQL
module Collectors
# = GraphQL Hash Collector
#
# This collector helps building a JSON response using the hash approach,
# where the value is kept as an hash and later turn into a string
class HashCollector
def initial... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/collectors/json_collector.rb | Ruby | mit | 190 | master | 4,277 | # frozen_string_literal: true
module Rails
module GraphQL
module Collectors
# = GraphQL JSON Collector
#
# This collector helps building a JSON response using the string approach,
# which has better performance, since all the encoding is performed up
# front. The drawback is that it... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/collectors/idented_collector.rb | Ruby | mit | 190 | master | 1,703 | module Rails
module GraphQL
module Collectors
# = GraphQL Idented Collector
#
# This collector helps building a indented string, most used for
# displaying a GraphQL schema
class IdentedCollector
def initialize(initial = 0, size = 2, auto_eol: true)
@size = size
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/alternative/mutation.rb | Ruby | mit | 190 | master | 405 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Alternative Mutation
#
# Same as it's parent class, but for mutations
class Alternative::Mutation < Alternative::Query
redefine_singleton_method(:type_field_class) { :mutation }
self.abstract = true
class << self... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/alternative/subscription.rb | Ruby | mit | 190 | master | 485 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Alternative Subscription
#
# Same as it's parent class, but for subscription
class Alternative::Subscription < Alternative::Query
redefine_singleton_method(:type_field_class) { :subscription }
self.abstract = true
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/alternative/field_set.rb | Ruby | mit | 190 | master | 1,341 | # frozen_string_literal: true
module Rails
module GraphQL
module Alternative
# = GraphQL Alternative Field Set
#
# A simple way to store fields that share some logic with each other
class FieldSet
extend Helpers::WithNamespace
extend Helpers::WithFields
include He... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/alternative/query.rb | Ruby | mit | 190 | master | 3,344 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Alternative Query
#
# This object acts like a field, but is organized as an object for extended
# resolvers or really complex fields.
class Alternative::Query
extend Helpers::WithNamespace
include Helpers::Instantia... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/directive/include_directive.rb | Ruby | mit | 190 | master | 647 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Spec Include Directive
#
# Allow including fields only +if+ condition is true
class Directive::IncludeDirective < Directive
self.spec_object = true
placed_on :field, :fragment_spread, :inline_fragment
desc 'Allo... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/directive/specified_by_directive.rb | Ruby | mit | 190 | master | 681 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Spec Specified By Directive
#
# Provides a scalar specification URL for specifying the behavior of
# custom scalar types.
class Directive::SpecifiedByDirective < Directive
self.spec_object = true
placed_on :scalar
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/directive/deprecated_directive.rb | Ruby | mit | 190 | master | 1,926 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Spec Deprecated Directive
#
# Mark fields or enum values as deprecated which will include an error
# message when they are requested or returned
class Directive::DeprecatedDirective < Directive
self.spec_object = true
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/directive/cached_directive.rb | Ruby | mit | 190 | master | 982 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Cached Directive
#
# Indicates that the request has hard cached operations that need to be
# collected
class Directive::CachedDirective < Directive
placed_on :query
desc 'Indicates that there are hard cached operat... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/directive/skip_directive.rb | Ruby | mit | 190 | master | 631 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Spec Skip Directive
#
# Allow skipping fields given an +if+ condition
class Directive::SkipDirective < Directive
self.spec_object = true
desc 'Allows for conditional exclusion during execution as described by the if ar... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/adapters/sqlite_adapter.rb | Ruby | mit | 190 | master | 1,506 | # frozen_string_literal: true
module Rails
module GraphQL
# Based on:
# https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/
# connection_adapters/sqlite3_adapter.rb#L64
type_map.register_alias 'sqlite:binary', :binary
type_map.register_alias 'sqlite:boolean', :boo... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/adapters/pg_adapter.rb | Ruby | mit | 190 | master | 2,393 | # frozen_string_literal: true
module Rails
module GraphQL
# Based on:
# SELECT t.oid, t.typname, format_type(t.oid, NULL) AS sql_type
# FROM pg_type t
# WHERE typtype = 'b'
# AND typcategory IN ('B', 'D', 'G', 'I', 'N', 'S', 'T', 'U', 'V')
# AND typowner = 10;
type_map.register_alias ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/adapters/mysql_adapter.rb | Ruby | mit | 190 | master | 2,603 | # frozen_string_literal: true
module Rails
module GraphQL
# Based on:
# SELECT DISTINCT data_type FROM information_schema.columns;
# And https://www.mysqltutorial.org/mysql-data-types.aspx
type_map.register_alias 'mysql:varchar', :string
type_map.register_alias 'mysql:bit', :bool
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/source/active_record_source.rb | Ruby | mit | 190 | master | 11,413 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Source Active Record
#
# This source allows the translation of active record objects into a new
# source object, creating:
# 1. 1 Object
# 2. 1 Input
# 3. 2 Query fields (singular and plural)
# 4. 3 Mutation fields ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/source/scoped_arguments.rb | Ruby | mit | 190 | master | 3,719 | # frozen_string_literal: true
module Rails
module GraphQL
# This is a helper class that allows sources to have scoped-based arguments,
# meaning that when an argument is present, it triggers the underlying block
# on the fields where the argument was attached to
module Source::ScopedArguments
d... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/source/base.rb | Ruby | mit | 190 | master | 4,308 | # frozen_string_literal: true
module Rails
module GraphQL
class Source
class Base < GraphQL::Source
extend Helpers::WithSchemaFields
extend Helpers::WithAssignment
extend Helpers::Unregisterable
self.abstract = true
# The name of the class (or the class itself) to ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/source/builder.rb | Ruby | mit | 190 | master | 3,787 | # frozen_string_literal: true
module Rails
module GraphQL
class Source
module Builder
# Check if the object was already built
def built?(part = nil)
defined?(@built) && @built.present? &&
(part.nil? || @built.include?(part.to_sym))
end
# Build all fro... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/source/active_record/builders.rb | Ruby | mit | 190 | master | 6,203 | # frozen_string_literal: true
module Rails
module GraphQL
# All the helper methods for building the source
module Source::ActiveRecordSource::Builders
# List of all columns that should be threated as IDs
# TODO: Add a exclusive cache for the build process
def id_columns
@id_columns ... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/channel.rb | Ruby | mit | 190 | master | 5,253 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Channel
#
# The channel helper methods that allow GraphQL to be performed on an
# Action Cable channel. It also provides structure fro working with
# subscriptions
module Channel
extend ActiveSupport::Concern
i... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/base_generator.rb | Ruby | mit | 190 | master | 754 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Base Generator
#
# A module to help generators to operate
module BaseGenerator
TEMPALTES_PATH = '../../../generators/graphql/templates'
APP_MODULE_NAME = Rails.application.class.name.chomp('::Application')
def se... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/controller.rb | Ruby | mit | 190 | master | 5,518 | # frozen_string_literal: true
module Rails
module GraphQL
# = GraphQL Controller
#
# The controller helper methods that allow GraphQL to be performed on a
# Rails Controller class
module Controller
extend ActiveSupport::Concern
REQUEST_XARGS = %i[operation_name variables context sche... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/controller_runtime.rb | Ruby | mit | 190 | master | 1,002 | # frozen_string_literal: true
require 'active_support/core_ext/module/attr_internal'
module Rails
module GraphQL
# = GraphQL Controller Runtime
#
# Tool that calculates the runtime of a GraphQL operation. This works
# similar to how Rails ActiveRecord calculate its execution time while
# perform... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/log_subscriber.rb | Ruby | mit | 190 | master | 3,806 | # frozen_string_literal: true
require "active_support/parameter_filter"
module Rails
module GraphQL
# = GraphQL Log Subscriber
#
# This is the log tracker that works the same way as ActiveRecord when it
# has to report on logs that a query was performed
class LogSubscriber < ::ActiveSupport::Log... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/app/base_controller.rb | Ruby | mit | 190 | master | 285 | # frozen_string_literal: true
module GraphQL
base = ActionController::Base
base = ApplicationController if defined?(ApplicationController)
BaseController = Class.new(base) do
include ::Rails::GraphQL::Controller
skip_before_action :verify_authenticity_token
end
end |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/railties/app/base_channel.rb | Ruby | mit | 190 | master | 240 | # frozen_string_literal: true
module GraphQL
base = ActionCable::Channel::Base
base = ApplicationCable::Channel if defined?(ApplicationCable::Channel)
BaseChannel = Class.new(base) do
include ::Rails::GraphQL::Channel
end
end |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/interface.rb | Ruby | mit | 190 | master | 3,071 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL InterfaceType
#
# Interfaces represent a list of named fields and their types.
# See http://spec.graphql.org/June2018/#InterfaceTypeDefinition
#
# This class doesn't implements +valid_output?+ nor... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/creator.rb | Ruby | mit | 190 | master | 7,155 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL Type Creator
#
# This class helps to dynamically create types using a large set of
# settings that are provided through the named arguments. There are
# setting that are general to all types, and some a... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/object.rb | Ruby | mit | 190 | master | 3,798 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL ObjectType
#
# Objects represent a list of named fields, each of which yield a value of
# a specific type.
# See http://spec.graphql.org/June2018/#ObjectTypeDefinition
class Object < Type
... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/union.rb | Ruby | mit | 190 | master | 2,937 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL UnionType
#
# Unions represent an object that could be one of a list of GraphQL
# Object types.
# See http://spec.graphql.org/June2018/#UnionTypeDefinition
class Union < Type
include Helpe... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/enum.rb | Ruby | mit | 190 | master | 7,349 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL EnumType
#
# Enum types, like scalar types, also represent leaf values in a GraphQL
# type system. However Enum types describe the set of possible values.
# See http://spec.graphql.org/June2018/#EnumTyp... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/scalar.rb | Ruby | mit | 190 | master | 2,308 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL ScalarType
#
# Scalar types represent primitive leaf values in a GraphQL type system.
# See http://spec.graphql.org/June2018/#ScalarTypeDefinition
#
# This class works very similarly to ActiveMode... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/input.rb | Ruby | mit | 190 | master | 6,704 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# = GraphQL InputType
#
# Input defines a set of input fields; the input fields are either
# scalars, enums, or other input objects.
# See http://spec.graphql.org/June2018/#InputObjectTypeDefinition
class Inp... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/object/field_object.rb | Ruby | mit | 190 | master | 2,047 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# The introspection object for a field on objects and interfaces
class Object::FieldObject < Object
self.assigned_to = 'Rails::GraphQL::Field'
self.spec_object = true
delegate :fake_type_object, to: 'Object:... |
github | virtualshield/rails-graphql | https://github.com/virtualshield/rails-graphql | lib/rails/graphql/type/object/input_value_object.rb | Ruby | mit | 190 | master | 1,401 | # frozen_string_literal: true
module Rails
module GraphQL
class Type
# The introspection object for a input object
class Object::InputValueObject < Object
self.assigned_to = 'Rails::GraphQL::Field::InputField'
self.spec_object = true
def self.valid_member?(value)
va... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.