@vuu-ui/vuu-data-remote 2.1.13 → 2.1.16

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.
@@ -130,6 +130,45 @@ var EventEmitter = class {
130
130
  };
131
131
  _events = new WeakMap();
132
132
 
133
+ // ../vuu-utils/src/protocol-message-utils.ts
134
+ var MENU_RPC_TYPES = [
135
+ "VIEW_PORT_MENUS_SELECT_RPC",
136
+ "VIEW_PORT_MENU_TABLE_RPC",
137
+ "VIEW_PORT_MENU_ROW_RPC",
138
+ "VIEW_PORT_MENU_CELL_RPC"
139
+ ];
140
+ var INVALID_SESSION = "Invalid session";
141
+ var SESSION_LIMIT_EXCEEDED = "User session limit exceeded";
142
+ var INVALID_TOKEN = "Invalid token";
143
+ var TOKEN_EXPIRED = "Token has expired";
144
+ var InvalidLoginMessages = [
145
+ INVALID_SESSION,
146
+ SESSION_LIMIT_EXCEEDED,
147
+ INVALID_TOKEN,
148
+ TOKEN_EXPIRED
149
+ ];
150
+ var isErrorMessage = (message) => typeof message == "object" && (message == null ? void 0 : message.type) === "ERROR";
151
+ var isLoginErrorMessage = (message) => typeof message === "string" && InvalidLoginMessages.includes(message);
152
+ var isSelectRequest = (message) => message && typeof message === "object" && "type" in message && (message.type === "SELECT_ROW" || message.type === "DESELECT_ROW" || message.type === "SELECT_ROW_RANGE" || message.type === "SELECT_ALL" || message.type === "DESELECT_ALL");
153
+ var isRpcServiceRequest = (message) => message.type === "RPC_REQUEST";
154
+ var hasViewPortContext = (message) => message.context.type === "VIEWPORT_CONTEXT";
155
+ var isVuuMenuRpcRequest = (message) => MENU_RPC_TYPES.includes(message["type"]);
156
+ var isOpenDialogAction = (action) => action !== void 0 && action.type === "OPEN_DIALOG_ACTION";
157
+ var isCreateVpSuccess = (response) => response.type === "CREATE_VP_SUCCESS";
158
+ var isSessionTable = (table) => {
159
+ if (table !== null && typeof table === "object" && "table" in table && "module" in table) {
160
+ return table.table.startsWith("session");
161
+ }
162
+ return false;
163
+ };
164
+ function isActionMessage(rpcResponse) {
165
+ return rpcResponse.type === "VIEW_PORT_MENU_RESP";
166
+ }
167
+ function isSessionTableActionMessage(rpcResponse) {
168
+ var _a, _b;
169
+ return isActionMessage(rpcResponse) && isOpenDialogAction(rpcResponse.action) && isSessionTable(rpcResponse.action.table) && (((_a = rpcResponse.action) == null ? void 0 : _a.renderComponent) === "inline-form" || ((_b = rpcResponse.action) == null ? void 0 : _b.renderComponent) === "grid");
170
+ }
171
+
133
172
  // ../vuu-utils/src/datasource/datasource-utils.ts
134
173
  var isConnectionQualityMetrics = (msg) => msg.type === "connection-metrics";
135
174
  var isVisualLinkMessage = (msg) => msg.type.endsWith("_VISUAL_LINK");
@@ -304,45 +343,6 @@ var RangeMonitor = class {
304
343
  }
305
344
  };
306
345
 
