workato-connector-sdk 1.3.5 → 1.3.7

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: 538607c7c1f2bff7a43d83f040b2eb9115a11dea69ea9ebb2d81a1610cc03bf0
4
- data.tar.gz: 23daea74845d804a8d3cd0be23c5315ada9e11a68413b231ddda2feea57a5133
3
+ metadata.gz: 49aa4824f123bf7b6601d8b2a341fee4c06f2b51142ddbcb6a86d59199018265
4
+ data.tar.gz: be9fedf954b6dac11edd5b41458b5a8a649e388e4407ee044521912e9eccbfd5
5
5
  SHA512:
6
- metadata.gz: d86d537e4f371a1e7e0f76910ef1ac0122af39e0b562409d2fbfe3a17c8e9f19e63a1ea81724e32ddf4b8518b0b0f85f67fbded70e1c3a09595d12ef66f89158
7
- data.tar.gz: cb52d1548bee52561f15c3900a65258f251410156c43875d6450ba30e16e532a54a23f4bf71de111733826c86a0302ba540670ce034542bf4c7c23e0311bca0c
6
+ metadata.gz: 56a7885ec1f441f2df917eebb703632825c3a978252d25cbb74ad683c41c9a2ca9625cec83f7a9dadb2b8a046f7da5d3ff8445ec192118c15ad208f653d6e23d
7
+ data.tar.gz: 0262d744fcc2c96fa6bf602ebd0c18b0b52165833e66a93b52dea7cdbd5d1c7c5e6b6731aa9c029369738634f1f0f4426866637b577af486fc33075ac0470df5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.5
1
+ 1.3.7
@@ -3,8 +3,6 @@
3
3
 
4
4
  require_relative 'block_invocation_refinements'
5
5
 
6
- using Workato::Extension::HashWithIndifferentAccess
7
-
8
6
  module Workato
9
7
  module Connector
10
8
  module Sdk
@@ -13,19 +11,29 @@ module Workato
13
11
  T.any(
14
12
  # oauth2
15
13
  [
16
- HashWithIndifferentAccess, # tokens
14
+ ActiveSupport::HashWithIndifferentAccess, # tokens
17
15
  T.untyped, # resource_owner_id
18
- T.nilable(HashWithIndifferentAccess) # settings
16
+ T.nilable(ActiveSupport::HashWithIndifferentAccess) # settings
19
17
  ],
20
18
  [
21
- HashWithIndifferentAccess, # tokens
19
+ ActiveSupport::HashWithIndifferentAccess, # tokens
22
20
  T.untyped # resource_owner_id
23
21
  ],
24
22
  [
25
- HashWithIndifferentAccess # tokens
23
+ ActiveSupport::HashWithIndifferentAccess # tokens
26
24
  ],
27
25
  # custom_auth
28
- HashWithIndifferentAccess
26
+ ActiveSupport::HashWithIndifferentAccess
27
+ )
28
+ end
29
+
30
+ RefreshOutput = T.type_alias do
31
+ T.any(
32
+ [
33
+ ActiveSupport::HashWithIndifferentAccess,
34
+ T.nilable(String)
35
+ ],
36
+ ActiveSupport::HashWithIndifferentAccess
29
37
  )
30
38
  end
31
39
  end
@@ -37,7 +45,7 @@ module Workato
37
45
  using BlockInvocationRefinements
38
46
 
39
47
  # @api private
40
- sig { returns(HashWithIndifferentAccess) }
48
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
41
49
  attr_reader :source
42
50
 
43
51
  class_attribute :on_settings_update, instance_predicate: false
@@ -52,8 +60,14 @@ module Workato
52
60
  end
53
61
  def initialize(connection: {}, methods: {}, settings: {})
54
62
  super()
55
- @methods_source = T.let(HashWithIndifferentAccess.wrap(methods), HashWithIndifferentAccess)
56
- @source = T.let(HashWithIndifferentAccess.wrap(connection), HashWithIndifferentAccess)
63
+ @methods_source = T.let(
64
+ Utilities::HashWithIndifferentAccess.wrap(methods),
65
+ ActiveSupport::HashWithIndifferentAccess
66
+ )
67
+ @source = T.let(
68
+ Utilities::HashWithIndifferentAccess.wrap(connection),
69
+ ActiveSupport::HashWithIndifferentAccess
70
+ )
57
71
  @settings = T.let(settings, SorbetTypes::SettingsHash)
58
72
  end
59
73
 
@@ -64,7 +78,7 @@ module Workato
64
78
  end
65
79
 
66
80
  # @api private
67
- sig { returns(HashWithIndifferentAccess) }
81
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
68
82
  def settings
69
83
  # we can't freeze or memoise because some developers modify it for storing something temporary in it.
70
84
  # always return a new copy
@@ -89,11 +103,13 @@ module Workato
89
103
  def authorization
90
104
  raise ::NotImplementedError, 'define authorization: before use' if source[:authorization].blank?
91
105
 
