@doist/todoist-sdk 14.2.0 → 15.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 (166) hide show
  1. package/dist/esm/utils/index.js +1 -1
  2. package/dist/esm/utils/url-helpers.js +151 -23
  3. package/dist/types/utils/index.d.ts +2 -1
  4. package/dist/types/utils/url-helpers.d.ts +88 -0
  5. package/package.json +5 -10
  6. package/dist/cjs/authentication.js +0 -317
  7. package/dist/cjs/clients/activity-client.js +0 -63
  8. package/dist/cjs/clients/app-client.js +0 -345
  9. package/dist/cjs/clients/backup-client.js +0 -47
  10. package/dist/cjs/clients/base-client.js +0 -31
  11. package/dist/cjs/clients/billing-client.js +0 -152
  12. package/dist/cjs/clients/comment-client.js +0 -91
  13. package/dist/cjs/clients/email-client.js +0 -43
  14. package/dist/cjs/clients/folder-client.js +0 -79
  15. package/dist/cjs/clients/id-mapping-client.js +0 -39
  16. package/dist/cjs/clients/insights-client.js +0 -87
  17. package/dist/cjs/clients/label-client.js +0 -126
  18. package/dist/cjs/clients/productivity-client.js +0 -27
  19. package/dist/cjs/clients/project-client.js +0 -235
  20. package/dist/cjs/clients/reminder-client.js +0 -198
  21. package/dist/cjs/clients/section-client.js +0 -117
  22. package/dist/cjs/clients/task-client.js +0 -254
  23. package/dist/cjs/clients/template-client.js +0 -88
  24. package/dist/cjs/clients/ui-extension-client.js +0 -107
  25. package/dist/cjs/clients/upload-client.js +0 -155
  26. package/dist/cjs/clients/view-options-client.js +0 -25
  27. package/dist/cjs/clients/workspace-client.js +0 -366
  28. package/dist/cjs/consts/endpoints.js +0 -224
  29. package/dist/cjs/index.js +0 -24
  30. package/dist/cjs/package.json +0 -1
  31. package/dist/cjs/test-utils/asserts.js +0 -11
  32. package/dist/cjs/test-utils/msw-setup.js +0 -97
  33. package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -54
  34. package/dist/cjs/test-utils/test-defaults.js +0 -371
  35. package/dist/cjs/test-utils/transport-seam.js +0 -17
  36. package/dist/cjs/test-utils/webhook-fixtures.js +0 -32
  37. package/dist/cjs/todoist-api.js +0 -1711
  38. package/dist/cjs/transport/fetch-with-retry.js +0 -219
  39. package/dist/cjs/transport/http-client.js +0 -134
  40. package/dist/cjs/transport/http-dispatcher.js +0 -198
  41. package/dist/cjs/transport/sync-request.js +0 -83
  42. package/dist/cjs/types/activity/index.js +0 -18
  43. package/dist/cjs/types/activity/requests.js +0 -2
  44. package/dist/cjs/types/activity/types.js +0 -28
  45. package/dist/cjs/types/apps/index.js +0 -18
  46. package/dist/cjs/types/apps/requests.js +0 -2
  47. package/dist/cjs/types/apps/types.js +0 -254
  48. package/dist/cjs/types/backups/index.js +0 -18
  49. package/dist/cjs/types/backups/requests.js +0 -2
  50. package/dist/cjs/types/backups/types.js +0 -8
  51. package/dist/cjs/types/billing/index.js +0 -18
  52. package/dist/cjs/types/billing/requests.js +0 -2
  53. package/dist/cjs/types/billing/types.js +0 -92
  54. package/dist/cjs/types/comments/index.js +0 -18
  55. package/dist/cjs/types/comments/requests.js +0 -2
  56. package/dist/cjs/types/comments/types.js +0 -60
  57. package/dist/cjs/types/common.js +0 -10
  58. package/dist/cjs/types/emails/index.js +0 -17
  59. package/dist/cjs/types/emails/requests.js +0 -5
  60. package/dist/cjs/types/errors.js +0 -29
  61. package/dist/cjs/types/folders/index.js +0 -17
  62. package/dist/cjs/types/folders/requests.js +0 -2
  63. package/dist/cjs/types/http.js +0 -24
  64. package/dist/cjs/types/id-mappings/index.js +0 -18
  65. package/dist/cjs/types/id-mappings/requests.js +0 -20
  66. package/dist/cjs/types/id-mappings/types.js +0 -12
  67. package/dist/cjs/types/index.js +0 -40
  68. package/dist/cjs/types/insights/index.js +0 -18
  69. package/dist/cjs/types/insights/requests.js +0 -2
  70. package/dist/cjs/types/insights/types.js +0 -80
  71. package/dist/cjs/types/labels/index.js +0 -18
  72. package/dist/cjs/types/labels/requests.js +0 -2
  73. package/dist/cjs/types/labels/types.js +0 -11
  74. package/dist/cjs/types/productivity/index.js +0 -17
  75. package/dist/cjs/types/productivity/types.js +0 -68
  76. package/dist/cjs/types/projects/index.js +0 -18
  77. package/dist/cjs/types/projects/requests.js +0 -2
  78. package/dist/cjs/types/projects/types.js +0 -66
  79. package/dist/cjs/types/reminders/index.js +0 -17
  80. package/dist/cjs/types/reminders/requests.js +0 -95
  81. package/dist/cjs/types/sections/index.js +0 -18
  82. package/dist/cjs/types/sections/requests.js +0 -2
  83. package/dist/cjs/types/sections/types.js +0 -25
  84. package/dist/cjs/types/sync/commands/calendars.js +0 -2
  85. package/dist/cjs/types/sync/commands/filters.js +0 -2
  86. package/dist/cjs/types/sync/commands/folders.js +0 -2
  87. package/dist/cjs/types/sync/commands/index.js +0 -34
  88. package/dist/cjs/types/sync/commands/labels.js +0 -5
  89. package/dist/cjs/types/sync/commands/notes.js +0 -2
  90. package/dist/cjs/types/sync/commands/notifications.js +0 -2
  91. package/dist/cjs/types/sync/commands/others.js +0 -2
  92. package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
  93. package/dist/cjs/types/sync/commands/projects.js +0 -2
  94. package/dist/cjs/types/sync/commands/reminders.js +0 -2
  95. package/dist/cjs/types/sync/commands/sections.js +0 -2
  96. package/dist/cjs/types/sync/commands/shared.js +0 -20
  97. package/dist/cjs/types/sync/commands/sharing.js +0 -2
  98. package/dist/cjs/types/sync/commands/tasks.js +0 -2
  99. package/dist/cjs/types/sync/commands/view-options.js +0 -2
  100. package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
  101. package/dist/cjs/types/sync/commands/workspaces.js +0 -2
  102. package/dist/cjs/types/sync/index.js +0 -22
  103. package/dist/cjs/types/sync/request.js +0 -2
  104. package/dist/cjs/types/sync/resource-types.js +0 -39
  105. package/dist/cjs/types/sync/resources/calendars.js +0 -27
  106. package/dist/cjs/types/sync/resources/collaborators.js +0 -21
  107. package/dist/cjs/types/sync/resources/completed-info.js +0 -24
  108. package/dist/cjs/types/sync/resources/filters.js +0 -14
  109. package/dist/cjs/types/sync/resources/folders.js +0 -12
  110. package/dist/cjs/types/sync/resources/index.js +0 -32
  111. package/dist/cjs/types/sync/resources/live-notifications.js +0 -38
  112. package/dist/cjs/types/sync/resources/notes.js +0 -21
  113. package/dist/cjs/types/sync/resources/reminders.js +0 -50
  114. package/dist/cjs/types/sync/resources/suggestions.js +0 -36
  115. package/dist/cjs/types/sync/resources/tooltips.js +0 -8
  116. package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -20
  117. package/dist/cjs/types/sync/resources/user-settings.js +0 -40
  118. package/dist/cjs/types/sync/resources/user.js +0 -110
  119. package/dist/cjs/types/sync/resources/view-options.js +0 -86
  120. package/dist/cjs/types/sync/resources/workspace-filters.js +0 -19
  121. package/dist/cjs/types/sync/resources/workspaces.js +0 -72
  122. package/dist/cjs/types/sync/response.js +0 -54
  123. package/dist/cjs/types/sync/user-preferences.js +0 -71
  124. package/dist/cjs/types/tasks/index.js +0 -18
  125. package/dist/cjs/types/tasks/requests.js +0 -2
  126. package/dist/cjs/types/tasks/types.js +0 -59
  127. package/dist/cjs/types/templates/index.js +0 -17
  128. package/dist/cjs/types/templates/requests.js +0 -2
  129. package/dist/cjs/types/ui-extensions/index.js +0 -18
  130. package/dist/cjs/types/ui-extensions/requests.js +0 -2
  131. package/dist/cjs/types/ui-extensions/types.js +0 -77
  132. package/dist/cjs/types/uploads/index.js +0 -17
  133. package/dist/cjs/types/uploads/requests.js +0 -2
  134. package/dist/cjs/types/users/index.js +0 -17
  135. package/dist/cjs/types/users/types.js +0 -51
  136. package/dist/cjs/types/webhooks/comments.js +0 -96
  137. package/dist/cjs/types/webhooks/envelope.js +0 -26
  138. package/dist/cjs/types/webhooks/filters.js +0 -30
  139. package/dist/cjs/types/webhooks/index.js +0 -25
  140. package/dist/cjs/types/webhooks/labels.js +0 -54
  141. package/dist/cjs/types/webhooks/projects.js +0 -36
  142. package/dist/cjs/types/webhooks/reminders.js +0 -35
  143. package/dist/cjs/types/webhooks/sections.js +0 -53
  144. package/dist/cjs/types/webhooks/tasks.js +0 -68
  145. package/dist/cjs/types/webhooks/types.js +0 -55
  146. package/dist/cjs/types/workspaces/index.js +0 -18
  147. package/dist/cjs/types/workspaces/requests.js +0 -2
  148. package/dist/cjs/types/workspaces/types.js +0 -154
  149. package/dist/cjs/utils/activity-helpers.js +0 -58
  150. package/dist/cjs/utils/case-conversion.js +0 -69
  151. package/dist/cjs/utils/colors.js +0 -143
  152. package/dist/cjs/utils/file-response.js +0 -32
  153. package/dist/cjs/utils/headers.js +0 -16
  154. package/dist/cjs/utils/index.js +0 -31
  155. package/dist/cjs/utils/multipart-upload.js +0 -293
  156. package/dist/cjs/utils/processing-helpers.js +0 -18
  157. package/dist/cjs/utils/project-helpers.js +0 -20
  158. package/dist/cjs/utils/request-helpers.js +0 -21
  159. package/dist/cjs/utils/sanitization.js +0 -116
  160. package/dist/cjs/utils/sync-helpers.js +0 -22
  161. package/dist/cjs/utils/task-sorting.js +0 -281
  162. package/dist/cjs/utils/uncompletable-helpers.js +0 -60
  163. package/dist/cjs/utils/url-helpers.js +0 -74
  164. package/dist/cjs/utils/validators.js +0 -108
  165. package/dist/cjs/utils/view-options.js +0 -19
  166. package/dist/cjs/utils/webhook-parser.js +0 -60
