Sha256: 07069aae79de4bffe8b490ebf0c7aae1fc2382299b04ded569f73f693272ac39
Contents?: true
Size: 955 Bytes
Versions: 6
Compression:
Stored size: 955 Bytes
Contents
# frozen_string_literal: true module GraphQL module Relay class Mutation # @api private module Instrumentation # Modify mutation `return_field` resolves by wrapping the returned object # in a {Mutation::Result}. # # By using an instrumention, we can apply our wrapper _last_, # giving users access to the original resolve function in earlier instrumentation. def self.instrument(type, field) if field.mutation.is_a?(GraphQL::Relay::Mutation) || (field.mutation.is_a?(Class) && field.mutation < GraphQL::Schema::RelayClassicMutation) new_resolve = Mutation::Resolve.new(field.mutation, field.resolve_proc) new_lazy_resolve = Mutation::Resolve.new(field.mutation, field.lazy_resolve_proc) field.redefine(resolve: new_resolve, lazy_resolve: new_lazy_resolve) else field end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems