wisco 0.1.7 → 0.2.0

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: 832da4703274d86e1bc2f5e1684e499b9c4f2de2628c3f0dfb362e23e34213b9
4
- data.tar.gz: 369be3677fdc543c2a0d1a5344e195bf97e05a61d1a9816b6f1993bc521c63af
3
+ metadata.gz: e3f19309282c91c6852cb1f154f9207313d1ad22d6765720f3b343684ce038aa
4
+ data.tar.gz: 9d1283d9cddffa149458e2e951bf519db1ef6d6bf09aaccf8a9e0b963ae2600b
5
5
  SHA512:
6
- metadata.gz: 3c5e906f59c4f5db77e30a8c583e09cea24e02074c89dfb1b9f985a7c3078bf789f17e5723d49d303789f8b0328d1c5a2c8bf80b735ea1706c4834700eef8dcb
7
- data.tar.gz: e474a3f6f3b761f3165366fb335c276f7d73ed2725d50a7dc2bea9fde92decf13b10991a809bc86b2737dbbc558284e8617c4301f321c67dadfe00e127e68eee
6
+ metadata.gz: 640ab92b67cbb771f4e7240f0884fc00afea45a14c4d4797ba4669babd13b4427bf079d9d907fc72ec6219dd8b7b4b013f6587518743f8e5e0c9ab19f20592bb
7
+ data.tar.gz: 07fbe166f632e635a612c1162e2b8b9394bd225a1b08df080296cee2d5ce7332feb418a9fb67637cb7db9f91e28fb863b5c2bee4f08eed49b17e7dbcb19e324d
@@ -42,25 +42,29 @@ module Wisco
42
42
  fixtures_dir = File.join(target_dir, 'fixtures', section, key)
43
43
  FileUtils.mkdir_p(fixtures_dir)
44
44
 
45
- input_fields_file = File.join(fixtures_dir, 'input_fields.json')
46
- call_exec(
47
- path: "#{section}.#{key}.input_fields",
48
- connector: connector_full_path,
49
- connection: connection,
50
- output: input_fields_file,
51
- debug: debug
52
- )
53
-
54
- generate_execute_input(input_fields_file, fixtures_dir, overwrite: overwrite, debug: debug)
55
-
56
- output_fields_file = File.join(fixtures_dir, 'output_fields.json')
57
- call_exec(
58
- path: "#{section}.#{key}.output_fields",
59
- connector: connector_full_path,
60
- connection: connection,
61
- output: output_fields_file,
62
- debug: debug
63
- )
45
+ if section == 'pick_lists'
46
+ process_pick_list(key, connector, fixtures_dir, overwrite: overwrite)
47
+ else
48
+ input_fields_file = File.join(fixtures_dir, 'input_fields.json')
49
+ call_exec(
50
+ path: "#{section}.#{key}.input_fields",
51
+ connector: connector_full_path,
52
+ connection: connection,
53
+ output: input_fields_file,
54
+ debug: debug
55
+ )
56
+
57
+ generate_execute_input(input_fields_file, fixtures_dir, overwrite: overwrite, debug: debug)
58
+
59
+ output_fields_file = File.join(fixtures_dir, 'output_fields.json')
60
+ call_exec(
61
+ path: "#{section}.#{key}.output_fields",
62
+ connector: connector_full_path,
63
+ connection: connection,
64
+ output: output_fields_file,
65
+ debug: debug
66
+ )
67
+ end
64
68
  end
65
69
  end
66
70
 
@@ -120,6 +124,44 @@ module Wisco
120
124
  end
121
125
  end
122
126
 
127
+ def process_pick_list(key, connector, fixtures_dir, overwrite: false)
128
+ pick_list_fn = connector[:pick_lists]&.[](key.to_sym)
129
+
130
+ unless pick_list_fn.respond_to?(:parameters)
131
+ warn " Warning: pick_list '#{key}' is not callable — skipping."
132
+ return
133
+ end
134
+
135
+ # Drop the first parameter (connection); remaining params become input fields
136
+ input_params = pick_list_fn.parameters.drop(1)
137
+
138
+ if input_params.empty?
139
+ puts " No input required: #{fixtures_dir}"
140
+ return
141
+ end
142
+
143
+ output_file = File.join(fixtures_dir, 'execute_input.json')
144
+
145
+ if File.exist?(output_file)
146
+ first_line = begin
147
+ File.open(output_file, &:readline).chomp
148
+ rescue StandardError
149
+ ''
150
+ end
151
+ unless first_line == SENTINEL || overwrite
152
+ puts " Skipped (user-edited): #{output_file}"
153
+ return
154
+ end
155
+ end
156
+
157
+ template = input_params.each_with_object({}) do |(_, name), hash|
158
+ hash[name.to_s] = '<string_value_required>'
159
+ end
160
+ content = "#{SENTINEL}\n#{JSON.pretty_generate(template)}\n"
161
+ File.write(output_file, content)
162
+ puts " Written: #{output_file}"
163
+ end
164
+
123
165
  def call_exec(path:, connector:, connection:, output:, debug: false)
