@doist/todoist-sdk 8.4.0 → 8.5.0-next.1

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 (39) 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/projects/types.js +11 -1
  8. package/dist/cjs/types/sync/commands/goals.js +2 -0
  9. package/dist/cjs/types/sync/commands/index.js +1 -0
  10. package/dist/cjs/types/sync/resource-types.js +1 -0
  11. package/dist/cjs/types/sync/response.js +55 -0
  12. package/dist/cjs/utils/validators.js +67 -142
  13. package/dist/esm/consts/endpoints.js +5 -0
  14. package/dist/esm/todoist-api.js +130 -2
  15. package/dist/esm/types/goals/index.js +2 -0
  16. package/dist/esm/types/goals/requests.js +1 -0
  17. package/dist/esm/types/goals/types.js +26 -0
  18. package/dist/esm/types/index.js +1 -0
  19. package/dist/esm/types/projects/types.js +10 -0
  20. package/dist/esm/types/sync/commands/goals.js +1 -0
  21. package/dist/esm/types/sync/commands/index.js +1 -0
  22. package/dist/esm/types/sync/resource-types.js +1 -0
  23. package/dist/esm/types/sync/response.js +54 -1
  24. package/dist/esm/utils/validators.js +56 -129
  25. package/dist/types/consts/endpoints.d.ts +5 -0
  26. package/dist/types/todoist-api.d.ts +11 -0
  27. package/dist/types/types/goals/index.d.ts +2 -0
  28. package/dist/types/types/goals/requests.d.ts +33 -0
  29. package/dist/types/types/goals/types.d.ts +41 -0
  30. package/dist/types/types/index.d.ts +1 -0
  31. package/dist/types/types/projects/types.d.ts +55 -0
  32. package/dist/types/types/sync/commands/goals.d.ts +33 -0
  33. package/dist/types/types/sync/commands/index.d.ts +9 -0
  34. package/dist/types/types/sync/resource-types.d.ts +1 -1
  35. package/dist/types/types/sync/resources/view-options.d.ts +6 -6
  36. package/dist/types/types/sync/response.d.ts +942 -51
  37. package/dist/types/types/tasks/requests.d.ts +1 -0
  38. package/dist/types/utils/validators.d.ts +194 -77
  39. 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';
@@ -1919,6 +1919,134 @@ class TodoistApi {
1919
1919
  });
1920
1920
  return (0, http_client_1.isSuccess)(response);
1921
1921
  }