307
- // ../vuu-utils/src/protocol-message-utils.ts
308
- var MENU_RPC_TYPES = [
309
- "VIEW_PORT_MENUS_SELECT_RPC",
310
- "VIEW_PORT_MENU_TABLE_RPC",
311
- "VIEW_PORT_MENU_ROW_RPC",
312
- "VIEW_PORT_MENU_CELL_RPC"
313
- ];
314
- var INVALID_SESSION = "Invalid session";
315
- var SESSION_LIMIT_EXCEEDED = "User session limit exceeded";
316
- var INVALID_TOKEN = "Invalid token";
317
- var TOKEN_EXPIRED = "Token has expired";
318
- var InvalidLoginMessages = [
319
- INVALID_SESSION,
320
- SESSION_LIMIT_EXCEEDED,
321
- INVALID_TOKEN,
322
- TOKEN_EXPIRED
323
- ];
324
- var isErrorMessage = (message) => typeof message == "object" && (message == null ? void 0 : message.type) === "ERROR";
325
- var isLoginErrorMessage = (message) => typeof message === "string" && InvalidLoginMessages.includes(message);
326
- var isSelectRequest = (message) => message && typeof message === "object" && "type" in message && (message.type === "SELECT_ROW" || message.type === "DESELECT_ROW" || message.type === "SELECT_ROW_RANGE" || message.type === "SELECT_ALL" || message.type === "DESELECT_ALL");
327
- var isRpcServiceRequest = (message) => message.type === "RPC_REQUEST";
328
- var hasViewPortContext = (message) => message.context.type === "VIEWPORT_CONTEXT";
329
- var isVuuMenuRpcRequest = (message) => MENU_RPC_TYPES.includes(message["type"]);
330
- var isOpenDialogAction = (action) => action !== void 0 && action.type === "OPEN_DIALOG_ACTION";
331
- var isCreateVpSuccess = (response) => response.type === "CREATE_VP_SUCCESS";
332
- var isSessionTable = (table) => {
333
- if (table !== null && typeof table === "object" && "table" in table && "module" in table) {
334
- return table.table.startsWith("session");
335
- }
336
- return false;
337
- };
338
- function isActionMessage(rpcResponse) {
339
- return rpcResponse.type === "VIEW_PORT_MENU_RESP";
340
- }
341
- function isSessionTableActionMessage(rpcResponse) {
342
- var _a, _b;
343
- return isActionMessage(rpcResponse) && isOpenDialogAction(rpcResponse.action) && isSessionTable(rpcResponse.action.table) && (((_a = rpcResponse.action) == null ? void 0 : _a.renderComponent) === "inline-form" || ((_b = rpcResponse.action) == null ? void 0 : _b.renderComponent) === "grid");
344
- }
345
-
346
346
  // ../vuu-utils/src/keyset.ts
347
347
  var EMPTY = [];
