Remove actions list and update SDK exports

Delete the obsolete actions.ts (SNOWLUMA_ACTIONS / isSnowLumaAction) and update package SDK top-level exports. index.ts was refactored to reorganize and expose additional helpers and types (createSnowLumaApiError, createEventContext, event/type guards, request/notice helpers, fromCQString, MessageChain, SnowLumaHttpClientOptions, etc.), remove duplicate/unused re-exports, and streamline message/client/error exports for consumers.
This commit is contained in:
手瓜一十雪
2026-05-20 19:23:22 +08:00
parent 36c3ed031b
commit c49ae1c8d9
2 changed files with 25 additions and 186 deletions
-151
View File
@@ -1,151 +0,0 @@
import type { SnowLumaActionMap } from './types/index';
export const SNOWLUMA_ACTIONS = [
'get_login_info',
'get_status',
'get_version_info',
'can_send_image',
'can_send_record',
'send_msg',
'send_private_msg',
'send_group_msg',
'get_msg',
'delete_msg',
'get_friend_list',
'get_stranger_info',
'delete_friend',
'get_group_list',
'get_group_info',
'get_group_member_list',
'get_group_member_info',
'get_group_honor_info',
'get_group_system_msg',
'set_group_kick',
'set_group_kick_members',
'set_group_ban',
'set_group_whole_ban',
'set_group_add_option',
'set_group_search',
'set_group_admin',
'set_group_card',
'set_group_name',
'set_group_leave',
'set_group_special_title',
'set_group_anonymous',
'set_group_anonymous_ban',
'set_group_portrait',
'upload_group_file',
'upload_private_file',
'get_group_file_url',
'get_group_root_files',
'get_group_files_by_folder',
'delete_group_file',
'move_group_file',
'create_group_file_folder',
'delete_group_file_folder',
'rename_group_file_folder',
'get_private_file_url',
'set_friend_add_request',
'set_group_add_request',
'send_like',
'friend_poke',
'group_poke',
'send_poke',
'set_essence_msg',
'delete_essence_msg',
'get_essence_msg_list',
'set_group_reaction',
'get_group_msg_history',
'get_friend_msg_history',
'mark_group_msg_as_read',
'mark_private_msg_as_read',
'mark_msg_as_read',
'get_rkey',
'ocr_image',
'.ocr_image',
'_send_group_notice',
'_get_group_notice',
'_del_group_notice',
'upload_forward_msg',
'upload_foward_msg',
'send_forward_msg',
'send_group_forward_msg',
'send_private_forward_msg',
'get_forward_msg',
'get_image',
'get_record',
'get_cookies',
'get_csrf_token',
'get_credentials',
'set_restart',
'clean_cache',
'.handle_quick_operation',
'set_friend_remark',
'set_group_remark',
'set_msg_emoji_like',
'_mark_all_as_read',
'get_group_file_system_info',
'check_url_safely',
'download_file',
'set_qq_profile',
'set_online_status',
'get_group_ignored_notifies',
'get_group_shut_list',
'forward_friend_single_msg',
'forward_group_single_msg',
'get_recent_contact',
'get_profile_like',
'fetch_custom_face',
'get_emoji_likes',
'fetch_emoji_like',
'get_friends_with_category',
'get_online_clients',
'_get_model_show',
'_set_model_show',
'.get_word_slices',
'get_group_at_all_remain',
'get_unidirectional_friend_list',
'set_self_longnick',
'get_collection_list',
'create_collection',
'set_qq_avatar',
'set_input_status',
'translate_en2zh',
'get_clientkey',
'get_mini_app_ark',
'click_inline_keyboard_button',
'set_group_sign',
'send_group_sign',
'get_group_info_ex',
'get_group_detail_info',
'trans_group_file',
'rename_group_file',
'get_file',
'.send_packet',
// napcat-parity extensions (Tier 1 + Tier 2)
'send_packet',
'bot_exit',
'nc_get_packet_status',
'nc_get_rkey',
'nc_get_user_status',
'get_group_ignore_add_request',
'delete_group_folder',
'set_group_todo',
'complete_group_todo',
'cancel_group_todo',
// Tier 3: DIY status
'set_diy_online_status',
// AI voice trio
'get_ai_characters',
'get_ai_record',
'send_group_ai_record',
] as const satisfies readonly (keyof SnowLumaActionMap)[];
export type SnowLumaKnownAction = typeof SNOWLUMA_ACTIONS[number];
const ACTION_SET = new Set<string>(SNOWLUMA_ACTIONS);
export function isSnowLumaAction(action: string): action is SnowLumaKnownAction {
return ACTION_SET.has(action);
}
+25 -35
View File
@@ -1,20 +1,32 @@
export { SNOWLUMA_ACTIONS, isSnowLumaAction } from './actions';
export { SnowLumaApiClient } from './client/api-client';
export { SnowLumaHttpClient, createHttpClient } from './client/http-client';
export { SnowLumaWebSocketClient, createWebSocketClient } from './client/websocket-client';
export { createHttpClient, SnowLumaHttpClient } from './client/http-client';
export type {
SnowLumaHttpClientOptions
} from './client/http-client';
export { createWebSocketClient, SnowLumaWebSocketClient } from './client/websocket-client';
export {
SnowLumaAbortError,
createSnowLumaApiError, SnowLumaAbortError,
SnowLumaApiError,
SnowLumaAuthError,
SnowLumaConnectionError,
SnowLumaError,
SnowLumaParseError,
SnowLumaTimeoutError,
SnowLumaTransportError,
createSnowLumaApiError,
SnowLumaTransportError
} from './errors';
export {
MessageChain,
createEventContext,
isGroupMessageEvent,
isMessageEvent,
isMetaEvent,
isNoticeEvent,
isPrivateMessageEvent,
isRequestEvent,
matchCommand,
noticeType,
requestType
} from './events/index';
export {
at,
atAll,
br,
@@ -23,12 +35,10 @@ export {
escapeCqParam,
escapeCqText,
face,
forward,
image,
forward, fromCQString, image,
json,
location,
message,
music,
message, MessageChain, music,
node,
normalizeMessage,
parseSegments,
@@ -40,36 +50,15 @@ export {
text,
toCQString,
video,
xml,
fromCQString,
xml
} from './messages/index';
export {
createEventContext,
isGroupMessageEvent,
isMessageEvent,
isMetaEvent,
isNoticeEvent,
isPrivateMessageEvent,
isRequestEvent,
matchCommand,
noticeType,
requestType,
} from './events/index';
export type {
SnowLumaKnownAction,
} from './actions';
export type {
SnowLumaHttpClientOptions,
} from './client/http-client';
export type {
ReconnectOptions,
SnowLumaWebSocketClientOptions,
SnowLumaWebSocketEvents,
WebSocketCloseInfo,
WebSocketConstructor,
WebSocketConstructor
} from './client/websocket-client';
export type {
@@ -82,7 +71,8 @@ export type {
EventPredicate,
MaybePromise,
RequestDecisionOptions,
SnowLumaEventContext,
SnowLumaEventContext
} from './events/index';
export type * from './types/index';