@doist/todoist-api-typescript 7.9.0 → 7.10.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 (343) hide show
  1. package/README.md +5 -204
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/index.mjs +1 -0
  5. package/package.json +12 -92
  6. package/LICENSE +0 -21
  7. package/dist/cjs/authentication.js +0 -204
  8. package/dist/cjs/consts/endpoints.js +0 -141
  9. package/dist/cjs/index.js +0 -20
  10. package/dist/cjs/package.json +0 -1
  11. package/dist/cjs/test-utils/asserts.js +0 -11
  12. package/dist/cjs/test-utils/msw-setup.js +0 -97
  13. package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -53
  14. package/dist/cjs/test-utils/test-defaults.js +0 -240
  15. package/dist/cjs/todoist-api.js +0 -2623
  16. package/dist/cjs/transport/fetch-with-retry.js +0 -206
  17. package/dist/cjs/transport/http-client.js +0 -133
  18. package/dist/cjs/transport/http-dispatcher.js +0 -72
  19. package/dist/cjs/types/activity/index.js +0 -18
  20. package/dist/cjs/types/activity/requests.js +0 -2
  21. package/dist/cjs/types/activity/types.js +0 -28
  22. package/dist/cjs/types/backups/index.js +0 -18
  23. package/dist/cjs/types/backups/requests.js +0 -2
  24. package/dist/cjs/types/backups/types.js +0 -8
  25. package/dist/cjs/types/comments/index.js +0 -18
  26. package/dist/cjs/types/comments/requests.js +0 -2
  27. package/dist/cjs/types/comments/types.js +0 -60
  28. package/dist/cjs/types/common.js +0 -2
  29. package/dist/cjs/types/emails/index.js +0 -17
  30. package/dist/cjs/types/emails/requests.js +0 -5
  31. package/dist/cjs/types/errors.js +0 -29
  32. package/dist/cjs/types/folders/index.js +0 -17
  33. package/dist/cjs/types/folders/requests.js +0 -2
  34. package/dist/cjs/types/http.js +0 -24
  35. package/dist/cjs/types/id-mappings/index.js +0 -18
  36. package/dist/cjs/types/id-mappings/requests.js +0 -20
  37. package/dist/cjs/types/id-mappings/types.js +0 -12
  38. package/dist/cjs/types/index.js +0 -36
  39. package/dist/cjs/types/insights/index.js +0 -18
  40. package/dist/cjs/types/insights/requests.js +0 -2
  41. package/dist/cjs/types/insights/types.js +0 -84
  42. package/dist/cjs/types/labels/index.js +0 -18
  43. package/dist/cjs/types/labels/requests.js +0 -2
  44. package/dist/cjs/types/labels/types.js +0 -11
  45. package/dist/cjs/types/productivity/index.js +0 -17
  46. package/dist/cjs/types/productivity/types.js +0 -67
  47. package/dist/cjs/types/projects/index.js +0 -18
  48. package/dist/cjs/types/projects/requests.js +0 -2
  49. package/dist/cjs/types/projects/types.js +0 -56
  50. package/dist/cjs/types/reminders/index.js +0 -17
  51. package/dist/cjs/types/reminders/requests.js +0 -95
  52. package/dist/cjs/types/sections/index.js +0 -18
  53. package/dist/cjs/types/sections/requests.js +0 -2
  54. package/dist/cjs/types/sections/types.js +0 -22
  55. package/dist/cjs/types/sync/commands/calendars.js +0 -2
  56. package/dist/cjs/types/sync/commands/filters.js +0 -2
  57. package/dist/cjs/types/sync/commands/folders.js +0 -2
  58. package/dist/cjs/types/sync/commands/index.js +0 -35
  59. package/dist/cjs/types/sync/commands/labels.js +0 -5
  60. package/dist/cjs/types/sync/commands/notes.js +0 -2
  61. package/dist/cjs/types/sync/commands/notifications.js +0 -2
  62. package/dist/cjs/types/sync/commands/others.js +0 -2
  63. package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
  64. package/dist/cjs/types/sync/commands/projects.js +0 -2
  65. package/dist/cjs/types/sync/commands/reminders.js +0 -2
  66. package/dist/cjs/types/sync/commands/sections.js +0 -2
  67. package/dist/cjs/types/sync/commands/shared.js +0 -20
  68. package/dist/cjs/types/sync/commands/sharing.js +0 -2
  69. package/dist/cjs/types/sync/commands/tasks.js +0 -2
  70. package/dist/cjs/types/sync/commands/view-options.js +0 -2
  71. package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
  72. package/dist/cjs/types/sync/commands/workspace-goals.js +0 -2
  73. package/dist/cjs/types/sync/commands/workspaces.js +0 -2
  74. package/dist/cjs/types/sync/index.js +0 -22
  75. package/dist/cjs/types/sync/request.js +0 -2
  76. package/dist/cjs/types/sync/resource-types.js +0 -40
  77. package/dist/cjs/types/sync/resources/calendars.js +0 -31
  78. package/dist/cjs/types/sync/resources/collaborators.js +0 -25
  79. package/dist/cjs/types/sync/resources/completed-info.js +0 -30
  80. package/dist/cjs/types/sync/resources/filters.js +0 -16
  81. package/dist/cjs/types/sync/resources/folders.js +0 -14
  82. package/dist/cjs/types/sync/resources/index.js +0 -33
  83. package/dist/cjs/types/sync/resources/live-notifications.js +0 -39
  84. package/dist/cjs/types/sync/resources/notes.js +0 -23
  85. package/dist/cjs/types/sync/resources/reminders.js +0 -50
  86. package/dist/cjs/types/sync/resources/suggestions.js +0 -42
  87. package/dist/cjs/types/sync/resources/tooltips.js +0 -10
  88. package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -24
  89. package/dist/cjs/types/sync/resources/user-settings.js +0 -42
  90. package/dist/cjs/types/sync/resources/user.js +0 -120
  91. package/dist/cjs/types/sync/resources/view-options.js +0 -83
  92. package/dist/cjs/types/sync/resources/workspace-filters.js +0 -21
  93. package/dist/cjs/types/sync/resources/workspace-goals.js +0 -32
  94. package/dist/cjs/types/sync/resources/workspaces.js +0 -56
  95. package/dist/cjs/types/sync/response.js +0 -2
  96. package/dist/cjs/types/sync/user-preferences.js +0 -71
  97. package/dist/cjs/types/tasks/index.js +0 -18
  98. package/dist/cjs/types/tasks/requests.js +0 -2
  99. package/dist/cjs/types/tasks/types.js +0 -59
  100. package/dist/cjs/types/templates/index.js +0 -17
  101. package/dist/cjs/types/templates/requests.js +0 -2
  102. package/dist/cjs/types/uploads/index.js +0 -17
  103. package/dist/cjs/types/uploads/requests.js +0 -2
  104. package/dist/cjs/types/users/index.js +0 -17
  105. package/dist/cjs/types/users/types.js +0 -51
  106. package/dist/cjs/types/workspaces/index.js +0 -18
  107. package/dist/cjs/types/workspaces/requests.js +0 -2
  108. package/dist/cjs/types/workspaces/types.js +0 -137
  109. package/dist/cjs/utils/activity-helpers.js +0 -58
  110. package/dist/cjs/utils/case-conversion.js +0 -69
  111. package/dist/cjs/utils/colors.js +0 -143
  112. package/dist/cjs/utils/index.js +0 -25
  113. package/dist/cjs/utils/multipart-upload.js +0 -178
  114. package/dist/cjs/utils/processing-helpers.js +0 -18
  115. package/dist/cjs/utils/sanitization.js +0 -116
  116. package/dist/cjs/utils/sync-helpers.js +0 -22
  117. package/dist/cjs/utils/uncompletable-helpers.js +0 -60
  118. package/dist/cjs/utils/url-helpers.js +0 -74
  119. package/dist/cjs/utils/validators.js +0 -141
  120. package/dist/esm/authentication.js +0 -196
  121. package/dist/esm/consts/endpoints.js +0 -122
  122. package/dist/esm/index.js +0 -4
  123. package/dist/esm/test-utils/asserts.js +0 -8
  124. package/dist/esm/test-utils/msw-setup.js +0 -88
  125. package/dist/esm/test-utils/obsidian-fetch-adapter.js +0 -50
  126. package/dist/esm/test-utils/test-defaults.js +0 -237
  127. package/dist/esm/todoist-api.js +0 -2619
  128. package/dist/esm/transport/fetch-with-retry.js +0 -203
  129. package/dist/esm/transport/http-client.js +0 -128
  130. package/dist/esm/transport/http-dispatcher.js +0 -35
  131. package/dist/esm/types/activity/index.js +0 -2
  132. package/dist/esm/types/activity/requests.js +0 -1
  133. package/dist/esm/types/activity/types.js +0 -25
  134. package/dist/esm/types/backups/index.js +0 -2
  135. package/dist/esm/types/backups/requests.js +0 -1
  136. package/dist/esm/types/backups/types.js +0 -5
  137. package/dist/esm/types/comments/index.js +0 -2
  138. package/dist/esm/types/comments/requests.js +0 -1
  139. package/dist/esm/types/comments/types.js +0 -57
  140. package/dist/esm/types/common.js +0 -1
  141. package/dist/esm/types/emails/index.js +0 -1
  142. package/dist/esm/types/emails/requests.js +0 -2
  143. package/dist/esm/types/errors.js +0 -24
  144. package/dist/esm/types/folders/index.js +0 -1
  145. package/dist/esm/types/folders/requests.js +0 -1
  146. package/dist/esm/types/http.js +0 -20
  147. package/dist/esm/types/id-mappings/index.js +0 -2
  148. package/dist/esm/types/id-mappings/requests.js +0 -17
  149. package/dist/esm/types/id-mappings/types.js +0 -9
  150. package/dist/esm/types/index.js +0 -20
  151. package/dist/esm/types/insights/index.js +0 -2
  152. package/dist/esm/types/insights/requests.js +0 -1
  153. package/dist/esm/types/insights/types.js +0 -81
  154. package/dist/esm/types/labels/index.js +0 -2
  155. package/dist/esm/types/labels/requests.js +0 -1
  156. package/dist/esm/types/labels/types.js +0 -8
  157. package/dist/esm/types/productivity/index.js +0 -1
  158. package/dist/esm/types/productivity/types.js +0 -64
  159. package/dist/esm/types/projects/index.js +0 -2
  160. package/dist/esm/types/projects/requests.js +0 -1
  161. package/dist/esm/types/projects/types.js +0 -53
  162. package/dist/esm/types/reminders/index.js +0 -1
  163. package/dist/esm/types/reminders/requests.js +0 -92
  164. package/dist/esm/types/sections/index.js +0 -2
  165. package/dist/esm/types/sections/requests.js +0 -1
  166. package/dist/esm/types/sections/types.js +0 -19
  167. package/dist/esm/types/sync/commands/calendars.js +0 -1
  168. package/dist/esm/types/sync/commands/filters.js +0 -1
  169. package/dist/esm/types/sync/commands/folders.js +0 -1
  170. package/dist/esm/types/sync/commands/index.js +0 -19
  171. package/dist/esm/types/sync/commands/labels.js +0 -2
  172. package/dist/esm/types/sync/commands/notes.js +0 -1
  173. package/dist/esm/types/sync/commands/notifications.js +0 -1
  174. package/dist/esm/types/sync/commands/others.js +0 -1
  175. package/dist/esm/types/sync/commands/project-view-options.js +0 -1
  176. package/dist/esm/types/sync/commands/projects.js +0 -1
  177. package/dist/esm/types/sync/commands/reminders.js +0 -1
  178. package/dist/esm/types/sync/commands/sections.js +0 -1
  179. package/dist/esm/types/sync/commands/shared.js +0 -16
  180. package/dist/esm/types/sync/commands/sharing.js +0 -1
  181. package/dist/esm/types/sync/commands/tasks.js +0 -1
  182. package/dist/esm/types/sync/commands/view-options.js +0 -1
  183. package/dist/esm/types/sync/commands/workspace-filters.js +0 -1
  184. package/dist/esm/types/sync/commands/workspace-goals.js +0 -1
  185. package/dist/esm/types/sync/commands/workspaces.js +0 -1
  186. package/dist/esm/types/sync/index.js +0 -6
  187. package/dist/esm/types/sync/request.js +0 -1
  188. package/dist/esm/types/sync/resource-types.js +0 -37
  189. package/dist/esm/types/sync/resources/calendars.js +0 -28
  190. package/dist/esm/types/sync/resources/collaborators.js +0 -22
  191. package/dist/esm/types/sync/resources/completed-info.js +0 -27
  192. package/dist/esm/types/sync/resources/filters.js +0 -13
  193. package/dist/esm/types/sync/resources/folders.js +0 -11
  194. package/dist/esm/types/sync/resources/index.js +0 -17
  195. package/dist/esm/types/sync/resources/live-notifications.js +0 -36
  196. package/dist/esm/types/sync/resources/notes.js +0 -20
  197. package/dist/esm/types/sync/resources/reminders.js +0 -47
  198. package/dist/esm/types/sync/resources/suggestions.js +0 -39
  199. package/dist/esm/types/sync/resources/tooltips.js +0 -7
  200. package/dist/esm/types/sync/resources/user-plan-limits.js +0 -21
  201. package/dist/esm/types/sync/resources/user-settings.js +0 -39
  202. package/dist/esm/types/sync/resources/user.js +0 -117
  203. package/dist/esm/types/sync/resources/view-options.js +0 -80
  204. package/dist/esm/types/sync/resources/workspace-filters.js +0 -18
  205. package/dist/esm/types/sync/resources/workspace-goals.js +0 -29
  206. package/dist/esm/types/sync/resources/workspaces.js +0 -53
  207. package/dist/esm/types/sync/response.js +0 -1
  208. package/dist/esm/types/sync/user-preferences.js +0 -68
  209. package/dist/esm/types/tasks/index.js +0 -2
  210. package/dist/esm/types/tasks/requests.js +0 -1
  211. package/dist/esm/types/tasks/types.js +0 -56
  212. package/dist/esm/types/templates/index.js +0 -1
  213. package/dist/esm/types/templates/requests.js +0 -1
  214. package/dist/esm/types/uploads/index.js +0 -1
  215. package/dist/esm/types/uploads/requests.js +0 -1
  216. package/dist/esm/types/users/index.js +0 -1
  217. package/dist/esm/types/users/types.js +0 -48
  218. package/dist/esm/types/workspaces/index.js +0 -2
  219. package/dist/esm/types/workspaces/requests.js +0 -1
  220. package/dist/esm/types/workspaces/types.js +0 -134
  221. package/dist/esm/utils/activity-helpers.js +0 -53
  222. package/dist/esm/utils/case-conversion.js +0 -61
  223. package/dist/esm/utils/colors.js +0 -139
  224. package/dist/esm/utils/index.js +0 -4
  225. package/dist/esm/utils/multipart-upload.js +0 -142
  226. package/dist/esm/utils/processing-helpers.js +0 -12
  227. package/dist/esm/utils/sanitization.js +0 -112
  228. package/dist/esm/utils/sync-helpers.js +0 -19
  229. package/dist/esm/utils/uncompletable-helpers.js +0 -54
  230. package/dist/esm/utils/url-helpers.js +0 -68
  231. package/dist/esm/utils/validators.js +0 -132
  232. package/dist/types/authentication.d.ts +0 -158
  233. package/dist/types/consts/endpoints.d.ts +0 -81
  234. package/dist/types/index.d.ts +0 -4
  235. package/dist/types/test-utils/asserts.d.ts +0 -1
  236. package/dist/types/test-utils/msw-setup.d.ts +0 -33
  237. package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +0 -29
  238. package/dist/types/test-utils/test-defaults.d.ts +0 -261
  239. package/dist/types/todoist-api.d.ts +0 -1018
  240. package/dist/types/transport/fetch-with-retry.d.ts +0 -12
  241. package/dist/types/transport/http-client.d.ts +0 -16
  242. package/dist/types/transport/http-dispatcher.d.ts +0 -3
  243. package/dist/types/types/activity/index.d.ts +0 -2
  244. package/dist/types/types/activity/requests.d.ts +0 -85
  245. package/dist/types/types/activity/types.d.ts +0 -49
  246. package/dist/types/types/backups/index.d.ts +0 -2
  247. package/dist/types/types/backups/requests.d.ts +0 -16
  248. package/dist/types/types/backups/types.d.ts +0 -7
  249. package/dist/types/types/comments/index.d.ts +0 -2
  250. package/dist/types/types/comments/requests.d.ts +0 -64
  251. package/dist/types/types/comments/types.d.ts +0 -141
  252. package/dist/types/types/common.d.ts +0 -6
  253. package/dist/types/types/emails/index.d.ts +0 -1
  254. package/dist/types/types/emails/requests.d.ts +0 -30
  255. package/dist/types/types/errors.d.ts +0 -12
  256. package/dist/types/types/folders/index.d.ts +0 -1
  257. package/dist/types/types/folders/requests.d.ts +0 -20
  258. package/dist/types/types/http.d.ts +0 -85
  259. package/dist/types/types/id-mappings/index.d.ts +0 -2
  260. package/dist/types/types/id-mappings/requests.d.ts +0 -28
  261. package/dist/types/types/id-mappings/types.d.ts +0 -13
  262. package/dist/types/types/index.d.ts +0 -20
  263. package/dist/types/types/insights/index.d.ts +0 -2
  264. package/dist/types/types/insights/requests.d.ts +0 -26
  265. package/dist/types/types/insights/types.d.ts +0 -186
  266. package/dist/types/types/labels/index.d.ts +0 -2
  267. package/dist/types/types/labels/requests.d.ts +0 -75
  268. package/dist/types/types/labels/types.d.ts +0 -13
  269. package/dist/types/types/productivity/index.d.ts +0 -1
  270. package/dist/types/types/productivity/types.d.ts +0 -115
  271. package/dist/types/types/projects/index.d.ts +0 -2
  272. package/dist/types/types/projects/requests.d.ts +0 -169
  273. package/dist/types/types/projects/types.d.ts +0 -201
  274. package/dist/types/types/reminders/index.d.ts +0 -1
  275. package/dist/types/types/reminders/requests.d.ts +0 -205
  276. package/dist/types/types/sections/index.d.ts +0 -2
  277. package/dist/types/types/sections/requests.d.ts +0 -41
  278. package/dist/types/types/sections/types.d.ts +0 -44
  279. package/dist/types/types/sync/commands/calendars.d.ts +0 -14
  280. package/dist/types/types/sync/commands/filters.d.ts +0 -22
  281. package/dist/types/types/sync/commands/folders.d.ts +0 -18
  282. package/dist/types/types/sync/commands/index.d.ts +0 -171
  283. package/dist/types/types/sync/commands/labels.d.ts +0 -32
  284. package/dist/types/types/sync/commands/notes.d.ts +0 -27
  285. package/dist/types/types/sync/commands/notifications.d.ts +0 -10
  286. package/dist/types/types/sync/commands/others.d.ts +0 -39
  287. package/dist/types/types/sync/commands/project-view-options.d.ts +0 -14
  288. package/dist/types/types/sync/commands/projects.d.ts +0 -90
  289. package/dist/types/types/sync/commands/reminders.d.ts +0 -51
  290. package/dist/types/types/sync/commands/sections.d.ts +0 -31
  291. package/dist/types/types/sync/commands/shared.d.ts +0 -51
  292. package/dist/types/types/sync/commands/sharing.d.ts +0 -16
  293. package/dist/types/types/sync/commands/tasks.d.ts +0 -78
  294. package/dist/types/types/sync/commands/view-options.d.ts +0 -15
  295. package/dist/types/types/sync/commands/workspace-filters.d.ts +0 -23
  296. package/dist/types/types/sync/commands/workspace-goals.d.ts +0 -24
  297. package/dist/types/types/sync/commands/workspaces.d.ts +0 -79
  298. package/dist/types/types/sync/index.d.ts +0 -6
  299. package/dist/types/types/sync/request.d.ts +0 -7
  300. package/dist/types/types/sync/resource-types.d.ts +0 -5
  301. package/dist/types/types/sync/resources/calendars.d.ts +0 -38
  302. package/dist/types/types/sync/resources/collaborators.d.ts +0 -28
  303. package/dist/types/types/sync/resources/completed-info.d.ts +0 -33
  304. package/dist/types/types/sync/resources/filters.d.ts +0 -12
  305. package/dist/types/types/sync/resources/folders.d.ts +0 -10
  306. package/dist/types/types/sync/resources/index.d.ts +0 -17
  307. package/dist/types/types/sync/resources/live-notifications.d.ts +0 -32
  308. package/dist/types/types/sync/resources/notes.d.ts +0 -34
  309. package/dist/types/types/sync/resources/reminders.d.ts +0 -126
  310. package/dist/types/types/sync/resources/suggestions.d.ts +0 -96
  311. package/dist/types/types/sync/resources/tooltips.d.ts +0 -6
  312. package/dist/types/types/sync/resources/user-plan-limits.d.ts +0 -41
  313. package/dist/types/types/sync/resources/user-settings.d.ts +0 -40
  314. package/dist/types/types/sync/resources/user.d.ts +0 -134
  315. package/dist/types/types/sync/resources/view-options.d.ts +0 -169
  316. package/dist/types/types/sync/resources/workspace-filters.d.ts +0 -17
  317. package/dist/types/types/sync/resources/workspace-goals.d.ts +0 -29
  318. package/dist/types/types/sync/resources/workspaces.d.ts +0 -57
  319. package/dist/types/types/sync/response.d.ts +0 -51
  320. package/dist/types/types/sync/user-preferences.d.ts +0 -39
  321. package/dist/types/types/tasks/index.d.ts +0 -2
  322. package/dist/types/types/tasks/requests.d.ts +0 -197
  323. package/dist/types/types/tasks/types.d.ts +0 -162
  324. package/dist/types/types/templates/index.d.ts +0 -1
  325. package/dist/types/types/templates/requests.d.ts +0 -92
  326. package/dist/types/types/uploads/index.d.ts +0 -1
  327. package/dist/types/types/uploads/requests.d.ts +0 -32
  328. package/dist/types/types/users/index.d.ts +0 -1
  329. package/dist/types/types/users/types.d.ts +0 -66
  330. package/dist/types/types/workspaces/index.d.ts +0 -2
  331. package/dist/types/types/workspaces/requests.d.ts +0 -260
  332. package/dist/types/types/workspaces/types.d.ts +0 -225
  333. package/dist/types/utils/activity-helpers.d.ts +0 -28
  334. package/dist/types/utils/case-conversion.d.ts +0 -12
  335. package/dist/types/utils/colors.d.ts +0 -197
  336. package/dist/types/utils/index.d.ts +0 -4
  337. package/dist/types/utils/multipart-upload.d.ts +0 -54
  338. package/dist/types/utils/processing-helpers.d.ts +0 -1
  339. package/dist/types/utils/sanitization.d.ts +0 -35
  340. package/dist/types/utils/sync-helpers.d.ts +0 -17
  341. package/dist/types/utils/uncompletable-helpers.d.ts +0 -30
  342. package/dist/types/utils/url-helpers.d.ts +0 -32
  343. package/dist/types/utils/validators.d.ts +0 -1406
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addUncompletablePrefix = addUncompletablePrefix;
4
- exports.removeUncompletablePrefix = removeUncompletablePrefix;
5
- exports.hasUncompletablePrefix = hasUncompletablePrefix;
6
- exports.processTaskContent = processTaskContent;
7
- const UNCOMPLETABLE_PREFIX = '* ';
8
- /**
9
- * Adds the uncompletable prefix (* ) to task content if not already present
10
- * @param content - The task content
11
- * @returns Content with uncompletable prefix added
12
- */
13
- function addUncompletablePrefix(content) {
14
- if (content.startsWith(UNCOMPLETABLE_PREFIX)) {
15
- return content;
16
- }
17
- return UNCOMPLETABLE_PREFIX + content;
18
- }
19
- /**
20
- * Removes the uncompletable prefix (* ) from task content if present
21
- * @param content - The task content
22
- * @returns Content with uncompletable prefix removed
23
- */
24
- function removeUncompletablePrefix(content) {
25
- if (content.startsWith(UNCOMPLETABLE_PREFIX)) {
26
- return content.slice(UNCOMPLETABLE_PREFIX.length);
27
- }
28
- return content;
29
- }
30
- /**
31
- * Checks if task content has the uncompletable prefix (* )
32
- * @param content - The task content
33
- * @returns True if content starts with uncompletable prefix
34
- */
35
- function hasUncompletablePrefix(content) {
36
- return content.startsWith(UNCOMPLETABLE_PREFIX);
37
- }
38
- /**
39
- * Processes task content based on isUncompletable flag, with content prefix taking precedence
40
- * @param content - The original task content
41
- * @param isUncompletable - Optional flag to make task uncompletable
42
- * @returns Processed content
43
- *
44
- * Logic:
45
- * - If content already has * prefix, task is uncompletable regardless of flag
46
- * - If content doesn't have * prefix and isUncompletable is true, add the prefix
47
- * - If isUncompletable is undefined or false (and no prefix), leave content unchanged
48
- */
49
- function processTaskContent(content, isUncompletable) {
50
- // Content prefix takes precedence - if already has prefix, keep it
51
- if (hasUncompletablePrefix(content)) {
52
- return content;
53
- }
54
- // If content doesn't have prefix and user wants uncompletable, add it
55
- if (isUncompletable === true) {
56
- return addUncompletablePrefix(content);
57
- }
58
- // Otherwise, leave content unchanged
59
- return content;
60
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatDateToYYYYMMDD = formatDateToYYYYMMDD;
4
- exports.getTaskUrl = getTaskUrl;
5
- exports.getProjectUrl = getProjectUrl;
6
- exports.getSectionUrl = getSectionUrl;
7
- const endpoints_1 = require("../consts/endpoints");
8
- /**
9
- * Formats a Date object to YYYY-MM-DD string format.
10
- *
11
- * @internal
12
- * @param date The Date object to format.
13
- * @returns The formatted date string in YYYY-MM-DD format.
14
- */
15
- function formatDateToYYYYMMDD(date) {
16
- const year = date.getFullYear();
17
- const month = String(date.getMonth() + 1).padStart(2, '0');
18
- const day = String(date.getDate()).padStart(2, '0');
19
- return `${year}-${month}-${day}`;
20
- }
21
- /**
22
- * Generate the URL for a given task.
23
- *
24
- * @param taskId The ID of the task.
25
- * @param content The content of the task.
26
- * @returns The URL string for the task view.
27
- */
28
- function getTaskUrl(taskId, content) {
29
- const slug = content ? slugify(content) : undefined;
30
- const path = slug ? `${slug}-${taskId}` : taskId;
31
- return `${endpoints_1.TODOIST_WEB_URI}/task/${path}`;
32
- }
33
- /**
34
- * Generate the URL for a given project.
35
- *
36
- * @param projectId The ID of the project.
37
- * @param name The name of the project.
38
- * @returns The URL string for the project view.
39
- */
40
- function getProjectUrl(projectId, name) {
41
- const slug = name ? slugify(name) : undefined;
42
- const path = slug ? `${slug}-${projectId}` : projectId;
43
- return `${endpoints_1.TODOIST_WEB_URI}/project/${path}`;
44
- }
45
- /**
46
- * Generate the URL for a given section.
47
- *
48
- * @param sectionId The ID of the section.
49
- * @param name The name of the section.
50
- * @returns The URL string for the section view.
51
- */
52
- function getSectionUrl(sectionId, name) {
53
- const slug = name ? slugify(name) : undefined;
54
- const path = slug ? `${slug}-${sectionId}` : sectionId;
55
- return `${endpoints_1.TODOIST_WEB_URI}/section/${path}`;
56
- }
57
- /**
58
- * Slugify function borrowed from Django.
59
- *
60
- * @param value The string to slugify.
61
- * @returns The slugified string.
62
- */
63
- function slugify(value) {
64
- // Convert to ASCII
65
- let result = value.normalize('NFKD').replace(/[\u0300-\u036f]/g, '');
66
- // Remove non-ASCII characters
67
- result = result.replace(/[^\x20-\x7E]/g, '');
68
- // Convert to lowercase and replace non-alphanumeric characters with dashes
69
- result = result.toLowerCase().replace(/[^\w\s-]/g, '');
70
- // Replace spaces and repeated dashes with single dashes
71
- result = result.replace(/[-\s]+/g, '-');
72
- // Strip dashes from the beginning and end
73
- return result.replace(/^-+|-+$/g, '');
74
- }
@@ -1,141 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = exports.validateTooltips = exports.validateNoteArray = exports.validateNote = exports.validateFolderArray = exports.validateFolder = exports.validateCollaboratorStateArray = exports.validateCollaboratorState = exports.validateCollaboratorArray = exports.validateCollaborator = exports.validateFilterArray = exports.validateFilter = exports.validateMovedIdArray = exports.validateMovedId = exports.validateIdMappingArray = exports.validateIdMapping = exports.validateBackupArray = exports.validateBackup = exports.validateWorkspaceInsights = exports.validateProjectProgress = exports.validateProjectHealthContext = exports.validateProjectHealth = exports.validateProjectActivityStats = exports.validateWorkspaceUserTaskArray = exports.validateWorkspaceUserTask = exports.validateMemberActivityInfoArray = exports.validateMemberActivityInfo = exports.validateWorkspaceArray = exports.validateWorkspace = exports.validateJoinWorkspaceResult = exports.validateWorkspacePlanDetails = exports.validateWorkspaceInvitationArray = exports.validateWorkspaceInvitation = exports.validateWorkspaceUser = exports.validateAttachment = exports.validateActivityEventArray = exports.validateActivityEvent = exports.validateCurrentUser = exports.validateProductivityStats = exports.validateUserArray = exports.validateUser = exports.validateCommentArray = exports.validateComment = exports.validateLabelArray = exports.validateLabel = exports.validateSectionArray = exports.validateSection = exports.validateTaskArray = exports.validateTask = void 0;
4
- exports.validateSuggestionArray = exports.validateSuggestion = exports.validateUserSettings = exports.validateSyncUser = exports.validateSyncWorkspaceArray = exports.validateSyncWorkspace = exports.validateLiveNotificationArray = exports.validateLiveNotification = exports.validateUserPlanLimits = exports.validateProjectViewOptionsDefaultsArray = exports.validateProjectViewOptionsDefaults = exports.validateViewOptionsArray = exports.validateViewOptions = exports.validateCompletedInfoArray = exports.validateCompletedInfo = exports.validateLocationReminderArray = exports.validateLocationReminder = exports.validateReminderArray = exports.validateReminder = exports.validateCalendarAccountArray = exports.validateCalendarAccount = exports.validateCalendarArray = exports.validateCalendar = exports.validateWorkspaceGoalArray = exports.validateWorkspaceGoal = void 0;
5
- exports.isWorkspaceProject = isWorkspaceProject;
6
- exports.isPersonalProject = isPersonalProject;
7
- exports.validateProject = validateProject;
8
- exports.validateProjectArray = validateProjectArray;
9
- exports.validateWorkspaceUserArray = validateWorkspaceUserArray;
10
- const types_1 = require("../types/tasks/types");
11
- const types_2 = require("../types/projects/types");
12
- const types_3 = require("../types/sections/types");
13
- const types_4 = require("../types/labels/types");
14
- const types_5 = require("../types/comments/types");
15
- const types_6 = require("../types/users/types");
16
- const types_7 = require("../types/productivity/types");
17
- const types_8 = require("../types/activity/types");
18
- const types_9 = require("../types/workspaces/types");
19
- const types_10 = require("../types/insights/types");
20
- const types_11 = require("../types/backups/types");
21
- const types_12 = require("../types/id-mappings/types");
22
- const resources_1 = require("../types/sync/resources");
23
- function createValidator(schema) {
24
- return (input) => schema.parse(input);
25
- }
26
- function createArrayValidator(validateItem) {
27
- return (input) => input.map(validateItem);
28
- }
29
- // Entity validators
30
- exports.validateTask = createValidator(types_1.TaskSchema);
31
- exports.validateTaskArray = createArrayValidator(exports.validateTask);
32
- /**
33
- * Type guard to check if a project is a workspace project.
34
- * @param project The project to check
35
- * @returns True if the project is a workspace project
36
- */
37
- function isWorkspaceProject(project) {
38
- return 'workspaceId' in project;
39
- }
40
- /**
41
- * Type guard to check if a project is a personal project.
42
- * @param project The project to check
43
- * @returns True if the project is a personal project
44
- */
45
- function isPersonalProject(project) {
46
- return !isWorkspaceProject(project);
47
- }
48
- /**
49
- * Validates and parses a project input.
50
- * @param input The input to validate
51
- * @returns A validated project (either PersonalProject or WorkspaceProject)
52
- */
53
- function validateProject(input) {
54
- if ('workspaceId' in input) {
55
- return types_2.WorkspaceProjectSchema.parse(input);
56
- }
57
- return types_2.PersonalProjectSchema.parse(input);
58
- }
59
- function validateProjectArray(input) {
60
- return input.map(validateProject);
61
- }
62
- exports.validateSection = createValidator(types_3.SectionSchema);
63
- exports.validateSectionArray = createArrayValidator(exports.validateSection);
64
- exports.validateLabel = createValidator(types_4.LabelSchema);
65
- exports.validateLabelArray = createArrayValidator(exports.validateLabel);
66
- exports.validateComment = createValidator(types_5.CommentSchema);
67
- exports.validateCommentArray = createArrayValidator(exports.validateComment);
68
- exports.validateUser = createValidator(types_6.UserSchema);
69
- exports.validateUserArray = createArrayValidator(exports.validateUser);
70
- exports.validateProductivityStats = createValidator(types_7.ProductivityStatsSchema);
71
- exports.validateCurrentUser = createValidator(types_6.CurrentUserSchema);
72
- exports.validateActivityEvent = createValidator(types_8.ActivityEventSchema);
73
- exports.validateActivityEventArray = createArrayValidator(exports.validateActivityEvent);
74
- exports.validateAttachment = createValidator(types_5.AttachmentSchema);
75
- exports.validateWorkspaceUser = createValidator(types_9.WorkspaceUserSchema);
76
- function validateWorkspaceUserArray(input) {
77
- if (!Array.isArray(input)) {
78
- throw new Error(`Expected array for workspace users, got ${typeof input}`);
79
- }
80
- return input.map(exports.validateWorkspaceUser);
81
- }
82
- exports.validateWorkspaceInvitation = createValidator(types_9.WorkspaceInvitationSchema);
83
- exports.validateWorkspaceInvitationArray = createArrayValidator(exports.validateWorkspaceInvitation);
84
- exports.validateWorkspacePlanDetails = createValidator(types_9.WorkspacePlanDetailsSchema);
85
- exports.validateJoinWorkspaceResult = createValidator(types_9.JoinWorkspaceResultSchema);
86
- exports.validateWorkspace = createValidator(types_9.WorkspaceSchema);
87
- exports.validateWorkspaceArray = createArrayValidator(exports.validateWorkspace);
88
- exports.validateMemberActivityInfo = createValidator(types_9.MemberActivityInfoSchema);
89
- exports.validateMemberActivityInfoArray = createArrayValidator(exports.validateMemberActivityInfo);
90
- exports.validateWorkspaceUserTask = createValidator(types_9.WorkspaceUserTaskSchema);
91
- exports.validateWorkspaceUserTaskArray = createArrayValidator(exports.validateWorkspaceUserTask);
92
- exports.validateProjectActivityStats = createValidator(types_10.ProjectActivityStatsSchema);
93
- exports.validateProjectHealth = createValidator(types_10.ProjectHealthSchema);
94
- exports.validateProjectHealthContext = createValidator(types_10.ProjectHealthContextSchema);
95
- exports.validateProjectProgress = createValidator(types_10.ProjectProgressSchema);
96
- exports.validateWorkspaceInsights = createValidator(types_10.WorkspaceInsightsSchema);
97
- exports.validateBackup = createValidator(types_11.BackupSchema);
98
- exports.validateBackupArray = createArrayValidator(exports.validateBackup);
99
- exports.validateIdMapping = createValidator(types_12.IdMappingSchema);
100
- exports.validateIdMappingArray = createArrayValidator(exports.validateIdMapping);
101
- exports.validateMovedId = createValidator(types_12.MovedIdSchema);
102
- exports.validateMovedIdArray = createArrayValidator(exports.validateMovedId);
103
- // Sync resource validators
104
- exports.validateFilter = createValidator(resources_1.FilterSchema);
105
- exports.validateFilterArray = createArrayValidator(exports.validateFilter);
106
- exports.validateCollaborator = createValidator(resources_1.CollaboratorSchema);
107
- exports.validateCollaboratorArray = createArrayValidator(exports.validateCollaborator);
108
- exports.validateCollaboratorState = createValidator(resources_1.CollaboratorStateSchema);
109
- exports.validateCollaboratorStateArray = createArrayValidator(exports.validateCollaboratorState);
110
- exports.validateFolder = createValidator(resources_1.FolderSchema);
111
- exports.validateFolderArray = createArrayValidator(exports.validateFolder);
112
- exports.validateNote = createValidator(resources_1.NoteSchema);
113
- exports.validateNoteArray = createArrayValidator(exports.validateNote);
114
- exports.validateTooltips = createValidator(resources_1.TooltipsSchema);
115
- exports.validateWorkspaceFilter = createValidator(resources_1.WorkspaceFilterSchema);
116
- exports.validateWorkspaceFilterArray = createArrayValidator(exports.validateWorkspaceFilter);
117
- exports.validateWorkspaceGoal = createValidator(resources_1.WorkspaceGoalSchema);
118
- exports.validateWorkspaceGoalArray = createArrayValidator(exports.validateWorkspaceGoal);
119
- exports.validateCalendar = createValidator(resources_1.CalendarSchema);
120
- exports.validateCalendarArray = createArrayValidator(exports.validateCalendar);
121
- exports.validateCalendarAccount = createValidator(resources_1.CalendarAccountSchema);
122
- exports.validateCalendarAccountArray = createArrayValidator(exports.validateCalendarAccount);
123
- exports.validateReminder = createValidator(resources_1.ReminderSchema);
124
- exports.validateReminderArray = createArrayValidator(exports.validateReminder);
125
- exports.validateLocationReminder = createValidator(resources_1.LocationReminderSchema);
126
- exports.validateLocationReminderArray = createArrayValidator(exports.validateLocationReminder);
127
- exports.validateCompletedInfo = createValidator(resources_1.CompletedInfoSchema);
128
- exports.validateCompletedInfoArray = createArrayValidator(exports.validateCompletedInfo);
129
- exports.validateViewOptions = createValidator(resources_1.ViewOptionsSchema);
130
- exports.validateViewOptionsArray = createArrayValidator(exports.validateViewOptions);
131
- exports.validateProjectViewOptionsDefaults = createValidator(resources_1.ProjectViewOptionsDefaultsSchema);
132
- exports.validateProjectViewOptionsDefaultsArray = createArrayValidator(exports.validateProjectViewOptionsDefaults);
133
- exports.validateUserPlanLimits = createValidator(resources_1.UserPlanLimitsSchema);
134
- exports.validateLiveNotification = createValidator(resources_1.LiveNotificationSchema);
135
- exports.validateLiveNotificationArray = createArrayValidator(exports.validateLiveNotification);
136
- exports.validateSyncWorkspace = createValidator(resources_1.SyncWorkspaceSchema);
137
- exports.validateSyncWorkspaceArray = createArrayValidator(exports.validateSyncWorkspace);
138
- exports.validateSyncUser = createValidator(resources_1.SyncUserSchema);
139
- exports.validateUserSettings = createValidator(resources_1.UserSettingsSchema);
140
- exports.validateSuggestion = createValidator(resources_1.SuggestionSchema);
141
- exports.validateSuggestionArray = createArrayValidator(exports.validateSuggestion);
@@ -1,196 +0,0 @@
1
- import { request, isSuccess } from './transport/http-client.js';
2
- import { v4 as uuid } from 'uuid';
3
- import { TodoistRequestError } from './types/index.js';
4
- import { getAuthBaseUri, getSyncBaseUri, ENDPOINT_AUTHORIZATION, ENDPOINT_GET_TOKEN, ENDPOINT_REVOKE, ENDPOINT_REST_ACCESS_TOKENS_MIGRATE, } from './consts/endpoints.js';
5
- /** Available OAuth2 permission scopes. */
6
- export const PERMISSIONS = [
7
- 'task:add',
8
- 'data:read',
9
- 'data:read_write',
10
- 'data:delete',
11
- 'project:delete',
12
- 'backups:read',
13
- ];
14
- /**
15
- * Creates a Basic Authentication header value from client credentials.
16
- * @param clientId - The OAuth client ID
17
- * @param clientSecret - The OAuth client secret
18
- * @returns The Basic Auth header value (without the 'Basic ' prefix)
19
- */
20
- function createBasicAuthHeader(clientId, clientSecret) {
21
- const credentials = `${clientId}:${clientSecret}`;
22
- return Buffer.from(credentials).toString('base64');
23
- }
24
- /**
25
- * Generates a random state parameter for OAuth2 authorization.
26
- * The state parameter helps prevent CSRF attacks.
27
- *
28
- * @example
29
- * ```typescript
30
- * const state = getAuthStateParameter()
31
- * // Store state in session
32
- * const authUrl = getAuthorizationUrl(clientId, ['data:read'], state)
33
- * ```
34
- *
35
- * @returns A random UUID v4 string
36
- */
37
- export function getAuthStateParameter() {
38
- return uuid();
39
- }
40
- /**
41
- * Generates the authorization URL for the OAuth2 flow.
42
- *
43
- * @example
44
- * ```typescript
45
- * const url = getAuthorizationUrl(
46
- * 'your-client-id',
47
- * ['data:read', 'task:add'],
48
- * state
49
- * )
50
- * // Redirect user to url
51
- * ```
52
- *
53
- * @returns The full authorization URL to redirect users to
54
- * @see https://developer.todoist.com/api/v1/#tag/Authorization/OAuth
55
- */
56
- export function getAuthorizationUrl({ clientId, permissions, state, baseUrl, }) {
57
- if (!(permissions === null || permissions === void 0 ? void 0 : permissions.length)) {
58
- throw new Error('At least one scope value should be passed for permissions.');
59
- }
60
- const scope = permissions.join(',');
61
- return `${getAuthBaseUri(baseUrl)}${ENDPOINT_AUTHORIZATION}?client_id=${clientId}&scope=${scope}&state=${state}`;
62
- }
63
- /**
64
- * Exchanges an authorization code for an access token.
65
- *
66
- * @example
67
- * ```typescript
68
- * const { accessToken } = await getAuthToken({
69
- * clientId: 'your-client-id',
70
- * clientSecret: 'your-client-secret',
71
- * code: authCode
72
- * })
73
- * ```
74
- *
75
- * @returns The access token response
76
- * @throws {@link TodoistRequestError} If the token exchange fails
77
- */
78
- export async function getAuthToken(args, options) {
79
- var _a;
80
- if (typeof options === 'string') {
81
- throw new TypeError('Passing baseUrl as a string is no longer supported. Use an options object instead: getAuthToken(args, { baseUrl })');
82
- }
83
- const baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl;
84
- const customFetch = options === null || options === void 0 ? void 0 : options.customFetch;
85
- try {
86
- const response = await request({
87
- httpMethod: 'POST',
88
- baseUri: getAuthBaseUri(baseUrl),
89
- relativePath: ENDPOINT_GET_TOKEN,
90
- apiToken: undefined,
91
- payload: args,
92
- customFetch,
93
- });
94
- if (response.status !== 200 || !((_a = response.data) === null || _a === void 0 ? void 0 : _a.accessToken)) {
95
- throw new TodoistRequestError('Authentication token exchange failed.', response.status, response.data);
96
- }
97
- return response.data;
98
- }
99
- catch (error) {
100
- // Re-throw with custom message for authentication failures
101
- const err = error;
102
- throw new TodoistRequestError('Authentication token exchange failed.', err.httpStatusCode, err.responseData);
103
- }
104
- }
105
- /**
106
- * Revokes a token using the RFC 7009 OAuth 2.0 Token Revocation standard.
107
- *
108
- * This function uses HTTP Basic Authentication with client credentials and follows
109
- * the RFC 7009 specification for token revocation.
110
- *
111
- * @example
112
- * ```typescript
113
- * await revokeToken({
114
- * clientId: 'your-client-id',
115
- * clientSecret: 'your-client-secret',
116
- * token: 'access-token-to-revoke'
117
- * })
118
- * ```
119
- *
120
- * @returns True if revocation was successful
121
- * @see https://datatracker.ietf.org/doc/html/rfc7009
122
- * @see https://developer.todoist.com/api/v1/#tag/Authorization
123
- */
124
- export async function revokeToken(args, options) {
125
- if (typeof options === 'string') {
126
- throw new TypeError('Passing baseUrl as a string is no longer supported. Use an options object instead: revokeToken(args, { baseUrl })');
127
- }
128
- const baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl;
129
- const customFetch = options === null || options === void 0 ? void 0 : options.customFetch;
130
- const { clientId, clientSecret, token } = args;
131
- // Create Basic Auth header as per RFC 7009
132
- const basicAuth = createBasicAuthHeader(clientId, clientSecret);
133
- const customHeaders = {
134
- Authorization: `Basic ${basicAuth}`,
135
- };
136
- // Request body only contains the token and optional token_type_hint
137
- const requestBody = {
138
- token,
139
- token_type_hint: 'access_token',
140
- };
141
- const response = await request({
142
- httpMethod: 'POST',
143
- baseUri: getSyncBaseUri(baseUrl),
144
- relativePath: ENDPOINT_REVOKE,
145
- apiToken: undefined,
146
- payload: requestBody,
147
- requestId: undefined,
148
- hasSyncCommands: false,
149
- customHeaders: customHeaders,
150
- customFetch,
151
- });
152
- return isSuccess(response);
153
- }
154
- /**
155
- * Migrates a personal API token to an OAuth access token.
156
- *
157
- * This allows applications to transition users from personal API tokens
158
- * to proper OAuth tokens without requiring the user to go through the
159
- * full OAuth authorization flow.
160
- *
161
- * @example
162
- * ```typescript
163
- * const { accessToken } = await migratePersonalToken({
164
- * clientId: 'your-client-id',
165
- * clientSecret: 'your-client-secret',
166
- * personalToken: 'user-personal-token',
167
- * scope: 'data:read_write,data:delete'
168
- * })
169
- * ```
170
- *
171
- * @returns The new OAuth token response
172
- * @throws {@link TodoistRequestError} If the migration fails
173
- */
174
- export async function migratePersonalToken(args, options) {
175
- var _a;
176
- const baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl;
177
- const customFetch = options === null || options === void 0 ? void 0 : options.customFetch;
178
- try {
179
- const response = await request({
180
- httpMethod: 'POST',
181
- baseUri: getSyncBaseUri(baseUrl),
182
- relativePath: ENDPOINT_REST_ACCESS_TOKENS_MIGRATE,
183
- apiToken: undefined,
184
- payload: Object.assign(Object.assign({}, args), { scope: args.scope.join(',') }),
185
- customFetch,
186
- });
187
- if (response.status !== 200 || !((_a = response.data) === null || _a === void 0 ? void 0 : _a.accessToken)) {
188
- throw new TodoistRequestError('Personal token migration failed.', response.status, response.data);
189
- }
190
- return response.data;
191
- }
192
- catch (error) {
193
- const err = error;
194
- throw new TodoistRequestError('Personal token migration failed.', err.httpStatusCode, err.responseData);
195
- }
196
- }
@@ -1,122 +0,0 @@
1
- const BASE_URI = 'https://api.todoist.com';
2
- const TODOIST_URI = 'https://todoist.com';
3
- export const TODOIST_WEB_URI = 'https://app.todoist.com/app';
4
- // The API version is not configurable, to ensure
5
- // compatibility between the API and the client.
6
- export const API_VERSION = 'v1';
7
- export const API_BASE_URI = `/api/${API_VERSION}/`;
8
- const API_AUTHORIZATION_BASE_URI = '/oauth/';
9
- export function getSyncBaseUri(domainBase = BASE_URI) {
10
- return new URL(API_BASE_URI, domainBase).toString();
11
- }
12
- export function getAuthBaseUri(domainBase = TODOIST_URI) {
13
- return new URL(API_AUTHORIZATION_BASE_URI, domainBase).toString();
14
- }
15
- export const ENDPOINT_REST_TASKS = 'tasks';
16
- export const ENDPOINT_REST_TASKS_FILTER = ENDPOINT_REST_TASKS + '/filter';
17
- export const ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = ENDPOINT_REST_TASKS + '/completed/by_completion_date';
18
- export const ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = ENDPOINT_REST_TASKS + '/completed/by_due_date';
19
- export const ENDPOINT_REST_TASKS_COMPLETED_SEARCH = 'completed/search';
20
- export const ENDPOINT_REST_SECTIONS = 'sections';
21
- export const ENDPOINT_REST_SECTIONS_SEARCH = ENDPOINT_REST_SECTIONS + '/search';
22
- export const ENDPOINT_REST_LABELS = 'labels';
23
- export const ENDPOINT_REST_LABELS_SEARCH = ENDPOINT_REST_LABELS + '/search';
24
- export const ENDPOINT_REST_LABELS_SHARED = ENDPOINT_REST_LABELS + '/shared';
25
- export const ENDPOINT_REST_LABELS_SHARED_RENAME = ENDPOINT_REST_LABELS_SHARED + '/rename';
26
- export const ENDPOINT_REST_LABELS_SHARED_REMOVE = ENDPOINT_REST_LABELS_SHARED + '/remove';
27
- export const ENDPOINT_REST_COMMENTS = 'comments';
28
- export const ENDPOINT_REST_REMINDERS = 'reminders';
29
- export const ENDPOINT_REST_LOCATION_REMINDERS = 'location_reminders';
30
- export const ENDPOINT_REST_TASK_CLOSE = 'close';
31
- export const ENDPOINT_REST_TASK_REOPEN = 'reopen';
32
- export const ENDPOINT_REST_TASK_MOVE = 'move';
33
- export const ENDPOINT_REST_PROJECTS = 'projects';
34
- export const ENDPOINT_REST_PROJECTS_SEARCH = ENDPOINT_REST_PROJECTS + '/search';
35
- export const ENDPOINT_REST_PROJECTS_ARCHIVED = ENDPOINT_REST_PROJECTS + '/archived';
36
- export const ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
37
- export const ENDPOINT_REST_USER = 'user';
38
- export const ENDPOINT_REST_PRODUCTIVITY = ENDPOINT_REST_TASKS + '/completed/stats';
39
- export const ENDPOINT_REST_ACTIVITIES = 'activities';
40
- export const ENDPOINT_REST_UPLOADS = 'uploads';
41
- export const PROJECT_ARCHIVE = 'archive';
42
- export const PROJECT_UNARCHIVE = 'unarchive';
43
- export const ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT = ENDPOINT_REST_PROJECTS + '/archived/count';
44
- export const ENDPOINT_REST_PROJECTS_PERMISSIONS = ENDPOINT_REST_PROJECTS + '/permissions';
45
- export const ENDPOINT_REST_PROJECT_FULL = 'full';
46
- export const ENDPOINT_REST_PROJECT_JOIN = 'join';
47
- export const SECTION_ARCHIVE = 'archive';
48
- export const SECTION_UNARCHIVE = 'unarchive';
49
- export const ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = ENDPOINT_REST_PROJECTS + '/move_to_workspace';
50
- export const ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = ENDPOINT_REST_PROJECTS + '/move_to_personal';
51
- export const ENDPOINT_REST_TASKS_COMPLETED = ENDPOINT_REST_TASKS + '/completed';
52
- export const ENDPOINT_REST_TEMPLATES_FILE = 'templates/file';
53
- export const ENDPOINT_REST_TEMPLATES_URL = 'templates/url';
54
- export const ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = 'templates/create_project_from_file';
55
- export const ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = 'templates/import_into_project_from_file';
56
- export const ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = 'templates/import_into_project_from_template_id';
57
- export const ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = 'access_tokens/migrate_personal_token';
58
- export const ENDPOINT_REST_BACKUPS = 'backups';
59
- export const ENDPOINT_REST_BACKUPS_DOWNLOAD = 'backups/download';
60
- export const ENDPOINT_REST_EMAILS = 'emails';
61
- export const ENDPOINT_REST_ID_MAPPINGS = 'id_mappings';
62
- export const ENDPOINT_REST_MOVED_IDS = 'moved_ids';
63
- export const ENDPOINT_SYNC_QUICK_ADD = ENDPOINT_REST_TASKS + '/quick';
64
- export const ENDPOINT_SYNC = 'sync';
65
- export const ENDPOINT_AUTHORIZATION = 'authorize';
66
- export const ENDPOINT_GET_TOKEN = 'access_token';
67
- export const ENDPOINT_REVOKE = 'revoke';
68
- export const ENDPOINT_REST_FOLDERS = 'folders';
69
- // Workspace endpoints
70
- export const ENDPOINT_REST_WORKSPACES = 'workspaces';
71
- export const ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
72
- export const ENDPOINT_WORKSPACE_INVITATIONS_ALL = 'workspaces/invitations/all';
73
- export const ENDPOINT_WORKSPACE_INVITATIONS_DELETE = 'workspaces/invitations/delete';
74
- export const ENDPOINT_WORKSPACE_JOIN = 'workspaces/join';
75
- export const ENDPOINT_WORKSPACE_LOGO = 'workspaces/logo';
76
- export const ENDPOINT_WORKSPACE_PLAN_DETAILS = 'workspaces/plan_details';
77
- export const ENDPOINT_WORKSPACE_USERS = 'workspaces/users';
78
- // Workspace invitation actions (require invite_code parameter)
79
- export function getWorkspaceInvitationAcceptEndpoint(inviteCode) {
80
- return `workspaces/invitations/${inviteCode}/accept`;
81
- }
82
- export function getWorkspaceInvitationRejectEndpoint(inviteCode) {
83
- return `workspaces/invitations/${inviteCode}/reject`;
84
- }
85
- // Insights endpoints
86
- export function getProjectInsightsActivityStatsEndpoint(projectId) {
87
- return `projects/${projectId}/insights/activity_stats`;
88
- }
89
- export function getProjectInsightsHealthEndpoint(projectId) {
90
- return `projects/${projectId}/insights/health`;
91
- }
92
- export function getProjectInsightsHealthContextEndpoint(projectId) {
93
- return `projects/${projectId}/insights/health/context`;
94
- }
95
- export function getProjectInsightsProgressEndpoint(projectId) {
96
- return `projects/${projectId}/insights/progress`;
97
- }
98
- export function getProjectInsightsHealthAnalyzeEndpoint(projectId) {
99
- return `projects/${projectId}/insights/health/analyze`;
100
- }
101
- export function getWorkspaceInsightsEndpoint(workspaceId) {
102
- return `workspaces/${workspaceId}/insights`;
103
- }
104
- // Workspace members
105
- export const ENDPOINT_WORKSPACE_MEMBERS = 'workspaces/members';
106
- // Workspace user management (require workspace_id and/or user_id parameters)
107
- export function getWorkspaceUserTasksEndpoint(workspaceId, userId) {
108
- return `workspaces/${workspaceId}/users/${userId}/tasks`;
109
- }
110
- export function getWorkspaceInviteUsersEndpoint(workspaceId) {
111
- return `workspaces/${workspaceId}/users/invite`;
112
- }
113
- export function getWorkspaceUserEndpoint(workspaceId, userId) {
114
- return `workspaces/${workspaceId}/users/${userId}`;
115
- }
116
- // Workspace projects (require workspace_id parameter)
117
- export function getWorkspaceActiveProjectsEndpoint(workspaceId) {
118
- return `workspaces/${workspaceId}/projects/active`;
119
- }
120
- export function getWorkspaceArchivedProjectsEndpoint(workspaceId) {
121
- return `workspaces/${workspaceId}/projects/archived`;
122
- }
package/dist/esm/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './todoist-api.js';
2
- export * from './authentication.js';
3
- export * from './types/index.js';
4
- export * from './utils/index.js';
@@ -1,8 +0,0 @@
1
- // Has to use 'any' to express constructor type
2
- // oxlint-disable-next-line no-explicit-any
3
- export function assertInstance(value, type) {
4
- if (value instanceof type) {
5
- return;
6
- }
7
- throw new TypeError(`Unexpected type ${typeof value}`);
8
- }