@nsshunt/stsutils 1.16.84 → 1.16.86

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.
@@ -12,7 +12,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
12
12
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
13
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
14
14
 
15
- var _options, _id, _options2, _inflightMessages, _messageHeader, _SendMessage, _ProcessMessage, _ipcMessageManager, _options3, _events, _clients, _pingTimeout, _messagePort, _messageSender, _ProcessResponseMessage, _processPayload;
15
+ var _options;
16
16
  function getDefaultExportFromCjs(x) {
17
17
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
18
18
  }
@@ -379,8 +379,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
379
379
  }
380
380
  const t1 = 2 * l - t2;
381
381
  const rgb = [0, 0, 0];
382
- for (let i2 = 0; i2 < 3; i2++) {
383
- t3 = h + 1 / 3 * -(i2 - 1);
382
+ for (let i = 0; i < 3; i++) {
383
+ t3 = h + 1 / 3 * -(i - 1);
384
384
  if (t3 < 0) {
385
385
  t3++;
386
386
  }
@@ -396,7 +396,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
396
396
  } else {
397
397
  val = t1;
398
398
  }
399
- rgb[i2] = val * 255;
399
+ rgb[i] = val * 255;
400
400
  }
401
401
  return rgb;
402
402
  };
@@ -463,17 +463,17 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
463
463
  wh /= ratio;
464
464
  bl /= ratio;
465
465
  }
466
- const i2 = Math.floor(6 * h);
466
+ const i = Math.floor(6 * h);
467
467
  const v = 1 - bl;