92
- @authorization = T.let(@authorization, T.nilable(Authorization))
93
- @authorization ||= Authorization.new(
94
- connection: self,
95
- authorization: source[:authorization],
96
- methods: methods_source
106
+ @authorization ||= T.let(
107
+ Authorization.new(
108
+ connection: self,
109
+ authorization: source[:authorization],
110
+ methods: methods_source
111
+ ),
112
+ T.nilable(Authorization)
97
113
  )
98
114
  end
99
115
 
@@ -137,7 +153,7 @@ module Workato
137
153
 
138
154
  private
139
155
 
140
- sig { returns(HashWithIndifferentAccess) }
156
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
141
157
  attr_reader :methods_source
142
158
 
143
159
  sig { returns(Dsl::WithDsl) }
@@ -151,15 +167,15 @@ module Workato
151
167
  sig do
152
168
  params(
153
169
  connection: Connection,
154
- authorization: HashWithIndifferentAccess,
155
- methods: HashWithIndifferentAccess
170
+ authorization: ActiveSupport::HashWithIndifferentAccess,
171
+ methods: ActiveSupport::HashWithIndifferentAccess
156
172
  ).void
157
173
  end
158
174
  def initialize(connection:, authorization:, methods:)
159
175
  @connection = T.let(connection, Connection)
160
- @connection_source = T.let(connection.source, HashWithIndifferentAccess)
161
- @source = T.let(authorization, HashWithIndifferentAccess)
162
- @methods_source = T.let(methods, HashWithIndifferentAccess)
176
+ @connection_source = T.let(connection.source, ActiveSupport::HashWithIndifferentAccess)
177
+ @source = T.let(authorization, ActiveSupport::HashWithIndifferentAccess)
178
+ @methods_source = T.let(methods, ActiveSupport::HashWithIndifferentAccess)
163
179
  end
164
180
 
165
181
  sig { returns(String) }
@@ -243,7 +259,7 @@ module Workato
243
259
  connection: Connection.new(
244
260
  connection: connection_source.merge(
245
261
  authorization: source.merge(
246
- apply: nil # only skip apply authorization for re-authorization request
262
+ apply: nil # only skip apply authorization for re-authorization request, but don't skip detect_on
247
263
  )
248
264
  ),
249
265
  methods: methods_source,
@@ -255,6 +271,11 @@ module Workato
255
271
  end
256
272
  end
257
273
 
274
+ sig { returns(T::Boolean) }
275
+ def reauthorizable?
276
+ oauth2? || source[:acquire].present?
277
+ end
278
+
258
279
  sig do
259
280
  params(
260
281
  http_code: T.nilable(Integer),
@@ -263,7 +284,7 @@ module Workato
263
284
  ).returns(T::Boolean)
264
285
  end
265
286
  def refresh?(http_code, http_body, exception)
266
- return false unless oauth2? || source[:acquire].present?
287
+ return false unless reauthorizable?
267
288
 
268
289
  refresh_on = self.refresh_on
269
290
  refresh_on.blank? || refresh_on.any? do |pattern|
@@ -274,12 +295,16 @@ module Workato
274
295
  end
275
296
 
276
297
  # @api private
277
- sig { params(settings: HashWithIndifferentAccess).returns(T.nilable(HashWithIndifferentAccess)) }
298
+ sig do
299
+ params(
300
+ settings: ActiveSupport::HashWithIndifferentAccess
301
+ ).returns(T.nilable(ActiveSupport::HashWithIndifferentAccess))
302
+ end
278
303
  def refresh!(settings)
279
304
  if oauth2?
280
305
  refresh_oauth2_token(settings)
281
306
  elsif source[:acquire].present?
282
- T.cast(acquire(settings), T.nilable(HashWithIndifferentAccess))
307
+ T.cast(acquire(settings), T.nilable(ActiveSupport::HashWithIndifferentAccess))
283
308
  end
284
309
  end
285
310
 
@@ -287,9 +312,7 @@ module Workato
287
312
  params(
288
313
  settings: T.nilable(SorbetTypes::SettingsHash),
289
314
  refresh_token: T.nilable(String)
290
- ).returns(
291
- T.any([HashWithIndifferentAccess, T.nilable(String)], HashWithIndifferentAccess)
292
- )
315
+ ).returns(SorbetTypes::RefreshOutput)
293
316
  end
294
317
  def refresh(settings = nil, refresh_token = nil)
295
318
  @connection.merge_settings!(settings) if settings
@@ -308,7 +331,7 @@ module Workato
308
331
  end
309
332
 
310
333
  # @api private
311
- sig { returns(HashWithIndifferentAccess) }
334
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
312
335
  def source
313
336
  return @source unless multi?
314
337
 
@@ -331,13 +354,17 @@ module Workato
331
354
 
332
355
  private
333
356
 
334
- sig { returns(HashWithIndifferentAccess) }
357
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
335
358
  attr_reader :connection_source
336
359
 
337
- sig { returns(HashWithIndifferentAccess) }
360
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
338
361
  attr_reader :methods_source
339
362
 
340
- sig { params(settings: HashWithIndifferentAccess).returns(HashWithIndifferentAccess) }
363
+ sig do
364
+ params(
365
+ settings: ActiveSupport::HashWithIndifferentAccess
366
+ ).returns(ActiveSupport::HashWithIndifferentAccess)
367
+ end
341
368
  def refresh_oauth2_token(settings)
342
369
  if source[:refresh].present?
343
370
  refresh_oauth2_token_using_refresh(settings)
@@ -348,16 +375,24 @@ module Workato
348
375
  end
349
376
  end
350
377
 
351
- sig { params(settings: HashWithIndifferentAccess).returns(HashWithIndifferentAccess) }
378
+ sig do
379
+ params(
380
+ settings: ActiveSupport::HashWithIndifferentAccess
381
+ ).returns(ActiveSupport::HashWithIndifferentAccess)
382
+ end
352
383
  def refresh_oauth2_token_using_refresh(settings)
353
384
  new_tokens, new_settings = refresh(settings, settings[:refresh_token])
354
- new_tokens = HashWithIndifferentAccess.wrap(new_tokens)
385
+ new_tokens = Utilities::HashWithIndifferentAccess.wrap(new_tokens)
355
386
  return new_tokens unless new_settings
356
387
 
357
388
  new_tokens.merge(new_settings)
358
389
  end
359
390
 
360
- sig { params(settings: HashWithIndifferentAccess).returns(HashWithIndifferentAccess) }
391
+ sig do
392
+ params(
393
+ settings: ActiveSupport::HashWithIndifferentAccess
394
+ ).returns(ActiveSupport::HashWithIndifferentAccess)
395
+ end
361
396
  def refresh_oauth2_token_using_token_url(settings)
362
397
  if settings[:refresh_token].blank?
363
398
  raise NotImplementedError, 'refresh_token is empty. ' \
@@ -1,20 +1,20 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
9
7
  module SorbetTypes
10
- SourceHash = T.type_alias { T.any(HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped]) }
8
+ SourceHash = T.type_alias do
9
+ T.any(ActiveSupport::HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped])
10
+ end
11
11
  end
12
12
 
13
13
  class Connector
14
14
  extend T::Sig
15
15
 
16
16
  # @api private
17
- sig { returns(HashWithIndifferentAccess) }
17
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
18
18
  attr_reader :source
19
19
 
20
20
  sig { params(path_to_source_code: String, settings: SorbetTypes::SettingsHash).returns(Connector) }
@@ -24,10 +24,22 @@ module Workato
24
24
 
25
25
  sig { params(definition: SorbetTypes::SourceHash, settings: SorbetTypes::SettingsHash).void }
26
26
  def initialize(definition, settings = {})
