ibrain-core 0.2.5 → 0.2.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3a1bdc7ba2d079ca5c04d151dd5693e22d2053a40bf1697ab6494ea8e03f400
|
4
|
+
data.tar.gz: 619d32610ab9cda07125ed545d424b70b86b35e52445e32e552db33629e331c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
36
|
-
|
37
|
-
|
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
|
-
|
9
|
-
|
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
|
data/lib/ibrain/core/version.rb
CHANGED
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.
|
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-
|
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
|