@nsshunt/stsuxvue 1.0.72 → 1.0.74
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/stsuxvue.cjs
CHANGED
|
@@ -10077,21 +10077,33 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10077
10077
|
#socketIoCustomPath;
|
|
10078
10078
|
#authToken;
|
|
10079
10079
|
#socket;
|
|
10080
|
+
#reconnectTimeout = 2e3;
|
|
10081
|
+
// default
|
|
10080
10082
|
constructor(name) {
|
|
10081
10083
|
super();
|
|
10082
10084
|
this.#name = name;
|
|
10083
10085
|
}
|
|
10086
|
+
get logPrefix() {
|
|
10087
|
+
return `SocketIoClient[${this.#name}]:`;
|
|
10088
|
+
}
|
|
10084
10089
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10085
10090
|
LogDebugMessage(message) {
|
|
10086
|
-
if (this.#logger) this.#logger.debug(message);
|
|
10091
|
+
if (this.#logger) this.#logger.debug(`${this.logPrefix}${message}`);
|
|
10087
10092
|
}
|
|
10088
10093
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10089
10094
|
LogErrorMessage(message) {
|
|
10090
|
-
if (this.#logger) this.#logger.error(message);
|
|
10095
|
+
if (this.#logger) this.#logger.error(`${this.logPrefix}${message}`);
|
|
10096
|
+
}
|
|
10097
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10098
|
+
LogWarningMessage(message) {
|
|
10099
|
+
if (this.#logger) this.#logger.warn(`${this.logPrefix}${message}`);
|
|
10091
10100
|
}
|
|
10092
10101
|
get name() {
|
|
10093
10102
|
return this.#name;
|
|
10094
10103
|
}
|
|
10104
|
+
get reconnectTimeout() {
|
|
10105
|
+
return this.#reconnectTimeout;
|
|
10106
|
+
}
|
|
10095
10107
|
get agentManager() {
|
|
10096
10108
|
return this.#agentManager;
|
|
10097
10109
|
}
|
|
@@ -10130,6 +10142,10 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10130
10142
|
this.#agentManager = agentManager;
|
|
10131
10143
|
return this;
|
|
10132
10144
|
}
|
|
10145
|
+
WithReconnectTimeout(reconnectTimeout) {
|
|
10146
|
+
this.#reconnectTimeout = reconnectTimeout;
|
|
10147
|
+
return this;
|
|
10148
|
+
}
|
|
10133
10149
|
SetupSocket() {
|
|
10134
10150
|
if (!this.#address) {
|
|
10135
10151
|
throw new Error(`SocketIoClientHelper:SetupSocket(): Error: [address not provided]`);
|
|
@@ -10162,9 +10178,9 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10162
10178
|
}
|
|
10163
10179
|
this.#socket = void 0;
|
|
10164
10180
|
if (isNode) {
|
|
10165
|
-
setTimeout(() => this.#EstablishSocketConnect(),
|
|
10181
|
+
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10166
10182
|
} else {
|
|
10167
|
-
setTimeout(() => this.#EstablishSocketConnect(),
|
|
10183
|
+
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10168
10184
|
}
|
|
10169
10185
|
return;
|
|
10170
10186
|
}
|
|
@@ -10175,7 +10191,7 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10175
10191
|
};
|
|
10176
10192
|
if (this.#agentManager) {
|
|
10177
10193
|
if (!this.#address) {
|
|
10178
|
-
throw new Error(`
|
|
10194
|
+
throw new Error(`SocketIoClient:SetupSocket(): Error: [address not provided when using agentManager]`);
|
|
10179
10195
|
}
|
|
10180
10196
|
socketOptions.agent = this.#agentManager.GetAgent(this.#address);
|
|
10181
10197
|
}
|
|
@@ -10196,58 +10212,58 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10196
10212
|
}
|
|
10197
10213
|
this.#socket = socket_ioClient.io(this.#address, socketOptions);
|
|
10198
10214
|
this.#socket.io.on("error", (err) => {
|
|
10199
|
-
this.LogErrorMessage(`
|
|
10215
|
+
this.LogErrorMessage(`socketDetail.socket.io.on('error'): [${err}] Address: [${this.#address}]`);
|
|
10200
10216
|
});
|
|
10201
10217
|
this.#socket.io.on("reconnect_error", (err) => {
|
|
10202
|
-
this.LogErrorMessage(`
|
|
10218
|
+
this.LogErrorMessage(`socketDetail.socket.io.on('reconnect_error'): [${err}] Address: [${this.#address}]`);
|
|
10203
10219
|
});
|
|
10204
10220
|
this.#socket.on("connect_error", (err) => {
|
|
10205
|
-
this.LogErrorMessage(`
|
|
10221
|
+
this.LogErrorMessage(`socketDetail.socket.on('connect_error'): [${err}] Address: [${this.#address}]`);
|
|
10206
10222
|
});
|
|
10207
10223
|
this.#socket.io.on("reconnect", (attempt) => {
|
|
10208
|
-
this.LogErrorMessage(`
|
|
10224
|
+
this.LogErrorMessage(`socketDetail.socket.io.on('reconnect'): Number: [${attempt}] Address: [${this.#address}]`);
|
|
10209
10225
|
});
|
|
10210
10226
|
this.#socket.on("connect", () => {
|
|
10211
10227
|
if (this.#socket) {
|
|
10212
|
-
this.LogDebugMessage(`
|
|
10228
|
+
this.LogDebugMessage(`Socket: [${this.#socket.id}]: connected, Address: [${this.#address}]`);
|
|
10213
10229
|
setTimeout(() => {
|
|
10214
10230
|
this.ConnectCallBack(this.#socket);
|
|
10215
10231
|
}, 0);
|
|
10216
10232
|
this.SocketEventsCallBack(this.#socket);
|
|
10217
10233
|
} else {
|
|
10218
|
-
const errorMessage = "
|
|
10234
|
+
const errorMessage = "Could not get socket object from socket.io, Address: [${socketDetail.address}]";
|
|
10219
10235
|
this.LogErrorMessage(errorMessage);
|
|
10220
10236
|
this.ErrorCallBack(new Error(errorMessage));
|
|
10221
10237
|
}
|
|
10222
10238
|
});
|
|
10223
10239
|
this.#socket.on("disconnect", (reason) => {
|
|
10224
|
-
this.LogDebugMessage("
|
|
10240
|
+
this.LogDebugMessage("socket disconnect: " + reason);
|
|
10225
10241
|
switch (reason) {
|
|
10226
10242
|
case "io server disconnect":
|
|
10227
10243
|
{
|
|
10228
|
-
this.LogDebugMessage("
|
|
10229
|
-
this.LogDebugMessage("
|
|
10244
|
+
this.LogDebugMessage("The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
|
|
10245
|
+
this.LogDebugMessage("The connection will be re-established when the server becomes available.");
|
|
10230
10246
|
this.#socket = void 0;
|
|
10231
10247
|
if (isNode) {
|
|
10232
10248
|
if (this.#agentManager) {
|
|
10233
10249
|
this.#agentManager.ResetAgent();
|
|
10234
10250
|
}
|
|
10235
|
-
setTimeout(() => this.#EstablishSocketConnect(),
|
|
10251
|
+
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10236
10252
|
} else {
|
|
10237
|
-
setTimeout(() => this.#EstablishSocketConnect(),
|
|
10253
|
+
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10238
10254
|
}
|
|
10239
10255
|
}
|
|
10240
10256
|
break;
|
|
10241
10257
|
case "io client disconnect":
|
|
10242
|
-
this.LogDebugMessage("
|
|
10243
|
-
this.LogDebugMessage("
|
|
10258
|
+
this.LogDebugMessage("The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
|
|
10259
|
+
this.LogDebugMessage("The connection will not be re-established automatically.");
|
|
10244
10260
|
break;
|
|
10245
10261
|
case "transport close":
|
|
10246
10262
|
case "ping timeout":
|
|
10247
10263
|
case "transport error":
|
|
10248
10264
|
{
|
|
10249
|
-
this.LogDebugMessage(`
|
|
10250
|
-
this.LogDebugMessage("
|
|
10265
|
+
this.LogDebugMessage(`Server unexpectedly disconnected. Reason: [${reason}]`);
|
|
10266
|
+
this.LogDebugMessage("The connection will be re-established when the server becomes available.");
|
|
10251
10267
|
if (this.#socket) {
|
|
10252
10268
|
this.#socket.disconnect();
|
|
10253
10269
|
}
|
|
@@ -10256,9 +10272,9 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10256
10272
|
if (this.#agentManager) {
|
|
10257
10273
|
this.#agentManager?.ResetAgent();
|
|
10258
10274
|
}
|
|
10259
|
-
setTimeout(() => this.#EstablishSocketConnect(),
|
|
10275
|
+
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
|
|
10260
10276
|
} else {
|
|
10261
|
-
setTimeout(() => this.#EstablishSocketConnect(),
|
|
10277
|
+
setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
|
|
10262
10278
|
}
|
|
10263
10279
|
}
|
|
10264
10280
|
break;
|
|
@@ -10604,10 +10620,13 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10604
10620
|
const LogDebug = (message) => {
|
|
10605
10621
|
stsutils.defaultLogger.debug(baseColour(`stsuxvue:UXModelNavigator:${message}`));
|
|
10606
10622
|
};
|
|
10623
|
+
const LogWarning = (message) => {
|
|
10624
|
+
stsutils.defaultLogger.warn(baseColour(`stsuxvue:UXModelNavigator:${message}`));
|
|
10625
|
+
};
|
|
10607
10626
|
const TransformSubscriptionPayloadCallback = (subscriptionPayload) => {
|
|
10608
10627
|
observabilitySubscriberManager?.TransformSubscriptionPayloadCallback(subscriptionPayload);
|
|
10609
10628
|
};
|
|
10610
|
-
|
|
10629
|
+
const GetRootLevelSubscriptions = () => [{
|
|
10611
10630
|
subscriptionKey: {
|
|
10612
10631
|
id: v4(),
|
|
10613
10632
|
topic: stsobservability.SubscriptionTopic.AllServicesCombined
|
|
@@ -10620,7 +10639,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10620
10639
|
},
|
|
10621
10640
|
cb: TransformSubscriptionPayloadCallback
|
|
10622
10641
|
}];
|
|
10623
|
-
const
|
|
10642
|
+
const GetServicesSubscriptions = () => [{
|
|
10624
10643
|
subscriptionKey: {
|
|
10625
10644
|
id: v4(),
|
|
10626
10645
|
topic: stsobservability.SubscriptionTopic.Services
|
|
@@ -10648,7 +10667,6 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10648
10667
|
cb: TransformSubscriptionPayloadCallback
|
|
10649
10668
|
}];
|
|
10650
10669
|
};
|
|
10651
|
-
let navSubscriptions = rootLevelSubscriptions;
|
|
10652
10670
|
let navigationSubscriptions = {
|
|
10653
10671
|
subscriptions: [],
|
|
10654
10672
|
currentSubscriptions: null
|
|
@@ -10692,7 +10710,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10692
10710
|
if (store._models[props.modelId].serviceModelSubscriptionKey) {
|
|
10693
10711
|
switch (store._models[props.modelId].serviceModelSubscriptionKey?.topic) {
|
|
10694
10712
|
case stsobservability.SubscriptionTopic.AllServicesCombined:
|
|
10695
|
-
navigate(
|
|
10713
|
+
navigate(GetServicesSubscriptions());
|
|
10696
10714
|
break;
|
|
10697
10715
|
case stsobservability.SubscriptionTopic.Services:
|
|
10698
10716
|
navigate(GetServiceInstancesSubscriptions(id));
|
|
@@ -10705,8 +10723,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10705
10723
|
}
|
|
10706
10724
|
};
|
|
10707
10725
|
const navigate = function(subscriptions) {
|
|
10708
|
-
obj.
|
|
10709
|
-
|
|
10726
|
+
if (obj.currentSubscriptions) {
|
|
10727
|
+
obj.subscriptions.push(obj.currentSubscriptions);
|
|
10728
|
+
} else {
|
|
10729
|
+
LogWarning(`navigate: obj.currentSubscriptions not defined`);
|
|
10730
|
+
}
|
|
10710
10731
|
obj.currentSubscriptions = subscriptions;
|
|
10711
10732
|
LogDebug(`navigate: observabilitySubscriberManager().UpdateModelCursor(${JSON.stringify(subscriptions)})`);
|
|
10712
10733
|
observabilitySubscriberManager?.UpdateModelCursor(subscriptions);
|
|
@@ -10715,10 +10736,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10715
10736
|
if (obj.subscriptions.length > 0) {
|
|
10716
10737
|
let key = obj.subscriptions.pop();
|
|
10717
10738
|
if (key) {
|
|
10718
|
-
navSubscriptions = key;
|
|
10719
10739
|
obj.currentSubscriptions = key;
|
|
10720
|
-
LogDebug(`GoBack: observabilitySubscriberManager().UpdateModelCursor(${JSON.stringify(
|
|
10721
|
-
observabilitySubscriberManager?.UpdateModelCursor(
|
|
10740
|
+
LogDebug(`GoBack: observabilitySubscriberManager().UpdateModelCursor(${JSON.stringify(obj.currentSubscriptions)})`);
|
|
10741
|
+
observabilitySubscriberManager?.UpdateModelCursor(obj.currentSubscriptions);
|
|
10722
10742
|
} else {
|
|
10723
10743
|
LogDebug(`GoBack: subscriptions key not defined`);
|
|
10724
10744
|
}
|
|
@@ -10728,10 +10748,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10728
10748
|
};
|
|
10729
10749
|
const TopLevel = function() {
|
|
10730
10750
|
obj.subscriptions = [];
|
|
10731
|
-
|
|
10732
|
-
obj.currentSubscriptions
|
|
10733
|
-
|
|
10734
|
-
observabilitySubscriberManager?.UpdateModelCursor(navSubscriptions);
|
|
10751
|
+
obj.currentSubscriptions = GetRootLevelSubscriptions();
|
|
10752
|
+
LogDebug(`TopLevel: observabilitySubscriberManager().UpdateModelCursor(${JSON.stringify(obj.currentSubscriptions)})`);
|
|
10753
|
+
observabilitySubscriberManager?.UpdateModelCursor(obj.currentSubscriptions);
|
|
10735
10754
|
};
|
|
10736
10755
|
vue.onMounted(() => {
|
|
10737
10756
|
LogDebug(`onMounted()`);
|
|
@@ -10760,9 +10779,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10760
10779
|
store.UpdateObservabilitySubscriberManager(observabilitySubscriberManager.id, observabilitySubscriberManager);
|
|
10761
10780
|
LogDebug(`Start(): observabilitySubscriberManager().Start(): Mode: [${options.consumeInstrumentationMode}]`);
|
|
10762
10781
|
await observabilitySubscriberManager.Start();
|
|
10763
|
-
obj.currentSubscriptions =
|
|
10764
|
-
LogDebug(`Start(): observabilitySubscriberManager().UpdateModelCursor(): Mode: [${options.consumeInstrumentationMode}] rootLevelSubscriptions: [(${JSON.stringify(
|
|
10765
|
-
observabilitySubscriberManager?.UpdateModelCursor(
|
|
10782
|
+
obj.currentSubscriptions = GetRootLevelSubscriptions();
|
|
10783
|
+
LogDebug(`Start(): observabilitySubscriberManager().UpdateModelCursor(): Mode: [${options.consumeInstrumentationMode}] rootLevelSubscriptions: [(${JSON.stringify(obj.currentSubscriptions)}]`);
|
|
10784
|
+
observabilitySubscriberManager?.UpdateModelCursor(obj.currentSubscriptions);
|
|
10766
10785
|
store.UpdateSate(props.modelId, _estate.STARTED);
|
|
10767
10786
|
};
|
|
10768
10787
|
__expose({
|