hyper-operation 0.99.6 → 1.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +44 -35
- data/hyper-operation.gemspec +7 -7
- data/lib/hyper-operation.rb +6 -5
- data/lib/hyper-operation/api.rb +2 -2
- data/lib/hyper-operation/boot.rb +3 -2
- data/lib/hyper-operation/engine.rb +2 -2
- data/lib/hyper-operation/exception.rb +2 -2
- data/lib/hyper-operation/filters/acting_user.rb +1 -1
- data/lib/hyper-operation/http.rb +2 -2
- data/lib/hyper-operation/railway.rb +1 -1
- data/lib/hyper-operation/railway/dispatcher.rb +8 -4
- data/lib/hyper-operation/railway/params_wrapper.rb +2 -2
- data/lib/hyper-operation/railway/run.rb +1 -1
- data/lib/hyper-operation/railway/validations.rb +1 -1
- data/lib/hyper-operation/server_op.rb +15 -15
- data/lib/hyper-operation/transport/action_cable.rb +8 -8
- data/lib/hyper-operation/transport/client_drivers.rb +36 -36
- data/lib/hyper-operation/transport/connection.rb +10 -10
- data/lib/hyper-operation/transport/{hyperloop.rb → hyperstack.rb} +13 -13
- data/lib/hyper-operation/transport/{hyperloop_controller.rb → hyperstack_controller.rb} +51 -51
- data/lib/hyper-operation/transport/policy.rb +25 -25
- data/lib/hyper-operation/version.rb +2 -2
- data/lib/sources/{hyperloop → hyperstack}/pusher.js +0 -0
- metadata +15 -18
- data/DOCS-POLICIES.md +0 -582
- data/DOCS.md +0 -869
- data/LICENSE.txt +0 -21
- data/README.md +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 201d77a0fcc5144ec05bc6fc0f7e4f0dd1a5baa4bbe9c78f22c17f977c8b38b6
|
4
|
+
data.tar.gz: eba31a79d7155ca81d3a56a06abb0c2a4f470dc02adc4ad69fcd910801020732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9497a9b1b279a14a5eb3af55f5a7bb5b5f92752c9cf4dc389c95b66574d6e3f4f1a7b83d42d887e401bb09428ae808e9b50e0a9cb3c5ef4a9e2315c6c68fef6
|
7
|
+
data.tar.gz: 51e405dd36ced886f574f2b145a3b5cbd20db7ecd0f7dc6a2e3332749ade328ca0b2cbef762383cc02e2879827759f1eded888e5caa89ad782f5707075d70c24
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
#gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: "master"
|
3
3
|
gem 'hyper-spec', path: '../hyper-spec'
|
4
|
-
gem '
|
5
|
-
gem 'hyper-
|
4
|
+
gem 'hyperstack-config', path: '../hyperstack-config'
|
5
|
+
gem 'hyper-state', path: '../hyper-state'
|
6
6
|
gem 'hyper-component', path: '../hyper-component'
|
7
7
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../hyper-component
|
3
3
|
specs:
|
4
|
-
hyper-component (0.
|
5
|
-
hyper-
|
6
|
-
|
7
|
-
libv8 (~> 6.
|
8
|
-
mini_racer (~> 0.
|
4
|
+
hyper-component (0.1)
|
5
|
+
hyper-state (= 0.1)
|
6
|
+
hyperstack-config (= 0.1)
|
7
|
+
libv8 (~> 6.3.0)
|
8
|
+
mini_racer (~> 0.1.15)
|
9
9
|
opal (>= 0.11.0, < 0.12.0)
|
10
10
|
opal-activesupport (~> 0.3.1)
|
11
11
|
react-rails (>= 2.4.0, < 2.5.0)
|
@@ -13,12 +13,12 @@ PATH
|
|
13
13
|
PATH
|
14
14
|
remote: ../hyper-spec
|
15
15
|
specs:
|
16
|
-
hyper-spec (0.
|
16
|
+
hyper-spec (0.1)
|
17
17
|
capybara
|
18
18
|
chromedriver-helper (= 1.2.0)
|
19
|
-
libv8 (~> 6.
|
19
|
+
libv8 (~> 6.3.0)
|
20
20
|
method_source
|
21
|
-
mini_racer (~> 0.
|
21
|
+
mini_racer (~> 0.1.15)
|
22
22
|
opal (>= 0.11.0, < 0.12.0)
|
23
23
|
parser (>= 2.3.3.1)
|
24
24
|
pry
|
@@ -26,32 +26,34 @@ PATH
|
|
26
26
|
selenium-webdriver
|
27
27
|
timecop (~> 0.8.1)
|
28
28
|
uglifier
|
29
|
-
unparser
|
29
|
+
unparser
|
30
30
|
webdrivers
|
31
31
|
|
32
32
|
PATH
|
33
|
-
remote: ../hyper-
|
33
|
+
remote: ../hyper-state
|
34
34
|
specs:
|
35
|
-
hyper-
|
36
|
-
|
35
|
+
hyper-state (0.1)
|
36
|
+
hyperstack-config (= 0.1)
|
37
37
|
opal (>= 0.11.0, < 0.12.0)
|
38
38
|
|
39
39
|
PATH
|
40
|
-
remote: ../
|
40
|
+
remote: ../hyperstack-config
|
41
41
|
specs:
|
42
|
-
|
43
|
-
libv8 (~> 6.
|
44
|
-
|
42
|
+
hyperstack-config (0.1)
|
43
|
+
libv8 (~> 6.3.0)
|
44
|
+
listen (~> 3.0)
|
45
|
+
mini_racer (~> 0.1.15)
|
45
46
|
opal (>= 0.11.0, < 0.12.0)
|
46
47
|
opal-browser (~> 0.2.0)
|
47
48
|
uglifier
|
49
|
+
websocket
|
48
50
|
|
49
51
|
PATH
|
50
52
|
remote: .
|
51
53
|
specs:
|
52
|
-
hyper-operation (0.
|
54
|
+
hyper-operation (0.1)
|
53
55
|
activerecord (>= 4.0.0)
|
54
|
-
hyper-component (= 0.
|
56
|
+
hyper-component (= 0.1)
|
55
57
|
mutations
|
56
58
|
opal-activesupport (~> 0.3.1)
|
57
59
|
|
@@ -114,7 +116,7 @@ GEM
|
|
114
116
|
babel-source (>= 4.0, < 6)
|
115
117
|
execjs (~> 2.0)
|
116
118
|
builder (3.2.3)
|
117
|
-
capybara (3.
|
119
|
+
capybara (3.10.0)
|
118
120
|
addressable
|
119
121
|
mini_mime (>= 0.1.3)
|
120
122
|
nokogiri (~> 1.8)
|
@@ -153,7 +155,7 @@ GEM
|
|
153
155
|
erubi (1.7.1)
|
154
156
|
eventmachine (1.2.7)
|
155
157
|
execjs (2.7.0)
|
156
|
-
ffi (1.
|
158
|
+
ffi (1.9.25)
|
157
159
|
globalid (0.4.1)
|
158
160
|
activesupport (>= 4.2.0)
|
159
161
|
hike (1.2.3)
|
@@ -168,7 +170,11 @@ GEM
|
|
168
170
|
rails-dom-testing (>= 1, < 3)
|
169
171
|
railties (>= 4.2.0)
|
170
172
|
thor (>= 0.14, < 2.0)
|
171
|
-
libv8 (6.
|
173
|
+
libv8 (6.3.292.48.1-x86_64-darwin-15)
|
174
|
+
listen (3.1.5)
|
175
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
176
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
177
|
+
ruby_dep (~> 1.2)
|
172
178
|
loofah (2.2.2)
|
173
179
|
crass (~> 1.0.2)
|
174
180
|
nokogiri (>= 1.5.9)
|
@@ -182,14 +188,13 @@ GEM
|
|
182
188
|
mimemagic (0.3.2)
|
183
189
|
mini_mime (1.0.1)
|
184
190
|
mini_portile2 (2.3.0)
|
185
|
-
mini_racer (0.
|
186
|
-
libv8 (
|
191
|
+
mini_racer (0.1.15)
|
192
|
+
libv8 (~> 6.3)
|
187
193
|
minitest (5.11.3)
|
188
194
|
multi_json (1.13.1)
|
189
|
-
mutations (0.
|
195
|
+
mutations (0.8.3)
|
190
196
|
activesupport
|
191
197
|
mysql2 (0.5.2)
|
192
|
-
net_http_ssl_fix (0.0.10)
|
193
198
|
nio4r (2.3.1)
|
194
199
|
nokogiri (1.8.4)
|
195
200
|
mini_portile2 (~> 2.3.0)
|
@@ -228,7 +233,7 @@ GEM
|
|
228
233
|
interception (>= 0.5)
|
229
234
|
pry
|
230
235
|
public_suffix (3.0.3)
|
231
|
-
puma (3.
|
236
|
+
puma (3.12.0)
|
232
237
|
pusher (1.3.1)
|
233
238
|
httpclient (~> 2.7)
|
234
239
|
multi_json (~> 1.0)
|
@@ -267,13 +272,16 @@ GEM
|
|
267
272
|
rake (>= 0.8.7)
|
268
273
|
thor (>= 0.19.0, < 2.0)
|
269
274
|
rake (12.3.1)
|
275
|
+
rb-fsevent (0.10.3)
|
276
|
+
rb-inotify (0.9.10)
|
277
|
+
ffi (>= 0.5.0, < 2)
|
270
278
|
react-rails (2.4.7)
|
271
279
|
babel-transpiler (>= 0.7.0)
|
272
280
|
connection_pool
|
273
281
|
execjs
|
274
282
|
railties (>= 3.2)
|
275
283
|
tilt
|
276
|
-
regexp_parser (1.
|
284
|
+
regexp_parser (1.2.0)
|
277
285
|
rspec (3.8.0)
|
278
286
|
rspec-core (~> 3.8.0)
|
279
287
|
rspec-expectations (~> 3.8.0)
|
@@ -299,8 +307,9 @@ GEM
|
|
299
307
|
rspec-support (3.8.0)
|
300
308
|
rspec-wait (0.0.9)
|
301
309
|
rspec (>= 3, < 4)
|
310
|
+
ruby_dep (1.5.0)
|
302
311
|
rubyzip (1.2.2)
|
303
|
-
selenium-webdriver (3.
|
312
|
+
selenium-webdriver (3.14.1)
|
304
313
|
childprocess (~> 0.5)
|
305
314
|
rubyzip (~> 1.2, >= 1.2.2)
|
306
315
|
sourcemap (0.1.1)
|
@@ -322,9 +331,9 @@ GEM
|
|
322
331
|
timecop (0.8.1)
|
323
332
|
tzinfo (1.2.5)
|
324
333
|
thread_safe (~> 0.1)
|
325
|
-
uglifier (4.1.
|
334
|
+
uglifier (4.1.19)
|
326
335
|
execjs (>= 0.3.0, < 3)
|
327
|
-
unparser (0.
|
336
|
+
unparser (0.2.8)
|
328
337
|
abstract_type (~> 0.0.7)
|
329
338
|
adamantium (~> 0.2.0)
|
330
339
|
concord (~> 0.1.5)
|
@@ -332,11 +341,11 @@ GEM
|
|
332
341
|
equalizer (~> 0.0.9)
|
333
342
|
parser (>= 2.3.1.2, < 2.6)
|
334
343
|
procto (~> 0.0.2)
|
335
|
-
webdrivers (3.
|
336
|
-
net_http_ssl_fix
|
344
|
+
webdrivers (3.4.3)
|
337
345
|
nokogiri (~> 1.6)
|
338
346
|
rubyzip (~> 1.0)
|
339
347
|
selenium-webdriver (~> 3.0)
|
348
|
+
websocket (1.2.8)
|
340
349
|
websocket-driver (0.7.0)
|
341
350
|
websocket-extensions (>= 0.1.0)
|
342
351
|
websocket-extensions (0.1.3)
|
@@ -353,8 +362,8 @@ DEPENDENCIES
|
|
353
362
|
hyper-component!
|
354
363
|
hyper-operation!
|
355
364
|
hyper-spec!
|
356
|
-
hyper-
|
357
|
-
|
365
|
+
hyper-state!
|
366
|
+
hyperstack-config!
|
358
367
|
mysql2
|
359
368
|
opal (>= 0.11.0, < 0.12.0)
|
360
369
|
opal-browser (~> 0.2.0)
|
@@ -373,4 +382,4 @@ DEPENDENCIES
|
|
373
382
|
timecop (~> 0.8.1)
|
374
383
|
|
375
384
|
BUNDLED WITH
|
376
|
-
1.
|
385
|
+
1.16.1
|
data/hyper-operation.gemspec
CHANGED
@@ -5,15 +5,15 @@ require 'hyper-operation/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'hyper-operation'
|
8
|
-
spec.version =
|
8
|
+
spec.version = Hyperstack::Operation::VERSION
|
9
9
|
spec.authors = ['Mitch VanDuyn', 'Jan Biedermann']
|
10
10
|
spec.email = ['mitch@catprint.com', 'jan@kursator.com']
|
11
|
-
spec.summary = 'HyperOperations are the swiss army knife of the
|
12
|
-
spec.homepage = 'http://ruby-
|
11
|
+
spec.summary = 'HyperOperations are the swiss army knife of the Hyperstack'
|
12
|
+
spec.homepage = 'http://ruby-hyperstack.org'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
# spec.metadata = {
|
15
|
-
# "homepage_uri" => 'http://ruby-
|
16
|
-
# "source_code_uri" => 'https://github.com/ruby-
|
15
|
+
# "homepage_uri" => 'http://ruby-hyperstack.org',
|
16
|
+
# "source_code_uri" => 'https://github.com/ruby-hyperstack/hyper-component'
|
17
17
|
# }
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`
|
@@ -24,14 +24,14 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
26
|
spec.add_dependency 'activerecord', '>= 4.0.0'
|
27
|
-
spec.add_dependency 'hyper-component',
|
27
|
+
spec.add_dependency 'hyper-component', Hyperstack::Operation::VERSION
|
28
28
|
spec.add_dependency 'mutations'
|
29
29
|
spec.add_dependency 'opal-activesupport', '~> 0.3.1'
|
30
30
|
|
31
31
|
spec.add_development_dependency 'bundler'
|
32
32
|
spec.add_development_dependency 'chromedriver-helper'
|
33
33
|
spec.add_development_dependency 'database_cleaner'
|
34
|
-
spec.add_development_dependency 'hyper-spec',
|
34
|
+
spec.add_development_dependency 'hyper-spec', Hyperstack::Operation::VERSION
|
35
35
|
spec.add_development_dependency 'mysql2'
|
36
36
|
spec.add_development_dependency 'opal', '>= 0.11.0', '< 0.12.0'
|
37
37
|
spec.add_development_dependency 'opal-browser', '~> 0.2.0'
|
data/lib/hyper-operation.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'hyper-operation/version'
|
2
|
-
require '
|
2
|
+
require 'hyperstack-config'
|
3
3
|
|
4
|
-
|
4
|
+
Hyperstack.import 'hyper-operation'
|
5
5
|
|
6
6
|
if RUBY_ENGINE == 'opal'
|
7
7
|
require 'active_support/core_ext/string'
|
@@ -29,7 +29,7 @@ if RUBY_ENGINE == 'opal'
|
|
29
29
|
require 'hyper-operation/server_op'
|
30
30
|
require 'hyper-operation/boot'
|
31
31
|
else
|
32
|
-
require '
|
32
|
+
require 'hyperstack-config'
|
33
33
|
require 'mutations'
|
34
34
|
Mutations::HashFilter.register_additional_filter(Mutations::DuckFilter, :duck)
|
35
35
|
require 'hyper-operation/filters/outbound_filter'
|
@@ -38,7 +38,7 @@ else
|
|
38
38
|
require 'hyper-operation/transport/active_record'
|
39
39
|
require 'hyper-operation/engine'
|
40
40
|
require 'hyper-operation/transport/connection'
|
41
|
-
require 'hyper-operation/transport/
|
41
|
+
require 'hyper-operation/transport/hyperstack'
|
42
42
|
require 'hyper-operation/transport/policy'
|
43
43
|
require 'hyper-operation/transport/client_drivers'
|
44
44
|
require 'hyper-operation/transport/acting_user'
|
@@ -52,8 +52,9 @@ else
|
|
52
52
|
require 'hyper-operation/railway/params_wrapper'
|
53
53
|
require 'hyper-operation/railway/run.rb'
|
54
54
|
require 'hyper-operation/railway/validations'
|
55
|
-
require 'hyper-operation/transport/
|
55
|
+
require 'hyper-operation/transport/hyperstack_controller'
|
56
56
|
require 'hyper-operation/server_op'
|
57
|
+
require 'hyper-operation/boot'
|
57
58
|
Opal.use_gem 'mutations', false
|
58
59
|
Opal.append_path File.expand_path('../sources/', __FILE__).untaint
|
59
60
|
Opal.append_path File.expand_path('../', __FILE__).untaint
|
data/lib/hyper-operation/api.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Hyperstack
|
2
2
|
class Operation
|
3
3
|
|
4
4
|
def add_error(key, kind, message = nil)
|
@@ -137,7 +137,7 @@ module Hyperloop
|
|
137
137
|
end
|
138
138
|
|
139
139
|
child.singleton_class.define_singleton_method(:_Railway) do
|
140
|
-
|
140
|
+
Hyperstack::Context.set_var(self, :@_railway) do
|
141
141
|
# overcomes a bug in Opal 0.9 which returns nil for singleton superclass
|
142
142
|
my_super = superclass || `self.$$singleton_of`.superclass.singleton_class
|
143
143
|
if my_super == Operation.singleton_class
|
data/lib/hyper-operation/boot.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module
|
2
|
-
# Tricky business here.
|
1
|
+
module Hyperstack
|
2
|
+
# Tricky business here. Hyperstack::Store will define boot
|
3
3
|
# if it is not already defined. It creates a minimal compatible
|
4
4
|
# API that includes the run and on_dispatch methods. This way
|
5
5
|
# you can use the Boot interface without loading operations.
|
@@ -11,6 +11,7 @@ module Hyperloop
|
|
11
11
|
class Application
|
12
12
|
Operation.inherited(Boot) if defined? Boot
|
13
13
|
class Boot < Operation
|
14
|
+
#broadcaster.receiver(self, *args, &block)
|
14
15
|
def self.on_dispatch(&block)
|
15
16
|
_Railway.add_receiver(&block)
|
16
17
|
end
|
data/lib/hyper-operation/http.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Hyperstack
|
2
2
|
# {HTTP} is used to perform a `XMLHttpRequest` in ruby. It is a simple wrapper
|
3
3
|
# around `XMLHttpRequest`
|
4
4
|
#
|
@@ -161,7 +161,7 @@ module Hyperloop
|
|
161
161
|
@active_requests ||= 0
|
162
162
|
@active_requests -= 1
|
163
163
|
if @active_requests < 0
|
164
|
-
`console.log("Ooops,
|
164
|
+
`console.log("Ooops, Hyperstack::HTTP active_requests out of sync!")`
|
165
165
|
@active_requests = 0
|
166
166
|
end
|
167
167
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Hyperstack
|
2
2
|
class Operation
|
3
3
|
class Railway
|
4
4
|
|
@@ -9,12 +9,16 @@ module Hyperloop
|
|
9
9
|
class << self
|
10
10
|
def receivers
|
11
11
|
# use the force: true option so that system code needing to receive
|
12
|
-
# boot will NOT be erased on the next
|
13
|
-
|
12
|
+
# boot will NOT be erased on the next Hyperstack::Context.reset!
|
13
|
+
Hyperstack::Context.set_var(self, :@receivers, force: true) { [] }
|
14
14
|
end
|
15
15
|
|
16
16
|
def add_receiver(&block)
|
17
|
-
|
17
|
+
cloned_block = ->(*args, &b) { block.call(*args, &b) }
|
18
|
+
operation = self
|
19
|
+
cloned_block.define_singleton_method(:unmount) { operation.receivers.delete(cloned_block) }
|
20
|
+
receivers << cloned_block
|
21
|
+
cloned_block
|
18
22
|
end
|
19
23
|
end
|
20
24
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Hyperstack
|
2
2
|
class Operation
|
3
3
|
class ParamsWrapper
|
4
4
|
|
@@ -119,7 +119,7 @@ module Hyperloop
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def self.params_wrapper
|
122
|
-
|
122
|
+
Hyperstack::Context.set_var(self, :@params_wrapper) do
|
123
123
|
if Railway == superclass
|
124
124
|
Class.new(ParamsWrapper)
|
125
125
|
else
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'net/http' unless RUBY_ENGINE == 'opal'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Hyperstack
|
4
4
|
class ServerOp < Operation
|
5
5
|
|
6
6
|
class << self
|
7
|
-
include
|
7
|
+
include Hyperstack::Component::IsomorphicHelpers
|
8
8
|
|
9
9
|
if RUBY_ENGINE == 'opal'
|
10
10
|
if on_opal_client?
|
11
11
|
def run(*args)
|
12
12
|
hash = _Railway.params_wrapper.combine_arg_array(args)
|
13
13
|
hash = serialize_params(hash)
|
14
|
-
|
15
|
-
"#{`window.
|
14
|
+
Hyperstack::HTTP.post(
|
15
|
+
"#{`window.HyperstackEnginePath`}/execute_remote",
|
16
16
|
payload: {json: {operation: name, params: hash}.to_json},
|
17
|
-
headers: {'X-CSRF-Token' =>
|
17
|
+
headers: {'X-CSRF-Token' => Hyperstack::ClientDrivers.opts[:form_authenticity_token] }
|
18
18
|
)
|
19
19
|
.then do |response|
|
20
20
|
deserialize_response response.json[:response]
|
@@ -40,20 +40,20 @@ module Hyperloop
|
|
40
40
|
isomorphic_method(:internal_iso_run) do |f, klass_name, op_params|
|
41
41
|
f.send_to_server(klass_name, op_params)
|
42
42
|
f.when_on_server {
|
43
|
-
|
43
|
+
Hyperstack::ServerOp.run_from_client(:acting_user, controller, klass_name, *op_params)
|
44
44
|
}
|
45
45
|
end
|
46
46
|
|
47
47
|
def descendants_map_cache
|
48
48
|
# calling descendants alone may take 10ms in a complex app, so better cache it
|
49
|
-
@cached_descendants ||=
|
49
|
+
@cached_descendants ||= Hyperstack::ServerOp.descendants.map(&:to_s)
|
50
50
|
end
|
51
51
|
|
52
52
|
def run_from_client(security_param, controller, operation, params)
|
53
53
|
if Rails.env.production?
|
54
54
|
# in production everything is eager loaded so ServerOp.descendants is filled and can be used to guard the .constantize
|
55
|
-
unless
|
56
|
-
|
55
|
+
unless Hyperstack::ServerOp.descendants_map_cache.include?(operation)
|
56
|
+
Hyperstack::InternalPolicy.raise_operation_access_violation(:illegal_remote_op_call, "Operation: #{operation} (in production)")
|
57
57
|
end
|
58
58
|
# however ...
|
59
59
|
else
|
@@ -64,10 +64,10 @@ module Hyperloop
|
|
64
64
|
begin
|
65
65
|
const = Object.const_get(operation)
|
66
66
|
rescue NameError
|
67
|
-
|
67
|
+
Hyperstack::InternalPolicy.raise_operation_access_violation(:illegal_remote_op_call, "Operation: #{operation} (const not found)")
|
68
68
|
end
|
69
|
-
unless const <
|
70
|
-
|
69
|
+
unless const < Hyperstack::ServerOp
|
70
|
+
Hyperstack::InternalPolicy.raise_operation_access_violation(:illegal_remote_op_call, "Operation: #{operation} (not a ServerOp subclass)")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
operation.constantize.class_eval do
|
@@ -87,7 +87,7 @@ module Hyperloop
|
|
87
87
|
def handle_exception(e, operation, params)
|
88
88
|
if defined? ::Rails
|
89
89
|
params.delete(:controller)
|
90
|
-
::Rails.logger.debug "\033[0;31;1mERROR:
|
90
|
+
::Rails.logger.debug "\033[0;31;1mERROR: Hyperstack::ServerOp exception caught when running "\
|
91
91
|
"#{operation} with params \"#{params}\": #{e}\033[0;30;21m"
|
92
92
|
end
|
93
93
|
{ json: { error: e }, status: 500 }
|
@@ -104,7 +104,7 @@ module Hyperloop
|
|
104
104
|
end
|
105
105
|
request.body = {
|
106
106
|
operation: name,
|
107
|
-
params:
|
107
|
+
params: Hyperstack::Operation::ParamsWrapper.combine_arg_array(args)
|
108
108
|
}.to_json
|
109
109
|
promise.resolve http.request(request)
|
110
110
|
rescue Exception => e
|
@@ -152,7 +152,7 @@ module Hyperloop
|
|
152
152
|
[operation.instance_exec(*context, ®ulation)].flatten.compact.uniq.each do |channel|
|
153
153
|
unless operation.instance_variable_get(:@_dispatched_channels).include?(channel)
|
154
154
|
operation.instance_variable_set(:@_dispatched_channels, operation.instance_variable_get(:@_dispatched_channels) << channel)
|
155
|
-
|
155
|
+
Hyperstack.dispatch(channel: Hyperstack::InternalPolicy.channel_to_string(channel), operation: operation.class.name, params: serialized_params)
|
156
156
|
end
|
157
157
|
end
|
158
158
|
end
|