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/static_validation/rules/query_root_exists_error.rb | Ruby | mit | 5,430 | master | 522 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class QueryRootExistsError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
extensions... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/directives_are_defined.rb | Ruby | mit | 5,430 | master | 959 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module DirectivesAreDefined
def initialize(*)
super
end
def on_directive(node, parent)
if !@types.directive_exists?(node.name)
@directives_are_defined_errors_by_name ||= {}
error = @directiv... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/required_arguments_are_present.rb | Ruby | mit | 5,430 | master | 1,948 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module RequiredArgumentsArePresent
def initialize(*)
super
@required_args_cache = {}.compare_by_identity
end
def on_field(node, _parent)
assert_required_args(node, @current_field_definition)
sup... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/fields_will_merge.rb | Ruby | mit | 5,430 | master | 19,021 | # frozen_string_literal: true
# frozen_string_literal: true
module GraphQL
module StaticValidation
module FieldsWillMerge
# Validates that a selection set is valid if all fields (including spreading any
# fragments) either correspond to distinct response names or can be merged
# without ambigui... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb | Ruby | mit | 5,430 | master | 745 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class DirectivesAreInValidLocationsError < StaticValidation::Error
attr_reader :target_name
attr_reader :name
def initialize(message, path: nil, nodes: [], target:, name: nil)
super(message, path: path, nodes: nodes)
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/mutation_root_exists_error.rb | Ruby | mit | 5,430 | master | 528 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class MutationRootExistsError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
extensi... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb | Ruby | mit | 5,430 | master | 816 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module SubscriptionRootExistsAndSingleSubscriptionSelection
def on_operation_definition(node, parent)
if node.operation_type == "subscription"
if context.types.subscription_root.nil?
add_error(GraphQL::StaticV... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb | Ruby | mit | 5,430 | master | 665 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentsAreOnCompositeTypesError < StaticValidation::Error
attr_reader :type_name
attr_reader :argument_name
def initialize(message, path: nil, nodes: [], type:)
super(message, path: path, nodes: nodes)
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb | Ruby | mit | 5,430 | master | 633 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class FragmentNamesAreUniqueError < StaticValidation::Error
attr_reader :fragment_name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@fragment_name = name
end
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/directives_are_defined_error.rb | Ruby | mit | 5,430 | master | 646 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class DirectivesAreDefinedError < StaticValidation::Error
attr_reader :directive_name
def initialize(message, path: nil, nodes: [], directive:)
super(message, path: path, nodes: nodes)
@directive_name = directive
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb | Ruby | mit | 5,430 | master | 2,996 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module DirectivesAreInValidLocations
include GraphQL::Language
def on_directive(node, parent)
validate_location(node, parent, context.schema_directives)
super
end
private
LOCATION_MESSAGE_NAMES = ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/argument_names_are_unique_error.rb | Ruby | mit | 5,430 | master | 599 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class ArgumentNamesAreUniqueError < StaticValidation::Error
attr_reader :name
def initialize(message, path: nil, nodes: [], name:)
super(message, path: path, nodes: nodes)
@name = name
end
# A hash repre... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/no_definitions_are_present.rb | Ruby | mit | 5,430 | master | 1,484 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module NoDefinitionsArePresent
include GraphQL::StaticValidation::Error::ErrorHelper
def initialize(*)
super
@schema_definition_nodes = []
end
def on_invalid_node(node, parent)
@schema_definition... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/input_object_names_are_unique.rb | Ruby | mit | 5,430 | master | 821 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module InputObjectNamesAreUnique
def on_input_object(node, parent)
validate_input_fields(node)
super
end
private
def validate_input_fields(node)
input_field_defns = node.arguments
input_f... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/argument_literals_are_compatible.rb | Ruby | mit | 5,430 | master | 2,403 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module ArgumentLiteralsAreCompatible
def on_argument(node, parent)
# Check the child arguments first;
# don't add a new error if one of them reports an error
super
# Don't validate variables here
if... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/no_definitions_are_present_error.rb | Ruby | mit | 5,430 | master | 534 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class NoDefinitionsArePresentError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
ext... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/subscription_root_exists_error.rb | Ruby | mit | 5,430 | master | 536 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class SubscriptionRootExistsError < StaticValidation::Error
def initialize(message, path: nil, nodes: [])
super(message, path: path, nodes: nodes)
end
# A hash representation of this Message
def to_h
ext... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/arguments_are_defined_error.rb | Ruby | mit | 5,430 | master | 885 | # frozen_string_literal: true
module GraphQL
module StaticValidation
class ArgumentsAreDefinedError < StaticValidation::Error
attr_reader :name
attr_reader :type_name
attr_reader :argument_name
attr_reader :parent
def initialize(message, path: nil, nodes: [], name:, type:, argument_... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/static_validation/rules/fragments_are_used.rb | Ruby | mit | 5,430 | master | 1,062 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module FragmentsAreUsed
def on_document(node, parent)
super
dependency_map = context.dependencies
dependency_map.unmet_dependencies.each do |op_defn, spreads|
spreads.each do |fragment_spread|
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/application_controller.rb | Ruby | mit | 5,430 | master | 1,753 | # frozen_string_literal: true
require "action_controller"
module Graphql
class Dashboard < Rails::Engine
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
prepend_view_path(File.expand_path("../views", __FILE__))
content_security_policy do |policy|
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/limiters.rb | Ruby | mit | 5,430 | master | 3,411 | # frozen_string_literal: true
require_relative "./installable"
module Graphql
class Dashboard < Rails::Engine
module Limiters
class LimitersController < Dashboard::ApplicationController
include Installable
FALLBACK_CSP_NONCE_GENERATOR = ->(_req) { SecureRandom.hex(32) }
def show
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/detailed_traces.rb | Ruby | mit | 5,430 | master | 1,455 | # frozen_string_literal: true
require_relative "./installable"
module Graphql
class Dashboard < Rails::Engine
module DetailedTraces
class TracesController < Graphql::Dashboard::ApplicationController
include Installable
def index
@last = params[:last]&.to_i || 50
@before ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/subscriptions.rb | Ruby | mit | 5,430 | master | 3,994 | # frozen_string_literal: true
require_relative "./installable"
module Graphql
class Dashboard < Rails::Engine
module Subscriptions
class BaseController < Graphql::Dashboard::ApplicationController
include Installable
def feature_installed?
defined?(GraphQL::Pro::Subscriptions) && s... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/installable.rb | Ruby | mit | 5,430 | master | 675 | # frozen_string_literal: true
module Graphql
class Dashboard < Rails::Engine
module Installable
def self.included(child_module)
child_module.before_action(:check_installed)
end
def feature_installed?
raise "Implement #{self.class}#feature_installed? to check whether this should ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/statics_controller.rb | Ruby | mit | 5,430 | master | 810 | # frozen_string_literal: true
module Graphql
class Dashboard < Rails::Engine
class StaticsController < ApplicationController
skip_forgery_protection
# Use an explicit list of files to avoid any chance of reading other files from disk
STATICS = {}
[
"icon.png",
"header-icon... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/dashboard/operation_store.rb | Ruby | mit | 5,430 | master | 7,271 | # frozen_string_literal: true
require_relative "./installable"
module Graphql
class Dashboard < Rails::Engine
module OperationStore
class BaseController < Dashboard::ApplicationController
include Installable
private
def feature_installed?
schema_class.respond_to?(:operati... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/appsignal_tracing.rb | Ruby | mit | 5,430 | master | 1,790 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class AppsignalTracing < PlatformTracing
self.platform_keys = {
"lex" => "lex.graphql",
"parse" => "parse.graphql",
"validate" => "validate.graphql",
"analyze_query" => "a... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/scout_tracing.rb | Ruby | mit | 5,430 | master | 1,893 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class ScoutTracing < PlatformTracing
INSTRUMENT_OPTS = { scope: true }
self.platform_keys = {
"lex" => "lex.graphql",
"parse" => "parse.graphql",
"validate" => "validate.gr... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/legacy_hooks_trace.rb | Ruby | mit | 5,430 | master | 2,586 | # frozen_string_literal: true
module GraphQL
module Tracing
module LegacyHooksTrace
def execute_multiplex(multiplex:)
multiplex_instrumenters = multiplex.schema.instrumenters[:multiplex]
query_instrumenters = multiplex.schema.instrumenters[:query]
# First, run multiplex instrumentat... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/prometheus_trace.rb | Ruby | mit | 5,430 | master | 2,932 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby times to Prometheus.
#
# The PrometheusExporter server must be run with a custom type collector that extends `GraphQL::Tracing::PrometheusTracing::GraphQLCollector`.
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/legacy_trace.rb | Ruby | mit | 5,430 | master | 222 | # frozen_string_literal: true
require "graphql/tracing/trace"
require "graphql/tracing/call_legacy_tracers"
module GraphQL
module Tracing
class LegacyTrace < Trace
include CallLegacyTracers
end
end
end |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/platform_tracing.rb | Ruby | mit | 5,430 | master | 4,915 | # frozen_string_literal: true
module GraphQL
module Tracing
# Each platform provides:
# - `.platform_keys`
# - `#platform_trace`
# - `#platform_field_key(type, field)`
# @api private
class PlatformTracing
class << self
attr_accessor :platform_keys
def inherited(child_cl... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/perfetto_trace.rb | Ruby | mit | 5,430 | master | 30,592 | # frozen_string_literal: true
module GraphQL
module Tracing
# This produces a trace file for inspecting in the [Perfetto Trace Viewer](https://ui.perfetto.dev).
#
# To get the file, call {#write} on the trace.
#
# Use "trace modes" to configure this to run on command or on a sample of traffic.
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/notifications_tracing.rb | Ruby | mit | 5,430 | master | 2,186 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
# This implementation forwards events to a notification handler (i.e.
# ActiveSupport::Notifications or Dry::Monitor::Notifications)
# with a `graphql` suffix.
#
# @see KEYS for event names
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/prometheus_tracing.rb | Ruby | mit | 5,430 | master | 2,067 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class PrometheusTracing < PlatformTracing
DEFAULT_WHITELIST = ['execute_field', 'execute_field_lazy'].freeze
DEFAULT_COLLECTOR_TYPE = 'graphql'.freeze
self.platform_keys = {
'lex' =>... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/appsignal_trace.rb | Ruby | mit | 5,430 | master | 1,921 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# Instrumentation for reporting GraphQL-Ruby times to Appsignal.
#
# @example Installing the tracer
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::AppsignalTrace
# en... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/platform_trace.rb | Ruby | mit | 5,430 | master | 4,212 | # frozen_string_literal: true
module GraphQL
module Tracing
module PlatformTrace
def initialize(trace_scalars: false, **_options)
@trace_scalars = trace_scalars
@platform_key_cache = Hash.new { |h, mod| h[mod] = mod::KeyCache.new }
super
end
module BaseKeyCache
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/statsd_tracing.rb | Ruby | mit | 5,430 | master | 1,190 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class StatsdTracing < PlatformTracing
self.platform_keys = {
'lex' => "graphql.lex",
'parse' => "graphql.parse",
'validate' => "graphql.validate",
'analyze_query' => "grap... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/appoptics_tracing.rb | Ruby | mit | 5,430 | master | 5,959 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
# This class uses the AppopticsAPM SDK from the appoptics_apm gem to create
# traces for GraphQL.
#
# There are 4 configurations available. They can be set in the
# appoptics_apm config file o... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/data_dog_tracing.rb | Ruby | mit | 5,430 | master | 3,010 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class DataDogTracing < PlatformTracing
self.platform_keys = {
'lex' => 'lex.graphql',
'parse' => 'parse.graphql',
'validate' => 'validate.graphql',
'analyze_query' => 'ana... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/new_relic_tracing.rb | Ruby | mit | 5,430 | master | 1,851 | # frozen_string_literal: true
require "graphql/tracing/platform_tracing"
module GraphQL
module Tracing
class NewRelicTracing < PlatformTracing
self.platform_keys = {
"lex" => "GraphQL/lex",
"parse" => "GraphQL/parse",
"validate" => "GraphQL/validate",
"analyze_query" => "Gr... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/active_support_notifications_trace.rb | Ruby | mit | 5,430 | master | 820 | # frozen_string_literal: true
require "graphql/tracing/notifications_trace"
module GraphQL
module Tracing
# This implementation forwards events to ActiveSupport::Notifications with a `graphql` suffix.
#
# @example Sending execution events to ActiveSupport::Notifications
# class MySchema < GraphQL:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/trace.rb | Ruby | mit | 5,430 | master | 6,206 | # frozen_string_literal: true
require "graphql/tracing"
module GraphQL
module Tracing
# This is the base class for a `trace` instance whose methods are called during query execution.
# "Trace modes" are subclasses of this with custom tracing modules mixed in.
#
# A trace module may implement any of ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/detailed_trace.rb | Ruby | mit | 5,430 | master | 5,893 | # frozen_string_literal: true
if defined?(ActiveRecord)
require "graphql/tracing/detailed_trace/active_record_backend"
end
require "graphql/tracing/detailed_trace/memory_backend"
require "graphql/tracing/detailed_trace/redis_backend"
module GraphQL
module Tracing
# `DetailedTrace` can make detailed profiles fo... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/active_support_notifications_tracing.rb | Ruby | mit | 5,430 | master | 670 | # frozen_string_literal: true
require "graphql/tracing/notifications_tracing"
module GraphQL
module Tracing
# This implementation forwards events to ActiveSupport::Notifications
# with a `graphql` suffix.
#
# @see KEYS for event names
module ActiveSupportNotificationsTracing
# A cache of f... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/new_relic_trace.rb | Ruby | mit | 5,430 | master | 2,334 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby time to New Relic
#
# @example Installing the tracer
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::NewRelicTrace
#
# # O... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/data_dog_trace.rb | Ruby | mit | 5,430 | master | 2,584 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting to DataDog
# @example Adding this tracer to your schema
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::DataDogTrace
# end
# @example Skipping... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/appoptics_trace.rb | Ruby | mit | 5,430 | master | 8,600 | # frozen_string_literal: true
require "graphql/tracing/platform_trace"
module GraphQL
module Tracing
# This class uses the AppopticsAPM SDK from the appoptics_apm gem to create
# traces for GraphQL.
#
# There are 4 configurations available. They can be set in the
# appoptics_apm config file or ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/scout_trace.rb | Ruby | mit | 5,430 | master | 1,478 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for sending GraphQL-Ruby times to Scout
#
# @example Adding this tracer to your schema
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::ScoutTrace
# end
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/statsd_trace.rb | Ruby | mit | 5,430 | master | 1,345 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby times to Statsd.
# Passing any Statsd client that implements `.time(name) { ... }`
# and `.timing(name, ms)` will work.
#
# @example Installing this tracer
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/call_legacy_tracers.rb | Ruby | mit | 5,430 | master | 2,764 | # frozen_string_literal: true
module GraphQL
module Tracing
# This trace class calls legacy-style tracer with payload hashes.
# New-style `trace_with` modules significantly reduce the overhead of tracing,
# but that advantage is lost when legacy-style tracers are also used (since the payload hashes are s... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/monitor_trace.rb | Ruby | mit | 5,430 | master | 9,295 | # frozen_string_literal: true
module GraphQL
module Tracing
# This module is the basis for Ruby-level integration with third-party monitoring platforms.
# Platform-specific traces include this module and implement an adapter.
#
# @see ActiveSupportNotificationsTrace Integration via ActiveSupport::Not... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/sentry_trace.rb | Ruby | mit | 5,430 | master | 2,662 | # frozen_string_literal: true
require "graphql/tracing/monitor_trace"
module GraphQL
module Tracing
# A tracer for reporting GraphQL-Ruby times to Sentry.
#
# @example Installing the tracer
# class MySchema < GraphQL::Schema
# trace_with GraphQL::Tracing::SentryTrace
# end
# @see... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/notifications_trace.rb | Ruby | mit | 5,430 | master | 5,390 | # frozen_string_literal: true
module GraphQL
module Tracing
# This implementation forwards events to a notification handler
# (i.e. ActiveSupport::Notifications or Dry::Monitor::Notifications) with a `graphql` suffix.
#
# @see ActiveSupportNotificationsTrace ActiveSupport::Notifications integration
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/perfetto_trace/trace_pb.rb | Ruby | mit | 5,430 | master | 6,906 | # frozen_string_literal: true
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: trace.proto
require 'google/protobuf'
descriptor_data = "\n\x0btrace.proto\x12\x15perfetto_trace.protos\";\n\x05Trace\x12\x32\n\x06packet\x18\x01 \x03(\x0b\x32\".perfetto_trace.protos.TracePacket\"\x8a\x03\n\x0bTracePa... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/detailed_trace/active_record_backend.rb | Ruby | mit | 5,430 | master | 1,860 | # frozen_string_literal: true
module GraphQL
module Tracing
class DetailedTrace
class ActiveRecordBackend
class GraphqlDetailedTrace < ActiveRecord::Base
end
def initialize(limit: nil, model_class: nil)
@limit = limit
@model_class = model_class || GraphqlDetaile... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/detailed_trace/memory_backend.rb | Ruby | mit | 5,430 | master | 1,522 | # frozen_string_literal: true
module GraphQL
module Tracing
class DetailedTrace
# An in-memory trace storage backend. Suitable for testing and development only.
# It won't work for multi-process deployments and everything is erased when the app is restarted.
class MemoryBackend
def init... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/detailed_trace/redis_backend.rb | Ruby | mit | 5,430 | master | 1,965 | # frozen_string_literal: true
module GraphQL
module Tracing
class DetailedTrace
class RedisBackend
KEY_PREFIX = "gql:trace:"
def initialize(redis:, limit: nil)
@redis = redis
@key = KEY_PREFIX + "traces"
@remrangebyrank_limit = limit ? -limit - 1 : nil
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/tracing/prometheus_trace/graphql_collector.rb | Ruby | mit | 5,430 | master | 973 | # frozen_string_literal: true
require "graphql/tracing"
module GraphQL
module Tracing
module PrometheusTrace
class GraphQLCollector < ::PrometheusExporter::Server::TypeCollector
def initialize
@graphql_gauge = PrometheusExporter::Metric::Base.default_aggregation.new(
'graphql... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/rubocop/graphql/base_cop.rb | Ruby | mit | 5,430 | master | 1,312 | # frozen_string_literal: true
require "rubocop"
module GraphQL
module Rubocop
module GraphQL
class BaseCop < RuboCop::Cop::Base
extend RuboCop::Cop::AutoCorrector
# Return the source of `send_node`, but without the keyword argument represented by `pair_node`
def source_without_keyw... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/rubocop/graphql/default_null_true.rb | Ruby | mit | 5,430 | master | 1,322 | # frozen_string_literal: true
require_relative "base_cop"
module GraphQL
module Rubocop
module GraphQL
# Identify (and auto-correct) any field configuration which duplicates
# the default `null: true` property.
#
# `null: true` is default because nullable fields can always be converted
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/rubocop/graphql/field_type_in_block.rb | Ruby | mit | 5,430 | master | 5,343 | # frozen_string_literal: true
require_relative "./base_cop"
module GraphQL
module Rubocop
module GraphQL
# Identify (and auto-correct) any field whose type configuration isn't given
# in the configuration block.
#
# @example
# # bad, immediately causes Rails to load `app/graphql/t... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/rubocop/graphql/root_types_in_block.rb | Ruby | mit | 5,430 | master | 1,138 | # frozen_string_literal: true
require_relative "./base_cop"
module GraphQL
module Rubocop
module GraphQL
# Identify (and auto-correct) any root types in your schema file.
#
# @example
# # bad, immediately causes Rails to load `app/graphql/types/query.rb`
# query Types::Query
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/rubocop/graphql/default_required_true.rb | Ruby | mit | 5,430 | master | 1,380 | # frozen_string_literal: true
require_relative "./base_cop"
module GraphQL
module Rubocop
module GraphQL
# Identify (and auto-correct) any argument configuration which duplicates
# the default `required: true` property.
#
# `required: true` is default because required arguments can always... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/json.rb | Ruby | mit | 5,430 | master | 716 | # frozen_string_literal: true
module GraphQL
module Types
# An untyped JSON scalar that maps to Ruby hashes, arrays, strings, integers, floats, booleans and nils.
# This should be used judiciously because it subverts the GraphQL type system.
#
# Use it for fields or arguments as follows:
#
# ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/string.rb | Ruby | mit | 5,430 | master | 817 | # frozen_string_literal: true
module GraphQL
module Types
class String < GraphQL::Schema::Scalar
description "Represents textual data as UTF-8 character sequences. This type is most often used by GraphQL to represent free-form human-readable text."
def self.coerce_result(value, ctx)
str = va... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/iso_8601_date_time.rb | Ruby | mit | 5,430 | master | 2,499 | # frozen_string_literal: true
require 'time'
module GraphQL
module Types
# This scalar takes `Time`s and transmits them as strings,
# using ISO 8601 format.
#
# Use it for fields or arguments as follows:
#
# field :created_at, GraphQL::Types::ISO8601DateTime, null: false
#
# ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/id.rb | Ruby | mit | 5,430 | master | 837 | # frozen_string_literal: true
module GraphQL
module Types
class ID < GraphQL::Schema::Scalar
graphql_name "ID"
description "Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/boolean.rb | Ruby | mit | 5,430 | master | 383 | # frozen_string_literal: true
module GraphQL
module Types
class Boolean < GraphQL::Schema::Scalar
description "Represents `true` or `false` values."
def self.coerce_input(value, _ctx)
(value == true || value == false) ? value : nil
end
def self.coerce_result(value, _ctx)
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/big_int.rb | Ruby | mit | 5,430 | master | 583 | # frozen_string_literal: true
module GraphQL
module Types
class BigInt < GraphQL::Schema::Scalar
description "Represents non-fractional signed whole numeric values. Since the value may exceed the size of a 32-bit integer, it's encoded as a string."
def self.coerce_input(value, _ctx)
value &&... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/iso_8601_date.rb | Ruby | mit | 5,430 | master | 1,325 | # frozen_string_literal: true
module GraphQL
module Types
# This scalar takes `Date`s and transmits them as strings,
# using ISO 8601 format.
#
# Use it for fields or arguments as follows:
#
# field :published_at, GraphQL::Types::ISO8601Date, null: false
#
# argument :deliver_a... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/int.rb | Ruby | mit | 5,430 | master | 938 | # frozen_string_literal: true
module GraphQL
module Types
# @see {Types::BigInt} for handling integers outside 32-bit range.
class Int < GraphQL::Schema::Scalar
description "Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1."
MIN = -(2**... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/float.rb | Ruby | mit | 5,430 | master | 472 | # frozen_string_literal: true
module GraphQL
module Types
class Float < GraphQL::Schema::Scalar
description "Represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point)."
def self.coerce_input(value, _ctx)
value.is_a?(Num... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay.rb | Ruby | mit | 5,430 | master | 1,493 | # frozen_string_literal: true
# behavior modules:
require "graphql/types/relay/connection_behaviors"
require "graphql/types/relay/edge_behaviors"
require "graphql/types/relay/node_behaviors"
require "graphql/types/relay/page_info_behaviors"
require "graphql/types/relay/has_node_field"
require "graphql/types/relay/has_... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/iso_8601_duration.rb | Ruby | mit | 5,430 | master | 2,872 | # frozen_string_literal: true
module GraphQL
module Types
# This scalar takes `Duration`s and transmits them as strings,
# using ISO 8601 format. ActiveSupport >= 5.0 must be loaded to use
# this scalar.
#
# Use it for fields or arguments as follows:
#
# field :age, GraphQL::Types::ISO... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/connection_behaviors.rb | Ruby | mit | 5,430 | master | 8,156 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
module ConnectionBehaviors
extend Forwardable
def_delegators :@object, :cursor_from_node, :parent
def self.included(child_class)
child_class.extend(ClassMethods)
child_class.has_nodes_field(t... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/has_node_field.rb | Ruby | mit | 5,430 | master | 1,260 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
# Include this module to your root Query type to get a Relay-compliant `node(id: ID!): Node` field that uses the schema's `object_from_id` hook.
module HasNodeField
def self.included(child_class)
child_class.fiel... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/base_connection.rb | Ruby | mit | 5,430 | master | 1,674 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
# Use this to implement Relay connections, or take it as inspiration
# for Relay classes in your own app.
#
# You may wish to copy this code into your own base class,
# so you can extend your own `BaseObject` ins... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/node_behaviors.rb | Ruby | mit | 5,430 | master | 966 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
module NodeBehaviors
def self.included(child_module)
child_module.extend(ClassMethods)
child_module.extend(ExecutionMethods)
child_module.description("An object with an ID.")
child_module.... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/node.rb | Ruby | mit | 5,430 | master | 369 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
# This can be used for Relay's `Node` interface,
# or you can take it as inspiration for your own implementation
# of the `Node` interface.
module Node
include GraphQL::Schema::Interface
include Types::... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/page_info_behaviors.rb | Ruby | mit | 5,430 | master | 1,034 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
module PageInfoBehaviors
def self.included(child_class)
child_class.extend ClassMethods
child_class.description "Information about pagination in a connection."
child_class.field :has_next_page, Boole... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/base_edge.rb | Ruby | mit | 5,430 | master | 888 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
# A class-based definition for Relay edges.
#
# Use this as a parent class in your app, or use it as inspiration for your
# own base `Edge` class.
#
# For example, you may want to extend your own `BaseObject... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/edge_behaviors.rb | Ruby | mit | 5,430 | master | 2,943 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
module EdgeBehaviors
def self.included(child_class)
child_class.description("An edge in a connection.")
child_class.field(:cursor, String, null: false, description: "A cursor for use in pagination.")
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/has_nodes_field.rb | Ruby | mit | 5,430 | master | 1,323 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
# Include this module to your root Query type to get a Relay-style `nodes(id: ID!): [Node]` field that uses the schema's `object_from_id` hook.
module HasNodesField
def self.included(child_class)
child_class.fiel... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/types/relay/page_info.rb | Ruby | mit | 5,430 | master | 245 | # frozen_string_literal: true
module GraphQL
module Types
module Relay
# The return type of a connection's `pageInfo` field
class PageInfo < GraphQL::Schema::Object
include PageInfoBehaviors
end
end
end
end |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/argument.rb | Ruby | mit | 5,430 | master | 17,439 | # frozen_string_literal: true
module GraphQL
class Schema
class Argument
include GraphQL::Schema::Member::HasPath
include GraphQL::Schema::Member::HasAstNode
include GraphQL::Schema::Member::HasAuthorization
include GraphQL::Schema::Member::HasDirectives
include GraphQL::Schema::Memb... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/interface.rb | Ruby | mit | 5,430 | master | 5,891 | # frozen_string_literal: true
module GraphQL
class Schema
module Interface
include GraphQL::Schema::Member::GraphQLTypeNames
module DefinitionMethods
include GraphQL::Schema::Member::BaseDSLMethods
# ConfigurationExtension's responsibilities are in `def included` below
include ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/directive.rb | Ruby | mit | 5,430 | master | 10,895 | # frozen_string_literal: true
module GraphQL
class Schema
# Subclasses of this can influence how {GraphQL::Execution::Interpreter} runs queries.
#
# - {.include?}: if it returns `false`, the field or fragment will be skipped altogether, as if it were absent
# - {.resolve}: Wraps field resolution (so ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/union.rb | Ruby | mit | 5,430 | master | 3,309 | # frozen_string_literal: true
module GraphQL
class Schema
class Union < GraphQL::Schema::Member
extend GraphQL::Schema::Member::HasUnresolvedTypeError
class << self
def inherited(child_class)
add_unresolved_type_error(child_class)
super
end
def possible_ty... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/enum.rb | Ruby | mit | 5,430 | master | 11,357 | # frozen_string_literal: true
module GraphQL
class Schema
# Extend this class to define GraphQL enums in your schema.
#
# By default, GraphQL enum values are translated into Ruby strings.
# You can provide a custom value with the `value:` keyword.
#
# @example
# # equivalent to
# ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/loader.rb | Ruby | mit | 5,430 | master | 8,378 | # frozen_string_literal: true
module GraphQL
class Schema
# You can use the result of {GraphQL::Introspection::INTROSPECTION_QUERY}
# to make a schema. This schema is missing some important details like
# `resolve` functions, but it does include the full type system,
# so you can use it to validate qu... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/member.rb | Ruby | mit | 5,430 | master | 1,416 | # frozen_string_literal: true
require 'graphql/schema/member/base_dsl_methods'
require 'graphql/schema/member/graphql_type_names'
require 'graphql/schema/member/has_ast_node'
require 'graphql/schema/member/has_authorization'
require 'graphql/schema/member/has_dataloader'
require 'graphql/schema/member/has_directives'
r... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/subscription.rb | Ruby | mit | 5,430 | master | 7,833 | # frozen_string_literal: true
module GraphQL
class Schema
# This class can be extended to create fields on your subscription root.
#
# It provides hooks for the different parts of the subscription lifecycle:
#
# - `#authorized?`: called before initial subscription and subsequent updates
# - `... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/timeout.rb | Ruby | mit | 5,430 | master | 5,146 | # frozen_string_literal: true
module GraphQL
class Schema
# This plugin will stop resolving new fields after `max_seconds` have elapsed.
# After the time has passed, any remaining fields will be `nil`, with errors added
# to the `errors` key. Any already-resolved fields will be in the `data` key, so
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/object.rb | Ruby | mit | 5,430 | master | 5,549 | # frozen_string_literal: true
require "graphql/query/null_context"
module GraphQL
class Schema
class Object < GraphQL::Schema::Member
extend GraphQL::Schema::Member::HasAuthorization
extend GraphQL::Schema::Member::HasFields
extend GraphQL::Schema::Member::HasInterfaces
include Member::H... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/input_object.rb | Ruby | mit | 5,430 | master | 11,343 | # frozen_string_literal: true
module GraphQL
class Schema
class InputObject < GraphQL::Schema::Member
extend Forwardable
extend GraphQL::Schema::Member::HasArguments
extend GraphQL::Schema::Member::HasArguments::ArgumentObjectLoader
extend GraphQL::Schema::Member::ValidatesInput
exte... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/always_visible.rb | Ruby | mit | 5,430 | master | 311 | # frozen_string_literal: true
module GraphQL
class Schema
module AlwaysVisible
def self.use(schema, **opts)
schema.use(GraphQL::Schema::Visibility, profiles: { nil => {} })
schema.extend(self)
end
def visible?(_member, _context)
true
end
end
end
end |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/find_inherited_value.rb | Ruby | mit | 5,430 | master | 854 | # frozen_string_literal: true
module GraphQL
class Schema
module FindInheritedValue
def self.extended(child_cls)
child_cls.singleton_class.include(GraphQL::EmptyObjects)
end
def self.included(child_cls)
child_cls.include(GraphQL::EmptyObjects)
end
private
def... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/addition.rb | Ruby | mit | 5,430 | master | 10,716 | # frozen_string_literal: true
module GraphQL
class Schema
class Addition
attr_reader :directives, :possible_types, :types, :union_memberships, :references, :arguments_with_default_values
def initialize(schema:, own_types:, new_types:)
@schema = schema
@own_types = own_types
@... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | lib/graphql/schema/built_in_types.rb | Ruby | mit | 5,430 | master | 295 | # frozen_string_literal: true
module GraphQL
class Schema
BUILT_IN_TYPES = {
"Int" => GraphQL::Types::Int,
"String" => GraphQL::Types::String,
"Float" => GraphQL::Types::Float,
"Boolean" => GraphQL::Types::Boolean,
"ID" => GraphQL::Types::ID,
}
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.