anycable-core 1.5.0 → 1.5.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: 51822ff8e8b07d8967dfaeed99b65c45e7cf8a2d3868f94f09dd81a26d934bd8
4
- data.tar.gz: d782bdda587a181716bd0d6dc0aa19d0a6c24b0236b0cb3aa3354100364839a8
3
+ metadata.gz: 471f65d8e5181aad39ec9b4ed537b6b7721ce39aef220a450089106cdad55944
4
+ data.tar.gz: fd511a291e8931d324fed2c9e3847de18e4815fc2ffecd86d5736f19b8b73855
5
5
  SHA512:
6
- metadata.gz: f2f48cae19656f6b3360f8173a76d91ec2e6bf87434c7b8ccc00e3fae5dd3f89542f8d545348944b2eee90068833cc74fbf33be929885eb0427c019f9a0c9ba1
7
- data.tar.gz: 00a17dedd9dd6f572aca18fe08f77d5d234c5b5636497f2b925b5dafbb230c4b918d4a4fa5a020d1adb612d9c11528554579e9ec81589b336081792249029a3d
6
+ metadata.gz: 9fac18169b44904b6cef45881a95d3e0e0e99e8410dc244847a3a72511390d6f09c90ce4702201eed440e5d1c7403032dee2bee652878b8398e6351081e11ab2
7
+ data.tar.gz: 5861b7974c45f5c84e8a29a95fd9684e7b660bb7ce14596289a67b3b9784c777001179f1adfff85f9105ad4b93c7cce26ef04c0b310962cd904a4903d927a465
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.5.2 (2024-12-27)
6
+
7
+ - Update google-protobuf to version 4 (support Ruby 3.4). ([@le0pard][])
8
+
9
+ ## 1.5.1 (2024-06-14) 🇪🇺 ⚽️
10
+
11
+ - Fixed compatibility with Rack 3.1 ([@earlopain][])
12
+
5
13
  ## 1.5.0 (2024-04-01)
6
14
 
7
15
  - Fixed gRPC keepalive settings to align with the Go server client. ([@palkan][])
