graphql_rails 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60ad653d6c6acbfe0816f0b7ddb406dae7131b1c07f86f7ab35b98813079edb1
4
- data.tar.gz: ff9446c8240615d5cba3e6ac3206444d47d257d201278e0860d765976c8f99fc
3
+ metadata.gz: aab866d81cb8b70ef283c47914ea056c15eb07000b701414a42a7055fe1dabe1
4
+ data.tar.gz: 814a9189c63ffee28c8ab47c761b8740680da723669ea05d0d0e2256770b61d7
5
5
  SHA512:
6
- metadata.gz: 59caf8be61dcf8777a5cdc2ac498f389006e8630b9ef62076976a0be849e8e09466e8a7b76891bf6a5b42510f5efc0856666383e9bd6e3e68c245500fb308d47
7
- data.tar.gz: 9851cb4dd601fa253c5790f39cbdf835403e08814c85db9f0646bd986ccb62650249216b2225f20dfa8ada581e0bd374e3eb30001dc51f2eb7a182d9c2f626c6
6
+ metadata.gz: 99fe93c9a15507f4ebd0c1ec8667ddeac6b211342ca4df65b4a866fd3ba1dc34dd5661c4fba8317e4deea5241b9c52a2cb176e9d1dc0d9a57ec57d464f7e1dfa
7
+ data.tar.gz: db4a1d9fb7d4c9a20fb449a54ae5c27e784c39672052d5f95e0c7927801eaebe3c88c4899e8477da3d892c7ff420cdc29a15b3753cf6ec1e9c94c946f6c6de66
data/CHANGELOG.md CHANGED
@@ -9,8 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  * Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
11
11
 
12
+ ## [1.2.0](2021-02-15)
13
+
14
+ * Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
15
+
12
16
  * Added: `options` argument to model level attribute. Allows disabling automatic camelCase
13
17
  * Fixed: methods with complex input arguments receives `Hash` instances instead of `GraphQL::Schema::InputObject`
18
+ * Fixed: Using `ActiveSupport::ParameterFilter` (Rails 6.1), if it is defined, instead of `ActionDispatch::Http::ParameterFilter`
19
+ * Changed: graphql version is now `1.12` which may require system-wide changes.
20
+ * Fixed: improved connection wrapper for pagination to work.
21
+ * Fixed: implementation of `total` field is no longer missing when using pagination.
22
+
14
23
 
15
24
  ## [1.0.0](2020-02-07)
16
25
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_rails (1.1.0)
4
+ graphql_rails (1.2.0)
5
5
  activesupport (>= 4)
6
- graphql (~> 1.11, >= 1.11.6)
6
+ graphql (~> 1.12, >= 1.12.4)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -78,7 +78,7 @@ GEM
78
78
  erubi (1.9.0)
79
79
  globalid (0.4.2)
80
80
  activesupport (>= 4.2.0)
81
- graphql (1.11.6)
81
+ graphql (1.12.4)
82
82
  i18n (1.8.5)
83
83
  concurrent-ruby (~> 1.0)
84
84
  json (2.3.1)
@@ -92,7 +92,7 @@ GEM
92
92
  method_source (1.0.0)
93
93
  mimemagic (0.3.5)
94
94
  mini_mime (1.0.2)
95
- mini_portile2 (2.4.0)
95
+ mini_portile2 (2.5.0)
96
96
  minitest (5.14.2)
97
97
  mongo (2.13.1)
98
98
  bson (>= 4.8.2, < 5.0.0)
@@ -100,8 +100,9 @@ GEM
100
100
  activemodel (>= 5.1, < 6.1)
101
101
  mongo (>= 2.7.0, < 3.0.0)
102
102
  nio4r (2.5.4)
103
- nokogiri (1.10.10)
104
- mini_portile2 (~> 2.4.0)
103
+ nokogiri (1.11.1)
104
+ mini_portile2 (~> 2.5.0)
105
+ racc (~> 1.4)
105
106
  parallel (1.19.2)
106
107
  parser (2.7.2.0)
107
108
  ast (~> 2.4.1)
@@ -111,6 +112,7 @@ GEM
111
112
  pry-byebug (3.9.0)