1922
+ // ── Goals ──
1923
+ async getGoals(args) {
1924
+ const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
1925
+ httpMethod: 'GET',
1926
+ baseUri: this.syncApiBase,
1927
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS,
1928
+ apiToken: this.authToken,
1929
+ customFetch: this.customFetch,
1930
+ payload: args,
1931
+ });
1932
+ return {
1933
+ results: (0, validators_1.validateGoalArray)(results),
1934
+ nextCursor,
1935
+ };
1936
+ }
1937
+ async searchGoals(args) {
1938
+ const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
1939
+ httpMethod: 'GET',
1940
+ baseUri: this.syncApiBase,
1941
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS_SEARCH,
1942
+ apiToken: this.authToken,
1943
+ customFetch: this.customFetch,
1944
+ payload: args,
1945
+ });
1946
+ return {
1947
+ results: (0, validators_1.validateGoalArray)(results),
1948
+ nextCursor,
1949
+ };
1950
+ }
1951
+ async getGoal(id) {
1952
+ zod_1.z.string().parse(id);
1953
+ const response = await (0, http_client_1.request)({
1954
+ httpMethod: 'GET',
1955
+ baseUri: this.syncApiBase,
1956
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1957
+ apiToken: this.authToken,
1958
+ customFetch: this.customFetch,
1959
+ });
1960
+ return (0, validators_1.validateGoal)(response.data);
1961
+ }
1962
+ async addGoal(args, requestId) {
1963
+ const response = await (0, http_client_1.request)({
1964
+ httpMethod: 'POST',
1965
+ baseUri: this.syncApiBase,
1966
+ relativePath: endpoints_1.ENDPOINT_REST_GOALS,
1967
+ apiToken: this.authToken,
1968
+ customFetch: this.customFetch,
1969
+ payload: args,
1970
+ requestId: requestId,
1971
+ });
1972
+ return (0, validators_1.validateGoal)(response.data);
1973
+ }
1974
+ async updateGoal(id, args, requestId) {
1975
+ zod_1.z.string().parse(id);
1976
+ const response = await (0, http_client_1.request)({
1977
+ httpMethod: 'POST',
1978
+ baseUri: this.syncApiBase,
1979
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1980
+ apiToken: this.authToken,
1981
+ customFetch: this.customFetch,
1982
+ payload: args,
1983
+ requestId: requestId,
1984
+ });
1985
+ return (0, validators_1.validateGoal)(response.data);
1986
+ }
1987
+ async deleteGoal(id, requestId) {
1988
+ zod_1.z.string().parse(id);
1989
+ const response = await (0, http_client_1.request)({
1990
+ httpMethod: 'DELETE',
1991
+ baseUri: this.syncApiBase,
1992
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id),
1993
+ apiToken: this.authToken,
1994
+ customFetch: this.customFetch,
1995
+ requestId: requestId,
1996
+ });
1997
+ return (0, http_client_1.isSuccess)(response);
1998
+ }
1999
+ async completeGoal(id, requestId) {
2000
+ zod_1.z.string().parse(id);
2001
+ const response = await (0, http_client_1.request)({
2002
+ httpMethod: 'POST',
2003
+ baseUri: this.syncApiBase,
2004
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id, endpoints_1.GOAL_COMPLETE),
2005
+ apiToken: this.authToken,
2006
+ customFetch: this.customFetch,
2007
+ requestId: requestId,
2008
+ });
2009
+ return (0, validators_1.validateGoal)(response.data);
2010
+ }
2011
+ async uncompleteGoal(id, requestId) {
2012
+ zod_1.z.string().parse(id);
2013
+ const response = await (0, http_client_1.request)({
2014
+ httpMethod: 'POST',
2015
+ baseUri: this.syncApiBase,
2016
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, id, endpoints_1.GOAL_UNCOMPLETE),
2017
+ apiToken: this.authToken,
2018
+ customFetch: this.customFetch,
2019
+ requestId: requestId,
2020
+ });
2021
+ return (0, validators_1.validateGoal)(response.data);
2022
+ }
2023
+ async linkTaskToGoal({ goalId, taskId }, requestId) {
2024
+ zod_1.z.string().parse(goalId);
2025
+ zod_1.z.string().parse(taskId);
2026
+ const response = await (0, http_client_1.request)({
2027
+ httpMethod: 'POST',
2028
+ baseUri: this.syncApiBase,
2029
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, goalId, endpoints_1.GOAL_TASKS),
2030
+ apiToken: this.authToken,
2031
+ customFetch: this.customFetch,
2032
+ payload: { itemId: taskId },
2033
+ requestId: requestId,
2034
+ });
2035
+ return (0, validators_1.validateGoal)(response.data);
2036
+ }
2037
+ async unlinkTaskFromGoal({ goalId, taskId }, requestId) {
2038
+ zod_1.z.string().parse(goalId);
2039
+ zod_1.z.string().parse(taskId);
2040
+ const response = await (0, http_client_1.request)({
2041
+ httpMethod: 'DELETE',
2042
+ baseUri: this.syncApiBase,
2043
+ relativePath: generatePath(endpoints_1.ENDPOINT_REST_GOALS, goalId, endpoints_1.GOAL_TASKS, taskId),
2044
+ apiToken: this.authToken,
2045
+ customFetch: this.customFetch,
2046
+ requestId: requestId,
2047
+ });
2048
+ return (0, http_client_1.isSuccess)(response);
2049
+ }
1922
2050
  // ── Backups ──
