@pipedream/salesforce_rest_api 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ export function getProps({
14
14
  objType,
15
15
  createOrUpdate = "create",
16
16
  docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm",
17
+ showDocsInfo = true,
17
18
  showDateInfo = false,
18
19
  }) {
19
20
  let { initialProps } = objType;
@@ -34,6 +35,13 @@ export function getProps({
34
35
 
35
36
  return {
36
37
  salesforce,
38
+ ...showDocsInfo && {
39
+ docsInfo: {
40
+ type: "alert",
41
+ alertType: "info",
42
+ content: `[See the documentation](${docsLink}) for more information on available fields.`,
43
+ },
44
+ },
37
45
  ...showDateInfo && {
38
46
  dateInfo: {
39
47
  type: "alert",
@@ -45,11 +53,6 @@ export function getProps({
45
53
  ? "createProps"
46
54
  : "updateProps"],
47
55
  ...initialProps,
48
- docsInfo: {
49
- type: "alert",
50
- alertType: "info",
51
- content: `[See the documentation](${docsLink}) for more information on available fields.`,
52
- },
53
56
  useAdvancedProps: {
54
57
  propDefinition: [
55
58
  salesforce,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-account",
9
9
  name: "Create Account",
10
10
  description: `Creates a Salesforce account. [See the documentation](${docsLink})`,
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  methods: {
14
14
  ...common.methods,
@@ -1,6 +1,6 @@
1
1
  import common, { getProps } from "../common/base-create-update.mjs";
2
2
  import attachment from "../../common/sobjects/attachment.mjs";
3
- import fs from "fs";
3
+ import { getFileStream } from "@pipedream/platform";
4
4
 
5
5
  const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_attachment.htm";
6
6
 
@@ -18,7 +18,7 @@ export default {
18
18
  key: "salesforce_rest_api-create-attachment",
19
19
  name: "Create Attachment",
20
20
  description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`,
21
- version: "0.4.0",
21
+ version: "0.5.0",
22
22
  type: "action",
23
23
  props,
24
24
  async run({ $ }) {
@@ -34,9 +34,17 @@ export default {
34
34
  } = this;
35
35
  /* eslint-enable no-unused-vars */
36
36
 
37
- const body = filePathOrContent.includes("tmp/")
38
- ? (await fs.promises.readFile(filePathOrContent)).toString("base64")
39
- : filePathOrContent;
37
+ let body;
38
+ if (filePathOrContent.startsWith("http") || filePathOrContent.includes("tmp/")) {
39
+ const stream = await getFileStream(filePathOrContent);
40
+ const chunks = [];
41
+ for await (const chunk of stream) {
42
+ chunks.push(chunk);
43
+ }
44
+ body = Buffer.concat(chunks).toString("base64");
45
+ } else {
46
+ body = filePathOrContent;
47
+ }
40
48
 
41
49
  const response = await salesforce.createRecord("Attachment", {
42
50
  $,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-campaign",
9
9
  name: "Create Campaign",
10
10
  description: `Creates a marketing campaign. [See the documentation](${docsLink})`,
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  methods: {
14
14
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-case",
9
9
  name: "Create Case",
10
10
  description: `Creates a Case, which represents a customer issue or problem. [See the documentation](${docsLink})`,
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  methods: {
14
14
  ...common.methods,
@@ -17,7 +17,7 @@ export default {
17
17
  key: "salesforce_rest_api-create-casecomment",
18
18
  name: "Create Case Comment",
19
19
  description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`,
20
- version: "0.3.0",
20
+ version: "0.3.1",
21
21
  type: "action",
22
22
  props,
23
23
  async run({ $ }) {
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-contact",
9
9
  name: "Create Contact",
10
10
  description: `Creates a contact. [See the documentation](${docsLink})`,
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  methods: {
14
14
  ...common.methods,
@@ -0,0 +1,91 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import common, { getProps } from "../common/base-create-update.mjs";
3
+ import contentNote from "../../common/sobjects/content-note.mjs";
4
+ import contentDocumentLink from "../../common/sobjects/content-document-link.mjs";
5
+
6
+ const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentnote.htm";
7
+
8
+ const {
9
+ useAdvancedProps: contentNoteUseAdvancedProps,
10
+ ...contentNoteProps
11
+ } = getProps({
12
+ objType: contentNote,
13
+ docsLink,
14
+ });
15
+
16
+ const {
17
+ useAdvancedProps: contentDocumentLinkUseAdvancedProps,
18
+ ...contentDocumentLinkProps
19
+ } = getProps({
20
+ objType: contentDocumentLink,
21
+ docsLink,
22
+ showDocsInfo: false,
23
+ });
24
+
25
+ export default {
26
+ ...common,
27
+ key: "salesforce_rest_api-create-content-note",
28
+ name: "Create Content Note",
29
+ description: `Creates a content note. [See the documentation](${docsLink}) and [Set Up Notes](https://help.salesforce.com/s/articleView?id=sales.notes_admin_setup.htm&type=5).`,
30
+ version: "0.0.1",
31
+ type: "action",
32
+ props: {
33
+ ...contentNoteProps,
34
+ ...contentDocumentLinkProps,
35
+ },
36
+ methods: {
37
+ ...common.methods,
38
+ escapeHtml4(unsafe) {
39
+ return unsafe
40
+ .replace(/&/g, "&")
41
+ .replace(/</g, "&lt;")
42
+ .replace(/>/g, "&gt;")
43
+ .replace(/"/g, "&quot;")
44
+ .replace(/'/g, "&#039;");
45
+ },
46
+ },
47
+ async run({ $ }) {
48
+ const {
49
+ salesforce,
50
+ escapeHtml4,
51
+ Title,
52
+ Content,
53
+ OwnerId,
54
+ LinkedEntityId,
55
+ ShareType,
56
+ Visibility,
57
+ } = this;
58
+
59
+ const contentNoteResponse = await salesforce.createRecord("ContentNote", {
60
+ $,
61
+ data: {
62
+ Title,
63
+ Content: Buffer.from(escapeHtml4(Content)).toString("base64"),
64
+ OwnerId: OwnerId,
65
+ },
66
+ });
67
+
68
+ if (!LinkedEntityId) {
69
+ $.export("$summary", `Successfully created content note with ID \`${contentNoteResponse.id}\`.`);
70
+ return {
71
+ contentNote: contentNoteResponse,
72
+ };
73
+ }
74
+
75
+ const contentDocumentLinkResponse = await salesforce.createRecord("ContentDocumentLink", {
76
+ $,
77
+ data: {
78
+ ContentDocumentId: contentNoteResponse.id,
79
+ LinkedEntityId,
80
+ ShareType,
81
+ Visibility,
82
+ },
83
+ });
84
+
85
+ $.export("$summary", `Successfully created content note with ID \`${contentNoteResponse.id}\` and document link with ID \`${contentDocumentLinkResponse.id}\`.`);
86
+ return {
87
+ contentNote: contentNoteResponse,
88
+ contentDocumentLink: contentDocumentLinkResponse,
89
+ };
90
+ },
91
+ };
@@ -9,7 +9,7 @@ export default {
9
9
  key: "salesforce_rest_api-create-event",
10
10
  name: "Create Event",
11
11
  description: `Creates an event. [See the documentation](${docsLink})`,
12
- version: "0.3.0",
12
+ version: "0.3.1",
13
13
  type: "action",
14
14
  methods: {
15
15
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-lead",
9
9
  name: "Create Lead",
10
10
  description: `Creates a lead. [See the documentation](${docsLink})`,
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  methods: {
14
14
  ...common.methods,
@@ -17,7 +17,7 @@ export default {
17
17
  key: "salesforce_rest_api-create-note",
18
18
  name: "Create Note",
19
19
  description: `Creates a note. [See the documentation](${docsLink})`,
20
- version: "0.3.0",
20
+ version: "0.3.1",
21
21
  type: "action",
22
22
  props,
23
23
  async run({ $ }) {
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-opportunity",
9
9
  name: "Create Opportunity",
10
10
  description: `Creates an opportunity. [See the documentation](${docsLink})`,
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  methods: {
14
14
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-create-record",
9
9
  name: "Create Record",
10
10
  description: "Create a record of a given object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)",
11
- version: "0.3.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -9,7 +9,7 @@ export default {
9
9
  key: "salesforce_rest_api-create-task",
10
10
  name: "Create Task",
11
11
  description: `Creates a task. [See the documentation](${docsLink})`,
12
- version: "0.4.0",
12
+ version: "0.4.1",
13
13
  type: "action",
14
14
  methods: {
15
15
  ...common.methods,
@@ -9,7 +9,7 @@ export default {
9
9
  key: "salesforce_rest_api-create-user",
10
10
  name: "Create User",
11
11
  description: `Creates a Salesforce user. [See the documentation](${docsLink})`,
12
- version: "0.1.0",
12
+ version: "0.1.1",
13
13
  type: "action",
14
14
  methods: {
15
15
  ...common.methods,
@@ -15,7 +15,7 @@ export default {
15
15
  key: "salesforce_rest_api-update-account",
16
16
  name: "Update Account",
17
17
  description: `Updates a Salesforce account. [See the documentation](${docsLink})`,
18
- version: "0.3.0",
18
+ version: "0.3.1",
19
19
  type: "action",
20
20
  methods: {
21
21
  ...common.methods,
@@ -16,7 +16,7 @@ export default {
16
16
  key: "salesforce_rest_api-update-contact",
17
17
  name: "Update Contact",
18
18
  description: `Updates a contact. [See the documentation](${docsLink})`,
19
- version: "0.3.0",
19
+ version: "0.3.1",
20
20
  type: "action",
21
21
  methods: {
22
22
  ...common.methods,
@@ -16,7 +16,7 @@ export default {
16
16
  key: "salesforce_rest_api-update-opportunity",
17
17
  name: "Update Opportunity",
18
18
  description: `Updates an opportunity. [See the documentation](${docsLink})`,
19
- version: "0.3.0",
19
+ version: "0.3.1",
20
20
  type: "action",
21
21
  methods: {
22
22
  ...common.methods,
@@ -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.0",
11
+ version: "0.3.1",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "salesforce_rest_api-upsert-record",
9
9
  name: "Upsert Record",
10
10
  description: "Create or update a record of a given object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_upsert.htm)",
11
- version: "0.0.1",
11
+ version: "0.0.2",
12
12
  type: "action",
13
13
  props: {
14
14
  salesforce,
@@ -9,8 +9,8 @@ export default {
9
9
  },
10
10
  filePathOrContent: {
11
11
  type: "string",
12
- label: "File Path or Content",
13
- description: "The path to a file in the `tmp` folder [(see the documentation)](https://pipedream.com/docs/code/nodejs/working-with-files). Alternatively, you can provide the base64-encoded file data.",
12
+ label: "File Path, URL or Content",
13
+ description: "The file to attach. Provide either a file URL, a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`), or base64-encoded file data.",
14
14
  },
15
15
  ContentType: {
16
16
  type: "string",
@@ -0,0 +1,51 @@
1
+ export default {
2
+ initialProps: {
3
+ LinkedEntityId: {
4
+ type: "string",
5
+ label: "Linked Entity ID",
6
+ description: "ID of the linked object. Can include Chatter users, groups, records (any that support Chatter feed tracking including custom objects), and Salesforce CRM Content libraries.",
7
+ optional: true,
8
+ },
9
+ ShareType: {
10
+ type: "string",
11
+ label: "Share Type",
12
+ description: "The permission granted to the user of the shared file in a library. This is determined by the permission the user already has in the library.",
13
+ optional: true,
14
+ default: "I",
15
+ options: [
16
+ {
17
+ label: "Viewer Permission",
18
+ value: "V",
19
+ },
20
+ {
21
+ label: "Collaborator Permission",
22
+ value: "C",
23
+ },
24
+ {
25
+ label: "Inferred Permission",
26
+ value: "I",
27
+ },
28
+ ],
29
+ },
30
+ Visibility: {
31
+ type: "string",
32
+ label: "Visibility",
33
+ description: "Specifies whether this file is available to all users, internal users, or shared users.",
34
+ optional: true,
35
+ options: [
36
+ {
37
+ label: "All Users",
38
+ value: "AllUsers",
39
+ },
40
+ {
41
+ label: "Internal Users",
42
+ value: "InternalUsers",
43
+ },
44
+ {
45
+ label: "Shared Users",
46
+ value: "SharedUsers",
47
+ },
48
+ ],
49
+ },
50
+ },
51
+ };
@@ -0,0 +1,34 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+
3
+ export default {
4
+ initialProps: {
5
+ OwnerId: {
6
+ propDefinition: [
7
+ salesforce,
8
+ "recordId",
9
+ () => ({
10
+ objType: "User",
11
+ nameField: "Name",
12
+ }),
13
+ ],
14
+ label: "Owner ID",
15
+ description: "ID of the user who owns the note.",
16
+ },
17
+ Title: {
18
+ type: "string",
19
+ label: "Title",
20
+ description: "Title of the note.",
21
+ },
22
+ Content: {
23
+ type: "string",
24
+ label: "Content",
25
+ description: "The content or body of the note, which can include properly formatted HTML or plain text.",
26
+ },
27
+ IsReadOnly: {
28
+ type: "boolean",
29
+ label: "Read Only",
30
+ description: "Indicates whether the note is read only.",
31
+ optional: true,
32
+ },
33
+ },
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/salesforce_rest_api",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
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.0.0",
13
+ "@pipedream/platform": "^3.1.0",
14
14
  "fast-xml-parser": "^4.3.2",
15
15
  "handlebars": "^4.7.7",
16
16
  "lodash": "^4.17.21",