468
- f = 6 * h - i2;
469
- if ((i2 & 1) !== 0) {
468
+ f = 6 * h - i;
469
+ if ((i & 1) !== 0) {
470
470
  f = 1 - f;
471
471
  }
472
472
  const n = wh + f * (v - wh);
473
473
  let r;
474
474
  let g;
475
475
  let b;
476
- switch (i2) {
476
+ switch (i) {
477
477
  default:
478
478
  case 6:
479
479
  case 0:
@@ -855,8 +855,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
855
855
  function buildGraph() {
856
856
  const graph = {};
857
857
  const models = Object.keys(conversions2);
858
- for (let len = models.length, i2 = 0; i2 < len; i2++) {
859
- graph[models[i2]] = {
858
+ for (let len = models.length, i = 0; i < len; i++) {
859
+ graph[models[i]] = {
860
860
  // http://jsperf.com/1-vs-infinity
861
861
  // micro-opt, but this is simple.
862
862
  distance: -1,
@@ -872,8 +872,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
872
872
  while (queue.length) {
873
873
  const current = queue.pop();
874
874
  const adjacents = Object.keys(conversions2[current]);
875
- for (let len = adjacents.length, i2 = 0; i2 < len; i2++) {
876
- const adjacent = adjacents[i2];
875
+ for (let len = adjacents.length, i = 0; i < len; i++) {
876
+ const adjacent = adjacents[i];
877
877
  const node = graph[adjacent];
878
878
  if (node.distance === -1) {
879
879
  node.distance = graph[current].distance + 1;
@@ -905,8 +905,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
905
905
  const graph = deriveBFS(fromModel);
906
906
  const conversion = {};
907
907
  const models = Object.keys(graph);
908
- for (let len = models.length, i2 = 0; i2 < len; i2++) {
909
- const toModel = models[i2];
908
+ for (let len = models.length, i = 0; i < len; i++) {
909
+ const toModel = models[i];
910
910
  const node = graph[toModel];
911
911
  if (node.parent === null) {
912
912
  continue;
@@ -953,8 +953,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
953
953
  }
954
954
  const result = fn(args);
955
955
  if (typeof result === "object") {
956
- for (let len = result.length, i2 = 0; i2 < len; i2++) {
957
- result[i2] = Math.round(result[i2]);
956
+ for (let len = result.length, i = 0; i < len; i++) {
957
+ result[i] = Math.round(result[i]);
958
958
  }
959
959
  }
960
960
  return result;
@@ -1422,10 +1422,10 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
1422
1422
  }
1423
1423
  const arguments_ = strings.slice(1);
1424
1424
  const parts = [firstString.raw[0]];
1425
- for (let i2 = 1; i2 < firstString.length; i2++) {
1425
+ for (let i = 1; i < firstString.length; i++) {
1426
1426
  parts.push(
1427
- String(arguments_[i2 - 1]).replace(/[{}\\]/g, "\\$&"),
1428
- String(firstString.raw[i2])
1427
+ String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
1428
+ String(firstString.raw[i])
1429
1429
  );
1430
1430
  }
1431
1431
  if (template === void 0) {
@@ -1614,9 +1614,9 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
1614
1614
  });
1615
1615
  function compareParameterTypes(source1, source2, authParameterTypes) {
1616
1616
  const errors = [];
1617
- for (let i2 = 0; i2 < authParameterTypes.length; i2++) {
1618
- const authParameterType = authParameterTypes[i2];
1619
- if (source1[i2].localeCompare(source2[i2]) !== 0) {
1617
+ for (let i = 0; i < authParameterTypes.length; i++) {
1618
+ const authParameterType = authParameterTypes[i];
1619
+ if (source1[i].localeCompare(source2[i]) !== 0) {
1620
1620
  const error = {
1621
1621
  error: OAuth2ParameterErrorType.NOT_EQUAL.code,
1622
1622
  error_description: OAuth2ParameterErrorType.NOT_EQUAL.description,
@@ -1628,492 +1628,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
1628
1628
  }
1629
1629
  return errors;
1630
1630
  }
1631
- var byteToHex = [];
1632
- for (var i = 0; i < 256; ++i) {
1633
- byteToHex.push((i + 256).toString(16).slice(1));
1634
- }
1635
- function unsafeStringify(arr, offset = 0) {
1636
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
1637
- }
1638
- var getRandomValues;
1639
- var rnds8 = new Uint8Array(16);
1640
- function rng() {
1641
- if (!getRandomValues) {
1642
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
1643
- if (!getRandomValues) {
1644
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1645
- }
1646
- }
1647
- return getRandomValues(rnds8);
1648
- }
1649
- var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1650
- const native = {
1651
- randomUUID
1652
- };
1653
- function v4(options, buf, offset) {
1654
- if (native.randomUUID && !buf && !options) {
1655
- return native.randomUUID();
1656
- }
1657
- options = options || {};
1658
- var rnds = options.random || (options.rng || rng)();
1659
- rnds[6] = rnds[6] & 15 | 64;
1660
- rnds[8] = rnds[8] & 63 | 128;
1661
- return unsafeStringify(rnds);
1662
- }
1663
- class GenericMessageManager {
1664
- constructor(options) {
1665
- __privateAdd(this, _id);
1666
- __privateAdd(this, _options2);
1667
- __privateAdd(this, _inflightMessages, {});
1668
- __privateAdd(this, _messageHeader);
1669
- __publicField(this, "SendMessage", (payload, options) => {
1670
- return new Promise((resolve, reject) => {
1671
- __privateGet(this, _SendMessage).call(this, payload, options, (payload2) => {
1672
- resolve(payload2.responsePayload);
1673
- }, (payload2) => {
1674
- reject(payload2.requestPayload);
1675
- });
1676
- });
1677
- });
1678
- __privateAdd(this, _SendMessage, (payload, options, callBack, errorCallBack) => {
1679
- const messageId = v4();
1680
- const requestPayload = {
1681
- header: __privateGet(this, _messageHeader),
1682
- messageId,
1683
- senderId: __privateGet(this, _id),
1684
- senderRole: __privateGet(this, _options2).role,
1685
- requestPayload: payload,
1686
- responsePayload: {},
1687
- pid: process.pid.toString(),
1688
- messageType: "REQUEST"
1689
- };
1690
- const messageRecord = {
1691
- messageId,
1692
- senderId: __privateGet(this, _id),
1693
- senderRole: __privateGet(this, _options2).role,
1694
- requestPayload,
1695
- responses: {},
1696
- // record
1697
- startTime: performance.now(),
1698
- endTime: 0,
1699
- timeout: setTimeout(() => {
1700
- setTimeout(() => {
1701
- delete __privateGet(this, _inflightMessages)[messageRecord.messageId];
1702
- }, 0).unref();
1703
- errorCallBack(requestPayload);
1704
- }, __privateGet(this, _options2).requestResponseMessageTimeout).unref(),
1705
- // max message timeout allowed
1706
- callBack,
1707
- errorCallBack
1708
- };
1709
- __privateGet(this, _inflightMessages)[messageRecord.messageId] = messageRecord;
1710
- __privateGet(this, _options2).messageSender(requestPayload, options);
1711
- });
1712
- __privateAdd(this, _ProcessMessage, async (msg, options) => {
1713
- if (msg.header && msg.header.localeCompare(__privateGet(this, _messageHeader)) === 0) {
1714
- const message = msg;
1715
- if (__privateGet(this, _inflightMessages)[message.messageId]) {
1716
- const inFlightMessageRecord = __privateGet(this, _inflightMessages)[message.messageId];
1717
- inFlightMessageRecord.responses[message.senderId] = { ...message };
1718
- let completed = true;
1719
- if (__privateGet(this, _options2).ProcessResponseMessage) {
1720
- completed = await __privateGet(this, _options2).ProcessResponseMessage(inFlightMessageRecord.responses, options);
1721
- if (completed) {
1722
- inFlightMessageRecord.endTime = performance.now();
1723
- clearTimeout(inFlightMessageRecord.timeout);
1724
- inFlightMessageRecord.callBack({
1725
- responsePayload: Object.values(inFlightMessageRecord.responses).map((r) => r.responsePayload)
1726
- }, options);
1727
- delete __privateGet(this, _inflightMessages)[message.messageId];
1728
- }
1729
- } else if (completed) {
1730
- inFlightMessageRecord.endTime = performance.now();
1731
- clearTimeout(inFlightMessageRecord.timeout);
1732
- inFlightMessageRecord.callBack(message, options);
1733
- delete __privateGet(this, _inflightMessages)[message.messageId];
1734
- } else ;
1735
- }
1736
- }
1737
- });
1738
- __publicField(this, "Start", (options) => {
1739
- __privateSet(this, _messageHeader, `__STS__${__privateGet(this, _options2).namespace}__${v4()}`);
1740
- __privateGet(this, _options2).messageReceiverStart(options);
1741
- });
1742
- __publicField(this, "Stop", (options) => {
1743
- __privateGet(this, _options2).messageReceiverStop(options);
1744
- for (const [, iPCMessageProcessorWorkerRecord] of Object.entries(__privateGet(this, _inflightMessages))) {
1745
- if (iPCMessageProcessorWorkerRecord.timeout) {
1746
- clearTimeout(iPCMessageProcessorWorkerRecord.timeout);
1747
- }
1748
- }
1749
- __privateSet(this, _inflightMessages, {});
1750
- });
1751
- // Process a message recieved from a worker
1752
- __publicField(this, "ProcessMessage", async (msg, options) => {
1753
- if (msg.header) {
1754
- const checkName = `__STS__${__privateGet(this, _options2).namespace}__`;
1755
- if (msg.header.includes(checkName)) {
1756
- const message = msg;
1757
- if (msg.messageType.localeCompare("REQUEST") === 0) {
1758
- let processMessage = true;
1759
- if (message.requestPayload.args && message.requestPayload.args.length > 0 && message.requestPayload.args[0].group) {
1760
- const group = message.requestPayload.args[0].group;
1761
- processMessage = __privateGet(this, _options2).groups.indexOf(group) === -1 ? false : true;
1762
- }
1763
- if (processMessage) {
1764
- message.responsePayload = await __privateGet(this, _options2).ProcessRequestMessage(message, options);
1765
- message.senderId = __privateGet(this, _id);
1766
- message.messageType = "RESPONSE";
1767
- __privateGet(this, _options2).messageSender(message, options);
1768
- }
1769
- } else {
1770
- __privateGet(this, _ProcessMessage).call(this, msg, options);
1771
- }
1772
- }
1773
- }
1774
- });
1775
- __privateSet(this, _id, v4());
1776
- __privateSet(this, _options2, options);
1777
- __privateSet(this, _messageHeader, `__STS__${__privateGet(this, _options2).namespace}__${v4()}`);
1778
- }
1779
- get id() {
1780
- return __privateGet(this, _id);
1781
- }
1782
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1783
- ReceivedMessageFromMaster(msg) {
1784
- }
1785
- }
1786
- _id = new WeakMap();
1787
- _options2 = new WeakMap();
1788
- _inflightMessages = new WeakMap();
1789
- _messageHeader = new WeakMap();
1790
- _SendMessage = new WeakMap();
1791
- _ProcessMessage = new WeakMap();
1792
- var tinyEmitter = { exports: {} };
1793
- function E() {
1794
- }
1795
- E.prototype = {
1796
- on: function(name, callback, ctx) {
1797
- var e = this.e || (this.e = {});
1798
- (e[name] || (e[name] = [])).push({
1799
- fn: callback,
1800
- ctx
1801
- });
1802
- return this;
1803
- },
1804
- once: function(name, callback, ctx) {
1805
- var self2 = this;
1806
- function listener() {
1807
- self2.off(name, listener);
1808
- callback.apply(ctx, arguments);
1809
- }
1810
- listener._ = callback;
1811
- return this.on(name, listener, ctx);
1812
- },
1813
- emit: function(name) {
1814
- var data = [].slice.call(arguments, 1);
1815
- var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
1816
- var i2 = 0;
1817
- var len = evtArr.length;
1818
- for (i2; i2 < len; i2++) {
1819
- evtArr[i2].fn.apply(evtArr[i2].ctx, data);
1820
- }
1821
- return this;
1822
- },
1823
- off: function(name, callback) {
1824
- var e = this.e || (this.e = {});
1825
- var evts = e[name];
1826
- var liveEvents = [];
1827
- if (evts && callback) {
1828
- for (var i2 = 0, len = evts.length; i2 < len; i2++) {
1829
- if (evts[i2].fn !== callback && evts[i2].fn._ !== callback)
1830
- liveEvents.push(evts[i2]);
1831
- }
1832
- }
1833
- liveEvents.length ? e[name] = liveEvents : delete e[name];
1834
- return this;
1835
- }
1836
- };
1837
- tinyEmitter.exports = E;
1838
- var TinyEmitter = tinyEmitter.exports.TinyEmitter = E;
1839
- const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
1840
- class WebWorkerMessageHandler extends TinyEmitter {
1841
- // MessagePort;
1842
- constructor(options) {
1843
- super();
1844
- __privateAdd(this, _ipcMessageManager, null);
1845
- __privateAdd(this, _options3);
1846
- __privateAdd(this, _events, {});
1847
- __privateAdd(this, _clients, {});
1848
- __privateAdd(this, _pingTimeout, null);
1849
- __privateAdd(this, _messagePort);
1850
- __publicField(this, "ProcessRawMessage", (rawmessage) => {
1851
- var _a;
1852
- const message = JSON.parse(rawmessage);
1853
- (_a = __privateGet(this, _ipcMessageManager)) == null ? void 0 : _a.ProcessMessage(message, {});
1854
- });
1855
- __publicField(this, "AddGroup", (group) => {
1856
- const index = __privateGet(this, _options3).groups.indexOf(group);
1857
- if (index === -1) {
1858
- __privateGet(this, _options3).groups.push(group);
1859
- }
1860
- });
1861
- __publicField(this, "RemoveGroup", (group) => {
1862
- const removeIndex = __privateGet(this, _options3).groups.indexOf(group);
1863
- if (removeIndex !== -1) {
1864
- __privateGet(this, _options3).groups.splice(removeIndex, 1);
1865
- }
1866
- });
1867
- __publicField(this, "SetupPrimary", () => {
1868
- const ipcMessageManagerOptions = {
1869
- logger: __privateGet(this, _options3).logger,
1870
- requestResponseMessageTimeout: 5e3,
1871
- namespace: __privateGet(this, _options3).namespace,
1872
- role: __privateGet(this, _options3).role,
1873
- messageSender: __privateGet(this, _messageSender),
1874
- groups: __privateGet(this, _options3).groups,
1875
- // This method is used to calculate if all responses have been received from multiple clients (broadcast)
1876
- // returns true/false.
1877
- ProcessResponseMessage: __privateGet(this, _ProcessResponseMessage),
1878
- // This gets called when an event is received from a message receiver (when ProcessMessage is invoked from the receiver event handler)
1879
- ProcessRequestMessage: __privateGet(this, _processPayload),
1880
- messageReceiverStart: (options) => {
1881
- if (isNode) {
1882
- __privateGet(this, _messagePort).on("message", this.ProcessRawMessage);
1883
- } else {
1884
- const xxx = this;
1885
- __privateGet(this, _messagePort).onmessage = async function(data) {
1886
- const message = data.data;
1887
- xxx.ProcessRawMessage(message);
1888
- };
1889
- }
1890
- },
1891
- messageReceiverStop: (options) => {
1892
- if (isNode) {
1893
- __privateGet(this, _messagePort).off("message", this.ProcessRawMessage);
1894
- }
1895
- }
1896
- };
1897
- __privateSet(this, _ipcMessageManager, new GenericMessageManager(ipcMessageManagerOptions));
1898
- });
1899
- __privateAdd(this, _messageSender, (payload, options) => {
1900
- if (payload.messageType.localeCompare("REQUEST") === 0) {
1901
- if (isNode) {
1902
- __privateGet(this, _messagePort).postMessage(JSON.stringify(payload));
1903
- } else {
1904
- __privateGet(this, _messagePort).postMessage(JSON.stringify(payload));
1905
- }
1906
- } else if (payload.messageType.localeCompare("RESPONSE") === 0) {
1907
- if (isNode) {
1908
- __privateGet(this, _messagePort).postMessage(JSON.stringify(payload));
1909
- } else {
1910
- __privateGet(this, _messagePort).postMessage(JSON.stringify(payload));
1911
- }
1912
- }
1913
- });
1914
- __privateAdd(this, _ProcessResponseMessage, async (responses, options) => {
1915
- let allFound = false;
1916
- for (const [responseId, response] of Object.entries(responses)) {
1917
- if (response.senderRole.localeCompare("CLIENT") === 0) {
1918
- allFound = true;
1919
- break;
1920
- }
1921
- }
1922
- if (allFound) {
1923
- return allFound;
1924
- }
1925
- let found = true;
1926
- let requestGroup = null;
1927
- for (const [responseId, response] of Object.entries(responses)) {
1928
- if (response.requestPayload.args.length > 0 && response.requestPayload.args[0].group) {
1929
- requestGroup = response.requestPayload.args[0].group;
1930
- break;
1931
- }
1932
- }
1933
- if (requestGroup) {
1934
- const clientsInGroup = Object.values(__privateGet(this, _clients)).filter((c) => {
1935
- if (c.groups.indexOf(requestGroup) === -1) {
1936
- return false;
1937
- }
1938
- return true;
1939
- });
1940
- found = true;
1941
- clientsInGroup.forEach((c) => {
1942
- if (!responses[c.id]) {
1943
- found = false;
1944
- }
1945
- });
1946
- } else {
1947
- const clientsInGroup = Object.values(__privateGet(this, _clients));
1948
- found = true;
1949
- clientsInGroup.forEach((c) => {
1950
- if (!responses[c.id]) {
1951
- found = false;
1952
- }
1953
- });
1954
- }
1955
- return found;
1956
- });
1957
- __privateAdd(this, _processPayload, (payload, options) => {
1958
- return new Promise((resolve, reject) => {
1959
- if (payload.messageType.localeCompare("REQUEST") === 0) {
1960
- if (payload.requestPayload["__eventName"]) {
1961
- const eventName = payload.requestPayload["__eventName"];
1962
- if (__privateGet(this, _events)[eventName]) {
1963
- try {
1964
- __privateGet(this, _events)[eventName].callback(...payload.requestPayload.args, (responseMessage) => {
1965
- resolve(responseMessage);
1966
- });
1967
- } catch (error) {
1968
- reject(error);
1969
- }
1970
- }
1971
- }
1972
- }
1973
- });
1974
- });
1975
- __publicField(this, "Start", () => {
1976
- var _a;
1977
- (_a = __privateGet(this, _ipcMessageManager)) == null ? void 0 : _a.Start();
1978
- });
1979
- __publicField(this, "Stop", () => {
1980
- var _a;
1981
- if (__privateGet(this, _pingTimeout)) {
1982
- clearTimeout(__privateGet(this, _pingTimeout));
1983
- __privateSet(this, _pingTimeout, null);
1984
- }
1985
- (_a = __privateGet(this, _ipcMessageManager)) == null ? void 0 : _a.Stop();
1986
- });
1987
- __publicField(this, "emitex", async (event, ...args) => {
1988
- return __privateGet(this, _ipcMessageManager).SendMessage({
1989
- __eventName: event,
1990
- args
1991
- });
1992
- });
1993
- __privateSet(this, _options3, options);
1994
- __privateSet(this, _messagePort, options.messagePort);
1995
- this.SetupPrimary();
1996
- if (__privateGet(this, _options3).role.localeCompare("CLIENT") === 0) {
1997
- const ping = () => {
1998
- __privateSet(this, _pingTimeout, setTimeout(() => {
1999
- const pingData = {
2000
- id: __privateGet(this, _ipcMessageManager).id,
2001
- groups: __privateGet(this, _options3).groups
2002
- };
2003
- if (__privateGet(this, _options3).context) {
2004
- pingData.context = __privateGet(this, _options3).context;
2005
- }
2006
- this.emit("ping", pingData, (response) => {
2007
- });
2008
- ping();
2009
- }, 1e3).unref());
2010
- };
2011
- ping();
2012
- } else {
2013
- this.on("ping", (pingData, callback) => {
2014
- const { id, groups, context } = pingData;
2015
- if (__privateGet(this, _clients)[id]) {
2016
- clearTimeout(__privateGet(this, _clients)[id].timeout);
2017
- __privateGet(this, _clients)[id].pingCount++;
2018
- __privateGet(this, _clients)[id].timeout = setTimeout(() => {
2019
- delete __privateGet(this, _clients)[id];
2020
- }, 2e3);
2021
- __privateGet(this, _clients)[id].groups = groups;
2022
- __privateGet(this, _clients)[id].context = context;
2023
- } else {
2024
- __privateGet(this, _clients)[id] = {
2025
- id,
2026
- clientConnected: /* @__PURE__ */ new Date(),
2027
- pingCount: 0,
2028
- timeout: setTimeout(() => {
2029
- delete __privateGet(this, _clients)[id];
2030
- }, 2e3),
2031
- groups,
2032
- context
2033
- };
2034
- }
2035
- callback("ok");
2036
- });
2037
- }
2038
- }
2039
- get clients() {
2040
- return __privateGet(this, _clients);
2041
- }
2042
- get groups() {
2043
- return __privateGet(this, _options3).groups;
2044
- }
2045
- // p.on('fromworker', (arg1: number, arg2: string, callback: any) => {
2046
- on(event, callback, ctx) {
2047
- if (__privateGet(this, _events)[event]) {
2048
- delete __privateGet(this, _events)[event];
2049
- }
2050
- const eventObject = {
2051
- event,
2052
- callback,
2053
- ctx
2054
- };
2055
- __privateGet(this, _events)[eventObject.event] = eventObject;
2056
- return this;
2057
- }
2058
- off(event, callback) {
2059
- if (__privateGet(this, _events)[event]) {
2060
- delete __privateGet(this, _events)[event];
2061
- }
2062
- return this;
2063
- }
2064
- emit(event, ...args) {
2065
- (async () => {
2066
- var _a;
2067
- try {
2068
- const retVal = await ((_a = __privateGet(this, _ipcMessageManager)) == null ? void 0 : _a.SendMessage({
2069
- __eventName: event,
2070
- args: args.slice(0, args.length - 1)
2071
- }));
2072
- args[args.length - 1](retVal);
2073
- } catch (error) {
2074
- if (__privateGet(this, _options3).ignoreEvents) {
2075
- if (__privateGet(this, _options3).ignoreEvents.indexOf(error.__eventName) !== -1) {
2076
- return;
2077
- }
2078
- }
2079
- __privateGet(this, _options3).logger.error(chalk$1.red(`RedisMessageHandler:emit(): Error: [${JSON.stringify(error)}]`));
2080
- }
2081
- })();
2082
- return this;
2083
- }
2084
- emitWithError(event, args, responseCb, errorCb) {
2085
- (async () => {
2086
- var _a;
2087
- try {
2088
- const retVal = await ((_a = __privateGet(this, _ipcMessageManager)) == null ? void 0 : _a.SendMessage({
2089
- __eventName: event,
2090
- args: [args]
2091
- }));
2092
- responseCb(retVal);
2093
- } catch (error) {
2094
- if (__privateGet(this, _options3).ignoreEvents) {
2095
- if (__privateGet(this, _options3).ignoreEvents.indexOf(error.__eventName) !== -1) {
2096
- return;
2097
- }
2098
- }
2099
- errorCb(error);
2100
- }
2101
- })();
2102
- return this;
2103
- }
2104
- }
2105
- _ipcMessageManager = new WeakMap();
2106
- _options3 = new WeakMap();
2107
- _events = new WeakMap();
2108
- _clients = new WeakMap();
2109
- _pingTimeout = new WeakMap();
2110
- _messagePort = new WeakMap();
2111
- _messageSender = new WeakMap();
2112
- _ProcessResponseMessage = new WeakMap();
2113
- _processPayload = new WeakMap();
2114
1631
  exports2.AddSchema = AddSchema;
2115
1632
  exports2.CheckValidChar = CheckValidChar;
2116
- exports2.GenericMessageManager = GenericMessageManager;
2117
1633
  exports2.GetErrorPayload = GetErrorPayload;
2118
1634
  exports2.JestSleep = JestSleep;
2119
1635
  exports2.ModelDelimeter = ModelDelimeter;
@@ -2124,7 +1640,6 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
2124
1640
  exports2.STSOptionsBase = STSOptionsBase;
2125
1641
  exports2.Sleep = Sleep;
2126
1642
  exports2.Validate = Validate;
2127
- exports2.WebWorkerMessageHandler = WebWorkerMessageHandler;
2128
1643
  exports2.compareParameterTypes = compareParameterTypes;
2129
1644
  exports2.defaultLogger = defaultLogger;
2130
1645
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });