@doist/todoist-api-typescript 7.5.0 → 7.6.1

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 (171) hide show
  1. package/dist/cjs/authentication.js +46 -2
  2. package/dist/cjs/consts/endpoints.js +54 -2
  3. package/dist/cjs/todoist-api.js +524 -6
  4. package/dist/cjs/types/activity/index.js +18 -0
  5. package/dist/cjs/types/activity/requests.js +2 -0
  6. package/dist/cjs/types/activity/types.js +28 -0
  7. package/dist/cjs/types/backups/index.js +18 -0
  8. package/dist/cjs/types/backups/requests.js +2 -0
  9. package/dist/cjs/types/backups/types.js +8 -0
  10. package/dist/cjs/types/comments/index.js +18 -0
  11. package/dist/cjs/types/comments/requests.js +2 -0
  12. package/dist/cjs/types/comments/types.js +60 -0
  13. package/dist/cjs/types/common.js +2 -0
  14. package/dist/cjs/types/emails/index.js +17 -0
  15. package/dist/cjs/types/emails/requests.js +5 -0
  16. package/dist/cjs/types/id-mappings/index.js +18 -0
  17. package/dist/cjs/types/id-mappings/requests.js +20 -0
  18. package/dist/cjs/types/id-mappings/types.js +12 -0
  19. package/dist/cjs/types/index.js +16 -2
  20. package/dist/cjs/types/insights/index.js +18 -0
  21. package/dist/cjs/types/insights/requests.js +2 -0
  22. package/dist/cjs/types/insights/types.js +84 -0
  23. package/dist/cjs/types/labels/index.js +18 -0
  24. package/dist/cjs/types/labels/requests.js +2 -0
  25. package/dist/cjs/types/labels/types.js +11 -0
  26. package/dist/cjs/types/productivity/index.js +17 -0
  27. package/dist/cjs/types/productivity/types.js +67 -0
  28. package/dist/cjs/types/projects/index.js +18 -0
  29. package/dist/cjs/types/projects/requests.js +2 -0
  30. package/dist/cjs/types/projects/types.js +56 -0
  31. package/dist/cjs/types/reminders/index.js +17 -0
  32. package/dist/cjs/types/sections/index.js +18 -0
  33. package/dist/cjs/types/sections/requests.js +2 -0
  34. package/dist/cjs/types/sections/types.js +22 -0
  35. package/dist/cjs/types/sync/commands/shared.js +2 -2
  36. package/dist/cjs/types/sync/resources/collaborators.js +2 -2
  37. package/dist/cjs/types/sync/resources/notes.js +2 -2
  38. package/dist/cjs/types/sync/resources/reminders.js +3 -3
  39. package/dist/cjs/types/sync/resources/user.js +2 -2
  40. package/dist/cjs/types/sync/resources/workspaces.js +5 -5
  41. package/dist/cjs/types/tasks/index.js +18 -0
  42. package/dist/cjs/types/tasks/requests.js +2 -0
  43. package/dist/cjs/types/tasks/types.js +59 -0
  44. package/dist/cjs/types/templates/index.js +17 -0
  45. package/dist/cjs/types/templates/requests.js +2 -0
  46. package/dist/cjs/types/uploads/index.js +17 -0
  47. package/dist/cjs/types/uploads/requests.js +2 -0
  48. package/dist/cjs/types/users/index.js +17 -0
  49. package/dist/cjs/types/users/types.js +51 -0
  50. package/dist/cjs/types/workspaces/index.js +18 -0
  51. package/dist/cjs/types/workspaces/requests.js +2 -0
  52. package/dist/cjs/types/workspaces/types.js +137 -0
  53. package/dist/cjs/utils/validators.js +47 -19
  54. package/dist/esm/authentication.js +46 -3
  55. package/dist/esm/consts/endpoints.js +43 -0
  56. package/dist/esm/todoist-api.js +522 -4
  57. package/dist/esm/types/activity/index.js +2 -0
  58. package/dist/esm/types/activity/requests.js +1 -0
  59. package/dist/esm/types/activity/types.js +25 -0
  60. package/dist/esm/types/backups/index.js +2 -0
  61. package/dist/esm/types/backups/requests.js +1 -0
  62. package/dist/esm/types/backups/types.js +5 -0
  63. package/dist/esm/types/comments/index.js +2 -0
  64. package/dist/esm/types/comments/requests.js +1 -0
  65. package/dist/esm/types/comments/types.js +57 -0
  66. package/dist/esm/types/common.js +1 -0
  67. package/dist/esm/types/emails/index.js +1 -0
  68. package/dist/esm/types/emails/requests.js +2 -0
  69. package/dist/esm/types/id-mappings/index.js +2 -0
  70. package/dist/esm/types/id-mappings/requests.js +17 -0
  71. package/dist/esm/types/id-mappings/types.js +9 -0
  72. package/dist/esm/types/index.js +16 -2
  73. package/dist/esm/types/insights/index.js +2 -0
  74. package/dist/esm/types/insights/requests.js +1 -0
  75. package/dist/esm/types/insights/types.js +81 -0
  76. package/dist/esm/types/labels/index.js +2 -0
  77. package/dist/esm/types/labels/requests.js +1 -0
  78. package/dist/esm/types/labels/types.js +8 -0
  79. package/dist/esm/types/productivity/index.js +1 -0
  80. package/dist/esm/types/productivity/types.js +64 -0
  81. package/dist/esm/types/projects/index.js +2 -0
  82. package/dist/esm/types/projects/requests.js +1 -0
  83. package/dist/esm/types/projects/types.js +53 -0
  84. package/dist/esm/types/reminders/index.js +1 -0
  85. package/dist/esm/types/sections/index.js +2 -0
  86. package/dist/esm/types/sections/requests.js +1 -0
  87. package/dist/esm/types/sections/types.js +19 -0
  88. package/dist/esm/types/sync/commands/shared.js +1 -1
  89. package/dist/esm/types/sync/resources/collaborators.js +1 -1
  90. package/dist/esm/types/sync/resources/notes.js +1 -1
  91. package/dist/esm/types/sync/resources/reminders.js +1 -1
  92. package/dist/esm/types/sync/resources/user.js +1 -1
  93. package/dist/esm/types/sync/resources/workspaces.js +1 -1
  94. package/dist/esm/types/tasks/index.js +2 -0
  95. package/dist/esm/types/tasks/requests.js +1 -0
  96. package/dist/esm/types/tasks/types.js +56 -0
  97. package/dist/esm/types/templates/index.js +1 -0
  98. package/dist/esm/types/templates/requests.js +1 -0
  99. package/dist/esm/types/uploads/index.js +1 -0
  100. package/dist/esm/types/uploads/requests.js +1 -0
  101. package/dist/esm/types/users/index.js +1 -0
  102. package/dist/esm/types/users/types.js +48 -0
  103. package/dist/esm/types/workspaces/index.js +2 -0
  104. package/dist/esm/types/workspaces/requests.js +1 -0
  105. package/dist/esm/types/workspaces/types.js +134 -0
  106. package/dist/esm/utils/validators.js +30 -2
  107. package/dist/types/authentication.d.ts +51 -6
  108. package/dist/types/consts/endpoints.d.ts +22 -0
  109. package/dist/types/test-utils/test-defaults.d.ts +5 -5
  110. package/dist/types/todoist-api.d.ts +209 -4
  111. package/dist/types/types/activity/index.d.ts +2 -0
  112. package/dist/types/types/activity/requests.d.ts +85 -0
  113. package/dist/types/types/activity/types.d.ts +49 -0
  114. package/dist/types/types/backups/index.d.ts +2 -0
  115. package/dist/types/types/backups/requests.d.ts +16 -0
  116. package/dist/types/types/backups/types.d.ts +7 -0
  117. package/dist/types/types/comments/index.d.ts +2 -0
  118. package/dist/types/types/comments/requests.d.ts +63 -0
  119. package/dist/types/types/comments/types.d.ts +141 -0
  120. package/dist/types/types/common.d.ts +6 -0
  121. package/dist/types/types/emails/index.d.ts +1 -0
  122. package/dist/types/types/emails/requests.d.ts +30 -0
  123. package/dist/types/types/id-mappings/index.d.ts +2 -0
  124. package/dist/types/types/id-mappings/requests.d.ts +28 -0
  125. package/dist/types/types/id-mappings/types.d.ts +13 -0
  126. package/dist/types/types/index.d.ts +16 -2
  127. package/dist/types/types/insights/index.d.ts +2 -0
  128. package/dist/types/types/insights/requests.d.ts +26 -0
  129. package/dist/types/types/insights/types.d.ts +186 -0
  130. package/dist/types/types/labels/index.d.ts +2 -0
  131. package/dist/types/types/labels/requests.d.ts +75 -0
  132. package/dist/types/types/labels/types.d.ts +13 -0
  133. package/dist/types/types/productivity/index.d.ts +1 -0
  134. package/dist/types/types/productivity/types.d.ts +115 -0
  135. package/dist/types/types/projects/index.d.ts +2 -0
  136. package/dist/types/types/projects/requests.d.ts +169 -0
  137. package/dist/types/types/projects/types.d.ts +201 -0
  138. package/dist/types/types/reminders/index.d.ts +1 -0
  139. package/dist/types/types/reminders/requests.d.ts +91 -0
  140. package/dist/types/types/sections/index.d.ts +2 -0
  141. package/dist/types/types/sections/requests.d.ts +41 -0
  142. package/dist/types/types/sections/types.d.ts +44 -0
  143. package/dist/types/types/sync/commands/projects.d.ts +2 -1
  144. package/dist/types/types/sync/commands/shared.d.ts +2 -2
  145. package/dist/types/types/sync/commands/workspaces.d.ts +1 -1
  146. package/dist/types/types/sync/resources/notes.d.ts +1 -1
  147. package/dist/types/types/sync/resources/user.d.ts +2 -2
  148. package/dist/types/types/sync/resources/view-options.d.ts +5 -5
  149. package/dist/types/types/sync/response.d.ts +5 -1
  150. package/dist/types/types/sync/user-preferences.d.ts +1 -1
  151. package/dist/types/types/tasks/index.d.ts +2 -0
  152. package/dist/types/types/tasks/requests.d.ts +197 -0
  153. package/dist/types/types/tasks/types.d.ts +162 -0
  154. package/dist/types/types/templates/index.d.ts +1 -0
  155. package/dist/types/types/templates/requests.d.ts +92 -0
  156. package/dist/types/types/uploads/index.d.ts +1 -0
  157. package/dist/types/types/uploads/requests.d.ts +32 -0
  158. package/dist/types/types/users/index.d.ts +1 -0
  159. package/dist/types/types/users/types.d.ts +66 -0
  160. package/dist/types/types/workspaces/index.d.ts +2 -0
  161. package/dist/types/types/workspaces/requests.d.ts +260 -0
  162. package/dist/types/types/workspaces/types.d.ts +225 -0
  163. package/dist/types/utils/colors.d.ts +1 -1
  164. package/dist/types/utils/validators.d.ts +205 -12
  165. package/package.json +1 -1
  166. package/dist/cjs/types/entities.js +0 -437
  167. package/dist/esm/types/entities.js +0 -434
  168. package/dist/types/types/entities.d.ts +0 -971
  169. package/dist/types/types/requests.d.ts +0 -856
  170. /package/dist/cjs/types/{requests.js → reminders/requests.js} +0 -0
  171. /package/dist/esm/types/{requests.js → reminders/requests.js} +0 -0
