mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
refactor: unify interrupt handling in various tools
Refactored the context types for create, delete, and update functionalities across multiple tools including Confluence, Dropbox, Gmail, Google Calendar, Jira, Linear, Notion, and OneDrive to utilize a consistent type definition. This change enhances code clarity and maintains uniformity in handling user approvals by integrating the useHitlDecision hook for decision dispatching.
This commit is contained in:
parent
041af34820
commit
71f4f77f26
25 changed files with 25 additions and 25 deletions
|
|
@ -32,7 +32,7 @@ interface ConfluenceSpace {
|
|||
name: string;
|
||||
}
|
||||
|
||||
interface CreateConfluencePageInterruptContext {
|
||||
type CreateConfluencePageInterruptContext = {
|
||||
accounts?: ConfluenceAccount[];
|
||||
spaces?: ConfluenceSpace[];
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
|
|||
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
|
||||
import { useHitlPhase } from "@/hooks/use-hitl-phase";
|
||||
|
||||
interface DeleteConfluencePageInterruptContext {
|
||||
type DeleteConfluencePageInterruptContext = {
|
||||
account?: {
|
||||
id: number;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
|
|||
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
|
||||
import { useHitlPhase } from "@/hooks/use-hitl-phase";
|
||||
|
||||
interface UpdateConfluencePageInterruptContext {
|
||||
type UpdateConfluencePageInterruptContext = {
|
||||
account?: {
|
||||
id: number;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ interface SupportedType {
|
|||
label: string;
|
||||
}
|
||||
|
||||
interface DropboxCreateFileContext {
|
||||
type DropboxCreateFileContext = {
|
||||
accounts?: DropboxAccount[];
|
||||
parent_folders?: Record<number, Array<{ folder_path: string; name: string }>>;
|
||||
supported_types?: SupportedType[];
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ interface DropboxFile {
|
|||
document_id?: number;
|
||||
}
|
||||
|
||||
interface DropboxTrashFileContext {
|
||||
type DropboxTrashFileContext = {
|
||||
account?: DropboxAccount;
|
||||
file?: DropboxFile;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ interface GmailAccount {
|
|||
auth_expired?: boolean;
|
||||
}
|
||||
|
||||
interface GmailCreateDraftContext {
|
||||
type GmailCreateDraftContext = {
|
||||
accounts?: GmailAccount[];
|
||||
error?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ interface GmailAccount {
|
|||
auth_expired?: boolean;
|
||||
}
|
||||
|
||||
interface GmailSendEmailContext {
|
||||
type GmailSendEmailContext = {
|
||||
accounts?: GmailAccount[];
|
||||
error?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ interface GmailMessage {
|
|||
document_id: number;
|
||||
}
|
||||
|
||||
interface GmailTrashEmailContext {
|
||||
type GmailTrashEmailContext = {
|
||||
account?: GmailAccount;
|
||||
email?: GmailMessage;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ interface GmailMessage {
|
|||
document_id: number;
|
||||
}
|
||||
|
||||
interface GmailUpdateDraftContext {
|
||||
type GmailUpdateDraftContext = {
|
||||
account?: GmailAccount;
|
||||
email?: GmailMessage;
|
||||
draft_id?: string;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ interface CalendarEntry {
|
|||
primary?: boolean;
|
||||
}
|
||||
|
||||
interface CalendarCreateEventContext {
|
||||
type CalendarCreateEventContext = {
|
||||
accounts?: GoogleCalendarAccount[];
|
||||
calendars?: CalendarEntry[];
|
||||
timezone?: string;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ interface CalendarEvent {
|
|||
indexed_at?: string;
|
||||
}
|
||||
|
||||
interface CalendarDeleteEventContext {
|
||||
type CalendarDeleteEventContext = {
|
||||
account?: GoogleCalendarAccount;
|
||||
event?: CalendarEvent;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ interface CalendarEvent {
|
|||
indexed_at?: string;
|
||||
}
|
||||
|
||||
interface CalendarUpdateEventContext {
|
||||
type CalendarUpdateEventContext = {
|
||||
account?: GoogleCalendarAccount;
|
||||
event?: CalendarEvent;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ interface GoogleDriveAccount {
|
|||
auth_expired?: boolean;
|
||||
}
|
||||
|
||||
interface DriveCreateFileContext {
|
||||
type DriveCreateFileContext = {
|
||||
accounts?: GoogleDriveAccount[];
|
||||
supported_types?: string[];
|
||||
parent_folders?: Record<number, Array<{ folder_id: string; name: string }>>;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ interface GoogleDriveFile {
|
|||
web_view_link: string;
|
||||
}
|
||||
|
||||
interface DriveTrashFileContext {
|
||||
type DriveTrashFileContext = {
|
||||
account?: GoogleDriveAccount;
|
||||
file?: GoogleDriveFile;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ interface JiraPriority {
|
|||
name: string;
|
||||
}
|
||||
|
||||
interface CreateJiraIssueInterruptContext {
|
||||
type CreateJiraIssueInterruptContext = {
|
||||
accounts?: JiraAccount[];
|
||||
projects?: JiraProject[];
|
||||
issue_types?: JiraIssueType[];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ interface JiraIssue {
|
|||
document_id?: number;
|
||||
}
|
||||
|
||||
interface DeleteJiraIssueInterruptContext {
|
||||
type DeleteJiraIssueInterruptContext = {
|
||||
account?: JiraAccount;
|
||||
issue?: JiraIssue;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ interface JiraPriority {
|
|||
name: string;
|
||||
}
|
||||
|
||||
interface UpdateJiraIssueInterruptContext {
|
||||
type UpdateJiraIssueInterruptContext = {
|
||||
account?: JiraAccount;
|
||||
issue?: JiraIssue;
|
||||
priorities?: JiraPriority[];
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ interface LinearWorkspace {
|
|||
auth_expired?: boolean;
|
||||
}
|
||||
|
||||
interface LinearCreateIssueContext {
|
||||
type LinearCreateIssueContext = {
|
||||
workspaces?: LinearWorkspace[];
|
||||
error?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
|
|||
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
|
||||
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
|
||||
|
||||
interface LinearDeleteIssueContext {
|
||||
type LinearDeleteIssueContext = {
|
||||
workspace?: { id: number; organization_name: string };
|
||||
issue?: {
|
||||
id: string;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ interface LinearPriority {
|
|||
label: string;
|
||||
}
|
||||
|
||||
interface LinearUpdateIssueContext {
|
||||
type LinearUpdateIssueContext = {
|
||||
workspace?: { id: number; organization_name: string };
|
||||
priorities?: LinearPriority[];
|
||||
issue?: {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
|
|||
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
|
||||
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
|
||||
|
||||
interface NotionCreatePageContext {
|
||||
type NotionCreatePageContext = {
|
||||
accounts?: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
|
|||
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
|
||||
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
|
||||
|
||||
interface NotionDeletePageContext {
|
||||
type NotionDeletePageContext = {
|
||||
account?: {
|
||||
id: number;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
|
|||
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
|
||||
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
|
||||
|
||||
interface NotionUpdatePageContext {
|
||||
type NotionUpdatePageContext = {
|
||||
account?: {
|
||||
id: number;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ interface OneDriveAccount {
|
|||
auth_expired?: boolean;
|
||||
}
|
||||
|
||||
interface OneDriveCreateFileContext {
|
||||
type OneDriveCreateFileContext = {
|
||||
accounts?: OneDriveAccount[];
|
||||
parent_folders?: Record<number, Array<{ folder_id: string; name: string }>>;
|
||||
error?: string;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ interface OneDriveFile {
|
|||
web_url?: string;
|
||||
}
|
||||
|
||||
interface OneDriveTrashFileContext {
|
||||
type OneDriveTrashFileContext = {
|
||||
account?: OneDriveAccount;
|
||||
file?: OneDriveFile;
|
||||
error?: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue