import type { Sync, SyncConfig } from '../../models/Sync.js';
import { SyncStatus } from '../../models/Sync.js';
import type { Connection } from '../../models/Connection.js';
import type { ActiveLog, IncomingFlowConfig, SyncAndActionDifferences, SyncTypeLiteral } from '@nangohq/types';
import type { LogContext, LogContextGetter } from '@nangohq/logs';
import type { Orchestrator } from '../../clients/orchestrator.js';
/**
 * Sync Service
 * @description
 *  A Sync is active Nango Sync on the connection level that has:
 *  - collection of sync jobs (initial or incremental)
 *  - sync schedule
 *  - bunch of sync data records
 *
 *  A Sync config is a separate entity that is not necessarily active on the
 *  provider level that has no direction to a sync
 *  A Sync job can connect a sync and a sync config as it has both a `sync_id`
 * and `sync_config_id`
 *
 */
export declare const getById: (id: string) => Promise<Sync | null>;
export declare const createSync: (nangoConnectionId: number, syncConfig: SyncConfig) => Promise<Sync | null>;
export declare const getLastSyncDate: (id: string) => Promise<Date | null>;
export declare const clearLastSyncDate: (id: string) => Promise<void>;
export declare function setFrequency(id: string, frequency: string | null): Promise<void>;
/**
 * Set Last Sync Date
 */
export declare const setLastSyncDate: (id: string, date: Date) => Promise<boolean>;
/**
 * Get Last Sync Date
 * @desc this is the very end of the sync process so we know when the sync job
 * is completely finished
 */
export declare const getJobLastSyncDate: (sync_id: string) => Promise<Date | null>;
export declare const getSyncByIdAndName: (nangoConnectionId: number, name: string) => Promise<Sync | null>;
/**
 * Get Syncs
 * @description get the sync related to the connection
 * the latest sync and its result and the next sync based on the schedule
 */
export declare const getSyncs: (nangoConnection: Connection, orchestrator: Orchestrator) => Promise<(Sync & {
    sync_type: SyncTypeLiteral;
    status: SyncStatus;
    active_logs: Pick<ActiveLog, 'log_id'>;
    models: string[];
})[]>;
export declare const getSyncsByConnectionId: (nangoConnectionId: number) => Promise<Sync[] | null>;
type SyncWithConnectionId = Sync & {
    connection_id: string;
};
export declare const getSyncsByProviderConfigKey: (environment_id: number, providerConfigKey: string) => Promise<SyncWithConnectionId[]>;
export declare const getSyncsByProviderConfigAndSyncName: (environment_id: number, providerConfigKey: string, syncName: string) => Promise<Sync[]>;
export declare const getSyncNamesByConnectionId: (nangoConnectionId: number) => Promise<string[]>;
export declare const getSyncsByProviderConfigAndSyncNames: (environment_id: number, providerConfigKey: string, syncNames: string[]) => Promise<Sync[]>;
/**
 * Verify Ownership
 * @desc verify that the incoming account id matches with the provided nango connection id
 */
export declare const verifyOwnership: (nangoConnectionId: number, environment_id: number, syncId: string) => Promise<boolean>;
export declare const isSyncValid: (connection_id: string, provider_config_key: string, environment_id: number, sync_id: string) => Promise<boolean>;
export declare const softDeleteSync: (syncId: string) => Promise<string>;
export declare const findSyncByConnections: (connectionIds: number[], sync_name: string) => Promise<Sync[]>;
export declare const getSyncsBySyncConfigId: (environmentId: number, syncConfigId: number) => Promise<Sync[]>;
export declare const getAndReconcileDifferences: ({ environmentId, flows, performAction, debug, singleDeployMode, logCtx, logContextGetter, orchestrator }: {
    environmentId: number;
    flows: IncomingFlowConfig[];
    performAction: boolean;
    debug?: boolean | undefined;
    singleDeployMode?: boolean | undefined;
    logCtx?: LogContext;
    logContextGetter: LogContextGetter;
    orchestrator: Orchestrator;
}) => Promise<SyncAndActionDifferences | null>;
export declare function findRecentlyDeletedSync(): Promise<{
    id: string;
    environmentId: number;
    connectionId: number;
    models: string[];
}[]>;
export declare function trackFetch(nango_connection_id: number): Promise<void>;
export {};
