scheduler
This commit is contained in:
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Mirrors src-tauri/src/notifications/catalog.rs (event ids/categories/severities) and
|
||||
// targets.rs (NotificationTarget shape, persisted in notifications/targets.json). The Rust side
|
||||
// is the source of truth — keep both in sync, and never rename an event id after release.
|
||||
|
||||
export type NotificationEventId =
|
||||
| 'job.started'
|
||||
| 'job.completed'
|
||||
| 'job.failed'
|
||||
| 'schedule.started'
|
||||
| 'schedule.completed'
|
||||
| 'schedule.failed'
|
||||
| 'mount.failed'
|
||||
| 'rclone.crashed'
|
||||
| 'rclone.update-available'
|
||||
| 'app.update-available'
|
||||
|
||||
export type NotificationSeverity = 'info' | 'success' | 'error'
|
||||
export type NotificationCategory = 'transfers' | 'schedules' | 'system'
|
||||
|
||||
export type NotificationProvider = 'discord' | 'slack' | 'telegram' | 'webhook'
|
||||
|
||||
export interface NotificationEventMeta {
|
||||
id: NotificationEventId
|
||||
label: string
|
||||
description: string
|
||||
category: NotificationCategory
|
||||
severity: NotificationSeverity
|
||||
}
|
||||
|
||||
/** Returned by the `notifications_catalog` command. */
|
||||
export interface NotificationCatalog {
|
||||
categories: { id: NotificationCategory; label: string }[]
|
||||
events: NotificationEventMeta[]
|
||||
}
|
||||
|
||||
export interface NotificationTarget {
|
||||
id: string
|
||||
provider: NotificationProvider
|
||||
name: string
|
||||
url: string
|
||||
isEnabled: boolean
|
||||
events: NotificationEventId[]
|
||||
createdAt: number
|
||||
// Delivery status, written by the dispatcher after each send attempt.
|
||||
lastSentAt?: number
|
||||
lastError?: string
|
||||
}
|
||||
Vendored
+35
-17
@@ -1,45 +1,63 @@
|
||||
import type {
|
||||
startBisync,
|
||||
startCopy,
|
||||
startDelete,
|
||||
startMove,
|
||||
startPurge,
|
||||
startSync,
|
||||
} from '../lib/rclone/api'
|
||||
BisyncArgs,
|
||||
CopyArgs,
|
||||
DeleteArgs,
|
||||
MoveArgs,
|
||||
PurgeArgs,
|
||||
SyncArgs,
|
||||
} from '../lib/rclone/requests'
|
||||
|
||||
export type ScheduledTask = {
|
||||
id: string
|
||||
name?: string
|
||||
cron: string
|
||||
isRunning: boolean
|
||||
isEnabled: boolean
|
||||
currentRunId?: string
|
||||
lastRun?: string
|
||||
lastRunError?: string
|
||||
/** The config file this task runs with (a lookup into the host's configFiles). */
|
||||
configId: string
|
||||
/** 'app-default' or an absolute path to a specific rclone binary. */
|
||||
binaryPath: 'app-default' | string
|
||||
/** Raise the run's rclone daemon to INFO logging (per-transfer lines in the rclone log). */
|
||||
verboseLogging?: boolean
|
||||
/**
|
||||
* Max run time in whole hours (1-120); the runner stops the job when it's exceeded.
|
||||
* Default 24 when absent.
|
||||
*/
|
||||
maxRunHours?: number
|
||||
/**
|
||||
* 'user' (default, also when absent): only runs while the user is logged in, borrowing the
|
||||
* session's context. 'system': runs even while logged out, but outside the login session —
|
||||
* no OS keychain, session-mounted drives, or (macOS) protected folders without a cron FDA
|
||||
* grant.
|
||||
*/
|
||||
runMode?: 'system' | 'user'
|
||||
/**
|
||||
* Set when the last OS-registration attempt failed (cron unrepresentable on this platform,
|
||||
* register error). Persisted so a disabled task can explain itself across restarts.
|
||||
*/
|
||||
registrationError?: string
|
||||
} & (
|
||||
| {
|
||||
operation: 'delete'
|
||||
args: Parameters<typeof startDelete>[0]
|
||||
args: DeleteArgs
|
||||
}
|
||||
| {
|
||||
operation: 'sync'
|
||||
args: Parameters<typeof startSync>[0]
|
||||
args: SyncArgs
|
||||
}
|
||||
| {
|
||||
operation: 'copy'
|
||||
args: Parameters<typeof startCopy>[0]
|
||||
args: CopyArgs
|
||||
}
|
||||
| {
|
||||
operation: 'move'
|
||||
args: Parameters<typeof startMove>[0]
|
||||
args: MoveArgs
|
||||
}
|
||||
| {
|
||||
operation: 'purge'
|
||||
args: Parameters<typeof startPurge>[0]
|
||||
args: PurgeArgs
|
||||
}
|
||||
| {
|
||||
operation: 'bisync'
|
||||
args: Parameters<typeof startBisync>[0]
|
||||
args: BisyncArgs
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user