// 校验错误码映射;每个分组的 ok 均为 0,表示校验通过 export const validate_code_map = { username: { ok: 0, over_length: 400, too_short: 401, invalid_char: 402, invalid_type: 403, empty: 404, }, host: { ok: 0, invalid_type: 410, empty: 411, over_length: 412, invalid_ip: 413, invalid_format: 414, }, port: { ok: 0, invalid_type: 420, not_integer: 421, not_number: 422, out_of_range: 423, }, version: { ok: 0, invalid_type: 430, empty: 431, unsupported: 432, }, proxy: { ok: 0, invalid_type: 440, missing_type: 441, invalid_type_value: 442, missing_host: 443, invalid_host: 444, missing_port: 445, invalid_port: 446, invalid_username: 447, invalid_password: 448, }, bot_status: { online: 0, offline: 449, connecting: 450 }, bot_context: { ok: 0, instance_created: 460, instance_end_by_user: 461, instance_connected: 462, instance_connecting: 463, context_created: 464, processing: 465, error: 466, }, forward: { ok: 0, invalid_token: 470, missing_key: 471, }, web: { ok: 0, database_error: 480, method_not_allowed: 481, invalid_json: 482, missing_parameter: 483, invalid_parameter: 484, not_found: 485, internal_server_error: 486, spam: 487, timeout: 488, account: { ok: 0, invalid_username: 489, invalid_password: 490, invalid_register_code: 491, invalid_email: 492, invalid_code: 493, invalid_minecraft_username: 494, same_username: 495, same_email: 496, same_minecraft_username: 497, not_login: 498, } } } as const; type value_of = T[keyof T]; export type validate_username_code = value_of; export type validate_host_code = value_of; export type validate_port_code = value_of; export type validate_version_code = value_of; export type validate_proxy_code = value_of; export type bot_status_code = value_of; // 所有校验错误码的联合类型 export type validate_code = | validate_username_code | validate_host_code | validate_port_code | validate_version_code | validate_proxy_code | bot_status_code;