@@ -1,6 +1,6 @@
1
1
  export * from './colors.js';
2
2
  export * from './sanitization.js';
3
- export { getTaskUrl, getProjectUrl, getSectionUrl } from './url-helpers.js';
3
+ export { getTaskUrl, getProjectUrl, getSectionUrl, getLabelUrl, getFilterUrl, getWorkspaceFilterUrl, getWorkspaceUrl, getTaskCommentsUrl, getProjectCommentsUrl, getTaskCommentUrl, getProjectCommentUrl, parseTodoistUrl, TODOIST_LINK_TYPES, } from './url-helpers.js';
4
4
  export { createCommand } from './sync-helpers.js';
5
5
  export * from './project-helpers.js';
6
6
  export * from './task-sorting.js';
@@ -1,3 +1,5 @@
1
+ import { LinkEnvironment } from '@doist/sdk-kmp/common';
2
+ import { parseTodoistLink, todoistFilterUrl, todoistLabelUrl, todoistProjectCommentsUrl, todoistProjectCommentUrl, todoistProjectUrl, todoistSectionUrl, todoistTaskCommentsUrl, todoistTaskCommentUrl, todoistTaskUrl, todoistWorkspaceFilterUrl, todoistWorkspaceUrl, } from '@doist/sdk-kmp/todoist';
1
3
  import { TODOIST_WEB_URI } from '../consts/endpoints.js';
