gant-core 0.1.30 → 0.1.31

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.
@@ -3,7 +3,6 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <link rel="icon" type="image/png" href="/public/favicon.ico" />
7
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
7
  </head>
9
8
  <body>
package/lib/index.d.ts CHANGED
@@ -1700,6 +1700,7 @@ interface GantUserConfig extends Configuration, GantCustomConfig {
1700
1700
  devServer?: Configuration$1;
1701
1701
  }
1702
1702
  type CONFIG_TYPE = {
1703
+ IP2_BASE_CONFIG?: BASE_CONFIG_TYPE;
1703
1704
  BASE_CONFIG?: BASE_CONFIG_TYPE;
1704
1705
  MAIN_CONFIG?: MAIN_CONFIG_TYPE;
1705
1706
  SYSMGMT_CONFIG?: SYSMGMT_CONFIG_TYPE;
@@ -2149,7 +2150,7 @@ interface WEBSOCKETRECROD {
2149
2150
  recipientType: string;
2150
2151
  recipientCode: string;
2151
2152
  title?: string;
2152
- status?: '01' | '00';
2153
+ status?: "01" | "00";
2153
2154
  senderName?: string;
2154
2155
  senderTime?: string;
2155
2156
  content: string;
package/lib/index.js CHANGED
@@ -236,38 +236,38 @@ class ParameterStoreClass {
236
236
  const parameterStoreInstance = new ParameterStoreClass();
237
237
 
238
238
  //计算最终的WebSocketUrl
239
- const pingMsg = 'ping'; //客户端心跳信息
240
- const pongMsg = 'pong'; //服务端心跳信息
239
+ const pingMsg = "ping"; //客户端心跳信息
240
+ const pongMsg = "pong"; //服务端心跳信息
241
241
  const reconnectTimeout = 10000;
242
242
  const pingPongTimeout = 10000; //发送的心跳的间隔时间
243
- const WS_CONTENT_SUCCESS = 'WS_CONTENT_SUCCESS';
244
- const WS_CONTENT_ERROR = 'WS_CONTENT_ERROR';
245
- const WS_CONTENT_CLOSE = 'WS_CONTENT_CLOSE';
243
+ const WS_CONTENT_SUCCESS = "WS_CONTENT_SUCCESS";
244
+ const WS_CONTENT_ERROR = "WS_CONTENT_ERROR";
245
+ const WS_CONTENT_CLOSE = "WS_CONTENT_CLOSE";
246
246
  const getWebSocketUrl = (userLoginName) => {
247
- const suffix = 'notification-ws';
247
+ const suffix = "notification-ws";
248
248
  const paramStr = `userLoginName=${userLoginName}`;
249
249
  const { host, protocol, port, hostname } = window.location;
250
250
  //是否是https
251
- const isHttps = protocol.includes('https');
251
+ const isHttps = protocol.includes("https");
252
252
  //ws协议
253
- let wsProtocol = isHttps ? 'wss' : 'ws';
253
+ let wsProtocol = isHttps ? "wss" : "ws";
254
254
  //默认是host
255
255
  let wsHost = host;
256
256
  //如果不是是https并且有端口号时,ws端口就是web端口+1
257
257
  if (!isHttps && port) {
258
- let newhost = parseInt(port) + 1;
258
+ let newhost = parseInt(port);
259
259
  wsHost = `${hostname}:${newhost}`;
260
260
  }
261
261
  const wsAddress = `${wsProtocol}://${wsHost}/${suffix}?${paramStr}`;
262
262
  return wsAddress;
263
263
  };
264
264
  class GantWebSocket {
265
- RECIPIENT_TYPE_ALL = 'all'; // 所有用户均可收到的消息类型【公告等消息】
266
- RECIPIENT_TYPE_USER = 'user'; // 某个用户可以收到【用户通知】
267
- RECIPIENT_TYPE_OBSERVER = 'obsvr'; // 某个观察者可以收到【接口处理进度】
268
- RECIPIENT_TYPE_CONNECTION = 'conn'; // 某个连接成功接收到【ws连接专用】
265
+ RECIPIENT_TYPE_ALL = "all"; // 所有用户均可收到的消息类型【公告等消息】
266
+ RECIPIENT_TYPE_USER = "user"; // 某个用户可以收到【用户通知】
267
+ RECIPIENT_TYPE_OBSERVER = "obsvr"; // 某个观察者可以收到【接口处理进度】
268
+ RECIPIENT_TYPE_CONNECTION = "conn"; // 某个连接成功接收到【ws连接专用】
269
269
  //链接地址
270
- webSocketUrl = '';
270
+ webSocketUrl = "";
271
271
  // WebSocket
272
272
  ws = null;
273
273
  //重链次数
@@ -280,17 +280,17 @@ class GantWebSocket {
280
280
  pongTimeoutFn = null;
281
281
  reconnectFn = null;
282
282
  //是否限制次数
283
- repeatLimit = 20;
283
+ repeatLimit = 2;
284
284
  //链接标识
285
- connectionId = '';
286
- userLoginName = '';
285
+ connectionId = "";
286
+ userLoginName = "";
287
287
  eventStack = {};
288
288
  constructor() { }
289
289
  init = (userLoginName, options) => {
290
290
  this.userLoginName = userLoginName;
291
291
  this.webSocketUrl = getWebSocketUrl(userLoginName);
292
- this.disReconnect = get$1(options, 'disReconnect', false);
293
- this.repeatLimit = get$1(options, 'repeatLimit', 20);
292
+ this.disReconnect = get$1(options, "disReconnect", false);
293
+ this.repeatLimit = get$1(options, "repeatLimit", 20);
294
294
  this.createWebSocket();
295
295
  };
296
296
  createWebSocket = () => {
@@ -385,7 +385,7 @@ class GantWebSocket {
385
385
  }
386
386
  }
387
387
  catch (err) {
388
- console.warn('received error!!!', err);
388
+ console.warn("received error!!!", err);
389
389
  }
390
390
  };
391
391
  this.ws.onerror = () => {
@@ -394,7 +394,7 @@ class GantWebSocket {
394
394
  emitter.emit(WS_CONTENT_ERROR);
395
395
  };
396
396
  this.ws.onclose = () => {
397
- console.warn('webSocket close');
397
+ console.warn("webSocket close");
398
398
  this.ws = null;
399
399
  this.heartReset();
400
400
  this.reconnect();
@@ -406,7 +406,7 @@ class GantWebSocket {
406
406
  const id = uniqueId();
407
407
  this.eventStack[id] = {
408
408
  recipientType: eventType,
409
- type: 'recipientType',
409
+ type: "recipientType",
410
410
  event,
411
411
  };
412
412
  return id;