@doist/todoist-api-typescript 7.6.0 → 7.7.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/cjs/todoist-api.js +8 -7
- package/dist/cjs/types/activity/index.js +18 -0
- package/dist/cjs/types/activity/requests.js +2 -0
- package/dist/cjs/types/activity/types.js +28 -0
- package/dist/cjs/types/backups/index.js +18 -0
- package/dist/cjs/types/backups/requests.js +2 -0
- package/dist/cjs/types/backups/types.js +8 -0
- package/dist/cjs/types/comments/index.js +18 -0
- package/dist/cjs/types/comments/requests.js +2 -0
- package/dist/cjs/types/comments/types.js +60 -0
- package/dist/cjs/types/common.js +2 -0
- package/dist/cjs/types/emails/index.js +17 -0
- package/dist/cjs/types/emails/requests.js +5 -0
- package/dist/cjs/types/id-mappings/index.js +18 -0
- package/dist/cjs/types/{requests.js → id-mappings/requests.js} +1 -7
- package/dist/cjs/types/id-mappings/types.js +12 -0
- package/dist/cjs/types/index.js +16 -2
- package/dist/cjs/types/insights/index.js +18 -0
- package/dist/cjs/types/insights/requests.js +2 -0
- package/dist/cjs/types/insights/types.js +84 -0
- package/dist/cjs/types/labels/index.js +18 -0
- package/dist/cjs/types/labels/requests.js +2 -0
- package/dist/cjs/types/labels/types.js +11 -0
- package/dist/cjs/types/productivity/index.js +17 -0
- package/dist/cjs/types/productivity/types.js +67 -0
- package/dist/cjs/types/projects/index.js +18 -0
- package/dist/cjs/types/projects/requests.js +2 -0
- package/dist/cjs/types/projects/types.js +56 -0
- package/dist/cjs/types/reminders/index.js +17 -0
- package/dist/cjs/types/reminders/requests.js +5 -0
- package/dist/cjs/types/sections/index.js +18 -0
- package/dist/cjs/types/sections/requests.js +2 -0
- package/dist/cjs/types/sections/types.js +22 -0
- package/dist/cjs/types/sync/commands/shared.js +2 -2
- package/dist/cjs/types/sync/resources/collaborators.js +2 -2
- package/dist/cjs/types/sync/resources/notes.js +2 -2
- package/dist/cjs/types/sync/resources/reminders.js +3 -3
- package/dist/cjs/types/sync/resources/user.js +2 -2
- package/dist/cjs/types/sync/resources/workspaces.js +5 -5
- package/dist/cjs/types/tasks/index.js +18 -0
- package/dist/cjs/types/tasks/requests.js +2 -0
- package/dist/cjs/types/tasks/types.js +59 -0
- package/dist/cjs/types/templates/index.js +17 -0
- package/dist/cjs/types/templates/requests.js +2 -0
- package/dist/cjs/types/uploads/index.js +17 -0
- package/dist/cjs/types/uploads/requests.js +2 -0
- package/dist/cjs/types/users/index.js +17 -0
- package/dist/cjs/types/users/types.js +51 -0
- package/dist/cjs/types/workspaces/index.js +18 -0
- package/dist/cjs/types/workspaces/requests.js +2 -0
- package/dist/cjs/types/workspaces/types.js +137 -0
- package/dist/cjs/utils/validators.js +38 -27
- package/dist/esm/todoist-api.js +4 -3
- package/dist/esm/types/activity/index.js +2 -0
- package/dist/esm/types/activity/requests.js +1 -0
- package/dist/esm/types/activity/types.js +25 -0
- package/dist/esm/types/backups/index.js +2 -0
- package/dist/esm/types/backups/requests.js +1 -0
- package/dist/esm/types/backups/types.js +5 -0
- package/dist/esm/types/comments/index.js +2 -0
- package/dist/esm/types/comments/requests.js +1 -0
- package/dist/esm/types/comments/types.js +57 -0
- package/dist/esm/types/common.js +1 -0
- package/dist/esm/types/emails/index.js +1 -0
- package/dist/esm/types/emails/requests.js +2 -0
- package/dist/esm/types/id-mappings/index.js +2 -0
- package/dist/esm/types/{requests.js → id-mappings/requests.js} +0 -6
- package/dist/esm/types/id-mappings/types.js +9 -0
- package/dist/esm/types/index.js +16 -2
- package/dist/esm/types/insights/index.js +2 -0
- package/dist/esm/types/insights/requests.js +1 -0
- package/dist/esm/types/insights/types.js +81 -0
- package/dist/esm/types/labels/index.js +2 -0
- package/dist/esm/types/labels/requests.js +1 -0
- package/dist/esm/types/labels/types.js +8 -0
- package/dist/esm/types/productivity/index.js +1 -0
- package/dist/esm/types/productivity/types.js +64 -0
- package/dist/esm/types/projects/index.js +2 -0
- package/dist/esm/types/projects/requests.js +1 -0
- package/dist/esm/types/projects/types.js +53 -0
- package/dist/esm/types/reminders/index.js +1 -0
- package/dist/esm/types/reminders/requests.js +2 -0
- package/dist/esm/types/sections/index.js +2 -0
- package/dist/esm/types/sections/requests.js +1 -0
- package/dist/esm/types/sections/types.js +19 -0
- package/dist/esm/types/sync/commands/shared.js +1 -1
- package/dist/esm/types/sync/resources/collaborators.js +1 -1
- package/dist/esm/types/sync/resources/notes.js +1 -1
- package/dist/esm/types/sync/resources/reminders.js +1 -1
- package/dist/esm/types/sync/resources/user.js +1 -1
- package/dist/esm/types/sync/resources/workspaces.js +1 -1
- package/dist/esm/types/tasks/index.js +2 -0
- package/dist/esm/types/tasks/requests.js +1 -0
- package/dist/esm/types/tasks/types.js +56 -0
- package/dist/esm/types/templates/index.js +1 -0
- package/dist/esm/types/templates/requests.js +1 -0
- package/dist/esm/types/uploads/index.js +1 -0
- package/dist/esm/types/uploads/requests.js +1 -0
- package/dist/esm/types/users/index.js +1 -0
- package/dist/esm/types/users/types.js +48 -0
- package/dist/esm/types/workspaces/index.js +2 -0
- package/dist/esm/types/workspaces/requests.js +1 -0
- package/dist/esm/types/workspaces/types.js +134 -0
- package/dist/esm/utils/validators.js +12 -1
- package/dist/types/test-utils/test-defaults.d.ts +5 -5
- package/dist/types/todoist-api.d.ts +16 -2
- package/dist/types/types/activity/index.d.ts +2 -0
- package/dist/types/types/activity/requests.d.ts +85 -0
- package/dist/types/types/activity/types.d.ts +49 -0
- package/dist/types/types/backups/index.d.ts +2 -0
- package/dist/types/types/backups/requests.d.ts +16 -0
- package/dist/types/types/backups/types.d.ts +7 -0
- package/dist/types/types/comments/index.d.ts +2 -0
- package/dist/types/types/comments/requests.d.ts +64 -0
- package/dist/types/types/comments/types.d.ts +141 -0
- package/dist/types/types/common.d.ts +6 -0
- package/dist/types/types/emails/index.d.ts +1 -0
- package/dist/types/types/emails/requests.d.ts +30 -0
- package/dist/types/types/id-mappings/index.d.ts +2 -0
- package/dist/types/types/id-mappings/requests.d.ts +28 -0
- package/dist/types/types/id-mappings/types.d.ts +13 -0
- package/dist/types/types/index.d.ts +16 -2
- package/dist/types/types/insights/index.d.ts +2 -0
- package/dist/types/types/insights/requests.d.ts +26 -0
- package/dist/types/types/insights/types.d.ts +186 -0
- package/dist/types/types/labels/index.d.ts +2 -0
- package/dist/types/types/labels/requests.d.ts +75 -0
- package/dist/types/types/labels/types.d.ts +13 -0
- package/dist/types/types/productivity/index.d.ts +1 -0
- package/dist/types/types/productivity/types.d.ts +115 -0
- package/dist/types/types/projects/index.d.ts +2 -0
- package/dist/types/types/projects/requests.d.ts +169 -0
- package/dist/types/types/projects/types.d.ts +201 -0
- package/dist/types/types/reminders/index.d.ts +1 -0
- package/dist/types/types/reminders/requests.d.ts +91 -0
- package/dist/types/types/sections/index.d.ts +2 -0
- package/dist/types/types/sections/requests.d.ts +41 -0
- package/dist/types/types/sections/types.d.ts +44 -0
- package/dist/types/types/sync/commands/projects.d.ts +2 -1
- package/dist/types/types/sync/commands/shared.d.ts +2 -2
- package/dist/types/types/sync/commands/workspaces.d.ts +1 -1
- package/dist/types/types/sync/resources/notes.d.ts +1 -1
- package/dist/types/types/sync/response.d.ts +5 -1
- package/dist/types/types/tasks/index.d.ts +2 -0
- package/dist/types/types/tasks/requests.d.ts +197 -0
- package/dist/types/types/tasks/types.d.ts +162 -0
- package/dist/types/types/templates/index.d.ts +1 -0
- package/dist/types/types/templates/requests.d.ts +92 -0
- package/dist/types/types/uploads/index.d.ts +1 -0
- package/dist/types/types/uploads/requests.d.ts +32 -0
- package/dist/types/types/users/index.d.ts +1 -0
- package/dist/types/types/users/types.d.ts +66 -0
- package/dist/types/types/workspaces/index.d.ts +2 -0
- package/dist/types/types/workspaces/requests.d.ts +260 -0
- package/dist/types/types/workspaces/types.d.ts +225 -0
- package/dist/types/utils/colors.d.ts +1 -1
- package/dist/types/utils/validators.d.ts +7 -6
- package/package.json +3 -3
- package/dist/cjs/types/entities.js +0 -552
- package/dist/esm/types/entities.js +0 -548
- package/dist/types/types/entities.d.ts +0 -1211
- package/dist/types/types/requests.d.ts +0 -1188
package/dist/esm/todoist-api.js
CHANGED
|
@@ -9,9 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { DueDateSchema, } from './types/
|
|
12
|
+
import { DueDateSchema, } from './types/tasks/index.js';
|
|
13
|
+
import { REMINDER_DELIVERY_SERVICES, } from './types/reminders/index.js';
|
|
13
14
|
import { LOCATION_TRIGGERS } from './types/sync/resources/reminders.js';
|
|
14
|
-
import { REMINDER_DELIVERY_SERVICES, } from './types/requests.js';
|
|
15
15
|
import { request, isSuccess } from './transport/http-client.js';
|
|
16
16
|
import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, } from './consts/endpoints.js';
|
|
17
17
|
import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, } from './utils/validators.js';
|
|
@@ -1337,13 +1337,14 @@ export class TodoistApi {
|
|
|
1337
1337
|
* @returns A promise that resolves to the created comment.
|
|
1338
1338
|
*/
|
|
1339
1339
|
async addComment(args, requestId) {
|
|
1340
|
+
const { uidsToNotify } = args, rest = __rest(args, ["uidsToNotify"]);
|
|
1340
1341
|
const response = await request({
|
|
1341
1342
|
httpMethod: 'POST',
|
|
1342
1343
|
baseUri: this.syncApiBase,
|
|
1343
1344
|
relativePath: ENDPOINT_REST_COMMENTS,
|
|
1344
1345
|
apiToken: this.authToken,
|
|
1345
1346
|
customFetch: this.customFetch,
|
|
1346
|
-
payload:
|
|
1347
|
+
payload: Object.assign(Object.assign({}, rest), (uidsToNotify ? { uidsToNotify: uidsToNotify.join(',') } : {})),
|
|
1347
1348
|
requestId: requestId,
|
|
1348
1349
|
});
|
|
1349
1350
|
return validateComment(response.data);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Flexible object containing event-specific data.
|
|
4
|
+
* Uses z.record to accept any properties for forward compatibility.
|
|
5
|
+
*/
|
|
6
|
+
export const ActivityEventExtraDataSchema = z.record(z.string(), z.any()).nullable();
|
|
7
|
+
/**
|
|
8
|
+
* Activity log event schema. Accepts unknown fields for forward compatibility.
|
|
9
|
+
*/
|
|
10
|
+
export const ActivityEventSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
objectType: z.string(),
|
|
13
|
+
objectId: z.string(),
|
|
14
|
+
eventType: z.string(),
|
|
15
|
+
eventDate: z.string(),
|
|
16
|
+
id: z
|
|
17
|
+
.union([z.string(), z.number()])
|
|
18
|
+
.transform((val) => { var _a; return (_a = val === null || val === void 0 ? void 0 : val.toString()) !== null && _a !== void 0 ? _a : null; })
|
|
19
|
+
.nullable(),
|
|
20
|
+
parentProjectId: z.string().nullable(),
|
|
21
|
+
parentItemId: z.string().nullable(),
|
|
22
|
+
initiatorId: z.string().nullable(),
|
|
23
|
+
extraData: ActivityEventExtraDataSchema,
|
|
24
|
+
})
|
|
25
|
+
.catchall(z.any());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
/** Available file attachment upload states. */
|
|
14
|
+
export const UPLOAD_STATES = ['pending', 'completed'];
|
|
15
|
+
export const AttachmentSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
resourceType: z.string(),
|
|
18
|
+
})
|
|
19
|
+
.extend({
|
|
20
|
+
fileName: z.string().nullable().optional(),
|
|
21
|
+
fileSize: z.number().int().nullable().optional(),
|
|
22
|
+
fileType: z.string().nullable().optional(),
|
|
23
|
+
fileUrl: z.string().nullable().optional(),
|
|
24
|
+
fileDuration: z.number().int().nullable().optional(),
|
|
25
|
+
uploadState: z.enum(UPLOAD_STATES).nullable().optional(),
|
|
26
|
+
image: z.string().nullable().optional(),
|
|
27
|
+
imageWidth: z.number().int().nullable().optional(),
|
|
28
|
+
imageHeight: z.number().int().nullable().optional(),
|
|
29
|
+
url: z.string().nullable().optional(),
|
|
30
|
+
title: z.string().nullable().optional(),
|
|
31
|
+
});
|
|
32
|
+
export const RawCommentSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
itemId: z.string().optional(),
|
|
36
|
+
projectId: z.string().optional(),
|
|
37
|
+
content: z.string(),
|
|
38
|
+
postedAt: z.string(),
|
|
39
|
+
fileAttachment: AttachmentSchema.nullable(),
|
|
40
|
+
postedUid: z.string(),
|
|
41
|
+
uidsToNotify: z.array(z.string()).nullable(),
|
|
42
|
+
reactions: z.record(z.string(), z.array(z.string())).nullable(),
|
|
43
|
+
isDeleted: z.boolean(),
|
|
44
|
+
})
|
|
45
|
+
.refine((data) => {
|
|
46
|
+
// At least one of itemId or projectId must be present
|
|
47
|
+
return ((data.itemId !== undefined && data.projectId === undefined) ||
|
|
48
|
+
(data.itemId === undefined && data.projectId !== undefined));
|
|
49
|
+
}, {
|
|
50
|
+
message: 'Exactly one of itemId or projectId must be provided',
|
|
51
|
+
});
|
|
52
|
+
export const CommentSchema = RawCommentSchema.transform((data) => {
|
|
53
|
+
const { itemId } = data, rest = __rest(data, ["itemId"]);
|
|
54
|
+
return Object.assign(Object.assign({}, rest), {
|
|
55
|
+
// Map itemId to taskId for backwards compatibility
|
|
56
|
+
taskId: itemId });
|
|
57
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/** Available reminder delivery services. */
|
|
2
|
-
export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
|
|
3
|
-
// Email forwarding types
|
|
4
|
-
/** Object types that support email forwarding. */
|
|
5
|
-
export const EMAIL_OBJECT_TYPES = ['project', 'project_comments', 'task'];
|
|
6
|
-
// ID mapping types
|
|
7
1
|
/** Object types that support ID mappings. */
|
|
8
2
|
export const ID_MAPPING_OBJECT_TYPES = [
|
|
9
3
|
'sections',
|
package/dist/esm/types/index.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './tasks/index.js';
|
|
2
|
+
export * from './projects/index.js';
|
|
3
|
+
export * from './sections/index.js';
|
|
4
|
+
export * from './labels/index.js';
|
|
5
|
+
export * from './comments/index.js';
|
|
6
|
+
export * from './reminders/index.js';
|
|
7
|
+
export * from './users/index.js';
|
|
8
|
+
export * from './productivity/index.js';
|
|
9
|
+
export * from './activity/index.js';
|
|
10
|
+
export * from './workspaces/index.js';
|
|
11
|
+
export * from './insights/index.js';
|
|
12
|
+
export * from './backups/index.js';
|
|
13
|
+
export * from './id-mappings/index.js';
|
|
14
|
+
export * from './emails/index.js';
|
|
15
|
+
export * from './uploads/index.js';
|
|
16
|
+
export * from './templates/index.js';
|
|
2
17
|
export * from './errors.js';
|
|
3
|
-
export * from './requests.js';
|
|
4
18
|
export * from './http.js';
|
|
5
19
|
export * from './sync/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const DayActivitySchema = z.object({
|
|
3
|
+
date: z.string(),
|
|
4
|
+
totalCount: z.number().int(),
|
|
5
|
+
});
|
|
6
|
+
export const WeekRollupSchema = z.object({
|
|
7
|
+
fromDate: z.string(),
|
|
8
|
+
toDate: z.string(),
|
|
9
|
+
totalCount: z.number().int(),
|
|
10
|
+
});
|
|
11
|
+
export const ProjectActivityStatsSchema = z.object({
|
|
12
|
+
dayItems: z.array(DayActivitySchema),
|
|
13
|
+
weekItems: z.array(WeekRollupSchema).nullable(),
|
|
14
|
+
});
|
|
15
|
+
/** Available project health statuses. */
|
|
16
|
+
export const HEALTH_STATUSES = [
|
|
17
|
+
'UNKNOWN',
|
|
18
|
+
'ON_TRACK',
|
|
19
|
+
'AT_RISK',
|
|
20
|
+
'CRITICAL',
|
|
21
|
+
'EXCELLENT',
|
|
22
|
+
'ERROR',
|
|
23
|
+
];
|
|
24
|
+
export const TaskRecommendationSchema = z.object({
|
|
25
|
+
taskId: z.string(),
|
|
26
|
+
recommendation: z.string(),
|
|
27
|
+
});
|
|
28
|
+
export const ProjectHealthSchema = z.object({
|
|
29
|
+
status: z.enum(HEALTH_STATUSES),
|
|
30
|
+
description: z.string().nullable().optional(),
|
|
31
|
+
descriptionSummary: z.string().nullable().optional(),
|
|
32
|
+
taskRecommendations: z.array(TaskRecommendationSchema).nullable().optional(),
|
|
33
|
+
projectId: z.string().nullable().optional(),
|
|
34
|
+
updatedAt: z.string().nullable().optional(),
|
|
35
|
+
isStale: z.boolean().default(false),
|
|
36
|
+
updateInProgress: z.boolean().default(false),
|
|
37
|
+
});
|
|
38
|
+
export const ProjectMetricsSchema = z.object({
|
|
39
|
+
totalTasks: z.number().int(),
|
|
40
|
+
completedTasks: z.number().int(),
|
|
41
|
+
overdueTasks: z.number().int(),
|
|
42
|
+
tasksCreatedThisWeek: z.number().int(),
|
|
43
|
+
tasksCompletedThisWeek: z.number().int(),
|
|
44
|
+
averageCompletionTime: z.number().nullable(),
|
|
45
|
+
});
|
|
46
|
+
export const TaskContextSchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
content: z.string(),
|
|
49
|
+
due: z.string().nullable().optional(),
|
|
50
|
+
deadline: z.string().nullable().optional(),
|
|
51
|
+
priority: z.string(),
|
|
52
|
+
isCompleted: z.boolean(),
|
|
53
|
+
createdAt: z.string(),
|
|
54
|
+
updatedAt: z.string(),
|
|
55
|
+
completedAt: z.string().nullable(),
|
|
56
|
+
completedByUid: z.string().nullable(),
|
|
57
|
+
labels: z.array(z.string()),
|
|
58
|
+
});
|
|
59
|
+
export const ProjectHealthContextSchema = z.object({
|
|
60
|
+
projectId: z.string(),
|
|
61
|
+
projectName: z.string(),
|
|
62
|
+
projectDescription: z.string().nullable(),
|
|
63
|
+
projectMetrics: ProjectMetricsSchema,
|
|
64
|
+
tasks: z.array(TaskContextSchema),
|
|
65
|
+
language: z.string().nullable().optional(),
|
|
66
|
+
});
|
|
67
|
+
export const ProjectProgressSchema = z.object({
|
|
68
|
+
projectId: z.string(),
|
|
69
|
+
completedCount: z.number().int(),
|
|
70
|
+
activeCount: z.number().int(),
|
|
71
|
+
progressPercent: z.number().int(),
|
|
72
|
+
});
|
|
73
|
+
export const ProjectInsightSchema = z.object({
|
|
74
|
+
projectId: z.string(),
|
|
75
|
+
health: ProjectHealthSchema.nullable(),
|
|
76
|
+
progress: ProjectProgressSchema.nullable(),
|
|
77
|
+
});
|
|
78
|
+
export const WorkspaceInsightsSchema = z.object({
|
|
79
|
+
folderId: z.string().nullable(),
|
|
80
|
+
projectInsights: z.array(ProjectInsightSchema),
|
|
81
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const StreakSchema = z.object({
|
|
3
|
+
count: z.number(),
|
|
4
|
+
start: z.string(),
|
|
5
|
+
end: z.string(),
|
|
6
|
+
});
|
|
7
|
+
export const CompletedItemSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
completed: z.number(),
|
|
10
|
+
});
|
|
11
|
+
export const ItemsWithDateSchema = z.object({
|
|
12
|
+
items: z.array(CompletedItemSchema),
|
|
13
|
+
totalCompleted: z.number(),
|
|
14
|
+
});
|
|
15
|
+
export const KarmaUpdateSchema = z.object({
|
|
16
|
+
time: z.string(),
|
|
17
|
+
newKarma: z.number(),
|
|
18
|
+
positiveKarma: z.number(),
|
|
19
|
+
negativeKarma: z.number(),
|
|
20
|
+
positiveKarmaReasons: z.array(z.any()),
|
|
21
|
+
negativeKarmaReasons: z.array(z.any()),
|
|
22
|
+
});
|
|
23
|
+
export const ProductivityStatsSchema = z.object({
|
|
24
|
+
completedCount: z.number(),
|
|
25
|
+
daysItems: z.array(ItemsWithDateSchema.extend({
|
|
26
|
+
date: z.string(),
|
|
27
|
+
})),
|
|
28
|
+
goals: z.object({
|
|
29
|
+
currentDailyStreak: StreakSchema,
|
|
30
|
+
currentWeeklyStreak: StreakSchema,
|
|
31
|
+
dailyGoal: z.number(),
|
|
32
|
+
ignoreDays: z.array(z.number()),
|
|
33
|
+
karmaDisabled: z.number(),
|
|
34
|
+
lastDailyStreak: StreakSchema,
|
|
35
|
+
lastWeeklyStreak: StreakSchema,
|
|
36
|
+
maxDailyStreak: StreakSchema,
|
|
37
|
+
maxWeeklyStreak: StreakSchema,
|
|
38
|
+
user: z.string(),
|
|
39
|
+
userId: z.string(),
|
|
40
|
+
vacationMode: z.number(),
|
|
41
|
+
weeklyGoal: z.number(),
|
|
42
|
+
}),
|
|
43
|
+
karma: z.number(),
|
|
44
|
+
karmaGraphData: z.array(z.object({
|
|
45
|
+
date: z.string(),
|
|
46
|
+
karmaAvg: z.number(),
|
|
47
|
+
})),
|
|
48
|
+
karmaLastUpdate: z.number(),
|
|
49
|
+
karmaTrend: z.string(),
|
|
50
|
+
karmaUpdateReasons: z.array(KarmaUpdateSchema),
|
|
51
|
+
projectColors: z.record(z.string(), z.string()),
|
|
52
|
+
weekItems: z.array(ItemsWithDateSchema.extend({
|
|
53
|
+
from: z.string(),
|
|
54
|
+
to: z.string(),
|
|
55
|
+
})),
|
|
56
|
+
});
|
|
57
|
+
export const ColorSchema = z.object({
|
|
58
|
+
/** The key of the color (i.e. 'berry_red') */
|
|
59
|
+
key: z.string(),
|
|
60
|
+
/** The display name of the color (i.e. 'Berry Red') */
|
|
61
|
+
displayName: z.string(),
|
|
62
|
+
/** The hex value of the color (i.e. '#b8255f') */
|
|
63
|
+
hexValue: z.string(),
|
|
64
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getProjectUrl } from '../../utils/url-helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Base schema for all project types in Todoist.
|
|
5
|
+
* Contains common fields shared between personal and workspace projects.
|
|
6
|
+
*/
|
|
7
|
+
export const BaseProjectSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
canAssignTasks: z.boolean(),
|
|
10
|
+
childOrder: z.number().int(),
|
|
11
|
+
color: z.string(),
|
|
12
|
+
createdAt: z.string().nullable(),
|
|
13
|
+
isArchived: z.boolean(),
|
|
14
|
+
isDeleted: z.boolean(),
|
|
15
|
+
isFavorite: z.boolean(),
|
|
16
|
+
isFrozen: z.boolean(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
updatedAt: z.string().nullable(),
|
|
19
|
+
viewStyle: z.string(),
|
|
20
|
+
defaultOrder: z.number().int(),
|
|
21
|
+
description: z.string(),
|
|
22
|
+
isCollapsed: z.boolean(),
|
|
23
|
+
isShared: z.boolean(),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Schema for personal projects in Todoist.
|
|
27
|
+
*/
|
|
28
|
+
export const PersonalProjectSchema = BaseProjectSchema.extend({
|
|
29
|
+
parentId: z.string().nullable(),
|
|
30
|
+
inboxProject: z.boolean().optional().default(false),
|
|
31
|
+
}).transform((data) => {
|
|
32
|
+
return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
|
|
33
|
+
});
|
|
34
|
+
/** Available project visibility levels. */
|
|
35
|
+
export const PROJECT_VISIBILITIES = ['restricted', 'team', 'public'];
|
|
36
|
+
export const ProjectVisibilitySchema = z.enum(PROJECT_VISIBILITIES);
|
|
37
|
+
/**
|
|
38
|
+
* Schema for workspace projects in Todoist.
|
|
39
|
+
*/
|
|
40
|
+
export const WorkspaceProjectSchema = BaseProjectSchema.extend({
|
|
41
|
+
access: z.object({ visibility: ProjectVisibilitySchema }).optional(),
|
|
42
|
+
collaboratorRoleDefault: z.string(),
|
|
43
|
+
folderId: z.string().nullable(),
|
|
44
|
+
isInviteOnly: z.boolean().nullable(),
|
|
45
|
+
isLinkSharingEnabled: z.boolean(),
|
|
46
|
+
role: z.string().nullable(),
|
|
47
|
+
status: z.string(),
|
|
48
|
+
workspaceId: z.string(),
|
|
49
|
+
}).transform((data) => {
|
|
50
|
+
return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
|
|
51
|
+
});
|
|
52
|
+
/** Available project view styles. */
|
|
53
|
+
export const PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getSectionUrl } from '../../utils/url-helpers.js';
|
|
3
|
+
export const SectionSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
userId: z.string(),
|
|
7
|
+
projectId: z.string(),
|
|
8
|
+
addedAt: z.string(),
|
|
9
|
+
updatedAt: z.string(),
|
|
10
|
+
archivedAt: z.string().nullable(),
|
|
11
|
+
name: z.string(),
|
|
12
|
+
sectionOrder: z.number().int(),
|
|
13
|
+
isArchived: z.boolean(),
|
|
14
|
+
isDeleted: z.boolean(),
|
|
15
|
+
isCollapsed: z.boolean(),
|
|
16
|
+
})
|
|
17
|
+
.transform((data) => {
|
|
18
|
+
return Object.assign(Object.assign({}, data), { url: getSectionUrl(data.id, data.name) });
|
|
19
|
+
});
|
|
@@ -9,7 +9,7 @@ export const PROJECT_STATUSES = [
|
|
|
9
9
|
'COMPLETED',
|
|
10
10
|
'CANCELED',
|
|
11
11
|
];
|
|
12
|
-
export { COLLABORATOR_ROLES } from '../../
|
|
12
|
+
export { COLLABORATOR_ROLES } from '../../workspaces/types.js';
|
|
13
13
|
/** Available reminder notification services. */
|
|
14
14
|
export const REMINDER_SERVICES = ['default', 'email', 'mobile', 'push', 'no_default'];
|
|
15
15
|
/** Available workspace project sort orders. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { PREMIUM_STATUSES } from '../../
|
|
2
|
+
import { PREMIUM_STATUSES } from '../../users/types.js';
|
|
3
3
|
import { BooleanFromZeroOneSchema, DateFormatSchema, DayOfWeekSchema, TimeFormatSchema, } from '../user-preferences.js';
|
|
4
4
|
export const FeaturesSchema = z
|
|
5
5
|
.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../
|
|
2
|
+
import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../workspaces/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Sync API workspace resource.
|
|
5
5
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getTaskUrl } from '../../utils/url-helpers.js';
|
|
3
|
+
import { hasUncompletablePrefix } from '../../utils/uncompletable-helpers.js';
|
|
4
|
+
export const DueDateSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
isRecurring: z.boolean(),
|
|
7
|
+
string: z.string(),
|
|
8
|
+
date: z.string(),
|
|
9
|
+
})
|
|
10
|
+
.extend({
|
|
11
|
+
datetime: z.string().nullable().optional(),
|
|
12
|
+
timezone: z.string().nullable().optional(),
|
|
13
|
+
lang: z.string().nullable().optional(),
|
|
14
|
+
});
|
|
15
|
+
/** Available duration units for task deadlines. */
|
|
16
|
+
export const DURATION_UNITS = ['minute', 'day'];
|
|
17
|
+
export const DurationSchema = z.object({
|
|
18
|
+
amount: z.number().positive('Value should be greater than zero'),
|
|
19
|
+
unit: z.enum(DURATION_UNITS),
|
|
20
|
+
});
|
|
21
|
+
export const DeadlineSchema = z.object({
|
|
22
|
+
date: z.string(),
|
|
23
|
+
lang: z.string(),
|
|
24
|
+
});
|
|
25
|
+
export const TaskSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
id: z.string(),
|
|
28
|
+
userId: z.string(),
|
|
29
|
+
projectId: z.string(),
|
|
30
|
+
sectionId: z.string().nullable(),
|
|
31
|
+
parentId: z.string().nullable(),
|
|
32
|
+
addedByUid: z.string().nullable(),
|
|
33
|
+
assignedByUid: z.string().nullable(),
|
|
34
|
+
responsibleUid: z.string().nullable(),
|
|
35
|
+
labels: z.array(z.string()),
|
|
36
|
+
deadline: DeadlineSchema.nullable(),
|
|
37
|
+
duration: DurationSchema.nullable(),
|
|
38
|
+
checked: z.boolean(),
|
|
39
|
+
isDeleted: z.boolean(),
|
|
40
|
+
addedAt: z.string().nullable(),
|
|
41
|
+
completedAt: z.string().nullable(),
|
|
42
|
+
updatedAt: z.string().nullable(),
|
|
43
|
+
due: DueDateSchema.nullable(),
|
|
44
|
+
priority: z.number().int(),
|
|
45
|
+
childOrder: z.number().int(),
|
|
46
|
+
content: z.string(),
|
|
47
|
+
description: z.string(),
|
|
48
|
+
dayOrder: z.number().int(),
|
|
49
|
+
isCollapsed: z.boolean(),
|
|
50
|
+
isUncompletable: z.boolean().default(false),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => {
|
|
53
|
+
// Auto-detect uncompletable status from content prefix
|
|
54
|
+
const isUncompletable = hasUncompletablePrefix(data.content);
|
|
55
|
+
return Object.assign(Object.assign({}, data), { isUncompletable, url: getTaskUrl(data.id, data.content) });
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types.js';
|