@doist/todoist-ai 4.16.0 → 4.17.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/filter-helpers.d.ts +1 -1
- package/dist/index.d.ts +1044 -196
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -81
- package/dist/main.js +15 -23
- package/dist/mcp-helpers.d.ts +5 -5
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/dist/mcp-server-BADReNAy.js +3092 -0
- package/dist/todoist-tool.d.ts +9 -3
- package/dist/todoist-tool.d.ts.map +1 -1
- package/dist/tool-helpers.d.ts +1 -1
- package/dist/tools/add-comments.d.ts +69 -3
- package/dist/tools/add-comments.d.ts.map +1 -1
- package/dist/tools/add-projects.d.ts +34 -3
- package/dist/tools/add-projects.d.ts.map +1 -1
- package/dist/tools/add-sections.d.ts +14 -1
- package/dist/tools/add-sections.d.ts.map +1 -1
- package/dist/tools/add-tasks.d.ts +65 -10
- package/dist/tools/add-tasks.d.ts.map +1 -1
- package/dist/tools/complete-tasks.d.ts +20 -1
- package/dist/tools/complete-tasks.d.ts.map +1 -1
- package/dist/tools/delete-object.d.ts +16 -3
- package/dist/tools/delete-object.d.ts.map +1 -1
- package/dist/tools/fetch.d.ts +8 -1
- package/dist/tools/fetch.d.ts.map +1 -1
- package/dist/tools/find-activity.d.ts +44 -7
- package/dist/tools/find-activity.d.ts.map +1 -1
- package/dist/tools/find-comments.d.ts +69 -3
- package/dist/tools/find-comments.d.ts.map +1 -1
- package/dist/tools/find-completed-tasks.d.ts +63 -5
- package/dist/tools/find-completed-tasks.d.ts.map +1 -1
- package/dist/tools/find-project-collaborators.d.ts +33 -2
- package/dist/tools/find-project-collaborators.d.ts.map +1 -1
- package/dist/tools/find-projects.d.ts +35 -1
- package/dist/tools/find-projects.d.ts.map +1 -1
- package/dist/tools/find-sections.d.ts +15 -1
- package/dist/tools/find-sections.d.ts.map +1 -1
- package/dist/tools/find-tasks-by-date.d.ts +61 -3
- package/dist/tools/find-tasks-by-date.d.ts.map +1 -1
- package/dist/tools/find-tasks.d.ts +63 -5
- package/dist/tools/find-tasks.d.ts.map +1 -1
- package/dist/tools/get-overview.d.ts +24 -1
- package/dist/tools/get-overview.d.ts.map +1 -1
- package/dist/tools/manage-assignments.d.ts +39 -2
- package/dist/tools/manage-assignments.d.ts.map +1 -1
- package/dist/tools/search.d.ts +17 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/update-comments.d.ts +76 -3
- package/dist/tools/update-comments.d.ts.map +1 -1
- package/dist/tools/update-projects.d.ts +43 -1
- package/dist/tools/update-projects.d.ts.map +1 -1
- package/dist/tools/update-sections.d.ts +17 -3
- package/dist/tools/update-sections.d.ts.map +1 -1
- package/dist/tools/update-tasks.d.ts +79 -13
- package/dist/tools/update-tasks.d.ts.map +1 -1
- package/dist/tools/user-info.d.ts +19 -1
- package/dist/tools/user-info.d.ts.map +1 -1
- package/dist/utils/assignment-validator.d.ts +2 -2
- package/dist/utils/output-schemas.d.ts +233 -0
- package/dist/utils/output-schemas.d.ts.map +1 -0
- package/dist/utils/response-builders.d.ts +1 -3
- package/dist/utils/response-builders.d.ts.map +1 -1
- package/dist/utils/test-helpers.d.ts +1 -1
- package/dist/utils/user-resolver.d.ts +1 -1
- package/package.json +10 -8
- package/dist/filter-helpers.js +0 -79
- package/dist/mcp-helpers.js +0 -71
- package/dist/mcp-server.js +0 -142
- package/dist/todoist-tool.js +0 -1
- package/dist/tool-helpers.js +0 -125
- package/dist/tool-helpers.test.d.ts +0 -2
- package/dist/tool-helpers.test.d.ts.map +0 -1
- package/dist/tool-helpers.test.js +0 -223
- package/dist/tools/__tests__/add-comments.test.d.ts +0 -2
- package/dist/tools/__tests__/add-comments.test.d.ts.map +0 -1
- package/dist/tools/__tests__/add-comments.test.js +0 -241
- package/dist/tools/__tests__/add-projects.test.d.ts +0 -2
- package/dist/tools/__tests__/add-projects.test.d.ts.map +0 -1
- package/dist/tools/__tests__/add-projects.test.js +0 -174
- package/dist/tools/__tests__/add-sections.test.d.ts +0 -2
- package/dist/tools/__tests__/add-sections.test.d.ts.map +0 -1
- package/dist/tools/__tests__/add-sections.test.js +0 -185
- package/dist/tools/__tests__/add-tasks.test.d.ts +0 -2
- package/dist/tools/__tests__/add-tasks.test.d.ts.map +0 -1
- package/dist/tools/__tests__/add-tasks.test.js +0 -606
- package/dist/tools/__tests__/assignment-integration.test.d.ts +0 -2
- package/dist/tools/__tests__/assignment-integration.test.d.ts.map +0 -1
- package/dist/tools/__tests__/assignment-integration.test.js +0 -428
- package/dist/tools/__tests__/complete-tasks.test.d.ts +0 -2
- package/dist/tools/__tests__/complete-tasks.test.d.ts.map +0 -1
- package/dist/tools/__tests__/complete-tasks.test.js +0 -206
- package/dist/tools/__tests__/delete-object.test.d.ts +0 -2
- package/dist/tools/__tests__/delete-object.test.d.ts.map +0 -1
- package/dist/tools/__tests__/delete-object.test.js +0 -110
- package/dist/tools/__tests__/fetch.test.d.ts +0 -2
- package/dist/tools/__tests__/fetch.test.d.ts.map +0 -1
- package/dist/tools/__tests__/fetch.test.js +0 -279
- package/dist/tools/__tests__/find-activity.test.d.ts +0 -2
- package/dist/tools/__tests__/find-activity.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-activity.test.js +0 -229
- package/dist/tools/__tests__/find-comments.test.d.ts +0 -2
- package/dist/tools/__tests__/find-comments.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-comments.test.js +0 -236
- package/dist/tools/__tests__/find-completed-tasks.test.d.ts +0 -2
- package/dist/tools/__tests__/find-completed-tasks.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-completed-tasks.test.js +0 -423
- package/dist/tools/__tests__/find-projects.test.d.ts +0 -2
- package/dist/tools/__tests__/find-projects.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-projects.test.js +0 -154
- package/dist/tools/__tests__/find-sections.test.d.ts +0 -2
- package/dist/tools/__tests__/find-sections.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-sections.test.js +0 -313
- package/dist/tools/__tests__/find-tasks-by-date.test.d.ts +0 -2
- package/dist/tools/__tests__/find-tasks-by-date.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-tasks-by-date.test.js +0 -528
- package/dist/tools/__tests__/find-tasks.test.d.ts +0 -2
- package/dist/tools/__tests__/find-tasks.test.d.ts.map +0 -1
- package/dist/tools/__tests__/find-tasks.test.js +0 -771
- package/dist/tools/__tests__/get-overview.test.d.ts +0 -2
- package/dist/tools/__tests__/get-overview.test.d.ts.map +0 -1
- package/dist/tools/__tests__/get-overview.test.js +0 -225
- package/dist/tools/__tests__/search.test.d.ts +0 -2
- package/dist/tools/__tests__/search.test.d.ts.map +0 -1
- package/dist/tools/__tests__/search.test.js +0 -206
- package/dist/tools/__tests__/update-comments.test.d.ts +0 -2
- package/dist/tools/__tests__/update-comments.test.d.ts.map +0 -1
- package/dist/tools/__tests__/update-comments.test.js +0 -294
- package/dist/tools/__tests__/update-projects.test.d.ts +0 -2
- package/dist/tools/__tests__/update-projects.test.d.ts.map +0 -1
- package/dist/tools/__tests__/update-projects.test.js +0 -217
- package/dist/tools/__tests__/update-sections.test.d.ts +0 -2
- package/dist/tools/__tests__/update-sections.test.d.ts.map +0 -1
- package/dist/tools/__tests__/update-sections.test.js +0 -169
- package/dist/tools/__tests__/update-tasks.test.d.ts +0 -2
- package/dist/tools/__tests__/update-tasks.test.d.ts.map +0 -1
- package/dist/tools/__tests__/update-tasks.test.js +0 -788
- package/dist/tools/__tests__/user-info.test.d.ts +0 -2
- package/dist/tools/__tests__/user-info.test.d.ts.map +0 -1
- package/dist/tools/__tests__/user-info.test.js +0 -139
- package/dist/tools/add-comments.js +0 -89
- package/dist/tools/add-projects.js +0 -63
- package/dist/tools/add-sections.js +0 -74
- package/dist/tools/add-tasks.js +0 -169
- package/dist/tools/complete-tasks.js +0 -68
- package/dist/tools/delete-object.js +0 -79
- package/dist/tools/fetch.js +0 -102
- package/dist/tools/find-activity.js +0 -221
- package/dist/tools/find-comments.js +0 -148
- package/dist/tools/find-completed-tasks.js +0 -168
- package/dist/tools/find-project-collaborators.js +0 -151
- package/dist/tools/find-projects.js +0 -101
- package/dist/tools/find-sections.js +0 -101
- package/dist/tools/find-tasks-by-date.js +0 -198
- package/dist/tools/find-tasks.js +0 -329
- package/dist/tools/get-overview.js +0 -249
- package/dist/tools/manage-assignments.js +0 -337
- package/dist/tools/search.js +0 -65
- package/dist/tools/update-comments.js +0 -82
- package/dist/tools/update-projects.js +0 -84
- package/dist/tools/update-sections.js +0 -70
- package/dist/tools/update-tasks.js +0 -179
- package/dist/tools/user-info.js +0 -142
- package/dist/utils/assignment-validator.js +0 -253
- package/dist/utils/constants.js +0 -45
- package/dist/utils/duration-parser.js +0 -96
- package/dist/utils/duration-parser.test.d.ts +0 -2
- package/dist/utils/duration-parser.test.d.ts.map +0 -1
- package/dist/utils/duration-parser.test.js +0 -147
- package/dist/utils/labels.js +0 -18
- package/dist/utils/priorities.js +0 -20
- package/dist/utils/response-builders.js +0 -210
- package/dist/utils/sanitize-data.js +0 -37
- package/dist/utils/sanitize-data.test.d.ts +0 -2
- package/dist/utils/sanitize-data.test.d.ts.map +0 -1
- package/dist/utils/sanitize-data.test.js +0 -93
- package/dist/utils/test-helpers.js +0 -237
- package/dist/utils/tool-names.js +0 -40
- package/dist/utils/user-resolver.js +0 -179
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals';
|
|
2
|
-
import { createMockSection, extractStructuredContent, extractTextContent, } from '../../utils/test-helpers.js';
|
|
3
|
-
import { ToolNames } from '../../utils/tool-names.js';
|
|
4
|
-
import { updateSections } from '../update-sections.js';
|
|
5
|
-
// Mock the Todoist API
|
|
6
|
-
const mockTodoistApi = {
|
|
7
|
-
updateSection: jest.fn(),
|
|
8
|
-
};
|
|
9
|
-
const { FIND_TASKS, UPDATE_SECTIONS, GET_OVERVIEW } = ToolNames;
|
|
10
|
-
describe(`${UPDATE_SECTIONS} tool`, () => {
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
jest.clearAllMocks();
|
|
13
|
-
});
|
|
14
|
-
describe('updating a single section', () => {
|
|
15
|
-
it('should update a section when id and name are provided', async () => {
|
|
16
|
-
const mockApiResponse = {
|
|
17
|
-
id: 'existing-section-123',
|
|
18
|
-
projectId: '6cfCcrrCFg2xP94Q',
|
|
19
|
-
sectionOrder: 1,
|
|
20
|
-
userId: 'test-user',
|
|
21
|
-
addedAt: '2024-01-01T00:00:00Z',
|
|
22
|
-
updatedAt: '2024-01-01T00:00:00Z',
|
|
23
|
-
archivedAt: null,
|
|
24
|
-
isArchived: false,
|
|
25
|
-
isDeleted: false,
|
|
26
|
-
isCollapsed: false,
|
|
27
|
-
name: 'Updated Section Name',
|
|
28
|
-
url: 'https://todoist.com/sections/existing-section-123',
|
|
29
|
-
};
|
|
30
|
-
mockTodoistApi.updateSection.mockResolvedValue(mockApiResponse);
|
|
31
|
-
const result = await updateSections.execute({ sections: [{ id: 'existing-section-123', name: 'Updated Section Name' }] }, mockTodoistApi);
|
|
32
|
-
expect(mockTodoistApi.updateSection).toHaveBeenCalledWith('existing-section-123', {
|
|
33
|
-
name: 'Updated Section Name',
|
|
34
|
-
});
|
|
35
|
-
const textContent = extractTextContent(result);
|
|
36
|
-
expect(textContent).toMatchSnapshot();
|
|
37
|
-
expect(textContent).toContain('Updated 1 section:');
|
|
38
|
-
expect(textContent).toContain('Updated Section Name (id=existing-section-123, projectId=6cfCcrrCFg2xP94Q)');
|
|
39
|
-
expect(textContent).toContain(`Use ${FIND_TASKS} with sectionId=existing-section-123`);
|
|
40
|
-
// Verify structured content
|
|
41
|
-
const structuredContent = extractStructuredContent(result);
|
|
42
|
-
expect(structuredContent).toEqual(expect.objectContaining({
|
|
43
|
-
sections: expect.arrayContaining([
|
|
44
|
-
expect.objectContaining({
|
|
45
|
-
id: 'existing-section-123',
|
|
46
|
-
name: 'Updated Section Name',
|
|
47
|
-
}),
|
|
48
|
-
]),
|
|
49
|
-
totalCount: 1,
|
|
50
|
-
updatedSectionIds: ['existing-section-123'],
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('updating multiple sections', () => {
|
|
55
|
-
it('should update multiple sections and return mapped results', async () => {
|
|
56
|
-
const mockSections = [
|
|
57
|
-
createMockSection({
|
|
58
|
-
id: 'section-1',
|
|
59
|
-
projectId: 'project-1',
|
|
60
|
-
name: 'Updated First Section',
|
|
61
|
-
}),
|
|
62
|
-
createMockSection({
|
|
63
|
-
id: 'section-2',
|
|
64
|
-
projectId: 'project-1',
|
|
65
|
-
name: 'Updated Second Section',
|
|
66
|
-
}),
|
|
67
|
-
createMockSection({
|
|
68
|
-
id: 'section-3',
|
|
69
|
-
projectId: 'project-2',
|
|
70
|
-
name: 'Updated Third Section',
|
|
71
|
-
}),
|
|
72
|
-
];
|
|
73
|
-
const [section1, section2, section3] = mockSections;
|
|
74
|
-
mockTodoistApi.updateSection
|
|
75
|
-
.mockResolvedValueOnce(section1)
|
|
76
|
-
.mockResolvedValueOnce(section2)
|
|
77
|
-
.mockResolvedValueOnce(section3);
|
|
78
|
-
const result = await updateSections.execute({
|
|
79
|
-
sections: [
|
|
80
|
-
{ id: 'section-1', name: 'Updated First Section' },
|
|
81
|
-
{ id: 'section-2', name: 'Updated Second Section' },
|
|
82
|
-
{ id: 'section-3', name: 'Updated Third Section' },
|
|
83
|
-
],
|
|
84
|
-
}, mockTodoistApi);
|
|
85
|
-
// Verify API was called correctly for each section
|
|
86
|
-
expect(mockTodoistApi.updateSection).toHaveBeenCalledTimes(3);
|
|
87
|
-
expect(mockTodoistApi.updateSection).toHaveBeenNthCalledWith(1, 'section-1', {
|
|
88
|
-
name: 'Updated First Section',
|
|
89
|
-
});
|
|
90
|
-
expect(mockTodoistApi.updateSection).toHaveBeenNthCalledWith(2, 'section-2', {
|
|
91
|
-
name: 'Updated Second Section',
|
|
92
|
-
});
|
|
93
|
-
expect(mockTodoistApi.updateSection).toHaveBeenNthCalledWith(3, 'section-3', {
|
|
94
|
-
name: 'Updated Third Section',
|
|
95
|
-
});
|
|
96
|
-
const textContent = extractTextContent(result);
|
|
97
|
-
expect(textContent).toMatchSnapshot();
|
|
98
|
-
expect(textContent).toContain('Updated 3 sections:');
|
|
99
|
-
expect(textContent).toContain('Updated First Section (id=section-1, projectId=project-1)');
|
|
100
|
-
expect(textContent).toContain('Updated Second Section (id=section-2, projectId=project-1)');
|
|
101
|
-
expect(textContent).toContain('Updated Third Section (id=section-3, projectId=project-2)');
|
|
102
|
-
// Verify structured content
|
|
103
|
-
const structuredContent = extractStructuredContent(result);
|
|
104
|
-
expect(structuredContent).toEqual(expect.objectContaining({
|
|
105
|
-
sections: expect.arrayContaining([
|
|
106
|
-
expect.objectContaining({ id: 'section-1', name: 'Updated First Section' }),
|
|
107
|
-
expect.objectContaining({
|
|
108
|
-
id: 'section-2',
|
|
109
|
-
name: 'Updated Second Section',
|
|
110
|
-
}),
|
|
111
|
-
expect.objectContaining({ id: 'section-3', name: 'Updated Third Section' }),
|
|
112
|
-
]),
|
|
113
|
-
totalCount: 3,
|
|
114
|
-
updatedSectionIds: ['section-1', 'section-2', 'section-3'],
|
|
115
|
-
}));
|
|
116
|
-
});
|
|
117
|
-
it('should handle sections from the same project', async () => {
|
|
118
|
-
const mockSections = [
|
|
119
|
-
createMockSection({
|
|
120
|
-
id: 'section-1',
|
|
121
|
-
projectId: 'same-project',
|
|
122
|
-
name: 'Backlog',
|
|
123
|
-
}),
|
|
124
|
-
createMockSection({
|
|
125
|
-
id: 'section-2',
|
|
126
|
-
projectId: 'same-project',
|
|
127
|
-
name: 'Done',
|
|
128
|
-
}),
|
|
129
|
-
];
|
|
130
|
-
const [section1, section2] = mockSections;
|
|
131
|
-
mockTodoistApi.updateSection
|
|
132
|
-
.mockResolvedValueOnce(section1)
|
|
133
|
-
.mockResolvedValueOnce(section2);
|
|
134
|
-
const result = await updateSections.execute({
|
|
135
|
-
sections: [
|
|
136
|
-
{ id: 'section-1', name: 'Backlog' },
|
|
137
|
-
{ id: 'section-2', name: 'Done' },
|
|
138
|
-
],
|
|
139
|
-
}, mockTodoistApi);
|
|
140
|
-
const textContent = extractTextContent(result);
|
|
141
|
-
expect(textContent).toMatchSnapshot();
|
|
142
|
-
expect(textContent).toContain('Updated 2 sections:');
|
|
143
|
-
expect(textContent).toContain(`Use ${GET_OVERVIEW} with projectId=same-project`);
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
describe('error handling', () => {
|
|
147
|
-
it('should propagate API errors', async () => {
|
|
148
|
-
const apiError = new Error('API Error: Section not found');
|
|
149
|
-
mockTodoistApi.updateSection.mockRejectedValue(apiError);
|
|
150
|
-
await expect(updateSections.execute({ sections: [{ id: 'nonexistent', name: 'New Name' }] }, mockTodoistApi)).rejects.toThrow('API Error: Section not found');
|
|
151
|
-
});
|
|
152
|
-
it('should handle partial failures in multiple sections', async () => {
|
|
153
|
-
const mockSection = createMockSection({
|
|
154
|
-
id: 'section-1',
|
|
155
|
-
projectId: 'project-1',
|
|
156
|
-
name: 'Updated Section',
|
|
157
|
-
});
|
|
158
|
-
mockTodoistApi.updateSection
|
|
159
|
-
.mockResolvedValueOnce(mockSection)
|
|
160
|
-
.mockRejectedValueOnce(new Error('API Error: Section not found'));
|
|
161
|
-
await expect(updateSections.execute({
|
|
162
|
-
sections: [
|
|
163
|
-
{ id: 'section-1', name: 'Updated Section' },
|
|
164
|
-
{ id: 'nonexistent', name: 'New Name' },
|
|
165
|
-
],
|
|
166
|
-
}, mockTodoistApi)).rejects.toThrow('API Error: Section not found');
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-tasks.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/update-tasks.test.ts"],"names":[],"mappings":""}
|