import { FirebaseApp } from 'firebase/app'; import { CueAuth } from './auth'; import { CreateProjectOptions, CueEndpoints, ProjectData } from './models'; import { ReadonlySignal } from './signal'; type ProjectRole = 'admin' | 'syncer' | 'member'; export declare class CueProjects { private readonly _auth; private readonly _db; private readonly _functions; private readonly _gatewayUrl; private readonly _projects; /** * Live cache of the current user's projects, refreshed on every `listProjects()` * call and patched in place by `getProject()` — lets consumers reflect changes * without every caller having to remember to re-fetch the whole list. */ readonly projects: ReadonlySignal; constructor(_auth: CueAuth, app: FirebaseApp, useEmulator?: boolean, endpoints?: CueEndpoints); /** * Create a new project. The authenticated user is automatically set as admin, syncer, and member. * Throws if a project with the given ID already exists. */ createProject(options: CreateProjectOptions): Promise; /** List all projects where the authenticated user appears in the members array. */ listProjects(): Promise; /** Fetch a single project by ID. Returns null if not found or user lacks access. */ getProject(projectId: string): Promise; /** * Merges a freshly-fetched project into the live `projects` signal, replacing * the entry with matching `id`. Skipped if the signal hasn't been populated by * `listProjects()` yet — patching into an unknown/partial list would make a * single project look like the user's entire project set. */ private _patchProject; /** * Atomically increments `unitsConsumed` on the top-level `clientSync/{projectId}` * document, creating it if it doesn't exist. Intended for pre-flight checks. */ incrementUnitsConsumed(projectId: string, units: number, userId: string): Promise; /** * Invite a user to a project by email. Returns the invited user's uid and display name. */ inviteUserToProject(email: string, projectId: string, role: ProjectRole): Promise<{ uid: string; name?: string; }>; /** Change an existing member's role on a project. */ changeUserRoleOnProject(uid: string, projectId: string, role: ProjectRole): Promise; /** Remove a member from a project. */ removeUserFromProject(uid: string, projectId: string): Promise; /** * Delete a project by ID. Requires superadmin privileges on the server. */ deleteProject(projectId: string): Promise; } export {};