ztxkutils 2.10.66-5 → 2.10.66-50
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/businessTools.js +4 -3
- package/dist/{dataModel-1fbaff40.js → dataModel-f1ef06bc.js} +4 -2
- package/dist/dataModel.js +2 -1
- package/dist/fileOperation.d.ts +27 -0
- package/dist/fileOperation.js +74 -9
- package/dist/hooks.js +35 -23
- package/dist/i18next.d.ts +2 -0
- package/dist/i18next.js +2401 -0
- package/dist/index.js +6 -5
- package/dist/myIndexDb.d.ts +1 -1
- package/dist/print.d.ts +2 -4
- package/dist/print.js +60 -12
- package/dist/reqUrl-e44a69ed.js +83 -0
- package/dist/{reqUrl-22b880a4.js → reqUrl-ea7ef876.js} +3 -2
- package/dist/reqUrl.js +1 -1
- package/dist/request-2ae9cfae.js +2991 -0
- package/dist/request-34b75d7b.js +2994 -0
- package/dist/request-36ce2fed.js +3005 -0
- package/dist/request-3b358860.js +2988 -0
- package/dist/{request-87d93572.js → request-40e9ca7b.js} +16 -8
- package/dist/request-49900ec9.js +3010 -0
- package/dist/request-6df00145.js +3006 -0
- package/dist/request-6f0aa072.js +3008 -0
- package/dist/{request-dc69f021.js → request-7bcf02f4.js} +34 -20
- package/dist/{request-3c906c2d.js → request-e147d640.js} +98 -23
- package/dist/request.d.ts +8 -0
- package/dist/request.js +2 -1
- package/dist/stompClient.d.ts +13 -0
- package/dist/stompClient.js +118 -66
- package/dist/test1.d.ts +1 -0
- package/dist/tools-05479576.js +2502 -0
- package/dist/tools-38e8ca87.js +2503 -0
- package/dist/{tools-16a7fb45.js → tools-47b9bee7.js} +53 -1
- package/dist/tools.d.ts +3 -1
- package/dist/tools.js +1 -1
- package/dist/useFileIdToBase64.js +1 -1
- package/dist/useHistory.js +7 -0
- package/dist/{validate-18e52490.js → validate-2138d94a.js} +29 -15
- package/dist/validate.d.ts +1 -0
- package/dist/validate.js +2 -1
- package/dist/workflow.js +4 -6
- package/locales/en-US.json +64 -0
- package/locales/zh-CN.json +64 -0
- package/package.json +41 -4
- package/zti18n-cli/bin/index.js +3 -0
- package/zti18n-cli/index.js +23 -0
- package/zti18n-cli/src/command/collect.js +353 -0
- package/zti18n-cli/src/command/convert.js +17 -0
- package/zti18n-cli/src/command/convert2.js +35 -0
- package/zti18n-cli/src/command/initFileConf.js +133 -0
- package/zti18n-cli/src/command/publish.js +24 -0
- package/zti18n-cli/src/conf/BaseConf.js +21 -0
- package/zti18n-cli/src/conf/FileConf.js +116 -0
- package/zti18n-cli/src/index.js +75 -0
- package/zti18n-cli/src/translate/google.js +87 -0
- package/zti18n-cli/src/utils/isChinese.js +3 -0
- package/zti18n-cli/src/utils/log.js +8 -0
- package/zti18n-cli/src/utils/mergeOptions.js +45 -0
- package/zti18n-cli/src/utils/reactOptions.js +73 -0
- package/zti18n-cli/src/utils/vueOptions.js +69 -0
- package/zti18n-core/index.js +1 -0
- package/zti18n-core/src/index.js +5 -0
- package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -0
- package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -0
- package/zti18n-core/src/transform/defaultPkMap.js +79 -0
- package/zti18n-core/src/transform/transformHtml.js +271 -0
- package/zti18n-core/src/transform/transformJs.js +489 -0
- package/zti18n-core/src/transform/transformPug.js +272 -0
- package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -0
- package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -0
- package/zti18n-core/src/transform/transformToDi18n.js +22 -0
- package/zti18n-core/src/transform/transformTs.js +41 -0
- package/zti18n-core/src/transform/transformVue.js +126 -0
- package/zti18n-core/src/transform/transformZeroToDi18n.js +105 -0
- package/zti18n-core/src/translate/google.js +6 -0
- package/zti18n-core/src/utils/constants.js +3 -0
- package/zti18n-core/src/utils/getIgnoreLines.js +14 -0
- package/zti18n-core/src/utils/isChinese.js +3 -0
- package/zti18n-core/src/utils/log.js +8 -0
package/dist/stompClient.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import instance from './i18next.js';
|
1
2
|
import Stomp from 'zt-stompjs';
|
2
3
|
import SockJS from 'zt-sockjs-client';
|
3
4
|
import { g as getToken } from './authority-7a91cb9f.js';
|
@@ -58,18 +59,22 @@ var StompClient = /** @class */ (function () {
|
|
58
59
|
this.clearIsClient = setTimeout(function () {
|
59
60
|
_this.clearIsClient = null;
|
60
61
|
if (!_this.isClient) {
|
61
|
-
console.log(
|
62
|
+
console.log(instance.t('连接已发起,但是10秒后未成功建立连接,手动断开重连!system={{slot0}}', { slot0: _this.connectWsConfig.systemType }));
|
62
63
|
try {
|
63
64
|
_this.client.disconnect(function () {
|
64
65
|
_this.client = null;
|
65
66
|
});
|
66
67
|
}
|
67
68
|
catch (err) {
|
68
|
-
console.log('---连接未建立的关闭出错---', err);
|
69
|
+
console.log(instance.t('---连接未建立的关闭出错---'), err);
|
69
70
|
}
|
70
71
|
_this.reconnectionNum++;
|
71
72
|
var timeInterval = _this.getReconnectionTime();
|
72
|
-
console.log(
|
73
|
+
console.log(instance.t('---第{{slot0}}次重连!time={{slot1}}system={{slot2}}---', {
|
74
|
+
slot0: _this.reconnectionNum,
|
75
|
+
slot1: Date.now(),
|
76
|
+
slot2: _this.connectWsConfig.systemType,
|
77
|
+
}));
|
73
78
|
if (_this.clearIsClientNo) {
|
74
79
|
clearTimeout(_this.clearIsClientNo);
|
75
80
|
_this.clearIsClientNo = null;
|
@@ -112,40 +117,16 @@ var StompClient = /** @class */ (function () {
|
|
112
117
|
_this.clearIsClientYes = null;
|
113
118
|
}
|
114
119
|
_this.reconnectionNum = 0;
|
115
|
-
console.log(
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
if (!isExecute) {
|
122
|
-
subscriptionsFn === null || subscriptionsFn === void 0 ? void 0 : subscriptionsFn();
|
123
|
-
_this.subscriptionsFn[key].isExecute = true;
|
124
|
-
}
|
125
|
-
});
|
126
|
-
}
|
127
|
-
// 连接成功后,统一执行连接成功函数
|
128
|
-
var successCallbackKeys = Object.keys(_this.successCallbacks);
|
129
|
-
if (Array.isArray(successCallbackKeys)) {
|
130
|
-
successCallbackKeys.forEach(function (key) {
|
131
|
-
var _a = _this.successCallbacks[key], isExecute = _a.isExecute, callback = _a.callback;
|
132
|
-
if (!isExecute) {
|
133
|
-
callback && callback();
|
134
|
-
}
|
135
|
-
_this.successCallbacks[key].isExecute = true;
|
136
|
-
});
|
137
|
-
}
|
138
|
-
// 将失败回调 的执行状态 重置为未执行状态
|
139
|
-
var errorCallbackKeys = Object.keys(_this.errorCallbacks);
|
140
|
-
if (Array.isArray(errorCallbackKeys)) {
|
141
|
-
errorCallbackKeys.forEach(function (key) {
|
142
|
-
_this.errorCallbacks[key].isExecute = false;
|
143
|
-
});
|
144
|
-
}
|
120
|
+
console.log(instance.t('---------连接成功 time={{slot0}} system={{slot1}} time={{slot2}}--------', {
|
121
|
+
slot0: Date.now(),
|
122
|
+
slot1: _this.connectWsConfig.systemType,
|
123
|
+
slot2: Date.now(),
|
124
|
+
}));
|
125
|
+
_this.executeSubscribe();
|
145
126
|
},
|
146
127
|
// 连接失败回调
|
147
128
|
function (err) {
|
148
|
-
console.log(
|
129
|
+
console.log(instance.t('---------连接失败 system={{slot0}} time={{slot1}}--------', { slot0: _this.connectWsConfig.systemType, slot1: Date.now() }));
|
149
130
|
console.log(err);
|
150
131
|
if (_this.userClose) {
|
151
132
|
_this.userClose = false; // 重新初始化 重新计算
|
@@ -161,7 +142,9 @@ var StompClient = /** @class */ (function () {
|
|
161
142
|
clearTimeout(_this.clearIsClientYes);
|
162
143
|
_this.clearIsClientYes = null;
|
163
144
|
}
|
164
|
-
|
145
|
+
// 连接失败后,将所有注册过的订阅、回调执行状态置为未执行状态。
|
146
|
+
_this.setExecuteFail();
|
147
|
+
console.log(instance.t('用户主动关闭'));
|
165
148
|
return;
|
166
149
|
}
|
167
150
|
_this.isClient = true;
|
@@ -177,32 +160,8 @@ var StompClient = /** @class */ (function () {
|
|
177
160
|
clearTimeout(_this.clearIsClientYes);
|
178
161
|
_this.clearIsClientYes = null;
|
179
162
|
}
|
180
|
-
//
|
181
|
-
|
182
|
-
var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
|
183
|
-
if (Array.isArray(subscriptionsFnKeys)) {
|
184
|
-
subscriptionsFnKeys.forEach(function (key) {
|
185
|
-
_this.subscriptionsFn[key].isExecute = false;
|
186
|
-
});
|
187
|
-
}
|
188
|
-
// 连接失败后,统一执行连接失败函数
|
189
|
-
var errorCallbackKeys = Object.keys(_this.errorCallbacks);
|
190
|
-
if (Array.isArray(errorCallbackKeys)) {
|
191
|
-
errorCallbackKeys.forEach(function (key) {
|
192
|
-
var _a = _this.errorCallbacks[key], isExecute = _a.isExecute, callback = _a.callback;
|
193
|
-
if (!isExecute) {
|
194
|
-
callback && callback();
|
195
|
-
}
|
196
|
-
_this.errorCallbacks[key].isExecute = true;
|
197
|
-
});
|
198
|
-
}
|
199
|
-
// 将成功回调 的执行状态 重置为未执行状态
|
200
|
-
var successCallbackKeys = Object.keys(_this.successCallbacks);
|
201
|
-
if (Array.isArray(successCallbackKeys)) {
|
202
|
-
successCallbackKeys.forEach(function (key) {
|
203
|
-
_this.successCallbacks[key].isExecute = false;
|
204
|
-
});
|
205
|
-
}
|
163
|
+
// 连接失败后,将所有注册过的订阅、回调执行状态置为未执行状态。
|
164
|
+
_this.setExecuteFail();
|
206
165
|
// 重连逻辑, 默认3秒后重连
|
207
166
|
// 重连间隔,每隔5秒递增,超过最大间隔时间后,取最大间隔时间重连
|
208
167
|
try {
|
@@ -211,14 +170,15 @@ var StompClient = /** @class */ (function () {
|
|
211
170
|
});
|
212
171
|
}
|
213
172
|
catch (err) {
|
214
|
-
console.log(
|
173
|
+
console.log(instance.t('---连接已建立的关闭出错 time={{slot0}}system={{slot1}}---', { slot0: Date.now(), slot1: _this.connectWsConfig.systemType }), err);
|
215
174
|
}
|
216
175
|
_this.reconnectionNum++;
|
217
|
-
// const timeInterval =
|
218
|
-
// Math.ceil(this.reconnectionNum / 5) *
|
219
|
-
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
220
176
|
var timeInterval = _this.getReconnectionTime();
|
221
|
-
console.log(
|
177
|
+
console.log(instance.t('---第{{slot0}}次重连!time={{slot1}}system={{slot2}}', {
|
178
|
+
slot0: _this.reconnectionNum,
|
179
|
+
slot1: Date.now(),
|
180
|
+
slot2: _this.connectWsConfig.systemType,
|
181
|
+
}));
|
222
182
|
_this.clearIsClientYes = setTimeout(function () {
|
223
183
|
_this.init();
|
224
184
|
}, timeInterval > _this.maxReconnectiontime
|
@@ -226,6 +186,76 @@ var StompClient = /** @class */ (function () {
|
|
226
186
|
: timeInterval);
|
227
187
|
});
|
228
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
|
+
};
|
229
259
|
// 重连时间计算
|
230
260
|
StompClient.prototype.getReconnectionTime = function () {
|
231
261
|
var _a;
|
@@ -310,6 +340,28 @@ var StompClient = /** @class */ (function () {
|
|
310
340
|
}
|
311
341
|
});
|
312
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
|
+
};
|
313
365
|
// 发送消息
|
314
366
|
StompClient.prototype.send = function (pipe, headers, message) {
|
315
367
|
if (typeof headers === 'string') {
|
package/dist/test1.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|