@todoist/sdk 0.0.1 → 19.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 +368 -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 +255 -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 +99 -0
  210. package/dist/types/types/apps/types.d.ts +450 -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 +1922 -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,33 @@
1
+ import { z } from 'zod';
2
+ /** Available template types. */
3
+ export const TEMPLATE_TYPES = ['project', 'setup'];
4
+ export const TemplateSuggestionSchema = z.looseObject({
5
+ id: z.string(),
6
+ name: z.string(),
7
+ templateType: z.enum(TEMPLATE_TYPES),
8
+ });
9
+ export const WorkspaceTemplateSuggestionSchema = TemplateSuggestionSchema.extend({
10
+ workspaceId: z.string().nullable(),
11
+ });
12
+ /** Available suggestion section types. */
13
+ export const SUGGESTION_SECTION_TYPES = ['templates', 'most_used_user_templates'];
14
+ export const SyncTemplateSuggestionsSchema = z.looseObject({
15
+ type: z.enum(SUGGESTION_SECTION_TYPES),
16
+ content: z.object({
17
+ templates: z.array(TemplateSuggestionSchema),
18
+ locale: z.string(),
19
+ }),
20
+ isDeleted: z.boolean(),
21
+ });
22
+ export const SyncWorkspaceTemplateSuggestionsSchema = z.looseObject({
23
+ type: z.literal('most_used_workspace_templates'),
24
+ content: z.object({
25
+ templates: z.array(WorkspaceTemplateSuggestionSchema),
26
+ locale: z.string(),
27
+ }),
28
+ isDeleted: z.boolean(),
29
+ });
30
+ export const SuggestionSchema = z.union([
31
+ SyncWorkspaceTemplateSuggestionsSchema,
32
+ SyncTemplateSuggestionsSchema,
33
+ ]);
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ export const TooltipsSchema = z.looseObject({
3
+ seen: z.array(z.string()).optional(),
4
+ scheduled: z.array(z.string()).optional(),
5
+ });
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ export const PlanLimitsSchema = z.looseObject({
3
+ activeProjects: z.number().int().optional(),
4
+ activityLog: z.boolean().optional(),
5
+ collaboratorsPerProject: z.number().int().optional(),
6
+ commentsPerTask: z.number().int().optional(),
7
+ fileUploadsPerComment: z.number().int().optional(),
8
+ filtersPerUser: z.number().int().optional(),
9
+ labelsPerTask: z.number().int().optional(),
10
+ /** How many active personal projects the plan allows, not counting the Inbox. */
11
+ maxProjects: z.number().int().optional(),
12
+ remindersPerUser: z.number().int().optional(),
13
+ sectionsPerProject: z.number().int().optional(),
14
+ /** Whether the plan includes the Table layout for views. */
15
+ tableLayout: z.boolean().optional(),
16
+ tasksPerProject: z.number().int().optional(),
17
+ });
18
+ export const UserPlanLimitsSchema = z.looseObject({
19
+ current: PlanLimitsSchema,
20
+ next: PlanLimitsSchema.nullable(),
21
+ });
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ export const NavigationFeatureSchema = z.object({
3
+ name: z.string(),
4
+ shown: z.boolean(),
5
+ });
6
+ export const QuickAddFeatureSchema = z.object({
7
+ name: z.string(),
8
+ shown: z.boolean(),
9
+ });
10
+ /**
11
+ * Sync API user settings resource.
12
+ */
13
+ export const UserSettingsSchema = z.looseObject({
14
+ completedSoundDesktop: z.boolean(),
15
+ completedSoundMobile: z.boolean(),
16
+ debugLogSendingEnabledUntil: z.string().nullish(),
17
+ /**
18
+ * The Pro price version kept for the account, or `0` when none is kept.
19
+ * Version numbers are not sequential, and new ones can appear at any time.
20
+ */
21
+ legacyPricing: z.number().int(),
22
+ navigation: z
23
+ .object({
24
+ countsShown: z.boolean(),
25
+ features: z.array(NavigationFeatureSchema),
26
+ })
27
+ .loose(),
28
+ reminderDesktop: z.boolean(),
29
+ reminderEmail: z.boolean(),
30
+ reminderPush: z.boolean(),
31
+ resetRecurringSubtasks: z.boolean(),
32
+ aiEmailAssist: z.boolean(),
33
+ theme: z.string().nullable().optional(),
34
+ syncTheme: z.boolean().optional(),
35
+ quickAdd: z
36
+ .object({
37
+ labelsShown: z.boolean(),
38
+ features: z.array(QuickAddFeatureSchema),
39
+ })
40
+ .loose(),
41
+ });
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `mode` stays a plain string and `scope` optional so that a new mode, or an effect another
4
+ * client stored without a scope, does not break parsing.
5
+ */
6
+ export const UserStatusEffectSchema = z.looseObject({
7
+ scope: z.looseObject({ mode: z.string() }).optional(),
8
+ });
9
+ export const UserStatusEffectsSchema = z.looseObject({
10
+ pauseNotifications: UserStatusEffectSchema.optional(),
11
+ pauseActivity: UserStatusEffectSchema.optional(),
12
+ });
13
+ /**
14
+ * A user's status, shared across Todoist and Comms. The API returns `null` in its place
15
+ * when the user has no status or it has expired.
16
+ */
17
+ export const UserStatusSchema = z.looseObject({
18
+ message: z.string(),
19
+ emoji: z.string().nullish(),
20
+ activeUntil: z.coerce.date().nullish(),
21
+ effects: UserStatusEffectsSchema.default({}),
22
+ });
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ import { PREMIUM_STATUSES } from '../../users/types.js';
3
+ import { BooleanFromZeroOneSchema, DateFormatSchema, DayOfWeekSchema, TimeFormatSchema, } from '../user-preferences.js';
4
+ import { UserStatusSchema } from './user-status.js';
5
+ export const FeaturesSchema = z.looseObject({
6
+ karmaDisabled: z.union([z.boolean(), BooleanFromZeroOneSchema]),
7
+ restriction: z.number().int(),
8
+ karmaVacation: z.boolean(),
9
+ dateistLang: z.any(),
10
+ beta: BooleanFromZeroOneSchema,
11
+ hasPushReminders: z.boolean(),
12
+ dateistInlineDisabled: z.boolean(),
13
+ autoInviteDisabled: z.boolean().optional(),
14
+ goldTheme: z.boolean().optional(),
15
+ migratedFromTdb: z.boolean().optional(),
16
+ });
17
+ export const TzInfoSchema = z.looseObject({
18
+ timezone: z.string(),
19
+ hours: z.number().int(),
20
+ minutes: z.number().int(),
21
+ isDst: BooleanFromZeroOneSchema,
22
+ gmtString: z.string(),
23
+ });
24
+ export const JoinableWorkspaceSchema = z.looseObject({
25
+ workspaceId: z.string(),
26
+ workspaceName: z.string(),
27
+ memberCount: z.number().int(),
28
+ });
29
+ export const GettingStartedGuideProjectSchema = z.looseObject({
30
+ onboardingUseCase: z.string(),
31
+ projectId: z.string(),
32
+ completed: z.boolean(),
33
+ closed: z.boolean(),
34
+ });
35
+ /**
36
+ * Sync API user resource.
37
+ *
38
+ * This is a superset of the REST `CurrentUserSchema` — the Sync API returns
39
+ * many additional fields for features, onboarding state, and account details.
40
+ */
41
+ export const SyncUserSchema = z.looseObject({
42
+ id: z.string(),
43
+ email: z.string(),
44
+ fullName: z.string(),
45
+ activatedUser: z.boolean(),
46
+ autoReminder: z.number().int(),
47
+ avatarBig: z.string().optional(),
48
+ avatarMedium: z.string().optional(),
49
+ avatarS640: z.string().optional(),
50
+ avatarSmall: z.string().optional(),
51
+ businessAccountId: z.string().nullable(),
52
+ dailyGoal: z.number().int(),
53
+ dateFormat: DateFormatSchema,
54
+ dateistLang: z.string().nullish(),
55
+ daysOff: z.array(z.number().int()),
56
+ featureIdentifier: z.string(),
57
+ features: FeaturesSchema,
58
+ freeTrailExpires: z.coerce.date().optional(),
59
+ hasMagicNumber: z.boolean(),
60
+ hasPassword: z.boolean(),
61
+ hasStartedATrial: z.boolean().optional(),
62
+ imageId: z.string().nullable(),
63
+ inboxProjectId: z.string(),
64
+ isCelebrationsEnabled: z.boolean(),
65
+ isPremium: z.boolean(),
66
+ joinableWorkspace: JoinableWorkspaceSchema.nullable(),
67
+ joinedAt: z.coerce.date(),
68
+ gettingStartedGuideProjects: z.array(GettingStartedGuideProjectSchema).nullable(),
69
+ karma: z.number(),
70
+ karmaTrend: z.string(),
71
+ lang: z.string(),
72
+ mfaEnabled: z.boolean().optional(),
73
+ mobileHost: z.string().nullish(),
74
+ mobileNumber: z.string().nullish(),
75
+ nextWeek: DayOfWeekSchema,
76
+ onboardingLevel: z.string().nullable().optional(),
77
+ onboardingRole: z.string().nullable().optional(),
78
+ onboardingPersona: z.string().nullable().optional(),
79
+ onboardingInitiated: z.boolean().nullable().optional(),
80
+ onboardingCompleted: z.boolean().nullable().optional(),
81
+ onboardingSkipped: z.boolean().optional(),
82
+ onboardingTeamMode: z.boolean().nullable().optional(),
83
+ onboardingUseCases: z.array(z.string()).nullable().optional(),
84
+ premiumStatus: z.enum(PREMIUM_STATUSES),
85
+ premiumUntil: z.coerce.date().nullable(),
86
+ rambleSessionsUsage: z
87
+ .object({
88
+ currentCount: z.number().int(),
89
+ limit: z.number().int(),
90
+ remaining: z.number().int(),
91
+ resetDate: z.coerce.date(),
92
+ })
93
+ .nullable()
94
+ .optional(),
95
+ shareLimit: z.number().int(),
96
+ sortOrder: z.number().int(),
97
+ startDay: DayOfWeekSchema,
98
+ startPage: z.string(),
99
+ status: UserStatusSchema.nullish(),
100
+ themeId: z.string(),
101
+ timeFormat: TimeFormatSchema,
102
+ token: z.string().optional(),
103
+ tzInfo: TzInfoSchema,
104
+ uniquePrefix: z.number().int(),
105
+ verificationStatus: z.string(),
106
+ websocketUrl: z.string(),
107
+ weekendStartDay: z.number().int(),
108
+ weeklyGoal: z.number().int(),
109
+ });
@@ -0,0 +1,128 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Parses a response field that the API can extend: any string is kept as sent, typed as one
4
+ * of the `Known` values or another string. Parsing doesn't check that a value is known.
5
+ */
6
+ function openEnumSchema() {
7
+ return z.string();
8
+ }
9
+ /** View types the SDK knows. */
10
+ export const VIEW_TYPES = [
11
+ 'TODAY',
12
+ 'UPCOMING',
13
+ 'PROJECT',
14
+ 'LABEL',
15
+ 'FILTER',
16
+ 'WORKSPACE_FILTER',
17
+ 'SEARCH',
18
+ 'TEMPLATE_PREVIEW',
19
+ 'TASK_DETAIL',
20
+ 'AUTOMATION',
21
+ 'ASSIGNED',
22
+ 'ASSIGNED_TO_ME',
23
+ 'OVERDUE',
24
+ 'WORKSPACE_OVERVIEW',
25
+ ];
26
+ export const ViewTypeSchema = openEnumSchema();
27
+ /** View modes the SDK knows. */
28
+ export const VIEW_MODES = ['LIST', 'BOARD', 'CALENDAR', 'TABLE'];
29
+ export const ViewModeSchema = openEnumSchema();
30
+ /** Grouping options the SDK knows. */
31
+ export const GROUPED_BY_OPTIONS = [
32
+ 'ASSIGNEE',
33
+ 'ADDED_DATE',
34
+ 'DUE_DATE',
35
+ 'DEADLINE',
36
+ 'LABEL',
37
+ 'PRIORITY',
38
+ 'PROJECT',
39
+ 'WORKSPACE',
40
+ ];
41
+ export const GroupedBySchema = openEnumSchema().nullable();
42
+ /** Sorting options the SDK knows. */
43
+ export const SORTED_BY_OPTIONS = [
44
+ 'MANUAL',
45
+ 'ALPHABETICALLY',
46
+ 'ASSIGNEE',
47
+ 'DUE_DATE',
48
+ 'DEADLINE',
49
+ 'ADDED_DATE',
50
+ 'LABEL',
51
+ 'PRIORITY',
52
+ 'PROJECT',
53
+ 'WORKSPACE',
54
+ ];
55
+ export const SortedBySchema = openEnumSchema().nullable();
56
+ /** Sort directions the SDK knows. */
57
+ export const SORT_ORDERS = ['ASC', 'DESC'];
58
+ export const SortOrderSchema = openEnumSchema().nullable();
59
+ /** Calendar layout modes the SDK knows. */
60
+ export const CALENDAR_LAYOUTS = ['WEEK', 'MONTH'];
61
+ /** Task color sources for calendar views the SDK knows. */
62
+ export const CALENDAR_COLORS = ['PRIORITY', 'LABEL', 'PROJECT'];
63
+ export const CalendarSettingsSchema = z.looseObject({
64
+ layout: openEnumSchema().nullable().optional(),
65
+ visibleDayCount: z
66
+ .union([z.literal(1), z.literal(3), z.literal(7)])
67
+ .nullable()
68
+ .optional(),
69
+ color: openEnumSchema().nullable().optional(),
70
+ });
71
+ /** How a view shows one task property. Attributes the SDK doesn't know are kept. */
72
+ export const PropertyAttributesSchema = z.looseObject({
73
+ is_hidden: z.boolean().optional(),
74
+ /** Width of the property's column, in CSS pixels. */
75
+ width: z.number().int().optional(),
76
+ });
77
+ /**
78
+ * How a view shows task properties, such as `due` or `labels`, holding only what the user
79
+ * changed. Property IDs are opaque strings (`field:6Jf8VQXx`), so every key inside keeps its
80
+ * API spelling rather than being camel-cased, and keys the SDK doesn't know are kept.
81
+ */
82
+ export const PropertySettingsSchema = z.looseObject({
83
+ /** Property IDs in display order. */
84
+ order: z.array(z.string()).optional(),
85
+ /** How each property shows, by property ID. */
86
+ properties: z.record(z.string(), PropertyAttributesSchema).optional(),
87
+ });
88
+ export const ViewOptionsSchema = z.looseObject({
89
+ viewType: ViewTypeSchema,
90
+ objectId: z.string().nullable().optional(),
91
+ groupedBy: GroupedBySchema.optional(),
92
+ filteredBy: z.string().nullable().optional(),
93
+ viewMode: ViewModeSchema.nullable().optional(),
94
+ showCompletedTasks: z.boolean().optional(),
95
+ sortedBy: SortedBySchema.optional(),
96
+ sortOrder: SortOrderSchema.optional(),
97
+ calendarSettings: CalendarSettingsSchema.nullable().optional(),
98
+ propertySettings: PropertySettingsSchema.nullable().optional(),
99
+ isDeleted: z.literal(false).optional(),
100
+ });
101
+ // A tombstone keeps only what identifies the deleted row, and the API empties every option.
102
+ const TOMBSTONE_FIELDS = {
103
+ isDeleted: z.literal(true),
104
+ viewMode: z.literal('').optional(),
105
+ groupedBy: z.literal('').optional(),
106
+ sortedBy: z.literal('').optional(),
107
+ sortOrder: z.literal('').optional(),
108
+ filteredBy: z.literal('').optional(),
109
+ showCompletedTasks: z.boolean().optional(),
110
+ calendarSettings: z.null().optional(),
111
+ propertySettings: z.null().optional(),
112
+ };
113
+ /** Deleted view options, as incremental syncs report them. */
114
+ export const ViewOptionsTombstoneSchema = z.looseObject(Object.assign({ viewType: ViewTypeSchema, objectId: z.string().nullable().optional() }, TOMBSTONE_FIELDS));
115
+ export const ProjectViewOptionsDefaultsSchema = z.looseObject({
116
+ projectId: z.string(),
117
+ viewMode: ViewModeSchema.nullable().optional(),
118
+ groupedBy: GroupedBySchema.optional(),
119
+ sortedBy: SortedBySchema.optional(),
120
+ sortOrder: SortOrderSchema.optional(),
121
+ showCompletedTasks: z.boolean().optional(),
122
+ filteredBy: z.string().nullable().optional(),
123
+ calendarSettings: CalendarSettingsSchema.nullable().optional(),
124
+ propertySettings: PropertySettingsSchema.nullable().optional(),
125
+ isDeleted: z.literal(false).optional(),
126
+ });
127
+ /** Deleted project view options defaults, as incremental syncs report them. */
128
+ export const ProjectViewOptionsDefaultsTombstoneSchema = z.looseObject(Object.assign({ projectId: z.string() }, TOMBSTONE_FIELDS));
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ export const WorkspaceFilterSchema = z.looseObject({
3
+ id: z.string(),
4
+ workspaceId: z.string(),
5
+ name: z.string(),
6
+ query: z.string(),
7
+ description: z.string().nullish(),
8
+ color: z.string(),
9
+ itemOrder: z.number().int(),
10
+ isDeleted: z.boolean(),
11
+ isFavorite: z.boolean(),
12
+ isFrozen: z.boolean(),
13
+ creatorUid: z.string(),
14
+ updaterUid: z.string(),
15
+ createdAt: z.coerce.date(),
16
+ updatedAt: z.coerce.date(),
17
+ });
@@ -0,0 +1,69 @@
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
+ import { StringOrNumberSchema } from '../../common.js';
14
+ import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../workspaces/types.js';
15
+ /**
16
+ * Sync API workspace resource.
17
+ *
18
+ * This is a superset of the REST `WorkspaceSchema` — the Sync API returns
19
+ * additional fields like description, isDeleted, isCollapsed, member counts,
20
+ * domain settings, and sorting preferences.
21
+ */
22
+ export const SyncWorkspaceSchema = z
23
+ .looseObject({
24
+ id: StringOrNumberSchema,
25
+ name: z.string(),
26
+ description: z.string(),
27
+ logoBig: z.string().nullish(),
28
+ logoMedium: z.string().nullish(),
29
+ logoSmall: z.string().nullish(),
30
+ logoS640: z.string().nullish(),
31
+ creatorId: StringOrNumberSchema,
32
+ createdAt: z.coerce.date().optional(),
33
+ dateCreated: z.coerce.date().optional(),
34
+ isDeleted: z.boolean(),
35
+ isCollapsed: z.boolean(),
36
+ role: WorkspaceRoleSchema.optional(),
37
+ plan: WorkspacePlanSchema,
38
+ limits: WorkspaceLimitsSchema.optional(),
39
+ inviteCode: z.string().nullable().optional(),
40
+ isLinkSharingEnabled: z.boolean().nullable().optional(),
41
+ isGuestAllowed: z.boolean().nullable().optional(),
42
+ currentActiveProjects: z.number().nullable(),
43
+ currentMemberCount: z.number().nullable(),
44
+ memberCountByType: z
45
+ .object({
46
+ adminCount: z.number().int(),
47
+ guestCount: z.number().int(),
48
+ memberCount: z.number().int(),
49
+ })
50
+ .optional(),
51
+ currentTemplateCount: z.number().nullable(),
52
+ pendingInvitations: z.array(z.string()).nullable().optional(),
53
+ domainName: z.string().nullish(),
54
+ domainDiscovery: z.boolean().nullish(),
55
+ restrictEmailDomains: z.boolean().nullish(),
56
+ adminSortingApplied: z.boolean(),
57
+ projectSortPreference: z.string().nullish(),
58
+ defaultCollaborators: z
59
+ .object({
60
+ predefinedGroupIds: z.array(z.string()),
61
+ userIds: z.array(StringOrNumberSchema),
62
+ })
63
+ .optional(),
64
+ properties: WorkspacePropertiesSchema.optional(),
65
+ })
66
+ .transform((_a) => {
67
+ var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
68
+ return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
69
+ });
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { ProjectSchema } from '../projects/types.js';
3
+ import { SectionSchema } from '../sections/types.js';
4
+ import { TaskSchema } from '../tasks/types.js';
5
+ import { WorkspaceUserSchema } from '../workspaces/types.js';
6
+ import { FilterSchema, CollaboratorSchema, CollaboratorStateSchema, FolderSchema, NoteSchema, TooltipsSchema, WorkspaceFilterSchema, CalendarSchema, CalendarAccountSchema, SyncLabelSchema, SyncReminderSchema, LocationReminderSchema, CompletedInfoSchema, ViewOptionsSchema, ViewOptionsTombstoneSchema, ProjectViewOptionsDefaultsSchema, ProjectViewOptionsDefaultsTombstoneSchema, UserPlanLimitsSchema, LiveNotificationSchema, SyncWorkspaceSchema, SyncUserSchema, UserSettingsSchema, SuggestionSchema, } from './resources/index.js';
7
+ export const SyncErrorSchema = z.object({
8
+ error: z.string(),
9
+ errorCode: z.number(),
10
+ errorExtra: z.record(z.string(), z.unknown()),
11
+ errorTag: z.string(),
12
+ httpCode: z.number(),
13
+ });
14
+ export const SyncResponseSchema = z.looseObject({
15
+ syncToken: z.string().optional(),
16
+ fullSync: z.boolean().optional(),
17
+ syncStatus: z.record(z.string(), z.union([z.literal('ok'), SyncErrorSchema])).optional(),
18
+ tempIdMapping: z.record(z.string(), z.string()).optional(),
19
+ items: z.array(TaskSchema).optional(),
20
+ projects: z.array(ProjectSchema).optional(),
21
+ sections: z.array(SectionSchema).optional(),
22
+ labels: z.array(SyncLabelSchema).optional(),
23
+ notes: z.array(NoteSchema).optional(),
24
+ projectNotes: z.array(NoteSchema).optional(),
25
+ filters: z.array(FilterSchema).optional(),
26
+ reminders: z.array(SyncReminderSchema).optional(),
27
+ remindersLocation: z.array(LocationReminderSchema).optional(),
28
+ locations: z.array(z.record(z.string(), z.unknown())).optional(),
29
+ user: SyncUserSchema.optional(),
30
+ liveNotifications: z.array(LiveNotificationSchema).optional(),
31
+ collaborators: z.array(CollaboratorSchema).optional(),
32
+ collaboratorStates: z.array(CollaboratorStateSchema).optional(),
33
+ userSettings: UserSettingsSchema.optional(),
34
+ notificationSettings: z.record(z.string(), z.boolean()).optional(),
35
+ userPlanLimits: UserPlanLimitsSchema.optional(),
36
+ completedInfo: z.array(CompletedInfoSchema).optional(),
37
+ stats: z.record(z.string(), z.unknown()).optional(),
38
+ workspaces: z.array(SyncWorkspaceSchema).optional(),
39
+ workspaceUsers: z.array(WorkspaceUserSchema).optional(),
40
+ workspaceFilters: z.array(WorkspaceFilterSchema).optional(),
41
+ viewOptions: z
42
+ .array(z.discriminatedUnion('isDeleted', [ViewOptionsSchema, ViewOptionsTombstoneSchema]))
43
+ .optional(),
44
+ projectViewOptionsDefaults: z
45
+ .array(z.discriminatedUnion('isDeleted', [
46
+ ProjectViewOptionsDefaultsSchema,
47
+ ProjectViewOptionsDefaultsTombstoneSchema,
48
+ ]))
49
+ .optional(),
50
+ roleActions: z.array(z.record(z.string(), z.unknown())).optional(),
51
+ folders: z.array(FolderSchema).optional(),
52
+ dayOrders: z.record(z.string(), z.number()).optional(),
53
+ calendars: z.array(CalendarSchema).optional(),
54
+ calendarAccounts: z.array(CalendarAccountSchema).optional(),
55
+ suggestions: z.array(SuggestionSchema).optional(),
56
+ tooltips: TooltipsSchema.optional(),
57
+ });
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ /** Available date format options. */
3
+ export const DATE_FORMATS = ['DD/MM/YYYY', 'MM/DD/YYYY'];
4
+ /** Available time format options. */
5
+ export const TIME_FORMATS = ['24h', '12h'];
6
+ /** Available days of the week. */
7
+ export const DAYS_OF_WEEK = [
8
+ 'Monday',
9
+ 'Tuesday',
10
+ 'Wednesday',
11
+ 'Thursday',
12
+ 'Friday',
13
+ 'Saturday',
14
+ 'Sunday',
15
+ ];
16
+ export const DATE_FORMAT_FROM_API = {
17
+ 0: 'DD/MM/YYYY',
18
+ 1: 'MM/DD/YYYY',
19
+ };
20
+ export const TIME_FORMAT_FROM_API = {
21
+ 0: '24h',
22
+ 1: '12h',
23
+ };
24
+ export const DAY_OF_WEEK_FROM_API = {
25
+ 1: 'Monday',
26
+ 2: 'Tuesday',
27
+ 3: 'Wednesday',
28
+ 4: 'Thursday',
29
+ 5: 'Friday',
30
+ 6: 'Saturday',
31
+ 7: 'Sunday',
32
+ };
33
+ export const DATE_FORMAT_TO_API = {
34
+ 'DD/MM/YYYY': 0,
35
+ 'MM/DD/YYYY': 1,
36
+ };
37
+ export const TIME_FORMAT_TO_API = { '24h': 0, '12h': 1 };
38
+ export const DAY_OF_WEEK_TO_API = {
39
+ Monday: 1,
40
+ Tuesday: 2,
41
+ Wednesday: 3,
42
+ Thursday: 4,
43
+ Friday: 5,
44
+ Saturday: 6,
45
+ Sunday: 7,
46
+ };
47
+ /** Zod read-schema: parse API 0/1 integer, emit boolean */
48
+ export const BooleanFromZeroOneSchema = z
49
+ .union([z.literal(0), z.literal(1)])
50
+ .transform((v) => v === 1);
51
+ /** Zod read-schemas: parse API numbers, emit descriptive strings */
52
+ export const DateFormatSchema = z
53
+ .union([z.literal(0), z.literal(1)])
54
+ .transform((v) => DATE_FORMAT_FROM_API[v]);
55
+ export const TimeFormatSchema = z
56
+ .union([z.literal(0), z.literal(1)])
57
+ .transform((v) => TIME_FORMAT_FROM_API[v]);
58
+ export const DayOfWeekSchema = z
59
+ .union([
60
+ z.literal(1),
61
+ z.literal(2),
62
+ z.literal(3),
63
+ z.literal(4),
64
+ z.literal(5),
65
+ z.literal(6),
66
+ z.literal(7),
67
+ ])
68
+ .transform((v) => DAY_OF_WEEK_FROM_API[v]);
@@ -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 { hasUncompletablePrefix } from '../../utils/uncompletable-helpers.js';
3
+ import { getTaskUrl } from '../../utils/url-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.coerce.date().nullable(),
41
+ completedAt: z.coerce.date().nullable(),
42
+ updatedAt: z.coerce.date().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,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};