@thejrsoft/subway-protocol 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import {
6
- CommandStatus,
6
+ MessageStatus,
7
7
  Priority,
8
8
  ClientType,
9
9
  MessageType,
@@ -26,26 +26,26 @@ import {
26
26
  */
27
27
  export class ProtocolUtils {
28
28
  /**
29
- * 将 CommandStatus 枚举转换为字符串
29
+ * 将 MessageStatus 枚举转换为字符串
30
30
  */
31
- static statusToString(status: CommandStatus): string {
31
+ static statusToString(status: MessageStatus): string {
32
32
  return status.toString();
33
33
  }
34
34
 
35
35
  /**
36
- * 将字符串转换为 CommandStatus 枚举
36
+ * 将字符串转换为 MessageStatus 枚举
37
37
  * @throws {Error} 如果字符串不是有效的状态值
38
38
  */
39
- static stringToStatus(status: string): CommandStatus {
39
+ static stringToStatus(status: string): MessageStatus {
40
40
  // 处理大小写和空格
41
41
  const normalizedStatus = status.trim().toUpperCase();
42
42
 
43
43
  // 检查是否是有效的枚举值
44
- if (!Object.values(CommandStatus).includes(normalizedStatus as CommandStatus)) {
45
- throw new Error(`Invalid command status: ${status}. Valid values are: ${Object.values(CommandStatus).join(', ')}`);
44
+ if (!Object.values(MessageStatus).includes(normalizedStatus as MessageStatus)) {
45
+ throw new Error(`Invalid command status: ${status}. Valid values are: ${Object.values(MessageStatus).join(', ')}`);
46
46
  }
47
47
 
48
- return normalizedStatus as CommandStatus;
48
+ return normalizedStatus as MessageStatus;
49
49
  }
50
50
 
51
51
  /**
@@ -225,7 +225,7 @@ export class ProtocolUtils {
225
225
  * 安全的枚举转换(不抛出异常)
226
226
  * @returns 枚举值或 null
227
227
  */
228
- static tryParseStatus(status: string): CommandStatus | null {
228
+ static tryParseStatus(status: string): MessageStatus | null {
229
229
  try {
230
230
  return this.stringToStatus(status);
231
231
  } catch {