Abstract Class: DatabaseCommand<TResult>
Defined in: electron/services/commands/DatabaseCommands.ts:136
Base class for database commands executed by the DatabaseCommandExecutor.
Hierarchy
Extended by
DownloadBackupCommandSaveBackupToPathCommandExportDataCommandImportDataCommandRestoreBackupCommand
Type Parameters
TResult
TResult = void
The result type produced by the command when DatabaseCommand.execute resolves.
Implements
IDatabaseCommand<TResult>
Constructors
Constructor
new DatabaseCommand<TResult>(
serviceFactory: DatabaseCommandServiceFactory,
eventEmitter: TypedEventBus<UptimeEvents>,
cache: StandardizedCache<Site>): DatabaseCommand<TResult>;
Defined in: electron/services/commands/DatabaseCommands.ts:181
Parameters
serviceFactory
eventEmitter
cache
Returns
DatabaseCommand<TResult>
Constructor
new DatabaseCommand<TResult>(context: DatabaseCommandContext): DatabaseCommand<TResult>;
Defined in: electron/services/commands/DatabaseCommands.ts:187
Parameters
context
Returns
DatabaseCommand<TResult>
Properties
cache
protected readonly cache: StandardizedCache<Site>;
Defined in: electron/services/commands/DatabaseCommands.ts:140
Site cache for data synchronization during operations
eventEmitter
protected readonly eventEmitter: TypedEventBus<UptimeEvents>;
Defined in: electron/services/commands/DatabaseCommands.ts:143
Event bus for emitting command execution events
serviceFactory
protected readonly serviceFactory: DatabaseCommandServiceFactory;
Defined in: electron/services/commands/DatabaseCommands.ts:146
Factory for accessing database services and repositories
configurationManager
protected readonly configurationManager:
| ConfigurationManager
| undefined;
Defined in: electron/services/commands/DatabaseCommands.ts:149
Optional configuration manager used for validation flows
updateHistoryLimit
protected readonly updateHistoryLimit:
| ((limit: number) => Promise<void>)
| undefined;
Defined in: electron/services/commands/DatabaseCommands.ts:152
Optional history limit updater for settings propagation
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.
execute()
abstract execute(): Promise<TResult>;
Defined in: electron/services/commands/DatabaseCommands.ts:202
Executes the command operation.
Returns
Promise<TResult>
Promise resolving to the operation result.
Remarks
Performs the main database operation encapsulated by the command.
Throws
When command execution fails.
Implementation of
getDescription()
abstract getDescription(): string;
Defined in: electron/services/commands/DatabaseCommands.ts:204
Gets a description of the command for logging and debugging.
Returns
string
Human-readable command description.
Implementation of
IDatabaseCommand.getDescription
rollback()
abstract rollback(): Promise<void>;
Defined in: electron/services/commands/DatabaseCommands.ts:206
Rolls back the command operation if possible.
Returns
Promise<void>
Promise resolving when rollback is complete.
Remarks
Attempts to revert the effects of the command. Not all commands require rollback.
Implementation of
validate()
abstract validate(): Promise<{
errors: string[];
isValid: boolean;
}>;
Defined in: electron/services/commands/DatabaseCommands.ts:208
Validates the command before execution.
Returns
Promise<{
errors: string[];
isValid: boolean;
}>
Promise resolving to validation result.
Remarks
Ensures the command is in a valid state before execution. Returns a validation result with errors if any.