@pisell/pisellos 0.0.220 → 0.0.221

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 (190) 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 +1 -1
  112. package/dist/solution/BookingTicket/index.js +82 -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.js +19 -19
  118. package/dist/solution/BookingTicket/utils/scan/scanCache.js +52 -52
  119. package/dist/solution/BuyTickets/types.js +4 -4
  120. package/dist/utils/task.js +11 -11
  121. package/dist/utils/watch.js +59 -59
  122. package/lib/plugins/app-types/app/app.d.ts +83 -83
  123. package/lib/plugins/app-types/app/const.d.ts +4 -4
  124. package/lib/plugins/app-types/app/index.d.ts +14 -14
  125. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -50
  126. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -13
  127. package/lib/plugins/app-types/config.d.ts +3 -3
  128. package/lib/plugins/app-types/cookie/index.d.ts +13 -13
  129. package/lib/plugins/app-types/data/index.d.ts +8 -8
  130. package/lib/plugins/app-types/history/config.d.ts +24 -24
  131. package/lib/plugins/app-types/history/index.d.ts +20 -20
  132. package/lib/plugins/app-types/history/type.d.ts +2 -2
  133. package/lib/plugins/app-types/hooks/index.d.ts +12 -12
  134. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
  135. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
  136. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
  137. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -6
  138. package/lib/plugins/app-types/index.d.ts +6 -6
  139. package/lib/plugins/app-types/indexDB/index.d.ts +178 -178
  140. package/lib/plugins/app-types/locales/en.d.ts +3 -3
  141. package/lib/plugins/app-types/locales/index.d.ts +37 -37
  142. package/lib/plugins/app-types/locales/original.d.ts +3 -3
  143. package/lib/plugins/app-types/locales/type.d.ts +19 -19
  144. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -3
  145. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -3
  146. package/lib/plugins/app-types/logger/feishu.d.ts +11 -11
  147. package/lib/plugins/app-types/logger/index.d.ts +122 -122
  148. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -17
  149. package/lib/plugins/app-types/menuManager/index.d.ts +28 -28
  150. package/lib/plugins/app-types/models/global.d.ts +32 -32
  151. package/lib/plugins/app-types/models/index.d.ts +45 -45
  152. package/lib/plugins/app-types/models/type.d.ts +2 -2
  153. package/lib/plugins/app-types/package.json +14 -14
  154. package/lib/plugins/app-types/pubsub/example.d.ts +5 -5
  155. package/lib/plugins/app-types/pubsub/index.d.ts +63 -63
  156. package/lib/plugins/app-types/request/cache.d.ts +46 -46
  157. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -38
  158. package/lib/plugins/app-types/request/config.d.ts +3 -3
  159. package/lib/plugins/app-types/request/constants.d.ts +2 -2
  160. package/lib/plugins/app-types/request/index.d.ts +24 -24
  161. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -6
  162. package/lib/plugins/app-types/request/type.d.ts +41 -41
  163. package/lib/plugins/app-types/request/utils.d.ts +46 -46
  164. package/lib/plugins/app-types/routes/config.d.ts +7 -7
  165. package/lib/plugins/app-types/routes/index.d.ts +28 -28
  166. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
  167. package/lib/plugins/app-types/socket/components/index.d.ts +2 -2
  168. package/lib/plugins/app-types/socket/constants.d.ts +33 -33
  169. package/lib/plugins/app-types/socket/events.d.ts +31 -31
  170. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -66
  171. package/lib/plugins/app-types/socket/index.d.ts +61 -61
  172. package/lib/plugins/app-types/socket/monitor.d.ts +169 -169
  173. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -61
  174. package/lib/plugins/app-types/socket/socket.d.ts +129 -129
  175. package/lib/plugins/app-types/socket/types.d.ts +85 -85
  176. package/lib/plugins/app-types/storage/index.d.ts +17 -17
  177. package/lib/plugins/app-types/tasks/index.d.ts +77 -77
  178. package/lib/plugins/app-types/tasks/type.d.ts +62 -62
  179. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -5
  180. package/lib/plugins/app-types/type.d.ts +2 -2
  181. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
  182. package/lib/plugins/app-types/variables/config.d.ts +3 -3
  183. package/lib/plugins/app-types/variables/index.d.ts +6 -6
  184. package/lib/plugins/app-types/variables/type.d.ts +2 -2
  185. package/lib/plugins/app-types/website/index.d.ts +6 -6
  186. package/lib/solution/BookingTicket/index.d.ts +1 -1
  187. package/lib/solution/BookingTicket/index.js +1 -2
  188. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -4
  189. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -14
  190. package/package.json +1 -1
