@doist/todoist-sdk 8.3.0 → 8.4.0-next.2

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 (34) hide show
  1. package/dist/cjs/consts/endpoints.js +6 -1
  2. package/dist/cjs/todoist-api.js +128 -0
  3. package/dist/cjs/types/goals/index.js +18 -0
  4. package/dist/cjs/types/goals/requests.js +2 -0
  5. package/dist/cjs/types/goals/types.js +29 -0
  6. package/dist/cjs/types/index.js +1 -0
  7. package/dist/cjs/types/sync/commands/goals.js +2 -0
  8. package/dist/cjs/types/sync/commands/index.js +1 -0
  9. package/dist/cjs/types/sync/resource-types.js +1 -0
  10. package/dist/cjs/utils/validators.js +39 -36
  11. package/dist/esm/consts/endpoints.js +5 -0
  12. package/dist/esm/todoist-api.js +130 -2
  13. package/dist/esm/types/goals/index.js +2 -0
  14. package/dist/esm/types/goals/requests.js +1 -0
  15. package/dist/esm/types/goals/types.js +26 -0
  16. package/dist/esm/types/index.js +1 -0
  17. package/dist/esm/types/sync/commands/goals.js +1 -0
  18. package/dist/esm/types/sync/commands/index.js +1 -0
  19. package/dist/esm/types/sync/resource-types.js +1 -0
  20. package/dist/esm/utils/validators.js +5 -2
  21. package/dist/types/consts/endpoints.d.ts +5 -0
  22. package/dist/types/todoist-api.d.ts +11 -0
  23. package/dist/types/types/goals/index.d.ts +2 -0
  24. package/dist/types/types/goals/requests.d.ts +33 -0
  25. package/dist/types/types/goals/types.d.ts +41 -0
  26. package/dist/types/types/index.d.ts +1 -0
  27. package/dist/types/types/sync/commands/goals.d.ts +33 -0
  28. package/dist/types/types/sync/commands/index.d.ts +9 -0
  29. package/dist/types/types/sync/resource-types.d.ts +1 -1
  30. package/dist/types/types/sync/resources/view-options.d.ts +6 -6
  31. package/dist/types/types/sync/response.d.ts +2 -0
  32. package/dist/types/types/tasks/requests.d.ts +1 -0
  33. package/dist/types/utils/validators.d.ts +56 -8
  34. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ENDPOINT_REST_ID_MAPPINGS = exports.ENDPOINT_REST_EMAILS = exports.ENDPOINT_REST_BACKUPS_DOWNLOAD = exports.ENDPOINT_REST_BACKUPS = exports.ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_URL = exports.ENDPOINT_REST_TEMPLATES_FILE = exports.ENDPOINT_REST_TASKS_COMPLETED = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.SECTION_UNARCHIVE = exports.SECTION_ARCHIVE = exports.ENDPOINT_REST_PROJECT_JOIN = exports.ENDPOINT_REST_PROJECT_FULL = exports.ENDPOINT_REST_PROJECTS_PERMISSIONS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS_SEARCH = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_LOCATION_REMINDERS = exports.ENDPOINT_REST_REMINDERS = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS_SEARCH = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS_SEARCH = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
4
- exports.ENDPOINT_WORKSPACE_MEMBERS = exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REST_WORKSPACES = exports.ENDPOINT_REST_FOLDERS = exports.ENDPOINT_REGISTER = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
4
+ exports.ENDPOINT_WORKSPACE_MEMBERS = exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REST_WORKSPACES = exports.GOAL_TASKS = exports.GOAL_UNCOMPLETE = exports.GOAL_COMPLETE = exports.ENDPOINT_REST_GOALS_SEARCH = exports.ENDPOINT_REST_GOALS = exports.ENDPOINT_REST_FOLDERS = exports.ENDPOINT_REGISTER = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
5
5
  exports.getSyncBaseUri = getSyncBaseUri;
6
6
  exports.getAuthBaseUri = getAuthBaseUri;
7
7
  exports.getWorkspaceInvitationAcceptEndpoint = getWorkspaceInvitationAcceptEndpoint;
@@ -86,6 +86,11 @@ exports.ENDPOINT_GET_TOKEN = 'access_token';
86
86
  exports.ENDPOINT_REVOKE = 'revoke';
87
87
  exports.ENDPOINT_REGISTER = 'register';
88
88
  exports.ENDPOINT_REST_FOLDERS = 'folders';
89
+ exports.ENDPOINT_REST_GOALS = 'goals';
90
+ exports.ENDPOINT_REST_GOALS_SEARCH = exports.ENDPOINT_REST_GOALS + '/search';
91
+ exports.GOAL_COMPLETE = 'complete';
92
+ exports.GOAL_UNCOMPLETE = 'uncomplete';
93
+ exports.GOAL_TASKS = 'items';
89
94
  // Workspace endpoints
90
95
  exports.ENDPOINT_REST_WORKSPACES = 'workspaces';
91
96
  exports.ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
@@ -1914,6 +1914,134 @@ class TodoistApi {
1914
1914
  });
1915
1915
  return (0, http_client_1.isSuccess)(response);
1916
1916
  }
1917
+ // ── Goals ──
1918
+ async getGoals(args) {
1919
+ const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
1920
+ httpMethod: 'GET',
1921
+ baseUri: this.syncApiBase,
1922
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS,
1923
+ apiToken: this.authToken,
1924
+ customFetch: this.customFetch,
1925
+ payload: args,
1926
+ });
1927
+ return {
1928
+ results: (0, validators_1.validateGoalArray)(results),
1929
+ nextCursor,
1930
+ };
1931
+ }
1932
+ async searchGoals(args) {
1933
+ const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
1934
+ httpMethod: 'GET',
1935
+ baseUri: this.syncApiBase,
1936
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS_SEARCH,
1937
+ apiToken: this.authToken,
1938
+ customFetch: this.customFetch,
1939
+ payload: args,
1940
+ });
1941
+ return {
1942
+ results: (0, validators_1.validateGoalArray)(results),
1943
+ nextCursor,
1944
+ };
1945
+ }
1946
+ async getGoal(id) {
1947
+ zod_1.z.string().parse(id);
1948
+ const response = await (0, http_client_1.request)({
1949
+ httpMethod: 'GET',
1950
+ baseUri: this.syncApiBase,
1951
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1952
+ apiToken: this.authToken,
1953
+ customFetch: this.customFetch,
1954
+ });
1955
+ return (0, validators_1.validateGoal)(response.data);
1956
+ }
1957
+ async addGoal(args, requestId) {
1958
+ const response = await (0, http_client_1.request)({
1959
+ httpMethod: 'POST',
1960
+ baseUri: this.syncApiBase,
1961
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS,
1962
+ apiToken: this.authToken,
1963
+ customFetch: this.customFetch,
1964
+ payload: args,
1965
+ requestId: requestId,
1966
+ });
1967
+ return (0, validators_1.validateGoal)(response.data);
1968
+ }
1969
+ async updateGoal(id, args, requestId) {
1970
+ zod_1.z.string().parse(id);
1971
+ const response = await (0, http_client_1.request)({
1972
+ httpMethod: 'POST',
1973
+ baseUri: this.syncApiBase,
1974
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1975
+ apiToken: this.authToken,
1976
+ customFetch: this.customFetch,
1977
+ payload: args,
1978
+ requestId: requestId,
1979
+ });
1980
+ return (0, validators_1.validateGoal)(response.data);
1981
+ }
1982
+ async deleteGoal(id, requestId) {
1983
+ zod_1.z.string().parse(id);
1984
+ const response = await (0, http_client_1.request)({
1985
+ httpMethod: 'DELETE',
1986
+ baseUri: this.syncApiBase,
1987
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1988
+ apiToken: this.authToken,
1989
+ customFetch: this.customFetch,
1990
+ requestId: requestId,
1991
+ });
1992
+ return (0, http_client_1.isSuccess)(response);
1993
+ }
1994
+ async completeGoal(id, requestId) {
1995
+ zod_1.z.string().parse(id);
1996
+ const response = await (0, http_client_1.request)({
1997
+ httpMethod: 'POST',
1998
+ baseUri: this.syncApiBase,
1999
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id, endpoints_1.GOAL_COMPLETE),
2000
+ apiToken: this.authToken,
2001
+ customFetch: this.customFetch,
2002
+ requestId: requestId,
2003
+ });
2004
+ return (0, validators_1.validateGoal)(response.data);
2005
+ }
2006
+ async uncompleteGoal(id, requestId) {
2007
+ zod_1.z.string().parse(id);
2008
+ const response = await (0, http_client_1.request)({
2009
+ httpMethod: 'POST',
2010
+ baseUri: this.syncApiBase,
2011
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id, endpoints_1.GOAL_UNCOMPLETE),
2012
+ apiToken: this.authToken,
2013
+ customFetch: this.customFetch,
2014
+ requestId: requestId,
2015
+ });
2016
+ return (0, validators_1.validateGoal)(response.data);
2017
+ }
2018
+ async linkTaskToGoal({ goalId, taskId }, requestId) {
2019
+ zod_1.z.string().parse(goalId);
2020
+ zod_1.z.string().parse(taskId);
2021
+ const response = await (0, http_client_1.request)({
2022
+ httpMethod: 'POST',
2023
+ baseUri: this.syncApiBase,
2024
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, goalId, endpoints_1.GOAL_TASKS),
2025
+ apiToken: this.authToken,
2026
+ customFetch: this.customFetch,
2027
+ payload: { itemId: taskId },
2028
+ requestId: requestId,
2029
+ });
2030
+ return (0, validators_1.validateGoal)(response.data);
2031
+ }
2032
+ async unlinkTaskFromGoal({ goalId, taskId }, requestId) {
2033
+ zod_1.z.string().parse(goalId);
2034
+ zod_1.z.string().parse(taskId);
2035
+ const response = await (0, http_client_1.request)({
2036
+ httpMethod: 'DELETE',
2037
+ baseUri: this.syncApiBase,
2038
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, goalId, endpoints_1.GOAL_TASKS, taskId),
2039
+ apiToken: this.authToken,
2040
+ customFetch: this.customFetch,
2041
+ requestId: requestId,
2042
+ });
2043
+ return (0, http_client_1.isSuccess)(response);
2044
+ }
1917
2045
  // ── Backups ──
