graphql-sources 0.5.0 → 1.1.1

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: e99e1d718952f3ee55b0a0b37c6f4f9f99789f4740243a6dd7995bee2b5fa6a4
4
- data.tar.gz: 4f082d61109e02db43b06b2ff345dd2fdc697f8a6dc30336b7e6226e352a5e79
3
+ metadata.gz: eccc9a6d7c7539247982a6a9dad900a481d7e364f54cca4491cd4d6e470d2b72
4
+ data.tar.gz: 2c9dfe54e836d8324c0218673b853260e6f5e62a3644215068e640c74b16d291
5
5
  SHA512:
6
- metadata.gz: 58202b58608b54a184ed5831672ebafbd39b216cee19908139b4c9ee6e2874197ed5609fcb2bcd592074e101e77ddce8b1e250db5777c55427a37e7f19abc7be
7
- data.tar.gz: ee4949a68c77cf7ea0b945f4f79d4a5ba6de9e491c64abb472f8091b01c8181512beafbaa16ca66bbecd8cc64b33c8891d2b3d2589659610ad0149c29dfdf6e0
6
+ metadata.gz: 642038b97140aadd3c027da4c94c2a40969f370d9be77d1297f927e89bf0d019242724f46d17afbd21e944ed8dd95d516a5d9c29d6e04c03142ccfa8226310e7
7
+ data.tar.gz: c80233bea7956c4b704c0c2e393897f3fd6fdb1866142591a5ba39b38657120c38eaf27d0a5b88811868fbb2fbbc4b6ae8b5bcf3399a113a0a5b9aa816e302bf
data/README.md CHANGED
@@ -10,6 +10,15 @@ If bundler is not being used to manage dependencies, install the gem by executin
10
10
 
11
11
  $ gem install graphql-sources
12
12
 
13
+ The `GraphQL::Dataloader` plugin must be installed in the schema:
14
+
15
+ ```ruby
16
+ class AppSchema < GraphQL::Schema
17
+ use GraphQL::Dataloader
18
+ # ...
19
+ end
20
+ ```
21
+
13
22
  ## Usage
14
23
 
15
24
  ### Loading `has_one` Associations
@@ -63,7 +72,7 @@ end
63
72
  class UserType < GraphQL::Schema::Object
64
73
  field :comments, [CommentType], null: false
65
74
 
66
- def profile
75
+ def comments
67
76
  dataloader
68
77
  .with(GraphQL::Sources::ActiveRecordCollection, ::Comment, key: :user_id)
69
78
  .load(object.id)
@@ -136,7 +145,7 @@ end
136
145
  class PostType < GraphQL::Schema::Object
137
146
  field :likes, Integer, null: false
138
147
 
139
- def comments
148
+ def likes
140
149
  dataloader
141
150
  .with(GraphQL::Sources::ActiveRecordCount, ::Like, key: :post_id)
142
151
  .load(object.id)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './active_record_base'
4
-
5
3
  module GraphQL
6
4
  module Sources
7
5
  # A class for loading `has_many` style associations.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './active_record_base'
4
-
5
3
  module GraphQL
6
4
  module Sources
7
5
  # A class for loading a count of records.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './active_record_base'
4
-
5
3
  module GraphQL
6
4
  module Sources
7
5
  # A class for loading `has_one` style associations.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './active_storage_base'
4
-
5
3
  module GraphQL
6
4
  module Sources
7
5
  # A class for loading `has_many_attached` style associations.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './active_storage_base'
4
-
5
3
  module GraphQL
6
4
  module Sources
7
5
  # A class for loading `has_one_attached` style associations.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module Sources
5
- VERSION = '0.5.0'
5
+ VERSION = '1.1.1'
6
6
  end
7
7
  end
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'graphql'
4
+ require 'zeitwerk'
4
5
 
5
- require_relative './sources/active_record_count'
6
- require_relative './sources/active_record_collection'
7
- require_relative './sources/active_record_object'
8
- require_relative './sources/active_storage_has_many_attached'
9
- require_relative './sources/active_storage_has_one_attached'
10
- require_relative './sources/rails_cache'
6
+ loader = Zeitwerk::Loader.for_gem
7
+ loader.push_dir(__dir__, namespace: GraphQL)
8
+ loader.setup
11
9
 
12
10
  module GraphQL
13
11
  # A collection of common GraphQL dataloader classes.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-sources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-05 00:00:00.000000000 Z
11
+ date: 2022-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: zeitwerk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: factory_bot
43
57
  requirement: !ruby/object:Gem::Requirement