@nsshunt/stsrunnerframework 2.0.29 → 2.0.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.
- package/dist/index.cjs +59 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +59 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- package/types/nodeAgent.d.ts.map +1 -1
- package/types/runnerInstance.d.ts.map +1 -1
- package/types/workerInstance.d.ts +2 -4
- package/types/workerInstance.d.ts.map +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3685,18 +3685,13 @@ var RunnerInstance = class {
|
|
|
3685
3685
|
* @throws Re-throws any error after logging.
|
|
3686
3686
|
*/
|
|
3687
3687
|
toRunnerCore() {
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
return retVal;
|
|
3696
|
-
} catch (error) {
|
|
3697
|
-
defaultLogger.error(`toRunnerCore(): Error: [${error}]`);
|
|
3698
|
-
throw error;
|
|
3699
|
-
}
|
|
3688
|
+
const retVal = {
|
|
3689
|
+
id: this.id,
|
|
3690
|
+
iteration: this.iteration,
|
|
3691
|
+
state: this.state
|
|
3692
|
+
};
|
|
3693
|
+
if (this.runnerPlanRuntime) retVal.runnerPlanRuntime = { ...this.runnerPlanRuntime };
|
|
3694
|
+
return retVal;
|
|
3700
3695
|
}
|
|
3701
3696
|
/**
|
|
3702
3697
|
* Send a command for this runner to the owning worker via the message broker.
|
|
@@ -4543,7 +4538,7 @@ var WorkerInstance = class {
|
|
|
4543
4538
|
});
|
|
4544
4539
|
return workerCopy;
|
|
4545
4540
|
} catch (error) {
|
|
4546
|
-
|
|
4541
|
+
this.#logger.error(`toWorkerCore(): Error: [${error}]`);
|
|
4547
4542
|
throw error;
|
|
4548
4543
|
}
|
|
4549
4544
|
}
|
|
@@ -9979,6 +9974,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
|
|
|
9979
9974
|
#socket;
|
|
9980
9975
|
#reconnectTimeout = 2e3;
|
|
9981
9976
|
#ackTimeout = 5e3;
|
|
9977
|
+
#reconnectTimeoutVal = void 0;
|
|
9982
9978
|
constructor(name) {
|
|
9983
9979
|
super();
|
|
9984
9980
|
this.#name = name;
|
|
@@ -10051,7 +10047,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
|
|
|
10051
10047
|
return this;
|
|
10052
10048
|
}
|
|
10053
10049
|
SetupSocket() {
|
|
10054
|
-
if (!this.#address) throw new Error(`
|
|
10050
|
+
if (!this.#address) throw new Error(`SocketIoClient:SetupSocket(): Error: [address not provided]`);
|
|
10055
10051
|
this.#EstablishSocketConnect();
|
|
10056
10052
|
return this;
|
|
10057
10053
|
}
|
|
@@ -10061,17 +10057,20 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
|
|
|
10061
10057
|
EngineReconnect(attempt) {}
|
|
10062
10058
|
#EstablishSocketConnect() {
|
|
10063
10059
|
if (this.#socket !== void 0) {
|
|
10064
|
-
|
|
10065
|
-
this.#
|
|
10066
|
-
|
|
10067
|
-
else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10060
|
+
this.ResetSocket();
|
|
10061
|
+
if (isNode) this.#reconnectTimeoutVal = setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10062
|
+
else this.#reconnectTimeoutVal = setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10068
10063
|
return;
|
|
10069
10064
|
}
|
|
10070
10065
|
let socketOptions;
|
|
10071
10066
|
if (isNode) {
|
|
10072
10067
|
socketOptions = { transports: ["websocket"] };
|
|
10073
10068
|
if (this.#agentManager) {
|
|
10074
|
-
if (!this.#address)
|
|
10069
|
+
if (!this.#address) {
|
|
10070
|
+
const message = `SocketIoClient:#EstablishSocketConnect(): Error: [address not provided when using agentManager]`;
|
|
10071
|
+
this.LogErrorMessage(message);
|
|
10072
|
+
throw new Error(message);
|
|
10073
|
+
}
|
|
10075
10074
|
socketOptions.agent = this.#agentManager.GetAgent(this.#address);
|
|
10076
10075
|
}
|
|
10077
10076
|
} else socketOptions = { transports: ["websocket"] };
|
|
@@ -10082,30 +10081,30 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
|
|
|
10082
10081
|
if (this.#socketIoCustomPath && this.#socketIoCustomPath.localeCompare("") !== 0) socketOptions.path = this.#socketIoCustomPath;
|
|
10083
10082
|
this.#socket = lookup(this.#address, socketOptions);
|
|
10084
10083
|
this.#socket.io.on("error", (err) => {
|
|
10085
|
-
this.LogErrorMessage(`
|
|
10084
|
+
this.LogErrorMessage(`SocketIoClient.socket.io.on('error'): [${err}] Address: [${this.#address}]`);
|
|
10086
10085
|
this.EngineError(err);
|
|
10087
10086
|
});
|
|
10088
10087
|
this.#socket.io.on("reconnect_error", (err) => {
|
|
10089
|
-
this.LogErrorMessage(`
|
|
10088
|
+
this.LogErrorMessage(`SocketIoClient.socket.io.on('reconnect_error'): [${err}] Address: [${this.#address}]`);
|
|
10090
10089
|
this.EngineReconnectError(err);
|
|
10091
10090
|
});
|
|
10092
10091
|
this.#socket.on("connect_error", (err) => {
|
|
10093
|
-
this.LogErrorMessage(`
|
|
10092
|
+
this.LogErrorMessage(`SocketIoClient.socket.on('connect_error'): [${err}] Address: [${this.#address}]`);
|
|
10094
10093
|
this.EngineConnectError(err);
|
|
10095
10094
|
});
|
|
10096
10095
|
this.#socket.io.on("reconnect", (attempt) => {
|
|
10097
|
-
this.LogErrorMessage(`
|
|
10096
|
+
this.LogErrorMessage(`SocketIoClient:socket.io.on('reconnect'): Number: [${attempt}] Address: [${this.#address}]`);
|
|
10098
10097
|
this.EngineReconnect(attempt);
|
|
10099
10098
|
});
|
|
10100
10099
|
this.#socket.on("connect", () => {
|
|
10101
10100
|
if (this.#socket) {
|
|
10102
|
-
this.LogDebugMessage(`Socket: [${this.#socket.id}]: connected, Address: [${this.#address}]`);
|
|
10101
|
+
this.LogDebugMessage(`SocketIoClient:on("connect"): Socket: [${this.#socket.id}]: connected, Address: [${this.#address}]`);
|
|
10103
10102
|
setTimeout(() => {
|
|
10104
10103
|
this.SocketConnect(this.#socket);
|
|
10105
10104
|
}, 0);
|
|
10106
10105
|
this.SetupSocketEvents(this.#socket);
|
|
10107
10106
|
} else {
|
|
10108
|
-
const errorMessage = "Could not get socket object from socket.io, Address: [${socketDetail.address}]";
|
|
10107
|
+
const errorMessage = "SocketIoClient:on(\"connect\"): Could not get socket object from socket.io, Address: [${socketDetail.address}]";
|
|
10109
10108
|
this.LogErrorMessage(errorMessage);
|
|
10110
10109
|
this.SocketConnectError(new Error(errorMessage));
|
|
10111
10110
|
}
|
|
@@ -10115,33 +10114,50 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
|
|
|
10115
10114
|
this.SocketDisconnect(reason);
|
|
10116
10115
|
switch (reason) {
|
|
10117
10116
|
case "io server disconnect":
|
|
10118
|
-
this.LogDebugMessage("The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
|
|
10119
|
-
this.LogDebugMessage("The connection will be re-established when the server becomes available.");
|
|
10120
|
-
this
|
|
10121
|
-
if (isNode)
|
|
10122
|
-
|
|
10123
|
-
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10124
|
-
} else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10117
|
+
this.LogDebugMessage("SocketIoClient:on(\"disconnect\"): The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
|
|
10118
|
+
this.LogDebugMessage("SocketIoClient:on(\"disconnect\"): The connection will be re-established when the server becomes available.");
|
|
10119
|
+
this.ResetSocket();
|
|
10120
|
+
if (isNode) this.#reconnectTimeoutVal = setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10121
|
+
else this.#reconnectTimeoutVal = setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10125
10122
|
break;
|
|
10126
10123
|
case "io client disconnect":
|
|
10127
|
-
this.LogDebugMessage("The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
|
|
10128
|
-
this.LogDebugMessage("The connection will not be re-established automatically.");
|
|
10124
|
+
this.LogDebugMessage("SocketIoClient:on(\"disconnect\"): The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
|
|
10125
|
+
this.LogDebugMessage("SocketIoClient:on(\"disconnect\"): The connection will not be re-established automatically.");
|
|
10126
|
+
this.ResetSocket();
|
|
10129
10127
|
break;
|
|
10130
10128
|
case "transport close":
|
|
10131
10129
|
case "ping timeout":
|
|
10132
10130
|
case "transport error":
|
|
10133
|
-
this.LogDebugMessage(`Server unexpectedly disconnected. Reason: [${reason}]`);
|
|
10134
|
-
this.LogDebugMessage("The connection will be re-established when the server becomes available.");
|
|
10135
|
-
|
|
10136
|
-
this.#
|
|
10137
|
-
|
|
10138
|
-
if (this.#agentManager) this.#agentManager?.ResetAgent();
|
|
10139
|
-
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10140
|
-
} else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10131
|
+
this.LogDebugMessage(`SocketIoClient:on("disconnect"): Server unexpectedly disconnected. Reason: [${reason}]`);
|
|
10132
|
+
this.LogDebugMessage("SocketIoClient:on(\"disconnect\"): The connection will be re-established when the server becomes available.");
|
|
10133
|
+
this.ResetSocket();
|
|
10134
|
+
if (isNode) this.#reconnectTimeoutVal = setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10135
|
+
else this.#reconnectTimeoutVal = setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10141
10136
|
break;
|
|
10142
10137
|
}
|
|
10143
10138
|
});
|
|
10144
10139
|
}
|
|
10140
|
+
ResetSocket = () => {
|
|
10141
|
+
try {
|
|
10142
|
+
if (this.#reconnectTimeoutVal !== void 0) {
|
|
10143
|
+
clearTimeout(this.#reconnectTimeoutVal);
|
|
10144
|
+
this.#reconnectTimeoutVal = void 0;
|
|
10145
|
+
}
|
|
10146
|
+
if (this.#socket) {
|
|
10147
|
+
this.#socket.removeAllListeners();
|
|
10148
|
+
this.#socket.io.removeAllListeners();
|
|
10149
|
+
if (this.#socket.connected === true) this.#socket.disconnect();
|
|
10150
|
+
if (isNode) {
|
|
10151
|
+
if (this.#agentManager) this.#agentManager.ResetAgent();
|
|
10152
|
+
}
|
|
10153
|
+
this.#socket = void 0;
|
|
10154
|
+
}
|
|
10155
|
+
} catch (error) {
|
|
10156
|
+
const errorMessage = `SocketIoClient:ResetSocket(): Error: [${error}]`;
|
|
10157
|
+
this.LogErrorMessage(errorMessage);
|
|
10158
|
+
this.SocketConnectError(new Error(errorMessage));
|
|
10159
|
+
}
|
|
10160
|
+
};
|
|
10145
10161
|
};
|
|
10146
10162
|
//#endregion
|
|
10147
10163
|
//#region src/wsevents.ts
|
|
@@ -10272,7 +10288,7 @@ var NodeAgent = class extends SocketIoClient {
|
|
|
10272
10288
|
};
|
|
10273
10289
|
_Start = async () => {
|
|
10274
10290
|
this._EmitEvent("Starting", {});
|
|
10275
|
-
this.WithAddress(this._options.nodeAgentEndpoint).WithLogger(
|
|
10291
|
+
this.WithAddress(this._options.nodeAgentEndpoint).WithLogger(this._options.logger).WithSocketIoCustomPath(this._options.nodeAgentSocketIoCustomPath).WithAckTimeout(5e3);
|
|
10276
10292
|
if (this._options.agentManager) this.WithAgentManager(this._options.agentManager);
|
|
10277
10293
|
this.#info(chalk.yellow(`_Start():STS Test Runner Service Instance.`));
|
|
10278
10294
|
this.#info(chalk.yellow(`_Start():This service instance emulates instances of the ststestrunnernode service.`));
|