1918
2046
  /**
1919
2047
  * Retrieves a list of available backups.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoalSchema = exports.GoalProgressSchema = exports.GOAL_OWNER_TYPES = void 0;
4
+ const zod_1 = require("zod");
5
+ /** Available goal owner types. */
6
+ exports.GOAL_OWNER_TYPES = ['USER', 'WORKSPACE'];
7
+ exports.GoalProgressSchema = zod_1.z.looseObject({
8
+ totalTaskCount: zod_1.z.number().int(),
9
+ completedTaskCount: zod_1.z.number().int(),
10
+ percentage: zod_1.z.number(),
11
+ });
12
+ exports.GoalSchema = zod_1.z.looseObject({
13
+ id: zod_1.z.string(),
14
+ ownerType: zod_1.z.enum(exports.GOAL_OWNER_TYPES),
15
+ ownerId: zod_1.z.string(),
16
+ name: zod_1.z.string(),
17
+ description: zod_1.z.string().nullable(),
18
+ deadline: zod_1.z.string().nullable(),
19
+ parentGoalId: zod_1.z.string().nullable(),
20
+ childOrder: zod_1.z.number().int(),
21
+ isCompleted: zod_1.z.boolean(),
22
+ completedAt: zod_1.z.coerce.date().nullable(),
23
+ responsibleUid: zod_1.z.string().nullable(),
24
+ isDeleted: zod_1.z.boolean(),
25
+ progress: exports.GoalProgressSchema.optional(),
26
+ creatorUid: zod_1.z.string(),
27
+ createdAt: zod_1.z.coerce.date(),
28
+ updatedAt: zod_1.z.coerce.date(),
29
+ });
@@ -25,6 +25,7 @@ __exportStar(require("./productivity"), exports);
25
25
  __exportStar(require("./activity"), exports);
26
26
  __exportStar(require("./workspaces"), exports);
27
27
  __exportStar(require("./folders"), exports);
28
+ __exportStar(require("./goals"), exports);
28
29
  __exportStar(require("./insights"), exports);
29
30
  __exportStar(require("./backups"), exports);
