import { type DbExec, type DbExecStatement } from "../db/client.js"; export type AutomationSharingVisibility = "private" | "organization"; export type AutomationSharingGrantRole = "view" | "collaborate"; export interface AutomationSharingGrantInput { email: string; role: AutomationSharingGrantRole; } export type CompleteAutomationSharingState = { kind: "personal"; } | { kind: "organization"; organizationId: string; } | { kind: "specific"; organizationId?: string | null; grants: readonly AutomationSharingGrantInput[]; }; export interface AutomationSharingOverlayRow { resourceId: string; visibility: AutomationSharingVisibility; organizationId: string | null; createdAt: number; updatedAt: number; } export interface AutomationSharingGrantRow { resourceId: string; email: string; role: AutomationSharingGrantRole; createdAt: number; updatedAt: number; } export interface AutomationMutationGuard { sql: string; args: readonly unknown[]; } export interface PreparedAutomationSharingMutation { statements: DbExecStatement[]; summary?: AutomationSharingSummary; } export type AutomationSharingSummary = { resourceId: string; kind: "personal"; visibility: "private"; organizationId: null; grants: []; } | { resourceId: string; kind: "organization"; visibility: "organization"; organizationId: string; grants: []; } | { resourceId: string; kind: "specific"; visibility: "private"; organizationId: string | null; grants: AutomationSharingGrantRow[]; }; export declare const automationSharingStore: import("../db/store-registry.js").Store; export declare function normalizeAutomationSharingEmail(email: string): string; export declare function ensureAutomationSharingTables(): Promise; export declare function loadAutomationSharingOverlays(resourceIds: readonly string[], client?: DbExec): Promise>; export declare function loadAutomationSharingGrants(resourceIds: readonly string[], client?: DbExec): Promise>; export declare function loadAutomationSharingStates(resourceIds: readonly string[], client?: DbExec): Promise>; export declare function getAutomationSharingState(resourceId: string, client?: DbExec): Promise; export declare function prepareAutomationSharingReplacement(resourceId: string, input: CompleteAutomationSharingState, options?: { now?: number; guard?: AutomationMutationGuard; }): { statements: DbExecStatement[]; summary: AutomationSharingSummary; }; export declare function replaceAutomationSharingStateWithDb(client: DbExec, resourceId: string, input: CompleteAutomationSharingState): Promise; export declare function prepareAutomationSharingDelete(resourceId: string, guard?: AutomationMutationGuard): PreparedAutomationSharingMutation; export declare function deleteAutomationSharingStateWithDb(client: DbExec, resourceId: string): Promise; export declare function replaceAutomationSharingState(resourceId: string, input: CompleteAutomationSharingState): Promise; export declare function __resetAutomationSharingStoreForTests(): void;