2
4
  /**
3
5
  * Formats a Date object to YYYY-MM-DD string format.
@@ -12,6 +14,23 @@ export function formatDateToYYYYMMDD(date) {
12
14
  const day = String(date.getDate()).padStart(2, '0');
13
15
  return `${year}-${month}-${day}`;
14
16
  }
17
+ /**
18
+ * Builds a URL, falling back to a bare-id URL when the link builder rejects the
19
+ * given id. These helpers are called while parsing API responses, so generating
20
+ * a URL must never fail the parse.
21
+ *
22
+ * @param build Builds the URL.
23
+ * @param fallbackPath The path to fall back to, relative to the Todoist web app.
24
+ * @returns The built URL, or a bare-id URL if the id was rejected.
25
+ */
26
+ function buildUrl(build, fallbackPath) {
27
+ try {
28
+ return build();
29
+ }
30
+ catch (_a) {
31
+ return `${TODOIST_WEB_URI}/${fallbackPath}`;
32
+ }
33
+ }
15
34
  /**
16
35
  * Generate the URL for a given task.
17
36
  *
@@ -20,9 +39,7 @@ export function formatDateToYYYYMMDD(date) {
20
39
  * @returns The URL string for the task view.
21
40
  */
22
41
  export function getTaskUrl(taskId, content) {
23
- const slug = content ? slugify(content) : undefined;
24
- const path = slug ? `${slug}-${taskId}` : taskId;
25
- return `${TODOIST_WEB_URI}/task/${path}`;
42
+ return buildUrl(() => todoistTaskUrl(taskId, content !== null && content !== void 0 ? content : '', LinkEnvironment.Production), `task/${taskId}`);
26
43
  }
