@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.
@@ -1,6 +1,6 @@
1
1
  (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("lodash.clonedeep"), require("detect-node"), require("@nsshunt/stsutils"), require("tiny-emitter"), require("axios"), require("node:http"), require("node:https"), require("vue"), require("socket.io-client")) : typeof define === "function" && define.amd ? define(["exports", "lodash.clonedeep", "detect-node", "@nsshunt/stsutils", "tiny-emitter", "axios", "node:http", "node:https", "vue", "socket.io-client"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsobservability"] = {}, global2.lodash, global2["detect-node"], global2.stsutils, global2["tiny-emitter"], global2.axios, global2.http, global2.https, global2.vue, global2.socket["io-client"]));
3
- })(this, function(exports2, _cloneDeep, isNode, stsutils, tinyEmitter, axios, http, https, vue, socket_ioClient) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("lodash.clonedeep"), require("detect-node"), require("@nsshunt/stsutils"), require("tiny-emitter"), require("axios"), require("node:fs"), require("path"), require("os"), require("crypto"), require("node:http"), require("node:https"), require("vue")) : typeof define === "function" && define.amd ? define(["exports", "lodash.clonedeep", "detect-node", "@nsshunt/stsutils", "tiny-emitter", "axios", "node:fs", "path", "os", "crypto", "node:http", "node:https", "vue"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsobservability"] = {}, global2.lodash, global2["detect-node"], global2.stsutils, global2["tiny-emitter"], global2.axios, global2.fs, global2.path, global2.os, global2.crypto, global2.http, global2.https, global2.vue));
3
+ })(this, function(exports2, _cloneDeep, isNode, stsutils, tinyEmitter, axios, fs$1, require$$1, require$$2, require$$3, http, https, vue) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __typeError = (msg) => {
6
6
  throw TypeError(msg);
@@ -21,7 +21,24 @@ var __privateWrapper = (obj, member, setter, getter) => ({
21
21
  }
22
22
  });
23
23
 
24
- 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, _options7, _sockets, _agentManager4, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn, _socketIoServerHelperOptions, _namespace, _SetupStandardEvents, _SetupConnectionMiddleware, _SetupMessageMiddleware;
24
+ 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;
25
+ function _interopNamespaceDefault(e) {
26
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
27
+ if (e) {
28
+ for (const k in e) {
29
+ if (k !== "default") {
30
+ const d = Object.getOwnPropertyDescriptor(e, k);
31
+ Object.defineProperty(n, k, d.get ? d : {
32
+ enumerable: true,
33
+ get: () => e[k]
34
+ });
35
+ }
36
+ }
37
+ }
38
+ n.default = e;
39
+ return Object.freeze(n);
40
+ }
41
+ const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs$1);
25
42
  var Gauge = /* @__PURE__ */ ((Gauge2) => {
26
43
  Gauge2["ACTIVE_REQUEST_GAUGE"] = "a";
27
44
  Gauge2["AUTHENTICATION_COUNT_GAUGE"] = "b";
@@ -4556,13 +4573,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4556
4573
  var encoder = new Encoder(options);
4557
4574
  return encoder.encodeSharedRef(value);
4558
4575
  }
4576
+ var main$1 = { exports: {} };
4559
4577
  const __viteBrowserExternal = {};
4560
- const fs$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4578
+ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4561
4579
  __proto__: null,
4562
4580
  default: __viteBrowserExternal
4563
4581
  }, Symbol.toStringTag, { value: "Module" }));
4564
- var main$1 = { exports: {} };
4565
- const require$$3 = /* @__PURE__ */ getAugmentedNamespace(fs$1);
4582
+ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
4566
4583
  const name = "dotenv";
4567
4584
  const version$1 = "16.4.5";
4568
4585
  const description = "Loads environment variables from .env file";
@@ -4643,9 +4660,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4643
4660
  engines,
4644
4661
  browser: browser$1
4645
4662
  };