30
31
  __exportStar(require("./id-mappings"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -27,6 +27,7 @@ __exportStar(require("./workspaces"), exports);
27
27
  __exportStar(require("./folders"), exports);
28
28
  __exportStar(require("./workspace-filters"), exports);
29
29
  __exportStar(require("./workspace-goals"), exports);
30
+ __exportStar(require("./goals"), exports);
30
31
  __exportStar(require("./notifications"), exports);
31
32
  __exportStar(require("./sharing"), exports);
32
33
  __exportStar(require("./view-options"), exports);
@@ -32,6 +32,7 @@ exports.SYNC_RESOURCE_TYPES = [
32
32
  'role_actions',
33
33
  'folders',
34
34
  'workspace_goals',
35
+ 'goals',
35
36
  'day_orders',
36
37
  'calendars',
37
38
  'calendar_accounts',
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.validateWorkspaceProjectArray = exports.validateWorkspaceProject = 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 = exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = void 0;
3
+ exports.validateNote = exports.validateGoalArray = exports.validateGoal = 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.validateWorkspaceProjectArray = exports.validateWorkspaceProject = 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 = exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = exports.validateTooltips = exports.validateNoteArray = void 0;
5
5
  exports.isWorkspaceProject = isWorkspaceProject;
6
6
  exports.isPersonalProject = isPersonalProject;
7
7
  exports.validateProject = validateProject;
@@ -11,15 +11,16 @@ exports.parseSyncResponse = parseSyncResponse;
11
11
  const types_1 = require("../types/activity/types");
12
12
  const types_2 = require("../types/backups/types");
13
13
  const types_3 = require("../types/comments/types");
14
- const types_4 = require("../types/id-mappings/types");
15
- const types_5 = require("../types/insights/types");
16
- const types_6 = require("../types/labels/types");
17
- const types_7 = require("../types/productivity/types");
18
- const types_8 = require("../types/projects/types");
19
- const types_9 = require("../types/sections/types");
20
- const types_10 = require("../types/tasks/types");
21
- const types_11 = require("../types/users/types");
22
- const types_12 = require("../types/workspaces/types");
14
+ const types_4 = require("../types/goals/types");
15
+ const types_5 = require("../types/id-mappings/types");
16
+ const types_6 = require("../types/insights/types");
17
+ const types_7 = require("../types/labels/types");
18
+ const types_8 = require("../types/productivity/types");
19
+ const types_9 = require("../types/projects/types");
20
+ const types_10 = require("../types/sections/types");
21
+ const types_11 = require("../types/tasks/types");
22
+ const types_12 = require("../types/users/types");
23
+ const types_13 = require("../types/workspaces/types");
23
24
  const resources_1 = require("../types/sync/resources");
24
25
  function createValidator(schema) {
25
26
  return (input) => schema.parse(input);
@@ -33,7 +34,7 @@ function createArrayValidator(validateItem) {
33
34
  };
34
35
  }
35
36
  // Entity validators
36
- exports.validateTask = createValidator(types_10.TaskSchema);
37
+ exports.validateTask = createValidator(types_11.TaskSchema);
37
38
  exports.validateTaskArray = createArrayValidator(exports.validateTask);
38
39
  /**
39
40
  * Type guard to check if a project is a workspace project.
@@ -58,9 +59,9 @@ function isPersonalProject(project) {
58
59
  */
59
60
  function validateProject(input) {
60
61
  if ('workspaceId' in input) {
61
- return types_8.WorkspaceProjectSchema.parse(input);
62
+ return types_9.WorkspaceProjectSchema.parse(input);
62
63
  }
63
- return types_8.PersonalProjectSchema.parse(input);
64
+ return types_9.PersonalProjectSchema.parse(input);
64
65
  }
65
66
  function validateProjectArray(input) {
66
67
  if (!Array.isArray(input)) {
@@ -68,48 +69,48 @@ function validateProjectArray(input) {
68
69
  }
69
70
  return input.map(validateProject);
70
71
  }
71
- exports.validateWorkspaceProject = createValidator(types_8.WorkspaceProjectSchema);
72
+ exports.validateWorkspaceProject = createValidator(types_9.WorkspaceProjectSchema);
72
73
  exports.validateWorkspaceProjectArray = createArrayValidator(exports.validateWorkspaceProject);
73
- exports.validateSection = createValidator(types_9.SectionSchema);
74
+ exports.validateSection = createValidator(types_10.SectionSchema);
74
75
  exports.validateSectionArray = createArrayValidator(exports.validateSection);
75
- exports.validateLabel = createValidator(types_6.LabelSchema);
76
+ exports.validateLabel = createValidator(types_7.LabelSchema);
76
77
  exports.validateLabelArray = createArrayValidator(exports.validateLabel);
77
78
  exports.validateComment = createValidator(types_3.CommentSchema);
78
79
  exports.validateCommentArray = createArrayValidator(exports.validateComment);
79
- exports.validateUser = createValidator(types_11.UserSchema);
80
+ exports.validateUser = createValidator(types_12.UserSchema);
80
81
  exports.validateUserArray = createArrayValidator(exports.validateUser);
81
- exports.validateProductivityStats = createValidator(types_7.ProductivityStatsSchema);
82
- exports.validateCurrentUser = createValidator(types_11.CurrentUserSchema);
82
+ exports.validateProductivityStats = createValidator(types_8.ProductivityStatsSchema);
83
+ exports.validateCurrentUser = createValidator(types_12.CurrentUserSchema);
83
84
  exports.validateActivityEvent = createValidator(types_1.ActivityEventSchema);
84
85
  exports.validateActivityEventArray = createArrayValidator(exports.validateActivityEvent);
85
86
  exports.validateAttachment = createValidator(types_3.AttachmentSchema);
86
- exports.validateWorkspaceUser = createValidator(types_12.WorkspaceUserSchema);
87
+ exports.validateWorkspaceUser = createValidator(types_13.WorkspaceUserSchema);
87
88
  function validateWorkspaceUserArray(input) {
88
89
  if (!Array.isArray(input)) {
89
90
  throw new Error(`Expected array for workspace users, got ${typeof input}`);
90
91
  }
91
92
  return input.map(exports.validateWorkspaceUser);
92
93
  }
93
- exports.validateWorkspaceInvitation = createValidator(types_12.WorkspaceInvitationSchema);
94
+ exports.validateWorkspaceInvitation = createValidator(types_13.WorkspaceInvitationSchema);
94
95
  exports.validateWorkspaceInvitationArray = createArrayValidator(exports.validateWorkspaceInvitation);
95
- exports.validateWorkspacePlanDetails = createValidator(types_12.WorkspacePlanDetailsSchema);
96
- exports.validateJoinWorkspaceResult = createValidator(types_12.JoinWorkspaceResultSchema);
97
- exports.validateWorkspace = createValidator(types_12.WorkspaceSchema);
96
+ exports.validateWorkspacePlanDetails = createValidator(types_13.WorkspacePlanDetailsSchema);
97
+ exports.validateJoinWorkspaceResult = createValidator(types_13.JoinWorkspaceResultSchema);
98
+ exports.validateWorkspace = createValidator(types_13.WorkspaceSchema);
98
99
  exports.validateWorkspaceArray = createArrayValidator(exports.validateWorkspace);
99
- exports.validateMemberActivityInfo = createValidator(types_12.MemberActivityInfoSchema);
100
+ exports.validateMemberActivityInfo = createValidator(types_13.MemberActivityInfoSchema);
100
101
  exports.validateMemberActivityInfoArray = createArrayValidator(exports.validateMemberActivityInfo);
101
- exports.validateWorkspaceUserTask = createValidator(types_12.WorkspaceUserTaskSchema);
102
+ exports.validateWorkspaceUserTask = createValidator(types_13.WorkspaceUserTaskSchema);
102
103
  exports.validateWorkspaceUserTaskArray = createArrayValidator(exports.validateWorkspaceUserTask);
103
- exports.validateProjectActivityStats = createValidator(types_5.ProjectActivityStatsSchema);
104
- exports.validateProjectHealth = createValidator(types_5.ProjectHealthSchema);
105
- exports.validateProjectHealthContext = createValidator(types_5.ProjectHealthContextSchema);
106
- exports.validateProjectProgress = createValidator(types_5.ProjectProgressSchema);
107
- exports.validateWorkspaceInsights = createValidator(types_5.WorkspaceInsightsSchema);
104
+ exports.validateProjectActivityStats = createValidator(types_6.ProjectActivityStatsSchema);
105
+ exports.validateProjectHealth = createValidator(types_6.ProjectHealthSchema);
106
+ exports.validateProjectHealthContext = createValidator(types_6.ProjectHealthContextSchema);
107
+ exports.validateProjectProgress = createValidator(types_6.ProjectProgressSchema);
108
+ exports.validateWorkspaceInsights = createValidator(types_6.WorkspaceInsightsSchema);
108
109
  exports.validateBackup = createValidator(types_2.BackupSchema);
109
110
  exports.validateBackupArray = createArrayValidator(exports.validateBackup);
110
- exports.validateIdMapping = createValidator(types_4.IdMappingSchema);
111
+ exports.validateIdMapping = createValidator(types_5.IdMappingSchema);
111
112
  exports.validateIdMappingArray = createArrayValidator(exports.validateIdMapping);
112
- exports.validateMovedId = createValidator(types_4.MovedIdSchema);
113
+ exports.validateMovedId = createValidator(types_5.MovedIdSchema);
113
114
  exports.validateMovedIdArray = createArrayValidator(exports.validateMovedId);
114
115
  // Sync resource validators
115
116
  exports.validateFilter = createValidator(resources_1.FilterSchema);
@@ -120,6 +121,8 @@ exports.validateCollaboratorState = createValidator(resources_1.CollaboratorStat
120
121
  exports.validateCollaboratorStateArray = createArrayValidator(exports.validateCollaboratorState);
121
122
  exports.validateFolder = createValidator(resources_1.FolderSchema);
122
123
  exports.validateFolderArray = createArrayValidator(exports.validateFolder);
124
+ exports.validateGoal = createValidator(types_4.GoalSchema);
125
+ exports.validateGoalArray = createArrayValidator(exports.validateGoal);
123
126
  exports.validateNote = createValidator(resources_1.NoteSchema);
124
127
  exports.validateNoteArray = createArrayValidator(exports.validateNote);
125
128
  exports.validateTooltips = createValidator(resources_1.TooltipsSchema);
@@ -151,7 +154,7 @@ exports.validateUserSettings = createValidator(resources_1.UserSettingsSchema);
151
154
  exports.validateSuggestion = createValidator(resources_1.SuggestionSchema);
152
155
  exports.validateSuggestionArray = createArrayValidator(exports.validateSuggestion);
153
156
  function parseSyncResponse(raw) {
154
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, raw), ('items' in raw ? { items: (0, exports.validateTaskArray)(raw.items) } : {})), ('projects' in raw ? { projects: validateProjectArray(raw.projects) } : {})), ('sections' in raw ? { sections: (0, exports.validateSectionArray)(raw.sections) } : {})), ('labels' in raw ? { labels: (0, exports.validateLabelArray)(raw.labels) } : {})), ('notes' in raw ? { notes: (0, exports.validateNoteArray)(raw.notes) } : {})), ('projectNotes' in raw ? { projectNotes: (0, exports.validateNoteArray)(raw.projectNotes) } : {})), ('filters' in raw ? { filters: (0, exports.validateFilterArray)(raw.filters) } : {})), ('reminders' in raw ? { reminders: (0, exports.validateReminderArray)(raw.reminders) } : {})), ('remindersLocation' in raw
157
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, raw), ('items' in raw ? { items: (0, exports.validateTaskArray)(raw.items) } : {})), ('projects' in raw ? { projects: validateProjectArray(raw.projects) } : {})), ('sections' in raw ? { sections: (0, exports.validateSectionArray)(raw.sections) } : {})), ('labels' in raw ? { labels: (0, exports.validateLabelArray)(raw.labels) } : {})), ('notes' in raw ? { notes: (0, exports.validateNoteArray)(raw.notes) } : {})), ('projectNotes' in raw ? { projectNotes: (0, exports.validateNoteArray)(raw.projectNotes) } : {})), ('filters' in raw ? { filters: (0, exports.validateFilterArray)(raw.filters) } : {})), ('reminders' in raw ? { reminders: (0, exports.validateReminderArray)(raw.reminders) } : {})), ('remindersLocation' in raw
155
158
  ? { remindersLocation: (0, exports.validateLocationReminderArray)(raw.remindersLocation) }
156
159
  : {})), ('user' in raw ? { user: (0, exports.validateSyncUser)(raw.user) } : {})), ('liveNotifications' in raw
157
160
  ? { liveNotifications: (0, exports.validateLiveNotificationArray)(raw.liveNotifications) }
@@ -171,7 +174,7 @@ function parseSyncResponse(raw) {
171
174
  ? {
172
175
  projectViewOptionsDefaults: (0, exports.validateProjectViewOptionsDefaultsArray)(raw.projectViewOptionsDefaults),
173
176
  }
174
- : {})), ('folders' in raw ? { folders: (0, exports.validateFolderArray)(raw.folders) } : {})), ('workspaceGoals' in raw
177
+ : {})), ('folders' in raw ? { folders: (0, exports.validateFolderArray)(raw.folders) } : {})), ('goals' in raw ? { goals: (0, exports.validateGoalArray)(raw.goals) } : {})), ('workspaceGoals' in raw
175
178
  ? { workspaceGoals: (0, exports.validateWorkspaceGoalArray)(raw.workspaceGoals) }
176
179
  : {})), ('calendars' in raw ? { calendars: (0, exports.validateCalendarArray)(raw.calendars) } : {})), ('calendarAccounts' in raw
177
180
  ? { calendarAccounts: (0, exports.validateCalendarAccountArray)(raw.calendarAccounts) }
@@ -67,6 +67,11 @@ export const ENDPOINT_GET_TOKEN = 'access_token';
67
67
  export const ENDPOINT_REVOKE = 'revoke';
68
68
  export const ENDPOINT_REGISTER = 'register';
69
69
  export const ENDPOINT_REST_FOLDERS = 'folders';
70
+ export const ENDPOINT_REST_GOALS = 'goals';
71
+ export const ENDPOINT_REST_GOALS_SEARCH = ENDPOINT_REST_GOALS + '/search';
72
+ export const GOAL_COMPLETE = 'complete';
73
+ export const GOAL_UNCOMPLETE = 'uncomplete';
74
+ export const GOAL_TASKS = 'items';
70
75
  // Workspace endpoints
71
76
  export const ENDPOINT_REST_WORKSPACES = 'workspaces';
72
77
  export const ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { z } from 'zod';
13
- import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, ENDPOINT_REST_FOLDERS, } from './consts/endpoints.js';
13
+ import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, ENDPOINT_REST_FOLDERS, ENDPOINT_REST_GOALS, ENDPOINT_REST_GOALS_SEARCH, GOAL_COMPLETE, GOAL_UNCOMPLETE, GOAL_TASKS, } from './consts/endpoints.js';
14
14
  import { request, isSuccess } from './transport/http-client.js';
