asana 3.0.1 → 3.0.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.
- package/README.md +3 -14
- package/build-tests/README.md +19 -0
- package/build-tests/api/ProjectsApi.js +178 -0
- package/build-tests/api/TasksApi.js +260 -0
- package/codegen/templates/README.mustache +0 -11
- package/codegen/templates/package.mustache +3 -1
- package/dist/ApiClient.js +3 -3
- package/dist/api/AttachmentsApi.js +1 -1
- package/dist/api/AuditLogAPIApi.js +1 -1
- package/dist/api/BatchAPIApi.js +1 -1
- package/dist/api/CustomFieldSettingsApi.js +1 -1
- package/dist/api/CustomFieldsApi.js +1 -1
- package/dist/api/EventsApi.js +1 -1
- package/dist/api/GoalRelationshipsApi.js +1 -1
- package/dist/api/GoalsApi.js +1 -1
- package/dist/api/JobsApi.js +1 -1
- package/dist/api/MembershipsApi.js +1 -1
- package/dist/api/OrganizationExportsApi.js +1 -1
- package/dist/api/PortfolioMembershipsApi.js +1 -1
- package/dist/api/PortfoliosApi.js +1 -1
- package/dist/api/ProjectBriefsApi.js +1 -1
- package/dist/api/ProjectMembershipsApi.js +1 -1
- package/dist/api/ProjectStatusesApi.js +1 -1
- package/dist/api/ProjectTemplatesApi.js +1 -1
- package/dist/api/ProjectsApi.js +1 -1
- package/dist/api/RulesApi.js +1 -1
- package/dist/api/SectionsApi.js +1 -1
- package/dist/api/StatusUpdatesApi.js +1 -1
- package/dist/api/StoriesApi.js +1 -1
- package/dist/api/TagsApi.js +1 -1
- package/dist/api/TaskTemplatesApi.js +1 -1
- package/dist/api/TasksApi.js +1 -1
- package/dist/api/TeamMembershipsApi.js +1 -1
- package/dist/api/TeamsApi.js +1 -1
- package/dist/api/TimePeriodsApi.js +1 -1
- package/dist/api/TimeTrackingEntriesApi.js +1 -1
- package/dist/api/TypeaheadApi.js +1 -1
- package/dist/api/UserTaskListsApi.js +1 -1
- package/dist/api/UsersApi.js +1 -1
- package/dist/api/WebhooksApi.js +1 -1
- package/dist/api/WorkspaceMembershipsApi.js +1 -1
- package/dist/api/WorkspacesApi.js +1 -1
- package/package.json +3 -1
- package/src/ApiClient.js +3 -3
- package/src/api/AttachmentsApi.js +1 -1
- package/src/api/AuditLogAPIApi.js +1 -1
- package/src/api/BatchAPIApi.js +1 -1
- package/src/api/CustomFieldSettingsApi.js +1 -1
- package/src/api/CustomFieldsApi.js +1 -1
- package/src/api/EventsApi.js +1 -1
- package/src/api/GoalRelationshipsApi.js +1 -1
- package/src/api/GoalsApi.js +1 -1
- package/src/api/JobsApi.js +1 -1
- package/src/api/MembershipsApi.js +1 -1
- package/src/api/OrganizationExportsApi.js +1 -1
- package/src/api/PortfolioMembershipsApi.js +1 -1
- package/src/api/PortfoliosApi.js +1 -1
- package/src/api/ProjectBriefsApi.js +1 -1
- package/src/api/ProjectMembershipsApi.js +1 -1
- package/src/api/ProjectStatusesApi.js +1 -1
- package/src/api/ProjectTemplatesApi.js +1 -1
- package/src/api/ProjectsApi.js +1 -1
- package/src/api/RulesApi.js +1 -1
- package/src/api/SectionsApi.js +1 -1
- package/src/api/StatusUpdatesApi.js +1 -1
- package/src/api/StoriesApi.js +1 -1
- package/src/api/TagsApi.js +1 -1
- package/src/api/TaskTemplatesApi.js +1 -1
- package/src/api/TasksApi.js +1 -1
- package/src/api/TeamMembershipsApi.js +1 -1
- package/src/api/TeamsApi.js +1 -1
- package/src/api/TimePeriodsApi.js +1 -1
- package/src/api/TimeTrackingEntriesApi.js +1 -1
- package/src/api/TypeaheadApi.js +1 -1
- package/src/api/UserTaskListsApi.js +1 -1
- package/src/api/UsersApi.js +1 -1
- package/src/api/WebhooksApi.js +1 -1
- package/src/api/WorkspaceMembershipsApi.js +1 -1
- package/src/api/WorkspacesApi.js +1 -1
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
# asana [![GitHub release][release-image]][release-url] [![NPM Version][npm-image]][npm-url]
|
|
2
2
|
|
|
3
|
-
> **Important**
|
|
4
|
-
> Version 3.X.X is the newest release of our Node client library and currently in public beta. This means that while it has the latest Asana features, we're still putting on the final touches to ensure it's as stable and reliable as possible.
|
|
5
|
-
>
|
|
6
|
-
>🛠️ **Looking Ahead**
|
|
7
|
-
>
|
|
8
|
-
> This version will receive updates going forward, and it’s on track to reach full stability soon. Your input is invaluable in this process! If you spot any issues, have suggestions, or need help, don’t hesitate to reach out. You can open a GitHub issue or submit your feedback directly to us.
|
|
9
|
-
>
|
|
10
|
-
>📖 **Get Started with Examples and Resources**
|
|
11
|
-
>
|
|
12
|
-
> For now, if you’re in search of a version that has stood the test of time and is proven to be stable, we recommend using version 1.0.2. You can easily install it using: `npm install asana@1.0.2` and following v1 samples and documentation.
|
|
13
|
-
|
|
14
3
|
- API version: 1.0
|
|
15
|
-
- Package version: 3.0.
|
|
4
|
+
- Package version: 3.0.2
|
|
16
5
|
|
|
17
6
|
## Installation
|
|
18
7
|
|
|
@@ -29,7 +18,7 @@ npm install asana --save
|
|
|
29
18
|
Include the latest release directly from GitHub:
|
|
30
19
|
|
|
31
20
|
```html
|
|
32
|
-
<script src="https://github.com/Asana/node-asana/releases/download/v3.0.
|
|
21
|
+
<script src="https://github.com/Asana/node-asana/releases/download/v3.0.2/asana-min.js"></script>
|
|
33
22
|
```
|
|
34
23
|
|
|
35
24
|
Example usage (**NOTE**: be careful not to expose your access token):
|
|
@@ -1011,6 +1000,6 @@ client.callApi(
|
|
|
1011
1000
|
```
|
|
1012
1001
|
|
|
1013
1002
|
[release-image]: https://img.shields.io/github/release/asana/node-asana.svg
|
|
1014
|
-
[release-url]: https://github.com/Asana/node-asana/releases/tag/v3.0.
|
|
1003
|
+
[release-url]: https://github.com/Asana/node-asana/releases/tag/v3.0.2
|
|
1015
1004
|
[npm-image]: http://img.shields.io/npm/v/asana.svg?style=flat-square
|
|
1016
1005
|
[npm-url]: https://www.npmjs.org/package/asana
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Test Build
|
|
2
|
+
|
|
3
|
+
This directory contains tests that are meant to be ran locally
|
|
4
|
+
|
|
5
|
+
1. Install dependencies: `npm i`
|
|
6
|
+
|
|
7
|
+
2. Setup Environment Variables. Create a `.env` file within the root of the project directory with the following information
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
PERSONAL_ACCESS_TOKEN=<YOUR_ASANA_PERSONAL_ACCESS_TOKEN>
|
|
11
|
+
TEAM_GID=<YOUR_TEAM_GID>
|
|
12
|
+
TEXT_CUSTOM_FIELD_GID=<YOUR_TEXT_CUSTOM_FIELD_GID> -> NOTE: make sure that there is at least one task that has this custom field and the value of the custom field on that task is `custom_value`
|
|
13
|
+
USER_GID=<YOUR_USER_GID>
|
|
14
|
+
WORKSPACE_GID=<YOUR_WORKSPACE_GID>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
3. Run tests: `npm run testbuild`
|
|
18
|
+
|
|
19
|
+
TIP: to debug, add `debugger;` to the location of the test code you want to debug and re-run `npm run testbuild`
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof define === "function" && define.amd) {
|
|
3
|
+
// AMD.
|
|
4
|
+
define(["expect.js", "../../src/index"], factory);
|
|
5
|
+
} else if (typeof module === "object" && module.exports) {
|
|
6
|
+
// CommonJS-like environments that support module.exports, like Node.
|
|
7
|
+
factory(require("expect.js"), require("../../src/index"));
|
|
8
|
+
} else {
|
|
9
|
+
// Browser globals (root is window)
|
|
10
|
+
factory(root.expect, root.Asana);
|
|
11
|
+
}
|
|
12
|
+
})(this, function (expect, Asana) {
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
15
|
+
var TEAM_GID;
|
|
16
|
+
var WORKSPACE_GID;
|
|
17
|
+
|
|
18
|
+
var projectsApiInstance;
|
|
19
|
+
var project;
|
|
20
|
+
var projects;
|
|
21
|
+
|
|
22
|
+
before(async function () {
|
|
23
|
+
require('dotenv').config()
|
|
24
|
+
TEAM_GID = process.env.TEAM_GID;
|
|
25
|
+
WORKSPACE_GID = process.env.WORKSPACE_GID;
|
|
26
|
+
|
|
27
|
+
let client = Asana.ApiClient.instance;
|
|
28
|
+
let token = client.authentications["token"];
|
|
29
|
+
token.accessToken = process.env.PERSONAL_ACCESS_TOKEN;
|
|
30
|
+
|
|
31
|
+
projectsApiInstance = new Asana.ProjectsApi();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("ProjectsApi", function () {
|
|
35
|
+
describe("createProject", function () {
|
|
36
|
+
it("should have created project", async function () {
|
|
37
|
+
let body = {
|
|
38
|
+
data: {
|
|
39
|
+
name: "Project 1",
|
|
40
|
+
notes: "Some description",
|
|
41
|
+
team: TEAM_GID,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
project = await projectsApiInstance.createProject(body, {});
|
|
47
|
+
} catch (error) {
|
|
48
|
+
throw error.response.body;
|
|
49
|
+
}
|
|
50
|
+
expect(project).to.be.ok();
|
|
51
|
+
});
|
|
52
|
+
it("should have a `name`", function () {
|
|
53
|
+
expect(project.data.name).to.be("Project 1");
|
|
54
|
+
});
|
|
55
|
+
it("should have a description/`notes`", function () {
|
|
56
|
+
expect(project.data.notes).to.be("Some description");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe("updateProject", function () {
|
|
60
|
+
it("should have updated project", async function () {
|
|
61
|
+
let body = {
|
|
62
|
+
data: {
|
|
63
|
+
name: "Project 1 - Updated",
|
|
64
|
+
notes: "Updated description",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
project = await projectsApiInstance.updateProject(
|
|
70
|
+
body,
|
|
71
|
+
project.data.gid,
|
|
72
|
+
{}
|
|
73
|
+
);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
throw error.response.body;
|
|
76
|
+
}
|
|
77
|
+
expect(project).to.be.ok();
|
|
78
|
+
});
|
|
79
|
+
it("should have updated project `name`", function () {
|
|
80
|
+
expect(project.data.name).to.be("Project 1 - Updated");
|
|
81
|
+
});
|
|
82
|
+
it("should have updated project description/`notes`", function () {
|
|
83
|
+
expect(project.data.notes).to.be("Updated description");
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe("getProject", function () {
|
|
87
|
+
it("should return project", async function () {
|
|
88
|
+
let response;
|
|
89
|
+
try {
|
|
90
|
+
response = await projectsApiInstance.getProject(
|
|
91
|
+
project.data.gid,
|
|
92
|
+
{}
|
|
93
|
+
);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
throw error.response.body;
|
|
96
|
+
}
|
|
97
|
+
expect(response).to.ok();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe("getProject with `opt_fields`", function () {
|
|
101
|
+
describe("ask for `html_notes` and `due_on` properties in `opt_fields`", function () {
|
|
102
|
+
it("should return project", async function () {
|
|
103
|
+
let opts = {
|
|
104
|
+
opt_fields: "html_notes,due_on",
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
project = await projectsApiInstance.getProject(
|
|
109
|
+
project.data.gid,
|
|
110
|
+
opts
|
|
111
|
+
);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
throw error.response.body;
|
|
114
|
+
}
|
|
115
|
+
expect(project).to.ok();
|
|
116
|
+
});
|
|
117
|
+
it("should have `html_notes`", async function () {
|
|
118
|
+
expect(project.data.html_notes).not.to.equal(null);
|
|
119
|
+
});
|
|
120
|
+
it("should have `due_on` with `null` value", async function () {
|
|
121
|
+
expect(project.data.due_on).to.be(null);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
describe("getProjects", function () {
|
|
126
|
+
it("should return an array of projects", async function () {
|
|
127
|
+
let opts = {
|
|
128
|
+
limit: 100,
|
|
129
|
+
workspace: WORKSPACE_GID,
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
projects = await projectsApiInstance.getProjects(opts);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
throw error.response.body;
|
|
135
|
+
}
|
|
136
|
+
expect(projects).to.be.ok();
|
|
137
|
+
expect(projects.data).to.be.an("array");
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
describe("getProjects with `opt_fields`", function () {
|
|
141
|
+
describe("ask for `color` and `completed` properties in `opt_fields`", function () {
|
|
142
|
+
it("should return an array of projects", async function () {
|
|
143
|
+
let opts = {
|
|
144
|
+
workspace: WORKSPACE_GID,
|
|
145
|
+
opt_fields: "color,completed",
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
projects = await projectsApiInstance.getProjects(opts);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
throw error.response.body;
|
|
152
|
+
}
|
|
153
|
+
expect(projects).to.be.ok();
|
|
154
|
+
expect(projects.data).to.be.an("array");
|
|
155
|
+
});
|
|
156
|
+
it("should have `workspace`", function () {
|
|
157
|
+
expect("color" in projects.data[0]).to.be(true);
|
|
158
|
+
});
|
|
159
|
+
it("should have `completed`", function () {
|
|
160
|
+
expect("completed" in projects.data[0]).to.be(true);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
describe("deleteProject", function () {
|
|
165
|
+
it("should be deleted", async function () {
|
|
166
|
+
let response;
|
|
167
|
+
try {
|
|
168
|
+
response = await projectsApiInstance.deleteProject(
|
|
169
|
+
project.data.gid
|
|
170
|
+
);
|
|
171
|
+
} catch (error) {
|
|
172
|
+
throw error.response.body;
|
|
173
|
+
}
|
|
174
|
+
expect(response.data).to.be.empty();
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
});
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// NOTE: Because these tests are making live API calls, we decided to write these tests in a particular order to optimize speed and reduce API calls.
|
|
2
|
+
// The down side to this approach is that these tests are tightly coupled.
|
|
3
|
+
(function (root, factory) {
|
|
4
|
+
if (typeof define === "function" && define.amd) {
|
|
5
|
+
// AMD.
|
|
6
|
+
define(["expect.js", "../../src/index"], factory);
|
|
7
|
+
} else if (typeof module === "object" && module.exports) {
|
|
8
|
+
// CommonJS-like environments that support module.exports, like Node.
|
|
9
|
+
factory(require("expect.js"), require("../../src/index"));
|
|
10
|
+
} else {
|
|
11
|
+
// Browser globals (root is window)
|
|
12
|
+
factory(root.expect, root.Asana);
|
|
13
|
+
}
|
|
14
|
+
})(this, function (expect, Asana) {
|
|
15
|
+
"use strict";
|
|
16
|
+
|
|
17
|
+
var TEXT_CUSTOM_FIELD_GID;
|
|
18
|
+
var USER_GID;
|
|
19
|
+
var WORKSPACE_GID;
|
|
20
|
+
|
|
21
|
+
var tasksApiInstance;
|
|
22
|
+
var task;
|
|
23
|
+
var tasks;
|
|
24
|
+
|
|
25
|
+
before(async function () {
|
|
26
|
+
require('dotenv').config()
|
|
27
|
+
TEXT_CUSTOM_FIELD_GID = process.env.TEXT_CUSTOM_FIELD_GID;
|
|
28
|
+
USER_GID = process.env.USER_GID;
|
|
29
|
+
WORKSPACE_GID = process.env.WORKSPACE_GID;
|
|
30
|
+
|
|
31
|
+
let client = Asana.ApiClient.instance;
|
|
32
|
+
let token = client.authentications["token"];
|
|
33
|
+
token.accessToken = process.env.PERSONAL_ACCESS_TOKEN;
|
|
34
|
+
tasksApiInstance = new Asana.TasksApi();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("TasksApi", function () {
|
|
38
|
+
describe("createTask", function () {
|
|
39
|
+
it("should have created task", async function () {
|
|
40
|
+
let body = {
|
|
41
|
+
data: {
|
|
42
|
+
assignee: USER_GID,
|
|
43
|
+
name: "Task 1",
|
|
44
|
+
notes: "Some description",
|
|
45
|
+
workspace: WORKSPACE_GID,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
try {
|
|
49
|
+
task = await tasksApiInstance.createTask(body, {});
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw error.response.body;
|
|
52
|
+
}
|
|
53
|
+
expect(task).to.be.ok();
|
|
54
|
+
});
|
|
55
|
+
it("should have a `name`", function () {
|
|
56
|
+
expect(task.data.name).to.be("Task 1");
|
|
57
|
+
});
|
|
58
|
+
it("should have a description/`notes`", function () {
|
|
59
|
+
expect(task.data.notes).to.be("Some description");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe("updateTask", function () {
|
|
63
|
+
it("should have updated task", async function () {
|
|
64
|
+
let body = {
|
|
65
|
+
data: {
|
|
66
|
+
name: "Task 1 - Updated",
|
|
67
|
+
notes: "Updated description",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
task = await tasksApiInstance.updateTask(
|
|
72
|
+
body,
|
|
73
|
+
task.data.gid,
|
|
74
|
+
{}
|
|
75
|
+
);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
throw error.response.body;
|
|
78
|
+
}
|
|
79
|
+
expect(task).to.be.ok();
|
|
80
|
+
});
|
|
81
|
+
it("should have updated task `name`", function () {
|
|
82
|
+
expect(task.data.name).to.be("Task 1 - Updated");
|
|
83
|
+
});
|
|
84
|
+
it("should have updated task description/`notes`", function () {
|
|
85
|
+
expect(task.data.notes).to.be("Updated description");
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe("getTask", function () {
|
|
89
|
+
it("should return task", async function () {
|
|
90
|
+
let response;
|
|
91
|
+
try {
|
|
92
|
+
response = await tasksApiInstance.getTask(
|
|
93
|
+
task.data.gid,
|
|
94
|
+
{}
|
|
95
|
+
);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
throw error.response.body;
|
|
98
|
+
}
|
|
99
|
+
expect(response).to.ok();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
describe("getTask with `opt_fields`", function () {
|
|
103
|
+
describe("task for `html_notes` and `due_on` properties in `opt_fields`", function () {
|
|
104
|
+
it("should return task", async function () {
|
|
105
|
+
let opts = {
|
|
106
|
+
opt_fields: "html_notes,due_on",
|
|
107
|
+
};
|
|
108
|
+
try {
|
|
109
|
+
task = await tasksApiInstance.getTask(
|
|
110
|
+
task.data.gid,
|
|
111
|
+
opts
|
|
112
|
+
);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
throw error.response.body;
|
|
115
|
+
}
|
|
116
|
+
expect(task).to.be.ok();
|
|
117
|
+
});
|
|
118
|
+
it("should have `html_notes`", function () {
|
|
119
|
+
expect(task.data.html_notes).not.to.equal(null);
|
|
120
|
+
});
|
|
121
|
+
it("should have `due_on` with `null` value", function () {
|
|
122
|
+
expect(task.data.due_on).to.be(null);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("getTasks", function () {
|
|
127
|
+
it("should return an array of tasks", async function () {
|
|
128
|
+
let tasksApiInstance = new Asana.TasksApi();
|
|
129
|
+
let opts = {
|
|
130
|
+
limit: 100,
|
|
131
|
+
assignee: USER_GID,
|
|
132
|
+
workspace: WORKSPACE_GID,
|
|
133
|
+
};
|
|
134
|
+
try {
|
|
135
|
+
tasks = await tasksApiInstance.getTasks(opts);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
throw error.response.body;
|
|
138
|
+
}
|
|
139
|
+
expect(tasks).to.be.ok();
|
|
140
|
+
expect(tasks.data).to.be.an("array");
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe("getTasks with `opt_fields`", function () {
|
|
144
|
+
describe("ask for `workspace` and `due_on` properties in `opt_fields`", function () {
|
|
145
|
+
it("should return an array of tasks", async function () {
|
|
146
|
+
let tasksApiInstance = new Asana.TasksApi();
|
|
147
|
+
let opts = {
|
|
148
|
+
assignee: USER_GID,
|
|
149
|
+
workspace: WORKSPACE_GID,
|
|
150
|
+
opt_fields: "workspace,due_on",
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
tasks = await tasksApiInstance.getTasks(opts);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
throw error.response.body;
|
|
157
|
+
}
|
|
158
|
+
expect(tasks).to.be.ok();
|
|
159
|
+
expect(tasks.data).to.be.an("array");
|
|
160
|
+
});
|
|
161
|
+
it("should have `workspace`", function () {
|
|
162
|
+
expect(tasks.data[0].workspace).not.to.equal(null);
|
|
163
|
+
});
|
|
164
|
+
it("should have `due_on`", function () {
|
|
165
|
+
expect("due_on" in tasks.data[0]).to.be(true);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe("getTasks limit 1", function () {
|
|
170
|
+
it("should return an array with 1 task", async function () {
|
|
171
|
+
let tasksApiInstance = new Asana.TasksApi();
|
|
172
|
+
let opts = {
|
|
173
|
+
limit: 1,
|
|
174
|
+
assignee: USER_GID,
|
|
175
|
+
workspace: WORKSPACE_GID,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
tasks = await tasksApiInstance.getTasks(opts);
|
|
180
|
+
} catch (error) {
|
|
181
|
+
throw error.response.body;
|
|
182
|
+
}
|
|
183
|
+
expect(tasks.data.length).to.be(1);
|
|
184
|
+
expect(tasks.data).to.be.an("array");
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
describe("searchTasksForWorkspace", function () {
|
|
188
|
+
it("should return an array of tasks", async function () {
|
|
189
|
+
let opts = {
|
|
190
|
+
text: "Task",
|
|
191
|
+
completed: false,
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
tasks = await tasksApiInstance.searchTasksForWorkspace(
|
|
196
|
+
WORKSPACE_GID,
|
|
197
|
+
opts
|
|
198
|
+
);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
throw error.response.body;
|
|
201
|
+
}
|
|
202
|
+
expect(tasks).to.be.ok();
|
|
203
|
+
expect(tasks.data).to.be.an("array");
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
describe("searchTasksForWorkspace with custom field parameter - MATCH", function () {
|
|
207
|
+
it("should return an array with one task that has matching custom field value from search query", async function () {
|
|
208
|
+
let opts = {
|
|
209
|
+
limit: 1,
|
|
210
|
+
[`custom_fields.${TEXT_CUSTOM_FIELD_GID}.value`]:
|
|
211
|
+
"custom_value",
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
tasks = await tasksApiInstance.searchTasksForWorkspace(
|
|
216
|
+
WORKSPACE_GID,
|
|
217
|
+
opts
|
|
218
|
+
);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
throw error.response.body;
|
|
221
|
+
}
|
|
222
|
+
expect(tasks).to.be.ok();
|
|
223
|
+
expect(tasks.data.length).to.be(1);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
describe("searchTasksForWorkspace with custom field parameter - NO MATCH", function () {
|
|
227
|
+
it("should return an empty array", async function () {
|
|
228
|
+
let opts = {
|
|
229
|
+
[`custom_fields.${TEXT_CUSTOM_FIELD_GID}.value`]:
|
|
230
|
+
"inimw8I23M4FRTPfApu1",
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
try {
|
|
234
|
+
tasks = await tasksApiInstance.searchTasksForWorkspace(
|
|
235
|
+
WORKSPACE_GID,
|
|
236
|
+
opts
|
|
237
|
+
);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
throw error.response.body;
|
|
240
|
+
}
|
|
241
|
+
expect(tasks.data).to.be.empty();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
describe("deleteTask", function () {
|
|
245
|
+
it("should be deleted", async function () {
|
|
246
|
+
let response;
|
|
247
|
+
try {
|
|
248
|
+
// NOTE: In the above tasks we are setting the global task variable in different tests. Make sure
|
|
249
|
+
// that future tests don't overwrite the original task created with another task otherwise
|
|
250
|
+
// that original task won't be deleted
|
|
251
|
+
response = await tasksApiInstance.deleteTask(task.data.gid);
|
|
252
|
+
} catch (error) {
|
|
253
|
+
throw error.response.body;
|
|
254
|
+
}
|
|
255
|
+
expect(response).to.be.ok();
|
|
256
|
+
expect(response.data).to.be.empty();
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
});
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
# {{projectName}} [![GitHub release][release-image]][release-url] [![NPM Version][npm-image]][npm-url]
|
|
2
2
|
|
|
3
|
-
> **Important**
|
|
4
|
-
> Version 3.X.X is the newest release of our Node client library and currently in public beta. This means that while it has the latest Asana features, we're still putting on the final touches to ensure it's as stable and reliable as possible.
|
|
5
|
-
>
|
|
6
|
-
>🛠️ **Looking Ahead**
|
|
7
|
-
>
|
|
8
|
-
> This version will receive updates going forward, and it’s on track to reach full stability soon. Your input is invaluable in this process! If you spot any issues, have suggestions, or need help, don’t hesitate to reach out. You can open a GitHub issue or submit your feedback directly to us.
|
|
9
|
-
>
|
|
10
|
-
>📖 **Get Started with Examples and Resources**
|
|
11
|
-
>
|
|
12
|
-
> For now, if you’re in search of a version that has stood the test of time and is proven to be stable, we recommend using version 1.0.2. You can easily install it using: `npm install asana@1.0.2` and following v1 samples and documentation.
|
|
13
|
-
|
|
14
3
|
- API version: {{appVersion}}
|
|
15
4
|
- Package version: {{projectVersion}}
|
|
16
5
|
{{^hideGenerationTimestamp}}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"type": "git"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"test": "mocha --require @babel/register --recursive"
|
|
12
|
+
"test": "mocha --require @babel/register --recursive",
|
|
13
|
+
"testbuild": "mocha --timeout 20000 --require @babel/register --recursive 'build-tests/api/*.js'"
|
|
13
14
|
},
|
|
14
15
|
"browser": {
|
|
15
16
|
"fs": false
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"@babel/plugin-syntax-import-meta": "^7.0.0",
|
|
39
40
|
"@babel/preset-env": "^7.0.0",
|
|
40
41
|
"@babel/register": "^7.0.0",
|
|
42
|
+
"dotenv": "^16.4.1",
|
|
41
43
|
"expect.js": "^0.3.1",
|
|
42
44
|
"mocha": "^8.0.1",
|
|
43
45
|
"sinon": "^7.2.0"
|
package/dist/ApiClient.js
CHANGED
|
@@ -28,7 +28,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
28
28
|
*/
|
|
29
29
|
/**
|
|
30
30
|
* @module ApiClient
|
|
31
|
-
* @version 3.0.
|
|
31
|
+
* @version 3.0.2
|
|
32
32
|
*/
|
|
33
33
|
/**
|
|
34
34
|
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
|
@@ -400,14 +400,14 @@ var ApiClient = exports.ApiClient = /*#__PURE__*/function () {
|
|
|
400
400
|
// set header parameters
|
|
401
401
|
if (typeof navigator === 'undefined' || typeof window === 'undefined') {
|
|
402
402
|
headerParams['X-Asana-Client-Lib'] = new URLSearchParams({
|
|
403
|
-
'version': "3.0.
|
|
403
|
+
'version': "3.0.2",
|
|
404
404
|
'language': 'NodeJS',
|
|
405
405
|
'language_version': process.version,
|
|
406
406
|
'os': process.platform
|
|
407
407
|
}).toString();
|
|
408
408
|
} else {
|
|
409
409
|
headerParams['X-Asana-Client-Lib'] = new URLSearchParams({
|
|
410
|
-
'version': "3.0.
|
|
410
|
+
'version': "3.0.2",
|
|
411
411
|
'language': 'BrowserJS'
|
|
412
412
|
}).toString();
|
|
413
413
|
}
|
package/dist/api/BatchAPIApi.js
CHANGED
|
@@ -29,7 +29,7 @@ var Collection = require('../utils/collection');
|
|
|
29
29
|
/**
|
|
30
30
|
* CustomFieldSettings service.
|
|
31
31
|
* @module api/CustomFieldSettingsApi
|
|
32
|
-
* @version 3.0.
|
|
32
|
+
* @version 3.0.2
|
|
33
33
|
*/
|
|
34
34
|
var CustomFieldSettingsApi = exports.CustomFieldSettingsApi = /*#__PURE__*/function () {
|
|
35
35
|
/**
|
package/dist/api/EventsApi.js
CHANGED
|
@@ -29,7 +29,7 @@ var Collection = require('../utils/collection');
|
|
|
29
29
|
/**
|
|
30
30
|
* GoalRelationships service.
|
|
31
31
|
* @module api/GoalRelationshipsApi
|
|
32
|
-
* @version 3.0.
|
|
32
|
+
* @version 3.0.2
|
|
33
33
|
*/
|
|
34
34
|
var GoalRelationshipsApi = exports.GoalRelationshipsApi = /*#__PURE__*/function () {
|
|
35
35
|
/**
|
package/dist/api/GoalsApi.js
CHANGED
package/dist/api/JobsApi.js
CHANGED
|
@@ -29,7 +29,7 @@ var Collection = require('../utils/collection');
|
|
|
29
29
|
/**
|
|
30
30
|
* OrganizationExports service.
|
|
31
31
|
* @module api/OrganizationExportsApi
|
|
32
|
-
* @version 3.0.
|
|
32
|
+
* @version 3.0.2
|
|
33
33
|
*/
|
|
34
34
|
var OrganizationExportsApi = exports.OrganizationExportsApi = /*#__PURE__*/function () {
|
|
35
35
|
/**
|