isomorfeus-operation 23.9.0.rc7 → 23.9.0.rc8

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: b7e6a1abcdbe84fdca6f1bb487a1eb3f218ba82219ae43c9270b3155eed7ded9
4
- data.tar.gz: b0eebb080b480092464928b2a24edcaa79448035440d98b940a46562a992300a
3
+ metadata.gz: 52a3ac481df1bb0bd9d0faee7497c02d8bf09445e8217dfcc0f49d9f81b58c97
4
+ data.tar.gz: d8295fa118ff351da81f0d193339449d36a8f5ded0e2a89aed86d3c10eeb965f
5
5
  SHA512:
6
- metadata.gz: 16d0156d48a26f9805f7d62b683a77a465d67867607a3d62d05ee006a1003fe4628ddae135f9dd74bc3eb81cdfb8564123880247953b02dd00fa7019012bb5f4
7
- data.tar.gz: dea9caada9f221f06908ac9ba518c1b8931ce521ce648dcec9c0bc966e0243812fe184fd1acb42fba3f6697614551d28a60b8b22f83f8bca9ab892951d1b0134
6
+ metadata.gz: 00d63b08ba6fa3f50fded72376ba7e380ade93dffd9cc1d7facbd4e953b2fef5c8aceafe7da2c90f4ccff6944e711ea9dacb9bb12ae90533d3e9e6d11dc79ad9
7
+ data.tar.gz: 1e1e9ab82660732babf137ee33f195cfefd92a947575a78d9c01d9d3bca7bd673c10b80eeadc6177b435b366d800b0dbf2564ad8a5932b9a95ffefef6b0b0014
data/README.md CHANGED
@@ -10,6 +10,4 @@ Operations use Props like other parts of the system.
10
10
  See [the isomorfeus-preact props documentation](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/props.md#prop-declaration).
11
11
 
12
12
  There are 3 kinds of Operations:
13
- - [LucidSimpleOperation](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-operation/docs/simple_operation.md) - Simple operation, always executed on the server, also deferred or daily.
14
- - [LucidOperation](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-operation/docs/operation.md) - For complex multi-stepped operations, always executed on the server, also deferred or daily.
15
- - [LucidLocalOperation](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-operation/docs/operation.md) - For complex multi-stepped operations, always executed locally.
13
+ - [LucidOperation](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-operation/docs/simple_operation.md) - Simple operation, always executed on the server, also deferred or daily.
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Operation
3
- VERSION = '23.9.0.rc7'
3
+ VERSION = '23.9.0.rc8'
4
4
  end
5
5
  end
@@ -1,12 +1,9 @@
1
1
  require 'isomorfeus-transport'
2
+ require 'isomorfeus-i18n'
2
3
  require 'isomorfeus-policy'
4
+ require 'isomorfeus-preact'
3
5
  require 'isomorfeus/operation/config'
4
6
  require 'isomorfeus/operation/generic_class_api'
5
- require 'lucid_operation/gherkin'
6
- require 'lucid_operation/steps'
7
- require 'lucid_operation/promise_run'
8
- require 'lucid_local_operation'
9
- require 'lucid_simple_operation'
10
7
  require 'lucid_operation'
11
8
 
12
9
  if RUBY_ENGINE == 'opal'
@@ -1,49 +1,45 @@
1
1
  class LucidOperation
2
2
  extend Preact::PropDeclarationMixin
3
3
  extend Isomorfeus::Operation::GenericClassApi
4
+ include LucidI18nMixin
4
5
 
5
- if RUBY_ENGINE == 'opal'
6
- class << self
7
- def procedure(gherkin_text); end
8
- def steps; end
9
-
10
- alias :gherkin :steps
11
- alias :ensure_steps :steps
12
- alias :failure_steps :steps
13
- alias :Given :steps
14
- alias :And :steps
15
- alias :Then :steps
16
- alias :When :steps
17
- alias :Ensure :steps
18
- alias :Failed :steps
19
- alias :If_failing :steps
20
- alias :When_failing :steps
21
- alias :If_this_failed :steps
22
- alias :If_that_failed :steps
23
- alias :First :steps
24
- alias :Finally :steps
25
- end
26
- else
27
- extend LucidOperation::Steps
28
- include LucidOperation::PromiseRun
6
+ class << self
7
+ if RUBY_ENGINE == 'opal'
8
+ def op; end
9
+ else
10
+ def inherited(base)
11
+ Isomorfeus.add_valid_operation_class(base)
12
+ end
29
13
 
30
- def self.inherited(base)
31
- Isomorfeus.add_valid_operation_class(base)
14
+ def op(&block)
15
+ @op = block
16
+ end
32
17
  end
18
+ end
33
19
 
34
- attr_reader :props
35
- attr_accessor :step_result
20
+ attr_reader :props
36
21
 
37
- def initialize(**props_hash)
38
- @props = self.class.validated_props(props_hash)
39
- end
22
+ def initialize(**props_hash)
23
+ @props = self.class.validated_props(props_hash)
24
+ end
40
25
 
41
- def current_user
42
- Isomorfeus.current_user
43
- end
26
+ def promise_run
27
+ original_promise = Promise.new
44
28
 
45
- def pub_sub_client
46
- Isomorfeus.pub_sub_client
29
+ operation = self
30
+ promise = original_promise.then do |_|
31
+ operation.instance_exec(&operation.class.instance_variable_get(:@op))
47
32
  end
33
+
34
+ original_promise.resolve
35
+ promise
36
+ end
37
+
38
+ def current_user
39
+ Isomorfeus.current_user
40
+ end
41
+
42
+ def pub_sub_client
43
+ Isomorfeus.pub_sub_client
48
44
  end
49
45
  end
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: 23.9.0.rc7
4
+ version: 23.9.0.rc8
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-09-18 00:00:00.000000000 Z
11
+ date: 2023-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -92,84 +92,98 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 23.9.0.rc7
95
+ version: 23.9.0.rc8
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 23.9.0.rc7
102
+ version: 23.9.0.rc8
103
+ - !ruby/object:Gem::Dependency
104
+ name: isomorfeus-i18n
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 23.9.0.rc8
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '='
115
+ - !ruby/object:Gem::Version
116
+ version: 23.9.0.rc8
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: isomorfeus-policy
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - '='
108
122
  - !ruby/object:Gem::Version
109
- version: 23.9.0.rc7
123
+ version: 23.9.0.rc8
110
124
  type: :runtime
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - '='
115
129
  - !ruby/object:Gem::Version
116
- version: 23.9.0.rc7
130
+ version: 23.9.0.rc8
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: isomorfeus-preact
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - '='
122
136
  - !ruby/object:Gem::Version
123
- version: 23.9.0.rc7
137
+ version: 23.9.0.rc8
124
138
  type: :runtime
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - '='
129
143
  - !ruby/object:Gem::Version
130
- version: 23.9.0.rc7
144
+ version: 23.9.0.rc8
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: isomorfeus-redux
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - '='
136
150
  - !ruby/object:Gem::Version
137
- version: 23.9.0.rc7
151
+ version: 23.9.0.rc8
138
152
  type: :runtime
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - '='
143
157
  - !ruby/object:Gem::Version
144
- version: 23.9.0.rc7
158
+ version: 23.9.0.rc8
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: isomorfeus-transport
147
161
  requirement: !ruby/object:Gem::Requirement
148
162
  requirements:
149
163
  - - '='
150
164
  - !ruby/object:Gem::Version
151
- version: 23.9.0.rc7
165
+ version: 23.9.0.rc8
152
166
  type: :runtime
153
167
  prerelease: false
154
168
  version_requirements: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - '='
157
171
  - !ruby/object:Gem::Version
158
- version: 23.9.0.rc7
172
+ version: 23.9.0.rc8
159
173
  - !ruby/object:Gem::Dependency
160
174
  name: isomorfeus
161
175
  requirement: !ruby/object:Gem::Requirement
162
176
  requirements:
163
177
  - - '='
164
178
  - !ruby/object:Gem::Version
165
- version: 23.9.0.rc7
179
+ version: 23.9.0.rc8
166
180
  type: :development
167
181
  prerelease: false
168
182
  version_requirements: !ruby/object:Gem::Requirement
169
183
  requirements:
170
184
  - - '='
171
185
  - !ruby/object:Gem::Version
172
- version: 23.9.0.rc7
186
+ version: 23.9.0.rc8
173
187
  - !ruby/object:Gem::Dependency
174
188
  name: rake
175
189
  requirement: !ruby/object:Gem::Requirement
@@ -215,12 +229,7 @@ files:
215
229
  - lib/isomorfeus/operation/init_timer_tasks.rb
216
230
  - lib/isomorfeus/operation/run_task.rb
217
231
  - lib/isomorfeus/operation/version.rb
218
- - lib/lucid_local_operation.rb
219
232
  - lib/lucid_operation.rb
220
- - lib/lucid_operation/gherkin.rb
221
- - lib/lucid_operation/promise_run.rb
222
- - lib/lucid_operation/steps.rb
223
- - lib/lucid_simple_operation.rb
224
233
  homepage: https://isomorfeus.com
225
234
  licenses:
226
235
  - MIT
@@ -1,32 +0,0 @@
1
- class LucidLocalOperation
2
- extend Preact::PropDeclarationMixin
3
- extend LucidOperation::Steps
4
- include LucidOperation::PromiseRun
5
-
6
- class << self
7
- if RUBY_ENGINE != 'opal'
8
- def inherited(base)
9
- Isomorfeus.add_valid_operation_class(base)
10
- end
11
- end
12
-
13
- def promise_run(**props_hash)
14
- self.new(**props_hash).promise_run
15
- end
16
- end
17
-
18
- attr_reader :props
19
- attr_accessor :step_result
20
-
21
- def initialize(**props_hash)
22
- @props = self.class.validated_props(props_hash)
23
- end
24
-
25
- def current_user
26
- Isomorfeus.current_user
27
- end
28
-
29
- def pub_sub_client
30
- Isomorfeus.pub_sub_client
31
- end
32
- end
@@ -1,63 +0,0 @@
1
- class LucidOperation
2
- module Gherkin
3
- FIRST_EXCEPTION = "First must be the first one that is used and can only used once!"
4
- FINALLY_EXCEPTION = "Finally, except for Ensure and Failed, must be the last one to be used and can only be used once!"
5
-
6
- NEWLINE = /\r?\n/
7
- OPERATION = /^\s*Operation: (.*)$/
8
- PROCEDURE = /^\s*Procedure: (.*)$/
9
- STAR = /^\s*\* (.*)$/
10
- GIVEN = /^\s*Given (.*)$/
11
- WHEN = /^\s*When (.*)$/
12
- THEN = /^\s*Then (.*)$/
13
- AND = /^\s*And (.*)$/
14
- FIRST = /^\s*First (.*)$/
15
- ENSURE = /^\s*Ensure (.*)$/
16
- FINALLY = /^\s*Finally (.*)$/
17
- IW_FAILING = /^\s*(?:When|If) failing (.*)$/
18
- IF_ITT_FAILED = /^\s*If (?:that|this|it) failed (.*)$/
19
- FAILED = /^\s*Failed (.*)$/
20
- COMMENT = /^\s*# (.*)$/
21
- WHITE_SPACE = /^\s*$/
22
-
23
- def self.parse(gherkin_text)
24
- operation = { operation: '', procedure: '', steps: [], failure: [], ensure: [] }
25
- has_finally = false
26
- lines = gherkin_text.split(NEWLINE)
27
-
28
- lines.each do |line|
29
- case line
30
- when STAR, GIVEN, WHEN, THEN, AND
31
- Isomorfeus.raise_error(message: FINALLY_EXCEPTION) if has_finally
32
- operation[:steps] << $1.strip
33
- when ENSURE
34
- operation[:ensure] << $1.strip
35
- when IW_FAILING, IF_ITT_FAILED, FAILED
36
- operation[:failure] << $1.strip
37
- when FIRST
38
- Isomorfeus.raise_error(message: FIRST_EXCEPTION) if operation[:steps].size > 0
39
- operation[:steps] << $1.strip
40
- when FINALLY
41
- Isomorfeus.raise_error(message: FINALLY_EXCEPTION) if has_finally
42
- operation[:steps] << $1.strip
43
- has_finally = true
44
- when PROCEDURE
45
- Isomorfeus.raise_error(message: 'No Operation defined!') if operation[:operation].empty?
46
- Isomorfeus.raise_error(message: 'Procedure already defined!') unless operation[:procedure].empty?
47
- operation[:procedure] = $1.strip
48
- when OPERATION
49
- Isomorfeus.raise_error(message: 'Operation already defined!') unless operation[:operation].empty?
50
- operation[:operation] = $1.strip
51
- when WHITE_SPACE, COMMENT
52
- # nothing, just skip
53
- else
54
- Isomorfeus.raise_error(message: "Unknown key word(s) at the beginning of the line: #{line}") unless operation[:procedure].empty?
55
- operation[:description] = [] unless operation.key?(:description)
56
- operation[:description] << line.strip
57
- end
58
- end
59
-
60
- operation
61
- end
62
- end
63
- end
@@ -1,67 +0,0 @@
1
- class LucidOperation
2
- module PromiseRun
3
- def promise_run
4
- promise = Promise.new
5
- original_promise = promise
6
- operation = self
7
-
8
- # steps
9
- self.class.gherkin[:steps].each do |gherkin_step|
10
- matched = false
11
- self.class.steps.each do |step|
12
- # step[0] -> regular_expression
13
- # step[1] -> block
14
- match_data = gherkin_step.match(step[0])
15
- if match_data
16
- matched = true
17
- promise = promise.then do |result|
18
- operation.step_result = result
19
- operation.instance_exec(*match_data, &step[1])
20
- end
21
- end
22
- end
23
- Isomorfeus.raise_error(message: "No match found for step #{gherkin_step}!") unless matched
24
- end
25
-
26
- # fail track
27
- self.class.gherkin[:failure].each do |gherkin_step|
28
- matched = false
29
- self.class.failure_steps.each do |step|
30
- # step[0] -> regular_expression
31
- # step[1] -> block
32
- match_data = gherkin_step.match(step[0])
33
- if match_data
34
- matched = true
35
- promise = promise.fail do |result|
36
- operation.step_result = result
37
- operation.instance_exec(*match_data, &step[1])
38
- end
39
- end
40
- end
41
- Isomorfeus.raise_error(message: "No match found for failure step #{gherkin_step}!") unless matched
42
- end
43
-
44
- # ensure
45
- self.class.gherkin[:ensure].each do |gherkin_step|
46
- matched = false
47
- self.class.ensure_steps.each do |step|
48
- # step[0] -> regular_expression
49
- # step[1] -> block
50
- match_data = gherkin_step.match(step[0])
51
- if match_data
52
- matched = true
53
-
54
- promise = promise.ensure do |result|
55
- operation.step_result = result
56
- operation.instance_exec(*match_data, &step[1])
57
- end
58
- end
59
- end
60
- Isomorfeus.raise_error(message: "No match found for ensure step #{gherkin_step}!") unless matched
61
- end
62
-
63
- original_promise.resolve
64
- promise
65
- end
66
- end
67
- end
@@ -1,61 +0,0 @@
1
- class LucidOperation
2
- module Steps
3
- def procedure(gherkin_text)
4
- feature_line = gherkin_text.include?('Operation: ') ? '' : "Operation: #{self.name}\n"
5
- scenario_line = feature_line == '' || gherkin_text.include?('Procedure: ') ? '' : " Procedure: #{self.name} executing\n"
6
- @procedure = feature_line + scenario_line + gherkin_text
7
- end
8
-
9
- def gherkin
10
- @gherkin ||= LucidOperation::Gherkin.parse(@procedure)
11
- end
12
-
13
- def ensure_steps
14
- @ensure_steps ||= []
15
- end
16
-
17
- def failure_steps
18
- @failure_steps ||= []
19
- end
20
-
21
- def steps
22
- @steps ||= []
23
- end
24
-
25
- def First(regexp_or_string, &block)
26
- Isomorfeus.raise_error(message: "#{self}: First already defined, can only be defined once!") if @first_defined
27
- @first_defined = true
28
- steps << [_re_from_res(regexp_or_string), block]
29
- end
30
-
31
- def Given(regexp_or_string, &block)
32
- steps << [_re_from_res(regexp_or_string), block]
33
- end
34
- alias :And :Given
35
- alias :Then :Given
36
- alias :When :Given
37
-
38
- def Finally(regexp_or_string, &block)
39
- Isomorfeus.raise_error(message: "#{self}: Finally already defined, can only be defined once!") if @finally_defined
40
- @finally_defined = true
41
- steps << [_re_from_res(regexp_or_string), block]
42
- end
43
-
44
- def Ensure(regexp_or_string, &block)
45
- ensure_steps << [_re_from_res(regexp_or_string), block]
46
- end
47
-
48
- def Failed(regexp_or_string, &block)
49
- failure_steps << [_re_from_res(regexp_or_string), block]
50
- end
51
-
52
- def _re_from_res(regexp_or_string)
53
- regexp_or_string.is_a?(String) ? Regexp.new(regexp_or_string) : regexp_or_string
54
- end
55
-
56
- alias :If_failing :Failed
57
- alias :When_failing :Failed
58
- alias :If_this_failed :Failed
59
- alias :If_that_failed :Failed
60
- end
61
- end
@@ -1,44 +0,0 @@
1
- class LucidSimpleOperation
2
- extend Preact::PropDeclarationMixin
3
- extend Isomorfeus::Operation::GenericClassApi
4
-
5
- class << self
6
- if RUBY_ENGINE == 'opal'
7
- def op; end
8
- else
9
- def inherited(base)
10
- Isomorfeus.add_valid_operation_class(base)
11
- end
12
-
13
- def op(&block)
14
- @op = block
15
- end
16
- end
17
- end
18
-
19
- attr_reader :props
20
-
21
- def initialize(**props_hash)
22
- @props = self.class.validated_props(props_hash)
23
- end
24
-
25
- def promise_run
26
- original_promise = Promise.new
27
-
28
- operation = self
29
- promise = original_promise.then do |_|
30
- operation.instance_exec(&operation.class.instance_variable_get(:@op))
31
- end
32
-
33
- original_promise.resolve
34
- promise
35
- end
36
-
37
- def current_user
38
- Isomorfeus.current_user
39
- end
40
-
41
- def pub_sub_client
42
- Isomorfeus.pub_sub_client
43
- end
44
- end