15
15
  import { UpdateReminderArgsSchema, UpdateLocationReminderArgsSchema, ReminderIdSchema, } from './types/reminders/index.js';
16
16
  import { normalizeObjectEventTypeForApi, denormalizeObjectTypeFromApi, } from './utils/activity-helpers.js';
@@ -18,7 +18,7 @@ import { camelCaseKeys } from './utils/case-conversion.js';
18
18
  import { uploadMultipartFile } from './utils/multipart-upload.js';
19
19
  import { processTaskContent } from './utils/uncompletable-helpers.js';
20
20
  import { formatDateToYYYYMMDD } from './utils/url-helpers.js';
21
- import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, validateFolder, validateFolderArray, validateCollaboratorArray, validateCollaboratorStateArray, validateNoteArray, validateWorkspaceProject, validateWorkspaceProjectArray, parseSyncResponse, } from './utils/validators.js';
21
+ import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, validateFolder, validateFolderArray, validateGoal, validateGoalArray, validateCollaboratorArray, validateCollaboratorStateArray, validateNoteArray, validateWorkspaceProject, validateWorkspaceProjectArray, parseSyncResponse, } from './utils/validators.js';
22
22
  import { v4 as uuidv4 } from 'uuid';
23
23
  import { TodoistArgumentError, TodoistRequestError } from './types/index.js';
24
24
  import { DATE_FORMAT_TO_API, TIME_FORMAT_TO_API, DAY_OF_WEEK_TO_API, } from './types/sync/index.js';
@@ -1911,6 +1911,134 @@ export class TodoistApi {
1911
1911
  });
1912
1912
  return isSuccess(response);
1913
1913
  }
