@segment/action-destinations 3.301.0 → 3.301.1-staging-4bd526d90.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.
- package/dist/destinations/salesforce/account2/generated-types.d.ts +32 -0
- package/dist/destinations/salesforce/account2/generated-types.js +3 -0
- package/dist/destinations/salesforce/account2/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/account2/index.d.ts +5 -0
- package/dist/destinations/salesforce/account2/index.js +248 -0
- package/dist/destinations/salesforce/account2/index.js.map +1 -0
- package/dist/destinations/salesforce/cases2/generated-types.d.ts +17 -0
- package/dist/destinations/salesforce/cases2/generated-types.js +3 -0
- package/dist/destinations/salesforce/cases2/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/cases2/index.d.ts +5 -0
- package/dist/destinations/salesforce/cases2/index.js +76 -0
- package/dist/destinations/salesforce/cases2/index.js.map +1 -0
- package/dist/destinations/salesforce/contact2/generated-types.d.ts +25 -0
- package/dist/destinations/salesforce/contact2/generated-types.js +3 -0
- package/dist/destinations/salesforce/contact2/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/contact2/index.d.ts +5 -0
- package/dist/destinations/salesforce/contact2/index.js +192 -0
- package/dist/destinations/salesforce/contact2/index.js.map +1 -0
- package/dist/destinations/salesforce/customObject2/generated-types.d.ts +17 -0
- package/dist/destinations/salesforce/customObject2/generated-types.js +3 -0
- package/dist/destinations/salesforce/customObject2/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/customObject2/index.d.ts +5 -0
- package/dist/destinations/salesforce/customObject2/index.js +97 -0
- package/dist/destinations/salesforce/customObject2/index.js.map +1 -0
- package/dist/destinations/salesforce/index.js +13 -1
- package/dist/destinations/salesforce/index.js.map +1 -1
- package/dist/destinations/salesforce/lead2/generated-types.d.ts +25 -0
- package/dist/destinations/salesforce/lead2/generated-types.js +3 -0
- package/dist/destinations/salesforce/lead2/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/lead2/index.d.ts +5 -0
- package/dist/destinations/salesforce/lead2/index.js +200 -0
- package/dist/destinations/salesforce/lead2/index.js.map +1 -0
- package/dist/destinations/salesforce/opportunity2/generated-types.d.ts +21 -0
- package/dist/destinations/salesforce/opportunity2/generated-types.js +3 -0
- package/dist/destinations/salesforce/opportunity2/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/opportunity2/index.d.ts +5 -0
- package/dist/destinations/salesforce/opportunity2/index.js +112 -0
- package/dist/destinations/salesforce/opportunity2/index.js.map +1 -0
- package/dist/destinations/salesforce/sf-operations.d.ts +1 -0
- package/dist/destinations/salesforce/sf-operations.js +20 -0
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/segment-profiles/sendGroup/index.js +0 -3
- package/dist/destinations/segment-profiles/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendIdentify/index.js +0 -3
- package/dist/destinations/segment-profiles/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendSubscription/index.js +0 -3
- package/dist/destinations/segment-profiles/sendSubscription/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendTrack/index.js +0 -3
- package/dist/destinations/segment-profiles/sendTrack/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
enable_batching?: boolean;
|
|
3
|
+
batch_size?: number;
|
|
4
|
+
recordMatcherOperator?: string;
|
|
5
|
+
traits?: {
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
bulkUpsertExternalId?: {
|
|
9
|
+
externalIdName?: string;
|
|
10
|
+
externalIdValue?: string;
|
|
11
|
+
};
|
|
12
|
+
bulkUpdateRecordId?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
account_number?: string;
|
|
15
|
+
number_of_employees?: number;
|
|
16
|
+
billing_city?: string;
|
|
17
|
+
billing_postal_code?: string;
|
|
18
|
+
billing_country?: string;
|
|
19
|
+
billing_street?: string;
|
|
20
|
+
billing_state?: string;
|
|
21
|
+
shipping_city?: string;
|
|
22
|
+
shipping_postal_code?: string;
|
|
23
|
+
shipping_country?: string;
|
|
24
|
+
shipping_street?: string;
|
|
25
|
+
shipping_state?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
website?: string;
|
|
29
|
+
customFields?: {
|
|
30
|
+
[k: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/account2/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
23
|
+
const sf_operations_1 = __importStar(require("../sf-operations"));
|
|
24
|
+
const sf_properties_1 = require("../sf-properties");
|
|
25
|
+
const OBJECT_NAME = 'Account';
|
|
26
|
+
const action = {
|
|
27
|
+
title: 'Account',
|
|
28
|
+
description: 'Create, update, or upsert accounts in Salesforce.',
|
|
29
|
+
defaultSubscription: 'type = "group"',
|
|
30
|
+
syncMode: {
|
|
31
|
+
description: 'Define how the records from your destination will be synced.',
|
|
32
|
+
label: 'How to sync records',
|
|
33
|
+
default: 'add',
|
|
34
|
+
choices: [
|
|
35
|
+
{ label: 'Insert Records', value: 'add' },
|
|
36
|
+
{ label: 'Update Records', value: 'update' },
|
|
37
|
+
{ label: 'Upsert Records', value: 'upsert' },
|
|
38
|
+
{ label: 'Delete Records. Not available when using batching. Requests will result in errors.', value: 'delete' }
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
fields: {
|
|
42
|
+
enable_batching: sf_properties_1.enable_batching,
|
|
43
|
+
batch_size: sf_properties_1.batch_size,
|
|
44
|
+
recordMatcherOperator: sf_properties_1.recordMatcherOperator,
|
|
45
|
+
traits: sf_properties_1.traits,
|
|
46
|
+
bulkUpsertExternalId: sf_properties_1.bulkUpsertExternalId,
|
|
47
|
+
bulkUpdateRecordId: sf_properties_1.bulkUpdateRecordId,
|
|
48
|
+
name: {
|
|
49
|
+
label: 'Name',
|
|
50
|
+
description: 'Name of the account. **This is required to create an account.**',
|
|
51
|
+
type: 'string',
|
|
52
|
+
default: {
|
|
53
|
+
'@path': '$.traits.name'
|
|
54
|
+
},
|
|
55
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
56
|
+
},
|
|
57
|
+
account_number: {
|
|
58
|
+
label: 'Account Number',
|
|
59
|
+
description: 'Account number assigned to the account. This is not the unique, Salesforce-generated ID assigned during creation.',
|
|
60
|
+
type: 'string',
|
|
61
|
+
default: {
|
|
62
|
+
'@path': '$.groupId'
|
|
63
|
+
},
|
|
64
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
65
|
+
},
|
|
66
|
+
number_of_employees: {
|
|
67
|
+
label: 'Number of employees',
|
|
68
|
+
description: 'Number of employees working at the company represented by the account.',
|
|
69
|
+
type: 'integer',
|
|
70
|
+
default: {
|
|
71
|
+
'@if': {
|
|
72
|
+
exists: { '@path': '$.traits.employees' },
|
|
73
|
+
then: { '@path': '$.traits.employees' },
|
|
74
|
+
else: { '@path': '$.properties.employees' }
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
78
|
+
},
|
|
79
|
+
billing_city: {
|
|
80
|
+
label: 'Billing City',
|
|
81
|
+
description: 'City for the billing address of the account.',
|
|
82
|
+
type: 'string',
|
|
83
|
+
default: {
|
|
84
|
+
'@if': {
|
|
85
|
+
exists: { '@path': '$.traits.address.city' },
|
|
86
|
+
then: { '@path': '$.traits.address.city' },
|
|
87
|
+
else: { '@path': '$.properties.address.city' }
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
91
|
+
},
|
|
92
|
+
billing_postal_code: {
|
|
93
|
+
label: 'Billing Postal Code',
|
|
94
|
+
description: 'Postal code for the billing address of the account.',
|
|
95
|
+
type: 'string',
|
|
96
|
+
default: {
|
|
97
|
+
'@if': {
|
|
98
|
+
exists: { '@path': '$.traits.address.postal_code' },
|
|
99
|
+
then: { '@path': '$.traits.address.postal_code' },
|
|
100
|
+
else: { '@path': '$.properties.address.postal_code' }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
104
|
+
},
|
|
105
|
+
billing_country: {
|
|
106
|
+
label: 'Billing Country',
|
|
107
|
+
description: 'Country for the billing address of the account.',
|
|
108
|
+
type: 'string',
|
|
109
|
+
default: {
|
|
110
|
+
'@if': {
|
|
111
|
+
exists: { '@path': '$.traits.address.country' },
|
|
112
|
+
then: { '@path': '$.traits.address.country' },
|
|
113
|
+
else: { '@path': '$.properties.address.country' }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
117
|
+
},
|
|
118
|
+
billing_street: {
|
|
119
|
+
label: 'Billing Street',
|
|
120
|
+
description: 'Street address for the billing address of the account.',
|
|
121
|
+
type: 'string',
|
|
122
|
+
default: {
|
|
123
|
+
'@if': {
|
|
124
|
+
exists: { '@path': '$.traits.address.street' },
|
|
125
|
+
then: { '@path': '$.traits.address.street' },
|
|
126
|
+
else: { '@path': '$.properties.address.street' }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
130
|
+
},
|
|
131
|
+
billing_state: {
|
|
132
|
+
label: 'Billing State',
|
|
133
|
+
description: 'State for the billing address of the account.',
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: {
|
|
136
|
+
'@if': {
|
|
137
|
+
exists: { '@path': '$.traits.address.state' },
|
|
138
|
+
then: { '@path': '$.traits.address.state' },
|
|
139
|
+
else: { '@path': '$.properties.address.state' }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
143
|
+
},
|
|
144
|
+
shipping_city: {
|
|
145
|
+
label: 'Shipping City',
|
|
146
|
+
description: 'City for the shipping address of the account.',
|
|
147
|
+
type: 'string',
|
|
148
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
149
|
+
},
|
|
150
|
+
shipping_postal_code: {
|
|
151
|
+
label: 'Shipping Postal Code',
|
|
152
|
+
description: 'Postal code for the shipping address of the account.',
|
|
153
|
+
type: 'string',
|
|
154
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
155
|
+
},
|
|
156
|
+
shipping_country: {
|
|
157
|
+
label: 'Shipping Country',
|
|
158
|
+
description: 'Country for the shipping address of the account.',
|
|
159
|
+
type: 'string',
|
|
160
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
161
|
+
},
|
|
162
|
+
shipping_street: {
|
|
163
|
+
label: 'Shipping Street',
|
|
164
|
+
description: 'Street address for the shipping address of the account.',
|
|
165
|
+
type: 'string',
|
|
166
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
167
|
+
},
|
|
168
|
+
shipping_state: {
|
|
169
|
+
label: 'Shipping State',
|
|
170
|
+
description: 'State for the shipping address of the account.',
|
|
171
|
+
type: 'string',
|
|
172
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
173
|
+
},
|
|
174
|
+
phone: {
|
|
175
|
+
label: 'Phone',
|
|
176
|
+
description: 'Phone number for the account.',
|
|
177
|
+
type: 'string',
|
|
178
|
+
default: {
|
|
179
|
+
'@if': {
|
|
180
|
+
exists: { '@path': '$.traits.phone' },
|
|
181
|
+
then: { '@path': '$.traits.phone' },
|
|
182
|
+
else: { '@path': '$.properties.phone' }
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
186
|
+
},
|
|
187
|
+
description: {
|
|
188
|
+
label: 'Description',
|
|
189
|
+
description: 'Text description of the account.',
|
|
190
|
+
type: 'string',
|
|
191
|
+
default: {
|
|
192
|
+
'@if': {
|
|
193
|
+
exists: { '@path': '$.traits.description' },
|
|
194
|
+
then: { '@path': '$.traits.description' },
|
|
195
|
+
else: { '@path': '$.properties.description' }
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
199
|
+
},
|
|
200
|
+
website: {
|
|
201
|
+
label: 'Website',
|
|
202
|
+
description: 'The website of the account.',
|
|
203
|
+
type: 'string',
|
|
204
|
+
default: {
|
|
205
|
+
'@if': {
|
|
206
|
+
exists: { '@path': '$.traits.website' },
|
|
207
|
+
then: { '@path': '$.traits.website' },
|
|
208
|
+
else: { '@path': '$.properties.website' }
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
212
|
+
},
|
|
213
|
+
customFields: sf_properties_1.customFields
|
|
214
|
+
},
|
|
215
|
+
perform: async (request, { settings, payload, syncMode }) => {
|
|
216
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, await sf_operations_1.generateSalesforceRequest(settings, request));
|
|
217
|
+
if (syncMode === 'add') {
|
|
218
|
+
if (!payload.name) {
|
|
219
|
+
throw new actions_core_1.IntegrationError('Missing name value', 'Misconfigured required field', 400);
|
|
220
|
+
}
|
|
221
|
+
return await sf.createRecord(payload, OBJECT_NAME);
|
|
222
|
+
}
|
|
223
|
+
sf_properties_1.validateLookup(payload);
|
|
224
|
+
if (syncMode === 'update') {
|
|
225
|
+
return await sf.updateRecord(payload, OBJECT_NAME);
|
|
226
|
+
}
|
|
227
|
+
if (syncMode === 'upsert') {
|
|
228
|
+
if (!payload.name) {
|
|
229
|
+
throw new actions_core_1.IntegrationError('Missing name value', 'Misconfigured required field', 400);
|
|
230
|
+
}
|
|
231
|
+
return await sf.upsertRecord(payload, OBJECT_NAME);
|
|
232
|
+
}
|
|
233
|
+
if (syncMode === 'delete') {
|
|
234
|
+
return await sf.deleteRecord(payload, OBJECT_NAME);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
performBatch: async (request, { settings, payload, syncMode }) => {
|
|
238
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, await sf_operations_1.generateSalesforceRequest(settings, request));
|
|
239
|
+
if (syncMode === 'upsert') {
|
|
240
|
+
if (!payload[0].name) {
|
|
241
|
+
throw new actions_core_1.IntegrationError('Missing name value', 'Misconfigured required field', 400);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return sf.bulkHandlerWithSyncMode(payload, OBJECT_NAME, syncMode);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
exports.default = action;
|
|
248
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/account2/index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F;QAED,OAAO,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
recordMatcherOperator?: string;
|
|
3
|
+
enable_batching?: boolean;
|
|
4
|
+
batch_size?: number;
|
|
5
|
+
traits?: {
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
bulkUpsertExternalId?: {
|
|
9
|
+
externalIdName?: string;
|
|
10
|
+
externalIdValue?: string;
|
|
11
|
+
};
|
|
12
|
+
bulkUpdateRecordId?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
customFields?: {
|
|
15
|
+
[k: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/cases2/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const sf_properties_1 = require("../sf-properties");
|
|
23
|
+
const sf_operations_1 = __importStar(require("../sf-operations"));
|
|
24
|
+
const OBJECT_NAME = 'Case';
|
|
25
|
+
const action = {
|
|
26
|
+
title: 'Case',
|
|
27
|
+
description: 'Create, update, or upsert cases in Salesforce.',
|
|
28
|
+
syncMode: {
|
|
29
|
+
description: 'Define how the records from your destination will be synced.',
|
|
30
|
+
label: 'How to sync records',
|
|
31
|
+
default: 'add',
|
|
32
|
+
choices: [
|
|
33
|
+
{ label: 'Insert Records', value: 'add' },
|
|
34
|
+
{ label: 'Update Records', value: 'update' },
|
|
35
|
+
{ label: 'Upsert Records', value: 'upsert' },
|
|
36
|
+
{ label: 'Delete Records. Not available when using batching. Requests will result in errors.', value: 'delete' }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
fields: {
|
|
40
|
+
recordMatcherOperator: sf_properties_1.recordMatcherOperator,
|
|
41
|
+
enable_batching: sf_properties_1.enable_batching,
|
|
42
|
+
batch_size: sf_properties_1.batch_size,
|
|
43
|
+
traits: sf_properties_1.traits,
|
|
44
|
+
bulkUpsertExternalId: sf_properties_1.bulkUpsertExternalId,
|
|
45
|
+
bulkUpdateRecordId: sf_properties_1.bulkUpdateRecordId,
|
|
46
|
+
description: {
|
|
47
|
+
label: 'Description',
|
|
48
|
+
description: 'A text description of the case.',
|
|
49
|
+
type: 'string',
|
|
50
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
51
|
+
},
|
|
52
|
+
customFields: sf_properties_1.customFields
|
|
53
|
+
},
|
|
54
|
+
perform: async (request, { settings, payload, syncMode }) => {
|
|
55
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, await sf_operations_1.generateSalesforceRequest(settings, request));
|
|
56
|
+
if (syncMode === 'add') {
|
|
57
|
+
return await sf.createRecord(payload, OBJECT_NAME);
|
|
58
|
+
}
|
|
59
|
+
sf_properties_1.validateLookup(payload);
|
|
60
|
+
if (syncMode === 'update') {
|
|
61
|
+
return await sf.updateRecord(payload, OBJECT_NAME);
|
|
62
|
+
}
|
|
63
|
+
if (syncMode === 'upsert') {
|
|
64
|
+
return await sf.upsertRecord(payload, OBJECT_NAME);
|
|
65
|
+
}
|
|
66
|
+
if (syncMode === 'delete') {
|
|
67
|
+
return await sf.deleteRecord(payload, OBJECT_NAME);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
performBatch: async (request, { settings, payload, syncMode }) => {
|
|
71
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, await sf_operations_1.generateSalesforceRequest(settings, request));
|
|
72
|
+
return sf.bulkHandlerWithSyncMode(payload, OBJECT_NAME, syncMode);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.default = action;
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/cases2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,oDAUyB;AACzB,kEAAwE;AAExE,MAAM,WAAW,GAAG,MAAM,CAAA;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,gDAAgD;IAC7D,QAAQ,EAAE;QACR,WAAW,EAAE,8DAA8D;QAC3E,KAAK,EAAE,qBAAqB;QAC5B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE;YACzC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE;YAC5C,EAAE,KAAK,EAAE,gBAAgB,EAAE,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E,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC/D,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,yCAAyB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;QAE/G,OAAO,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
recordMatcherOperator?: string;
|
|
3
|
+
enable_batching?: boolean;
|
|
4
|
+
batch_size?: number;
|
|
5
|
+
traits?: {
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
bulkUpsertExternalId?: {
|
|
9
|
+
externalIdName?: string;
|
|
10
|
+
externalIdValue?: string;
|
|
11
|
+
};
|
|
12
|
+
bulkUpdateRecordId?: string;
|
|
13
|
+
last_name?: string;
|
|
14
|
+
first_name?: string;
|
|
15
|
+
account_id?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
mailing_city?: string;
|
|
18
|
+
mailing_postal_code?: string;
|
|
19
|
+
mailing_country?: string;
|
|
20
|
+
mailing_street?: string;
|
|
21
|
+
mailing_state?: string;
|
|
22
|
+
customFields?: {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/contact2/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
23
|
+
const sf_properties_1 = require("../sf-properties");
|
|
24
|
+
const sf_operations_1 = __importStar(require("../sf-operations"));
|
|
25
|
+
const OBJECT_NAME = 'Contact';
|
|
26
|
+
const action = {
|
|
27
|
+
title: 'Contact',
|
|
28
|
+
description: 'Create, update, or upsert contacts in Salesforce.',
|
|
29
|
+
syncMode: {
|
|
30
|
+
description: 'Define how the records from your destination will be synced.',
|
|
31
|
+
label: 'How to sync records',
|
|
32
|
+
default: 'add',
|
|
33
|
+
choices: [
|
|
34
|
+
{ label: 'Insert Records', value: 'add' },
|
|
35
|
+
{ label: 'Update Records', value: 'update' },
|
|
36
|
+
{ label: 'Upsert Records', value: 'upsert' },
|
|
37
|
+
{ label: 'Delete Records. Not available when using batching. Requests will result in errors.', value: 'delete' }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
fields: {
|
|
41
|
+
recordMatcherOperator: sf_properties_1.recordMatcherOperator,
|
|
42
|
+
enable_batching: sf_properties_1.enable_batching,
|
|
43
|
+
batch_size: sf_properties_1.batch_size,
|
|
44
|
+
traits: sf_properties_1.traits,
|
|
45
|
+
bulkUpsertExternalId: sf_properties_1.bulkUpsertExternalId,
|
|
46
|
+
bulkUpdateRecordId: sf_properties_1.bulkUpdateRecordId,
|
|
47
|
+
last_name: {
|
|
48
|
+
label: 'Last Name',
|
|
49
|
+
description: "The contact's last name up to 80 characters. **This is required to create a contact.**",
|
|
50
|
+
type: 'string',
|
|
51
|
+
default: {
|
|
52
|
+
'@if': {
|
|
53
|
+
exists: { '@path': '$.traits.last_name' },
|
|
54
|
+
then: { '@path': '$.traits.last_name' },
|
|
55
|
+
else: { '@path': '$.properties.last_name' }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
59
|
+
},
|
|
60
|
+
first_name: {
|
|
61
|
+
label: 'First Name',
|
|
62
|
+
description: "The contact's first name up to 40 characters.",
|
|
63
|
+
type: 'string',
|
|
64
|
+
default: {
|
|
65
|
+
'@if': {
|
|
66
|
+
exists: { '@path': '$.traits.first_name' },
|
|
67
|
+
then: { '@path': '$.traits.first_name' },
|
|
68
|
+
else: { '@path': '$.properties.first_name' }
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
72
|
+
},
|
|
73
|
+
account_id: {
|
|
74
|
+
label: 'Account ID',
|
|
75
|
+
description: 'The ID of the account that this contact is associated with. This is the Salesforce-generated ID assigned to the account during creation (i.e. 0018c00002CDThnAAH).',
|
|
76
|
+
type: 'string',
|
|
77
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
78
|
+
},
|
|
79
|
+
email: {
|
|
80
|
+
label: 'Email',
|
|
81
|
+
description: "The contact's email address.",
|
|
82
|
+
type: 'string',
|
|
83
|
+
default: {
|
|
84
|
+
'@if': {
|
|
85
|
+
exists: { '@path': '$.traits.email' },
|
|
86
|
+
then: { '@path': '$.traits.email' },
|
|
87
|
+
else: { '@path': '$.properties.email' }
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
91
|
+
},
|
|
92
|
+
mailing_city: {
|
|
93
|
+
label: 'Mailing City',
|
|
94
|
+
description: "City for the contact's mailing address.",
|
|
95
|
+
type: 'string',
|
|
96
|
+
default: {
|
|
97
|
+
'@if': {
|
|
98
|
+
exists: { '@path': '$.traits.address.city' },
|
|
99
|
+
then: { '@path': '$.traits.address.city' },
|
|
100
|
+
else: { '@path': '$.properties.address.city' }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
104
|
+
},
|
|
105
|
+
mailing_postal_code: {
|
|
106
|
+
label: 'Mailing Postal Code',
|
|
107
|
+
description: "Postal Code for the contact's mailing address.",
|
|
108
|
+
type: 'string',
|
|
109
|
+
default: {
|
|
110
|
+
'@if': {
|
|
111
|
+
exists: { '@path': '$.traits.address.postal_code' },
|
|
112
|
+
then: { '@path': '$.traits.address.postal_code' },
|
|
113
|
+
else: { '@path': '$.properties.address.postal_code' }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
117
|
+
},
|
|
118
|
+
mailing_country: {
|
|
119
|
+
label: 'Mailing Country',
|
|
120
|
+
description: "Country for the contact's mailing address.",
|
|
121
|
+
type: 'string',
|
|
122
|
+
default: {
|
|
123
|
+
'@if': {
|
|
124
|
+
exists: { '@path': '$.traits.address.country' },
|
|
125
|
+
then: { '@path': '$.traits.address.country' },
|
|
126
|
+
else: { '@path': '$.properties.address.country' }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
130
|
+
},
|
|
131
|
+
mailing_street: {
|
|
132
|
+
label: 'Mailing Street',
|
|
133
|
+
description: "Street number and name for the contact's mailing address.",
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: {
|
|
136
|
+
'@if': {
|
|
137
|
+
exists: { '@path': '$.traits.address.street' },
|
|
138
|
+
then: { '@path': '$.traits.address.street' },
|
|
139
|
+
else: { '@path': '$.properties.address.street' }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
143
|
+
},
|
|
144
|
+
mailing_state: {
|
|
145
|
+
label: 'Mailing State',
|
|
146
|
+
description: "State for the contact's mailing address.",
|
|
147
|
+
type: 'string',
|
|
148
|
+
default: {
|
|
149
|
+
'@if': {
|
|
150
|
+
exists: { '@path': '$.traits.address.state' },
|
|
151
|
+
then: { '@path': '$.traits.address.state' },
|
|
152
|
+
else: { '@path': '$.properties.address.state' }
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
depends_on: sf_properties_1.hideIfDeleteOperation
|
|
156
|
+
},
|
|
157
|
+
customFields: sf_properties_1.customFields
|
|
158
|
+
},
|
|
159
|
+
perform: async (request, { settings, payload, syncMode }) => {
|
|
160
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, await sf_operations_1.generateSalesforceRequest(settings, request));
|
|
161
|
+
if (syncMode === 'add') {
|
|
162
|
+
if (!payload.last_name) {
|
|
163
|
+
throw new actions_core_1.IntegrationError('Missing last_name value', 'Misconfigured required field', 400);
|
|
164
|
+
}
|
|
165
|
+
return await sf.createRecord(payload, OBJECT_NAME);
|
|
166
|
+
}
|
|
167
|
+
sf_properties_1.validateLookup(payload);
|
|
168
|
+
if (syncMode === 'update') {
|
|
169
|
+
return await sf.updateRecord(payload, OBJECT_NAME);
|
|
170
|
+
}
|
|
171
|
+
if (syncMode === 'upsert') {
|
|
172
|
+
if (!payload.last_name) {
|
|
173
|
+
throw new actions_core_1.IntegrationError('Missing last_name value', 'Misconfigured required field', 400);
|
|
174
|
+
}
|
|
175
|
+
return await sf.upsertRecord(payload, OBJECT_NAME);
|
|
176
|
+
}
|
|
177
|
+
if (syncMode === 'delete') {
|
|
178
|
+
return await sf.deleteRecord(payload, OBJECT_NAME);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
performBatch: async (request, { settings, payload, syncMode }) => {
|
|
182
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, await sf_operations_1.generateSalesforceRequest(settings, request));
|
|
183
|
+
if (syncMode === 'upsert') {
|
|
184
|
+
if (!payload[0].last_name) {
|
|
185
|
+
throw new actions_core_1.IntegrationError('Missing last_name value', 'Misconfigured required field', 400);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return sf.bulkHandlerWithSyncMode(payload, OBJECT_NAME, syncMode);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
exports.default = action;
|
|
192
|
+
//# sourceMappingURL=index.js.map
|