Class: ExportDataCommand
Defined in: electron/services/commands/DatabaseCommands.ts:378
Command for exporting all application data to JSON.
Remarks
Encapsulates the logic for exporting all data and emitting a success event. Rollback and validation are no-ops.
Extends
DatabaseCommand
<string
>
Constructors
Constructor
new ExportDataCommand(
serviceFactory
:DatabaseServiceFactory
,eventEmitter
:TypedEventBus
<UptimeEvents
>,cache
:StandardizedCache
<Site
>):ExportDataCommand
Defined in: electron/services/commands/DatabaseCommands.ts:152
Parameters
serviceFactory
eventEmitter
cache
Returns
ExportDataCommand
Inherited from
Properties
cache
protected
readonly
cache:StandardizedCache
<Site
>
Defined in: electron/services/commands/DatabaseCommands.ts:95
Site cache for data synchronization during operations
Inherited from
eventEmitter
protected
readonly
eventEmitter:TypedEventBus
<UptimeEvents
>
Defined in: electron/services/commands/DatabaseCommands.ts:98
Event bus for emitting command execution events
Inherited from
serviceFactory
protected
readonly
serviceFactory:DatabaseServiceFactory
Defined in: electron/services/commands/DatabaseCommands.ts:101
Factory for accessing database services and repositories
Inherited from
DatabaseCommand
.serviceFactory
Methods
emitFailureEvent()
protected
emitFailureEvent(eventType
: keyofUptimeEvents
,error
:Error
,data
:Partial
<UptimeEvents
[keyofUptimeEvents
]>):Promise
<void
>
Defined in: electron/services/commands/DatabaseCommands.ts:116
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()
protected
emitSuccessEvent(eventType
: keyofUptimeEvents
,data
:Partial
<UptimeEvents
[keyofUptimeEvents
]>):Promise
<void
>
Defined in: electron/services/commands/DatabaseCommands.ts:141
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()
execute():
Promise
<string
>
Defined in: electron/services/commands/DatabaseCommands.ts:379
Executes the command operation.
Returns
Promise
<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:391
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.
Overrides
validate()
validate():
Promise
<{errors
:string
[];isValid
:boolean
; }>
Defined in: electron/services/commands/DatabaseCommands.ts:395
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.
Overrides
getDescription()
getDescription():
string
Defined in: electron/services/commands/DatabaseCommands.ts:406
Gets a description of the command for logging and debugging.
Returns
string
Human-readable command description.