TaskDecay v1.0.0 MVP — smart task review & archive Chrome extension

This commit is contained in:
Bun Bun
2026-06-17 06:48:47 +00:00
commit cc9aee68ee
38 changed files with 4710 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
import { fetchTodoistTasks, closeTodoistTask, deleteTodoistTask } from './todoist.js';
import { fetchTickTickTasks, closeTickTickTask, deleteTickTickTask } from './ticktick.js';
import { fetchNotionTasks, archiveNotionTask, deleteNotionTask } from './notion.js';
export async function fetchAllTasks(providers) {
const all = [];
const errors = [];
if (providers.todoist.enabled && providers.todoist.token) {
try {
const tasks = await fetchTodoistTasks(providers.todoist);
all.push(...tasks);
}
catch (e) {
errors.push(`Todoist: ${e.message}`);
}
}
if (providers.ticktick.enabled && providers.ticktick.token) {
try {
const tasks = await fetchTickTickTasks(providers.ticktick);
all.push(...tasks);
}
catch (e) {
errors.push(`TickTick: ${e.message}`);
}
}
if (providers.notion.enabled && providers.notion.token) {
try {
const tasks = await fetchNotionTasks(providers.notion);
all.push(...tasks);
}
catch (e) {
errors.push(`Notion: ${e.message}`);
}
}
if (errors.length > 0 && all.length === 0) {
throw new Error(errors.join('; '));
}
return all;
}
export async function completeTask(task, token) {
if (task.source === 'todoist')
await closeTodoistTask(task.id, token);
else if (task.source === 'ticktick')
await closeTickTickTask(task.id, token);
else if (task.source === 'notion')
await archiveNotionTask(task.id, token);
}
export async function deleteTask(task, token) {
if (task.source === 'todoist')
await deleteTodoistTask(task.id, token);
else if (task.source === 'ticktick')
await deleteTickTickTask(task.id, token);
else if (task.source === 'notion')
await deleteNotionTask(task.id, token);
}
export function getTokenForSource(source, providers) {
if (source === 'todoist')
return providers.todoist.token;
if (source === 'ticktick')
return providers.ticktick.token;
if (source === 'notion')
return providers.notion.token;
return '';
}