@pisell/pisellos 0.0.220 → 0.0.222

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.
Files changed (199) hide show
  1. package/README.md +180 -180
  2. package/dist/core/index.js +4 -4
  3. package/dist/index.js +3 -3
  4. package/dist/modules/Account/types.js +6 -6
  5. package/dist/modules/AccountList/index.js +14 -14
  6. package/dist/modules/AccountList/types.js +14 -14
  7. package/dist/modules/AccountList/utils.js +5 -5
  8. package/dist/modules/Cart/index.js +35 -35
  9. package/dist/modules/Cart/types.js +14 -14
  10. package/dist/modules/Cart/utils/cartAccount.js +8 -8
  11. package/dist/modules/Cart/utils/cartDate.js +12 -12
  12. package/dist/modules/Cart/utils/cartDiscount.js +8 -8
  13. package/dist/modules/Cart/utils/cartNote.js +8 -8
  14. package/dist/modules/Cart/utils/cartProduct.js +39 -39
  15. package/dist/modules/Cart/utils/cartRelationForms.js +8 -8
  16. package/dist/modules/Cart/utils/cartResource.js +8 -8
  17. package/dist/modules/Cart/utils/index.js +4 -4
  18. package/dist/modules/Customer/index.js +67 -67
  19. package/dist/modules/Customer/types.js +18 -18
  20. package/dist/modules/Date/types.js +6 -6
  21. package/dist/modules/Date/utils.js +25 -25
  22. package/dist/modules/Guests/types.js +8 -8
  23. package/dist/modules/Order/types.js +4 -4
  24. package/dist/modules/Order/utils.js +8 -8
  25. package/dist/modules/Payment/cash.js +2 -2
  26. package/dist/modules/Payment/eftpos.js +2 -2
  27. package/dist/modules/Payment/index.js +135 -135
  28. package/dist/modules/Payment/types.js +50 -50
  29. package/dist/modules/Payment/wallet.js +2 -2
  30. package/dist/modules/Product/index.js +22 -22
  31. package/dist/modules/Product/utils.js +12 -12
  32. package/dist/modules/ProductList/index.js +4 -4
  33. package/dist/modules/Resource/types.js +8 -8
  34. package/dist/modules/Resource/utils.js +14 -14
  35. package/dist/modules/Schedule/index.js +4 -4
  36. package/dist/modules/Schedule/utils.js +73 -73
  37. package/dist/modules/Step/index.js +18 -18
  38. package/dist/modules/Summary/index.js +4 -4
  39. package/dist/modules/Summary/utils.js +15 -15
  40. package/dist/plugins/app-types/app/app.d.ts +83 -83
  41. package/dist/plugins/app-types/app/const.d.ts +4 -4
  42. package/dist/plugins/app-types/app/index.d.ts +14 -14
  43. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -50
  44. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -13
  45. package/dist/plugins/app-types/config.d.ts +3 -3
  46. package/dist/plugins/app-types/cookie/index.d.ts +13 -13
  47. package/dist/plugins/app-types/data/index.d.ts +8 -8
  48. package/dist/plugins/app-types/history/config.d.ts +24 -24
  49. package/dist/plugins/app-types/history/index.d.ts +20 -20
  50. package/dist/plugins/app-types/history/type.d.ts +2 -2
  51. package/dist/plugins/app-types/hooks/index.d.ts +12 -12
  52. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
  53. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
  54. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
  55. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -6
  56. package/dist/plugins/app-types/index.d.ts +6 -6
  57. package/dist/plugins/app-types/indexDB/index.d.ts +178 -178
  58. package/dist/plugins/app-types/locales/en.d.ts +3 -3
  59. package/dist/plugins/app-types/locales/index.d.ts +37 -37
  60. package/dist/plugins/app-types/locales/original.d.ts +3 -3
  61. package/dist/plugins/app-types/locales/type.d.ts +19 -19
  62. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -3
  63. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -3
  64. package/dist/plugins/app-types/logger/feishu.d.ts +11 -11
  65. package/dist/plugins/app-types/logger/index.d.ts +122 -122
  66. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -17
  67. package/dist/plugins/app-types/menuManager/index.d.ts +28 -28
  68. package/dist/plugins/app-types/models/global.d.ts +32 -32
  69. package/dist/plugins/app-types/models/index.d.ts +45 -45
  70. package/dist/plugins/app-types/models/type.d.ts +2 -2
  71. package/dist/plugins/app-types/package.json +14 -14
  72. package/dist/plugins/app-types/pubsub/example.d.ts +5 -5
  73. package/dist/plugins/app-types/pubsub/index.d.ts +63 -63
  74. package/dist/plugins/app-types/request/cache.d.ts +46 -46
  75. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -38
  76. package/dist/plugins/app-types/request/config.d.ts +3 -3
  77. package/dist/plugins/app-types/request/constants.d.ts +2 -2
  78. package/dist/plugins/app-types/request/index.d.ts +24 -24
  79. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -6
  80. package/dist/plugins/app-types/request/type.d.ts +41 -41
  81. package/dist/plugins/app-types/request/utils.d.ts +46 -46
  82. package/dist/plugins/app-types/routes/config.d.ts +7 -7
  83. package/dist/plugins/app-types/routes/index.d.ts +28 -28
  84. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
  85. package/dist/plugins/app-types/socket/components/index.d.ts +2 -2
  86. package/dist/plugins/app-types/socket/constants.d.ts +33 -33
  87. package/dist/plugins/app-types/socket/events.d.ts +31 -31
  88. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -66
  89. package/dist/plugins/app-types/socket/index.d.ts +61 -61
  90. package/dist/plugins/app-types/socket/monitor.d.ts +169 -169
  91. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -61
  92. package/dist/plugins/app-types/socket/socket.d.ts +129 -129
  93. package/dist/plugins/app-types/socket/types.d.ts +85 -85
  94. package/dist/plugins/app-types/storage/index.d.ts +17 -17
  95. package/dist/plugins/app-types/tasks/index.d.ts +77 -77
  96. package/dist/plugins/app-types/tasks/type.d.ts +62 -62
  97. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -5
  98. package/dist/plugins/app-types/type.d.ts +2 -2
  99. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
  100. package/dist/plugins/app-types/variables/config.d.ts +3 -3
  101. package/dist/plugins/app-types/variables/index.d.ts +6 -6
  102. package/dist/plugins/app-types/variables/type.d.ts +2 -2
  103. package/dist/plugins/app-types/website/index.d.ts +6 -6
  104. package/dist/plugins/request.js +33 -33
  105. package/dist/plugins/window.js +16 -16
  106. package/dist/solution/BookingByStep/index.js +126 -126
  107. package/dist/solution/BookingByStep/utils/capacity.js +30 -30
  108. package/dist/solution/BookingByStep/utils/products.js +4 -4
  109. package/dist/solution/BookingByStep/utils/resources.js +146 -146
  110. package/dist/solution/BookingByStep/utils/timeslots.js +20 -20
  111. package/dist/solution/BookingTicket/index.d.ts +13 -1
  112. package/dist/solution/BookingTicket/index.js +109 -86
  113. package/dist/solution/BookingTicket/types.js +8 -8
  114. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -6
  115. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -4
  116. package/dist/solution/BookingTicket/utils/scan/handleScan.js +20 -28
  117. package/dist/solution/BookingTicket/utils/scan/index.d.ts +13 -0
  118. package/dist/solution/BookingTicket/utils/scan/index.js +64 -21
  119. package/dist/solution/BookingTicket/utils/scan/scanCache.js +52 -52
  120. package/dist/solution/BuyTickets/types.js +4 -4
  121. package/dist/utils/task.d.ts +5 -1
  122. package/dist/utils/task.js +22 -38
  123. package/dist/utils/watch.d.ts +1 -1
  124. package/dist/utils/watch.js +60 -60
  125. package/lib/plugins/app-types/app/app.d.ts +83 -83
  126. package/lib/plugins/app-types/app/const.d.ts +4 -4
  127. package/lib/plugins/app-types/app/index.d.ts +14 -14
  128. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -50
  129. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -13
  130. package/lib/plugins/app-types/config.d.ts +3 -3
  131. package/lib/plugins/app-types/cookie/index.d.ts +13 -13
  132. package/lib/plugins/app-types/data/index.d.ts +8 -8
  133. package/lib/plugins/app-types/history/config.d.ts +24 -24
  134. package/lib/plugins/app-types/history/index.d.ts +20 -20
  135. package/lib/plugins/app-types/history/type.d.ts +2 -2
  136. package/lib/plugins/app-types/hooks/index.d.ts +12 -12
  137. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
  138. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
  139. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
  140. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -6
  141. package/lib/plugins/app-types/index.d.ts +6 -6
  142. package/lib/plugins/app-types/indexDB/index.d.ts +178 -178
  143. package/lib/plugins/app-types/locales/en.d.ts +3 -3
  144. package/lib/plugins/app-types/locales/index.d.ts +37 -37
  145. package/lib/plugins/app-types/locales/original.d.ts +3 -3
  146. package/lib/plugins/app-types/locales/type.d.ts +19 -19
  147. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -3
  148. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -3
  149. package/lib/plugins/app-types/logger/feishu.d.ts +11 -11
  150. package/lib/plugins/app-types/logger/index.d.ts +122 -122
  151. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -17
  152. package/lib/plugins/app-types/menuManager/index.d.ts +28 -28
  153. package/lib/plugins/app-types/models/global.d.ts +32 -32
  154. package/lib/plugins/app-types/models/index.d.ts +45 -45
  155. package/lib/plugins/app-types/models/type.d.ts +2 -2
  156. package/lib/plugins/app-types/package.json +14 -14
  157. package/lib/plugins/app-types/pubsub/example.d.ts +5 -5
  158. package/lib/plugins/app-types/pubsub/index.d.ts +63 -63
  159. package/lib/plugins/app-types/request/cache.d.ts +46 -46
  160. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -38
  161. package/lib/plugins/app-types/request/config.d.ts +3 -3
  162. package/lib/plugins/app-types/request/constants.d.ts +2 -2
  163. package/lib/plugins/app-types/request/index.d.ts +24 -24
  164. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -6
  165. package/lib/plugins/app-types/request/type.d.ts +41 -41
  166. package/lib/plugins/app-types/request/utils.d.ts +46 -46
  167. package/lib/plugins/app-types/routes/config.d.ts +7 -7
  168. package/lib/plugins/app-types/routes/index.d.ts +28 -28
  169. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
  170. package/lib/plugins/app-types/socket/components/index.d.ts +2 -2
  171. package/lib/plugins/app-types/socket/constants.d.ts +33 -33
  172. package/lib/plugins/app-types/socket/events.d.ts +31 -31
  173. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -66
  174. package/lib/plugins/app-types/socket/index.d.ts +61 -61
  175. package/lib/plugins/app-types/socket/monitor.d.ts +169 -169
  176. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -61
  177. package/lib/plugins/app-types/socket/socket.d.ts +129 -129
  178. package/lib/plugins/app-types/socket/types.d.ts +85 -85
  179. package/lib/plugins/app-types/storage/index.d.ts +17 -17
  180. package/lib/plugins/app-types/tasks/index.d.ts +77 -77
  181. package/lib/plugins/app-types/tasks/type.d.ts +62 -62
  182. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -5
  183. package/lib/plugins/app-types/type.d.ts +2 -2
  184. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
  185. package/lib/plugins/app-types/variables/config.d.ts +3 -3
  186. package/lib/plugins/app-types/variables/index.d.ts +6 -6
  187. package/lib/plugins/app-types/variables/type.d.ts +2 -2
  188. package/lib/plugins/app-types/website/index.d.ts +6 -6
  189. package/lib/solution/BookingTicket/index.d.ts +13 -1
  190. package/lib/solution/BookingTicket/index.js +19 -2
  191. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -4
  192. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -14
  193. package/lib/solution/BookingTicket/utils/scan/index.d.ts +13 -0
  194. package/lib/solution/BookingTicket/utils/scan/index.js +32 -0
  195. package/lib/utils/task.d.ts +5 -1
  196. package/lib/utils/task.js +8 -1
  197. package/lib/utils/watch.d.ts +1 -1
  198. package/lib/utils/watch.js +1 -1
  199. package/package.json +1 -1
