graphql_preload_queries 0.2.2 → 0.3
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/config/initializers/patch_continue_value.rb +1 -1
- data/lib/graphql_preload_queries.rb +4 -0
- data/lib/graphql_preload_queries/extensions/preload.rb +4 -1
- data/lib/graphql_preload_queries/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: 2033097c8239ec615569f2e51837e68b0300e46c8983a2d4d9db11d98d9ceea8
|
4
|
+
data.tar.gz: 1015a0b2bbd114ecc5b8de4c57b42c1591494e0c64b53595a2177d4886d18555
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04df1b49aae6f5978bafb22cfa8740d62ee70eb87963617fcd8b5c8766ee57d0d49a1633d53c5211aaa1f24f76513683b56f2f148f8ff732532fbd7722f6a474
|
7
|
+
data.tar.gz: 33432e16d0465307533537cdd1e438b6afafe515a0ac6c06933c828e29905eb697aa7e85d3a8ef1d73b82a861f38d4617bbc49df407464b41f6e8ae5c0eeca6c
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -84,6 +84,12 @@ Or install it yourself as:
|
|
84
84
|
$ gem install graphql_preload_queries
|
85
85
|
```
|
86
86
|
|
87
|
+
For debugging mode:
|
88
|
+
```
|
89
|
+
# config/initializers/gql_preload.rb
|
90
|
+
GraphqlPreloadQueries::DEBUG = true
|
91
|
+
```
|
92
|
+
|
87
93
|
## Contributing
|
88
94
|
Bug reports and pull requests are welcome on GitHub at https://github.com/owen2345/graphql_preload_queries. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
89
95
|
|
@@ -7,7 +7,7 @@ module GraphqlPreloadQueries::PatchContinueValue # rubocop:disable Style/ClassAn
|
|
7
7
|
value = args[1]
|
8
8
|
ast_node = args[5]
|
9
9
|
field = args[3]
|
10
|
-
type_klass = field.
|
10
|
+
type_klass = Array(field.instance_variable_get(:@return_type_expr))[0]
|
11
11
|
is_active_record = value.is_a?(ActiveRecord::Relation)
|
12
12
|
return super if !is_active_record || value.loaded? || !type_klass.respond_to?(:preloads)
|
13
13
|
|
@@ -12,7 +12,10 @@ module GraphqlPreloadQueries
|
|
12
12
|
# @param @type_klass (GqlTypeKlass)
|
13
13
|
# @return @data with necessary preloads
|
14
14
|
def preload_associations(value, node, type_klass)
|
15
|
-
|
15
|
+
preloads = filter_preloads(node, type_klass.preloads || {})
|
16
|
+
log_info = { type_klass: type_klass, preloads: preloads, configured: type_klass.preloads }
|
17
|
+
GraphqlPreloadQueries.log("Preloading: #{log_info}")
|
18
|
+
apply_preloads(value, preloads)
|
16
19
|
end
|
17
20
|
|
18
21
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_preload_queries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- owen2345
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|