@pisell/pisellos 3.0.57 → 3.0.58
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.
- package/dist/core/index.js +1 -2
- package/dist/effects/index.d.ts +3 -4
- package/dist/effects/index.js +6 -15
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Payment/index.d.ts +9 -273
- package/dist/modules/Payment/index.js +109 -2525
- package/dist/modules/Payment/types.d.ts +30 -382
- package/dist/modules/Payment/types.js +14 -116
- package/dist/modules/ProductList/index.d.ts +1 -12
- package/dist/modules/ProductList/index.js +3 -27
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +1 -9
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Payment/index.d.ts +9 -273
- package/lib/modules/Payment/index.js +50 -1285
- package/lib/modules/Payment/types.d.ts +30 -382
- package/lib/modules/Payment/types.js +6 -41
- package/lib/modules/ProductList/index.d.ts +1 -12
- package/lib/modules/ProductList/index.js +2 -29
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +2 -1
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/lib/types/index.d.ts +1 -3
- package/package.json +2 -4
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/modules/Payment/cash.d.ts +0 -11
- package/dist/modules/Payment/cash.js +0 -78
- package/dist/modules/Payment/eftpos.d.ts +0 -11
- package/dist/modules/Payment/eftpos.js +0 -80
- package/dist/modules/Payment/wallet.d.ts +0 -11
- package/dist/modules/Payment/wallet.js +0 -78
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/plugins/app-types/app/app.d.ts +0 -83
- package/dist/plugins/app-types/app/const.d.ts +0 -4
- package/dist/plugins/app-types/app/index.d.ts +0 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/dist/plugins/app-types/config.d.ts +0 -3
- package/dist/plugins/app-types/cookie/index.d.ts +0 -13
- package/dist/plugins/app-types/data/index.d.ts +0 -8
- package/dist/plugins/app-types/history/config.d.ts +0 -24
- package/dist/plugins/app-types/history/index.d.ts +0 -20
- package/dist/plugins/app-types/history/type.d.ts +0 -2
- package/dist/plugins/app-types/hooks/index.d.ts +0 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/dist/plugins/app-types/index.d.ts +0 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
- package/dist/plugins/app-types/locales/en.d.ts +0 -3
- package/dist/plugins/app-types/locales/index.d.ts +0 -37
- package/dist/plugins/app-types/locales/original.d.ts +0 -3
- package/dist/plugins/app-types/locales/type.d.ts +0 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
- package/dist/plugins/app-types/logger/index.d.ts +0 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
- package/dist/plugins/app-types/models/global.d.ts +0 -32
- package/dist/plugins/app-types/models/index.d.ts +0 -45
- package/dist/plugins/app-types/models/type.d.ts +0 -2
- package/dist/plugins/app-types/package.json +0 -15
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
- package/dist/plugins/app-types/request/cache.d.ts +0 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/dist/plugins/app-types/request/config.d.ts +0 -3
- package/dist/plugins/app-types/request/constants.d.ts +0 -2
- package/dist/plugins/app-types/request/index.d.ts +0 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/dist/plugins/app-types/request/type.d.ts +0 -41
- package/dist/plugins/app-types/request/utils.d.ts +0 -46
- package/dist/plugins/app-types/routes/config.d.ts +0 -7
- package/dist/plugins/app-types/routes/index.d.ts +0 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
- package/dist/plugins/app-types/socket/constants.d.ts +0 -33
- package/dist/plugins/app-types/socket/events.d.ts +0 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/dist/plugins/app-types/socket/index.d.ts +0 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/dist/plugins/app-types/socket/socket.d.ts +0 -129
- package/dist/plugins/app-types/socket/types.d.ts +0 -85
- package/dist/plugins/app-types/storage/index.d.ts +0 -17
- package/dist/plugins/app-types/tasks/index.d.ts +0 -77
- package/dist/plugins/app-types/tasks/type.d.ts +0 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/dist/plugins/app-types/type.d.ts +0 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/dist/plugins/app-types/variables/config.d.ts +0 -3
- package/dist/plugins/app-types/variables/index.d.ts +0 -6
- package/dist/plugins/app-types/variables/type.d.ts +0 -2
- package/dist/plugins/app-types/website/index.d.ts +0 -6
- package/dist/plugins/app.d.ts +0 -8
- package/dist/plugins/app.js +0 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/Checkout/index.d.ts +0 -181
- package/dist/solution/Checkout/index.js +0 -1596
- package/dist/solution/Checkout/types.d.ts +0 -550
- package/dist/solution/Checkout/types.js +0 -132
- package/dist/solution/Checkout/utils/index.d.ts +0 -73
- package/dist/solution/Checkout/utils/index.js +0 -371
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/modules/Payment/cash.d.ts +0 -11
- package/lib/modules/Payment/cash.js +0 -51
- package/lib/modules/Payment/eftpos.d.ts +0 -11
- package/lib/modules/Payment/eftpos.js +0 -51
- package/lib/modules/Payment/wallet.d.ts +0 -11
- package/lib/modules/Payment/wallet.js +0 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/plugins/app-types/app/app.d.ts +0 -83
- package/lib/plugins/app-types/app/const.d.ts +0 -4
- package/lib/plugins/app-types/app/index.d.ts +0 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/lib/plugins/app-types/config.d.ts +0 -3
- package/lib/plugins/app-types/cookie/index.d.ts +0 -13
- package/lib/plugins/app-types/data/index.d.ts +0 -8
- package/lib/plugins/app-types/history/config.d.ts +0 -24
- package/lib/plugins/app-types/history/index.d.ts +0 -20
- package/lib/plugins/app-types/history/type.d.ts +0 -2
- package/lib/plugins/app-types/hooks/index.d.ts +0 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/lib/plugins/app-types/index.d.ts +0 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
- package/lib/plugins/app-types/locales/en.d.ts +0 -3
- package/lib/plugins/app-types/locales/index.d.ts +0 -37
- package/lib/plugins/app-types/locales/original.d.ts +0 -3
- package/lib/plugins/app-types/locales/type.d.ts +0 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
- package/lib/plugins/app-types/logger/index.d.ts +0 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
- package/lib/plugins/app-types/models/global.d.ts +0 -32
- package/lib/plugins/app-types/models/index.d.ts +0 -45
- package/lib/plugins/app-types/models/type.d.ts +0 -2
- package/lib/plugins/app-types/package.json +0 -15
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
- package/lib/plugins/app-types/request/cache.d.ts +0 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/lib/plugins/app-types/request/config.d.ts +0 -3
- package/lib/plugins/app-types/request/constants.d.ts +0 -2
- package/lib/plugins/app-types/request/index.d.ts +0 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/lib/plugins/app-types/request/type.d.ts +0 -41
- package/lib/plugins/app-types/request/utils.d.ts +0 -46
- package/lib/plugins/app-types/routes/config.d.ts +0 -7
- package/lib/plugins/app-types/routes/index.d.ts +0 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
- package/lib/plugins/app-types/socket/constants.d.ts +0 -33
- package/lib/plugins/app-types/socket/events.d.ts +0 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/lib/plugins/app-types/socket/index.d.ts +0 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/lib/plugins/app-types/socket/socket.d.ts +0 -129
- package/lib/plugins/app-types/socket/types.d.ts +0 -85
- package/lib/plugins/app-types/storage/index.d.ts +0 -17
- package/lib/plugins/app-types/tasks/index.d.ts +0 -77
- package/lib/plugins/app-types/tasks/type.d.ts +0 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/lib/plugins/app-types/type.d.ts +0 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/lib/plugins/app-types/variables/config.d.ts +0 -3
- package/lib/plugins/app-types/variables/index.d.ts +0 -6
- package/lib/plugins/app-types/variables/type.d.ts +0 -2
- package/lib/plugins/app-types/website/index.d.ts +0 -6
- package/lib/plugins/app.d.ts +0 -8
- package/lib/plugins/app.js +0 -17
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/index.d.ts +0 -181
- package/lib/solution/Checkout/index.js +0 -864
- package/lib/solution/Checkout/types.d.ts +0 -550
- package/lib/solution/Checkout/types.js +0 -75
- package/lib/solution/Checkout/utils/index.d.ts +0 -73
- package/lib/solution/Checkout/utils/index.js +0 -266
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -1,169 +0,0 @@
|
|
|
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,61 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,77 +0,0 @@
|
|
|
1
|
-
import { Task, TasksModule, RunTaskParams, AddTaskParams, DeleteTaskParams } from "./type";
|
|
2
|
-
import App from "../app";
|
|
3
|
-
export declare class TasksManager {
|
|
4
|
-
private static instance;
|
|
5
|
-
private taskFunctions;
|
|
6
|
-
private tasks;
|
|
7
|
-
private app;
|
|
8
|
-
private db;
|
|
9
|
-
useTasks: () => {
|
|
10
|
-
tasks: TasksModule;
|
|
11
|
-
};
|
|
12
|
-
watchTaskCallback: (taskModule: TasksModule) => void;
|
|
13
|
-
constructor(app: App);
|
|
14
|
-
static getInstance(app?: App): TasksManager;
|
|
15
|
-
addTaskFunction<T>(name: string, fun: T): void;
|
|
16
|
-
addTaskFunctions<T>(tasks: {
|
|
17
|
-
name: string;
|
|
18
|
-
fun: T;
|
|
19
|
-
}[]): void;
|
|
20
|
-
getTasks(): TasksModule;
|
|
21
|
-
getTaskFunction(name: string): any;
|
|
22
|
-
init(): Promise<void>;
|
|
23
|
-
private saveTaskQueueToLocal;
|
|
24
|
-
private loadTaskQueueFromLocal;
|
|
25
|
-
/**
|
|
26
|
-
* @title: 执行任务
|
|
27
|
-
* @description:
|
|
28
|
-
* @param {Task} task
|
|
29
|
-
* @return {*}
|
|
30
|
-
* @Author: zhiwei.Wang
|
|
31
|
-
* @Date: 2024-09-26 13:53
|
|
32
|
-
*/
|
|
33
|
-
private runTask;
|
|
34
|
-
/**
|
|
35
|
-
* @title: 启动轮询
|
|
36
|
-
* @description: 根据轮询间隔定期执行任务
|
|
37
|
-
* @param {Task} task
|
|
38
|
-
* @return {*}
|
|
39
|
-
*/
|
|
40
|
-
private startPolling;
|
|
41
|
-
/**
|
|
42
|
-
* @title: 创建任务数据
|
|
43
|
-
* @description:
|
|
44
|
-
* @param {Partial} payload
|
|
45
|
-
* @return {*}
|
|
46
|
-
* @Author: zhiwei.Wang
|
|
47
|
-
* @Date: 2024-09-26 13:54
|
|
48
|
-
*/
|
|
49
|
-
private createTaskData;
|
|
50
|
-
private getTaskQueue;
|
|
51
|
-
private timeout;
|
|
52
|
-
/**
|
|
53
|
-
* @title: 执行任务队列
|
|
54
|
-
* @description:
|
|
55
|
-
* @return {*}
|
|
56
|
-
* @Author: zhiwei.Wang
|
|
57
|
-
* @Date: 2024-09-26 13:52
|
|
58
|
-
*/
|
|
59
|
-
run(payload: RunTaskParams): Promise<void>;
|
|
60
|
-
deleteTask(payload: DeleteTaskParams): void;
|
|
61
|
-
/**
|
|
62
|
-
* @title: 重试任务
|
|
63
|
-
* @description:
|
|
64
|
-
* @return {*}
|
|
65
|
-
* @Author: zhiwei.Wang
|
|
66
|
-
* @Date: 2024-09-26 13:53
|
|
67
|
-
*/
|
|
68
|
-
retryTask(payload: RunTaskParams): void;
|
|
69
|
-
addTask(payload: AddTaskParams): void;
|
|
70
|
-
private updateTask;
|
|
71
|
-
private updateQueueStatus;
|
|
72
|
-
private setTasks;
|
|
73
|
-
clearAllTaskTimer(tasks: Task[]): void;
|
|
74
|
-
clearTasks(payload: RunTaskParams): void;
|
|
75
|
-
clearAllTasks(): void;
|
|
76
|
-
watchTask(callback: (taskModule: TasksModule) => void): void;
|
|
77
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export type TaskRunStatus = "pending" | "in-progress" | "success" | "failure";
|
|
2
|
-
export interface Task {
|
|
3
|
-
id?: string;
|
|
4
|
-
type?: "local" | "cloud";
|
|
5
|
-
retries?: number;
|
|
6
|
-
maxRetries?: number;
|
|
7
|
-
status?: TaskRunStatus;
|
|
8
|
-
action: string;
|
|
9
|
-
payload: any;
|
|
10
|
-
beforeAction?: string;
|
|
11
|
-
beforePayload?: any;
|
|
12
|
-
afterAction?: string;
|
|
13
|
-
afterPayload?: any;
|
|
14
|
-
polling?: {
|
|
15
|
-
interval?: number;
|
|
16
|
-
};
|
|
17
|
-
pollingResult?: {
|
|
18
|
-
count: number;
|
|
19
|
-
timerId?: any;
|
|
20
|
-
};
|
|
21
|
-
manual?: boolean;
|
|
22
|
-
destroy?: boolean;
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
}
|
|
25
|
-
export interface TaskConfig {
|
|
26
|
-
tasks: Task[];
|
|
27
|
-
}
|
|
28
|
-
type TaskModuleName = string;
|
|
29
|
-
type TaskQueueName = string;
|
|
30
|
-
type TaskStatus = "uncompleted" | "completed";
|
|
31
|
-
export interface TaskQueue {
|
|
32
|
-
status: TaskStatus;
|
|
33
|
-
tasks: Task[];
|
|
34
|
-
}
|
|
35
|
-
export interface RunTaskParams {
|
|
36
|
-
module: TaskModuleName;
|
|
37
|
-
queueId: TaskQueueName;
|
|
38
|
-
callback?: () => void;
|
|
39
|
-
}
|
|
40
|
-
export interface DeleteTaskParams {
|
|
41
|
-
module: TaskModuleName;
|
|
42
|
-
queueId: TaskQueueName;
|
|
43
|
-
taskId: string;
|
|
44
|
-
}
|
|
45
|
-
export interface AddTaskParams {
|
|
46
|
-
module: TaskModuleName;
|
|
47
|
-
queueId: TaskQueueName;
|
|
48
|
-
tasks: Task[];
|
|
49
|
-
}
|
|
50
|
-
export interface TaskRunResult {
|
|
51
|
-
status: TaskRunStatus;
|
|
52
|
-
[key: string]: any;
|
|
53
|
-
}
|
|
54
|
-
export interface TasksModule {
|
|
55
|
-
[key: TaskModuleName]: {
|
|
56
|
-
[key: TaskQueueName]: {
|
|
57
|
-
status: TaskStatus;
|
|
58
|
-
tasks: Task[];
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export {};
|
package/dist/plugins/app.d.ts
DELETED
package/dist/plugins/app.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|