isomorfeus-operation 1.0.0.epsilon1 → 1.0.0.epsilon2

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: b3ca50663dcceda1e660e6a6678dc86f0d37bbd23e014622529123e8cb8144fb
4
- data.tar.gz: b515eae2a6298aab9eb2977d27a7a0fe66bc5600cde803b706207c2b6a9aa0de
3
+ metadata.gz: e6579700c64951e487d014a8ea4ff5a7c5878a51b40b7d2d7377a0a360e3f838
4
+ data.tar.gz: 6c0a3ae43946b7a8b02ebbabf24581abf312cfcd771f756195151e2e6d2c0d6d
5
5
  SHA512:
6
- metadata.gz: 5c324365f506790ec858bfb6e634b74dc032e56b57d6343c5a21e412479e71cc254364944711920ddd1265c1d433507a824ae02d5876903b81f73a143402c0dd
7
- data.tar.gz: 05ba33492f154bd5a54a3d9044f5f09709420aea90d365b29630ae12be0a75b032751c55c8fe5e254deef3466160fc2355c1772d956199b47e1ed66aba0f2022
6
+ metadata.gz: 70c72e4e875220b4d3c77d07b3a412ff88419b023ffaeaacb4cd916c6fce08840b49da98923b2a1495ee4ac47df1ac4edd2579334dbe6869d0821e93d2ba9656
7
+ data.tar.gz: a9afe16f39c342d64c811a9c54d20f4ce13d6d1b1b115f18287924a2715c5e663101e033dc5d951d37bb4857bad5ce4b0593ef579d27a092e5790944066efa9e
@@ -1,36 +1,42 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Isomorfeus
2
4
  module Operation
3
5
  module Handler
4
6
  class OperationHandler < LucidHandler::Base
5
- on_request do |pub_sub_client, session_id, current_user, request, response|
7
+ on_request do |pub_sub_client, current_user, request, response|
6
8
  result = { error: 'No such thing' }
7
9
  # promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.to_s, props_hash)
8
- request.keys.each do |operation_class_name|
10
+ request.each_key do |operation_class_name|
9
11
  if Isomorfeus.valid_operation_class_name?(operation_class_name)
10
12
  operation_class = Isomorfeus.cached_operation_class(operation_class_name)
11
13
  if operation_class
12
14
  props_json = request[operation_class_name]
13
15
  begin
14
16
  props = Oj.load(props_json, mode: :strict)
15
- props.merge!({pub_sub_client: pub_sub_client, session_id: session_id, current_user: current_user})
16
- operation_promise = operation_class.promise_run(props)
17
- if operation_promise.realized?
18
- result = { success: 'ok' , result: operation_promise.value }
19
- else
20
- start = Time.now
21
- timeout = false
22
- while !operation_promise.realized?
23
- if (Time.now - start) > 20
24
- timeout = true
25
- break
26
- end
27
- sleep 0.01
28
- end
29
- if timeout
30
- result = { error: 'Timeout' }
31
- else
17
+ props.merge!({pub_sub_client: pub_sub_client, current_user: current_user})
18
+ if current_user.authorized?(operation_class, :promise_run, *props)
19
+ operation_promise = operation_class.promise_run(props)
20
+ if operation_promise.realized?
32
21
  result = { success: 'ok' , result: operation_promise.value }
22
+ else
23
+ start = Time.now
24
+ timeout = false
25
+ while !operation_promise.realized?
26
+ if (Time.now - start) > 20
27
+ timeout = true
28
+ break
29
+ end
30
+ sleep 0.01
31
+ end
32
+ if timeout
33
+ result = { error: 'Timeout' }
34
+ else
35
+ result = { success: 'ok' , result: operation_promise.value }
36
+ end
33
37
  end
38
+ else
39
+ result = { error: 'Access denied!' }
34
40
  end
35
41
  rescue Exception => e
36
42
  result = if Isomorfeus.production?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Isomorfeus
2
4
  module Operation
3
5
  module Mixin
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Operation
3
- VERSION = '1.0.0.epsilon1'
3
+ VERSION = '1.0.0.epsilon2'
4
4
  end
5
5
  end
@@ -7,7 +7,6 @@ module LucidOperation
7
7
  Isomorfeus.add_valid_operation_class(base)
8
8
 
9
9
  base.prop :pub_sub_client, default: nil
10
- base.prop :session_id, default: nil
11
10
  base.prop :current_user, default: nil
12
11
  end
13
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LucidOperation
2
4
  module Mixin
3
5
  def self.included(base)
@@ -53,7 +55,6 @@ module LucidOperation
53
55
 
54
56
  unless base == LucidOperation::Base
55
57
  base.prop :pub_sub_client, default: nil
56
- base.prop :session_id, default: nil
57
58
  base.prop :current_user, default: nil
58
59
  end
59
60
 
@@ -7,7 +7,6 @@ module LucidQuickOp
7
7
  Isomorfeus.add_valid_operation_class(base)
8
8
 
9
9
  base.prop :pub_sub_client, default: nil
10
- base.prop :session_id, default: nil
11
10
  base.prop :current_user, default: nil
12
11
  end
13
12
  end
@@ -25,7 +25,6 @@ module LucidQuickOp
25
25
 
26
26
  unless base == LucidQuickOp::Base
27
27
  base.prop :pub_sub_client, default: nil
28
- base.prop :session_id, default: nil
29
28
  base.prop :current_user, default: nil
30
29
  end
31
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-operation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.epsilon1
4
+ version: 1.0.0.epsilon2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-16 00:00:00.000000000 Z
11
+ date: 2019-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,14 +100,42 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0.epsilon1
103
+ version: 1.0.0.epsilon2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.0.epsilon1
110
+ version: 1.0.0.epsilon2
111
+ - !ruby/object:Gem::Dependency
112
+ name: isomorfeus-installer
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0.epsilon2
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.0.0.epsilon2
125
+ - !ruby/object:Gem::Dependency
126
+ name: opal-webpack-loader
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 0.9.4
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.9.4
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: rake
113
141
  requirement: !ruby/object:Gem::Requirement