graphiti_gql 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71fdec4bf251efc22810991433ff68f9797cd347537e01a9cd309557c68567ea
4
- data.tar.gz: 9b65200d9eb293333b3cb4727389bc4c51ebc46da014d12f478f95c75fc48b0b
3
+ metadata.gz: 738c0d01e7e5491204399c4ddf9b0d346943555c49a1b64937e62c4503a23d9b
4
+ data.tar.gz: 80837b0265bcfda82c95bb498e262f52208a75a06b61670df342aea53d16ceb5
5
5
  SHA512:
6
- metadata.gz: f6e7ad07688af72a5850d5a93338ebce34c224e54259fce30a32b51a5deb842a8e9b1f3f2779bcf21ca841bfc7e7a88206c63e5bd3cb56644c92612c626762ec
7
- data.tar.gz: a18337b399b74f1389e43becffddff4119a0c07b6c53ddfc84a0e2d925d7b5339206823d6f366adf24484838b79dda45298b11cee785d258455cebd802c46c1a
6
+ metadata.gz: 3ad649a5f015c967529be572ad5f586edbeeb83205aaf4421c0f8906099213565492ba54f871e141aee37a668d5255cfa7188429cbbb15484d11af20c2b70cbe
7
+ data.tar.gz: b1b6812f8e4f350682124de0dfefde997602ed41f6d7b5e704ae640d2e59636c789e1ba54c75a51ef5beea41fbd76d3213424736d7159f455aad27bd6323361d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphiti_gql (0.2.9)
4
+ graphiti_gql (0.2.11)
5
5
  graphiti (~> 1.3.9)
6
6
  graphql (~> 2.0)
7
7
  graphql-batch (~> 0.5)
@@ -20,15 +20,11 @@ GEM
20
20
  coderay (1.1.3)
21
21
  concurrent-ruby (1.1.10)
22
22
  diff-lcs (1.5.0)
23
- dry-configurable (0.15.0)
23
+ dry-container (0.10.0)
24
24
  concurrent-ruby (~> 1.0)
25
- dry-core (~> 0.6)
26
- dry-container (0.9.0)
25
+ dry-core (0.8.0)
27
26
  concurrent-ruby (~> 1.0)
28
- dry-configurable (~> 0.13, >= 0.13.0)
29
- dry-core (0.7.1)
30
- concurrent-ruby (~> 1.0)
31
- dry-inflector (0.2.1)
27
+ dry-inflector (0.3.0)
32
28
  dry-logic (1.2.0)
33
29
  concurrent-ruby (~> 1.0)
34
30
  dry-core (~> 0.5, >= 0.5)
@@ -47,7 +47,7 @@ module GraphitiGql
47
47
  end
48
48
 
49
49
  class Proxy
50
- def initialize(resource, params, ctx, query)
50
+ def initialize(resource, params, ctx, query, options = {})
51
51
  @query = query
52
52
  @resource = resource
53
53
  @ctx = ctx
@@ -56,6 +56,7 @@ module GraphitiGql
56
56
  sort[:att] = sort[:att].to_s.camelize(:lower)
57
57
  sort[:dir] = sort[:dir].to_s
58
58
  end
59
+ @with_pagination = !!options[:with_pagination]
59
60
  end
60
61
 
61
62
  def to_h(symbolize_keys: true)
@@ -76,7 +77,7 @@ module GraphitiGql
76
77
  else
77
78
  data[data.keys.first][:nodes] || []
78
79
  end
79
- elements.map { |n| Node.new(underscore(n), @resource) }
80
+ elements.compact.map { |n| Node.new(underscore(n), @resource) }
80
81
  end
81
82
  alias :to_a :nodes
82
83
 
@@ -207,15 +208,18 @@ module GraphitiGql
207
208
  end
208
209
  end
209
210
 
210
- q << %|
211
- }
212
- }
213
- pageInfo {
214
- startCursor
215
- endCursor
216
- hasNextPage
217
- hasPreviousPage
218
- }|
211
+ q << %|
212
+ }
213
+ }|
214
+ if @with_pagination
215
+ q << %|
216
+ pageInfo {
217
+ startCursor
218
+ endCursor
219
+ hasNextPage
220
+ hasPreviousPage
221
+ }|
222
+ end
219
223
 
220
224
  if @params[:stats]
221
225
  q << %|
@@ -251,8 +255,8 @@ module GraphitiGql
251
255
  end
252
256
 
253
257
  class_methods do
254
- def gql(params = {}, ctx = {}, query = nil)
255
- Proxy.new(self, params, ctx, query)
258
+ def gql(params = {}, ctx = {}, query = nil, opts = {})
259
+ Proxy.new(self, params, ctx, query, opts)
256
260
  end
257
261
  end
258
262
  end
@@ -69,7 +69,9 @@ module GraphitiGql
69
69
 
70
70
  def proxy
71
71
  q = defined?(query) ? query : nil
72
- resource.gql(params.merge(fields: fields), ctx, q)
72
+ with_pagination = respond_to?(:with_pagination) ? send(:with_pagination) : false
73
+ opts = { with_pagination: with_pagination }
74
+ resource.gql(params.merge(fields: fields), ctx, q, opts)
73
75
  end
74
76
 
75
77
 
@@ -1,3 +1,3 @@
1
1
  module GraphitiGql
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti_gql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-16 00:00:00.000000000 Z
11
+ date: 2022-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql