isomorfeus-operation 1.0.0.zeta5 → 1.0.0.zeta6

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: d4edc7df50c50c0ef40cda3eb5e5ab020a535461b507d356a8f0a5e839171bbc
4
- data.tar.gz: b1778101149f4f71e482969673d8159c37d04dbaafb0b8b51bce00f366f2d80f
3
+ metadata.gz: d40da619afe17206cc317311ead0a56f84460681c9405e616afc56dde6eddd2d
4
+ data.tar.gz: eb5f416c5297e572011cfaec2f21a2c7bd63ad6d769e07e67b3190c9040ef374
5
5
  SHA512:
6
- metadata.gz: e55bc5e1583c48de475225774c223f1aaa3eafd519524cc6e34de087d957761e79c2f4e1d55da8477fc15ab393b01f20b78b241020cd5c24d7ca7165581d0931
7
- data.tar.gz: c5aebd61a2fd43b8bfd3511fc9aace997bc865d87b2a9c354bc9d8aca4596e2e3655c6a461ddb4a0fe432befa6cbb3402761c06c68efe8d6aa83ca578e37abea
6
+ metadata.gz: 936de075f600276a26404fe2a4bba20ba6c55b34e53145204c506d457e19c2e0550d86fc5901c59b9e8721ef057a3018fd520f36a601845cbd83fd4dca5fe167
7
+ data.tar.gz: f1681cdcc67065f6dc1165308f987d3f807dacf436312390d7afe3a50b9d027f29832bca367fb701e0c6992fc29754d2226185f6c885ec4fff19e8d2cf3588ba
data/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # isomorfeus-operation
2
2
 