@@ -1,437 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.WorkspaceSchema = exports.WorkspacePropertiesSchema = exports.WorkspaceLimitsSchema = exports.WorkspacePlanSchema = exports.WORKSPACE_PLANS = exports.JoinWorkspaceResultSchema = exports.WorkspacePlanDetailsSchema = exports.WORKSPACE_PLAN_STATUSES = exports.WORKSPACE_CURRENT_PLANS = exports.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.COLLABORATOR_ROLES = exports.ActivityEventSchema = exports.ActivityEventExtraDataSchema = exports.ColorSchema = exports.ProductivityStatsSchema = exports.KarmaUpdateSchema = exports.ItemsWithDateSchema = exports.CompletedItemSchema = exports.StreakSchema = exports.CurrentUserSchema = exports.PREMIUM_STATUSES = exports.TimezoneInfoSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.UPLOAD_STATES = exports.LabelSchema = exports.SectionSchema = exports.PROJECT_VIEW_STYLES = exports.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PROJECT_VISIBILITIES = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DURATION_UNITS = exports.DueDateSchema = void 0;
15
- const zod_1 = require("zod");
16
- const url_helpers_1 = require("../utils/url-helpers");
17
- const uncompletable_helpers_1 = require("../utils/uncompletable-helpers");
18
- exports.DueDateSchema = zod_1.z
19
- .object({
20
- isRecurring: zod_1.z.boolean(),
21
- string: zod_1.z.string(),
22
- date: zod_1.z.string(),
23
- })
24
- .extend({
25
- datetime: zod_1.z.string().nullable().optional(),
26
- timezone: zod_1.z.string().nullable().optional(),
27
- lang: zod_1.z.string().nullable().optional(),
28
- });
29
- /** Available duration units for task deadlines. */
30
- exports.DURATION_UNITS = ['minute', 'day'];
31
- exports.DurationSchema = zod_1.z.object({
32
- amount: zod_1.z.number().positive('Value should be greater than zero'),
33
- unit: zod_1.z.enum(exports.DURATION_UNITS),
34
- });
35
- exports.DeadlineSchema = zod_1.z.object({
36
- date: zod_1.z.string(),
37
- lang: zod_1.z.string(),
38
- });
39
- exports.TaskSchema = zod_1.z
40
- .object({
41
- id: zod_1.z.string(),
42
- userId: zod_1.z.string(),
43
- projectId: zod_1.z.string(),
44
- sectionId: zod_1.z.string().nullable(),
45
- parentId: zod_1.z.string().nullable(),
46
- addedByUid: zod_1.z.string().nullable(),
47
- assignedByUid: zod_1.z.string().nullable(),
48
- responsibleUid: zod_1.z.string().nullable(),
49
- labels: zod_1.z.array(zod_1.z.string()),
50
- deadline: exports.DeadlineSchema.nullable(),
51
- duration: exports.DurationSchema.nullable(),
52
- checked: zod_1.z.boolean(),
53
- isDeleted: zod_1.z.boolean(),
54
- addedAt: zod_1.z.string().nullable(),
55
- completedAt: zod_1.z.string().nullable(),
56
- updatedAt: zod_1.z.string().nullable(),
57
- due: exports.DueDateSchema.nullable(),
58
- priority: zod_1.z.number().int(),
59
- childOrder: zod_1.z.number().int(),
60
- content: zod_1.z.string(),
61
- description: zod_1.z.string(),
62
- dayOrder: zod_1.z.number().int(),
63
- isCollapsed: zod_1.z.boolean(),
64
- isUncompletable: zod_1.z.boolean().default(false),
65
- })
66
- .transform((data) => {
67
- // Auto-detect uncompletable status from content prefix
68
- const isUncompletable = (0, uncompletable_helpers_1.hasUncompletablePrefix)(data.content);
69
- return Object.assign(Object.assign({}, data), { isUncompletable, url: (0, url_helpers_1.getTaskUrl)(data.id, data.content) });
70
- });
71
- /**
72
- * Base schema for all project types in Todoist.
73
- * Contains common fields shared between personal and workspace projects.
74
- */
75
- exports.BaseProjectSchema = zod_1.z.object({
76
- id: zod_1.z.string(),
77
- canAssignTasks: zod_1.z.boolean(),
78
- childOrder: zod_1.z.number().int(),
79
- color: zod_1.z.string(),
80
- createdAt: zod_1.z.string().nullable(),
81
- isArchived: zod_1.z.boolean(),
82
- isDeleted: zod_1.z.boolean(),
83
- isFavorite: zod_1.z.boolean(),
84
- isFrozen: zod_1.z.boolean(),
85
- name: zod_1.z.string(),
86
- updatedAt: zod_1.z.string().nullable(),
87
- viewStyle: zod_1.z.string(),
88
- defaultOrder: zod_1.z.number().int(),
89
- description: zod_1.z.string(),
90
- isCollapsed: zod_1.z.boolean(),
91
- isShared: zod_1.z.boolean(),
92
- });
93
- /**
94
- * Schema for personal projects in Todoist.
95
- */
96
- exports.PersonalProjectSchema = exports.BaseProjectSchema.extend({
97
- parentId: zod_1.z.string().nullable(),
98
- inboxProject: zod_1.z.boolean().optional().default(false),
99
- }).transform((data) => {
100
- return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
101
- });
102
- /** Available project visibility levels. */
103
- exports.PROJECT_VISIBILITIES = ['restricted', 'team', 'public'];
104
- exports.ProjectVisibilitySchema = zod_1.z.enum(exports.PROJECT_VISIBILITIES);
105
- /**
106
- * Schema for workspace projects in Todoist.
107
- */
108
- exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
109
- access: zod_1.z.object({ visibility: exports.ProjectVisibilitySchema }).optional(),
110
- collaboratorRoleDefault: zod_1.z.string(),
111
- folderId: zod_1.z.string().nullable(),
112
- isInviteOnly: zod_1.z.boolean().nullable(),
113
- isLinkSharingEnabled: zod_1.z.boolean(),
114
- role: zod_1.z.string().nullable(),
115
- status: zod_1.z.string(),
116
- workspaceId: zod_1.z.string(),
117
- }).transform((data) => {
118
- return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
119
- });
120
- /** Available project view styles. */
121
- exports.PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
122
- exports.SectionSchema = zod_1.z
123
- .object({
124
- id: zod_1.z.string(),
125
- userId: zod_1.z.string(),
126
- projectId: zod_1.z.string(),
127
- addedAt: zod_1.z.string(),
128
- updatedAt: zod_1.z.string(),
129
- archivedAt: zod_1.z.string().nullable(),
130
- name: zod_1.z.string(),
131
- sectionOrder: zod_1.z.number().int(),
132
- isArchived: zod_1.z.boolean(),
133
- isDeleted: zod_1.z.boolean(),
134
- isCollapsed: zod_1.z.boolean(),
135
- })
136
- .transform((data) => {
137
- return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getSectionUrl)(data.id, data.name) });
138
- });
139
- exports.LabelSchema = zod_1.z.object({
140
- id: zod_1.z.string(),
141
- order: zod_1.z.number().int().nullable(),
142
- name: zod_1.z.string(),
143
- color: zod_1.z.string(),
144
- isFavorite: zod_1.z.boolean(),
145
- });
146
- /** Available file attachment upload states. */
147
- exports.UPLOAD_STATES = ['pending', 'completed'];
148
- exports.AttachmentSchema = zod_1.z
149
- .object({
150
- resourceType: zod_1.z.string(),
151
- })
152
- .extend({
153
- fileName: zod_1.z.string().nullable().optional(),
154
- fileSize: zod_1.z.number().int().nullable().optional(),
155
- fileType: zod_1.z.string().nullable().optional(),
156
- fileUrl: zod_1.z.string().nullable().optional(),
157
- fileDuration: zod_1.z.number().int().nullable().optional(),
158
- uploadState: zod_1.z.enum(exports.UPLOAD_STATES).nullable().optional(),
159
- image: zod_1.z.string().nullable().optional(),
160
- imageWidth: zod_1.z.number().int().nullable().optional(),
161
- imageHeight: zod_1.z.number().int().nullable().optional(),
162
- url: zod_1.z.string().nullable().optional(),
163
- title: zod_1.z.string().nullable().optional(),
164
- });
165
- exports.RawCommentSchema = zod_1.z
166
- .object({
167
- id: zod_1.z.string(),
168
- itemId: zod_1.z.string().optional(),
169
- projectId: zod_1.z.string().optional(),
170
- content: zod_1.z.string(),
171
- postedAt: zod_1.z.string(),
172
- fileAttachment: exports.AttachmentSchema.nullable(),
173
- postedUid: zod_1.z.string(),
174
- uidsToNotify: zod_1.z.array(zod_1.z.string()).nullable(),
175
- reactions: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())).nullable(),
176
- isDeleted: zod_1.z.boolean(),
177
- })
178
- .refine((data) => {
179
- // At least one of itemId or projectId must be present
180
- return ((data.itemId !== undefined && data.projectId === undefined) ||
181
- (data.itemId === undefined && data.projectId !== undefined));
182
- }, {
183
- message: 'Exactly one of itemId or projectId must be provided',
184
- });
185
- exports.CommentSchema = exports.RawCommentSchema.transform((data) => {
186
- const { itemId } = data, rest = __rest(data, ["itemId"]);
187
- return Object.assign(Object.assign({}, rest), {
188
- // Map itemId to taskId for backwards compatibility
189
- taskId: itemId });
190
- });
191
- exports.UserSchema = zod_1.z.object({
192
- id: zod_1.z.string(),
193
- name: zod_1.z.string(),
194
- email: zod_1.z.string(),
195
- });
196
- exports.TimezoneInfoSchema = zod_1.z.object({
197
- gmtString: zod_1.z.string(),
198
- hours: zod_1.z.number().int(),
199
- isDst: zod_1.z.number().int(),
200
- minutes: zod_1.z.number().int(),
201
- timezone: zod_1.z.string(),
202
- });
203
- /** Available user premium statuses. */
204
- exports.PREMIUM_STATUSES = [
205
- 'not_premium',
206
- 'current_personal_plan',
207
- 'legacy_personal_plan',
208
- 'teams_business_member',
209
- ];
210
- exports.CurrentUserSchema = zod_1.z.object({
211
- id: zod_1.z.string(),
212
- email: zod_1.z.string(),
213
- fullName: zod_1.z.string(),
214
- avatarBig: zod_1.z.string().nullish(),
215
- avatarMedium: zod_1.z.string().nullish(),
216
- avatarS640: zod_1.z.string().nullish(),
217
- avatarSmall: zod_1.z.string().nullish(),
218
- businessAccountId: zod_1.z.string().nullable(),
219
- isPremium: zod_1.z.boolean(),
220
- premiumStatus: zod_1.z.enum(exports.PREMIUM_STATUSES),
221
- dateFormat: zod_1.z.number().int(),
222
- timeFormat: zod_1.z.number().int(),
223
- weeklyGoal: zod_1.z.number().int(),
224
- dailyGoal: zod_1.z.number().int(),
225
- completedCount: zod_1.z.number().int(),
226
- completedToday: zod_1.z.number().int(),
227
- karma: zod_1.z.number(),
228
- karmaTrend: zod_1.z.string(),
229
- lang: zod_1.z.string(),
230
- nextWeek: zod_1.z.number().int(),
231
- startDay: zod_1.z.number().int(),
232
- startPage: zod_1.z.string(),
233
- tzInfo: exports.TimezoneInfoSchema,
234
- inboxProjectId: zod_1.z.string(),
235
- daysOff: zod_1.z.array(zod_1.z.number().int()),
236
- weekendStartDay: zod_1.z.number().int(),
237
- });
238
- exports.StreakSchema = zod_1.z.object({
239
- count: zod_1.z.number(),
240
- start: zod_1.z.string(),
241
- end: zod_1.z.string(),
242
- });
243
- exports.CompletedItemSchema = zod_1.z.object({
244
- id: zod_1.z.string(),
245
- completed: zod_1.z.number(),
246
- });
247
- exports.ItemsWithDateSchema = zod_1.z.object({
248
- items: zod_1.z.array(exports.CompletedItemSchema),
249
- totalCompleted: zod_1.z.number(),
250
- });
251
- exports.KarmaUpdateSchema = zod_1.z.object({
252
- time: zod_1.z.string(),
253
- newKarma: zod_1.z.number(),
254
- positiveKarma: zod_1.z.number(),
255
- negativeKarma: zod_1.z.number(),
256
- positiveKarmaReasons: zod_1.z.array(zod_1.z.any()),
257
- negativeKarmaReasons: zod_1.z.array(zod_1.z.any()),
258
- });
259
- exports.ProductivityStatsSchema = zod_1.z.object({
260
- completedCount: zod_1.z.number(),
261
- daysItems: zod_1.z.array(exports.ItemsWithDateSchema.extend({
262
- date: zod_1.z.string(),
263
- })),
264
- goals: zod_1.z.object({
265
- currentDailyStreak: exports.StreakSchema,
266
- currentWeeklyStreak: exports.StreakSchema,
267
- dailyGoal: zod_1.z.number(),
268
- ignoreDays: zod_1.z.array(zod_1.z.number()),
269
- karmaDisabled: zod_1.z.number(),
270
- lastDailyStreak: exports.StreakSchema,
271
- lastWeeklyStreak: exports.StreakSchema,
272
- maxDailyStreak: exports.StreakSchema,
273
- maxWeeklyStreak: exports.StreakSchema,
274
- user: zod_1.z.string(),
275
- userId: zod_1.z.string(),
276
- vacationMode: zod_1.z.number(),
277
- weeklyGoal: zod_1.z.number(),
278
- }),
279
- karma: zod_1.z.number(),
280
- karmaGraphData: zod_1.z.array(zod_1.z.object({
281
- date: zod_1.z.string(),
282
- karmaAvg: zod_1.z.number(),
283
- })),
284
- karmaLastUpdate: zod_1.z.number(),
285
- karmaTrend: zod_1.z.string(),
286
- karmaUpdateReasons: zod_1.z.array(exports.KarmaUpdateSchema),
287
- projectColors: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
288
- weekItems: zod_1.z.array(exports.ItemsWithDateSchema.extend({
289
- from: zod_1.z.string(),
290
- to: zod_1.z.string(),
291
- })),
292
- });
293
- exports.ColorSchema = zod_1.z.object({
294
- /** The key of the color (i.e. 'berry_red') */
295
- key: zod_1.z.string(),
296
- /** The display name of the color (i.e. 'Berry Red') */
297
- displayName: zod_1.z.string(),
298
- /** The hex value of the color (i.e. '#b8255f') */
299
- hexValue: zod_1.z.string(),
300
- });
301
- /**
302
- * Flexible object containing event-specific data.
303
- * Uses z.record to accept any properties for forward compatibility.
304
- */
305
- exports.ActivityEventExtraDataSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable();
306
- /**
307
- * Activity log event schema. Accepts unknown fields for forward compatibility.
308
- */
309
- exports.ActivityEventSchema = zod_1.z
310
- .object({
311
- objectType: zod_1.z.string(),
312
- objectId: zod_1.z.string(),
313
- eventType: zod_1.z.string(),
314
- eventDate: zod_1.z.string(),
315
- id: zod_1.z
316
- .union([zod_1.z.string(), zod_1.z.number()])
317
- .transform((val) => { var _a; return (_a = val === null || val === void 0 ? void 0 : val.toString()) !== null && _a !== void 0 ? _a : null; })
318
- .nullable(),
319
- parentProjectId: zod_1.z.string().nullable(),
320
- parentItemId: zod_1.z.string().nullable(),
321
- initiatorId: zod_1.z.string().nullable(),
322
- extraData: exports.ActivityEventExtraDataSchema,
323
- })
324
- .catchall(zod_1.z.any());
325
- /** Available project collaborator roles. */
326
- exports.COLLABORATOR_ROLES = [
327
- 'CREATOR',
328
- 'ADMIN',
329
- 'READ_WRITE',
330
- 'EDIT_ONLY',
331
- 'COMPLETE_ONLY',
332
- ];
333
- /**
334
- * Available workspace roles.
335
- */
336
- exports.WORKSPACE_ROLES = ['ADMIN', 'MEMBER', 'GUEST'];
337
- exports.WorkspaceRoleSchema = zod_1.z.enum(exports.WORKSPACE_ROLES);
338
- exports.WorkspaceUserSchema = zod_1.z.object({
339
- userId: zod_1.z.string(),
340
- workspaceId: zod_1.z.string(),
341
- userEmail: zod_1.z.string(),
342
- fullName: zod_1.z.string(),
343
- timezone: zod_1.z.string(),
344
- role: exports.WorkspaceRoleSchema,
345
- imageId: zod_1.z.string().nullable(),
346
- isDeleted: zod_1.z.boolean().default(false),
347
- });
348
- exports.WorkspaceInvitationSchema = zod_1.z.object({
349
- id: zod_1.z.string().default('0'),
350
- inviterId: zod_1.z.string(),
351
- userEmail: zod_1.z.string(),
352
- workspaceId: zod_1.z.string(),
353
- role: exports.WorkspaceRoleSchema,
354
- isExistingUser: zod_1.z.boolean(),
355
- });
356
- exports.PlanPriceSchema = zod_1.z.object({
357
- currency: zod_1.z.string(),
358
- amount: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
359
- interval: zod_1.z.string().optional(),
360
- });
361
- exports.FormattedPriceListingSchema = zod_1.z.object({
362
- currency: zod_1.z.string().optional(),
363
- amount: zod_1.z.number().optional(),
364
- interval: zod_1.z.string().optional(),
365
- formatted: zod_1.z.string().optional(),
366
- });
367
- /** Available workspace plan names. */
368
- exports.WORKSPACE_CURRENT_PLANS = ['Business', 'Starter'];
369
- /** Available workspace plan statuses. */
370
- exports.WORKSPACE_PLAN_STATUSES = [
371
- 'Active',
372
- 'Downgraded',
373
- 'Cancelled',
374
- 'NeverSubscribed',
375
- ];
376
- exports.WorkspacePlanDetailsSchema = zod_1.z.object({
377
- currentMemberCount: zod_1.z.number(),
378
- currentPlan: zod_1.z.enum(exports.WORKSPACE_CURRENT_PLANS),
379
- currentPlanStatus: zod_1.z.enum(exports.WORKSPACE_PLAN_STATUSES),
380
- downgradeAt: zod_1.z.string().nullable(),
381
- currentActiveProjects: zod_1.z.number(),
382
- maximumActiveProjects: zod_1.z.number(),
383
- priceList: zod_1.z.array(exports.FormattedPriceListingSchema),
384
- workspaceId: zod_1.z.number(),
385
- isTrialing: zod_1.z.boolean(),
386
- trialEndsAt: zod_1.z.string().nullable(),
387
- cancelAtPeriodEnd: zod_1.z.boolean(),
388
- hasTrialed: zod_1.z.boolean(),
389
- planPrice: exports.PlanPriceSchema.nullable(),
390
- hasBillingPortal: zod_1.z.boolean(),
391
- hasBillingPortalSwitchToAnnual: zod_1.z.boolean(),
392
- });
393
- exports.JoinWorkspaceResultSchema = zod_1.z.object({
394
- customSortingApplied: zod_1.z.boolean(),
395
- projectSortPreference: zod_1.z.string(),
396
- role: exports.WorkspaceRoleSchema,
397
- userId: zod_1.z.string(),
398
- workspaceId: zod_1.z.string(),
399
- });
400
- /**
401
- * Available workspace plans.
402
- */
403
- exports.WORKSPACE_PLANS = ['STARTER', 'BUSINESS'];
404
- exports.WorkspacePlanSchema = zod_1.z.enum(exports.WORKSPACE_PLANS);
405
- /**
406
- * Workspace resource limits.
407
- */
408
- exports.WorkspaceLimitsSchema = zod_1.z
409
- .object({
410
- current: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable(),
411
- next: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable(),
412
- })
413
- .catchall(zod_1.z.any());
414
- /**
415
- * Workspace properties (flexible object for unknown fields).
416
- */
417
- exports.WorkspacePropertiesSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
418
- /**
419
- * Represents a workspace in Todoist.
420
- */
421
- exports.WorkspaceSchema = zod_1.z.object({
422
- id: zod_1.z.string(),
423
- name: zod_1.z.string(),
424
- plan: exports.WorkspacePlanSchema,
425
- role: exports.WorkspaceRoleSchema,
426
- inviteCode: zod_1.z.string(),
427
- isLinkSharingEnabled: zod_1.z.boolean(),
428
- isGuestAllowed: zod_1.z.boolean(),
429
- limits: exports.WorkspaceLimitsSchema,
430
- logoBig: zod_1.z.string().nullish(),
431
- logoMedium: zod_1.z.string().nullish(),
432
- logoSmall: zod_1.z.string().nullish(),
433
- logoS640: zod_1.z.string().nullish(),
434
- createdAt: zod_1.z.string(),
435
- creatorId: zod_1.z.string(),
436
- properties: exports.WorkspacePropertiesSchema,
437
- });