grumlin 0.14.1 → 0.14.2

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: 4889d5002539dc86922c58967a95a9d65da0e93b0b953626f17b59e1296f24bc
4
- data.tar.gz: d2f9cf32f1d2d41ba65ac610c08167333e13eb26a98da6569b4b05c41c78aa6a
3
+ metadata.gz: 2d54992de5df5f10f004557bc7a7d86ec5558c104663bf36904838e843d38b4d
4
+ data.tar.gz: e2e5cca5ad4cc034b991760db13c9a41d780609895ea38e236ef384bfa9df8f4
5
5
  SHA512:
6
- metadata.gz: 72503ca022ceb7f38a9b8444cd711ef5aed9a0c3b37121c93009b9cbf2e1000d318e9e720c8d6ce4c1882a09d0ce24a823df7e06b15e359c0d46388baf06fc8d
7
- data.tar.gz: 073aaa56b7a15a0cb6cc149629f744c82892a902f68cc7e7c2df052cd4d0c053942cdb9a2625310bc7d6afc24433a97ba753bc4ea8bd54f8ddb681cba3075dbc
6
+ metadata.gz: 9a1f23141609f072193fa4a624ae63263200daebb72b4f2c0759e738325409546365f962117d36dbb8baf1c6df5ebd9a60f5c53453f7827cfd8cc90d450afa0e
7
+ data.tar.gz: c6bd3b5f1f0b02173931f8189c0dca7fdcb5c11bfc6c4f8fdb34065a8d90a55ecb4118cf50f080c3c490ed1e2afda9035716fafc4679c6f606ad74ccc955d5f3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.14.2] - 2021-12-12
2
+
3
+ - Better exceptions
4
+ - Add `choose` step
5
+ - Add `__.hasNot`, `__.is`, `__.select`
6
+
1
7
  ## [0.14.0] - 2021-12-07
2
8
 
