graphql-batch 0.5.3 → 0.5.4
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/.github/workflows/ci.yml +6 -1
- data/README.md +1 -3
- data/lib/graphql/batch/setup_multiplex.rb +14 -0
- data/lib/graphql/batch/version.rb +1 -1
- data/lib/graphql/batch.rb +6 -2
- 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: d554444b8de82eddc177ef4461270ed6b34c24e7d48f505c9b568115b913ec18
         | 
| 4 | 
            +
              data.tar.gz: e46587c28fdf154c6747b658d6ec534d2bc8d036bcef02a5fa11e52b0dc0cb9d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 58d680e45da55224d58709d78ae187623d096dfc695b1ea8e00116590fafcd4f16b3f84ef78a337fbde0ca449c02822d87da6ce0274818cc8df336dbe016ee27
         | 
| 7 | 
            +
              data.tar.gz: 3b609c6ad409cc48deeb71d2d0d487f1fd10063f54aae181dbec7da5825deab825900fa6764634aceae2663ee05ac0a8bfdec8148a970a0d677b0f9f5bf8455d
         | 
    
        data/.github/workflows/ci.yml
    CHANGED
    
    | @@ -10,8 +10,13 @@ jobs: | |
| 10 10 | 
             
                strategy:
         | 
| 11 11 | 
             
                  fail-fast: false
         | 
| 12 12 | 
             
                  matrix:
         | 
| 13 | 
            -
                    ruby: [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 | 
| 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
         | 
    
        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 | 
            -
                   | 
| 20 | 
            -
             | 
| 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. | 
| 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:  | 
| 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. | 
| 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
         |