@@ -1,61 +1,61 @@
1
- import { ReconnectOptions } from './types';
2
- /**
3
- * Socket重连管理器
4
- * 处理断线重连逻辑
5
- */
6
- export declare class ReconnectManager {
7
- private options;
8
- private attempts;
9
- private timer;
10
- private isReconnecting;
11
- private reconnectCallback;
12
- private onAttempt;
13
- private onSuccess;
14
- private onFail;
15
- private onMaxAttemptsExceeded;
16
- /**
17
- * 创建重连管理器实例
18
- * @param options 重连配置
19
- * @param reconnectCallback 重连执行函数
20
- * @param callbacks 回调函数集合
21
- */
22
- constructor(options: ReconnectOptions, reconnectCallback: () => Promise<boolean>, callbacks?: {
23
- onAttempt?: (attempt: number) => void;
24
- onSuccess?: () => void;
25
- onFail?: (error: Error) => void;
26
- onMaxAttemptsExceeded?: () => void;
27
- });
28
- /**
29
- * 启动重连过程
30
- */
31
- startReconnect(): void;
32
- /**
33
- * 停止重连过程
34
- */
35
- stopReconnect(): void;
36
- /**
37
- * 获取当前重连尝试次数
38
- */
39
- getReconnectAttempts(): number;
40
- /**
41
- * 获取当前是否正在重连
42
- */
43
- isActive(): boolean;
44
- /**
45
- * 重置重连状态
46
- */
47
- reset(): void;
48
- /**
49
- * 安排下一次重连尝试
50
- */
51
- private scheduleReconnect;
52
- /**
53
- * 执行重连操作
54
- */
55
- private executeReconnect;
56
- /**
57
- * 计算重连延迟时间
58
- * 支持指数退避算法,增加随机抖动
59
- */
60
- private getReconnectDelay;
61
- }
1
+ import { ReconnectOptions } from './types';
2
+ /**
3
+ * Socket重连管理器
4
+ * 处理断线重连逻辑
5
+ */
6
+ export declare class ReconnectManager {
7
+ private options;
8
+ private attempts;
9
+ private timer;
10
+ private isReconnecting;
11
+ private reconnectCallback;
12
+ private onAttempt;
13
+ private onSuccess;
14
+ private onFail;
15
+ private onMaxAttemptsExceeded;
16
+ /**
17
+ * 创建重连管理器实例
18
+ * @param options 重连配置
19
+ * @param reconnectCallback 重连执行函数
20
+ * @param callbacks 回调函数集合
21
+ */
22
+ constructor(options: ReconnectOptions, reconnectCallback: () => Promise<boolean>, callbacks?: {
23
+ onAttempt?: (attempt: number) => void;
24
+ onSuccess?: () => void;
25
+ onFail?: (error: Error) => void;
26
+ onMaxAttemptsExceeded?: () => void;
27
+ });
28
+ /**
29
+ * 启动重连过程
30
+ */
31
+ startReconnect(): void;
32
+ /**
33
+ * 停止重连过程
34
+ */
35
+ stopReconnect(): void;
36
+ /**
37
+ * 获取当前重连尝试次数
38
+ */
39
+ getReconnectAttempts(): number;
40
+ /**
41
+ * 获取当前是否正在重连
42
+ */
43
+ isActive(): boolean;
44
+ /**
45
+ * 重置重连状态
46
+ */
47
+ reset(): void;
48
+ /**
49
+ * 安排下一次重连尝试
50
+ */
51
+ private scheduleReconnect;
52
+ /**
53
+ * 执行重连操作
54
+ */
55
+ private executeReconnect;
56
+ /**
57
+ * 计算重连延迟时间
58
+ * 支持指数退避算法,增加随机抖动
59
+ */
60
+ private getReconnectDelay;
61
+ }
@@ -1,129 +1,129 @@
1
- import { SocketOptions, SocketStatus } from "./types";
2
- import { SocketMonitor, SocketMonitorOptions } from "./monitor";
3
- /**
4
- * Socket主类
5
- * 负责管理WebSocket连接、消息收发、事件处理、心跳检测和断线重连
6
- */
7
- export declare class Socket {
8
- private ws;
9
- private url;
10
- private options;
11
- private status;
12
- private eventHandlers;
13
- private heartbeatManager;
14
- private reconnectManager;
15
- private monitor;
16
- private messageIdCounter;
17
- /**
18
- * 创建Socket实例
19
- * @param options Socket配置选项
20
- */
21
- constructor(options: SocketOptions);
22
- /**
23
- * 建立WebSocket连接
24
- */
25
- connect(): Promise<void>;
26
- /**
27
- * 关闭WebSocket连接
28
- */
29
- disconnect(): void;
30
- /**
31
- * 发送消息到服务器
32
- * @param event 事件名称
33
- * @param data 消息数据
34
- * @param id 消息ID(可选,默认自动生成)
35
- */
36
- send(type: string, data?: any, id?: string): void;
37
- /**
38
- * 发送原始消息
39
- * @param message 消息对象
40
- */
41
- private sendRaw;
42
- /**
43
- * 注册事件监听器
44
- * @param event 事件名称
45
- * @param handler 事件处理函数
46
- */
47
- on(event: string, handler: (...args: any[]) => void): void;
48
- /**
49
- * 移除事件监听器
50
- * @param event 事件名称
51
- * @param handler 事件处理函数(可选,不提供则移除所有该事件的处理函数)
52
- */
53
- off(event: string, handler?: (...args: any[]) => void): void;
54
- /**
55
- * 触发事件
56
- * @param event 事件名称
57
- * @param args 事件参数
58
- */
59
- private emit;
60
- /**
61
- * 获取当前连接状态
62
- */
63
- getStatus(): SocketStatus;
64
- /**
65
- * 获取当前状态描述
66
- */
67
- getStatusText(): string;
68
- /**
69
- * 检查是否已连接
70
- */
71
- isConnected(): boolean;
72
- /**
73
- * 设置连接状态
74
- */
75
- private setStatus;
76
- /**
77
- * 设置WebSocket事件监听器
78
- */
79
- private setupWebSocketListeners;
80
- /**
81
- * 处理接收到的消息
82
- */
83
- private handleMessage;
84
- /**
85
- * 处理连接关闭
86
- */
87
- private handleConnectionClosed;
88
- /**
89
- * 处理连接失败
90
- */
91
- private handleConnectionFailure;
92
- /**
93
- * 处理心跳响应
94
- */
95
- private handleHeartbeatResponse;
96
- /**
97
- * 初始化心跳检测
98
- */
99
- private initHeartbeat;
100
- /**
101
- * 初始化重连管理
102
- */
103
- private initReconnect;
104
- /**
105
- * 开始重连过程
106
- */
107
- private startReconnection;
108
- /**
109
- * 生成消息ID
110
- */
111
- private generateMessageId;
112
- /**
113
- * 启用监控功能
114
- * @param options 监控配置选项
115
- */
116
- enableMonitoring(options?: SocketMonitorOptions): SocketMonitor;
117
- /**
118
- * 禁用监控功能
119
- */
120
- disableMonitoring(): void;
121
- /**
122
- * 获取监控器实例
123
- */
124
- getMonitor(): SocketMonitor | null;
125
- /**
126
- * 释放资源
127
- */
128
- destroy(): void;
129
- }
1
+ import { SocketOptions, SocketStatus } from "./types";
2
+ import { SocketMonitor, SocketMonitorOptions } from "./monitor";
3
+ /**
4
+ * Socket主类
5
+ * 负责管理WebSocket连接、消息收发、事件处理、心跳检测和断线重连
6
+ */
7
+ export declare class Socket {
8
+ private ws;
9
+ private url;
10
+ private options;
11
+ private status;
12
+ private eventHandlers;
13
+ private heartbeatManager;
14
+ private reconnectManager;
15
+ private monitor;
16
+ private messageIdCounter;
17
+ /**
18
+ * 创建Socket实例
19
+ * @param options Socket配置选项
20
+ */
21
+ constructor(options: SocketOptions);
22
+ /**
23
+ * 建立WebSocket连接
24
+ */
25
+ connect(): Promise<void>;
26
+ /**
27
+ * 关闭WebSocket连接
28
+ */
29
+ disconnect(): void;
30
+ /**
31
+ * 发送消息到服务器
32
+ * @param event 事件名称
33
+ * @param data 消息数据
34
+ * @param id 消息ID(可选,默认自动生成)
35
+ */
36
+ send(type: string, data?: any, id?: string): void;
37
+ /**
38
+ * 发送原始消息
39
+ * @param message 消息对象
40
+ */
41
+ private sendRaw;
42
+ /**
43
+ * 注册事件监听器
44
+ * @param event 事件名称
45
+ * @param handler 事件处理函数
46
+ */
47
+ on(event: string, handler: (...args: any[]) => void): void;
48
+ /**
49
+ * 移除事件监听器
50
+ * @param event 事件名称
51
+ * @param handler 事件处理函数(可选,不提供则移除所有该事件的处理函数)
52
+ */
53
+ off(event: string, handler?: (...args: any[]) => void): void;
54
+ /**
55
+ * 触发事件
56
+ * @param event 事件名称
57
+ * @param args 事件参数
58
+ */
59
+ private emit;
60
+ /**
61
+ * 获取当前连接状态
62
+ */
63
+ getStatus(): SocketStatus;
64
+ /**
65
+ * 获取当前状态描述
66
+ */
67
+ getStatusText(): string;
68
+ /**
69
+ * 检查是否已连接
70
+ */
71
+ isConnected(): boolean;
72
+ /**
73
+ * 设置连接状态
74
+ */
75
+ private setStatus;
76
+ /**
77
+ * 设置WebSocket事件监听器
78
+ */
79
+ private setupWebSocketListeners;
80
+ /**
81
+ * 处理接收到的消息
82
+ */
83
+ private handleMessage;
84
+ /**
85
+ * 处理连接关闭
86
+ */
87
+ private handleConnectionClosed;
88
+ /**
89
+ * 处理连接失败
90
+ */
91
+ private handleConnectionFailure;
92
+ /**
93
+ * 处理心跳响应
94
+ */
95
+ private handleHeartbeatResponse;
96
+ /**
97
+ * 初始化心跳检测
98
+ */
99
+ private initHeartbeat;
100
+ /**
101
+ * 初始化重连管理
102
+ */
103
+ private initReconnect;
104
+ /**
105
+ * 开始重连过程
106
+ */
107
+ private startReconnection;
108
+ /**
109
+ * 生成消息ID
110
+ */
111
+ private generateMessageId;
112
+ /**
113
+ * 启用监控功能
114
+ * @param options 监控配置选项
115
+ */
116
+ enableMonitoring(options?: SocketMonitorOptions): SocketMonitor;
117
+ /**
118
+ * 禁用监控功能
119
+ */
120
+ disableMonitoring(): void;
121
+ /**
122
+ * 获取监控器实例
123
+ */
124
+ getMonitor(): SocketMonitor | null;
125
+ /**
126
+ * 释放资源
127
+ */
128
+ destroy(): void;
129
+ }
@@ -1,85 +1,85 @@
1
- /**
2
- * Socket配置选项
3
- */
4
- export interface SocketOptions {
5
- /** 是否自动连接 */
6
- autoConnect?: boolean;
7
- /** 是否启用重连功能 */
8
- reconnection?: boolean;
9
- /** 最大重连尝试次数,默认无限 */
10
- reconnectionAttempts?: number;
11
- /** 重连延迟时间(毫秒) */
12
- reconnectionDelay?: number;
13
- /** 最大重连延迟时间(毫秒) */
14
- reconnectionDelayMax?: number;
15
- /** 是否启用心跳检测 */
16
- heartbeat?: boolean;
17
- /** 心跳间隔时间(毫秒) */
18
- heartbeatInterval?: number;
19
- /** 请求超时时间(毫秒) */
20
- timeout?: number;
21
- /** 心跳超时时间(毫秒) */
22
- heartbeatTimeout?: number;
23
- /** 自定义协议 */
24
- protocols?: string | string[];
25
- /** 连接URL */
26
- url: string;
27
- }
28
- /**
29
- * Socket连接状态
30
- */
31
- export declare enum SocketStatus {
32
- CONNECTING = 0,
33
- OPEN = 1,
34
- CLOSING = 2,
35
- CLOSED = 3,
36
- RECONNECTING = 4
37
- }
38
- /**
39
- * Socket消息格式
40
- */
41
- export interface SocketMessage<T = any> {
42
- /** 事件类型 */
43
- type: string;
44
- /** 消息数据 */
45
- data?: T;
46
- /** 消息ID */
47
- id?: string;
48
- event?: any;
49
- }
50
- /**
51
- * 心跳配置选项
52
- */
53
- export interface HeartbeatOptions {
54
- /** 心跳间隔时间(毫秒) */
55
- interval: number;
56
- /** 心跳超时时间(毫秒) */
57
- timeout: number;
58
- /** 心跳探测消息 */
59
- message?: SocketMessage;
60
- }
61
- /**
62
- * 重连配置选项
63
- */
64
- export interface ReconnectOptions {
65
- /** 是否启用重连 */
66
- enabled: boolean;
67
- /** 最大重连尝试次数 */
68
- attempts?: number;
69
- /** 重连延迟时间(毫秒) */
70
- delay: number;
71
- /** 最大重连延迟时间(毫秒) */
72
- delayMax?: number;
73
- /** 是否使用指数退避算法 */
74
- jitter?: boolean;
75
- }
76
- /**
77
- * 事件处理函数类型
78
- */
79
- export type EventHandler = (...args: any[]) => void;
80
- /**
81
- * 事件处理函数映射
82
- */
83
- export interface EventHandlerMap {
84
- [event: string]: EventHandler[];
85
- }
1
+ /**
2
+ * Socket配置选项
3
+ */
4
+ export interface SocketOptions {
5
+ /** 是否自动连接 */
6
+ autoConnect?: boolean;
7
+ /** 是否启用重连功能 */
8
+ reconnection?: boolean;
9
+ /** 最大重连尝试次数,默认无限 */
10
+ reconnectionAttempts?: number;
11
+ /** 重连延迟时间(毫秒) */
12
+ reconnectionDelay?: number;
13
+ /** 最大重连延迟时间(毫秒) */
14
+ reconnectionDelayMax?: number;
15
+ /** 是否启用心跳检测 */
16
+ heartbeat?: boolean;
17
+ /** 心跳间隔时间(毫秒) */
18
+ heartbeatInterval?: number;
19
+ /** 请求超时时间(毫秒) */
20
+ timeout?: number;
21
+ /** 心跳超时时间(毫秒) */
22
+ heartbeatTimeout?: number;
23
+ /** 自定义协议 */
24
+ protocols?: string | string[];
25
+ /** 连接URL */
26
+ url: string;
27
+ }
28
+ /**
29
+ * Socket连接状态
30
+ */
31
+ export declare enum SocketStatus {
32
+ CONNECTING = 0,
33
+ OPEN = 1,
34
+ CLOSING = 2,
35
+ CLOSED = 3,
36
+ RECONNECTING = 4
37
+ }
38
+ /**
39
+ * Socket消息格式
40
+ */
41
+ export interface SocketMessage<T = any> {
42
+ /** 事件类型 */
43
+ type: string;
44
+ /** 消息数据 */
45
+ data?: T;
46
+ /** 消息ID */
47
+ id?: string;
48
+ event?: any;
49
+ }
50
+ /**
51
+ * 心跳配置选项
52
+ */
53
+ export interface HeartbeatOptions {
54
+ /** 心跳间隔时间(毫秒) */
55
+ interval: number;
56
+ /** 心跳超时时间(毫秒) */
57
+ timeout: number;
58
+ /** 心跳探测消息 */
59
+ message?: SocketMessage;
60
+ }
61
+ /**
62
+ * 重连配置选项
63
+ */
64
+ export interface ReconnectOptions {
65
+ /** 是否启用重连 */
66
+ enabled: boolean;
67
+ /** 最大重连尝试次数 */
68
+ attempts?: number;
69
+ /** 重连延迟时间(毫秒) */
70
+ delay: number;
71
+ /** 最大重连延迟时间(毫秒) */
72
+ delayMax?: number;
73
+ /** 是否使用指数退避算法 */
74
+ jitter?: boolean;
75
+ }
76
+ /**
77
+ * 事件处理函数类型
78
+ */
79
+ export type EventHandler = (...args: any[]) => void;
80
+ /**
81
+ * 事件处理函数映射
82
+ */
83
+ export interface EventHandlerMap {
84
+ [event: string]: EventHandler[];
85
+ }
@@ -1,17 +1,17 @@
1
- import App from '../app';
2
- export interface StorageOptions {
3
- storageKey?: string;
4
- removeStorageAfter?: (key: string) => void;
5
- setStorageAfter?: (key: string, value: string) => void;
6
- }
7
- export declare class Storage {
8
- private storageKey;
9
- private app?;
10
- private options;
11
- constructor(app?: App, options?: StorageOptions);
12
- createKey: (key: string) => string;
13
- setStorage: (key: string, value: string) => void;
14
- getStorage: (key: string) => string | null;
15
- removeStorage: (key: string) => void;
16
- clear: () => void;
17
- }
1
+ import App from '../app';
2
+ export interface StorageOptions {
3
+ storageKey?: string;
4
+ removeStorageAfter?: (key: string) => void;
5
+ setStorageAfter?: (key: string, value: string) => void;
6
+ }
7
+ export declare class Storage {
8
+ private storageKey;
9
+ private app?;
10
+ private options;
11
+ constructor(app?: App, options?: StorageOptions);
12
+ createKey: (key: string) => string;
13
+ setStorage: (key: string, value: string) => void;
14
+ getStorage: (key: string) => string | null;
15
+ removeStorage: (key: string) => void;
16
+ clear: () => void;
17
+ }