@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/TodoistApi.d.ts
CHANGED
|
@@ -164,6 +164,22 @@ export declare class TodoistApi {
|
|
|
164
164
|
* @returns A promise that resolves to `true` if successful.
|
|
165
165
|
*/
|
|
166
166
|
deleteProject(id: string, requestId?: string): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* Archives a project by its ID.
|
|
169
|
+
*
|
|
170
|
+
* @param id - The unique identifier of the project to archive.
|
|
171
|
+
* @param requestId - Optional custom identifier for the request.
|
|
172
|
+
* @returns A promise that resolves to the updated project.
|
|
173
|
+
*/
|
|
174
|
+
archiveProject(id: string, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
175
|
+
/**
|
|
176
|
+
* Unarchives a project by its ID.
|
|
177
|
+
*
|
|
178
|
+
* @param id - The unique identifier of the project to unarchive.
|
|
179
|
+
* @param requestId - Optional custom identifier for the request.
|
|
180
|
+
* @returns A promise that resolves to the updated project.
|
|
181
|
+
*/
|
|
182
|
+
unarchiveProject(id: string, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
167
183
|
/**
|
|
168
184
|
* Retrieves a list of collaborators for a specific project.
|
|
169
185
|
*
|
package/dist/TodoistApi.js
CHANGED
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -128,10 +128,10 @@ var TodoistApi = /** @class */ (function () {
|
|
|
128
128
|
* @param args - Filter parameters such as project ID, label ID, or due date.
|
|
129
129
|
* @returns A promise that resolves to an array of tasks.
|
|
130
130
|
*/
|
|
131
|
-
TodoistApi.prototype.getTasks = function (
|
|
132
|
-
|
|
133
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
TodoistApi.prototype.getTasks = function () {
|
|
132
|
+
return __awaiter(this, arguments, void 0, function (args) {
|
|
134
133
|
var _a, results, nextCursor;
|
|
134
|
+
if (args === void 0) { args = {}; }
|
|
135
135
|
return __generator(this, function (_b) {
|
|
136
136
|
switch (_b.label) {
|
|
137
137
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args)];
|
|
@@ -282,19 +282,18 @@ var TodoistApi = /** @class */ (function () {
|
|
|
282
282
|
* @returns - A promise that resolves to an array of the updated tasks.
|
|
283
283
|
*/
|
|
284
284
|
TodoistApi.prototype.moveTasks = function (ids, args, requestId) {
|
|
285
|
-
var _a;
|
|
286
285
|
return __awaiter(this, void 0, void 0, function () {
|
|
287
|
-
var
|
|
286
|
+
var commands, syncRequest, response, syncTasks;
|
|
287
|
+
var _a;
|
|
288
288
|
return __generator(this, function (_b) {
|
|
289
289
|
switch (_b.label) {
|
|
290
290
|
case 0:
|
|
291
291
|
if (ids.length > MAX_COMMAND_COUNT) {
|
|
292
292
|
throw new types_1.TodoistRequestError("Maximum number of items is ".concat(MAX_COMMAND_COUNT), 400);
|
|
293
293
|
}
|
|
294
|
-
uuid = (0, uuid_1.v4)();
|
|
295
294
|
commands = ids.map(function (id) { return ({
|
|
296
295
|
type: 'item_move',
|
|
297
|
-
uuid:
|
|
296
|
+
uuid: (0, uuid_1.v4)(),
|
|
298
297
|
args: __assign(__assign(__assign({ id: id }, (args.projectId && { project_id: args.projectId })), (args.sectionId && { section_id: args.sectionId })), (args.parentId && { parent_id: args.parentId })),
|
|
299
298
|
}); });
|
|
300
299
|
syncRequest = {
|
|
@@ -418,10 +417,10 @@ var TodoistApi = /** @class */ (function () {
|
|
|
418
417
|
* @param args - Optional filters for retrieving projects.
|
|
419
418
|
* @returns A promise that resolves to an array of projects.
|
|
420
419
|
*/
|
|
421
|
-
TodoistApi.prototype.getProjects = function (
|
|
422
|
-
|
|
423
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
420
|
+
TodoistApi.prototype.getProjects = function () {
|
|
421
|
+
return __awaiter(this, arguments, void 0, function (args) {
|
|
424
422
|
var _a, results, nextCursor;
|
|
423
|
+
if (args === void 0) { args = {}; }
|
|
425
424
|
return __generator(this, function (_b) {
|
|
426
425
|
switch (_b.label) {
|
|
427
426
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args)];
|
|
@@ -500,6 +499,50 @@ var TodoistApi = /** @class */ (function () {
|
|
|
500
499
|
});
|
|
501
500
|
});
|
|
502
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Archives a project by its ID.
|
|
504
|
+
*
|
|
505
|
+
* @param id - The unique identifier of the project to archive.
|
|
506
|
+
* @param requestId - Optional custom identifier for the request.
|
|
507
|
+
* @returns A promise that resolves to the updated project.
|
|
508
|
+
*/
|
|
509
|
+
TodoistApi.prototype.archiveProject = function (id, requestId) {
|
|
510
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
511
|
+
var response;
|
|
512
|
+
return __generator(this, function (_a) {
|
|
513
|
+
switch (_a.label) {
|
|
514
|
+
case 0:
|
|
515
|
+
zod_1.z.string().parse(id);
|
|
516
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id, endpoints_1.PROJECT_ARCHIVE), this.authToken, undefined, requestId)];
|
|
517
|
+
case 1:
|
|
518
|
+
response = _a.sent();
|
|
519
|
+
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* Unarchives a project by its ID.
|
|
526
|
+
*
|
|
527
|
+
* @param id - The unique identifier of the project to unarchive.
|
|
528
|
+
* @param requestId - Optional custom identifier for the request.
|
|
529
|
+
* @returns A promise that resolves to the updated project.
|
|
530
|
+
*/
|
|
531
|
+
TodoistApi.prototype.unarchiveProject = function (id, requestId) {
|
|
532
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
533
|
+
var response;
|
|
534
|
+
return __generator(this, function (_a) {
|
|
535
|
+
switch (_a.label) {
|
|
536
|
+
case 0:
|
|
537
|
+
zod_1.z.string().parse(id);
|
|
538
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id, endpoints_1.PROJECT_UNARCHIVE), this.authToken, undefined, requestId)];
|
|
539
|
+
case 1:
|
|
540
|
+
response = _a.sent();
|
|
541
|
+
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
};
|
|
503
546
|
/**
|
|
504
547
|
* Retrieves a list of collaborators for a specific project.
|
|
505
548
|
*
|
|
@@ -507,10 +550,10 @@ var TodoistApi = /** @class */ (function () {
|
|
|
507
550
|
* @param args - Optional parameters to filter collaborators.
|
|
508
551
|
* @returns A promise that resolves to an array of collaborators for the project.
|
|
509
552
|
*/
|
|
510
|
-
TodoistApi.prototype.getProjectCollaborators = function (
|
|
511
|
-
|
|
512
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
553
|
+
TodoistApi.prototype.getProjectCollaborators = function (projectId_1) {
|
|
554
|
+
return __awaiter(this, arguments, void 0, function (projectId, args) {
|
|
513
555
|
var _a, results, nextCursor;
|
|
556
|
+
if (args === void 0) { args = {}; }
|
|
514
557
|
return __generator(this, function (_b) {
|
|
515
558
|
switch (_b.label) {
|
|
516
559
|
case 0:
|
|
@@ -661,10 +704,10 @@ var TodoistApi = /** @class */ (function () {
|
|
|
661
704
|
* @param args - Optional filter parameters.
|
|
662
705
|
* @returns A promise that resolves to an array of labels.
|
|
663
706
|
*/
|
|
664
|
-
TodoistApi.prototype.getLabels = function (
|
|
665
|
-
|
|
666
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
707
|
+
TodoistApi.prototype.getLabels = function () {
|
|
708
|
+
return __awaiter(this, arguments, void 0, function (args) {
|
|
667
709
|
var _a, results, nextCursor;
|
|
710
|
+
if (args === void 0) { args = {}; }
|
|
668
711
|
return __generator(this, function (_b) {
|
|
669
712
|
switch (_b.label) {
|
|
670
713
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_LABELS, this.authToken, args)];
|
package/dist/authentication.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.getAuthStateParameter = getAuthStateParameter;
|
|
40
|
+
exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
41
|
+
exports.getAuthToken = getAuthToken;
|
|
42
|
+
exports.revokeAuthToken = revokeAuthToken;
|
|
40
43
|
var restClient_1 = require("./restClient");
|
|
41
44
|
var uuid_1 = require("uuid");
|
|
42
45
|
var types_1 = require("./types");
|
|
@@ -57,7 +60,6 @@ var endpoints_1 = require("./consts/endpoints");
|
|
|
57
60
|
function getAuthStateParameter() {
|
|
58
61
|
return (0, uuid_1.v4)();
|
|
59
62
|
}
|
|
60
|
-
exports.getAuthStateParameter = getAuthStateParameter;
|
|
61
63
|
/**
|
|
62
64
|
* Generates the authorization URL for the OAuth2 flow.
|
|
63
65
|
*
|
|
@@ -81,7 +83,6 @@ function getAuthorizationUrl(clientId, permissions, state, baseUrl) {
|
|
|
81
83
|
var scope = permissions.join(',');
|
|
82
84
|
return "".concat((0, endpoints_1.getAuthBaseUri)(baseUrl)).concat(endpoints_1.ENDPOINT_AUTHORIZATION, "?client_id=").concat(clientId, "&scope=").concat(scope, "&state=").concat(state);
|
|
83
85
|
}
|
|
84
|
-
exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
85
86
|
/**
|
|
86
87
|
* Exchanges an authorization code for an access token.
|
|
87
88
|
*
|
|
@@ -98,9 +99,9 @@ exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
|
98
99
|
* @throws {@link TodoistRequestError} If the token exchange fails
|
|
99
100
|
*/
|
|
100
101
|
function getAuthToken(args, baseUrl) {
|
|
101
|
-
var _a;
|
|
102
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
103
|
var response;
|
|
104
|
+
var _a;
|
|
104
105
|
return __generator(this, function (_b) {
|
|
105
106
|
switch (_b.label) {
|
|
106
107
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', (0, endpoints_1.getAuthBaseUri)(baseUrl), endpoints_1.ENDPOINT_GET_TOKEN, undefined, args)];
|
|
@@ -114,7 +115,6 @@ function getAuthToken(args, baseUrl) {
|
|
|
114
115
|
});
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
|
-
exports.getAuthToken = getAuthToken;
|
|
118
118
|
/**
|
|
119
119
|
* Revokes an access token, making it invalid for future use.
|
|
120
120
|
*
|
|
@@ -143,4 +143,3 @@ function revokeAuthToken(args, baseUrl) {
|
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
exports.revokeAuthToken = revokeAuthToken;
|
|
@@ -17,6 +17,8 @@ export declare const ENDPOINT_REST_COMMENTS = "comments";
|
|
|
17
17
|
export declare const ENDPOINT_REST_TASK_CLOSE = "close";
|
|
18
18
|
export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
|
|
19
19
|
export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
|
|
20
|
+
export declare const PROJECT_ARCHIVE = "archive";
|
|
21
|
+
export declare const PROJECT_UNARCHIVE = "unarchive";
|
|
20
22
|
export declare const ENDPOINT_SYNC_QUICK_ADD: string;
|
|
21
23
|
export declare const ENDPOINT_SYNC = "sync";
|
|
22
24
|
export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
package/dist/consts/endpoints.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.
|
|
3
|
+
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
4
|
+
exports.getSyncBaseUri = getSyncBaseUri;
|
|
5
|
+
exports.getAuthBaseUri = getAuthBaseUri;
|
|
4
6
|
var BASE_URI = 'https://api.todoist.com';
|
|
5
7
|
var TODOIST_URI = 'https://todoist.com';
|
|
6
8
|
exports.TODOIST_WEB_URI = 'https://app.todoist.com/app';
|
|
@@ -13,12 +15,10 @@ function getSyncBaseUri(domainBase) {
|
|
|
13
15
|
if (domainBase === void 0) { domainBase = BASE_URI; }
|
|
14
16
|
return new URL(exports.API_BASE_URI, domainBase).toString();
|
|
15
17
|
}
|
|
16
|
-
exports.getSyncBaseUri = getSyncBaseUri;
|
|
17
18
|
function getAuthBaseUri(domainBase) {
|
|
18
19
|
if (domainBase === void 0) { domainBase = TODOIST_URI; }
|
|
19
20
|
return new URL(API_AUTHORIZATION_BASE_URI, domainBase).toString();
|
|
20
21
|
}
|
|
21
|
-
exports.getAuthBaseUri = getAuthBaseUri;
|
|
22
22
|
exports.ENDPOINT_REST_TASKS = 'tasks';
|
|
23
23
|
exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS + '/filter';
|
|
24
24
|
exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS + '/completed/by_completion_date';
|
|
@@ -33,6 +33,8 @@ exports.ENDPOINT_REST_COMMENTS = 'comments';
|
|
|
33
33
|
exports.ENDPOINT_REST_TASK_CLOSE = 'close';
|
|
34
34
|
exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
|
|
35
35
|
exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
|
|
36
|
+
exports.PROJECT_ARCHIVE = 'archive';
|
|
37
|
+
exports.PROJECT_UNARCHIVE = 'unarchive';
|
|
36
38
|
exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_TASKS + '/quick';
|
|
37
39
|
exports.ENDPOINT_SYNC = 'sync';
|
|
38
40
|
exports.ENDPOINT_AUTHORIZATION = 'authorize';
|
package/dist/restClient.js
CHANGED
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -50,7 +50,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
53
|
+
exports.paramsSerializer = paramsSerializer;
|
|
54
|
+
exports.isSuccess = isSuccess;
|
|
55
|
+
exports.request = request;
|
|
54
56
|
// eslint-disable-next-line import/no-named-as-default
|
|
55
57
|
var axios_1 = __importDefault(require("axios"));
|
|
56
58
|
var axios_case_converter_1 = __importDefault(require("axios-case-converter"));
|
|
@@ -74,7 +76,6 @@ function paramsSerializer(params) {
|
|
|
74
76
|
});
|
|
75
77
|
return qs.toString();
|
|
76
78
|
}
|
|
77
|
-
exports.paramsSerializer = paramsSerializer;
|
|
78
79
|
var defaultHeaders = {
|
|
79
80
|
'Content-Type': 'application/json',
|
|
80
81
|
};
|
|
@@ -122,7 +123,6 @@ function getAxiosClient(baseURL, apiToken, requestId) {
|
|
|
122
123
|
function isSuccess(response) {
|
|
123
124
|
return response.status >= 200 && response.status < 300;
|
|
124
125
|
}
|
|
125
|
-
exports.isSuccess = isSuccess;
|
|
126
126
|
function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId, hasSyncCommands) {
|
|
127
127
|
return __awaiter(this, void 0, void 0, function () {
|
|
128
128
|
var originalStack, axiosClient, _a, error_1;
|
|
@@ -168,4 +168,3 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
|
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
exports.request = request;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertInstance =
|
|
3
|
+
exports.assertInstance = assertInstance;
|
|
4
4
|
// Has to use 'any' to express constructor type
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
6
|
function assertInstance(value, type) {
|
|
@@ -9,4 +9,3 @@ function assertInstance(value, type) {
|
|
|
9
9
|
}
|
|
10
10
|
throw new TypeError("Unexpected type ".concat(typeof value));
|
|
11
11
|
}
|
|
12
|
-
exports.assertInstance = assertInstance;
|
package/dist/testUtils/mocks.js
CHANGED
|
@@ -15,19 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.setupRestClientMock =
|
|
36
|
+
exports.setupRestClientMock = setupRestClientMock;
|
|
27
37
|
var restClient = __importStar(require("../restClient"));
|
|
28
38
|
function setupRestClientMock(responseData, status) {
|
|
29
39
|
if (status === void 0) { status = 200; }
|
|
30
40
|
var response = { status: status, data: responseData };
|
|
31
41
|
return jest.spyOn(restClient, 'request').mockResolvedValue(response);
|
|
32
42
|
}
|
|
33
|
-
exports.setupRestClientMock = setupRestClientMock;
|
|
@@ -23,7 +23,6 @@ export declare const DEFAULT_TASK: Task;
|
|
|
23
23
|
export declare const INVALID_TASK: {
|
|
24
24
|
due: string;
|
|
25
25
|
url: string;
|
|
26
|
-
labels: string[];
|
|
27
26
|
id: string;
|
|
28
27
|
userId: string;
|
|
29
28
|
projectId: string;
|
|
@@ -32,6 +31,7 @@ export declare const INVALID_TASK: {
|
|
|
32
31
|
addedByUid: string | null;
|
|
33
32
|
assignedByUid: string | null;
|
|
34
33
|
responsibleUid: string | null;
|
|
34
|
+
labels: string[];
|
|
35
35
|
deadline: {
|
|
36
36
|
date: string;
|
|
37
37
|
lang: string;
|
|
@@ -59,21 +59,21 @@ export declare const INVALID_PROJECT: {
|
|
|
59
59
|
name: number;
|
|
60
60
|
url: string;
|
|
61
61
|
id: string;
|
|
62
|
-
parentId: string | null;
|
|
63
|
-
isDeleted: boolean;
|
|
64
|
-
updatedAt: string | null;
|
|
65
|
-
childOrder: number;
|
|
66
|
-
description: string;
|
|
67
|
-
isCollapsed: boolean;
|
|
68
62
|
canAssignTasks: boolean;
|
|
63
|
+
childOrder: number;
|
|
69
64
|
color: string;
|
|
70
65
|
createdAt: string | null;
|
|
71
66
|
isArchived: boolean;
|
|
67
|
+
isDeleted: boolean;
|
|
72
68
|
isFavorite: boolean;
|
|
73
69
|
isFrozen: boolean;
|
|
70
|
+
updatedAt: string | null;
|
|
74
71
|
viewStyle: string;
|
|
75
72
|
defaultOrder: number;
|
|
73
|
+
description: string;
|
|
74
|
+
isCollapsed: boolean;
|
|
76
75
|
isShared: boolean;
|
|
76
|
+
parentId: string | null;
|
|
77
77
|
inboxProject: boolean;
|
|
78
78
|
};
|
|
79
79
|
export declare const PROJECT_WITH_OPTIONALS_AS_NULL: PersonalProject;
|
|
@@ -82,22 +82,22 @@ export declare const INVALID_SECTION: {
|
|
|
82
82
|
projectId: undefined;
|
|
83
83
|
id: string;
|
|
84
84
|
userId: string;
|
|
85
|
-
isDeleted: boolean;
|
|
86
85
|
addedAt: string;
|
|
87
86
|
updatedAt: string;
|
|
88
|
-
isCollapsed: boolean;
|
|
89
|
-
isArchived: boolean;
|
|
90
|
-
name: string;
|
|
91
87
|
archivedAt: string | null;
|
|
88
|
+
name: string;
|
|
92
89
|
sectionOrder: number;
|
|
90
|
+
isArchived: boolean;
|
|
91
|
+
isDeleted: boolean;
|
|
92
|
+
isCollapsed: boolean;
|
|
93
93
|
};
|
|
94
94
|
export declare const DEFAULT_LABEL: Label;
|
|
95
95
|
export declare const INVALID_LABEL: {
|
|
96
96
|
isFavorite: string;
|
|
97
97
|
id: string;
|
|
98
|
-
color: string;
|
|
99
|
-
name: string;
|
|
100
98
|
order: number | null;
|
|
99
|
+
name: string;
|
|
100
|
+
color: string;
|
|
101
101
|
};
|
|
102
102
|
export declare const DEFAULT_USER: User;
|
|
103
103
|
export declare const INVALID_USER: {
|
|
@@ -109,7 +109,6 @@ export declare const DEFAULT_ATTACHMENT: Attachment;
|
|
|
109
109
|
export declare const INVALID_ATTACHMENT: {
|
|
110
110
|
uploadState: string;
|
|
111
111
|
resourceType: string;
|
|
112
|
-
url?: string | null | undefined;
|
|
113
112
|
fileName?: string | null | undefined;
|
|
114
113
|
fileSize?: number | null | undefined;
|
|
115
114
|
fileType?: string | null | undefined;
|
|
@@ -118,6 +117,7 @@ export declare const INVALID_ATTACHMENT: {
|
|
|
118
117
|
image?: string | null | undefined;
|
|
119
118
|
imageWidth?: number | null | undefined;
|
|
120
119
|
imageHeight?: number | null | undefined;
|
|
120
|
+
url?: string | null | undefined;
|
|
121
121
|
title?: string | null | undefined;
|
|
122
122
|
};
|
|
123
123
|
export declare const DEFAULT_RAW_COMMENT: RawComment;
|
|
@@ -125,12 +125,10 @@ export declare const DEFAULT_COMMENT: {
|
|
|
125
125
|
taskId: string | undefined;
|
|
126
126
|
itemId: undefined;
|
|
127
127
|
id: string;
|
|
128
|
-
isDeleted: boolean;
|
|
129
128
|
content: string;
|
|
130
129
|
postedAt: string;
|
|
131
130
|
fileAttachment: {
|
|
132
131
|
resourceType: string;
|
|
133
|
-
url?: string | null | undefined;
|
|
134
132
|
fileName?: string | null | undefined;
|
|
135
133
|
fileSize?: number | null | undefined;
|
|
136
134
|
fileType?: string | null | undefined;
|
|
@@ -140,11 +138,13 @@ export declare const DEFAULT_COMMENT: {
|
|
|
140
138
|
image?: string | null | undefined;
|
|
141
139
|
imageWidth?: number | null | undefined;
|
|
142
140
|
imageHeight?: number | null | undefined;
|
|
141
|
+
url?: string | null | undefined;
|
|
143
142
|
title?: string | null | undefined;
|
|
144
143
|
} | null;
|
|
145
144
|
postedUid: string;
|
|
146
145
|
uidsToNotify: string[] | null;
|
|
147
146
|
reactions: Record<string, string[]> | null;
|
|
147
|
+
isDeleted: boolean;
|
|
148
148
|
projectId?: string | undefined;
|
|
149
149
|
};
|
|
150
150
|
export declare const INVALID_COMMENT: {
|
|
@@ -154,7 +154,6 @@ export declare const INVALID_COMMENT: {
|
|
|
154
154
|
postedAt: string;
|
|
155
155
|
fileAttachment: {
|
|
156
156
|
resourceType: string;
|
|
157
|
-
url?: string | null | undefined;
|
|
158
157
|
fileName?: string | null | undefined;
|
|
159
158
|
fileSize?: number | null | undefined;
|
|
160
159
|
fileType?: string | null | undefined;
|
|
@@ -164,25 +163,24 @@ export declare const INVALID_COMMENT: {
|
|
|
164
163
|
image?: string | null | undefined;
|
|
165
164
|
imageWidth?: number | null | undefined;
|
|
166
165
|
imageHeight?: number | null | undefined;
|
|
166
|
+
url?: string | null | undefined;
|
|
167
167
|
title?: string | null | undefined;
|
|
168
168
|
} | null;
|
|
169
169
|
postedUid: string;
|
|
170
170
|
uidsToNotify: string[] | null;
|
|
171
171
|
reactions: Record<string, string[]> | null;
|
|
172
|
-
projectId?: string | undefined;
|
|
173
172
|
itemId?: string | undefined;
|
|
173
|
+
projectId?: string | undefined;
|
|
174
174
|
};
|
|
175
175
|
export declare const RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK: RawComment;
|
|
176
176
|
export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: {
|
|
177
177
|
taskId: string | undefined;
|
|
178
178
|
itemId: undefined;
|
|
179
179
|
id: string;
|
|
180
|
-
isDeleted: boolean;
|
|
181
180
|
content: string;
|
|
182
181
|
postedAt: string;
|
|
183
182
|
fileAttachment: {
|
|
184
183
|
resourceType: string;
|
|
185
|
-
url?: string | null | undefined;
|
|
186
184
|
fileName?: string | null | undefined;
|
|
187
185
|
fileSize?: number | null | undefined;
|
|
188
186
|
fileType?: string | null | undefined;
|
|
@@ -192,11 +190,13 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: {
|
|
|
192
190
|
image?: string | null | undefined;
|
|
193
191
|
imageWidth?: number | null | undefined;
|
|
194
192
|
imageHeight?: number | null | undefined;
|
|
193
|
+
url?: string | null | undefined;
|
|
195
194
|
title?: string | null | undefined;
|
|
196
195
|
} | null;
|
|
197
196
|
postedUid: string;
|
|
198
197
|
uidsToNotify: string[] | null;
|
|
199
198
|
reactions: Record<string, string[]> | null;
|
|
199
|
+
isDeleted: boolean;
|
|
200
200
|
projectId?: string | undefined;
|
|
201
201
|
};
|
|
202
202
|
export declare const RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: RawComment;
|
|
@@ -204,12 +204,10 @@ export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: {
|
|
|
204
204
|
taskId: string | undefined;
|
|
205
205
|
itemId: undefined;
|
|
206
206
|
id: string;
|
|
207
|
-
isDeleted: boolean;
|
|
208
207
|
content: string;
|
|
209
208
|
postedAt: string;
|
|
210
209
|
fileAttachment: {
|
|
211
210
|
resourceType: string;
|
|
212
|
-
url?: string | null | undefined;
|
|
213
211
|
fileName?: string | null | undefined;
|
|
214
212
|
fileSize?: number | null | undefined;
|
|
215
213
|
fileType?: string | null | undefined;
|
|
@@ -219,23 +217,23 @@ export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: {
|
|
|
219
217
|
image?: string | null | undefined;
|
|
220
218
|
imageWidth?: number | null | undefined;
|
|
221
219
|
imageHeight?: number | null | undefined;
|
|
220
|
+
url?: string | null | undefined;
|
|
222
221
|
title?: string | null | undefined;
|
|
223
222
|
} | null;
|
|
224
223
|
postedUid: string;
|
|
225
224
|
uidsToNotify: string[] | null;
|
|
226
225
|
reactions: Record<string, string[]> | null;
|
|
226
|
+
isDeleted: boolean;
|
|
227
227
|
projectId?: string | undefined;
|
|
228
228
|
};
|
|
229
229
|
export declare const RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: RawComment;
|
|
230
230
|
export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
|
|
231
231
|
taskId: undefined;
|
|
232
232
|
id: string;
|
|
233
|
-
isDeleted: boolean;
|
|
234
233
|
content: string;
|
|
235
234
|
postedAt: string;
|
|
236
235
|
fileAttachment: {
|
|
237
236
|
resourceType: string;
|
|
238
|
-
url?: string | null | undefined;
|
|
239
237
|
fileName?: string | null | undefined;
|
|
240
238
|
fileSize?: number | null | undefined;
|
|
241
239
|
fileType?: string | null | undefined;
|
|
@@ -245,11 +243,13 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
|
|
|
245
243
|
image?: string | null | undefined;
|
|
246
244
|
imageWidth?: number | null | undefined;
|
|
247
245
|
imageHeight?: number | null | undefined;
|
|
246
|
+
url?: string | null | undefined;
|
|
248
247
|
title?: string | null | undefined;
|
|
249
248
|
} | null;
|
|
250
249
|
postedUid: string;
|
|
251
250
|
uidsToNotify: string[] | null;
|
|
252
251
|
reactions: Record<string, string[]> | null;
|
|
253
|
-
|
|
252
|
+
isDeleted: boolean;
|
|
254
253
|
itemId?: string | undefined;
|
|
254
|
+
projectId?: string | undefined;
|
|
255
255
|
};
|