27
44
  /**
28
45
  * Generate the URL for a given project.
@@ -32,9 +49,7 @@ export function getTaskUrl(taskId, content) {
32
49
  * @returns The URL string for the project view.
33
50
  */
34
51
  export function getProjectUrl(projectId, name) {
35
- const slug = name ? slugify(name) : undefined;
36
- const path = slug ? `${slug}-${projectId}` : projectId;
37
- return `${TODOIST_WEB_URI}/project/${path}`;
52
+ return buildUrl(() => todoistProjectUrl(projectId, name !== null && name !== void 0 ? name : '', LinkEnvironment.Production), `project/${projectId}`);
38
53
  }
39
54
  /**
40
55
  * Generate the URL for a given section.
@@ -44,25 +59,138 @@ export function getProjectUrl(projectId, name) {
44
59
  * @returns The URL string for the section view.
45
60
  */
46
61
  export function getSectionUrl(sectionId, name) {
47
- const slug = name ? slugify(name) : undefined;
48
- const path = slug ? `${slug}-${sectionId}` : sectionId;
49
- return `${TODOIST_WEB_URI}/section/${path}`;
62
+ return buildUrl(() => todoistSectionUrl(sectionId, name !== null && name !== void 0 ? name : '', LinkEnvironment.Production), `section/${sectionId}`);
63
+ }
64
+ /**
65
+ * Generate the URL for a given label.
66
+ *
67
+ * @param labelId The ID of the label.
68
+ * @param name The name of the label.
69
+ * @returns The URL string for the label view.
70
+ */
71
+ export function getLabelUrl(labelId, name) {
72
+ return buildUrl(() => todoistLabelUrl(labelId, name !== null && name !== void 0 ? name : '', LinkEnvironment.Production), `label/${labelId}`);
73
+ }
74
+ /**
75
+ * Generate the URL for a given filter.
76
+ *
77
+ * @param filterId The ID of the filter.
78
+ * @param name The name of the filter.
79
+ * @returns The URL string for the filter view.
80
+ */
81
+ export function getFilterUrl(filterId, name) {
82
+ return buildUrl(() => todoistFilterUrl(filterId, name !== null && name !== void 0 ? name : '', LinkEnvironment.Production), `filter/${filterId}`);
83
+ }
84
+ /**
85
+ * Generate the URL for a filter belonging to a workspace.
86
+ *
87
+ * @param workspaceId The ID of the workspace the filter belongs to.
88
+ * @param filterId The ID of the filter.
89
+ * @param name The name of the filter.
90
+ * @returns The URL string for the workspace filter view.
91
+ */
92
+ export function getWorkspaceFilterUrl(workspaceId, filterId, name) {
93
+ return buildUrl(() => todoistWorkspaceFilterUrl(workspaceId, filterId, name !== null && name !== void 0 ? name : '', LinkEnvironment.Production), `${workspaceId}/filter/${filterId}`);
94
+ }
95
+ /**
96
+ * Generate the URL for a given workspace.
97
+ *
98
+ * @param workspaceId The ID of the workspace.
99
+ * @returns The URL string for the workspace view.
100
+ */
101
+ export function getWorkspaceUrl(workspaceId) {
102
+ return buildUrl(() => todoistWorkspaceUrl(workspaceId, LinkEnvironment.Production), workspaceId);
103
+ }
104
+ /**
105
+ * Generate the URL for the comments on a given task.
106
+ *
107
+ * @param taskId The ID of the task.
108
+ * @param content The content of the task.
109
+ * @returns The URL string for the task's comments.
110
+ */
111
+ export function getTaskCommentsUrl(taskId, content) {
112
+ return buildUrl(() => todoistTaskCommentsUrl(taskId, content !== null && content !== void 0 ? content : '', LinkEnvironment.Production), `task/${taskId}/comments`);
113
+ }
114
+ /**
115
+ * Generate the URL for the comments on a given project.
116
+ *
117
+ * @param projectId The ID of the project.
118
+ * @param name The name of the project.
119
+ * @returns The URL string for the project's comments.
120
+ */
121
+ export function getProjectCommentsUrl(projectId, name) {
122
+ return buildUrl(() => todoistProjectCommentsUrl(projectId, name !== null && name !== void 0 ? name : '', LinkEnvironment.Production), `project/${projectId}/comments`);
50
123
  }
