wisco 0.3.2 → 0.3.3

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: c5e683d4cb7283e3e673a02b5829a55baf9c6bed86040559a7486492a45a41fb
4
- data.tar.gz: 0f6492a182ba109c8d1fd1d8f607465e0cef50962c212bdad414972a978d5a91
3
+ metadata.gz: 944f817b8530dd052e9f4a1131f73b2fe8006c83e506cae8b0378a14df7149e1
4
+ data.tar.gz: 363f7febaf0e6640c25fd9ff69cd889b9ea5a0eb6ea98854c0691b5bf7790631
5
5
  SHA512:
6
- metadata.gz: 8237b2e29e141a7305a5a4d042aa6708b45889e2ef7af4be30f4df32665044b2cec06ab08fc686fb458bcc228417e8f37883d6b0d35bcb811a81acff99c350b1
7
- data.tar.gz: 699227a3116ba74cf5f0bdf4c686f72a0a10eeac87096f043dd155d59a176c99cb2d7c8a48e2e9eb154956238ecda1ce4f8a8ee19b33b4d9d678f65a0f457aae
6
+ metadata.gz: 7036e05ef5065a57127f77fd18f82b85d1e715f2d7e94b5aa17f41244b1cfd0d89e5f98a969a4b8cc89490604bc439eb10a6506efbd47e3b6b049210b7e769b6
7
+ data.tar.gz: c910579ebe006ea965e90a2e44e71412a768612baff725799939f5cb336cfb5b5610aa59edc9e7779628d7d45b31d33fd8b48b543b550e328a38f02c90538d8c
@@ -10,13 +10,15 @@ module Wisco
10
10
  module Exec
11
11
  module_function
12
12
 
13
- def run(path_arg, target_dir, input: nil, pagination: true, verbose: true, debug: false)
13
+ def run(path_arg, target_dir, input: nil, pagination: true, verbose: true, debug: false,
14
+ extended: true, closure: nil, config_fields: nil, continue: nil,
15
+ extended_input_schema: nil, extended_output_schema: nil)
14
16
  target_dir = File.expand_path(target_dir)
15
17
  config_path = Wisco.config_path(target_dir)
16
18
 
17
19
  unless File.exist?(config_path)
18
- warn "Error: No #{Wisco::WISCO_DIR}/#{Wisco::CONFIG_FILENAME} found in #{target_dir}."
19
- warn " Run '#{Wisco::CLI_NAME} init' first."
20
+ Wisco::TerminalOutput.emit_error("Error: No #{Wisco::WISCO_DIR}/#{Wisco::CONFIG_FILENAME} found in #{target_dir}.")
21
+ Wisco::TerminalOutput.emit_error(" Run '#{Wisco::CLI_NAME} init' first.")
20
22
  exit 1
21
23
  end
22
24
 
@@ -25,7 +27,7 @@ module Wisco
25
27
  connector_file = config.dig('connector', 'file')
26
28
 
27
29
  if connector_path.nil? || connector_file.nil?
28
- warn "Error: #{Wisco::WISCO_DIR}/#{Wisco::CONFIG_FILENAME} is missing connector path/file. Run '#{Wisco::CLI_NAME} init' again."
30
+ Wisco::TerminalOutput.emit_error("Error: #{Wisco::WISCO_DIR}/#{Wisco::CONFIG_FILENAME} is missing connector path/file. Run '#{Wisco::CLI_NAME} init' again.")
29
31
  exit 1
30
32
  end
31
33
 
@@ -47,8 +49,8 @@ module Wisco
47
49
  fixture_dir_output = fixtures_dir.sub(connector_path, '.')
48
50
 
49
51
  unless File.directory?(fixtures_dir)
50
- warn "Error: fixtures directory not found: #{fixture_dir_output}"
51
- warn " Run '#{Wisco::CLI_NAME} fixtures #{section}.#{key}' first."
52
+ Wisco::TerminalOutput.emit_error("Error: fixtures directory not found: #{fixture_dir_output}")
53
+ Wisco::TerminalOutput.emit_error(" Run '#{Wisco::CLI_NAME} fixtures #{section}.#{key}' first.")
52
54
  next
53
55
  end
54
56
 
@@ -58,16 +60,22 @@ module Wisco
58
60
  if %w[pick_lists methods].include?(section)
59
61
  # No-param pick list or method — execute once with no input file
60
62
  execute_one(section, key, nil, fixtures_dir, connector_full_path, connection,
61
- pagination: pagination, verbose: verbose, debug: debug)
63
+ pagination: pagination, verbose: verbose, extended: extended,
64
+ closure: closure, config_fields: config_fields, continue: continue,
65
+ extended_input_schema: extended_input_schema,
66
+ extended_output_schema: extended_output_schema, debug: debug)
62
67
  else
