@doist/todoist-ai 4.11.0 → 4.13.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.
- package/dist/filter-helpers.d.ts +51 -0
- package/dist/filter-helpers.d.ts.map +1 -0
- package/dist/filter-helpers.js +79 -0
- package/dist/index.d.ts +42 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/tool-helpers.d.ts +6 -20
- package/dist/tool-helpers.d.ts.map +1 -1
- package/dist/tool-helpers.js +5 -23
- package/dist/tools/__tests__/find-tasks-by-date.test.js +118 -20
- package/dist/tools/__tests__/find-tasks.test.js +2 -0
- package/dist/tools/add-projects.d.ts +3 -3
- package/dist/tools/add-tasks.d.ts +5 -3
- package/dist/tools/add-tasks.d.ts.map +1 -1
- package/dist/tools/delete-object.d.ts +1 -1
- package/dist/tools/find-completed-tasks.d.ts +15 -10
- package/dist/tools/find-completed-tasks.d.ts.map +1 -1
- package/dist/tools/find-completed-tasks.js +23 -4
- package/dist/tools/find-tasks-by-date.d.ts +8 -0
- package/dist/tools/find-tasks-by-date.d.ts.map +1 -1
- package/dist/tools/find-tasks-by-date.js +39 -15
- package/dist/tools/find-tasks.d.ts +4 -2
- package/dist/tools/find-tasks.d.ts.map +1 -1
- package/dist/tools/find-tasks.js +20 -36
- package/dist/tools/update-comments.d.ts +3 -3
- package/dist/tools/update-sections.d.ts +3 -3
- package/dist/tools/update-tasks.d.ts +8 -6
- package/dist/tools/update-tasks.d.ts.map +1 -1
- package/dist/utils/test-helpers.d.ts +2 -0
- package/dist/utils/test-helpers.d.ts.map +1 -1
- package/dist/utils/test-helpers.js +2 -0
- package/dist/utils/user-resolver.d.ts +2 -4
- package/dist/utils/user-resolver.d.ts.map +1 -1
- package/dist/utils/user-resolver.js +5 -5
- package/package.json +4 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { TodoistApi } from '@doist/todoist-api-typescript';
|
|
2
|
+
export declare const RESPONSIBLE_USER_FILTERING: readonly ["assigned", "unassignedOrMe", "all"];
|
|
3
|
+
export type ResponsibleUserFiltering = (typeof RESPONSIBLE_USER_FILTERING)[number];
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a responsible user name/email to user ID and email.
|
|
6
|
+
* @param client - Todoist API client
|
|
7
|
+
* @param responsibleUser - User identifier (can be user ID, name, or email)
|
|
8
|
+
* @returns Object with userId and email, or undefined if not provided
|
|
9
|
+
* @throws Error if user cannot be found
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveResponsibleUser(client: TodoistApi, responsibleUser: string | undefined): Promise<{
|
|
12
|
+
userId: string;
|
|
13
|
+
email: string;
|
|
14
|
+
} | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Appends a filter component to a query string with proper ' & ' separator.
|
|
17
|
+
* @param query - The existing query string
|
|
18
|
+
* @param filterComponent - The filter component to append
|
|
19
|
+
* @returns The updated query string
|
|
20
|
+
*/
|
|
21
|
+
export declare function appendToQuery(query: string, filterComponent: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Builds a query filter string for responsible user filtering that can be appended to a Todoist filter query.
|
|
24
|
+
* @param resolvedAssigneeId - The resolved assignee ID (if provided)
|
|
25
|
+
* @param assigneeEmail - The assignee email (if provided)
|
|
26
|
+
* @param responsibleUserFiltering - The filtering mode ('assigned', 'unassignedOrMe', 'all')
|
|
27
|
+
* @returns Query filter string (e.g., "assigned to: email@example.com" or "!assigned to: others")
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildResponsibleUserQueryFilter({ resolvedAssigneeId, assigneeEmail, responsibleUserFiltering, }: {
|
|
30
|
+
resolvedAssigneeId: string | undefined;
|
|
31
|
+
assigneeEmail: string | undefined;
|
|
32
|
+
responsibleUserFiltering?: ResponsibleUserFiltering;
|
|
33
|
+
}): string;
|
|
34
|
+
/**
|
|
35
|
+
* Filters tasks based on responsible user logic:
|
|
36
|
+
* - If resolvedAssigneeId is provided: returns only tasks assigned to that user
|
|
37
|
+
* - If no resolvedAssigneeId: returns only unassigned tasks or tasks assigned to current user
|
|
38
|
+
* @param tasks - Array of tasks to filter (must have responsibleUid property)
|
|
39
|
+
* @param resolvedAssigneeId - The resolved assignee ID to filter by (optional)
|
|
40
|
+
* @param currentUserId - The current authenticated user's ID
|
|
41
|
+
* @returns Filtered array of tasks
|
|
42
|
+
*/
|
|
43
|
+
export declare function filterTasksByResponsibleUser<T extends {
|
|
44
|
+
responsibleUid: string | null;
|
|
45
|
+
}>({ tasks, resolvedAssigneeId, currentUserId, responsibleUserFiltering, }: {
|
|
46
|
+
tasks: T[];
|
|
47
|
+
resolvedAssigneeId: string | undefined;
|
|
48
|
+
currentUserId: string;
|
|
49
|
+
responsibleUserFiltering?: ResponsibleUserFiltering;
|
|
50
|
+
}): T[];
|
|
51
|
+
//# sourceMappingURL=filter-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-helpers.d.ts","sourceRoot":"","sources":["../src/filter-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAG/D,eAAO,MAAM,0BAA0B,gDAAiD,CAAA;AACxF,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAElF;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CACxC,MAAM,EAAE,UAAU,EAClB,eAAe,EAAE,MAAM,GAAG,SAAS,GACpC,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CAaxD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAQ5E;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,EAC5C,kBAAkB,EAClB,aAAa,EACb,wBAA2C,GAC9C,EAAE;IACC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACtD,GAAG,MAAM,CAmBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS;IAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,EACtF,KAAK,EACL,kBAAkB,EAClB,aAAa,EACb,wBAA2C,GAC9C,EAAE;IACC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACtD,GAAG,CAAC,EAAE,CAUN"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { resolveUserNameToId } from './utils/user-resolver.js';
|
|
2
|
+
export const RESPONSIBLE_USER_FILTERING = ['assigned', 'unassignedOrMe', 'all'];
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a responsible user name/email to user ID and email.
|
|
5
|
+
* @param client - Todoist API client
|
|
6
|
+
* @param responsibleUser - User identifier (can be user ID, name, or email)
|
|
7
|
+
* @returns Object with userId and email, or undefined if not provided
|
|
8
|
+
* @throws Error if user cannot be found
|
|
9
|
+
*/
|
|
10
|
+
export async function resolveResponsibleUser(client, responsibleUser) {
|
|
11
|
+
if (!responsibleUser) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const resolved = await resolveUserNameToId(client, responsibleUser);
|
|
15
|
+
if (!resolved) {
|
|
16
|
+
throw new Error(`Could not find user: "${responsibleUser}". Make sure the user is a collaborator on a shared project.`);
|
|
17
|
+
}
|
|
18
|
+
return { userId: resolved.userId, email: resolved.email };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Appends a filter component to a query string with proper ' & ' separator.
|
|
22
|
+
* @param query - The existing query string
|
|
23
|
+
* @param filterComponent - The filter component to append
|
|
24
|
+
* @returns The updated query string
|
|
25
|
+
*/
|
|
26
|
+
export function appendToQuery(query, filterComponent) {
|
|
27
|
+
if (filterComponent.length === 0) {
|
|
28
|
+
return query;
|
|
29
|
+
}
|
|
30
|
+
if (query.length === 0) {
|
|
31
|
+
return filterComponent;
|
|
32
|
+
}
|
|
33
|
+
return `${query} & ${filterComponent}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds a query filter string for responsible user filtering that can be appended to a Todoist filter query.
|
|
37
|
+
* @param resolvedAssigneeId - The resolved assignee ID (if provided)
|
|
38
|
+
* @param assigneeEmail - The assignee email (if provided)
|
|
39
|
+
* @param responsibleUserFiltering - The filtering mode ('assigned', 'unassignedOrMe', 'all')
|
|
40
|
+
* @returns Query filter string (e.g., "assigned to: email@example.com" or "!assigned to: others")
|
|
41
|
+
*/
|
|
42
|
+
export function buildResponsibleUserQueryFilter({ resolvedAssigneeId, assigneeEmail, responsibleUserFiltering = 'unassignedOrMe', }) {
|
|
43
|
+
if (resolvedAssigneeId && assigneeEmail) {
|
|
44
|
+
// If specific user is provided, filter by that user
|
|
45
|
+
return `assigned to: ${assigneeEmail}`;
|
|
46
|
+
}
|
|
47
|
+
// Otherwise use the filtering mode
|
|
48
|
+
if (responsibleUserFiltering === 'unassignedOrMe') {
|
|
49
|
+
// Exclude tasks assigned to others (keeps unassigned + assigned to me)
|
|
50
|
+
return '!assigned to: others';
|
|
51
|
+
}
|
|
52
|
+
if (responsibleUserFiltering === 'assigned') {
|
|
53
|
+
// Only tasks assigned to others
|
|
54
|
+
return 'assigned to: others';
|
|
55
|
+
}
|
|
56
|
+
// For 'all', don't add any assignment filter
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Filters tasks based on responsible user logic:
|
|
61
|
+
* - If resolvedAssigneeId is provided: returns only tasks assigned to that user
|
|
62
|
+
* - If no resolvedAssigneeId: returns only unassigned tasks or tasks assigned to current user
|
|
63
|
+
* @param tasks - Array of tasks to filter (must have responsibleUid property)
|
|
64
|
+
* @param resolvedAssigneeId - The resolved assignee ID to filter by (optional)
|
|
65
|
+
* @param currentUserId - The current authenticated user's ID
|
|
66
|
+
* @returns Filtered array of tasks
|
|
67
|
+
*/
|
|
68
|
+
export function filterTasksByResponsibleUser({ tasks, resolvedAssigneeId, currentUserId, responsibleUserFiltering = 'unassignedOrMe', }) {
|
|
69
|
+
if (resolvedAssigneeId) {
|
|
70
|
+
// If responsibleUser provided, only return tasks assigned to that user
|
|
71
|
+
return tasks.filter((task) => task.responsibleUid === resolvedAssigneeId);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// If no responsibleUser, only return unassigned tasks or tasks assigned to current user
|
|
75
|
+
return responsibleUserFiltering === 'unassignedOrMe'
|
|
76
|
+
? tasks.filter((task) => !task.responsibleUid || task.responsibleUid === currentUserId)
|
|
77
|
+
: tasks;
|
|
78
|
+
}
|
|
79
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -40,8 +40,8 @@ declare const tools: {
|
|
|
40
40
|
}, "strip", import("zod").ZodTypeAny, {
|
|
41
41
|
content: string;
|
|
42
42
|
description?: string | undefined;
|
|
43
|
-
projectId?: string | undefined;
|
|
44
43
|
parentId?: string | undefined;
|
|
44
|
+
projectId?: string | undefined;
|
|
45
45
|
sectionId?: string | undefined;
|
|
46
46
|
labels?: string[] | undefined;
|
|
47
47
|
duration?: string | undefined;
|
|
@@ -51,8 +51,8 @@ declare const tools: {
|
|
|
51
51
|
}, {
|
|
52
52
|
content: string;
|
|
53
53
|
description?: string | undefined;
|
|
54
|
-
projectId?: string | undefined;
|
|
55
54
|
parentId?: string | undefined;
|
|
55
|
+
projectId?: string | undefined;
|
|
56
56
|
sectionId?: string | undefined;
|
|
57
57
|
labels?: string[] | undefined;
|
|
58
58
|
duration?: string | undefined;
|
|
@@ -65,8 +65,8 @@ declare const tools: {
|
|
|
65
65
|
tasks: {
|
|
66
66
|
content: string;
|
|
67
67
|
description?: string | undefined;
|
|
68
|
-
projectId?: string | undefined;
|
|
69
68
|
parentId?: string | undefined;
|
|
69
|
+
projectId?: string | undefined;
|
|
70
70
|
sectionId?: string | undefined;
|
|
71
71
|
labels?: string[] | undefined;
|
|
72
72
|
duration?: string | undefined;
|
|
@@ -94,6 +94,8 @@ declare const tools: {
|
|
|
94
94
|
duration: string | null;
|
|
95
95
|
responsibleUid: string | null;
|
|
96
96
|
assignedByUid: string | null;
|
|
97
|
+
checked: boolean;
|
|
98
|
+
completedAt: string | null;
|
|
97
99
|
}[];
|
|
98
100
|
totalCount: number;
|
|
99
101
|
};
|
|
@@ -166,10 +168,10 @@ declare const tools: {
|
|
|
166
168
|
labels: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
167
169
|
}, "strip", import("zod").ZodTypeAny, {
|
|
168
170
|
id: string;
|
|
169
|
-
content?: string | undefined;
|
|
170
171
|
description?: string | undefined;
|
|
171
|
-
projectId?: string | undefined;
|
|
172
172
|
parentId?: string | undefined;
|
|
173
|
+
content?: string | undefined;
|
|
174
|
+
projectId?: string | undefined;
|
|
173
175
|
sectionId?: string | undefined;
|
|
174
176
|
labels?: string[] | undefined;
|
|
175
177
|
duration?: string | undefined;
|
|
@@ -179,10 +181,10 @@ declare const tools: {
|
|
|
179
181
|
order?: number | undefined;
|
|
180
182
|
}, {
|
|
181
183
|
id: string;
|
|
182
|
-
content?: string | undefined;
|
|
183
184
|
description?: string | undefined;
|
|
184
|
-
projectId?: string | undefined;
|
|
185
185
|
parentId?: string | undefined;
|
|
186
|
+
content?: string | undefined;
|
|
187
|
+
projectId?: string | undefined;
|
|
186
188
|
sectionId?: string | undefined;
|
|
187
189
|
labels?: string[] | undefined;
|
|
188
190
|
duration?: string | undefined;
|
|
@@ -195,10 +197,10 @@ declare const tools: {
|
|
|
195
197
|
execute(args: {
|
|
196
198
|
tasks: {
|
|
197
199
|
id: string;
|
|
198
|
-
content?: string | undefined;
|
|
199
200
|
description?: string | undefined;
|
|
200
|
-
projectId?: string | undefined;
|
|
201
201
|
parentId?: string | undefined;
|
|
202
|
+
content?: string | undefined;
|
|
203
|
+
projectId?: string | undefined;
|
|
202
204
|
sectionId?: string | undefined;
|
|
203
205
|
labels?: string[] | undefined;
|
|
204
206
|
duration?: string | undefined;
|
|
@@ -227,6 +229,8 @@ declare const tools: {
|
|
|
227
229
|
duration: string | null;
|
|
228
230
|
responsibleUid: string | null;
|
|
229
231
|
assignedByUid: string | null;
|
|
232
|
+
checked: boolean;
|
|
233
|
+
completedAt: string | null;
|
|
230
234
|
}[];
|
|
231
235
|
totalCount: number;
|
|
232
236
|
updatedTaskIds: string[];
|
|
@@ -265,9 +269,9 @@ declare const tools: {
|
|
|
265
269
|
};
|
|
266
270
|
execute(args: {
|
|
267
271
|
limit: number;
|
|
268
|
-
projectId?: string | undefined;
|
|
269
272
|
parentId?: string | undefined;
|
|
270
273
|
responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
|
|
274
|
+
projectId?: string | undefined;
|
|
271
275
|
sectionId?: string | undefined;
|
|
272
276
|
labels?: string[] | undefined;
|
|
273
277
|
cursor?: string | undefined;
|
|
@@ -294,15 +298,17 @@ declare const tools: {
|
|
|
294
298
|
duration: string | null;
|
|
295
299
|
responsibleUid: string | null;
|
|
296
300
|
assignedByUid: string | null;
|
|
301
|
+
checked: boolean;
|
|
302
|
+
completedAt: string | null;
|
|
297
303
|
}[];
|
|
298
304
|
nextCursor: string | null;
|
|
299
305
|
totalCount: number;
|
|
300
306
|
hasMore: boolean;
|
|
301
307
|
appliedFilters: {
|
|
302
308
|
limit: number;
|
|
303
|
-
projectId?: string | undefined;
|
|
304
309
|
parentId?: string | undefined;
|
|
305
310
|
responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
|
|
311
|
+
projectId?: string | undefined;
|
|
306
312
|
sectionId?: string | undefined;
|
|
307
313
|
labels?: string[] | undefined;
|
|
308
314
|
cursor?: string | undefined;
|
|
@@ -335,12 +341,16 @@ declare const tools: {
|
|
|
335
341
|
daysCount: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
336
342
|
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
337
343
|
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
344
|
+
responsibleUser: import("zod").ZodOptional<import("zod").ZodString>;
|
|
345
|
+
responsibleUserFiltering: import("zod").ZodOptional<import("zod").ZodEnum<["assigned", "unassignedOrMe", "all"]>>;
|
|
338
346
|
};
|
|
339
347
|
execute(args: {
|
|
340
348
|
limit: number;
|
|
341
349
|
daysCount: number;
|
|
350
|
+
responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
|
|
342
351
|
labels?: string[] | undefined;
|
|
343
352
|
cursor?: string | undefined;
|
|
353
|
+
responsibleUser?: string | undefined;
|
|
344
354
|
labelsOperator?: "and" | "or" | undefined;
|
|
345
355
|
startDate?: string | undefined;
|
|
346
356
|
overdueOption?: "overdue-only" | "include-overdue" | "exclude-overdue" | undefined;
|
|
@@ -364,6 +374,8 @@ declare const tools: {
|
|
|
364
374
|
duration: string | null;
|
|
365
375
|
responsibleUid: string | null;
|
|
366
376
|
assignedByUid: string | null;
|
|
377
|
+
checked: boolean;
|
|
378
|
+
completedAt: string | null;
|
|
367
379
|
}[];
|
|
368
380
|
nextCursor: string | null;
|
|
369
381
|
totalCount: number;
|
|
@@ -371,8 +383,10 @@ declare const tools: {
|
|
|
371
383
|
appliedFilters: {
|
|
372
384
|
limit: number;
|
|
373
385
|
daysCount: number;
|
|
386
|
+
responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
|
|
374
387
|
labels?: string[] | undefined;
|
|
375
388
|
cursor?: string | undefined;
|
|
389
|
+
responsibleUser?: string | undefined;
|
|
376
390
|
labelsOperator?: "and" | "or" | undefined;
|
|
377
391
|
startDate?: string | undefined;
|
|
378
392
|
overdueOption?: "overdue-only" | "include-overdue" | "exclude-overdue" | undefined;
|
|
@@ -404,6 +418,7 @@ declare const tools: {
|
|
|
404
418
|
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
405
419
|
sectionId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
406
420
|
parentId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
421
|
+
responsibleUser: import("zod").ZodOptional<import("zod").ZodString>;
|
|
407
422
|
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
408
423
|
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
409
424
|
};
|
|
@@ -412,12 +427,13 @@ declare const tools: {
|
|
|
412
427
|
getBy: "due" | "completion";
|
|
413
428
|
since: string;
|
|
414
429
|
until: string;
|
|
415
|
-
projectId?: string | undefined;
|
|
416
430
|
parentId?: string | undefined;
|
|
417
431
|
workspaceId?: string | undefined;
|
|
432
|
+
projectId?: string | undefined;
|
|
418
433
|
sectionId?: string | undefined;
|
|
419
434
|
labels?: string[] | undefined;
|
|
420
435
|
cursor?: string | undefined;
|
|
436
|
+
responsibleUser?: string | undefined;
|
|
421
437
|
labelsOperator?: "and" | "or" | undefined;
|
|
422
438
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
423
439
|
content: {
|
|
@@ -439,6 +455,8 @@ declare const tools: {
|
|
|
439
455
|
duration: string | null;
|
|
440
456
|
responsibleUid: string | null;
|
|
441
457
|
assignedByUid: string | null;
|
|
458
|
+
checked: boolean;
|
|
459
|
+
completedAt: string | null;
|
|
442
460
|
}[];
|
|
443
461
|
nextCursor: string | null;
|
|
444
462
|
totalCount: number;
|
|
@@ -448,12 +466,13 @@ declare const tools: {
|
|
|
448
466
|
getBy: "due" | "completion";
|
|
449
467
|
since: string;
|
|
450
468
|
until: string;
|
|
451
|
-
projectId?: string | undefined;
|
|
452
469
|
parentId?: string | undefined;
|
|
453
470
|
workspaceId?: string | undefined;
|
|
471
|
+
projectId?: string | undefined;
|
|
454
472
|
sectionId?: string | undefined;
|
|
455
473
|
labels?: string[] | undefined;
|
|
456
474
|
cursor?: string | undefined;
|
|
475
|
+
responsibleUser?: string | undefined;
|
|
457
476
|
labelsOperator?: "and" | "or" | undefined;
|
|
458
477
|
};
|
|
459
478
|
};
|
|
@@ -481,22 +500,22 @@ declare const tools: {
|
|
|
481
500
|
viewStyle: import("zod").ZodOptional<import("zod").ZodEnum<["list", "board", "calendar"]>>;
|
|
482
501
|
}, "strip", import("zod").ZodTypeAny, {
|
|
483
502
|
name: string;
|
|
484
|
-
parentId?: string | undefined;
|
|
485
503
|
isFavorite?: boolean | undefined;
|
|
486
504
|
viewStyle?: "list" | "board" | "calendar" | undefined;
|
|
505
|
+
parentId?: string | undefined;
|
|
487
506
|
}, {
|
|
488
507
|
name: string;
|
|
489
|
-
parentId?: string | undefined;
|
|
490
508
|
isFavorite?: boolean | undefined;
|
|
491
509
|
viewStyle?: "list" | "board" | "calendar" | undefined;
|
|
510
|
+
parentId?: string | undefined;
|
|
492
511
|
}>, "many">;
|
|
493
512
|
};
|
|
494
513
|
execute({ projects }: {
|
|
495
514
|
projects: {
|
|
496
515
|
name: string;
|
|
497
|
-
parentId?: string | undefined;
|
|
498
516
|
isFavorite?: boolean | undefined;
|
|
499
517
|
viewStyle?: "list" | "board" | "calendar" | undefined;
|
|
518
|
+
parentId?: string | undefined;
|
|
500
519
|
}[];
|
|
501
520
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
502
521
|
content: {
|
|
@@ -778,17 +797,17 @@ declare const tools: {
|
|
|
778
797
|
id: import("zod").ZodString;
|
|
779
798
|
name: import("zod").ZodString;
|
|
780
799
|
}, "strip", import("zod").ZodTypeAny, {
|
|
781
|
-
name: string;
|
|
782
800
|
id: string;
|
|
783
|
-
}, {
|
|
784
801
|
name: string;
|
|
802
|
+
}, {
|
|
785
803
|
id: string;
|
|
804
|
+
name: string;
|
|
786
805
|
}>, "many">;
|
|
787
806
|
};
|
|
788
807
|
execute({ sections }: {
|
|
789
808
|
sections: {
|
|
790
|
-
name: string;
|
|
791
809
|
id: string;
|
|
810
|
+
name: string;
|
|
792
811
|
}[];
|
|
793
812
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
794
813
|
content: {
|
|
@@ -944,17 +963,17 @@ declare const tools: {
|
|
|
944
963
|
id: import("zod").ZodString;
|
|
945
964
|
content: import("zod").ZodString;
|
|
946
965
|
}, "strip", import("zod").ZodTypeAny, {
|
|
947
|
-
content: string;
|
|
948
966
|
id: string;
|
|
949
|
-
}, {
|
|
950
967
|
content: string;
|
|
968
|
+
}, {
|
|
951
969
|
id: string;
|
|
970
|
+
content: string;
|
|
952
971
|
}>, "many">;
|
|
953
972
|
};
|
|
954
973
|
execute(args: {
|
|
955
974
|
comments: {
|
|
956
|
-
content: string;
|
|
957
975
|
id: string;
|
|
976
|
+
content: string;
|
|
958
977
|
}[];
|
|
959
978
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
960
979
|
content: {
|
|
@@ -1107,8 +1126,8 @@ declare const tools: {
|
|
|
1107
1126
|
id: import("zod").ZodString;
|
|
1108
1127
|
};
|
|
1109
1128
|
execute(args: {
|
|
1110
|
-
type: "task" | "comment" | "project" | "section";
|
|
1111
1129
|
id: string;
|
|
1130
|
+
type: "task" | "comment" | "project" | "section";
|
|
1112
1131
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
1113
1132
|
content: {
|
|
1114
1133
|
type: "text";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,O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,CAAC;mCAAgD,CAAC;2BAAwC,CAAC;6BAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAA9d,CAAC;gCAA6C,CAAC;gCAA6C,CAAC;+BAA4C,CAAC;oCAAiD,CAAC;mCAAgD,CAAC;6BAA2D,CAAC;kCAA+C,CAAC;mCAAgD,CAAC;2BAAwC,CAAC;6BAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAnCrxY,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA;AAE9B,OAAO,EAEH,QAAQ,EACR,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,kBAAkB,EAElB,WAAW,EACX,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,YAAY,EACZ,QAAQ,EAER,wBAAwB,EACxB,iBAAiB,EAEjB,MAAM,EACN,KAAK,GACR,CAAA"}
|
package/dist/tool-helpers.d.ts
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import type { MoveTaskArgs, PersonalProject, Task, TodoistApi, WorkspaceProject } from '@doist/todoist-api-typescript';
|
|
2
|
-
export
|
|
3
|
-
export type ResponsibleUserFiltering = (typeof RESPONSIBLE_USER_FILTERING)[number];
|
|
2
|
+
export { appendToQuery, buildResponsibleUserQueryFilter, filterTasksByResponsibleUser, RESPONSIBLE_USER_FILTERING, type ResponsibleUserFiltering, resolveResponsibleUser, } from './filter-helpers.js';
|
|
4
3
|
export type Project = PersonalProject | WorkspaceProject;
|
|
5
4
|
export declare function isPersonalProject(project: Project): project is PersonalProject;
|
|
6
5
|
export declare function isWorkspaceProject(project: Project): project is WorkspaceProject;
|
|
7
|
-
/**
|
|
8
|
-
* Filters tasks based on responsible user logic:
|
|
9
|
-
* - If resolvedAssigneeId is provided: returns only tasks assigned to that user
|
|
10
|
-
* - If no resolvedAssigneeId: returns only unassigned tasks or tasks assigned to current user
|
|
11
|
-
* @param tasks - Array of tasks to filter (must have responsibleUid property)
|
|
12
|
-
* @param resolvedAssigneeId - The resolved assignee ID to filter by (optional)
|
|
13
|
-
* @param currentUserId - The current authenticated user's ID
|
|
14
|
-
* @returns Filtered array of tasks
|
|
15
|
-
*/
|
|
16
|
-
export declare function filterTasksByResponsibleUser<T extends {
|
|
17
|
-
responsibleUid: string | null;
|
|
18
|
-
}>({ tasks, resolvedAssigneeId, currentUserId, responsibleUserFiltering, }: {
|
|
19
|
-
tasks: T[];
|
|
20
|
-
resolvedAssigneeId: string | undefined;
|
|
21
|
-
currentUserId: string;
|
|
22
|
-
responsibleUserFiltering?: ResponsibleUserFiltering;
|
|
23
|
-
}): T[];
|
|
24
6
|
/**
|
|
25
7
|
* Creates a MoveTaskArgs object from move parameters, validating that exactly one is provided.
|
|
26
8
|
* @param taskId - The task ID (used for error messages)
|
|
@@ -50,6 +32,8 @@ declare function mapTask(task: Task): {
|
|
|
50
32
|
duration: string | null;
|
|
51
33
|
responsibleUid: string | null;
|
|
52
34
|
assignedByUid: string | null;
|
|
35
|
+
checked: boolean;
|
|
36
|
+
completedAt: string | null;
|
|
53
37
|
};
|
|
54
38
|
/**
|
|
55
39
|
* Map a single Todoist project to a more structured format, for LLM consumption.
|
|
@@ -86,6 +70,8 @@ declare function getTasksByFilter({ client, query, limit, cursor, }: {
|
|
|
86
70
|
duration: string | null;
|
|
87
71
|
responsibleUid: string | null;
|
|
88
72
|
assignedByUid: string | null;
|
|
73
|
+
checked: boolean;
|
|
74
|
+
completedAt: string | null;
|
|
89
75
|
}[];
|
|
90
76
|
nextCursor: string | null;
|
|
91
77
|
}>;
|
|
@@ -96,5 +82,5 @@ declare function getTasksByFilter({ client, query, limit, cursor, }: {
|
|
|
96
82
|
* @returns The URL string
|
|
97
83
|
*/
|
|
98
84
|
declare function buildTodoistUrl(type: 'task' | 'project', id: string): string;
|
|
99
|
-
export {
|
|
85
|
+
export { buildTodoistUrl, getTasksByFilter, mapProject, mapTask };
|
|
100
86
|
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../src/tool-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,UAAU,EACV,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../src/tool-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,UAAU,EACV,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AAKtC,OAAO,EACH,aAAa,EACb,+BAA+B,EAC/B,4BAA4B,EAC5B,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,sBAAsB,GACzB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAExD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAClB,YAAY,CAsBd;AAED;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI;;;;;;;;;;;;;;;;EAkB1B;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,OAAO;;;;;;;;;EAWnC;AAWD,iBAAe,gBAAgB,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,GACT,EAAE;IACC,MAAM,EAAE,UAAU,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B;;;;;;;;;;;;;;;;;;;GAkBA;AAED;;;;;GAKG;AACH,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/tool-helpers.js
CHANGED
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { formatDuration } from './utils/duration-parser.js';
|
|
3
|
-
export
|
|
3
|
+
// Re-export filter helpers for backward compatibility
|
|
4
|
+
export { appendToQuery, buildResponsibleUserQueryFilter, filterTasksByResponsibleUser, RESPONSIBLE_USER_FILTERING, resolveResponsibleUser, } from './filter-helpers.js';
|
|
4
5
|
export function isPersonalProject(project) {
|
|
5
6
|
return 'inboxProject' in project;
|
|
6
7
|
}
|
|
7
8
|
export function isWorkspaceProject(project) {
|
|
8
9
|
return 'accessLevel' in project;
|
|
9
10
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Filters tasks based on responsible user logic:
|
|
12
|
-
* - If resolvedAssigneeId is provided: returns only tasks assigned to that user
|
|
13
|
-
* - If no resolvedAssigneeId: returns only unassigned tasks or tasks assigned to current user
|
|
14
|
-
* @param tasks - Array of tasks to filter (must have responsibleUid property)
|
|
15
|
-
* @param resolvedAssigneeId - The resolved assignee ID to filter by (optional)
|
|
16
|
-
* @param currentUserId - The current authenticated user's ID
|
|
17
|
-
* @returns Filtered array of tasks
|
|
18
|
-
*/
|
|
19
|
-
export function filterTasksByResponsibleUser({ tasks, resolvedAssigneeId, currentUserId, responsibleUserFiltering = 'unassignedOrMe', }) {
|
|
20
|
-
if (resolvedAssigneeId) {
|
|
21
|
-
// If responsibleUser provided, only return tasks assigned to that user
|
|
22
|
-
return tasks.filter((task) => task.responsibleUid === resolvedAssigneeId);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
// If no responsibleUser, only return unassigned tasks or tasks assigned to current user
|
|
26
|
-
return responsibleUserFiltering === 'unassignedOrMe'
|
|
27
|
-
? tasks.filter((task) => !task.responsibleUid || task.responsibleUid === currentUserId)
|
|
28
|
-
: tasks;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
11
|
/**
|
|
32
12
|
* Creates a MoveTaskArgs object from move parameters, validating that exactly one is provided.
|
|
33
13
|
* @param taskId - The task ID (used for error messages)
|
|
@@ -76,6 +56,8 @@ function mapTask(task) {
|
|
|
76
56
|
duration: task.duration ? formatDuration(task.duration.amount) : null,
|
|
77
57
|
responsibleUid: task.responsibleUid,
|
|
78
58
|
assignedByUid: task.assignedByUid,
|
|
59
|
+
checked: task.checked,
|
|
60
|
+
completedAt: task.completedAt,
|
|
79
61
|
};
|
|
80
62
|
}
|
|
81
63
|
/**
|
|
@@ -130,4 +112,4 @@ async function getTasksByFilter({ client, query, limit, cursor, }) {
|
|
|
130
112
|
function buildTodoistUrl(type, id) {
|
|
131
113
|
return `https://app.todoist.com/app/${type}/${id}`;
|
|
132
114
|
}
|
|
133
|
-
export {
|
|
115
|
+
export { buildTodoistUrl, getTasksByFilter, mapProject, mapTask };
|