ibrain-core 0.2.5 → 0.2.9

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: 85e62cc635fbccd53815db9ee21e664d3db31e3989ce34d9768c1ca68aefd8b1
4
- data.tar.gz: 81527f0a0dc820ceb12abdab5c000ad72f8a623277befd0a83594fd9f7597427
3
+ metadata.gz: a3a1bdc7ba2d079ca5c04d151dd5693e22d2053a40bf1697ab6494ea8e03f400
4
+ data.tar.gz: 619d32610ab9cda07125ed545d424b70b86b35e52445e32e552db33629e331c3
5
5
  SHA512:
6
- metadata.gz: 217e2820258575c7e41fa1f1ae3a3561eee5ece0eff563c2e1d48b92dea76cd39a8eec45c8e1333679851b738480a3d3bd49769ec322f7852d88b050eed4160a
7
- data.tar.gz: bc61cf1e647c33760ce4d7fe4bab3fc8438114a04cad284763fa9c9cb26d71e649ea663471f1de050287acbc8bd74c3bab45eb183ab298fbe4852265259d854e
6
+ metadata.gz: 4b541ae4a5f20c9e4d2e2ff5135066ff8f3824a3ae0a4b25717f286eb3ca7f9883e4f25e73f5d87905230fa35070e2da1799798e94fc9c6f68ec0a363a81066a
7
+ data.tar.gz: 6562679bf38d56515b74316c84b45c4600460b0ac01745e3e9bbc3fe6848e19c6ddec92b8f01e3bc9af7f294f96f09a2d50edc935a91c9ac65e1cc87a157346b
@@ -32,9 +32,33 @@ module Ibrain
32
32
  protected
33
33
 
34
34
  def normalize_entity
35
- query = params[:query]
36
- operation_name = params[:operationName]
37
- variables = prepare_variables(params[:variables])
35
+ return [params[:query], prepare_variables(params[:variables]), params[:operationName]] if params[:variables].present?
36
+
37
+ operations = prepare_variables(params[:operations])
38
+ query = operations['query']
39
+ variables = operations['variables']
40
+ operation_name = operations['operationName']
41
+
42
+ if params[:map].present?
43
+ JSON.parse(params[:map]).each do |k, arguments|
44
+ argument_name = arguments.try(:first).try(:split, '.').try(:second)
45
+ next if argument_name.blank?
46
+
47
+ file = params[k]
48
+
49
+ if variables[argument_name].blank?
50
+ variables[argument_name] = variables[argument_name].is_a?(Array) ? [file] : file
51
+
52
+ next
53
+ end
54
+
55
+ unless variables[argument_name].is_a?(Array)
56
+ variables[argument_name] = [variables[argument_name]]
57
+ end
58
+
59
+ variables[argument_name] = variables[argument_name].concat([file]).compact
60
+ end
61
+ end
38
62
 
39
63
  [query, variables, operation_name]
40
64
  end
@@ -4,10 +4,10 @@ module Ibrain
4
4
  class BaseSchema < ::GraphQL::Schema
5
5
  use GraphQL::Batch
6
6
 
7
- use GraphQL::Guard.new(
8
- policy_object: ::Ibrain::Config.graphql_policy.safe_constantize,
9
- not_authorized: ->(type, field) { raise IbrainErrors::PermissionError.new("You not have permission to access #{type}.#{field}") }
10
- )
7
+ # use GraphQL::Guard.new(
8
+ # policy_object: ::Ibrain::Config.graphql_policy.safe_constantize,
9
+ # not_authorized: ->(type, field) { raise IbrainErrors::PermissionError.new("You not have permission to access #{type}.#{field}") }
10
+ # )
11
11
 
12
12
  # Union and Interface Resolution
13
13
  def self.resolve_type(_abstract_type, _obj, _ctx)
@@ -3,6 +3,8 @@
3
3
  module Ibrain
4
4
  module Resolvers
5
5
  class BaseResolver < GraphQL::Schema::Resolver
6
+ argument_class ::Ibrain::Types::BaseArgument
7
+
6
8
  argument :filter, Ibrain::Types::FilterType, required: false, default_value: nil
7
9
  argument :limit, Int, required: false, default_value: 10
8
10
  argument :offset, Int, required: false, default_value: 0
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibrain
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.9"
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.2.4'
11
+ '0.2.8'
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.2.5
4
+ version: 0.2.9
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-01-11 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-session_store