import { isPersonalProject, isWorkspaceProject, ActivityEvent, ColorKey, Comment, CurrentUser, Label, MoveTaskArgs, PersonalProject, Reminder, Section, Task, TodoistApi, WorkspaceProject } from '@doist/todoist-sdk'; export { appendToQuery, buildResponsibleUserQueryFilter, filterTasksByResponsibleUser, RESPONSIBLE_USER_FILTERING, type ResponsibleUserFiltering, resolveResponsibleUser, } from './filter-helpers.js'; export type Project = PersonalProject | WorkspaceProject; export { isPersonalProject, isWorkspaceProject }; /** * Checks if a project ID represents the inbox (case-insensitive). * * @param projectId - The project ID to check * @returns true if the project ID is inbox-like */ export declare function isInboxProjectId(projectId: string | undefined): boolean; /** * Resolves "inbox" project ID to actual inbox project ID (case-insensitive). * Only makes API calls when necessary (when projectId is inbox-like and user not provided). * * @param args - Configuration object * @param args.projectId - The project ID to resolve (may be "inbox", "Inbox", etc.) * @param args.user - The current user object (if already fetched) * @param args.client - The API client (if user needs to be fetched) * @returns Promise resolving to the resolved project ID */ export declare function resolveInboxProjectId(args: { projectId: string | undefined; user?: CurrentUser; client?: TodoistApi; }): Promise; /** * Generic pagination utility for Todoist API methods * * Recursively fetches all pages of data from paginated Todoist API endpoints. * * @template TArgs - The type of arguments accepted by the API method * @template TResponse - The type of response returned by the API method * @template TResult - The type of individual result items in the response * * @param options - Configuration options * @param options.apiMethod - The Todoist API method to call (e.g., todoistApi.getLabels) * @param options.args - Initial arguments to pass to the API method (excluding cursor and limit) * @param options.limit - Number of items to fetch per page (default: 100) * @returns Promise resolving to an array of all result items across all pages * * @example * const allLabels = await fetchAllPages({ * apiMethod: (args) => todoistApi.getLabels(args), * args: {}, * limit: 100 * }) */ export declare function fetchAllPages(options: { apiMethod: (args: TArgs) => Promise; args?: Omit; limit?: number; }): Promise; /** * Wraps a search query with wildcards for substring matching. * If the query already contains unescaped wildcards, it is returned as-is * to preserve intentional wildcard patterns (e.g. prefix matching with "work*"). */ export declare function toWildcardQuery(query: string): string; /** * Searches projects by name and fetches all matching pages. * * @param client - The Todoist API client * @param query - The search query string * @returns Promise resolving to array of matching projects */ export declare function searchAllProjects(client: TodoistApi, query: string): Promise; /** * Fetches all active (non-archived) projects across every page. * * @param client - The Todoist API client * @returns Promise resolving to array of active projects */ export declare function fetchAllActiveProjects(client: TodoistApi): Promise; /** * Fetches all archived projects across every page. * * The API has no server-side search for archived projects, so callers that need * to filter by name should fetch all and filter client-side with * {@link matchesWildcardQuery}. * * @param client - The Todoist API client * @returns Promise resolving to array of archived projects */ export declare function fetchAllArchivedProjects(client: TodoistApi): Promise; /** * Compiles a search query into a case-insensitive RegExp using the same wildcard * semantics as server-side search (see {@link toWildcardQuery}): `*` matches any * sequence, `\*` is a literal asterisk, and every other character (backslashes * included) is matched literally. A query without an unescaped `*` matches as a * substring; otherwise the whole name must match. * * Compile once and reuse the result when filtering many names (e.g. archived * projects), rather than calling {@link matchesWildcardQuery} per item. */ export declare function compileWildcardQuery(query: string): RegExp; /** * Tests whether a name matches a search query using the same wildcard semantics * as server-side search. Used for client-side filtering where the API exposes no * search endpoint (e.g. archived projects). For bulk filtering, prefer * {@link compileWildcardQuery} so the pattern is compiled only once. */ export declare function matchesWildcardQuery(name: string, query: string): boolean; /** * Searches labels by name and fetches all matching pages. * * @param client - The Todoist API client * @param query - The search query string * @returns Promise resolving to array of matching labels */ export declare function searchAllLabels(client: TodoistApi, query: string): Promise; export declare function fetchAllSharedLabels(client: TodoistApi): Promise; /** * Searches sections by name (optionally scoped to a project) and fetches all matching pages. * * @param client - The Todoist API client * @param query - The search query string * @param projectId - Optional project ID to scope the search * @returns Promise resolving to array of matching sections */ export declare function searchAllSections(client: TodoistApi, query: string, projectId?: string): Promise; /** * Creates a MoveTaskArgs object from move parameters, validating that exactly one is provided. * @param taskId - The task ID (used for error messages) * @param projectId - Optional project ID to move to * @param sectionId - Optional section ID to move to * @param parentId - Optional parent ID to move to * @returns MoveTaskArgs object with exactly one destination * @throws Error if multiple move parameters are provided or none are provided */ export declare function createMoveTaskArgs(taskId: string, projectId?: string, sectionId?: string, parentId?: string): MoveTaskArgs; /** * Map a single Todoist task to a more structured format, for LLM consumption. * @param task - The task to map. * @returns The mapped task. */ declare function mapTask(task: Task): { id: string; content: string; description: string; dueDate: string | undefined; recurring: string | boolean; deadlineDate: string | undefined; priority: "p1" | "p2" | "p3" | "p4"; projectId: string; sectionId: string | undefined; parentId: string | undefined; labels: string[]; duration: string | undefined; responsibleUid: string | undefined; assignedByUid: string | undefined; isDeleted: true | undefined; checked: boolean; completedAt: string | undefined; addedAt: string | undefined; }; type MappedTask = ReturnType; /** * Map a single Todoist project to a more structured format, for LLM consumption. * @param project - The project to map. * @returns The mapped project. */ declare function mapProject(project: Project): { id: string; name: string; description: string; color: ColorKey; isFavorite: boolean; isShared: boolean; parentId: string | undefined; inboxProject: boolean; viewStyle: string; workspaceId: string | undefined; folderId: string | undefined; childOrder: number; isArchived: boolean; }; /** * Map a single Todoist comment to a more structured format, for LLM consumption. * @param comment - The comment to map. * @returns The mapped comment. */ declare function mapComment(comment: Comment): { id: string; taskId: string | undefined; projectId: string | undefined; content: string; postedAt: string; postedUid: string; notifiedUserIds: string[] | undefined; fileAttachment: { resourceType: string; fileName: string | undefined; fileSize: number | undefined; fileType: string | undefined; fileUrl: string | undefined; fileDuration: number | undefined; uploadState: "completed" | "pending" | undefined; url: string | undefined; title: string | undefined; image: string | undefined; imageWidth: number | undefined; imageHeight: number | undefined; } | undefined; }; /** * Map a single Todoist activity event to a more structured format, for LLM consumption. * @param event - The activity event to map. * @returns The mapped activity event. */ declare function mapActivityEvent(event: ActivityEvent): { id: string | undefined; objectType: string; objectId: string; eventType: string; eventDate: string; parentProjectId: string | undefined; parentItemId: string | undefined; initiatorId: string | undefined; extraData: Record | undefined; }; /** * Normalize first-page cursor values commonly emitted by schema-driven clients. */ export declare function normalizePaginationCursor(cursor: string | undefined): string | undefined; declare function getTasksByFilter({ client, query, limit, cursor, }: { client: TodoistApi; query: string; limit: number | undefined; cursor: string | undefined; }): Promise<{ tasks: { id: string; content: string; description: string; dueDate: string | undefined; recurring: string | boolean; deadlineDate: string | undefined; priority: "p1" | "p2" | "p3" | "p4"; projectId: string; sectionId: string | undefined; parentId: string | undefined; labels: string[]; duration: string | undefined; responsibleUid: string | undefined; assignedByUid: string | undefined; isDeleted: true | undefined; checked: boolean; completedAt: string | undefined; addedAt: string | undefined; }[]; nextCursor: string | null; }>; /** * Map a single Todoist reminder to a more structured format, for LLM consumption. * Normalizes SDK's `itemId` to `taskId` for consistency with other tools. * @param reminder - The reminder to map (any of the 3 types). * @returns The mapped reminder. */ declare function mapReminder(reminder: Reminder): { minuteOffset: number; due: { isRecurring: boolean; string: string; date: string; datetime: string | undefined; timezone: string | undefined; } | undefined; isUrgent: boolean | undefined; id: string; taskId: string; type: "location" | "absolute" | "relative"; } | { due: { isRecurring: boolean; string: string; date: string; datetime: string | undefined; timezone: string | undefined; }; isUrgent: boolean | undefined; id: string; taskId: string; type: "location" | "absolute" | "relative"; } | { name: string; locLat: string; locLong: string; locTrigger: "on_enter" | "on_leave"; radius: number; id: string; taskId: string; type: "location" | "absolute" | "relative"; }; /** * Count reminders by category: time-based (relative/absolute) and location. */ declare function countRemindersByType(reminders: { type: string; }[]): { timeBasedCount: number; locationCount: number; }; export type { MappedTask }; export { countRemindersByType, getTasksByFilter, mapActivityEvent, mapComment, mapProject, mapReminder, mapTask, }; //# sourceMappingURL=tool-helpers.d.ts.map