@@ -1,66 +1,66 @@
1
- import { HeartbeatOptions, SocketMessage } from "./types";
2
- /**
3
- * Socket心跳管理器
4
- * 处理WebSocket连接的心跳检测
5
- */
6
- export declare class HeartbeatManager {
7
- private options;
8
- private intervalTimer;
9
- private timeoutTimer;
10
- private lastHeartbeatTime;
11
- private lastHeartbeatResponse;
12
- private active;
13
- private sendHeartbeat;
14
- private onTimeout;
15
- private onResponse;
16
- /**
17
- * 创建心跳管理器
18
- * @param options 心跳配置选项
19
- * @param sendHeartbeat 发送心跳的回调函数
20
- * @param callbacks 回调函数集合
21
- */
22
- constructor(options: HeartbeatOptions, sendHeartbeat: (msg: SocketMessage) => void, callbacks?: {
23
- onTimeout?: () => void;
24
- onResponse?: () => void;
25
- });
26
- /**
27
- * 启动心跳检测
28
- */
29
- start(): void;
30
- /**
31
- * 停止心跳检测
32
- */
33
- stop(): void;
34
- /**
35
- * 重启心跳检测
36
- */
37
- restart(): void;
38
- /**
39
- * 接收到心跳响应
40
- */
41
- receiveHeartbeatResponse(): void;
42
- /**
43
- * 获取上次心跳时间
44
- */
45
- getLastHeartbeatTime(): number;
46
- /**
47
- * 获取上次心跳响应时间
48
- */
49
- getLastHeartbeatResponseTime(): number;
50
- /**
51
- * 获取心跳是否活跃
52
- */
53
- isActive(): boolean;
54
- /**
55
- * 安排下一次心跳
56
- */
57
- private scheduleHeartbeat;
58
- /**
59
- * 发送心跳消息
60
- */
61
- private sendHeartbeatMessage;
62
- /**
63
- * 清除所有计时器
64
- */
65
- private clearTimers;
66
- }
1
+ import { HeartbeatOptions, SocketMessage } from "./types";
2
+ /**
3
+ * Socket心跳管理器
4
+ * 处理WebSocket连接的心跳检测
5
+ */
6
+ export declare class HeartbeatManager {
7
+ private options;
8
+ private intervalTimer;
9
+ private timeoutTimer;
10
+ private lastHeartbeatTime;
11
+ private lastHeartbeatResponse;
12
+ private active;
13
+ private sendHeartbeat;
14
+ private onTimeout;
15
+ private onResponse;
16
+ /**
17
+ * 创建心跳管理器
18
+ * @param options 心跳配置选项
19
+ * @param sendHeartbeat 发送心跳的回调函数
20
+ * @param callbacks 回调函数集合
21
+ */
22
+ constructor(options: HeartbeatOptions, sendHeartbeat: (msg: SocketMessage) => void, callbacks?: {
23
+ onTimeout?: () => void;
24
+ onResponse?: () => void;
25
+ });
26
+ /**
27
+ * 启动心跳检测
28
+ */
29
+ start(): void;
30
+ /**
31
+ * 停止心跳检测
32
+ */
33
+ stop(): void;
34
+ /**
35
+ * 重启心跳检测
36
+ */
37
+ restart(): void;
38
+ /**
39
+ * 接收到心跳响应
40
+ */
41
+ receiveHeartbeatResponse(): void;
42
+ /**
43
+ * 获取上次心跳时间
44
+ */
45
+ getLastHeartbeatTime(): number;
46
+ /**
47
+ * 获取上次心跳响应时间
48
+ */
49
+ getLastHeartbeatResponseTime(): number;
50
+ /**
51
+ * 获取心跳是否活跃
52
+ */
53
+ isActive(): boolean;
54
+ /**
55
+ * 安排下一次心跳
56
+ */
57
+ private scheduleHeartbeat;
58
+ /**
59
+ * 发送心跳消息
60
+ */
61
+ private sendHeartbeatMessage;
62
+ /**
63
+ * 清除所有计时器
64
+ */
65
+ private clearTimers;
66
+ }
@@ -1,61 +1,61 @@
1
- import { Socket } from './socket';
2
- import { SocketOptions, SocketStatus, SocketMessage } from './types';
3
- import { SocketEvents } from './events';
4
- import { SocketMonitor, SocketMonitorOptions, SocketHistoryItem, SocketStatusItem, SocketStats } from './monitor';
5
- import * as components from './components';
6
- /**
7
- * 创建Socket实例
8
- * @param url WebSocket连接URL
9
- * @param options Socket配置选项
10
- */
11
- export declare function createSocket(url: string, options?: Partial<Omit<SocketOptions, 'url'>>): Socket;
12
- declare const _default: {
13
- /**
14
- * 创建新的Socket实例
15
- */
16
- create: (url: string, options?: Partial<Omit<SocketOptions, "url">>, key?: string) => Socket;
17
- /**
18
- * 获取指定键的Socket实例
19
- */
20
- get: (key: string) => Socket | undefined;
21
- /**
22
- * 移除Socket实例
23
- */
24
- remove: (key: string) => boolean;
25
- /**
26
- * 关闭并移除所有Socket实例
27
- */
28
- closeAll: () => void;
29
- /**
30
- * 检查指定键的Socket是否存在
31
- */
32
- has: (key: string) => boolean;
33
- /**
34
- * 获取所有Socket标识键
35
- */
36
- getKeys: () => string[];
37
- /**
38
- * 获取所有Socket实例
39
- */
40
- getAllSockets: () => Socket[];
41
- /**
42
- * 为指定的Socket启用监控
43
- */
44
- enableMonitoring: (key: string, options?: SocketMonitorOptions) => SocketMonitor | null;
45
- /**
46
- * 获取指定Socket的监控器
47
- */
48
- getMonitor: (key: string) => SocketMonitor | null;
49
- /**
50
- * 获取所有Socket的监控信息
51
- */
52
- getAllMonitors: () => Map<string, SocketMonitor | null>;
53
- /**
54
- * 监控组件
55
- */
56
- components: typeof components;
57
- };
58
- export default _default;
59
- export { Socket, SocketMonitor };
60
- export type { SocketOptions, SocketMessage, SocketMonitorOptions, SocketHistoryItem, SocketStatusItem, SocketStats };
61
- export { SocketStatus, SocketEvents };
1
+ import { Socket } from './socket';
2
+ import { SocketOptions, SocketStatus, SocketMessage } from './types';
3
+ import { SocketEvents } from './events';
4
+ import { SocketMonitor, SocketMonitorOptions, SocketHistoryItem, SocketStatusItem, SocketStats } from './monitor';
5
+ import * as components from './components';
6
+ /**
7
+ * 创建Socket实例
8
+ * @param url WebSocket连接URL
9
+ * @param options Socket配置选项
10
+ */
11
+ export declare function createSocket(url: string, options?: Partial<Omit<SocketOptions, 'url'>>): Socket;
12
+ declare const _default: {
13
+ /**
14
+ * 创建新的Socket实例
15
+ */
16
+ create: (url: string, options?: Partial<Omit<SocketOptions, "url">>, key?: string) => Socket;
17
+ /**
18
+ * 获取指定键的Socket实例
19
+ */
20
+ get: (key: string) => Socket | undefined;
21
+ /**
22
+ * 移除Socket实例
23
+ */
24
+ remove: (key: string) => boolean;
25
+ /**
26
+ * 关闭并移除所有Socket实例
27
+ */
28
+ closeAll: () => void;
29
+ /**
30
+ * 检查指定键的Socket是否存在
31
+ */
32
+ has: (key: string) => boolean;
33
+ /**
34
+ * 获取所有Socket标识键
35
+ */
36
+ getKeys: () => string[];
37
+ /**
38
+ * 获取所有Socket实例
39
+ */
40
+ getAllSockets: () => Socket[];
41
+ /**
42
+ * 为指定的Socket启用监控
43
+ */
44
+ enableMonitoring: (key: string, options?: SocketMonitorOptions) => SocketMonitor | null;
45
+ /**
46
+ * 获取指定Socket的监控器
47
+ */
48
+ getMonitor: (key: string) => SocketMonitor | null;
49
+ /**
50
+ * 获取所有Socket的监控信息
51
+ */
52
+ getAllMonitors: () => Map<string, SocketMonitor | null>;
53
+ /**
54
+ * 监控组件
55
+ */
56
+ components: typeof components;
57
+ };
58
+ export default _default;
59
+ export { Socket, SocketMonitor };
60
+ export type { SocketOptions, SocketMessage, SocketMonitorOptions, SocketHistoryItem, SocketStatusItem, SocketStats };
61
+ export { SocketStatus, SocketEvents };
@@ -1,169 +1,169 @@
1
- import { Socket } from './socket';
2
- import { SocketMessage, SocketStatus } from './types';
3
- /**
4
- * Socket历史消息记录项
5
- */
6
- export interface SocketHistoryItem {
7
- /** 消息ID */
8
- id: string;
9
- /** 消息时间戳 */
10
- timestamp: number;
11
- /** 消息方向(发送/接收) */
12
- direction: 'in' | 'out';
13
- /** 消息内容 */
14
- message: SocketMessage | Partial<SocketMessage>;
15
- /** 消息大小(字节) */
16
- size?: number;
17
- }
18
- /**
19
- * Socket状态记录项
20
- */
21
- export interface SocketStatusItem {
22
- /** 状态变更时间戳 */
23
- timestamp: number;
24
- /** 变更前状态 */
25
- from: SocketStatus;
26
- /** 变更后状态 */
27
- to: SocketStatus;
28
- /** 相关事件(如果有) */
29
- event?: string;
30
- /** 附加信息 */
31
- info?: any;
32
- }
33
- /**
34
- * Socket监控配置选项
35
- */
36
- export interface SocketMonitorOptions {
37
- /** 最大历史消息记录数 */
38
- maxHistoryItems?: number;
39
- /** 最大状态变更记录数 */
40
- maxStatusItems?: number;
41
- /** 是否记录消息内容 */
42
- recordMessageContent?: boolean;
43
- /** 是否自动开始监控 */
44
- autoStart?: boolean;
45
- /** 过滤掉的消息类型(不记录) */
46
- excludeEvents?: string[];
47
- }
48
- /**
49
- * Socket监控统计信息
50
- */
51
- export interface SocketStats {
52
- /** 总发送消息数 */
53
- totalSent: number;
54
- /** 总接收消息数 */
55
- totalReceived: number;
56
- /** 总发送字节数 */
57
- bytesSent: number;
58
- /** 总接收字节数 */
59
- bytesReceived: number;
60
- /** 连接次数 */
61
- connectionCount: number;
62
- /** 重连次数 */
63
- reconnectionCount: number;
64
- /** 错误次数 */
65
- errorCount: number;
66
- /** 心跳发送次数 */
67
- heartbeatCount: number;
68
- /** 心跳超时次数 */
69
- heartbeatTimeoutCount: number;
70
- /** 首次连接时间 */
71
- firstConnectTime: number | null;
72
- /** 最后连接时间 */
73
- lastConnectTime: number | null;
74
- /** 当前连接持续时间(毫秒,连接状态下有效) */
75
- currentConnectionDuration: number | null;
76
- /** 平均消息大小(字节) */
77
- averageMessageSize: number;
78
- }
79
- /**
80
- * Socket监控器
81
- * 用于监控Socket的连接状态和消息历史
82
- */
83
- export declare class SocketMonitor {
84
- private socket;
85
- private options;
86
- private isMonitoring;
87
- private messageHistory;
88
- private statusHistory;
89
- private stats;
90
- private connectStartTime;
91
- private eventHandlers;
92
- /**
93
- * 创建Socket监控器
94
- * @param socket 要监控的Socket实例
95
- * @param options 监控配置选项
96
- */
97
- constructor(socket: Socket, options?: SocketMonitorOptions);
98
- /**
99
- * 开始监控
100
- */
101
- start(): void;
102
- /**
103
- * 停止监控
104
- */
105
- stop(): void;
106
- /**
107
- * 检查监控器是否处于活跃状态
108
- */
109
- isActive(): boolean;
110
- /**
111
- * 清除历史记录
112
- */
113
- clearHistory(): void;
114
- /**
115
- * 重置统计数据
116
- */
117
- resetStats(): void;
118
- /**
119
- * 获取消息历史记录
120
- * @param limit 返回的最大记录数
121
- * @param direction 消息方向过滤
122
- */
123
- getMessageHistory(limit?: number, direction?: 'in' | 'out'): SocketHistoryItem[];
124
- /**
125
- * 获取状态变更历史
126
- * @param limit 返回的最大记录数
127
- */
128
- getStatusHistory(limit?: number): SocketStatusItem[];
129
- /**
130
- * 获取统计信息
131
- */
132
- getStats(): SocketStats;
133
- /**
134
- * 设置监控事件监听
135
- */
136
- private setupEventListeners;
137
- /**
138
- * 移除监控事件监听
139
- */
140
- private removeEventListeners;
141
- /**
142
- * 记录已发送的消息
143
- */
144
- private recordMessageSent;
145
- /**
146
- * 记录已接收的消息
147
- */
148
- private recordMessageReceived;
149
- /**
150
- * 记录状态变化
151
- */
152
- private recordStatusChange;
153
- /**
154
- * 添加消息到历史记录,并控制记录数量
155
- */
156
- private addToMessageHistory;
157
- /**
158
- * 添加状态到历史记录,并控制记录数量
159
- */
160
- private addToStatusHistory;
161
- /**
162
- * 更新平均消息大小
163
- */
164
- private updateAverageMessageSize;
165
- /**
166
- * 释放资源
167
- */
168
- destroy(): void;
169
- }
1
+ import { Socket } from './socket';
2
+ import { SocketMessage, SocketStatus } from './types';
3
+ /**
4
+ * Socket历史消息记录项
5
+ */
6
+ export interface SocketHistoryItem {
7
+ /** 消息ID */
8
+ id: string;
9
+ /** 消息时间戳 */
10
+ timestamp: number;
11
+ /** 消息方向(发送/接收) */
12
+ direction: 'in' | 'out';
13
+ /** 消息内容 */
14
+ message: SocketMessage | Partial<SocketMessage>;
15
+ /** 消息大小(字节) */
16
+ size?: number;
17
+ }
18
+ /**
19
+ * Socket状态记录项
20
+ */
21
+ export interface SocketStatusItem {
22
+ /** 状态变更时间戳 */
23
+ timestamp: number;
24
+ /** 变更前状态 */
25
+ from: SocketStatus;
26
+ /** 变更后状态 */
27
+ to: SocketStatus;
28
+ /** 相关事件(如果有) */
29
+ event?: string;
30
+ /** 附加信息 */
31
+ info?: any;
32
+ }
33
+ /**
34
+ * Socket监控配置选项
35
+ */
36
+ export interface SocketMonitorOptions {
37
+ /** 最大历史消息记录数 */
38
+ maxHistoryItems?: number;
39
+ /** 最大状态变更记录数 */
40
+ maxStatusItems?: number;
41
+ /** 是否记录消息内容 */
42
+ recordMessageContent?: boolean;
43
+ /** 是否自动开始监控 */
44
+ autoStart?: boolean;
45
+ /** 过滤掉的消息类型(不记录) */
46
+ excludeEvents?: string[];
47
+ }
48
+ /**
49
+ * Socket监控统计信息
50
+ */
51
+ export interface SocketStats {
52
+ /** 总发送消息数 */
53
+ totalSent: number;
54
+ /** 总接收消息数 */
55
+ totalReceived: number;
56
+ /** 总发送字节数 */
57
+ bytesSent: number;
58
+ /** 总接收字节数 */
59
+ bytesReceived: number;
60
+ /** 连接次数 */
61
+ connectionCount: number;
62
+ /** 重连次数 */
63
+ reconnectionCount: number;
64
+ /** 错误次数 */
65
+ errorCount: number;
66
+ /** 心跳发送次数 */
67
+ heartbeatCount: number;
68
+ /** 心跳超时次数 */
69
+ heartbeatTimeoutCount: number;
70
+ /** 首次连接时间 */
71
+ firstConnectTime: number | null;
72
+ /** 最后连接时间 */
73
+ lastConnectTime: number | null;
74
+ /** 当前连接持续时间(毫秒,连接状态下有效) */
75
+ currentConnectionDuration: number | null;
76
+ /** 平均消息大小(字节) */
77
+ averageMessageSize: number;
78
+ }
79
+ /**
80
+ * Socket监控器
81
+ * 用于监控Socket的连接状态和消息历史
82
+ */
83
+ export declare class SocketMonitor {
84
+ private socket;
85
+ private options;
86
+ private isMonitoring;
87
+ private messageHistory;
88
+ private statusHistory;
89
+ private stats;
90
+ private connectStartTime;
91
+ private eventHandlers;
92
+ /**
93
+ * 创建Socket监控器
94
+ * @param socket 要监控的Socket实例
95
+ * @param options 监控配置选项
96
+ */
97
+ constructor(socket: Socket, options?: SocketMonitorOptions);
98
+ /**
99
+ * 开始监控
100
+ */
101
+ start(): void;
102
+ /**
103
+ * 停止监控
104
+ */
105
+ stop(): void;
106
+ /**
107
+ * 检查监控器是否处于活跃状态
108
+ */
109
+ isActive(): boolean;
110
+ /**
111
+ * 清除历史记录
112
+ */
113
+ clearHistory(): void;
114
+ /**
115
+ * 重置统计数据
116
+ */
117
+ resetStats(): void;
118
+ /**
119
+ * 获取消息历史记录
120
+ * @param limit 返回的最大记录数
121
+ * @param direction 消息方向过滤
122
+ */
123
+ getMessageHistory(limit?: number, direction?: 'in' | 'out'): SocketHistoryItem[];
124
+ /**
125
+ * 获取状态变更历史
126
+ * @param limit 返回的最大记录数
127
+ */
128
+ getStatusHistory(limit?: number): SocketStatusItem[];
129
+ /**
130
+ * 获取统计信息
131
+ */
132
+ getStats(): SocketStats;
133
+ /**
134
+ * 设置监控事件监听
135
+ */
136
+ private setupEventListeners;
137
+ /**
138
+ * 移除监控事件监听
139
+ */
140
+ private removeEventListeners;
141
+ /**
142
+ * 记录已发送的消息
143
+ */
144
+ private recordMessageSent;
145
+ /**
146
+ * 记录已接收的消息
147
+ */
148
+ private recordMessageReceived;
149
+ /**
150
+ * 记录状态变化
151
+ */
152
+ private recordStatusChange;
153
+ /**
154
+ * 添加消息到历史记录,并控制记录数量
155
+ */
156
+ private addToMessageHistory;
157
+ /**
158
+ * 添加状态到历史记录,并控制记录数量
159
+ */
160
+ private addToStatusHistory;
161
+ /**
162
+ * 更新平均消息大小
163
+ */
164
+ private updateAverageMessageSize;
165
+ /**
166
+ * 释放资源
167
+ */
168
+ destroy(): void;
169
+ }