activecube-graphql 0.1.17 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/activecube-graphql.iml +38 -11
- data/Gemfile.lock +20 -21
- data/lib/activecube/graphql/cube_field.rb +2 -0
- data/lib/activecube/graphql/parse_tree.rb +25 -3
- data/lib/activecube/graphql/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40c5c73bc8f042d31fd5516c87bbccc1ad94793ae8dfee03f1218648bff42fa9
|
4
|
+
data.tar.gz: 4bbde86bc60f05b118f5d22f0327c40659a8a8ec046f427733313f86ae294d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4eb8de7db042ae4618cfbc0052f6e01f3756094d373ad755a76bac4bf86ca3d48bfabcbcf678cd600b4cd45e780f43c94baae3c2f8ea33e9b61808b7cb5e897
|
7
|
+
data.tar.gz: 1413b6df98ee24609fe9ebae8af7e57558708b9af97f5da09b1b8f7179318099954bf518e280ae731886ab9fd787161501a6ba81208ec8fa7698c16956df565c
|
@@ -11,24 +11,51 @@
|
|
11
11
|
</content>
|
12
12
|
<orderEntry type="jdk" jdkName="RVM: ruby-2.6.3" jdkType="RUBY_SDK" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="activecube (v0.1.
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="activemodel (v6.
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="activerecord (v6.
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="activecube (v0.1.34, RVM: ruby-2.6.3) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v6.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v6.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
18
18
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.3, RVM: ruby-2.6.3) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.6.3) [gem]" level="application" />
|
20
20
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.3) [gem]" level="application" />
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="graphql (v1.
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="graphql (v1.12.19, RVM: ruby-2.6.3) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.11, RVM: ruby-2.6.3) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
24
24
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
25
25
|
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
26
26
|
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
27
27
|
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
28
28
|
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
29
29
|
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, RVM: ruby-2.6.3) [gem]" level="application" />
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
32
|
-
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
32
|
+
</component>
|
33
|
+
<component name="RakeTasksCache">
|
34
|
+
<option name="myRootTask">
|
35
|
+
<RakeTaskImpl id="rake">
|
36
|
+
<subtasks>
|
37
|
+
<RakeTaskImpl description="Build activecube-graphql-0.1.19.gem into the pkg directory" fullCommand="build" id="build" />
|
38
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
39
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
40
|
+
<RakeTaskImpl description="Build and install activecube-graphql-0.1.19.gem into system gems" fullCommand="install" id="install" />
|
41
|
+
<RakeTaskImpl id="install">
|
42
|
+
<subtasks>
|
43
|
+
<RakeTaskImpl description="Build and install activecube-graphql-0.1.19.gem into system gems without network access" fullCommand="install:local" id="local" />
|
44
|
+
</subtasks>
|
45
|
+
</RakeTaskImpl>
|
46
|
+
<RakeTaskImpl description="Create tag v0.1.19 and build and push activecube-graphql-0.1.19.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
47
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
48
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
49
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
50
|
+
<RakeTaskImpl id="release">
|
51
|
+
<subtasks>
|
52
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
53
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
54
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
55
|
+
</subtasks>
|
56
|
+
</RakeTaskImpl>
|
57
|
+
</subtasks>
|
58
|
+
</RakeTaskImpl>
|
59
|
+
</option>
|
33
60
|
</component>
|
34
61
|
</module>
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activecube-graphql (0.1.
|
5
|
-
activecube (~> 0.1.
|
4
|
+
activecube-graphql (0.1.20)
|
5
|
+
activecube (~> 0.1.28)
|
6
6
|
graphql (~> 1.10)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activecube (0.1.
|
11
|
+
activecube (0.1.34)
|
12
12
|
activerecord (>= 5.2)
|
13
|
-
activemodel (6.
|
14
|
-
activesupport (= 6.
|
15
|
-
activerecord (6.
|
16
|
-
activemodel (= 6.
|
17
|
-
activesupport (= 6.
|
18
|
-
activesupport (6.
|
13
|
+
activemodel (6.1.4)
|
14
|
+
activesupport (= 6.1.4)
|
15
|
+
activerecord (6.1.4)
|
16
|
+
activemodel (= 6.1.4)
|
17
|
+
activesupport (= 6.1.4)
|
18
|
+
activesupport (6.1.4)
|
19
19
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
-
i18n (>=
|
21
|
-
minitest (
|
22
|
-
tzinfo (~>
|
23
|
-
zeitwerk (~> 2.
|
24
|
-
concurrent-ruby (1.1.
|
20
|
+
i18n (>= 1.6, < 2)
|
21
|
+
minitest (>= 5.1)
|
22
|
+
tzinfo (~> 2.0)
|
23
|
+
zeitwerk (~> 2.3)
|
24
|
+
concurrent-ruby (1.1.9)
|
25
25
|
diff-lcs (1.3)
|
26
|
-
graphql (1.
|
27
|
-
i18n (1.8.
|
26
|
+
graphql (1.12.19)
|
27
|
+
i18n (1.8.11)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
minitest (5.14.
|
29
|
+
minitest (5.14.4)
|
30
30
|
rake (13.0.1)
|
31
31
|
rspec (3.9.0)
|
32
32
|
rspec-core (~> 3.9.0)
|
@@ -41,10 +41,9 @@ GEM
|
|
41
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
42
|
rspec-support (~> 3.9.0)
|
43
43
|
rspec-support (3.9.3)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
zeitwerk (2.4.0)
|
44
|
+
tzinfo (2.0.4)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
zeitwerk (2.5.1)
|
48
47
|
|
49
48
|
PLATFORMS
|
50
49
|
ruby
|
@@ -48,6 +48,8 @@ module Activecube
|
|
48
48
|
|
49
49
|
def execute_query tree, ctx
|
50
50
|
cube_query = tree.build_query
|
51
|
+
cube_query.user_agent = ctx[:sql_user_agent] || 'Ruby/Activecube Graphql'
|
52
|
+
|
51
53
|
ctx[:sql_io].puts(cube_query.to_sql) if ctx[:sql_io].respond_to?(:puts)
|
52
54
|
cube_query.query
|
53
55
|
end
|
@@ -6,6 +6,7 @@ module Activecube
|
|
6
6
|
|
7
7
|
TYPENAME = '__typename'
|
8
8
|
KEY_FIELD_PREFIX = '_aq.'
|
9
|
+
NULLABLE_OPERATORS = [:eq,:not_eq,:is,:not]
|
9
10
|
|
10
11
|
attr_reader :arguments, :ast_node, :cube, :parent, :name, :definition, :key,
|
11
12
|
:children, :metric, :dimension, :field, :context_node
|
@@ -18,10 +19,11 @@ module Activecube
|
|
18
19
|
@key = parent ? (parent.key ? "#{parent.key}.#{name}" : KEY_FIELD_PREFIX+name ) : nil
|
19
20
|
|
20
21
|
@context_node = context_node
|
21
|
-
@arguments = context_node.arguments.to_h
|
22
|
-
|
23
22
|
@ast_node = context_node.ast_node
|
24
23
|
|
24
|
+
@arguments = sort_node_arguments ast_node, context_node.arguments.to_h
|
25
|
+
|
26
|
+
|
25
27
|
if parent
|
26
28
|
@definition = context_node.definitions.first.name
|
27
29
|
if parent.dimension
|
@@ -43,6 +45,22 @@ module Activecube
|
|
43
45
|
|
44
46
|
end
|
45
47
|
|
48
|
+
def sort_node_arguments ast_node, arguments
|
49
|
+
if (options = arguments['options']).kind_of?(Hash)
|
50
|
+
options_keys = context_node.ast_node.arguments.detect{|x| x.name=='options'}.value.arguments.map{|x|
|
51
|
+
x.name.underscore.to_sym
|
52
|
+
}
|
53
|
+
arguments['options'] = Hash[
|
54
|
+
options_keys.collect{|key|
|
55
|
+
raise "Unmatched key #{key}" unless options[key]
|
56
|
+
[key, options[key]]
|
57
|
+
}
|
58
|
+
|
59
|
+
]
|
60
|
+
end
|
61
|
+
arguments
|
62
|
+
end
|
63
|
+
|
46
64
|
def union?
|
47
65
|
context_node.return_type.kind_of? GraphQL::UnionType
|
48
66
|
end
|
@@ -114,11 +132,15 @@ module Activecube
|
|
114
132
|
hash.each_pair do |operator, arg|
|
115
133
|
selector = cube.selectors[k]
|
116
134
|
raise Activecube::InputArgumentError, "#{selector} does not handle method '#{operator}' for #{element} '#{k}'" unless selector.respond_to?(operator)
|
117
|
-
element = element.when( selector.send(operator, arg) )
|
135
|
+
element = element.when( selector.send(operator, arg) ) if applicable_operator?(operator, arg)
|
118
136
|
end
|
119
137
|
element
|
120
138
|
end
|
121
139
|
|
140
|
+
def applicable_operator? operator, arg
|
141
|
+
!arg.nil? || NULLABLE_OPERATORS.include?(operator)
|
142
|
+
end
|
143
|
+
|
122
144
|
def apply_or_selector element, value
|
123
145
|
selectors = value.collect{|v| make_selector v }.compact
|
124
146
|
element.when( Activecube::Query::Selector.or(selectors) )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activecube-graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksey Studnev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activecube
|
@@ -114,7 +114,7 @@ homepage: https://github.com/bitquery/activecube-graphql
|
|
114
114
|
licenses:
|
115
115
|
- MIT
|
116
116
|
metadata: {}
|
117
|
-
post_install_message:
|
117
|
+
post_install_message:
|
118
118
|
rdoc_options: []
|
119
119
|
require_paths:
|
120
120
|
- lib
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubygems_version: 3.0.4
|
133
|
-
signing_key:
|
133
|
+
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Multi-Dimensional Queries using GraphQL
|
136
136
|
test_files: []
|