@doist/todoist-ai 8.5.0 → 8.7.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/README.md +2 -2
- package/dist/mcp-apps/index.html +98 -0
- package/package.json +14 -7
- package/dist/filter-helpers.d.ts +0 -51
- package/dist/filter-helpers.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2862
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -98
- package/dist/main-http.d.ts +0 -3
- package/dist/main-http.d.ts.map +0 -1
- package/dist/main-http.js +0 -36
- package/dist/main.d.ts +0 -3
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -17
- package/dist/mcp-helpers.d.ts +0 -64
- package/dist/mcp-helpers.d.ts.map +0 -1
- package/dist/mcp-server-WZSyKBI3.js +0 -5429
- package/dist/mcp-server.d.ts +0 -16
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/prompts/productivity-analysis.d.ts +0 -58
- package/dist/prompts/productivity-analysis.d.ts.map +0 -1
- package/dist/todoist-tool.d.ts +0 -62
- package/dist/todoist-tool.d.ts.map +0 -1
- package/dist/tool-execution-error.d.ts +0 -7
- package/dist/tool-execution-error.d.ts.map +0 -1
- package/dist/tool-helpers.d.ts +0 -216
- package/dist/tool-helpers.d.ts.map +0 -1
- package/dist/tools/add-comments.d.ts +0 -83
- package/dist/tools/add-comments.d.ts.map +0 -1
- package/dist/tools/add-filters.d.ts +0 -94
- package/dist/tools/add-filters.d.ts.map +0 -1
- package/dist/tools/add-labels.d.ts +0 -92
- package/dist/tools/add-labels.d.ts.map +0 -1
- package/dist/tools/add-projects.d.ts +0 -112
- package/dist/tools/add-projects.d.ts.map +0 -1
- package/dist/tools/add-sections.d.ts +0 -50
- package/dist/tools/add-sections.d.ts.map +0 -1
- package/dist/tools/add-tasks.d.ts +0 -118
- package/dist/tools/add-tasks.d.ts.map +0 -1
- package/dist/tools/analyze-project-health.d.ts +0 -45
- package/dist/tools/analyze-project-health.d.ts.map +0 -1
- package/dist/tools/complete-tasks.d.ts +0 -42
- package/dist/tools/complete-tasks.d.ts.map +0 -1
- package/dist/tools/delete-object.d.ts +0 -50
- package/dist/tools/delete-object.d.ts.map +0 -1
- package/dist/tools/fetch-object.d.ts +0 -199
- package/dist/tools/fetch-object.d.ts.map +0 -1
- package/dist/tools/fetch.d.ts +0 -41
- package/dist/tools/fetch.d.ts.map +0 -1
- package/dist/tools/find-activity.d.ts +0 -91
- package/dist/tools/find-activity.d.ts.map +0 -1
- package/dist/tools/find-comments.d.ts +0 -89
- package/dist/tools/find-comments.d.ts.map +0 -1
- package/dist/tools/find-completed-tasks.d.ts +0 -115
- package/dist/tools/find-completed-tasks.d.ts.map +0 -1
- package/dist/tools/find-filters.d.ts +0 -92
- package/dist/tools/find-filters.d.ts.map +0 -1
- package/dist/tools/find-labels.d.ts +0 -81
- package/dist/tools/find-labels.d.ts.map +0 -1
- package/dist/tools/find-project-collaborators.d.ts +0 -84
- package/dist/tools/find-project-collaborators.d.ts.map +0 -1
- package/dist/tools/find-projects.d.ts +0 -87
- package/dist/tools/find-projects.d.ts.map +0 -1
- package/dist/tools/find-sections.d.ts +0 -41
- package/dist/tools/find-sections.d.ts.map +0 -1
- package/dist/tools/find-tasks-by-date.d.ts +0 -111
- package/dist/tools/find-tasks-by-date.d.ts.map +0 -1
- package/dist/tools/find-tasks-by-date.resource.d.ts +0 -28
- package/dist/tools/find-tasks-by-date.resource.d.ts.map +0 -1
- package/dist/tools/find-tasks.d.ts +0 -116
- package/dist/tools/find-tasks.d.ts.map +0 -1
- package/dist/tools/get-overview.d.ts +0 -122
- package/dist/tools/get-overview.d.ts.map +0 -1
- package/dist/tools/get-productivity-stats.d.ts +0 -160
- package/dist/tools/get-productivity-stats.d.ts.map +0 -1
- package/dist/tools/get-project-activity-stats.d.ts +0 -48
- package/dist/tools/get-project-activity-stats.d.ts.map +0 -1
- package/dist/tools/get-project-health.d.ts +0 -112
- package/dist/tools/get-project-health.d.ts.map +0 -1
- package/dist/tools/get-workspace-insights.d.ts +0 -65
- package/dist/tools/get-workspace-insights.d.ts.map +0 -1
- package/dist/tools/list-workspaces.d.ts +0 -54
- package/dist/tools/list-workspaces.d.ts.map +0 -1
- package/dist/tools/manage-assignments.d.ts +0 -72
- package/dist/tools/manage-assignments.d.ts.map +0 -1
- package/dist/tools/project-management.d.ts +0 -78
- package/dist/tools/project-management.d.ts.map +0 -1
- package/dist/tools/project-move.d.ts +0 -88
- package/dist/tools/project-move.d.ts.map +0 -1
- package/dist/tools/reorder-objects.d.ts +0 -50
- package/dist/tools/reorder-objects.d.ts.map +0 -1
- package/dist/tools/reschedule-tasks.d.ts +0 -78
- package/dist/tools/reschedule-tasks.d.ts.map +0 -1
- package/dist/tools/search.d.ts +0 -43
- package/dist/tools/search.d.ts.map +0 -1
- package/dist/tools/uncomplete-tasks.d.ts +0 -42
- package/dist/tools/uncomplete-tasks.d.ts.map +0 -1
- package/dist/tools/update-comments.d.ts +0 -87
- package/dist/tools/update-comments.d.ts.map +0 -1
- package/dist/tools/update-filters.d.ts +0 -106
- package/dist/tools/update-filters.d.ts.map +0 -1
- package/dist/tools/update-projects.d.ts +0 -120
- package/dist/tools/update-projects.d.ts.map +0 -1
- package/dist/tools/update-sections.d.ts +0 -52
- package/dist/tools/update-sections.d.ts.map +0 -1
- package/dist/tools/update-tasks.d.ts +0 -113
- package/dist/tools/update-tasks.d.ts.map +0 -1
- package/dist/tools/user-info.d.ts +0 -57
- package/dist/tools/user-info.d.ts.map +0 -1
- package/dist/tools/view-attachment.d.ts +0 -48
- package/dist/tools/view-attachment.d.ts.map +0 -1
- package/dist/utils/assignment-validator.d.ts +0 -69
- package/dist/utils/assignment-validator.d.ts.map +0 -1
- package/dist/utils/colors.d.ts +0 -68
- package/dist/utils/colors.d.ts.map +0 -1
- package/dist/utils/constants.d.ts +0 -49
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/date.d.ts +0 -18
- package/dist/utils/date.d.ts.map +0 -1
- package/dist/utils/duration-parser.d.ts +0 -36
- package/dist/utils/duration-parser.d.ts.map +0 -1
- package/dist/utils/filter-resolver.d.ts +0 -27
- package/dist/utils/filter-resolver.d.ts.map +0 -1
- package/dist/utils/labels.d.ts +0 -13
- package/dist/utils/labels.d.ts.map +0 -1
- package/dist/utils/output-schemas.d.ts +0 -163
- package/dist/utils/output-schemas.d.ts.map +0 -1
- package/dist/utils/priorities.d.ts +0 -14
- package/dist/utils/priorities.d.ts.map +0 -1
- package/dist/utils/response-builders.d.ts +0 -93
- package/dist/utils/response-builders.d.ts.map +0 -1
- package/dist/utils/sanitize-data.d.ts +0 -10
- package/dist/utils/sanitize-data.d.ts.map +0 -1
- package/dist/utils/test-helpers.d.ts +0 -91
- package/dist/utils/test-helpers.d.ts.map +0 -1
- package/dist/utils/tool-names.d.ts +0 -52
- package/dist/utils/tool-names.d.ts.map +0 -1
- package/dist/utils/user-resolver.d.ts +0 -39
- package/dist/utils/user-resolver.d.ts.map +0 -1
- package/dist/utils/widget-loader.d.ts +0 -7
- package/dist/utils/widget-loader.d.ts.map +0 -1
- package/dist/utils/workspace-resolver.d.ts +0 -31
- package/dist/utils/workspace-resolver.d.ts.map +0 -1
- package/scripts/inline-widget-builder.ts +0 -87
- package/scripts/inline-widgets-vite-plugin.ts +0 -134
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { CurrentUser, Label, PersonalProject, Section, Task, WorkspaceProject } from '@doist/todoist-api-typescript';
|
|
2
|
-
import { MappedTask } from '../tool-helpers';
|
|
3
|
-
import { Priority } from './priorities';
|
|
4
|
-
type TaskWithUserFacingPriority = Omit<Task, 'priority'> & {
|
|
5
|
-
priority: Priority;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Creates a mock Task with all required properties and sensible defaults.
|
|
9
|
-
* Pass only the properties you want to override for your specific test.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createMockTask({ priority, ...overrides }?: Partial<TaskWithUserFacingPriority>): Task;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a mock Section with all required properties and sensible defaults.
|
|
14
|
-
* Pass only the properties you want to override for your specific test.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createMockSection(overrides?: Partial<Section>): Section;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a mock PersonalProject with all required properties and sensible defaults.
|
|
19
|
-
* Pass only the properties you want to override for your specific test.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createMockProject(overrides?: Partial<PersonalProject>): PersonalProject;
|
|
22
|
-
/**
|
|
23
|
-
* Creates a mock WorkspaceProject with all required properties and sensible defaults.
|
|
24
|
-
* Pass only the properties you want to override for your specific test.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createMockWorkspaceProject(overrides?: Partial<WorkspaceProject>): WorkspaceProject;
|
|
27
|
-
/**
|
|
28
|
-
* Creates a mock Label with all required properties and sensible defaults.
|
|
29
|
-
* Pass only the properties you want to override for your specific test.
|
|
30
|
-
*/
|
|
31
|
-
export declare function createMockLabel(overrides?: Partial<Label>): Label;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a mock API response object with results and nextCursor.
|
|
34
|
-
*/
|
|
35
|
-
export declare function createMockApiResponse<T>(results: T[], nextCursor?: string | null): {
|
|
36
|
-
results: T[];
|
|
37
|
-
nextCursor: string | null;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Creates a simplified mapped task (matches mapTask output) for filter-based query tests.
|
|
41
|
-
*/
|
|
42
|
-
export declare function createMappedTask(overrides?: Partial<MappedTask>): MappedTask;
|
|
43
|
-
/**
|
|
44
|
-
* Common error messages used across tests.
|
|
45
|
-
*/
|
|
46
|
-
export declare const TEST_ERRORS: {
|
|
47
|
-
readonly API_RATE_LIMIT: "API Error: Rate limit exceeded";
|
|
48
|
-
readonly API_UNAUTHORIZED: "API Error: Unauthorized";
|
|
49
|
-
readonly INVALID_CURSOR: "Invalid cursor format";
|
|
50
|
-
readonly INVALID_FILTER: "Invalid filter query";
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Creates multiple test cases for parameterized testing.
|
|
54
|
-
*/
|
|
55
|
-
export declare function createTestCases<T, E = unknown>(cases: Array<{
|
|
56
|
-
name: string;
|
|
57
|
-
input: T;
|
|
58
|
-
expected?: E;
|
|
59
|
-
}>): {
|
|
60
|
-
name: string;
|
|
61
|
-
input: T;
|
|
62
|
-
expected?: E;
|
|
63
|
-
}[];
|
|
64
|
-
/**
|
|
65
|
-
* Common mock IDs used across tests for consistency.
|
|
66
|
-
*/
|
|
67
|
-
export declare const TEST_IDS: {
|
|
68
|
-
readonly TASK_1: "8485093748";
|
|
69
|
-
readonly TASK_2: "8485093749";
|
|
70
|
-
readonly TASK_3: "8485093750";
|
|
71
|
-
readonly PROJECT_INBOX: "inbox-project-id";
|
|
72
|
-
readonly PROJECT_WORK: "work-project-id";
|
|
73
|
-
readonly PROJECT_TEST: "6cfCcrrCFg2xP94Q";
|
|
74
|
-
readonly PROJECT_WORKSPACE: "workspace-project-id";
|
|
75
|
-
readonly SECTION_1: "section-123";
|
|
76
|
-
readonly SECTION_2: "section-456";
|
|
77
|
-
readonly USER_ID: "713437";
|
|
78
|
-
readonly WORKSPACE_1: "workspace-123";
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Fixed date for consistent test snapshots.
|
|
82
|
-
* Use this instead of new Date() in tests to avoid snapshot drift.
|
|
83
|
-
*/
|
|
84
|
-
export declare const TODAY: "2025-08-17";
|
|
85
|
-
/**
|
|
86
|
-
* Creates a mock CurrentUser with all required properties and sensible defaults.
|
|
87
|
-
* Pass only the properties you want to override for your specific test.
|
|
88
|
-
*/
|
|
89
|
-
export declare function createMockUser(overrides?: Partial<CurrentUser>): CurrentUser;
|
|
90
|
-
export {};
|
|
91
|
-
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/test-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,KAAK,EACL,eAAe,EACf,OAAO,EACP,IAAI,EACJ,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAErE,KAAK,0BAA0B,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG;IACvD,QAAQ,EAAE,QAAQ,CAAA;CACrB,CAAA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC3B,QAAe,EACf,GAAG,SAAS,EACf,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAAG,IAAI,CA6BjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,OAAO,CAAC,OAAO,CAAM,GAAG,OAAO,CAgB3E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,OAAO,CAAC,eAAe,CAAM,GAAG,eAAe,CAuB3F;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACtC,SAAS,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAC1C,gBAAgB,CA4BlB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,GAAE,OAAO,CAAC,KAAK,CAAM,GAAG,KAAK,CASrE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACnC,OAAO,EAAE,CAAC,EAAE,EACZ,UAAU,GAAE,MAAM,GAAG,IAAW,GACjC;IACC,OAAO,EAAE,CAAC,EAAE,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAKA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAoBhF;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAA;AAEV;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAC1C,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;UAAjC,MAAM;WAAS,CAAC;eAAa,CAAC;IAGtD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;CAYX,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAG,YAAqB,CAAA;AAE1C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAoChF"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized tool names module
|
|
3
|
-
*
|
|
4
|
-
* This module provides a single source of truth for all tool names used throughout the codebase.
|
|
5
|
-
* Each tool should import its own name from this module to avoid hardcoded strings.
|
|
6
|
-
* This prevents outdated references when tool names change.
|
|
7
|
-
*/
|
|
8
|
-
export declare const ToolNames: {
|
|
9
|
-
readonly ADD_TASKS: "add-tasks";
|
|
10
|
-
readonly COMPLETE_TASKS: "complete-tasks";
|
|
11
|
-
readonly UNCOMPLETE_TASKS: "uncomplete-tasks";
|
|
12
|
-
readonly UPDATE_TASKS: "update-tasks";
|
|
13
|
-
readonly FIND_TASKS: "find-tasks";
|
|
14
|
-
readonly FIND_TASKS_BY_DATE: "find-tasks-by-date";
|
|
15
|
-
readonly FIND_COMPLETED_TASKS: "find-completed-tasks";
|
|
16
|
-
readonly RESCHEDULE_TASKS: "reschedule-tasks";
|
|
17
|
-
readonly ADD_PROJECTS: "add-projects";
|
|
18
|
-
readonly UPDATE_PROJECTS: "update-projects";
|
|
19
|
-
readonly FIND_PROJECTS: "find-projects";
|
|
20
|
-
readonly PROJECT_MANAGEMENT: "project-management";
|
|
21
|
-
readonly PROJECT_MOVE: "project-move";
|
|
22
|
-
readonly ADD_SECTIONS: "add-sections";
|
|
23
|
-
readonly UPDATE_SECTIONS: "update-sections";
|
|
24
|
-
readonly FIND_SECTIONS: "find-sections";
|
|
25
|
-
readonly ADD_COMMENTS: "add-comments";
|
|
26
|
-
readonly UPDATE_COMMENTS: "update-comments";
|
|
27
|
-
readonly FIND_COMMENTS: "find-comments";
|
|
28
|
-
readonly VIEW_ATTACHMENT: "view-attachment";
|
|
29
|
-
readonly FIND_PROJECT_COLLABORATORS: "find-project-collaborators";
|
|
30
|
-
readonly MANAGE_ASSIGNMENTS: "manage-assignments";
|
|
31
|
-
readonly FIND_ACTIVITY: "find-activity";
|
|
32
|
-
readonly GET_PRODUCTIVITY_STATS: "get-productivity-stats";
|
|
33
|
-
readonly GET_PROJECT_HEALTH: "get-project-health";
|
|
34
|
-
readonly GET_PROJECT_ACTIVITY_STATS: "get-project-activity-stats";
|
|
35
|
-
readonly ANALYZE_PROJECT_HEALTH: "analyze-project-health";
|
|
36
|
-
readonly GET_WORKSPACE_INSIGHTS: "get-workspace-insights";
|
|
37
|
-
readonly GET_OVERVIEW: "get-overview";
|
|
38
|
-
readonly DELETE_OBJECT: "delete-object";
|
|
39
|
-
readonly FETCH_OBJECT: "fetch-object";
|
|
40
|
-
readonly REORDER_OBJECTS: "reorder-objects";
|
|
41
|
-
readonly USER_INFO: "user-info";
|
|
42
|
-
readonly ADD_LABELS: "add-labels";
|
|
43
|
-
readonly FIND_LABELS: "find-labels";
|
|
44
|
-
readonly FIND_FILTERS: "find-filters";
|
|
45
|
-
readonly ADD_FILTERS: "add-filters";
|
|
46
|
-
readonly UPDATE_FILTERS: "update-filters";
|
|
47
|
-
readonly LIST_WORKSPACES: "list-workspaces";
|
|
48
|
-
readonly SEARCH: "search";
|
|
49
|
-
readonly FETCH: "fetch";
|
|
50
|
-
};
|
|
51
|
-
export type ToolName = (typeof ToolNames)[keyof typeof ToolNames];
|
|
52
|
-
//# sourceMappingURL=tool-names.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-names.d.ts","sourceRoot":"","sources":["../../src/utils/tool-names.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEZ,CAAA;AAGV,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { TodoistApi } from '@doist/todoist-api-typescript';
|
|
2
|
-
export type ResolvedUser = {
|
|
3
|
-
userId: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
email: string;
|
|
6
|
-
};
|
|
7
|
-
export type ProjectCollaborator = {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
email: string;
|
|
11
|
-
};
|
|
12
|
-
/** Keyword that resolves to the current authenticated user. */
|
|
13
|
-
export declare const SELF_USER_KEYWORD: "me";
|
|
14
|
-
export declare class UserResolver {
|
|
15
|
-
/**
|
|
16
|
-
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
17
|
-
* Supports exact name matches, partial matches, email matches, and the "me" keyword.
|
|
18
|
-
*/
|
|
19
|
-
resolveUser(client: TodoistApi, nameOrId: string): Promise<ResolvedUser | null>;
|
|
20
|
-
/**
|
|
21
|
-
* Validate that a user is a collaborator on a specific project
|
|
22
|
-
*/
|
|
23
|
-
validateProjectCollaborator(client: TodoistApi, projectId: string, userId: string): Promise<boolean>;
|
|
24
|
-
/**
|
|
25
|
-
* Get collaborators for a specific project
|
|
26
|
-
*/
|
|
27
|
-
getProjectCollaborators(client: TodoistApi, projectId: string): Promise<ProjectCollaborator[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Get all collaborators from all shared projects
|
|
30
|
-
*/
|
|
31
|
-
private getAllCollaborators;
|
|
32
|
-
/**
|
|
33
|
-
* Clear all caches - useful for testing
|
|
34
|
-
*/
|
|
35
|
-
clearCache(): void;
|
|
36
|
-
}
|
|
37
|
-
export declare const userResolver: UserResolver;
|
|
38
|
-
export declare function resolveUserNameToId(client: TodoistApi, nameOrId: string): Promise<ResolvedUser | null>;
|
|
39
|
-
//# sourceMappingURL=user-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/user-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAE/D,MAAM,MAAM,YAAY,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAsBD,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,EAAG,IAAa,CAAA;AAE9C,qBAAa,YAAY;IACrB;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA+HrF;;OAEG;IACG,2BAA2B,CAC7B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;IASnB;;OAEG;IACG,uBAAuB,CACzB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA2BjC;;OAEG;YACW,mBAAmB;IAqDjC;;OAEG;IACH,UAAU,IAAI,IAAI;CAIrB;AAGD,eAAO,MAAM,YAAY,cAAqB,CAAA;AAG9C,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAE9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget-loader.d.ts","sourceRoot":"","sources":["../../src/utils/widget-loader.ts"],"names":[],"mappings":"AAEA,KAAK,cAAc,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAClB,CAAA;AAYD,iBAAS,kBAAkB,CAAC,YAAY,GAAE,cAA+B,GAAG,cAAc,CAMzF;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { TodoistApi } from '@doist/todoist-api-typescript';
|
|
2
|
-
export type ResolvedWorkspace = {
|
|
3
|
-
workspaceId: string;
|
|
4
|
-
workspaceName: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Check if a string looks like a workspace ID (purely numeric).
|
|
8
|
-
*/
|
|
9
|
-
export declare function looksLikeWorkspaceId(ref: string): boolean;
|
|
10
|
-
export declare class WorkspaceResolver {
|
|
11
|
-
private cache;
|
|
12
|
-
private getWorkspaces;
|
|
13
|
-
/**
|
|
14
|
-
* Resolve a workspace name or ID to a workspace ID and name.
|
|
15
|
-
*
|
|
16
|
-
* Resolution order:
|
|
17
|
-
* 1. Exact ID match (always tried first for any input)
|
|
18
|
-
* 2. If input looks like an ID (numeric) but wasn't found, pass through as-is (API validates)
|
|
19
|
-
* 3. Exact case-insensitive name match
|
|
20
|
-
* 4. Unique partial case-insensitive name match
|
|
21
|
-
* 5. Multiple partial matches → throw ambiguous error
|
|
22
|
-
* 6. No match → throw not-found error
|
|
23
|
-
*/
|
|
24
|
-
resolveWorkspace(client: TodoistApi, nameOrId: string): Promise<ResolvedWorkspace>;
|
|
25
|
-
/**
|
|
26
|
-
* Clear the workspace cache — useful for testing.
|
|
27
|
-
*/
|
|
28
|
-
clearCache(): void;
|
|
29
|
-
}
|
|
30
|
-
export declare const workspaceResolver: WorkspaceResolver;
|
|
31
|
-
//# sourceMappingURL=workspace-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/workspace-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,+BAA+B,CAAA;AAE1E,MAAM,MAAM,iBAAiB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACxB,CAAA;AAID;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,KAAK,CAA8D;YAE7D,aAAa;IAU3B;;;;;;;;;;OAUG;IACG,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsDxF;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
2
|
-
import { dirname, join, resolve } from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import type { BuildResult } from 'esbuild'
|
|
5
|
-
import { build } from 'esbuild'
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
8
|
-
const __dirname = dirname(__filename)
|
|
9
|
-
|
|
10
|
-
const PLACEHOLDER = '<!-- INLINE_WIDGET_SCRIPT -->'
|
|
11
|
-
|
|
12
|
-
type InlineWidget = {
|
|
13
|
-
entryFile: string
|
|
14
|
-
htmlTemplate: string
|
|
15
|
-
outputName: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type InlineWidgetBuildResult = {
|
|
19
|
-
fileName: string
|
|
20
|
-
content: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function buildInlineWidget(
|
|
24
|
-
widget: InlineWidget,
|
|
25
|
-
{ buildTimestamp }: { buildTimestamp: string },
|
|
26
|
-
): Promise<InlineWidgetBuildResult> {
|
|
27
|
-
const projectRoot = resolve(__dirname, '..')
|
|
28
|
-
const entryPath = join(projectRoot, widget.entryFile)
|
|
29
|
-
const templatePath = join(projectRoot, widget.htmlTemplate)
|
|
30
|
-
const outputFileName = `${widget.outputName}-${buildTimestamp}.html`
|
|
31
|
-
|
|
32
|
-
if (!existsSync(templatePath)) {
|
|
33
|
-
throw new Error(`HTML template not found: ${templatePath}`)
|
|
34
|
-
}
|
|
35
|
-
const htmlTemplateContent = readFileSync(templatePath, 'utf-8')
|
|
36
|
-
if (!htmlTemplateContent.includes(PLACEHOLDER)) {
|
|
37
|
-
throw new Error(`Placeholder ${PLACEHOLDER} not found in ${templatePath}`)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const result: BuildResult = await build({
|
|
41
|
-
entryPoints: [entryPath],
|
|
42
|
-
bundle: true,
|
|
43
|
-
write: false,
|
|
44
|
-
format: 'iife',
|
|
45
|
-
platform: 'browser',
|
|
46
|
-
target: 'es2020',
|
|
47
|
-
minify: true,
|
|
48
|
-
jsx: 'automatic',
|
|
49
|
-
globalName: 'Widget',
|
|
50
|
-
outdir: 'out',
|
|
51
|
-
loader: {
|
|
52
|
-
'.svg': 'dataurl',
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
if (!result.outputFiles || result.outputFiles.length === 0) {
|
|
57
|
-
throw new Error(`Failed to build ${widget.entryFile}`)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const jsFile = result.outputFiles.find((file) => file.path.endsWith('.js'))
|
|
61
|
-
const cssFile = result.outputFiles.find((file) => file.path.endsWith('.css'))
|
|
62
|
-
|
|
63
|
-
if (!jsFile) {
|
|
64
|
-
throw new Error(`No JavaScript output found for ${widget.entryFile}`)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const bundledCode = jsFile.text
|
|
68
|
-
const sanitizedBundledCode = bundledCode
|
|
69
|
-
.replace(/<\/script/gi, '<\\/script')
|
|
70
|
-
.replace(/<!--/g, '<\\!--')
|
|
71
|
-
|
|
72
|
-
// Build the inline style tag if CSS exists
|
|
73
|
-
const inlinedStyle = cssFile ? `<style>${cssFile.text}</style>` : ''
|
|
74
|
-
|
|
75
|
-
const inlinedScript = `
|
|
76
|
-
${inlinedStyle}
|
|
77
|
-
<script>
|
|
78
|
-
${sanitizedBundledCode}
|
|
79
|
-
if (typeof Widget !== 'undefined' && typeof Widget.renderWidget === 'function') {
|
|
80
|
-
Widget.renderWidget();
|
|
81
|
-
}
|
|
82
|
-
</script>
|
|
83
|
-
`
|
|
84
|
-
const finalHtml = htmlTemplateContent.replace(PLACEHOLDER, () => inlinedScript)
|
|
85
|
-
|
|
86
|
-
return { fileName: outputFileName, content: finalHtml }
|
|
87
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { dirname, join, resolve } from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import type { Plugin, PluginContext } from 'vite'
|
|
5
|
-
|
|
6
|
-
import { buildInlineWidget, type InlineWidgetBuildResult } from './inline-widget-builder.js'
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
9
|
-
const __dirname = dirname(__filename)
|
|
10
|
-
|
|
11
|
-
type InlineWidgetConfig = {
|
|
12
|
-
entryFile: string
|
|
13
|
-
htmlTemplate: string
|
|
14
|
-
outputName: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const TASK_LIST_WIDGET: InlineWidgetConfig = {
|
|
18
|
-
entryFile: 'src/widgets/task-list/widget.tsx',
|
|
19
|
-
htmlTemplate: 'src/widgets/task-list/template.html',
|
|
20
|
-
outputName: 'task-list-widget',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const WIDGET_SOURCE_PATTERN = /src[\\/]widgets[\\/].+\.(tsx?|css|html|svg)$/
|
|
24
|
-
const WIDGET_FILE_EXTENSIONS = /\.(tsx?|css|html|svg)$/
|
|
25
|
-
const WIDGET_SOURCE_DIR = 'src/widgets'
|
|
26
|
-
|
|
27
|
-
function getWidgetSourceFiles(rootDir: string): string[] {
|
|
28
|
-
const widgetsDir = join(rootDir, WIDGET_SOURCE_DIR)
|
|
29
|
-
if (!existsSync(widgetsDir)) {
|
|
30
|
-
return []
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const files: string[] = []
|
|
34
|
-
const entries = readdirSync(widgetsDir, { withFileTypes: true, recursive: true })
|
|
35
|
-
|
|
36
|
-
for (const entry of entries) {
|
|
37
|
-
if (entry.isFile() && WIDGET_FILE_EXTENSIONS.test(entry.name)) {
|
|
38
|
-
const parentPath = entry.parentPath ?? entry.path
|
|
39
|
-
files.push(join(parentPath, entry.name))
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return files
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function inlineWidgetsVitePlugin(): Plugin {
|
|
47
|
-
let cachedResult: InlineWidgetBuildResult | undefined
|
|
48
|
-
let isWatchMode = false
|
|
49
|
-
let projectRoot: string
|
|
50
|
-
const virtualModuleId = 'virtual:todoist-ai-widgets'
|
|
51
|
-
const resolvedVirtualModuleId = `\0${virtualModuleId}`
|
|
52
|
-
|
|
53
|
-
async function rebuildWidget(): Promise<void> {
|
|
54
|
-
const buildTimestamp = process.env.BUILD_TIMESTAMP ?? Date.now().toString()
|
|
55
|
-
cachedResult = await buildInlineWidget(TASK_LIST_WIDGET, { buildTimestamp })
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function writePreviewHtml(): void {
|
|
59
|
-
if (!cachedResult) {
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const previewDir = resolve(projectRoot, 'dist', 'dev')
|
|
64
|
-
if (!existsSync(previewDir)) {
|
|
65
|
-
mkdirSync(previewDir, { recursive: true })
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const previewPath = resolve(previewDir, `${TASK_LIST_WIDGET.outputName}.html`)
|
|
69
|
-
writeFileSync(previewPath, cachedResult.content, 'utf-8')
|
|
70
|
-
console.log(`[widgets] Preview written to ${previewPath}`)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function addWidgetFilesToWatch(ctx: PluginContext): void {
|
|
74
|
-
const widgetFiles = getWidgetSourceFiles(projectRoot)
|
|
75
|
-
for (const file of widgetFiles) {
|
|
76
|
-
ctx.addWatchFile(file)
|
|
77
|
-
}
|
|
78
|
-
if (widgetFiles.length > 0) {
|
|
79
|
-
console.log(`[widgets] Watching ${widgetFiles.length} widget source files`)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
name: 'todoist-ai-inline-widgets',
|
|
85
|
-
enforce: 'pre' as const,
|
|
86
|
-
|
|
87
|
-
configResolved(config) {
|
|
88
|
-
projectRoot = config.root
|
|
89
|
-
isWatchMode = config.command === 'build' && Boolean(config.build.watch)
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
async buildStart() {
|
|
93
|
-
await rebuildWidget()
|
|
94
|
-
addWidgetFilesToWatch(this)
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
async watchChange(id) {
|
|
98
|
-
if (WIDGET_SOURCE_PATTERN.test(id)) {
|
|
99
|
-
console.log(`[widgets] Detected change in ${id}, rebuilding...`)
|
|
100
|
-
await rebuildWidget()
|
|
101
|
-
|
|
102
|
-
// Write preview HTML in watch mode
|
|
103
|
-
if (isWatchMode) {
|
|
104
|
-
writePreviewHtml()
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
writeBundle() {
|
|
110
|
-
writePreviewHtml()
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
resolveId(id: string) {
|
|
114
|
-
if (id === virtualModuleId) {
|
|
115
|
-
return resolvedVirtualModuleId
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return null
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
load(id: string) {
|
|
122
|
-
if (id !== resolvedVirtualModuleId || !cachedResult) {
|
|
123
|
-
return null
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const moduleSource = `
|
|
127
|
-
const taskListWidget = ${JSON.stringify(cachedResult)};
|
|
128
|
-
export { taskListWidget };
|
|
129
|
-
export default { taskListWidget };
|
|
130
|
-
`
|
|
131
|
-
return moduleSource
|
|
132
|
-
},
|
|
133
|
-
}
|
|
134
|
-
}
|