@pipedream/salesforce_rest_api 0.4.7 → 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.
Files changed (41) hide show
  1. package/LICENSE +41 -7
  2. package/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +1 -1
  3. package/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +1 -1
  4. package/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +1 -1
  5. package/actions/create-account/create-account.mjs +1 -1
  6. package/actions/create-attachment/create-attachment.mjs +1 -1
  7. package/actions/create-campaign/create-campaign.mjs +1 -1
  8. package/actions/create-case/create-case.mjs +1 -1
  9. package/actions/create-casecomment/create-casecomment.mjs +1 -1
  10. package/actions/create-contact/create-contact.mjs +1 -1
  11. package/actions/create-event/create-event.mjs +1 -1
  12. package/actions/create-lead/create-lead.mjs +1 -1
  13. package/actions/create-note/create-note.mjs +1 -1
  14. package/actions/create-opportunity/create-opportunity.mjs +1 -1
  15. package/actions/create-record/create-record.mjs +1 -1
  16. package/actions/create-task/create-task.mjs +1 -1
  17. package/actions/delete-opportunity/delete-opportunity.mjs +1 -1
  18. package/actions/delete-record/delete-record.mjs +1 -1
  19. package/actions/find-create-record/find-create-record.mjs +1 -1
  20. package/actions/find-records/find-records.mjs +1 -1
  21. package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +1 -1
  22. package/actions/insert-blob-data/insert-blob-data.mjs +1 -1
  23. package/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +1 -1
  24. package/actions/soql-search/soql-search.mjs +1 -1
  25. package/actions/sosl-search/sosl-search.mjs +1 -1
  26. package/actions/update-account/update-account.mjs +1 -1
  27. package/actions/update-contact/update-contact.mjs +1 -1
  28. package/actions/update-opportunity/update-opportunity.mjs +1 -1
  29. package/actions/update-record/update-record.mjs +1 -1
  30. package/package.json +4 -3
  31. package/salesforce_rest_api.app.mjs +4 -6
  32. package/sources/common.mjs +22 -0
  33. package/sources/new-object/new-object.mjs +18 -13
  34. package/sources/new-object-instant/new-object-instant.mjs +1 -1
  35. package/sources/new-outbound-message/new-outbound-message.mjs +1 -1
  36. package/sources/object-deleted/object-deleted.mjs +1 -1
  37. package/sources/object-deleted-instant/object-deleted-instant.mjs +1 -1
  38. package/sources/object-updated/object-updated.mjs +14 -12
  39. package/sources/object-updated-instant/object-updated-instant.mjs +1 -1
  40. package/sources/updated-field-on-record/updated-field-on-record.mjs +58 -38
  41. package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +1 -1
package/LICENSE CHANGED
@@ -1,7 +1,41 @@
1
- Copyright 2020 Pipedream, Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Pipedream Source Available License Version 1.0
2
+
3
+ This Pipedream Source Available License Agreement Version 1.0 (this “Agreement”) sets forth the terms on which Pipedream, Inc., a Delaware corporation (“Pipedream”) makes available certain software (the Software). By installing, downloading, accessing, using or distributing the Software, you agree to the terms of this Agreement. If you do not agree to such terms, you must not use the Software. If you are receiving the Software on behalf of a legal entity, you represent and warrant that you have the actual authority to agree to the terms and conditions of this Agreement on behalf of such entity. “Licensee” means you, an individual, or the entity on whose behalf you are receiving the Software.
4
+
5
+ LICENSE GRANT AND CONDITIONS.
6
+
7
+ 1.1 License. Subject to the terms and conditions of this Agreement, Pipedream hereby grants to Licensee a non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this Agreement to use, prepare modifications and derivative works, distribute (including without limitation in source code or object code form) and reproduce copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means any commercial use of the software including, but not limited to, making available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other online service that competes with the Software or any other Pipedream products or services.
8
+
9
+ 1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the following conditions:
10
+
11
+ a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee modified the Software.
12
+
13
+ b. On each Software copy, Licensee shall reproduce and not remove or alter all Pipedream or third party copyright or other proprietary notices contained in the Software, and Licensee must provide this with each copy: “This software is made available by Pipedream, Inc., under the terms of the Pipedream Source Available License, Version 1.0 located at https://github.com/PipedreamHQ/pipedream/blob/master/LICENSE. By installing, downloading, accessing, using or distributing the Software, you agree to the terms of such License Agreement.”
14
+
15
+ 1.3 Modifications. Licensee may add its own copyright notices to modifications made by Licensee and may provide additional or different license terms and conditions for use, reproduction, or distribution of Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not Pipedream, will be responsible for any such obligations.
16
+
17
+ 1.4 No Sublicensing. The License does not include the right to sublicense the Software; provided, however, that any recipient to which Licensee provides the Software may exercise the License so long as such recipient agrees to the terms and conditions of this Agreement.
18
+
19
+ TERM AND TERMINATION.
20
+
21
+ This Agreement will continue unless and until earlier terminated as set forth herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will terminate automatically and the License will terminate automatically and permanently.
22
+
23
+ INTELLECTUAL PROPERTY.
24
+
25
+ As between the parties, Pipedream retains all right, title, and interest in the Software, and all intellectual property rights therein. Pipedream hereby reserves all rights not expressly granted to Licensee in this Agreement. Pipedream reserves all rights in its trademarks and service marks, and no licenses thereto are granted by this Agreement.
26
+
27
+ DISCLAIMER.
28
+
29
+ PIPEDREAM HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE.
30
+
31
+ LIMITATION OF LIABILITY.
32
+
33
+ PIPEDREAM WILL NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
34
+
35
+ GENERAL.
36
+
37
+ 6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the state of California, without reference to its conflict of laws principles. If Licensee is located outside of the United States, any dispute, controversy or claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in accordance with the JAMS International Arbitration Rules. The tribunal will consist of one arbitrator. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction thereof. All disputes including arbitrations shall take place in Santa Clara County, California. The language to be used in any such proceedings shall be English.
38
+
39
+ 6.2. Assignment. Licensee is not authorized to assign its rights under this Agreement to any third party. Pipedream may freely assign its rights under this Agreement to any third party.
40
+
41
+ 6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof. No amendment or modification of this Agreement will be valid or binding upon the parties unless made in writing and signed by the duly authorized representatives of both parties. In the event that any provision, including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and all licenses and rights granted hereunder will immediately terminate. Waiver by Pipedream of a breach of any provision of this Agreement or the failure by Pipedream to exercise any right hereunder will not be construed as a waiver of any subsequent breach of that right or as a waiver of any other right.
@@ -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.2",
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.2",
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.1",
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.3",
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.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.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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.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.3",
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.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.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.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.3",
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.3",
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.2",
11
+ version: "0.0.3",
12
12
  type: "action",
