Skip to main content

Class: DownloadBackupCommand

Defined in: electron/services/commands/DatabaseCommands.ts:371

Command for downloading a database backup as a buffer and file name.

Remarks​

Encapsulates the logic for downloading a backup and emitting a success event. Rollback and validation are no-ops.

Hierarchy​

View Summary

Extends​

Constructors​

Constructor​

new DownloadBackupCommand(
serviceFactory: DatabaseCommandServiceFactory,
eventEmitter: TypedEventBus<UptimeEvents>,
cache: StandardizedCache<Site>): DownloadBackupCommand;

Defined in: electron/services/commands/DatabaseCommands.ts:181

Parameters​

serviceFactory​

DatabaseCommandServiceFactory

eventEmitter​

TypedEventBus<UptimeEvents>

cache​

StandardizedCache<Site>

Returns​

DownloadBackupCommand

Inherited from​

DatabaseCommand.constructor

Constructor​

new DownloadBackupCommand(context: DatabaseCommandContext): DownloadBackupCommand;

Defined in: electron/services/commands/DatabaseCommands.ts:187

Parameters​

context​

DatabaseCommandContext

Returns​

DownloadBackupCommand

Inherited from​

DatabaseCommand.constructor

Properties​

cache​

protected readonly cache: StandardizedCache<Site>;

Defined in: electron/services/commands/DatabaseCommands.ts:140

Site cache for data synchronization during operations

Inherited from​

DatabaseCommand.cache


eventEmitter​

protected readonly eventEmitter: TypedEventBus<UptimeEvents>;

Defined in: electron/services/commands/DatabaseCommands.ts:143

Event bus for emitting command execution events

Inherited from​

DatabaseCommand.eventEmitter


serviceFactory​

protected readonly serviceFactory: DatabaseCommandServiceFactory;

Defined in: electron/services/commands/DatabaseCommands.ts:146

Factory for accessing database services and repositories

Inherited from​

DatabaseCommand.serviceFactory


configurationManager​

protected readonly configurationManager:
| ConfigurationManager
| undefined;

Defined in: electron/services/commands/DatabaseCommands.ts:149

Optional configuration manager used for validation flows

Inherited from​

DatabaseCommand.configurationManager


updateHistoryLimit​

protected readonly updateHistoryLimit:
| ((limit: number) => Promise<void>)
| undefined;

Defined in: electron/services/commands/DatabaseCommands.ts:152

Optional history limit updater for settings propagation

Inherited from​

DatabaseCommand.updateHistoryLimit

Methods​

emitSuccessEvent()​

protected emitSuccessEvent<K>(eventType: K, data: Partial<EventPayload<UptimeEvents, K>>): Promise<void>;

Defined in: electron/services/commands/DatabaseCommands.ts:167

Internal

Emits a success event for the command operation.

Type Parameters​

K​

K extends EventKey<UptimeEvents>

Parameters​

eventType​

K

The event type to emit.

data​

Partial<EventPayload<UptimeEvents, K>>

Additional event data to include in the event payload.

Returns​

Promise<void>

Remarks​

Used internally to emit a typed event indicating command success, including additional event data.

Inherited from​

DatabaseCommand.emitSuccessEvent


execute()​

execute(): Promise<DatabaseBackupResult>;

Defined in: electron/services/commands/DatabaseCommands.ts:372

Executes the command operation.

Returns​

Promise<DatabaseBackupResult>

Promise resolving to the operation result.

Remarks​

Performs the main database operation encapsulated by the command.

Throws​

When command execution fails.

Overrides​

DatabaseCommand.execute


rollback()​

rollback(): Promise<void>;

Defined in: electron/services/commands/DatabaseCommands.ts:396

No-op rollback for backup operations.

Returns​

Promise<void>

Resolved promise since backup operations are read-only and do not require rollback.

Remarks​

Backup operations are inherently safe and do not modify the database state, so no rollback action is necessary. Returns a resolved promise to satisfy the IDatabaseCommand interface contract.

Overrides​

DatabaseCommand.rollback


validate()​

validate(): Promise<{
errors: string[];
isValid: boolean;
}>;

Defined in: electron/services/commands/DatabaseCommands.ts:410

Validates backup operation prerequisites.

Returns​

Promise<{ errors: string[]; isValid: boolean; }>

Resolved promise with validation result indicating success.

Remarks​

Backup operations have minimal prerequisites, so validation always succeeds. Returns a resolved promise to satisfy the IDatabaseCommand interface contract.

Overrides​

DatabaseCommand.validate


getDescription()​

getDescription(): string;

Defined in: electron/services/commands/DatabaseCommands.ts:419

Gets a description of the command for logging and debugging.

Returns​

string

Human-readable command description.

Overrides​

DatabaseCommand.getDescription