@pipedream/salesforce_rest_api 0.3.3 → 0.4.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/actions/create-account/create-account.mjs +51 -0
- package/actions/create-attachment/create-attachment.mjs +62 -0
- package/actions/create-campaign/create-campaign.mjs +51 -0
- package/actions/create-case/create-case.mjs +50 -0
- package/actions/create-casecomment/create-casecomment.mjs +50 -0
- package/actions/create-contact/create-contact.mjs +50 -0
- package/actions/create-event/create-event.mjs +80 -0
- package/actions/create-lead/create-lead.mjs +56 -0
- package/actions/create-note/create-note.mjs +56 -0
- package/actions/create-opportunity/create-opportunity.mjs +62 -0
- package/actions/create-record/create-record.mjs +36 -0
- package/actions/create-task/create-task.mjs +56 -0
- package/actions/delete-opportunity/delete-opportunity.mjs +30 -0
- package/actions/delete-record/delete-record.mjs +37 -0
- package/actions/find-create-record/find-create-record.mjs +84 -0
- package/actions/find-records/find-records.mjs +48 -0
- package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +57 -0
- package/actions/insert-blob-data/insert-blob-data.mjs +77 -0
- package/actions/soql-search/soql-search.mjs +29 -0
- package/actions/sosl-search/sosl-search.mjs +29 -0
- package/actions/update-account/update-account.mjs +59 -0
- package/actions/update-contact/update-contact.mjs +58 -0
- package/actions/update-opportunity/update-opportunity.mjs +72 -0
- package/actions/update-record/update-record.mjs +46 -0
- package/common/constants.mjs +30 -0
- package/common/sobjects/account.mjs +27 -0
- package/common/sobjects/attachment.mjs +22 -0
- package/common/sobjects/campaign.mjs +27 -0
- package/common/sobjects/case.mjs +17 -0
- package/common/sobjects/caseComment.mjs +7 -0
- package/common/sobjects/contact.mjs +52 -0
- package/common/sobjects/event.mjs +22 -0
- package/common/sobjects/lead.mjs +32 -0
- package/common/sobjects/note.mjs +17 -0
- package/common/sobjects/opportunity.mjs +27 -0
- package/common/sobjects/task.mjs +25 -0
- package/common/utils.mjs +51 -0
- package/package.json +6 -3
- package/salesforce_rest_api.app.mjs +349 -37
- package/sources/common-instant.mjs +15 -9
- package/sources/common.mjs +3 -5
- package/sources/new-object/new-object.mjs +1 -1
- package/sources/new-object-instant/new-object-instant.mjs +1 -1
- package/sources/new-outbound-message/new-outbound-message.mjs +1 -1
- package/sources/object-deleted/object-deleted.mjs +2 -2
- package/sources/object-deleted-instant/object-deleted-instant.mjs +2 -2
- package/sources/object-updated/object-updated.mjs +2 -2
- package/sources/object-updated-instant/object-updated-instant.mjs +2 -2
- package/sources/updated-field-on-record/updated-field-on-record.mjs +2 -2
- package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +2 -2
- package/actions/salesforce-create-account/salesforce-create-account.mjs +0 -374
- package/actions/salesforce-create-attachment/salesforce-create-attachment.mjs +0 -73
- package/actions/salesforce-create-campaign/salesforce-create-campaign.mjs +0 -148
- package/actions/salesforce-create-case/salesforce-create-case.mjs +0 -179
- package/actions/salesforce-create-casecomment/salesforce-create-casecomment.mjs +0 -58
- package/actions/salesforce-create-contact/salesforce-create-contact.mjs +0 -340
- package/actions/salesforce-create-event/salesforce-create-event.mjs +0 -232
- package/actions/salesforce-create-lead/salesforce-create-lead.mjs +0 -267
- package/actions/salesforce-create-note/salesforce-create-note.mjs +0 -63
- package/actions/salesforce-create-opportunity/salesforce-create-opportunity.mjs +0 -170
- package/actions/salesforce-create-record/salesforce-create-record.mjs +0 -36
- package/actions/salesforce-create-task/salesforce-create-task.mjs +0 -219
- package/actions/salesforce-delete-opportunity/salesforce-delete-opportunity.mjs +0 -37
- package/actions/salesforce-get-sobject-fields-values/salesforce-get-sobject-fields-values.mjs +0 -37
- package/actions/salesforce-insert-blob-data/salesforce-insert-blob-data.mjs +0 -70
- package/actions/salesforce-make-api-call/salesforce-make-api-call.mjs +0 -56
- package/actions/salesforce-soql-search/salesforce-soql-search.mjs +0 -29
- package/actions/salesforce-sosl-search/salesforce-sosl-search.mjs +0 -30
- package/actions/salesforce-update-account/salesforce-update-account.mjs +0 -357
- package/actions/salesforce-update-contact/salesforce-update-contact.mjs +0 -345
- package/actions/salesforce-update-opportunity/salesforce-update-opportunity.mjs +0 -171
- package/actions/salesforce-update-record/salesforce-update-record.mjs +0 -40
- package/utils.mjs +0 -27
|
@@ -6,29 +6,35 @@ export default {
|
|
|
6
6
|
type: "app",
|
|
7
7
|
app: "salesforce_rest_api",
|
|
8
8
|
propDefinitions: {
|
|
9
|
+
sobjectId: {
|
|
10
|
+
type: "string",
|
|
11
|
+
label: "SObject ID",
|
|
12
|
+
description: "ID of the Standard object to get field values from",
|
|
13
|
+
async options(context) {
|
|
14
|
+
const { objectType } = context;
|
|
15
|
+
const { recentItems } = await this.listSObjectTypeIds(objectType);
|
|
16
|
+
return recentItems.map((item) => ({
|
|
17
|
+
label: item.Name,
|
|
18
|
+
value: item.Id,
|
|
19
|
+
}));
|
|
20
|
+
},
|
|
21
|
+
},
|
|
9
22
|
objectType: {
|
|
10
23
|
type: "string",
|
|
11
|
-
label: "
|
|
12
|
-
description: "
|
|
24
|
+
label: "SObject Type",
|
|
25
|
+
description: "Standard object type of the record to get field values from",
|
|
13
26
|
async options(context) {
|
|
14
|
-
const {
|
|
15
|
-
page,
|
|
16
|
-
eventType,
|
|
17
|
-
} = context;
|
|
27
|
+
const { page } = context;
|
|
18
28
|
if (page !== 0) {
|
|
19
|
-
// The list of allowed SObject types is static and exhaustively
|
|
20
|
-
// provided through a single method call
|
|
21
29
|
return [];
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
options,
|
|
31
|
-
};
|
|
31
|
+
const { sobjects } = await this.listSObjectTypes();
|
|
32
|
+
return sobjects
|
|
33
|
+
.filter((sobject) => sobject.replicateable)
|
|
34
|
+
.map((sobject) => ({
|
|
35
|
+
label: sobject.label,
|
|
36
|
+
value: sobject.name,
|
|
37
|
+
}));
|
|
32
38
|
},
|
|
33
39
|
},
|
|
34
40
|
field: {
|
|
@@ -41,9 +47,7 @@ export default {
|
|
|
41
47
|
objectType,
|
|
42
48
|
} = context;
|
|
43
49
|
if (page !== 0) {
|
|
44
|
-
return
|
|
45
|
-
options: [],
|
|
46
|
-
};
|
|
50
|
+
return [];
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
const fields = await this.getFieldsForObjectType(objectType);
|
|
@@ -53,9 +57,35 @@ export default {
|
|
|
53
57
|
fieldUpdatedTo: {
|
|
54
58
|
type: "string",
|
|
55
59
|
label: "Field Updated to",
|
|
56
|
-
description:
|
|
60
|
+
description:
|
|
61
|
+
"If provided, the trigger will only fire when the updated field is an EXACT MATCH (including spacing and casing) to the value you provide in this field",
|
|
57
62
|
optional: true,
|
|
58
63
|
},
|
|
64
|
+
fieldSelector: {
|
|
65
|
+
type: "string[]",
|
|
66
|
+
label: "Field Selector",
|
|
67
|
+
description: "Select fields for the Standard Object",
|
|
68
|
+
options: () => [], // override options for each object, e.g., () => Object.keys(account)
|
|
69
|
+
},
|
|
70
|
+
AcceptedEventInviteeIds: {
|
|
71
|
+
type: "string[]",
|
|
72
|
+
label: "Accepted Event Invitee IDs",
|
|
73
|
+
async options() {
|
|
74
|
+
const { recentItems: contacts } = await this.listSObjectTypeIds("Contact");
|
|
75
|
+
const { recentItems: leads } = await this.listSObjectTypeIds("Lead");
|
|
76
|
+
const allContacts = [
|
|
77
|
+
...contacts,
|
|
78
|
+
...leads,
|
|
79
|
+
];
|
|
80
|
+
return allContacts.map(({
|
|
81
|
+
Name, Id,
|
|
82
|
+
}) => ({
|
|
83
|
+
label: Name,
|
|
84
|
+
value: Id,
|
|
85
|
+
}));
|
|
86
|
+
},
|
|
87
|
+
description: "A string array of contact or lead IDs who accepted this event. This JunctionIdList is linked to the AcceptedEventRelation child relationship. Warning Adding a JunctionIdList field name to the fieldsToNull property deletes all related junction records. This action can't be undone.",
|
|
88
|
+
},
|
|
59
89
|
},
|
|
60
90
|
methods: {
|
|
61
91
|
_authToken() {
|
|
@@ -80,34 +110,46 @@ export default {
|
|
|
80
110
|
},
|
|
81
111
|
_baseApiUrl() {
|
|
82
112
|
return (
|
|
83
|
-
this._instanceUrl() ||
|
|
84
|
-
`https://${this._subdomain()}.salesforce.com`
|
|
113
|
+
this._instanceUrl() || `https://${this._subdomain()}.salesforce.com`
|
|
85
114
|
);
|
|
86
115
|
},
|
|
87
116
|
_userApiUrl() {
|
|
88
117
|
const baseUrl = this._baseApiUrl();
|
|
89
118
|
return `${baseUrl}/services/oauth2/userinfo`;
|
|
90
119
|
},
|
|
120
|
+
_baseApiVersionUrl() {
|
|
121
|
+
const baseUrl = this._baseApiUrl();
|
|
122
|
+
const apiVersion = this._apiVersion();
|
|
123
|
+
return `${baseUrl}/services/data/v${apiVersion}`;
|
|
124
|
+
},
|
|
91
125
|
_sObjectsApiUrl() {
|
|
126
|
+
const baseUrl = this._baseApiVersionUrl();
|
|
127
|
+
return `${baseUrl}/sobjects`;
|
|
128
|
+
},
|
|
129
|
+
_sCompositeApiUrl() {
|
|
92
130
|
const baseUrl = this._baseApiUrl();
|
|
93
131
|
const apiVersion = this._apiVersion();
|
|
94
|
-
return `${baseUrl}/services/data/v${apiVersion}/sobjects`;
|
|
132
|
+
return `${baseUrl}/services/data/v${apiVersion}/composite/sobjects`;
|
|
95
133
|
},
|
|
96
|
-
|
|
134
|
+
_sObjectTypeApiUrl(sObjectType) {
|
|
97
135
|
const baseUrl = this._sObjectsApiUrl();
|
|
98
|
-
return `${baseUrl}/${sObjectType}
|
|
136
|
+
return `${baseUrl}/${sObjectType}`;
|
|
137
|
+
},
|
|
138
|
+
_sObjectTypeDescriptionApiUrl(sObjectType) {
|
|
139
|
+
const baseUrl = this._sObjectTypeApiUrl(sObjectType);
|
|
140
|
+
return `${baseUrl}/describe`;
|
|
99
141
|
},
|
|
100
142
|
_sObjectTypeUpdatedApiUrl(sObjectType) {
|
|
101
|
-
const baseUrl = this.
|
|
102
|
-
return `${baseUrl}
|
|
143
|
+
const baseUrl = this._sObjectTypeApiUrl(sObjectType);
|
|
144
|
+
return `${baseUrl}/updated`;
|
|
103
145
|
},
|
|
104
146
|
_sObjectTypeDeletedApiUrl(sObjectType) {
|
|
105
|
-
const baseUrl = this.
|
|
106
|
-
return `${baseUrl}
|
|
147
|
+
const baseUrl = this._sObjectTypeApiUrl(sObjectType);
|
|
148
|
+
return `${baseUrl}/deleted`;
|
|
107
149
|
},
|
|
108
150
|
_sObjectDetailsApiUrl(sObjectType, id) {
|
|
109
|
-
const baseUrl = this.
|
|
110
|
-
return `${baseUrl}/${
|
|
151
|
+
const baseUrl = this._sObjectTypeApiUrl(sObjectType);
|
|
152
|
+
return `${baseUrl}/${id}`;
|
|
111
153
|
},
|
|
112
154
|
_makeRequestHeaders() {
|
|
113
155
|
const authToken = this._authToken();
|
|
@@ -147,8 +189,17 @@ export default {
|
|
|
147
189
|
};
|
|
148
190
|
return new SalesforceClient(clientOpts);
|
|
149
191
|
},
|
|
192
|
+
async additionalProps(selector, sobject) {
|
|
193
|
+
return selector.reduce((props, prop) => ({
|
|
194
|
+
...props,
|
|
195
|
+
[prop]: sobject[prop],
|
|
196
|
+
}), {});
|
|
197
|
+
},
|
|
150
198
|
isHistorySObject(sobject) {
|
|
151
|
-
return
|
|
199
|
+
return (
|
|
200
|
+
sobject.associateEntityType === "History" &&
|
|
201
|
+
sobject.name.includes("History")
|
|
202
|
+
);
|
|
152
203
|
},
|
|
153
204
|
listAllowedSObjectTypes(eventType) {
|
|
154
205
|
const verbose = true;
|
|
@@ -180,6 +231,12 @@ export default {
|
|
|
180
231
|
url,
|
|
181
232
|
});
|
|
182
233
|
},
|
|
234
|
+
async listSObjectTypeIds(objectType) {
|
|
235
|
+
const url = this._sObjectTypeApiUrl(objectType);
|
|
236
|
+
return this._makeRequest({
|
|
237
|
+
url,
|
|
238
|
+
});
|
|
239
|
+
},
|
|
183
240
|
async getNameFieldForObjectType(objectType) {
|
|
184
241
|
const url = this._sObjectTypeDescriptionApiUrl(objectType);
|
|
185
242
|
const data = await this._makeRequest({
|
|
@@ -200,15 +257,39 @@ export default {
|
|
|
200
257
|
async getHistorySObjectForObjectType(objectType) {
|
|
201
258
|
const { sobjects } = await this.listSObjectTypes();
|
|
202
259
|
const historyObject = sobjects.find(
|
|
203
|
-
(sobject) =>
|
|
204
|
-
|
|
260
|
+
(sobject) =>
|
|
261
|
+
sobject.associateParentEntity === objectType &&
|
|
262
|
+
this.isHistorySObject(sobject),
|
|
205
263
|
);
|
|
206
264
|
return historyObject;
|
|
207
265
|
},
|
|
208
|
-
async
|
|
266
|
+
async createObject(objectType, data) {
|
|
267
|
+
const url = `${this._sObjectsApiUrl()}/${objectType}`;
|
|
268
|
+
return this._makeRequest({
|
|
269
|
+
url,
|
|
270
|
+
data,
|
|
271
|
+
method: "POST",
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
async deleteObject(objectType, sobjectId) {
|
|
275
|
+
const url = `${this._sObjectsApiUrl()}/${objectType}/${sobjectId}`;
|
|
276
|
+
return this._makeRequest({
|
|
277
|
+
url,
|
|
278
|
+
method: "DELETE",
|
|
279
|
+
});
|
|
280
|
+
},
|
|
281
|
+
async getRecords(objectType, params) {
|
|
282
|
+
const url = `${this._sCompositeApiUrl()}/${objectType}`;
|
|
283
|
+
return this._makeRequest({
|
|
284
|
+
url,
|
|
285
|
+
params,
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
async getSObject(objectType, id, params = null) {
|
|
209
289
|
const url = this._sObjectDetailsApiUrl(objectType, id);
|
|
210
290
|
return this._makeRequest({
|
|
211
291
|
url,
|
|
292
|
+
params,
|
|
212
293
|
});
|
|
213
294
|
},
|
|
214
295
|
async getUpdatedForObjectType(objectType, start, end) {
|
|
@@ -239,9 +320,240 @@ export default {
|
|
|
239
320
|
url,
|
|
240
321
|
headers: {
|
|
241
322
|
...this._makeRequestHeaders(),
|
|
242
|
-
|
|
323
|
+
Authorization: `Bearer ${authToken}`,
|
|
243
324
|
},
|
|
244
325
|
});
|
|
245
326
|
},
|
|
327
|
+
async createAccount({
|
|
328
|
+
$, data,
|
|
329
|
+
}) {
|
|
330
|
+
const url = this._sObjectTypeApiUrl("Account");
|
|
331
|
+
return this._makeRequest({
|
|
332
|
+
$,
|
|
333
|
+
url,
|
|
334
|
+
method: "POST",
|
|
335
|
+
data,
|
|
336
|
+
});
|
|
337
|
+
},
|
|
338
|
+
async updateAccount({
|
|
339
|
+
$, id, data,
|
|
340
|
+
}) {
|
|
341
|
+
const url = this._sObjectDetailsApiUrl("Account", id);
|
|
342
|
+
return this._makeRequest({
|
|
343
|
+
$,
|
|
344
|
+
url,
|
|
345
|
+
method: "PATCH",
|
|
346
|
+
data,
|
|
347
|
+
});
|
|
348
|
+
},
|
|
349
|
+
async createAttachment({
|
|
350
|
+
$, data,
|
|
351
|
+
}) {
|
|
352
|
+
const url = this._sObjectTypeApiUrl("Attachment");
|
|
353
|
+
return this._makeRequest({
|
|
354
|
+
$,
|
|
355
|
+
url,
|
|
356
|
+
method: "POST",
|
|
357
|
+
data,
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
async createCampaign({
|
|
361
|
+
$, data,
|
|
362
|
+
}) {
|
|
363
|
+
const url = this._sObjectTypeApiUrl("Campaign");
|
|
364
|
+
return this._makeRequest({
|
|
365
|
+
$,
|
|
366
|
+
url,
|
|
367
|
+
method: "POST",
|
|
368
|
+
data,
|
|
369
|
+
});
|
|
370
|
+
},
|
|
371
|
+
async createCase({
|
|
372
|
+
$, data,
|
|
373
|
+
}) {
|
|
374
|
+
const url = this._sObjectTypeApiUrl("Case");
|
|
375
|
+
return this._makeRequest({
|
|
376
|
+
$,
|
|
377
|
+
url,
|
|
378
|
+
method: "POST",
|
|
379
|
+
data,
|
|
380
|
+
});
|
|
381
|
+
},
|
|
382
|
+
async createCaseComment({
|
|
383
|
+
$, data,
|
|
384
|
+
}) {
|
|
385
|
+
const url = this._sObjectTypeApiUrl("CaseComment");
|
|
386
|
+
return this._makeRequest({
|
|
387
|
+
$,
|
|
388
|
+
url,
|
|
389
|
+
method: "POST",
|
|
390
|
+
data,
|
|
391
|
+
});
|
|
392
|
+
},
|
|
393
|
+
async createContact({
|
|
394
|
+
$, data,
|
|
395
|
+
}) {
|
|
396
|
+
const url = this._sObjectTypeApiUrl("Contact");
|
|
397
|
+
return this._makeRequest({
|
|
398
|
+
$,
|
|
399
|
+
url,
|
|
400
|
+
method: "POST",
|
|
401
|
+
data,
|
|
402
|
+
});
|
|
403
|
+
},
|
|
404
|
+
async updateContact({
|
|
405
|
+
$, id, data,
|
|
406
|
+
}) {
|
|
407
|
+
const url = this._sObjectDetailsApiUrl("Contact", id);
|
|
408
|
+
return this._makeRequest({
|
|
409
|
+
$,
|
|
410
|
+
url,
|
|
411
|
+
method: "PATCH",
|
|
412
|
+
data,
|
|
413
|
+
});
|
|
414
|
+
},
|
|
415
|
+
async createEvent({
|
|
416
|
+
$, data,
|
|
417
|
+
}) {
|
|
418
|
+
const url = this._sObjectTypeApiUrl("Event");
|
|
419
|
+
return this._makeRequest({
|
|
420
|
+
$,
|
|
421
|
+
url,
|
|
422
|
+
method: "POST",
|
|
423
|
+
data,
|
|
424
|
+
});
|
|
425
|
+
},
|
|
426
|
+
async createLead({
|
|
427
|
+
$, data,
|
|
428
|
+
}) {
|
|
429
|
+
const url = this._sObjectTypeApiUrl("Lead");
|
|
430
|
+
return this._makeRequest({
|
|
431
|
+
$,
|
|
432
|
+
url,
|
|
433
|
+
method: "POST",
|
|
434
|
+
data,
|
|
435
|
+
});
|
|
436
|
+
},
|
|
437
|
+
async createNote({
|
|
438
|
+
$, data,
|
|
439
|
+
}) {
|
|
440
|
+
const url = this._sObjectTypeApiUrl("Note");
|
|
441
|
+
return this._makeRequest({
|
|
442
|
+
$,
|
|
443
|
+
url,
|
|
444
|
+
method: "POST",
|
|
445
|
+
data,
|
|
446
|
+
});
|
|
447
|
+
},
|
|
448
|
+
async createOpportunity({
|
|
449
|
+
$, data,
|
|
450
|
+
}) {
|
|
451
|
+
const url = this._sObjectTypeApiUrl("Opportunity");
|
|
452
|
+
return this._makeRequest({
|
|
453
|
+
$,
|
|
454
|
+
url,
|
|
455
|
+
method: "POST",
|
|
456
|
+
data,
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
async updateOpportunity({
|
|
460
|
+
$, id, data,
|
|
461
|
+
}) {
|
|
462
|
+
const url = this._sObjectDetailsApiUrl("Opportunity", id);
|
|
463
|
+
return this._makeRequest({
|
|
464
|
+
$,
|
|
465
|
+
url,
|
|
466
|
+
method: "PATCH",
|
|
467
|
+
data,
|
|
468
|
+
});
|
|
469
|
+
},
|
|
470
|
+
async getRecordFieldValues(sobjectName, {
|
|
471
|
+
$, id, params,
|
|
472
|
+
}) {
|
|
473
|
+
const url = this._sObjectDetailsApiUrl(sobjectName, id);
|
|
474
|
+
return this._makeRequest({
|
|
475
|
+
$,
|
|
476
|
+
url,
|
|
477
|
+
params,
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
async createRecord(sobjectName, {
|
|
481
|
+
$, data,
|
|
482
|
+
}) {
|
|
483
|
+
const url = this._sObjectTypeApiUrl(sobjectName);
|
|
484
|
+
return this._makeRequest({
|
|
485
|
+
$,
|
|
486
|
+
url,
|
|
487
|
+
method: "POST",
|
|
488
|
+
data,
|
|
489
|
+
});
|
|
490
|
+
},
|
|
491
|
+
async updateRecord(sobjectName, {
|
|
492
|
+
$, id, data,
|
|
493
|
+
}) {
|
|
494
|
+
const url = this._sObjectDetailsApiUrl(sobjectName, id);
|
|
495
|
+
return this._makeRequest({
|
|
496
|
+
$,
|
|
497
|
+
url,
|
|
498
|
+
method: "PATCH",
|
|
499
|
+
data,
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
async createTask({
|
|
503
|
+
$, data,
|
|
504
|
+
}) {
|
|
505
|
+
const url = this._sObjectTypeApiUrl("Task");
|
|
506
|
+
return this._makeRequest({
|
|
507
|
+
$,
|
|
508
|
+
url,
|
|
509
|
+
method: "POST",
|
|
510
|
+
data,
|
|
511
|
+
});
|
|
512
|
+
},
|
|
513
|
+
async deleteOpportunity({
|
|
514
|
+
$, id,
|
|
515
|
+
}) {
|
|
516
|
+
const url = this._sObjectDetailsApiUrl("Opportunity", id);
|
|
517
|
+
return this._makeRequest({
|
|
518
|
+
$,
|
|
519
|
+
url,
|
|
520
|
+
method: "DELETE",
|
|
521
|
+
});
|
|
522
|
+
},
|
|
523
|
+
async query({
|
|
524
|
+
$, query,
|
|
525
|
+
}) {
|
|
526
|
+
const baseUrl = this._baseApiVersionUrl();
|
|
527
|
+
const url = `${baseUrl}/query/?q=${encodeURI(query)}`;
|
|
528
|
+
return this._makeRequest({
|
|
529
|
+
$,
|
|
530
|
+
url,
|
|
531
|
+
});
|
|
532
|
+
},
|
|
533
|
+
async search({
|
|
534
|
+
$, search,
|
|
535
|
+
}) {
|
|
536
|
+
const baseUrl = this._baseApiVersionUrl();
|
|
537
|
+
const url = `${baseUrl}/search/?q=${encodeURI(search)}`;
|
|
538
|
+
return this._makeRequest({
|
|
539
|
+
$,
|
|
540
|
+
url,
|
|
541
|
+
});
|
|
542
|
+
},
|
|
543
|
+
async insertBlobData(sobjectName, {
|
|
544
|
+
$, headers, data,
|
|
545
|
+
}) {
|
|
546
|
+
const url = this._sObjectTypeApiUrl(sobjectName);
|
|
547
|
+
const requestConfig = {
|
|
548
|
+
url,
|
|
549
|
+
method: "POST",
|
|
550
|
+
data,
|
|
551
|
+
headers: {
|
|
552
|
+
...this._makeRequestHeaders(),
|
|
553
|
+
...headers,
|
|
554
|
+
},
|
|
555
|
+
};
|
|
556
|
+
return axios($ ?? this, requestConfig);
|
|
557
|
+
},
|
|
246
558
|
},
|
|
247
559
|
};
|
|
@@ -12,17 +12,23 @@ export default {
|
|
|
12
12
|
customResponse: true,
|
|
13
13
|
},
|
|
14
14
|
salesforce,
|
|
15
|
-
// Not inheriting `objectType` propDefinition from salesforce so `this` in async options has
|
|
16
|
-
// component instance's methods
|
|
17
15
|
objectType: {
|
|
18
|
-
|
|
19
|
-
label:
|
|
20
|
-
description:
|
|
16
|
+
type: "string",
|
|
17
|
+
label: "Object Type",
|
|
18
|
+
description: "The type of object for which to monitor events",
|
|
21
19
|
async options(context) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const { page } = context;
|
|
21
|
+
if (page !== 0) {
|
|
22
|
+
// The list of allowed SObject types is static and exhaustively
|
|
23
|
+
// provided through a single method call
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const supportedObjectTypes = this.salesforce.listAllowedSObjectTypes(this.getEventType());
|
|
28
|
+
return supportedObjectTypes.map((i) => ({
|
|
29
|
+
label: i.label,
|
|
30
|
+
value: i.name,
|
|
31
|
+
}));
|
|
26
32
|
},
|
|
27
33
|
},
|
|
28
34
|
},
|
package/sources/common.mjs
CHANGED
|
@@ -12,12 +12,10 @@ export default {
|
|
|
12
12
|
intervalSeconds: 60 * 15, // 15 minutes
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
|
-
// Not inheriting `objectType` propDefinition from salesforce so `this` in async options has
|
|
16
|
-
// component instance's methods
|
|
17
15
|
objectType: {
|
|
18
|
-
|
|
19
|
-
label:
|
|
20
|
-
description:
|
|
16
|
+
type: "string",
|
|
17
|
+
label: "Object Type",
|
|
18
|
+
description: "The type of object for which to monitor events",
|
|
21
19
|
async options(context) {
|
|
22
20
|
const { page } = context;
|
|
23
21
|
if (page !== 0) {
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Object (of Selectable Type)",
|
|
9
9
|
key: "salesforce_rest_api-new-object",
|
|
10
10
|
description: "Emit new event (at regular intervals) when an object of arbitrary type (selected as an input parameter by the user) is created. See [the docs](https://sforce.co/3yPSJZy) for more information.",
|
|
11
|
-
version: "0.0
|
|
11
|
+
version: "0.1.0",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
isItemRelevant(item, startTimestamp, endTimestamp) {
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Object (Instant, of Selectable Type)",
|
|
9
9
|
key: "salesforce_rest_api-new-object-instant",
|
|
10
10
|
description: "Emit new event immediately after an object of arbitrary type (selected as an input parameter by the user) is created",
|
|
11
|
-
version: "0.0
|
|
11
|
+
version: "0.1.0",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(data) {
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "New Outbound Message (Instant)",
|
|
7
7
|
key: "salesforce_rest_api-new-outbound-message",
|
|
8
8
|
description: "Emit new event when a new outbound message is received in Salesforce. See Salesforce's guide on setting up [Outbound Messaging](https://sforce.co/3JbZJom). Set the Outbound Message's Endpoint URL to the endpoint of the created source. The \"Send Session ID\" option must be enabled for validating outbound messages from Salesforce.",
|
|
9
|
-
version: "0.0
|
|
9
|
+
version: "0.1.0",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
db: "$.service.db",
|
|
@@ -5,10 +5,10 @@ import common from "../common.mjs";
|
|
|
5
5
|
export default {
|
|
6
6
|
...common,
|
|
7
7
|
type: "source",
|
|
8
|
-
name: "
|
|
8
|
+
name: "New Deleted Object (of Selectable Type)",
|
|
9
9
|
key: "salesforce_rest_api-object-deleted",
|
|
10
10
|
description: "Emit new event (at regular intervals) when an object of arbitrary type (selected as an input parameter by the user) is deleted. [See the docs](https://sforce.co/3msDDEE) for more information.",
|
|
11
|
-
version: "0.0
|
|
11
|
+
version: "0.1.0",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(item) {
|
|
@@ -5,10 +5,10 @@ import common from "../common-instant.mjs";
|
|
|
5
5
|
export default {
|
|
6
6
|
...common,
|
|
7
7
|
type: "source",
|
|
8
|
-
name: "
|
|
8
|
+
name: "New Deleted Object (Instant, of Selectable Type)",
|
|
9
9
|
key: "salesforce_rest_api-object-deleted-instant",
|
|
10
10
|
description: "Emit new event immediately after an object of arbitrary type (selected as an input parameter by the user) is deleted",
|
|
11
|
-
version: "0.0
|
|
11
|
+
version: "0.1.0",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(data) {
|
|
@@ -5,10 +5,10 @@ import common from "../common.mjs";
|
|
|
5
5
|
export default {
|
|
6
6
|
...common,
|
|
7
7
|
type: "source",
|
|
8
|
-
name: "
|
|
8
|
+
name: "New Updated Object (of Selectable Type)",
|
|
9
9
|
key: "salesforce_rest_api-object-updated",
|
|
10
10
|
description: "Emit new event (at regular intervals) when an object of arbitrary type (selected as an input parameter by the user) is updated. [See the docs](https://sforce.co/3yPSJZy) for more information.",
|
|
11
|
-
version: "0.0
|
|
11
|
+
version: "0.1.0",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(item) {
|
|
@@ -5,10 +5,10 @@ import common from "../common-instant.mjs";
|
|
|
5
5
|
export default {
|
|
6
6
|
...common,
|
|
7
7
|
type: "source",
|
|
8
|
-
name: "
|
|
8
|
+
name: "New Updated Object (Instant, of Selectable Type)",
|
|
9
9
|
key: "salesforce_rest_api-object-updated-instant",
|
|
10
10
|
description: "Emit new event immediately after an object of arbitrary type (selected as an input parameter by the user) is updated",
|
|
11
|
-
version: "0.0
|
|
11
|
+
version: "0.1.0",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(data) {
|
|
@@ -12,10 +12,10 @@ const { salesforce } = common.props;
|
|
|
12
12
|
export default {
|
|
13
13
|
...common,
|
|
14
14
|
type: "source",
|
|
15
|
-
name: "Updated Field on Record (of Selectable Type)",
|
|
15
|
+
name: "New Updated Field on Record (of Selectable Type)",
|
|
16
16
|
key: "salesforce_rest_api-updated-field-on-record",
|
|
17
17
|
description: "Emit new event (at regular intervals) when a field of your choosing is updated on any record of a specified Salesforce object. Field history tracking must be enabled for the chosen field. See the docs on [field history tracking](https://sforce.co/3mtj0rF) and [history objects](https://sforce.co/3Fn4lWB) for more information.",
|
|
18
|
-
version: "0.0
|
|
18
|
+
version: "0.1.0",
|
|
19
19
|
props: {
|
|
20
20
|
...common.props,
|
|
21
21
|
objectType: {
|
|
@@ -6,10 +6,10 @@ const { salesforce } = common.props;
|
|
|
6
6
|
export default {
|
|
7
7
|
...common,
|
|
8
8
|
type: "source",
|
|
9
|
-
name: "Updated Field on Record (Instant, of Selectable Type)",
|
|
9
|
+
name: "New Updated Field on Record (Instant, of Selectable Type)",
|
|
10
10
|
key: "salesforce_rest_api-updated-field-on-record-instant",
|
|
11
11
|
description: "Emit new event immediately after a field of your choosing is updated on any record of a specified Salesforce object",
|
|
12
|
-
version: "0.0
|
|
12
|
+
version: "0.1.0",
|
|
13
13
|
props: {
|
|
14
14
|
...common.props,
|
|
15
15
|
field: {
|