@segment/action-destinations 3.107.0-alpha.1 → 3.107.0-alpha.2
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.
- package/dist/destinations/amplitude/emptyObject.d.ts +2 -0
- package/dist/destinations/amplitude/emptyObject.js +7 -0
- package/dist/destinations/amplitude/emptyObject.js.map +1 -0
- package/dist/destinations/amplitude/index.js +3 -1
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEventV2/generated-types.d.ts +77 -0
- package/dist/destinations/{hubspot/customObject → amplitude/logEventV2}/generated-types.js +0 -0
- package/dist/destinations/amplitude/logEventV2/generated-types.js.map +1 -0
- package/dist/destinations/amplitude/logEventV2/index.d.ts +13 -0
- package/dist/destinations/amplitude/logEventV2/index.js +237 -0
- package/dist/destinations/amplitude/logEventV2/index.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +6 -0
- package/dist/destinations/google-enhanced-conversions/functions.js +55 -0
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/generated-types.d.ts +2 -1
- package/dist/destinations/google-enhanced-conversions/index.js +14 -7
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js +7 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/types.d.ts +23 -0
- package/dist/destinations/google-enhanced-conversions/types.js +5 -0
- package/dist/destinations/google-enhanced-conversions/types.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.d.ts +11 -0
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.js +3 -0
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.d.ts +5 -0
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +92 -0
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.d.ts +25 -0
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.js +3 -0
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.d.ts +5 -0
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +229 -0
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.d.ts +20 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.js +3 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.d.ts +5 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +286 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -0
- package/dist/destinations/hubspot/contact/index.js +8 -22
- package/dist/destinations/hubspot/contact/index.js.map +1 -1
- package/dist/destinations/hubspot/{customObject → createCustomObjectRecord}/generated-types.d.ts +0 -0
- package/dist/destinations/hubspot/createCustomObjectRecord/generated-types.js +3 -0
- package/dist/destinations/hubspot/createCustomObjectRecord/generated-types.js.map +1 -0
- package/dist/destinations/hubspot/{customObject → createCustomObjectRecord}/index.d.ts +0 -0
- package/dist/destinations/hubspot/{customObject → createCustomObjectRecord}/index.js +1 -1
- package/dist/destinations/hubspot/createCustomObjectRecord/index.js.map +1 -0
- package/dist/destinations/hubspot/index.js +3 -3
- package/dist/destinations/hubspot/index.js.map +1 -1
- package/dist/destinations/hubspot/testHelper.js +3 -2
- package/dist/destinations/hubspot/testHelper.js.map +1 -1
- package/dist/destinations/salesforce/customObject/index.js +12 -1
- package/dist/destinations/salesforce/customObject/index.js.map +1 -1
- package/dist/destinations/salesforce/sf-operations.d.ts +3 -0
- package/dist/destinations/salesforce/sf-operations.js +42 -0
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/salesforce/sf-properties.js +2 -1
- package/dist/destinations/salesforce/sf-properties.js.map +1 -1
- package/package.json +1 -1
- package/dist/destinations/hubspot/customObject/generated-types.js.map +0 -1
- package/dist/destinations/hubspot/customObject/index.js.map +0 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const functions_1 = require("../functions");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Upload Conversion Adjustment',
|
|
8
|
+
description: 'Upload a conversion adjustment to the Google Ads API.',
|
|
9
|
+
fields: {
|
|
10
|
+
conversion_action: {
|
|
11
|
+
label: 'Conversion Action ID',
|
|
12
|
+
description: 'The ID of the conversion action associated with this conversion. To find the Conversion Action ID, click on your conversion in Google Ads and get the value for `ctId` in the URL. For example, if the URL is `https://ads.google.com/aw/conversions/detail?ocid=00000000&ctId=570000000`, your Conversion Action ID is `570000000`.',
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
adjustment_type: {
|
|
17
|
+
label: 'Adjustment Type',
|
|
18
|
+
description: 'The adjustment type. See [Google’s documentation](https://developers.google.com/google-ads/api/reference/rpc/v11/ConversionAdjustmentTypeEnum.ConversionAdjustmentType) for details on each type.',
|
|
19
|
+
type: 'string',
|
|
20
|
+
choices: [
|
|
21
|
+
{ label: 'UNSPECIFIED', value: 'UNSPECIFIED' },
|
|
22
|
+
{ label: 'UNKNOWN', value: 'UNKNOWN' },
|
|
23
|
+
{ label: `RETRACTION`, value: 'RETRACTION' },
|
|
24
|
+
{ label: 'RESTATEMENT', value: 'RESTATEMENT' },
|
|
25
|
+
{ label: `ENHANCEMENT`, value: 'ENHANCEMENT' }
|
|
26
|
+
],
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
adjustment_timestamp: {
|
|
30
|
+
label: 'Adjustment Timestamp',
|
|
31
|
+
description: 'The date time at which the adjustment occurred. Must be after the conversion timestamp. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00".',
|
|
32
|
+
type: 'string',
|
|
33
|
+
required: true,
|
|
34
|
+
default: {
|
|
35
|
+
'@path': '$.timestamp'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
order_id: {
|
|
39
|
+
label: 'Order ID',
|
|
40
|
+
description: 'The order ID of the conversion to be adjusted. If the conversion was reported with an order ID specified, that order ID must be used as the identifier here. Required for ENHANCEMENT adjustments.',
|
|
41
|
+
type: 'string',
|
|
42
|
+
default: {
|
|
43
|
+
'@if': {
|
|
44
|
+
exists: { '@path': '$.properties.orderId' },
|
|
45
|
+
then: { '@path': '$.properties.orderId' },
|
|
46
|
+
else: { '@path': '$.properties.order_id' }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
gclid: {
|
|
51
|
+
label: 'GCLID',
|
|
52
|
+
description: 'Google click ID associated with the original conversion for this adjustment. This is used for the GCLID Date Time Pair. Required for non-ENHANCEMENT adjustments. If adjustment is ENHANCEMENT, this value is optional but may be set in addition to the order ID.',
|
|
53
|
+
type: 'string'
|
|
54
|
+
},
|
|
55
|
+
conversion_timestamp: {
|
|
56
|
+
label: 'Conversion Timestamp',
|
|
57
|
+
description: 'The date time at which the original conversion for this adjustment occurred. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00". This is used for the GCLID Date Time Pair. Required for non-ENHANCEMENT adjustments. If adjustment is ENHANCEMENT, this value is optional but may be set in addition to the order ID.',
|
|
58
|
+
type: 'string'
|
|
59
|
+
},
|
|
60
|
+
restatement_value: {
|
|
61
|
+
label: 'Restatement Value',
|
|
62
|
+
description: 'The restated conversion value. This is the value of the conversion after restatement. For example, to change the value of a conversion from 100 to 70, an adjusted value of 70 should be reported. Required for RESTATEMENT adjustments.',
|
|
63
|
+
type: 'number'
|
|
64
|
+
},
|
|
65
|
+
restatement_currency_code: {
|
|
66
|
+
label: 'Restatement Currency Code',
|
|
67
|
+
description: 'The currency of the restated value. If not provided, then the default currency from the conversion action is used, and if that is not set then the account currency is used. This is the ISO 4217 3-character currency code, e.g. USD or EUR.',
|
|
68
|
+
type: 'string'
|
|
69
|
+
},
|
|
70
|
+
email_address: {
|
|
71
|
+
label: 'Email Address',
|
|
72
|
+
description: 'Email address of the individual who triggered the conversion event. Segment will hash this value before sending to Google.',
|
|
73
|
+
type: 'string',
|
|
74
|
+
format: 'email',
|
|
75
|
+
default: {
|
|
76
|
+
'@if': {
|
|
77
|
+
exists: { '@path': '$.properties.email' },
|
|
78
|
+
then: { '@path': '$.properties.email' },
|
|
79
|
+
else: { '@path': '$.context.traits.email' }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
phone_number: {
|
|
84
|
+
label: 'Phone Number',
|
|
85
|
+
description: 'Phone number of the individual who triggered the conversion event, in E.164 standard format, e.g. +14150000000. Segment will hash this value before sending to Google.',
|
|
86
|
+
type: 'string',
|
|
87
|
+
default: {
|
|
88
|
+
'@if': {
|
|
89
|
+
exists: { '@path': '$.properties.phone' },
|
|
90
|
+
then: { '@path': '$.properties.phone' },
|
|
91
|
+
else: { '@path': '$.context.traits.phone' }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
first_name: {
|
|
96
|
+
label: 'First Name',
|
|
97
|
+
description: 'First name of the user who performed the conversion. Segment will hash this value before sending to Google.',
|
|
98
|
+
type: 'string',
|
|
99
|
+
default: {
|
|
100
|
+
'@if': {
|
|
101
|
+
exists: { '@path': '$.properties.firstName' },
|
|
102
|
+
then: { '@path': '$.properties.firstName' },
|
|
103
|
+
else: { '@path': '$.context.traits.firstName' }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
last_name: {
|
|
108
|
+
label: 'Last Name',
|
|
109
|
+
description: 'Last name of the user who performed the conversion. Segment will hash this value before sending to Google.',
|
|
110
|
+
type: 'string',
|
|
111
|
+
default: {
|
|
112
|
+
'@if': {
|
|
113
|
+
exists: { '@path': '$.properties.lastName' },
|
|
114
|
+
then: { '@path': '$.properties.lastName' },
|
|
115
|
+
else: { '@path': '$.context.traits.lastName' }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
city: {
|
|
120
|
+
label: 'City',
|
|
121
|
+
description: 'City of the user who performed the conversion.',
|
|
122
|
+
type: 'string',
|
|
123
|
+
default: {
|
|
124
|
+
'@if': {
|
|
125
|
+
exists: { '@path': '$.properties.address.city,' },
|
|
126
|
+
then: { '@path': '$.properties.address.city,' },
|
|
127
|
+
else: { '@path': '$.context.traits.address.city' }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
state: {
|
|
132
|
+
label: 'State',
|
|
133
|
+
description: 'State of the user who performed the conversion.',
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: {
|
|
136
|
+
'@if': {
|
|
137
|
+
exists: { '@path': '$.properties.address.state,' },
|
|
138
|
+
then: { '@path': '$.properties.address.state,' },
|
|
139
|
+
else: { '@path': '$.context.traits.address.state' }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
country: {
|
|
144
|
+
label: 'Country',
|
|
145
|
+
description: '2-letter country code in ISO-3166-1 alpha-2 of the user who performed the conversion.',
|
|
146
|
+
type: 'string',
|
|
147
|
+
default: {
|
|
148
|
+
'@if': {
|
|
149
|
+
exists: { '@path': '$.properties.address.country,' },
|
|
150
|
+
then: { '@path': '$.properties.address.country,' },
|
|
151
|
+
else: { '@path': '$.context.traits.address.country' }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
postal_code: {
|
|
156
|
+
label: 'Postal Code',
|
|
157
|
+
description: 'Postal code of the user who performed the conversion.',
|
|
158
|
+
type: 'string',
|
|
159
|
+
default: {
|
|
160
|
+
'@if': {
|
|
161
|
+
exists: { '@path': '$.properties.address.postalCode,' },
|
|
162
|
+
then: { '@path': '$.properties.address.postalCode,' },
|
|
163
|
+
else: { '@path': '$.context.traits.address.postalCode' }
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
street_address: {
|
|
168
|
+
label: 'Street Address',
|
|
169
|
+
description: 'Street address of the user who performed the conversion. Segment will hash this value before sending to Google.',
|
|
170
|
+
type: 'string',
|
|
171
|
+
default: {
|
|
172
|
+
'@if': {
|
|
173
|
+
exists: { '@path': '$.properties.address.street,' },
|
|
174
|
+
then: { '@path': '$.properties.address.street,' },
|
|
175
|
+
else: { '@path': '$.context.traits.address.street' }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
user_agent: {
|
|
180
|
+
label: 'User Agent',
|
|
181
|
+
description: 'The user agent to enhance the original conversion. User agent can only be specified in enhancements with user identifiers. This should match the user agent of the request that sent the original conversion so the conversion and its enhancement are either both attributed as same-device or both attributed as cross-device.',
|
|
182
|
+
type: 'string',
|
|
183
|
+
default: {
|
|
184
|
+
'@path': '$.context.userAgent'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
perform: async (request, { settings, payload }) => {
|
|
189
|
+
if (!settings.customerId) {
|
|
190
|
+
throw new actions_core_1.IntegrationError('Customer ID is required for this action. Please set it in destination settings.', 'Missing required fields.', 400);
|
|
191
|
+
}
|
|
192
|
+
settings.customerId = settings.customerId.replace(/-/g, '');
|
|
193
|
+
const validations = {
|
|
194
|
+
ENHANCEMENT: {
|
|
195
|
+
validation: (payload) => !payload.order_id,
|
|
196
|
+
error: {
|
|
197
|
+
message: 'Order ID required for enhancements'
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
RESTATEMENT: {
|
|
201
|
+
validation: (payload) => !payload.restatement_value,
|
|
202
|
+
error: {
|
|
203
|
+
message: 'Restatement value required for restatements'
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
RETRACTION: {
|
|
207
|
+
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
208
|
+
error: {
|
|
209
|
+
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
UNKNOWN: {
|
|
213
|
+
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
214
|
+
error: {
|
|
215
|
+
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
UNSPECIFIED: {
|
|
219
|
+
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
220
|
+
error: {
|
|
221
|
+
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const key = payload.adjustment_type;
|
|
226
|
+
if (validations[key].validation(payload)) {
|
|
227
|
+
throw new actions_core_1.IntegrationError(validations[key].error.message, 'INVALID_ARGUMENT', 400);
|
|
228
|
+
}
|
|
229
|
+
const request_object = {
|
|
230
|
+
conversionAction: `customers/${settings.customerId}/conversionActions/${payload.conversion_action}`,
|
|
231
|
+
adjustmentType: payload.adjustment_type,
|
|
232
|
+
adjustmentDateTime: payload.adjustment_timestamp.replace(/T/, ' ').replace(/\..+/, '+00:00'),
|
|
233
|
+
orderId: payload.order_id,
|
|
234
|
+
gclidDateTimePair: {
|
|
235
|
+
gclid: payload.gclid,
|
|
236
|
+
conversionDateTime: payload.conversion_timestamp
|
|
237
|
+
},
|
|
238
|
+
restatementValue: {
|
|
239
|
+
adjustedValue: payload.restatement_value,
|
|
240
|
+
currencyCode: payload.restatement_currency_code
|
|
241
|
+
},
|
|
242
|
+
userIdentifiers: [],
|
|
243
|
+
userAgent: payload.user_agent
|
|
244
|
+
};
|
|
245
|
+
if (payload.email_address) {
|
|
246
|
+
request_object.userIdentifiers.push({ hashedEmail: functions_1.hash(payload.email_address) });
|
|
247
|
+
}
|
|
248
|
+
if (payload.phone_number) {
|
|
249
|
+
request_object.userIdentifiers.push({ hashedPhoneNumber: functions_1.hash(payload.phone_number) });
|
|
250
|
+
}
|
|
251
|
+
const containsAddressInfo = payload.first_name ||
|
|
252
|
+
payload.last_name ||
|
|
253
|
+
payload.city ||
|
|
254
|
+
payload.state ||
|
|
255
|
+
payload.country ||
|
|
256
|
+
payload.postal_code ||
|
|
257
|
+
payload.street_address;
|
|
258
|
+
if (containsAddressInfo) {
|
|
259
|
+
request_object.userIdentifiers.push({
|
|
260
|
+
addressInfo: {
|
|
261
|
+
hashedFirstName: functions_1.hash(payload.first_name),
|
|
262
|
+
hashedLastName: functions_1.hash(payload.last_name),
|
|
263
|
+
hashedStreetAddress: functions_1.hash(payload.street_address),
|
|
264
|
+
city: payload.city,
|
|
265
|
+
state: payload.state,
|
|
266
|
+
countryCode: payload.country,
|
|
267
|
+
postalCode: payload.postal_code
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const response = await request(`${types_1.GoogleAdsAPI}/${settings.customerId}:uploadConversionAdjustments`, {
|
|
272
|
+
method: 'post',
|
|
273
|
+
headers: {
|
|
274
|
+
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
|
|
275
|
+
},
|
|
276
|
+
json: {
|
|
277
|
+
conversionAdjustments: [request_object],
|
|
278
|
+
partialFailure: true
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
functions_1.handleGoogleErrors(response);
|
|
282
|
+
return response;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
exports.default = action;
|
|
286
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,4CAAuD;AAGvD,oCAA6D;AAG7D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,uDAAuD;IACpE,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,sUAAsU;YACxU,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,mMAAmM;YACrM,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;gBAC9C,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACtC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;gBAC5C,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;gBAC9C,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;aAC/C;YACD,QAAQ,EAAE,IAAI;SACf;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,wMAAwM;YAC1M,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EACT,oMAAoM;YACtM,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE;oBAC3C,IAAI,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE;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C,IAAI;oBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,WAAW,EAAE,OAAO,CAAC,OAAO;oBAC5B,UAAU,EAAE,OAAO,CAAC,WAAW;iBAChC;aACF,CAAC,CAAA;SACH;QAED,MAAM,QAAQ,GAA2C,MAAM,OAAO,CACpE,GAAG,oBAAY,IAAI,QAAQ,CAAC,UAAU,8BAA8B,EACpE;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,iBAAiB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;aAC5D;YACD,IAAI,EAAE;gBACJ,qBAAqB,EAAE,CAAC,cAAc,CAAC;gBACvC,cAAc,EAAE,IAAI;aACrB;SACF,CACF,CAAA;QAED,8BAAkB,CAAC,QAAQ,CAAC,CAAA;QAC5B,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const properties_1 = require("../properties");
|
|
4
5
|
const action = {
|
|
5
6
|
title: 'Upsert Contact',
|
|
@@ -131,16 +132,16 @@ const action = {
|
|
|
131
132
|
state: payload.state,
|
|
132
133
|
country: payload.country,
|
|
133
134
|
zip: payload.zip,
|
|
134
|
-
lifecyclestage: payload.lifecyclestage,
|
|
135
|
+
lifecyclestage: payload.lifecyclestage?.toLowerCase(),
|
|
135
136
|
...payload.properties
|
|
136
137
|
};
|
|
137
138
|
try {
|
|
138
139
|
const response = await updateContact(request, payload.email, contactProperties);
|
|
139
140
|
transactionContext?.setTransaction('contact_id', response.data.id);
|
|
140
|
-
if (payload.lifecyclestage
|
|
141
|
+
if (payload.lifecyclestage) {
|
|
141
142
|
const currentLCS = response.data.properties['lifecyclestage'];
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
143
|
+
const hasLCSChanged = currentLCS == payload.lifecyclestage.toLowerCase();
|
|
144
|
+
if (hasLCSChanged)
|
|
144
145
|
return response;
|
|
145
146
|
await updateContact(request, payload.email, { lifecylestage: '' });
|
|
146
147
|
return updateContact(request, payload.email, contactProperties);
|
|
@@ -148,6 +149,8 @@ const action = {
|
|
|
148
149
|
return response;
|
|
149
150
|
}
|
|
150
151
|
catch (ex) {
|
|
152
|
+
if (!(ex instanceof actions_core_1.HTTPError))
|
|
153
|
+
throw ex;
|
|
151
154
|
const error = ex;
|
|
152
155
|
const statusCode = error.response.status;
|
|
153
156
|
if (statusCode == 404) {
|
|
@@ -169,25 +172,8 @@ async function createContact(request, contactProperties) {
|
|
|
169
172
|
}
|
|
170
173
|
});
|
|
171
174
|
}
|
|
172
|
-
async function isLCSStageValid(request, newLCS, currentLCS) {
|
|
173
|
-
if (newLCS == currentLCS)
|
|
174
|
-
return true;
|
|
175
|
-
const response = await request(`${properties_1.HubSpotBaseURL}/crm/v3/properties/contacts`, {
|
|
176
|
-
method: 'GET'
|
|
177
|
-
});
|
|
178
|
-
const lifecycleStage = response.data.results.find((property) => property.name == 'lifecyclestage');
|
|
179
|
-
if (!lifecycleStage) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
const stageOrderMap = Object.fromEntries(lifecycleStage.options.map(({ value, displayOrder }) => [value, displayOrder]));
|
|
183
|
-
const newLCSOrder = stageOrderMap[newLCS];
|
|
184
|
-
const existingLCSOrder = stageOrderMap[currentLCS];
|
|
185
|
-
if (!newLCS)
|
|
186
|
-
return true;
|
|
187
|
-
return newLCSOrder >= existingLCSOrder;
|
|
188
|
-
}
|
|
189
175
|
async function updateContact(request, email, properties) {
|
|
190
|
-
return
|
|
176
|
+
return request(`${properties_1.HubSpotBaseURL}/crm/v3/objects/contacts/${email}?idProperty=email`, {
|
|
191
177
|
method: 'PATCH',
|
|
192
178
|
json: {
|
|
193
179
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/contact/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/contact/index.ts"],"names":[],"mappings":";;AACA,wDAAiD;AAEjD,8CAA8C;AAQ9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2NAA2N;YAC7N,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wBAAwB;YACrC,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAkB;aAC5B;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBACxC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;iBACxC;aACF;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EA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-types.d.ts
RENAMED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/createCustomObjectRecord/generated-types.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ const actions_core_1 = require("@segment/actions-core");
|
|
|
4
4
|
const hubspotDefinedObjects = ['contacts', 'companies', 'deals', 'tickets'];
|
|
5
5
|
const customObjectExpression = new RegExp('^[a-zA-Z0-9]+_[a-zA-Z][a-zA-Z0-9_-]+$');
|
|
6
6
|
const action = {
|
|
7
|
-
title: 'Custom Object',
|
|
7
|
+
title: 'Create Custom Object',
|
|
8
8
|
description: 'Create or Update a Custom Object in HubSpot',
|
|
9
9
|
fields: {
|
|
10
10
|
objectType: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/createCustomObjectRecord/index.ts"],"names":[],"mappings":";;AACA,wDAAwD;AAKxD,MAAM,qBAAqB,GAAa,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;AAKrF,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,uCAAuC,CAAC,CAAA;AAElF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,6CAA6C;IAC1D,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,wNAAwN;YAC1N,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,yRAAyR;YAC3R,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,eAAe;YAChC,SAAS,EAAE,KAAK;SACjB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAEtC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YAChD,MAAM,IAAI,+BAAgB,CACxB,sDAAsD,EACtD,mCAAmC,EACnC,GAAG,CACJ,CAAA;SACF;QAGD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC3G,MAAM,IAAI,+BAAgB,CACxB,6OAA6O,EAC7O,sCAAsC,EACtC,GAAG,CACJ,CAAA;SACF;QAED,OAAO,OAAO,CAAC,yCAAyC,OAAO,CAAC,UAAU,EAAE,EAAE;YAC5E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;aACtC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const customObject_1 = __importDefault(require("./customObject"));
|
|
7
6
|
const sendCustomBehavioralEvent_1 = __importDefault(require("./sendCustomBehavioralEvent"));
|
|
8
7
|
const contact_1 = __importDefault(require("./contact"));
|
|
8
|
+
const createCustomObjectRecord_1 = __importDefault(require("./createCustomObjectRecord"));
|
|
9
9
|
const destination = {
|
|
10
10
|
name: 'Hubspot Cloud Mode (Actions)',
|
|
11
11
|
slug: 'actions-hubspot-cloud',
|
|
@@ -37,9 +37,9 @@ const destination = {
|
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
39
|
actions: {
|
|
40
|
-
customObject: customObject_1.default,
|
|
41
40
|
sendCustomBehavioralEvent: sendCustomBehavioralEvent_1.default,
|
|
42
|
-
contact: contact_1.default
|
|
41
|
+
contact: contact_1.default,
|
|
42
|
+
createCustomObjectRecord: createCustomObjectRecord_1.default
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/index.ts"],"names":[],"mappings":";;;;;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/index.ts"],"names":[],"mappings":";;;;;AAGA,4FAAmE;AACnE,wDAA+B;AAC/B,0FAAiE;AAKjE,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAE9B,OAAO,OAAO,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAE9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,uCAAuC,EAAE;gBACvF,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,yBAAyB,EAAzB,mCAAyB;QACzB,OAAO,EAAP,iBAAO;QACP,wBAAwB,EAAxB,kCAAwB;KACzB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateValidHubSpotCustomObjectName = void 0;
|
|
4
4
|
const generateHash = (seed) => {
|
|
5
|
-
let i, chr, hash
|
|
5
|
+
let i, chr, hash;
|
|
6
|
+
hash = 0;
|
|
6
7
|
if (seed.length === 0)
|
|
7
8
|
return hash;
|
|
8
9
|
for (i = 0; i < seed.length; i++) {
|
|
@@ -10,7 +11,7 @@ const generateHash = (seed) => {
|
|
|
10
11
|
hash = (hash << 5) - hash + chr;
|
|
11
12
|
hash |= 0;
|
|
12
13
|
}
|
|
13
|
-
return hash;
|
|
14
|
+
return Math.abs(hash);
|
|
14
15
|
};
|
|
15
16
|
const generateValidHubSpotCustomObjectName = (seed) => {
|
|
16
17
|
const hash = generateHash(seed);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testHelper.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/testHelper.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"testHelper.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/testHelper.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAA;IAChB,IAAI,GAAG,CAAC,CAAA;IAER,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChC,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAA;QAC/B,IAAI,IAAI,CAAC,CAAA;KACV;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,oCAAoC,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO;QACL,UAAU,EAAE,IAAI,IAAI,OAAO,IAAI,EAAE;QACjC,UAAU,EAAE,EAAE,YAAY,EAAE,aAAa,IAAI,EAAE,EAAE;KAClD,CAAA;AACH,CAAC,CAAA;AACQ,oFAAoC"}
|
|
@@ -18,10 +18,21 @@ const action = {
|
|
|
18
18
|
label: 'Salesforce Object',
|
|
19
19
|
description: 'The API name of the Salesforce object that records will be added or updated within. This can be a standard or custom object. Custom objects must be predefined in your Salesforce account and should end with "__c".',
|
|
20
20
|
type: 'string',
|
|
21
|
-
required: true
|
|
21
|
+
required: true,
|
|
22
|
+
dynamic: true
|
|
22
23
|
},
|
|
23
24
|
customFields: { ...sf_properties_1.customFields, required: true }
|
|
24
25
|
},
|
|
26
|
+
dynamicFields: {
|
|
27
|
+
customObjectName: async (request, data) => {
|
|
28
|
+
const sf = new sf_operations_1.default(data.settings.instanceUrl, request);
|
|
29
|
+
return sf.customObjectName();
|
|
30
|
+
},
|
|
31
|
+
bulkUpsertExternalId: async (request, { settings, payload }) => {
|
|
32
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, request);
|
|
33
|
+
return sf.bulkUpsertExternalId(payload.customObjectName);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
25
36
|
perform: async (request, { settings, payload }) => {
|
|
26
37
|
const sf = new sf_operations_1.default(settings.instanceUrl, request);
|
|
27
38
|
if (payload.operation === 'create') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/customObject/index.ts"],"names":[],"mappings":";;;;;AAGA,oDAQyB;AACzB,qEAAyC;AAEzC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,mFAAmF;IAChG,MAAM,EAAE;QACN,SAAS,EAAE,yBAAS;QACpB,eAAe,EAAE,+BAAe;QAChC,MAAM,EAAE,sBAAM;QACd,oBAAoB,EAAE,oCAAoB;QAC1C,kBAAkB,EAAE,kCAAkB;QACtC,gBAAgB,EAAE;YAChB,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,sNAAsN;YACxN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/customObject/index.ts"],"names":[],"mappings":";;;;;AAGA,oDAQyB;AACzB,qEAAyC;AAEzC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,mFAAmF;IAChG,MAAM,EAAE;QACN,SAAS,EAAE,yBAAS;QACpB,eAAe,EAAE,+BAAe;QAChC,MAAM,EAAE,sBAAM;QACd,oBAAoB,EAAE,oCAAoB;QAC1C,kBAAkB,EAAE,kCAAkB;QACtC,gBAAgB,EAAE;YAChB,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,sNAAsN;YACxN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;QACD,YAAY,EAAE,EAAE,GAAG,4BAAY,EAAE,QAAQ,EAAE,IAAI,EAAE;KAClD;IACD,aAAa,EAAE;QACb,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YACxC,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,IAAI,CAAC,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OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;IAC7D,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RequestClient } from '@segment/actions-core';
|
|
2
2
|
import type { GenericPayload } from './sf-types';
|
|
3
|
+
import { DynamicFieldResponse } from '@segment/actions-core';
|
|
3
4
|
export declare const API_VERSION = "v53.0";
|
|
4
5
|
export default class Salesforce {
|
|
5
6
|
instanceUrl: string;
|
|
@@ -9,6 +10,8 @@ export default class Salesforce {
|
|
|
9
10
|
updateRecord: (payload: GenericPayload, sobject: string) => Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
10
11
|
upsertRecord: (payload: GenericPayload, sobject: string) => Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
11
12
|
bulkHandler: (payloads: GenericPayload[], sobject: string) => Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
13
|
+
bulkUpsertExternalId: (sobject: string) => Promise<DynamicFieldResponse>;
|
|
14
|
+
customObjectName: () => Promise<DynamicFieldResponse>;
|
|
12
15
|
private bulkUpsert;
|
|
13
16
|
private bulkUpdate;
|
|
14
17
|
private createBulkJob;
|
|
@@ -56,6 +56,48 @@ class Salesforce {
|
|
|
56
56
|
}
|
|
57
57
|
throw new actions_core_1.IntegrationError(`Unsupported operation: Bulk API does not support the create operation`, 'Unsupported operation', 400);
|
|
58
58
|
};
|
|
59
|
+
this.bulkUpsertExternalId = async (sobject) => {
|
|
60
|
+
const result = await this.request(`${this.instanceUrl}services/data/${exports.API_VERSION}/sobjects/${sobject}/describe`, {
|
|
61
|
+
method: 'get',
|
|
62
|
+
skipResponseCloning: true
|
|
63
|
+
});
|
|
64
|
+
const fields = result.data.fields.filter((field) => {
|
|
65
|
+
return field.externalId === true;
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
choices: fields.map((field) => {
|
|
69
|
+
return { value: field.name, label: field.label };
|
|
70
|
+
}),
|
|
71
|
+
nextPage: '2'
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
this.customObjectName = async () => {
|
|
75
|
+
try {
|
|
76
|
+
const result = await this.request(`${this.instanceUrl}services/data/${exports.API_VERSION}/sobjects`, {
|
|
77
|
+
method: 'get',
|
|
78
|
+
skipResponseCloning: true
|
|
79
|
+
});
|
|
80
|
+
const fields = result.data.sobjects.filter((field) => {
|
|
81
|
+
return field.createable === true;
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
choices: fields.map((field) => {
|
|
85
|
+
return { value: field.name, label: field.label };
|
|
86
|
+
}),
|
|
87
|
+
nextPage: '2'
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return {
|
|
92
|
+
choices: [],
|
|
93
|
+
nextPage: '',
|
|
94
|
+
error: {
|
|
95
|
+
message: err.response.data[0].message ?? 'Unknown error',
|
|
96
|
+
code: err.response.data[0].errorCode ?? 'Unknown error'
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
59
101
|
this.bulkUpsert = async (payloads, sobject) => {
|
|
60
102
|
if (!payloads[0].bulkUpsertExternalId ||
|
|
61
103
|
!payloads[0].bulkUpsertExternalId.externalIdName ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sf-operations.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/sf-operations.ts"],"names":[],"mappings":";;;AAAA,wDAAuE;AAEvE,6DAAuD;AACvD,yCAAyC;
|
|
1
|
+
{"version":3,"file":"sf-operations.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/sf-operations.ts"],"names":[],"mappings":";;;AAAA,wDAAuE;AAEvE,6DAAuD;AACvD,yCAAyC;AAG5B,QAAA,WAAW,GAAG,OAAO,CAAA;AAKlC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,MAAM,QAAQ,GAAG,0DAA0D,CAAA;IAC3E,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,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAC/E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CA+RF;AAxSD,6BAwSC"}
|
|
@@ -29,7 +29,8 @@ exports.bulkUpsertExternalId = {
|
|
|
29
29
|
externalIdName: {
|
|
30
30
|
label: 'External Id Name',
|
|
31
31
|
description: 'The external id field name as defined in Salesforce.',
|
|
32
|
-
type: 'string'
|
|
32
|
+
type: 'string',
|
|
33
|
+
dynamic: true
|
|
33
34
|
},
|
|
34
35
|
externalIdValue: {
|
|
35
36
|
label: 'External Id Value',
|