ibrain-core 0.3.5 → 0.3.6.pre.rc.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: 32c2ce34dadd75f8a4f3b9928f6329264ac1b9b2d029bbdc8bd02fc144663cda
4
- data.tar.gz: d3e0ddda503ccdf30e7a6708d2b197b58c3818f1dfa49fc2e8375c19ea5abb86
3
+ metadata.gz: b1e030506b77afbbd1a195a04ce3887a4ca3b2331cba1963985c6d93577f78b3
4
+ data.tar.gz: 2c4fc926524af27183fc2fec91f6eb3ba301caba1b46ecbdd89c71337d05da0d
5
5
  SHA512:
6
- metadata.gz: 3174ba2c0cd7bff10ec5ca9bae27be08cfa933c93e34552ec7a7c3f90c657efb974cf9cdcf3df9dbe60f6c15b42057275d1726935ad6b89a1d7153bef629c68e
7
- data.tar.gz: 8710c5d10f36824d66bbf2378de560a63add715ebd75d26d972c15713785c1014712f82dc600f5df7dc8b35c4bca61327594046a2ee140ebd37a9101e09775d7
6
+ metadata.gz: 7014646c14b98c4435e3a75362367eb5f5ee699f065ab92e7afd166d4a87fdcd9d3faae83461aec70e07812416999b0457646f8c72ebc2255733fb1e8942d31f
7
+ data.tar.gz: e23e0af4d959ee2e1e5e4d424a52cb0288208697c295069d66e37e8091d1e08d3ed338303c5fba847178f1428a6fa4bb3d1f6eae9bb3b31290d0532930d8e83d
@@ -36,9 +36,9 @@ module Ibrain
36
36
  return [params[:query], prepare_variables(params[:variables]), 'IntrospectionQuery'] if params[:query].try(:include?, 'IntrospectionQuery')
37
37
 
38
38
  operations = prepare_variables(params[:operations])
39
- query = operations['query']
40
- variables = operations['variables']
41
- operation_name = operations['operationName']
39
+ query = operations['query'] || params[:query]
40
+ variables = operations['variables'] || params[:variables]
41
+ operation_name = operations['operationName'] || params[:operationName]
42
42
 
43
43
  if params[:map].present?
44
44
  JSON.parse(params[:map]).each do |k, arguments|
@@ -3,7 +3,7 @@
3
3
  module Ibrain
4
4
  module Resolvers
5
5
  class BaseAggregate < BaseResolver
6
- type Ibrain::Types::AggregateType.connection_type, null: false
6
+ type Ibrain::Types::BaseObject.connection_type, null: false
7
7
  end
8
8
  end
9
9
  end
@@ -3,7 +3,9 @@
3
3
  module Ibrain
4
4
  module Types
5
5
  class AggregateType < BaseObject
6
- field :total_count, Int, null: false, default_value: 0
6
+ graphql_name 'aggregate'
7
+
8
+ field :count, Int, null: false
7
9
  end
8
10
  end
9
11
  end
@@ -6,10 +6,10 @@ module Ibrain
6
6
  # add `nodes` and `pageInfo` fields, as well as `edge_type(...)` and `node_nullable(...)` overrides
7
7
  include GraphQL::Types::Relay::ConnectionBehaviors
8
8
 
9
- field :total_count, Integer, null: false, camelize: false
9
+ field :aggregate, Ibrain::Types::AggregateType, null: false, camelize: false
10
10
 
11
- def total_count
12
- object.items.size
11
+ def aggregate
12
+ Ibrain::Aggregate.new(object.uniq.size)
13
13
  end
14
14
  end
15
15
  end
@@ -9,6 +9,14 @@ module Ibrain
9
9
  connection_type_class(Ibrain::Types::BaseApiConnection)
10
10
 
11
11
  field_class Ibrain::Types::BaseApiField
12
+
13
+ def self.overridden_graphql_name(name = '')
14
+ to_s.demodulize.gsub('Type', '').singularize.classify.constantize.table_name
15
+ rescue StandardError
16
+ return to_s.demodulize if name.blank?
17
+
18
+ name
19
+ end
12
20
  end
13
21
  end
14
22
  end
@@ -6,10 +6,10 @@ module Ibrain
6
6
  # add `nodes` and `pageInfo` fields, as well as `edge_type(...)` and `node_nullable(...)` overrides
7
7
  include GraphQL::Types::Relay::ConnectionBehaviors
8
8
 
9
- field :total_count, Integer, null: false, camelize: false
9
+ field :aggregate, Ibrain::Types::AggregateType, null: false, camelize: false
10
10
 
11
- def total_count
12
- object.items.size
11
+ def aggregate
12
+ Ibrain::Aggregate.new(object.uniq.size)
13
13
  end
14
14
  end
15
15
  end
@@ -9,6 +9,14 @@ module Ibrain
9
9
  connection_type_class(Ibrain::Types::BaseConnection)
10
10
 
11
11
  field_class ::Ibrain::Types::BaseField
12
+
13
+ def self.overridden_graphql_name(name = '')
14
+ to_s.demodulize.gsub('Type', '').singularize.classify.constantize.table_name
15
+ rescue StandardError
16
+ return to_s.demodulize if name.blank?
17
+
18
+ name
19
+ end
12
20
  end
13
21
  end
14
22
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain
4
+ class Aggregate
5
+ def initialize(count)
6
+ @count = count
7
+ end
8
+
9
+ attr_reader :count
10
+ end
11
+ end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibrain
4
- VERSION = "0.3.5"
4
+ VERSION = "0.3.6-rc.1"
5
5
 
6
6
  def self.ibrain_version
7
7
  VERSION
8
8
  end
9
9
 
10
10
  def self.previous_ibrain_minor_version
11
- '0.3.4'
11
+ '0.3.6'
12
12
  end
13
13
 
14
14
  def self.ibrain_gem_version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibrain-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6.pre.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tai Nguyen Van
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-25 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-session_store
@@ -218,6 +218,7 @@ files:
218
218
  - app/models/concerns/ibrain/user_api_authentication.rb
219
219
  - app/models/concerns/ibrain/user_methods.rb
220
220
  - app/models/ibrain/ability.rb
221
+ - app/models/ibrain/aggregate.rb
221
222
  - app/models/ibrain/application_record.rb
222
223
  - app/models/ibrain/base.rb
223
224
  - app/models/ibrain/legacy_user.rb
@@ -301,9 +302,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
301
302
  version: '0'
302
303
  required_rubygems_version: !ruby/object:Gem::Requirement
303
304
  requirements:
304
- - - ">="
305
+ - - ">"
305
306
  - !ruby/object:Gem::Version
306
- version: '0'
307
+ version: 1.3.1
307
308
  requirements: []
308
309
  rubygems_version: 3.3.7
309
310
  signing_key: