@doist/todoist-api-typescript 1.5.0 → 2.0.0
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/dist/TodoistApi.d.ts +27 -7
- package/dist/TodoistApi.js +101 -39
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.js +6 -6
- package/dist/consts/endpoints.d.ts +6 -3
- package/dist/consts/endpoints.js +24 -4
- package/dist/index.js +5 -1
- package/dist/restClient.d.ts +1 -1
- package/dist/restClient.js +10 -12
- package/dist/testUtils/asserts.js +1 -1
- package/dist/testUtils/mocks.js +6 -3
- package/dist/testUtils/testDefaults.d.ts +31 -29
- package/dist/testUtils/testDefaults.js +29 -23
- package/dist/types/entities.d.ts +56 -54
- package/dist/types/entities.js +31 -29
- package/dist/types/index.js +5 -1
- package/dist/types/requests.d.ts +30 -20
- package/dist/utils/colors.d.ts +2 -1
- package/dist/utils/colors.js +8 -3
- package/dist/utils/index.js +5 -1
- package/dist/utils/sanitization.js +1 -1
- package/dist/utils/taskConverters.js +5 -6
- package/package.json +26 -28
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export declare type AddTaskArgs = {
|
|
2
2
|
content: string;
|
|
3
3
|
description?: string;
|
|
4
|
-
projectId?:
|
|
5
|
-
sectionId?:
|
|
6
|
-
parentId?:
|
|
4
|
+
projectId?: string;
|
|
5
|
+
sectionId?: string;
|
|
6
|
+
parentId?: string;
|
|
7
7
|
order?: number;
|
|
8
|
-
|
|
8
|
+
labels?: string[];
|
|
9
9
|
priority?: number;
|
|
10
10
|
dueString?: string;
|
|
11
11
|
dueLang?: string;
|
|
12
12
|
dueDate?: string;
|
|
13
13
|
dueDatetime?: string;
|
|
14
|
-
|
|
14
|
+
assigneeId?: string;
|
|
15
15
|
};
|
|
16
16
|
export declare type QuickAddTaskArgs = {
|
|
17
17
|
text: string;
|
|
@@ -20,9 +20,9 @@ export declare type QuickAddTaskArgs = {
|
|
|
20
20
|
autoReminder?: boolean;
|
|
21
21
|
};
|
|
22
22
|
export declare type GetTasksArgs = {
|
|
23
|
-
projectId?:
|
|
24
|
-
sectionId?:
|
|
25
|
-
|
|
23
|
+
projectId?: string;
|
|
24
|
+
sectionId?: string;
|
|
25
|
+
label?: string;
|
|
26
26
|
filter?: string;
|
|
27
27
|
lang?: string;
|
|
28
28
|
ids?: number[];
|
|
@@ -30,28 +30,31 @@ export declare type GetTasksArgs = {
|
|
|
30
30
|
export declare type UpdateTaskArgs = {
|
|
31
31
|
content?: string;
|
|
32
32
|
description?: string;
|
|
33
|
-
|
|
33
|
+
labels?: string[];
|
|
34
34
|
priority?: number;
|
|
35
35
|
dueString?: string;
|
|
36
36
|
dueLang?: string;
|
|
37
37
|
dueDate?: string;
|
|
38
38
|
dueDatetime?: string;
|
|
39
|
-
|
|
39
|
+
assigneeId?: string;
|
|
40
40
|
};
|
|
41
|
+
export declare type ProjectViewStyle = 'list' | 'board';
|
|
41
42
|
export declare type AddProjectArgs = {
|
|
42
43
|
name: string;
|
|
43
|
-
parentId?:
|
|
44
|
+
parentId?: string;
|
|
44
45
|
color?: number;
|
|
45
|
-
|
|
46
|
+
isFavorite?: boolean;
|
|
47
|
+
viewStyle?: ProjectViewStyle;
|
|
46
48
|
};
|
|
47
49
|
export declare type UpdateProjectArgs = {
|
|
48
50
|
name?: string;
|
|
49
51
|
color?: number;
|
|
50
|
-
|
|
52
|
+
isFavorite?: boolean;
|
|
53
|
+
viewStyle?: ProjectViewStyle;
|
|
51
54
|
};
|
|
52
55
|
export declare type AddSectionArgs = {
|
|
53
56
|
name: string;
|
|
54
|
-
projectId:
|
|
57
|
+
projectId: string;
|
|
55
58
|
order?: number;
|
|
56
59
|
};
|
|
57
60
|
export declare type UpdateSectionArgs = {
|
|
@@ -61,20 +64,20 @@ export declare type AddLabelArgs = {
|
|
|
61
64
|
name: string;
|
|
62
65
|
order?: number;
|
|
63
66
|
color?: number;
|
|
64
|
-
|
|
67
|
+
isFavorite?: boolean;
|
|
65
68
|
};
|
|
66
69
|
export declare type UpdateLabelArgs = {
|
|
67
70
|
name?: string;
|
|
68
71
|
order?: number;
|
|
69
72
|
color?: number;
|
|
70
|
-
|
|
73
|
+
isFavorite?: boolean;
|
|
71
74
|
};
|
|
72
75
|
export declare type GetTaskCommentsArgs = {
|
|
73
|
-
taskId:
|
|
76
|
+
taskId: string;
|
|
74
77
|
projectId?: never;
|
|
75
78
|
};
|
|
76
79
|
export declare type GetProjectCommentsArgs = {
|
|
77
|
-
projectId:
|
|
80
|
+
projectId: string;
|
|
78
81
|
taskId?: never;
|
|
79
82
|
};
|
|
80
83
|
declare type AddCommentArgs = {
|
|
@@ -87,14 +90,21 @@ declare type AddCommentArgs = {
|
|
|
87
90
|
};
|
|
88
91
|
};
|
|
89
92
|
export declare type AddTaskCommentArgs = AddCommentArgs & {
|
|
90
|
-
taskId:
|
|
93
|
+
taskId: string;
|
|
91
94
|
projectId?: never;
|
|
92
95
|
};
|
|
93
96
|
export declare type AddProjectCommentArgs = AddCommentArgs & {
|
|
94
|
-
projectId:
|
|
97
|
+
projectId: string;
|
|
95
98
|
taskId?: never;
|
|
96
99
|
};
|
|
97
100
|
export declare type UpdateCommentArgs = {
|
|
98
101
|
content: string;
|
|
99
102
|
};
|
|
103
|
+
export declare type RenameSharedLabelArgs = {
|
|
104
|
+
name: string;
|
|
105
|
+
newName: string;
|
|
106
|
+
};
|
|
107
|
+
export declare type RemoveSharedLabelArgs = {
|
|
108
|
+
name: string;
|
|
109
|
+
};
|
|
100
110
|
export {};
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export declare const charcoal: Color;
|
|
|
20
20
|
export declare const gray: Color;
|
|
21
21
|
export declare const taupe: Color;
|
|
22
22
|
export declare const colors: Color[];
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function getColorById(colorId: number): Color;
|
|
24
|
+
export declare function getColorByName(colorName: string): Color;
|
package/dist/utils/colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getColorByName = exports.getColorById = exports.colors = exports.taupe = exports.gray = exports.charcoal = exports.salmon = exports.magenta = exports.lavender = exports.violet = exports.grape = exports.blue = exports.lightBlue = exports.skyBlue = exports.turquoise = exports.mintGreen = exports.green = exports.limeGreen = exports.oliveGreen = exports.yellow = exports.orange = exports.red = exports.berryRed = void 0;
|
|
4
4
|
exports.berryRed = { name: 'Berry Red', id: 30, value: '#b8255f' };
|
|
5
5
|
exports.red = { name: 'Red', id: 31, value: '#db4035' };
|
|
6
6
|
exports.orange = { name: 'Orange', id: 32, value: '#ff9933' };
|
|
@@ -43,8 +43,13 @@ exports.colors = [
|
|
|
43
43
|
exports.gray,
|
|
44
44
|
exports.taupe,
|
|
45
45
|
];
|
|
46
|
-
function
|
|
46
|
+
function getColorById(colorId) {
|
|
47
47
|
var color = exports.colors.find(function (color) { return color.id === colorId; });
|
|
48
48
|
return color !== null && color !== void 0 ? color : exports.charcoal;
|
|
49
49
|
}
|
|
50
|
-
exports.
|
|
50
|
+
exports.getColorById = getColorById;
|
|
51
|
+
function getColorByName(colorName) {
|
|
52
|
+
var color = exports.colors.find(function (color) { return color.name === colorName; });
|
|
53
|
+
return color !== null && color !== void 0 ? color : exports.charcoal;
|
|
54
|
+
}
|
|
55
|
+
exports.getColorByName = getColorByName;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -29,7 +29,7 @@ function removeStyleFormatting(input) {
|
|
|
29
29
|
return input;
|
|
30
30
|
}
|
|
31
31
|
function removeMarkdown(match, prefix, text) {
|
|
32
|
-
return ""
|
|
32
|
+
return "".concat(prefix).concat(text);
|
|
33
33
|
}
|
|
34
34
|
input = input.replace(BOLD_ITALIC_FORMAT, removeMarkdown);
|
|
35
35
|
input = input.replace(BOLD_FORMAT, removeMarkdown);
|
|
@@ -14,15 +14,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.getTaskFromQuickAddResponse = void 0;
|
|
15
15
|
var showTaskEndpoint = 'https://todoist.com/showTask';
|
|
16
16
|
function getTaskUrlFromQuickAddResponse(responseData) {
|
|
17
|
-
return responseData.
|
|
18
|
-
? showTaskEndpoint + "?id=" + responseData.id + "&sync_id=" + responseData.syncId
|
|
19
|
-
: showTaskEndpoint + "?id=" + responseData.id;
|
|
17
|
+
return "".concat(showTaskEndpoint, "?id=").concat(responseData.id);
|
|
20
18
|
}
|
|
21
19
|
function getTaskFromQuickAddResponse(responseData) {
|
|
22
|
-
var _a;
|
|
23
20
|
var due = responseData.due
|
|
24
|
-
? __assign(__assign({
|
|
25
|
-
var task = __assign(__assign(__assign({ id: responseData.id, order: responseData.childOrder, content: responseData.content, description: responseData.description, projectId: responseData.projectId, sectionId:
|
|
21
|
+
? __assign(__assign({ isRecurring: responseData.due.isRecurring, string: responseData.due.string, date: responseData.due.date }, (responseData.due.timezone !== null && { datetime: responseData.due.date })), (responseData.due.timezone !== null && { timezone: responseData.due.timezone })) : undefined;
|
|
22
|
+
var task = __assign(__assign(__assign({ id: responseData.id, order: responseData.childOrder, content: responseData.content, description: responseData.description, projectId: responseData.projectId, sectionId: responseData.sectionId ? responseData.sectionId : undefined, isCompleted: responseData.checked === 1, labels: responseData.labels, priority: responseData.priority, commentCount: 0, createdAt: responseData.added_at, url: getTaskUrlFromQuickAddResponse(responseData), creatorId: responseData.added_by_uid ? responseData.added_by_uid : '' }, (due !== undefined && { due: due })), (responseData.parentId !== null && { parentId: responseData.parentId })), (responseData.responsibleUid !== null && {
|
|
23
|
+
assigneeId: responseData.responsibleUid,
|
|
24
|
+
}));
|
|
26
25
|
return task;
|
|
27
26
|
}
|
|
28
27
|
exports.getTaskFromQuickAddResponse = getTaskFromQuickAddResponse;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-api-typescript",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A typescript wrapper for the Todoist REST API.",
|
|
5
5
|
"author": "Doist developers",
|
|
6
6
|
"repository": "git@github.com:doist/todoist-api-typescript.git",
|
|
7
|
+
"homepage": "https://developer.todoist.com/rest/v1/?javascript",
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"main": "dist/index.js",
|
|
9
10
|
"types": "dist/index.d.ts",
|
|
@@ -23,38 +24,35 @@
|
|
|
23
24
|
"prepare": "npm run build"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"axios": "^0.
|
|
27
|
-
"axios-case-converter": "^0.
|
|
27
|
+
"axios": "^0.27.0",
|
|
28
|
+
"axios-case-converter": "^0.9.0",
|
|
28
29
|
"axios-retry": "^3.1.9",
|
|
29
|
-
"runtypes": "^5.
|
|
30
|
+
"runtypes": "^6.5.0",
|
|
30
31
|
"ts-custom-error": "^3.2.0",
|
|
31
|
-
"url-join": "^4.0.1",
|
|
32
32
|
"uuid": "^8.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@doist/eslint-config": "
|
|
36
|
-
"@doist/prettier-config": "
|
|
37
|
-
"@types/axios": "
|
|
38
|
-
"@types/jest": "
|
|
39
|
-
"@types/
|
|
40
|
-
"@
|
|
41
|
-
"@typescript-eslint/
|
|
42
|
-
"
|
|
43
|
-
"eslint": "
|
|
44
|
-
"eslint-
|
|
45
|
-
"eslint-import
|
|
46
|
-
"eslint-plugin-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"ts-node": "^9.1.1",
|
|
57
|
-
"typescript": "^4.4.4"
|
|
35
|
+
"@doist/eslint-config": "7.1.2",
|
|
36
|
+
"@doist/prettier-config": "3.0.5",
|
|
37
|
+
"@types/axios": "0.14.0",
|
|
38
|
+
"@types/jest": "27.5.2",
|
|
39
|
+
"@types/uuid": "8.3.4",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "5.36.1",
|
|
41
|
+
"@typescript-eslint/parser": "5.36.1",
|
|
42
|
+
"eslint": "8.23.0",
|
|
43
|
+
"eslint-config-prettier": "8.5.0",
|
|
44
|
+
"eslint-import-resolver-webpack": "0.13.2",
|
|
45
|
+
"eslint-plugin-import": "2.26.0",
|
|
46
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
47
|
+
"husky": "8.0.1",
|
|
48
|
+
"jest": "28.1.3",
|
|
49
|
+
"lint-staged": "13.0.3",
|
|
50
|
+
"npm-run-all": "4.1.5",
|
|
51
|
+
"prettier": "2.7.1",
|
|
52
|
+
"rimraf": "3.0.2",
|
|
53
|
+
"ts-jest": "28.0.8",
|
|
54
|
+
"ts-node": "10.9.1",
|
|
55
|
+
"typescript": "4.8.2"
|
|
58
56
|
},
|
|
59
57
|
"prettier": "@doist/prettier-config",
|
|
60
58
|
"husky": {
|