63
- warn "\tWarning: No ready input files found in #{fixture_dir_output}"
68
+ Wisco::TerminalOutput.emit_warning(" Warning: No ready input files found in #{fixture_dir_output}")
64
69
  end
65
70
  next
66
71
  end
67
72
 
68
73
  input_files.each do |input_file|
69
74
  execute_one(section, key, input_file, fixtures_dir,
70
- connector_full_path, connection, pagination: pagination, verbose: verbose, debug: debug)
75
+ connector_full_path, connection, pagination: pagination, verbose: verbose,
76
+ extended: extended, closure: closure, config_fields: config_fields,
77
+ continue: continue, extended_input_schema: extended_input_schema,
78
+ extended_output_schema: extended_output_schema, debug: debug)
71
79
  end
72
80
  end
73
81
  end
@@ -79,7 +87,7 @@ module Wisco
79
87
  if input
80
88
  path = File.absolute_path?(input) ? input : File.join(fixtures_dir, input)
81
89
  unless File.exist?(path)
82
- warn "Error: Input file not found: #{path}"
90
+ Wisco::TerminalOutput.emit_error("Error: Input file not found: #{path}")
83
91
  exit 1
84
92
  end
85
93
  [path]
@@ -99,6 +107,13 @@ module Wisco
99
107
  first_line == Wisco::Commands::Fixtures::SENTINEL
100
108
  end
101
109
 
110
+ # Resolves a user-supplied path option. If the value is a bare filename
111
+ # (no directory component), it is joined to fixtures_dir. Otherwise used as-is.
112
+ def resolve_option_path(value, fixtures_dir)
113
+ return nil if value.nil?
114
+ File.dirname(value) == '.' ? File.join(fixtures_dir, value) : value
115
+ end
116
+
102
117
  def run_test(target_dir, connector_full_path, connection, verbose: true, debug: false)
103
118
  puts "Testing connection"
104
119
  fixtures_dir = File.join(target_dir, 'fixtures', 'connection', 'test')
@@ -123,8 +138,8 @@ module Wisco
123
138
  cmd.call
124
139
  rescue StandardError => e
125
140
  File.write(error_file, "#{e.class}: #{e.message}\n\n#{e.backtrace.join("\n")}\n")
126
- warn "Error testing connection: #{e.message}"
127
- warn " Details written to: #{error_file}"
141
+ Wisco::TerminalOutput.emit_error("Error testing connection: #{e.message}")
142
+ Wisco::TerminalOutput.emit_error(" Details written to: #{error_file}")
128
143
  return
129
144
  end
130
145
 
@@ -137,7 +152,9 @@ module Wisco
137
152
  end
138
153
 
139
154
  def execute_one(section, key, input_file, fixtures_dir, connector_full_path, connection,
140
- pagination: true, verbose: true, debug: false)
155
+ pagination: true, verbose: true, debug: false,
156
+ extended: true, closure: nil, config_fields: nil, continue: nil,
157
+ extended_input_schema: nil, extended_output_schema: nil)
141
158
  stem = input_file ? File.basename(input_file, '.*') : 'execute'
142
159
  output_file = File.join(fixtures_dir, "output_#{stem}.json")
143
160
  error_file = File.join(fixtures_dir, "error_#{stem}.txt")
@@ -160,12 +177,46 @@ module Wisco
160
177
  options[:input] = input_file
161
178
  end
162
179
 
180
+ # ── pass-through workato exec parameters ───────────────────────────
181
+ options[:closure] = resolve_option_path(closure, fixtures_dir) if closure
182
+ options[:config_fields] = resolve_option_path(config_fields, fixtures_dir) if config_fields
183
+ options[:continue] = resolve_option_path(continue, fixtures_dir) if continue
184
+
185
+ # ── extended schema (actions + triggers only) ───────────────────────
186
+ unless use_args
187
+ eis = if extended_input_schema
188
+ resolve_option_path(extended_input_schema, fixtures_dir)
189
+ elsif extended
190
+ f = File.join(fixtures_dir, 'input_fields.json')
191
+ File.exist?(f) ? f : nil
192
+ end
193
+ options[:extended_input_schema] = eis if eis
194
+
195
+ eos = if extended_output_schema
196
+ resolve_option_path(extended_output_schema, fixtures_dir)
197
+ elsif extended
198
+ f = File.join(fixtures_dir, 'output_fields.json')
199
+ File.exist?(f) ? f : nil
200
+ end
201
+ options[:extended_output_schema] = eos if eos
202
+
203
+ if verbose
204
+ Wisco::TerminalOutput.emit_info(" [INFO] extended_input_schema: #{options[:extended_input_schema]}") if options[:extended_input_schema]
205
+ Wisco::TerminalOutput.emit_info(" [INFO] extended_output_schema: #{options[:extended_output_schema]}") if options[:extended_output_schema]
206
+ end
207
+ end
208
+
163
209
  if debug
