ruby-sfn-local 0.1.28 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1ded192dbca449ce9c35a0fdac5a33cff11a5d6e7c60bf2780de51e93463896
4
- data.tar.gz: 0d3ccddbbded015d1bae65ca6459f68e19581121063d3d9a93e4c31d5402fbba
3
+ metadata.gz: 5f39a29fcb4267d151c127c9cb1bb087225f8bfcec17fcbd86fae7e728509472
4
+ data.tar.gz: 96cf6b8922ef7b7bdb6a77fef72f985bd8212f6386f13a214fa8955fd5f62ccb
5
5
  SHA512:
6
- metadata.gz: e18a67928a60e687dbe05e0ee1947feedfa16c4ecad21f45f2c483bd5efbf2391785b010031d16592ba8b2e7043b8f9a41621d99473721cfb0ef23404c0c70a8
7
- data.tar.gz: 60e1b4cfdfb3497e767dfc1a2ac6afdfad190df3c97141c538500085170858a863f10166a63ec451b04f1387b637b4fe9c4dc90195a05abcc48bda1c6a18d701
6
+ metadata.gz: 02cd2a8099569ab7e0cbf86f38b5b95ac325b8ae3912b406709d93bdf09f70d24f82e63da8c7ace09204d4354d47ab5838c9163034548f8c52cab59f9fa73130
7
+ data.tar.gz: d40f6ee1da4a101fe4e8e226b450518f24784dcda34e93c5de918b5231a05c71da280fb25df51e12a17c0d5b61b54510cb5550d066ac9ff86e4c0ef6a9d2f028
data/lib/hash.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Hash
4
+ def stringify_keys
5
+ h = self.map do |k,v|
6
+ v_str = if v.instance_of? Hash
7
+ v.stringify_keys
8
+ else
9
+ v
10
+ end
11
+
12
+ [k.to_s, v_str]
13
+ end
14
+ Hash[h]
15
+ end
16
+ end
@@ -7,7 +7,7 @@ module Sfn
7
7
  data = [data] if data.is_a?(Hash)
8
8
  data.map! do |val|
9
9
  if val.key?(:error)
10
- { Throw: { Error: val[:error], Cause: val[:cause] } }
10
+ { Return: { Error: val[:error], Cause: val[:cause], Status: 'FAILED' } }
11
11
  else
12
12
  val[:output] ||= val[:payload]
13
13
  val[:output] ||= val[:response]
@@ -39,7 +39,7 @@ module Sfn
39
39
 
40
40
  def self.optimised_step_function_response(data)
41
41
  OptimisedStepFunction.response(data)
42
- end
42
+ end
43
43
 
44
44
  def self.secrets_manager_response(data)
45
45
  SecretsManager.response(data)
@@ -30,7 +30,7 @@ module Sfn
30
30
  def initialize(name, variables = {}, arn = nil)
31
31
  self.path = "#{Sfn.configuration.definition_path}/#{name}.json"
32
32
  self.name = name.split('/').last
33
- self.variables = variables
33
+ self.variables = (variables || {}).stringify_keys
34
34
  self.arn = arn || self.class.find_by_name(self.name)&.arn || create_state_machine
35
35
  self.executions = {}
36
36
  end
@@ -83,7 +83,7 @@ module Sfn
83
83
  local_definition = local_definition.gsub(/,[\s\n]+\}/, "\n}")
84
84
  local_definition = local_definition.gsub(/(\${[a-z_]+})/) do |variable|
85
85
  key = variable.gsub(/[${}]/, '')
86
- variables[key].to_s || variable
86
+ (self.variables[key] || variable).to_s
87
87
  end
88
88
  File.open(local_definition_path, 'w') { |file| file.puts local_definition }
89
89
  "file://#{local_definition_path}"
data/lib/sfn.rb CHANGED
@@ -11,3 +11,4 @@ require 'sfn/mock_macros'
11
11
  require 'sfn/execution'
12
12
  require 'sfn/execution_log'
13
13
  require 'string'
14
+ require 'hash'
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.28
4
+ version: 0.1.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianni Mazza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-02 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release
@@ -58,6 +58,7 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
+ - lib/hash.rb
61
62
  - lib/sfn.rb
62
63
  - lib/sfn/aws_cli.rb
63
64
  - lib/sfn/collection.rb