51
124
  /**
52
- * Slugify function borrowed from Django.
125
+ * Generate the URL for a single comment on a given task.
126
+ *
127
+ * @param taskId The ID of the task.
128
+ * @param commentId The ID of the comment.
129
+ * @param content The content of the task.
130
+ * @returns The URL string for the comment.
131
+ */
132
+ export function getTaskCommentUrl(taskId, commentId, content) {
133
+ return buildUrl(() => todoistTaskCommentUrl(taskId, content !== null && content !== void 0 ? content : '', commentId, LinkEnvironment.Production), `task/${taskId}#comment-${commentId}`);
134
+ }
135
+ /**
136
+ * Generate the URL for a single comment on a given project.
137
+ *
138
+ * @param projectId The ID of the project.
139
+ * @param commentId The ID of the comment.
140
+ * @param name The name of the project.
141
+ * @returns The URL string for the comment.
142
+ */
143
+ export function getProjectCommentUrl(projectId, commentId, name) {
144
+ return buildUrl(() => todoistProjectCommentUrl(projectId, name !== null && name !== void 0 ? name : '', commentId, LinkEnvironment.Production), `project/${projectId}#comment-${commentId}`);
145
+ }
146
+ /** The kinds of Todoist entity a URL can point at. */
147
+ export const TODOIST_LINK_TYPES = [
148
+ 'task',
149
+ 'project',
150
+ 'filter',
151
+ 'label',
152
+ 'section',
153
+ 'workspace',
154
+ 'template',
155
+ 'comment',
156
+ 'label_by_name',
157
+ ];
158
+ /**
159
+ * Maps the link parser's type names onto the types this SDK exposes. A name
160
+ * that is missing here is one this SDK does not know about, and is treated as
161
+ * an unrecognised URL rather than surfaced as a value outside the union.
162
+ */
163
+ const LINK_TYPE_BY_PARSED_NAME = {
164
+ Task: 'task',
165
+ Project: 'project',
166
+ Filter: 'filter',
167
+ Label: 'label',
168
+ Section: 'section',
169
+ Workspace: 'workspace',
170
+ Template: 'template',
171
+ Comment: 'comment',
172
+ LabelByName: 'label_by_name',
173
+ };
174
+ /**
175
+ * Parse a Todoist URL into the entity it points at.
53
176
  *
54
- * @param value The string to slugify.
55
- * @returns The slugified string.
177
+ * @param url The URL to parse.
178
+ * @returns The entity the URL points at, or `null` if it is not a Todoist URL.
56
179
  */