3
9
  - Add initial support for [configuration steps](https://tinkerpop.apache.org/docs/current/reference/#configuration-steps)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grumlin (0.14.1)
4
+ grumlin (0.14.2)
5
5
  async-pool (~> 0.3)
6
6
  async-websocket (~> 0.19)
7
7
  oj (~> 3.12)
@@ -72,8 +72,8 @@ GEM
72
72
  overcommit (0.57.0)
73
73
  childprocess (>= 0.6.3, < 5)
74
74
  iniparse (~> 1.4)
75
- parallel (1.20.1)
76
- parser (3.0.1.1)
75
+ parallel (1.21.0)
76
+ parser (3.0.3.2)
77
77
  ast (~> 2.4.1)
78
78
  protocol-hpack (1.4.2)
79
79
  protocol-http (0.22.5)
@@ -88,7 +88,7 @@ GEM
88
88
  racc (1.5.2)
89
89
  rainbow (3.0.0)
90
90
  rake (13.0.3)
91
- regexp_parser (2.1.1)
91
+ regexp_parser (2.2.0)
92
92
  reverse_markdown (2.0.0)
93
93
  nokogiri
94
94
  rexml (3.2.5)
@@ -109,23 +109,22 @@ GEM
109
109
  diff-lcs (>= 1.2.0, < 2.0)
110
110
  rspec-support (~> 3.10.0)
111
111
  rspec-support (3.10.2)
112
- rubocop (1.16.1)
112
+ rubocop (1.23.0)
113
113
  parallel (~> 1.10)
114
114
  parser (>= 3.0.0.0)
115
115
  rainbow (>= 2.2.2, < 4.0)
116
116
  regexp_parser (>= 1.8, < 3.0)
117
117
  rexml
118
- rubocop-ast (>= 1.7.0, < 2.0)
118
+ rubocop-ast (>= 1.12.0, < 2.0)
119
119
  ruby-progressbar (~> 1.7)
120
120
  unicode-display_width (>= 1.4.0, < 3.0)
121
- rubocop-ast (1.7.0)
121
+ rubocop-ast (1.14.0)
122
122
  parser (>= 3.0.1.1)
123
- rubocop-performance (1.11.3)
123
+ rubocop-performance (1.12.0)
124
124
  rubocop (>= 1.7.0, < 2.0)
125
125
  rubocop-ast (>= 0.4.0)
126
- rubocop-rspec (2.3.0)
127
- rubocop (~> 1.0)
128
- rubocop-ast (>= 1.1.0)
126
+ rubocop-rspec (2.6.0)
127
+ rubocop (~> 1.19)
129
128
  ruby-progressbar (1.11.0)
130
129
  simplecov (0.21.2)
131
130
  docile (~> 1.1)
@@ -153,7 +152,7 @@ GEM
153
152
  timers (4.3.3)
154
153
  tzinfo (2.0.4)
155
154
  concurrent-ruby (~> 1.0)
156
- unicode-display_width (2.0.0)
155
+ unicode-display_width (2.1.0)
157
156
  yard (0.9.26)
158
157
  zeitwerk (2.4.2)
159
158
 
data/README.md CHANGED
@@ -241,7 +241,8 @@ config.include_context(Grumlin::Test::RSpec::DBCleanerContext) # Cleans the data
241
241
  ...
242
242
  ```
243
243
 
244
- It is highly recommended to use `Grumlin::Sugar` and not trying to use lower level APIs as they are subject to change.
244
+ It is highly recommended to use `Grumlin::Sugar` or `Grumlin::Repository` and not trying to use lower level APIs
245
+ as they are subject to change.
245
246
 
246
247
  ## Development
247
248
 
data/grumlin.gemspec CHANGED
@@ -31,4 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "async-websocket", "~> 0.19"
32
32
  spec.add_dependency "oj", "~> 3.12"
33
33
  spec.add_dependency "zeitwerk", "~> 2.4"
34
+ spec.metadata = {
35
+ "rubygems_mfa_required" => "true"
36
+ }
34
37
  end
@@ -5,9 +5,9 @@ module Grumlin
5
5
  attr_reader :name, :previous_step, :configuration_steps
6
6
 
7
7
  # TODO: add other steps
8
- SUPPORTED_STEPS = %i[E V addE addV and as both bothE by coalesce count dedup drop elementMap emit fold from group
9
- groupCount has hasId hasLabel hasNot id in inE inV is label limit not or order out outE path
10
- project property range repeat select sideEffect skip tail to unfold union until valueMap
8
+ SUPPORTED_STEPS = %i[E V addE addV and as both bothE by choose coalesce count dedup drop elementMap emit fold from
9
+ group groupCount has hasId hasLabel hasNot id in inE inV is label limit not or order out outE
10
+ path project property range repeat select sideEffect skip tail to unfold union until valueMap
11
11
  values where with].freeze
12
12
 
13
13
  def initialize(name, *args, configuration_steps: [], previous_step: nil, **params)
@@ -32,7 +32,9 @@ module Grumlin
32
32
  bytecode.inspect
33
33
  end
34
34
 
35
- alias to_s inspect
35
+ def to_s
36
+ inspect
37
+ end
36
38
 
37
39
  def bytecode(no_return: false)
38
40
  @bytecode ||= Bytecode.new(self, no_return: no_return)
@@ -25,7 +25,10 @@ module Grumlin
25
25
  end
26
26
  "#{configuration_steps.any? ? configuration_steps : nil}#{to_readable_bytecode}"
27
27
  end
28
- alias to_s inspect
28
+
29
+ def to_s
30
+ inspect
31
+ end
29
32
 
30
33
  def to_readable_bytecode
31
34
  @to_readable_bytecode ||= steps.map { |s| serialize_arg(s, serialization_method: :to_readable_bytecode) }
@@ -51,7 +51,7 @@ module Grumlin
51
51
  end
52
52
 
53
53
  def connect
54
- raise "ClientClosed" if @closed
54
+ raise ClientClosedError if @closed
55
55
 
56
56
  @transport = build_transport
57
57
  response_channel = @transport.connect
@@ -113,10 +113,13 @@ module Grumlin
113
113
  "<#{self.class} url=#{@url} connected=#{connected?}>"
114
114
  end
115
115
 
116
- alias to_s inspect
116
+ def to_s
117
+ inspect
118
+ end
117
119
 
118
120
  private
119
121
 
122
+ # This might be overridden in successors
120
123
  def build_transport
121
124
  Transport.new(@url, parent: @parent, **@client_options)
122
125
  end
data/lib/grumlin/edge.rb CHANGED
@@ -20,6 +20,9 @@ module Grumlin
20
20
  def inspect
21
21
  "e[#{@id}][#{@outV}-#{@label}->#{@inV}]"
22
22
  end
23
- alias to_s inspect
23
+
24
+ def to_s
25
+ inspect
26
+ end
24
27
  end
25
28
  end
@@ -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 count drop fold has hasLabel id in inE inV label out outE outV project repeat
8
- timeLimit unfold valueMap values].freeze
7
+ SUPPORTED_STEPS = %i[V addV count drop fold has hasLabel hasNot id in inE inV is label out outE outV project
8
+ repeat select timeLimit unfold valueMap values].freeze
9
9
 
10
10
  class << self
11
11
  SUPPORTED_STEPS.each do |step|
data/lib/grumlin/path.rb CHANGED
@@ -12,6 +12,9 @@ module Grumlin
12
12
  def inspect
13
13
  "p[#{@objects}]"
14
14
  end
15
- alias to_s inspect
15
+
16
+ def to_s
17
+ inspect
18
+ end
16
19
  end
17
20
  end
@@ -22,14 +22,18 @@ module Grumlin
22
22
  498 => ClientSideError
23
23
  }.freeze
24
24
 
25
- include Console
25
+ class DispatcherError < Grumlin::Error; end
26
+
27
+ class RequestAlreadyAddedError < DispatcherError; end
28
+
29
+ class UnknownRequestError < DispatcherError; end
26
30
 
27
31
  def initialize
28
32
  @requests = {}
29
33
  end
30
34
 
31
35
  def add_request(request)
32
- raise "ERROR" if @requests.key?(request[:requestId])
36
+ raise RequestAlreadyAddedError if @requests.key?(request[:requestId])
33
37
 
34
38
  Async::Channel.new.tap do |channel|
35
39
  @requests[request[:requestId]] = { request: request, result: [], channel: channel }
@@ -40,7 +44,7 @@ module Grumlin
40
44
  # TODO: sometimes response does not include requestID, no idea how to handle it so far.
41
45
  def add_response(response) # rubocop:disable Metrics/AbcSize
42
46
  request_id = response[:requestId]
43
- raise "ERROR" unless ongoing_request?(request_id)
47
+ raise UnknownRequestError unless ongoing_request?(request_id)
44
48
 
45
49
  request = @requests[request_id]
46
50
 
@@ -61,7 +65,7 @@ module Grumlin
61
65
  end
62
66
 
63
67
  def close_request(request_id)
64
- raise "ERROR" unless ongoing_request?(request_id)
68
+ raise UnknownRequestError unless ongoing_request?(request_id)
65
69
 
66
70
  request = @requests.delete(request_id)
67
71
  request[:channel].close
@@ -23,7 +23,7 @@ module Grumlin
23
23
  end
24
24
 
25
25
  def connect
26
- raise "ClientClosed" if @closed
26
+ raise ClientClosedError if @closed
27
27
  raise AlreadyConnectedError if connected?
28
28
 
29
29
  @connection = Async::WebSocket::Client.connect(Async::HTTP::Endpoint.parse(@url), **@client_options)
@@ -14,7 +14,13 @@ module Grumlin
14
14
  @configuration_steps = configuration_steps
15
15
  end
16
16
 
17
- alias inspect to_s
17
+ def inspect
18
+ "#<#{self.class}>"
19
+ end
20
+
21
+ def to_s
22
+ inspect
23
+ end
18
24
 
19
25
  CONFIGURATION_STEPS.each do |step|
20
26
  define_method step do |*args, **params|
@@ -23,7 +23,13 @@ module Grumlin
23
23
  def inspect
24
24
  "<#{type}.#{value}>"
25
25
  end
26
- alias to_s inspect
27
- alias to_readable_bytecode inspect
26
+
27
+ def to_s
28
+ inspect
29
+ end
30
+
31
+ def to_readable_bytecode
32
+ inspect
33
+ end
28
34
  end
29
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Grumlin
4
- VERSION = "0.14.1"
4
+ VERSION = "0.14.2"
5
5
  end
@@ -16,6 +16,9 @@ module Grumlin
16
16
  def inspect
17
17
  "v[#{@id}]"
18
18
  end
19
- alias to_s inspect
19
+
20
+ def to_s
21
+ inspect
22
+ end
20
23
  end
21
24
  end
data/lib/grumlin.rb CHANGED
@@ -43,6 +43,8 @@ module Grumlin
43
43
 
44
44
  class AlreadyConnectedError < ConnectionStatusError; end
45
45
 
46
+ class ClientClosedError < ConnectionStatusError; end
47
+
46
48
  class ProtocolError < Error; end
47
49
 
48
50
  class UnknownResponseStatus < ProtocolError
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.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Sinyavskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-09 00:00:00.000000000 Z
11
+ date: 2021-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-pool
@@ -130,9 +130,7 @@ homepage: https://github.com/zhulik/grumlin
130
130
  licenses:
131
131
  - MIT
132
132
  metadata:
133
- homepage_uri: https://github.com/zhulik/grumlin
134
- source_code_uri: https://github.com/zhulik/grumlin
135
- changelog_uri: https://github.com/zhulik/grumlin/blob/master/CHANGELOG.md
133
+ rubygems_mfa_required: 'true'
136
134
  post_install_message:
137
135
  rdoc_options: []
138
136
  require_paths: