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 +4 -4
- data/Gemfile.lock +4 -8
- data/lib/graphiti_gql/active_resource.rb +17 -13
- data/lib/graphiti_gql/spec_helper.rb +3 -1
- data/lib/graphiti_gql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 738c0d01e7e5491204399c4ddf9b0d346943555c49a1b64937e62c4503a23d9b
|
|
4
|
+
data.tar.gz: 80837b0265bcfda82c95bb498e262f52208a75a06b61670df342aea53d16ceb5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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-
|
|
23
|
+
dry-container (0.10.0)
|
|
24
24
|
concurrent-ruby (~> 1.0)
|
|
25
|
-
|
|
26
|
-
dry-container (0.9.0)
|
|
25
|
+
dry-core (0.8.0)
|
|
27
26
|
concurrent-ruby (~> 1.0)
|
|
28
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
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
|
|
data/lib/graphiti_gql/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: graphql
|