@doist/todoist-api-typescript 5.1.1 → 5.2.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 +16 -0
- package/dist/TodoistApi.js +61 -18
- package/dist/authentication.js +7 -8
- package/dist/consts/endpoints.d.ts +2 -0
- package/dist/consts/endpoints.js +5 -3
- package/dist/restClient.js +5 -6
- package/dist/testUtils/asserts.js +1 -2
- package/dist/testUtils/mocks.d.ts +0 -1
- package/dist/testUtils/mocks.js +18 -9
- package/dist/testUtils/testDefaults.d.ts +25 -25
- package/dist/types/entities.d.ts +96 -685
- package/dist/types/errors.d.ts +2 -2
- package/dist/utils/colors.d.ts +141 -1
- package/dist/utils/colors.js +4 -4
- package/dist/utils/processing-helpers.js +1 -2
- package/dist/utils/sanitization.js +2 -3
- package/dist/utils/urlHelpers.js +2 -3
- package/dist/utils/validators.js +14 -15
- package/package.json +15 -15
package/dist/types/errors.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CustomError } from 'ts-custom-error';
|
|
|
2
2
|
export declare class TodoistRequestError extends CustomError {
|
|
3
3
|
message: string;
|
|
4
4
|
httpStatusCode?: number | undefined;
|
|
5
|
-
responseData?: unknown;
|
|
6
|
-
constructor(message: string, httpStatusCode?: number | undefined, responseData?: unknown);
|
|
5
|
+
responseData?: unknown | undefined;
|
|
6
|
+
constructor(message: string, httpStatusCode?: number | undefined, responseData?: unknown | undefined);
|
|
7
7
|
isAuthenticationError: () => boolean;
|
|
8
8
|
}
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -19,7 +19,147 @@ export declare const salmon: Color;
|
|
|
19
19
|
export declare const charcoal: Color;
|
|
20
20
|
export declare const gray: Color;
|
|
21
21
|
export declare const taupe: Color;
|
|
22
|
-
export declare const colors: readonly [
|
|
22
|
+
export declare const colors: readonly [{
|
|
23
|
+
id: number;
|
|
24
|
+
key: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
name: string;
|
|
27
|
+
hexValue: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}, {
|
|
30
|
+
id: number;
|
|
31
|
+
key: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
name: string;
|
|
34
|
+
hexValue: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}, {
|
|
37
|
+
id: number;
|
|
38
|
+
key: string;
|
|
39
|
+
displayName: string;
|
|
40
|
+
name: string;
|
|
41
|
+
hexValue: string;
|
|
42
|
+
value: string;
|
|
43
|
+
}, {
|
|
44
|
+
id: number;
|
|
45
|
+
key: string;
|
|
46
|
+
displayName: string;
|
|
47
|
+
name: string;
|
|
48
|
+
hexValue: string;
|
|
49
|
+
value: string;
|
|
50
|
+
}, {
|
|
51
|
+
id: number;
|
|
52
|
+
key: string;
|
|
53
|
+
displayName: string;
|
|
54
|
+
name: string;
|
|
55
|
+
hexValue: string;
|
|
56
|
+
value: string;
|
|
57
|
+
}, {
|
|
58
|
+
id: number;
|
|
59
|
+
key: string;
|
|
60
|
+
displayName: string;
|
|
61
|
+
name: string;
|
|
62
|
+
hexValue: string;
|
|
63
|
+
value: string;
|
|
64
|
+
}, {
|
|
65
|
+
id: number;
|
|
66
|
+
key: string;
|
|
67
|
+
displayName: string;
|
|
68
|
+
name: string;
|
|
69
|
+
hexValue: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}, {
|
|
72
|
+
id: number;
|
|
73
|
+
key: string;
|
|
74
|
+
displayName: string;
|
|
75
|
+
name: string;
|
|
76
|
+
hexValue: string;
|
|
77
|
+
value: string;
|
|
78
|
+
}, {
|
|
79
|
+
id: number;
|
|
80
|
+
key: string;
|
|
81
|
+
displayName: string;
|
|
82
|
+
name: string;
|
|
83
|
+
hexValue: string;
|
|
84
|
+
value: string;
|
|
85
|
+
}, {
|
|
86
|
+
id: number;
|
|
87
|
+
key: string;
|
|
88
|
+
displayName: string;
|
|
89
|
+
name: string;
|
|
90
|
+
hexValue: string;
|
|
91
|
+
value: string;
|
|
92
|
+
}, {
|
|
93
|
+
id: number;
|
|
94
|
+
key: string;
|
|
95
|
+
displayName: string;
|
|
96
|
+
name: string;
|
|
97
|
+
hexValue: string;
|
|
98
|
+
value: string;
|
|
99
|
+
}, {
|
|
100
|
+
id: number;
|
|
101
|
+
key: string;
|
|
102
|
+
displayName: string;
|
|
103
|
+
name: string;
|
|
104
|
+
hexValue: string;
|
|
105
|
+
value: string;
|
|
106
|
+
}, {
|
|
107
|
+
id: number;
|
|
108
|
+
key: string;
|
|
109
|
+
displayName: string;
|
|
110
|
+
name: string;
|
|
111
|
+
hexValue: string;
|
|
112
|
+
value: string;
|
|
113
|
+
}, {
|
|
114
|
+
id: number;
|
|
115
|
+
key: string;
|
|
116
|
+
displayName: string;
|
|
117
|
+
name: string;
|
|
118
|
+
hexValue: string;
|
|
119
|
+
value: string;
|
|
120
|
+
}, {
|
|
121
|
+
id: number;
|
|
122
|
+
key: string;
|
|
123
|
+
displayName: string;
|
|
124
|
+
name: string;
|
|
125
|
+
hexValue: string;
|
|
126
|
+
value: string;
|
|
127
|
+
}, {
|
|
128
|
+
id: number;
|
|
129
|
+
key: string;
|
|
130
|
+
displayName: string;
|
|
131
|
+
name: string;
|
|
132
|
+
hexValue: string;
|
|
133
|
+
value: string;
|
|
134
|
+
}, {
|
|
135
|
+
id: number;
|
|
136
|
+
key: string;
|
|
137
|
+
displayName: string;
|
|
138
|
+
name: string;
|
|
139
|
+
hexValue: string;
|
|
140
|
+
value: string;
|
|
141
|
+
}, {
|
|
142
|
+
id: number;
|
|
143
|
+
key: string;
|
|
144
|
+
displayName: string;
|
|
145
|
+
name: string;
|
|
146
|
+
hexValue: string;
|
|
147
|
+
value: string;
|
|
148
|
+
}, {
|
|
149
|
+
id: number;
|
|
150
|
+
key: string;
|
|
151
|
+
displayName: string;
|
|
152
|
+
name: string;
|
|
153
|
+
hexValue: string;
|
|
154
|
+
value: string;
|
|
155
|
+
}, {
|
|
156
|
+
id: number;
|
|
157
|
+
key: string;
|
|
158
|
+
displayName: string;
|
|
159
|
+
name: string;
|
|
160
|
+
hexValue: string;
|
|
161
|
+
value: string;
|
|
162
|
+
}];
|
|
23
163
|
export declare const defaultColor: Color;
|
|
24
164
|
/**
|
|
25
165
|
* @private
|
package/dist/utils/colors.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.defaultColor = 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
|
+
exports.getColorById = getColorById;
|
|
5
|
+
exports.getColorByName = getColorByName;
|
|
6
|
+
exports.getColorByKey = getColorByKey;
|
|
4
7
|
exports.berryRed = {
|
|
5
8
|
id: 30,
|
|
6
9
|
key: 'berry_red',
|
|
@@ -192,7 +195,6 @@ function getColorById(colorId) {
|
|
|
192
195
|
var color = exports.colors.find(function (color) { return color.id === colorId; });
|
|
193
196
|
return color !== null && color !== void 0 ? color : exports.defaultColor;
|
|
194
197
|
}
|
|
195
|
-
exports.getColorById = getColorById;
|
|
196
198
|
/**
|
|
197
199
|
* @private
|
|
198
200
|
* @deprecated Use {@link getColorByKey} instead
|
|
@@ -201,7 +203,6 @@ function getColorByName(colorName) {
|
|
|
201
203
|
var color = exports.colors.find(function (color) { return color.name === colorName; });
|
|
202
204
|
return color !== null && color !== void 0 ? color : exports.defaultColor;
|
|
203
205
|
}
|
|
204
|
-
exports.getColorByName = getColorByName;
|
|
205
206
|
/**
|
|
206
207
|
* Retrieves a {@link Color} object by its key identifier.
|
|
207
208
|
*
|
|
@@ -218,4 +219,3 @@ function getColorByKey(colorKey) {
|
|
|
218
219
|
var color = exports.colors.find(function (color) { return color.key === colorKey; });
|
|
219
220
|
return color !== null && color !== void 0 ? color : exports.defaultColor;
|
|
220
221
|
}
|
|
221
|
-
exports.getColorByKey = getColorByKey;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.customCamelCase =
|
|
6
|
+
exports.customCamelCase = customCamelCase;
|
|
7
7
|
var camelcase_1 = __importDefault(require("camelcase"));
|
|
8
8
|
var emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
9
9
|
function isEmojiKey(key) {
|
|
@@ -16,4 +16,3 @@ function customCamelCase(input) {
|
|
|
16
16
|
return input;
|
|
17
17
|
return (0, camelcase_1.default)(input);
|
|
18
18
|
}
|
|
19
|
-
exports.customCamelCase = customCamelCase;
|
|
@@ -11,7 +11,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.getSanitizedContent = getSanitizedContent;
|
|
15
|
+
exports.getSanitizedTasks = getSanitizedTasks;
|
|
15
16
|
var BOLD_FORMAT = /(^|[\s!?,;>:]+)(?:\*\*|__|!!)(.+?)(\*\*|__|!!)(?=$|[\s!?,;><:]+)/gi;
|
|
16
17
|
var ITALIC_FORMAT = /(^|[\s!?,;>:]+)(?:\*|_|!)(.+?)(\*|_|!)(?=$|[\s!?,;><:]+)/gi;
|
|
17
18
|
var BOLD_ITALIC_FORMAT = /(^|[\s!?,;>:]+)(?:\*\*\*|___|!!!)(.+?)(\*\*\*|___|!!!)(?=$|[\s!?,;><:]+)/gi;
|
|
@@ -108,7 +109,6 @@ function getSanitizedContent(input) {
|
|
|
108
109
|
input = removeAppLinks(input);
|
|
109
110
|
return input;
|
|
110
111
|
}
|
|
111
|
-
exports.getSanitizedContent = getSanitizedContent;
|
|
112
112
|
/**
|
|
113
113
|
* Takes an array of tasks and returns a new array with sanitized content
|
|
114
114
|
* added as 'sanitizedContent' property to each task.
|
|
@@ -125,4 +125,3 @@ exports.getSanitizedContent = getSanitizedContent;
|
|
|
125
125
|
function getSanitizedTasks(tasks) {
|
|
126
126
|
return tasks.map(function (task) { return (__assign(__assign({}, task), { sanitizedContent: getSanitizedContent(task.content) })); });
|
|
127
127
|
}
|
|
128
|
-
exports.getSanitizedTasks = getSanitizedTasks;
|
package/dist/utils/urlHelpers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getTaskUrl = getTaskUrl;
|
|
4
|
+
exports.getProjectUrl = getProjectUrl;
|
|
4
5
|
var endpoints_1 = require("../consts/endpoints");
|
|
5
6
|
/**
|
|
6
7
|
* Generate the URL for a given task.
|
|
@@ -14,7 +15,6 @@ function getTaskUrl(taskId, content) {
|
|
|
14
15
|
var path = slug ? "".concat(slug, "-").concat(taskId) : taskId;
|
|
15
16
|
return "".concat(endpoints_1.TODOIST_WEB_URI, "/task/").concat(path);
|
|
16
17
|
}
|
|
17
|
-
exports.getTaskUrl = getTaskUrl;
|
|
18
18
|
/**
|
|
19
19
|
* Generate the URL for a given project.
|
|
20
20
|
*
|
|
@@ -27,7 +27,6 @@ function getProjectUrl(projectId, name) {
|
|
|
27
27
|
var path = slug ? "".concat(slug, "-").concat(projectId) : projectId;
|
|
28
28
|
return "".concat(endpoints_1.TODOIST_WEB_URI, "/project/").concat(path);
|
|
29
29
|
}
|
|
30
|
-
exports.getProjectUrl = getProjectUrl;
|
|
31
30
|
/**
|
|
32
31
|
* Slugify function borrowed from Django.
|
|
33
32
|
*
|
package/dist/utils/validators.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateTask = validateTask;
|
|
4
|
+
exports.validateTaskArray = validateTaskArray;
|
|
5
|
+
exports.isWorkspaceProject = isWorkspaceProject;
|
|
6
|
+
exports.isPersonalProject = isPersonalProject;
|
|
7
|
+
exports.validateProject = validateProject;
|
|
8
|
+
exports.validateProjectArray = validateProjectArray;
|
|
9
|
+
exports.validateSection = validateSection;
|
|
10
|
+
exports.validateSectionArray = validateSectionArray;
|
|
11
|
+
exports.validateLabel = validateLabel;
|
|
12
|
+
exports.validateLabelArray = validateLabelArray;
|
|
13
|
+
exports.validateComment = validateComment;
|
|
14
|
+
exports.validateCommentArray = validateCommentArray;
|
|
15
|
+
exports.validateUser = validateUser;
|
|
16
|
+
exports.validateUserArray = validateUserArray;
|
|
4
17
|
var entities_1 = require("../types/entities");
|
|
5
18
|
function validateTask(input) {
|
|
6
19
|
return entities_1.TaskSchema.parse(input);
|
|
7
20
|
}
|
|
8
|
-
exports.validateTask = validateTask;
|
|
9
21
|
function validateTaskArray(input) {
|
|
10
22
|
return input.map(validateTask);
|
|
11
23
|
}
|
|
12
|
-
exports.validateTaskArray = validateTaskArray;
|
|
13
24
|
/**
|
|
14
25
|
* Type guard to check if a project is a workspace project.
|
|
15
26
|
* @param project The project to check
|
|
@@ -18,7 +29,6 @@ exports.validateTaskArray = validateTaskArray;
|
|
|
18
29
|
function isWorkspaceProject(project) {
|
|
19
30
|
return 'workspaceId' in project;
|
|
20
31
|
}
|
|
21
|
-
exports.isWorkspaceProject = isWorkspaceProject;
|
|
22
32
|
/**
|
|
23
33
|
* Type guard to check if a project is a personal project.
|
|
24
34
|
* @param project The project to check
|
|
@@ -27,7 +37,6 @@ exports.isWorkspaceProject = isWorkspaceProject;
|
|
|
27
37
|
function isPersonalProject(project) {
|
|
28
38
|
return !isWorkspaceProject(project);
|
|
29
39
|
}
|
|
30
|
-
exports.isPersonalProject = isPersonalProject;
|
|
31
40
|
/**
|
|
32
41
|
* Validates and parses a project input.
|
|
33
42
|
* @param input The input to validate
|
|
@@ -39,40 +48,30 @@ function validateProject(input) {
|
|
|
39
48
|
}
|
|
40
49
|
return entities_1.PersonalProjectSchema.parse(input);
|
|
41
50
|
}
|
|
42
|
-
exports.validateProject = validateProject;
|
|
43
51
|
function validateProjectArray(input) {
|
|
44
52
|
return input.map(validateProject);
|
|
45
53
|
}
|
|
46
|
-
exports.validateProjectArray = validateProjectArray;
|
|
47
54
|
function validateSection(input) {
|
|
48
55
|
return entities_1.SectionSchema.parse(input);
|
|
49
56
|
}
|
|
50
|
-
exports.validateSection = validateSection;
|
|
51
57
|
function validateSectionArray(input) {
|
|
52
58
|
return input.map(validateSection);
|
|
53
59
|
}
|
|
54
|
-
exports.validateSectionArray = validateSectionArray;
|
|
55
60
|
function validateLabel(input) {
|
|
56
61
|
return entities_1.LabelSchema.parse(input);
|
|
57
62
|
}
|
|
58
|
-
exports.validateLabel = validateLabel;
|
|
59
63
|
function validateLabelArray(input) {
|
|
60
64
|
return input.map(validateLabel);
|
|
61
65
|
}
|
|
62
|
-
exports.validateLabelArray = validateLabelArray;
|
|
63
66
|
function validateComment(input) {
|
|
64
67
|
return entities_1.CommentSchema.parse(input);
|
|
65
68
|
}
|
|
66
|
-
exports.validateComment = validateComment;
|
|
67
69
|
function validateCommentArray(input) {
|
|
68
70
|
return input.map(validateComment);
|
|
69
71
|
}
|
|
70
|
-
exports.validateCommentArray = validateCommentArray;
|
|
71
72
|
function validateUser(input) {
|
|
72
73
|
return entities_1.UserSchema.parse(input);
|
|
73
74
|
}
|
|
74
|
-
exports.validateUser = validateUser;
|
|
75
75
|
function validateUserArray(input) {
|
|
76
76
|
return input.map(validateUser);
|
|
77
77
|
}
|
|
78
|
-
exports.validateUserArray = validateUserArray;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-api-typescript",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.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",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "^1.0.0",
|
|
28
28
|
"axios-case-converter": "^1.0.0",
|
|
29
|
-
"axios-retry": "^
|
|
29
|
+
"axios-retry": "^4.0.0",
|
|
30
30
|
"camelcase": "6.3.0",
|
|
31
|
-
"emoji-regex": "10.
|
|
31
|
+
"emoji-regex": "10.5.0",
|
|
32
32
|
"ts-custom-error": "^3.2.0",
|
|
33
|
-
"uuid": "^
|
|
34
|
-
"zod": "
|
|
33
|
+
"uuid": "^11.0.0",
|
|
34
|
+
"zod": "4.1.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@doist/eslint-config": "11.1.0",
|
|
38
38
|
"@doist/prettier-config": "4.0.0",
|
|
39
|
-
"@types/jest": "
|
|
40
|
-
"@types/uuid": "
|
|
39
|
+
"@types/jest": "30.0.0",
|
|
40
|
+
"@types/uuid": "10.0.0",
|
|
41
41
|
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
42
42
|
"@typescript-eslint/parser": "6.21.0",
|
|
43
43
|
"eslint": "8.35.0",
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
46
46
|
"eslint-plugin-import": "2.27.5",
|
|
47
47
|
"eslint-plugin-prettier": "5.1.3",
|
|
48
|
-
"husky": "
|
|
49
|
-
"jest": "
|
|
50
|
-
"lint-staged": "
|
|
51
|
-
"npm-run-
|
|
48
|
+
"husky": "9.1.7",
|
|
49
|
+
"jest": "30.1.3",
|
|
50
|
+
"lint-staged": "16.1.6",
|
|
51
|
+
"npm-run-all2": "8.0.4",
|
|
52
52
|
"prettier": "3.3.2",
|
|
53
|
-
"rimraf": "
|
|
54
|
-
"ts-jest": "29.
|
|
55
|
-
"ts-node": "10.9.
|
|
53
|
+
"rimraf": "6.0.1",
|
|
54
|
+
"ts-jest": "29.4.1",
|
|
55
|
+
"ts-node": "10.9.2",
|
|
56
56
|
"type-fest": "^4.12.0",
|
|
57
|
-
"typescript": "5.
|
|
57
|
+
"typescript": "5.9.2"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"type-fest": "^4.12.0"
|