import type { LogContext, LogContextGetter } from '@nangohq/logs'; import type { Result } from '@nangohq/utils'; import { NangoError } from '../utils/error.js'; import type { NangoConnection } from '../models/Connection.js'; import type { Config as ProviderConfig } from '../models/Provider.js'; import type { ExecuteReturn, ExecuteActionProps, ExecuteWebhookProps, ExecuteOnEventProps, ExecuteSyncProps, VoidReturn, OrchestratorTask, RecurringProps, SchedulesReturn, OrchestratorSchedule } from '@nangohq/nango-orchestrator'; import type { NangoIntegrationData, Sync, SyncConfig } from '../models/index.js'; import { SyncCommand } from '../models/index.js'; import type { DBEnvironment, DBTeam } from '@nangohq/types'; import type { RecordCount } from '@nangohq/records'; export interface RecordsServiceInterface { deleteRecordsBySyncId({ connectionId, environmentId, model, syncId }: { connectionId: number; environmentId: number; model: string; syncId: string; }): Promise<{ totalDeletedRecords: number; }>; getRecordCountsByModel({ connectionId, environmentId }: { connectionId: number; environmentId: number; }): Promise>>; } export interface OrchestratorClientInterface { recurring(props: RecurringProps): Promise>; executeAction(props: ExecuteActionProps): Promise; executeWebhook(props: ExecuteWebhookProps): Promise; executeOnEvent(props: ExecuteOnEventProps): Promise; executeSync(props: ExecuteSyncProps): Promise; pauseSync({ scheduleName }: { scheduleName: string; }): Promise; unpauseSync({ scheduleName }: { scheduleName: string; }): Promise; deleteSync({ scheduleName }: { scheduleName: string; }): Promise; updateSyncFrequency({ scheduleName, frequencyMs }: { scheduleName: string; frequencyMs: number; }): Promise; cancel({ taskId, reason }: { taskId: string; reason: string; }): Promise>; searchSchedules({ scheduleNames, limit }: { scheduleNames: string[]; limit: number; }): Promise; } export declare class Orchestrator { private client; constructor(client: OrchestratorClientInterface); searchSchedules(props: { syncId: string; environmentId: number; }[]): Promise>>; triggerAction({ connection, actionName, input, logCtx }: { connection: NangoConnection; actionName: string; input: object; logCtx: LogContext; }): Promise>; triggerWebhook({ account, environment, integration, connection, webhookName, syncConfig, input, logContextGetter }: { account: DBTeam; environment: DBEnvironment; integration: ProviderConfig; connection: NangoConnection; webhookName: string; syncConfig: SyncConfig; input: object; logContextGetter: LogContextGetter; }): Promise>; triggerOnEventScript({ connection, version, name, fileLocation, logCtx }: { connection: NangoConnection; version: string; name: string; fileLocation: string; logCtx: LogContext; }): Promise>; updateSyncFrequency({ syncId, interval, syncName, environmentId, logCtx }: { syncId: string; interval: string; syncName: string; environmentId: number; logCtx?: LogContext; }): Promise>; runSyncCommand({ connectionId, syncId, command, environmentId, logCtx, recordsService, initiator, delete_records }: { connectionId: number; syncId: string; command: SyncCommand; environmentId: number; logCtx: LogContext; recordsService: RecordsServiceInterface; initiator: string; delete_records?: boolean; }): Promise>; deleteSync({ syncId, environmentId }: { syncId: string; environmentId: number; }): Promise>; scheduleSync({ nangoConnection, sync, providerConfig, syncName, syncData, logContextGetter, debug }: { nangoConnection: NangoConnection; sync: Sync; providerConfig: ProviderConfig; syncName: string; syncData: NangoIntegrationData; logContextGetter: LogContextGetter; debug?: boolean; }): Promise>; private getFrequencyMs; }