multiwoven-integrations 0.38.0 → 0.39.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: 6517ac7cba3e8d4ef88e44ea54ba106168a1145ddd028fbb5d12ee15a6d24420
4
- data.tar.gz: aeca6c1672dc44259ec5ef8b71e22e1c28c817d8e4ebf37ac5801fbfefc568ad
3
+ metadata.gz: 8bea6c5689d8543401961ecd7840b04b2e2db88d3401d9d8c59ba09646149da7
4
+ data.tar.gz: e2a9a283a5718016f63ee7a0de2725d017fd5dc4543cd8e05bf1b07f4877a239
5
5
  SHA512:
6
- metadata.gz: b4c29de3371f2c52c9377da307c68cb18dbe21006602dcba6a39d172d452956276213f7efc56bf9990edf6cb6b5b81eaf1534a95ec8cb854f2cbdc9e8be6d77d
7
- data.tar.gz: 3881622dda89bdcdee30bc421344201e8ea8d1c0bd4164911464beeabc5c522b03155edcc19bea8a5e8444f6ec145ef28f8dcd3c1b2d30a631a55925ac229c6b
6
+ metadata.gz: b9df4fb01b5a0834fc5e1475d910da9327e842b104dd0acfb84fb6c33ad394ce90ae57d0fe634d29ef4fab3229313347ff681b46157e0a6313eb1d4677cdf669
7
+ data.tar.gz: 718c8dde52b98bb30bb90d809309edc620a5ff8ff78b7a88f8de7bd219076baf5bf02d97e55b21674602a5349a834243c2796b50dd6b863e5412091981c12380
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.38.0"
5
+ VERSION = "0.39.0"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -36,6 +36,7 @@ module Multiwoven
36
36
  Http
37
37
  Aisquared
38
38
  OneDrive
39
+ MicrosoftDynamics
39
40
  ].freeze
40
41
 
