activecube-graphql 0.1.16 → 0.1.20
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 +33 -5
- data/Gemfile.lock +6 -6
- data/lib/activecube/graphql/cube_field.rb +1 -0
- data/lib/activecube/graphql/parse_tree.rb +34 -8
- 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: f40dfd438429b751590b990dd74293efaeddf44196408376568622b031996077
|
4
|
+
data.tar.gz: d457c6825398059230abacccf5c65d166929fb8feb69a3ef93abb1ff4bf99de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd77b677c65d9ae5be1bd4b918aeb235ff0c077a0ab04e57efbbac9dac4df1fe579bdcb382dd1c6205ff0efc2bbc9c213e93bb3f3eb2377a287a8967b4a23496
|
7
|
+
data.tar.gz: 2de88d604b46cea71e7a8fe8e714ac84b060089484bdf2b7c8dbe9192eabff1cce191726d5268cde9e7673378bfd91ed0b18b2d190c6f23984bce029708e53a3
|
@@ -11,15 +11,15 @@
|
|
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.
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="activecube (v0.1.30, RVM: ruby-2.6.3) [gem]" level="application" />
|
15
15
|
<orderEntry type="library" scope="PROVIDED" name="activemodel (v6.0.3.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="activerecord (v6.0.3.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.0.3.1, 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
19
|
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.7, 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.
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="graphql (v1.12.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.6, RVM: ruby-2.6.3) [gem]" level="application" />
|
23
23
|
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.2, 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" />
|
@@ -28,7 +28,35 @@
|
|
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
30
|
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.6.3) [gem]" level="application" />
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.4.
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.9, RVM: ruby-2.6.3) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.4.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
33
|
+
</component>
|
34
|
+
<component name="RakeTasksCache">
|
35
|
+
<option name="myRootTask">
|
36
|
+
<RakeTaskImpl id="rake">
|
37
|
+
<subtasks>
|
38
|
+
<RakeTaskImpl description="Build activecube-graphql-0.1.19.gem into the pkg directory" fullCommand="build" id="build" />
|
39
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
40
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
41
|
+
<RakeTaskImpl description="Build and install activecube-graphql-0.1.19.gem into system gems" fullCommand="install" id="install" />
|
42
|
+
<RakeTaskImpl id="install">
|
43
|
+
<subtasks>
|
44
|
+
<RakeTaskImpl description="Build and install activecube-graphql-0.1.19.gem into system gems without network access" fullCommand="install:local" id="local" />
|
45
|
+
</subtasks>
|
46
|
+
</RakeTaskImpl>
|
47
|
+
<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]" />
|
48
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
49
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
50
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
51
|
+
<RakeTaskImpl id="release">
|
52
|
+
<subtasks>
|
53
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
54
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
55
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
56
|
+
</subtasks>
|
57
|
+
</RakeTaskImpl>
|
58
|
+
</subtasks>
|
59
|
+
</RakeTaskImpl>
|
60
|
+
</option>
|
33
61
|
</component>
|
34
62
|
</module>
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activecube-graphql (0.1.
|
4
|
+
activecube-graphql (0.1.19)
|
5
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.30)
|
12
12
|
activerecord (>= 5.2)
|
13
13
|
activemodel (6.0.3.1)
|
14
14
|
activesupport (= 6.0.3.1)
|
@@ -23,8 +23,8 @@ GEM
|
|
23
23
|
zeitwerk (~> 2.2, >= 2.2.2)
|
24
24
|
concurrent-ruby (1.1.7)
|
25
25
|
diff-lcs (1.3)
|
26
|
-
graphql (1.
|
27
|
-
i18n (1.8.
|
26
|
+
graphql (1.12.4)
|
27
|
+
i18n (1.8.6)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
minitest (5.14.2)
|
30
30
|
rake (13.0.1)
|
@@ -42,9 +42,9 @@ GEM
|
|
42
42
|
rspec-support (~> 3.9.0)
|
43
43
|
rspec-support (3.9.3)
|
44
44
|
thread_safe (0.3.6)
|
45
|
-
tzinfo (1.2.
|
45
|
+
tzinfo (1.2.9)
|
46
46
|
thread_safe (~> 0.1)
|
47
|
-
zeitwerk (2.4.
|
47
|
+
zeitwerk (2.4.2)
|
48
48
|
|
49
49
|
PLATFORMS
|
50
50
|
ruby
|
@@ -49,6 +49,7 @@ module Activecube
|
|
49
49
|
def execute_query tree, ctx
|
50
50
|
cube_query = tree.build_query
|
51
51
|
ctx[:sql_io].puts(cube_query.to_sql) if ctx[:sql_io].respond_to?(:puts)
|
52
|
+
cube_query.user_agent = ctx[:sql_user_agent] || 'Ruby/Activecube Graphql'
|
52
53
|
cube_query.query
|
53
54
|
end
|
54
55
|
|
@@ -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
|
@@ -98,23 +116,31 @@ module Activecube
|
|
98
116
|
element
|
99
117
|
end
|
100
118
|
|
119
|
+
|
101
120
|
def converted_field_array method, values
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
121
|
+
case method
|
122
|
+
when :desc,:asc
|
123
|
+
values.collect{|v| KEY_FIELD_PREFIX + v}
|
124
|
+
when :limit_by
|
125
|
+
values.merge({each: KEY_FIELD_PREFIX + values[:each]})
|
126
|
+
else
|
127
|
+
values
|
128
|
+
end
|
107
129
|
end
|
108
130
|
|
109
131
|
def apply_selector element, k, hash
|
110
132
|
hash.each_pair do |operator, arg|
|
111
133
|
selector = cube.selectors[k]
|
112
134
|
raise Activecube::InputArgumentError, "#{selector} does not handle method '#{operator}' for #{element} '#{k}'" unless selector.respond_to?(operator)
|
113
|
-
element = element.when( selector.send(operator, arg) )
|
135
|
+
element = element.when( selector.send(operator, arg) ) if applicable_operator?(operator, arg)
|
114
136
|
end
|
115
137
|
element
|
116
138
|
end
|
117
139
|
|
140
|
+
def applicable_operator? operator, arg
|
141
|
+
!arg.nil? || NULLABLE_OPERATORS.include?(operator)
|
142
|
+
end
|
143
|
+
|
118
144
|
def apply_or_selector element, value
|
119
145
|
selectors = value.collect{|v| make_selector v }.compact
|
120
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.20
|
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: []
|