import type { ControlPlaneStore, JsonValue } from '../control-plane';
import type { SourceBinding, SourceConnection, SourceConnectionStoreOptions, SourceCredential, SourceDeployKey, SourceProvider, SourceRepository, SourceWebhook, SourceWebhookDelivery } from './types';
export declare class SourceConnectionStore {
    private readonly controlPlane;
    private readonly key?;
    private readonly nowFn;
    private readonly idFn;
    constructor(controlPlane: ControlPlaneStore, options?: SourceConnectionStoreOptions);
    private now;
    private run;
    private encrypt;
    private decrypt;
    createConnection(input: {
        organizationId: string;
        provider: SourceProvider;
        name: string;
        host: string;
        owner?: string;
        authKind?: SourceConnection['authKind'];
        credential?: SourceCredential;
        grantedScopes?: string[];
        credentialExpiresAt?: string;
        createdByActorId?: string;
    }): SourceConnection;
    getConnection(id: string): SourceConnection | undefined;
    listConnections(organizationId: string): SourceConnection[];
    private currentConnection;
    getCredential(id: string): SourceCredential | undefined;
    rotateCredential(id: string, credential: SourceCredential, input?: {
        expiresAt?: string;
        actorId?: string;
    }): SourceConnection;
    updateHealth(id: string, input: {
        status: 'healthy' | 'degraded' | 'expired';
        message?: string;
        tested?: boolean;
        synced?: boolean;
        grantedScopes?: string[];
    }): SourceConnection;
    upsertRepository(input: Omit<SourceRepository, 'id' | 'syncedAt'>): SourceRepository;
    listRepositories(connectionId: string, search?: string, limit?: number): SourceRepository[];
    getRepository(id: string): SourceRepository | undefined;
    createDeployKey(input: {
        connectionId: string;
        name: string;
        publicKey: string;
        privateKey: string;
        host: string;
        hostKey: string;
        actorId?: string;
    }): SourceDeployKey;
    getDeployKey(id: string): SourceDeployKey | undefined;
    listDeployKeys(connectionId: string): SourceDeployKey[];
    revokeDeployKey(id: string, actorId?: string): {
        affectedBindings: SourceBinding[];
    };
    getDeployPrivateKey(id: string): string;
    createBinding(input: {
        projectId: string;
        environmentId?: string;
        resourceId?: string;
        connectionId: string;
        repositoryId?: string;
        repositoryFullName: string;
        defaultBranch?: string;
        branchRule?: string;
        tagRule?: string;
        monorepoRoot?: string;
        includePaths?: string[];
        excludePaths?: string[];
        submodules?: boolean;
        cloneDepth?: number;
        deployKeyId?: string;
        autoDeploy?: boolean;
        pullRequestPreviews?: boolean;
        actorId?: string;
    }): SourceBinding;
    getBinding(id: string): SourceBinding | undefined;
    listBindings(input?: {
        connectionId?: string;
        projectId?: string;
        status?: SourceBinding['status'];
    }): SourceBinding[];
    updateBinding(id: string, expectedVersion: number, input: {
        defaultBranch?: string;
        branchRule?: string;
        tagRule?: string;
        monorepoRoot?: string;
        includePaths?: string[];
        excludePaths?: string[];
        submodules?: boolean;
        cloneDepth?: number | null;
        deployKeyId?: string | null;
        autoDeploy?: boolean;
        pullRequestPreviews?: boolean;
        status?: SourceBinding['status'];
        disabledReason?: string;
        actorId?: string;
    }): SourceBinding;
    createWebhook(input: {
        connectionId: string;
        repositoryId?: string;
        repositoryFullName: string;
        events?: string[];
        endpointToken?: string;
        secret?: string;
    }): {
        webhook: SourceWebhook;
        secret: string;
    };
    getWebhook(id: string): SourceWebhook | undefined;
    getWebhookByEndpointToken(endpointToken: string): SourceWebhook | undefined;
    getWebhookSecret(id: string): string;
    getWebhookEndpointToken(id: string): string;
    listWebhooks(connectionId: string): SourceWebhook[];
    updateWebhookState(id: string, input: {
        providerWebhookId?: string;
        status: SourceWebhook['status'];
        healthMessage?: string;
        reconciled?: boolean;
    }): SourceWebhook;
    getDeliveryByProviderId(connectionId: string, providerDeliveryId: string): SourceWebhookDelivery | undefined;
    recordDelivery(input: {
        connectionId: string;
        webhookId: string;
        providerDeliveryId: string;
        event: string;
        action?: string;
        commitSha?: string;
        signatureStatus: SourceWebhookDelivery['signatureStatus'];
        status: SourceWebhookDelivery['status'];
        payloadSummary?: JsonValue;
        operationId?: string;
        error?: string;
    }): {
        delivery: SourceWebhookDelivery;
        duplicate: boolean;
    };
    updateDelivery(id: string, input: {
        status: SourceWebhookDelivery['status'];
        operationId?: string;
        error?: string;
    }): SourceWebhookDelivery;
    listDeliveries(webhookId: string, limit?: number): SourceWebhookDelivery[];
    disconnectConnection(id: string, actorId?: string): {
        connection: SourceConnection;
        affectedBindings: SourceBinding[];
    };
}
