graphql-activerecord 0.12.6 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +581 -11
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +1 -0
  5. data/README.md +69 -37
  6. data/Rakefile +1 -0
  7. data/bin/bundle +105 -0
  8. data/bin/coderay +12 -0
  9. data/bin/htmldiff +12 -0
  10. data/bin/ldiff +12 -0
  11. data/bin/pry +12 -0
  12. data/bin/rake +12 -0
  13. data/bin/rspec +12 -0
  14. data/bin/rubocop +12 -0
  15. data/bin/ruby-parse +12 -0
  16. data/bin/ruby-rewrite +12 -0
  17. data/graphql-activerecord.gemspec +6 -6
  18. data/lib/graphql/activerecord.rb +6 -2
  19. data/lib/graphql/models/active_record_extension.rb +2 -1
  20. data/lib/graphql/models/association_load_request.rb +1 -0
  21. data/lib/graphql/models/attribute_loader.rb +1 -0
  22. data/lib/graphql/models/backed_by_model.rb +1 -0
  23. data/lib/graphql/models/database_types.rb +1 -0
  24. data/lib/graphql/models/definer.rb +1 -0
  25. data/lib/graphql/models/definition_helpers.rb +3 -2
  26. data/lib/graphql/models/definition_helpers/associations.rb +3 -2
  27. data/lib/graphql/models/definition_helpers/attributes.rb +1 -0
  28. data/lib/graphql/models/hash_combiner.rb +1 -0
  29. data/lib/graphql/models/helpers.rb +1 -0
  30. data/lib/graphql/models/instrumentation.rb +6 -4
  31. data/lib/graphql/models/monkey_patches/graphql_query_context.rb +1 -0
  32. data/lib/graphql/models/mutation_field_map.rb +9 -7
  33. data/lib/graphql/models/mutation_helpers/apply_changes.rb +16 -5
  34. data/lib/graphql/models/mutation_helpers/authorization.rb +1 -0
  35. data/lib/graphql/models/mutation_helpers/print_input_fields.rb +4 -3
  36. data/lib/graphql/models/mutation_helpers/validation.rb +1 -0
  37. data/lib/graphql/models/mutation_helpers/validation_error.rb +1 -0
  38. data/lib/graphql/models/mutator.rb +3 -2
  39. data/lib/graphql/models/promise_relation_connection.rb +1 -0
  40. data/lib/graphql/models/reflection.rb +2 -0
  41. data/lib/graphql/models/relation_load_request.rb +1 -0
  42. data/lib/graphql/models/relation_loader.rb +1 -0
  43. data/lib/graphql/models/version.rb +2 -1
  44. metadata +23 -22
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL::Models
3
4
  module MutationHelpers
4
5
  class ValidationError < GraphQL::ExecutionError
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL::Models
3
4
  class Mutator
4
5
  attr_accessor :field_map, :root_model, :inputs, :context
@@ -53,8 +54,8 @@ module GraphQL::Models
53
54
  class MutatorDefinition
54
55
  attr_accessor :field_map
55
56
 
56
- def initialize(model_type, null_behavior:)
57
- @field_map = MutationFieldMap.new(model_type, find_by: nil, null_behavior: null_behavior)
57
+ def initialize(model_type, null_behavior:, legacy_nulls:)
58
+ @field_map = MutationFieldMap.new(model_type, find_by: nil, null_behavior: null_behavior, legacy_nulls: legacy_nulls)
58
59
  end
59
60
 
60
61
  def mutator(root_model, inputs, context)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL
3
4
  module Models
4
5
  class PromiseRelationConnection < GraphQL::Relay::RelationConnection
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Exposes utility methods for getting metadata out of active record models
3
4
  module GraphQL::Models
4
5
  module Reflection
@@ -64,6 +65,7 @@ module GraphQL::Models
64
65
  if result.nil?
65
66
  # rubocop:disable Metrics/LineLength
66
67
  raise "Don't know how to map database type #{active_record_type.type.inspect} to a GraphQL type. Forget to register it with GraphQL::Models::DatabaseTypes? (attribute #{attribute} on #{model_class.name})"
68
+ # rubocop:enable Metrics/LineLength
67
69
  end
68
70
 
69
71
  # Arrays: Rails doesn't have a generalized way to detect arrays, so we use this method to do it:
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL
3
4
  module Models
4
5
  class RelationLoadRequest
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL
3
4
  module Models
4
5
  class RelationLoader < GraphQL::Batch::Loader
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL
3
4
  module Models
4
- VERSION = "0.12.6"
5
+ VERSION = "0.13.0"
5
6
  end
6
7
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Foster
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -31,7 +31,7 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6'
33
33
  - !ruby/object:Gem::Dependency
34
- name: activerecord
34
+ name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.5.10
59
+ version: 1.7.5
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '2'
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 1.5.10
69
+ version: 1.7.5
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '2'
@@ -98,6 +98,20 @@ dependencies:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
100
  version: '1.11'
101
+ - !ruby/object:Gem::Dependency
102
+ name: pry
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
101
115
  - !ruby/object:Gem::Dependency
102
116
  name: rake
103
117
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +141,7 @@ dependencies:
127
141
  - !ruby/object:Gem::Version
128
142
  version: '3.0'
129
143
  - !ruby/object:Gem::Dependency
130
- name: pry
144
+ name: rubocop
131
145
  requirement: !ruby/object:Gem::Requirement
132
146
  requirements:
133
147
  - - ">="
@@ -140,20 +154,6 @@ dependencies:
140
154
  - - ">="
141
155
  - !ruby/object:Gem::Version
142
156
  version: '0'
143
- - !ruby/object:Gem::Dependency
144
- name: rubocop
145
- requirement: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - "~>"
148
- - !ruby/object:Gem::Version
149
- version: 0.47.1
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- requirements:
154
- - - "~>"
155
- - !ruby/object:Gem::Version
156
- version: 0.47.1
157
157
  description: Build Relay-compatible GraphQL schemas based on ActiveRecord models
158
158
  email:
159
159
  - theorygeek@gmail.com
@@ -175,6 +175,7 @@ files:
175
175
  - README.md
176
176
  - Rakefile
177
177
  - bin/_guard-core
178
+ - bin/bundle
178
179
  - bin/bundler
179
180
  - bin/coderay
180
181
  - bin/console
@@ -237,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
238
  version: '0'
238
239
  requirements: []
239
240
  rubyforge_project:
240
- rubygems_version: 2.6.12
241
+ rubygems_version: 2.7.4
241
242
  signing_key:
242
243
  specification_version: 4
243
244
  summary: ActiveRecord helpers for GraphQL + Relay