@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.
Files changed (162) hide show
  1. package/dist/cjs/todoist-api.js +8 -7
  2. package/dist/cjs/types/activity/index.js +18 -0
  3. package/dist/cjs/types/activity/requests.js +2 -0
  4. package/dist/cjs/types/activity/types.js +28 -0
  5. package/dist/cjs/types/backups/index.js +18 -0
  6. package/dist/cjs/types/backups/requests.js +2 -0
  7. package/dist/cjs/types/backups/types.js +8 -0
  8. package/dist/cjs/types/comments/index.js +18 -0
  9. package/dist/cjs/types/comments/requests.js +2 -0
  10. package/dist/cjs/types/comments/types.js +60 -0
  11. package/dist/cjs/types/common.js +2 -0
  12. package/dist/cjs/types/emails/index.js +17 -0
  13. package/dist/cjs/types/emails/requests.js +5 -0
  14. package/dist/cjs/types/id-mappings/index.js +18 -0
  15. package/dist/cjs/types/{requests.js → id-mappings/requests.js} +1 -7
  16. package/dist/cjs/types/id-mappings/types.js +12 -0
  17. package/dist/cjs/types/index.js +16 -2
  18. package/dist/cjs/types/insights/index.js +18 -0
  19. package/dist/cjs/types/insights/requests.js +2 -0
  20. package/dist/cjs/types/insights/types.js +84 -0
  21. package/dist/cjs/types/labels/index.js +18 -0
  22. package/dist/cjs/types/labels/requests.js +2 -0
  23. package/dist/cjs/types/labels/types.js +11 -0
  24. package/dist/cjs/types/productivity/index.js +17 -0
  25. package/dist/cjs/types/productivity/types.js +67 -0
  26. package/dist/cjs/types/projects/index.js +18 -0
  27. package/dist/cjs/types/projects/requests.js +2 -0
  28. package/dist/cjs/types/projects/types.js +56 -0
  29. package/dist/cjs/types/reminders/index.js +17 -0
  30. package/dist/cjs/types/reminders/requests.js +5 -0
  31. package/dist/cjs/types/sections/index.js +18 -0
  32. package/dist/cjs/types/sections/requests.js +2 -0
  33. package/dist/cjs/types/sections/types.js +22 -0
  34. package/dist/cjs/types/sync/commands/shared.js +2 -2
  35. package/dist/cjs/types/sync/resources/collaborators.js +2 -2
  36. package/dist/cjs/types/sync/resources/notes.js +2 -2
  37. package/dist/cjs/types/sync/resources/reminders.js +3 -3
  38. package/dist/cjs/types/sync/resources/user.js +2 -2
  39. package/dist/cjs/types/sync/resources/workspaces.js +5 -5
  40. package/dist/cjs/types/tasks/index.js +18 -0
  41. package/dist/cjs/types/tasks/requests.js +2 -0
  42. package/dist/cjs/types/tasks/types.js +59 -0
  43. package/dist/cjs/types/templates/index.js +17 -0
  44. package/dist/cjs/types/templates/requests.js +2 -0
  45. package/dist/cjs/types/uploads/index.js +17 -0
  46. package/dist/cjs/types/uploads/requests.js +2 -0
  47. package/dist/cjs/types/users/index.js +17 -0
  48. package/dist/cjs/types/users/types.js +51 -0
  49. package/dist/cjs/types/workspaces/index.js +18 -0
  50. package/dist/cjs/types/workspaces/requests.js +2 -0
  51. package/dist/cjs/types/workspaces/types.js +137 -0
  52. package/dist/cjs/utils/validators.js +38 -27
  53. package/dist/esm/todoist-api.js +4 -3
  54. package/dist/esm/types/activity/index.js +2 -0
  55. package/dist/esm/types/activity/requests.js +1 -0
  56. package/dist/esm/types/activity/types.js +25 -0
  57. package/dist/esm/types/backups/index.js +2 -0
  58. package/dist/esm/types/backups/requests.js +1 -0
  59. package/dist/esm/types/backups/types.js +5 -0
  60. package/dist/esm/types/comments/index.js +2 -0
  61. package/dist/esm/types/comments/requests.js +1 -0
  62. package/dist/esm/types/comments/types.js +57 -0
  63. package/dist/esm/types/common.js +1 -0
  64. package/dist/esm/types/emails/index.js +1 -0
  65. package/dist/esm/types/emails/requests.js +2 -0
  66. package/dist/esm/types/id-mappings/index.js +2 -0
  67. package/dist/esm/types/{requests.js → id-mappings/requests.js} +0 -6
  68. package/dist/esm/types/id-mappings/types.js +9 -0
  69. package/dist/esm/types/index.js +16 -2
  70. package/dist/esm/types/insights/index.js +2 -0
  71. package/dist/esm/types/insights/requests.js +1 -0
  72. package/dist/esm/types/insights/types.js +81 -0
  73. package/dist/esm/types/labels/index.js +2 -0
  74. package/dist/esm/types/labels/requests.js +1 -0
  75. package/dist/esm/types/labels/types.js +8 -0
  76. package/dist/esm/types/productivity/index.js +1 -0
  77. package/dist/esm/types/productivity/types.js +64 -0
  78. package/dist/esm/types/projects/index.js +2 -0
  79. package/dist/esm/types/projects/requests.js +1 -0
  80. package/dist/esm/types/projects/types.js +53 -0
  81. package/dist/esm/types/reminders/index.js +1 -0
  82. package/dist/esm/types/reminders/requests.js +2 -0
  83. package/dist/esm/types/sections/index.js +2 -0
  84. package/dist/esm/types/sections/requests.js +1 -0
  85. package/dist/esm/types/sections/types.js +19 -0
  86. package/dist/esm/types/sync/commands/shared.js +1 -1
  87. package/dist/esm/types/sync/resources/collaborators.js +1 -1
  88. package/dist/esm/types/sync/resources/notes.js +1 -1
  89. package/dist/esm/types/sync/resources/reminders.js +1 -1
  90. package/dist/esm/types/sync/resources/user.js +1 -1
  91. package/dist/esm/types/sync/resources/workspaces.js +1 -1
  92. package/dist/esm/types/tasks/index.js +2 -0
  93. package/dist/esm/types/tasks/requests.js +1 -0
  94. package/dist/esm/types/tasks/types.js +56 -0
  95. package/dist/esm/types/templates/index.js +1 -0
  96. package/dist/esm/types/templates/requests.js +1 -0
  97. package/dist/esm/types/uploads/index.js +1 -0
  98. package/dist/esm/types/uploads/requests.js +1 -0
  99. package/dist/esm/types/users/index.js +1 -0
  100. package/dist/esm/types/users/types.js +48 -0
  101. package/dist/esm/types/workspaces/index.js +2 -0
  102. package/dist/esm/types/workspaces/requests.js +1 -0
  103. package/dist/esm/types/workspaces/types.js +134 -0
  104. package/dist/esm/utils/validators.js +12 -1
  105. package/dist/types/test-utils/test-defaults.d.ts +5 -5
  106. package/dist/types/todoist-api.d.ts +16 -2
  107. package/dist/types/types/activity/index.d.ts +2 -0
  108. package/dist/types/types/activity/requests.d.ts +85 -0
  109. package/dist/types/types/activity/types.d.ts +49 -0
  110. package/dist/types/types/backups/index.d.ts +2 -0
  111. package/dist/types/types/backups/requests.d.ts +16 -0
  112. package/dist/types/types/backups/types.d.ts +7 -0
  113. package/dist/types/types/comments/index.d.ts +2 -0
  114. package/dist/types/types/comments/requests.d.ts +64 -0
  115. package/dist/types/types/comments/types.d.ts +141 -0
  116. package/dist/types/types/common.d.ts +6 -0
  117. package/dist/types/types/emails/index.d.ts +1 -0
  118. package/dist/types/types/emails/requests.d.ts +30 -0
  119. package/dist/types/types/id-mappings/index.d.ts +2 -0
  120. package/dist/types/types/id-mappings/requests.d.ts +28 -0
  121. package/dist/types/types/id-mappings/types.d.ts +13 -0
  122. package/dist/types/types/index.d.ts +16 -2
  123. package/dist/types/types/insights/index.d.ts +2 -0
  124. package/dist/types/types/insights/requests.d.ts +26 -0
  125. package/dist/types/types/insights/types.d.ts +186 -0
  126. package/dist/types/types/labels/index.d.ts +2 -0
  127. package/dist/types/types/labels/requests.d.ts +75 -0
  128. package/dist/types/types/labels/types.d.ts +13 -0
  129. package/dist/types/types/productivity/index.d.ts +1 -0
  130. package/dist/types/types/productivity/types.d.ts +115 -0
  131. package/dist/types/types/projects/index.d.ts +2 -0
  132. package/dist/types/types/projects/requests.d.ts +169 -0
  133. package/dist/types/types/projects/types.d.ts +201 -0
  134. package/dist/types/types/reminders/index.d.ts +1 -0
  135. package/dist/types/types/reminders/requests.d.ts +91 -0
  136. package/dist/types/types/sections/index.d.ts +2 -0
  137. package/dist/types/types/sections/requests.d.ts +41 -0
  138. package/dist/types/types/sections/types.d.ts +44 -0
  139. package/dist/types/types/sync/commands/projects.d.ts +2 -1
  140. package/dist/types/types/sync/commands/shared.d.ts +2 -2
  141. package/dist/types/types/sync/commands/workspaces.d.ts +1 -1
  142. package/dist/types/types/sync/resources/notes.d.ts +1 -1
  143. package/dist/types/types/sync/response.d.ts +5 -1
  144. package/dist/types/types/tasks/index.d.ts +2 -0
  145. package/dist/types/types/tasks/requests.d.ts +197 -0
  146. package/dist/types/types/tasks/types.d.ts +162 -0
  147. package/dist/types/types/templates/index.d.ts +1 -0
  148. package/dist/types/types/templates/requests.d.ts +92 -0
  149. package/dist/types/types/uploads/index.d.ts +1 -0
  150. package/dist/types/types/uploads/requests.d.ts +32 -0
  151. package/dist/types/types/users/index.d.ts +1 -0
  152. package/dist/types/types/users/types.d.ts +66 -0
  153. package/dist/types/types/workspaces/index.d.ts +2 -0
  154. package/dist/types/types/workspaces/requests.d.ts +260 -0
  155. package/dist/types/types/workspaces/types.d.ts +225 -0
  156. package/dist/types/utils/colors.d.ts +1 -1
  157. package/dist/types/utils/validators.d.ts +7 -6
  158. package/package.json +3 -3
  159. package/dist/cjs/types/entities.js +0 -552
  160. package/dist/esm/types/entities.js +0 -548
  161. package/dist/types/types/entities.d.ts +0 -1211
  162. package/dist/types/types/requests.d.ts +0 -1188
