multiwoven-integrations 0.1.48 → 0.1.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/schema_helper.rb +3 -2
- data/lib/multiwoven/integrations/rollout.rb +1 -1
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/client.rb +15 -4
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/schema_helper.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: b2ec8669076a7a0b2efcb2d782776a6ce40a225f40ae0ebe63f56c04a526c1e1
|
4
|
+
data.tar.gz: 8234a7d9f7f11a5cde6c20d6ef9f954111f3757a272c89037359899c8eab5de0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61d15b55378dffb0448080079d34665899980219f7ce7341aa74c241818298d2cb17fd261e2c33e82dd37df846a8b57ace50dd2ec3d6772bfc60ecd5fb9bb798
|
7
|
+
data.tar.gz: a1a31b747928624ccbcbb34d8cac68ef75c5182b767b6f4cd3650d106f31ca723f5bb16403fa9f91936e57f3cf9e004c7769596c53ba3bd337cb2be2542a29eb
|
data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/schema_helper.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Multiwoven
|
4
4
|
module Integrations
|
5
|
-
module
|
5
|
+
module Destination
|
6
6
|
module SalesforceConsumerGoodsCloud
|
7
7
|
module SchemaHelper
|
8
8
|
include Core::Constants
|
@@ -100,6 +100,7 @@ module Multiwoven
|
|
100
100
|
json_schema = {
|
101
101
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
102
102
|
"title": metadata["name"],
|
103
|
+
"batch_support": false,
|
103
104
|
"type": "object",
|
104
105
|
"additionalProperties": true,
|
105
106
|
"properties": fields_schema
|
@@ -117,7 +118,7 @@ module Multiwoven
|
|
117
118
|
"action": "create",
|
118
119
|
"json_schema": json_schema,
|
119
120
|
"required": required,
|
120
|
-
"supported_sync_modes": %w[
|
121
|
+
"supported_sync_modes": %w[incremental],
|
121
122
|
"source_defined_cursor": true,
|
122
123
|
"default_cursor_field": ["updated"],
|
123
124
|
"source_defined_primary_key": [primary_key]
|
@@ -47,10 +47,10 @@ module Multiwoven
|
|
47
47
|
# To overcome this, we need a cursor-based pagination strategy instead of relying on OFFSET.
|
48
48
|
# query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
|
49
49
|
query = sync_config.model.query
|
50
|
-
|
50
|
+
query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
|
51
51
|
queried_data = @client.query(query)
|
52
52
|
results = queried_data.map do |record|
|
53
|
-
record
|
53
|
+
flatten_nested_hash(record)
|
54
54
|
end
|
55
55
|
results.map do |row|
|
56
56
|
RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
|
@@ -62,16 +62,27 @@ module Multiwoven
|
|
62
62
|
private
|
63
63
|
|
64
64
|
def query(connection, query)
|
65
|
-
exclude_keys = ["attributes"]
|
66
65
|
queried_data = connection.query(query)
|
66
|
+
|
67
67
|
results = queried_data.map do |record|
|
68
|
-
record
|
68
|
+
flatten_nested_hash(record)
|
69
69
|
end
|
70
70
|
results.map do |row|
|
71
71
|
RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
def flatten_nested_hash(record, prefix = nil)
|
76
|
+
record = record.reject { |key, _| key == "attributes" }
|
77
|
+
record.flat_map do |key, value|
|
78
|
+
if value.is_a?(Hash)
|
79
|
+
flatten_nested_hash(value, prefix ? "#{prefix}_#{key}" : key)
|
80
|
+
else
|
81
|
+
{ prefix ? "#{prefix}_#{key}" : key => value }
|
82
|
+
end
|
83
|
+
end.reduce({}, :merge)
|
84
|
+
end
|
85
|
+
|
75
86
|
def create_connection(connection_config)
|
76
87
|
initialize_client(connection_config)
|
77
88
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Multiwoven
|
4
4
|
module Integrations
|
5
|
-
module
|
5
|
+
module Source
|
6
6
|
module SalesforceConsumerGoodsCloud
|
7
7
|
module SchemaHelper
|
8
8
|
include Core::Constants
|
@@ -117,7 +117,7 @@ module Multiwoven
|
|
117
117
|
"action": "create",
|
118
118
|
"json_schema": json_schema,
|
119
119
|
"required": required,
|
120
|
-
"supported_sync_modes": %w[
|
120
|
+
"supported_sync_modes": %w[incremental],
|
121
121
|
"source_defined_cursor": true,
|
122
122
|
"default_cursor_field": ["updated"],
|
123
123
|
"source_defined_primary_key": [primary_key]
|
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.1.
|
4
|
+
version: 0.1.50
|
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: 2024-03-
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|