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 | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/subscriptions/serialize.rb | Ruby | mit | 5,430 | master | 6,196 | # frozen_string_literal: true
require "set"
module GraphQL
class Subscriptions
# Serialization helpers for passing subscription data around.
# @api private
module Serialize
GLOBALID_KEY = "__gid__"
SYMBOL_KEY = "__sym__"
SYMBOL_KEYS_KEY = "__sym_keys__"
TIMESTAMP_KEY = "__timestamp... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/subscriptions/action_cable_subscriptions.rb | Ruby | mit | 5,430 | master | 10,435 | # frozen_string_literal: true
module GraphQL
class Subscriptions
# A subscriptions implementation that sends data
# as ActionCable broadcastings.
#
# Some things to keep in mind:
#
# - No queueing system; ActiveJob should be added
# - Take care to reload context when re-delivering the subs... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/subscriptions/default_subscription_resolve_extension.rb | Ruby | mit | 5,430 | master | 3,014 | # frozen_string_literal: true
module GraphQL
class Subscriptions
class DefaultSubscriptionResolveExtension < GraphQL::Schema::FieldExtension
def resolve(context:, object: nil, objects: nil, arguments:)
if objects
has_override_implementation = @field.execution_mode != :direct_send
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/multiplex.rb | Ruby | mit | 5,430 | master | 1,646 | # frozen_string_literal: true
module GraphQL
module Execution
# Execute multiple queries under the same multiplex "umbrella".
# They can share a batching context and reduce redundant database hits.
#
# The flow is:
#
# - Multiplex instrumentation setup
# - Query instrumentation setup
#... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/field_resolve_step.rb | Ruby | mit | 5,430 | master | 23,202 | # frozen_string_literal: true
module GraphQL
module Execution
class FieldResolveStep
def initialize(parent_type:, runner:, key:, selections_step:)
@selections_step = selections_step
@key = key
@parent_type = parent_type
@ast_node = @ast_nodes = nil
@runner = runner
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/finalize.rb | Ruby | mit | 5,430 | master | 7,909 | # frozen_string_literal: true
module GraphQL
module Execution
class Finalize
def initialize(query, data, runner)
@query = query
@data = data
@static_type_at = runner.static_type_at
@runner = runner
@current_exec_path = query.path.dup
@current_result_path = que... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/selections_step.rb | Ruby | mit | 5,430 | master | 3,349 | # frozen_string_literal: true
module GraphQL
module Execution
class SelectionsStep
def initialize(parent_type:, selections:, objects:, results:, runner:, query:, path:, clobber: true)
@path = path
@parent_type = parent_type
@selections = selections
@runner = runner
@o... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter.rb | Ruby | mit | 5,430 | master | 6,729 | # frozen_string_literal: true
require "fiber"
require "graphql/execution/interpreter/argument_value"
require "graphql/execution/interpreter/arguments"
require "graphql/execution/interpreter/arguments_cache"
require "graphql/execution/interpreter/execution_errors"
require "graphql/execution/interpreter/runtime"
require ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/lookahead.rb | Ruby | mit | 5,430 | master | 15,529 | # frozen_string_literal: true
module GraphQL
module Execution
# Lookahead creates a uniform interface to inspect the forthcoming selections.
#
# It assumes that the AST it's working with is valid. (So, it's safe to use
# during execution, but if you're using it directly, be sure to validate first.)
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/load_argument_step.rb | Ruby | mit | 5,430 | master | 2,273 | # frozen_string_literal: true
module GraphQL
module Execution
class LoadArgumentStep
def initialize(field_resolve_step:, arguments:, load_receiver:, argument_value:, argument_definition:, argument_key:)
@field_resolve_step = field_resolve_step
@load_receiver = load_receiver
@argument... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/lazy.rb | Ruby | mit | 5,430 | master | 2,252 | # frozen_string_literal: true
require "graphql/execution/lazy/lazy_method_map"
module GraphQL
module Execution
# This wraps a value which is available, but not yet calculated, like a promise or future.
#
# Calling `#value` will trigger calculation & return the "lazy" value.
#
# This is an itty-bi... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/errors.rb | Ruby | mit | 5,430 | master | 3,812 | # frozen_string_literal: true
module GraphQL
module Execution
class Errors
# Register this handler, updating the
# internal handler index to maintain least-to-most specific.
#
# @param error_class [Class<Exception>]
# @param error_handlers [Hash]
# @param error_handler [Proc]
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/runner.rb | Ruby | mit | 5,430 | master | 15,145 | # frozen_string_literal: true
module GraphQL
module Execution
class Runner
def initialize(multiplex, authorization:)
@multiplex = multiplex
@schema = multiplex.schema
@steps_queue = []
@runtime_type_at = {}.compare_by_identity
@static_type_at = {}.compare_by_identity
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/directive_checks.rb | Ruby | mit | 5,430 | master | 1,052 | # frozen_string_literal: true
module GraphQL
module Execution
# Boolean checks for how an AST node's directives should
# influence its execution
# @api private
module DirectiveChecks
SKIP = "skip"
INCLUDE = "include"
module_function
# @return [Boolean] Should this node be inc... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/prepare_object_step.rb | Ruby | mit | 5,430 | master | 4,983 | # frozen_string_literal: true
module GraphQL
module Execution
class PrepareObjectStep
def initialize(object:, runner:, graphql_result:, key:, is_non_null:, field_resolve_step:, next_objects:, next_results:, is_from_array:)
@object = object
@runner = runner
@field_resolve_step = field... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/input_values.rb | Ruby | mit | 5,430 | master | 9,516 | # frozen_string_literal: true
module GraphQL
module Execution
class InputValues
def initialize(query, runner)
@query = query
@runner = runner
@variable_values = nil
end
def variable_values
@variable_values ||= begin
variable_nodes = @query.selected_oper... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/next.rb | Ruby | mit | 5,430 | master | 3,166 | # frozen_string_literal: true
require "graphql/execution/prepare_object_step"
require "graphql/execution/input_values"
require "graphql/execution/field_resolve_step"
require "graphql/execution/finalize"
require "graphql/execution/load_argument_step"
require "graphql/execution/runner"
require "graphql/execution/selectio... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/lazy/lazy_method_map.rb | Ruby | mit | 5,430 | master | 2,943 | # frozen_string_literal: true
require 'thread'
begin
require 'concurrent'
rescue LoadError
# no problem, we'll fallback to our own map
end
module GraphQL
module Execution
class Lazy
# {GraphQL::Schema} uses this to match returned values to lazy resolution methods.
# Methods may be registered for ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/arguments.rb | Ruby | mit | 5,430 | master | 3,352 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
# A wrapper for argument hashes in GraphQL queries.
#
# This object is immutable so that the runtime code can be sure that
# modifications don't leak from one use to another
#
# @see GraphQL::Query... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/execution_errors.rb | Ruby | mit | 5,430 | master | 743 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
class ExecutionErrors
def initialize(ctx, ast_node, path)
@context = ctx
@ast_node = ast_node
@path = path
end
def add(err_or_msg)
err = case err_or_msg
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/resolve.rb | Ruby | mit | 5,430 | master | 3,759 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
module Resolve
# Continue field results in `results` until there's nothing else to continue.
# @return [void]
# @deprecated Call `dataloader.run` instead
def self.resolve_all(results, dataloader)... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/arguments_cache.rb | Ruby | mit | 5,430 | master | 3,859 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
class ArgumentsCache
def initialize(query)
@query = query
@dataloader = query.context.dataloader
@storage = Hash.new do |h, argument_owner|
h[argument_owner] = if argument_owner... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/runtime.rb | Ruby | mit | 5,430 | master | 48,667 | # frozen_string_literal: true
require "graphql/execution/interpreter/runtime/graphql_result"
module GraphQL
module Execution
class Interpreter
# I think it would be even better if we could somehow make
# `continue_field` not recursive. "Trampolining" it somehow.
#
# @api private
cla... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/argument_value.rb | Ruby | mit | 5,430 | master | 1,073 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
# A container for metadata regarding arguments present in a GraphQL query.
# @see Interpreter::Arguments#argument_values for a hash of these objects.
class ArgumentValue
def initialize(definition:, value:, o... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/handles_raw_value.rb | Ruby | mit | 5,430 | master | 460 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
# Wrapper for raw values
class RawValue
include GraphQL::Execution::Finalizer
def finalize_graphql_result(query, result_data, result_key)
result_data[result_key] = @object
end
d... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/execution/interpreter/runtime/graphql_result.rb | Ruby | mit | 5,430 | master | 8,648 | # frozen_string_literal: true
module GraphQL
module Execution
class Interpreter
class Runtime
module GraphQLResult
def initialize(result_name, result_type, application_value, parent_result, is_non_null_in_parent, selections, is_eager, ast_node, graphql_arguments, graphql_field) # rubocop:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/connection.rb | Ruby | mit | 5,430 | master | 10,052 | # frozen_string_literal: true
module GraphQL
module Pagination
# A Connection wraps a list of items and provides cursor-based pagination over it.
#
# Connections were introduced by Facebook's `Relay` front-end framework, but
# proved to be generally useful for GraphQL APIs. When in doubt, use connect... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/array_connection.rb | Ruby | mit | 5,430 | master | 2,027 | # frozen_string_literal: true
require "graphql/pagination/connection"
module GraphQL
module Pagination
class ArrayConnection < Pagination::Connection
def nodes
load_nodes
@nodes
end
def has_previous_page
load_nodes
@has_previous_page
end
def has_nex... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/relation_connection.rb | Ruby | mit | 5,430 | master | 7,792 | # frozen_string_literal: true
require "graphql/pagination/connection"
module GraphQL
module Pagination
# A generic class for working with database query objects.
class RelationConnection < Pagination::Connection
def nodes
load_nodes
@nodes
end
def has_previous_page
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/mongoid_relation_connection.rb | Ruby | mit | 5,430 | master | 550 | # frozen_string_literal: true
require "graphql/pagination/relation_connection"
module GraphQL
module Pagination
class MongoidRelationConnection < Pagination::RelationConnection
def relation_offset(relation)
relation.options.skip
end
def relation_limit(relation)
relation.options... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/connections.rb | Ruby | mit | 5,430 | master | 5,780 | # frozen_string_literal: true
module GraphQL
module Pagination
# A schema-level connection wrapper manager.
#
# Attach as a plugin.
#
# @example Adding a custom wrapper
# class MySchema < GraphQL::Schema
# connections.add(MyApp::SearchResults, MyApp::SearchResultsConnection)
# ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/active_record_relation_connection.rb | Ruby | mit | 5,430 | master | 1,819 | # frozen_string_literal: true
require "graphql/pagination/relation_connection"
module GraphQL
module Pagination
# Customizes `RelationConnection` to work with `ActiveRecord::Relation`s.
class ActiveRecordRelationConnection < Pagination::RelationConnection
private
def relation_count(relation)
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/pagination/sequel_dataset_connection.rb | Ruby | mit | 5,430 | master | 635 | # frozen_string_literal: true
require "graphql/pagination/relation_connection"
module GraphQL
module Pagination
# Customizes `RelationConnection` to work with `Sequel::Dataset`s.
class SequelDatasetConnection < Pagination::RelationConnection
private
def relation_offset(relation)
relation... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/testing/mock_action_cable.rb | Ruby | mit | 5,430 | master | 3,613 | # frozen_string_literal: true
module GraphQL
module Testing
# A stub implementation of ActionCable.
# Any methods to support the mock backend have `mock` in the name.
#
# @example Configuring your schema to use MockActionCable in the test environment
# class MySchema < GraphQL::Schema
# ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/testing/helpers.rb | Ruby | mit | 5,430 | master | 6,592 | # frozen_string_literal: true
module GraphQL
module Testing
module Helpers
# @param schema_class [Class<GraphQL::Schema>]
# @return [Module] A helpers module which always uses the given schema
def self.for(schema_class)
SchemaHelpers.for(schema_class)
end
class Error < Graph... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/null_dataloader.rb | Ruby | mit | 5,430 | master | 2,001 | # frozen_string_literal: true
module GraphQL
class Dataloader
# GraphQL-Ruby uses this when Dataloader isn't enabled.
#
# It runs execution code inline and gathers lazy objects (eg. Promises)
# and resolves them during {#run}.
class NullDataloader < Dataloader
def initialize(*)
@laz... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/active_record_association_source.rb | Ruby | mit | 5,430 | master | 2,577 | # frozen_string_literal: true
require "graphql/dataloader/source"
require "graphql/dataloader/active_record_source"
module GraphQL
class Dataloader
class ActiveRecordAssociationSource < GraphQL::Dataloader::Source
RECORD_SOURCE_CLASS = ActiveRecordSource
def initialize(association, scope = nil)
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/source.rb | Ruby | mit | 5,430 | master | 7,930 | # frozen_string_literal: true
module GraphQL
class Dataloader
class Source
# Called by {Dataloader} to prepare the {Source}'s internal state
# @api private
def setup(dataloader)
# These keys have been requested but haven't been fetched yet
@pending = {}
# These keys have... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/request.rb | Ruby | mit | 5,430 | master | 675 | # frozen_string_literal: true
module GraphQL
class Dataloader
# @see Source#request which returns an instance of this
class Request
def initialize(source, key)
@source = source
@key = key
end
# Call this method to cause the current Fiber to wait for the results of this reque... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/request_all.rb | Ruby | mit | 5,430 | master | 490 | # frozen_string_literal: true
module GraphQL
class Dataloader
# @see Source#request_all which returns an instance of this.
class RequestAll < Request
def initialize(source, keys)
@source = source
@keys = keys
end
# Call this method to cause the current Fiber to wait for the ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/async_dataloader.rb | Ruby | mit | 5,430 | master | 3,964 | # frozen_string_literal: true
module GraphQL
class Dataloader
class AsyncDataloader < Dataloader
def yield(source = Fiber[:__graphql_current_dataloader_source])
trace = Fiber[:__graphql_current_multiplex]&.current_trace
trace&.dataloader_fiber_yield(source)
if (condition = Fiber[:gra... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dataloader/active_record_source.rb | Ruby | mit | 5,430 | master | 1,368 | # frozen_string_literal: true
require "graphql/dataloader/source"
module GraphQL
class Dataloader
class ActiveRecordSource < GraphQL::Dataloader::Source
def initialize(model_class, find_by: model_class.primary_key)
@model_class = model_class
@find_by = find_by
@find_by_many = find_b... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/type_type.rb | Ruby | mit | 5,430 | master | 5,154 | # frozen_string_literal: true
module GraphQL
module Introspection
class TypeType < Introspection::BaseObject
graphql_name "__Type"
description "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in "\
"GraphQL as represented by the `__TypeKind` enum... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/directive_location_enum.rb | Ruby | mit | 5,430 | master | 582 | # frozen_string_literal: true
module GraphQL
module Introspection
class DirectiveLocationEnum < GraphQL::Schema::Enum
graphql_name "__DirectiveLocation"
description "A Directive can be adjacent to many parts of the GraphQL language, "\
"a __DirectiveLocation describes one such possib... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/introspection_query.rb | Ruby | mit | 5,430 | master | 323 | # frozen_string_literal: true
# This query is used by graphql-client so don't add the includeDeprecated
# argument for inputFields since the server may not support it. Two stage
# introspection queries will be required to handle this in clients.
GraphQL::Introspection::INTROSPECTION_QUERY = GraphQL::Introspection.quer... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/schema_type.rb | Ruby | mit | 5,430 | master | 1,844 | # frozen_string_literal: true
module GraphQL
module Introspection
class SchemaType < Introspection::BaseObject
graphql_name "__Schema"
description "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all "\
"available types and directives on the server, as well... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/dynamic_fields.rb | Ruby | mit | 5,430 | master | 424 | # frozen_string_literal: true
module GraphQL
module Introspection
class DynamicFields < Introspection::BaseObject
field :__typename, String, "The name of this type", null: false, dynamic_introspection: true, resolve_each: true
def __typename
self.class.__typename(object, context)
end
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/entry_points.rb | Ruby | mit | 5,430 | master | 1,201 | # frozen_string_literal: true
module GraphQL
module Introspection
class EntryPoints < Introspection::BaseObject
field :__schema, GraphQL::Schema::LateBoundType.new("__Schema"), "This GraphQL schema", null: false, dynamic_introspection: true, resolve_static: :__schema
field :__type, GraphQL::Schema::La... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/directive_type.rb | Ruby | mit | 5,430 | master | 1,844 | # frozen_string_literal: true
module GraphQL
module Introspection
class DirectiveType < Introspection::BaseObject
graphql_name "__Directive"
description "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document."\
"\n\n"\
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/field_type.rb | Ruby | mit | 5,430 | master | 1,390 | # frozen_string_literal: true
module GraphQL
module Introspection
class FieldType < Introspection::BaseObject
graphql_name "__Field"
description "Object and Interface types are described by a list of Fields, each of which has "\
"a name, potentially a list of arguments, and a return ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/base_object.rb | Ruby | mit | 5,430 | master | 293 | # frozen_string_literal: true
module GraphQL
module Introspection
class BaseObject < GraphQL::Schema::Object
introspection(true)
def self.field(*args, **kwargs, &block)
kwargs[:introspection] = true
super(*args, **kwargs, &block)
end
end
end
end |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/type_kind_enum.rb | Ruby | mit | 5,430 | master | 388 | # frozen_string_literal: true
module GraphQL
module Introspection
class TypeKindEnum < GraphQL::Schema::Enum
graphql_name "__TypeKind"
description "An enum describing what kind of type a given `__Type` is."
GraphQL::TypeKinds::TYPE_KINDS.each do |type_kind|
value(type_kind.name, type_kin... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/input_value_type.rb | Ruby | mit | 5,430 | master | 2,848 | # frozen_string_literal: true
module GraphQL
module Introspection
class InputValueType < Introspection::BaseObject
graphql_name "__InputValue"
description "Arguments provided to Fields or Directives and the input fields of an "\
"InputObject are represented as Input Values which desc... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/introspection/enum_value_type.rb | Ruby | mit | 5,430 | master | 834 | # frozen_string_literal: true
module GraphQL
module Introspection
class EnumValueType < Introspection::BaseObject
graphql_name "__EnumValue"
description "One possible value for a given Enum. Enum values are unique values, not a "\
"placeholder for a string or numeric value. However a... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/enum_generator.rb | Ruby | mit | 5,430 | master | 681 | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate an enum type by name, with the given values.
# To add a `value:` option, add another value after a `:`.
#
# ```
# rails g graphql:enum ProgrammingLanguage RUBY PYTHON PERL PERL6:"... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/type_generator.rb | Ruby | mit | 5,430 | master | 4,614 | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require 'graphql'
require 'active_support'
require 'active_support/core_ext/string/inflections'
require_relative 'core'
module Graphql
module Generators
class TypeGeneratorBase < Rails::Generators::NamedBase
include Co... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/detailed_trace_generator.rb | Ruby | mit | 5,430 | master | 2,838 | # frozen_string_literal: true
require 'rails/generators/active_record'
module Graphql
module Generators
class DetailedTraceGenerator < ::Rails::Generators::Base
include ::Rails::Generators::Migration
desc "Install GraphQL::Tracing::DetailedTrace for your schema"
source_root File.expand_path('..... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/scalar_generator.rb | Ruby | mit | 5,430 | master | 467 | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate a scalar type by given name.
#
# ```
# rails g graphql:scalar Date
# ```
class ScalarGenerator < TypeGeneratorBase
desc "Create a GraphQL::ScalarType with the given name... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/relay_generator.rb | Ruby | mit | 5,430 | master | 470 | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
module Graphql
module Generators
class RelayGenerator < Rails::Generators::Base
include Core
include Relay
desc "Add base types and fields for Relay-style n... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/mutation_generator.rb | Ruby | mit | 5,430 | master | 1,121 | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/named_base'
require_relative 'core'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutatio... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/install_generator.rb | Ruby | mit | 5,430 | master | 8,256 | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
module Graphql
module Generators
# Add GraphQL to a Rails app with `rails g graphql:install`.
#
# Setup a folder structure for GraphQL:
#
# ```
# - app/
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/loader_generator.rb | Ruby | mit | 5,430 | master | 589 | # frozen_string_literal: true
require 'rails/generators'
require "rails/generators/named_base"
require_relative "core"
module Graphql
module Generators
# @example Generate a `GraphQL::Batch` loader by name.
# rails g graphql:loader RecordLoader
class LoaderGenerator < Rails::Generators::NamedBase
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/mutation_create_generator.rb | Ruby | mit | 5,430 | master | 575 | # frozen_string_literal: true
require_relative 'orm_mutations_base'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutation CreatePostMutation
class MutationCreateGenera... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/mutation_update_generator.rb | Ruby | mit | 5,430 | master | 575 | # frozen_string_literal: true
require_relative 'orm_mutations_base'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutation UpdatePostMutation
class MutationUpdateGenera... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/orm_mutations_base.rb | Ruby | mit | 5,430 | master | 1,529 | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/named_base'
require_relative 'core'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutatio... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/union_generator.rb | Ruby | mit | 5,430 | master | 868 | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate a union type by name
# with the specified member types.
#
# ```
# rails g graphql:union SearchResultType ImageType AudioType
# ```
class UnionGenerator < TypeGeneratorBase... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/input_generator.rb | Ruby | mit | 5,430 | master | 1,267 | # frozen_string_literal: true
require 'generators/graphql/type_generator'
require 'generators/graphql/field_extractor'
module Graphql
module Generators
# Generate an input type by name,
# with the specified fields.
#
# ```
# rails g graphql:object PostType name:string!
# ```
class InputGe... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/core.rb | Ruby | mit | 5,430 | master | 1,650 | # frozen_string_literal: true
require 'rails/generators/base'
module Graphql
module Generators
module Core
def self.included(base)
base.send(
:class_option,
:directory,
type: :string,
default: "app/graphql",
desc: "Directory where generated files sh... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/object_generator.rb | Ruby | mit | 5,430 | master | 1,473 | # frozen_string_literal: true
require 'generators/graphql/type_generator'
require 'generators/graphql/field_extractor'
module Graphql
module Generators
# Generate an object type by name,
# with the specified fields.
#
# ```
# rails g graphql:object PostType name:String!
# ```
#
# Add ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/interface_generator.rb | Ruby | mit | 5,430 | master | 595 | # frozen_string_literal: true
require 'generators/graphql/type_generator'
module Graphql
module Generators
# Generate an interface type by name,
# with the specified fields.
#
# ```
# rails g graphql:interface NamedEntityType name:String!
# ```
class InterfaceGenerator < TypeGeneratorBase... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/mutation_delete_generator.rb | Ruby | mit | 5,430 | master | 575 | # frozen_string_literal: true
require_relative 'orm_mutations_base'
module Graphql
module Generators
# TODO: What other options should be supported?
#
# @example Generate a `GraphQL::Schema::RelayClassicMutation` by name
# rails g graphql:mutation DeletePostMutation
class MutationDeleteGenera... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/relay.rb | Ruby | mit | 5,430 | master | 2,588 | # frozen_string_literal: true
module Graphql
module Generators
module Relay
def install_relay
# Add Node, `node(id:)`, and `nodes(ids:)`
template("node_type.erb", "#{options[:directory]}/types/node_type.rb")
in_root do
fields = <<-RUBY
field :node, Types::NodeType, null... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/field_extractor.rb | Ruby | mit | 5,430 | master | 737 | # frozen_string_literal: true
require 'rails/generators/base'
module Graphql
module Generators
module FieldExtractor
def fields
columns = []
columns += (klass&.columns&.map { |c| generate_column_string(c) } || [])
columns + custom_fields
end
def generate_column_string(... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/generators/graphql/install/mutation_root_generator.rb | Ruby | mit | 5,430 | master | 1,072 | # frozen_string_literal: true
require "rails/generators/base"
require_relative "../core"
module Graphql
module Generators
module Install
class MutationRootGenerator < Rails::Generators::Base
include Core
desc "Create mutation base type, mutation root type, and adds the latter to the schem... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | benchmark/batch_loading.rb | Ruby | mit | 5,430 | master | 3,354 | # frozen_string_literal: true
module BatchLoading
class GraphQLBatchSchema < GraphQL::Schema
DATA = [
{ id: "1", name: "Bulls", player_ids: ["2", "3"] },
{ id: "2", name: "Michael Jordan", team_id: "1" },
{ id: "3", name: "Scottie Pippin", team_id: "1" },
{ id: "4", name: "Braves", player_... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | benchmark/run.rb | Ruby | mit | 5,430 | master | 23,733 | # frozen_string_literal: true
require "graphql"
ADD_WARDEN = false
TESTING_EXEC_NEXT = !!ENV["GRAPHQL_FUTURE"]
TESTING_METHOD = !!ENV["TEST_METHOD"]
require "jazz"
require "benchmark/ips"
require "stackprof"
require "memory_profiler"
require "graphql/batch"
require "securerandom"
module GraphQLBenchmark
QUERY_STRING... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | guides/_plugins/api_doc.rb | Ruby | mit | 5,430 | master | 7,216 | # frozen_string_literal: true
require_relative "../../lib/graphql/version"
require "kramdown"
module GraphQLSite
API_DOC_ROOT = "/api-doc/#{GraphQL::VERSION}/"
module APIDoc
def api_doc(input)
if !input.start_with?("GraphQL")
ruby_ident = "GraphQL::#{input}"
else
ruby_ident = input... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | guides/_tasks/site.rb | Ruby | mit | 5,430 | master | 6,111 | # frozen_string_literal: true
require "yard"
require "webrick"
namespace :apidocs do
desc "Fetch a gem version from RubyGems, build the docs"
task :gen_version, [:version] do |t, args|
# GITHUB_REF comes from GitHub Actions
version = args[:version] || ENV["GITHUB_REF"] || raise("A version is required")
... |
github | slim-template/slim | https://github.com/slim-template/slim | Gemfile | Ruby | mit | 5,359 | main | 905 | source 'https://rubygems.org/'
gemspec
gem 'logger', '~> 1.7'
gem 'ostruct', '~> 0.6'
gem 'minitest', '~> 5.15'
gem 'rake', '~> 13.3'
gem 'kramdown', '~> 2.5'
if ENV['TEMPLE'] && ENV['TEMPLE'] != 'master'
gem 'temple', "= #{ENV['TEMPLE']}"
else
# Test against temple master by default
gem 'temple', github: 'jud... |
github | slim-template/slim | https://github.com/slim-template/slim | Rakefile | Ruby | mit | 5,359 | main | 1,933 | begin
require 'bundler/setup'
Bundler::GemHelper.install_tasks
rescue Exception
end
require 'rake/testtask'
task 'test' => %w(test:core test:literate test:logic_less test:translator test:smart test:include)
namespace 'test' do
Rake::TestTask.new('core') do |t|
t.libs << 'lib' << 'test/core'
t.test_file... |
github | slim-template/slim | https://github.com/slim-template/slim | slim.gemspec | Ruby | mit | 5,359 | main | 1,493 | require File.dirname(__FILE__) + '/lib/slim/version'
require 'date'
Gem::Specification.new do |s|
s.name = 'slim'
s.version = Slim::VERSION
s.date = Date.today.to_s
s.authors = ['Daniel Mendler', 'Andrew Stone', 'Fred Wu']
s.email = ['mail@daniel-mend... |
github | slim-template/slim | https://github.com/slim-template/slim | test/translator/test_translator.rb | Ruby | mit | 5,359 | main | 2,588 | require 'helper'
require 'slim/translator'
class TestSlimTranslator < TestSlim
def setup
super
Slim::Engine.set_options tr: true, tr_fn: 'TestSlimTranslator.tr'
end
def self.tr(s)
s.upcase
end
def self.tr_reverse(s)
s.reverse.gsub(/(\d+)%/, '%\1')
end
def test_no_translation_of_embedde... |
github | slim-template/slim | https://github.com/slim-template/slim | test/literate/helper.rb | Ruby | mit | 5,359 | main | 452 | require 'slim'
require 'slim/logic_less'
require 'slim/translator'
require 'slim/grammar'
require 'minitest/autorun'
Slim::Engine.after Slim::Parser, Temple::Filters::Validator, grammar: Slim::Grammar
Slim::Engine.before :Pretty, Temple::Filters::Validator
Slim::Engine.set_options tr: false, logic_less: false
class ... |
github | slim-template/slim | https://github.com/slim-template/slim | test/literate/run.rb | Ruby | mit | 5,359 | main | 2,462 | require 'temple'
class LiterateTest < Temple::Engine
class Parser < Temple::Parser
def call(lines)
stack = [[:multi]]
until lines.empty?
case lines.shift
when /\A(#+)\s*(.*)\Z/
stack.pop(stack.size - $1.size)
block = [:multi]
stack.last << [:section, $2, ... |
github | slim-template/slim | https://github.com/slim-template/slim | test/logic_less/test_logic_less.rb | Ruby | mit | 5,359 | main | 7,125 | require 'helper'
require 'slim/logic_less'
class TestSlimLogicLess < TestSlim
class Scope
def initialize
@hash = {
person: [
{ name: 'Joe', age: 1, selected: true },
{ name: 'Jack', age: 2 }
]
}
end
end
def test_lambda
so... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/Rakefile | Ruby | mit | 5,359 | main | 265 | # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
Dummy::Application.load_tasks |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/test/helper.rb | Ruby | mit | 5,359 | main | 1,000 | # Configure Rails Envinronment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment.rb", __FILE__)
require "rails/test_help"
require "nokogiri"
require 'rails-controller-testing'
Rails::Controller::Testing.install
Rails.backtrace_cleaner.remove_silencers!
class ActionDispatch::IntegrationTes... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/test/test_slim.rb | Ruby | mit | 5,359 | main | 3,112 | require File.expand_path('../helper', __FILE__)
class TestSlim < ActionDispatch::IntegrationTest
test "normal view" do
get "/slim/normal"
assert_response :success
assert_template "slim/normal"
assert_template "layouts/application"
assert_html "<h1>Hello Slim!</h1>"
end
test "variant" do
... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/routes.rb | Ruby | mit | 5,359 | main | 1,794 | Dummy::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
resources :entries
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/application.rb | Ruby | mit | 5,359 | main | 1,936 | require File.expand_path('../boot', __FILE__)
require 'logger'
require 'active_model/railtie'
require 'action_controller/railtie'
require 'action_view/railtie'
#require 'active_record/railtie'
#require 'action_mailer/railtie'
#require 'sprockets/railtie'
require 'slim'
module Dummy
class Application < Rails::Applic... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/boot.rb | Ruby | mit | 5,359 | main | 271 | require 'rubygems'
gemfile = File.expand_path('../../../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup(:default, :integration)
end
$:.unshift File.expand_path('../../../../../../lib', __FILE__) |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/environments/test.rb | Ruby | mit | 5,359 | main | 1,445 | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test su... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/initializers/session_store.rb | Ruby | mit | 5,359 | main | 407 | # Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails gener... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/initializers/mime_types.rb | Ruby | mit | 5,359 | main | 205 | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/initializers/inflections.rb | Ruby | mit | 5,359 | main | 376 | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/config/initializers/backtrace_silencers.rb | Ruby | mit | 5,359 | main | 404 | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/app/models/entry.rb | Ruby | mit | 5,359 | main | 252 | class Entry
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :name
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
end |
github | slim-template/slim | https://github.com/slim-template/slim | test/rails/app/controllers/slim_controller.rb | Ruby | mit | 5,359 | main | 721 | class SlimController < ApplicationController
def normal
end
def xml
end
def no_layout
render layout: false
end
def variables
@hello = "Hello Slim with variables!"
end
def partial
end
def streaming
@hello = "Hello Streaming!"
render :content_for, stream: true
end
def integ... |
github | slim-template/slim | https://github.com/slim-template/slim | test/include/test_include.rb | Ruby | mit | 5,359 | main | 608 | require 'helper'
require 'slim/include'
class TestSlimInclude < TestSlim
def test_include
source = %q{
br/
a: include slimfile
b: include textfile
c: include slimfile.slim
d: include subdir/test
}
assert_html '<br /><a>slim1recslim2</a><b>1+2=3</b><c>slim1recslim2</c><d>subdir</d>', source, include_dirs: [Fi... |
github | slim-template/slim | https://github.com/slim-template/slim | test/core/test_ruby_errors.rb | Ruby | mit | 5,359 | main | 3,400 | require 'helper'
class TestSlimRubyErrors < TestSlim
def test_multline_attribute
source = %q{
p(data-1=1
data2-=1)
p
= unknown_ruby_method
}
assert_ruby_error NameError, "test.slim:5", source, file: 'test.slim'
end
def test_broken_output_line
source = %q{
p = hello_world + \
hello_world + \... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.