Skip to content

Commit 4ef0ceb

Browse files
Asana & Freshdesk Updates (#16080)
* asana search-tasks updates * freshdesk updates * updates * pnpm-lock.yaml --------- Co-authored-by: Danny Roosevelt <[email protected]>
1 parent 72c8447 commit 4ef0ceb

File tree

11 files changed

+55
-39
lines changed

11 files changed

+55
-39
lines changed

components/asana/actions/search-tasks/search-tasks.mjs

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import asana from "../../asana.app.mjs";
22
import common from "../common/common.mjs";
3+
import { ConfigurationError } from "@pipedream/platform";
34

45
export default {
56
key: "asana-search-tasks",
67
name: "Search Tasks",
78
description: "Searches for a Task by name within a Project. [See the documentation](https://developers.asana.com/docs/get-multiple-tasks)",
8-
version: "0.3.1",
9+
version: "0.3.2",
910
type: "action",
1011
props: {
1112
...common.props,
13+
project: {
14+
...common.props.project,
15+
optional: true,
16+
},
1217
name: {
1318
label: "Name",
1419
description: "The task name to search for.",
@@ -30,7 +35,7 @@ export default {
3035
section: {
3136
label: "Section",
3237
type: "string",
33-
description: "The section to filter tasks on.",
38+
description: "The section to filter tasks on. Must specify Project to list options.",
3439
optional: true,
3540
propDefinition: [
3641
asana,
@@ -40,33 +45,44 @@ export default {
4045
}),
4146
],
4247
},
43-
completed_since: {
48+
completedSince: {
4449
label: "Completed Since",
4550
type: "string",
4651
description: "Only return tasks that are either incomplete or that have been completed since this time. ISO 8601 date string",
4752
optional: true,
4853
},
49-
modified_since: {
54+
modifiedSince: {
5055
label: "Modified Since",
5156
type: "string",
5257
description: "Only return tasks that have been modified since the given time. ISO 8601 date string",
5358
optional: true,
5459
},
5560
},
5661
async run({ $ }) {
57-
if ((!this.workspace || !this.assignee) && !this.project && !this.section) {
58-
throw new Error("You must specify a Project or Section if you do not specify Assignee and Workspace");
62+
if (!this.project && !this.section && !this.assignee) {
63+
throw new ConfigurationError("Must specify one of Project, Section, or Assignee");
64+
}
65+
66+
if ((this.project || this.section) && this.assignee) {
67+
throw new ConfigurationError("Must specify only one of Assignee, Project, or Project + Section");
68+
}
69+
70+
const params = {
71+
completed_since: this.completedSince,
72+
modified_since: this.modifiedSince,
73+
};
74+
75+
if (this.assignee) {
76+
params.assignee = this.assignee;
77+
params.workspace = this.workspace;
78+
} else if (this.section) {
79+
params.section = this.section;
80+
} else {
81+
params.project = this.project;
5982
}
6083

6184
const { data: tasks } = await this.asana.getTasks({
62-
params: {
63-
assignee: this.assignee,
64-
project: this.project,
65-
section: this.section,
66-
workspace: this.workspace,
67-
completed_since: this.completed_since,
68-
modified_since: this.modified_since,
69-
},
85+
params,
7086
$,
7187
});
7288

components/asana/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/asana",
3-
"version": "0.7.1",
3+
"version": "0.7.2",
44
"description": "Pipedream Asana Components",
55
"main": "asana.app.mjs",
66
"keywords": [

components/freshdesk/actions/create-company/create-company.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "freshdesk-create-company",
55
name: "Create a Company",
66
description: "Create a company. [See the documentation](https://developers.freshdesk.com/api/#create_company)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
freshdesk,

components/freshdesk/actions/create-contact/create-contact.mjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import freshdesk from "../../freshdesk.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
23

34
export default {
45
key: "freshdesk-create-contact",
56
name: "Create a Contact",
67
description: "Create a contact. [See the documentation](https://developers.freshdesk.com/api/#create_contact)",
7-
version: "0.0.2",
8+
version: "0.0.3",
89
type: "action",
910
props: {
1011
freshdesk,
@@ -41,9 +42,14 @@ export default {
4142
},
4243
async run({ $ }) {
4344
const {
44-
companyId, otherEmails, ...data
45+
freshdesk, companyId, otherEmails, ...data
4546
} = this;
46-
const response = await this.freshdesk.createContact({
47+
48+
if (!this.email && !this.phone) {
49+
throw new ConfigurationError("Must specify `email` and/or `phone`");
50+
}
51+
52+
const response = await freshdesk.createContact({
4753
$,
4854
data: {
4955
other_emails: otherEmails,

components/freshdesk/actions/create-ticket/create-ticket.mjs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "freshdesk-create-ticket",
55
name: "Create a Ticket",
66
description: "Create a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_ticket)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
freshdesk,
@@ -22,32 +22,24 @@ export default {
2222
companyId,
2323
}),
2424
],
25-
optional: true,
2625
},
2726
priority: {
2827
propDefinition: [
2928
freshdesk,
3029
"ticketPriority",
3130
],
3231
default: 1,
32+
optional: true,
3333
},
3434
subject: {
3535
type: "string",
3636
label: "Subject",
3737
description: "Subject of the ticket",
38-
optional: true,
3938
},
4039
description: {
4140
type: "string",
4241
label: "Description",
4342
description: "HTML content of the ticket",
44-
optional: true,
45-
},
46-
descriptionText: {
47-
type: "string",
48-
label: "Description text",
49-
description: "Content of the ticket in plain text",
50-
optional: true,
5143
},
5244
phone: {
5345
type: "string",
@@ -66,13 +58,12 @@ export default {
6658
},
6759
async run({ $ }) {
6860
const {
69-
freshdesk, companyId, descriptionText, ...data
61+
freshdesk, companyId, ...data
7062
} = this;
7163
const response = await freshdesk.createTicket({
7264
$,
7365
data: {
7466
company_id: Number(companyId),
75-
description_text: descriptionText,
7667
...data,
7768
},
7869
});

components/freshdesk/actions/get-ticket/get-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "freshdesk-get-ticket",
55
name: "Get Ticket Details",
66
description: "Get details of a Ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)",
7-
version: "0.1.0",
7+
version: "0.1.1",
88
type: "action",
99
props: {
1010
freshdesk,

components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "List Tickets",
66
description:
77
"Fetch up to 100 tickets according to the selected filters. [See the documentation](https://developers.freshdesk.com/api/#list_all_tickets)",
8-
version: "0.2.0",
8+
version: "0.2.1",
99
type: "action",
1010
props: {
1111
freshdesk,

components/freshdesk/freshdesk.app.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ export default {
5858
label: "Email",
5959
description: "Select a contact or provide a contact's email",
6060
async options({ companyId }) {
61-
const contacts = await this.getContacts();
62-
const numId = Number(companyId);
61+
const contacts = await this.getContacts({
62+
params: {
63+
company_id: companyId,
64+
},
65+
});
6366
return contacts
64-
.filter((contact) => contact.company_id === numId)
67+
.filter(({ email }) => email)
6568
.map(({
6669
email, name,
6770
}) => ({

components/freshdesk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/freshdesk",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Pipedream Freshdesk Components",
55
"main": "freshdesk.app.mjs",
66
"keywords": [

components/freshdesk/sources/new-contact/new-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "freshdesk-new-contact",
77
name: "New Contact Created",
88
description: "Emit new event when a contact is created. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
type: "source",
1111
props: {
1212
freshdesk,

components/freshdesk/sources/new-ticket/new-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "freshdesk-new-ticket",
77
name: "New Ticket Created",
88
description: "Emit new event when a ticket is created. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
type: "source",
1111
props: {
1212
freshdesk,

0 commit comments

Comments
 (0)