1923
2051
  /**
1924
2052
  * 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);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROJECT_VIEW_STYLES = exports.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PROJECT_VISIBILITIES = exports.PersonalProjectSchema = exports.BaseProjectSchema = void 0;
3
+ exports.PROJECT_VIEW_STYLES = exports.ProjectSchema = exports.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PROJECT_VISIBILITIES = exports.PersonalProjectSchema = exports.BaseProjectSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const url_helpers_1 = require("../../utils/url-helpers");
6
6
  /**
@@ -52,5 +52,15 @@ exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
52
52
  }).transform((data) => {
53
53
  return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
54
54
  });
55
+ /**
56
+ * Schema for any project type in Todoist (personal or workspace).
57
+ * Dispatches to WorkspaceProjectSchema when workspaceId is present, PersonalProjectSchema otherwise.
58
+ */
59
+ exports.ProjectSchema = zod_1.z.unknown().transform((val) => {
60
+ if (typeof val === 'object' && val !== null && 'workspaceId' in val) {
61
+ return exports.WorkspaceProjectSchema.parse(val);
62
+ }
63
+ return exports.PersonalProjectSchema.parse(val);
64
+ });
55
65
  /** Available project view styles. */
56
66
  exports.PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
@@ -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,2 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncResponseSchema = exports.SyncErrorSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const types_1 = require("../goals/types");
6
+ const types_2 = require("../labels/types");
7
+ const types_3 = require("../projects/types");
8
+ const types_4 = require("../sections/types");
9
+ const types_5 = require("../tasks/types");
10
+ const types_6 = require("../workspaces/types");
11
+ const resources_1 = require("./resources");
12
+ exports.SyncErrorSchema = zod_1.z.object({
13
+ error: zod_1.z.string(),
14
+ errorCode: zod_1.z.number(),
15
+ errorExtra: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
16
+ errorTag: zod_1.z.string(),
17
+ httpCode: zod_1.z.number(),
18
+ });
19
+ exports.SyncResponseSchema = zod_1.z.looseObject({
20
+ syncToken: zod_1.z.string().optional(),
21
+ fullSync: zod_1.z.boolean().optional(),
22
+ syncStatus: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.literal('ok'), exports.SyncErrorSchema])).optional(),
23
+ tempIdMapping: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
24
+ items: zod_1.z.array(types_5.TaskSchema).optional(),
25
+ projects: zod_1.z.array(types_3.ProjectSchema).optional(),
26
+ sections: zod_1.z.array(types_4.SectionSchema).optional(),
27
+ labels: zod_1.z.array(types_2.LabelSchema).optional(),
28
+ notes: zod_1.z.array(resources_1.NoteSchema).optional(),
29
+ projectNotes: zod_1.z.array(resources_1.NoteSchema).optional(),
30
+ filters: zod_1.z.array(resources_1.FilterSchema).optional(),
31
+ reminders: zod_1.z.array(resources_1.ReminderSchema).optional(),
32
+ remindersLocation: zod_1.z.array(resources_1.LocationReminderSchema).optional(),
33
+ locations: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
34
+ user: resources_1.SyncUserSchema.optional(),
35
+ liveNotifications: zod_1.z.array(resources_1.LiveNotificationSchema).optional(),
36
+ collaborators: zod_1.z.array(resources_1.CollaboratorSchema).optional(),
37
+ collaboratorStates: zod_1.z.array(resources_1.CollaboratorStateSchema).optional(),
38
+ userSettings: resources_1.UserSettingsSchema.optional(),
39
+ notificationSettings: zod_1.z.record(zod_1.z.string(), zod_1.z.boolean()).optional(),
40
+ userPlanLimits: resources_1.UserPlanLimitsSchema.optional(),
41
+ completedInfo: zod_1.z.array(resources_1.CompletedInfoSchema).optional(),
42
+ stats: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
43
+ workspaces: zod_1.z.array(resources_1.SyncWorkspaceSchema).optional(),
44
+ workspaceUsers: zod_1.z.array(types_6.WorkspaceUserSchema).optional(),
45
+ workspaceFilters: zod_1.z.array(resources_1.WorkspaceFilterSchema).optional(),
46
+ viewOptions: zod_1.z.array(resources_1.ViewOptionsSchema).optional(),
47
+ projectViewOptionsDefaults: zod_1.z.array(resources_1.ProjectViewOptionsDefaultsSchema).optional(),
48
+ roleActions: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
49
+ folders: zod_1.z.array(resources_1.FolderSchema).optional(),
50
+ goals: zod_1.z.array(types_1.GoalSchema).optional(),
51
+ workspaceGoals: zod_1.z.array(resources_1.WorkspaceGoalSchema).optional(),
52
+ dayOrders: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(),
53
+ calendars: zod_1.z.array(resources_1.CalendarSchema).optional(),
54
+ calendarAccounts: zod_1.z.array(resources_1.CalendarAccountSchema).optional(),
55
+ suggestions: zod_1.z.array(resources_1.SuggestionSchema).optional(),
56
+ tooltips: resources_1.TooltipsSchema.optional(),
57
+ });
@@ -1,161 +1,86 @@
1
1
  "use strict";