27
- @source = T.let(HashWithIndifferentAccess.wrap(definition), HashWithIndifferentAccess)
28
- @settings = T.let(HashWithIndifferentAccess.wrap(settings), HashWithIndifferentAccess)
29
- @connection_source = T.let(HashWithIndifferentAccess.wrap(@source[:connection]), HashWithIndifferentAccess)
30
- @methods_source = T.let(HashWithIndifferentAccess.wrap(@source[:methods]), HashWithIndifferentAccess)
27
+ @source = T.let(
28
+ Utilities::HashWithIndifferentAccess.wrap(definition),
29
+ ActiveSupport::HashWithIndifferentAccess
30
+ )
31
+ @settings = T.let(
32
+ Utilities::HashWithIndifferentAccess.wrap(settings),
33
+ ActiveSupport::HashWithIndifferentAccess
34
+ )
35
+ @connection_source = T.let(
36
+ Utilities::HashWithIndifferentAccess.wrap(@source[:connection]),
37
+ ActiveSupport::HashWithIndifferentAccess
38
+ )
39
+ @methods_source = T.let(
40
+ Utilities::HashWithIndifferentAccess.wrap(@source[:methods]),
41
+ ActiveSupport::HashWithIndifferentAccess
42
+ )
31
43
  end
32
44
 
33
45
  sig { returns(T.nilable(String)) }
@@ -37,23 +49,27 @@ module Workato
37
49
 
38
50
  sig { returns(ActionsProxy) }
39
51
  def actions