124
166
  options = { connector: connector, output: output }
125
167
  options[:connection] = connection if connection
@@ -123,14 +123,22 @@ module Wisco
123
123
  exit 1
124
124
  end
125
125
 
126
- if results.size > 1
127
- warn "Error: Multiple connectors matched '#{title}':"
128
- results.each { |r| warn " - #{r['title']} (id: #{r['id']}, name: #{r['name']})" }
129
- warn " Use --title with a more specific name."
130
- exit 1
126
+ return results.first if results.size == 1
127
+
128
+ # Multiple matches let the user choose
129
+ puts "Multiple connectors matched '#{title}':"
130
+ results.each_with_index do |r, i|
131
+ puts " #{i + 1}. #{r['title']} (id: #{r['id']}, name: #{r['name']})"
131
132
  end
132
133
 
133
- results.first
134
+ loop do
135
+ print "Enter number to retrieve (1-#{results.size}): "
136
+ input = $stdin.gets.strip
137
+ index = input.to_i
138
+ return results[index - 1] if index >= 1 && index <= results.size
139
+
140
+ warn "Invalid selection. Please enter a number between 1 and #{results.size}."
141
+ end
134
142
  end
135
143
 
136
144
  def handle_http_error(status, context, identifier, body: nil)
@@ -1,6 +1,6 @@
1
1
  module Wisco
2
2
  module PathUtils
3
- VALID_SECTIONS = %w[actions triggers].freeze
3
+ VALID_SECTIONS = %w[actions triggers pick_lists].freeze
4
4
 
5
5
  module_function
6
6
 
@@ -36,19 +36,18 @@ module Wisco
36
36
  items.keys.map { |k| [section, k.to_s] }
37
37
 
38
38
  else
39
- key = path_arg
40
- in_actions = connector[:actions]&.key?(key.to_sym) || false
41
- in_triggers = connector[:triggers]&.key?(key.to_sym) || false
39
+ key = path_arg
40
+ found_in = VALID_SECTIONS.select { |s| connector[s.to_sym]&.key?(key.to_sym) }
42
41
 
43
- case [in_actions, in_triggers]
44
- when [true, false] then [['actions', key]]
45
- when [false, true] then [['triggers', key]]
46
- when [true, true]
47
- warn "Error: '#{key}' exists in both actions and triggers."
48
- warn " Qualify with section, e.g. 'actions.#{key}'."
42
+ case found_in.size
43
+ when 1
44
+ [[found_in.first, key]]
45
+ when 0
46
+ warn "Error: '#{key}' not found in #{VALID_SECTIONS.join(', ')}."
49
47
  exit 1
50
48
  else
51
- warn "Error: '#{key}' not found in actions or triggers."
49
+ warn "Error: '#{key}' exists in multiple sections: #{found_in.join(', ')}."
50
+ warn " Qualify with section, e.g. '#{found_in.first}.#{key}'."
52
51
  exit 1
53
52
  end
54
53
  end
data/lib/wisco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wisco
2
- VERSION = '0.1.7'
2
+ VERSION = '0.2.0'
3
3
  end
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.1.7
4
+ version: 0.2.0
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-10 00:00:00.000000000 Z
11
+ date: 2026-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,7 +52,10 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
- description:
55
+ description: "Wisco is a command-line interface (CLI) tool designed to assist developers
56
+ in creating and managing Workato connectors. \nIt extends the capabilities of the
57
+ official Workato Connector SDK by providing additional features and streamlining
58
+ common tasks, making the development process more efficient and user-friendly.\n"
56
59
  email:
57
60
  executables:
58
61
  - wisco
@@ -94,5 +97,5 @@ requirements: []
94
97
  rubygems_version: 3.1.6
95
98
  signing_key:
96
99
  specification_version: 4
97
- summary: Workato Connector SDK Companion
100
+ summary: A CLI tool to assist with developing and managing Workato connectors.
98
101
  test_files: []