@vuu-ui/vuu-data-remote 2.1.13 → 2.1.15
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/cjs/VuuDataSource.js +29 -71
- package/cjs/VuuDataSource.js.map +1 -1
- package/cjs/WebSocketConnection.js.map +1 -1
- package/cjs/data-source.js +1 -2
- package/cjs/data-source.js.map +1 -1
- package/cjs/inlined-worker.js +38 -49
- package/cjs/inlined-worker.js.map +1 -1
- package/esm/VuuDataSource.js +30 -72
- package/esm/VuuDataSource.js.map +1 -1
- package/esm/WebSocketConnection.js.map +1 -1
- package/esm/data-source.js +1 -2
- package/esm/data-source.js.map +1 -1
- package/esm/inlined-worker.js +38 -49
- package/esm/inlined-worker.js.map +1 -1
- package/package.json +7 -7
- package/types/VuuDataSource.d.ts +4 -13
- package/types/inlined-worker.d.ts +1 -1
- package/types/server-proxy/array-backed-moving-window.d.ts +0 -1
package/cjs/inlined-worker.js
CHANGED
|
@@ -323,7 +323,6 @@ var InvalidLoginMessages = [
|
|
|
323
323
|
INVALID_TOKEN,
|
|
324
324
|
TOKEN_EXPIRED
|
|
325
325
|
];
|
|
326
|
-
var isErrorMessage = (message) => typeof message == "object" && (message == null ? void 0 : message.type) === "ERROR";
|
|
327
326
|
var isLoginErrorMessage = (message) => typeof message === "string" && InvalidLoginMessages.includes(message);
|
|
328
327
|
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");
|
|
329
328
|
var isRpcServiceRequest = (message) => message.type === "RPC_REQUEST";
|
|
@@ -592,9 +591,13 @@ var ArrayBackedMovingWindow = class {
|
|
|
592
591
|
get range() {
|
|
593
592
|
return __privateGet(this, _range);
|
|
594
593
|
}
|
|
595
|
-
get hasAllRowsWithinRange() {
|
|
596
|
-
|
|
597
|
-
|
|
594
|
+
// get hasAllRowsWithinRange(): boolean {
|
|
595
|
+
// return (
|
|
596
|
+
// this.rowsWithinRange === this.clientRange.to - this.clientRange.from ||
|
|
597
|
+
// (this.rowCount > 0 &&
|
|
598
|
+
// this.clientRange.from + this.rowsWithinRange === this.rowCount)
|
|
599
|
+
// );
|
|
600
|
+
// }
|
|
598
601
|
// Check to see if set of rows is outside the current viewport range, indicating
|
|
599
602
|
// that veiwport is being scrolled quickly and server is not able to keep up.
|
|
600
603
|
outOfRange(firstIndex, lastIndex) {
|
|
@@ -908,9 +911,7 @@ var Viewport = class {
|
|
|
908
911
|
this.table = table;
|
|
909
912
|
this.sort = sort;
|
|
910
913
|
this.title = title;
|
|
911
|
-
infoEnabled && (info == null ? void 0 : info(
|
|
912
|
-
\`constructor #\${viewport} \${table.table} bufferSize=\${bufferSize}\`
|
|
913
|
-
));
|
|
914
|
+
infoEnabled && (info == null ? void 0 : info(\`\${table.table} #\${viewport}, bufferSize=\${bufferSize}\`));
|
|
914
915
|
this.dataWindow = new ArrayBackedMovingWindow(
|
|
915
916
|
__privateGet(this, _clientRange),
|
|
916
917
|
range,
|
|
@@ -1225,6 +1226,7 @@ var Viewport = class {
|
|
|
1225
1226
|
}
|
|
1226
1227
|
suspend() {
|
|
1227
1228
|
this.suspended = true;
|
|
1229
|
+
this.pendingUpdates.length = 0;
|
|
1228
1230
|
info == null ? void 0 : info("suspend");
|
|
1229
1231
|
}
|
|
1230
1232
|
resume() {
|
|
@@ -1362,9 +1364,11 @@ var Viewport = class {
|
|
|
1362
1364
|
}
|
|
1363
1365
|
if (row.updateType === "U") {
|
|
1364
1366
|
if ((_c = this.dataWindow) == null ? void 0 : _c.setAtIndex(row)) {
|
|
1365
|
-
this.
|
|
1366
|
-
|
|
1367
|
-
this.
|
|
1367
|
+
if (this.suspended !== true) {
|
|
1368
|
+
this.hasUpdates = true;
|
|
1369
|
+
if (!this.batchMode) {
|
|
1370
|
+
this.pendingUpdates.push(row);
|
|
1371
|
+
}
|
|
1368
1372
|
}
|
|
1369
1373
|
}
|
|
1370
1374
|
}
|
|
@@ -1500,9 +1504,9 @@ var WebSocketConnection = class extends EventEmitter {
|
|
|
1500
1504
|
__privateAdd(this, _ws);
|
|
1501
1505
|
__publicField(this, "receive", (evt) => {
|
|
1502
1506
|
if (isLoginErrorMessage(evt.data)) {
|
|
1503
|
-
console.
|
|
1507
|
+
console.warn(\`[WebSocketConnection] closed because of login issue\`);
|
|
1504
1508
|
if (__privateGet(this, _deferredOpen)) {
|
|
1505
|
-
console.
|
|
1509
|
+
console.warn(\`... and we have a deferred connection\`);
|
|
1506
1510
|
}
|
|
1507
1511
|
__privateGet(this, _callback).call(this, {
|
|
1508
1512
|
type: "LOGIN_REJECTED",
|
|
@@ -1513,7 +1517,7 @@ var WebSocketConnection = class extends EventEmitter {
|
|
|
1513
1517
|
const vuuMessageFromServer = parseWebSocketMessage(evt.data);
|
|
1514
1518
|
if (debugEnabled3) {
|
|
1515
1519
|
if (vuuMessageFromServer.body.type !== "HB") {
|
|
1516
|
-
debug3(
|
|
1520
|
+
debug3(\`<=== \${vuuMessageFromServer.body.type}\`);
|
|
1517
1521
|
if (vuuMessageFromServer.body.type === "CHANGE_VP_SUCCESS") {
|
|
1518
1522
|
debug3(JSON.stringify(vuuMessageFromServer.body));
|
|
1519
1523
|
}
|
|
@@ -1532,7 +1536,7 @@ var WebSocketConnection = class extends EventEmitter {
|
|
|
1532
1536
|
var _a;
|
|
1533
1537
|
if (msg.body.type === "CHANGE_VP_RANGE") {
|
|
1534
1538
|
info2 == null ? void 0 : info2(
|
|
1535
|
-
|
|
1539
|
+
\`===> CHANGE_VP_RANGE<#\${msg.requestId}> \${msg.body.from}-\${msg.body.to}\`
|
|
1536
1540
|
);
|
|
1537
1541
|
}
|
|
1538
1542
|
(_a = __privateGet(this, _ws)) == null ? void 0 : _a.send(JSON.stringify(msg));
|
|
@@ -1772,13 +1776,7 @@ var ServerProxy = class {
|
|
|
1772
1776
|
pendingSubscription,
|
|
1773
1777
|
pendingTableSchema
|
|
1774
1778
|
]);
|
|
1775
|
-
if (
|
|
1776
|
-
this.postMessageToClient({
|
|
1777
|
-
clientViewportId: message.viewport,
|
|
1778
|
-
type: "subscribe-failed",
|
|
1779
|
-
msg: \`failed to fetch schema for table \${message.table.table}: \${tableSchema.msg}\`
|
|
1780
|
-
});
|
|
1781
|
-
} else if (isCreateVpSuccess(subscribeResponse)) {
|
|
1779
|
+
if (isCreateVpSuccess(subscribeResponse)) {
|
|
1782
1780
|
const { viewPortId: serverViewportId } = subscribeResponse;
|
|
1783
1781
|
const { status: previousViewportStatus } = viewport;
|
|
1784
1782
|
if (message.viewport !== serverViewportId) {
|
|
@@ -1826,11 +1824,6 @@ var ServerProxy = class {
|
|
|
1826
1824
|
});
|
|
1827
1825
|
}
|
|
1828
1826
|
} else {
|
|
1829
|
-
this.postMessageToClient({
|
|
1830
|
-
clientViewportId: message.viewport,
|
|
1831
|
-
type: "subscribe-failed",
|
|
1832
|
-
msg: \`failed to open subscription on table \${message.table.table}: \${subscribeResponse.msg}\`
|
|
1833
|
-
});
|
|
1834
1827
|
}
|
|
1835
1828
|
} else {
|
|
1836
1829
|
error2(\`spurious subscribe call \${message.viewport}\`);
|
|
@@ -2216,8 +2209,7 @@ var ServerProxy = class {
|
|
|
2216
2209
|
}
|
|
2217
2210
|
case "GET_TABLE_META": {
|
|
2218
2211
|
this.getTableMeta(message.table, requestId).then((tableSchema) => {
|
|
2219
|
-
if (
|
|
2220
|
-
} else if (tableSchema) {
|
|
2212
|
+
if (tableSchema) {
|
|
2221
2213
|
this.postMessageToClient({
|
|
2222
2214
|
type: "TABLE_META_RESP",
|
|
2223
2215
|
tableSchema,
|
|
@@ -2238,9 +2230,10 @@ var ServerProxy = class {
|
|
|
2238
2230
|
}
|
|
2239
2231
|
getTableMeta(table, requestId = nextRequestId()) {
|
|
2240
2232
|
if (isSessionTable(table)) {
|
|
2241
|
-
return this.awaitResponseToMessage(
|
|
2242
|
-
|
|
2243
|
-
|
|
2233
|
+
return this.awaitResponseToMessage(
|
|
2234
|
+
{ type: "GET_TABLE_META", table },
|
|
2235
|
+
requestId
|
|
2236
|
+
).then(createSchemaFromTableMetadata);
|
|
2244
2237
|
}
|
|
2245
2238
|
const key = \`\${table.module}:\${table.table}\`;
|
|
2246
2239
|
let tableMetaRequest = this.cachedTableMetaRequests.get(key);
|
|
@@ -2251,13 +2244,7 @@ var ServerProxy = class {
|
|
|
2251
2244
|
);
|
|
2252
2245
|
this.cachedTableMetaRequests.set(key, tableMetaRequest);
|
|
2253
2246
|
}
|
|
2254
|
-
return tableMetaRequest == null ? void 0 : tableMetaRequest.then((response) =>
|
|
2255
|
-
if (isErrorMessage(response)) {
|
|
2256
|
-
return response;
|
|
2257
|
-
} else {
|
|
2258
|
-
return this.cacheTableMeta(response);
|
|
2259
|
-
}
|
|
2260
|
-
});
|
|
2247
|
+
return tableMetaRequest == null ? void 0 : tableMetaRequest.then((response) => this.cacheTableMeta(response));
|
|
2261
2248
|
}
|
|
2262
2249
|
awaitResponseToMessage(message, requestId = nextRequestId()) {
|
|
2263
2250
|
return new Promise((resolve, reject) => {
|
|
@@ -2421,26 +2408,26 @@ var ServerProxy = class {
|
|
|
2421
2408
|
if (debugEnabled4) {
|
|
2422
2409
|
const [firstRow] = body.rows;
|
|
2423
2410
|
if (body.rows.length === 0) {
|
|
2424
|
-
infoEnabled2 && info3("
|
|
2411
|
+
infoEnabled2 && info3("<=== TABLE_ROW 0 rows");
|
|
2425
2412
|
} else if ((firstRow == null ? void 0 : firstRow.rowIndex) === -1) {
|
|
2426
2413
|
if (body.rows.length === 1) {
|
|
2427
2414
|
if (firstRow.updateType === "SIZE") {
|
|
2428
2415
|
infoEnabled2 && info3(
|
|
2429
|
-
|
|
2416
|
+
\`<=== [\${firstRow.viewPortId}] TABLE_ROW SIZE ONLY \${firstRow.vpSize}\`
|
|
2430
2417
|
);
|
|
2431
2418
|
} else {
|
|
2432
2419
|
infoEnabled2 && info3(
|
|
2433
|
-
|
|
2420
|
+
\`<=== [\${firstRow.viewPortId}] TABLE_ROW SIZE \${firstRow.vpSize} rowIdx \${firstRow.rowIndex}\`
|
|
2434
2421
|
);
|
|
2435
2422
|
}
|
|
2436
2423
|
} else {
|
|
2437
2424
|
infoEnabled2 && info3(
|
|
2438
|
-
|
|
2425
|
+
\`<=== TABLE_ROW \${body.rows.length} rows, SIZE \${firstRow.vpSize}, [\${body.rows.map((r) => r.rowIndex).join(",")}]\`
|
|
2439
2426
|
);
|
|
2440
2427
|
}
|
|
2441
2428
|
} else {
|
|
2442
2429
|
infoEnabled2 && info3(
|
|
2443
|
-
|
|
2430
|
+
\`<=== TABLE_ROW \${body.rows.length} rows [\${body.rows.map((r) => r.rowIndex).join(",")}]\`
|
|
2444
2431
|
);
|
|
2445
2432
|
}
|
|
2446
2433
|
}
|
|
@@ -2462,7 +2449,9 @@ var ServerProxy = class {
|
|
|
2462
2449
|
const viewport = this.viewports.get(body.viewPortId);
|
|
2463
2450
|
if (viewport) {
|
|
2464
2451
|
const { from, to } = body;
|
|
2465
|
-
infoEnabled2 && info3(
|
|
2452
|
+
infoEnabled2 && info3(
|
|
2453
|
+
\`<=== CHANGE_VP_RANGE_SUCCESS<#\${requestId}> \${from} - \${to}\`
|
|
2454
|
+
);
|
|
2466
2455
|
viewport.completeOperation(requestId, from, to);
|
|
2467
2456
|
}
|
|
2468
2457
|
}
|
|
@@ -2607,7 +2596,7 @@ var ServerProxy = class {
|
|
|
2607
2596
|
error2(body.msg);
|
|
2608
2597
|
break;
|
|
2609
2598
|
default:
|
|
2610
|
-
infoEnabled2 && info3(
|
|
2599
|
+
infoEnabled2 && info3(\`<=== \${body["type"]}.\`);
|
|
2611
2600
|
}
|
|
2612
2601
|
}
|
|
2613
2602
|
cacheTableMeta(messageBody) {
|
|
@@ -2647,7 +2636,7 @@ var ServerProxy = class {
|
|
|
2647
2636
|
const size = viewport.getNewRowCount();
|
|
2648
2637
|
if (size !== void 0 || rows && rows.length > 0) {
|
|
2649
2638
|
debugEnabled4 && debug4(
|
|
2650
|
-
|
|
2639
|
+
\`===> #\${viewport.clientViewportId} viewport-update \${mode}, \${(_a = rows == null ? void 0 : rows.length) != null ? _a : "no"} rows, size \${size}\`
|
|
2651
2640
|
);
|
|
2652
2641
|
if (mode) {
|
|
2653
2642
|
this.postMessageToClient({
|
|
@@ -2714,15 +2703,15 @@ var handleMessageFromClient = async ({
|
|
|
2714
2703
|
webSocketConnection == null ? void 0 : webSocketConnection.close();
|
|
2715
2704
|
break;
|
|
2716
2705
|
case "subscribe":
|
|
2717
|
-
infoEnabled3 && info4(
|
|
2706
|
+
infoEnabled3 && info4(\`===> \${JSON.stringify(message)}\`);
|
|
2718
2707
|
serverProxy.subscribe(message);
|
|
2719
2708
|
break;
|
|
2720
2709
|
case "unsubscribe":
|
|
2721
|
-
infoEnabled3 && info4(
|
|
2710
|
+
infoEnabled3 && info4(\`===> \${JSON.stringify(message)}\`);
|
|
2722
2711
|
serverProxy.unsubscribe(message.viewport);
|
|
2723
2712
|
break;
|
|
2724
2713
|
default:
|
|
2725
|
-
infoEnabled3 && info4(
|
|
2714
|
+
infoEnabled3 && info4(\`===> \${JSON.stringify(message)}\`);
|
|
2726
2715
|
serverProxy.handleMessageFromClient(message);
|
|
2727
2716
|
}
|
|
2728
2717
|
};
|