@@ -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/entities.js';
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: args,
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,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -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,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ export const BackupSchema = z.object({
3
+ version: z.string(),
4
+ url: z.string(),
5
+ });
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -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';
@@ -0,0 +1,2 @@
1
+ /** Object types that support email forwarding. */
2
+ export const EMAIL_OBJECT_TYPES = ['project', 'project_comments', 'task'];
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ 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',
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export const IdMappingSchema = z.object({
3
+ oldId: z.string().nullable(),
4
+ newId: z.string().nullable(),
5
+ });
6
+ export const MovedIdSchema = z.object({
7
+ oldId: z.string(),
8
+ newId: z.string(),
9
+ });
@@ -1,5 +1,19 @@
1
- export * from './entities.js';
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,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.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,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export const LabelSchema = z.object({
3
+ id: z.string(),
4
+ order: z.number().int().nullable(),
5
+ name: z.string(),
6
+ color: z.string(),
7
+ isFavorite: z.boolean(),
8
+ });
@@ -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,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -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,2 @@
1
+ /** Available reminder delivery services. */
2
+ export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ 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 '../../entities.js';
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 { WorkspaceRoleSchema } from '../../entities.js';
2
+ import { WorkspaceRoleSchema } from '../../workspaces/types.js';
3
3
  export const CollaboratorSchema = z
4
4
  .object({
5
5
  id: z.string(),
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AttachmentSchema } from '../../entities.js';
2
+ import { AttachmentSchema } from '../../comments/types.js';
3
3
  /**
4
4
  * Sync API note (comment) resource.
5
5
  * Separate from the REST `CommentSchema` which transforms `itemId` to `taskId`.
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { DueDateSchema } from '../../entities.js';
2
+ import { DueDateSchema } from '../../tasks/types.js';
3
3
  export const ReminderBaseSchema = z.object({
4
4
  id: z.string(),
5
5
  notifyUid: z.string(),
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { PREMIUM_STATUSES } from '../../entities.js';
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 '../../entities.js';
2
+ import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../workspaces/types.js';
3
3
  /**
4
4
  * Sync API workspace resource.
5
5
  *
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -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';