ruby-sfn-local 0.1.12 → 0.1.13

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: 05122d4c47a198bda25cdb97029a921f3e84a081f2bab2283124c8ee4eefb102
4
- data.tar.gz: 212f8edb5259942315dd586ed34c453618adc245164db27b307123b66d9f8ba5
3
+ metadata.gz: 75dd7b0209a27d5fedaac3a899ab43ce8c9cc814ae8736e9ebfab57e11a81397
4
+ data.tar.gz: a4caabe1ecab7fbae2b9a71d3ddd760f95c709813d67c67972248cd15d7628b8
5
5
  SHA512:
6
- metadata.gz: 31b1037fbad8a590aa1df037ab4f57709666e462c8ef9cc05242de74d891461bde6eee0381eaac26b449ef3b7c5864d6df3b6fa7e55ba3403f0e2e9e6cfba77b
7
- data.tar.gz: 128ab49678e6a0d6622811f7610d135ea89d054a2700f915efe40a8e6c37f2259afc84ea08f64c6ca30f72783f33f7b7b83d9fe27cf7168419d45f12037bf653
6
+ metadata.gz: 46d027dcc3ba4688427c36f35ffd40c725a6edef9727320aea01c7c6c100f8dc2933dbe01437104d71546b037ea7830458dccb3e14b1be7cb443c47628077298
7
+ data.tar.gz: 77cc4a235b5e881fac19faff75c9a36c2d57ef08b95a7c941d214bb823166db9149f9e53241a51436ec94c0d8e85965564dbe9caa0b40c3f2caae0fbe2a8fe02
@@ -19,6 +19,7 @@ module Sfn
19
19
 
20
20
  def self.parse(execution_arn)
21
21
  profile = {}
22
+ root_state_name = {}
22
23
  output = nil
23
24
  error = nil
24
25
  state_name = nil
@@ -26,19 +27,19 @@ module Sfn
26
27
  { 'execution-arn': execution_arn.to_s, query: "'events[?#{EVENTS.join(' || ')}]'" })
27
28
  JSON.parse(events_json).each do |event|
28
29
  parsed_event = new(event)
29
-
30
30
  output ||= parsed_event.output
31
31
  error ||= parsed_event.error(events_json)
32
- last_state_name = state_name
33
32
  state_name = parsed_event.state_name
34
33
 
35
34
  unless state_name.nil?
36
35
  profile[state_name] ||= { 'input' => [], 'output' => [], 'parameters' => [] }
37
36
  profile[state_name]['input'] << parsed_event.profile['input'] unless parsed_event.profile['input'].nil?
38
37
  profile[state_name]['output'] << parsed_event.profile['output'] unless parsed_event.profile['output'].nil?
38
+ root_state_name[parsed_event.event['id']] = state_name
39
39
  end
40
- if !last_state_name.nil? && !parsed_event.profile['parameters'].nil?
41
- profile[last_state_name]['parameters'] << parsed_event.profile['parameters']
40
+
41
+ if !root_state_name[parsed_event.event['previousEventId']].nil? && !parsed_event.profile['parameters'].nil?
42
+ profile[root_state_name[parsed_event.event['previousEventId']]]['parameters'] << parsed_event.profile['parameters']
42
43
  end
43
44
  end
44
45
  [output, profile]
@@ -29,7 +29,7 @@ module Sfn
29
29
 
30
30
  def initialize(name, arn = nil)
31
31
  self.path = "#{Sfn.configuration.definition_path}/#{name}.json"
32
- self.name = name.split("/").last
32
+ self.name = name.split('/').last
33
33
  self.arn = arn || self.class.find_by_name(self.name)&.arn || create_state_machine
34
34
  self.executions = {}
35
35
  end
@@ -41,7 +41,7 @@ module Sfn
41
41
  end
42
42
 
43
43
  def run(mock_data = {}, input = {}, test_name = nil)
44
- test_name ||= OpenSSL::Digest::SHA512.digest(mock_data.merge({input: input}).to_json)
44
+ test_name ||= OpenSSL::Digest::SHA512.digest(mock_data.merge({ input: input }).to_json)
45
45
  executions[test_name] ||= Execution.call(self, test_name, mock_data, input)
46
46
  executions[test_name]
47
47
  end
@@ -63,8 +63,8 @@ module Sfn
63
63
 
64
64
  def load_definition
65
65
  local_definition_path = Tempfile.new(['name', '.json']).path
66
-
67
- definition = File.read(self.path)
66
+
67
+ definition = File.read(path)
68
68
  local_definition = definition.gsub(/"MaxConcurrency": [0-9]+/, '"MaxConcurrency": 1')
69
69
 
70
70
  File.open(local_definition_path, 'w') { |file| file.puts local_definition }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-sfn-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianni Mazza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-23 00:00:00.000000000 Z
11
+ date: 2022-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release