2
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
2
3
  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;
5
- exports.validateProject = validateProject;
6
- exports.validateProjectArray = validateProjectArray;
7
- exports.validateWorkspaceUserArray = validateWorkspaceUserArray;
4
+ 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.validateWorkspaceUserArray = 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.validateProjectArray = exports.validateProject = exports.validateTaskArray = exports.validateTask = void 0;
5
+ 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 = exports.validateNote = exports.validateGoalArray = exports.validateGoal = void 0;
8
6
  exports.parseSyncResponse = parseSyncResponse;
7
+ const zod_1 = require("zod");
9
8
  const types_1 = require("../types/activity/types");
10
9
  const types_2 = require("../types/backups/types");
11
10
  const types_3 = require("../types/comments/types");
12
- const types_4 = require("../types/id-mappings/types");
13
- const types_5 = require("../types/insights/types");
14
- const types_6 = require("../types/labels/types");
15
- const types_7 = require("../types/productivity/types");
16
- const types_8 = require("../types/projects/types");
17
- const types_9 = require("../types/sections/types");
18
- const types_10 = require("../types/tasks/types");
19
- const types_11 = require("../types/users/types");
20
- const types_12 = require("../types/workspaces/types");
11
+ const types_4 = require("../types/goals/types");
12
+ const types_5 = require("../types/id-mappings/types");
13
+ const types_6 = require("../types/insights/types");
14
+ const types_7 = require("../types/labels/types");
15
+ const types_8 = require("../types/productivity/types");
16
+ const types_9 = require("../types/projects/types");
17
+ const types_10 = require("../types/sections/types");
18
+ const response_1 = require("../types/sync/response");
19
+ const types_11 = require("../types/tasks/types");
20
+ const types_12 = require("../types/users/types");
21
+ const types_13 = require("../types/workspaces/types");
21
22
  const resources_1 = require("../types/sync/resources");
