@doist/todoist-sdk 8.4.0-next.2 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/consts/endpoints.js +1 -6
- package/dist/cjs/todoist-api.js +5 -128
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/types/sync/commands/index.js +0 -1
- package/dist/cjs/types/sync/resource-types.js +0 -1
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/project-helpers.js +20 -0
- package/dist/cjs/utils/validators.js +36 -57
- package/dist/esm/consts/endpoints.js +0 -5
- package/dist/esm/todoist-api.js +7 -130
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/types/sync/commands/index.js +0 -1
- package/dist/esm/types/sync/resource-types.js +0 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/project-helpers.js +16 -0
- package/dist/esm/utils/validators.js +2 -21
- package/dist/types/consts/endpoints.d.ts +0 -5
- package/dist/types/todoist-api.d.ts +5 -11
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/types/sync/commands/index.d.ts +0 -9
- package/dist/types/types/sync/resource-types.d.ts +1 -1
- package/dist/types/types/sync/resources/view-options.d.ts +6 -6
- package/dist/types/types/sync/response.d.ts +0 -2
- package/dist/types/types/tasks/requests.d.ts +0 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/project-helpers.d.ts +13 -0
- package/dist/types/utils/validators.d.ts +8 -68
- package/package.json +1 -1
- package/dist/cjs/types/goals/index.js +0 -18
- package/dist/cjs/types/goals/requests.js +0 -2
- package/dist/cjs/types/goals/types.js +0 -29
- package/dist/cjs/types/sync/commands/goals.js +0 -2
- package/dist/esm/types/goals/index.js +0 -2
- package/dist/esm/types/goals/requests.js +0 -1
- package/dist/esm/types/goals/types.js +0 -26
- package/dist/esm/types/sync/commands/goals.js +0 -1
- package/dist/types/types/goals/index.d.ts +0 -2
- package/dist/types/types/goals/requests.d.ts +0 -33
- package/dist/types/types/goals/types.d.ts +0 -41
- package/dist/types/types/sync/commands/goals.d.ts +0 -33
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
|
|
6
5
|
import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
|
|
7
6
|
import { LabelSchema } from '../types/labels/types.js';
|
|
@@ -26,22 +25,6 @@ function createArrayValidator(validateItem) {
|
|
|
26
25
|
// Entity validators
|
|
27
26
|
export const validateTask = createValidator(TaskSchema);
|
|
28
27
|
export const validateTaskArray = createArrayValidator(validateTask);
|
|
29
|
-
/**
|
|
30
|
-
* Type guard to check if a project is a workspace project.
|
|
31
|
-
* @param project The project to check
|
|
32
|
-
* @returns True if the project is a workspace project
|
|
33
|
-
*/
|
|
34
|
-
export function isWorkspaceProject(project) {
|
|
35
|
-
return 'workspaceId' in project;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Type guard to check if a project is a personal project.
|
|
39
|
-
* @param project The project to check
|
|
40
|
-
* @returns True if the project is a personal project
|
|
41
|
-
*/
|
|
42
|
-
export function isPersonalProject(project) {
|
|
43
|
-
return !isWorkspaceProject(project);
|
|
44
|
-
}
|
|
45
28
|
/**
|
|
46
29
|
* Validates and parses a project input.
|
|
47
30
|
* @param input The input to validate
|
|
@@ -111,8 +94,6 @@ export const validateCollaboratorState = createValidator(CollaboratorStateSchema
|
|
|
111
94
|
export const validateCollaboratorStateArray = createArrayValidator(validateCollaboratorState);
|
|
112
95
|
export const validateFolder = createValidator(FolderSchema);
|
|
113
96
|
export const validateFolderArray = createArrayValidator(validateFolder);
|
|
114
|
-
export const validateGoal = createValidator(GoalSchema);
|
|
115
|
-
export const validateGoalArray = createArrayValidator(validateGoal);
|
|
116
97
|
export const validateNote = createValidator(NoteSchema);
|
|
117
98
|
export const validateNoteArray = createArrayValidator(validateNote);
|
|
118
99
|
export const validateTooltips = createValidator(TooltipsSchema);
|
|
@@ -144,7 +125,7 @@ export const validateUserSettings = createValidator(UserSettingsSchema);
|
|
|
144
125
|
export const validateSuggestion = createValidator(SuggestionSchema);
|
|
145
126
|
export const validateSuggestionArray = createArrayValidator(validateSuggestion);
|
|
146
127
|
export function parseSyncResponse(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(
|
|
128
|
+
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
|
|
148
129
|
? { remindersLocation: validateLocationReminderArray(raw.remindersLocation) }
|
|
149
130
|
: {})), ('user' in raw ? { user: validateSyncUser(raw.user) } : {})), ('liveNotifications' in raw
|
|
150
131
|
? { liveNotifications: validateLiveNotificationArray(raw.liveNotifications) }
|
|
@@ -164,7 +145,7 @@ export function parseSyncResponse(raw) {
|
|
|
164
145
|
? {
|
|
165
146
|
projectViewOptionsDefaults: validateProjectViewOptionsDefaultsArray(raw.projectViewOptionsDefaults),
|
|
166
147
|
}
|
|
167
|
-
: {})), ('folders' in raw ? { folders: validateFolderArray(raw.folders) } : {})), ('
|
|
148
|
+
: {})), ('folders' in raw ? { folders: validateFolderArray(raw.folders) } : {})), ('workspaceGoals' in raw
|
|
168
149
|
? { workspaceGoals: validateWorkspaceGoalArray(raw.workspaceGoals) }
|
|
169
150
|
: {})), ('calendars' in raw ? { calendars: validateCalendarArray(raw.calendars) } : {})), ('calendarAccounts' in raw
|
|
170
151
|
? { calendarAccounts: validateCalendarAccountArray(raw.calendarAccounts) }
|
|
@@ -58,11 +58,6 @@ 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";
|
|
66
61
|
export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
|
|
67
62
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
|
|
68
63
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
|
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
import { CustomFetch, CustomFetchResponse } from './types/http.js';
|
|
9
8
|
import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
|
|
10
9
|
import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
|
|
@@ -260,6 +259,11 @@ export declare class TodoistApi {
|
|
|
260
259
|
/**
|
|
261
260
|
* Deletes a project by its ID.
|
|
262
261
|
*
|
|
262
|
+
* If the project is a workspace project, it must have been
|
|
263
|
+
* archived first before it can be deleted, otherwise calling
|
|
264
|
+
* this function will result in an error. Personal projects can
|
|
265
|
+
* be deleted regardless of their archived status.
|
|
266
|
+
*
|
|
263
267
|
* @param id - The unique identifier of the project to delete.
|
|
264
268
|
* @param requestId - Optional custom identifier for the request.
|
|
265
269
|
* @returns A promise that resolves to `true` if successful.
|
|
@@ -759,16 +763,6 @@ export declare class TodoistApi {
|
|
|
759
763
|
* @returns A promise that resolves to `true` if successful.
|
|
760
764
|
*/
|
|
761
765
|
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>;
|
|
772
766
|
/**
|
|
773
767
|
* Retrieves a list of available backups.
|
|
774
768
|
*
|
|
@@ -9,7 +9,6 @@ export * from './productivity/index.js';
|
|
|
9
9
|
export * from './activity/index.js';
|
|
10
10
|
export * from './workspaces/index.js';
|
|
11
11
|
export * from './folders/index.js';
|
|
12
|
-
export * from './goals/index.js';
|
|
13
12
|
export * from './insights/index.js';
|
|
14
13
|
export * from './backups/index.js';
|
|
15
14
|
export * from './id-mappings/index.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
|
|
6
5
|
import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
|
|
7
6
|
import type { LiveNotificationsMarkUnreadArgs, LiveNotificationsMarkReadArgs, LiveNotificationsMarkReadAllArgs, LiveNotificationsSetLastReadArgs } from './notifications.js';
|
|
@@ -97,13 +96,6 @@ export type SyncCommandsMap = {
|
|
|
97
96
|
workspace_goal_delete: WorkspaceGoalDeleteArgs;
|
|
98
97
|
workspace_goal_project_add: WorkspaceGoalProjectAddArgs;
|
|
99
98
|
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;
|
|
107
99
|
live_notifications_mark_unread: LiveNotificationsMarkUnreadArgs;
|
|
108
100
|
live_notifications_mark_read: LiveNotificationsMarkReadArgs;
|
|
109
101
|
live_notifications_mark_read_all: LiveNotificationsMarkReadAllArgs;
|
|
@@ -171,7 +163,6 @@ export * from './workspaces.js';
|
|
|
171
163
|
export * from './folders.js';
|
|
172
164
|
export * from './workspace-filters.js';
|
|
173
165
|
export * from './workspace-goals.js';
|
|
174
|
-
export * from './goals.js';
|
|
175
166
|
export * from './notifications.js';
|
|
176
167
|
export * from './sharing.js';
|
|
177
168
|
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", "
|
|
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"];
|
|
5
5
|
export type SyncResourceType = (typeof SYNC_RESOURCE_TYPES)[number];
|
|
@@ -32,7 +32,6 @@ 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";
|
|
36
35
|
PROJECT: "PROJECT";
|
|
37
36
|
LABEL: "LABEL";
|
|
38
37
|
ASSIGNEE: "ASSIGNEE";
|
|
@@ -40,19 +39,20 @@ export declare const GroupedBySchema: z.ZodNullable<z.ZodEnum<{
|
|
|
40
39
|
DUE_DATE: "DUE_DATE";
|
|
41
40
|
DEADLINE: "DEADLINE";
|
|
42
41
|
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";
|
|
50
49
|
PROJECT: "PROJECT";
|
|
51
50
|
ASSIGNEE: "ASSIGNEE";
|
|
52
51
|
ADDED_DATE: "ADDED_DATE";
|
|
53
52
|
DUE_DATE: "DUE_DATE";
|
|
54
53
|
DEADLINE: "DEADLINE";
|
|
55
54
|
PRIORITY: "PRIORITY";
|
|
55
|
+
WORKSPACE: "WORKSPACE";
|
|
56
56
|
MANUAL: "MANUAL";
|
|
57
57
|
ALPHABETICALLY: "ALPHABETICALLY";
|
|
58
58
|
}>>;
|
|
@@ -92,7 +92,6 @@ 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";
|
|
96
95
|
PROJECT: "PROJECT";
|
|
97
96
|
LABEL: "LABEL";
|
|
98
97
|
ASSIGNEE: "ASSIGNEE";
|
|
@@ -100,6 +99,7 @@ export declare const ViewOptionsSchema: z.ZodObject<{
|
|
|
100
99
|
DUE_DATE: "DUE_DATE";
|
|
101
100
|
DEADLINE: "DEADLINE";
|
|
102
101
|
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";
|
|
113
112
|
PROJECT: "PROJECT";
|
|
114
113
|
ASSIGNEE: "ASSIGNEE";
|
|
115
114
|
ADDED_DATE: "ADDED_DATE";
|
|
116
115
|
DUE_DATE: "DUE_DATE";
|
|
117
116
|
DEADLINE: "DEADLINE";
|
|
118
117
|
PRIORITY: "PRIORITY";
|
|
118
|
+
WORKSPACE: "WORKSPACE";
|
|
119
119
|
MANUAL: "MANUAL";
|
|
120
120
|
ALPHABETICALLY: "ALPHABETICALLY";
|
|
121
121
|
}>>>;
|
|
@@ -133,7 +133,6 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
|
|
|
133
133
|
CALENDAR: "CALENDAR";
|
|
134
134
|
}>>>;
|
|
135
135
|
groupedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
136
|
-
WORKSPACE: "WORKSPACE";
|
|
137
136
|
PROJECT: "PROJECT";
|
|
138
137
|
LABEL: "LABEL";
|
|
139
138
|
ASSIGNEE: "ASSIGNEE";
|
|
@@ -141,15 +140,16 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
|
|
|
141
140
|
DUE_DATE: "DUE_DATE";
|
|
142
141
|
DEADLINE: "DEADLINE";
|
|
143
142
|
PRIORITY: "PRIORITY";
|
|
143
|
+
WORKSPACE: "WORKSPACE";
|
|
144
144
|
}>>>;
|
|
145
145
|
sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
146
|
-
WORKSPACE: "WORKSPACE";
|
|
147
146
|
PROJECT: "PROJECT";
|
|
148
147
|
ASSIGNEE: "ASSIGNEE";
|
|
149
148
|
ADDED_DATE: "ADDED_DATE";
|
|
150
149
|
DUE_DATE: "DUE_DATE";
|
|
151
150
|
DEADLINE: "DEADLINE";
|
|
152
151
|
PRIORITY: "PRIORITY";
|
|
152
|
+
WORKSPACE: "WORKSPACE";
|
|
153
153
|
MANUAL: "MANUAL";
|
|
154
154
|
ALPHABETICALLY: "ALPHABETICALLY";
|
|
155
155
|
}>>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Goal } from '../goals/types.js';
|
|
2
1
|
import type { Label } from '../labels/types.js';
|
|
3
2
|
import type { PersonalProject, WorkspaceProject } from '../projects/types.js';
|
|
4
3
|
import type { Section } from '../sections/types.js';
|
|
@@ -44,7 +43,6 @@ export type SyncResponse = {
|
|
|
44
43
|
roleActions?: Record<string, unknown>[];
|
|
45
44
|
folders?: Folder[];
|
|
46
45
|
workspaceGoals?: WorkspaceGoal[];
|
|
47
|
-
goals?: Goal[];
|
|
48
46
|
dayOrders?: Record<string, number>;
|
|
49
47
|
calendars?: Calendar[];
|
|
50
48
|
calendarAccounts?: CalendarAccount[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PersonalProject, WorkspaceProject } from '../types/projects/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if a project is a workspace project.
|
|
4
|
+
* @param project The project to check
|
|
5
|
+
* @returns True if the project is a workspace project
|
|
6
|
+
*/
|
|
7
|
+
export declare function isWorkspaceProject(project: PersonalProject | WorkspaceProject): project is WorkspaceProject;
|
|
8
|
+
/**
|
|
9
|
+
* Type guard to check if a project is a personal project.
|
|
10
|
+
* @param project The project to check
|
|
11
|
+
* @returns True if the project is a personal project
|
|
12
|
+
*/
|
|
13
|
+
export declare function isPersonalProject(project: PersonalProject | WorkspaceProject): project is PersonalProject;
|
|
@@ -81,18 +81,6 @@ export declare const validateTaskArray: (input: unknown) => {
|
|
|
81
81
|
dayOrder: number;
|
|
82
82
|
isCollapsed: boolean;
|
|
83
83
|
}[];
|
|
84
|
-
/**
|
|
85
|
-
* Type guard to check if a project is a workspace project.
|
|
86
|
-
* @param project The project to check
|
|
87
|
-
* @returns True if the project is a workspace project
|
|
88
|
-
*/
|
|
89
|
-
export declare function isWorkspaceProject(project: PersonalProject | WorkspaceProject): project is WorkspaceProject;
|
|
90
|
-
/**
|
|
91
|
-
* Type guard to check if a project is a personal project.
|
|
92
|
-
* @param project The project to check
|
|
93
|
-
* @returns True if the project is a personal project
|
|
94
|
-
*/
|
|
95
|
-
export declare function isPersonalProject(project: PersonalProject | WorkspaceProject): project is PersonalProject;
|
|
96
84
|
/**
|
|
97
85
|
* Validates and parses a project input.
|
|
98
86
|
* @param input The input to validate
|
|
@@ -745,54 +733,6 @@ export declare const validateFolderArray: (input: unknown) => {
|
|
|
745
733
|
defaultOrder: number;
|
|
746
734
|
childOrder: number;
|
|
747
735
|
}[];
|
|
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
|
-
}[];
|
|
796
736
|
export declare const validateNote: (input: unknown) => {
|
|
797
737
|
[x: string]: unknown;
|
|
798
738
|
id: string;
|
|
@@ -1122,30 +1062,30 @@ export declare const validateViewOptions: (input: unknown) => {
|
|
|
1122
1062
|
[x: string]: unknown;
|
|
1123
1063
|
viewType: "PROJECT" | "TODAY" | "UPCOMING" | "LABEL" | "FILTER" | "WORKSPACE_FILTER" | "SEARCH" | "TEMPLATE_PREVIEW" | "TASK_DETAIL" | "AUTOMATION" | "ASSIGNED" | "OVERDUE" | "WORKSPACE_OVERVIEW";
|
|
1124
1064
|
objectId?: string | undefined;
|
|
1125
|
-
groupedBy?: "
|
|
1065
|
+
groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
|
|
1126
1066
|
filteredBy?: string | null | undefined;
|
|
1127
1067
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
|
|
1128
1068
|
showCompletedTasks?: boolean | undefined;
|
|
1129
|
-
sortedBy?: "
|
|
1069
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1130
1070
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1131
1071
|
};
|
|
1132
1072
|
export declare const validateViewOptionsArray: (input: unknown) => {
|
|
1133
1073
|
[x: string]: unknown;
|
|
1134
1074
|
viewType: "PROJECT" | "TODAY" | "UPCOMING" | "LABEL" | "FILTER" | "WORKSPACE_FILTER" | "SEARCH" | "TEMPLATE_PREVIEW" | "TASK_DETAIL" | "AUTOMATION" | "ASSIGNED" | "OVERDUE" | "WORKSPACE_OVERVIEW";
|
|
1135
1075
|
objectId?: string | undefined;
|
|
1136
|
-
groupedBy?: "
|
|
1076
|
+
groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
|
|
1137
1077
|
filteredBy?: string | null | undefined;
|
|
1138
1078
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
|
|
1139
1079
|
showCompletedTasks?: boolean | undefined;
|
|
1140
|
-
sortedBy?: "
|
|
1080
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1141
1081
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1142
1082
|
}[];
|
|
1143
1083
|
export declare const validateProjectViewOptionsDefaults: (input: unknown) => {
|
|
1144
1084
|
[x: string]: unknown;
|
|
1145
1085
|
projectId: string;
|
|
1146
1086
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
|
|
1147
|
-
groupedBy?: "
|
|
1148
|
-
sortedBy?: "
|
|
1087
|
+
groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
|
|
1088
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1149
1089
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1150
1090
|
showCompletedTasks?: boolean | undefined;
|
|
1151
1091
|
filteredBy?: string | null | undefined;
|
|
@@ -1158,8 +1098,8 @@ export declare const validateProjectViewOptionsDefaultsArray: (input: unknown) =
|
|
|
1158
1098
|
[x: string]: unknown;
|
|
1159
1099
|
projectId: string;
|
|
1160
1100
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
|
|
1161
|
-
groupedBy?: "
|
|
1162
|
-
sortedBy?: "
|
|
1101
|
+
groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
|
|
1102
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1163
1103
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1164
1104
|
showCompletedTasks?: boolean | undefined;
|
|
1165
1105
|
filteredBy?: string | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
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);
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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>;
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
};
|