164
- warn "[exec] path: #{exec_path}"
165
- warn "[exec] connector: #{connector_full_path}"
166
- warn "[exec] connection: #{connection.inspect}"
167
- warn "[exec] #{use_args ? 'args' : 'input'}: #{input_file.inspect}"
168
- warn "[exec] output: #{output_file}"
210
+ warn "[exec] path: #{exec_path}"
211
+ warn "[exec] connector: #{connector_full_path}"
212
+ warn "[exec] connection: #{connection.inspect}"
213
+ warn "[exec] #{use_args ? 'args' : 'input'}: #{input_file.inspect}"
214
+ warn "[exec] output: #{output_file}"
215
+ warn "[exec] closure: #{options[:closure].inspect}" if options[:closure]
216
+ warn "[exec] config_fields:#{options[:config_fields].inspect}" if options[:config_fields]
217
+ warn "[exec] continue: #{options[:continue].inspect}" if options[:continue]
218
+ warn "[exec] ext_input: #{options[:extended_input_schema].inspect}" if options[:extended_input_schema]
219
+ warn "[exec] ext_output: #{options[:extended_output_schema].inspect}" if options[:extended_output_schema]
169
220
  end
170
221
 
171
222
  begin
@@ -173,8 +224,8 @@ module Wisco
173
224
  cmd.call
174
225
  rescue StandardError => e
175
226
  File.write(error_file, "#{e.class}: #{e.message}\n\n#{e.backtrace.join("\n")}\n")
176
- warn "Error executing #{section}.#{key} with #{input_file ? File.basename(input_file) : 'no input'}: #{e.message}"
177
- warn " Details written to: #{error_file}"
227
+ Wisco::TerminalOutput.emit_error("Error executing #{section}.#{key} with #{input_file ? File.basename(input_file) : 'no input'}: #{e.message}")
228
+ Wisco::TerminalOutput.emit_error(" Details written to: #{error_file}")
178
229
  return
179
230
  end
180
231
 
@@ -1,6 +1,7 @@
1
1
  module Wisco
2
2
  module TerminalOutput
3
- RED = 31
3
+ RED = 31
4
+ BLUE = 34
4
5
  YELLOW = 33
5
6
 
6
7
  module_function
@@ -13,6 +14,10 @@ module Wisco
13
14
  warn(colorize(message, YELLOW))
14
15
  end
15
16
 
17
+ def emit_info(message)
18
+ warn(colorize(message, BLUE))
19
+ end
20
+
16
21
  def colorize(message, color_code)
17
22
  return message unless $stderr.tty?
18
23
 
data/lib/wisco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wisco
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
data/lib/wisco.rb CHANGED
@@ -87,15 +87,28 @@ module Wisco
87
87
  option :pagination, type: :boolean, default: true,
88
88
  desc: 'Triggers only: true = .poll (with pagination), false = .poll_page (without)'
89
89
  option :verbose, type: :boolean, default: true, desc: 'Enable detailed SDK logging'
90
+ option :extended, type: :boolean, default: true,
91
+ desc: 'Auto-pass input_fields/output_fields as extended schema (actions/triggers)'
92
+ option :closure, type: :string, desc: 'Closure JSON file (triggers: simulate subsequent polls)'
93
+ option :'config-fields', type: :string, desc: 'config_fields JSON file'
94
+ option :continue, type: :string, desc: 'Continue JSON file (multistep actions)'
95
+ option :'extended-input-schema', type: :string, desc: 'Extended input schema JSON (overrides --extended auto-detection)'
96
+ option :'extended-output-schema', type: :string, desc: 'Extended output schema JSON (overrides --extended auto-detection)'
90
97
  option :debug, type: :boolean, default: false, desc: 'Print ExecCommand call details'
91
98
  def exec(path_arg, target_dir = nil)
92
99
  Wisco::Commands::Exec.run(
93
100
  path_arg,
94
101
  target_dir || Dir.pwd,
95
- input: options[:input],
96
- pagination: options[:pagination],
97
- verbose: options[:verbose],
98
- debug: options[:debug]
102
+ input: options[:input],
103
+ pagination: options[:pagination],
104
+ verbose: options[:verbose],
105
+ extended: options[:extended],
106
+ closure: options[:closure],
107
+ config_fields: options[:config_fields],
108
+ continue: options[:continue],
109
+ extended_input_schema: options[:extended_input_schema],
110
+ extended_output_schema: options[:extended_output_schema],
111
+ debug: options[:debug]
99
112
  )
100
113
  end
101
114
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wisco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mbillington
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-18 00:00:00.000000000 Z
11
+ date: 2026-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport