From 177dbdeea7b6ccb534f3031c9b1f00e82c70f702 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 30 Mar 2025 18:32:44 -0300 Subject: [PATCH 1/8] pnpm --- pnpm-lock.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b06348ad6990c..2fa3b1a7ab523 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1584,8 +1584,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/bloomerang: - specifiers: {} + components/bloomerang: {} components/blue: {} @@ -6172,8 +6171,7 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/hyperbrowser: - specifiers: {} + components/hyperbrowser: {} components/hyperise: dependencies: From 202014db5e2733ac19b578129420a0e061325342 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 30 Mar 2025 19:40:28 -0300 Subject: [PATCH 2/8] Adding isDefault field and flex additionalOptions field --- .../actions/create-contact/create-contact.mjs | 14 ++++++++++++ components/connectwise_psa/common/utils.mjs | 22 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 components/connectwise_psa/common/utils.mjs diff --git a/components/connectwise_psa/actions/create-contact/create-contact.mjs b/components/connectwise_psa/actions/create-contact/create-contact.mjs index 4ac0d16d6d05b..8f2b19def706b 100644 --- a/components/connectwise_psa/actions/create-contact/create-contact.mjs +++ b/components/connectwise_psa/actions/create-contact/create-contact.mjs @@ -1,3 +1,4 @@ +import { parseObjectEntries } from "../../../firecrawl/common/utils.mjs"; import connectwise from "../../connectwise_psa.app.mjs"; export default { @@ -91,6 +92,17 @@ export default { "country", ], }, + isDefault: { + type: "boolean", + label: "Primary Contact", + description: "Whether the contact is the primary (default) contact for the company", + optional: true, + }, + additionalOptions: { + type: "object", + label: "Additional Options", + description: "Additional parameters to send in the request. [See the documentation](https://developer.connectwise.com/Products/ConnectWise_PSA/REST#/Contacts/postCompanyContacts) for available parameters. Values will be parsed as JSON where applicable.", + }, }, async run({ $ }) { const communicationItems = []; @@ -145,6 +157,8 @@ export default { id: this.department, } : undefined, + defaultFlag: this.isDefault, + ...(this.additionalOptions && parseObjectEntries(this.additionalOptions)), }, }); $.export("$summary", `Successfully created contact with ID: ${response.id}`); diff --git a/components/connectwise_psa/common/utils.mjs b/components/connectwise_psa/common/utils.mjs new file mode 100644 index 0000000000000..9c3cdbf569744 --- /dev/null +++ b/components/connectwise_psa/common/utils.mjs @@ -0,0 +1,22 @@ +function optionalParseAsJSON(value) { + try { + return JSON.parse(value); + } catch (e) { + return value; + } +} + +export function parseObjectEntries(value) { + const obj = typeof value === "string" + ? JSON.parse(value) + : value; + return Object.fromEntries( + Object.entries(obj).map(([ + key, + value, + ]) => [ + key, + optionalParseAsJSON(value), + ]), + ); +} From 25589c080380436f079db1f1b3ce7a2f88893896 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 30 Mar 2025 19:43:19 -0300 Subject: [PATCH 3/8] Version bumps --- .../connectwise_psa/actions/create-contact/create-contact.mjs | 2 +- components/connectwise_psa/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/connectwise_psa/actions/create-contact/create-contact.mjs b/components/connectwise_psa/actions/create-contact/create-contact.mjs index 8f2b19def706b..772639084cbf2 100644 --- a/components/connectwise_psa/actions/create-contact/create-contact.mjs +++ b/components/connectwise_psa/actions/create-contact/create-contact.mjs @@ -5,7 +5,7 @@ export default { key: "connectwise_psa-create-contact", name: "Create Contact", description: "Creates a new contact in Connectwise. [See the documentation](https://developer.connectwise.com/Products/ConnectWise_PSA/REST#/Contacts/postCompanyContacts)", - version: "0.0.1", + version: "0.1.0", type: "action", props: { connectwise, diff --git a/components/connectwise_psa/package.json b/components/connectwise_psa/package.json index 12cb51c301656..571a1866a1a59 100644 --- a/components/connectwise_psa/package.json +++ b/components/connectwise_psa/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/connectwise_psa", - "version": "0.1.1", + "version": "0.1.2", "description": "Pipedream Connectwise PSA Components", "main": "connectwise_psa.app.mjs", "keywords": [ From a58e06557ae3c25dcf7eefc27e0e110ca5e1926f Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 30 Mar 2025 21:44:58 -0300 Subject: [PATCH 4/8] Adding optional note creation to ticket --- .../actions/create-ticket/create-ticket.mjs | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/components/connectwise_psa/actions/create-ticket/create-ticket.mjs b/components/connectwise_psa/actions/create-ticket/create-ticket.mjs index 850a2d9d1f910..dc654a55d70f0 100644 --- a/components/connectwise_psa/actions/create-ticket/create-ticket.mjs +++ b/components/connectwise_psa/actions/create-ticket/create-ticket.mjs @@ -4,7 +4,7 @@ export default { key: "connectwise_psa-create-ticket", name: "Create Ticket", description: "Creates a new ticket in Connectwise. [See the documentation](https://developer.connectwise.com/Products/ConnectWise_PSA/REST#/Tickets/postServiceTickets)", - version: "0.0.1", + version: "0.1.0", type: "action", props: { connectwise, @@ -31,6 +31,23 @@ export default { "priority", ], }, + note: { + type: "string[]", + label: "Note(s)", + description: "Text content of one or more notes to add to the ticket", + optional: true, + }, + }, + methods: { + createTicketNote({ + id, ...args + }) { + return this.connectwise._makeRequest({ + method: "POST", + path: `/service/tickets/${id}/notes`, + ...args, + }); + }, }, async run({ $ }) { const response = await this.connectwise.createTicket({ @@ -52,7 +69,38 @@ export default { : undefined, }, }); - $.export("$summary", `Successfully created ticket with ID: ${response.id}`); - return response; + const { id } = response; + const { note } = this; + const createdNotes = []; + if (id && note?.length) { + const notes = Array.isArray(note) + ? note + : [ + note, + ]; + for (let note of notes) { + const response = await this.createTicketNote({ + $, + id, + data: { + text: note, + detailDescriptionFlag: true, + }, + }); + createdNotes.push(response); + } + } + const amountNotes = createdNotes.length; + $.export("$summary", `Successfully created ticket (ID: ${id})${amountNotes + ? ` and added ${amountNotes} notes` + : ""}`); + return { + ...(amountNotes + ? { + createdNotes, + } + : undefined), + ...response, + }; }, }; From 7d9409bbe368b286ae8f14c7a8e024e9aec63321 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 30 Mar 2025 21:58:02 -0300 Subject: [PATCH 5/8] import path fix --- .../connectwise_psa/actions/create-contact/create-contact.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/connectwise_psa/actions/create-contact/create-contact.mjs b/components/connectwise_psa/actions/create-contact/create-contact.mjs index 772639084cbf2..09bbb5f9330a3 100644 --- a/components/connectwise_psa/actions/create-contact/create-contact.mjs +++ b/components/connectwise_psa/actions/create-contact/create-contact.mjs @@ -1,4 +1,4 @@ -import { parseObjectEntries } from "../../../firecrawl/common/utils.mjs"; +import { parseObjectEntries } from "../../common/utils.mjs"; import connectwise from "../../connectwise_psa.app.mjs"; export default { From 862879af4d496ece03fdc4c1531132d216ddb224 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 30 Mar 2025 21:58:27 -0300 Subject: [PATCH 6/8] Package bump --- components/connectwise_psa/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/connectwise_psa/package.json b/components/connectwise_psa/package.json index 571a1866a1a59..1cba42742869e 100644 --- a/components/connectwise_psa/package.json +++ b/components/connectwise_psa/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/connectwise_psa", - "version": "0.1.2", + "version": "0.2.0", "description": "Pipedream Connectwise PSA Components", "main": "connectwise_psa.app.mjs", "keywords": [ From a26eeeee30cf732dda3b4ee49bf2ac7caf1dd8d7 Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Wed, 2 Apr 2025 08:57:35 +0700 Subject: [PATCH 7/8] Update components/connectwise_psa/actions/create-contact/create-contact.mjs --- .../connectwise_psa/actions/create-contact/create-contact.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/connectwise_psa/actions/create-contact/create-contact.mjs b/components/connectwise_psa/actions/create-contact/create-contact.mjs index 09bbb5f9330a3..3dc5410f25902 100644 --- a/components/connectwise_psa/actions/create-contact/create-contact.mjs +++ b/components/connectwise_psa/actions/create-contact/create-contact.mjs @@ -102,6 +102,7 @@ export default { type: "object", label: "Additional Options", description: "Additional parameters to send in the request. [See the documentation](https://developer.connectwise.com/Products/ConnectWise_PSA/REST#/Contacts/postCompanyContacts) for available parameters. Values will be parsed as JSON where applicable.", + optional: true }, }, async run({ $ }) { From 3fc57a3b00bf6625a54c036c24065488b17c0cba Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Wed, 2 Apr 2025 09:00:10 +0700 Subject: [PATCH 8/8] Update components/connectwise_psa/actions/create-contact/create-contact.mjs --- .../connectwise_psa/actions/create-contact/create-contact.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/connectwise_psa/actions/create-contact/create-contact.mjs b/components/connectwise_psa/actions/create-contact/create-contact.mjs index 3dc5410f25902..04dd9982095d7 100644 --- a/components/connectwise_psa/actions/create-contact/create-contact.mjs +++ b/components/connectwise_psa/actions/create-contact/create-contact.mjs @@ -102,7 +102,7 @@ export default { type: "object", label: "Additional Options", description: "Additional parameters to send in the request. [See the documentation](https://developer.connectwise.com/Products/ConnectWise_PSA/REST#/Contacts/postCompanyContacts) for available parameters. Values will be parsed as JSON where applicable.", - optional: true + optional: true, }, }, async run({ $ }) {