13
13
  props: {
14
14
  salesForceRestApi,
@@ -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.4",
11
+ version: "0.2.5",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -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.3",
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.3",
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.3",
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.3",
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.3",
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.7",
3
+ "version": "0.4.9",
4
4
  "description": "Pipedream Salesforce (REST API) Components",
5
5
  "main": "salesforce_rest_api.app.mjs",
6
6
  "keywords": [
@@ -9,13 +9,14 @@
9
9
  ],
10
10
  "homepage": "https://pipedream.com/apps/salesforce_rest_api",
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
- "license": "MIT",
13
12
  "dependencies": {
14
13
  "@pipedream/platform": "^1.2.0",
14
+ "fast-xml-parser": "^4.3.2",
15
15
  "handlebars": "^4.7.7",
16
16
  "lodash": "^4.17.21",
17
17
  "lodash-es": "^4.17.21",
18
- "salesforce-webhooks": "^1.1.11"
18
+ "salesforce-webhooks": "^1.1.11",
19
+ "uuid": "^9.0.1"
19
20
  },
20
21
  "gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
21
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(context) {
41
- const {
42
- page,
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((field) => field.name);
48
+ return fields.filter(filter).map(({ name }) => name);
51
49
  },
52
50
  },
53
51
  fieldUpdatedTo: {
@@ -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.5",
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
- // By the time we try to retrieve an item, it might've been deleted. This
55
- // will cause `getSObject` to throw a 404 exception, which will reject its
56
- // promise. Hence, we need to filter those items that are still in Salesforce
57
- // and exclude those that are not.
58
- const itemRetrievals = await Promise.allSettled(
59
- ids.map((id) => this.salesforce.getSObject(this.objectType, id)),
60
- );
61
- itemRetrievals
62
- .filter((result) => result.status === "fulfilled")
63
- .map((result) => result.value)
64
- .filter((item) => this.isItemRelevant(item, startTimestamp, endTimestamp))
65
- .forEach((item) => {
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.3",
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.2",
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.5",
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.2",
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.5",
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
- // By the time we try to retrieve an item, it might've been deleted. This
47
- // will cause `getSObject` to throw a 404 exception, which will reject its
48
- // promise. Hence, we need to filter those items that are still in Salesforce
49
- // and exclude those that are not.
50
- const itemRetrievals = await Promise.allSettled(
51
- ids.map((id) => this.salesforce.getSObject(this.objectType, id)),
52
- );
53
- itemRetrievals
54
- .filter((result) => result.status === "fulfilled")
55
- .map((result) => result.value)
56
- .forEach((item) => {
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.2",
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.5",
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(eventData) {
126
+ async processEvent({
127
+ startTimestamp, endTimestamp,
128
+ }) {
120
129
  const {
121
- startTimestamp,
122
- endTimestamp,
123
- } = eventData;
124
- const historyObjectType = this._getHistoryObjectType();
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 this.salesforce.getUpdatedForObjectType(
148
+ } = await salesforce.getUpdatedForObjectType(
129
149
  historyObjectType,
130
150
  startTimestamp,
131
151
  endTimestamp,
132
152
  );
133
- this.setLatestDateCovered(latestDateCovered);
134
153
 
135
- // By the time we try to retrieve an item, it might've been deleted. This
136
- // will cause `getSObject` to throw a 404 exception, which will reject its
137
- // promise. Hence, we need to filter those items that are still in Salesforce
138
- // and exclude those that are not.
139
- const historyItemRetrievals = await Promise.allSettled(
140
- ids.map((id) => this.salesforce.getSObject(historyObjectType, id)),
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((result) => result.status === "fulfilled")
144
- .map((result) => result.value)
145
- .filter(this.isRelevant);
165
+ .filter(({
166
+ statusCode, result: item,
167
+ }) => statusCode === 200 && isRelevant(item))
168
+ .map(({ result: item }) => item);
146
169
 
147
- // To fetch associated sObject records only once, create a set of the "parent IDs" of the
148
- // history object records
149
- const parentIdSet = new Set(
150
- historyItems
151
- .map(this._getParentId)
152
- .filter((id) => id),
153
- );
154
- const parentIds = Array.from(parentIdSet);
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((result) => result.status === "fulfilled")
161
- .map((result) => result.value)
162
- .reduce((acc, item) => {
163
- acc[item.Id] = item;
164
- return acc;
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[this._getParentId(item)],
189
+ record: itemsById[_getParentId(item)],
170
190
  }));
171
191
 
172
192
  events.forEach((event) => {
173
- const meta = this.generateMeta(event);
174
- this.$emit(event, meta);
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.2",
12
+ version: "0.1.3",
13
13
  props: {
14
14
  ...common.props,
15
15
  field: {