4646
- const fs = require$$3;
4647
- const path = require$$3;
4648
- const os = require$$3;
4663
+ const fs = require$$0;
4664
+ const path = require$$1;
4665
+ const os = require$$2;
4649
4666
  const crypto$1 = require$$3;
4650
4667
  const packageJson = require$$4;
4651
4668
  const version = packageJson.version;
@@ -6342,7 +6359,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6342
6359
  chalk.supportsColor = stdoutColor;
6343
6360
  chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
6344
6361
  chalk.stderr.supportsColor = stderrColor;
6345
- const { accessSync, constants, readFileSync } = fs$1;
6362
+ const { accessSync, constants, readFileSync } = fs__namespace;
6346
6363
  const envOptions = {};
6347
6364
  function SetupConfig(envOptions2, logger) {
6348
6365
  const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
@@ -8717,285 +8734,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
8717
8734
  LogErrorMessage_fn3 = function(message) {
8718
8735
  __privateGet(this, _options6).logger.error(message);
8719
8736
  };
8720
- class SocketIoClientHelper {
8721
- constructor(options) {
8722
- __privateAdd(this, _SocketIoClientHelper_instances);
8723
- __privateAdd(this, _options7);
8724
- __privateAdd(this, _sockets, {});
8725
- __privateAdd(this, _agentManager4, null);
8726
- __privateSet(this, _options7, options);
8727
- if (isNode) {
8728
- __privateSet(this, _agentManager4, new AgentManager({
8729
- agentOptions: __privateGet(this, _options7).agentOptions
8730
- }));
8731
- }
8732
- }
8733
- get sockets() {
8734
- return __privateGet(this, _sockets);
8735
- }
8736
- SetupClientSideSocket(name2, address, onConnectCallBack, socketEventsCallBack, errorCallBack) {
8737
- this.sockets[name2] = {
8738
- name: name2,
8739
- address,
8740
- socket: null,
8741
- errorCallBack
8742
- };
8743
- __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack);
8744
- return this.sockets[name2].socket;
8745
- }
8746
- GetSocket(name2) {
8747
- return this.sockets[name2].socket;
8748
- }
8749
- GetSocketDetail(name2) {
8750
- return this.sockets[name2];
8751
- }
8752
- }
8753
- _options7 = new WeakMap();
8754
- _sockets = new WeakMap();
8755
- _agentManager4 = new WeakMap();
8756
- _SocketIoClientHelper_instances = new WeakSet();
8757
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8758
- LogDebugMessage_fn5 = function(message) {
8759
- if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.debug(message);
8760
- };
8761
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8762
- LogErrorMessage_fn4 = function(message) {
8763
- if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.error(message);
8764
- };
8765
- EstablishSocketConnect_fn = function(name2, onConnectCallBack, socketEventsCallBack) {
8766
- var _a2;
8767
- const socketDetail = this.sockets[name2];
8768
- if (socketDetail.socket !== null) {
8769
- if (socketDetail.socket.connected === true) {
8770
- socketDetail.socket.disconnect();
8771
- }
8772
- socketDetail.socket = null;
8773
- if (isNode) {
8774
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
8775
- } else {
8776
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
8777
- }
8778
- return;
8779
- }
8780
- let socketOptions;
8781
- if (isNode) {
8782
- socketOptions = {
8783
- transports: ["websocket"],
8784
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8785
- agent: (_a2 = __privateGet(this, _agentManager4)) == null ? void 0 : _a2.GetAgent(socketDetail.address)
8786
- };
8787
- } else {
8788
- socketOptions = {
8789
- transports: ["websocket"]
8790
- };
8791
- }
8792
- socketDetail.socket = socket_ioClient.io(socketDetail.address, socketOptions);
8793
- socketDetail.socket.on("connect", () => {
8794
- if (socketDetail.socket) {
8795
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, `Socket: [${socketDetail.socket.id}]: connected`);
8796
- if (onConnectCallBack) {
8797
- setTimeout(() => {
8798
- onConnectCallBack(socketDetail.socket);
8799
- }, 0);
8800
- }
8801
- if (socketEventsCallBack) {
8802
- socketEventsCallBack(socketDetail.socket);
8803
- }
8804
- } else {
8805
- const errorMessage = "Could not get socket object from socket.io";
8806
- __privateMethod(this, _SocketIoClientHelper_instances, LogErrorMessage_fn4).call(this, errorMessage);
8807
- socketDetail.errorCallBack(new Error(errorMessage));
8808
- }
8809
- });
8810
- socketDetail.socket.on("disconnect", (reason) => {
8811
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "socket disconnect: " + reason);
8812
- switch (reason) {
8813
- case "io server disconnect":
8814
- {
8815
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
8816
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
8817
- const socketDetail2 = this.sockets[name2];
8818
- socketDetail2.socket = null;
8819
- if (isNode) {
8820
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
8821
- } else {
8822
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
8823
- }
8824
- }
8825
- break;
8826
- case "io client disconnect":
8827
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The client disconnected using disconnectSockets, i.e. normal safe disconnection from explicit disconnection by the client.");
8828
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will not be re-established automatically.");
8829
- break;
8830
- case "transport close":
8831
- case "ping timeout":
8832
- case "transport error":
8833
- {
8834
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, `Server unexpectedly disconnected. Reason: [${reason}]`);
8835
- __privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
8836
- const socketDetail2 = this.sockets[name2];
8837
- if (socketDetail2.socket) {
8838
- socketDetail2.socket.disconnect();
8839
- }
8840
- socketDetail2.socket = null;
8841
- if (isNode) {
8842
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
8843
- } else {
8844
- setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
8845
- }
8846
- }
8847
- break;
8848
- }
8849
- });
8850
- };
8851
- var STSNamespace = /* @__PURE__ */ ((STSNamespace2) => {
8852
- STSNamespace2["STSMonitor"] = "stsinstrumentmanager/stsmonitor";
8853
- STSNamespace2["STSControl"] = "stsinstrumentmanager/stscontrol";
8854
- return STSNamespace2;
8855
- })(STSNamespace || {});
8856
- var STSRoom = /* @__PURE__ */ ((STSRoom2) => {
8857
- STSRoom2["STSInstrumentDataRoom"] = "stsinstrumentdataroom";
8858
- STSRoom2["STSInstrumentDataSubscriptionRoom"] = "stsinstrumentdatasubscriptionroom";
8859
- STSRoom2["STSRunnerRoom"] = "stsrunnerroom";
8860
- STSRoom2["STSNodeRunnerRoom"] = "stsnoderunnerroom";
8861
- return STSRoom2;
8862
- })(STSRoom || {});
8863
- var STSEvent = /* @__PURE__ */ ((STSEvent2) => {
8864
- STSEvent2["STSInstrumentData"] = "stsinstrumentdata";
8865
- STSEvent2["STSSubInstrumentData"] = "stssubinstrumentdata";
8866
- STSEvent2["STSResetInstrumentData"] = "stsresetinstrumentdata";
8867
- STSEvent2["STSStartLoggingInstrumentData"] = "stsStartLoggingInstrumentData";
8868
- STSEvent2["STSStopLoggingInstrumentData"] = "stsStopLoggingInstrumentData";
8869
- STSEvent2["STSStart"] = "stsstart";
8870
- STSEvent2["STSStop"] = "stsstop";
8871
- STSEvent2["STSPause"] = "stspause";
8872
- STSEvent2["STSResume"] = "stsresume";
8873
- STSEvent2["STSTerminate"] = "ststerminate";
8874
- STSEvent2["STSUpdateStaticConfig"] = "stsupdatestaticconfig";
8875
- STSEvent2["STSUpdateDynamicConfig"] = "stsupdatedynamicconfig";
8876
- STSEvent2["STSSendToRoom"] = "sendToRoom";
8877
- STSEvent2["connect"] = "connect";
8878
- return STSEvent2;
8879
- })(STSEvent || {});
8880
- class SocketIoServerHelper {
8881
- constructor(options) {
8882
- __privateAdd(this, _socketIoServerHelperOptions);
8883
- __privateAdd(this, _namespace, {});
8884
- __publicField(this, "LeaveRoom", (namespace, socket, room) => {
8885
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: Leaving room [${room}]`);
8886
- socket.leave(room);
8887
- });
8888
- __publicField(this, "JoinRoom", (namespace, socket, room) => {
8889
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: Socket joining room [${room}], ID: [${socket.id}]`);
8890
- socket.join(room);
8891
- });
8892
- __privateAdd(this, _SetupStandardEvents, (namespace, socket) => {
8893
- socket.on("disconnect", (reason) => {
8894
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: socket disconnect, ID: [${socket.id}] [${reason}]`);
8895
- });
8896
- socket.on("disconnecting", (reason) => {
8897
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: socket disconnecting, ID: [${socket.id}] [${reason}]`);
8898
- });
8899
- socket.on("error", (error) => {
8900
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: socket error, ID: [${socket.id}] [${error}]`);
8901
- });
8902
- socket.on("__STSdisconnect", (reason) => {
8903
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: __STSdisconnect: socket disconnect, ID: [${socket.id}] [${reason}]`);
8904
- });
8905
- socket.on("__STSdisconnecting", (reason, callBackResult) => {
8906
- this.LogMessage(namespace, `${namespace.socketionamespace.name}: __STSdisconnecting: socket disconnecting, ID: [${socket.id}] [${reason}]`);
8907
- callBackResult("__STSdisconnecting accepted by server.");
8908
- });
8909
- socket.on("__STSjoinRoom", (rooms) => {
8910
- rooms.forEach((room) => {
8911
- this.JoinRoom(namespace, socket, room);
8912
- });
8913
- });
8914
- socket.on("__STSleaveRoom", (rooms) => {
8915
- rooms.forEach((room) => {
8916
- this.LeaveRoom(namespace, socket, room);
8917
- });
8918
- });
8919
- socket.on("__STSsendToRoom", (rooms, payload) => {
8920
- rooms.forEach((room) => {
8921
- this.LogMessage(namespace, `${namespace.socketionamespace.name}:socket.on:sendToRoom: __STSsendToRoom: Sending to room [${room}], ID: [${socket.id}]`);
8922
- namespace.socketionamespace.to(room).emit(payload.command, payload);
8923
- });
8924
- });
8925
- });
8926
- // Use this middleward to check every incomming connection
8927
- __privateAdd(this, _SetupConnectionMiddleware, (nameSpace) => {
8928
- nameSpace.socketionamespace.use((socket, next) => {
8929
- {
8930
- next();
8931
- }
8932
- });
8933
- });
8934
- // Use this middleware to check very packet being received
8935
- __privateAdd(this, _SetupMessageMiddleware, (socket) => {
8936
- socket.use(([event, ...args], next) => {
8937
- next();
8938
- });
8939
- });
8940
- __publicField(this, "SetupNamespace", (io, namespace, rooms, autoJoinRooms, socketConnectCallBack, socketEventsCallBack) => {
8941
- __privateGet(this, _namespace)[namespace] = {
8942
- namespace,
8943
- pid: process.pid,
8944
- socketionamespace: io.of(`/${namespace}/`)
8945
- };
8946
- __privateGet(this, _SetupConnectionMiddleware).call(this, __privateGet(this, _namespace)[namespace]);
8947
- __privateGet(this, _namespace)[namespace].socketionamespace.on("connection", (socket) => {
8948
- this.LogMessage(__privateGet(this, _namespace)[namespace], `${namespace}: Socket connected, ID: [${socket.id}]`);
8949
- this.LogMessage(__privateGet(this, _namespace)[namespace], `${namespace}: Authentication Handshake: [${JSON.stringify(socket.handshake.auth)}]`);
8950
- __privateGet(this, _SetupMessageMiddleware).call(this, socket);
8951
- if (autoJoinRooms) {
8952
- rooms.map((room) => {
8953
- this.JoinRoom(__privateGet(this, _namespace)[namespace], socket, room);
8954
- });
8955
- }
8956
- __privateGet(this, _SetupStandardEvents).call(this, __privateGet(this, _namespace)[namespace], socket);
8957
- if (socketConnectCallBack) {
8958
- setTimeout(() => {
8959
- socketConnectCallBack(socket);
8960
- }, 0);
8961
- }
8962
- if (socketEventsCallBack) {
8963
- socketEventsCallBack(socket);
8964
- }
8965
- });
8966
- return __privateGet(this, _namespace)[namespace].socketionamespace;
8967
- });
8968
- __publicField(this, "GetSTSSocketIONamespace", (namespace) => {
8969
- return __privateGet(this, _namespace)[namespace];
8970
- });
8971
- __publicField(this, "GetSTSSocketIONamespaces", () => {
8972
- return __privateGet(this, _namespace);
8973
- });
8974
- __publicField(this, "CloseAdaptors", async () => {
8975
- for (const [, namespace] of Object.entries(__privateGet(this, _namespace))) {
8976
- await namespace.socketionamespace.adapter.close();
8977
- }
8978
- });
8979
- __publicField(this, "DisconnectSockets", () => {
8980
- for (const [, namespace] of Object.entries(__privateGet(this, _namespace))) {
8981
- namespace.socketionamespace.disconnectSockets();
8982
- }
8983
- __privateSet(this, _namespace, {});
8984
- });
8985
- __privateSet(this, _socketIoServerHelperOptions, options);
8986
- }
8987
- LogMessage(namespace, message) {
8988
- __privateGet(this, _socketIoServerHelperOptions).logger.debug(`${namespace.namespace}: ${message}`);
8989
- }
8990
- SetupEvent(event, eventCb) {
8991
- return this;
8992
- }
8993
- }
8994
- _socketIoServerHelperOptions = new WeakMap();
8995
- _namespace = new WeakMap();
8996
- _SetupStandardEvents = new WeakMap();
8997
- _SetupConnectionMiddleware = new WeakMap();
8998
- _SetupMessageMiddleware = new WeakMap();
8999
8737
  exports2.CompareSTSInstrumentControllerPluginKey = CompareSTSInstrumentControllerPluginKey;
9000
8738
  exports2.CreateInstrument = CreateInstrument;
9001
8739
  exports2.Gauge = Gauge;
@@ -9039,14 +8777,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
9039
8777
  exports2.PublishTransportRESTServer = PublishTransportRESTServer;
9040
8778
  exports2.RequestLoggerMiddleware = RequestLoggerMiddleware;
9041
8779
  exports2.RequestLoggerMiddlewareEventName = RequestLoggerMiddlewareEventName;
9042
- exports2.STSEvent = STSEvent;
9043
8780
  exports2.STSInstrumentControllerPlugin = STSInstrumentControllerPlugin;
9044
8781
  exports2.STSInstrumentControllerPluginKey = STSInstrumentControllerPluginKey;
9045
- exports2.STSNamespace = STSNamespace;
9046
- exports2.STSRoom = STSRoom;
9047
- exports2.SocketIoClientHelper = SocketIoClientHelper;
9048
8782
  exports2.SocketIoMessageSender = SocketIoMessageSender;
9049
- exports2.SocketIoServerHelper = SocketIoServerHelper;
9050
8783
  exports2.StopInstruments = StopInstruments;
9051
8784
  exports2.SubscriptionTopic = SubscriptionTopic;
9052
8785
  exports2.TransportType = TransportType;