grumlin 0.14.5 → 0.15.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +7 -7
- data/README.md +1 -1
- data/lib/grumlin/anonymous_step.rb +6 -4
- data/lib/grumlin/bytecode.rb +1 -2
- data/lib/grumlin/expressions/u.rb +2 -2
- data/lib/grumlin/property.rb +24 -0
- data/lib/grumlin/traverser.rb +12 -0
- data/lib/grumlin/typing.rb +13 -3
- data/lib/grumlin/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44c62fb657fac1ce08d4a4dcb05456a2750284dddcd5adbbd20f56bb2b9ef9c
|
4
|
+
data.tar.gz: eccc2648799e68be2225ce606a06411b49953ce586e4b8249156dc680fc3522e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc9f36a53d49749425df0014005e18ddd47b91e5c35bdc4dd4c7dfc0ec3309ba15df4e8a3367a8dba4c92494a2f70cab9fe4a846ded833100dc09937bf4ff9b
|
7
|
+
data.tar.gz: d315dfb2945c27091f76a21af2e30f77eb8753042519cf2bd7813ef544cb805f4970808158a550e5abdc1891c1526d4c3441bda46334bae67e2bf49a8ff9bd87
|
data/.github/workflows/main.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## [0.15.3] - 2022-01-18
|
2
|
+
|
3
|
+
- Fix passing nils as step arguments. Even if they are not supported by the server, they should not be omitted.
|
4
|
+
|
5
|
+
## [0.15.2] - 2022-01-17
|
6
|
+
|
7
|
+
- New steps: `map` and `identity`
|
8
|
+
|
9
|
+
## [0.15.1] - 2022-01-17
|
10
|
+
|
11
|
+
- Fix passing arrays as step arguments
|
12
|
+
|
13
|
+
## [0.15.0] - 2022-01-11
|
14
|
+
|
15
|
+
- Add `properties` step
|
16
|
+
- Add proper support for bulked results
|
17
|
+
- Add support for `Property` objects
|
18
|
+
|
1
19
|
## [0.14.5] - 2021-12-27
|
2
20
|
|
3
21
|
- Fix params handling
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grumlin (0.
|
4
|
+
grumlin (0.15.3)
|
5
5
|
async-pool (~> 0.3)
|
6
6
|
async-websocket (~> 0.19)
|
7
7
|
oj (~> 3.12)
|
@@ -60,15 +60,15 @@ GEM
|
|
60
60
|
rexml
|
61
61
|
kramdown-parser-gfm (1.1.0)
|
62
62
|
kramdown (~> 2.0)
|
63
|
-
mini_portile2 (2.
|
63
|
+
mini_portile2 (2.7.1)
|
64
64
|
minitest (5.14.4)
|
65
65
|
nio4r (2.5.8)
|
66
|
-
nokogiri (1.
|
67
|
-
mini_portile2 (~> 2.
|
66
|
+
nokogiri (1.13.1)
|
67
|
+
mini_portile2 (~> 2.7.0)
|
68
68
|
racc (~> 1.4)
|
69
|
-
nokogiri (1.
|
69
|
+
nokogiri (1.13.1-x86_64-linux)
|
70
70
|
racc (~> 1.4)
|
71
|
-
oj (3.13.
|
71
|
+
oj (3.13.11)
|
72
72
|
overcommit (0.57.0)
|
73
73
|
childprocess (>= 0.6.3, < 5)
|
74
74
|
iniparse (~> 1.4)
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
protocol-websocket (0.7.5)
|
86
86
|
protocol-http (~> 0.2)
|
87
87
|
protocol-http1 (~> 0.2)
|
88
|
-
racc (1.
|
88
|
+
racc (1.6.0)
|
89
89
|
rainbow (3.0.0)
|
90
90
|
rake (13.0.3)
|
91
91
|
regexp_parser (2.2.0)
|
data/README.md
CHANGED
@@ -6,9 +6,9 @@ module Grumlin
|
|
6
6
|
|
7
7
|
# TODO: add other steps
|
8
8
|
SUPPORTED_STEPS = %i[E V addE addV aggregate and as both bothE by choose coalesce count dedup drop elementMap emit
|
9
|
-
fold from group groupCount has hasId hasLabel hasNot id in inE inV is label limit
|
10
|
-
out outE path project property range repeat sack select sideEffect
|
11
|
-
union until valueMap values where with].freeze
|
9
|
+
fold from group groupCount has hasId hasLabel hasNot id identity in inE inV is label limit
|
10
|
+
map not or order out outE path project properties property range repeat sack select sideEffect
|
11
|
+
skip sum tail to unfold union until valueMap values where with].freeze
|
12
12
|
|
13
13
|
def initialize(name, *args, configuration_steps: [], previous_step: nil, **params)
|
14
14
|
@name = name
|
@@ -41,7 +41,9 @@ module Grumlin
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def args
|
44
|
-
[*@args
|
44
|
+
[*@args].tap do |args|
|
45
|
+
args << @params if @params.any?
|
46
|
+
end
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
data/lib/grumlin/bytecode.rb
CHANGED
@@ -14,7 +14,6 @@ module Grumlin
|
|
14
14
|
|
15
15
|
def initialize(step, no_return: false)
|
16
16
|
super(type: "Bytecode")
|
17
|
-
|
18
17
|
@step = step
|
19
18
|
@no_return = no_return
|
20
19
|
end
|
@@ -49,7 +48,7 @@ module Grumlin
|
|
49
48
|
return arg.public_send(serialization_method) if arg.respond_to?(serialization_method)
|
50
49
|
return arg unless arg.is_a?(AnonymousStep)
|
51
50
|
|
52
|
-
arg.args.
|
51
|
+
arg.args.each.with_object([arg.name.to_s]) do |a, res|
|
53
52
|
res << if a.respond_to?(:bytecode)
|
54
53
|
a.bytecode.public_send(serialization_method)
|
55
54
|
else
|
@@ -4,8 +4,8 @@ module Grumlin
|
|
4
4
|
module Expressions
|
5
5
|
module U
|
6
6
|
# TODO: add other start steps
|
7
|
-
SUPPORTED_STEPS = %i[V addV coalesce constant count drop fold has hasLabel hasNot id in inE inV is label
|
8
|
-
outV project repeat select timeLimit unfold valueMap values].freeze
|
7
|
+
SUPPORTED_STEPS = %i[V addV coalesce constant count drop fold has hasLabel hasNot id identity in inE inV is label
|
8
|
+
out outE outV project repeat select timeLimit unfold valueMap values].freeze
|
9
9
|
|
10
10
|
class << self
|
11
11
|
SUPPORTED_STEPS.each do |step|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Grumlin
|
4
|
+
class Property
|
5
|
+
attr_reader :key, :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@key = value[:key]
|
9
|
+
@value = Typing.cast(value[:value])
|
10
|
+
end
|
11
|
+
|
12
|
+
def inspect
|
13
|
+
"p[#{key}->#{value}]"
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
inspect
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(other)
|
21
|
+
self.class == other.class && @key == other.key && @value == other.value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/grumlin/typing.rb
CHANGED
@@ -3,16 +3,17 @@
|
|
3
3
|
module Grumlin
|
4
4
|
module Typing
|
5
5
|
TYPES = {
|
6
|
-
"g:List" => ->(value) { value
|
7
|
-
"g:Set" => ->(value) {
|
6
|
+
"g:List" => ->(value) { cast_list(value) },
|
7
|
+
"g:Set" => ->(value) { cast_list(value).to_set },
|
8
8
|
"g:Map" => ->(value) { cast_map(value) },
|
9
9
|
"g:Vertex" => ->(value) { cast_entity(Grumlin::Vertex, value) },
|
10
10
|
"g:Edge" => ->(value) { cast_entity(Grumlin::Edge, value) },
|
11
11
|
"g:Path" => ->(value) { cast_entity(Grumlin::Path, value) },
|
12
|
+
"g:Traverser" => ->(value) { cast_entity(Traverser, value) },
|
13
|
+
"g:Property" => ->(value) { cast_entity(Property, value) },
|
12
14
|
"g:Int64" => ->(value) { cast_int(value) },
|
13
15
|
"g:Int32" => ->(value) { cast_int(value) },
|
14
16
|
"g:Double" => ->(value) { cast_double(value) },
|
15
|
-
"g:Traverser" => ->(value) { cast(value[:value]) }, # TODO: wtf is bulk?
|
16
17
|
"g:Direction" => ->(value) { value },
|
17
18
|
# "g:VertexProperty"=> ->(value) { value }, # TODO: implement me
|
18
19
|
"g:T" => ->(value) { value.to_sym }
|
@@ -73,6 +74,15 @@ module Grumlin
|
|
73
74
|
rescue ArgumentError
|
74
75
|
raise TypeError, "#{value} cannot be casted to Hash"
|
75
76
|
end
|
77
|
+
|
78
|
+
def cast_list(value)
|
79
|
+
value.each_with_object([]) do |item, result|
|
80
|
+
casted_value = cast(item)
|
81
|
+
next (result << casted_value) unless casted_value.instance_of?(Traverser)
|
82
|
+
|
83
|
+
casted_value.bulk.times { result << casted_value.value }
|
84
|
+
end
|
85
|
+
end
|
76
86
|
end
|
77
87
|
end
|
78
88
|
end
|
data/lib/grumlin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-pool
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/grumlin/expressions/u.rb
|
112
112
|
- lib/grumlin/expressions/with_options.rb
|
113
113
|
- lib/grumlin/path.rb
|
114
|
+
- lib/grumlin/property.rb
|
114
115
|
- lib/grumlin/repository.rb
|
115
116
|
- lib/grumlin/request_dispatcher.rb
|
116
117
|
- lib/grumlin/shortcut_proxy.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- lib/grumlin/test/rspec/gremlin_context.rb
|
124
125
|
- lib/grumlin/transport.rb
|
125
126
|
- lib/grumlin/traversal.rb
|
127
|
+
- lib/grumlin/traverser.rb
|
126
128
|
- lib/grumlin/typed_value.rb
|
127
129
|
- lib/grumlin/typing.rb
|
128
130
|
- lib/grumlin/version.rb
|