hyper-operation 1.0.alpha1.5 → 1.0.0.lap28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -7
- data/.travis.yml +9 -20
- data/CODE_OF_CONDUCT.md +49 -0
- data/DOCS-POLICIES.md +582 -0
- data/DOCS.md +869 -0
- data/Gemfile +1 -5
- data/LICENSE.txt +21 -0
- data/README.md +77 -0
- data/Rakefile +2 -1
- data/dciy.toml +3 -0
- data/hyper-operation.gemspec +13 -16
- data/lib/hyper-operation.rb +5 -8
- data/lib/hyper-operation/api.rb +2 -2
- data/lib/hyper-operation/boot.rb +2 -3
- data/lib/hyper-operation/engine.rb +2 -2
- data/lib/hyper-operation/exception.rb +4 -30
- data/lib/hyper-operation/filters/acting_user.rb +1 -1
- data/lib/hyper-operation/http.rb +2 -2
- data/lib/hyper-operation/promise.rb +2 -28
- data/lib/hyper-operation/railway.rb +1 -1
- data/lib/hyper-operation/railway/dispatcher.rb +4 -8
- data/lib/hyper-operation/railway/params_wrapper.rb +2 -2
- data/lib/hyper-operation/railway/run.rb +49 -52
- data/lib/hyper-operation/railway/validations.rb +3 -10
- data/lib/hyper-operation/server_op.rb +19 -45
- data/lib/hyper-operation/transport/action_cable.rb +8 -8
- data/lib/hyper-operation/transport/client_drivers.rb +53 -94
- data/lib/hyper-operation/transport/connection.rb +10 -10
- data/lib/hyper-operation/transport/{hyperstack.rb → hyperloop.rb} +14 -19
- data/lib/hyper-operation/transport/{hyperstack_controller.rb → hyperloop_controller.rb} +52 -54
- data/lib/hyper-operation/transport/policy.rb +45 -41
- data/lib/hyper-operation/version.rb +2 -2
- data/lib/sources/{hyperstack → hyperloop}/pusher.js +0 -0
- metadata +51 -50
- data/lib/hyper-operation/transport/policy_diagnostics.rb +0 -106
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-operation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.0.lap28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitch VanDuyn
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -31,14 +31,28 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.0.
|
34
|
+
version: 1.0.0.lap28
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.0.
|
41
|
+
version: 1.0.0.lap28
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: hyperloop-config
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.0.0.lap28
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.0.0.lap28
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: mutations
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,42 +81,22 @@ dependencies:
|
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
83
|
version: 0.3.1
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: tty-table
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :runtime
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: bundler
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
91
|
-
- - "<"
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '2.1'
|
90
|
+
version: '0'
|
94
91
|
type: :development
|
95
92
|
prerelease: false
|
96
93
|
version_requirements: !ruby/object:Gem::Requirement
|
97
94
|
requirements:
|
98
95
|
- - ">="
|
99
96
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
101
|
-
- - "<"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '2.1'
|
97
|
+
version: '0'
|
104
98
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
99
|
+
name: database_cleaner
|
106
100
|
requirement: !ruby/object:Gem::Requirement
|
107
101
|
requirements:
|
108
102
|
- - ">="
|
@@ -116,33 +110,33 @@ dependencies:
|
|
116
110
|
- !ruby/object:Gem::Version
|
117
111
|
version: '0'
|
118
112
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
113
|
+
name: hyper-react
|
120
114
|
requirement: !ruby/object:Gem::Requirement
|
121
115
|
requirements:
|
122
|
-
- -
|
116
|
+
- - '='
|
123
117
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
118
|
+
version: 1.0.0.lap28
|
125
119
|
type: :development
|
126
120
|
prerelease: false
|
127
121
|
version_requirements: !ruby/object:Gem::Requirement
|
128
122
|
requirements:
|
129
|
-
- -
|
123
|
+
- - '='
|
130
124
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
125
|
+
version: 1.0.0.lap28
|
132
126
|
- !ruby/object:Gem::Dependency
|
133
127
|
name: hyper-spec
|
134
128
|
requirement: !ruby/object:Gem::Requirement
|
135
129
|
requirements:
|
136
130
|
- - '='
|
137
131
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.0.
|
132
|
+
version: 1.0.0.lap28
|
139
133
|
type: :development
|
140
134
|
prerelease: false
|
141
135
|
version_requirements: !ruby/object:Gem::Requirement
|
142
136
|
requirements:
|
143
137
|
- - '='
|
144
138
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.0.
|
139
|
+
version: 1.0.0.lap28
|
146
140
|
- !ruby/object:Gem::Dependency
|
147
141
|
name: mysql2
|
148
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,19 +200,19 @@ dependencies:
|
|
206
200
|
- !ruby/object:Gem::Version
|
207
201
|
version: 0.9.4
|
208
202
|
- !ruby/object:Gem::Dependency
|
209
|
-
name:
|
203
|
+
name: mini_racer
|
210
204
|
requirement: !ruby/object:Gem::Requirement
|
211
205
|
requirements:
|
212
|
-
- - "
|
206
|
+
- - "~>"
|
213
207
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
208
|
+
version: 0.1.15
|
215
209
|
type: :development
|
216
210
|
prerelease: false
|
217
211
|
version_requirements: !ruby/object:Gem::Requirement
|
218
212
|
requirements:
|
219
|
-
- - "
|
213
|
+
- - "~>"
|
220
214
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
215
|
+
version: 0.1.15
|
222
216
|
- !ruby/object:Gem::Dependency
|
223
217
|
name: puma
|
224
218
|
requirement: !ruby/object:Gem::Requirement
|
@@ -355,16 +349,16 @@ dependencies:
|
|
355
349
|
name: sqlite3
|
356
350
|
requirement: !ruby/object:Gem::Requirement
|
357
351
|
requirements:
|
358
|
-
- - "
|
352
|
+
- - ">="
|
359
353
|
- !ruby/object:Gem::Version
|
360
|
-
version:
|
354
|
+
version: '0'
|
361
355
|
type: :development
|
362
356
|
prerelease: false
|
363
357
|
version_requirements: !ruby/object:Gem::Requirement
|
364
358
|
requirements:
|
365
|
-
- - "
|
359
|
+
- - ">="
|
366
360
|
- !ruby/object:Gem::Version
|
367
|
-
version:
|
361
|
+
version: '0'
|
368
362
|
- !ruby/object:Gem::Dependency
|
369
363
|
name: timecop
|
370
364
|
requirement: !ruby/object:Gem::Requirement
|
@@ -389,8 +383,14 @@ extra_rdoc_files: []
|
|
389
383
|
files:
|
390
384
|
- ".gitignore"
|
391
385
|
- ".travis.yml"
|
386
|
+
- CODE_OF_CONDUCT.md
|
387
|
+
- DOCS-POLICIES.md
|
388
|
+
- DOCS.md
|
392
389
|
- Gemfile
|
390
|
+
- LICENSE.txt
|
391
|
+
- README.md
|
393
392
|
- Rakefile
|
393
|
+
- dciy.toml
|
394
394
|
- hyper-operation.gemspec
|
395
395
|
- lib/hyper-operation.rb
|
396
396
|
- lib/hyper-operation/api.rb
|
@@ -415,14 +415,13 @@ files:
|
|
415
415
|
- lib/hyper-operation/transport/active_record.rb
|
416
416
|
- lib/hyper-operation/transport/client_drivers.rb
|
417
417
|
- lib/hyper-operation/transport/connection.rb
|
418
|
-
- lib/hyper-operation/transport/
|
419
|
-
- lib/hyper-operation/transport/
|
418
|
+
- lib/hyper-operation/transport/hyperloop.rb
|
419
|
+
- lib/hyper-operation/transport/hyperloop_controller.rb
|
420
420
|
- lib/hyper-operation/transport/pluck.rb
|
421
421
|
- lib/hyper-operation/transport/policy.rb
|
422
|
-
- lib/hyper-operation/transport/policy_diagnostics.rb
|
423
422
|
- lib/hyper-operation/version.rb
|
424
|
-
- lib/sources/
|
425
|
-
homepage: http://ruby-
|
423
|
+
- lib/sources/hyperloop/pusher.js
|
424
|
+
homepage: http://ruby-hyperloop.org
|
426
425
|
licenses:
|
427
426
|
- MIT
|
428
427
|
metadata: {}
|
@@ -441,8 +440,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
441
440
|
- !ruby/object:Gem::Version
|
442
441
|
version: 1.3.1
|
443
442
|
requirements: []
|
444
|
-
|
443
|
+
rubyforge_project:
|
444
|
+
rubygems_version: 2.7.6
|
445
445
|
signing_key:
|
446
446
|
specification_version: 4
|
447
|
-
summary:
|
447
|
+
summary: Compose your business logic into isomorphic commands that sanitize and validate
|
448
|
+
input. Write safe, reusable, and maintainable code for Ruby and Rails app
|
448
449
|
test_files: []
|
@@ -1,106 +0,0 @@
|
|
1
|
-
module Hyperstack
|
2
|
-
class ClassConnectionRegulation
|
3
|
-
def self.connections(acting_user)
|
4
|
-
regulations.collect do |channel, regulation|
|
5
|
-
status = regulation.connectable?(acting_user) ? :allowed : :denied
|
6
|
-
{ type: :class, owner: channel, channel: InternalPolicy.channel_to_string(channel), auto_connect: !regulation.auto_connect_disabled?, status: status }
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class InstanceConnectionRegulation
|
12
|
-
def self.connections(acting_user)
|
13
|
-
regulations.collect do |channel, regulation|
|
14
|
-
regulation.connectable_to(acting_user, false).collect do |obj|
|
15
|
-
{ type: :instance, owner: channel, channel: InternalPolicy.channel_to_string(obj), auto_connect: !regulation.auto_connect_disabled?, status: :allowed }
|
16
|
-
end
|
17
|
-
end.flatten(1)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class InternalPolicy
|
22
|
-
def attribute_dump(acting_user)
|
23
|
-
# dump[channel]['@channel_status'] -> [owner, type, auto_connect, falsy/no connection/allowed]
|
24
|
-
# dump[channel][attribute] -> 'no connection/no channel/no policy/allowed'
|
25
|
-
dump = Hash.new { |h, k| h[k] = Hash.new }
|
26
|
-
connections = ClassConnectionRegulation.connections(acting_user) +
|
27
|
-
InstanceConnectionRegulation.connections(acting_user)
|
28
|
-
connections.each do |status|
|
29
|
-
status[:status] = 'allowed' if status[:status]
|
30
|
-
status[:status] ||= 'no connection'
|
31
|
-
dump[status[:channel]]['@channel_status'] = status
|
32
|
-
end
|
33
|
-
@channel_sets.each do |channel, attribute_set|
|
34
|
-
channel = InternalPolicy.channel_to_string(channel)
|
35
|
-
attribute_set.each do |attribute|
|
36
|
-
dump[channel]['@channel_status'] ||= { type: 'no channel' }
|
37
|
-
dump[channel][attribute] = dump[channel]['@channel_status'][:status] || 'no channel'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
dump.each_key do |channel|
|
41
|
-
@attribute_names.each do |attribute|
|
42
|
-
dump[channel][attribute] ||= 'no policy'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
dump
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
module PolicyDiagnostics
|
50
|
-
def self.policy_dump_hash(model, acting_user)
|
51
|
-
internal_policy = InternalPolicy.new(model, model.attribute_names, :all)
|
52
|
-
ChannelBroadcastRegulation.broadcast(internal_policy)
|
53
|
-
InstanceBroadcastRegulation.broadcast(model, internal_policy)
|
54
|
-
internal_policy.attribute_dump(acting_user)
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.policy_dump_for(model, acting_user)
|
58
|
-
dump = policy_dump_hash(model, acting_user)
|
59
|
-
attributes = model.attribute_names.map(&:to_sym)
|
60
|
-
acting_user_channel = InternalPolicy.channel_to_string(acting_user) if acting_user
|
61
|
-
pastel = Pastel.new
|
62
|
-
channels = dump.keys.collect do |channel|
|
63
|
-
c = channel == acting_user_channel ? "* #{channel} *" : channel
|
64
|
-
if dump[channel]['@channel_status'][:status] != 'allowed'
|
65
|
-
pastel.red(c)
|
66
|
-
elsif channel == acting_user_channel
|
67
|
-
pastel.blue(c)
|
68
|
-
else
|
69
|
-
c
|
70
|
-
end
|
71
|
-
end
|
72
|
-
table = TTY::Table.new header: [''] + channels
|
73
|
-
types = dump.keys.collect do |channel|
|
74
|
-
type = dump[channel]['@channel_status'][:type]
|
75
|
-
type = pastel.red(type) if type == 'no policy'
|
76
|
-
type
|
77
|
-
end
|
78
|
-
table << ['type'] + types
|
79
|
-
table << ['auto connect'] + dump.keys.collect { |channel| dump[channel]['@channel_status'][:auto_connect] }
|
80
|
-
table << ['status'] + dump.keys.collect { |channel| dump[channel]['@channel_status'][:status] }
|
81
|
-
attributes.each do |attribute|
|
82
|
-
allowed = false
|
83
|
-
statuses = dump.keys.collect do |channel|
|
84
|
-
status = dump[channel][attribute]
|
85
|
-
if status == 'allowed'
|
86
|
-
allowed = true
|
87
|
-
status
|
88
|
-
else
|
89
|
-
pastel.red(status)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
attribute = pastel.red(attribute) unless allowed
|
93
|
-
table << [attribute] + statuses
|
94
|
-
end
|
95
|
-
rendered = table.render(:unicode, indent: 4).split("\n")
|
96
|
-
rendered = rendered.insert(6, rendered[2]).join("\n")
|
97
|
-
model_string = "<##{model.class} id: #{model.id}>"
|
98
|
-
if acting_user
|
99
|
-
id = "id: #{acting_user.id}" if acting_user.respond_to? :id
|
100
|
-
acting_user_string = "by acting_user <##{acting_user.class} id: #{id}>"
|
101
|
-
end
|
102
|
-
" Attribute access policies for #{model_string} #{acting_user_string || 'with no acting_user'}:\n\n"\
|
103
|
-
"#{rendered}"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|