1914
+ // ── Goals ──
1915
+ async getGoals(args) {
1916
+ const { data: { results, nextCursor }, } = await request({
1917
+ httpMethod: 'GET',
1918
+ baseUri: this.syncApiBase,
1919
+ relativePath: ENDPOINT_REST_GOALS,
1920
+ apiToken: this.authToken,
1921
+ customFetch: this.customFetch,
1922
+ payload: args,
1923
+ });
1924
+ return {
1925
+ results: validateGoalArray(results),
1926
+ nextCursor,
1927
+ };
1928
+ }
1929
+ async searchGoals(args) {
1930
+ const { data: { results, nextCursor }, } = await request({
1931
+ httpMethod: 'GET',
1932
+ baseUri: this.syncApiBase,
1933
+ relativePath: ENDPOINT_REST_GOALS_SEARCH,
1934
+ apiToken: this.authToken,
1935
+ customFetch: this.customFetch,
1936
+ payload: args,
1937
+ });
1938
+ return {
1939
+ results: validateGoalArray(results),
1940
+ nextCursor,
1941
+ };
1942
+ }
1943
+ async getGoal(id) {
1944
+ z.string().parse(id);
1945
+ const response = await request({
1946
+ httpMethod: 'GET',
1947
+ baseUri: this.syncApiBase,
1948
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id),
1949
+ apiToken: this.authToken,
1950
+ customFetch: this.customFetch,
1951
+ });
1952
+ return validateGoal(response.data);
1953
+ }
1954
+ async addGoal(args, requestId) {
1955
+ const response = await request({
1956
+ httpMethod: 'POST',
1957
+ baseUri: this.syncApiBase,
1958
+ relativePath: ENDPOINT_REST_GOALS,
1959
+ apiToken: this.authToken,
1960
+ customFetch: this.customFetch,
1961
+ payload: args,
1962
+ requestId: requestId,
1963
+ });
1964
+ return validateGoal(response.data);
1965
+ }
1966
+ async updateGoal(id, args, requestId) {
1967
+ z.string().parse(id);
1968
+ const response = await request({
1969
+ httpMethod: 'POST',
1970
+ baseUri: this.syncApiBase,
1971
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id),
1972
+ apiToken: this.authToken,
1973
+ customFetch: this.customFetch,
1974
+ payload: args,
1975
+ requestId: requestId,
1976
+ });
1977
+ return validateGoal(response.data);
1978
+ }
1979
+ async deleteGoal(id, requestId) {
1980
+ z.string().parse(id);
1981
+ const response = await request({
1982
+ httpMethod: 'DELETE',
1983
+ baseUri: this.syncApiBase,
1984
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id),
1985
+ apiToken: this.authToken,
1986
+ customFetch: this.customFetch,
1987
+ requestId: requestId,
1988
+ });
1989
+ return isSuccess(response);
1990
+ }
1991
+ async completeGoal(id, requestId) {
1992
+ z.string().parse(id);
1993
+ const response = await request({
1994
+ httpMethod: 'POST',
1995
+ baseUri: this.syncApiBase,
1996
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id, GOAL_COMPLETE),
1997
+ apiToken: this.authToken,
1998
+ customFetch: this.customFetch,
1999
+ requestId: requestId,
2000
+ });
2001
+ return validateGoal(response.data);
2002
+ }
2003
+ async uncompleteGoal(id, requestId) {
2004
+ z.string().parse(id);
2005
+ const response = await request({
2006
+ httpMethod: 'POST',
2007
+ baseUri: this.syncApiBase,
2008
+ relativePath: generatePath(ENDPOINT_REST_GOALS, id, GOAL_UNCOMPLETE),
2009
+ apiToken: this.authToken,
2010
+ customFetch: this.customFetch,
2011
+ requestId: requestId,
2012
+ });
2013
+ return validateGoal(response.data);
2014
+ }
2015
+ async linkTaskToGoal({ goalId, taskId }, requestId) {
2016
+ z.string().parse(goalId);
2017
+ z.string().parse(taskId);
2018
+ const response = await request({
2019
+ httpMethod: 'POST',
2020
+ baseUri: this.syncApiBase,
2021
+ relativePath: generatePath(ENDPOINT_REST_GOALS, goalId, GOAL_TASKS),
2022
+ apiToken: this.authToken,
2023
+ customFetch: this.customFetch,
2024
+ payload: { itemId: taskId },
2025
+ requestId: requestId,
2026
+ });
2027
+ return validateGoal(response.data);
2028
+ }
2029
+ async unlinkTaskFromGoal({ goalId, taskId }, requestId) {
2030
+ z.string().parse(goalId);
2031
+ z.string().parse(taskId);
2032
+ const response = await request({
2033
+ httpMethod: 'DELETE',
2034
+ baseUri: this.syncApiBase,
2035
+ relativePath: generatePath(ENDPOINT_REST_GOALS, goalId, GOAL_TASKS, taskId),
2036
+ apiToken: this.authToken,
2037
+ customFetch: this.customFetch,
2038
+ requestId: requestId,
2039
+ });
2040
+ return isSuccess(response);
2041
+ }
1914
2042
  // ── Backups ──
1915
2043
  /**
1916
2044
  * Retrieves a list of available backups.
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ /** Available goal owner types. */
3
+ export const GOAL_OWNER_TYPES = ['USER', 'WORKSPACE'];
4
+ export const GoalProgressSchema = z.looseObject({
5
+ totalTaskCount: z.number().int(),
6
+ completedTaskCount: z.number().int(),
7
+ percentage: z.number(),
8
+ });
9
+ export const GoalSchema = z.looseObject({
10
+ id: z.string(),
11
+ ownerType: z.enum(GOAL_OWNER_TYPES),
12
+ ownerId: z.string(),
13
+ name: z.string(),
14
+ description: z.string().nullable(),
15
+ deadline: z.string().nullable(),
16
+ parentGoalId: z.string().nullable(),
17
+ childOrder: z.number().int(),
18
+ isCompleted: z.boolean(),
19
+ completedAt: z.coerce.date().nullable(),
20
+ responsibleUid: z.string().nullable(),
21
+ isDeleted: z.boolean(),
22
+ progress: GoalProgressSchema.optional(),
23
+ creatorUid: z.string(),
24
+ createdAt: z.coerce.date(),
25
+ updatedAt: z.coerce.date(),
26
+ });
@@ -9,6 +9,7 @@ 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';
12
13
  export * from './insights/index.js';
13
14
  export * from './backups/index.js';
14
15
  export * from './id-mappings/index.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -11,6 +11,7 @@ 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';
14
15
  export * from './notifications.js';
15
16
  export * from './sharing.js';
16
17
  export * from './view-options.js';
