import type { Sync, SyncWithConnectionId, 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; export declare const createSync: (nangoConnectionId: number, syncConfig: SyncConfig) => Promise; export declare const getLastSyncDate: (id: string) => Promise; export declare const clearLastSyncDate: (id: string) => Promise; export declare function setFrequency(id: string, frequency: string | null): Promise; /** * Set Last Sync Date */ export declare const setLastSyncDate: (id: string, date: Date) => Promise; /** * 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; export declare const getSyncByIdAndName: (nangoConnectionId: number, name: string) => Promise; /** * 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; models: string[]; })[]>; export declare const getSyncsByConnectionId: (nangoConnectionId: number) => Promise; export declare const getSyncsByProviderConfigKey: (environment_id: number, providerConfigKey: string) => Promise; export declare const getSyncsByProviderConfigAndSyncName: (environment_id: number, providerConfigKey: string, syncName: string) => Promise; export declare const getSyncNamesByConnectionId: (nangoConnectionId: number) => Promise; export declare const getSyncsByProviderConfigAndSyncNames: (environment_id: number, providerConfigKey: string, syncNames: string[]) => Promise; /** * 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; export declare const isSyncValid: (connection_id: string, provider_config_key: string, environment_id: number, sync_id: string) => Promise; export declare const softDeleteSync: (syncId: string) => Promise; export declare const findSyncByConnections: (connectionIds: number[], sync_name: string) => Promise; export declare const getSyncsBySyncConfigId: (environmentId: number, syncConfigId: number) => Promise; 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; export declare function findRecentlyDeletedSync(): Promise<{ id: string; environmentId: number; connectionId: number; models: string[]; }[]>; export declare function trackFetch(nango_connection_id: number): Promise;