@doist/todoist-sdk 9.2.0-next.1 → 9.3.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 (66) hide show
  1. package/dist/cjs/clients/app-client.js +24 -25
  2. package/dist/cjs/clients/comment-client.js +3 -4
  3. package/dist/cjs/clients/folder-client.js +3 -4
  4. package/dist/cjs/clients/insights-client.js +6 -7
  5. package/dist/cjs/clients/label-client.js +3 -4
  6. package/dist/cjs/clients/project-client.js +8 -9
  7. package/dist/cjs/clients/section-client.js +5 -6
  8. package/dist/cjs/clients/task-client.js +6 -7
  9. package/dist/cjs/clients/ui-extension-client.js +4 -5
  10. package/dist/cjs/clients/workspace-client.js +3 -4
  11. package/dist/cjs/consts/endpoints.js +1 -6
  12. package/dist/cjs/test-utils/test-defaults.js +3 -26
  13. package/dist/cjs/todoist-api.js +0 -33
  14. package/dist/cjs/types/apps/types.js +1 -0
  15. package/dist/cjs/types/index.js +0 -1
  16. package/dist/cjs/types/sync/commands/index.js +0 -1
  17. package/dist/cjs/types/sync/resource-types.js +0 -1
  18. package/dist/cjs/types/sync/response.js +10 -12
  19. package/dist/cjs/utils/validators.js +57 -54
  20. package/dist/esm/clients/app-client.js +25 -26
  21. package/dist/esm/clients/comment-client.js +4 -5
  22. package/dist/esm/clients/folder-client.js +4 -5
  23. package/dist/esm/clients/insights-client.js +7 -8
  24. package/dist/esm/clients/label-client.js +4 -5
  25. package/dist/esm/clients/project-client.js +9 -10
  26. package/dist/esm/clients/section-client.js +6 -7
  27. package/dist/esm/clients/task-client.js +7 -8
  28. package/dist/esm/clients/ui-extension-client.js +5 -6
  29. package/dist/esm/clients/workspace-client.js +4 -5
  30. package/dist/esm/consts/endpoints.js +0 -5
  31. package/dist/esm/test-utils/test-defaults.js +1 -24
  32. package/dist/esm/todoist-api.js +0 -33
  33. package/dist/esm/types/apps/types.js +1 -0
  34. package/dist/esm/types/index.js +0 -1
  35. package/dist/esm/types/sync/commands/index.js +0 -1
  36. package/dist/esm/types/sync/resource-types.js +0 -1
  37. package/dist/esm/types/sync/response.js +0 -2
  38. package/dist/esm/utils/validators.js +5 -2
  39. package/dist/types/clients/app-client.d.ts +1 -1
  40. package/dist/types/consts/endpoints.d.ts +0 -5
  41. package/dist/types/test-utils/test-defaults.d.ts +1 -4
  42. package/dist/types/todoist-api.d.ts +0 -12
  43. package/dist/types/types/apps/types.d.ts +4 -0
  44. package/dist/types/types/index.d.ts +0 -1
  45. package/dist/types/types/sync/commands/index.d.ts +0 -9
  46. package/dist/types/types/sync/resource-types.d.ts +1 -1
  47. package/dist/types/types/sync/resources/view-options.d.ts +6 -6
  48. package/dist/types/types/sync/response.d.ts +4 -29
  49. package/dist/types/types/tasks/requests.d.ts +0 -1
  50. package/dist/types/utils/validators.d.ts +15 -55
  51. package/package.json +1 -1
  52. package/dist/cjs/clients/goals-client.js +0 -145
  53. package/dist/cjs/types/goals/index.js +0 -18
  54. package/dist/cjs/types/goals/requests.js +0 -2
  55. package/dist/cjs/types/goals/types.js +0 -56
  56. package/dist/cjs/types/sync/commands/goals.js +0 -2
  57. package/dist/esm/clients/goals-client.js +0 -141
  58. package/dist/esm/types/goals/index.js +0 -2
  59. package/dist/esm/types/goals/requests.js +0 -1
  60. package/dist/esm/types/goals/types.js +0 -53
  61. package/dist/esm/types/sync/commands/goals.js +0 -1
  62. package/dist/types/clients/goals-client.d.ts +0 -20
  63. package/dist/types/types/goals/index.d.ts +0 -2
  64. package/dist/types/types/goals/requests.d.ts +0 -33
  65. package/dist/types/types/goals/types.d.ts +0 -51
  66. package/dist/types/types/sync/commands/goals.d.ts +0 -33
@@ -1,7 +1,6 @@
1
- import { z } from 'zod';
2
1
  import { getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsProgressEndpoint, getWorkspaceInsightsEndpoint, } from '../consts/endpoints.js';
3
2
  import { request } from '../transport/http-client.js';
4
- import { validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, } from '../utils/validators.js';
3
+ import { IdSchema, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, } from '../utils/validators.js';
5
4
  import { BaseClient } from './base-client.js';
