mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-26 22:22:13 +08:00
Adds a zero-dependency `frontend-contract` bin that serializes the real NoticeStatus variants and FrontendEvent payloads, scripts/gen-contract.mjs which emits the committed src/services/contract.ts, and a CI job that regenerates it and fails on a non-empty diff. events.ts now derives its event map from the generated contract instead of hand-typed shapes.
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
// @generated by scripts/gen-contract.mjs from the backend wire contract. DO NOT EDIT.
|
|
// Regen: pnpm gen:contract
|
|
|
|
import type { RunState } from './cmds'
|
|
|
|
/** Wire status strings from NoticeStatus; keep in sync via `pnpm gen:contract`. */
|
|
export type NoticeStatus =
|
|
| 'info'
|
|
| 'import_sub_url::ok'
|
|
| 'import_sub_url::error'
|
|
| 'set_config::error'
|
|
| 'core_start::error'
|
|
| 'service_core::repair_required'
|
|
| 'service_core::app_data_not_owned'
|
|
| 'service_core::sidecar_fallback'
|
|
| 'dns_override::auto_disabled'
|
|
| 'enhance::discarded_keys'
|
|
| 'tun_mode::auto_disabled'
|
|
| 'tun_mode::auto_disable_failed'
|
|
| 'app_restart::core_stop_failed'
|
|
| 'app_quit::core_stop_failed'
|
|
| 'update_with_clash_proxy'
|
|
| 'update_failed_even_with_clash'
|
|
| 'reactivate_profiles::error'
|
|
| 'update_failed'
|
|
| 'config_validate::boot_error'
|
|
| 'config_validate::error'
|
|
| 'config_validate::process_terminated'
|
|
| 'config_validate::script_error'
|
|
| 'config_validate::script_syntax_error'
|
|
| 'config_validate::script_missing_main'
|
|
| 'config_validate::file_not_found'
|
|
| 'config_validate::yaml_syntax_error'
|
|
| 'config_validate::yaml_read_error'
|
|
| 'config_validate::yaml_mapping_error'
|
|
| 'config_validate::merge_syntax_error'
|
|
| 'config_validate::merge_mapping_error'
|
|
| 'config_core::change_success'
|
|
| 'config_core::change_error'
|
|
| 'mixed_port::fallback'
|
|
| 'mixed_port::fallback_error'
|
|
| 'config_validate::core_change'
|
|
| 'config_validate::stdout_error'
|
|
| 'config_validate::yaml_key_error'
|
|
| 'config_validate::yaml_error'
|
|
| 'config_validate::merge_key_error'
|
|
| 'config_validate::merge_error'
|
|
| 'set_config::ok'
|
|
|
|
/** Event name → payload type for every backend-emitted event. */
|
|
export interface VergeEventPayloads {
|
|
'verge://refresh-clash-config': string
|
|
'verge://refresh-verge-config': string
|
|
'verge://refresh-profiles': string
|
|
'verge://refresh-proxy-config': null
|
|
'verge://notice-message': [NoticeStatus, string]
|
|
'verge://timer-updated': string
|
|
'verge://run-state-changed': RunState
|
|
'verge://pending-failures-changed': null
|
|
'profile-changed': string
|
|
'profile-update-started': { uid: string }
|
|
'profile-update-completed': { uid: string }
|
|
}
|