diff --git a/components/asana/actions/search-tasks/search-tasks.mjs b/components/asana/actions/search-tasks/search-tasks.mjs index 79392f041da98..c9e7df888bc8d 100644 --- a/components/asana/actions/search-tasks/search-tasks.mjs +++ b/components/asana/actions/search-tasks/search-tasks.mjs @@ -1,14 +1,19 @@ import asana from "../../asana.app.mjs"; import common from "../common/common.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "asana-search-tasks", name: "Search Tasks", description: "Searches for a Task by name within a Project. [See the documentation](https://developers.asana.com/docs/get-multiple-tasks)", - version: "0.3.1", + version: "0.3.2", type: "action", props: { ...common.props, + project: { + ...common.props.project, + optional: true, + }, name: { label: "Name", description: "The task name to search for.", @@ -30,7 +35,7 @@ export default { section: { label: "Section", type: "string", - description: "The section to filter tasks on.", + description: "The section to filter tasks on. Must specify Project to list options.", optional: true, propDefinition: [ asana, @@ -40,13 +45,13 @@ export default { }), ], }, - completed_since: { + completedSince: { label: "Completed Since", type: "string", description: "Only return tasks that are either incomplete or that have been completed since this time. ISO 8601 date string", optional: true, }, - modified_since: { + modifiedSince: { label: "Modified Since", type: "string", description: "Only return tasks that have been modified since the given time. ISO 8601 date string", @@ -54,19 +59,30 @@ export default { }, }, async run({ $ }) { - if ((!this.workspace || !this.assignee) && !this.project && !this.section) { - throw new Error("You must specify a Project or Section if you do not specify Assignee and Workspace"); + if (!this.project && !this.section && !this.assignee) { + throw new ConfigurationError("Must specify one of Project, Section, or Assignee"); + } + + if ((this.project || this.section) && this.assignee) { + throw new ConfigurationError("Must specify only one of Assignee, Project, or Project + Section"); + } + + const params = { + completed_since: this.completedSince, + modified_since: this.modifiedSince, + }; + + if (this.assignee) { + params.assignee = this.assignee; + params.workspace = this.workspace; + } else if (this.section) { + params.section = this.section; + } else { + params.project = this.project; } const { data: tasks } = await this.asana.getTasks({ - params: { - assignee: this.assignee, - project: this.project, - section: this.section, - workspace: this.workspace, - completed_since: this.completed_since, - modified_since: this.modified_since, - }, + params, $, }); diff --git a/components/asana/package.json b/components/asana/package.json index 68de90cd4e99c..3222fc12f6a98 100644 --- a/components/asana/package.json +++ b/components/asana/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/asana", - "version": "0.7.1", + "version": "0.7.2", "description": "Pipedream Asana Components", "main": "asana.app.mjs", "keywords": [ diff --git a/components/freshdesk/actions/create-company/create-company.mjs b/components/freshdesk/actions/create-company/create-company.mjs index 9771ebadd4460..2960aec4dc5f1 100644 --- a/components/freshdesk/actions/create-company/create-company.mjs +++ b/components/freshdesk/actions/create-company/create-company.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-create-company", name: "Create a Company", description: "Create a company. [See the documentation](https://developers.freshdesk.com/api/#create_company)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { freshdesk, diff --git a/components/freshdesk/actions/create-contact/create-contact.mjs b/components/freshdesk/actions/create-contact/create-contact.mjs index 3722bb55dbc72..e7a375fc2a6ef 100644 --- a/components/freshdesk/actions/create-contact/create-contact.mjs +++ b/components/freshdesk/actions/create-contact/create-contact.mjs @@ -1,10 +1,11 @@ import freshdesk from "../../freshdesk.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "freshdesk-create-contact", name: "Create a Contact", description: "Create a contact. [See the documentation](https://developers.freshdesk.com/api/#create_contact)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { freshdesk, @@ -41,9 +42,14 @@ export default { }, async run({ $ }) { const { - companyId, otherEmails, ...data + freshdesk, companyId, otherEmails, ...data } = this; - const response = await this.freshdesk.createContact({ + + if (!this.email && !this.phone) { + throw new ConfigurationError("Must specify `email` and/or `phone`"); + } + + const response = await freshdesk.createContact({ $, data: { other_emails: otherEmails, diff --git a/components/freshdesk/actions/create-ticket/create-ticket.mjs b/components/freshdesk/actions/create-ticket/create-ticket.mjs index 20a05fb75c651..c505334e4e455 100644 --- a/components/freshdesk/actions/create-ticket/create-ticket.mjs +++ b/components/freshdesk/actions/create-ticket/create-ticket.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-create-ticket", name: "Create a Ticket", description: "Create a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_ticket)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { freshdesk, @@ -22,7 +22,6 @@ export default { companyId, }), ], - optional: true, }, priority: { propDefinition: [ @@ -30,24 +29,17 @@ export default { "ticketPriority", ], default: 1, + optional: true, }, subject: { type: "string", label: "Subject", description: "Subject of the ticket", - optional: true, }, description: { type: "string", label: "Description", description: "HTML content of the ticket", - optional: true, - }, - descriptionText: { - type: "string", - label: "Description text", - description: "Content of the ticket in plain text", - optional: true, }, phone: { type: "string", @@ -66,13 +58,12 @@ export default { }, async run({ $ }) { const { - freshdesk, companyId, descriptionText, ...data + freshdesk, companyId, ...data } = this; const response = await freshdesk.createTicket({ $, data: { company_id: Number(companyId), - description_text: descriptionText, ...data, }, }); diff --git a/components/freshdesk/actions/get-ticket/get-ticket.mjs b/components/freshdesk/actions/get-ticket/get-ticket.mjs index 3a59260c47ea4..18837769a396f 100644 --- a/components/freshdesk/actions/get-ticket/get-ticket.mjs +++ b/components/freshdesk/actions/get-ticket/get-ticket.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-get-ticket", name: "Get Ticket Details", description: "Get details of a Ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)", - version: "0.1.0", + version: "0.1.1", type: "action", props: { freshdesk, diff --git a/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs b/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs index adefcc4be2ca6..8c9060b92517d 100644 --- a/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs +++ b/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs @@ -5,7 +5,7 @@ export default { name: "List Tickets", description: "Fetch up to 100 tickets according to the selected filters. [See the documentation](https://developers.freshdesk.com/api/#list_all_tickets)", - version: "0.2.0", + version: "0.2.1", type: "action", props: { freshdesk, diff --git a/components/freshdesk/freshdesk.app.mjs b/components/freshdesk/freshdesk.app.mjs index 39fde1cd6025b..d60c43eff58af 100644 --- a/components/freshdesk/freshdesk.app.mjs +++ b/components/freshdesk/freshdesk.app.mjs @@ -58,10 +58,13 @@ export default { label: "Email", description: "Select a contact or provide a contact's email", async options({ companyId }) { - const contacts = await this.getContacts(); - const numId = Number(companyId); + const contacts = await this.getContacts({ + params: { + company_id: companyId, + }, + }); return contacts - .filter((contact) => contact.company_id === numId) + .filter(({ email }) => email) .map(({ email, name, }) => ({ diff --git a/components/freshdesk/package.json b/components/freshdesk/package.json index 5a0836d4847b4..1128b1f775f3e 100644 --- a/components/freshdesk/package.json +++ b/components/freshdesk/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/freshdesk", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Freshdesk Components", "main": "freshdesk.app.mjs", "keywords": [ diff --git a/components/freshdesk/sources/new-contact/new-contact.mjs b/components/freshdesk/sources/new-contact/new-contact.mjs index c965df308e594..bfd2f40aab89d 100644 --- a/components/freshdesk/sources/new-contact/new-contact.mjs +++ b/components/freshdesk/sources/new-contact/new-contact.mjs @@ -6,7 +6,7 @@ export default { key: "freshdesk-new-contact", name: "New Contact Created", description: "Emit new event when a contact is created. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)", - version: "0.0.3", + version: "0.0.4", type: "source", props: { freshdesk, diff --git a/components/freshdesk/sources/new-ticket/new-ticket.mjs b/components/freshdesk/sources/new-ticket/new-ticket.mjs index 6cab8f07d395c..1f910b1786cc4 100644 --- a/components/freshdesk/sources/new-ticket/new-ticket.mjs +++ b/components/freshdesk/sources/new-ticket/new-ticket.mjs @@ -6,7 +6,7 @@ export default { key: "freshdesk-new-ticket", name: "New Ticket Created", description: "Emit new event when a ticket is created. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)", - version: "0.0.3", + version: "0.0.4", type: "source", props: { freshdesk,