/** * Import staging: validating an uploaded archive before any of it reaches the live data * directory, and serialising concurrent imports of the same database. */ /** Thrown when an upload is not a genuine AxioDB export. Callers answer 400. */ export declare class InvalidExportError extends Error { constructor(message: string); } /** Thrown when the same database is already present or already being imported. Answer 409. */ export declare class ImportConflictError extends Error { constructor(message: string); } /** * Confirms that a staged directory holds one AxioDB database export, and returns its name. * * The database name comes from the archive's own contents, never from the uploaded * filename - two people can export the same database and rename the file to anything, so * the filename says nothing about what is inside. * * `tarGzFolder` archives `{root}/{dbName}`, so a genuine export is exactly one top-level * directory containing recognisable AxioDB artefacts. * * @param stagingDir - Directory the archive was extracted into. * @returns The database name the archive contains. * @throws {InvalidExportError} When the contents are not an AxioDB export. */ export declare function readExportedDatabaseName(stagingDir: string): string; /** * Claims the right to import `databaseName`. * * @param databaseName - Name read from the archive's contents. * @param username - Who is importing, so a clash can name them. * @throws {ImportConflictError} When another import of the same database is in flight. */ export declare function claimImport(databaseName: string, username: string): void; /** Releases the claim. Always call from a `finally`. */ export declare function releaseImport(databaseName: string): void;