@pipedream/salesforce_rest_api 1.9.2 → 1.10.1

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.
@@ -0,0 +1,64 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+
3
+ export default {
4
+ key: "salesforce_rest_api-get-record-by-id",
5
+ name: "Get Record by ID",
6
+ description: "Retrieves a record by its ID. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ salesforce,
16
+ sobjectType: {
17
+ propDefinition: [
18
+ salesforce,
19
+ "objectType",
20
+ ],
21
+ description: "The type of object to retrieve a record of",
22
+ },
23
+ recordId: {
24
+ propDefinition: [
25
+ salesforce,
26
+ "recordId",
27
+ (c) => ({
28
+ objType: c.sobjectType,
29
+ }),
30
+ ],
31
+ description: "The ID of the record to retrieve",
32
+ },
33
+ fieldsToObtain: {
34
+ propDefinition: [
35
+ salesforce,
36
+ "fieldsToObtain",
37
+ (c) => ({
38
+ objType: c.sobjectType,
39
+ }),
40
+ ],
41
+ },
42
+ },
43
+ async run({ $ }) {
44
+ let {
45
+ sobjectType,
46
+ recordId,
47
+ fieldsToObtain,
48
+ } = this;
49
+
50
+ if (typeof fieldsToObtain === "string") fieldsToObtain = fieldsToObtain.split(",");
51
+
52
+ let query = `SELECT ${fieldsToObtain.join(", ")} FROM ${sobjectType}`;
53
+
54
+ query += ` WHERE Id = '${recordId}'`;
55
+
56
+ const { records } = await this.salesforce.query({
57
+ $,
58
+ query,
59
+ });
60
+
61
+ $.export("$summary", `Sucessfully retrieved record with ID ${recordId}`);
62
+ return records[0];
63
+ },
64
+ };
@@ -0,0 +1,40 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+
3
+ export default {
4
+ key: "salesforce_rest_api-list-object-fields",
5
+ name: "List Object Fields",
6
+ description: "Lists all fields for a given object type. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_describe.htm)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ salesforce,
16
+ sobjectType: {
17
+ propDefinition: [
18
+ salesforce,
19
+ "objectType",
20
+ ],
21
+ description: "The type of object to list fields of",
22
+ },
23
+ customOnly: {
24
+ type: "boolean",
25
+ label: "Custom Only",
26
+ description: "Set to `true` to only list custom fields",
27
+ optional: true,
28
+ },
29
+ },
30
+ async run({ $ }) {
31
+ let response = await this.salesforce.getFieldsForObjectType(this.sobjectType);
32
+
33
+ if (this.customOnly) {
34
+ response = response.filter((field) => field.custom);
35
+ }
36
+
37
+ $.export("$summary", `Successfully listed fields for object type ${this.sobjectType}`);
38
+ return response;
39
+ },
40
+ };
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-update-record",
9
9
  name: "Update Record",
10
10
  description: "Update fields of a record. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)",
11
- version: "0.3.4",
11
+ version: "0.3.5",
12
12
  annotations: {
13
13
  destructiveHint: true,
14
14
  openWorldHint: true,
@@ -23,7 +23,7 @@ export default {
23
23
  "objectType",
24
24
  ],
25
25
  description: "The type of object to update a record of.",
26
-
26
+ reloadProps: true,
27
27
  },
28
28
  recordId: {
29
29
  propDefinition: [
@@ -44,6 +44,7 @@ export default {
44
44
  objType: c.sobjectType,
45
45
  }),
46
46
  ],
47
+ optional: true,
47
48
  reloadProps: true,
48
49
  },
49
50
  },
@@ -57,8 +58,12 @@ export default {
57
58
  } = this;
58
59
  const fields = await this.salesforce.getFieldsForObjectType(sobjectType);
59
60
 
60
- const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name));
61
- const selectedFieldProps = this.convertFieldsToProps(selectedFields);
61
+ // Only generate props for manually selected fields if any were selected
62
+ let selectedFieldProps = {};
63
+ if (fieldsToUpdate && fieldsToUpdate.length > 0) {
64
+ const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name));
65
+ selectedFieldProps = this.convertFieldsToProps(selectedFields);
66
+ }
62
67
 
63
68
  return {
64
69
  docsInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/salesforce_rest_api",
3
- "version": "1.9.2",
3
+ "version": "1.10.1",
4
4
  "description": "Pipedream Salesforce (REST API) Components",
5
5
  "main": "salesforce_rest_api.app.mjs",
6
6
  "keywords": [
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://pipedream.com/apps/salesforce_rest_api",
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "dependencies": {
13
- "@pipedream/platform": "^3.1.0",
13
+ "@pipedream/platform": "^3.1.1",
14
14
  "fast-xml-parser": "^4.3.2",
15
15
  "handlebars": "^4.7.7",
16
16
  "lodash": "^4.17.21",