import type { AppendEventInput, AuthorizationGrant, AuthorizationScope, AuthorizationTarget, CompactResult, ControlPlaneActor, ControlPlaneEnvironment, ControlPlaneEvent, ControlPlaneHealth, ControlPlaneOperation, ControlPlaneOrganization, ControlPlaneProject, ControlPlaneResource, ControlPlaneSnapshot, ControlPlaneStoreOptions, ControlPlaneTag, CreateActorInput, CreateEnvironmentInput, CreateGrantInput, CreateInvitationInput, CreateMembershipInput, CreateOperationInput, CreateOrganizationInput, CreateProjectInput, CreateResourceInput, EventListOptions, ImportSnapshotOptions, JsonValue, NavigationPreference, OperationListOptions, OrganizationInvitation, OrganizationMembership, ReconcileResult, SavedFilter, TransitionOperationInput, UpdateProjectInput, UpdateResourceInput } from './types';
import { Database } from 'bun:sqlite';
/** Project-relative location of the control-plane database. */
export declare function controlPlaneDatabaseFile(): string;
export declare const MAX_CONTROL_PLANE_JSON_BYTES: number;
export declare const MAX_CONTROL_PLANE_ERROR_BYTES: number;
export declare function sanitizeControlPlaneValue(value: unknown, maxBytes?: number): JsonValue;
export declare class ControlPlaneStore {
    readonly path: string;
    readonly database: Database;
    private readonly nowFn;
    private readonly idFn;
    constructor(options?: ControlPlaneStoreOptions);
    private now;
    private secureDatabaseFiles;
    private migrate;
    close(): void;
    transaction<T>(callback: () => T): T;
    createProject(input: CreateProjectInput): ControlPlaneProject;
    getProject(id: string): ControlPlaneProject | undefined;
    getProjectBySlug(slug: string): ControlPlaneProject | undefined;
    listProjects(): ControlPlaneProject[];
    updateProject(id: string, expectedVersion: number, input: UpdateProjectInput): ControlPlaneProject;
    createEnvironment(input: CreateEnvironmentInput): ControlPlaneEnvironment;
    listEnvironments(projectId: string): ControlPlaneEnvironment[];
    getEnvironmentBySlug(projectId: string, slug: string): ControlPlaneEnvironment | undefined;
    createResource(input: CreateResourceInput): ControlPlaneResource;
    listResources(projectId: string, environmentId?: string): ControlPlaneResource[];
    getResource(id: string): ControlPlaneResource | undefined;
    updateResource(id: string, expectedVersion: number, input: UpdateResourceInput): ControlPlaneResource;
    createActor(input: CreateActorInput): ControlPlaneActor;
    getActorByExternalId(kind: ControlPlaneActor['kind'], externalId: string): ControlPlaneActor | undefined;
    getActor(id: string): ControlPlaneActor | undefined;
    createOrganization(input: CreateOrganizationInput): ControlPlaneOrganization;
    getOrganization(id: string): ControlPlaneOrganization | undefined;
    getOrganizationBySlug(slug: string): ControlPlaneOrganization | undefined;
    listOrganizations(actorId?: string): ControlPlaneOrganization[];
    private normalizeAuthorizationScope;
    resolveAuthorizationTarget(organizationId: string, scope: AuthorizationScope): AuthorizationTarget | undefined;
    createMembership(input: CreateMembershipInput): OrganizationMembership;
    getMembership(id: string): OrganizationMembership | undefined;
    getMembershipForActor(organizationId: string, actorId: string): OrganizationMembership | undefined;
    listMemberships(organizationId: string, options?: {
        includeRevoked?: boolean;
    }): OrganizationMembership[];
    updateMembership(input: {
        id: string;
        roleTemplate: OrganizationMembership['roleTemplate'];
        scope?: AuthorizationScope;
        actorId?: string;
    }): OrganizationMembership;
    revokeMembership(id: string, actorId?: string): OrganizationMembership;
    touchMembership(id: string): OrganizationMembership;
    private assertAnotherOwner;
    createInvitation(input: CreateInvitationInput): {
        invitation: OrganizationInvitation;
        token: string;
    };
    getInvitation(id: string): OrganizationInvitation | undefined;
    listInvitations(organizationId: string): OrganizationInvitation[];
    /** Resolve a bearer invitation without exposing its stored hash. */
    inspectInvitationToken(token: string): OrganizationInvitation | undefined;
    acceptInvitation(token: string, actorId: string): {
        invitation: OrganizationInvitation;
        membership: OrganizationMembership;
    };
    revokeInvitation(id: string, actorId?: string): OrganizationInvitation;
    reissueInvitation(id: string, actorId?: string): {
        invitation: OrganizationInvitation;
        token: string;
    };
    upsertGrant(input: CreateGrantInput): AuthorizationGrant;
    getGrant(id: string): AuthorizationGrant | undefined;
    listGrants(membershipId: string): AuthorizationGrant[];
    removeGrant(id: string, actorId?: string): boolean;
    createOperation(input: CreateOperationInput): ControlPlaneOperation;
    getOperation(id: string): ControlPlaneOperation | undefined;
    listOperations(options?: OperationListOptions): ControlPlaneOperation[];
    claimNextOperation(workerId: string, leaseMs?: number, kinds?: readonly string[]): ControlPlaneOperation | undefined;
    claimOperation(id: string, workerId: string, leaseMs?: number): ControlPlaneOperation | undefined;
    transitionOperation(id: string, input: TransitionOperationInput): ControlPlaneOperation;
    requestCancellation(id: string): ControlPlaneOperation;
    reconcileOrphanedOperations(options?: {
        policy?: 'requeue' | 'fail';
        now?: Date;
    }): ReconcileResult;
    appendEvent(input: AppendEventInput): ControlPlaneEvent;
    listEvents(options?: EventListOptions): ControlPlaneEvent[];
    setSetting(key: string, value: JsonValue): void;
    getSetting(key: string): JsonValue | undefined;
    upsertTag(projectId: string, name: string, color?: string): ControlPlaneTag;
    listTags(projectId: string): ControlPlaneTag[];
    assignTag(resourceId: string, tagId: string): void;
    removeTag(resourceId: string, tagId: string): void;
    listResourceTags(projectId: string): Array<{
        resourceId: string;
        tag: ControlPlaneTag;
    }>;
    saveFilter(actorKey: string, name: string, routeId: string, query: Record<string, JsonValue>): SavedFilter;
    listSavedFilters(actorKey: string): SavedFilter[];
    deleteSavedFilter(actorKey: string, id: string): boolean;
    recordNavigation(actorKey: string, entityType: string, entityId: string): NavigationPreference;
    setFavorite(actorKey: string, entityType: string, entityId: string, favorite: boolean): NavigationPreference;
    listNavigation(actorKey: string, options?: {
        favoritesOnly?: boolean;
        limit?: number;
    }): NavigationPreference[];
    compact(options?: {
        eventRetentionDays?: number;
        operationRetentionDays?: number;
        vacuum?: boolean;
    }): CompactResult;
    createBackup(reason?: string): string;
    integrityCheck(): 'ok' | 'corrupt';
    health(): ControlPlaneHealth;
    exportSnapshot(): ControlPlaneSnapshot;
    importSnapshot(snapshot: ControlPlaneSnapshot, options?: ImportSnapshotOptions): void;
}
