@pipedream/asana 0.7.1 → 0.7.2
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.
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import asana from "../../asana.app.mjs";
|
|
2
2
|
import common from "../common/common.mjs";
|
|
3
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
key: "asana-search-tasks",
|
|
6
7
|
name: "Search Tasks",
|
|
7
8
|
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.
|
|
9
|
+
version: "0.3.2",
|
|
9
10
|
type: "action",
|
|
10
11
|
props: {
|
|
11
12
|
...common.props,
|
|
13
|
+
project: {
|
|
14
|
+
...common.props.project,
|
|
15
|
+
optional: true,
|
|
16
|
+
},
|
|
12
17
|
name: {
|
|
13
18
|
label: "Name",
|
|
14
19
|
description: "The task name to search for.",
|
|
@@ -30,7 +35,7 @@ export default {
|
|
|
30
35
|
section: {
|
|
31
36
|
label: "Section",
|
|
32
37
|
type: "string",
|
|
33
|
-
description: "The section to filter tasks on.",
|
|
38
|
+
description: "The section to filter tasks on. Must specify Project to list options.",
|
|
34
39
|
optional: true,
|
|
35
40
|
propDefinition: [
|
|
36
41
|
asana,
|
|
@@ -40,13 +45,13 @@ export default {
|
|
|
40
45
|
}),
|
|
41
46
|
],
|
|
42
47
|
},
|
|
43
|
-
|
|
48
|
+
completedSince: {
|
|
44
49
|
label: "Completed Since",
|
|
45
50
|
type: "string",
|
|
46
51
|
description: "Only return tasks that are either incomplete or that have been completed since this time. ISO 8601 date string",
|
|
47
52
|
optional: true,
|
|
48
53
|
},
|
|
49
|
-
|
|
54
|
+
modifiedSince: {
|
|
50
55
|
label: "Modified Since",
|
|
51
56
|
type: "string",
|
|
52
57
|
description: "Only return tasks that have been modified since the given time. ISO 8601 date string",
|
|
@@ -54,19 +59,30 @@ export default {
|
|
|
54
59
|
},
|
|
55
60
|
},
|
|
56
61
|
async run({ $ }) {
|
|
57
|
-
if (
|
|
58
|
-
throw new
|
|
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;
|
|
59
82
|
}
|
|
60
83
|
|
|
61
84
|
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,
|
|
70
86
|
$,
|
|
71
87
|
});
|
|
72
88
|
|