Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG-pro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

### Bug Fix

### 1.8.2 (22 Oct 2018)

### Bug Fix

- Support `NULLS LAST` in stable cursors

### 1.8.1 (16 Oct 2018)

### Bug Fix
Expand Down
1 change: 1 addition & 0 deletions graphql.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "yard"
s.add_development_dependency "jekyll-algolia" if RUBY_VERSION >= '2.3.0'
s.add_development_dependency "jekyll-redirect-from" if RUBY_VERSION >= '2.3.0'
s.add_development_dependency "m", "~> 1.5.0"
end
7 changes: 7 additions & 0 deletions guides/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ bundle exec rake test TEST=spec/graphql/query_spec.rb
# run tests in `query_spec.rb` only
```

Alternatively, you can run a __specific file__ with the [m](https://github.com/qrush/m) gem:

```
m spec/graphql/query_spec.rb
# run tests in `query_spec.rb` only
```

You can focus on a __specific example__ with `focus`:

```ruby
Expand Down
4 changes: 4 additions & 0 deletions guides/javascript_client/apollo_subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import { ApolloLink } from 'apollo-link';
import { ApolloClient } from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';

// Load PusherLink from graphql-ruby-client
import PusherLink from 'graphql-ruby-client/subscriptions/PusherLink';

// Load Pusher and create a client
import Pusher from "pusher-js"
var pusherClient = new Pusher("your-app-key", { cluster: "us2" })
Expand Down
1 change: 1 addition & 0 deletions guides/pro/checksums/graphql-pro-1.8.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
78623f5ef2359e170dc04eaaf1b5397b74082f962b35bda766e2574218ad55c2b490884f1f76e7bd66acd091f68539b6ecf5f8eedc63190c26aeedb976278562
39 changes: 39 additions & 0 deletions guides/type_definitions/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,45 @@ end

Now, `AuthorizedField.new(*args, &block).to_graphql` will be used to create `GraphQL::Field`s.

### Customizing Connections

Connections may be customized in a similar way to Fields.

- Create a new class extending 'GraphQL::Types::Relay::BaseConnection'
- Assign it to your object/interface type with `connection_type_class(MyCustomConnection)`

For example, you can create a custom connection:

```ruby
class MyCustomConnection < GraphQL::Types::Relay::BaseConnection
field :total_count, Integer, null: false

def total_count
object.nodes.size
end
end
```

Then, pass the field class as `connection_type_class(...)` wherever it should be used:

```ruby
module Types
class BaseObject < GraphQL::Schema::Object
# Use this class for defining connections
connection_type_class MyCustomConnection
end
end
```

Now, all type classes that extend `BaseObject` will have a connection_type with the additional field `totalCount`.

### Customizing Edges

Edges may be customized in a similar way to Connections.

- Create a new class extending 'GraphQL::Types::Relay::BaseEdge'
- Assign it to your object/interface type with `edge_type_class(MyCustomEdge)`

### Customizing Arguments

Arguments may be customized in a similar way to Fields.
Expand Down
5 changes: 3 additions & 2 deletions javascript_client/subscriptions/PusherLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
// // Do something with `data` and/or `errors`
// }})
//
import {ApolloLink, Observable} from "apollo-link"
var ApolloLink = require("apollo-link").ApolloLink
var Observable = require("apollo-link").Observable

class PusherLink extends ApolloLink {
constructor(options) {
Expand Down Expand Up @@ -88,4 +89,4 @@ class PusherLink extends ApolloLink {
}
}

export default PusherLink
module.exports = PusherLink
28 changes: 27 additions & 1 deletion lib/graphql/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@ class << self
:execute, :multiplex,
:static_validator, :introspection_system,
:query_analyzers, :tracers, :instrumenters,
:query_execution_strategy, :mutation_execution_strategy, :subscription_execution_strategy,
:validate, :multiplex_analyzers, :lazy?, :lazy_method_name, :after_lazy, :sync_lazy,
# Configuration
:max_complexity=, :max_depth=,
Expand Down Expand Up @@ -709,6 +708,9 @@ def to_graphql
schema_defn.query_analyzers << GraphQL::Authorization::Analyzer
schema_defn.middleware.concat(defined_middleware)
schema_defn.multiplex_analyzers.concat(defined_multiplex_analyzers)
schema_defn.query_execution_strategy = query_execution_strategy
schema_defn.mutation_execution_strategy = mutation_execution_strategy
schema_defn.subscription_execution_strategy = subscription_execution_strategy
defined_instrumenters.each do |step, insts|
insts.each do |inst|
schema_defn.instrumenters[step] << inst
Expand Down Expand Up @@ -789,6 +791,30 @@ def default_max_page_size(new_default_max_page_size = nil)
end
end

def query_execution_strategy(new_query_execution_strategy = nil)
if new_query_execution_strategy
@query_execution_strategy = new_query_execution_strategy
else
@query_execution_strategy || self.default_execution_strategy
end
end

def mutation_execution_strategy(new_mutation_execution_strategy = nil)
if new_mutation_execution_strategy
@mutation_execution_strategy = new_mutation_execution_strategy
else
@mutation_execution_strategy || self.default_execution_strategy
end
end

def subscription_execution_strategy(new_subscription_execution_strategy = nil)
if new_subscription_execution_strategy
@subscription_execution_strategy = new_subscription_execution_strategy
else
@subscription_execution_strategy || self.default_execution_strategy
end
end

def max_complexity(max_complexity = nil)
if max_complexity
@max_complexity = max_complexity
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'rubygems'
require 'bundler'
Bundler.require

# Print full backtrace for failiures:
Expand All @@ -10,6 +11,7 @@
CodeClimate::TestReporter.start

require "graphql"
require "rake"
require "graphql/rake_task"
require "benchmark"
require "pry"
Expand Down