wisco 0.4.0 → 0.4.1

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: 9d0223c07b265d6b699acec69facb0abc3cded752a3b99791454507bf8623490
4
- data.tar.gz: 82b76acb11a65728840067d60bb809f0fb4f88421b0efeac922b967915cef2dc
3
+ metadata.gz: 6d835a3d768c20b2555e1b17ecd61bf1d3363db39b74aa6e2a3cd56c507ec136
4
+ data.tar.gz: 903542f44f76502b94f247337b4c77f6bb34d06c6d84f1f94ef0efab05a97917
5
5
  SHA512:
6
- metadata.gz: 91cae2af261537aa28ab79a66f817fc4095f06c7d2f7cc16281e181872e4d5101b09386cc31793b1d8da09dbf03040946d2b162c41d3705062c4a7b77a5bd7a9
7
- data.tar.gz: 8355aa7b644b559c082d656ca19134b3af9c3a2803f1e31ba7e27b4a31d11af9ea1788a558f259e69d7c4d0af88b5e6f27abf19d223b312c1aa1c273cda93d9b
6
+ metadata.gz: 5cec2439df4a49df18a314a40535acd2d460e1116b80a87e550a356ad02b4a834d94c2c5a921ed342f4994411c5897bd7814d635a7ae0483c17957bc2d55ae31
7
+ data.tar.gz: 19ad6f559d813656907576b53d341f2222bce65e234f0ac42bd6285d8f59f8c55e8f0595a598ca02ec0e2608c8be5c4afe5af278027f3f75af94a62174cc540d
@@ -114,50 +114,51 @@ module Wisco
114
114
  end
115
115
 
116
116
  def build_connector_hash(connector)
117
- {
118
- 'title' => connector[:title].to_s,
119
- 'connection' => build_connection(connector[:connection]),
120
- 'actions' => build_section(connector[:actions]),
121
- 'triggers' => build_section(connector[:triggers]),
122
- 'methods' => (connector[:methods] || {}).keys.map(&:to_s).sort,
123
- 'pick_lists' => (connector[:pick_lists] || {}).keys.map(&:to_s).sort
124
- }
125
- end
126
-
127
- def build_connection(conn)
128
- return { 'fields' => [] } unless conn.is_a?(Hash)
129
-
130
- fields = conn[:fields] || []
131
- { 'fields' => fields.map { |f| safe_serialize(f) }.compact }
132
- end
117
+ # Full connector serialization with context-aware lambda handling
118
+ data = serialize_value(connector, context: :root)
133
119
 
134
- def build_section(section)
135
- return {} unless section.is_a?(Hash)
136
-
137
- section.keys.sort_by(&:to_s).each_with_object({}) do |key, h|
138
- item = section[key]
139
- h[key.to_s] = {
140
- 'title' => title_for(key, item),
141
- 'subtitle' => subtitle_for(item).to_s
142
- }
120
+ # Post-process object_definitions: convert Hash to sorted array of keys
121
+ if data.is_a?(Hash) && data['object_definitions'].is_a?(Hash)
122
+ data['object_definitions'] = data['object_definitions'].keys.map(&:to_s).sort
143
123
  end
124
+
125
+ data
144
126
  end
145
127
 
146
- # Recursively converts a connector value to a JSON-safe structure.
147
- # Proc/lambda values are dropped (returned as nil so callers can compact).
148
- def safe_serialize(value)
128
+ def serialize_value(value, context: nil)
149
129
  case value
130
+ when Proc
131
+ case context
132
+ when :methods, :pick_lists
133
+ # Extract parameter info; format type as string
134
+ {
135
+ 'parameters' => value.parameters.map { |type, name| [type.to_s, name.to_s] }
136
+ }
137
+ else
138
+ # All other lambdas become "__is_lambda__" string
139
+ '__is_lambda__'
140
+ end
150
141
  when Hash
142
+ # Recursively serialize each key-value pair, tracking context
151
143
  value.each_with_object({}) do |(k, v), h|
152
- next if v.is_a?(Proc)
153
-
154
- serialized = safe_serialize(v)
155
- h[k.to_s] = serialized
144
+ next_context = determine_context(k, context)
145
+ h[k.to_s] = serialize_value(v, context: next_context)
156
146
  end
157
- when Array then value.map { |v| safe_serialize(v) }
158
- when Proc then nil
159
- when Symbol then value.to_s
160
- else value
147
+ when Array
148
+ value.map { |v| serialize_value(v, context: context) }
149
+ when Symbol
150
+ value.to_s
151
+ else
152
+ value
153
+ end
154
+ end
155
+
156
+ def determine_context(key, parent_context)
157
+ # When traversing into :methods or :pick_lists hashes, set context for param extraction
158
+ case key
159
+ when :methods then :methods
160
+ when :pick_lists then :pick_lists
161
+ else parent_context
161
162
  end
162
163
  end
163
164
 
data/lib/wisco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wisco
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
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.4.0
4
+ version: 0.4.1
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-14 00:00:00.000000000 Z
11
+ date: 2026-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport