wisco 0.3.7 → 0.3.8
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 +4 -4
- data/lib/wisco/commands/exec.rb +41 -6
- data/lib/wisco/version.rb +1 -1
- data/lib/wisco.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6489b0aaac5c9626f27141afebc7b4dda9b087c2cf94fee0744b9b603de4953
|
|
4
|
+
data.tar.gz: 298e1469cd688e9d824fd091d32ea84526934637b96e92a4ea19243dfb715e49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b711094e3bf5990c6a591a9a75356660c86d813a76df331f101c8cf48ecbf3d98edcf9f4ede28c4c3cff1448f19991ef89383a1fecb5c78c8a21a3b1a1ce88c
|
|
7
|
+
data.tar.gz: 1581e25abeb992cb6eee659407561df32a47ecbe2cacacf9bb5ea55650eabe27015114c97cf6d5f5bcbba4acbf5593416c1bb5b37ca612f682b7095ba3708ccb
|
data/lib/wisco/commands/exec.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
|
+
require 'tempfile'
|
|
2
3
|
require 'workato/connector/sdk'
|
|
3
4
|
require 'workato/cli/exec_command'
|
|
4
5
|
require_relative '../config'
|
|
@@ -11,7 +12,7 @@ module Wisco
|
|
|
11
12
|
module Exec
|
|
12
13
|
module_function
|
|
13
14
|
|
|
14
|
-
def run(path_arg, target_dir, input: nil, pagination: true, verbose:
|
|
15
|
+
def run(path_arg, target_dir, input: nil, pagination: true, verbose: false, debug: false,
|
|
15
16
|
extended: true, closure: nil, config_fields: nil, continue: nil,
|
|
16
17
|
extended_input_schema: nil, extended_output_schema: nil)
|
|
17
18
|
target_dir = File.expand_path(target_dir)
|
|
@@ -143,7 +144,7 @@ module Wisco
|
|
|
143
144
|
File.dirname(value) == '.' ? File.join(fixtures_dir, value) : value
|
|
144
145
|
end
|
|
145
146
|
|
|
146
|
-
def run_test(target_dir, connector_full_path, connection, verbose:
|
|
147
|
+
def run_test(target_dir, connector_full_path, connection, verbose: false, debug: false)
|
|
147
148
|
puts "Testing connection"
|
|
148
149
|
fixtures_dir = File.join(target_dir, 'fixtures', 'connection', 'test')
|
|
149
150
|
FileUtils.mkdir_p(fixtures_dir)
|
|
@@ -181,7 +182,7 @@ module Wisco
|
|
|
181
182
|
end
|
|
182
183
|
|
|
183
184
|
def execute_one(section, key, input_file, fixtures_dir, connector_full_path, connection,
|
|
184
|
-
pagination: true, verbose:
|
|
185
|
+
pagination: true, verbose: false, debug: false,
|
|
185
186
|
extended: true, closure: nil, config_fields: nil, continue: nil,
|
|
186
187
|
extended_input_schema: nil, extended_output_schema: nil)
|
|
187
188
|
stem = input_file ? File.basename(input_file, '.*') : 'execute'
|
|
@@ -201,7 +202,11 @@ module Wisco
|
|
|
201
202
|
options[:connection] = connection if connection
|
|
202
203
|
options[:verbose] = verbose
|
|
203
204
|
if use_args
|
|
204
|
-
|
|
205
|
+
if input_file && section == 'methods'
|
|
206
|
+
options[:args] = normalize_method_args(input_file)
|
|
207
|
+
elsif input_file
|
|
208
|
+
options[:args] = input_file
|
|
209
|
+
end
|
|
205
210
|
else
|
|
206
211
|
options[:input] = input_file
|
|
207
212
|
end
|
|
@@ -275,7 +280,7 @@ module Wisco
|
|
|
275
280
|
# execute_input.rb -> execute_input/.
|
|
276
281
|
def execute_ruby_script(section, key, script_path, fixtures_dir, target_dir,
|
|
277
282
|
connector_full_path, connection, config,
|
|
278
|
-
pagination: true, verbose:
|
|
283
|
+
pagination: true, verbose: false, debug: false,
|
|
279
284
|
extended: true, closure: nil, config_fields: nil, continue: nil,
|
|
280
285
|
extended_input_schema: nil, extended_output_schema: nil)
|
|
281
286
|
subdir = File.join(fixtures_dir, File.basename(script_path, '.rb'))
|
|
@@ -320,7 +325,7 @@ module Wisco
|
|
|
320
325
|
options[:connection] = connection if connection
|
|
321
326
|
options[:verbose] = verbose
|
|
322
327
|
if use_args
|
|
323
|
-
options[:args] = input_file
|
|
328
|
+
options[:args] = section == 'methods' ? normalize_ruby_method_args(input_file) : input_file
|
|
324
329
|
else
|
|
325
330
|
options[:input] = input_file
|
|
326
331
|
end
|
|
@@ -379,6 +384,36 @@ module Wisco
|
|
|
379
384
|
File.write(output_file, pretty + "\n")
|
|
380
385
|
puts " Written: #{output_file}"
|
|
381
386
|
end
|
|
387
|
+
|
|
388
|
+
# The Workato SDK's InvokePath#invoke_method applies Array.wrap(args.last).flatten(1)
|
|
389
|
+
# when the last parameter is *args, which incorrectly unwraps array-valued positional
|
|
390
|
+
# arguments one level too many. These helpers compensate by pre-wrapping Array elements
|
|
391
|
+
# so that flatten(1) cancels out and the method receives the correct value.
|
|
392
|
+
|
|
393
|
+
# For JSON execute_input files (positional-args array format):
|
|
394
|
+
# [[{h1},{h2}]] → [[[{h1},{h2}]]] so SDK flatten(1) restores [[{h1},{h2}]] → method([{h1},{h2}])
|
|
395
|
+
def normalize_method_args(input_file)
|
|
396
|
+
parsed = JSON.parse(File.read(input_file))
|
|
397
|
+
return input_file unless parsed.is_a?(Array) && parsed.any? { |a| a.is_a?(Array) }
|
|
398
|
+
|
|
399
|
+
fixed = parsed.map { |a| a.is_a?(Array) ? [a] : a }
|
|
400
|
+
tmp = Tempfile.new(['wisco_args_', '.json'])
|
|
401
|
+
tmp.write(JSON.generate(fixed))
|
|
402
|
+
tmp.close
|
|
403
|
+
tmp.path
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# For Ruby-script-generated input files (direct argument value):
|
|
407
|
+
# [{h1},{h2}] → [[{h1},{h2}]] so SDK flatten(1) restores [{h1},{h2}] → method([{h1},{h2}])
|
|
408
|
+
def normalize_ruby_method_args(input_file)
|
|
409
|
+
parsed = JSON.parse(File.read(input_file))
|
|
410
|
+
return input_file unless parsed.is_a?(Array)
|
|
411
|
+
|
|
412
|
+
tmp = Tempfile.new(['wisco_args_', '.json'])
|
|
413
|
+
tmp.write(JSON.generate([parsed]))
|
|
414
|
+
tmp.close
|
|
415
|
+
tmp.path
|
|
416
|
+
end
|
|
382
417
|
end
|
|
383
418
|
end
|
|
384
419
|
end
|
data/lib/wisco/version.rb
CHANGED
data/lib/wisco.rb
CHANGED
|
@@ -90,7 +90,7 @@ module Wisco
|
|
|
90
90
|
option :input, type: :string, desc: 'Specific input file'
|
|
91
91
|
option :pagination, type: :boolean, default: true,
|
|
92
92
|
desc: 'Triggers only: true = .poll (with pagination), false = .poll_page (without)'
|
|
93
|
-
option :verbose, type: :boolean, default:
|
|
93
|
+
option :verbose, type: :boolean, default: false, desc: 'Enable detailed SDK logging'
|
|
94
94
|
option :extended, type: :boolean, default: true,
|
|
95
95
|
desc: 'Auto-pass input_fields/output_fields as extended schema (actions/triggers)'
|
|
96
96
|
option :closure, type: :string, desc: 'Closure JSON file (triggers: simulate subsequent polls)'
|
|
@@ -149,7 +149,7 @@ module Wisco
|
|
|
149
149
|
option :title, type: :string, desc: 'Connector title (default: from config or connector code)'
|
|
150
150
|
option :notes, type: :string, desc: 'Version notes (prompted if not provided)'
|
|
151
151
|
option :folder, type: :numeric, desc: 'Workato folder ID to push connector into'
|
|
152
|
-
option :verbose, type: :boolean, default:
|
|
152
|
+
option :verbose, type: :boolean, default: false, desc: 'Enable detailed SDK logging'
|
|
153
153
|
option :debug, type: :boolean, default: false, desc: 'Show push call details'
|
|
154
154
|
def push(target_dir = nil)
|
|
155
155
|
Wisco::Commands::Push.run(
|
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.
|
|
4
|
+
version: 0.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mbillington
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|