Class: DownloadBackupCommand
Defined in: electron/services/commands/DatabaseCommands.ts:309
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.
Extends
DatabaseCommand<{buffer:Buffer;fileName:string; }>
Constructors
Constructor
new DownloadBackupCommand(
serviceFactory:DatabaseServiceFactory,eventEmitter:TypedEventBus<UptimeEvents>,cache:StandardizedCache<Site>):DownloadBackupCommand
Defined in: electron/services/commands/DatabaseCommands.ts:156
Parameters
serviceFactory
eventEmitter
cache
Returns
DownloadBackupCommand
Inherited from
Properties
cache
protectedreadonlycache:StandardizedCache<Site>
Defined in: electron/services/commands/DatabaseCommands.ts:99
Site cache for data synchronization during operations
Inherited from
eventEmitter
protectedreadonlyeventEmitter:TypedEventBus<UptimeEvents>
Defined in: electron/services/commands/DatabaseCommands.ts:102
Event bus for emitting command execution events
Inherited from
serviceFactory
protectedreadonlyserviceFactory:DatabaseServiceFactory
Defined in: electron/services/commands/DatabaseCommands.ts:105
Factory for accessing database services and repositories
Inherited from
DatabaseCommand.serviceFactory
Methods
emitFailureEvent()
protectedemitFailureEvent(eventType: keyofUptimeEvents,error:Error,data:Partial<UptimeEvents[keyofUptimeEvents]>):Promise<void>
Defined in: electron/services/commands/DatabaseCommands.ts:120
Internal
Emits a failure event for the command operation.
Parameters
eventType
keyof UptimeEvents
The event type to emit.
error
The ://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error that occurred.
data
Partial<UptimeEvents[keyof UptimeEvents]> = {}
Additional event data to include in the event payload.
Returns
Promise<void>
Remarks
Used internally to emit a typed event indicating command failure, including error details and additional event data.
Inherited from
DatabaseCommand.emitFailureEvent
emitSuccessEvent()
protectedemitSuccessEvent(eventType: keyofUptimeEvents,data:Partial<UptimeEvents[keyofUptimeEvents]>):Promise<void>
Defined in: electron/services/commands/DatabaseCommands.ts:145
Internal
Emits a success event for the command operation.
Parameters
eventType
keyof UptimeEvents
The event type to emit.
data
Partial<UptimeEvents[keyof UptimeEvents]>
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()
Defined in: electron/services/commands/DatabaseCommands.ts:315
Executes the command operation.
Returns
Promise<{ buffer: Buffer; fileName: string; }>
Promise resolving to the operation result.
Remarks
Performs the main database operation encapsulated by the command.
Throws
When command execution fails.
Overrides
rollback()
rollback():
Promise<void>
Defined in: electron/services/commands/DatabaseCommands.ts:343
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
validate()
validate():
Promise<{errors:string[];isValid:boolean; }>
Defined in: electron/services/commands/DatabaseCommands.ts:357
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
getDescription()
getDescription():
string
Defined in: electron/services/commands/DatabaseCommands.ts:368
Gets a description of the command for logging and debugging.
Returns
string
Human-readable command description.