import type { IntegrationStorageHandle, IntegrationSubscription } from '../../storage/domains/integrations/base.js'; export type GitLabSignalSubscriptionSource = 'auto-create-change-request' | 'explicit-tool'; export type GitLabSignalSubscriptionStatus = 'open' | 'closed' | 'merged'; export interface GitLabSignalSubscriptionData { /** Normalized GitLab instance host. */ host: string; /** Immutable numeric GitLab project id, as stored on the repository row. */ projectId: string; /** Project `path_with_namespace`, used for links and summaries. */ projectPath: string; projectRepositoryId: string; /** The stored connection id of the installation the link was created under. */ installationExternalId: string; /** Merge request IID. */ changeRequestId: string; ownerId: string; source: GitLabSignalSubscriptionSource; subscribedByUserId: string | null; } export type GitLabSignalSubscriptionRow = IntegrationSubscription; export type GitLabSubscriptionStorage = IntegrationStorageHandle, Record, GitLabSignalSubscriptionData>; export interface SubscribeToMergeRequestInput { orgId: string; host: string; projectId: string; projectPath: string; projectRepositoryId: string; installationExternalId: string; changeRequestId: string; sessionId: string; ownerId: string; resourceId: string; threadId: string; sessionScope?: string; source: GitLabSignalSubscriptionSource; subscribedByUserId?: string; } export interface GitLabThreadSubscriptionTarget { orgId: string; resourceId: string; threadId: string; sessionScope?: string; } export interface MergeRequestSubscriptionTarget { orgId: string; host: string; projectId: string; changeRequestId: string; } export type GitLabWebhookMergeRequestTarget = Omit; export declare function normalizeSubscriptionHost(host: string): string; export declare function mergeRequestTargetKey(input: GitLabWebhookMergeRequestTarget): string; export declare function mergeRequestUrl(host: string, projectPath: string, changeRequestId: string | number): string; export declare function subscribeToMergeRequest(input: SubscribeToMergeRequestInput, storage: GitLabSubscriptionStorage): Promise; export declare function unsubscribeFromMergeRequest(input: SubscribeToMergeRequestInput, storage: GitLabSubscriptionStorage): Promise; export declare function listMergeRequestSubscriptionsForThread(input: GitLabThreadSubscriptionTarget, storage: GitLabSubscriptionStorage): Promise; export declare function listMergeRequestSubscriptions(input: MergeRequestSubscriptionTarget, storage: GitLabSubscriptionStorage): Promise; export declare function listMergeRequestSubscriptionsForWebhook(input: GitLabWebhookMergeRequestTarget, options: { includeTerminal?: boolean; } | undefined, storage: GitLabSubscriptionStorage): Promise; export declare function retireMergeRequestSubscription(id: string, status: GitLabSignalSubscriptionStatus, storage: GitLabSubscriptionStorage): Promise; /** * Retire every open subscription for a merge request that reached a terminal * state outside the webhook path (the reconcile sweep), so the thread's MR chip * and the workspace row do not stay `open` on a deployment GitLab cannot reach. */ export declare function retireMergeRequestSubscriptions(input: GitLabWebhookMergeRequestTarget & { merged: boolean; }, storage: GitLabSubscriptionStorage): Promise; //# sourceMappingURL=subscriptions.d.ts.map