41
42
  ENABLED_DESTINATIONS = %w[
@@ -0,0 +1,327 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven::Integrations::Source
4
+ module MicrosoftDynamics
5
+ include Multiwoven::Integrations::Core
6
+
7
+ API_VERSION = "9.2"
8
+ EXPIRED_ACCESS_TOKEN_ERROR_CODE = "InvalidAuthenticationToken"
9
+ # Dynamics Web API max page size; $skip is not supported, so paging uses @odata.nextLink.
10
+ PAGE_SIZE = 5000
11
+ DYNAMICS_OBJECTS = %w[accounts contacts opportunities leads].freeze
12
+ ENTITY_ORDER_BY = {
13
+ "accounts" => "accountid",
14
+ "contacts" => "contactid",
15
+ "opportunities" => "opportunityid",
16
+ "leads" => "leadid"
17
+ }.freeze
18
+
19
+ class Client < SourceConnector
20
+ def check_connection(connection_config)
21
+ connection_config = connection_config.with_indifferent_access
22
+ create_connection(connection_config)
23
+ response = dynamics_request(whoami_url)
24
+ response_body = JSON.parse(response.body)
25
+
26
+ if success?(response) && response_body.key?("UserId")
27
+ success_status
28
+ else
29
+ failure_status(nil)
30
+ end
31
+ rescue StandardError => e
32
+ handle_exception(e, {
33
+ context: "MICROSOFT:DYNAMICS:CHECK_CONNECTION:EXCEPTION",
34
+ type: "error"
35
+ })
36
+ failure_status(e)
37
+ end
38
+
39
+ def discover(connection_config)
40
+ connection_config = connection_config.with_indifferent_access
41
+ create_connection(connection_config)
42
+
43
+ streams = DYNAMICS_OBJECTS.filter_map do |entity|
44
+ create_stream_for_entity(entity)
45
+ rescue StandardError => e
46
+ handle_exception(e, {
47
+ context: "MICROSOFT:DYNAMICS:DISCOVER:LOOP_EXCEPTION",
48
+ type: "error"
49
+ })
50
+ nil
51
+ end
52
+
53
+ Catalog.new(streams: streams).to_multiwoven_message
54
+ rescue StandardError => e
55
+ handle_exception(e, {
56
+ context: "MICROSOFT:DYNAMICS:DISCOVER:EXCEPTION",
57
+ type: "error"
58
+ })
59
+ end
60
+
61
+ def read(sync_config)
62
+ connection_config = sync_config.source.connection_specification.with_indifferent_access
63
+ @connector_instance = sync_config&.source&.connector_instance
64
+ create_connection(connection_config)
65
+
66
+ query = sync_config.model.query
67
+ query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
68
+ query(nil, query)
69
+ rescue StandardError => e
70
+ handle_exception(e, {
71
+ context: "MICROSOFT:DYNAMICS:READ:EXCEPTION",
72
+ type: "error",
73
+ sync_id: sync_config.sync_id,
74
+ sync_run_id: sync_config.sync_run_id
75
+ })
76
+ end
77
+
78
+ private
79
+
80
+ def create_connection(connection_config)
81
+ load_connection_config(connection_config)
82
+ end
83
+
84
+ def load_connection_config(connection_config)
85
+ @tenant_id = connection_config[:tenant_id]
86
+ @client_id = connection_config[:application_id]
87
+ @instance_url = connection_config[:instance_url]
88
+ @client_secret = connection_config[:client_secret]
89
+ stored_token = @connector_instance&.configuration&.dig("access_token")
90
+ @access_token = stored_token.presence || refresh_access_token
91
+ end
92
+
93
+ def refresh_access_token
94
+ @access_token = fetch_access_token
95
+ persist_access_token(@access_token)
96
+ @access_token
97
+ end
98
+
99
+ def persist_access_token(token)
100
+ return unless @connector_instance&.configuration
101
+
102
+ config = @connector_instance.configuration
103
+ config = {} unless config.is_a?(Hash)
104
+ @connector_instance.update!(configuration: config.merge("access_token" => token))
105
+ end
106
+
107
+ def fetch_access_token
108
+ response = Multiwoven::Integrations::Core::HttpClient.request(
109
+ format(MICROSOFT_GRAPH_TOKEN_URL, tenant_id: @tenant_id),
110
+ HTTP_POST,
111
+ payload: form_urlencoded_payload(
112
+ client_id: @client_id,
113
+ client_secret: @client_secret,
114
+ scope: "https://#{@instance_url}.crm.dynamics.com/.default",
115
+ grant_type: "client_credentials"
116
+ ),
117
+ headers: {
118
+ "Content-Type" => "application/x-www-form-urlencoded"
119
+ }
120
+ )
121
+ raise dynamics_api_error(response.body) unless success?(response)
122
+
123
+ JSON.parse(response.body)["access_token"]
124
+ end
125
+
126
+ def query(_connection, sql_query)
127
+ entity, select_fields, limit, offset = parse_sql_query(sql_query)
128
+ records = fetch_entity_records(entity, select_fields: select_fields, limit: limit, offset: offset)
129
+ records.map do |row|
130
+ RecordMessage.new(data: sanitize_record(row), emitted_at: Time.now.to_i).to_multiwoven_message
131
+ end
132
+ end
133
+
134
+ def create_stream_for_entity(entity)
135
+ records = fetch_entity_records(entity, limit: 1)
136
+ raise StandardError, "No records found for #{entity}" if records.empty?
137
+
138
+ columns = records.first.keys.reject { |key| odata_annotation?(key) }.map do |key|
139
+ { column_name: key, type: "string" }
140
+ end
141
+
142
+ Multiwoven::Integrations::Protocol::Stream.new(
143
+ name: entity,
144
+ action: StreamAction["fetch"],
145
+ json_schema: convert_to_json_schema(columns),
146
+ supported_sync_modes: %w[incremental]
147
+ )
148
+ end
149
+
150
+ def fetch_entity_records(entity, select_fields: nil, limit: nil, offset: nil)
151
+ offset = offset.to_i
152
+ limit = limit&.to_i
153
+ records = []
154
+ skipped = 0
155
+ url = entity_url(
156
+ entity,
157
+ select_fields: select_fields,
158
+ top: page_size_for(limit: limit, offset: offset)
159
+ )
160
+
161
+ while url.present?
162
+ page_records, next_url = fetch_entity_page(url)
163
+ break if page_records.empty?
164
+
165
+ skipped = collect_page_records(
166
+ records,
167
+ page_records,
168
+ offset: offset,
169
+ limit: limit,
170
+ skipped: skipped
171
+ )
172
+ break if limit_reached?(records, limit)
173
+
174
+ url = next_url
175
+ end
176
+
177
+ records
178
+ end
179
+
180
+ def fetch_entity_page(url)
181
+ response = dynamics_request(url)
182
+ raise dynamics_api_error(response.body) unless success?(response)
183
+
184
+ body = JSON.parse(response.body)
185
+ [body["value"] || [], body["@odata.nextLink"]]
186
+ end
187
+
188
+ def collect_page_records(records, page_records, offset:, limit:, skipped:)
189
+ page_records.each do |record|
190
+ if skipped < offset
191
+ skipped += 1
192
+ next
193
+ end
194
+
195
+ records << record
196
+ break if limit_reached?(records, limit)
197
+ end
198
+ skipped
199
+ end
200
+
201
+ def limit_reached?(records, limit)
202
+ limit.present? && limit.positive? && records.size >= limit
203
+ end
204
+
205
+ def parse_sql_query(sql_query)
206
+ query = sql_query.to_s.strip.chomp(";")
207
+ entity = query[/FROM\s+([^\s;]+)/i, 1]
208
+ raise ArgumentError, "Could not extract entity name from query" if entity.blank?
209
+
210
+ select_clause = query[/SELECT\s+(.+?)\s+FROM/i, 1]
211
+ select_fields = if select_clause.nil? || select_clause.strip == "*"
212
+ nil
213
+ else
214
+ select_clause.split(",").map(&:strip)
215
+ end
216
+
217
+ limit = query[/LIMIT\s+(\d+)/i, 1]&.to_i
218
+ offset = query[/OFFSET\s+(\d+)/i, 1]&.to_i
219
+
220
+ [entity, select_fields, limit, offset]
221
+ end
222
+
223
+ # CRM rejects OData $skip ("Skip Clause is not supported").
224
+ # Batching uses $top + @odata.nextLink, applying OFFSET in-process.
225
+ def entity_url(entity, select_fields: nil, top: nil)
226
+ entity = entity.to_s
227
+ raise ArgumentError, "Invalid entity name: #{entity}" unless entity.match?(/\A\w+\z/)
228
+
229
+ base = format(MS_DYNAMICS_REST_API, instance_url: @instance_url, api_version: API_VERSION, entity: entity)
230
+ query_parts = []
231
+ query_parts << "$select=#{URI.encode_www_form_component(select_fields.join(","))}" if select_fields.present?
232
+ order_by = ENTITY_ORDER_BY[entity]
233
+ query_parts << "$orderby=#{URI.encode_www_form_component(order_by)}" if order_by.present?
234
+ query_parts << "$top=#{top.to_i}" if top.present? && top.to_i.positive?
235
+ query_parts.empty? ? base : "#{base}?#{query_parts.join("&")}"
236
+ end
237
+
238
+ def page_size_for(limit:, offset:)
239
+ offset = offset.to_i
240
+ limit = limit&.to_i
241
+ return [PAGE_SIZE, offset + limit].min if offset.positive? && limit.present? && limit.positive?
242
+ return limit if limit.present? && limit.positive?
243
+
244
+ PAGE_SIZE
245
+ end
246
+
247
+ def whoami_url
248
+ format(MS_DYNAMICS_WHOAMI_API, instance_url: @instance_url, api_version: API_VERSION)
249
+ end
250
+
251
+ def dynamics_request(url)
252
+ response = dynamics_http_get(url)
253
+ return response unless expired_access_token_error?(response)
254
+
255
+ refresh_access_token
256
+ dynamics_http_get(url)
257
+ end
258
+
259
+ def dynamics_http_get(url)
260
+ Multiwoven::Integrations::Core::HttpClient.request(
261
+ url,
262
+ HTTP_GET,
263
+ headers: {
264
+ "Accept" => "application/json",
265
+ "Authorization" => "Bearer #{@access_token}",
266
+ "Content-Type" => "application/json"
267
+ }
268
+ )
269
+ end
270
+
271
+ def sanitize_record(record)
272
+ record.each_with_object({}) do |(key, value), result|
273
+ next if odata_annotation?(key)
274
+ next if value.is_a?(Hash) || value.is_a?(Array)
275
+
276
+ result[key] = value
277
+ end
278
+ end
279
+
280
+ def odata_annotation?(key)
281
+ key.to_s.start_with?("@") || key.to_s.include?("@odata")
282
+ end
283
+
284
+ def dynamics_api_error(response_body)
285
+ parsed = JSON.parse(response_body)
286
+ error = parsed["error"]
287
+
288
+ message = if error.is_a?(Hash)
289
+ "#{error["code"]}: #{error["message"]}"
290
+ elsif error.is_a?(String)
291
+ description = parsed["error_description"]
292
+ description.present? ? "#{error}: #{description}" : error
293
+ else
294
+ response_body
295
+ end
296
+
297
+ StandardError.new(message)
298
+ rescue JSON::ParserError, TypeError
299
+ StandardError.new(response_body.to_s)
300
+ end
301
+
302
+ def expired_access_token_error?(response)
303
+ return true if response.code.to_s == "401"
304
+
305
+ error = JSON.parse(response.body)["error"]
306
+ return false unless error.is_a?(Hash)
307
+
308
+ error["code"] == EXPIRED_ACCESS_TOKEN_ERROR_CODE
309
+ rescue JSON::ParserError, TypeError
310
+ false
311
+ end
312
+
313
+ # HttpClient.request always calls payload.to_json.
314
+ # Microsoft OAuth token endpoints require
315
+ # application/x-www-form-urlencoded bodies instead of JSON.
316
+ # This wrapper overrides to_json so HttpClient sends a
317
+ # form-encoded string rather than a JSON document.
318
+ def form_urlencoded_payload(fields)
319
+ payload = Object.new
320
+ payload.define_singleton_method(:to_json) do |*_args|
321
+ URI.encode_www_form(fields)
322
+ end
323
+ payload
324
+ end
325
+ end
326
+ end
327
+ end
@@ -0,0 +1,16 @@
1
+ {
2
+ "data": {
3
+ "name": "MicrosoftDynamics",
4
+ "title": "Microsoft Dynamics",
5
+ "connector_type": "source",
6
+ "category": "Data Warehouse",
7
+ "sub_category": "Relational Database",
8
+ "documentation_url": "https://docs.squared.ai/guides/sources/data-sources/microsoft_dynamics",
9
+ "github_issue_label": "source-microsoft-dynamics",
10
+ "icon": "icon.svg",
11
+ "license": "MIT",
12
+ "release_stage": "alpha",
13
+ "support_level": "community",
14
+ "tags": ["language:ruby", "multiwoven"]
15
+ }
16
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "documentation_url": "https://docs.squared.ai/guides/sources/data-sources/microsoft_dynamics",
3
+ "stream_type": "dynamic",
4
+ "connector_query_type": "raw_sql",
5
+ "connection_specification": {
6
+ "$schema": "http://json-schema.org/draft-07/schema#",
7
+ "title": "Microsoft Dynamics",
8
+ "type": "object",
9
+ "required": ["instance_url", "tenant_id", "application_id", "client_secret"],
10
+ "properties": {
11
+ "instance_url": {
12
+ "type": "string",
13
+ "title": "Organization Name",
14
+ "order": 0
15
+ },
16
+ "tenant_id": {
17
+ "type": "string",
18
+ "multiwoven_secret": true,
19
+ "title": "Tenant ID",
20
+ "order": 1
21
+ },
22
+ "application_id": {
23
+ "type": "string",
24
+ "title": "Application ID",
25
+ "order": 2
26
+ },
27
+ "client_secret": {
28
+ "type": "string",
29
+ "multiwoven_secret": true,
30
+ "title": "Client Secret",
31
+ "order": 3
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
2
+ <svg fill="#000000" width="800px" height="800px" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg"><title>Dynamics 365 icon</title><path d="M4.59 7.41l4.94 3.54L4.59 24zm0-7.41v6.36l9.53 5.29 4.59-3.52zm0 24l14.82-8.47v-6.7Z"/></svg>
@@ -82,6 +82,7 @@ module Multiwoven::Integrations::Source
82
82
  @data_type = connection_config[:data_type]
83
83
  @file_name = connection_config[:file_name]
84
84
  @share_url = connection_config[:share_url]
85
+ @is_recursive = [true, "true"].include?(connection_config[:is_recursive])
85
86
  stored_token = @connector_instance&.configuration&.dig("access_token")
86
87
  @access_token = stored_token.presence || refresh_access_token
87
88
  end
@@ -173,11 +174,12 @@ module Multiwoven::Integrations::Source
173
174
 
174
175
  def list_files_in_folder(_connection_config)
175
176
  files_in_folder.map do |file|
177
+ relative_path = relative_file_path(file)
176
178
  RecordMessage.new(
177
179
  data: {
178
180
  element_id: file["id"],
179
181
  file_name: file["name"],
180
- file_path: file["name"],
182
+ file_path: relative_path,
181
183
  size: file["size"],
182
184
  file_type: File.extname(file["name"]).sub(".", ""),
183
185
  created_date: file["createdDateTime"],
@@ -190,10 +192,12 @@ module Multiwoven::Integrations::Source
190
192
  end
191
193
 
192
194
  def download_unstructured_file(_connection_config, file_path, sync_id)
193
- file_name = resolve_download_file_name(file_path)
194
- file_item = files_in_folder.find { |item| item["name"] == file_name }
195
+ lookup_path = resolve_download_file_name(file_path)
196
+ file_item = find_file_item(lookup_path)
195
197
  raise StandardError, "File not found." if file_item.nil?
196
198
 
199
+ file_name = file_item["name"]
200
+ relative_path = relative_file_path(file_item)
197
201
  local_path = download_file_to_local(
198
202
  file_name,
199
203
  sync_id,
@@ -206,7 +210,7 @@ module Multiwoven::Integrations::Source
206
210
  element_id: file_item["id"],
207
211
  local_path: local_path,
208
212
  file_name: file_name,
209
- file_path: file_name,
213
+ file_path: relative_path,
210
214
  size: file_item["size"],
211
215
  file_type: File.extname(file_name).sub(".", ""),
212
216
  created_date: file_item["createdDateTime"],
@@ -220,19 +224,35 @@ module Multiwoven::Integrations::Source
220
224
  def files_in_folder
221
225
  records = fetch_list_items
222
226
  records["value"].select do |item|
223
- item["folder"].blank? && matching_file_name?(item["name"])
227
+ item["folder"].blank? && matching_file_name?(item["name"], relative_file_path(item))
224
228
  end
225
229
  end
226
230
 
231
+ def find_file_item(lookup_path)
232
+ files = files_in_folder
233
+ exact_match = files.find do |item|
234
+ relative_path = relative_file_path(item)
235
+ relative_path == lookup_path
236
+ end
237
+ return exact_match if exact_match
238
+ return if lookup_path.include?("/")
239
+
240
+ files.find { |item| item["name"] == lookup_path }
241
+ end
242
+
243
+ def relative_file_path(file)
244
+ file["relative_path"].presence || file["name"]
245
+ end
246
+
227
247
  def resolve_download_file_name(file_path)
228
- return File.basename(file_path) unless file_path.to_s.start_with?("http")
248
+ return file_path.to_s.strip unless file_path.to_s.start_with?("http")
229
249
 
230
250
  @file_name.to_s.strip.presence || File.basename(file_path)
231
251
  end
232
252
 
233
- def matching_file_name?(name)
253
+ def matching_file_name?(name, relative_path = nil)
234
254
  configured_name = @file_name.to_s.strip
235
- configured_name.blank? || configured_name == name
255
+ configured_name.blank? || configured_name == name || configured_name == relative_path
236
256
  end
237
257
 
238
258
  def discover_stream_for_file(conn, file)
@@ -240,7 +260,7 @@ module Multiwoven::Integrations::Source
240
260
  columns = build_discover_columns(describe_results)
241
261
 
242
262
  Multiwoven::Integrations::Protocol::Stream.new(
243
- name: stream_name_for(file["name"]),
263
+ name: stream_name_for(file),
244
264
  action: StreamAction["fetch"],
245
265
  json_schema: convert_to_json_schema(columns)
246
266
  )
@@ -289,9 +309,10 @@ module Multiwoven::Integrations::Source
289
309
  def query(connection, query)
290
310
  local_file = nil
291
311
  file_name = extract_file_name_from_query(query)
312
+ local_basename = File.basename(file_name)
292
313
  local_file = download_file_to_local(file_name, @sync_id)
293
314
 
294
- file = read_local_file(connection, file_name, local_file)
315
+ file = read_local_file(connection, local_basename, local_file)
295
316
  query = apply_local_file_to_query(query, file)
296
317
  get_results(connection, query).map do |row|
297
318
  RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
@@ -393,7 +414,8 @@ module Multiwoven::Integrations::Source
393
414
  end
394
415
 
395
416
  def single_file_item_url(file_name)
396
- encoded_file = URI::DEFAULT_PARSER.escape(file_name)
417
+ # Preserve path separators for nested files; encode other unsafe chars.
418
+ encoded_file = file_name.to_s.split("/").map { |segment| URI::DEFAULT_PARSER.escape(segment) }.join("/")
397
419
 
398
420
  if @share_url.present?
399
421
  shared = shared_folder_reference
@@ -440,7 +462,35 @@ module Multiwoven::Integrations::Source
440
462
 
441
463
  return { "value" => [fetch_shared_item_metadata] } if @share_url.present? && shared_folder_reference[:is_file]
442
464
 
443
- paginated_graph_collection(list_items_url)
465
+ collect_files_from_folder(list_items_url, recursive: @is_recursive)
466
+ end
467
+
468
+ # Lists files under the configured folder. When recursive is true, BFS over
469
+ # /children so nested folder files are included in syncs.
470
+ def collect_files_from_folder(root_url, recursive: false)
471
+ files = []
472
+ queue = [[root_url, ""]]
473
+
474
+ until queue.empty?
475
+ url, prefix = queue.shift
476
+ page = paginated_graph_collection(url)
477
+
478
+ page["value"].each do |item|
479
+ relative_path = prefix.empty? ? item["name"].to_s : "#{prefix}/#{item["name"]}"
480
+
481
+ if item["folder"].present?
482
+ next unless recursive
483
+
484
+ drive_id = item.dig("parentReference", "driveId") || @drive_id
485
+ queue << ["#{drive_item_url(drive_id, item["id"])}/children", relative_path]
486
+ else
487
+ item["relative_path"] = relative_path
488
+ files << item
489
+ end
490
+ end
491
+ end
492
+
493
+ { "value" => files }
444
494
  end
445
495
 
446
496
  def fetch_shared_item_metadata
@@ -460,7 +510,9 @@ module Multiwoven::Integrations::Source
460
510
  response = microsoft_graph_request(single_file_item_url(@file_name))
461
511
  raise graph_api_error(response.body) unless success?(response)
462
512
 
463
- JSON.parse(response.body)
513
+ item = JSON.parse(response.body)
514
+ item["relative_path"] = @file_name.to_s.strip
515
+ item
464
516
  end
465
517
 
466
518
  def paginated_graph_collection(url)
@@ -498,14 +550,15 @@ module Multiwoven::Integrations::Source
498
550
  records["value"].select do |record|
499
551
  record["folder"].blank? &&
500
552
  SPREADSHEET_EXTENSIONS.include?(File.extname(record["name"].to_s).downcase) &&
501
- matching_file_name?(record["name"])
553
+ matching_file_name?(record["name"], relative_file_path(record))
502
554
  end
503
555
  end
504
556
 
505
- # Keep the file extension in the stream name — TableSelector generates
506
- # `SELECT * FROM ${stream.name}`, and read_local_file keys off File.extname.
507
- def stream_name_for(file_name)
508
- File.basename(file_name)
557
+ # Keep the relative path (with extension) in the stream name — TableSelector
558
+ # generates `SELECT * FROM ${stream.name}`, and read_local_file keys off
559
+ # File.extname. Relative paths also disambiguate nested duplicates.
560
+ def stream_name_for(file)
561
+ relative_file_path(file)
509
562
  end
510
563
 
511
564
  def encode_sharing_url(url)
@@ -45,6 +45,12 @@
45
45
  "title": "Share URL",
46
46
  "description": "OneDrive or SharePoint sharing link for the folder to read from, skip if using User Name to access Root Folder."
47
47
  },
48
+ "is_recursive": {
49
+ "type": "boolean",
50
+ "title": "Enable recursive",
51
+ "description": "Enables recursive folder traversal. When true, all files and subfolders are read. Default is false, reading only the specified folder.",
52
+ "default": false
53
+ },
48
54
  "file_name": {
49
55
  "type": "string",
50
56
  "title": "File Name",
@@ -102,6 +102,7 @@ require_relative "integrations/source/google_drive/client"
102
102
  require_relative "integrations/source/http/client"
103
103
  require_relative "integrations/source/aisquared/client"
104
104
  require_relative "integrations/source/one_drive/client"
105
+ require_relative "integrations/source/microsoft_dynamics/client"
105
106
 
106
107
  # Destination
107
108
  require_relative "integrations/destination/klaviyo/client"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiwoven-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.38.0
4
+ version: 0.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subin T P
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-17 00:00:00.000000000 Z
11
+ date: 2026-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -802,6 +802,10 @@ files:
802
802
  - lib/multiwoven/integrations/source/maria_db/config/meta.json
803
803
  - lib/multiwoven/integrations/source/maria_db/config/spec.json
804
804
  - lib/multiwoven/integrations/source/maria_db/icon.svg
805
+ - lib/multiwoven/integrations/source/microsoft_dynamics/client.rb
806
+ - lib/multiwoven/integrations/source/microsoft_dynamics/config/meta.json
807
+ - lib/multiwoven/integrations/source/microsoft_dynamics/config/spec.json
808
+ - lib/multiwoven/integrations/source/microsoft_dynamics/icon.svg
805
809
  - lib/multiwoven/integrations/source/odoo/client.rb
806
810
  - lib/multiwoven/integrations/source/odoo/config/meta.json
807
811
  - lib/multiwoven/integrations/source/odoo/config/spec.json