graphql-batch 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c697b54ac680478b01f6ec5dbbd9f0aa60f4a7b0254b801ebf4fd24eed304b5
4
- data.tar.gz: aedf76281ad239e034365c40d90e6460e347f896838b29e56dae07506c585103
3
+ metadata.gz: d554444b8de82eddc177ef4461270ed6b34c24e7d48f505c9b568115b913ec18
4
+ data.tar.gz: e46587c28fdf154c6747b658d6ec534d2bc8d036bcef02a5fa11e52b0dc0cb9d
5
5
  SHA512:
6
- metadata.gz: 12da2909740747a98ceb210fc9d6ce32dcbfb21db367b818523e26efd1b96fefeee7d8b18bdb906fa1e8ca60687732b478c4f08c515d9ef82d4e73a915d03a15
7
- data.tar.gz: 03d064a71e246df757cf4a0eed81f230082fb2efcf87b5db021a6debff7b39e693eba4895412151e5a69224c997cd829a729d735d98ca50863ea3bbb3c19bed4
6
+ metadata.gz: 58d680e45da55224d58709d78ae187623d096dfc695b1ea8e00116590fafcd4f16b3f84ef78a337fbde0ca449c02822d87da6ce0274818cc8df336dbe016ee27
7
+ data.tar.gz: 3b609c6ad409cc48deeb71d2d0d487f1fd10063f54aae181dbec7da5825deab825900fa6764634aceae2663ee05ac0a8bfdec8148a970a0d677b0f9f5bf8455d
@@ -10,8 +10,13 @@ jobs:
10
10
  strategy:
11
11
  fail-fast: false
12
12
  matrix:
13
- ruby: [2.4, 2.7, '3.1', '3.2']
13
+ ruby: [2.7, 3.1, 3.3]
14
14
  graphql_version: ['~> 1.12.18', '~> 1.13', '~> 2.0']
15
+ include:
16
+ - ruby: 2.4
17
+ graphql_version: '~> 1.12.18'
18
+ - ruby: 2.4
19
+ graphql_version: '~> 1.13'
15
20
  steps:
16
21
  - uses: actions/checkout@v2
17
22
  - uses: ruby/setup-ruby@v1
data/README.md CHANGED
@@ -122,9 +122,7 @@ def all_collections
122
122
  Promise.all([
123
123
  CountLoader.for(Shop, :smart_collections).load(context.shop_id),
124
124
  CountLoader.for(Shop, :custom_collections).load(context.shop_id),
125
- ]).then do |results|
126
- results.reduce(&:+)
127
- end
125
+ ]).then(&:sum)
128
126
  end
129
127
  ```
130
128
 
@@ -12,5 +12,19 @@ module GraphQL::Batch
12
12
  def after_multiplex(multiplex)
13
13
  GraphQL::Batch::Executor.end_batch
14
14
  end
15
+
16
+ module Trace
17
+ def initialize(executor_class:, **_rest)
18
+ @executor_class = executor_class
19
+ super
20
+ end
21
+
22
+ def execute_multiplex(multiplex:)
23
+ GraphQL::Batch::Executor.start_batch(@executor_class)
24
+ super
25
+ ensure
26
+ GraphQL::Batch::Executor.end_batch
27
+ end
28
+ end
15
29
  end
16
30
  end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Batch
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
data/lib/graphql/batch.rb CHANGED
@@ -16,8 +16,12 @@ module GraphQL
16
16
  end
17
17
 
18
18
  def self.use(schema_defn, executor_class: GraphQL::Batch::Executor)
19
- instrumentation = GraphQL::Batch::SetupMultiplex.new(schema_defn, executor_class: executor_class)
20
- schema_defn.instrument(:multiplex, instrumentation)
19
+ if schema_defn.respond_to?(:trace_with)
20
+ schema_defn.trace_with(GraphQL::Batch::SetupMultiplex::Trace, executor_class: executor_class)
21
+ else
22
+ instrumentation = GraphQL::Batch::SetupMultiplex.new(schema_defn, executor_class: executor_class)
23
+ schema_defn.instrument(:multiplex, instrumentation)
24
+ end
21
25
 
22
26
  if schema_defn.mutation
23
27
  require_relative "batch/mutation_field_extension"
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.5.3
4
+ version: 0.5.4
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: 2023-05-16 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.4.13
140
+ rubygems_version: 3.5.5
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: A query batching executor for the graphql gem