@doist/todoist-ai 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,60 @@
1
- import { ActivityEvent, Comment, MoveTaskArgs, PersonalProject, Task, TodoistApi, WorkspaceProject } from '@doist/todoist-api-typescript';
1
+ import { ActivityEvent, Comment, MoveTaskArgs, PersonalProject, Section, Task, TodoistApi, WorkspaceProject } from '@doist/todoist-api-typescript';
2
2
  export { appendToQuery, buildResponsibleUserQueryFilter, filterTasksByResponsibleUser, RESPONSIBLE_USER_FILTERING, type ResponsibleUserFiltering, resolveResponsibleUser, } from './filter-helpers.js';
3
3
  export type Project = PersonalProject | WorkspaceProject;
4
4
  export declare function isPersonalProject(project: Project): project is PersonalProject;
5
5
  export declare function isWorkspaceProject(project: Project): project is WorkspaceProject;
6
+ /**
7
+ * Generic pagination utility for Todoist API methods
8
+ *
9
+ * Recursively fetches all pages of data from paginated Todoist API endpoints.
10
+ *
11
+ * @template TArgs - The type of arguments accepted by the API method
12
+ * @template TResponse - The type of response returned by the API method
13
+ * @template TResult - The type of individual result items in the response
14
+ *
15
+ * @param options - Configuration options
16
+ * @param options.apiMethod - The Todoist API method to call (e.g., todoistApi.getLabels)
17
+ * @param options.args - Initial arguments to pass to the API method (excluding cursor and limit)
18
+ * @param options.limit - Number of items to fetch per page (default: 100)
19
+ * @returns Promise resolving to an array of all result items across all pages
20
+ *
21
+ * @example
22
+ * const allLabels = await fetchAllPages({
23
+ * apiMethod: (args) => todoistApi.getLabels(args),
24
+ * args: {},
25
+ * limit: 100
26
+ * })
27
+ */
28
+ export declare function fetchAllPages<TArgs extends {
29
+ cursor?: string | null;
30
+ limit?: number;
31
+ }, TResponse extends {
32
+ results: TResult[];
33
+ nextCursor: string | null;
34
+ }, TResult>(options: {
35
+ apiMethod: (args: TArgs) => Promise<TResponse>;
36
+ args?: Omit<TArgs, 'cursor' | 'limit'>;
37
+ limit?: number;
38
+ }): Promise<TResult[]>;
39
+ /**
40
+ * Fetches all projects from Todoist by looping through paginated results.
41
+ * This is useful when you need to search/filter projects client-side and want
42
+ * to ensure no matches are missed due to pagination boundaries.
43
+ *
44
+ * @param client - The Todoist API client
45
+ * @returns Promise resolving to array of all projects
46
+ */
47
+ export declare function fetchAllProjects(client: TodoistApi): Promise<Project[]>;
48
+ /**
49
+ * Fetches all sections for a project from Todoist by looping through paginated results.
50
+ * This is useful when you need to search/filter sections client-side and want
51
+ * to ensure no matches are missed due to pagination boundaries.
52
+ *
53
+ * @param client - The Todoist API client
54
+ * @param projectId - The ID of the project to fetch sections from
55
+ * @returns Promise resolving to array of all sections in the project
56
+ */
57
+ export declare function fetchAllSections(client: TodoistApi, projectId?: string): Promise<Section[]>;
6
58
  /**
7
59
  * Creates a MoveTaskArgs object from move parameters, validating that exactly one is provided.
8
60
  * @param taskId - The task ID (used for error messages)
@@ -1 +1 @@
1
- {"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../src/tool-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,OAAO,EACP,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,UAAU,EACV,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AAMtC,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,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AU,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;AAE5C;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,OAAO;;;;;;;;;EAWnC;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;EAyBnC;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,KAAK,EAAE,aAAa;;;;;;;;;;EAY7C;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,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,CAAA;AAC9E,YAAY,EAAE,UAAU,EAAE,CAAA"}
@@ -51,12 +51,12 @@ declare const findActivity: {
51
51
  };
52
52
  execute(args: {
53
53
  limit: number;
54
+ cursor?: string | undefined;
54
55
  projectId?: string | undefined;
55
56
  objectType?: "comment" | "task" | "project" | undefined;
56
57
  objectId?: string | undefined;
57
58
  eventType?: "completed" | "added" | "updated" | "deleted" | "uncompleted" | "archived" | "unarchived" | "shared" | "left" | undefined;
58
59
  initiatorId?: string | undefined;
59
- cursor?: string | undefined;
60
60
  taskId?: string | undefined;
61
61
  }, client: import('@doist/todoist-api-typescript').TodoistApi): Promise<{
62
62
  textContent: string;
@@ -77,12 +77,12 @@ declare const findActivity: {
77
77
  hasMore: boolean;
78
78
  appliedFilters: {
79
79
  limit: number;
80
+ cursor?: string | undefined;
80
81
  projectId?: string | undefined;
81
82
  objectType?: "comment" | "task" | "project" | undefined;
82
83
  objectId?: string | undefined;
83
84
  eventType?: "completed" | "added" | "updated" | "deleted" | "uncompleted" | "archived" | "unarchived" | "shared" | "left" | undefined;
84
85
  initiatorId?: string | undefined;
85
- cursor?: string | undefined;
86
86
  taskId?: string | undefined;
87
87
  };
88
88
  };
@@ -104,9 +104,9 @@ declare const findComments: {
104
104
  totalCount: z.ZodNumber;
105
105
  };
106
106
  execute(args: {
107
- projectId?: string | undefined;
108
- limit?: number | undefined;
109
107
  cursor?: string | undefined;
108
+ limit?: number | undefined;
109
+ projectId?: string | undefined;
110
110
  taskId?: string | undefined;
111
111
  commentId?: string | undefined;
112
112
  }, client: import('@doist/todoist-api-typescript').TodoistApi): Promise<{
@@ -81,10 +81,10 @@ declare const findCompletedTasks: {
81
81
  until: string;
82
82
  parentId?: string | undefined;
83
83
  workspaceId?: string | undefined;
84
+ cursor?: string | undefined;
84
85
  projectId?: string | undefined;
85
86
  sectionId?: string | undefined;
86
87
  labels?: string[] | undefined;
87
- cursor?: string | undefined;
88
88
  responsibleUser?: string | undefined;
89
89
  labelsOperator?: "and" | "or" | undefined;
90
90
  }, client: import('@doist/todoist-api-typescript').TodoistApi): Promise<{
@@ -118,10 +118,10 @@ declare const findCompletedTasks: {
118
118
  until: string;
119
119
  parentId?: string | undefined;
120
120
  workspaceId?: string | undefined;
121
+ cursor?: string | undefined;
121
122
  projectId?: string | undefined;
122
123
  sectionId?: string | undefined;
123
124
  labels?: string[] | undefined;
124
- cursor?: string | undefined;
125
125
  responsibleUser?: string | undefined;
126
126
  labelsOperator?: "and" | "or" | undefined;
127
127
  };
@@ -1 +1 @@
1
- {"version":3,"file":"find-projects.d.ts","sourceRoot":"","sources":["../../src/tools/find-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwCvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B6C,CAAA;AAoD/D,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"find-projects.d.ts","sourceRoot":"","sources":["../../src/tools/find-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwCvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C6C,CAAA;AAoD/D,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"find-sections.d.ts","sourceRoot":"","sources":["../../src/tools/find-sections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkCvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC6C,CAAA;AAwC/D,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"find-sections.d.ts","sourceRoot":"","sources":["../../src/tools/find-sections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmCvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C6C,CAAA;AAwC/D,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -75,8 +75,8 @@ declare const findTasksByDate: {
75
75
  limit: number;
76
76
  daysCount: number;
77
77
  responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
78
- labels?: string[] | undefined;
79
78
  cursor?: string | undefined;
79
+ labels?: string[] | undefined;
80
80
  responsibleUser?: string | undefined;
81
81
  labelsOperator?: "and" | "or" | undefined;
82
82
  startDate?: string | undefined;
@@ -109,8 +109,8 @@ declare const findTasksByDate: {
109
109
  limit: number;
110
110
  daysCount: number;
111
111
  responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
112
- labels?: string[] | undefined;
113
112
  cursor?: string | undefined;
113
+ labels?: string[] | undefined;
114
114
  responsibleUser?: string | undefined;
115
115
  labelsOperator?: "and" | "or" | undefined;
116
116
  startDate?: string | undefined;
@@ -76,10 +76,10 @@ declare const findTasks: {
76
76
  limit: number;
77
77
  parentId?: string | undefined;
78
78
  responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
79
+ cursor?: string | undefined;
79
80
  projectId?: string | undefined;
80
81
  sectionId?: string | undefined;
81
82
  labels?: string[] | undefined;
82
- cursor?: string | undefined;
83
83
  responsibleUser?: string | undefined;
84
84
  labelsOperator?: "and" | "or" | undefined;
85
85
  searchText?: string | undefined;
@@ -111,10 +111,10 @@ declare const findTasks: {
111
111
  limit: number;
112
112
  parentId?: string | undefined;
113
113
  responsibleUserFiltering?: "assigned" | "unassignedOrMe" | "all" | undefined;
114
+ cursor?: string | undefined;
114
115
  projectId?: string | undefined;
115
116
  sectionId?: string | undefined;
116
117
  labels?: string[] | undefined;
117
- cursor?: string | undefined;
118
118
  responsibleUser?: string | undefined;
119
119
  labelsOperator?: "and" | "or" | undefined;
120
120
  searchText?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,KAAK,YAAY,GAAG;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACd,CAAA;AAeD;;;;;GAKG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDmD,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,KAAK,YAAY,GAAG;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACd,CAAA;AAeD;;;;;GAKG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDmD,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -16,7 +16,9 @@ export declare const ApiLimits: {
16
16
  /** Default limit for project listings */
