@pipedream/salesforce_rest_api 0.4.0 → 0.4.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.
Files changed (43) hide show
  1. package/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +52 -0
  2. package/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +51 -0
  3. package/actions/create-account/create-account.mjs +1 -1
  4. package/actions/create-attachment/create-attachment.mjs +1 -1
  5. package/actions/create-campaign/create-campaign.mjs +1 -1
  6. package/actions/create-case/create-case.mjs +1 -1
  7. package/actions/create-casecomment/create-casecomment.mjs +1 -1
  8. package/actions/create-contact/create-contact.mjs +1 -1
  9. package/actions/create-event/create-event.mjs +1 -1
  10. package/actions/create-lead/create-lead.mjs +1 -1
  11. package/actions/create-note/create-note.mjs +1 -1
  12. package/actions/create-opportunity/create-opportunity.mjs +1 -1
  13. package/actions/create-record/create-record.mjs +1 -1
  14. package/actions/create-task/create-task.mjs +1 -1
  15. package/actions/delete-opportunity/delete-opportunity.mjs +1 -1
  16. package/actions/delete-record/delete-record.mjs +12 -7
  17. package/actions/find-create-record/find-create-record.mjs +12 -7
  18. package/actions/find-records/find-records.mjs +16 -12
  19. package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +1 -1
  20. package/actions/insert-blob-data/insert-blob-data.mjs +1 -1
  21. package/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +39 -0
  22. package/actions/soql-search/soql-search.mjs +3 -3
  23. package/actions/sosl-search/sosl-search.mjs +1 -1
  24. package/actions/update-account/update-account.mjs +1 -1
  25. package/actions/update-contact/update-contact.mjs +1 -1
  26. package/actions/update-opportunity/update-opportunity.mjs +1 -1
  27. package/actions/update-record/update-record.mjs +1 -1
  28. package/common/constants.mjs +6 -0
  29. package/common/sobjects/contact.mjs +0 -5
  30. package/common/sobjects/lead.mjs +0 -5
  31. package/package.json +2 -2
  32. package/salesforce_rest_api.app.mjs +21 -18
  33. package/sources/common-instant.mjs +6 -16
  34. package/sources/common.mjs +5 -28
  35. package/sources/new-object/new-object.mjs +6 -4
  36. package/sources/new-object-instant/new-object-instant.mjs +1 -1
  37. package/sources/new-outbound-message/new-outbound-message.mjs +1 -1
  38. package/sources/object-deleted/object-deleted.mjs +2 -3
  39. package/sources/object-deleted-instant/object-deleted-instant.mjs +1 -1
  40. package/sources/object-updated/object-updated.mjs +3 -4
  41. package/sources/object-updated-instant/object-updated-instant.mjs +1 -1
  42. package/sources/updated-field-on-record/updated-field-on-record.mjs +3 -4
  43. package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +1 -1