3
+ Operations for Isomorfeus.
4
+
5
+ ### Community and Support
6
+ At the [Isomorfeus Framework Project](http://isomorfeus.com)
7
+
8
+ ### Usage
3
9
  there are 3 kinds of Operations:
4
10
  - LucidQuickOp
5
11
  - LucidOperation
@@ -1,8 +1,3 @@
1
- require 'opal'
2
- require 'opal-autoloader'
3
- require 'opal-activesupport'
4
- require 'isomorfeus-redux'
5
- require 'isomorfeus-react'
6
1
  require 'isomorfeus-transport'
7
2
  require 'isomorfeus/operation/config'
8
3
  require 'isomorfeus/operation/gherkin'
@@ -16,20 +11,16 @@ require 'lucid_operation/mixin'
16
11
  require 'lucid_operation/base'
17
12
 
18
13
  if RUBY_ENGINE == 'opal'
19
- Opal::Autoloader.add_load_path('data')
14
+ Isomorfeus.zeitwerk.push_dir('operations')
20
15
  else
21
16
  require 'oj'
22
17
  require 'isomorfeus/operation/handler/operation_handler'
23
18
 
24
19
  Opal.append_path(__dir__.untaint) unless Opal.paths.include?(__dir__.untaint)
25
20
 
26
- require 'active_support/dependencies'
21
+ # require 'active_support/dependencies'
27
22
 
28
23
  path = File.expand_path(File.join('isomorfeus', 'operations'))
29
24
 
30
- ActiveSupport::Dependencies.autoload_paths << path
31
- # we also need to require them all, so classes are registered accordingly
32
- Dir.glob("#{path}/**/*.rb").each do |file|
33
- require file
34
- end
25
+ Isomorfeus.zeitwerk.push_dir(path)
35
26
  end
@@ -5,6 +5,7 @@ module Isomorfeus
5
5
  end
6
6
 
7
7
  def cached_operation_class(class_name)
8
+ return "::#{class_name}".constantize if Isomorfeus.development?
8
9
  return cached_operation_classes[class_name] if cached_operation_classes.key?(class_name)
9
10
  cached_operation_classes[class_name] = "::#{class_name}".constantize
10
11
  end
@@ -4,21 +4,20 @@ module Isomorfeus
4
4
  module Operation
5
5
  module Handler
6
6
  class OperationHandler < LucidHandler::Base
7
- on_request do |pub_sub_client, current_user, request, response|
8
- result = { error: 'No such thing' }
7
+ on_request do |pub_sub_client, current_user, response_agent|
9
8
  # promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.to_s, props_hash)
10
- request.each_key do |operation_class_name|
9
+ response_agent.request.each_key do |operation_class_name|
11
10
  if Isomorfeus.valid_operation_class_name?(operation_class_name)
12
11
  operation_class = Isomorfeus.cached_operation_class(operation_class_name)
13
12
  if operation_class
14
- props_json = request[operation_class_name]
13
+ props_json = response_agent.request[operation_class_name]
15
14
  begin
16
15
  props = Oj.load(props_json, mode: :strict)
17
16
  props.merge!({pub_sub_client: pub_sub_client, current_user: current_user})
18
17
  if current_user.authorized?(operation_class, :promise_run, props)
19
18
  operation_promise = operation_class.promise_run(props)
20
19
  if operation_promise.realized?
21
- result = { success: 'ok' , result: operation_promise.value }
20
+ response_agent.agent_result = { success: 'ok' , result: operation_promise.value }
22
21
  else
23
22
  start = Time.now
24
23
  timeout = false
@@ -30,29 +29,28 @@ module Isomorfeus
30
29
  sleep 0.01
31
30
  end
32
31
  if timeout
33
- result = { error: 'Timeout' }
32
+ response_agent.error = { error: 'Timeout' }
34
33
  else
35
- result = { success: 'ok' , result: operation_promise.value }
34
+ response_agent.agent_result = { success: 'ok' , result: operation_promise.value }
36
35
  end
37
36
  end
38
37
  else
39
- result = { error: 'Access denied!' }
38
+ response_agent.error = { error: 'Access denied!' }
40
39
  end
41
40
  rescue Exception => e
42
- result = if Isomorfeus.production?
43
- { error: { operation_class_name => 'No such thing!' }}
44
- else
45
- { error: { operation_class_name => "Isomorfeus::Operation::Handler::OperationHandler: #{e.message}" }}
46
- end
41
+ response_agent.error = if Isomorfeus.production?
42
+ { error: { operation_class_name => 'No such thing!' }}
43
+ else
44
+ { error: { operation_class_name => "Isomorfeus::Operation::Handler::OperationHandler: #{e.message}" }}
45
+ end
47
46
  end
48
47
  else
49
- result = { error: { operation_class_name => 'No such thing!' }}
48
+ response_agent.error = { error: { operation_class_name => 'No such thing!' }}
50
49
  end
51
50
  else
52
- result = { error: { operation_class_name => 'No such thing!' }}
51
+ response_agent.error = { error: { operation_class_name => 'No such thing!' }}
53
52
  end
54
53
  end
55
- result
56
54
  end
57
55
  end
58
56
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Operation
3
- VERSION = '1.0.0.zeta5'
3
+ VERSION = '1.0.0.zeta6'
4
4
  end
5
5
  end
@@ -7,8 +7,8 @@ module LucidOperation
7
7
  Isomorfeus.add_valid_operation_class(base)
8
8
 
9
9
  base.prop :pub_sub_client, default: nil
10
- base.prop :current_user, default: nil
10
+ base.prop :current_user, default: Anonymous.new
11
11
  end
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -60,7 +60,7 @@ module LucidOperation
60
60
 
61
61
  unless base == LucidOperation::Base
62
62
  base.prop :pub_sub_client, default: nil
63
- base.prop :current_user, default: nil
63
+ base.prop :current_user, default: Anonymous.new
64
64
  end
65
65
 
66
66
  base.instance_exec do
@@ -7,8 +7,8 @@ module LucidQuickOp
7
7
  Isomorfeus.add_valid_operation_class(base)
8
8
 
9
9
  base.prop :pub_sub_client, default: nil
10
- base.prop :current_user, default: nil
10
+ base.prop :current_user, default: Anonymous.new
11
11
  end
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -30,7 +30,7 @@ module LucidQuickOp
30
30
 
31
31
  unless base == LucidQuickOp::Base
32
32
  base.prop :pub_sub_client, default: nil
33
- base.prop :current_user, default: nil
33
+ base.prop :current_user, default: Anonymous.new
34
34
  end
35
35
 
36
36
  base.instance_exec do
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.zeta5
4
+ version: 1.0.0.zeta6
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-29 00:00:00.000000000 Z
11
+ date: 2019-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: oj
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.9.0
33
+ version: 3.10.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.9.0
40
+ version: 3.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opal
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.11.0
47
+ version: 1.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.11.0
54
+ version: 1.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: opal-activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,90 +66,76 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.3.3
69
- - !ruby/object:Gem::Dependency
70
- name: opal-autoloader
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.1.0
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.1.0
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: isomorfeus-react
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: 16.9.23
75
+ version: 16.12.1
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: 16.9.23
82
+ version: 16.12.1
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: isomorfeus-redux
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: 4.0.13
89
+ version: 4.0.16
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: 4.0.13
96
+ version: 4.0.16
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: isomorfeus-transport
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - '='
116
102
  - !ruby/object:Gem::Version
117
- version: 1.0.0.zeta5
103
+ version: 1.0.0.zeta6
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - '='
123
109
  - !ruby/object:Gem::Version
124
- version: 1.0.0.zeta5
110
+ version: 1.0.0.zeta6
125
111
  - !ruby/object:Gem::Dependency
126
- name: isomorfeus-installer
112
+ name: isomorfeus
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - '='
130
116
  - !ruby/object:Gem::Version
131
- version: 1.0.0.zeta5
117
+ version: 1.0.0.zeta6
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - '='
137
123
  - !ruby/object:Gem::Version
138
- version: 1.0.0.zeta5
124
+ version: 1.0.0.zeta6
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: opal-webpack-loader
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
144
130
  - !ruby/object:Gem::Version
145
- version: 0.9.5
131
+ version: 0.9.9
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - ">="
151
137
  - !ruby/object:Gem::Version
152
- version: 0.9.5
138
+ version: 0.9.9
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: rake
155
141
  requirement: !ruby/object:Gem::Requirement