@todoist/sdk 0.0.1 → 18.0.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 (335) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +293 -29
  3. package/dist/esm/authentication.js +307 -0
  4. package/dist/esm/clients/activity-client.js +60 -0
  5. package/dist/esm/clients/app-client.js +366 -0
  6. package/dist/esm/clients/backup-client.js +47 -0
  7. package/dist/esm/clients/base-client.js +29 -0
  8. package/dist/esm/clients/billing-client.js +160 -0
  9. package/dist/esm/clients/comment-client.js +92 -0
  10. package/dist/esm/clients/email-client.js +41 -0
  11. package/dist/esm/clients/filter-client.js +26 -0
  12. package/dist/esm/clients/folder-client.js +80 -0
  13. package/dist/esm/clients/id-mapping-client.js +37 -0
  14. package/dist/esm/clients/insights-client.js +89 -0
  15. package/dist/esm/clients/label-client.js +131 -0
  16. package/dist/esm/clients/productivity-client.js +24 -0
  17. package/dist/esm/clients/project-client.js +284 -0
  18. package/dist/esm/clients/reminder-client.js +204 -0
  19. package/dist/esm/clients/section-client.js +121 -0
  20. package/dist/esm/clients/task-client.js +264 -0
  21. package/dist/esm/clients/template-client.js +89 -0
  22. package/dist/esm/clients/ui-extension-client.js +110 -0
  23. package/dist/esm/clients/upload-client.js +153 -0
  24. package/dist/esm/clients/view-options-client.js +21 -0
  25. package/dist/esm/clients/workspace-client.js +384 -0
  26. package/dist/esm/consts/endpoints.js +193 -0
  27. package/dist/esm/index.js +5 -0
  28. package/dist/esm/test-utils/asserts.js +8 -0
  29. package/dist/esm/test-utils/msw-setup.js +88 -0
  30. package/dist/esm/test-utils/obsidian-fetch-adapter.js +51 -0
  31. package/dist/esm/test-utils/test-defaults.js +367 -0
  32. package/dist/esm/test-utils/transport-seam.js +15 -0
  33. package/dist/esm/test-utils/webhook-fixtures.js +26 -0
  34. package/dist/esm/todoist-api.js +1757 -0
  35. package/dist/esm/transport/fetch-with-retry.js +216 -0
  36. package/dist/esm/transport/http-client.js +140 -0
  37. package/dist/esm/transport/http-dispatcher.js +158 -0
  38. package/dist/esm/transport/sync-request.js +106 -0
  39. package/dist/esm/types/activity/index.js +2 -0
  40. package/dist/esm/types/activity/requests.js +1 -0
  41. package/dist/esm/types/activity/types.js +45 -0
  42. package/dist/esm/types/apps/index.js +2 -0
  43. package/dist/esm/types/apps/requests.js +1 -0
  44. package/dist/esm/types/apps/types.js +249 -0
  45. package/dist/esm/types/backups/index.js +2 -0
  46. package/dist/esm/types/backups/requests.js +1 -0
  47. package/dist/esm/types/backups/types.js +5 -0
  48. package/dist/esm/types/billing/index.js +2 -0
  49. package/dist/esm/types/billing/requests.js +1 -0
  50. package/dist/esm/types/billing/types.js +89 -0
  51. package/dist/esm/types/comments/index.js +2 -0
  52. package/dist/esm/types/comments/requests.js +1 -0
  53. package/dist/esm/types/comments/types.js +57 -0
  54. package/dist/esm/types/common.js +7 -0
  55. package/dist/esm/types/emails/index.js +1 -0
  56. package/dist/esm/types/emails/requests.js +2 -0
  57. package/dist/esm/types/errors.js +41 -0
  58. package/dist/esm/types/folders/index.js +1 -0
  59. package/dist/esm/types/folders/requests.js +1 -0
  60. package/dist/esm/types/http.js +20 -0
  61. package/dist/esm/types/id-mappings/index.js +2 -0
  62. package/dist/esm/types/id-mappings/requests.js +17 -0
  63. package/dist/esm/types/id-mappings/types.js +9 -0
  64. package/dist/esm/types/index.js +24 -0
  65. package/dist/esm/types/insights/index.js +2 -0
  66. package/dist/esm/types/insights/requests.js +1 -0
  67. package/dist/esm/types/insights/types.js +77 -0
  68. package/dist/esm/types/labels/index.js +2 -0
  69. package/dist/esm/types/labels/requests.js +1 -0
  70. package/dist/esm/types/labels/types.js +8 -0
  71. package/dist/esm/types/productivity/index.js +1 -0
  72. package/dist/esm/types/productivity/types.js +65 -0
  73. package/dist/esm/types/projects/index.js +2 -0
  74. package/dist/esm/types/projects/requests.js +1 -0
  75. package/dist/esm/types/projects/types.js +65 -0
  76. package/dist/esm/types/reminders/index.js +1 -0
  77. package/dist/esm/types/reminders/requests.js +92 -0
  78. package/dist/esm/types/sections/index.js +2 -0
  79. package/dist/esm/types/sections/requests.js +1 -0
  80. package/dist/esm/types/sections/types.js +23 -0
  81. package/dist/esm/types/sync/commands/calendars.js +1 -0
  82. package/dist/esm/types/sync/commands/filters.js +1 -0
  83. package/dist/esm/types/sync/commands/folders.js +1 -0
  84. package/dist/esm/types/sync/commands/index.js +18 -0
  85. package/dist/esm/types/sync/commands/labels.js +2 -0
  86. package/dist/esm/types/sync/commands/notes.js +1 -0
  87. package/dist/esm/types/sync/commands/notifications.js +1 -0
  88. package/dist/esm/types/sync/commands/others.js +1 -0
  89. package/dist/esm/types/sync/commands/project-view-options.js +1 -0
  90. package/dist/esm/types/sync/commands/projects.js +1 -0
  91. package/dist/esm/types/sync/commands/reminders.js +1 -0
  92. package/dist/esm/types/sync/commands/sections.js +1 -0
  93. package/dist/esm/types/sync/commands/shared.js +16 -0
  94. package/dist/esm/types/sync/commands/sharing.js +1 -0
  95. package/dist/esm/types/sync/commands/tasks.js +1 -0
  96. package/dist/esm/types/sync/commands/view-options.js +1 -0
  97. package/dist/esm/types/sync/commands/workspace-filters.js +1 -0
  98. package/dist/esm/types/sync/commands/workspaces.js +1 -0
  99. package/dist/esm/types/sync/index.js +6 -0
  100. package/dist/esm/types/sync/request.js +1 -0
  101. package/dist/esm/types/sync/resource-types.js +36 -0
  102. package/dist/esm/types/sync/resources/calendars.js +24 -0
  103. package/dist/esm/types/sync/resources/collaborators.js +21 -0
  104. package/dist/esm/types/sync/resources/completed-info.js +21 -0
  105. package/dist/esm/types/sync/resources/filters.js +12 -0
  106. package/dist/esm/types/sync/resources/folders.js +10 -0
  107. package/dist/esm/types/sync/resources/index.js +18 -0
  108. package/dist/esm/types/sync/resources/labels.js +7 -0
  109. package/dist/esm/types/sync/resources/live-notifications.js +35 -0
  110. package/dist/esm/types/sync/resources/notes.js +18 -0
  111. package/dist/esm/types/sync/resources/reminders.js +58 -0
  112. package/dist/esm/types/sync/resources/suggestions.js +33 -0
  113. package/dist/esm/types/sync/resources/tooltips.js +5 -0
  114. package/dist/esm/types/sync/resources/user-plan-limits.js +21 -0
  115. package/dist/esm/types/sync/resources/user-settings.js +41 -0
  116. package/dist/esm/types/sync/resources/user-status.js +22 -0
  117. package/dist/esm/types/sync/resources/user.js +109 -0
  118. package/dist/esm/types/sync/resources/view-options.js +128 -0
  119. package/dist/esm/types/sync/resources/workspace-filters.js +17 -0
  120. package/dist/esm/types/sync/resources/workspaces.js +69 -0
  121. package/dist/esm/types/sync/response.js +57 -0
  122. package/dist/esm/types/sync/user-preferences.js +68 -0
  123. package/dist/esm/types/tasks/index.js +2 -0
  124. package/dist/esm/types/tasks/requests.js +1 -0
  125. package/dist/esm/types/tasks/types.js +56 -0
  126. package/dist/esm/types/templates/index.js +1 -0
  127. package/dist/esm/types/templates/requests.js +1 -0
  128. package/dist/esm/types/ui-extensions/index.js +2 -0
  129. package/dist/esm/types/ui-extensions/requests.js +1 -0
  130. package/dist/esm/types/ui-extensions/types.js +74 -0
  131. package/dist/esm/types/uploads/index.js +1 -0
  132. package/dist/esm/types/uploads/requests.js +1 -0
  133. package/dist/esm/types/users/index.js +1 -0
  134. package/dist/esm/types/users/types.js +49 -0
  135. package/dist/esm/types/webhooks/comments.js +93 -0
  136. package/dist/esm/types/webhooks/envelope.js +23 -0
  137. package/dist/esm/types/webhooks/filters.js +27 -0
  138. package/dist/esm/types/webhooks/index.js +9 -0
  139. package/dist/esm/types/webhooks/labels.js +51 -0
  140. package/dist/esm/types/webhooks/projects.js +33 -0
  141. package/dist/esm/types/webhooks/reminders.js +32 -0
  142. package/dist/esm/types/webhooks/sections.js +50 -0
  143. package/dist/esm/types/webhooks/tasks.js +65 -0
  144. package/dist/esm/types/webhooks/types.js +52 -0
  145. package/dist/esm/types/workspaces/index.js +2 -0
  146. package/dist/esm/types/workspaces/requests.js +1 -0
  147. package/dist/esm/types/workspaces/types.js +151 -0
  148. package/dist/esm/utils/activity-helpers.js +53 -0
  149. package/dist/esm/utils/case-conversion.js +84 -0
  150. package/dist/esm/utils/colors.js +145 -0
  151. package/dist/esm/utils/file-response.js +29 -0
  152. package/dist/esm/utils/filter-queries.js +231 -0
  153. package/dist/esm/utils/filter-query-definitions.js +2789 -0
  154. package/dist/esm/utils/headers.js +42 -0
  155. package/dist/esm/utils/index.js +11 -0
  156. package/dist/esm/utils/multipart-upload.js +267 -0
  157. package/dist/esm/utils/person-names.js +61 -0
  158. package/dist/esm/utils/processing-helpers.js +12 -0
  159. package/dist/esm/utils/project-helpers.js +29 -0
  160. package/dist/esm/utils/request-helpers.js +43 -0
  161. package/dist/esm/utils/sanitization.js +131 -0
  162. package/dist/esm/utils/sync-helpers.js +19 -0
  163. package/dist/esm/utils/task-sorting.js +280 -0
  164. package/dist/esm/utils/uncompletable-helpers.js +54 -0
  165. package/dist/esm/utils/url-helpers.js +196 -0
  166. package/dist/esm/utils/validators.js +102 -0
  167. package/dist/esm/utils/view-options.js +15 -0
  168. package/dist/esm/utils/webhook-parser.js +56 -0
  169. package/dist/types/authentication.d.ts +262 -0
  170. package/dist/types/clients/activity-client.d.ts +12 -0
  171. package/dist/types/clients/app-client.d.ts +37 -0
  172. package/dist/types/clients/backup-client.d.ts +14 -0
  173. package/dist/types/clients/base-client.d.ts +23 -0
  174. package/dist/types/clients/billing-client.d.ts +22 -0
  175. package/dist/types/clients/comment-client.d.ts +15 -0
  176. package/dist/types/clients/email-client.d.ts +13 -0
  177. package/dist/types/clients/filter-client.d.ts +10 -0
  178. package/dist/types/clients/folder-client.d.ts +16 -0
  179. package/dist/types/clients/id-mapping-client.d.ts +13 -0
  180. package/dist/types/clients/insights-client.d.ts +18 -0
  181. package/dist/types/clients/label-client.d.ts +19 -0
  182. package/dist/types/clients/productivity-client.d.ts +12 -0
  183. package/dist/types/clients/project-client.d.ts +22 -0
  184. package/dist/types/clients/reminder-client.d.ts +25 -0
  185. package/dist/types/clients/section-client.d.ts +18 -0
  186. package/dist/types/clients/task-client.d.ts +25 -0
  187. package/dist/types/clients/template-client.d.ts +17 -0
  188. package/dist/types/clients/ui-extension-client.d.ts +18 -0
  189. package/dist/types/clients/upload-client.d.ts +17 -0
  190. package/dist/types/clients/view-options-client.d.ts +8 -0
  191. package/dist/types/clients/workspace-client.d.ts +43 -0
  192. package/dist/types/consts/endpoints.d.ts +120 -0
  193. package/dist/types/index.d.ts +6 -0
  194. package/dist/types/test-utils/asserts.d.ts +1 -0
  195. package/dist/types/test-utils/msw-setup.d.ts +33 -0
  196. package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +29 -0
  197. package/dist/types/test-utils/test-defaults.d.ts +286 -0
  198. package/dist/types/test-utils/transport-seam.d.ts +1 -0
  199. package/dist/types/test-utils/webhook-fixtures.d.ts +13 -0
  200. package/dist/types/todoist-api.d.ts +1437 -0
  201. package/dist/types/transport/fetch-with-retry.d.ts +12 -0
  202. package/dist/types/transport/http-client.d.ts +25 -0
  203. package/dist/types/transport/http-dispatcher.d.ts +65 -0
  204. package/dist/types/transport/sync-request.d.ts +31 -0
  205. package/dist/types/types/activity/index.d.ts +2 -0
  206. package/dist/types/types/activity/requests.d.ts +85 -0
  207. package/dist/types/types/activity/types.d.ts +56 -0
  208. package/dist/types/types/apps/index.d.ts +2 -0
  209. package/dist/types/types/apps/requests.d.ts +89 -0
  210. package/dist/types/types/apps/types.d.ts +418 -0
  211. package/dist/types/types/backups/index.d.ts +2 -0
  212. package/dist/types/types/backups/requests.d.ts +16 -0
  213. package/dist/types/types/backups/types.d.ts +7 -0
  214. package/dist/types/types/billing/index.d.ts +2 -0
  215. package/dist/types/types/billing/requests.d.ts +62 -0
  216. package/dist/types/types/billing/types.d.ts +207 -0
  217. package/dist/types/types/comments/index.d.ts +2 -0
  218. package/dist/types/types/comments/requests.d.ts +64 -0
  219. package/dist/types/types/comments/types.d.ts +141 -0
  220. package/dist/types/types/common.d.ts +13 -0
  221. package/dist/types/types/emails/index.d.ts +1 -0
  222. package/dist/types/types/emails/requests.d.ts +30 -0
  223. package/dist/types/types/errors.d.ts +29 -0
  224. package/dist/types/types/folders/index.d.ts +1 -0
  225. package/dist/types/types/folders/requests.d.ts +20 -0
  226. package/dist/types/types/http.d.ts +104 -0
  227. package/dist/types/types/id-mappings/index.d.ts +2 -0
  228. package/dist/types/types/id-mappings/requests.d.ts +28 -0
  229. package/dist/types/types/id-mappings/types.d.ts +13 -0
  230. package/dist/types/types/index.d.ts +24 -0
  231. package/dist/types/types/insights/index.d.ts +2 -0
  232. package/dist/types/types/insights/requests.d.ts +26 -0
  233. package/dist/types/types/insights/types.d.ts +167 -0
  234. package/dist/types/types/labels/index.d.ts +2 -0
  235. package/dist/types/types/labels/requests.d.ts +75 -0
  236. package/dist/types/types/labels/types.d.ts +13 -0
  237. package/dist/types/types/productivity/index.d.ts +1 -0
  238. package/dist/types/types/productivity/types.d.ts +115 -0
  239. package/dist/types/types/projects/index.d.ts +2 -0
  240. package/dist/types/types/projects/requests.d.ts +206 -0
  241. package/dist/types/types/projects/types.d.ts +286 -0
  242. package/dist/types/types/reminders/index.d.ts +1 -0
  243. package/dist/types/types/reminders/requests.d.ts +205 -0
  244. package/dist/types/types/sections/index.d.ts +2 -0
  245. package/dist/types/types/sections/requests.d.ts +49 -0
  246. package/dist/types/types/sections/types.d.ts +70 -0
  247. package/dist/types/types/sync/commands/calendars.d.ts +14 -0
  248. package/dist/types/types/sync/commands/filters.d.ts +24 -0
  249. package/dist/types/types/sync/commands/folders.d.ts +20 -0
  250. package/dist/types/types/sync/commands/index.d.ts +167 -0
  251. package/dist/types/types/sync/commands/labels.d.ts +32 -0
  252. package/dist/types/types/sync/commands/notes.d.ts +27 -0
  253. package/dist/types/types/sync/commands/notifications.d.ts +10 -0
  254. package/dist/types/types/sync/commands/others.d.ts +61 -0
  255. package/dist/types/types/sync/commands/project-view-options.d.ts +13 -0
  256. package/dist/types/types/sync/commands/projects.d.ts +96 -0
  257. package/dist/types/types/sync/commands/reminders.d.ts +51 -0
  258. package/dist/types/types/sync/commands/sections.d.ts +36 -0
  259. package/dist/types/types/sync/commands/shared.d.ts +51 -0
  260. package/dist/types/types/sync/commands/sharing.d.ts +16 -0
  261. package/dist/types/types/sync/commands/tasks.d.ts +78 -0
  262. package/dist/types/types/sync/commands/view-options.d.ts +18 -0
  263. package/dist/types/types/sync/commands/workspace-filters.d.ts +25 -0
  264. package/dist/types/types/sync/commands/workspaces.d.ts +82 -0
  265. package/dist/types/types/sync/index.d.ts +6 -0
  266. package/dist/types/types/sync/request.d.ts +7 -0
  267. package/dist/types/types/sync/resource-types.d.ts +5 -0
  268. package/dist/types/types/sync/resources/calendars.d.ts +38 -0
  269. package/dist/types/types/sync/resources/collaborators.d.ts +45 -0
  270. package/dist/types/types/sync/resources/completed-info.d.ts +33 -0
  271. package/dist/types/types/sync/resources/filters.d.ts +13 -0
  272. package/dist/types/types/sync/resources/folders.d.ts +11 -0
  273. package/dist/types/types/sync/resources/index.d.ts +18 -0
  274. package/dist/types/types/sync/resources/labels.d.ts +12 -0
  275. package/dist/types/types/sync/resources/live-notifications.d.ts +32 -0
  276. package/dist/types/types/sync/resources/notes.d.ts +34 -0
  277. package/dist/types/types/sync/resources/reminders.d.ts +213 -0
  278. package/dist/types/types/sync/resources/suggestions.d.ts +96 -0
  279. package/dist/types/types/sync/resources/tooltips.d.ts +6 -0
  280. package/dist/types/types/sync/resources/user-plan-limits.d.ts +47 -0
  281. package/dist/types/types/sync/resources/user-settings.d.ts +40 -0
  282. package/dist/types/types/sync/resources/user-status.d.ts +46 -0
  283. package/dist/types/types/sync/resources/user.d.ts +151 -0
  284. package/dist/types/types/sync/resources/view-options.d.ts +157 -0
  285. package/dist/types/types/sync/resources/workspace-filters.d.ts +18 -0
  286. package/dist/types/types/sync/resources/workspaces.d.ts +142 -0
  287. package/dist/types/types/sync/response.d.ts +930 -0
  288. package/dist/types/types/sync/user-preferences.d.ts +39 -0
  289. package/dist/types/types/tasks/index.d.ts +2 -0
  290. package/dist/types/types/tasks/requests.d.ts +197 -0
  291. package/dist/types/types/tasks/types.d.ts +162 -0
  292. package/dist/types/types/templates/index.d.ts +1 -0
  293. package/dist/types/types/templates/requests.d.ts +92 -0
  294. package/dist/types/types/ui-extensions/index.d.ts +2 -0
  295. package/dist/types/types/ui-extensions/requests.d.ts +108 -0
  296. package/dist/types/types/ui-extensions/types.d.ts +185 -0
  297. package/dist/types/types/uploads/index.d.ts +1 -0
  298. package/dist/types/types/uploads/requests.d.ts +32 -0
  299. package/dist/types/types/users/index.d.ts +1 -0
  300. package/dist/types/types/users/types.d.ts +67 -0
  301. package/dist/types/types/webhooks/comments.d.ts +1600 -0
  302. package/dist/types/types/webhooks/envelope.d.ts +34 -0
  303. package/dist/types/types/webhooks/filters.d.ts +99 -0
  304. package/dist/types/types/webhooks/index.d.ts +9 -0
  305. package/dist/types/types/webhooks/labels.d.ts +160 -0
  306. package/dist/types/types/webhooks/projects.d.ts +365 -0
  307. package/dist/types/types/webhooks/reminders.d.ts +82 -0
  308. package/dist/types/types/webhooks/sections.d.ts +372 -0
  309. package/dist/types/types/webhooks/tasks.d.ts +981 -0
  310. package/dist/types/types/webhooks/types.d.ts +2606 -0
  311. package/dist/types/types/workspaces/index.d.ts +2 -0
  312. package/dist/types/types/workspaces/requests.d.ts +260 -0
  313. package/dist/types/types/workspaces/types.d.ts +266 -0
  314. package/dist/types/utils/activity-helpers.d.ts +28 -0
  315. package/dist/types/utils/case-conversion.d.ts +20 -0
  316. package/dist/types/utils/colors.d.ts +201 -0
  317. package/dist/types/utils/file-response.d.ts +15 -0
  318. package/dist/types/utils/filter-queries.d.ts +42 -0
  319. package/dist/types/utils/filter-query-definitions.d.ts +27 -0
  320. package/dist/types/utils/headers.d.ts +20 -0
  321. package/dist/types/utils/index.d.ts +15 -0
  322. package/dist/types/utils/multipart-upload.d.ts +58 -0
  323. package/dist/types/utils/person-names.d.ts +52 -0
  324. package/dist/types/utils/processing-helpers.d.ts +1 -0
  325. package/dist/types/utils/project-helpers.d.ts +21 -0
  326. package/dist/types/utils/request-helpers.d.ts +33 -0
  327. package/dist/types/utils/sanitization.d.ts +52 -0
  328. package/dist/types/utils/sync-helpers.d.ts +17 -0
  329. package/dist/types/utils/task-sorting.d.ts +46 -0
  330. package/dist/types/utils/uncompletable-helpers.d.ts +30 -0
  331. package/dist/types/utils/url-helpers.d.ts +120 -0
  332. package/dist/types/utils/validators.d.ts +1917 -0
  333. package/dist/types/utils/view-options.d.ts +11 -0
  334. package/dist/types/utils/webhook-parser.d.ts +48 -0
  335. package/package.json +87 -8
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ import { BooleanFromZeroOneSchema, DayOfWeekSchema } from '../sync/user-preferences.js';
3
+ export const StreakSchema = z.object({
4
+ count: z.number(),
5
+ start: z.string(),
6
+ end: z.string(),
7
+ });
8
+ export const CompletedItemSchema = z.object({
9
+ id: z.string(),
10
+ completed: z.number(),
11
+ });
12
+ export const ItemsWithDateSchema = z.object({
13
+ items: z.array(CompletedItemSchema),
14
+ totalCompleted: z.number(),
15
+ });
16
+ export const KarmaUpdateSchema = z.object({
17
+ time: z.string(),
18
+ newKarma: z.number(),
19
+ positiveKarma: z.number(),
20
+ negativeKarma: z.number(),
21
+ positiveKarmaReasons: z.array(z.any()),
22
+ negativeKarmaReasons: z.array(z.any()),
23
+ });
24
+ export const ProductivityStatsSchema = z.object({
25
+ completedCount: z.number(),
26
+ daysItems: z.array(ItemsWithDateSchema.extend({
27
+ date: z.string(),
28
+ })),
29
+ goals: z.object({
30
+ currentDailyStreak: StreakSchema,
31
+ currentWeeklyStreak: StreakSchema,
32
+ dailyGoal: z.number(),
33
+ ignoreDays: z.array(DayOfWeekSchema),
34
+ karmaDisabled: BooleanFromZeroOneSchema,
35
+ lastDailyStreak: StreakSchema,
36
+ lastWeeklyStreak: StreakSchema,
37
+ maxDailyStreak: StreakSchema,
38
+ maxWeeklyStreak: StreakSchema,
39
+ user: z.string(),
40
+ userId: z.string(),
41
+ vacationMode: BooleanFromZeroOneSchema,
42
+ weeklyGoal: z.number(),
43
+ }),
44
+ karma: z.number(),
45
+ karmaGraphData: z.array(z.object({
46
+ date: z.string(),
47
+ karmaAvg: z.number(),
48
+ })),
49
+ karmaLastUpdate: z.number(),
50
+ karmaTrend: z.string(),
51
+ karmaUpdateReasons: z.array(KarmaUpdateSchema),
52
+ projectColors: z.record(z.string(), z.string()),
53
+ weekItems: z.array(ItemsWithDateSchema.extend({
54
+ from: z.string(),
55
+ to: z.string(),
56
+ })),
57
+ });
58
+ export const ColorSchema = z.object({
59
+ /** The key of the color (i.e. 'berry_red') */
60
+ key: z.string(),
61
+ /** The display name of the color (i.e. 'Berry Red') */
62
+ displayName: z.string(),
63
+ /** The hex value of the color (i.e. '#b8255f') */
64
+ hexValue: z.string(),
65
+ });
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
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
+ orderKey: z.string().nullable().optional(),
12
+ color: z.string(),
13
+ createdAt: z.coerce.date().nullable(),
14
+ isArchived: z.boolean(),
15
+ isDeleted: z.boolean(),
16
+ isFavorite: z.boolean(),
17
+ isFrozen: z.boolean(),
18
+ name: z.string(),
19
+ updatedAt: z.coerce.date().nullable(),
20
+ viewStyle: z.string(),
21
+ defaultOrder: z.number().int(),
22
+ defaultOrderKey: z.string().nullable().optional(),
23
+ description: z.string(),
24
+ isCollapsed: z.boolean(),
25
+ isShared: z.boolean(),
26
+ });
27
+ /**
28
+ * Schema for personal projects in Todoist.
29
+ */
30
+ export const PersonalProjectSchema = BaseProjectSchema.extend({
31
+ parentId: z.string().nullable(),
32
+ inboxProject: z.boolean().optional().default(false),
33
+ }).transform((data) => {
34
+ return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
35
+ });
36
+ /** Available project visibility levels. */
37
+ export const PROJECT_VISIBILITIES = ['restricted', 'team', 'public'];
38
+ export const ProjectVisibilitySchema = z.enum(PROJECT_VISIBILITIES);
39
+ /**
40
+ * Schema for workspace projects in Todoist.
41
+ */
42
+ export const WorkspaceProjectSchema = BaseProjectSchema.extend({
43
+ access: z.object({ visibility: ProjectVisibilitySchema }).optional(),
44
+ collaboratorRoleDefault: z.string(),
45
+ folderId: z.string().nullable(),
46
+ isInviteOnly: z.boolean().nullable(),
47
+ isLinkSharingEnabled: z.boolean(),
48
+ role: z.string().nullable(),
49
+ status: z.string(),
50
+ workspaceId: z.string(),
51
+ }).transform((data) => {
52
+ return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
53
+ });
54
+ /**
55
+ * Schema for any project type in Todoist (personal or workspace).
56
+ * Dispatches to WorkspaceProjectSchema when workspaceId is present, PersonalProjectSchema otherwise.
57
+ */
58
+ export const ProjectSchema = z.unknown().transform((val) => {
59
+ if (typeof val === 'object' && val !== null && 'workspaceId' in val) {
60
+ return WorkspaceProjectSchema.parse(val);
61
+ }
62
+ return PersonalProjectSchema.parse(val);
63
+ });
64
+ /** Available project view styles. */
65
+ export const PROJECT_VIEW_STYLES = ['list', 'board', 'calendar', 'table'];
@@ -0,0 +1 @@
1
+ export * from './requests.js';
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+ import { LOCATION_TRIGGERS, ReminderTypeEnum } from '../sync/resources/reminders.js';
3
+ import { DueDateSchema } from '../tasks/types.js';
4
+ /** Available reminder delivery services. */
5
+ export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
6
+ export const ReminderDeliveryServiceSchema = z.enum(REMINDER_DELIVERY_SERVICES);
7
+ export const ReminderIdSchema = z.string();
8
+ export const ReminderDueDateSchema = DueDateSchema.pick({
9
+ date: true,
10
+ string: true,
11
+ timezone: true,
12
+ lang: true,
13
+ isRecurring: true,
14
+ })
15
+ .partial()
16
+ .strict();
17
+ // ── Add schemas ──────────────────────────────────────────────────────
18
+ export const AddRelativeReminderArgsSchema = z
19
+ .object({
20
+ taskId: z.string(),
21
+ reminderType: z.literal(ReminderTypeEnum.Relative).optional(),
22
+ minuteOffset: z.number().int(),
23
+ service: ReminderDeliveryServiceSchema.optional(),
24
+ notifyUid: z.string().optional(),
25
+ isUrgent: z.boolean().optional(),
26
+ })
27
+ .strict();
28
+ export const AddAbsoluteReminderArgsSchema = z
29
+ .object({
30
+ taskId: z.string(),
31
+ reminderType: z.literal(ReminderTypeEnum.Absolute),
32
+ due: ReminderDueDateSchema,
33
+ service: ReminderDeliveryServiceSchema.optional(),
34
+ notifyUid: z.string().optional(),
35
+ isUrgent: z.boolean().optional(),
36
+ })
37
+ .strict();
38
+ export const AddReminderArgsSchema = z.union([
39
+ AddRelativeReminderArgsSchema,
40
+ AddAbsoluteReminderArgsSchema,
41
+ ]);
42
+ export const AddLocationReminderArgsSchema = z
43
+ .object({
44
+ taskId: z.string(),
45
+ notifyUid: z.string().optional(),
46
+ name: z.string(),
47
+ locLat: z.string(),
48
+ locLong: z.string(),
49
+ locTrigger: z.enum(LOCATION_TRIGGERS),
50
+ radius: z.number().int().optional(),
51
+ })
52
+ .strict();
53
+ // ── Update schemas ───────────────────────────────────────────────────
54
+ export const UpdateRelativeReminderArgsSchema = z
55
+ .object({
56
+ reminderType: z.literal(ReminderTypeEnum.Relative),
57
+ minuteOffset: z.number().int().optional(),
58
+ notifyUid: z.string().optional(),
59
+ service: ReminderDeliveryServiceSchema.optional(),
60
+ isUrgent: z.boolean().optional(),
61
+ })
62
+ .strict();
63
+ export const UpdateAbsoluteReminderArgsSchema = z
64
+ .object({
65
+ reminderType: z.literal(ReminderTypeEnum.Absolute),
66
+ due: ReminderDueDateSchema.optional(),
67
+ notifyUid: z.string().optional(),
68
+ service: ReminderDeliveryServiceSchema.optional(),
69
+ isUrgent: z.boolean().optional(),
70
+ })
71
+ .strict();
72
+ export const UpdateReminderArgsSchema = z
73
+ .discriminatedUnion('reminderType', [
74
+ UpdateRelativeReminderArgsSchema,
75
+ UpdateAbsoluteReminderArgsSchema,
76
+ ])
77
+ .refine((args) => Object.entries(args).some(([key, value]) => key !== 'reminderType' && value !== undefined), {
78
+ message: 'At least one reminder field must be provided to updateReminder',
79
+ });
80
+ export const UpdateLocationReminderArgsSchema = z
81
+ .object({
82
+ notifyUid: z.string().optional(),
83
+ name: z.string().optional(),
84
+ locLat: z.string().optional(),
85
+ locLong: z.string().optional(),
86
+ locTrigger: z.enum(LOCATION_TRIGGERS).optional(),
87
+ radius: z.number().int().optional(),
88
+ })
89
+ .strict()
90
+ .refine((args) => Object.values(args).some((value) => value !== undefined), {
91
+ message: 'At least one reminder field must be provided to updateLocationReminder',
92
+ });
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { getSectionUrl } from '../../utils/url-helpers.js';
3
+ /**
4
+ * Raw section fields (the persisted shape). Exposed so schemas that extend
5
+ * or override a field — notably the webhook variant — can reuse the base
6
+ * without duplicating every field.
7
+ */
8
+ export const SectionBaseSchema = z.object({
9
+ id: z.string(),
10
+ userId: z.string(),
11
+ projectId: z.string(),
12
+ addedAt: z.coerce.date(),
13
+ updatedAt: z.coerce.date(),
14
+ archivedAt: z.coerce.date().nullable(),
15
+ name: z.string(),
16
+ description: z.string().nullable(),
17
+ sectionOrder: z.number().int(),
18
+ orderKey: z.string().nullable().optional(),
19
+ isArchived: z.boolean(),
20
+ isDeleted: z.boolean(),
21
+ isCollapsed: z.boolean(),
22
+ });
23
+ export const SectionSchema = SectionBaseSchema.transform((data) => (Object.assign(Object.assign({}, data), { url: getSectionUrl(data.id, data.name) })));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ // Re-export all domain types
2
+ export * from './shared.js';
3
+ export * from './tasks.js';
4
+ export * from './projects.js';
5
+ export * from './sections.js';
6
+ export * from './labels.js';
7
+ export * from './filters.js';
8
+ export * from './notes.js';
9
+ export * from './reminders.js';
10
+ export * from './workspaces.js';
11
+ export * from './folders.js';
12
+ export * from './workspace-filters.js';
13
+ export * from './notifications.js';
14
+ export * from './sharing.js';
15
+ export * from './view-options.js';
16
+ export * from './project-view-options.js';
17
+ export * from './calendars.js';
18
+ export * from './others.js';
@@ -0,0 +1,2 @@
1
+ /** Available label delete cascade modes. */
2
+ export const LABEL_DELETE_CASCADE_MODES = ['none', 'all'];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared types used across multiple Sync API command argument types.
3
+ */
4
+ /** Available project workflow statuses. */
5
+ export const PROJECT_STATUSES = [
6
+ 'PLANNED',
7
+ 'IN_PROGRESS',
8
+ 'PAUSED',
9
+ 'COMPLETED',
10
+ 'CANCELED',
11
+ ];
12
+ export { COLLABORATOR_ROLES } from '../../workspaces/types.js';
13
+ /** Available reminder notification services. */
14
+ export const REMINDER_SERVICES = ['default', 'email', 'mobile', 'push', 'no_default'];
15
+ /** Available workspace project sort orders. */
16
+ export const WORKSPACE_PROJECT_SORT_ORDERS = ['MANUAL', 'A_TO_Z', 'Z_TO_A'];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './commands/index.js';
2
+ export * from './resources/index.js';
3
+ export * from './resource-types.js';
4
+ export * from './request.js';
5
+ export * from './response.js';
6
+ export * from './user-preferences.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * All available Sync API resource types.
3
+ */
4
+ export const SYNC_RESOURCE_TYPES = [
5
+ 'labels',
6
+ 'projects',
7
+ 'items',
8
+ 'notes',
9
+ 'project_notes',
10
+ 'sections',
11
+ 'filters',
12
+ 'reminders',
13
+ 'reminders_location',
14
+ 'locations',
15
+ 'user',
16
+ 'live_notifications',
17
+ 'collaborators',
18
+ 'collaborator_states',
19
+ 'user_settings',
20
+ 'notification_settings',
21
+ 'user_plan_limits',
22
+ 'completed_info',
23
+ 'stats',
24
+ 'workspaces',
25
+ 'workspace_users',
26
+ 'workspace_filters',
27
+ 'view_options',
28
+ 'project_view_options_defaults',
29
+ 'role_actions',
30
+ 'folders',
31
+ 'day_orders',
32
+ 'calendars',
33
+ 'calendar_accounts',
34
+ 'suggestions',
35
+ 'tooltips',
36
+ ];
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export const CalendarSchema = z.looseObject({
3
+ id: z.string(),
4
+ summary: z.string(),
5
+ color: z.string().nullable(),
6
+ accountId: z.string(),
7
+ isVisible: z.boolean(),
8
+ isTaskCalendar: z.boolean().optional(),
9
+ });
10
+ /** Available calendar account provider types. */
11
+ export const CALENDAR_ACCOUNT_TYPES = ['google', 'microsoft', 'apple'];
12
+ /** Available calendar sync states. */
13
+ export const CALENDAR_SYNC_STATES = ['synced', 'syncing', 'error'];
14
+ export const CalendarAccountSchema = z.looseObject({
15
+ id: z.string(),
16
+ name: z.string(),
17
+ type: z.enum(CALENDAR_ACCOUNT_TYPES),
18
+ isDeleted: z.boolean().optional(),
19
+ isEventsEnabled: z.boolean().optional(),
20
+ isTasksEnabled: z.boolean().optional(),
21
+ isAllDayTasksEnabled: z.boolean().optional(),
22
+ pendingOperationUntil: z.string().nullable().optional(),
23
+ calendarsSyncState: z.enum(CALENDAR_SYNC_STATES).optional(),
24
+ });
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { WorkspaceRoleSchema } from '../../workspaces/types.js';
3
+ import { UserStatusSchema } from './user-status.js';
4
+ export const CollaboratorSchema = z.looseObject({
5
+ id: z.string(),
6
+ email: z.string(),
7
+ fullName: z.string(),
8
+ timezone: z.string(),
9
+ imageId: z.string().nullable(),
10
+ /** The collaborator's shared status. Not related to {@link CollaboratorStatus}. */
11
+ status: UserStatusSchema.nullish(),
12
+ });
13
+ /** Available collaborator statuses. */
14
+ export const COLLABORATOR_STATUSES = ['active', 'invited'];
15
+ export const CollaboratorStateSchema = z.looseObject({
16
+ userId: z.string(),
17
+ projectId: z.string(),
18
+ state: z.enum(COLLABORATOR_STATUSES),
19
+ isDeleted: z.boolean(),
20
+ workspaceRole: WorkspaceRoleSchema.optional(),
21
+ });
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ export const CompletedProjectMetadataSchema = z.looseObject({
3
+ projectId: z.string(),
4
+ archivedSections: z.number().int(),
5
+ completedItems: z.number().int(),
6
+ });
7
+ export const CompletedSectionMetadataSchema = z.looseObject({
8
+ sectionId: z.string(),
9
+ id: z.string(),
10
+ completedItems: z.number().int(),
11
+ });
12
+ export const CompletedTaskMetadataSchema = z.looseObject({
13
+ itemId: z.string(),
14
+ id: z.string().optional(),
15
+ completedItems: z.number().int(),
16
+ });
17
+ export const CompletedInfoSchema = z.union([
18
+ CompletedProjectMetadataSchema,
19
+ CompletedSectionMetadataSchema,
20
+ CompletedTaskMetadataSchema,
21
+ ]);
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export const FilterSchema = z.looseObject({
3
+ id: z.string(),
4
+ name: z.string(),
5
+ query: z.string(),
6
+ description: z.string().nullish(),
7
+ color: z.string(),
8
+ isDeleted: z.boolean(),
9
+ isFavorite: z.boolean(),
10
+ isFrozen: z.boolean(),
11
+ itemOrder: z.number().int(),
12
+ });
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export const FolderSchema = z.looseObject({
3
+ id: z.string(),
4
+ name: z.string(),
5
+ workspaceId: z.string(),
6
+ isDeleted: z.boolean(),
7
+ defaultOrder: z.number().int(),
8
+ defaultOrderKey: z.string().nullable().optional(),
9
+ childOrder: z.number().int(),
10
+ });
@@ -0,0 +1,18 @@
1
+ export * from './filters.js';
2
+ export * from './labels.js';
3
+ export * from './collaborators.js';
4
+ export * from './folders.js';
5
+ export * from './tooltips.js';
6
+ export * from './notes.js';
7
+ export * from './workspace-filters.js';
8
+ export * from './calendars.js';
9
+ export * from './reminders.js';
10
+ export * from './completed-info.js';
11
+ export * from './view-options.js';
12
+ export * from './user-plan-limits.js';
13
+ export * from './live-notifications.js';
14
+ export * from './workspaces.js';
15
+ export * from './user.js';
16
+ export * from './user-settings.js';
17
+ export * from './user-status.js';
18
+ export * from './suggestions.js';
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { LabelSchema } from '../../labels/types.js';
3
+ /** A label returned by the Sync API. */
4
+ export const SyncLabelSchema = LabelSchema.extend({
5
+ order: z.number().int().nullable().optional(),
6
+ isDeleted: z.boolean().optional(),
7
+ });
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { StringOrNumberSchema } from '../../common.js';
3
+ /**
4
+ * Live notification resource from the Sync API.
5
+ *
6
+ * Uses a loose object schema with commonly-present fields for forward
7
+ * compatibility. The Sync API returns 20+ notification variants; fully typing
8
+ * each is too fragile for a library, so we validate the common shape and
9
+ * preserve all extra fields.
10
+ */
11
+ export const LiveNotificationSchema = z.looseObject({
12
+ id: z.string(),
13
+ createdAt: z.coerce.date(),
14
+ fromUid: z.string().optional(),
15
+ notificationType: z.string(),
16
+ isUnread: z.boolean(),
17
+ // Commonly present optional fields
18
+ projectId: z.string().optional(),
19
+ invitationId: z.string().optional(),
20
+ itemId: z.string().optional(),
21
+ itemContent: z.string().optional(),
22
+ responsibleUid: z.string().nullable().optional(),
23
+ assignedByUid: z.string().nullable().optional(),
24
+ fromUser: z
25
+ .object({
26
+ email: z.string(),
27
+ fullName: z.string(),
28
+ id: StringOrNumberSchema,
29
+ imageId: z.string().nullable(),
30
+ })
31
+ .optional(),
32
+ projectName: z.string().optional(),
33
+ isDeleted: z.boolean().optional(),
34
+ invitationSecret: z.string().optional(),
35
+ });
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { AttachmentSchema } from '../../comments/types.js';
3
+ /**
4
+ * Sync API note (comment) resource.
5
+ * Separate from the REST `CommentSchema` which transforms `itemId` to `taskId`.
6
+ */
7
+ export const NoteSchema = z.looseObject({
8
+ id: z.string(),
9
+ itemId: z.string().optional(),
10
+ projectId: z.string().optional(),
11
+ content: z.string(),
12
+ postedAt: z.coerce.date(),
13
+ fileAttachment: AttachmentSchema.nullable(),
14
+ postedUid: z.string(),
15
+ uidsToNotify: z.array(z.string()).nullable(),
16
+ reactions: z.record(z.string(), z.array(z.string())).nullable(),
17
+ isDeleted: z.boolean(),
18
+ });
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ import { DueDateSchema } from '../../tasks/types.js';
3
+ export const ReminderBaseSchema = z.looseObject({
4
+ id: z.string(),
5
+ notifyUid: z.string(),
6
+ itemId: z.string(),
7
+ projectId: z.string().optional(),
8
+ isDeleted: z.boolean(),
9
+ });
10
+ /** Enum-like object of reminder type values. */
11
+ export const ReminderTypeEnum = {
12
+ Relative: 'relative',
13
+ Absolute: 'absolute',
14
+ Location: 'location',
15
+ };
16
+ /** Available reminder types. */
17
+ export const REMINDER_TYPES = [
18
+ ReminderTypeEnum.Relative,
19
+ ReminderTypeEnum.Absolute,
20
+ ReminderTypeEnum.Location,
21
+ ];
22
+ /** Available location reminder triggers. */
23
+ export const LOCATION_TRIGGERS = ['on_enter', 'on_leave'];
24
+ export const LocationReminderSchema = ReminderBaseSchema.extend({
25
+ type: z.literal(ReminderTypeEnum.Location),
26
+ name: z.string(),
27
+ locLat: z.string(),
28
+ locLong: z.string(),
29
+ locTrigger: z.enum(LOCATION_TRIGGERS),
30
+ radius: z.number().int(),
31
+ });
32
+ export const AbsoluteReminderSchema = ReminderBaseSchema.extend({
33
+ type: z.literal(ReminderTypeEnum.Absolute),
34
+ due: DueDateSchema,
35
+ isUrgent: z.boolean().optional(),
36
+ });
37
+ export const RelativeReminderSchema = ReminderBaseSchema.extend({
38
+ type: z.literal(ReminderTypeEnum.Relative),
39
+ minuteOffset: z.number().int(),
40
+ due: DueDateSchema.optional(),
41
+ isUrgent: z.boolean().optional(),
42
+ });
43
+ export const ReminderSchema = z.discriminatedUnion('type', [
44
+ LocationReminderSchema,
45
+ AbsoluteReminderSchema,
46
+ RelativeReminderSchema,
47
+ ]);
48
+ export const SyncAbsoluteReminderSchema = AbsoluteReminderSchema.extend({
49
+ due: DueDateSchema.nullable(),
50
+ });
51
+ export const SyncRelativeReminderSchema = RelativeReminderSchema.extend({
52
+ due: DueDateSchema.nullable().optional(),
53
+ });
54
+ export const SyncReminderSchema = z.discriminatedUnion('type', [
55
+ LocationReminderSchema,
56
+ SyncAbsoluteReminderSchema,
57
+ SyncRelativeReminderSchema,
58
+ ]);