isomorfeus-transport 23.6.0.rc3 → 23.6.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c4133dbd6db3a7ec68fd33734724492990159ac0930baec3de275f5690a3ef
|
4
|
+
data.tar.gz: 4a7136266a220ebf889e0b51ad201adc5df1e5fbf79322ccc10281e3752cb7bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a9de85ee25d6581ddc4380f5305288e07dbb7db7df37ff1d0c85ea15826cbb6b7bde3ace5037cd44893d94b76258c60b7491aacdd24b9c1a09cd4a34dabbbd6
|
7
|
+
data.tar.gz: e05b34fd3c4a762b5287801f946a5fcff29360a7d8b130c88fdba3ac0752d7396c8f771786bcab27ad39f021d83307ea70a5301a5ae24f285b4588def56f66d9
|
@@ -1,77 +1,77 @@
|
|
1
|
-
class Hash
|
2
|
-
def deep_freeze
|
3
|
-
each_value do |value|
|
4
|
-
value.deep_freeze if value.is_a?(Hash)
|
5
|
-
end
|
6
|
-
self
|
7
|
-
end
|
8
|
-
|
9
|
-
if RUBY_ENGINE == 'opal'
|
10
|
-
def self.recursive_new(obj)
|
11
|
-
%x{
|
12
|
-
var key, val;
|
13
|
-
for (var key in obj) {
|
14
|
-
val = obj[key];
|
15
|
-
if (val !== null && typeof val === "object" && !val.$$is_array && !val.$$is_hash && !Array.isArray(val)) {
|
16
|
-
obj[key] = #{Hash.recursive_new(`val`)};
|
17
|
-
}
|
18
|
-
}
|
19
|
-
return Opal.hash(obj);
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# originally taken from: https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/object/deep_dup.rb
|
25
|
-
# Returns a deep copy of hash.
|
26
|
-
#
|
27
|
-
# hash = { a: { b: 'b' } }
|
28
|
-
# dup = hash.deep_dup
|
29
|
-
# dup[:a][:c] = 'c'
|
30
|
-
#
|
31
|
-
# hash[:a][:c] # => nil
|
32
|
-
# dup[:a][:c] # => "c"
|
33
|
-
def deep_dup
|
34
|
-
hash = dup
|
35
|
-
each_pair do |key, value|
|
36
|
-
if ::String === key || ::Symbol === key
|
37
|
-
hash[key] = value.deep_dup
|
38
|
-
else
|
39
|
-
hash.delete(key)
|
40
|
-
hash[key.deep_dup] = value.deep_dup
|
41
|
-
end
|
42
|
-
end
|
43
|
-
hash
|
44
|
-
end
|
45
|
-
|
46
|
-
# originally taken from: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
|
47
|
-
# Returns a new hash with +self+ and +other_hash+ merged recursively.
|
48
|
-
#
|
49
|
-
# h1 = { a: true, b: { c: [1, 2, 3] } }
|
50
|
-
# h2 = { a: false, b: { x: [3, 4, 5] } }
|
51
|
-
#
|
52
|
-
# h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
|
53
|
-
#
|
54
|
-
# Like with Hash#merge in the standard library, a block can be provided
|
55
|
-
# to merge values:
|
56
|
-
#
|
57
|
-
# h1 = { a: 100, b: 200, c: { c1: 100 } }
|
58
|
-
# h2 = { b: 250, c: { c1: 200 } }
|
59
|
-
# h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
|
60
|
-
# # => { a: 100, b: 450, c: { c1: 300 } }
|
61
|
-
def deep_merge(other_hash, &block)
|
62
|
-
dup.deep_merge!(other_hash, &block)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Same as +deep_merge+, but modifies +self+.
|
66
|
-
def deep_merge!(other_hash, &block)
|
67
|
-
merge!(other_hash) do |key, this_val, other_val|
|
68
|
-
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
69
|
-
this_val.deep_merge(other_val, &block)
|
70
|
-
elsif block_given?
|
71
|
-
block.call(key, this_val, other_val)
|
72
|
-
else
|
73
|
-
other_val
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
1
|
+
class Hash
|
2
|
+
def deep_freeze
|
3
|
+
each_value do |value|
|
4
|
+
value.deep_freeze if value.is_a?(Hash)
|
5
|
+
end
|
6
|
+
self
|
7
|
+
end
|
8
|
+
|
9
|
+
if RUBY_ENGINE == 'opal'
|
10
|
+
def self.recursive_new(obj)
|
11
|
+
%x{
|
12
|
+
var key, val;
|
13
|
+
for (var key in obj) {
|
14
|
+
val = obj[key];
|
15
|
+
if (val !== null && typeof val === "object" && !val.$$is_array && !val.$$is_hash && !Array.isArray(val)) {
|
16
|
+
obj[key] = #{Hash.recursive_new(`val`)};
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return Opal.hash(obj);
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# originally taken from: https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/object/deep_dup.rb
|
25
|
+
# Returns a deep copy of hash.
|
26
|
+
#
|
27
|
+
# hash = { a: { b: 'b' } }
|
28
|
+
# dup = hash.deep_dup
|
29
|
+
# dup[:a][:c] = 'c'
|
30
|
+
#
|
31
|
+
# hash[:a][:c] # => nil
|
32
|
+
# dup[:a][:c] # => "c"
|
33
|
+
def deep_dup
|
34
|
+
hash = dup
|
35
|
+
each_pair do |key, value|
|
36
|
+
if ::String === key || ::Symbol === key
|
37
|
+
hash[key] = value.deep_dup
|
38
|
+
else
|
39
|
+
hash.delete(key)
|
40
|
+
hash[key.deep_dup] = value.deep_dup
|
41
|
+
end
|
42
|
+
end
|
43
|
+
hash
|
44
|
+
end
|
45
|
+
|
46
|
+
# originally taken from: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
|
47
|
+
# Returns a new hash with +self+ and +other_hash+ merged recursively.
|
48
|
+
#
|
49
|
+
# h1 = { a: true, b: { c: [1, 2, 3] } }
|
50
|
+
# h2 = { a: false, b: { x: [3, 4, 5] } }
|
51
|
+
#
|
52
|
+
# h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
|
53
|
+
#
|
54
|
+
# Like with Hash#merge in the standard library, a block can be provided
|
55
|
+
# to merge values:
|
56
|
+
#
|
57
|
+
# h1 = { a: 100, b: 200, c: { c1: 100 } }
|
58
|
+
# h2 = { b: 250, c: { c1: 200 } }
|
59
|
+
# h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
|
60
|
+
# # => { a: 100, b: 450, c: { c1: 300 } }
|
61
|
+
def deep_merge(other_hash, &block)
|
62
|
+
dup.deep_merge!(other_hash, &block)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Same as +deep_merge+, but modifies +self+.
|
66
|
+
def deep_merge!(other_hash, &block)
|
67
|
+
merge!(other_hash) do |key, this_val, other_val|
|
68
|
+
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
69
|
+
this_val.deep_merge(other_val, &block)
|
70
|
+
elsif block_given?
|
71
|
+
block.call(key, this_val, other_val)
|
72
|
+
else
|
73
|
+
other_val
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -1,24 +1,12 @@
|
|
1
1
|
module Kernel
|
2
|
-
def promise(&block)
|
3
|
-
p = Promise.new
|
4
|
-
|
2
|
+
def promise(p = Promise.new, &block)
|
5
3
|
begin
|
6
4
|
result = block.call
|
7
5
|
return p.resolve(result) if result
|
6
|
+
after(10) { promise(p, &block) }
|
8
7
|
rescue => e
|
9
8
|
return p.reject(e)
|
10
9
|
end
|
11
|
-
|
12
|
-
pr = proc do
|
13
|
-
begin
|
14
|
-
res = block.call
|
15
|
-
res ? p.resolve(res) : after(10, &pr)
|
16
|
-
rescue => e
|
17
|
-
p.reject(e)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
after(10, &pr)
|
22
10
|
p
|
23
11
|
end
|
24
12
|
|
@@ -33,13 +21,6 @@ module Kernel
|
|
33
21
|
def after(time_ms, &block)
|
34
22
|
`setTimeout(#{block.to_n}, time_ms)`
|
35
23
|
end
|
36
|
-
|
37
|
-
# TODO remove before release
|
38
|
-
%x{
|
39
|
-
Opal.s = function() {
|
40
|
-
return Opal.Isomorfeus.store.$get_state().$to_n();
|
41
|
-
}
|
42
|
-
}
|
43
24
|
else
|
44
25
|
def on_browser?; false; end
|
45
26
|
def on_desktop?; false; end
|
@@ -22,7 +22,7 @@ module Isomorfeus
|
|
22
22
|
response_agent.error = { error: { handler_class_name => 'No such handler!'}}
|
23
23
|
end
|
24
24
|
rescue Exception => e
|
25
|
-
response_agent.error = {
|
25
|
+
response_agent.error = { error: { handler_class_name => "#{e.message}\n#{e.backtrace.join("\n")}" }}
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -34,20 +34,22 @@ module Isomorfeus
|
|
34
34
|
end
|
35
35
|
Thread.current[:isomorfeus_user] = user
|
36
36
|
request_hash = Oj.load(data, mode: :strict)
|
37
|
-
unless request_hash.key?(
|
37
|
+
unless request_hash.key?("iso_ping")
|
38
38
|
handler_instance_cache = {}
|
39
39
|
response_agent_array = []
|
40
40
|
Thread.current[:isomorfeus_pub_sub_client] = client
|
41
41
|
process_request(request_hash, handler_instance_cache, response_agent_array)
|
42
|
-
handler_instance_cache.each_value do |handler|
|
43
|
-
|
44
|
-
end
|
42
|
+
# handler_instance_cache.each_value do |handler|
|
43
|
+
# handler.resolve if handler.resolving?
|
44
|
+
# end
|
45
45
|
result = {}
|
46
46
|
response_agent_array.each do |response_agent|
|
47
47
|
result.deep_merge!(response_agent.result)
|
48
48
|
end
|
49
49
|
client.write Oj.dump(result, mode: :strict) unless result.empty?
|
50
50
|
end
|
51
|
+
rescue => e
|
52
|
+
STDERR.puts "#{e.message}#{e.backtrace&.join("\n")}"
|
51
53
|
ensure
|
52
54
|
Thread.current[:isomorfeus_user] = nil
|
53
55
|
Thread.current[:isomorfeus_pub_sub_client] = nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 23.6.0.
|
4
|
+
version: 23.6.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -190,14 +190,14 @@ dependencies:
|
|
190
190
|
requirements:
|
191
191
|
- - '='
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 23.6.0.
|
193
|
+
version: 23.6.0.rc5
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - '='
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 23.6.0.
|
200
|
+
version: 23.6.0.rc5
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: rake
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|