graphql-rails-api 0.9.6 → 0.9.7
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/lib/graphql/hydrate_query.rb +25 -4
- data/lib/graphql/rails/api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb89c21597bdbc0a59ebe13ec5030d847fd356901600700ae3be29f33c3f54f
|
4
|
+
data.tar.gz: a276f011746654e122e7b574707fa1df57590e753ca64ea3d23e232d2fcb356a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf96a1ce8f8f0d18a7d5ca9844fa3802c84664e05e1a790a257007cfd71444fff823a2b916b0e1e436694e9402edb38a484a1fe58c26b33e9b86ecbd551eee13
|
7
|
+
data.tar.gz: 438629cf1b5213e919639f60b52b2f8f64b02d086578570fc8924bedf770d5826af51506b6191d458dc4ba851839cd11f1abbb44775b3579b993aa336da87056
|
@@ -357,12 +357,33 @@ module Graphql
|
|
357
357
|
end
|
358
358
|
|
359
359
|
def deep_pluck_to_structs(irep_node)
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
).load_all,
|
360
|
+
attributes = (hash_to_array_of_hashes(parse_fields(irep_node), @model) || []).compact
|
361
|
+
res = plucked_attr_to_structs(
|
362
|
+
DeepPluck::Model.new(@model.visible_for(user: @user), user: @user).add(attributes).load_all,
|
364
363
|
model_name.singularize.camelize.constantize
|
365
364
|
)&.compact
|
365
|
+
res.map do |r|
|
366
|
+
fill_nil_in_openstruct(r, attributes)
|
367
|
+
end
|
368
|
+
res
|
369
|
+
end
|
370
|
+
|
371
|
+
def fill_nil_in_openstruct(struct, fields)
|
372
|
+
fields.each do |field|
|
373
|
+
if field.is_a?(Hash)
|
374
|
+
struct[field.keys.first] ||= OpenStruct.new
|
375
|
+
data = struct[field.keys.first]
|
376
|
+
if data.is_a?(Array)
|
377
|
+
data.each do |s|
|
378
|
+
fill_nil_in_openstruct(s, field.values.first)
|
379
|
+
end
|
380
|
+
else
|
381
|
+
fill_nil_in_openstruct(data, field.values.first)
|
382
|
+
end
|
383
|
+
else
|
384
|
+
struct[field] ||= nil
|
385
|
+
end
|
386
|
+
end
|
366
387
|
end
|
367
388
|
|
368
389
|
def plucked_attr_to_structs(arr, parent_model)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-rails-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poilon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
117
|
+
rubygems_version: 3.1.2
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Graphql rails api framework to create easily graphql api with rails
|