@@ -0,0 +1,52 @@
1
+ import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
2
+ import {
3
+ removeNullEntries, toSingleLineString,
4
+ } from "../../common/utils.mjs";
5
+ import constants from "../../common/constants.mjs";
6
+
7
+ export default {
8
+ key: "salesforce_rest_api-add-contact-to-campaign",
9
+ name: "Add Contact to Campaign",
10
+ description: toSingleLineString(`
11
+ Adds an existing contact to an existing campaign.
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
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
14
+ `),
15
+ version: "0.0.2",
16
+ type: "action",
17
+ props: {
18
+ salesForceRestApi,
19
+ campaignId: {
20
+ propDefinition: [
21
+ salesForceRestApi,
22
+ "sobjectId",
23
+ () => ({
24
+ objectType: constants.OBJECT_TYPE.CAMPAIGN,
25
+ }),
26
+ ],
27
+ label: "Campaign ID",
28
+ description: "ID of the Campaign to which this Lead is associated.",
29
+ },
30
+ contactId: {
31
+ propDefinition: [
32
+ salesForceRestApi,
33
+ "sobjectId",
34
+ () => ({
35
+ objectType: constants.OBJECT_TYPE.CONTACT,
36
+ }),
37
+ ],
38
+ label: "Contact ID",
39
+ description: "ID of the Contact who is associated with a Campaign.",
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ const data = removeNullEntries({
44
+ CampaignId: this.campaignId,
45
+ ContactId: this.contactId,
46
+ });
47
+ const response = await this.salesForceRestApi
48
+ .createObject(constants.OBJECT_TYPE.CAMPAIGN_MEMBER, data);
49
+ response && $.export("$summary", "Successfully added contact to campaign");
50
+ return response;
51
+ },
52
+ };
@@ -0,0 +1,51 @@
1
+ import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
2
+ import {
3
+ removeNullEntries, toSingleLineString,
4
+ } from "../../common/utils.mjs";
5
+ import constants from "../../common/constants.mjs";
6
+
7
+ export default {
8
+ key: "salesforce_rest_api-add-lead-to-campaign",
9
+ name: "Add Lead to Campaign",
10
+ description: toSingleLineString(`
11
+ Adds an existing lead to an existing campaign.
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
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
14
+ `),
15
+ version: "0.0.2",
16
+ type: "action",
17
+ props: {
18
+ salesForceRestApi,
19
+ campaignId: {
20
+ propDefinition: [
21
+ salesForceRestApi,
22
+ "sobjectId",
23
+ () => ({
24
+ objectType: constants.OBJECT_TYPE.CAMPAIGN,
25
+ }),
26
+ ],
27
+ label: "Campaign ID",
28
+ description: "ID of the Campaign to which this Lead is associated.",
29
+ },
30
+ leadId: {
31
+ propDefinition: [
32
+ salesForceRestApi,
33
+ "sobjectId",
34
+ () => ({
35
+ objectType: constants.OBJECT_TYPE.LEAD,
36
+ }),
37
+ ],
38
+ label: "Lead ID",
39
+ description: "ID of the Lead who is associated with a Campaign.",
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ const data = removeNullEntries({
44
+ CampaignId: this.campaignId,
45
+ LeadId: this.leadId,
46
+ });
47
+ const response = await this.salesForceRestApi.createObject("CampaignMember", data);
48
+ response && $.export("$summary", "Successfully added lead to campaign");
49
+ return response;
50
+ },
51
+ };
@@ -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.2",
17
+ version: "0.2.3",
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.2",
16
+ version: "0.3.3",
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.2",
16
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
14
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
11
+ version: "0.2.3",
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.2",
16
+ version: "0.3.3",
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.2",
12
+ version: "0.2.3",
13
13
  type: "action",
14
14
  props: {
15
15
  salesforce,
@@ -5,19 +5,24 @@ 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.0",
8
+ version: "0.1.1",
9
9
  type: "action",
10
10
  props: {
11
11
  salesForceRestApi,
12
12
  sobjectType: {
13
- type: "string",
14
- label: "Object type",
15
- description:
16
- "Salesforce standard object type of the record to get field values from. [Object types](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm)",
13
+ propDefinition: [
14
+ salesForceRestApi,
15
+ "objectType",
16
+ ],
17
17
  },
18
18
  sobjectId: {
19
- type: "string",
20
- label: "Object id",
19
+ propDefinition: [
20
+ salesForceRestApi,
21
+ "sobjectId",
22
+ (c) => ({
23
+ objectType: c.sobjectType,
24
+ }),
25
+ ],
21
26
  description:
22
27
  "ID of the Salesforce standard object to get field values from.",
23
28
  },
@@ -6,19 +6,24 @@ 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.0",
9
+ version: "0.1.1",
10
10
  type: "action",
11
11
  props: {
12
12
  salesForceRestApi,
13
13
  sobjectType: {
14
- type: "string",
15
- label: "Object type",
16
- description:
17
- "Salesforce standard object type of the record to get field values from. [Object types](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm)",
14
+ propDefinition: [
15
+ salesForceRestApi,
16
+ "objectType",
17
+ ],
18
18
  },
19
19
  sobjectId: {
20
- type: "string",
21
- label: "Object ID",
20
+ propDefinition: [
21
+ salesForceRestApi,
22
+ "sobjectId",
23
+ (c) => ({
24
+ objectType: c.sobjectType,
25
+ }),
26
+ ],
22
27
  description:
23
28
  "ID of the Salesforce standard object to get field values from.",
24
29
  },
@@ -5,21 +5,25 @@ 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.0",
8
+ version: "0.1.1",
9
9
  type: "action",
10
10
  props: {
11
11
  salesForceRestApi,
12
12
  sobjectType: {
13
- type: "string",
14
- label: "Object type",
15
- description:
16
- "Salesforce standard object type of the record to get field values from. [Object types](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm)",
13
+ propDefinition: [
14
+ salesForceRestApi,
15
+ "objectType",
16
+ ],
17
17
  },
18
18
  ids: {
19
+ propDefinition: [
20
+ salesForceRestApi,
21
+ "sobjectId",
22
+ (c) => ({
23
+ objectType: c.sobjectType,
24
+ }),
25
+ ],
19
26
  type: "string[]",
20
- label: "Record IDs to be returned",
21
- description:
22
- "Record IDs to be returned",
23
27
  },
24
28
  fields: {
25
29
  type: "string[]",
@@ -34,14 +38,14 @@ export default {
34
38
  fields,
35
39
  ids,
36
40
  } = this;
37
- const response = await this.salesForceRestApi.getRecords(
41
+ const response = await this.salesForceRestApi.getRecords(
38
42
  sobjectType, {
39
- fields: fields.join(","),
40
- ids: ids.join(","),
43
+ fields: Array.isArray(fields) && fields.join(",") || fields,
44
+ ids: Array.isArray(ids) && ids.join(",") || ids,
41
45
  },
42
46
  );
43
47
  if (response) {
44
- $.export("$summary", "Record found successfully" );
48
+ $.export("$summary", "Record found successfully");
45
49
  }
46
50
  return response;
47
51
  },
@@ -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.2",
11
+ version: "0.2.3",
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.2",
11
+ version: "0.2.3",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -0,0 +1,39 @@
1
+ import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
2
+ import { toSingleLineString } from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "salesforce_rest_api-post-feed-to-chatter",
6
+ name: "Post a Message to Chatter Feed",
7
+ description: toSingleLineString(`
8
+ Posts a message to the Chatter Feed.
9
+ [See doc](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm)
10
+ `),
11
+ version: "0.0.2",
12
+ type: "action",
13
+ props: {
14
+ salesForceRestApi,
15
+ text: {
16
+ label: "Text body",
17
+ description: "Text body.",
18
+ type: "string",
19
+ },
20
+ subjectId: {
21
+ label: "Subject ID",
22
+ description: "Specify the user, group, or record that will parent the feed item.",
23
+ type: "string",
24
+ },
25
+ },
26
+ async run({ $ }) {
27
+ const params = {
28
+ text: this.text,
29
+ subjectId: this.subjectId,
30
+ feedElementType: "FeedItem",
31
+ };
32
+ const response = await this.salesForceRestApi.postFeed({
33
+ $,
34
+ params,
35
+ });
36
+ response && $.export("$summary", "Successfully added message to chatter feed");
37
+ return response;
38
+ },
39
+ };
@@ -1,5 +1,5 @@
1
- import salesforce from "../../salesforce_rest_api.app.mjs";
2
1
  import { toSingleLineString } from "../../common/utils.mjs";
2
+ import salesforce from "../../salesforce_rest_api.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "salesforce_rest_api-soql-search",
@@ -8,7 +8,7 @@ export default {
8
8
  Executes a SOQL query.
9
9
  See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm)
10
10
  `),
11
- version: "0.2.2",
11
+ version: "0.2.4",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -23,7 +23,7 @@ export default {
23
23
  $,
24
24
  query: this.query,
25
25
  });
26
- $.export("$summary", "Successfully returned ${response.length} results for SOQL query");
26
+ $.export("$summary", `Successfully returned ${response.totalSize} results for SOQL query`);
27
27
  return response;
28
28
  },
29
29
  };
@@ -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.2",
11
+ version: "0.2.3",
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.2",
17
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
16
+ version: "0.2.3",
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.2",
11
+ version: "0.2.3",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -27,4 +27,10 @@ export default {
27
27
  "Cadence",
28
28
  "Call",
29
29
  ],
30
+ OBJECT_TYPE: {
31
+ CAMPAIGN: "Campaign",
32
+ CONTACT: "Contact",
33
+ CAMPAIGN_MEMBER: "CampaignMember",
34
+ LEAD: "Lead",
35
+ },
30
36
  };
@@ -29,11 +29,6 @@ export default {
29
29
  label: "First Name",
30
30
  description: "The contact's first name up to 40 characters.",
31
31
  },
32
- MiddleName: {
33
- type: "string",
34
- label: "Middle Name",
35
- description: "The contact's middle name up to 40 characters. To enable this field, ask Salesforce Customer Support for help.",
36
- },
37
32
  Phone: {
38
33
  type: "string",
39
34
  label: "Phone",
@@ -24,9 +24,4 @@ export default {
24
24
  label: "First Name",
25
25
  description: "The lead's first name up to 40 characters.",
26
26
  },
27
- MiddleName: {
28
- type: "string",
29
- label: "Middle Name",
30
- description: "The lead's middle name up to 40 characters. To enable this field, ask Salesforce Customer Support for help.",
31
- },
32
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/salesforce_rest_api",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Pipedream Salesforce (REST API) Components",
5
5
  "main": "salesforce_rest_api.app.mjs",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "@pipedream/platform": "^0.9.0",
15
15
  "handlebars": "^4.7.7",
16
16
  "lodash": "^4.17.21",
17
- "salesforce-webhooks": "^1.1.4",
17
+ "salesforce-webhooks": "^1.1.11",
18
18
  "lodash-es": "^4.17.21"
19
19
  },
20
20
  "gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
@@ -23,14 +23,10 @@ export default {
23
23
  type: "string",
24
24
  label: "SObject Type",
25
25
  description: "Standard object type of the record to get field values from",
26
- async options(context) {
27
- const { page } = context;
28
- if (page !== 0) {
29
- return [];
30
- }
26
+ async options() {
31
27
  const { sobjects } = await this.listSObjectTypes();
32
28
  return sobjects
33
- .filter((sobject) => sobject.replicateable)
29
+ .filter(this.isValidSObject)
34
30
  .map((sobject) => ({
35
31
  label: sobject.label,
36
32
  value: sobject.name,
@@ -195,29 +191,27 @@ export default {
195
191
  [prop]: sobject[prop],
196
192
  }), {});
197
193
  },
194
+ isValidSObject(sobject) {
195
+ // Only the activity of those SObject types that have the `replicateable`
196
+ // flag set is published via the `getUpdated` API.
197
+ //
198
+ // See the API docs here: https://sforce.co/3gDy3uP
199
+ return sobject.replicateable;
200
+ },
198
201
  isHistorySObject(sobject) {
199
202
  return (
200
203
  sobject.associateEntityType === "History" &&
201
204
  sobject.name.includes("History")
202
205
  );
203
206
  },
204
- listAllowedSObjectTypes(eventType) {
205
- const verbose = true;
206
- return SalesforceClient.getAllowedSObjects(eventType, verbose);
207
- },
208
207
  async createWebhook(endpointUrl, sObjectType, event, secretToken, opts) {
209
- const {
210
- fieldsToCheck,
211
- fieldsToCheckMode,
212
- } = opts;
213
208
  const client = this._getSalesforceClient();
214
209
  const webhookOpts = {
215
210
  endpointUrl,
216
211
  sObjectType,
217
212
  event,
218
213
  secretToken,
219
- fieldsToCheck,
220
- fieldsToCheckMode,
214
+ ...opts,
221
215
  };
222
216
  return client.createWebhook(webhookOpts);
223
217
  },
@@ -524,7 +518,7 @@ export default {
524
518
  $, query,
525
519
  }) {
526
520
  const baseUrl = this._baseApiVersionUrl();
527
- const url = `${baseUrl}/query/?q=${encodeURI(query)}`;
521
+ const url = `${baseUrl}/query/?q=${encodeURIComponent(query)}`;
528
522
  return this._makeRequest({
529
523
  $,
530
524
  url,
@@ -534,7 +528,7 @@ export default {
534
528
  $, search,
535
529
  }) {
536
530
  const baseUrl = this._baseApiVersionUrl();
537
- const url = `${baseUrl}/search/?q=${encodeURI(search)}`;
531
+ const url = `${baseUrl}/search/?q=${encodeURIComponent(search)}`;
538
532
  return this._makeRequest({
539
533
  $,
540
534
  url,
@@ -555,5 +549,14 @@ export default {
555
549
  };
556
550
  return axios($ ?? this, requestConfig);
557
551
  },
552
+ async postFeed(args = {}) {
553
+ const baseUrl = this._baseApiVersionUrl();
554
+ const url = `${baseUrl}/chatter/feed-elements`;
555
+ return this._makeRequest({
556
+ url,
557
+ method: "POST",
558
+ ...args,
559
+ });
560
+ },
558
561
  },
559
562
  };
@@ -5,31 +5,20 @@ import salesforce from "../salesforce_rest_api.app.mjs";
5
5
  export default {
6
6
  dedupe: "unique",
7
7
  props: {
8
+ salesforce,
8
9
  db: "$.service.db",
9
10
  // eslint-disable-next-line pipedream/props-label,pipedream/props-description
10
11
  http: {
11
12
  type: "$.interface.http",
12
13
  customResponse: true,
13
14
  },
14
- salesforce,
15
15
  objectType: {
16
- type: "string",
17
16
  label: "Object Type",
18
17
  description: "The type of object for which to monitor events",
19
- async options(context) {
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
- }));
32
- },
18
+ propDefinition: [
19
+ salesforce,
20
+ "objectType",
21
+ ],
33
22
  },
34
23
  },
35
24
  hooks: {
@@ -50,6 +39,7 @@ export default {
50
39
  {
51
40
  fieldsToCheck: this.getFieldsToCheck(),
52
41
  fieldsToCheckMode: this.getFieldsToCheckMode(),
42
+ skipValidation: true, // neccessary for custom objects
53
43
  },
54
44
  );
55
45
  } catch (err) {
@@ -3,8 +3,8 @@ import salesforce from "../salesforce_rest_api.app.mjs";
3
3
  export default {
4
4
  dedupe: "unique",
5
5
  props: {
6
- db: "$.service.db",
7
6
  salesforce,
7
+ db: "$.service.db",
8
8
  // eslint-disable-next-line pipedream/props-label,pipedream/props-description
9
9
  timer: {
10
10
  type: "$.interface.timer",
@@ -13,28 +13,12 @@ export default {
13
13
  },
14
14
  },
15
15
  objectType: {
16
- type: "string",
17
16
  label: "Object Type",
18
17
  description: "The type of object for which to monitor events",
19
- async options(context) {
20
- const { page } = context;
21
- if (page !== 0) {
22
- return {
23
- options: [],
24
- };
25
- }
26
-
27
- const { sobjects } = await this.salesforce.listSObjectTypes();
28
- const options = sobjects
29
- .filter(this.isValidSObject)
30
- .map((sobject) => ({
31
- label: sobject.label,
32
- value: sobject.name,
33
- }));
34
- return {
35
- options,
36
- };
37
- },
18
+ propDefinition: [
19
+ salesforce,
20
+ "objectType",
21
+ ],
38
22
  },
39
23
  },
40
24
  hooks: {
@@ -62,13 +46,6 @@ export default {
62
46
  setNameField(nameField) {
63
47
  this.db.set("nameField", nameField);
64
48
  },
65
- isValidSObject(sobject) {
66
- // Only the activity of those SObject types that have the `replicateable`
67
- // flag set is published via the `getUpdated` API.
68
- //
69
- // See the API docs here: https://sforce.co/3gDy3uP
70
- return sobject.replicateable;
71
- },
72
49
  processEvent() {
73
50
  throw new Error("processEvent is not implemented");
74
51
  },
@@ -8,10 +8,13 @@ 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.0",
11
+ version: "0.1.2",
12
12
  methods: {
13
13
  ...common.methods,
14
14
  isItemRelevant(item, startTimestamp, endTimestamp) {
15
+ if (!item) {
16
+ return false;
17
+ }
15
18
  const startDate = Date.parse(startTimestamp);
16
19
  const endDate = Date.parse(endTimestamp);
17
20
  const createdDate = Date.parse(item.CreatedDate);
@@ -46,10 +49,11 @@ export default {
46
49
  startTimestamp,
47
50
  endTimestamp,
48
51
  );
52
+ this.setLatestDateCovered(latestDateCovered);
49
53
 
50
54
  // By the time we try to retrieve an item, it might've been deleted. This
51
55
  // will cause `getSObject` to throw a 404 exception, which will reject its
52
- // promise. Hence, we need to filter those items that we still in Salesforce
56
+ // promise. Hence, we need to filter those items that are still in Salesforce
53
57
  // and exclude those that are not.
54
58
  const itemRetrievals = await Promise.allSettled(
55
59
  ids.map((id) => this.salesforce.getSObject(this.objectType, id)),
@@ -62,8 +66,6 @@ export default {
62
66
  const meta = this.generateMeta(item);
63
67
  this.$emit(item, meta);
64
68
  });
65
-
66
- this.setLatestDateCovered(latestDateCovered);
67
69
  },
68
70
  },
69
71
  };
@@ -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.1.0",
11
+ version: "0.1.1",
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.1.0",
9
+ version: "0.1.1",
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.0",
11
+ version: "0.1.2",
12
12
  methods: {
13
13
  ...common.methods,
14
14
  generateMeta(item) {
@@ -38,6 +38,7 @@ export default {
38
38
  startTimestamp,
39
39
  endTimestamp,
40
40
  );
41
+ this.setLatestDateCovered(latestDateCovered);
41
42
 
42
43
  // When a record is deleted, the `getDeleted` API only shows the ID of the
43
44
  // deleted item and the date in which it was deleted.
@@ -45,8 +46,6 @@ export default {
45
46
  const meta = this.generateMeta(item);
46
47
  this.$emit(item, meta);
47
48
  });
48
-
49
- this.setLatestDateCovered(latestDateCovered);
50
49
  },
51
50
  },
52
51
  };
@@ -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.0",
11
+ version: "0.1.1",
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.0",
11
+ version: "0.1.2",
12
12
  methods: {
13
13
  ...common.methods,
14
14
  generateMeta(item) {
@@ -41,10 +41,11 @@ export default {
41
41
  startTimestamp,
42
42
  endTimestamp,
43
43
  );
44
+ this.setLatestDateCovered(latestDateCovered);
44
45
 
45
46
  // By the time we try to retrieve an item, it might've been deleted. This
46
47
  // will cause `getSObject` to throw a 404 exception, which will reject its
47
- // promise. Hence, we need to filter those items that we still in Salesforce
48
+ // promise. Hence, we need to filter those items that are still in Salesforce
48
49
  // and exclude those that are not.
49
50
  const itemRetrievals = await Promise.allSettled(
50
51
  ids.map((id) => this.salesforce.getSObject(this.objectType, id)),
@@ -56,8 +57,6 @@ export default {
56
57
  const meta = this.generateMeta(item);
57
58
  this.$emit(item, meta);
58
59
  });
59
-
60
- this.setLatestDateCovered(latestDateCovered);
61
60
  },
62
61
  },
63
62
  };
@@ -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.0",
11
+ version: "0.1.1",
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.0",
18
+ version: "0.1.2",
19
19
  props: {
20
20
  ...common.props,
21
21
  objectType: {
@@ -130,10 +130,11 @@ export default {
130
130
  startTimestamp,
131
131
  endTimestamp,
132
132
  );
133
+ this.setLatestDateCovered(latestDateCovered);
133
134
 
134
135
  // By the time we try to retrieve an item, it might've been deleted. This
135
136
  // will cause `getSObject` to throw a 404 exception, which will reject its
136
- // promise. Hence, we need to filter those items that we still in Salesforce
137
+ // promise. Hence, we need to filter those items that are still in Salesforce
137
138
  // and exclude those that are not.
138
139
  const historyItemRetrievals = await Promise.allSettled(
139
140
  ids.map((id) => this.salesforce.getSObject(historyObjectType, id)),
@@ -172,8 +173,6 @@ export default {
172
173
  const meta = this.generateMeta(event);
173
174
  this.$emit(event, meta);
174
175
  });
175
-
176
- this.setLatestDateCovered(latestDateCovered);
177
176
  },
178
177
  },
179
178
  };
@@ -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.0",
12
+ version: "0.1.1",
13
13
  props: {
14
14
  ...common.props,
15
15
  field: {