nulogy_graphql_api 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/README.md +11 -8
- data/lib/nulogy_graphql_api.rb +1 -0
- data/lib/nulogy_graphql_api/schema/base_mutation.rb +12 -0
- data/lib/nulogy_graphql_api/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6625da7a3a2e9f0f68ded5321a5bc57b81fdf1ca00e1f85385f8551454a3ea70
|
4
|
+
data.tar.gz: 375182960778201a137f3b2dd96667f5eead6c82959e06e1be0f9c8de3e829a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d83ccfd6856215e4965d9ca64a253447d2593d26c801547c0259a5024765193d1f4ef2e0bbcf865c58a95e11518ab544e0f0486eb95a77ade9f6f041bc3d54cf
|
7
|
+
data.tar.gz: c72a1471eb7dc8f4a63219d0494c7ba159d31009e18e36791455c984f5d01bc5299c639d4eadb42e3150f36db675656135df2001211e4ff4519dbba8134d8d65
|
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,15 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
-
## 0.5.
|
5
|
+
## 0.5.3 (2020-08-11)
|
6
|
+
|
7
|
+
* Add `BaseMutation`.
|
8
|
+
|
9
|
+
## 0.5.1 (2020-08-11)
|
6
10
|
|
7
11
|
* Add the `schema_generation_context?` attribute to the GraphQL `context` when generating the schema.
|
8
12
|
|
9
|
-
## 0.5.0
|
13
|
+
## 0.5.0 (2020-08-05)
|
10
14
|
|
11
15
|
**Breaking Changes**
|
12
16
|
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Add this line to your application's Gemfile:
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
gem "nulogy_graphql_api", "0.5.
|
8
|
+
gem "nulogy_graphql_api", "0.5.3"
|
9
9
|
```
|
10
10
|
|
11
11
|
And then execute:
|
@@ -145,11 +145,11 @@ end
|
|
145
145
|
|
146
146
|
### Node visibility
|
147
147
|
|
148
|
-
When you customize the visibility of parts of your graph you have to make sure that
|
148
|
+
When you customize the visibility of parts of your graph you have to make sure that all nodes are visible when the schema is being generated by the rake task. You can do so by using the `schema_generation_context?` attribute that is added to the context by the `SchemaGenerator` mentioned in the previous section.
|
149
149
|
|
150
150
|
Here is how to use it:
|
151
151
|
|
152
|
-
#####
|
152
|
+
##### On fields
|
153
153
|
```ruby
|
154
154
|
field :entity, MyApp::EntityType, null: false do
|
155
155
|
description "Find an entity by ID"
|
@@ -162,16 +162,19 @@ end
|
|
162
162
|
```
|
163
163
|
|
164
164
|
|
165
|
-
#####
|
165
|
+
##### On mutations
|
166
|
+
|
167
|
+
In this case the `schema_generation_context?` attribute is checked by the `BaseMutation` class. All you have to do is inheriting from it and override `visible?` passing a block to the base method.
|
168
|
+
|
166
169
|
```ruby
|
167
170
|
module MyApp
|
168
|
-
class CreateEntity <
|
171
|
+
class CreateEntity < NulogyGraphqlApi::Schema::BaseMutation
|
169
172
|
field :entity, MyApp::EntityType, null: false
|
170
173
|
field :errors, [NulogyGraphqlApi::Types::UserErrorType], null: false
|
171
174
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
+
def self.visible?(context)
|
176
|
+
super { context[:current_user].super_user? }
|
177
|
+
end
|
175
178
|
|
176
179
|
def resolve(args)
|
177
180
|
# ...
|
data/lib/nulogy_graphql_api.rb
CHANGED
@@ -3,6 +3,7 @@ require "graphql"
|
|
3
3
|
require "nulogy_graphql_api/error_handling"
|
4
4
|
require "nulogy_graphql_api/graphql_executor"
|
5
5
|
require "nulogy_graphql_api/graphql_response"
|
6
|
+
require "nulogy_graphql_api/schema/base_mutation"
|
6
7
|
require "nulogy_graphql_api/transaction_service"
|
7
8
|
require "nulogy_graphql_api/tasks/schema_changes_checker"
|
8
9
|
require "nulogy_graphql_api/tasks/schema_generator"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nulogy_graphql_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Silva
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- lib/nulogy_graphql_api/rspec.rb
|
190
190
|
- lib/nulogy_graphql_api/rspec/graphql_helpers.rb
|
191
191
|
- lib/nulogy_graphql_api/rspec/graphql_matchers.rb
|
192
|
+
- lib/nulogy_graphql_api/schema/base_mutation.rb
|
192
193
|
- lib/nulogy_graphql_api/tasks/schema_changes_checker.rb
|
193
194
|
- lib/nulogy_graphql_api/tasks/schema_generator.rb
|
194
195
|
- lib/nulogy_graphql_api/transaction_service.rb
|