17
17
  readonly PROJECTS_DEFAULT: 50;
18
18
  /** Maximum limit for project listings */
19
- readonly PROJECTS_MAX: 100;
19
+ readonly PROJECTS_MAX: 200;
20
+ /** Maximum limit for section listings */
21
+ readonly SECTIONS_MAX: 200;
20
22
  /** Batch size for fetching all tasks in a project */
21
23
  readonly TASKS_BATCH_SIZE: 50;
22
24
  /** Default limit for comment listings */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,eAAO,MAAM,SAAS;IAClB,sCAAsC;;IAEtC,wDAAwD;;IAExD,wCAAwC;;IAExC,wCAAwC;;IAExC,yCAAyC;;IAEzC,yCAAyC;;IAEzC,qDAAqD;;IAErD,yCAAyC;;IAEzC,2DAA2D;;IAE3D,8CAA8C;;IAE9C,gEAAgE;;CAE1D,CAAA;AAGV,eAAO,MAAM,aAAa;IACtB,oEAAoE;;IAEpE,gDAAgD;;CAE1C,CAAA;AAGV,eAAO,MAAM,cAAc;IACvB,oDAAoD;;IAEpD,mCAAmC;;CAE7B,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,eAAO,MAAM,SAAS;IAClB,sCAAsC;;IAEtC,wDAAwD;;IAExD,wCAAwC;;IAExC,wCAAwC;;IAExC,yCAAyC;;IAEzC,yCAAyC;;IAEzC,yCAAyC;;IAEzC,qDAAqD;;IAErD,yCAAyC;;IAEzC,2DAA2D;;IAE3D,8CAA8C;;IAE9C,gEAAgE;;CAE1D,CAAA;AAGV,eAAO,MAAM,aAAa;IACtB,oEAAoE;;IAEpE,gDAAgD;;CAE1C,CAAA;AAGV,eAAO,MAAM,cAAc;IACvB,oDAAoD;;IAEpD,mCAAmC;;CAE7B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-ai",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "prepare": "husky"
49
49
  },
50
50
  "dependencies": {
51
- "@doist/todoist-api-typescript": "6.1.7",
51
+ "@doist/todoist-api-typescript": "6.1.10",
52
52
  "@modelcontextprotocol/sdk": "1.21.1",
53
53
  "date-fns": "4.1.0",
54
54
  "dotenv": "17.2.3",