@@ -29,6 +29,7 @@ export const SYNC_RESOURCE_TYPES = [
29
29
  'role_actions',
30
30
  'folders',
31
31
  'workspace_goals',
32
+ 'goals',
32
33
  'day_orders',
33
34
  'calendars',
34
35
  'calendar_accounts',
@@ -1,6 +1,7 @@
1
1
  import { ActivityEventSchema } from '../types/activity/types.js';
2
2
  import { BackupSchema } from '../types/backups/types.js';
3
3
  import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
4
+ import { GoalSchema } from '../types/goals/types.js';
4
5
  import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
5
6
  import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
6
7
  import { LabelSchema } from '../types/labels/types.js';
@@ -110,6 +111,8 @@ export const validateCollaboratorState = createValidator(CollaboratorStateSchema
110
111
  export const validateCollaboratorStateArray = createArrayValidator(validateCollaboratorState);
111
112
  export const validateFolder = createValidator(FolderSchema);
112
113
  export const validateFolderArray = createArrayValidator(validateFolder);
114
+ export const validateGoal = createValidator(GoalSchema);
115
+ export const validateGoalArray = createArrayValidator(validateGoal);
113
116
  export const validateNote = createValidator(NoteSchema);
114
117
  export const validateNoteArray = createArrayValidator(validateNote);
115
118
  export const validateTooltips = createValidator(TooltipsSchema);
@@ -141,7 +144,7 @@ export const validateUserSettings = createValidator(UserSettingsSchema);
141
144
  export const validateSuggestion = createValidator(SuggestionSchema);
142
145
  export const validateSuggestionArray = createArrayValidator(validateSuggestion);
143
146
  export function parseSyncResponse(raw) {
144
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, raw), ('items' in raw ? { items: validateTaskArray(raw.items) } : {})), ('projects' in raw ? { projects: validateProjectArray(raw.projects) } : {})), ('sections' in raw ? { sections: validateSectionArray(raw.sections) } : {})), ('labels' in raw ? { labels: validateLabelArray(raw.labels) } : {})), ('notes' in raw ? { notes: validateNoteArray(raw.notes) } : {})), ('projectNotes' in raw ? { projectNotes: validateNoteArray(raw.projectNotes) } : {})), ('filters' in raw ? { filters: validateFilterArray(raw.filters) } : {})), ('reminders' in raw ? { reminders: validateReminderArray(raw.reminders) } : {})), ('remindersLocation' in raw
147
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, raw), ('items' in raw ? { items: validateTaskArray(raw.items) } : {})), ('projects' in raw ? { projects: validateProjectArray(raw.projects) } : {})), ('sections' in raw ? { sections: validateSectionArray(raw.sections) } : {})), ('labels' in raw ? { labels: validateLabelArray(raw.labels) } : {})), ('notes' in raw ? { notes: validateNoteArray(raw.notes) } : {})), ('projectNotes' in raw ? { projectNotes: validateNoteArray(raw.projectNotes) } : {})), ('filters' in raw ? { filters: validateFilterArray(raw.filters) } : {})), ('reminders' in raw ? { reminders: validateReminderArray(raw.reminders) } : {})), ('remindersLocation' in raw
145
148
  ? { remindersLocation: validateLocationReminderArray(raw.remindersLocation) }
146
149
  : {})), ('user' in raw ? { user: validateSyncUser(raw.user) } : {})), ('liveNotifications' in raw
147
150
  ? { liveNotifications: validateLiveNotificationArray(raw.liveNotifications) }
@@ -161,7 +164,7 @@ export function parseSyncResponse(raw) {
161
164
  ? {
162
165
  projectViewOptionsDefaults: validateProjectViewOptionsDefaultsArray(raw.projectViewOptionsDefaults),
163
166
  }
164
- : {})), ('folders' in raw ? { folders: validateFolderArray(raw.folders) } : {})), ('workspaceGoals' in raw
167
+ : {})), ('folders' in raw ? { folders: validateFolderArray(raw.folders) } : {})), ('goals' in raw ? { goals: validateGoalArray(raw.goals) } : {})), ('workspaceGoals' in raw
165
168
  ? { workspaceGoals: validateWorkspaceGoalArray(raw.workspaceGoals) }
166
169
  : {})), ('calendars' in raw ? { calendars: validateCalendarArray(raw.calendars) } : {})), ('calendarAccounts' in raw
167
170
  ? { calendarAccounts: validateCalendarAccountArray(raw.calendarAccounts) }
@@ -58,6 +58,11 @@ export declare const ENDPOINT_GET_TOKEN = "access_token";
58
58
  export declare const ENDPOINT_REVOKE = "revoke";
59
59
  export declare const ENDPOINT_REGISTER = "register";
60
60
  export declare const ENDPOINT_REST_FOLDERS = "folders";
61
+ export declare const ENDPOINT_REST_GOALS = "goals";
62
+ export declare const ENDPOINT_REST_GOALS_SEARCH: string;
63
+ export declare const GOAL_COMPLETE = "complete";
64
+ export declare const GOAL_UNCOMPLETE = "uncomplete";
65
+ export declare const GOAL_TASKS = "items";
61
66
  export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
62
67
  export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
63
68
  export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
@@ -4,6 +4,7 @@ import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/inde
4
4
  import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js';
5
5
  import { GetOrCreateEmailArgs, GetOrCreateEmailResponse, DisableEmailArgs } from './types/emails/index.js';
6
6
  import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
7
+ import type { Goal, GetGoalsArgs, GetGoalsResponse, SearchGoalsArgs, AddGoalArgs, UpdateGoalArgs, TaskLinkingArgs } from './types/goals/index.js';
7
8
  import { CustomFetch, CustomFetchResponse } from './types/http.js';
8
9
  import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
9
10
  import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
@@ -758,6 +759,16 @@ export declare class TodoistApi {
758
759
  * @returns A promise that resolves to `true` if successful.
759
760
  */
760
761
  deleteFolder(id: string, requestId?: string): Promise<boolean>;
762
+ getGoals(args?: GetGoalsArgs): Promise<GetGoalsResponse>;
763
+ searchGoals(args: SearchGoalsArgs): Promise<GetGoalsResponse>;
764
+ getGoal(id: string): Promise<Goal>;
765
+ addGoal(args: AddGoalArgs, requestId?: string): Promise<Goal>;
766
+ updateGoal(id: string, args: UpdateGoalArgs, requestId?: string): Promise<Goal>;
767
+ deleteGoal(id: string, requestId?: string): Promise<boolean>;
768
+ completeGoal(id: string, requestId?: string): Promise<Goal>;
769
+ uncompleteGoal(id: string, requestId?: string): Promise<Goal>;
770
+ linkTaskToGoal({ goalId, taskId }: TaskLinkingArgs, requestId?: string): Promise<Goal>;
771
+ unlinkTaskFromGoal({ goalId, taskId }: TaskLinkingArgs, requestId?: string): Promise<boolean>;
761
772
  /**
762
773
  * Retrieves a list of available backups.
763
774
  *
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -0,0 +1,33 @@
1
+ import type { SearchArgs } from '../common.js';
2
+ import type { Workspace } from '../workspaces/index.js';
3
+ import type { Goal, GoalOwnerType } from './types.js';
4
+ export type GetGoalsArgs = {
5
+ ownerType?: GoalOwnerType;
6
+ workspaceId?: Workspace['id'];
7
+ cursor?: string | null;
8
+ limit?: number;
9
+ };
10
+ export type SearchGoalsArgs = SearchArgs & {
11
+ ownerType?: GoalOwnerType;
12
+ };
13
+ export type GetGoalsResponse = {
14
+ results: Goal[];
15
+ nextCursor: string | null;
16
+ };
17
+ export type AddGoalArgs = {
18
+ name: string;
19
+ workspaceId?: string;
20
+ description?: string | null;
21
+ deadline?: string | null;
22
+ responsibleUid?: string | null;
23
+ };
24
+ export type UpdateGoalArgs = {
25
+ name?: string;
26
+ description?: string | null;
27
+ deadline?: string | null;
28
+ responsibleUid?: string | null;
29
+ };
30
+ export type TaskLinkingArgs = {
31
+ goalId: string;
32
+ taskId: string;
33
+ };
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ /** Available goal owner types. */
3
+ export declare const GOAL_OWNER_TYPES: readonly ["USER", "WORKSPACE"];
4
+ /** Goal owner type. */
5
+ export type GoalOwnerType = (typeof GOAL_OWNER_TYPES)[number];
6
+ export declare const GoalProgressSchema: z.ZodObject<{
7
+ totalTaskCount: z.ZodNumber;
8
+ completedTaskCount: z.ZodNumber;
9
+ percentage: z.ZodNumber;
10
+ }, z.core.$loose>;
11
+ export type GoalProgress = z.infer<typeof GoalProgressSchema>;
12
+ export declare const GoalSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ ownerType: z.ZodEnum<{
15
+ USER: "USER";
16
+ WORKSPACE: "WORKSPACE";
17
+ }>;
18
+ ownerId: z.ZodString;
19
+ name: z.ZodString;
20
+ description: z.ZodNullable<z.ZodString>;
21
+ deadline: z.ZodNullable<z.ZodString>;
22
+ parentGoalId: z.ZodNullable<z.ZodString>;
23
+ childOrder: z.ZodNumber;
24
+ isCompleted: z.ZodBoolean;
25
+ completedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
26
+ responsibleUid: z.ZodNullable<z.ZodString>;
27
+ isDeleted: z.ZodBoolean;
28
+ progress: z.ZodOptional<z.ZodObject<{
29
+ totalTaskCount: z.ZodNumber;
30
+ completedTaskCount: z.ZodNumber;
31
+ percentage: z.ZodNumber;
32
+ }, z.core.$loose>>;
33
+ creatorUid: z.ZodString;
34
+ createdAt: z.ZodCoercedDate<unknown>;
35
+ updatedAt: z.ZodCoercedDate<unknown>;
36
+ }, z.core.$loose>;
37
+ /**
38
+ * Represents a goal in Todoist.
39
+ * Goals support dual ownership: personal (ownerType=USER) and workspace (ownerType=WORKSPACE).
40
+ */
41
+ export type Goal = z.infer<typeof GoalSchema>;
@@ -9,6 +9,7 @@ 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';
12
13
  export * from './insights/index.js';
13
14
  export * from './backups/index.js';
14
15
  export * from './id-mappings/index.js';
@@ -0,0 +1,33 @@
1
+ import type { GoalOwnerType } from '../../goals/types.js';
2
+ export type GoalAddArgs = {
3
+ ownerType: GoalOwnerType;
4
+ ownerId: string;
5
+ name: string;
6
+ description?: string | null;
7
+ deadline?: string | null;
8
+ responsibleUid?: string | null;
9
+ };
10
+ export type GoalUpdateArgs = {
11
+ id: string;
12
+ name?: string;
13
+ description?: string | null;
14
+ deadline?: string | null;
15
+ responsibleUid?: string | null;
16
+ };
17
+ export type GoalCompleteArgs = {
18
+ id: string;
19
+ };
20
+ export type GoalUncompleteArgs = {
21
+ id: string;
22
+ };
23
+ export type GoalDeleteArgs = {
24
+ id: string;
25
+ };
26
+ export type GoalLinkItemArgs = {
27
+ goalId: string;
28
+ itemId: string;
29
+ };
30
+ export type GoalUnlinkItemArgs = {
31
+ goalId: string;
32
+ itemId: string;
33
+ };
@@ -1,6 +1,7 @@
1
1
  import type { CalendarUpdateArgs, CalendarAccountUpdateArgs, CalendarAccountRestoreTaskCalendarArgs } from './calendars.js';
2
2
  import type { FilterAddArgs, FilterUpdateArgs, FilterUpdateOrdersArgs, FilterDeleteArgs } from './filters.js';
3
3
  import type { FolderAddArgs, FolderUpdateArgs, FolderDeleteArgs } from './folders.js';
4
+ import type { GoalAddArgs, GoalUpdateArgs, GoalCompleteArgs, GoalUncompleteArgs, GoalDeleteArgs, GoalLinkItemArgs, GoalUnlinkItemArgs } from './goals.js';
4
5
  import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
5
6
  import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
6
7
  import type { LiveNotificationsMarkUnreadArgs, LiveNotificationsMarkReadArgs, LiveNotificationsMarkReadAllArgs, LiveNotificationsSetLastReadArgs } from './notifications.js';
@@ -96,6 +97,13 @@ export type SyncCommandsMap = {
96
97
  workspace_goal_delete: WorkspaceGoalDeleteArgs;
97
98
  workspace_goal_project_add: WorkspaceGoalProjectAddArgs;
98
99
  workspace_goal_project_remove: WorkspaceGoalProjectRemoveArgs;
100
+ goal_add: GoalAddArgs;
101
+ goal_update: GoalUpdateArgs;
102
+ goal_complete: GoalCompleteArgs;
103
+ goal_uncomplete: GoalUncompleteArgs;
104
+ goal_delete: GoalDeleteArgs;
105
+ goal_link_item: GoalLinkItemArgs;
106
+ goal_unlink_item: GoalUnlinkItemArgs;
99
107
  live_notifications_mark_unread: LiveNotificationsMarkUnreadArgs;
100
108
  live_notifications_mark_read: LiveNotificationsMarkReadArgs;
101
109
  live_notifications_mark_read_all: LiveNotificationsMarkReadAllArgs;
@@ -163,6 +171,7 @@ export * from './workspaces.js';
163
171
  export * from './folders.js';
164
172
  export * from './workspace-filters.js';
165
173
  export * from './workspace-goals.js';
174
+ export * from './goals.js';
166
175
  export * from './notifications.js';
167
176
  export * from './sharing.js';
168
177
  export * from './view-options.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * All available Sync API resource types.
3
3
  */
4
- export declare const SYNC_RESOURCE_TYPES: readonly ["labels", "projects", "items", "notes", "project_notes", "sections", "filters", "reminders", "reminders_location", "locations", "user", "live_notifications", "collaborators", "collaborator_states", "user_settings", "notification_settings", "user_plan_limits", "completed_info", "stats", "workspaces", "workspace_users", "workspace_filters", "view_options", "project_view_options_defaults", "role_actions", "folders", "workspace_goals", "day_orders", "calendars", "calendar_accounts", "suggestions", "tooltips"];
4
+ export declare const SYNC_RESOURCE_TYPES: readonly ["labels", "projects", "items", "notes", "project_notes", "sections", "filters", "reminders", "reminders_location", "locations", "user", "live_notifications", "collaborators", "collaborator_states", "user_settings", "notification_settings", "user_plan_limits", "completed_info", "stats", "workspaces", "workspace_users", "workspace_filters", "view_options", "project_view_options_defaults", "role_actions", "folders", "workspace_goals", "goals", "day_orders", "calendars", "calendar_accounts", "suggestions", "tooltips"];
5
5
  export type SyncResourceType = (typeof SYNC_RESOURCE_TYPES)[number];
@@ -32,6 +32,7 @@ export declare const GROUPED_BY_OPTIONS: readonly ["ASSIGNEE", "ADDED_DATE", "DU
32
32
  /** Field to group tasks by. */
33
33
  export type GroupedBy = (typeof GROUPED_BY_OPTIONS)[number];
34
34
  export declare const GroupedBySchema: z.ZodNullable<z.ZodEnum<{
35
+ WORKSPACE: "WORKSPACE";
35
36
  PROJECT: "PROJECT";
36
37
  LABEL: "LABEL";
37
38
  ASSIGNEE: "ASSIGNEE";
@@ -39,20 +40,19 @@ export declare const GroupedBySchema: z.ZodNullable<z.ZodEnum<{
39
40
  DUE_DATE: "DUE_DATE";
40
41
  DEADLINE: "DEADLINE";
41
42
  PRIORITY: "PRIORITY";
42
- WORKSPACE: "WORKSPACE";
43
43
  }>>;
44
44
  /** Available sorting options. */
45
45
  export declare const SORTED_BY_OPTIONS: readonly ["MANUAL", "ALPHABETICALLY", "ASSIGNEE", "DUE_DATE", "DEADLINE", "ADDED_DATE", "PRIORITY", "PROJECT", "WORKSPACE"];
46
46
  /** Field to sort tasks by. */
47
47
  export type SortedBy = (typeof SORTED_BY_OPTIONS)[number];
48
48
  export declare const SortedBySchema: z.ZodNullable<z.ZodEnum<{
49
+ WORKSPACE: "WORKSPACE";
49
50
  PROJECT: "PROJECT";
50
51
  ASSIGNEE: "ASSIGNEE";
51
52
  ADDED_DATE: "ADDED_DATE";
52
53
  DUE_DATE: "DUE_DATE";
53
54
  DEADLINE: "DEADLINE";
54
55
  PRIORITY: "PRIORITY";
55
- WORKSPACE: "WORKSPACE";
56
56
  MANUAL: "MANUAL";
57
57
  ALPHABETICALLY: "ALPHABETICALLY";
58
58
  }>>;
@@ -92,6 +92,7 @@ export declare const ViewOptionsSchema: z.ZodObject<{
92
92
  }>;
93
93
  objectId: z.ZodOptional<z.ZodString>;
94
94
  groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
95
+ WORKSPACE: "WORKSPACE";
95
96
  PROJECT: "PROJECT";
96
97
  LABEL: "LABEL";
97
98
  ASSIGNEE: "ASSIGNEE";
@@ -99,7 +100,6 @@ export declare const ViewOptionsSchema: z.ZodObject<{
99
100
  DUE_DATE: "DUE_DATE";
100
101
  DEADLINE: "DEADLINE";
101
102
  PRIORITY: "PRIORITY";
102
- WORKSPACE: "WORKSPACE";
103
103
  }>>>;
104
104
  filteredBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
105
  viewMode: z.ZodOptional<z.ZodEnum<{
@@ -109,13 +109,13 @@ export declare const ViewOptionsSchema: z.ZodObject<{
109
109
  }>>;
110
110
  showCompletedTasks: z.ZodOptional<z.ZodBoolean>;
111
111
  sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
112
+ WORKSPACE: "WORKSPACE";
112
113
  PROJECT: "PROJECT";
113
114
  ASSIGNEE: "ASSIGNEE";
114
115
  ADDED_DATE: "ADDED_DATE";
115
116
  DUE_DATE: "DUE_DATE";
116
117
  DEADLINE: "DEADLINE";
117
118
  PRIORITY: "PRIORITY";
118
- WORKSPACE: "WORKSPACE";
119
119
  MANUAL: "MANUAL";
120
120
  ALPHABETICALLY: "ALPHABETICALLY";
121
121
  }>>>;
@@ -133,6 +133,7 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
133
133
  CALENDAR: "CALENDAR";
134
134
  }>>>;
135
135
  groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
136
+ WORKSPACE: "WORKSPACE";
136
137
  PROJECT: "PROJECT";
137
138
  LABEL: "LABEL";
138
139
  ASSIGNEE: "ASSIGNEE";
@@ -140,16 +141,15 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
140
141
  DUE_DATE: "DUE_DATE";
141
142
  DEADLINE: "DEADLINE";
142
143
  PRIORITY: "PRIORITY";
143
- WORKSPACE: "WORKSPACE";
144
144
  }>>>;
145
145
  sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
146
+ WORKSPACE: "WORKSPACE";
146
147
  PROJECT: "PROJECT";
147
148
  ASSIGNEE: "ASSIGNEE";
148
149
  ADDED_DATE: "ADDED_DATE";
149
150
  DUE_DATE: "DUE_DATE";
150
151
  DEADLINE: "DEADLINE";
151
152
  PRIORITY: "PRIORITY";
152
- WORKSPACE: "WORKSPACE";
153
153
  MANUAL: "MANUAL";
154
154
  ALPHABETICALLY: "ALPHABETICALLY";
155
155
  }>>>;
@@ -1,3 +1,4 @@
1
+ import type { Goal } from '../goals/types.js';
1
2
  import type { Label } from '../labels/types.js';
2
3
  import type { PersonalProject, WorkspaceProject } from '../projects/types.js';
3
4
  import type { Section } from '../sections/types.js';
@@ -43,6 +44,7 @@ export type SyncResponse = {
43
44
  roleActions?: Record<string, unknown>[];
44
45
  folders?: Folder[];
45
46
  workspaceGoals?: WorkspaceGoal[];
47
+ goals?: Goal[];
46
48
  dayOrders?: Record<string, number>;
47
49
  calendars?: Calendar[];
48
50
  calendarAccounts?: CalendarAccount[];
@@ -36,6 +36,7 @@ export type GetTasksArgs = {
36
36
  parentId?: string;
37
37
  label?: string;
38
38
  ids?: string[];
39
+ goalId?: string;
39
40
  cursor?: string | null;
40
41
  limit?: number;
41
42
  };
@@ -745,6 +745,54 @@ export declare const validateFolderArray: (input: unknown) => {
745
745
  defaultOrder: number;
746
746
  childOrder: number;
747
747
  }[];
748
+ export declare const validateGoal: (input: unknown) => {
749
+ [x: string]: unknown;
750
+ id: string;
751
+ ownerType: "USER" | "WORKSPACE";
752
+ ownerId: string;
753
+ name: string;
754
+ description: string | null;
755
+ deadline: string | null;
756
+ parentGoalId: string | null;
757
+ childOrder: number;
758
+ isCompleted: boolean;
759
+ completedAt: Date | null;
760
+ responsibleUid: string | null;
761
+ isDeleted: boolean;
762
+ creatorUid: string;
763
+ createdAt: Date;
764
+ updatedAt: Date;
765
+ progress?: {
766
+ [x: string]: unknown;
767
+ totalTaskCount: number;
768
+ completedTaskCount: number;
769
+ percentage: number;
770
+ } | undefined;
771
+ };
772
+ export declare const validateGoalArray: (input: unknown) => {
773
+ [x: string]: unknown;
774
+ id: string;
775
+ ownerType: "USER" | "WORKSPACE";
776
+ ownerId: string;
777
+ name: string;
778
+ description: string | null;
779
+ deadline: string | null;
780
+ parentGoalId: string | null;
781
+ childOrder: number;
782
+ isCompleted: boolean;
783
+ completedAt: Date | null;
784
+ responsibleUid: string | null;
785
+ isDeleted: boolean;
786
+ creatorUid: string;
787
+ createdAt: Date;
788
+ updatedAt: Date;
789
+ progress?: {
790
+ [x: string]: unknown;
791
+ totalTaskCount: number;
792
+ completedTaskCount: number;
793
+ percentage: number;
794
+ } | undefined;
795
+ }[];
748
796
  export declare const validateNote: (input: unknown) => {
749
797
  [x: string]: unknown;
750
798
  id: string;
@@ -1074,30 +1122,30 @@ export declare const validateViewOptions: (input: unknown) => {
1074
1122
  [x: string]: unknown;
1075
1123
  viewType: "PROJECT" | "TODAY" | "UPCOMING" | "LABEL" | "FILTER" | "WORKSPACE_FILTER" | "SEARCH" | "TEMPLATE_PREVIEW" | "TASK_DETAIL" | "AUTOMATION" | "ASSIGNED" | "OVERDUE" | "WORKSPACE_OVERVIEW";
1076
1124
  objectId?: string | undefined;
1077
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1125
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1078
1126
  filteredBy?: string | null | undefined;
1079
1127
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
1080
1128
  showCompletedTasks?: boolean | undefined;
1081
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1129
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1082
1130
  sortOrder?: "ASC" | "DESC" | null | undefined;
1083
1131
  };
1084
1132
  export declare const validateViewOptionsArray: (input: unknown) => {
1085
1133
  [x: string]: unknown;
1086
1134
  viewType: "PROJECT" | "TODAY" | "UPCOMING" | "LABEL" | "FILTER" | "WORKSPACE_FILTER" | "SEARCH" | "TEMPLATE_PREVIEW" | "TASK_DETAIL" | "AUTOMATION" | "ASSIGNED" | "OVERDUE" | "WORKSPACE_OVERVIEW";
1087
1135
  objectId?: string | undefined;
1088
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1136
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1089
1137
  filteredBy?: string | null | undefined;
1090
1138
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
1091
1139
  showCompletedTasks?: boolean | undefined;
1092
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1140
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1093
1141
  sortOrder?: "ASC" | "DESC" | null | undefined;
1094
1142
  }[];
1095
1143
  export declare const validateProjectViewOptionsDefaults: (input: unknown) => {
1096
1144
  [x: string]: unknown;
1097
1145
  projectId: string;
1098
1146
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
1099
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1100
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1147
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1148
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1101
1149
  sortOrder?: "ASC" | "DESC" | null | undefined;
1102
1150
  showCompletedTasks?: boolean | undefined;
1103
1151
  filteredBy?: string | null | undefined;
@@ -1110,8 +1158,8 @@ export declare const validateProjectViewOptionsDefaultsArray: (input: unknown) =
1110
1158
  [x: string]: unknown;
1111
1159
  projectId: string;
1112
1160
  viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
1113
- groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
1114
- sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1161
+ groupedBy?: "WORKSPACE" | "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | null | undefined;
1162
+ sortedBy?: "WORKSPACE" | "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
1115
1163
  sortOrder?: "ASC" | "DESC" | null | undefined;
1116
1164
  showCompletedTasks?: boolean | undefined;
1117
1165
  filteredBy?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-sdk",
3
- "version": "8.3.0",
3
+ "version": "8.4.0-next.2",
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",