348
348
  var KeySet = class {
@@ -590,9 +590,13 @@ var ArrayBackedMovingWindow = class {
590
590
  get range() {
591
591
  return __privateGet(this, _range);
592
592
  }
593
- get hasAllRowsWithinRange() {
594
- return this.rowsWithinRange === this.clientRange.to - this.clientRange.from || this.rowCount > 0 && this.clientRange.from + this.rowsWithinRange === this.rowCount;
595
- }
593
+ // get hasAllRowsWithinRange(): boolean {
594
+ // return (
595
+ // this.rowsWithinRange === this.clientRange.to - this.clientRange.from ||
596
+ // (this.rowCount > 0 &&
597
+ // this.clientRange.from + this.rowsWithinRange === this.rowCount)
598
+ // );
599
+ // }
596
600
  // Check to see if set of rows is outside the current viewport range, indicating
597
601
  // that veiwport is being scrolled quickly and server is not able to keep up.
598
602
  outOfRange(firstIndex, lastIndex) {
@@ -906,9 +910,7 @@ var Viewport = class {
906
910
  this.table = table;
907
911
  this.sort = sort;
908
912
  this.title = title;
909
- infoEnabled && (info == null ? void 0 : info(
910
- \`constructor #\${viewport} \${table.table} bufferSize=\${bufferSize}\`
911
- ));
913
+ infoEnabled && (info == null ? void 0 : info(\`\${table.table} #\${viewport}, bufferSize=\${bufferSize}\`));
912
914
  this.dataWindow = new ArrayBackedMovingWindow(
913
915
  __privateGet(this, _clientRange),
914
916
  range,
@@ -1223,6 +1225,7 @@ var Viewport = class {
1223
1225
  }
1224
1226
  suspend() {
1225
1227
  this.suspended = true;
1228
+ this.pendingUpdates.length = 0;
1226
1229
  info == null ? void 0 : info("suspend");
1227
1230
  }
1228
1231
  resume() {
@@ -1360,9 +1363,11 @@ var Viewport = class {
1360
1363
  }
1361
1364
  if (row.updateType === "U") {
1362
1365
  if ((_c = this.dataWindow) == null ? void 0 : _c.setAtIndex(row)) {
1363
- this.hasUpdates = true;
1364
- if (!this.batchMode) {
1365
- this.pendingUpdates.push(row);
1366
+ if (this.suspended !== true) {
1367
+ this.hasUpdates = true;
1368
+ if (!this.batchMode) {
1369
+ this.pendingUpdates.push(row);
1370
+ }
1366
1371
  }
1367
1372
  }
1368
1373
  }
@@ -1498,9 +1503,9 @@ var WebSocketConnection = class extends EventEmitter {
1498
1503
  __privateAdd(this, _ws);
1499
1504
  __publicField(this, "receive", (evt) => {
1500
1505
  if (isLoginErrorMessage(evt.data)) {
1501
- console.log(\`[WebSocketConnection] closed because of login issue\`);
1506
+ console.warn(\`[WebSocketConnection] closed because of login issue\`);
1502
1507
  if (__privateGet(this, _deferredOpen)) {
1503
- console.log(\`... and qwe have a deferred connection\`);
1508
+ console.warn(\`... and we have a deferred connection\`);
1504
1509
  }
1505
1510
  __privateGet(this, _callback).call(this, {
1506
1511
  type: "LOGIN_REJECTED",
@@ -1511,7 +1516,7 @@ var WebSocketConnection = class extends EventEmitter {
1511
1516
  const vuuMessageFromServer = parseWebSocketMessage(evt.data);
1512
1517
  if (debugEnabled3) {
1513
1518
  if (vuuMessageFromServer.body.type !== "HB") {
1514
- debug3(\`\${vuuMessageFromServer.body.type}\`);
1519
+ debug3(\`<=== \${vuuMessageFromServer.body.type}\`);
1515
1520
  if (vuuMessageFromServer.body.type === "CHANGE_VP_SUCCESS") {
1516
1521
  debug3(JSON.stringify(vuuMessageFromServer.body));
1517
1522
  }
@@ -1530,7 +1535,7 @@ var WebSocketConnection = class extends EventEmitter {
1530
1535
  var _a;
1531
1536
  if (msg.body.type === "CHANGE_VP_RANGE") {
1532
1537
  info2 == null ? void 0 : info2(
1533
- \`CHANGE_VP_RANGE<#\${msg.requestId}> \${msg.body.from}-\${msg.body.to}\`
1538
+ \`===> CHANGE_VP_RANGE<#\${msg.requestId}> \${msg.body.from}-\${msg.body.to}\`
1534
1539
  );
1535
1540
  }
1536
1541
  (_a = __privateGet(this, _ws)) == null ? void 0 : _a.send(JSON.stringify(msg));
@@ -2419,26 +2424,26 @@ var ServerProxy = class {
2419
2424
  if (debugEnabled4) {
2420
2425
  const [firstRow] = body.rows;
2421
2426
  if (body.rows.length === 0) {
2422
- infoEnabled2 && info3("handleMessageFromServer TABLE_ROW 0 rows");
2427
+ infoEnabled2 && info3("<=== TABLE_ROW 0 rows");
2423
2428
  } else if ((firstRow == null ? void 0 : firstRow.rowIndex) === -1) {
2424
2429
  if (body.rows.length === 1) {
2425
2430
  if (firstRow.updateType === "SIZE") {
2426
2431
  infoEnabled2 && info3(
2427
- \`handleMessageFromServer [\${firstRow.viewPortId}] TABLE_ROW SIZE ONLY \${firstRow.vpSize}\`
2432
+ \`<=== [\${firstRow.viewPortId}] TABLE_ROW SIZE ONLY \${firstRow.vpSize}\`
2428
2433
  );
2429
2434
  } else {
2430
2435
  infoEnabled2 && info3(
2431
- \`handleMessageFromServer [\${firstRow.viewPortId}] TABLE_ROW SIZE \${firstRow.vpSize} rowIdx \${firstRow.rowIndex}\`
2436
+ \`<=== [\${firstRow.viewPortId}] TABLE_ROW SIZE \${firstRow.vpSize} rowIdx \${firstRow.rowIndex}\`
2432
2437
  );
2433
2438
  }
2434
2439
  } else {
2435
2440
  infoEnabled2 && info3(
2436
- \`handleMessageFromServer TABLE_ROW \${body.rows.length} rows, SIZE \${firstRow.vpSize}, [\${body.rows.map((r) => r.rowIndex).join(",")}]\`
2441
+ \`<=== TABLE_ROW \${body.rows.length} rows, SIZE \${firstRow.vpSize}, [\${body.rows.map((r) => r.rowIndex).join(",")}]\`
2437
2442
  );
2438
2443
  }
2439
2444
  } else {
2440
2445
  infoEnabled2 && info3(
2441
- \`handleMessageFromServer TABLE_ROW \${body.rows.length} rows [\${body.rows.map((r) => r.rowIndex).join(",")}]\`
2446
+ \`<=== TABLE_ROW \${body.rows.length} rows [\${body.rows.map((r) => r.rowIndex).join(",")}]\`
2442
2447
  );
2443
2448
  }
2444
2449
  }
@@ -2460,7 +2465,9 @@ var ServerProxy = class {
2460
2465
  const viewport = this.viewports.get(body.viewPortId);
2461
2466
  if (viewport) {
2462
2467
  const { from, to } = body;
2463
- infoEnabled2 && info3(\`CHANGE_VP_RANGE_SUCCESS<#\${requestId}> \${from} - \${to}\`);
2468
+ infoEnabled2 && info3(
2469
+ \`<=== CHANGE_VP_RANGE_SUCCESS<#\${requestId}> \${from} - \${to}\`
2470
+ );
2464
2471
  viewport.completeOperation(requestId, from, to);
2465
2472
  }
2466
2473
  }
@@ -2605,7 +2612,7 @@ var ServerProxy = class {
2605
2612
  error2(body.msg);
2606
2613
  break;
2607
2614
  default:
2608
- infoEnabled2 && info3(\`handleMessageFromServer \${body["type"]}.\`);
2615
+ infoEnabled2 && info3(\`<=== \${body["type"]}.\`);
2609
2616
  }
2610
2617
  }
2611
2618
  cacheTableMeta(messageBody) {
@@ -2645,7 +2652,7 @@ var ServerProxy = class {
2645
2652
  const size = viewport.getNewRowCount();
2646
2653
  if (size !== void 0 || rows && rows.length > 0) {
2647
2654
  debugEnabled4 && debug4(
2648
- \`postMessageToClient #\${viewport.clientViewportId} viewport-update \${mode}, \${(_a = rows == null ? void 0 : rows.length) != null ? _a : "no"} rows, size \${size}\`
2655
+ \`===> #\${viewport.clientViewportId} viewport-update \${mode}, \${(_a = rows == null ? void 0 : rows.length) != null ? _a : "no"} rows, size \${size}\`
2649
2656
  );
2650
2657
  if (mode) {
2651
2658
  this.postMessageToClient({
@@ -2712,15 +2719,15 @@ var handleMessageFromClient = async ({
2712
2719
  webSocketConnection == null ? void 0 : webSocketConnection.close();
2713
2720
  break;
2714
2721
  case "subscribe":
2715
- infoEnabled3 && info4(\`client subscribe: \${JSON.stringify(message)}\`);
2722
+ infoEnabled3 && info4(\`===> \${JSON.stringify(message)}\`);
2716
2723
  serverProxy.subscribe(message);
2717
2724
  break;
2718
2725
  case "unsubscribe":
2719
- infoEnabled3 && info4(\`client unsubscribe: \${JSON.stringify(message)}\`);
2726
+ infoEnabled3 && info4(\`===> \${JSON.stringify(message)}\`);
2720
2727
  serverProxy.unsubscribe(message.viewport);
2721
2728
  break;
2722
2729
  default:
2723
- infoEnabled3 && info4(\`client message: \${JSON.stringify(message)}\`);
2730
+ infoEnabled3 && info4(\`===> \${JSON.stringify(message)}\`);
2724
2731
  serverProxy.handleMessageFromClient(message);
2725
2732
  }
2726
2733
  };