112
113
  byebug (~> 11.0)
113
114
  pry (~> 0.13.0)
115
+ racc (1.5.2)
114
116
  rack (2.2.3)
115
117
  rack-test (1.1.0)
116
118
  rack (>= 1.0, < 3)
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'graphql', '~> 1.11', '>= 1.11.6'
23
+ spec.add_dependency 'graphql', '~> 1.12', '>= 1.12.4'
24
24
  spec.add_dependency 'activesupport', '>= 4'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '~> 2'
@@ -51,8 +51,7 @@ module GraphqlRails
51
51
  params
52
52
  else
53
53
  filter_options = Rails.configuration.filter_parameters
54
- parametter_filter = ActionDispatch::Http::ParameterFilter.new(filter_options)
55
- parametter_filter.filter(params)
54
+ parameter_filter_class.new(filter_options).filter(params)
56
55
  end
57
56
  end
58
57
 
@@ -61,6 +60,12 @@ module GraphqlRails
61
60
 
62
61
  Rails.application.config.filter_parameters || []
63
62
  end
63
+
64
+ def parameter_filter_class
65
+ return ActiveSupport::ParameterFilter if Object.const_defined?('ActiveSupport::ParameterFilter')
66
+
67
+ ActionDispatch::Http::ParameterFilter
68
+ end
64
69
  end
65
70
  end
66
71
  end
@@ -71,9 +71,5 @@ module GraphqlRails
71
71
  self.class.new(decorator: decorator, relation: new_relation, decorator_args: decorator_args)
72
72
  end
73
73
  end
74
-
75
- GraphQL::Relay::BaseConnection.register_connection_implementation(
76
- RelationDecorator, GraphQL::Relay::RelationConnection
77
- )
78
74
  end
79
75
  end
@@ -30,7 +30,11 @@ module GraphqlRails
30
30
  graphql_name("#{type.graphql_name}Connection")
31
31
  edge_type(edge_type)
32
32
 
33
- field :total, Integer, null: false, resolve: CountItems
33
+ field :total, Integer, null: false
34
+
35
+ def total
36
+ CountItems.call(self)
37
+ end
34
38
  end
35
39
  end
36
40
 
@@ -10,7 +10,7 @@ module GraphqlRails
10
10
 
11
11
  include ::GraphqlRails::Service
12
12
 
13
- def initialize(graphql_object, _args, _ctx)
13
+ def initialize(graphql_object)
14
14
  @graphql_object = graphql_object
15
15
  end
16
16
 
@@ -21,11 +21,21 @@ module GraphqlRails
21
21
  raw = raw_actions
22
22
 
23
23
  Class.new(GraphQL::Schema) do
24
+ connections.add(
25
+ GraphqlRails::Decorator::RelationDecorator,
26
+ GraphQL::Pagination::ActiveRecordRelationConnection
27
+ )
24
28
  cursor_encoder(Router::PlainCursorEncoder)
25
29
  raw.each { |action| send(action[:name], *action[:args], &action[:block]) }
26
30
 
27
31
  query(query_type) if query_type
28
32
  mutation(mutation_type) if mutation_type
33
+
34
+ def self.type_from_ast(*args)
35
+ type = super
36
+
37
+ type.respond_to?(:to_graphql) ? type.to_graphql : type
38
+ end
29
39
  end
30
40
  end
31
41
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlRails
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurčys
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2021-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '1.12'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.11.6
22
+ version: 1.12.4
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.11'
29
+ version: '1.12'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.11.6
32
+ version: 1.12.4
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ dependencies:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: '6'
131
- description:
131
+ description:
132
132
  email:
133
133
  - po.jurcys@gmail.com
134
134
  executables: []
@@ -232,7 +232,7 @@ homepage: https://github.com/samesystem/graphql_rails
232
232
  licenses:
233
233
  - MIT
234
234
  metadata: {}
235
- post_install_message:
235
+ post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths:
238
238
  - lib
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubygems_version: 3.1.2
251
- signing_key:
251
+ signing_key:
252
252
  specification_version: 4
253
253
  summary: Rails style structure for GraphQL API.
254
254
  test_files: []