ztxkutils 2.10.66-44 → 2.10.66-46
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/fileOperation.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.js +1 -1
- package/dist/stompClient.d.ts +13 -0
- package/dist/stompClient.js +97 -58
- package/dist/test1.d.ts +1 -0
- package/dist/tools-38e8ca87.js +2503 -0
- package/dist/tools.d.ts +3 -1
- package/dist/tools.js +1 -1
- package/dist/useFileIdToBase64.js +1 -1
- package/dist/workflow.js +1 -1
- package/package.json +1 -1
package/dist/fileOperation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { g as getToken } from './authority-7a91cb9f.js';
|
2
|
-
import { d as dangerouslySetXss } from './tools-
|
2
|
+
import { d as dangerouslySetXss } from './tools-38e8ca87.js';
|
3
3
|
import { a as crypto } from './crypto-c481f616.js';
|
4
4
|
import './tslib.es6-35653116.js';
|
5
5
|
import 'dayjs';
|
package/dist/hooks.js
CHANGED
@@ -6,7 +6,7 @@ import { message } from 'ztxkui';
|
|
6
6
|
import axios from 'axios';
|
7
7
|
import './fileOperation.js';
|
8
8
|
import './authority-7a91cb9f.js';
|
9
|
-
import './tools-
|
9
|
+
import './tools-38e8ca87.js';
|
10
10
|
import 'dayjs';
|
11
11
|
import './crypto-c481f616.js';
|
12
12
|
import 'crypto';
|
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { d as authority } from './authority-7a91cb9f.js';
|
2
2
|
export { d as dataModel } from './dataModel-f1ef06bc.js';
|
3
|
-
export { t as tools } from './tools-
|
3
|
+
export { t as tools } from './tools-38e8ca87.js';
|
4
4
|
export { v as validate } from './validate-2138d94a.js';
|
5
5
|
export { r as request } from './request-34b75d7b.js';
|
6
6
|
export { r as reqUrl } from './reqUrl-ea7ef876.js';
|
package/dist/stompClient.d.ts
CHANGED
@@ -30,12 +30,25 @@ declare class StompClient {
|
|
30
30
|
isInit: boolean;
|
31
31
|
constructor(connectWsConfig: IConnectWsConfig);
|
32
32
|
init(): void;
|
33
|
+
/**
|
34
|
+
* 连接失败后,将所有注册过的订阅、回调执行状态置为未执行状态。
|
35
|
+
* @param isExecute 连接通道、回调的执行状态
|
36
|
+
*/
|
37
|
+
setExecuteFail(): void;
|
38
|
+
/**
|
39
|
+
* 连接成功后,需要将当前已注册的,未执行的连接通道重新执行连接
|
40
|
+
* 还有成功回调
|
41
|
+
* 失败回调的执行状态重置为未执行状态
|
42
|
+
* @returns 执行订阅相关回调
|
43
|
+
*/
|
44
|
+
executeSubscribe(): void;
|
33
45
|
getReconnectionTime(): number;
|
34
46
|
subscribeSuccessCall(subscribeId: string, callback: () => void): void;
|
35
47
|
subscribeErrorCall(subscribeId: string, callback: () => void): void;
|
36
48
|
subscribe(subscribeId: string, pipe: string, callback?: (response: any) => void, headers?: any): void;
|
37
49
|
getSubscriptions(key: any): any;
|
38
50
|
disconnect(callback: () => void): Promise<unknown>;
|
51
|
+
reconnect(): Promise<unknown>;
|
39
52
|
send(pipe: string, headers: object, message: string): void;
|
40
53
|
}
|
41
54
|
export default StompClient;
|
package/dist/stompClient.js
CHANGED
@@ -122,35 +122,7 @@ var StompClient = /** @class */ (function () {
|
|
122
122
|
slot1: _this.connectWsConfig.systemType,
|
123
123
|
slot2: Date.now(),
|
124
124
|
}));
|
125
|
-
|
126
|
-
var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
|
127
|
-
if (Array.isArray(subscriptionsFnKeys)) {
|
128
|
-
subscriptionsFnKeys.forEach(function (key) {
|
129
|
-
var _a = _this.subscriptionsFn[key], isExecute = _a.isExecute, subscriptionsFn = _a.subscriptionsFn;
|
130
|
-
if (!isExecute) {
|
131
|
-
subscriptionsFn === null || subscriptionsFn === void 0 ? void 0 : subscriptionsFn();
|
132
|
-
_this.subscriptionsFn[key].isExecute = true;
|
133
|
-
}
|
134
|
-
});
|
135
|
-
}
|
136
|
-
// 连接成功后,统一执行连接成功函数
|
137
|
-
var successCallbackKeys = Object.keys(_this.successCallbacks);
|
138
|
-
if (Array.isArray(successCallbackKeys)) {
|
139
|
-
successCallbackKeys.forEach(function (key) {
|
140
|
-
var _a = _this.successCallbacks[key], isExecute = _a.isExecute, callback = _a.callback;
|
141
|
-
if (!isExecute) {
|
142
|
-
callback && callback();
|
143
|
-
}
|
144
|
-
_this.successCallbacks[key].isExecute = true;
|
145
|
-
});
|
146
|
-
}
|
147
|
-
// 将失败回调 的执行状态 重置为未执行状态
|
148
|
-
var errorCallbackKeys = Object.keys(_this.errorCallbacks);
|
149
|
-
if (Array.isArray(errorCallbackKeys)) {
|
150
|
-
errorCallbackKeys.forEach(function (key) {
|
151
|
-
_this.errorCallbacks[key].isExecute = false;
|
152
|
-
});
|
153
|
-
}
|
125
|
+
_this.executeSubscribe();
|
154
126
|
},
|
155
127
|
// 连接失败回调
|
156
128
|
function (err) {
|
@@ -170,6 +142,8 @@ var StompClient = /** @class */ (function () {
|
|
170
142
|
clearTimeout(_this.clearIsClientYes);
|
171
143
|
_this.clearIsClientYes = null;
|
172
144
|
}
|
145
|
+
// 连接失败后,将所有注册过的订阅、回调执行状态置为未执行状态。
|
146
|
+
_this.setExecuteFail();
|
173
147
|
console.log(instance.t('用户主动关闭'));
|
174
148
|
return;
|
175
149
|
}
|
@@ -186,32 +160,8 @@ var StompClient = /** @class */ (function () {
|
|
186
160
|
clearTimeout(_this.clearIsClientYes);
|
187
161
|
_this.clearIsClientYes = null;
|
188
162
|
}
|
189
|
-
//
|
190
|
-
|
191
|
-
var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
|
192
|
-
if (Array.isArray(subscriptionsFnKeys)) {
|
193
|
-
subscriptionsFnKeys.forEach(function (key) {
|
194
|
-
_this.subscriptionsFn[key].isExecute = false;
|
195
|
-
});
|
196
|
-
}
|
197
|
-
// 连接失败后,统一执行连接失败函数
|
198
|
-
var errorCallbackKeys = Object.keys(_this.errorCallbacks);
|
199
|
-
if (Array.isArray(errorCallbackKeys)) {
|
200
|
-
errorCallbackKeys.forEach(function (key) {
|
201
|
-
var _a = _this.errorCallbacks[key], isExecute = _a.isExecute, callback = _a.callback;
|
202
|
-
if (!isExecute) {
|
203
|
-
callback && callback();
|
204
|
-
}
|
205
|
-
_this.errorCallbacks[key].isExecute = true;
|
206
|
-
});
|
207
|
-
}
|
208
|
-
// 将成功回调 的执行状态 重置为未执行状态
|
209
|
-
var successCallbackKeys = Object.keys(_this.successCallbacks);
|
210
|
-
if (Array.isArray(successCallbackKeys)) {
|
211
|
-
successCallbackKeys.forEach(function (key) {
|
212
|
-
_this.successCallbacks[key].isExecute = false;
|
213
|
-
});
|
214
|
-
}
|
163
|
+
// 连接失败后,将所有注册过的订阅、回调执行状态置为未执行状态。
|
164
|
+
_this.setExecuteFail();
|
215
165
|
// 重连逻辑, 默认3秒后重连
|
216
166
|
// 重连间隔,每隔5秒递增,超过最大间隔时间后,取最大间隔时间重连
|
217
167
|
try {
|
@@ -223,9 +173,6 @@ var StompClient = /** @class */ (function () {
|
|
223
173
|
console.log(instance.t('---连接已建立的关闭出错 time={{slot0}}system={{slot1}}---', { slot0: Date.now(), slot1: _this.connectWsConfig.systemType }), err);
|
224
174
|
}
|
225
175
|
_this.reconnectionNum++;
|
226
|
-
// const timeInterval =
|
227
|
-
// Math.ceil(this.reconnectionNum / 5) *
|
228
|
-
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
229
176
|
var timeInterval = _this.getReconnectionTime();
|
230
177
|
console.log(instance.t('---第{{slot0}}次重连!time={{slot1}}system={{slot2}}', {
|
231
178
|
slot0: _this.reconnectionNum,
|
@@ -239,6 +186,76 @@ var StompClient = /** @class */ (function () {
|
|
239
186
|
: timeInterval);
|
240
187
|
});
|
241
188
|
};
|
189
|
+
/**
|
190
|
+
* 连接失败后,将所有注册过的订阅、回调执行状态置为未执行状态。
|
191
|
+
* @param isExecute 连接通道、回调的执行状态
|
192
|
+
*/
|
193
|
+
StompClient.prototype.setExecuteFail = function () {
|
194
|
+
var _this = this;
|
195
|
+
// 连接失败后,将当前已注册的 连接通道 全部置为未执行状态
|
196
|
+
var subscriptionsFnKeys = Object.keys(this.subscriptionsFn);
|
197
|
+
if (Array.isArray(subscriptionsFnKeys)) {
|
198
|
+
subscriptionsFnKeys.forEach(function (key) {
|
199
|
+
_this.subscriptionsFn[key].isExecute = false;
|
200
|
+
});
|
201
|
+
}
|
202
|
+
// 连接失败后,统一执行连接失败函数
|
203
|
+
var errorCallbackKeys = Object.keys(this.errorCallbacks);
|
204
|
+
if (Array.isArray(errorCallbackKeys)) {
|
205
|
+
errorCallbackKeys.forEach(function (key) {
|
206
|
+
var _a = _this.errorCallbacks[key], isExecute = _a.isExecute, callback = _a.callback;
|
207
|
+
if (!isExecute) {
|
208
|
+
callback && callback();
|
209
|
+
}
|
210
|
+
_this.errorCallbacks[key].isExecute = true;
|
211
|
+
});
|
212
|
+
}
|
213
|
+
// 将成功回调 的执行状态 重置为未执行状态
|
214
|
+
var successCallbackKeys = Object.keys(this.successCallbacks);
|
215
|
+
if (Array.isArray(successCallbackKeys)) {
|
216
|
+
successCallbackKeys.forEach(function (key) {
|
217
|
+
_this.successCallbacks[key].isExecute = false;
|
218
|
+
});
|
219
|
+
}
|
220
|
+
};
|
221
|
+
/**
|
222
|
+
* 连接成功后,需要将当前已注册的,未执行的连接通道重新执行连接
|
223
|
+
* 还有成功回调
|
224
|
+
* 失败回调的执行状态重置为未执行状态
|
225
|
+
* @returns 执行订阅相关回调
|
226
|
+
*/
|
227
|
+
StompClient.prototype.executeSubscribe = function () {
|
228
|
+
var _this = this;
|
229
|
+
// 连接成功后,将当前已注册的,未执行的 连接通道 连接
|
230
|
+
var subscriptionsFnKeys = Object.keys(this.subscriptionsFn);
|
231
|
+
if (Array.isArray(subscriptionsFnKeys)) {
|
232
|
+
subscriptionsFnKeys.forEach(function (key) {
|
233
|
+
var _a = _this.subscriptionsFn[key], isExecute = _a.isExecute, subscriptionsFn = _a.subscriptionsFn;
|
234
|
+
if (!isExecute) {
|
235
|
+
subscriptionsFn === null || subscriptionsFn === void 0 ? void 0 : subscriptionsFn();
|
236
|
+
_this.subscriptionsFn[key].isExecute = true;
|
237
|
+
}
|
238
|
+
});
|
239
|
+
}
|
240
|
+
// 连接成功后,统一执行连接成功函数
|
241
|
+
var successCallbackKeys = Object.keys(this.successCallbacks);
|
242
|
+
if (Array.isArray(successCallbackKeys)) {
|
243
|
+
successCallbackKeys.forEach(function (key) {
|
244
|
+
var _a = _this.successCallbacks[key], isExecute = _a.isExecute, callback = _a.callback;
|
245
|
+
if (!isExecute) {
|
246
|
+
callback && callback();
|
247
|
+
}
|
248
|
+
_this.successCallbacks[key].isExecute = true;
|
249
|
+
});
|
250
|
+
}
|
251
|
+
// 将失败回调 的执行状态 重置为未执行状态
|
252
|
+
var errorCallbackKeys = Object.keys(this.errorCallbacks);
|
253
|
+
if (Array.isArray(errorCallbackKeys)) {
|
254
|
+
errorCallbackKeys.forEach(function (key) {
|
255
|
+
_this.errorCallbacks[key].isExecute = false;
|
256
|
+
});
|
257
|
+
}
|
258
|
+
};
|
242
259
|
// 重连时间计算
|
243
260
|
StompClient.prototype.getReconnectionTime = function () {
|
244
261
|
var _a;
|
@@ -323,6 +340,28 @@ var StompClient = /** @class */ (function () {
|
|
323
340
|
}
|
324
341
|
});
|
325
342
|
};
|
343
|
+
// 手动重新连接
|
344
|
+
StompClient.prototype.reconnect = function () {
|
345
|
+
var _this = this;
|
346
|
+
this.isInit = false;
|
347
|
+
this.userClose = true;
|
348
|
+
return new Promise(function (resolve, reject) {
|
349
|
+
try {
|
350
|
+
_this.setExecuteFail();
|
351
|
+
_this.client.disconnect(function () {
|
352
|
+
_this.client = null;
|
353
|
+
resolve(null);
|
354
|
+
});
|
355
|
+
setTimeout(function () {
|
356
|
+
_this.userClose = false;
|
357
|
+
_this.init();
|
358
|
+
}, 400);
|
359
|
+
}
|
360
|
+
catch (err) {
|
361
|
+
resolve(null);
|
362
|
+
}
|
363
|
+
});
|
364
|
+
};
|
326
365
|
// 发送消息
|
327
366
|
StompClient.prototype.send = function (pipe, headers, message) {
|
328
367
|
if (typeof headers === 'string') {
|
package/dist/test1.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|