graphql-batch 0.3.0 → 0.3.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 +4 -4
- data/.travis.yml +0 -3
- data/CONTRIBUTING.md +28 -0
- data/README.md +5 -4
- data/lib/graphql/batch.rb +6 -6
- data/lib/graphql/batch/execution_strategy.rb +2 -0
- data/lib/graphql/batch/mutation_execution_strategy.rb +2 -0
- data/lib/graphql/batch/version.rb +1 -1
- metadata +3 -3
- data/Gemfile.graphql13 +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ae7754876a6ce37072721f5f69e56af29de783a
|
4
|
+
data.tar.gz: 0cc9fa2b9f612543adb13a889b5d7d9e3756e5fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 007f8c44eabe9c5edcb2d1bb58fc4fa2e725a728cd5c2a3f41a9ffebdf36aba8cdac639f1e356aa6f0bde33a6d03f0a4f9ce697cf491badf21b9470b210d1fd6
|
7
|
+
data.tar.gz: 1353b91cdbfe336630cb34b7ead64dd366df643f3275c2d800129ffc049c7d1183532f5e3c4355cfad73b52063c6cc927481225d2fb022b043c71f8b9b5013f8
|
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Types of contributions we welcome:
|
4
|
+
|
5
|
+
* Reporting issues with existing features
|
6
|
+
* Bug fixes
|
7
|
+
* Performance improvements
|
8
|
+
* Documentation and/or clearer interfaces
|
9
|
+
|
10
|
+
## Proposing Features
|
11
|
+
|
12
|
+
The main use case for this project is around batching queries
|
13
|
+
for GraphQL requests, but is open to changes that make it more
|
14
|
+
generic. This includes supporting concurrent or parallel executors.
|
15
|
+
|
16
|
+
When in doubt about whether we will be interested in including a
|
17
|
+
new feature in this project, please open an issue to propose the
|
18
|
+
feature so we can confirm the feature should be in scope for the
|
19
|
+
project before it is implemented.
|
20
|
+
|
21
|
+
## How To Contribute
|
22
|
+
|
23
|
+
1. Fork the [repository in github](https://github.com/Shopify/graphql-batch)
|
24
|
+
2. Create your feature branch (`git checkout -b fix-feature`)
|
25
|
+
3. Commit your changes (`git commit -am 'fix: Summarize change'`)
|
26
|
+
3. Make sure all tests pass (`bundle exec rake`)
|
27
|
+
4. Push to the branch (`git push origin fix-feature`)
|
28
|
+
5. [Create new pull request](https://github.com/Shopify/graphql-batch/pulls)
|
data/README.md
CHANGED
@@ -46,14 +46,15 @@ class RecordLoader < GraphQL::Batch::Loader
|
|
46
46
|
end
|
47
47
|
```
|
48
48
|
|
49
|
-
Use
|
49
|
+
Use lazy execution and instrumentation by `GraphQL::Batch` in your schema
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
MySchema = GraphQL::Schema.define do
|
53
53
|
query MyQueryType
|
54
|
+
|
55
|
+
lazy_resolve(Promise, :sync)
|
56
|
+
instrument(:query, GraphQL::Batch::Setup)
|
54
57
|
end
|
55
|
-
MySchema.query_execution_strategy = GraphQL::Batch::ExecutionStrategy
|
56
|
-
MySchema.mutation_execution_strategy = GraphQL::Batch::MutationExecutionStrategy
|
57
58
|
```
|
58
59
|
|
59
60
|
The loader class can be used from the resolve proc for a graphql field by calling `.for` with the grouping arguments to get a loader instance, then call `.load` on that instance with the key to load.
|
@@ -133,7 +134,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
133
134
|
|
134
135
|
## Contributing
|
135
136
|
|
136
|
-
|
137
|
+
See our [contributing guidelines](CONTRIBUTING.md) for more information.
|
137
138
|
|
138
139
|
## License
|
139
140
|
|
data/lib/graphql/batch.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require "graphql"
|
2
|
+
if Gem::Version.new(GraphQL::VERSION) < Gem::Version.new("1.3")
|
3
|
+
warn "graphql gem versions less than 1.3 are deprecated for use with graphql-batch, upgrade so lazy_resolve can be used"
|
4
|
+
end
|
2
5
|
require "promise.rb"
|
3
6
|
|
4
7
|
module GraphQL
|
@@ -15,6 +18,9 @@ module GraphQL
|
|
15
18
|
GraphQL::Batch::Executor.current = nil
|
16
19
|
end
|
17
20
|
end
|
21
|
+
|
22
|
+
autoload :ExecutionStrategy, 'graphql/batch/execution_strategy'
|
23
|
+
autoload :MutationExecutionStrategy, 'graphql/batch/mutation_execution_strategy'
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
@@ -23,9 +29,3 @@ require_relative "batch/loader"
|
|
23
29
|
require_relative "batch/executor"
|
24
30
|
require_relative "batch/promise"
|
25
31
|
require_relative "batch/setup"
|
26
|
-
|
27
|
-
# Allow custom execution strategies to be removed upstream
|
28
|
-
if defined?(GraphQL::Query::SerialExecution)
|
29
|
-
require_relative "batch/execution_strategy"
|
30
|
-
require_relative "batch/mutation_execution_strategy"
|
31
|
-
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
warn "GraphQL::Batch::ExecutionStrategy is deprecated, instead use `lazy_resolve(Promise, :sync)` and `instrument(:query, GraphQL::Batch::Setup)` in GraphQL::Schema.define"
|
2
|
+
|
1
3
|
module GraphQL::Batch
|
2
4
|
class ExecutionStrategy < GraphQL::Query::SerialExecution
|
3
5
|
def execute(_, _, query)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Thacker-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -109,8 +109,8 @@ extra_rdoc_files: []
|
|
109
109
|
files:
|
110
110
|
- ".gitignore"
|
111
111
|
- ".travis.yml"
|
112
|
+
- CONTRIBUTING.md
|
112
113
|
- Gemfile
|
113
|
-
- Gemfile.graphql13
|
114
114
|
- LICENSE.txt
|
115
115
|
- README.md
|
116
116
|
- Rakefile
|