@@ -211,3 +219,5 @@ See [Changelog](https://github.com/anycable/anycable/blob/0-6-stable/CHANGELOG.m
211
219
  [@smasry]: https://github.com/smasry
212
220
  [@Envek]: https://github.com/Envek
213
221
  [@cylon-v]: https://github.com/cylon-v
222
+ [@earlopain]: https://github.com/earlopain
223
+ [@le0pard]: https://github.com/le0pard
@@ -5,19 +5,10 @@
5
5
 
6
6
  require 'google/protobuf'
7
7
 
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_message "grpc.health.v1.HealthCheckRequest" do
10
- optional :service, :string, 1
11
- end
12
- add_message "grpc.health.v1.HealthCheckResponse" do
13
- optional :status, :enum, 1, "grpc.health.v1.HealthCheckResponse.ServingStatus"
14
- end
15
- add_enum "grpc.health.v1.HealthCheckResponse.ServingStatus" do
16
- value :UNKNOWN, 0
17
- value :SERVING, 1
18
- value :NOT_SERVING, 2
19
- end
20
- end
8
+ descriptor_data = "\n\x1bgrpc/health/v1/health.proto\x12\x0egrpc.health.v1\"%\n\x12HealthCheckRequest\x12\x0f\n\x07service\x18\x01 \x01(\t\"\xa9\x01\n\x13HealthCheckResponse\x12\x41\n\x06status\x18\x01 \x01(\x0e\x32\x31.grpc.health.v1.HealthCheckResponse.ServingStatus\"O\n\rServingStatus\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07SERVING\x10\x01\x12\x0f\n\x0bNOT_SERVING\x10\x02\x12\x13\n\x0fSERVICE_UNKNOWN\x10\x03\x32\xae\x01\n\x06Health\x12P\n\x05\x43heck\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.health.v1.HealthCheckResponse\x12R\n\x05Watch\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.health.v1.HealthCheckResponse0\x01\x42\x61\n\x11io.grpc.health.v1B\x0bHealthProtoP\x01Z,google.golang.org/grpc/health/grpc_health_v1\xaa\x02\x0eGrpc.Health.V1b\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
21
12
 
22
13
  module Grpc
23
14
  module Health
@@ -27,8 +27,9 @@ module AnyCable
27
27
  return [404, {}, ["Not found"]] unless AnyCable.rpc_handler.supported?(rpc_command)
28
28
 
29
29
  # read request body and it's empty, return 422
30
- request_body = env["rack.input"].read
31
- return [422, {}, ["Empty request body"]] if request_body.empty?
30
+ # rack.input is optional starting in Rack 3.1
31
+ request_body = env["rack.input"]&.read
32
+ return [422, {}, ["Empty request body"]] if request_body.nil? || request_body.empty?
32
33
 
33
34
  payload =
34
35
  case rpc_command
data/lib/anycable/jwt.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "base64"
3
4
  require "json"
4
5
  require "openssl"
5
6
 
@@ -5,61 +5,10 @@
5
5
 
6
6
  require "google/protobuf"
7
7
 
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_file("rpc.proto", syntax: :proto3) do
10
- add_message "anycable.Env" do
11
- optional :url, :string, 1
12
- map :headers, :string, :string, 2
13
- map :cstate, :string, :string, 3
14
- map :istate, :string, :string, 4
15
- end
16
- add_message "anycable.EnvResponse" do
17
- map :cstate, :string, :string, 1
18
- map :istate, :string, :string, 2
19
- end
20
- add_message "anycable.ConnectionRequest" do
21
- optional :env, :message, 3, "anycable.Env"
22
- end
23
- add_message "anycable.ConnectionResponse" do
24
- optional :status, :enum, 1, "anycable.Status"
25
- optional :identifiers, :string, 2
26
- repeated :transmissions, :string, 3
27
- optional :error_msg, :string, 4
28
- optional :env, :message, 5, "anycable.EnvResponse"
29
- end
30
- add_message "anycable.CommandMessage" do
31
- optional :command, :string, 1
32
- optional :identifier, :string, 2
33
- optional :connection_identifiers, :string, 3
34
- optional :data, :string, 4
35
- optional :env, :message, 5, "anycable.Env"
36
- end
37
- add_message "anycable.CommandResponse" do
38
- optional :status, :enum, 1, "anycable.Status"
39
- optional :disconnect, :bool, 2
40
- optional :stop_streams, :bool, 3
41
- repeated :streams, :string, 4
42
- repeated :transmissions, :string, 5
43
- optional :error_msg, :string, 6
44
- optional :env, :message, 7, "anycable.EnvResponse"
45
- repeated :stopped_streams, :string, 8
46
- end
47
- add_message "anycable.DisconnectRequest" do
48
- optional :identifiers, :string, 1
49
- repeated :subscriptions, :string, 2
50
- optional :env, :message, 5, "anycable.Env"
51
- end
52
- add_message "anycable.DisconnectResponse" do
53
- optional :status, :enum, 1, "anycable.Status"
54
- optional :error_msg, :string, 2
55
- end
56
- add_enum "anycable.Status" do
57
- value :ERROR, 0
58
- value :SUCCESS, 1
59
- value :FAILURE, 2
60
- end
61
- end
62
- end
8
+ descriptor_data = "\n\trpc.proto\x12\x08\x61nycable\"\xa3\x02\n\x03\x45nv\x12\x0b\n\x03url\x18\x01 \x01(\t\x12+\n\x07headers\x18\x02 \x03(\x0b\x32\x1a.anycable.Env.HeadersEntry\x12)\n\x06\x63state\x18\x03 \x03(\x0b\x32\x19.anycable.Env.CstateEntry\x12)\n\x06istate\x18\x04 \x03(\x0b\x32\x19.anycable.Env.IstateEntry\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0b\x43stateEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bIstateEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xd1\x01\n\x0b\x45nvResponse\x12\x31\n\x06\x63state\x18\x01 \x03(\x0b\x32!.anycable.EnvResponse.CstateEntry\x12\x31\n\x06istate\x18\x02 \x03(\x0b\x32!.anycable.EnvResponse.IstateEntry\x1a-\n\x0b\x43stateEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bIstateEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"/\n\x11\x43onnectionRequest\x12\x1a\n\x03\x65nv\x18\x03 \x01(\x0b\x32\r.anycable.Env\"\x99\x01\n\x12\x43onnectionResponse\x12 \n\x06status\x18\x01 \x01(\x0e\x32\x10.anycable.Status\x12\x13\n\x0bidentifiers\x18\x02 \x01(\t\x12\x15\n\rtransmissions\x18\x03 \x03(\t\x12\x11\n\terror_msg\x18\x04 \x01(\t\x12\"\n\x03\x65nv\x18\x05 \x01(\x0b\x32\x15.anycable.EnvResponse\"\x7f\n\x0e\x43ommandMessage\x12\x0f\n\x07\x63ommand\x18\x01 \x01(\t\x12\x12\n\nidentifier\x18\x02 \x01(\t\x12\x1e\n\x16\x63onnection_identifiers\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x1a\n\x03\x65nv\x18\x05 \x01(\x0b\x32\r.anycable.Env\"\xd5\x01\n\x0f\x43ommandResponse\x12 \n\x06status\x18\x01 \x01(\x0e\x32\x10.anycable.Status\x12\x12\n\ndisconnect\x18\x02 \x01(\x08\x12\x14\n\x0cstop_streams\x18\x03 \x01(\x08\x12\x0f\n\x07streams\x18\x04 \x03(\t\x12\x15\n\rtransmissions\x18\x05 \x03(\t\x12\x11\n\terror_msg\x18\x06 \x01(\t\x12\"\n\x03\x65nv\x18\x07 \x01(\x0b\x32\x15.anycable.EnvResponse\x12\x17\n\x0fstopped_streams\x18\x08 \x03(\t\"[\n\x11\x44isconnectRequest\x12\x13\n\x0bidentifiers\x18\x01 \x01(\t\x12\x15\n\rsubscriptions\x18\x02 \x03(\t\x12\x1a\n\x03\x65nv\x18\x05 \x01(\x0b\x32\r.anycable.Env\"I\n\x12\x44isconnectResponse\x12 \n\x06status\x18\x01 \x01(\x0e\x32\x10.anycable.Status\x12\x11\n\terror_msg\x18\x02 \x01(\t*-\n\x06Status\x12\t\n\x05\x45RROR\x10\x00\x12\x0b\n\x07SUCCESS\x10\x01\x12\x0b\n\x07\x46\x41ILURE\x10\x02\x32\xda\x01\n\x03RPC\x12\x46\n\x07\x43onnect\x12\x1b.anycable.ConnectionRequest\x1a\x1c.anycable.ConnectionResponse\"\x00\x12@\n\x07\x43ommand\x12\x18.anycable.CommandMessage\x1a\x19.anycable.CommandResponse\"\x00\x12I\n\nDisconnect\x12\x1b.anycable.DisconnectRequest\x1a\x1c.anycable.DisconnectResponse\"\x00\x62\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
63
12
 
64
13
  module AnyCable
65
14
  Env = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anycable.Env").msgclass
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "stringio"
4
+
3
5
  module AnyCable
4
6
  WHISPER_KEY = "$w"
5
7
 
@@ -154,22 +156,30 @@ module AnyCable
154
156
  # (not all of them though, just those enough for Action Cable to work)
155
157
  # See https://rubydoc.info/github/rack/rack/master/file/SPEC
156
158
  # and https://github.com/rack/rack/blob/master/lib/rack/lint.rb
157
- {
159
+ env = {
158
160
  "REQUEST_METHOD" => "GET",
159
161
  "SCRIPT_NAME" => "",
160
162
  "PATH_INFO" => "/",
161
163
  "QUERY_STRING" => "",
162
164
  "SERVER_NAME" => "",
163
165
  "SERVER_PORT" => "80",
166
+ "SERVER_PROTOCOL" => "HTTP/1.1",
164
167
  "rack.url_scheme" => "http",
165
168
  "rack.input" => StringIO.new("", "r").tap { |io| io.set_encoding(Encoding::ASCII_8BIT) },
166
- "rack.version" => ::Rack::VERSION,
167
169
  "rack.errors" => StringIO.new("").tap { |io| io.set_encoding(Encoding::ASCII_8BIT) },
168
170
  "rack.multithread" => true,
169
171
  "rack.multiprocess" => false,
170
172
  "rack.run_once" => false,
171
173
  "rack.hijack?" => false
172
174
  }
175
+
176
+ # Rack 3.1 removes `Rack::VERSION`. rack.version is optional (deprecated) since Rack 3.0
177
+ if ::Rack::RELEASE < "3.0"
178
+ rversion = ::Rack::VERSION
179
+ # @type var rversion : String
180
+ env["rack.version"] = rversion
181
+ end
182
+ env
173
183
  end
174
184
 
175
185
  def build_headers(headers)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnyCable
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.2"
5
5
  end
@@ -4,8 +4,8 @@ module AnyCable
4
4
  def running?: () -> bool
5
5
  end
6
6
 
7
- SUCCESS_RESPONSE: Array[Integer | String]
8
- FAILURE_RESPONSE: Array[Integer | String]
7
+ SUCCESS_RESPONSE: [Integer, String]
8
+ FAILURE_RESPONSE: [Integer, String]
9
9
 
10
10
  attr_reader server: _Runnable
11
11
  attr_reader port: Integer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-01 00:00:00.000000000 Z
11
+ date: 2024-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -24,20 +24,48 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: base64
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: google-protobuf
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '3.25'
47
+ version: '4'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '3.25'
54
+ version: '4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: stringio
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: redis
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +128,28 @@ dependencies:
100
128
  requirements:
101
129
  - - "~>"
102
130
  - !ruby/object:Gem::Version
103
- version: '2.0'
131
+ version: '3.0'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
- version: '2.0'
138
+ version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: rspec
113
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +212,14 @@ dependencies:
170
212
  requirements:
171
213
  - - ">="
172
214
  - !ruby/object:Gem::Version
173
- version: '0'
215
+ version: 1.9.1
174
216
  type: :development
175
217
  prerelease: false
176
218
  version_requirements: !ruby/object:Gem::Requirement
177
219
  requirements:
178
220
  - - ">="
179
221
  - !ruby/object:Gem::Version
180
- version: '0'
222
+ version: 1.9.1
181
223
  description: AnyCable core RPC implementation not depenending on a particular server
182
224
  type (e.g., gRPC or whatever)
183
225
  email:
@@ -277,7 +319,7 @@ metadata:
277
319
  homepage_uri: https://anycable.io/
278
320
  source_code_uri: http://github.com/anycable/anycable
279
321
  funding_uri: https://github.com/sponsors/anycable
280
- post_install_message:
322
+ post_install_message:
281
323
  rdoc_options: []
282
324
  require_paths:
283
325
  - lib
@@ -285,15 +327,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
285
327
  requirements:
286
328
  - - ">="
287
329
  - !ruby/object:Gem::Version
288
- version: 2.7.0
330
+ version: '2.7'
289
331
  required_rubygems_version: !ruby/object:Gem::Requirement
290
332
  requirements:
291
333
  - - ">="
292
334
  - !ruby/object:Gem::Version
293
335
  version: '0'
294
336
  requirements: []
295
- rubygems_version: 3.4.20
296
- signing_key:
337
+ rubygems_version: 3.4.19
338
+ signing_key:
297
339
  specification_version: 4
298
340
  summary: AnyCable core RPC implementation
299
341
  test_files: []