Module: GraphQL::PersistedQueries::CompiledQueries::MultiplexPatch

Defined in:
lib/graphql/persisted_queries/compiled_queries/multiplex_patch.rb

Overview

Patches GraphQL::Execution::Multiplex to support compiled queries

Instance Method Summary collapse

Instance Method Details

#add_not_found_error(query) ⇒ Object



22
23
24
25
26
# File 'lib/graphql/persisted_queries/compiled_queries/multiplex_patch.rb', line 22

def add_not_found_error(query)
  query.context.errors.clear
  query.context.errors << GraphQL::ExecutionError.new("PersistedQueryNotFound")
  GraphQL::Execution::Multiplex::NO_OPERATION
end

#begin_query(query, multiplex) ⇒ Object



9
10
11
12
13
# File 'lib/graphql/persisted_queries/compiled_queries/multiplex_patch.rb', line 9

def begin_query(results, idx, query, multiplex)
  return super unless query.persisted_query_not_found?

  results[idx] = add_not_found_error(query)
end