57
- function slugify(value) {
58
- // Convert to ASCII
59
- let result = value.normalize('NFKD').replace(/[\u0300-\u036f]/g, '');
60
- // Remove non-ASCII characters
61
- result = result.replace(/[^\x20-\x7E]/g, '');
62
- // Convert to lowercase and replace non-alphanumeric characters with dashes
63
- result = result.toLowerCase().replace(/[^\w\s-]/g, '');
64
- // Replace spaces and repeated dashes with single dashes
65
- result = result.replace(/[-\s]+/g, '-');
66
- // Strip dashes from the beginning and end
67
- return result.replace(/^-+|-+$/g, '');
180
+ export function parseTodoistUrl(url) {
181
+ var _a, _b;
182
+ const link = parseTodoistLink(url);
183
+ if (!link) {
184
+ return null;
185
+ }
186
+ const type = LINK_TYPE_BY_PARSED_NAME[link.type.name];
187
+ if (!type) {
188
+ return null;
189
+ }
190
+ return {
191
+ type,
192
+ id: link.id,
193
+ workspaceId: (_a = link.workspaceId) !== null && _a !== void 0 ? _a : null,
194
+ commentId: (_b = link.commentId) !== null && _b !== void 0 ? _b : null,
195
+ };
68
196
  }
@@ -1,6 +1,7 @@
1
1
  export * from './colors.js';
2
2
  export * from './sanitization.js';
3
- export { getTaskUrl, getProjectUrl, getSectionUrl } from './url-helpers.js';
3
+ export { getTaskUrl, getProjectUrl, getSectionUrl, getLabelUrl, getFilterUrl, getWorkspaceFilterUrl, getWorkspaceUrl, getTaskCommentsUrl, getProjectCommentsUrl, getTaskCommentUrl, getProjectCommentUrl, parseTodoistUrl, TODOIST_LINK_TYPES, } from './url-helpers.js';
4
+ export type { TodoistLinkType, TodoistUrlInfo } from './url-helpers.js';
4
5
  export { createCommand } from './sync-helpers.js';
5
6
  export * from './project-helpers.js';
6
7
  export * from './task-sorting.js';
@@ -30,3 +30,91 @@ export declare function getProjectUrl(projectId: string, name?: string): string;
30
30
  * @returns The URL string for the section view.
31
31
  */
32
32
  export declare function getSectionUrl(sectionId: string, name?: string): string;
33
+ /**
34
+ * Generate the URL for a given label.
35
+ *
36
+ * @param labelId The ID of the label.
37
+ * @param name The name of the label.
38
+ * @returns The URL string for the label view.
39
+ */
40
+ export declare function getLabelUrl(labelId: string, name?: string): string;
41
+ /**
42
+ * Generate the URL for a given filter.
43
+ *
44
+ * @param filterId The ID of the filter.
45
+ * @param name The name of the filter.
46
+ * @returns The URL string for the filter view.
47
+ */
48
+ export declare function getFilterUrl(filterId: string, name?: string): string;
49
+ /**
50
+ * Generate the URL for a filter belonging to a workspace.
51
+ *
52
+ * @param workspaceId The ID of the workspace the filter belongs to.
53
+ * @param filterId The ID of the filter.
54
+ * @param name The name of the filter.
55
+ * @returns The URL string for the workspace filter view.
56
+ */
57
+ export declare function getWorkspaceFilterUrl(workspaceId: string, filterId: string, name?: string): string;
58
+ /**
59
+ * Generate the URL for a given workspace.
60
+ *
61
+ * @param workspaceId The ID of the workspace.
62
+ * @returns The URL string for the workspace view.
63
+ */
64
+ export declare function getWorkspaceUrl(workspaceId: string): string;
65
+ /**
66
+ * Generate the URL for the comments on a given task.
67
+ *
68
+ * @param taskId The ID of the task.
69
+ * @param content The content of the task.
70
+ * @returns The URL string for the task's comments.
71
+ */
72
+ export declare function getTaskCommentsUrl(taskId: string, content?: string): string;
73
+ /**
74
+ * Generate the URL for the comments on a given project.
75
+ *
76
+ * @param projectId The ID of the project.
77
+ * @param name The name of the project.
78
+ * @returns The URL string for the project's comments.
79
+ */
80
+ export declare function getProjectCommentsUrl(projectId: string, name?: string): string;
81
+ /**
82
+ * Generate the URL for a single comment on a given task.
83
+ *
84
+ * @param taskId The ID of the task.
85
+ * @param commentId The ID of the comment.
86
+ * @param content The content of the task.
87
+ * @returns The URL string for the comment.
88
+ */
89
+ export declare function getTaskCommentUrl(taskId: string, commentId: string, content?: string): string;
90
+ /**
91
+ * Generate the URL for a single comment on a given project.
92
+ *
93
+ * @param projectId The ID of the project.
94
+ * @param commentId The ID of the comment.
95
+ * @param name The name of the project.
96
+ * @returns The URL string for the comment.
97
+ */
98
+ export declare function getProjectCommentUrl(projectId: string, commentId: string, name?: string): string;
99
+ /** The kinds of Todoist entity a URL can point at. */
100
+ export declare const TODOIST_LINK_TYPES: readonly ["task", "project", "filter", "label", "section", "workspace", "template", "comment", "label_by_name"];
101
+ /** The kind of Todoist entity a URL points at. */
102
+ export type TodoistLinkType = (typeof TODOIST_LINK_TYPES)[number];
103
+ /** The entity a Todoist URL points at. */
104
+ export type TodoistUrlInfo = {
105
+ /** The kind of entity the URL points at. */
106
+ type: TodoistLinkType;
107
+ /** The ID of the entity. */
108
+ id: string;
109
+ /** The ID of the workspace the entity belongs to, when the URL names one. */
110
+ workspaceId: string | null;
111
+ /** The ID of the comment the URL points at, when the URL names one. */
112
+ commentId: string | null;
113
+ };
114
+ /**
115
+ * Parse a Todoist URL into the entity it points at.
116
+ *
117
+ * @param url The URL to parse.
118
+ * @returns The entity the URL points at, or `null` if it is not a Todoist URL.
119
+ */
120
+ export declare function parseTodoistUrl(url: string): TodoistUrlInfo | null;
package/package.json CHANGED
@@ -1,20 +1,17 @@
1
1
  {
2
2
  "name": "@doist/todoist-sdk",
3
- "version": "14.2.0",
3
+ "version": "15.0.0",
4
4
  "description": "The official TypeScript SDK for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "https://github.com/Doist/todoist-sdk-typescript",
7
7
  "homepage": "https://doist.github.io/todoist-sdk-typescript/",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
- "main": "dist/cjs/index.js",
11
- "module": "dist/esm/index.js",
12
10
  "types": "dist/types/index.d.ts",
13
11
  "exports": {
14
12
  ".": {
15
13
  "types": "./dist/types/index.d.ts",
16
- "import": "./dist/esm/index.js",
17
- "require": "./dist/cjs/index.js"
14
+ "default": "./dist/esm/index.js"
18
15
  }
19
16
  },
20
17
  "publishConfig": {
@@ -36,13 +33,11 @@
36
33
  "test:watch": "vitest",
37
34
  "test:coverage": "vitest run --coverage",
38
35
  "api:request": "node ./scripts/todoist-api-request.cjs",
39
- "build:cjs": "npx tsc -p tsconfig.cjs.json",
40
36
  "build:esm": "npx tsc -p tsconfig.esm.json",
41
37
  "build:fix-esm": "node scripts/fix-esm-imports.cjs",
42
38
  "build:fix-dts": "node scripts/fix-dts-imports.cjs",
43
- "build:post": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
44
- "build": "npm-run-all clean build:cjs build:esm build:fix-esm build:fix-dts build:post",
45
- "attw": "attw --pack --ignore-rules fallback-condition false-esm",
39
+ "build": "npm-run-all clean build:esm build:fix-esm build:fix-dts",
40
+ "attw": "attw --pack --ignore-rules cjs-resolves-to-esm",
46
41
  "integrity-checks": "npm-run-all clean check test build attw",
47
42
  "prepublishOnly": "npm run integrity-checks",
48
43
  "prepare": "npm run build"
@@ -51,6 +46,7 @@
51
46
  "fflate": "0.8.2"
52
47
  },
53
48
  "dependencies": {
49
+ "@doist/sdk-kmp": "0.2.3",
54
50
  "camelcase": "6.3.0",
55
51
  "emoji-regex": "10.6.0",
56
52
  "ts-custom-error": "^3.2.0",
@@ -91,7 +87,6 @@
91
87
  "*.{ts,tsx,json,md,yml,yaml}": "oxfmt --no-error-on-unmatched-pattern"
92
88
  },
93
89
  "files": [
94
- "dist/cjs/**/*",
95
90
  "dist/esm/**/*",
96
91
  "dist/types/**/*",
97
92
  "!dist/**/*.test.js",