vim-web 0.3.42-dev.4 → 0.3.42-dev.5
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/types/core-viewers/ultra/viewer/socketClient.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +1 -1
- package/dist/vim-web.iife.js +24 -43
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +30 -49
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
|
@@ -101,7 +101,7 @@ export declare class SocketClient {
|
|
|
101
101
|
* @param url - The WebSocket URL to connect to.
|
|
102
102
|
* @returns A promise that resolves when the connection is established.
|
|
103
103
|
*/
|
|
104
|
-
connect(settings: ConnectionSettings): Promise<
|
|
104
|
+
connect(settings: ConnectionSettings): Promise<boolean>;
|
|
105
105
|
/**
|
|
106
106
|
* Disconnects from the current WebSocket server.
|
|
107
107
|
*/
|
|
@@ -96,7 +96,7 @@ export declare class Viewer {
|
|
|
96
96
|
* @param url - The server URL to connect to. Defaults to 'ws://localhost:8123'.
|
|
97
97
|
* @returns A promise that resolves when the connection is established.
|
|
98
98
|
*/
|
|
99
|
-
connect(settings?: ConnectionSettings): Promise<
|
|
99
|
+
connect(settings?: ConnectionSettings): Promise<boolean>;
|
|
100
100
|
/**
|
|
101
101
|
* Disconnects from the current VIM Ultra server.
|
|
102
102
|
*/
|
package/dist/vim-web.iife.js
CHANGED
|
@@ -49963,7 +49963,7 @@ void main() {
|
|
|
49963
49963
|
}
|
|
49964
49964
|
return vim;
|
|
49965
49965
|
}
|
|
49966
|
-
let DeferredPromise$
|
|
49966
|
+
let DeferredPromise$1 = class DeferredPromise extends Promise {
|
|
49967
49967
|
constructor(executor = () => {
|
|
49968
49968
|
}) {
|
|
49969
49969
|
var _a2;
|
|
@@ -50026,8 +50026,8 @@ void main() {
|
|
|
50026
50026
|
__publicField(this, "_error");
|
|
50027
50027
|
// Promises to await progress updates and completion
|
|
50028
50028
|
__publicField(this, "_progress", { loaded: 0, total: 0, all: /* @__PURE__ */ new Map() });
|
|
50029
|
-
__publicField(this, "_progressPromise", new DeferredPromise$
|
|
50030
|
-
__publicField(this, "_completionPromise", new DeferredPromise$
|
|
50029
|
+
__publicField(this, "_progressPromise", new DeferredPromise$1());
|
|
50030
|
+
__publicField(this, "_completionPromise", new DeferredPromise$1());
|
|
50031
50031
|
this._source = source;
|
|
50032
50032
|
this._settings = settings2;
|
|
50033
50033
|
this.startRequest();
|
|
@@ -50041,7 +50041,7 @@ void main() {
|
|
|
50041
50041
|
const vim = await open(this._bfast, this._settings, (progress) => {
|
|
50042
50042
|
this._progress = progress;
|
|
50043
50043
|
this._progressPromise.resolve(progress);
|
|
50044
|
-
this._progressPromise = new DeferredPromise$
|
|
50044
|
+
this._progressPromise = new DeferredPromise$1();
|
|
50045
50045
|
});
|
|
50046
50046
|
this._vimResult = vim;
|
|
50047
50047
|
} catch (err) {
|
|
@@ -59789,7 +59789,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59789
59789
|
connect(settings2) {
|
|
59790
59790
|
settings2 = {
|
|
59791
59791
|
url: (settings2 == null ? void 0 : settings2.url) ?? DEFAULT_LOCAL_ULTRA_SERVER_URL,
|
|
59792
|
-
retries: (settings2 == null ? void 0 : settings2.retries) ??
|
|
59792
|
+
retries: (settings2 == null ? void 0 : settings2.retries) ?? -1,
|
|
59793
59793
|
timeout: (settings2 == null ? void 0 : settings2.timeout) ?? 5e3,
|
|
59794
59794
|
retryDelay: (settings2 == null ? void 0 : settings2.retryDelay) ?? 5e3
|
|
59795
59795
|
};
|
|
@@ -59803,11 +59803,14 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59803
59803
|
return this._connectPromise.promise;
|
|
59804
59804
|
} else {
|
|
59805
59805
|
this._clearSocket();
|
|
59806
|
+
this._connectionSettings = void 0;
|
|
59806
59807
|
this._connectPromise.reject("Connection to a different server");
|
|
59807
59808
|
}
|
|
59808
59809
|
}
|
|
59809
|
-
this.
|
|
59810
|
-
|
|
59810
|
+
if (this.url !== url) {
|
|
59811
|
+
this._connectPromise = new ControllablePromise();
|
|
59812
|
+
this._connectionSettings = settings2;
|
|
59813
|
+
}
|
|
59811
59814
|
this.updateState({ status: "connecting" });
|
|
59812
59815
|
try {
|
|
59813
59816
|
this._socket = new WebSocket(url);
|
|
@@ -59842,7 +59845,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59842
59845
|
* Handles the disconnection logic, stopping logging and clearing the socket.
|
|
59843
59846
|
*/
|
|
59844
59847
|
_disconnect(error) {
|
|
59845
|
-
|
|
59848
|
+
this._logger.log("disconnect", error);
|
|
59846
59849
|
clearTimeout(this._reconnectTimeout);
|
|
59847
59850
|
clearTimeout(this._connectionTimeout);
|
|
59848
59851
|
this._streamLogger.stopLogging();
|
|
@@ -59923,25 +59926,28 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59923
59926
|
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59924
59927
|
this.updateState({ status: "connected" });
|
|
59925
59928
|
this._streamLogger.startLoggging();
|
|
59926
|
-
this._connectPromise.resolve();
|
|
59929
|
+
this._connectPromise.resolve(true);
|
|
59927
59930
|
}
|
|
59928
59931
|
/**
|
|
59929
59932
|
* Handler for WebSocket 'close' event.
|
|
59930
59933
|
* @param _event - The event object.
|
|
59931
59934
|
*/
|
|
59932
59935
|
_onClose(_event) {
|
|
59936
|
+
const connecting = this.state.status === "connecting" || this.state.status === "validating";
|
|
59933
59937
|
this._logger.log("WebSocket closed.");
|
|
59934
59938
|
clearTimeout(this._connectionTimeout);
|
|
59935
59939
|
this._disconnect({ status: "error", error: "connection", serverUrl: this.url });
|
|
59936
|
-
if (this._connectionSettings.retries === 0) {
|
|
59940
|
+
if (connecting && this._connectionSettings.retries === 0) {
|
|
59937
59941
|
this._logger.log("No more retries left");
|
|
59938
|
-
this._connectPromise.resolve();
|
|
59942
|
+
this._connectPromise.resolve(false);
|
|
59939
59943
|
return;
|
|
59940
59944
|
}
|
|
59941
59945
|
this._logger.log("Attempting to reconnect in 5 seconds");
|
|
59942
59946
|
this._reconnectTimeout = setTimeout(() => {
|
|
59943
59947
|
this.updateState({ status: "connecting" });
|
|
59944
|
-
|
|
59948
|
+
if (connecting) {
|
|
59949
|
+
this._connectionSettings.retries--;
|
|
59950
|
+
}
|
|
59945
59951
|
this.connect(this._connectionSettings);
|
|
59946
59952
|
}, this._connectionSettings.retryDelay);
|
|
59947
59953
|
}
|
|
@@ -60316,31 +60322,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60316
60322
|
this._pendingFrame = frame;
|
|
60317
60323
|
}
|
|
60318
60324
|
}
|
|
60319
|
-
let DeferredPromise$1 = class DeferredPromise extends Promise {
|
|
60320
|
-
constructor(executor = () => {
|
|
60321
|
-
}) {
|
|
60322
|
-
var _a2;
|
|
60323
|
-
let resolver;
|
|
60324
|
-
let rejector;
|
|
60325
|
-
super((resolve, reject) => {
|
|
60326
|
-
resolver = resolve;
|
|
60327
|
-
rejector = reject;
|
|
60328
|
-
return executor(resolve, reject);
|
|
60329
|
-
});
|
|
60330
|
-
__publicField(this, "resolve");
|
|
60331
|
-
__publicField(this, "reject");
|
|
60332
|
-
__publicField(this, "initialCallStack");
|
|
60333
|
-
this.resolve = resolver;
|
|
60334
|
-
this.reject = rejector;
|
|
60335
|
-
this.initialCallStack = (_a2 = Error().stack) == null ? void 0 : _a2.split("\n").slice(2).join("\n");
|
|
60336
|
-
}
|
|
60337
|
-
/** @throws error with amended call stack */
|
|
60338
|
-
rejectWithError(error) {
|
|
60339
|
-
var _a2;
|
|
60340
|
-
error.stack = [(_a2 = error.stack) == null ? void 0 : _a2.split("\n")[0], this.initialCallStack].join("\n");
|
|
60341
|
-
this.reject(error);
|
|
60342
|
-
}
|
|
60343
|
-
};
|
|
60344
60325
|
class LoadSuccess {
|
|
60345
60326
|
constructor(vim) {
|
|
60346
60327
|
__publicField(this, "isError", false);
|
|
@@ -60363,8 +60344,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60363
60344
|
let LoadRequest$1 = class LoadRequest {
|
|
60364
60345
|
constructor() {
|
|
60365
60346
|
__publicField(this, "_progress", 0);
|
|
60366
|
-
__publicField(this, "_progressPromise", new
|
|
60367
|
-
__publicField(this, "_completionPromise", new
|
|
60347
|
+
__publicField(this, "_progressPromise", new ControllablePromise());
|
|
60348
|
+
__publicField(this, "_completionPromise", new ControllablePromise());
|
|
60368
60349
|
__publicField(this, "_result");
|
|
60369
60350
|
}
|
|
60370
60351
|
get isCompleted() {
|
|
@@ -60377,18 +60358,18 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60377
60358
|
return;
|
|
60378
60359
|
}
|
|
60379
60360
|
while (this._result === void 0) {
|
|
60380
|
-
await this._progressPromise;
|
|
60361
|
+
await this._progressPromise.promise;
|
|
60381
60362
|
yield this._progress;
|
|
60382
60363
|
}
|
|
60383
60364
|
}
|
|
60384
60365
|
async getResult() {
|
|
60385
|
-
await this._completionPromise;
|
|
60366
|
+
await this._completionPromise.promise;
|
|
60386
60367
|
return this._result;
|
|
60387
60368
|
}
|
|
60388
60369
|
onProgress(progress) {
|
|
60389
60370
|
this._progress = progress;
|
|
60390
60371
|
this._progressPromise.resolve();
|
|
60391
|
-
this._progressPromise = new
|
|
60372
|
+
this._progressPromise = new ControllablePromise();
|
|
60392
60373
|
}
|
|
60393
60374
|
success(vim) {
|
|
60394
60375
|
this._result = new LoadSuccess(vim);
|
|
@@ -61769,7 +61750,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61769
61750
|
* @returns A promise that resolves when the connection is established.
|
|
61770
61751
|
*/
|
|
61771
61752
|
async connect(settings2) {
|
|
61772
|
-
|
|
61753
|
+
return this._socketClient.connect(settings2);
|
|
61773
61754
|
}
|
|
61774
61755
|
/**
|
|
61775
61756
|
* Disconnects from the current VIM Ultra server.
|