@pipedream/salesforce_rest_api 0.4.8 → 0.4.9
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/add-contact-to-campaign/add-contact-to-campaign.mjs +1 -1
- package/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +1 -1
- package/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +1 -1
- package/actions/create-account/create-account.mjs +1 -1
- package/actions/create-attachment/create-attachment.mjs +1 -1
- package/actions/create-campaign/create-campaign.mjs +1 -1
- package/actions/create-case/create-case.mjs +1 -1
- package/actions/create-casecomment/create-casecomment.mjs +1 -1
- package/actions/create-contact/create-contact.mjs +1 -1
- package/actions/create-event/create-event.mjs +1 -1
- package/actions/create-lead/create-lead.mjs +1 -1
- package/actions/create-note/create-note.mjs +1 -1
- package/actions/create-opportunity/create-opportunity.mjs +1 -1
- package/actions/create-record/create-record.mjs +1 -1
- package/actions/create-task/create-task.mjs +1 -1
- package/actions/delete-opportunity/delete-opportunity.mjs +1 -1
- package/actions/delete-record/delete-record.mjs +1 -1
- package/actions/find-create-record/find-create-record.mjs +1 -1
- package/actions/find-records/find-records.mjs +1 -1
- package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +1 -1
- package/actions/insert-blob-data/insert-blob-data.mjs +1 -1
- package/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +1 -1
- package/actions/soql-search/soql-search.mjs +1 -1
- package/actions/sosl-search/sosl-search.mjs +1 -1
- package/actions/update-account/update-account.mjs +1 -1
- package/actions/update-contact/update-contact.mjs +1 -1
- package/actions/update-opportunity/update-opportunity.mjs +1 -1
- package/actions/update-record/update-record.mjs +1 -1
- package/package.json +4 -2
- package/salesforce_rest_api.app.mjs +4 -6
- package/sources/common.mjs +22 -0
- package/sources/new-object/new-object.mjs +18 -13
- 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 +1 -1
- package/sources/object-deleted-instant/object-deleted-instant.mjs +1 -1
- package/sources/object-updated/object-updated.mjs +14 -12
- package/sources/object-updated-instant/object-updated-instant.mjs +1 -1
- package/sources/updated-field-on-record/updated-field-on-record.mjs +58 -38
- package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +1 -1
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)
|
|
13
13
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
14
14
|
`),
|
|
15
|
-
version: "0.0.
|
|
15
|
+
version: "0.0.3",
|
|
16
16
|
type: "action",
|
|
17
17
|
props: {
|
|
18
18
|
salesForceRestApi,
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)
|
|
13
13
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
14
14
|
`),
|
|
15
|
-
version: "0.0.
|
|
15
|
+
version: "0.0.3",
|
|
16
16
|
type: "action",
|
|
17
17
|
props: {
|
|
18
18
|
salesForceRestApi,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "salesforce_rest_api-convert-soap-xml-to-json",
|
|
6
6
|
name: "Convert SOAP XML Object to JSON",
|
|
7
7
|
description: "Converts a SOAP XML Object received from Salesforce to JSON",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
salesforce_rest_api,
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm)
|
|
15
15
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
16
16
|
`),
|
|
17
|
-
version: "0.2.
|
|
17
|
+
version: "0.2.4",
|
|
18
18
|
type: "action",
|
|
19
19
|
props: {
|
|
20
20
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Attachment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.3.
|
|
16
|
+
version: "0.3.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Campaign SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaign.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Case SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_case.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [CaseComment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_casecomment.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_event.htm)
|
|
12
12
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
13
13
|
`),
|
|
14
|
-
version: "0.2.
|
|
14
|
+
version: "0.2.4",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Lead SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_lead.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Note SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_note.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
Create new records of a given resource.
|
|
9
9
|
See [docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
10
10
|
`),
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.4",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Task SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_task.htm)
|
|
14
14
|
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.3.
|
|
16
|
+
version: "0.3.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm)
|
|
10
10
|
and [Delete Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm)
|
|
11
11
|
`),
|
|
12
|
-
version: "0.2.
|
|
12
|
+
version: "0.2.4",
|
|
13
13
|
type: "action",
|
|
14
14
|
props: {
|
|
15
15
|
salesforce,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Delete a Record in an Object",
|
|
6
6
|
description:
|
|
7
7
|
"Deletes an existing record in an object. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
salesForceRestApi,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Get Field Values from Object Record and optionally create one is none is found. ",
|
|
7
7
|
description:
|
|
8
8
|
"Finds a specified Salesforce record by a field. Optionally, create one if none is found. [API Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.2",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
salesForceRestApi,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Get Object Records",
|
|
6
6
|
description:
|
|
7
7
|
"Retrieves all records in an object or a record in an object by the given ID or criteria. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
salesForceRestApi,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
Retrieve field values from a record. You can specify the fields you want to retrieve.
|
|
9
9
|
See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_get_field_values.htm)
|
|
10
10
|
`),
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.4",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesforce,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
Inserts blob data in Salesforce standard objects.
|
|
9
9
|
See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm)
|
|
10
10
|
`),
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.4",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesforce,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
Posts a message to the Chatter Feed.
|
|
9
9
|
[See doc](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm)
|
|
10
10
|
`),
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.3",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesForceRestApi,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
Executes the specified SOSL search.
|
|
9
9
|
See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl.htm)
|
|
10
10
|
`),
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.4",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesforce,
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm)
|
|
15
15
|
and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
16
16
|
`),
|
|
17
|
-
version: "0.2.
|
|
17
|
+
version: "0.2.4",
|
|
18
18
|
type: "action",
|
|
19
19
|
props: {
|
|
20
20
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm)
|
|
14
14
|
and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm)
|
|
14
14
|
and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
15
15
|
`),
|
|
16
|
-
version: "0.2.
|
|
16
|
+
version: "0.2.4",
|
|
17
17
|
type: "action",
|
|
18
18
|
props: {
|
|
19
19
|
salesforce,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
Updates a record of a given resource.
|
|
9
9
|
[See docs here](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
10
10
|
`),
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.4",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesforce,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/salesforce_rest_api",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "Pipedream Salesforce (REST API) Components",
|
|
5
5
|
"main": "salesforce_rest_api.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@pipedream/platform": "^1.2.0",
|
|
14
|
+
"fast-xml-parser": "^4.3.2",
|
|
14
15
|
"handlebars": "^4.7.7",
|
|
15
16
|
"lodash": "^4.17.21",
|
|
16
17
|
"lodash-es": "^4.17.21",
|
|
17
|
-
"salesforce-webhooks": "^1.1.11"
|
|
18
|
+
"salesforce-webhooks": "^1.1.11",
|
|
19
|
+
"uuid": "^9.0.1"
|
|
18
20
|
},
|
|
19
21
|
"gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
|
|
20
22
|
"publishConfig": {
|
|
@@ -37,17 +37,15 @@ export default {
|
|
|
37
37
|
type: "string",
|
|
38
38
|
label: "Field",
|
|
39
39
|
description: "The object field to watch for changes",
|
|
40
|
-
async options(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
objectType,
|
|
44
|
-
} = context;
|
|
40
|
+
async options({
|
|
41
|
+
page, objectType, filter = () => true,
|
|
42
|
+
}) {
|
|
45
43
|
if (page !== 0) {
|
|
46
44
|
return [];
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
const fields = await this.getFieldsForObjectType(objectType);
|
|
50
|
-
return fields.map((
|
|
48
|
+
return fields.filter(filter).map(({ name }) => name);
|
|
51
49
|
},
|
|
52
50
|
},
|
|
53
51
|
fieldUpdatedTo: {
|
package/sources/common.mjs
CHANGED
|
@@ -51,6 +51,28 @@ export default {
|
|
|
51
51
|
processEvent() {
|
|
52
52
|
throw new Error("processEvent is not implemented");
|
|
53
53
|
},
|
|
54
|
+
getRelativeObjectUrl(id, historyObjectType) {
|
|
55
|
+
const {
|
|
56
|
+
salesforce,
|
|
57
|
+
objectType,
|
|
58
|
+
} = this;
|
|
59
|
+
return `/services/data/v${salesforce._apiVersion()}/sobjects/${historyObjectType || objectType}/${id}`;
|
|
60
|
+
},
|
|
61
|
+
getBatchRequests(ids, historyObjectType) {
|
|
62
|
+
return ids.map((id) => ({
|
|
63
|
+
method: "GET",
|
|
64
|
+
url: this.getRelativeObjectUrl(id, historyObjectType),
|
|
65
|
+
}));
|
|
66
|
+
},
|
|
67
|
+
batchRequest(args = {}) {
|
|
68
|
+
const { salesforce } = this;
|
|
69
|
+
return salesforce._makeRequest({
|
|
70
|
+
debug: true,
|
|
71
|
+
method: "POST",
|
|
72
|
+
url: `${salesforce._baseApiVersionUrl()}/composite/batch`,
|
|
73
|
+
...args,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
54
76
|
},
|
|
55
77
|
async run(event) {
|
|
56
78
|
const startTimestamp = this.getLatestDateCovered();
|
|
@@ -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.1.
|
|
11
|
+
version: "0.1.7",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
isItemRelevant(item, startTimestamp, endTimestamp) {
|
|
@@ -51,18 +51,23 @@ export default {
|
|
|
51
51
|
);
|
|
52
52
|
this.setLatestDateCovered(latestDateCovered);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.
|
|
54
|
+
if (!ids?.length) {
|
|
55
|
+
return console.log("No batch requests to send");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { results } = await this.batchRequest({
|
|
59
|
+
data: {
|
|
60
|
+
batchRequests: this.getBatchRequests(ids),
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
results
|
|
65
|
+
.filter(({
|
|
66
|
+
statusCode, result: item,
|
|
67
|
+
}) =>
|
|
68
|
+
statusCode === 200
|
|
69
|
+
&& this.isItemRelevant(item, startTimestamp, endTimestamp))
|
|
70
|
+
.forEach(({ result: item }) => {
|
|
66
71
|
const meta = this.generateMeta(item);
|
|
67
72
|
this.$emit(item, meta);
|
|
68
73
|
});
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Object (Instant, of Selectable Type)",
|
|
8
8
|
key: "salesforce_rest_api-new-object-instant",
|
|
9
9
|
description: "Emit new event immediately after an object of arbitrary type (selected as an input parameter by the user) is created",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.4",
|
|
11
11
|
hooks: {
|
|
12
12
|
...common.hooks,
|
|
13
13
|
async deploy() {
|
|
@@ -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.1.
|
|
9
|
+
version: "0.1.3",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
|
12
12
|
db: "$.service.db",
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
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.1.
|
|
11
|
+
version: "0.1.6",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(item) {
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
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.1.
|
|
11
|
+
version: "0.1.3",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(data) {
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
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.1.
|
|
11
|
+
version: "0.1.6",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(item) {
|
|
@@ -43,17 +43,19 @@ export default {
|
|
|
43
43
|
);
|
|
44
44
|
this.setLatestDateCovered(latestDateCovered);
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
if (!ids?.length) {
|
|
47
|
+
return console.log("No batch requests to send");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { results } = await this.batchRequest({
|
|
51
|
+
data: {
|
|
52
|
+
batchRequests: this.getBatchRequests(ids),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
results
|
|
57
|
+
.filter(({ statusCode }) => statusCode === 200)
|
|
58
|
+
.forEach(({ result: item }) => {
|
|
57
59
|
const meta = this.generateMeta(item);
|
|
58
60
|
this.$emit(item, meta);
|
|
59
61
|
});
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
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.1.
|
|
11
|
+
version: "0.1.3",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
14
14
|
generateMeta(data) {
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
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.1.
|
|
18
|
+
version: "0.1.6",
|
|
19
19
|
props: {
|
|
20
20
|
...common.props,
|
|
21
21
|
objectType: {
|
|
@@ -50,6 +50,7 @@ export default {
|
|
|
50
50
|
"field",
|
|
51
51
|
({ objectType }) => ({
|
|
52
52
|
objectType,
|
|
53
|
+
filter: ({ updateable }) => updateable,
|
|
53
54
|
}),
|
|
54
55
|
],
|
|
55
56
|
},
|
|
@@ -83,6 +84,12 @@ export default {
|
|
|
83
84
|
const parentIdKey = `${this.objectType}Id`;
|
|
84
85
|
return item[parentIdKey] ?? item["ParentId"];
|
|
85
86
|
},
|
|
87
|
+
getUniqueParentIds(items) {
|
|
88
|
+
// To fetch associated sObject records only once, create a set of the "parent IDs" of the
|
|
89
|
+
// history object records
|
|
90
|
+
const parentIdSet = new Set(items.map(this._getParentId).filter((id) => id));
|
|
91
|
+
return Array.from(parentIdSet);
|
|
92
|
+
},
|
|
86
93
|
isValidSObject(sobject) {
|
|
87
94
|
// Only the activity of those SObject types that have the `replicateable`
|
|
88
95
|
// flag set is published via the `getUpdated` API.
|
|
@@ -116,62 +123,75 @@ export default {
|
|
|
116
123
|
ts,
|
|
117
124
|
};
|
|
118
125
|
},
|
|
119
|
-
async processEvent(
|
|
126
|
+
async processEvent({
|
|
127
|
+
startTimestamp, endTimestamp,
|
|
128
|
+
}) {
|
|
120
129
|
const {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
salesforce,
|
|
131
|
+
_getHistoryObjectType,
|
|
132
|
+
setLatestDateCovered,
|
|
133
|
+
batchRequest,
|
|
134
|
+
getBatchRequests,
|
|
135
|
+
isRelevant,
|
|
136
|
+
getUniqueParentIds,
|
|
137
|
+
_getParentId,
|
|
138
|
+
generateMeta,
|
|
139
|
+
$emit: emit,
|
|
140
|
+
} = this;
|
|
141
|
+
|
|
142
|
+
let historyItemRetrievals = [];
|
|
143
|
+
let itemRetrievals = [];
|
|
144
|
+
const historyObjectType = _getHistoryObjectType();
|
|
125
145
|
const {
|
|
126
146
|
ids,
|
|
127
147
|
latestDateCovered,
|
|
128
|
-
} = await
|
|
148
|
+
} = await salesforce.getUpdatedForObjectType(
|
|
129
149
|
historyObjectType,
|
|
130
150
|
startTimestamp,
|
|
131
151
|
endTimestamp,
|
|
132
152
|
);
|
|
133
|
-
this.setLatestDateCovered(latestDateCovered);
|
|
134
153
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
154
|
+
setLatestDateCovered((new Date(latestDateCovered)).toISOString());
|
|
155
|
+
|
|
156
|
+
if (ids?.length) {
|
|
157
|
+
({ results: historyItemRetrievals } = await batchRequest({
|
|
158
|
+
data: {
|
|
159
|
+
batchRequests: getBatchRequests(ids, historyObjectType),
|
|
160
|
+
},
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
|
|
142
164
|
const historyItems = historyItemRetrievals
|
|
143
|
-
.filter((
|
|
144
|
-
|
|
145
|
-
|
|
165
|
+
.filter(({
|
|
166
|
+
statusCode, result: item,
|
|
167
|
+
}) => statusCode === 200 && isRelevant(item))
|
|
168
|
+
.map(({ result: item }) => item);
|
|
146
169
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
170
|
+
const parentIds = getUniqueParentIds(historyItems);
|
|
171
|
+
|
|
172
|
+
if (parentIds.length) {
|
|
173
|
+
({ results: itemRetrievals } = await batchRequest({
|
|
174
|
+
data: {
|
|
175
|
+
batchRequests: getBatchRequests(parentIds),
|
|
176
|
+
},
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
155
179
|
|
|
156
|
-
const itemRetrievals = await Promise.allSettled(
|
|
157
|
-
parentIds.map((id) => this.salesforce.getSObject(this.objectType, id)),
|
|
158
|
-
);
|
|
159
180
|
const itemsById = itemRetrievals
|
|
160
|
-
.filter((
|
|
161
|
-
.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}, {});
|
|
181
|
+
.filter(({ statusCode }) => statusCode === 200)
|
|
182
|
+
.reduce((acc, { result: item }) => ({
|
|
183
|
+
...acc,
|
|
184
|
+
[item.Id]: item,
|
|
185
|
+
}), {});
|
|
166
186
|
|
|
167
187
|
const events = historyItems.map((item) => ({
|
|
168
188
|
update: item,
|
|
169
|
-
record: itemsById[
|
|
189
|
+
record: itemsById[_getParentId(item)],
|
|
170
190
|
}));
|
|
171
191
|
|
|
172
192
|
events.forEach((event) => {
|
|
173
|
-
const meta =
|
|
174
|
-
|
|
193
|
+
const meta = generateMeta(event);
|
|
194
|
+
emit(event, meta);
|
|
175
195
|
});
|
|
176
196
|
},
|
|
177
197
|
},
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
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.1.
|
|
12
|
+
version: "0.1.3",
|
|
13
13
|
props: {
|
|
14
14
|
...common.props,
|
|
15
15
|
field: {
|