6
5
  /**
7
6
  * Internal sub-client handling all insights-domain endpoints
@@ -13,7 +12,7 @@ import { BaseClient } from './base-client.js';
13
12
  */
14
13
  export class InsightsClient extends BaseClient {
15
14
  async getProjectActivityStats(projectId, args = {}) {
16
- z.string().parse(projectId);
15
+ IdSchema.parse(projectId);
17
16
  const response = await request({
18
17
  httpMethod: 'GET',
19
18
  baseUri: this.syncApiBase,
@@ -25,7 +24,7 @@ export class InsightsClient extends BaseClient {
25
24
  return validateProjectActivityStats(response.data);
26
25
  }
27
26
  async getProjectHealth(projectId) {
28
- z.string().parse(projectId);
27
+ IdSchema.parse(projectId);
29
28
  const response = await request({
30
29
  httpMethod: 'GET',
31
30
  baseUri: this.syncApiBase,
@@ -36,7 +35,7 @@ export class InsightsClient extends BaseClient {
36
35
  return validateProjectHealth(response.data);
37
36
  }
38
37
  async getProjectHealthContext(projectId) {
39
- z.string().parse(projectId);
38
+ IdSchema.parse(projectId);
40
39
  const response = await request({
41
40
  httpMethod: 'GET',
42
41
  baseUri: this.syncApiBase,
@@ -47,7 +46,7 @@ export class InsightsClient extends BaseClient {
47
46
  return validateProjectHealthContext(response.data);
48
47
  }
49
48
  async getProjectProgress(projectId) {
50
- z.string().parse(projectId);
49
+ IdSchema.parse(projectId);
51
50
  const response = await request({
52
51
  httpMethod: 'GET',
53
52
  baseUri: this.syncApiBase,
@@ -58,7 +57,7 @@ export class InsightsClient extends BaseClient {
58
57
  return validateProjectProgress(response.data);
59
58
  }
60
59
  async getWorkspaceInsights(workspaceId, args = {}) {
61
- z.string().parse(workspaceId);
60
+ IdSchema.parse(workspaceId);
62
61
  const response = await request({
63
62
  httpMethod: 'GET',
64
63
  baseUri: this.syncApiBase,
@@ -70,7 +69,7 @@ export class InsightsClient extends BaseClient {
70
69
  return validateWorkspaceInsights(response.data);
71
70
  }
72
71
  async analyzeProjectHealth(projectId, requestId) {
73
- z.string().parse(projectId);
72
+ IdSchema.parse(projectId);
74
73
  const response = await request({
75
74
  httpMethod: 'POST',
76
75
  baseUri: this.syncApiBase,
@@ -1,8 +1,7 @@
1
- import { z } from 'zod';
2
1
  import { ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_REST_LABELS_SHARED_RENAME, } from '../consts/endpoints.js';
3
2
  import { isSuccess, request } from '../transport/http-client.js';
4
3
  import { generatePath } from '../utils/request-helpers.js';
5
- import { validateLabel, validateLabelArray } from '../utils/validators.js';
4
+ import { IdSchema, validateLabel, validateLabelArray } from '../utils/validators.js';
6
5
  import { BaseClient } from './base-client.js';
7
6
  /**
8
7
  * Internal sub-client handling all label-domain endpoints.
@@ -12,7 +11,7 @@ import { BaseClient } from './base-client.js';
12
11
  */
13
12
  export class LabelClient extends BaseClient {
14
13
  async getLabel(id) {
15
- z.string().parse(id);
14
+ IdSchema.parse(id);
16
15
  const response = await request({
17
16
  httpMethod: 'GET',
18
17
  baseUri: this.syncApiBase,
@@ -63,7 +62,7 @@ export class LabelClient extends BaseClient {
63
62
  return validateLabel(response.data);
64
63
  }
65
64
  async updateLabel(id, args, requestId) {
66
- z.string().parse(id);
65
+ IdSchema.parse(id);
67
66
  const response = await request({
68
67
  httpMethod: 'POST',
69
68
  baseUri: this.syncApiBase,
@@ -76,7 +75,7 @@ export class LabelClient extends BaseClient {
76
75
  return validateLabel(response.data);
77
76
  }
78
77
  async deleteLabel(id, requestId) {
79
- z.string().parse(id);
78
+ IdSchema.parse(id);
80
79
  const response = await request({
81
80
  httpMethod: 'DELETE',
82
81
  baseUri: this.syncApiBase,
@@ -1,8 +1,7 @@
1
- import { z } from 'zod';
2
1
  import { ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, } from '../consts/endpoints.js';
3
2
  import { isSuccess, request } from '../transport/http-client.js';
4
3
  import { generatePath } from '../utils/request-helpers.js';
5
- import { validateCollaboratorArray, validateCollaboratorStateArray, validateCommentArray, validateFolder, validateNoteArray, validateProject, validateProjectArray, validateSectionArray, validateTaskArray, validateUserArray, validateWorkspaceProject, validateWorkspaceProjectArray, } from '../utils/validators.js';
4
+ import { IdSchema, validateCollaboratorArray, validateCollaboratorStateArray, validateCommentArray, validateFolder, validateNoteArray, validateProject, validateProjectArray, validateSectionArray, validateTaskArray, validateUserArray, validateWorkspaceProject, validateWorkspaceProjectArray, } from '../utils/validators.js';
6
5
  import { BaseClient } from './base-client.js';
7
6
  /**
8
7
  * Internal sub-client handling all project-domain endpoints.
@@ -12,7 +11,7 @@ import { BaseClient } from './base-client.js';
12
11
  */
13
12
  export class ProjectClient extends BaseClient {
14
13
  async getProject(id) {
15
- z.string().parse(id);
14
+ IdSchema.parse(id);
16
15
  const response = await request({
17
16
  httpMethod: 'GET',
18
17
  baseUri: this.syncApiBase,
@@ -77,7 +76,7 @@ export class ProjectClient extends BaseClient {
77
76
  return validateProject(response.data);
78
77
  }
79
78
  async updateProject(id, args, requestId) {
80
- z.string().parse(id);
79
+ IdSchema.parse(id);
81
80
  const response = await request({
82
81
  httpMethod: 'POST',
83
82
  baseUri: this.syncApiBase,
@@ -90,7 +89,7 @@ export class ProjectClient extends BaseClient {
90
89
  return validateProject(response.data);
91
90
  }
92
91
  async deleteProject(id, requestId) {
93
- z.string().parse(id);
92
+ IdSchema.parse(id);
94
93
  const response = await request({
95
94
  httpMethod: 'DELETE',
96
95
  baseUri: this.syncApiBase,
@@ -102,7 +101,7 @@ export class ProjectClient extends BaseClient {
102
101
  return isSuccess(response);
103
102
  }
104
103
  async archiveProject(id, requestId) {
105
- z.string().parse(id);
104
+ IdSchema.parse(id);
106
105
  const response = await request({
107
106
  httpMethod: 'POST',
108
107
  baseUri: this.syncApiBase,
@@ -114,7 +113,7 @@ export class ProjectClient extends BaseClient {
114
113
  return validateProject(response.data);
115
114
  }
116
115
  async unarchiveProject(id, requestId) {
117
- z.string().parse(id);
116
+ IdSchema.parse(id);
118
117
  const response = await request({
119
118
  httpMethod: 'POST',
120
119
  baseUri: this.syncApiBase,
@@ -171,7 +170,7 @@ export class ProjectClient extends BaseClient {
171
170
  return data;
172
171
  }
173
172
  async getFullProject(id, args = {}) {
174
- z.string().parse(id);
173
+ IdSchema.parse(id);
175
174
  const { data } = await request({
176
175
  httpMethod: 'GET',
177
176
  baseUri: this.syncApiBase,
@@ -190,7 +189,7 @@ export class ProjectClient extends BaseClient {
190
189
  };
191
190
  }
192
191
  async joinProject(id, requestId) {
193
- z.string().parse(id);
192
+ IdSchema.parse(id);
194
193
  const { data } = await request({
195
194
  httpMethod: 'POST',
196
195
  baseUri: this.syncApiBase,
@@ -211,7 +210,7 @@ export class ProjectClient extends BaseClient {
211
210
  };
212
211
  }
213
212
  async getProjectCollaborators(projectId, args = {}) {
214
- z.string().parse(projectId);
213
+ IdSchema.parse(projectId);
215
214
  const { data: { results, nextCursor }, } = await request({
216
215
  httpMethod: 'GET',
217
216
  baseUri: this.syncApiBase,
@@ -1,8 +1,7 @@
1
- import { z } from 'zod';
2
1
  import { ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, SECTION_ARCHIVE, SECTION_UNARCHIVE, } from '../consts/endpoints.js';
3
2
  import { isSuccess, request } from '../transport/http-client.js';
4
3
  import { generatePath } from '../utils/request-helpers.js';
5
- import { validateSection, validateSectionArray } from '../utils/validators.js';
4
+ import { IdSchema, validateSection, validateSectionArray } from '../utils/validators.js';
6
5
  import { BaseClient } from './base-client.js';
7
6
  /**
8
7
  * Internal sub-client handling all section-domain endpoints.
@@ -40,7 +39,7 @@ export class SectionClient extends BaseClient {
40
39
  };
41
40
  }
42
41
  async getSection(id) {
43
- z.string().parse(id);
42
+ IdSchema.parse(id);
44
43
  const response = await request({
45
44
  httpMethod: 'GET',
46
45
  baseUri: this.syncApiBase,
@@ -63,7 +62,7 @@ export class SectionClient extends BaseClient {
63
62
  return validateSection(response.data);
64
63
  }
65
64
  async updateSection(id, args, requestId) {
66
- z.string().parse(id);
65
+ IdSchema.parse(id);
67
66
  const response = await request({
68
67
  httpMethod: 'POST',
69
68
  baseUri: this.syncApiBase,
@@ -76,7 +75,7 @@ export class SectionClient extends BaseClient {
76
75
  return validateSection(response.data);
77
76
  }
78
77
  async deleteSection(id, requestId) {
79
- z.string().parse(id);
78
+ IdSchema.parse(id);
80
79
  const response = await request({
81
80
  httpMethod: 'DELETE',
82
81
  baseUri: this.syncApiBase,
@@ -88,7 +87,7 @@ export class SectionClient extends BaseClient {
88
87
  return isSuccess(response);
89
88
  }
90
89
  async archiveSection(id, requestId) {
91
- z.string().parse(id);
90
+ IdSchema.parse(id);
92
91
  const response = await request({
93
92
  httpMethod: 'POST',
94
93
  baseUri: this.syncApiBase,
@@ -100,7 +99,7 @@ export class SectionClient extends BaseClient {
100
99
  return validateSection(response.data);
101
100
  }
102
101
  async unarchiveSection(id, requestId) {
103
- z.string().parse(id);
102
+ IdSchema.parse(id);
104
103
  const response = await request({
105
104
  httpMethod: 'POST',
106
105
  baseUri: this.syncApiBase,
@@ -10,14 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { v4 as uuidv4 } from 'uuid';
13
- import { z } from 'zod';
14
13
  import { ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_SYNC_QUICK_ADD, } from '../consts/endpoints.js';
15
14
  import { isSuccess, request } from '../transport/http-client.js';
16
15
  import { performSyncRequest } from '../transport/sync-request.js';
17
16
  import { TodoistRequestError } from '../types/index.js';
18
17
  import { generatePath, spreadIfDefined } from '../utils/request-helpers.js';
19
18
  import { processTaskContent } from '../utils/uncompletable-helpers.js';
20
- import { validateTask, validateTaskArray } from '../utils/validators.js';
19
+ import { IdSchema, validateTask, validateTaskArray } from '../utils/validators.js';
21
20
  import { BaseClient } from './base-client.js';
22
21
  const MAX_COMMAND_COUNT = 100;
23
22
  /**
@@ -28,7 +27,7 @@ const MAX_COMMAND_COUNT = 100;
28
27
  */
29
28
  export class TaskClient extends BaseClient {
30
29
  async getTask(id) {
31
- z.string().parse(id);
30
+ IdSchema.parse(id);
32
31
  const response = await request({
33
32
  httpMethod: 'GET',
34
33
  baseUri: this.syncApiBase,
@@ -152,7 +151,7 @@ export class TaskClient extends BaseClient {
152
151
  return validateTask(response.data);
153
152
  }
154
153
  async updateTask(id, args, requestId) {
155
- z.string().parse(id);
154
+ IdSchema.parse(id);
156
155
  // Translate SDK alias for due-date clearing to Todoist's accepted payload value.
157
156
  const normalizedArgs = args.dueString === null ? Object.assign(Object.assign({}, args), { dueString: 'no date' }) : args;
158
157
  // Process content if both content and isUncompletable are provided
@@ -200,7 +199,7 @@ export class TaskClient extends BaseClient {
200
199
  return validateTaskArray(syncTasks);
201
200
  }
202
201
  async moveTask(id, args, requestId) {
203
- z.string().parse(id);
202
+ IdSchema.parse(id);
204
203
  const response = await request({
205
204
  httpMethod: 'POST',
206
205
  baseUri: this.syncApiBase,
@@ -213,7 +212,7 @@ export class TaskClient extends BaseClient {
213
212
  return validateTask(response.data);
214
213
  }
215
214
  async closeTask(id, requestId) {
216
- z.string().parse(id);
215
+ IdSchema.parse(id);
217
216
  const response = await request({
218
217
  httpMethod: 'POST',
219
218
  baseUri: this.syncApiBase,
@@ -225,7 +224,7 @@ export class TaskClient extends BaseClient {
225
224
  return isSuccess(response);
226
225
  }
227
226
  async reopenTask(id, requestId) {
228
- z.string().parse(id);
227
+ IdSchema.parse(id);
229
228
  const response = await request({
230
229
  httpMethod: 'POST',
231
230
  baseUri: this.syncApiBase,
@@ -237,7 +236,7 @@ export class TaskClient extends BaseClient {
237
236
  return isSuccess(response);
238
237
  }
239
238
  async deleteTask(id, requestId) {
240
- z.string().parse(id);
239
+ IdSchema.parse(id);
241
240
  const response = await request({
242
241
  httpMethod: 'DELETE',
243
242
  baseUri: this.syncApiBase,
@@ -1,9 +1,8 @@
1
- import { z } from 'zod';
2
1
  import { ENDPOINT_REST_APPS_UI_EXTENSIONS, ENDPOINT_REST_APPS_UI_EXTENSIONS_INSTALLED, getUiExtensionEndpoint, getUiExtensionIconEndpoint, getUiExtensionsByIntegrationEndpoint, } from '../consts/endpoints.js';
3
2
  import { isSuccess, request } from '../transport/http-client.js';
4
3
  import { camelCaseKeys } from '../utils/case-conversion.js';
5
4
  import { uploadMultipartFile } from '../utils/multipart-upload.js';
6
- import { validateUiExtension, validateUiExtensionArray } from '../utils/validators.js';
5
+ import { IdSchema, validateUiExtension, validateUiExtensionArray } from '../utils/validators.js';
7
6
  import { BaseClient } from './base-client.js';
8
7
  /**
9
8
  * Internal sub-client handling all UI-extension endpoints for developer
@@ -14,7 +13,7 @@ import { BaseClient } from './base-client.js';
14
13
  */
15
14
  export class UiExtensionClient extends BaseClient {
16
15
  async getUiExtension(uiExtensionId, requestId) {
17
- z.string().parse(uiExtensionId);
16
+ IdSchema.parse(uiExtensionId);
18
17
  const response = await request({
19
18
  httpMethod: 'GET',
20
19
  baseUri: this.apiRootBase,
@@ -37,7 +36,7 @@ export class UiExtensionClient extends BaseClient {
37
36
  return validateUiExtensionArray(response.data);
38
37
  }
39
38
  async getUiExtensionsForApp(appId, requestId) {
40
- z.string().parse(appId);
39
+ IdSchema.parse(appId);
41
40
  const response = await request({
42
41
  httpMethod: 'GET',
43
42
  baseUri: this.apiRootBase,
@@ -61,7 +60,7 @@ export class UiExtensionClient extends BaseClient {
61
60
  return validateUiExtension(response.data);
62
61
  }
63
62
  async updateUiExtension(uiExtensionId, args, requestId) {
64
- z.string().parse(uiExtensionId);
63
+ IdSchema.parse(uiExtensionId);
65
64
  const response = await request({
66
65
  httpMethod: 'PATCH',
67
66
  baseUri: this.apiRootBase,
@@ -74,7 +73,7 @@ export class UiExtensionClient extends BaseClient {
74
73
  return validateUiExtension(response.data);
75
74
  }
76
75
  async deleteUiExtension(uiExtensionId, requestId) {
77
- z.string().parse(uiExtensionId);
76
+ IdSchema.parse(uiExtensionId);
78
77
  const response = await request({
79
78
  httpMethod: 'DELETE',
80
79
  baseUri: this.apiRootBase,
@@ -9,12 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { z } from 'zod';
13
12
  import { ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_MEMBERS, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, getWorkspaceUserTasksEndpoint, } from '../consts/endpoints.js';
14
13
  import { isSuccess, request } from '../transport/http-client.js';
15
14
  import { uploadMultipartFile } from '../utils/multipart-upload.js';
16
15
  import { generatePath } from '../utils/request-helpers.js';
17
- import { validateJoinWorkspaceResult, validateMemberActivityInfoArray, validateProject, validateWorkspace, validateWorkspaceArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateWorkspaceUserArray, validateWorkspaceUserTaskArray, } from '../utils/validators.js';
16
+ import { IdSchema, validateJoinWorkspaceResult, validateMemberActivityInfoArray, validateProject, validateWorkspace, validateWorkspaceArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateWorkspaceUserArray, validateWorkspaceUserTaskArray, } from '../utils/validators.js';
18
17
  import { BaseClient } from './base-client.js';
19
18
  /**
20
19
  * Internal sub-client handling all workspace-domain endpoints —
@@ -196,7 +195,7 @@ export class WorkspaceClient extends BaseClient {
196
195
  return validateWorkspaceArray(response.data);
197
196
  }
198
197
  async getWorkspace(id, requestId) {
199
- z.string().parse(id);
198
+ IdSchema.parse(id);
200
199
  const response = await request({
201
200
  httpMethod: 'GET',
202
201
  baseUri: this.syncApiBase,
@@ -220,7 +219,7 @@ export class WorkspaceClient extends BaseClient {
220
219
  return validateWorkspace(response.data);
221
220
  }
222
221
  async updateWorkspace(id, args, requestId) {
223
- z.string().parse(id);
222
+ IdSchema.parse(id);
224
223
  const response = await request({
225
224
  httpMethod: 'POST',
226
225
  baseUri: this.syncApiBase,
@@ -233,7 +232,7 @@ export class WorkspaceClient extends BaseClient {
233
232
  return validateWorkspace(response.data);
234
233
  }
235
234
  async deleteWorkspace(id, requestId) {
236
- z.string().parse(id);
235
+ IdSchema.parse(id);
237
236
  const response = await request({
238
237
  httpMethod: 'DELETE',
239
238
  baseUri: this.syncApiBase,
@@ -70,11 +70,6 @@ export const ENDPOINT_GET_TOKEN = 'access_token';
70
70
  export const ENDPOINT_REVOKE = 'revoke';
71
71
  export const ENDPOINT_REGISTER = 'register';
72
72
  export const ENDPOINT_REST_FOLDERS = 'folders';
73
- export const ENDPOINT_REST_GOALS = 'goals';
74
- export const ENDPOINT_REST_GOALS_SEARCH = ENDPOINT_REST_GOALS + '/search';
75
- export const GOAL_COMPLETE = 'complete';
76
- export const GOAL_UNCOMPLETE = 'uncomplete';
77
- export const GOAL_TASKS = 'items';
78
73
  // Workspace endpoints
79
74
  export const ENDPOINT_REST_WORKSPACES = 'workspaces';
80
75
  export const ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
@@ -277,30 +277,6 @@ export const DEFAULT_COLLABORATOR_STATE = {
277
277
  state: 'active',
278
278
  isDeleted: false,
279
279
  };
280
- export const DEFAULT_GOAL_ID = '550e8400-e29b-41d4-a716-446655440000';
281
- export const DEFAULT_GOAL = {
282
- id: DEFAULT_GOAL_ID,
283
- ownerType: 'USER',
284
- ownerId: DEFAULT_USER_ID,
285
- name: 'Ship v2',
286
- description: 'Launch the new version',
287
- deadline: '2026-04-03',
288
- parentGoalId: null,
289
- childOrder: 0,
290
- isCompleted: false,
291
- completedAt: null,
292
- responsibleUid: null,
293
- isDeleted: false,
294
- progress: {
295
- totalTaskCount: 5,
296
- completedTaskCount: 2,
297
- percentage: 40,
298
- },
299
- creatorUid: DEFAULT_USER_ID,
300
- createdAt: defaultDate(),
301
- updatedAt: defaultDate(),
302
- };
303
- export const DEFAULT_GOAL_NO_PROGRESS = Object.assign(Object.assign({}, DEFAULT_GOAL), { id: 'e5f6g7h8-e29b-41d4-a716-446655440001', progress: undefined });
304
280
  export const DEFAULT_APP_ID = '42';
305
281
  export const DEFAULT_INSTALLATION_ID = '1001';
306
282
  export const DEFAULT_UI_EXTENSION_ID = '2002';
@@ -308,6 +284,7 @@ export const DEFAULT_DISTRIBUTION_TOKEN = 'dist-token-abc';
308
284
  export const DEFAULT_ACCESS_TOKEN_ID = '3003';
309
285
  export const DEFAULT_APP = {
310
286
  id: DEFAULT_APP_ID,
287
+ clientId: 'client-id-xyz',
311
288
  status: 'public',
312
289
  displayName: 'Sample App',
313
290
  userId: DEFAULT_USER_ID,
@@ -4,7 +4,6 @@ import { BackupClient } from './clients/backup-client.js';
4
4
  import { CommentClient } from './clients/comment-client.js';
5
5
  import { EmailClient } from './clients/email-client.js';
6
6
  import { FolderClient } from './clients/folder-client.js';
7
- import { GoalsClient } from './clients/goals-client.js';
8
7
  import { IdMappingClient } from './clients/id-mapping-client.js';
9
8
  import { InsightsClient } from './clients/insights-client.js';
10
9
  import { LabelClient } from './clients/label-client.js';
@@ -59,7 +58,6 @@ export class TodoistApi {
59
58
  this.activityClient = new ActivityClient(clientDeps);
60
59
  this.productivityClient = new ProductivityClient(clientDeps);
61
60
  this.workspaceClient = new WorkspaceClient(clientDeps);
62
- this.goalsClient = new GoalsClient(clientDeps);
63
61
  this.appClient = new AppClient(clientDeps);
64
62
  this.uiExtensionClient = new UiExtensionClient(clientDeps);
65
63
  }
@@ -941,37 +939,6 @@ export class TodoistApi {
941
939
  async deleteFolder(id, requestId) {
942
940
  return this.folderClient.deleteFolder(id, requestId);
943
941
  }
944
- // ── Goals ──
945
- async getGoals(args) {
946
- return this.goalsClient.getGoals(args);
947
- }
948
- async searchGoals(args) {
949
- return this.goalsClient.searchGoals(args);
950
- }
951
- async getGoal(id) {
952
- return this.goalsClient.getGoal(id);
953
- }
954
- async addGoal(args, requestId) {
955
- return this.goalsClient.addGoal(args, requestId);
956
- }
957
- async updateGoal(id, args, requestId) {
958
- return this.goalsClient.updateGoal(id, args, requestId);
959
- }
960
- async deleteGoal(id, requestId) {
961
- return this.goalsClient.deleteGoal(id, requestId);
962
- }
963
- async completeGoal(id, requestId) {
964
- return this.goalsClient.completeGoal(id, requestId);
965
- }
966
- async uncompleteGoal(id, requestId) {
967
- return this.goalsClient.uncompleteGoal(id, requestId);
968
- }
969
- async linkTaskToGoal(args, requestId) {
970
- return this.goalsClient.linkTaskToGoal(args, requestId);
971
- }
972
- async unlinkTaskFromGoal(args, requestId) {
973
- return this.goalsClient.unlinkTaskFromGoal(args, requestId);
974
- }
975
942
  // ── Backups ──
976
943
  /**
977
944
  * Retrieves a list of available backups.
@@ -136,6 +136,7 @@ export const AppTokenScopesSchema = z
136
136
  */
137
137
  export const AppSchema = z.object({
138
138
  id: StringOrNumberSchema,
139
+ clientId: z.string(),
139
140
  status: AppStatusSchema,
140
141
  displayName: z.string(),
141
142
  userId: StringOrNumberSchema,
@@ -9,7 +9,6 @@ export * from './productivity/index.js';
9
9
  export * from './activity/index.js';
10
10
  export * from './workspaces/index.js';
11
11
  export * from './folders/index.js';
12
- export * from './goals/index.js';
13
12
  export * from './insights/index.js';
14
13
  export * from './backups/index.js';
15
14
  export * from './id-mappings/index.js';
@@ -11,7 +11,6 @@ export * from './workspaces.js';
11
11
  export * from './folders.js';
12
12
  export * from './workspace-filters.js';
13
13
  export * from './workspace-goals.js';
14
- export * from './goals.js';
15
14
  export * from './notifications.js';
16
15
  export * from './sharing.js';
17
16
  export * from './view-options.js';
@@ -29,7 +29,6 @@ export const SYNC_RESOURCE_TYPES = [
29
29
  'role_actions',
30
30
  'folders',
31
31
  'workspace_goals',
32
- 'goals',
33
32
  'day_orders',
34
33
  'calendars',
35
34
  'calendar_accounts',
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { GoalSchema } from '../goals/types.js';
3
2
  import { LabelSchema } from '../labels/types.js';
4
3
  import { ProjectSchema } from '../projects/types.js';
5
4
  import { SectionSchema } from '../sections/types.js';
@@ -44,7 +43,6 @@ export const SyncResponseSchema = z.looseObject({
44
43
  projectViewOptionsDefaults: z.array(ProjectViewOptionsDefaultsSchema).optional(),
45
44
  roleActions: z.array(z.record(z.string(), z.unknown())).optional(),
46
45
  folders: z.array(FolderSchema).optional(),
47
- goals: z.array(GoalSchema).optional(),
48
46
  workspaceGoals: z.array(WorkspaceGoalSchema).optional(),
49
47
  dayOrders: z.record(z.string(), z.number()).optional(),
50
48
  calendars: z.array(CalendarSchema).optional(),
@@ -3,7 +3,6 @@ import { ActivityEventSchema } from '../types/activity/types.js';
3
3
  import { AppSchema, AppWithUserCountSchema, AppSecretsSchema, AppVerificationTokenSchema, AppTestTokenSchema, AppDistributionTokenSchema, AppByDistributionTokenSchema, AppWebhookSchema, AppInstallationSchema, UserAuthorizationSchema, } from '../types/apps/types.js';
4
4
  import { BackupSchema } from '../types/backups/types.js';
5
5
  import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
6
- import { GoalSchema } from '../types/goals/types.js';
7
6
  import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
8
7
  import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
9
8
  import { LabelSchema } from '../types/labels/types.js';
@@ -22,6 +21,11 @@ function createValidator(schema) {
22
21
  validateArray: (input) => z.array(schema).parse(input),
23
22
  };
24
23
  }
24
+ const TMP_ID_MESSAGE = 'This looks like a client-side placeholder — wait for sync to complete before calling the API.';
25
+ export const IdSchema = z
26
+ .string()
27
+ .min(1)
28
+ .refine((id) => !id.startsWith('tmp-'), { message: TMP_ID_MESSAGE });
25
29
  // Entity validators
26
30
  export const { validate: validateTask, validateArray: validateTaskArray } = createValidator(TaskSchema);
27
31
  /**
@@ -59,7 +63,6 @@ export const { validate: validateFilter, validateArray: validateFilterArray } =
59
63
  export const { validate: validateCollaborator, validateArray: validateCollaboratorArray } = createValidator(CollaboratorSchema);
60
64
  export const { validate: validateCollaboratorState, validateArray: validateCollaboratorStateArray, } = createValidator(CollaboratorStateSchema);
61
65
  export const { validate: validateFolder, validateArray: validateFolderArray } = createValidator(FolderSchema);
62
- export const { validate: validateGoal, validateArray: validateGoalArray } = createValidator(GoalSchema);
63
66
  export const { validate: validateNote, validateArray: validateNoteArray } = createValidator(NoteSchema);
64
67
  export const { validate: validateTooltips } = createValidator(TooltipsSchema);
65
68
  export const { validate: validateWorkspaceFilter, validateArray: validateWorkspaceFilterArray } = createValidator(WorkspaceFilterSchema);
@@ -17,7 +17,7 @@ export declare class AppClient extends BaseClient {
17
17
  getAppSecrets(appId: string, requestId?: string): Promise<AppSecrets>;
18
18
  resetAppClientSecret(appId: string, requestId?: string): Promise<AppWithUserCount>;
19
19
  revokeAppTokens(appId: string, requestId?: string): Promise<AppWithUserCount>;
20
- uploadAppIcon(args: UploadAppIconArgs, requestId?: string): Promise<AppWithUserCount>;
20
+ uploadAppIcon({ appId, file, fileName, size }: UploadAppIconArgs, requestId?: string): Promise<AppWithUserCount>;
21
21
  getAppTestToken(appId: string, requestId?: string): Promise<AppTestToken>;
22
22
  createAppTestToken(appId: string, requestId?: string): Promise<AppTestToken>;
23
23
  getAppDistributionToken(appId: string, requestId?: string): Promise<AppDistributionToken>;
@@ -59,11 +59,6 @@ export declare const ENDPOINT_GET_TOKEN = "access_token";
59
59
  export declare const ENDPOINT_REVOKE = "revoke";
60
60
  export declare const ENDPOINT_REGISTER = "register";
61
61
  export declare const ENDPOINT_REST_FOLDERS = "folders";
62
- export declare const ENDPOINT_REST_GOALS = "goals";
63
- export declare const ENDPOINT_REST_GOALS_SEARCH: string;
64
- export declare const GOAL_COMPLETE = "complete";
65
- export declare const GOAL_UNCOMPLETE = "uncomplete";
66
- export declare const GOAL_TASKS = "items";
67
62
  export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
68
63
  export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
69
64
  export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
@@ -1,4 +1,4 @@
1
- import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, WorkspaceProject, Reminder, Folder, Goal, App, AppWithUserCount, AppSecrets, AppVerificationToken, AppTestToken, AppDistributionToken, AppWebhook, AppInstallation, UserAuthorization, UiExtension } from '../types/index.js';
1
+ import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, WorkspaceProject, Reminder, Folder, App, AppWithUserCount, AppSecrets, AppVerificationToken, AppTestToken, AppDistributionToken, AppWebhook, AppInstallation, UserAuthorization, UiExtension } from '../types/index.js';
2
2
  import type { Collaborator, CollaboratorState } from '../types/sync/resources/collaborators.js';
3
3
  import type { Note } from '../types/sync/resources/notes.js';
4
4
  export declare const DEFAULT_TASK_ID = "1234";
@@ -264,9 +264,6 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
264
264
  export declare const DEFAULT_FOLDER: Folder;
265
265
  export declare const DEFAULT_COLLABORATOR: Collaborator;
266
266
  export declare const DEFAULT_COLLABORATOR_STATE: CollaboratorState;
267
- export declare const DEFAULT_GOAL_ID = "550e8400-e29b-41d4-a716-446655440000";
268
- export declare const DEFAULT_GOAL: Goal;
269
- export declare const DEFAULT_GOAL_NO_PROGRESS: Goal;
270
267
  export declare const DEFAULT_APP_ID = "42";
271
268
  export declare const DEFAULT_INSTALLATION_ID = "1001";
272
269
  export declare const DEFAULT_UI_EXTENSION_ID = "2002";
@@ -5,7 +5,6 @@ import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/inde
5
5
  import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js';
6
6
  import { GetOrCreateEmailArgs, GetOrCreateEmailResponse, DisableEmailArgs } from './types/emails/index.js';
7
7
  import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
8
- import type { AddGoalArgs, GetGoalsArgs, GetGoalsResponse, Goal, SearchGoalsArgs, TaskLinkingArgs, UpdateGoalArgs } from './types/goals/index.js';
9
8
  import { CustomFetch, FileResponse } from './types/http.js';
10
9
  import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
11
10
  import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
@@ -76,7 +75,6 @@ export declare class TodoistApi {
76
75
  private readonly activityClient;
77
76
  private readonly productivityClient;
78
77
  private readonly workspaceClient;
79
- private readonly goalsClient;
80
78
  private readonly appClient;
81
79
  private readonly uiExtensionClient;
82
80
  constructor(
@@ -789,16 +787,6 @@ export declare class TodoistApi {
789
787
  * @returns A promise that resolves to `true` if successful.
790
788
  */
791
789
  deleteFolder(id: string, requestId?: string): Promise<boolean>;
792
- getGoals(args?: GetGoalsArgs): Promise<GetGoalsResponse>;
793
- searchGoals(args: SearchGoalsArgs): Promise<GetGoalsResponse>;
794
- getGoal(id: string): Promise<Goal>;
795
- addGoal(args: AddGoalArgs, requestId?: string): Promise<Goal>;
796
- updateGoal(id: string, args: UpdateGoalArgs, requestId?: string): Promise<Goal>;
797
- deleteGoal(id: string, requestId?: string): Promise<boolean>;
798
- completeGoal(id: string, requestId?: string): Promise<Goal>;
799
- uncompleteGoal(id: string, requestId?: string): Promise<Goal>;
800
- linkTaskToGoal(args: TaskLinkingArgs, requestId?: string): Promise<Goal>;
801
- unlinkTaskFromGoal(args: TaskLinkingArgs, requestId?: string): Promise<boolean>;
802
790
  /**
803
791
  * Retrieves a list of available backups.
804
792
  *