@vuu-ui/vuu-data-remote 0.8.22-debug → 0.8.23-debug
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/index.js +57 -36
- package/cjs/index.js.map +2 -2
- package/esm/index.js +57 -36
- package/esm/index.js.map +2 -2
- package/package.json +7 -7
- package/types/inlined-worker.d.ts +1 -1
- package/types/server-proxy/viewport.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -199,31 +199,31 @@ var getCookieValue = (name) => {
|
|
|
199
199
|
};
|
|
200
200
|
|
|
201
201
|
// ../vuu-utils/src/range-utils.ts
|
|
202
|
-
function getFullRange({ from, to }, bufferSize = 0,
|
|
203
|
-
if (
|
|
204
|
-
|
|
202
|
+
function getFullRange({ from, to }, bufferSize = 0, totalRowCount = Number.MAX_SAFE_INTEGER) {
|
|
203
|
+
if (from === 0 && to === 0) {
|
|
204
|
+
return { from, to };
|
|
205
|
+
} else if (bufferSize === 0) {
|
|
206
|
+
if (totalRowCount < from) {
|
|
205
207
|
return { from: 0, to: 0 };
|
|
206
208
|
} else {
|
|
207
|
-
return { from, to: Math.min(to,
|
|
209
|
+
return { from, to: Math.min(to, totalRowCount) };
|
|
208
210
|
}
|
|
209
211
|
} else if (from === 0) {
|
|
210
|
-
return { from, to: Math.min(to + bufferSize,
|
|
212
|
+
return { from, to: Math.min(to + bufferSize, totalRowCount) };
|
|
211
213
|
} else {
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (shortfallBefore && shortFallAfter) {
|
|
217
|
-
return { from: 0, to: rowCount };
|
|
214
|
+
const shortfallBefore = from - bufferSize < 0;
|
|
215
|
+
const shortfallAfter = totalRowCount - (to + bufferSize) < 0;
|
|
216
|
+
if (shortfallBefore && shortfallAfter) {
|
|
217
|
+
return { from: 0, to: totalRowCount };
|
|
218
218
|
} else if (shortfallBefore) {
|
|
219
|
-
return { from: 0, to:
|
|
220
|
-
} else if (
|
|
219
|
+
return { from: 0, to: to + bufferSize };
|
|
220
|
+
} else if (shortfallAfter) {
|
|
221
221
|
return {
|
|
222
|
-
from: Math.max(0,
|
|
223
|
-
to:
|
|
222
|
+
from: Math.max(0, from - bufferSize),
|
|
223
|
+
to: totalRowCount
|
|
224
224
|
};
|
|
225
225
|
} else {
|
|
226
|
-
return { from: from -
|
|
226
|
+
return { from: from - bufferSize, to: to + bufferSize };
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -329,54 +329,67 @@ var RangeMonitor = class {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
// ../vuu-utils/src/keyset.ts
|
|
332
|
+
var EMPTY = [];
|
|
332
333
|
var KeySet = class {
|
|
333
334
|
constructor(range) {
|
|
334
335
|
this.keys = /* @__PURE__ */ new Map();
|
|
335
|
-
this.free = [];
|
|
336
336
|
this.nextKeyValue = 0;
|
|
337
|
-
this.
|
|
337
|
+
this.range = range;
|
|
338
|
+
this.init(range);
|
|
338
339
|
}
|
|
339
|
-
next() {
|
|
340
|
-
if (
|
|
341
|
-
return
|
|
340
|
+
next(free = EMPTY) {
|
|
341
|
+
if (free.length > 0) {
|
|
342
|
+
return free.shift();
|
|
342
343
|
} else {
|
|
343
344
|
return this.nextKeyValue++;
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
|
-
|
|
347
|
+
init({ from, to }) {
|
|
348
|
+
this.keys.clear();
|
|
349
|
+
this.nextKeyValue = 0;
|
|
350
|
+
for (let rowIndex = from; rowIndex < to; rowIndex++) {
|
|
351
|
+
const nextKeyValue = this.next();
|
|
352
|
+
this.keys.set(rowIndex, nextKeyValue);
|
|
353
|
+
}
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
reset(range) {
|
|
357
|
+
const { from, to } = range;
|
|
358
|
+
const newSize = to - from;
|
|
359
|
+
const currentSize = this.range.to - this.range.from;
|
|
360
|
+
this.range = range;
|
|
361
|
+
if (currentSize > newSize) {
|
|
362
|
+
return this.init(range);
|
|
363
|
+
}
|
|
364
|
+
const freeKeys = [];
|
|
347
365
|
this.keys.forEach((keyValue, rowIndex) => {
|
|
348
366
|
if (rowIndex < from || rowIndex >= to) {
|
|
349
|
-
|
|
367
|
+
freeKeys.push(keyValue);
|
|
350
368
|
this.keys.delete(rowIndex);
|
|
351
369
|
}
|
|
352
370
|
});
|
|
353
|
-
const size = to - from;
|
|
354
|
-
if (this.keys.size + this.free.length > size) {
|
|
355
|
-
this.free.length = Math.max(0, size - this.keys.size);
|
|
356
|
-
}
|
|
357
371
|
for (let rowIndex = from; rowIndex < to; rowIndex++) {
|
|
358
372
|
if (!this.keys.has(rowIndex)) {
|
|
359
|
-
const nextKeyValue = this.next();
|
|
373
|
+
const nextKeyValue = this.next(freeKeys);
|
|
360
374
|
this.keys.set(rowIndex, nextKeyValue);
|
|
361
375
|
}
|
|
362
376
|
}
|
|
363
|
-
|
|
364
|
-
this.nextKeyValue = this.keys.size;
|
|
365
|
-
}
|
|
377
|
+
return false;
|
|
366
378
|
}
|
|
367
379
|
keyFor(rowIndex) {
|
|
368
380
|
const key = this.keys.get(rowIndex);
|
|
369
381
|
if (key === void 0) {
|
|
370
382
|
console.log(\`key not found
|
|
371
383
|
keys: \${this.toDebugString()}
|
|
372
|
-
free : \${this.free.join(",")}
|
|
373
384
|
\`);
|
|
374
385
|
throw Error(\`KeySet, no key found for rowIndex \${rowIndex}\`);
|
|
375
386
|
}
|
|
376
387
|
return key;
|
|
377
388
|
}
|
|
378
389
|
toDebugString() {
|
|
379
|
-
return
|
|
390
|
+
return \`\${this.keys.size} keys
|
|
391
|
+
\${Array.from(this.keys.entries()).sort(([key1], [key2]) => key1 - key2).map(([k, v]) => \`\${k}=>\${v}\`).join(",")}]
|
|
392
|
+
\`;
|
|
380
393
|
}
|
|
381
394
|
};
|
|
382
395
|
|
|
@@ -912,8 +925,9 @@ var Viewport = class {
|
|
|
912
925
|
filterSpec: filter,
|
|
913
926
|
range,
|
|
914
927
|
sort,
|
|
915
|
-
groupBy
|
|
916
|
-
|
|
928
|
+
groupBy,
|
|
929
|
+
table
|
|
930
|
+
}, baseTableSchema) {
|
|
917
931
|
this.serverViewportId = viewPortId;
|
|
918
932
|
this.status = "subscribed";
|
|
919
933
|
this.aggregations = aggregations;
|
|
@@ -921,6 +935,13 @@ var Viewport = class {
|
|
|
921
935
|
this.groupBy = groupBy;
|
|
922
936
|
this.isTree = groupBy && groupBy.length > 0;
|
|
923
937
|
this.dataWindow.setRange(range.from, range.to);
|
|
938
|
+
const tableSchema = table === baseTableSchema.table.table ? baseTableSchema : {
|
|
939
|
+
...baseTableSchema,
|
|
940
|
+
table: {
|
|
941
|
+
...baseTableSchema.table,
|
|
942
|
+
session: table
|
|
943
|
+
}
|
|
944
|
+
};
|
|
924
945
|
return {
|
|
925
946
|
aggregations,
|
|
926
947
|
type: "subscribed",
|
|
@@ -2374,7 +2395,7 @@ async function connect(connectionString, protocol, callback, retryLimitDisconnec
|
|
|
2374
2395
|
};
|
|
2375
2396
|
return makeConnection(connectionString, protocol, callback);
|
|
2376
2397
|
}
|
|
2377
|
-
async function reconnect(
|
|
2398
|
+
async function reconnect(_) {
|
|
2378
2399
|
throw Error("connection broken");
|
|
2379
2400
|
}
|
|
2380
2401
|
async function makeConnection(url, protocol, callback, connection) {
|