@nsshunt/stsobservability 1.0.83 → 1.0.85
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/stsobservability.mjs +11 -292
- package/dist/stsobservability.mjs.map +1 -1
- package/dist/stsobservability.umd.js +27 -294
- package/dist/stsobservability.umd.js.map +1 -1
- package/package.json +12 -12
- package/types/index.d.ts +0 -3
- package/types/index.d.ts.map +1 -1
- package/types/subscribe/commonTypes.d.ts +2 -3
- package/types/subscribe/commonTypes.d.ts.map +1 -1
- package/types/commonTypes.d.ts +0 -47
- package/types/commonTypes.d.ts.map +0 -1
- package/types/socketioutils/socketIoClientHelper.d.ts +0 -31
- package/types/socketioutils/socketIoClientHelper.d.ts.map +0 -1
- package/types/socketioutils/socketIoServerHelper.d.ts +0 -73
- package/types/socketioutils/socketIoServerHelper.d.ts.map +0 -1
|
@@ -17,16 +17,19 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
17
17
|
return __privateGet(obj, member, getter);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
var _a, _label, _options2, _data2, _val, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _agentManager2, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _publisher, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options3, _agentManager3, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options4, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options5, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options6, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3
|
|
20
|
+
var _a, _label, _options2, _data2, _val, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _agentManager2, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _publisher, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options3, _agentManager3, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options4, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options5, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options6, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3;
|
|
21
21
|
import _cloneDeep from "lodash.clonedeep";
|
|
22
22
|
import isNode from "detect-node";
|
|
23
23
|
import { STSOptionsBase } from "@nsshunt/stsutils";
|
|
24
24
|
import { TinyEmitter } from "tiny-emitter";
|
|
25
25
|
import axios from "axios";
|
|
26
|
+
import * as fs$1 from "node:fs";
|
|
27
|
+
import require$$1 from "path";
|
|
28
|
+
import require$$2 from "os";
|
|
29
|
+
import require$$3 from "crypto";
|
|
26
30
|
import http from "node:http";
|
|
27
31
|
import https from "node:https";
|
|
28
32
|
import { inject } from "vue";
|
|
29
|
-
import { io } from "socket.io-client";
|
|
30
33
|
var Gauge = /* @__PURE__ */ ((Gauge2) => {
|
|
31
34
|
Gauge2["ACTIVE_REQUEST_GAUGE"] = "a";
|
|
32
35
|
Gauge2["AUTHENTICATION_COUNT_GAUGE"] = "b";
|
|
@@ -4561,13 +4564,13 @@ function encode(value, options) {
|
|
|
4561
4564
|
var encoder = new Encoder(options);
|
|
4562
4565
|
return encoder.encodeSharedRef(value);
|
|
4563
4566
|
}
|
|
4567
|
+
var main$1 = { exports: {} };
|
|
4564
4568
|
const __viteBrowserExternal = {};
|
|
4565
|
-
const
|
|
4569
|
+
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4566
4570
|
__proto__: null,
|
|
4567
4571
|
default: __viteBrowserExternal
|
|
4568
4572
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4569
|
-
|
|
4570
|
-
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(fs$1);
|
|
4573
|
+
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
4571
4574
|
const name = "dotenv";
|
|
4572
4575
|
const version$1 = "16.4.5";
|
|
4573
4576
|
const description = "Loads environment variables from .env file";
|
|
@@ -4648,9 +4651,9 @@ const require$$4 = {
|
|
|
4648
4651
|
engines,
|
|
4649
4652
|
browser: browser$1
|
|
4650
4653
|
};
|
|
4651
|
-
const fs = require$$
|
|
4652
|
-
const path = require$$
|
|
4653
|
-
const os = require$$
|
|
4654
|
+
const fs = require$$0;
|
|
4655
|
+
const path = require$$1;
|
|
4656
|
+
const os = require$$2;
|
|
4654
4657
|
const crypto$1 = require$$3;
|
|
4655
4658
|
const packageJson = require$$4;
|
|
4656
4659
|
const version = packageJson.version;
|
|
@@ -8722,285 +8725,6 @@ LogDebugMessage_fn4 = function(message) {
|
|
|
8722
8725
|
LogErrorMessage_fn3 = function(message) {
|
|
8723
8726
|
__privateGet(this, _options6).logger.error(message);
|
|
8724
8727
|
};
|
|
8725
|
-
class SocketIoClientHelper {
|
|
8726
|
-
constructor(options) {
|
|
8727
|
-
__privateAdd(this, _SocketIoClientHelper_instances);
|
|
8728
|
-
__privateAdd(this, _options7);
|
|
8729
|
-
__privateAdd(this, _sockets, {});
|
|
8730
|
-
__privateAdd(this, _agentManager4, null);
|
|
8731
|
-
__privateSet(this, _options7, options);
|
|
8732
|
-
if (isNode) {
|
|
8733
|
-
__privateSet(this, _agentManager4, new AgentManager({
|
|
8734
|
-
agentOptions: __privateGet(this, _options7).agentOptions
|
|
8735
|
-
}));
|
|
8736
|
-
}
|
|
8737
|
-
}
|
|
8738
|
-
get sockets() {
|
|
8739
|
-
return __privateGet(this, _sockets);
|
|
8740
|
-
}
|
|
8741
|
-
SetupClientSideSocket(name2, address, onConnectCallBack, socketEventsCallBack, errorCallBack) {
|
|
8742
|
-
this.sockets[name2] = {
|
|
8743
|
-
name: name2,
|
|
8744
|
-
address,
|
|
8745
|
-
socket: null,
|
|
8746
|
-
errorCallBack
|
|
8747
|
-
};
|
|
8748
|
-
__privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack);
|
|
8749
|
-
return this.sockets[name2].socket;
|
|
8750
|
-
}
|
|
8751
|
-
GetSocket(name2) {
|
|
8752
|
-
return this.sockets[name2].socket;
|
|
8753
|
-
}
|
|
8754
|
-
GetSocketDetail(name2) {
|
|
8755
|
-
return this.sockets[name2];
|
|
8756
|
-
}
|
|
8757
|
-
}
|
|
8758
|
-
_options7 = new WeakMap();
|
|
8759
|
-
_sockets = new WeakMap();
|
|
8760
|
-
_agentManager4 = new WeakMap();
|
|
8761
|
-
_SocketIoClientHelper_instances = new WeakSet();
|
|
8762
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8763
|
-
LogDebugMessage_fn5 = function(message) {
|
|
8764
|
-
if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.debug(message);
|
|
8765
|
-
};
|
|
8766
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8767
|
-
LogErrorMessage_fn4 = function(message) {
|
|
8768
|
-
if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.error(message);
|
|
8769
|
-
};
|
|
8770
|
-
EstablishSocketConnect_fn = function(name2, onConnectCallBack, socketEventsCallBack) {
|
|
8771
|
-
var _a2;
|
|
8772
|
-
const socketDetail = this.sockets[name2];
|
|
8773
|
-
if (socketDetail.socket !== null) {
|
|
8774
|
-
if (socketDetail.socket.connected === true) {
|
|
8775
|
-
socketDetail.socket.disconnect();
|
|
8776
|
-
}
|
|
8777
|
-
socketDetail.socket = null;
|
|
8778
|
-
if (isNode) {
|
|
8779
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
8780
|
-
} else {
|
|
8781
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
8782
|
-
}
|
|
8783
|
-
return;
|
|
8784
|
-
}
|
|
8785
|
-
let socketOptions;
|
|
8786
|
-
if (isNode) {
|
|
8787
|
-
socketOptions = {
|
|
8788
|
-
transports: ["websocket"],
|
|
8789
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8790
|
-
agent: (_a2 = __privateGet(this, _agentManager4)) == null ? void 0 : _a2.GetAgent(socketDetail.address)
|
|
8791
|
-
};
|
|
8792
|
-
} else {
|
|
8793
|
-
socketOptions = {
|
|
8794
|
-
transports: ["websocket"]
|
|
8795
|
-
};
|
|
8796
|
-
}
|
|
8797
|
-
socketDetail.socket = io(socketDetail.address, socketOptions);
|
|
8798
|
-
socketDetail.socket.on("connect", () => {
|
|
8799
|
-
if (socketDetail.socket) {
|
|
8800
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, `Socket: [${socketDetail.socket.id}]: connected`);
|
|
8801
|
-
if (onConnectCallBack) {
|
|
8802
|
-
setTimeout(() => {
|
|
8803
|
-
onConnectCallBack(socketDetail.socket);
|
|
8804
|
-
}, 0);
|
|
8805
|
-
}
|
|
8806
|
-
if (socketEventsCallBack) {
|
|
8807
|
-
socketEventsCallBack(socketDetail.socket);
|
|
8808
|
-
}
|
|
8809
|
-
} else {
|
|
8810
|
-
const errorMessage = "Could not get socket object from socket.io";
|
|
8811
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogErrorMessage_fn4).call(this, errorMessage);
|
|
8812
|
-
socketDetail.errorCallBack(new Error(errorMessage));
|
|
8813
|
-
}
|
|
8814
|
-
});
|
|
8815
|
-
socketDetail.socket.on("disconnect", (reason) => {
|
|
8816
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "socket disconnect: " + reason);
|
|
8817
|
-
switch (reason) {
|
|
8818
|
-
case "io server disconnect":
|
|
8819
|
-
{
|
|
8820
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
|
|
8821
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
|
|
8822
|
-
const socketDetail2 = this.sockets[name2];
|
|
8823
|
-
socketDetail2.socket = null;
|
|
8824
|
-
if (isNode) {
|
|
8825
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
8826
|
-
} else {
|
|
8827
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
8828
|
-
}
|
|
8829
|
-
}
|
|
8830
|
-
break;
|
|
8831
|
-
case "io client disconnect":
|
|
8832
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
|
|
8833
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will not be re-established automatically.");
|
|
8834
|
-
break;
|
|
8835
|
-
case "transport close":
|
|
8836
|
-
case "ping timeout":
|
|
8837
|
-
case "transport error":
|
|
8838
|
-
{
|
|
8839
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, `Server unexpectedly disconnected. Reason: [${reason}]`);
|
|
8840
|
-
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
|
|
8841
|
-
const socketDetail2 = this.sockets[name2];
|
|
8842
|
-
if (socketDetail2.socket) {
|
|
8843
|
-
socketDetail2.socket.disconnect();
|
|
8844
|
-
}
|
|
8845
|
-
socketDetail2.socket = null;
|
|
8846
|
-
if (isNode) {
|
|
8847
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
8848
|
-
} else {
|
|
8849
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
8850
|
-
}
|
|
8851
|
-
}
|
|
8852
|
-
break;
|
|
8853
|
-
}
|
|
8854
|
-
});
|
|
8855
|
-
};
|
|
8856
|
-
var STSNamespace = /* @__PURE__ */ ((STSNamespace2) => {
|
|
8857
|
-
STSNamespace2["STSMonitor"] = "stsinstrumentmanager/stsmonitor";
|
|
8858
|
-
STSNamespace2["STSControl"] = "stsinstrumentmanager/stscontrol";
|
|
8859
|
-
return STSNamespace2;
|
|
8860
|
-
})(STSNamespace || {});
|
|
8861
|
-
var STSRoom = /* @__PURE__ */ ((STSRoom2) => {
|
|
8862
|
-
STSRoom2["STSInstrumentDataRoom"] = "stsinstrumentdataroom";
|
|
8863
|
-
STSRoom2["STSInstrumentDataSubscriptionRoom"] = "stsinstrumentdatasubscriptionroom";
|
|
8864
|
-
STSRoom2["STSRunnerRoom"] = "stsrunnerroom";
|
|
8865
|
-
STSRoom2["STSNodeRunnerRoom"] = "stsnoderunnerroom";
|
|
8866
|
-
return STSRoom2;
|
|
8867
|
-
})(STSRoom || {});
|
|
8868
|
-
var STSEvent = /* @__PURE__ */ ((STSEvent2) => {
|
|
8869
|
-
STSEvent2["STSInstrumentData"] = "stsinstrumentdata";
|
|
8870
|
-
STSEvent2["STSSubInstrumentData"] = "stssubinstrumentdata";
|
|
8871
|
-
STSEvent2["STSResetInstrumentData"] = "stsresetinstrumentdata";
|
|
8872
|
-
STSEvent2["STSStartLoggingInstrumentData"] = "stsStartLoggingInstrumentData";
|
|
8873
|
-
STSEvent2["STSStopLoggingInstrumentData"] = "stsStopLoggingInstrumentData";
|
|
8874
|
-
STSEvent2["STSStart"] = "stsstart";
|
|
8875
|
-
STSEvent2["STSStop"] = "stsstop";
|
|
8876
|
-
STSEvent2["STSPause"] = "stspause";
|
|
8877
|
-
STSEvent2["STSResume"] = "stsresume";
|
|
8878
|
-
STSEvent2["STSTerminate"] = "ststerminate";
|
|
8879
|
-
STSEvent2["STSUpdateStaticConfig"] = "stsupdatestaticconfig";
|
|
8880
|
-
STSEvent2["STSUpdateDynamicConfig"] = "stsupdatedynamicconfig";
|
|
8881
|
-
STSEvent2["STSSendToRoom"] = "sendToRoom";
|
|
8882
|
-
STSEvent2["connect"] = "connect";
|
|
8883
|
-
return STSEvent2;
|
|
8884
|
-
})(STSEvent || {});
|
|
8885
|
-
class SocketIoServerHelper {
|
|
8886
|
-
constructor(options) {
|
|
8887
|
-
__privateAdd(this, _socketIoServerHelperOptions);
|
|
8888
|
-
__privateAdd(this, _namespace, {});
|
|
8889
|
-
__publicField(this, "LeaveRoom", (namespace, socket, room) => {
|
|
8890
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: Leaving room [${room}]`);
|
|
8891
|
-
socket.leave(room);
|
|
8892
|
-
});
|
|
8893
|
-
__publicField(this, "JoinRoom", (namespace, socket, room) => {
|
|
8894
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: Socket joining room [${room}], ID: [${socket.id}]`);
|
|
8895
|
-
socket.join(room);
|
|
8896
|
-
});
|
|
8897
|
-
__privateAdd(this, _SetupStandardEvents, (namespace, socket) => {
|
|
8898
|
-
socket.on("disconnect", (reason) => {
|
|
8899
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: socket disconnect, ID: [${socket.id}] [${reason}]`);
|
|
8900
|
-
});
|
|
8901
|
-
socket.on("disconnecting", (reason) => {
|
|
8902
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: socket disconnecting, ID: [${socket.id}] [${reason}]`);
|
|
8903
|
-
});
|
|
8904
|
-
socket.on("error", (error) => {
|
|
8905
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: socket error, ID: [${socket.id}] [${error}]`);
|
|
8906
|
-
});
|
|
8907
|
-
socket.on("__STSdisconnect", (reason) => {
|
|
8908
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: __STSdisconnect: socket disconnect, ID: [${socket.id}] [${reason}]`);
|
|
8909
|
-
});
|
|
8910
|
-
socket.on("__STSdisconnecting", (reason, callBackResult) => {
|
|
8911
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}: __STSdisconnecting: socket disconnecting, ID: [${socket.id}] [${reason}]`);
|
|
8912
|
-
callBackResult("__STSdisconnecting accepted by server.");
|
|
8913
|
-
});
|
|
8914
|
-
socket.on("__STSjoinRoom", (rooms) => {
|
|
8915
|
-
rooms.forEach((room) => {
|
|
8916
|
-
this.JoinRoom(namespace, socket, room);
|
|
8917
|
-
});
|
|
8918
|
-
});
|
|
8919
|
-
socket.on("__STSleaveRoom", (rooms) => {
|
|
8920
|
-
rooms.forEach((room) => {
|
|
8921
|
-
this.LeaveRoom(namespace, socket, room);
|
|
8922
|
-
});
|
|
8923
|
-
});
|
|
8924
|
-
socket.on("__STSsendToRoom", (rooms, payload) => {
|
|
8925
|
-
rooms.forEach((room) => {
|
|
8926
|
-
this.LogMessage(namespace, `${namespace.socketionamespace.name}:socket.on:sendToRoom: __STSsendToRoom: Sending to room [${room}], ID: [${socket.id}]`);
|
|
8927
|
-
namespace.socketionamespace.to(room).emit(payload.command, payload);
|
|
8928
|
-
});
|
|
8929
|
-
});
|
|
8930
|
-
});
|
|
8931
|
-
// Use this middleward to check every incomming connection
|
|
8932
|
-
__privateAdd(this, _SetupConnectionMiddleware, (nameSpace) => {
|
|
8933
|
-
nameSpace.socketionamespace.use((socket, next) => {
|
|
8934
|
-
{
|
|
8935
|
-
next();
|
|
8936
|
-
}
|
|
8937
|
-
});
|
|
8938
|
-
});
|
|
8939
|
-
// Use this middleware to check very packet being received
|
|
8940
|
-
__privateAdd(this, _SetupMessageMiddleware, (socket) => {
|
|
8941
|
-
socket.use(([event, ...args], next) => {
|
|
8942
|
-
next();
|
|
8943
|
-
});
|
|
8944
|
-
});
|
|
8945
|
-
__publicField(this, "SetupNamespace", (io2, namespace, rooms, autoJoinRooms, socketConnectCallBack, socketEventsCallBack) => {
|
|
8946
|
-
__privateGet(this, _namespace)[namespace] = {
|
|
8947
|
-
namespace,
|
|
8948
|
-
pid: process.pid,
|
|
8949
|
-
socketionamespace: io2.of(`/${namespace}/`)
|
|
8950
|
-
};
|
|
8951
|
-
__privateGet(this, _SetupConnectionMiddleware).call(this, __privateGet(this, _namespace)[namespace]);
|
|
8952
|
-
__privateGet(this, _namespace)[namespace].socketionamespace.on("connection", (socket) => {
|
|
8953
|
-
this.LogMessage(__privateGet(this, _namespace)[namespace], `${namespace}: Socket connected, ID: [${socket.id}]`);
|
|
8954
|
-
this.LogMessage(__privateGet(this, _namespace)[namespace], `${namespace}: Authentication Handshake: [${JSON.stringify(socket.handshake.auth)}]`);
|
|
8955
|
-
__privateGet(this, _SetupMessageMiddleware).call(this, socket);
|
|
8956
|
-
if (autoJoinRooms) {
|
|
8957
|
-
rooms.map((room) => {
|
|
8958
|
-
this.JoinRoom(__privateGet(this, _namespace)[namespace], socket, room);
|
|
8959
|
-
});
|
|
8960
|
-
}
|
|
8961
|
-
__privateGet(this, _SetupStandardEvents).call(this, __privateGet(this, _namespace)[namespace], socket);
|
|
8962
|
-
if (socketConnectCallBack) {
|
|
8963
|
-
setTimeout(() => {
|
|
8964
|
-
socketConnectCallBack(socket);
|
|
8965
|
-
}, 0);
|
|
8966
|
-
}
|
|
8967
|
-
if (socketEventsCallBack) {
|
|
8968
|
-
socketEventsCallBack(socket);
|
|
8969
|
-
}
|
|
8970
|
-
});
|
|
8971
|
-
return __privateGet(this, _namespace)[namespace].socketionamespace;
|
|
8972
|
-
});
|
|
8973
|
-
__publicField(this, "GetSTSSocketIONamespace", (namespace) => {
|
|
8974
|
-
return __privateGet(this, _namespace)[namespace];
|
|
8975
|
-
});
|
|
8976
|
-
__publicField(this, "GetSTSSocketIONamespaces", () => {
|
|
8977
|
-
return __privateGet(this, _namespace);
|
|
8978
|
-
});
|
|
8979
|
-
__publicField(this, "CloseAdaptors", async () => {
|
|
8980
|
-
for (const [, namespace] of Object.entries(__privateGet(this, _namespace))) {
|
|
8981
|
-
await namespace.socketionamespace.adapter.close();
|
|
8982
|
-
}
|
|
8983
|
-
});
|
|
8984
|
-
__publicField(this, "DisconnectSockets", () => {
|
|
8985
|
-
for (const [, namespace] of Object.entries(__privateGet(this, _namespace))) {
|
|
8986
|
-
namespace.socketionamespace.disconnectSockets();
|
|
8987
|
-
}
|
|
8988
|
-
__privateSet(this, _namespace, {});
|
|
8989
|
-
});
|
|
8990
|
-
__privateSet(this, _socketIoServerHelperOptions, options);
|
|
8991
|
-
}
|
|
8992
|
-
LogMessage(namespace, message) {
|
|
8993
|
-
__privateGet(this, _socketIoServerHelperOptions).logger.debug(`${namespace.namespace}: ${message}`);
|
|
8994
|
-
}
|
|
8995
|
-
SetupEvent(event, eventCb) {
|
|
8996
|
-
return this;
|
|
8997
|
-
}
|
|
8998
|
-
}
|
|
8999
|
-
_socketIoServerHelperOptions = new WeakMap();
|
|
9000
|
-
_namespace = new WeakMap();
|
|
9001
|
-
_SetupStandardEvents = new WeakMap();
|
|
9002
|
-
_SetupConnectionMiddleware = new WeakMap();
|
|
9003
|
-
_SetupMessageMiddleware = new WeakMap();
|
|
9004
8728
|
export {
|
|
9005
8729
|
CompareSTSInstrumentControllerPluginKey,
|
|
9006
8730
|
CreateInstrument,
|
|
@@ -9045,14 +8769,9 @@ export {
|
|
|
9045
8769
|
PublishTransportRESTServer,
|
|
9046
8770
|
RequestLoggerMiddleware,
|
|
9047
8771
|
RequestLoggerMiddlewareEventName,
|
|
9048
|
-
STSEvent,
|
|
9049
8772
|
STSInstrumentControllerPlugin,
|
|
9050
8773
|
STSInstrumentControllerPluginKey,
|
|
9051
|
-
STSNamespace,
|
|
9052
|
-
STSRoom,
|
|
9053
|
-
SocketIoClientHelper,
|
|
9054
8774
|
SocketIoMessageSender,
|
|
9055
|
-
SocketIoServerHelper,
|
|
9056
8775
|
StopInstruments,
|
|
9057
8776
|
SubscriptionTopic,
|
|
9058
8777
|
TransportType,
|