40
- @actions = T.let(@actions, T.nilable(ActionsProxy))
41
- @actions ||= ActionsProxy.new(
42
- actions: source[:actions].presence || {},
43
- methods: methods_source,
44
- object_definitions: object_definitions,
45
- connection: connection,
46
- streams: streams
52
+ @actions ||= T.let(
53
+ ActionsProxy.new(
54
+ actions: source[:actions].presence || {},
55
+ methods: methods_source,
56
+ object_definitions: object_definitions,
57
+ connection: connection,
58
+ streams: streams
59
+ ),
60
+ T.nilable(ActionsProxy)
47
61
  )
48
62
  end
49
63
 
50
64
  sig { returns(MethodsProxy) }
51
65
  def methods
52
- @methods = T.let(@methods, T.nilable(MethodsProxy))
53
- @methods ||= MethodsProxy.new(
54
- methods: methods_source,
55
- connection: connection,
56
- streams: streams
66
+ @methods ||= T.let(
67
+ MethodsProxy.new(
68
+ methods: methods_source,
69
+ connection: connection,
70
+ streams: streams
71
+ ),
72
+ T.nilable(MethodsProxy)
57
73
  )
58
74
  end
59
75
 
@@ -72,64 +88,74 @@ module Workato
72
88
 
73
89
  sig { returns(TriggersProxy) }
74
90
  def triggers
75
- @triggers = T.let(@triggers, T.nilable(TriggersProxy))
76
- @triggers ||= TriggersProxy.new(
77
- triggers: source[:triggers].presence || {},
78
- methods: methods_source,
79
- connection: connection,
80
- object_definitions: object_definitions,
81
- streams: streams
91
+ @triggers ||= T.let(
92
+ TriggersProxy.new(
93
+ triggers: source[:triggers].presence || {},
94
+ methods: methods_source,
95
+ connection: connection,
96
+ object_definitions: object_definitions,
97
+ streams: streams
98
+ ),
99
+ T.nilable(TriggersProxy)
82
100
  )
83
101
  end
84
102
 
85
103
  sig { returns(ObjectDefinitions) }
86
104
  def object_definitions
87
- @object_definitions = T.let(@object_definitions, T.nilable(ObjectDefinitions))
88
- @object_definitions ||= ObjectDefinitions.new(
89
- object_definitions: source[:object_definitions].presence || {},
90
- methods: methods_source,
91
- connection: connection
105
+ @object_definitions ||= T.let(
106
+ ObjectDefinitions.new(
107
+ object_definitions: source[:object_definitions].presence || {},
108
+ methods: methods_source,
109
+ connection: connection
110
+ ),
111
+ T.nilable(ObjectDefinitions)
92
112
  )
93
113
  end
94
114
 
95
115
  sig { returns(PickListsProxy) }
96
116
  def pick_lists
97
- @pick_lists = T.let(@pick_lists, T.nilable(PickListsProxy))
98
- @pick_lists ||= PickListsProxy.new(
99
- pick_lists: source[:pick_lists].presence || {},
100
- methods: methods_source,
101
- connection: connection
117
+ @pick_lists ||= T.let(
118
+ PickListsProxy.new(
119
+ pick_lists: source[:pick_lists].presence || {},
120
+ methods: methods_source,
121
+ connection: connection
122
+ ),
123
+ T.nilable(PickListsProxy)
102
124
  )
103
125
  end
104
126
 
105
127
  sig { returns(Connection) }
106
128
  def connection
107
- @connection = T.let(@connection, T.nilable(Connection))
108
- @connection ||= Connection.new(
109
- methods: methods_source,
110
- connection: connection_source,
111
- settings: settings
129
+ @connection ||= T.let(
130
+ Connection.new(
131
+ methods: methods_source,
132
+ connection: connection_source,
133
+ settings: settings
134
+ ),
135
+ T.nilable(Connection)
112
136
  )
113
137
  end
114
138
 
115
139
  sig { returns(Streams) }
116
140
  def streams
117
- @streams = T.let(@streams, T.nilable(Streams))
118
- @streams ||= Streams.new(
119
- streams: streams_sources,
120
- methods: methods_source,
121
- connection: connection
141
+ @streams ||= T.let(
142
+ Streams.new(
143
+ streams: streams_sources,
144
+ methods: methods_source,
145
+ connection: connection
146
+ ),
147
+ T.nilable(Streams)
122
148
  )
123
149
  end
124
150
 
125
151
  private
126
152
 
127
- sig { returns(HashWithIndifferentAccess) }
153
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
128
154
  def streams_sources
129
- @streams_sources = T.let(@streams_sources, T.nilable(HashWithIndifferentAccess))
155
+ @streams_sources = T.let(@streams_sources, T.nilable(ActiveSupport::HashWithIndifferentAccess))
130
156
  return @streams_sources if @streams_sources
131
157
 
132
- @streams_sources = HashWithIndifferentAccess.new
158
+ @streams_sources = ActiveSupport::HashWithIndifferentAccess.new
133
159
  @streams_sources.merge!(source[:streams].presence || {})
134
160
  (source[:actions] || {}).values.map do |action|
135
161
  @streams_sources.merge!(action[:streams] || {})
@@ -140,10 +166,10 @@ module Workato
140
166
  @streams_sources
141
167
  end
142
168
 
143
- sig { returns(HashWithIndifferentAccess) }
169
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
144
170
  attr_reader :methods_source
145
171
 
146
- sig { returns(HashWithIndifferentAccess) }
172
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
147
173
  attr_reader :connection_source
148
174
 
149
175
  sig { returns(SorbetTypes::SettingsHash) }
@@ -155,9 +181,9 @@ module Workato
155
181
 
156
182
  sig do
157
183
  params(
158
- actions: HashWithIndifferentAccess,
184
+ actions: ActiveSupport::HashWithIndifferentAccess,
159
185
  object_definitions: ObjectDefinitions,
160
- methods: HashWithIndifferentAccess,
186
+ methods: ActiveSupport::HashWithIndifferentAccess,
161
187
  connection: Connection,
162
188
  streams: Streams
163
189
  ).void
@@ -178,7 +204,7 @@ module Workato
178
204
 
179
205
  private
180
206
 
181
- sig { returns(HashWithIndifferentAccess) }
207
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
182
208
  attr_reader :methods
183
209
 
184
210
  sig { returns(Connection) }
@@ -190,7 +216,7 @@ module Workato
190
216
  sig { returns(ObjectDefinitions) }
191
217
  attr_reader :object_definitions
192
218
 
193
- sig { params(actions_source: HashWithIndifferentAccess).void }
219
+ sig { params(actions_source: ActiveSupport::HashWithIndifferentAccess).void }
194
220
  def define_action_methods(actions_source)
195
221
  actions_source.each do |action, definition|
196
222
  define_singleton_method(action) do |input_ = nil|
@@ -216,7 +242,7 @@ module Workato
216
242
 
217
243
  sig do
218
244
  params(
219
- methods: HashWithIndifferentAccess,
245
+ methods: ActiveSupport::HashWithIndifferentAccess,
220
246
  connection: Connection,
221
247
  streams: Streams
222
248
  ).void
@@ -231,7 +257,7 @@ module Workato
231
257
 
232
258
  private
233
259
 
234
- sig { returns(HashWithIndifferentAccess) }
260
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
235
261
  attr_reader :methods
236
262
 
237
263
  sig { returns(Connection) }
@@ -265,8 +291,8 @@ module Workato
265
291
 
266
292
  sig do
267
293
  params(
268
- pick_lists: HashWithIndifferentAccess,
269
- methods: HashWithIndifferentAccess,
294
+ pick_lists: ActiveSupport::HashWithIndifferentAccess,
295
+ methods: ActiveSupport::HashWithIndifferentAccess,
270
296
  connection: Connection
271
297
  ).void
272
298
  end
@@ -279,13 +305,13 @@ module Workato
279
305
 
280
306
  private
281
307
 
282
- sig { returns(HashWithIndifferentAccess) }
308
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
283
309
  attr_reader :methods
284
310
 
285
311
  sig { returns(Connection) }
286
312
  attr_reader :connection
287
313
 
288
- sig { params(pick_lists_source: HashWithIndifferentAccess).void }
314
+ sig { params(pick_lists_source: ActiveSupport::HashWithIndifferentAccess).void }
289
315
  def define_action_methods(pick_lists_source)
290
316
  pick_lists_source.each do |pick_list, pick_list_proc|
291
317
  define_singleton_method(pick_list) do |settings = nil, args = {}|
@@ -318,9 +344,9 @@ module Workato
318
344
 
319
345
  sig do
320
346
  params(
321
- triggers: HashWithIndifferentAccess,
347
+ triggers: ActiveSupport::HashWithIndifferentAccess,
322
348
  object_definitions: ObjectDefinitions,
323
- methods: HashWithIndifferentAccess,
349
+ methods: ActiveSupport::HashWithIndifferentAccess,
324
350
  connection: Connection,
325
351
  streams: Streams
326
352
  ).void
@@ -341,7 +367,7 @@ module Workato
341
367
 
342
368
  private
343
369
 
344
- sig { returns(HashWithIndifferentAccess) }
370
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
345
371
  attr_reader :methods
346
372
 
347
373
  sig { returns(Connection) }
@@ -353,7 +379,7 @@ module Workato
353
379
  sig { returns(ObjectDefinitions) }
354
380
  attr_reader :object_definitions
355
381
 
356
- sig { params(triggers_source: HashWithIndifferentAccess).void }
382
+ sig { params(triggers_source: ActiveSupport::HashWithIndifferentAccess).void }
357
383
  def define_trigger_methods(triggers_source)
358
384
  triggers_source.each do |trigger, definition|
359
385
  define_singleton_method(trigger) do |input_ = nil, payload = {}, headers = {}, params = {}|
@@ -42,7 +42,7 @@ module Workato
42
42
  end
43
43
  end
44
44
 
45
- require_relative '../../extension/hash_with_indifferent_access'
45
+ require 'workato/utilities/hash_with_indifferent_access'
46
46
 
47
47
  require_relative 'errors'
48
48
  require_relative 'account_properties'
@@ -4,8 +4,6 @@
4
4
  require 'aws-sigv4'
5
5
  require 'workato/utilities/xml'
6
6
 
7
- using Workato::Extension::HashWithIndifferentAccess
8
-
9
7
  module Workato
10
8
  module Connector
11
9
  module Sdk
@@ -68,7 +66,7 @@ module Workato
68
66
  method: method,
69
67
  path: path,
70
68
  params: params,
71
- headers: HashWithIndifferentAccess.wrap(headers),
69
+ headers: Utilities::HashWithIndifferentAccess.wrap(headers),
72
70
  payload: payload
73
71
  )
74
72
 
@@ -74,8 +74,7 @@ module Workato
74
74
 
75
75
  sig { returns(Integer) }
76
76
  def reinvoke_limit
77
- @reinvoke_limit = T.let(@reinvoke_limit, T.nilable(Integer))
78
- @reinvoke_limit ||= (ENV['MAX_REINVOKES'].presence || MAX_REINVOKES).to_i
77
+ @reinvoke_limit ||= T.let((ENV['MAX_REINVOKES'].presence || MAX_REINVOKES).to_i, T.nilable(Integer))
79
78
  end
80
79
  end
81
80
  end
@@ -6,8 +6,6 @@ require_relative 'csv_package'
6
6
  require_relative 'net_package'
7
7
  require_relative 'stream_package'
8
8
 
9
- using Workato::Extension::HashWithIndifferentAccess
10
-
11
9
  module Workato
12
10
  module Connector
13
11
  module Sdk
@@ -72,9 +70,9 @@ module Workato
72
70
  end
73
71
  end
74
72
 
75
- header_fields = HashWithIndifferentAccess.wrap(header_fields)
76
- .except(:typ, :alg)
77
- .reverse_merge(typ: 'JWT', alg: algorithm)
73
+ header_fields = Utilities::HashWithIndifferentAccess.wrap(header_fields)
74
+ .except(:typ, :alg)
75
+ .reverse_merge(typ: 'JWT', alg: algorithm)
78
76
 
79
77
  ::JWT.encode(payload, key, algorithm, header_fields)
80
78
  rescue JWT::IncorrectAlgorithm
@@ -104,6 +102,8 @@ module Workato
104
102
  raise Sdk::ArgumentError, 'Mismatched algorithm and key'
105
103
  rescue OpenSSL::PKey::PKeyError
106
104
  raise Sdk::ArgumentError, 'Invalid key'
105
+ rescue JWT::VerificationError
106
+ raise Sdk::ArgumentError, 'Invalid signature'
107
107
  end
108
108
 
109
109
  def verify_rsa(payload, certificate, signature, algorithm = 'SHA256')
@@ -174,6 +174,8 @@ module Workato
174
174
  cipher.key = key
175
175
  cipher.iv = init_vector if init_vector.present?
176
176
  Types::Binary.new(cipher.update(string) + cipher.final)
177
+ rescue OpenSSL::Cipher::CipherError => e
178
+ raise Sdk::ArgumentError, e.message
177
179
  end
178
180
 
179
181
  def pbkdf2_hmac_sha1(string, salt, iterations = 1000, key_len = 16)
@@ -4,8 +4,6 @@
4
4
  require 'csv'
5
5
  require 'singleton'
6
6
 
7
- using Workato::Extension::HashWithIndifferentAccess
8
-
9
7
  module Workato
10
8
  module Connector
11
9
  module Sdk
@@ -42,7 +40,7 @@ module Workato
42
40
  @table_by_id ||= {}
43
41
  @table_by_name ||= {}
44
42
  data.each do |name, table|
45
- table = HashWithIndifferentAccess.wrap(table)
43
+ table = Utilities::HashWithIndifferentAccess.wrap(table)
46
44
  rows = table['rows'].freeze
47
45
  @table_by_id[table['id'].to_i] = rows
48
46
  @table_by_name[name] = rows
@@ -7,7 +7,7 @@ module Workato
7
7
  module Connector
8
8
  module Sdk
9
9
  module SorbetTypes
10
- ObjectDefinitionOutput = T.type_alias { T::Array[HashWithIndifferentAccess] }
10
+ ObjectDefinitionOutput = T.type_alias { T::Array[ActiveSupport::HashWithIndifferentAccess] }
11
11
  end
12
12
 
13
13
  class ObjectDefinitions
@@ -34,7 +34,7 @@ module Workato
34
34
  params(
35
35
  settings: T.nilable(SorbetTypes::SettingsHash),
36
36
  config_fields: SorbetTypes::OperationInputHash
37
- ).returns(HashWithIndifferentAccess)
37
+ ).returns(ActiveSupport::HashWithIndifferentAccess)
38
38
  end
39
39
  def lazy(settings = nil, config_fields = {})
40
40
  DupHashWithIndifferentAccess.new do |object_definitions, name|
@@ -99,7 +99,7 @@ module Workato
99
99
 
100
100
  private_constant :ObjectDefinition
101
101
 
102
- class DupHashWithIndifferentAccess < HashWithIndifferentAccess
102
+ class DupHashWithIndifferentAccess < ActiveSupport::HashWithIndifferentAccess
103
103
  extend T::Sig
104
104
  extend T::Generic
105
105
 
@@ -5,8 +5,6 @@ require_relative 'dsl'
5
5
  require_relative 'block_invocation_refinements'
6
6
  require_relative 'schema'
7
7
 
8
- using Workato::Extension::HashWithIndifferentAccess
9
-
10
8
  module Workato
11
9
  module Connector
12
10
  module Sdk
@@ -15,11 +13,11 @@ module Workato
15
13
 
16
14
  OperationExecuteProc = T.type_alias do
17
15
  T.proc.params(
18
- arg0: HashWithIndifferentAccess,
19
- arg1: HashWithIndifferentAccess,
20
- arg2: T.any(Schema, T::Array[HashWithIndifferentAccess]),
21
- arg3: T.any(Schema, T::Array[HashWithIndifferentAccess]),
22
- arg4: HashWithIndifferentAccess
16
+ arg0: ActiveSupport::HashWithIndifferentAccess,
17
+ arg1: ActiveSupport::HashWithIndifferentAccess,
18
+ arg2: T.any(Schema, T::Array[ActiveSupport::HashWithIndifferentAccess]),
19
+ arg3: T.any(Schema, T::Array[ActiveSupport::HashWithIndifferentAccess]),
20
+ arg4: ActiveSupport::HashWithIndifferentAccess
23
21
  ).returns(
24
22
  T.untyped
25
23
  )
@@ -31,9 +29,9 @@ module Workato
31
29
 
32
30
  OperationSchemaProc = T.type_alias do
33
31
  T.proc.params(
34
- arg0: HashWithIndifferentAccess,
35
- arg1: HashWithIndifferentAccess,
36
- arg2: HashWithIndifferentAccess
32
+ arg0: ActiveSupport::HashWithIndifferentAccess,
33
+ arg1: ActiveSupport::HashWithIndifferentAccess,
34
+ arg2: ActiveSupport::HashWithIndifferentAccess
37
35
  ).returns(
38
36
  T.nilable(T.any(SorbetTypes::OperationSchema, T::Hash[T.any(Symbol, String), T.untyped]))
39
37
  )
@@ -66,8 +64,14 @@ module Workato
66
64
  end
67
65
  def initialize(operation: {}, methods: {}, connection: Connection.new, streams: ProhibitedStreams.new,
68
66
  object_definitions: nil)
69
- @operation = T.let(HashWithIndifferentAccess.wrap(operation), HashWithIndifferentAccess)
70
- @_methods = T.let(HashWithIndifferentAccess.wrap(methods), HashWithIndifferentAccess)
67
+ @operation = T.let(
68
+ Utilities::HashWithIndifferentAccess.wrap(operation),
69
+ ActiveSupport::HashWithIndifferentAccess
70
+ )
71
+ @_methods = T.let(
72
+ Utilities::HashWithIndifferentAccess.wrap(methods),
73
+ ActiveSupport::HashWithIndifferentAccess
74
+ )
71
75
  @connection = T.let(connection, Connection)
72
76
  @streams = T.let(streams, Streams)
73
77
  @object_definitions = T.let(object_definitions, T.nilable(ObjectDefinitions))
@@ -90,10 +94,10 @@ module Workato
90
94
  connection.merge_settings!(settings) if settings
91
95
  request_or_result = T.unsafe(self).instance_exec(
92
96
  connection.settings,
93
- HashWithIndifferentAccess.wrap(input),
94
- Array.wrap(extended_input_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
95
- Array.wrap(extended_output_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
96
- HashWithIndifferentAccess.wrap(continue),
97
+ Utilities::HashWithIndifferentAccess.wrap(input),
98
+ Array.wrap(extended_input_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
99
+ Array.wrap(extended_output_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
100
+ Utilities::HashWithIndifferentAccess.wrap(continue),
97
101
  &block
98
102
  )
99
103
  result = resolve_request(request_or_result)
@@ -105,7 +109,7 @@ module Workato
105
109
  settings: T.nilable(SorbetTypes::SettingsHash),
106
110
  config_fields: SorbetTypes::OperationInputHash
107
111
  ).returns(
108
- HashWithIndifferentAccess
112
+ ActiveSupport::HashWithIndifferentAccess
109
113
  )
110
114
  end
111
115
  def extended_schema(settings = nil, config_fields = {})
@@ -200,7 +204,7 @@ module Workato
200
204
 
201
205
  sig do
202
206
  params(
203
- object_definitions_hash: HashWithIndifferentAccess,
207
+ object_definitions_hash: ActiveSupport::HashWithIndifferentAccess,
204
208
  settings: T.nilable(SorbetTypes::SettingsHash),
205
209
  config_fields: SorbetTypes::OperationInputHash,
206
210
  schema_proc: T.nilable(SorbetTypes::OperationSchemaProc)
@@ -253,7 +257,7 @@ module Workato
253
257
  def try_convert_to_hash_with_indifferent_access(value)
254
258
  case value
255
259
  when ::Hash
256
- HashWithIndifferentAccess.wrap(value)
260
+ Utilities::HashWithIndifferentAccess.wrap(value)
257
261
  when ::Array
258
262
  value.map! { |i| try_convert_to_hash_with_indifferent_access(i) }
259
263
  else
@@ -266,7 +270,7 @@ module Workato
266
270
  T.must(@object_definitions)
267
271
  end
268
272
 
269
- sig { returns(HashWithIndifferentAccess) }
273
+ sig { returns(ActiveSupport::HashWithIndifferentAccess) }
270
274
  attr_reader :operation
271
275
 
272
276
  sig { override.returns(Connection) }
@@ -13,8 +13,6 @@ require 'workato/utilities/encoding'
13
13
  require 'workato/utilities/xml'
14
14
  require_relative 'block_invocation_refinements'
15
15
 
16
- using Workato::Extension::HashWithIndifferentAccess
17
-
18
16
  module Workato
19
17
  module Connector
20
18
  module Sdk
@@ -32,9 +30,9 @@ module Workato
32
30
  @action = action
33
31
  @headers = {}
34
32
  @case_sensitive_headers = {}
35
- @render_request = ->(payload) { payload }
36
- @parse_response = ->(payload) { payload }
37
- @after_response = ->(_response_code, parsed_response, _response_headers) { parsed_response }
33
+ @render_request = DEFAULT_RENDER_REQUEST
34
+ @parse_response = DEFAULT_PARSE_RESPONSE
35
+ @after_response = DEFAULT_AFTER_RESPONSE
38
36
  @callstack_before_request = Array.wrap(Kernel.caller)
39
37
  end
40
38
 
@@ -77,7 +75,7 @@ module Workato
77
75
 
78
76
  def params(params)
79
77
  if params.is_a?(Hash)
80
- @params ||= HashWithIndifferentAccess.new
78
+ @params ||= ActiveSupport::HashWithIndifferentAccess.new
81
79
  @params.merge!(params)
82
80
  else
83
81
  @params = params
@@ -87,12 +85,15 @@ module Workato
87
85
 
88
86
  def payload(payload = nil)
89
87
  if defined?(@payload) || payload.is_a?(Hash)
90
- @payload ||= HashWithIndifferentAccess.new
88
+ @payload ||= ActiveSupport::HashWithIndifferentAccess.new
91
89
  @payload.merge!(payload) if payload
92
90
  else
93
91
  @payload = payload
94
92
  end
95
- yield(@payload) if Kernel.block_given?
93
+ if Kernel.block_given?
94
+ @payload ||= ActiveSupport::HashWithIndifferentAccess.new
95
+ yield(@payload)
96
+ end
96
97
  self
97
98
  end
98
99
 
@@ -256,6 +257,15 @@ module Workato
256
257
 
257
258
  private
258
259
 
260
+ DEFAULT_RENDER_REQUEST = ->(_) {}
261
+ private_constant :DEFAULT_RENDER_REQUEST
262
+
263
+ DEFAULT_PARSE_RESPONSE = ->(payload) { payload }
264
+ private_constant :DEFAULT_PARSE_RESPONSE
265
+
266
+ DEFAULT_AFTER_RESPONSE = ->(_response_code, parsed_response, _response_headers) { parsed_response }
267
+ private_constant :DEFAULT_AFTER_RESPONSE
268
+
259
269
  attr_reader :method
260
270
 
261
271
  def response
@@ -363,7 +373,7 @@ module Workato
363
373
  end
364
374
 
365
375
  def detect_auth_error!(response)
366
- return unless authorized?
376
+ return unless authorization? && connection.authorization.reauthorizable?
367
377
 
368
378
  error_patterns = connection.authorization.detect_on
369
379
  return unless error_patterns.any? { |pattern| pattern === response rescue false }
@@ -390,14 +400,15 @@ module Workato
390
400
  within_action_context(
391
401
  exception.http_code,
392
402
  exception.http_body,
393
- HashWithIndifferentAccess.wrap(exception.http_headers),
403
+ Utilities::HashWithIndifferentAccess.wrap(exception.http_headers),
394
404
  exception.message,
395
405
  &@after_error_response
396
406
  )
397
407
  end
398
408
 
399
409
  def apply_after_response(code, parsed_response, headers)
400
- encoded_headers = (headers || {}).each_with_object(HashWithIndifferentAccess.new) do |(k, v), h|
410
+ headers ||= {}
411
+ encoded_headers = headers.each_with_object(ActiveSupport::HashWithIndifferentAccess.new) do |(k, v), h|
401
412
  h[k] = Workato::Utilities::Encoding.force_best_encoding!(v.to_s)
402
413
  end
403
414
  within_action_context(code, parsed_response, encoded_headers, &@after_response)
@@ -408,12 +419,12 @@ module Workato
408
419
  end
409
420
 
410
421
  sig { returns(T::Boolean) }
411
- def authorized?
422
+ def authorization?
412
423
  !!@connection&.authorization?
413
424
  end
414
425
 
415
426
  def authorized
416
- return yield unless authorized?
427
+ return yield unless authorization?
417
428
 
418
429
  apply = connection.authorization.source[:apply] || connection.authorization.source[:credentials]
419
430
  return yield unless apply
@@ -438,11 +449,11 @@ module Workato
438
449
 
439
450
  sig do
440
451
  params(
441
- settings: HashWithIndifferentAccess,
452
+ settings: ActiveSupport::HashWithIndifferentAccess,
442
453
  access_token: T.untyped,
443
454
  auth_type: T.untyped,
444
455
  apply_proc: T.proc.params(
445
- settings: HashWithIndifferentAccess,
456
+ settings: ActiveSupport::HashWithIndifferentAccess,
446
457
  access_token: T.untyped,
447
458
  auth_type: T.untyped
448
459
  ).void
@@ -454,10 +465,10 @@ module Workato
454
465
 
455
466
  sig do
456
467
  params(
457
- settings: HashWithIndifferentAccess,
468
+ settings: ActiveSupport::HashWithIndifferentAccess,
458
469
  auth_type: T.untyped,
459
470
  apply_proc: T.proc.params(
460
- settings: HashWithIndifferentAccess,
471
+ settings: ActiveSupport::HashWithIndifferentAccess,
461
472
  auth_type: T.untyped
462
473
  ).void
463
474
  ).void
@@ -468,7 +479,7 @@ module Workato
468
479
 
469
480
  sig do
470
481
  params(
471
- settings_before: HashWithIndifferentAccess,
482
+ settings_before: ActiveSupport::HashWithIndifferentAccess,
472
483
  http_code: T.nilable(Integer),
473
484
  http_body: T.nilable(String),
474
485
  exception: T.nilable(String)
@@ -1,22 +1,20 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
9
7
  class Schema < SimpleDelegator
10
8
  def initialize(schema: [])
11
- super(Fields.new(::Array.wrap(schema).map { |i| HashWithIndifferentAccess.wrap(i) }))
9
+ super(Fields.new(::Array.wrap(schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) }))
12
10
  end
13
11
 
14
12
  def trim(input)
15
- HashWithIndifferentAccess.wrap(input).keep_if { |property_name| includes_property?(property_name) }
13
+ Utilities::HashWithIndifferentAccess.wrap(input).keep_if { |property_name| includes_property?(property_name) }
16
14
  end
17
15
 
18
16
  def apply(input, enforce_required:, &block)
19
- HashWithIndifferentAccess.wrap(input).tap do |input_with_indifferent_access|
17
+ Utilities::HashWithIndifferentAccess.wrap(input).tap do |input_with_indifferent_access|
20
18
  apply_to_hash(self, input_with_indifferent_access, enforce_required: enforce_required, &block)
21
19
  end
22
20
  end
@@ -3,13 +3,13 @@
3
3
 
4
4
  require 'active_support/encrypted_configuration'
5
5
 
6
- using Workato::Extension::HashWithIndifferentAccess
7
-
8
6
  module Workato
9
7
  module Connector
10
8
  module Sdk
11
9
  module SorbetTypes
12
- SettingsHash = T.type_alias { T.any(HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped]) }
10
+ SettingsHash = T.type_alias do
11
+ T.any(ActiveSupport::HashWithIndifferentAccess, T::Hash[T.any(Symbol, String), T.untyped])
12
+ end
13
13
  end
14
14
 
15
15
  class Settings
@@ -100,13 +100,13 @@ module Workato
100
100
  end
101
101
 
102
102
  def read_encrypted_file
103
- all_settings = HashWithIndifferentAccess.wrap(encrypted_configuration.config)
103
+ all_settings = Utilities::HashWithIndifferentAccess.wrap(encrypted_configuration.config)
104
104
 
105
105
  (name ? all_settings.fetch(name) : all_settings) || {}
106
106
  end
107
107
 
108
108
  def update_encrypted_file(new_settings)
109
- all_settings = HashWithIndifferentAccess.wrap(encrypted_configuration.config)
109
+ all_settings = Utilities::HashWithIndifferentAccess.wrap(encrypted_configuration.config)
110
110
 
111
111
  merge_settings(all_settings, new_settings)
112
112
 
@@ -1,8 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
@@ -152,7 +150,7 @@ module Workato
152
150
  when Proc
153
151
  Proxy.new(
154
152
  name: hash[:name],
155
- input: HashWithIndifferentAccess.wrap(hash[:input] || {}),
153
+ input: Utilities::HashWithIndifferentAccess.wrap(hash[:input] || {}),
156
154
  stream: Stream.new(
157
155
  stream: hash[:chunks],
158
156
  connection: Connection.new(
@@ -1,8 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- using Workato::Extension::HashWithIndifferentAccess
5
-
6
4
  module Workato
7
5
  module Connector
8
6
  module Sdk
@@ -3,8 +3,6 @@
3
3
 
4
4
  require 'securerandom'
5
5
 
6
- using Workato::Extension::HashWithIndifferentAccess
7
-
8
6
  module Workato
9
7
  module Connector
10
8
  module Sdk
@@ -145,14 +143,14 @@ module Workato
145
143
  )
146
144
  connection.merge_settings!(settings) if settings
147
145
  output = global_dsl_context.execute(
148
- HashWithIndifferentAccess.wrap(input),
146
+ Utilities::HashWithIndifferentAccess.wrap(input),
149
147
  payload,
150
- Array.wrap(extended_input_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
151
- Array.wrap(extended_output_schema).map { |i| HashWithIndifferentAccess.wrap(i) },
152
- HashWithIndifferentAccess.wrap(headers),
153
- HashWithIndifferentAccess.wrap(params),
148
+ Array.wrap(extended_input_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
149
+ Array.wrap(extended_output_schema).map { |i| Utilities::HashWithIndifferentAccess.wrap(i) },
150
+ Utilities::HashWithIndifferentAccess.wrap(headers),
151
+ Utilities::HashWithIndifferentAccess.wrap(params),
154
152
  connection.settings,
155
- HashWithIndifferentAccess.wrap(webhook_subscribe_output),
153
+ Utilities::HashWithIndifferentAccess.wrap(webhook_subscribe_output),
156
154
  &trigger[:webhook_notification]
157
155
  )
158
156
  if output.is_a?(::Array)
@@ -18,7 +18,6 @@ require_relative '../extension/date'
18
18
  require_relative '../extension/enumerable'
19
19
  require_relative '../extension/extra_chain_cert'
20
20
  require_relative '../extension/hash'
21
- require_relative '../extension/hash_with_indifferent_access'
22
21
  require_relative '../extension/integer'
23
22
  require_relative '../extension/nil_class'
24
23
  require_relative '../extension/object'
@@ -18,7 +18,7 @@ module Enumerable
18
18
  end
19
19
 
20
20
  map do |val|
21
- format % (Array.wrap(val).map { |v| v.is_a?(HashWithIndifferentAccess) ? v.symbolize_keys : v })
21
+ format % (Array.wrap(val).map { |v| v.is_a?(ActiveSupport::HashWithIndifferentAccess) ? v.symbolize_keys : v })
22
22
  end
23
23
  end
24
24
 
@@ -143,6 +143,15 @@ module Workato
143
143
  Types::Binary.new(::Digest::SHA256.digest(self))
144
144
  end
145
145
 
146
+ def encode_sha512
147
+ Types::Binary.new(::Digest::SHA512.digest(self))
148
+ end
149
+
150
+ def encode_sha512_256 # rubocop:disable Naming/VariableNumber
151
+ digest = ::OpenSSL::Digest.new('sha512-256', self)
152
+ Types::Binary.new(digest.to_s)
153
+ end
154
+
146
155
  def hmac_sha256(key)
147
156
  digest = ::OpenSSL::Digest.new('sha256')
148
157
  Types::Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
@@ -159,6 +168,14 @@ module Workato
159
168
  Types::Binary.new(private_key.sign(digest, self))
160
169
  end
161
170
 
171
+ def rsa_sha512(key)
172
+ digest = ::OpenSSL::Digest.new('sha512')
173
+ private_key = ::OpenSSL::PKey::RSA.new(key)
174
+ Types::Binary.new(private_key.sign(digest, self))
175
+ rescue OpenSSL::PKey::RSAError => e
176
+ Kernel.raise(Workato::Connector::Sdk::ArgumentError, e.message)
177
+ end
178
+
162
179
  def md5_hexdigest
163
180
  ::Digest::MD5.hexdigest(self)
164
181
  end
@@ -1,14 +1,17 @@
1
- # typed: false
1
+ # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'active_support/hash_with_indifferent_access'
5
5
 
6
6
  module Workato
7
- module Extension
7
+ module Utilities
8
8
  module HashWithIndifferentAccess
9
- refine ::ActiveSupport::HashWithIndifferentAccess.singleton_class do
9
+ class << self
10
+ extend T::Sig
11
+
12
+ sig { params(value: T.untyped).returns(ActiveSupport::HashWithIndifferentAccess) }
10
13
  def wrap(value)
11
- return ::ActiveSupport::HashWithIndifferentAccess.new unless value
14
+ return ActiveSupport::HashWithIndifferentAccess.new unless value
12
15
  return value if value.is_a?(ActiveSupport::HashWithIndifferentAccess)
13
16
 
14
17
  value.with_indifferent_access
@@ -14,7 +14,7 @@ module Workato
14
14
  ancestors.shift while ancestors.count > node.depth + 1
15
15
  case node.node_type
16
16
  when Nokogiri::XML::Reader::TYPE_ELEMENT
17
- element = HashWithIndifferentAccess.new
17
+ element = ActiveSupport::HashWithIndifferentAccess.new
18
18
  node.attributes&.each do |name, value|
19
19
  element["@#{strip_namespaces ? name[/(?:^xmlns:)?[^:]+$/] : name}"] = value
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workato-connector-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Abolmasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-21 00:00:00.000000000 Z
11
+ date: 2023-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -383,7 +383,6 @@ files:
383
383
  - lib/workato/extension/enumerable.rb
384
384
  - lib/workato/extension/extra_chain_cert.rb
385
385
  - lib/workato/extension/hash.rb
386
- - lib/workato/extension/hash_with_indifferent_access.rb
387
386
  - lib/workato/extension/integer.rb
388
387
  - lib/workato/extension/metadata_fix_wrap_kw_args.rb
389
388
  - lib/workato/extension/nil_class.rb
@@ -397,6 +396,7 @@ files:
397
396
  - lib/workato/types/binary.rb
398
397
  - lib/workato/types/unicode_string.rb
399
398
  - lib/workato/utilities/encoding.rb
399
+ - lib/workato/utilities/hash_with_indifferent_access.rb
400
400
  - lib/workato/utilities/xml.rb
401
401
  - lib/workato/web/app.rb
402
402
  - templates/.rspec.erb
@@ -439,7 +439,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
439
439
  - !ruby/object:Gem::Version
440
440
  version: '0'
441
441
  requirements: []
442
- rubygems_version: 3.2.3
442
+ rubygems_version: 3.4.10
443
443
  signing_key:
444
444
  specification_version: 4
445
445
  summary: Gem for running adapter's code outside Workato infrastructure