22
23
  function createValidator(schema) {
23
- return (input) => schema.parse(input);
24
- }
25
- function createArrayValidator(validateItem) {
26
- return (input) => {
27
- if (!Array.isArray(input)) {
28
- throw new TypeError(`Expected array, got ${typeof input}`);
29
- }
30
- return input.map(validateItem);
24
+ return {
25
+ validate: (input) => schema.parse(input),
26
+ validateArray: (input) => zod_1.z.array(schema).parse(input),
31
27
  };
32
28
  }
33
29
  // Entity validators
34
- exports.validateTask = createValidator(types_10.TaskSchema);
35
- exports.validateTaskArray = createArrayValidator(exports.validateTask);
30
+ _a = createValidator(types_11.TaskSchema), exports.validateTask = _a.validate, exports.validateTaskArray = _a.validateArray;
36
31
  /**
37
32
  * Validates and parses a project input.
38
33
  * @param input The input to validate
39
34
  * @returns A validated project (either PersonalProject or WorkspaceProject)
40
35
  */
41
- function validateProject(input) {
42
- if ('workspaceId' in input) {
43
- return types_8.WorkspaceProjectSchema.parse(input);
44
- }
45
- return types_8.PersonalProjectSchema.parse(input);
46
- }
47
- function validateProjectArray(input) {
48
- if (!Array.isArray(input)) {
49
- throw new TypeError(`Expected array, got ${typeof input}`);
50
- }
51
- return input.map(validateProject);
52
- }
53
- exports.validateWorkspaceProject = createValidator(types_8.WorkspaceProjectSchema);
54
- exports.validateWorkspaceProjectArray = createArrayValidator(exports.validateWorkspaceProject);
55
- exports.validateSection = createValidator(types_9.SectionSchema);
56
- exports.validateSectionArray = createArrayValidator(exports.validateSection);
57
- exports.validateLabel = createValidator(types_6.LabelSchema);
58
- exports.validateLabelArray = createArrayValidator(exports.validateLabel);
59
- exports.validateComment = createValidator(types_3.CommentSchema);
60
- exports.validateCommentArray = createArrayValidator(exports.validateComment);
61
- exports.validateUser = createValidator(types_11.UserSchema);
62
- exports.validateUserArray = createArrayValidator(exports.validateUser);
63
- exports.validateProductivityStats = createValidator(types_7.ProductivityStatsSchema);
64
- exports.validateCurrentUser = createValidator(types_11.CurrentUserSchema);
65
- exports.validateActivityEvent = createValidator(types_1.ActivityEventSchema);
66
- exports.validateActivityEventArray = createArrayValidator(exports.validateActivityEvent);
67
- exports.validateAttachment = createValidator(types_3.AttachmentSchema);
68
- exports.validateWorkspaceUser = createValidator(types_12.WorkspaceUserSchema);
69
- function validateWorkspaceUserArray(input) {
70
- if (!Array.isArray(input)) {
71
- throw new Error(`Expected array for workspace users, got ${typeof input}`);
72
- }
73
- return input.map(exports.validateWorkspaceUser);
74
- }
75
- exports.validateWorkspaceInvitation = createValidator(types_12.WorkspaceInvitationSchema);
76
- exports.validateWorkspaceInvitationArray = createArrayValidator(exports.validateWorkspaceInvitation);
77
- exports.validateWorkspacePlanDetails = createValidator(types_12.WorkspacePlanDetailsSchema);
78
- exports.validateJoinWorkspaceResult = createValidator(types_12.JoinWorkspaceResultSchema);
79
- exports.validateWorkspace = createValidator(types_12.WorkspaceSchema);
80
- exports.validateWorkspaceArray = createArrayValidator(exports.validateWorkspace);
81
- exports.validateMemberActivityInfo = createValidator(types_12.MemberActivityInfoSchema);
82
- exports.validateMemberActivityInfoArray = createArrayValidator(exports.validateMemberActivityInfo);
83
- exports.validateWorkspaceUserTask = createValidator(types_12.WorkspaceUserTaskSchema);
84
- exports.validateWorkspaceUserTaskArray = createArrayValidator(exports.validateWorkspaceUserTask);
85
- exports.validateProjectActivityStats = createValidator(types_5.ProjectActivityStatsSchema);
86
- exports.validateProjectHealth = createValidator(types_5.ProjectHealthSchema);
87
- exports.validateProjectHealthContext = createValidator(types_5.ProjectHealthContextSchema);
88
- exports.validateProjectProgress = createValidator(types_5.ProjectProgressSchema);
89
- exports.validateWorkspaceInsights = createValidator(types_5.WorkspaceInsightsSchema);
90
- exports.validateBackup = createValidator(types_2.BackupSchema);
91
- exports.validateBackupArray = createArrayValidator(exports.validateBackup);
92
- exports.validateIdMapping = createValidator(types_4.IdMappingSchema);
93
- exports.validateIdMappingArray = createArrayValidator(exports.validateIdMapping);
94
- exports.validateMovedId = createValidator(types_4.MovedIdSchema);
95
- exports.validateMovedIdArray = createArrayValidator(exports.validateMovedId);
36
+ _b = createValidator(types_9.ProjectSchema), exports.validateProject = _b.validate, exports.validateProjectArray = _b.validateArray;
37
+ _c = createValidator(types_9.WorkspaceProjectSchema), exports.validateWorkspaceProject = _c.validate, exports.validateWorkspaceProjectArray = _c.validateArray;
38
+ _d = createValidator(types_10.SectionSchema), exports.validateSection = _d.validate, exports.validateSectionArray = _d.validateArray;
39
+ _e = createValidator(types_7.LabelSchema), exports.validateLabel = _e.validate, exports.validateLabelArray = _e.validateArray;
40
+ _f = createValidator(types_3.CommentSchema), exports.validateComment = _f.validate, exports.validateCommentArray = _f.validateArray;
41
+ _g = createValidator(types_12.UserSchema), exports.validateUser = _g.validate, exports.validateUserArray = _g.validateArray;
42
+ exports.validateProductivityStats = createValidator(types_8.ProductivityStatsSchema).validate;
43
+ exports.validateCurrentUser = createValidator(types_12.CurrentUserSchema).validate;
44
+ _h = createValidator(types_1.ActivityEventSchema), exports.validateActivityEvent = _h.validate, exports.validateActivityEventArray = _h.validateArray;
45
+ exports.validateAttachment = createValidator(types_3.AttachmentSchema).validate;
46
+ _j = createValidator(types_13.WorkspaceUserSchema), exports.validateWorkspaceUser = _j.validate, exports.validateWorkspaceUserArray = _j.validateArray;
47
+ _k = createValidator(types_13.WorkspaceInvitationSchema), exports.validateWorkspaceInvitation = _k.validate, exports.validateWorkspaceInvitationArray = _k.validateArray;
48
+ exports.validateWorkspacePlanDetails = createValidator(types_13.WorkspacePlanDetailsSchema).validate;
49
+ exports.validateJoinWorkspaceResult = createValidator(types_13.JoinWorkspaceResultSchema).validate;
50
+ _l = createValidator(types_13.WorkspaceSchema), exports.validateWorkspace = _l.validate, exports.validateWorkspaceArray = _l.validateArray;
51
+ _m = createValidator(types_13.MemberActivityInfoSchema), exports.validateMemberActivityInfo = _m.validate, exports.validateMemberActivityInfoArray = _m.validateArray;
52
+ _o = createValidator(types_13.WorkspaceUserTaskSchema), exports.validateWorkspaceUserTask = _o.validate, exports.validateWorkspaceUserTaskArray = _o.validateArray;
53
+ exports.validateProjectActivityStats = createValidator(types_6.ProjectActivityStatsSchema).validate;
54
+ exports.validateProjectHealth = createValidator(types_6.ProjectHealthSchema).validate;
55
+ exports.validateProjectHealthContext = createValidator(types_6.ProjectHealthContextSchema).validate;
56
+ exports.validateProjectProgress = createValidator(types_6.ProjectProgressSchema).validate;
57
+ exports.validateWorkspaceInsights = createValidator(types_6.WorkspaceInsightsSchema).validate;
58
+ _p = createValidator(types_2.BackupSchema), exports.validateBackup = _p.validate, exports.validateBackupArray = _p.validateArray;
59
+ _q = createValidator(types_5.IdMappingSchema), exports.validateIdMapping = _q.validate, exports.validateIdMappingArray = _q.validateArray;
60
+ _r = createValidator(types_5.MovedIdSchema), exports.validateMovedId = _r.validate, exports.validateMovedIdArray = _r.validateArray;
96
61
  // Sync resource validators
97
- exports.validateFilter = createValidator(resources_1.FilterSchema);
98
- exports.validateFilterArray = createArrayValidator(exports.validateFilter);
99
- exports.validateCollaborator = createValidator(resources_1.CollaboratorSchema);
100
- exports.validateCollaboratorArray = createArrayValidator(exports.validateCollaborator);
101
- exports.validateCollaboratorState = createValidator(resources_1.CollaboratorStateSchema);
102
- exports.validateCollaboratorStateArray = createArrayValidator(exports.validateCollaboratorState);
103
- exports.validateFolder = createValidator(resources_1.FolderSchema);
104
- exports.validateFolderArray = createArrayValidator(exports.validateFolder);
105
- exports.validateNote = createValidator(resources_1.NoteSchema);
106
- exports.validateNoteArray = createArrayValidator(exports.validateNote);
107
- exports.validateTooltips = createValidator(resources_1.TooltipsSchema);
108
- exports.validateWorkspaceFilter = createValidator(resources_1.WorkspaceFilterSchema);
109
- exports.validateWorkspaceFilterArray = createArrayValidator(exports.validateWorkspaceFilter);
110
- exports.validateWorkspaceGoal = createValidator(resources_1.WorkspaceGoalSchema);
111
- exports.validateWorkspaceGoalArray = createArrayValidator(exports.validateWorkspaceGoal);
112
- exports.validateCalendar = createValidator(resources_1.CalendarSchema);
113
- exports.validateCalendarArray = createArrayValidator(exports.validateCalendar);
114
- exports.validateCalendarAccount = createValidator(resources_1.CalendarAccountSchema);
115
- exports.validateCalendarAccountArray = createArrayValidator(exports.validateCalendarAccount);
116
- exports.validateReminder = createValidator(resources_1.ReminderSchema);
117
- exports.validateReminderArray = createArrayValidator(exports.validateReminder);
118
- exports.validateLocationReminder = createValidator(resources_1.LocationReminderSchema);
119
- exports.validateLocationReminderArray = createArrayValidator(exports.validateLocationReminder);
120
- exports.validateCompletedInfo = createValidator(resources_1.CompletedInfoSchema);
121
- exports.validateCompletedInfoArray = createArrayValidator(exports.validateCompletedInfo);
122
- exports.validateViewOptions = createValidator(resources_1.ViewOptionsSchema);
123
- exports.validateViewOptionsArray = createArrayValidator(exports.validateViewOptions);
124
- exports.validateProjectViewOptionsDefaults = createValidator(resources_1.ProjectViewOptionsDefaultsSchema);
125
- exports.validateProjectViewOptionsDefaultsArray = createArrayValidator(exports.validateProjectViewOptionsDefaults);
126
- exports.validateUserPlanLimits = createValidator(resources_1.UserPlanLimitsSchema);
127
- exports.validateLiveNotification = createValidator(resources_1.LiveNotificationSchema);
128
- exports.validateLiveNotificationArray = createArrayValidator(exports.validateLiveNotification);
129
- exports.validateSyncWorkspace = createValidator(resources_1.SyncWorkspaceSchema);
130
- exports.validateSyncWorkspaceArray = createArrayValidator(exports.validateSyncWorkspace);
131
- exports.validateSyncUser = createValidator(resources_1.SyncUserSchema);
132
- exports.validateUserSettings = createValidator(resources_1.UserSettingsSchema);
133
- exports.validateSuggestion = createValidator(resources_1.SuggestionSchema);
134
- exports.validateSuggestionArray = createArrayValidator(exports.validateSuggestion);
62
+ _s = createValidator(resources_1.FilterSchema), exports.validateFilter = _s.validate, exports.validateFilterArray = _s.validateArray;
63
+ _t = createValidator(resources_1.CollaboratorSchema), exports.validateCollaborator = _t.validate, exports.validateCollaboratorArray = _t.validateArray;
64
+ _u = createValidator(resources_1.CollaboratorStateSchema), exports.validateCollaboratorState = _u.validate, exports.validateCollaboratorStateArray = _u.validateArray;
65
+ _v = createValidator(resources_1.FolderSchema), exports.validateFolder = _v.validate, exports.validateFolderArray = _v.validateArray;
66
+ _w = createValidator(types_4.GoalSchema), exports.validateGoal = _w.validate, exports.validateGoalArray = _w.validateArray;
67
+ _x = createValidator(resources_1.NoteSchema), exports.validateNote = _x.validate, exports.validateNoteArray = _x.validateArray;
68
+ exports.validateTooltips = createValidator(resources_1.TooltipsSchema).validate;
69
+ _y = createValidator(resources_1.WorkspaceFilterSchema), exports.validateWorkspaceFilter = _y.validate, exports.validateWorkspaceFilterArray = _y.validateArray;
70
+ _z = createValidator(resources_1.WorkspaceGoalSchema), exports.validateWorkspaceGoal = _z.validate, exports.validateWorkspaceGoalArray = _z.validateArray;
71
+ _0 = createValidator(resources_1.CalendarSchema), exports.validateCalendar = _0.validate, exports.validateCalendarArray = _0.validateArray;
72
+ _1 = createValidator(resources_1.CalendarAccountSchema), exports.validateCalendarAccount = _1.validate, exports.validateCalendarAccountArray = _1.validateArray;
73
+ _2 = createValidator(resources_1.ReminderSchema), exports.validateReminder = _2.validate, exports.validateReminderArray = _2.validateArray;
74
+ _3 = createValidator(resources_1.LocationReminderSchema), exports.validateLocationReminder = _3.validate, exports.validateLocationReminderArray = _3.validateArray;
75
+ _4 = createValidator(resources_1.CompletedInfoSchema), exports.validateCompletedInfo = _4.validate, exports.validateCompletedInfoArray = _4.validateArray;
76
+ _5 = createValidator(resources_1.ViewOptionsSchema), exports.validateViewOptions = _5.validate, exports.validateViewOptionsArray = _5.validateArray;
77
+ _6 = createValidator(resources_1.ProjectViewOptionsDefaultsSchema), exports.validateProjectViewOptionsDefaults = _6.validate, exports.validateProjectViewOptionsDefaultsArray = _6.validateArray;
78
+ exports.validateUserPlanLimits = createValidator(resources_1.UserPlanLimitsSchema).validate;
79
+ _7 = createValidator(resources_1.LiveNotificationSchema), exports.validateLiveNotification = _7.validate, exports.validateLiveNotificationArray = _7.validateArray;
80
+ _8 = createValidator(resources_1.SyncWorkspaceSchema), exports.validateSyncWorkspace = _8.validate, exports.validateSyncWorkspaceArray = _8.validateArray;
81
+ exports.validateSyncUser = createValidator(resources_1.SyncUserSchema).validate;
82
+ exports.validateUserSettings = createValidator(resources_1.UserSettingsSchema).validate;
83
+ _9 = createValidator(resources_1.SuggestionSchema), exports.validateSuggestion = _9.validate, exports.validateSuggestionArray = _9.validateArray;
135
84
  function parseSyncResponse(raw) {
136
- 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
137
- ? { remindersLocation: (0, exports.validateLocationReminderArray)(raw.remindersLocation) }
138
- : {})), ('user' in raw ? { user: (0, exports.validateSyncUser)(raw.user) } : {})), ('liveNotifications' in raw
139
- ? { liveNotifications: (0, exports.validateLiveNotificationArray)(raw.liveNotifications) }
140
- : {})), ('collaborators' in raw
141
- ? { collaborators: (0, exports.validateCollaboratorArray)(raw.collaborators) }
142
- : {})), ('collaboratorStates' in raw
143
- ? { collaboratorStates: (0, exports.validateCollaboratorStateArray)(raw.collaboratorStates) }
144
- : {})), ('userSettings' in raw ? { userSettings: (0, exports.validateUserSettings)(raw.userSettings) } : {})), ('userPlanLimits' in raw
145
- ? { userPlanLimits: (0, exports.validateUserPlanLimits)(raw.userPlanLimits) }
146
- : {})), ('completedInfo' in raw
147
- ? { completedInfo: (0, exports.validateCompletedInfoArray)(raw.completedInfo) }
148
- : {})), ('workspaces' in raw ? { workspaces: (0, exports.validateSyncWorkspaceArray)(raw.workspaces) } : {})), ('workspaceUsers' in raw
149
- ? { workspaceUsers: validateWorkspaceUserArray(raw.workspaceUsers) }
150
- : {})), ('workspaceFilters' in raw
151
- ? { workspaceFilters: (0, exports.validateWorkspaceFilterArray)(raw.workspaceFilters) }
152
- : {})), ('viewOptions' in raw ? { viewOptions: (0, exports.validateViewOptionsArray)(raw.viewOptions) } : {})), ('projectViewOptionsDefaults' in raw
153
- ? {
154
- projectViewOptionsDefaults: (0, exports.validateProjectViewOptionsDefaultsArray)(raw.projectViewOptionsDefaults),
155
- }
156
- : {})), ('folders' in raw ? { folders: (0, exports.validateFolderArray)(raw.folders) } : {})), ('workspaceGoals' in raw
157
- ? { workspaceGoals: (0, exports.validateWorkspaceGoalArray)(raw.workspaceGoals) }
158
- : {})), ('calendars' in raw ? { calendars: (0, exports.validateCalendarArray)(raw.calendars) } : {})), ('calendarAccounts' in raw
159
- ? { calendarAccounts: (0, exports.validateCalendarAccountArray)(raw.calendarAccounts) }
160
- : {})), ('suggestions' in raw ? { suggestions: (0, exports.validateSuggestionArray)(raw.suggestions) } : {})), ('tooltips' in raw ? { tooltips: (0, exports.validateTooltips)(raw.tooltips) } : {}));
85
+ return response_1.SyncResponseSchema.parse(raw);
161
86
  }
@@ -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';