import GameServer from "./GameServer"; export declare enum BackupType { User = "user", Automatic = "auto" } export interface BackupMetadata { name?: string; id: string; desc?: string; created: number; author?: string; type: "auto" | "user"; } export interface BackupManifest { _comment: string; version: string; backups: BackupMetadata[]; } export default class BackupModule { static readonly DEFAULT_BACKUP_PATH: string; static readonly BACKUP_LIMIT = 2; static readonly BACKUP_EXT = ".zip"; protected server: GameServer; private _manifest; backupsDir: string; private dirEventWatcher; /** * The path of the manifest.json file */ get manifestPath(): string; protected set manifest(manifest: BackupManifest); protected get manifest(): BackupManifest; constructor(server: GameServer, backupsDir?: string); /** * Initalize the module for use. Many methods throw an error if init has not been called */ init(): Promise; /** * Creates a backup manifest file with default values */ protected createBackupManifest(): Promise; /** * @description Loads the manifest.json file from the disk on to memory */ protected getBackupManifest(): Promise; /** * @description Creates the backup directory */ createBackupDirectory(): Promise; /** * Gets all files inside a directory * @param dir Starting directory * @returns A flat list of file paths all inside the directory */ getFilesFlat(dir: string): Promise; /** * Creates a user backup * @param name The name of the backup * @param desc The description of the backup * @param author The author/creator of the backup * @returns The metadata of the created backup */ createUser: (name?: string | undefined, desc?: string | undefined, author?: string | undefined) => Promise; /** * Creates an automatic backup * @param name The name of the backup * @param desc The description of the backup * @param author The author/creator of the backup * @returns The metadata of the created backup */ createAutomatic: (name?: string | undefined, desc?: string | undefined) => Promise; /** * Creates a backup * @param backupType The type of backup that will be made * @param name The name of the backup * @param desc The description of the backup * @param author The author/creator of the backup * @returns The metadata of the created backup */ create(backupType: BackupType, name?: string, desc?: string, author?: string): Promise; /** * Lists all backups */ listAll(): BackupMetadata[]; /** * Lists all user backups */ listUser(): BackupMetadata[]; /** * Lists all automatic backups */ listAutomatic(): BackupMetadata[]; private latestSorter; /** * Get the latest backup from all backups */ getLatest: () => BackupMetadata | undefined; /** * Get the latest backup from all user backups */ getLatestUser: () => BackupMetadata | undefined; /** * Get the latest backup from all automatic backups */ getLatestAutomatic: () => BackupMetadata | undefined; /** * Saves the in memory manifest to the disk */ saveManifest(): Promise; } //# sourceMappingURL=BackupModule.d.ts.map