kitty_policy 0.1.1 → 0.1.2

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: 8675ef33087573ac4e48e855adeaf5aa1bff65768ef55ed7deda86744d8c0c21
4
- data.tar.gz: 97f3bde8f761bc6a849b32696e4a4fdfdc1a454c015a96c8d6c0d22f9957d397
3
+ metadata.gz: 36bb0e98df928a03bb4e18761f8e23e7b7868da05d15bb70f81425d76f936da1
4
+ data.tar.gz: 6a00a72433c6cc7016f5d62427395d52914bab78fea76e2cdd1faf3b6f526924
5
5
  SHA512:
6
- metadata.gz: c9e0f3c4f1e25608ca8dac48055b748aadffc66ec04f1b44e54525de9ff209214f3cd75a74ef7a29c1fc86149d35e4dde73c1d8d416f5783d94f1af3a5a044d4
7
- data.tar.gz: f2b6e5a6f51446ff592ee0bd2fe19eb18e07a798b6d553daeb8db03f6f0b3f1e38da307db3ecee01cc1e33524901084726729dfbed806df53b1804f7b68fe688
6
+ metadata.gz: fc35eeb00ba8e1ec5d43ed4a20fa710fc2e1c347dea3d3f8424809f8eaf5a80300a99bb760d08660cb3ae5a9a32909fd61e6e2336bf95df27af3fdc59f5219ee
7
+ data.tar.gz: 81905f36f0b2cc4f2b007b53b5599d05f9be8777818a713706ec93c687fad1fcb76a9f49f27a651c2542e1323c4e389219ea2129e870b0e2d5f97a93d9bd7c2a
data/.rubocop.yml CHANGED
@@ -15,8 +15,8 @@ Style/PercentLiteralDelimiters:
15
15
  '%w': '()'
16
16
  '%r': '()'
17
17
 
18
- LineLength:
19
- Max: 140
18
+ Layout/LineLength:
19
+ Max: 150
20
20
 
21
21
  Metrics/MethodLength:
22
22
  Max: 20
@@ -24,7 +24,10 @@ Metrics/MethodLength:
24
24
  Metrics/AbcSize:
25
25
  Max: 40
26
26
 
27
- Documentation:
27
+ Metrics/BlockLength:
28
+ Enabled: false
29
+
30
+ Style/Documentation:
28
31
  Enabled: false
29
32
 
30
33
  Style/ModuleFunction:
@@ -51,9 +54,6 @@ Style/TrailingCommaInArguments:
51
54
  Style/DoubleNegation:
52
55
  Enabled: false
53
56
 
54
- BlockLength:
55
- Enabled: false
56
-
57
57
  RSpec/MultipleExpectations:
58
58
  Enabled: false
59
59
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.1.2
4
+
5
+ * **[fix]** Allow `fallback: []` to work for Relay connections (@rstankov)
6
+
3
7
  ## Version 0.1.1
4
8
 
5
9
  * **[fix]** Allow for `fallback: []` in GraphQL (@rstankov)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kitty_policy (0.1.0)
4
+ kitty_policy (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -54,4 +54,4 @@ DEPENDENCIES
54
54
  rubocop-rspec (= 1.33.0)
55
55
 
56
56
  BUNDLED WITH
57
- 2.0.1
57
+ 2.0.2
@@ -20,6 +20,17 @@ module KittyPolicy
20
20
 
21
21
  if policy.can?(context[current_user_key], field.metadata[:authorize], object)
22
22
  old_resolve.call(type_or_object, arguments, context)
23
+ elsif field.connection?
24
+ # NOTE(rstankov): When field is connection we need to wrap it with connection option as done here:
25
+ # https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/relay/connection_resolve.rb#L37-L38
26
+ #
27
+ # Normally GraphQL gem will handle this, however this instrument is bypassing it
28
+ nodes = field.metadata[:fallback]
29
+
30
+ parent = parent.is_a?(::GraphQL::Schema::Object) ? context.object.object : context.object
31
+
32
+ connection_class = ::GraphQL::Relay::BaseConnection.connection_for_nodes(nodes)
33
+ connection_class.new(nodes, arguments, field: field, max_page_size: field.connection_max_page_size, parent: parent, context: context)
23
34
  else
24
35
  field.metadata[:fallback]
25
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KittyPolicy
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitty_policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radoslav Stankov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2020-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler