import { type PersonalGitHubRepository as PersonalGitHubRepositoryContract, type PersonalGitHubRepositorySelectionInput } from "@opengeni/contracts/personal-github"; import { type GitHubRepositoryBranchesResponse as GitHubRepositoryBranchesResponseContract, type ListGitHubRepositoryBranchesQuery } from "@opengeni/contracts/github-repository-contracts"; import type { ApiRouteDeps } from "@opengeni/core"; import { getConnectionMetadata, type PersonalGitHubRepositorySelectionState as DbPersonalGitHubRepositorySelectionState } from "@opengeni/db"; import { HTTPException } from "hono/http-exception"; export type PersonalGitHubRepositoryConnection = NonNullable>>; type PersonalGitHubRepositoryProviderOperation = "repositories_list" | "repository_branches_list" | "repository_verify"; type ExpectedPersonalGitHubRepositoryAuthority = { selectionGeneration: number; repositoryId: string; fullName: string; }; type PersonalGitHubProviderJsonOptions = { operation: PersonalGitHubRepositoryProviderOperation; expectedRepositoryAuthority?: ExpectedPersonalGitHubRepositoryAuthority; responseLabel?: string; responseMaxBytes?: number; }; export type PersonalGitHubRepositoryBranchServices = { requireConnection: typeof requirePersonalGitHubRepositoryConnection; getSelectionState: (deps: ApiRouteDeps, input: { accountId: string; originWorkspaceId: string; subjectId: string; connectionId: string; }) => Promise; providerJson: (input: { deps: ApiRouteDeps; connection: PersonalGitHubRepositoryConnection; subjectId: string; url: URL; expectedConnectionAuthorityGeneration: number; options: PersonalGitHubProviderJsonOptions; }) => Promise; }; export type PersonalGitHubRepositoryProviderErrorCode = "connection_changed" | "connection_inactive" | "invalid_provider_response" | "provider_denied" | "provider_rate_limited" | "provider_unavailable" | "repository_archived" | "repository_not_found" | "repository_not_selected" | "repository_read_denied" | "repository_selection_changed" | "repository_write_denied"; export declare class PersonalGitHubRepositoryProviderError extends Error { readonly code: PersonalGitHubRepositoryProviderErrorCode; constructor(code: PersonalGitHubRepositoryProviderErrorCode); } export declare function requirePersonalGitHubRepositoryConnection(deps: ApiRouteDeps, input: { accountId: string; workspaceId: string; subjectId: string; connectionId: string; }): Promise; export declare function listLivePersonalGitHubRepositories(deps: ApiRouteDeps, input: { workspaceId: string; accountId: string; subjectId: string; connectionId: string; expectedConnectionAuthorityGeneration: number; page: number; limit: number; }): Promise<{ repositories: PersonalGitHubRepositoryContract[]; nextPage: number | null; }>; export declare function listLivePersonalGitHubRepositoryBranches(deps: ApiRouteDeps, input: { workspaceId: string; accountId: string; subjectId: string; connectionId: string; repositoryId: string; query: ListGitHubRepositoryBranchesQuery; }, services?: PersonalGitHubRepositoryBranchServices): Promise; /** Serial by design: one bounded provider request and one authority check at a time. */ export declare function verifyLivePersonalGitHubRepositories(deps: ApiRouteDeps, input: { workspaceId: string; accountId: string; subjectId: string; connectionId: string; expectedConnectionAuthorityGeneration: number; repositories: PersonalGitHubRepositorySelectionInput[]; }): Promise>; export declare function personalGitHubRepositoryProviderHttpError(error: PersonalGitHubRepositoryProviderError): HTTPException; /** Keep provider integer lexemes exact before repository IDs become bigint-backed strings. */ export declare function parsePersonalGitHubProviderJson(value: string): unknown; export declare function personalGitHubRepositoryCanRead(permissions: PersonalGitHubRepositoryContract["permissions"]): boolean; export declare function personalGitHubRepositoryCanWrite(permissions: PersonalGitHubRepositoryContract["permissions"]): boolean; export declare function parsePersonalGitHubRepository(value: unknown): PersonalGitHubRepositoryContract; export {};