@nsshunt/stsuxvue 1.0.57 → 1.0.58
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.mjs +22 -899
- package/dist/stsuxvue.mjs.map +1 -1
- package/dist/stsuxvue.umd.js +23 -895
- package/dist/stsuxvue.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/stsuxvue.mjs
CHANGED
|
@@ -2,13 +2,8 @@ import { defineStore } from "pinia";
|
|
|
2
2
|
import _cloneDeep from "lodash.clonedeep";
|
|
3
3
|
import { defineComponent, defineAsyncComponent, ref, createElementBlock, openBlock, createVNode, unref, reactive, computed, watch, resolveComponent, createBlock, withCtx, createTextVNode, toDisplayString, createElementVNode, createCommentVNode, Fragment, renderList, onMounted, onBeforeUnmount, resolveDynamicComponent, isRef } from "vue";
|
|
4
4
|
import { Gauge, ObservabilitySocketIOSubscriber, ObservabilityRESTAPISubscriber, ObservabilitySubscriptionManager, SubscriptionTopic } from "@nsshunt/stsobservability";
|
|
5
|
-
import {
|
|
5
|
+
import { defaultLogger } from "@nsshunt/stsutils";
|
|
6
6
|
import { io } from "socket.io-client";
|
|
7
|
-
import { Server } from "socket.io";
|
|
8
|
-
import { Redis } from "ioredis";
|
|
9
|
-
import require$$0$2 from "node:cluster";
|
|
10
|
-
import require$$1$2 from "socket.io-adapter";
|
|
11
|
-
import { createAdapter } from "@socket.io/redis-streams-adapter";
|
|
12
7
|
var _estate = /* @__PURE__ */ ((_estate2) => {
|
|
13
8
|
_estate2["IDLE"] = "idle";
|
|
14
9
|
_estate2["STARTING"] = "starting";
|
|
@@ -6013,9 +6008,9 @@ function createDOMPurify() {
|
|
|
6013
6008
|
return DOMPurify;
|
|
6014
6009
|
}
|
|
6015
6010
|
let {
|
|
6016
|
-
document
|
|
6011
|
+
document
|
|
6017
6012
|
} = window2;
|
|
6018
|
-
const originalDocument =
|
|
6013
|
+
const originalDocument = document;
|
|
6019
6014
|
const currentScript = originalDocument.currentScript;
|
|
6020
6015
|
const {
|
|
6021
6016
|
DocumentFragment,
|
|
@@ -6035,9 +6030,9 @@ function createDOMPurify() {
|
|
|
6035
6030
|
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
6036
6031
|
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
6037
6032
|
if (typeof HTMLTemplateElement === "function") {
|
|
6038
|
-
const template =
|
|
6033
|
+
const template = document.createElement("template");
|
|
6039
6034
|
if (template.content && template.content.ownerDocument) {
|
|
6040
|
-
|
|
6035
|
+
document = template.content.ownerDocument;
|
|
6041
6036
|
}
|
|
6042
6037
|
}
|
|
6043
6038
|
let trustedTypesPolicy;
|
|
@@ -6047,7 +6042,7 @@ function createDOMPurify() {
|
|
|
6047
6042
|
createNodeIterator,
|
|
6048
6043
|
createDocumentFragment,
|
|
6049
6044
|
getElementsByTagName
|
|
6050
|
-
} =
|
|
6045
|
+
} = document;
|
|
6051
6046
|
const {
|
|
6052
6047
|
importNode
|
|
6053
6048
|
} = originalDocument;
|
|
@@ -6145,7 +6140,7 @@ function createDOMPurify() {
|
|
|
6145
6140
|
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
6146
6141
|
let transformCaseFunc = null;
|
|
6147
6142
|
let CONFIG = null;
|
|
6148
|
-
const formElement =
|
|
6143
|
+
const formElement = document.createElement("form");
|
|
6149
6144
|
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
|
6150
6145
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
6151
6146
|
};
|
|
@@ -6407,7 +6402,7 @@ function createDOMPurify() {
|
|
|
6407
6402
|
}
|
|
6408
6403
|
const body = doc.body || doc.documentElement;
|
|
6409
6404
|
if (dirty && leadingWhitespace) {
|
|
6410
|
-
body.insertBefore(
|
|
6405
|
+
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
6411
6406
|
}
|
|
6412
6407
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
6413
6408
|
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
@@ -6506,7 +6501,7 @@ function createDOMPurify() {
|
|
|
6506
6501
|
return false;
|
|
6507
6502
|
};
|
|
6508
6503
|
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
|
6509
|
-
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in
|
|
6504
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
|
|
6510
6505
|
return false;
|
|
6511
6506
|
}
|
|
6512
6507
|
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
|
|
@@ -6895,8 +6890,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
6895
6890
|
return retVal;
|
|
6896
6891
|
}, "") + "]";
|
|
6897
6892
|
};
|
|
6898
|
-
const convertMS = function(
|
|
6899
|
-
let s = Math.floor(
|
|
6893
|
+
const convertMS = function(ms) {
|
|
6894
|
+
let s = Math.floor(ms / 1e3);
|
|
6900
6895
|
let m = Math.floor(s / 60);
|
|
6901
6896
|
s = s % 60;
|
|
6902
6897
|
let h = Math.floor(m / 60);
|
|
@@ -8342,16 +8337,16 @@ function requireAnsiStyles() {
|
|
|
8342
8337
|
})(ansiStyles);
|
|
8343
8338
|
return ansiStyles.exports;
|
|
8344
8339
|
}
|
|
8345
|
-
var browser
|
|
8346
|
-
var hasRequiredBrowser
|
|
8347
|
-
function requireBrowser
|
|
8348
|
-
if (hasRequiredBrowser
|
|
8349
|
-
hasRequiredBrowser
|
|
8350
|
-
browser
|
|
8340
|
+
var browser;
|
|
8341
|
+
var hasRequiredBrowser;
|
|
8342
|
+
function requireBrowser() {
|
|
8343
|
+
if (hasRequiredBrowser) return browser;
|
|
8344
|
+
hasRequiredBrowser = 1;
|
|
8345
|
+
browser = {
|
|
8351
8346
|
stdout: false,
|
|
8352
8347
|
stderr: false
|
|
8353
8348
|
};
|
|
8354
|
-
return browser
|
|
8349
|
+
return browser;
|
|
8355
8350
|
}
|
|
8356
8351
|
var util;
|
|
8357
8352
|
var hasRequiredUtil;
|
|
@@ -8512,7 +8507,7 @@ function requireSource() {
|
|
|
8512
8507
|
if (hasRequiredSource) return source;
|
|
8513
8508
|
hasRequiredSource = 1;
|
|
8514
8509
|
const ansiStyles2 = requireAnsiStyles();
|
|
8515
|
-
const { stdout: stdoutColor, stderr: stderrColor } = requireBrowser
|
|
8510
|
+
const { stdout: stdoutColor, stderr: stderrColor } = requireBrowser();
|
|
8516
8511
|
const {
|
|
8517
8512
|
stringReplaceAll,
|
|
8518
8513
|
stringEncaseCRLFWithFirstIndex
|
|
@@ -8823,8 +8818,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8823
8818
|
return "";
|
|
8824
8819
|
}
|
|
8825
8820
|
};
|
|
8826
|
-
const convertMS = function(
|
|
8827
|
-
let s = Math.floor(
|
|
8821
|
+
const convertMS = function(ms) {
|
|
8822
|
+
let s = Math.floor(ms / 1e3);
|
|
8828
8823
|
let m = Math.floor(s / 60);
|
|
8829
8824
|
s = s % 60;
|
|
8830
8825
|
let h = Math.floor(m / 60);
|
|
@@ -9995,7 +9990,6 @@ function v4(options, buf, offset) {
|
|
|
9995
9990
|
}
|
|
9996
9991
|
return _v4(options);
|
|
9997
9992
|
}
|
|
9998
|
-
const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
|
9999
9993
|
var tinyEmitter$1 = { exports: {} };
|
|
10000
9994
|
var hasRequiredTinyEmitter$1;
|
|
10001
9995
|
function requireTinyEmitter$1() {
|
|
@@ -10050,6 +10044,7 @@ function requireTinyEmitter$1() {
|
|
|
10050
10044
|
return tinyEmitter$1.exports;
|
|
10051
10045
|
}
|
|
10052
10046
|
var tinyEmitterExports$1 = requireTinyEmitter$1();
|
|
10047
|
+
const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
|
10053
10048
|
class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
10054
10049
|
#agentManager;
|
|
10055
10050
|
#logger;
|
|
@@ -10247,878 +10242,6 @@ class SocketIoClient extends tinyEmitterExports$1.TinyEmitter {
|
|
|
10247
10242
|
});
|
|
10248
10243
|
}
|
|
10249
10244
|
}
|
|
10250
|
-
var dist = {};
|
|
10251
|
-
var browser = { exports: {} };
|
|
10252
|
-
var ms;
|
|
10253
|
-
var hasRequiredMs;
|
|
10254
|
-
function requireMs() {
|
|
10255
|
-
if (hasRequiredMs) return ms;
|
|
10256
|
-
hasRequiredMs = 1;
|
|
10257
|
-
var s = 1e3;
|
|
10258
|
-
var m = s * 60;
|
|
10259
|
-
var h = m * 60;
|
|
10260
|
-
var d = h * 24;
|
|
10261
|
-
var w = d * 7;
|
|
10262
|
-
var y = d * 365.25;
|
|
10263
|
-
ms = function(val, options) {
|
|
10264
|
-
options = options || {};
|
|
10265
|
-
var type = typeof val;
|
|
10266
|
-
if (type === "string" && val.length > 0) {
|
|
10267
|
-
return parse(val);
|
|
10268
|
-
} else if (type === "number" && isFinite(val)) {
|
|
10269
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
10270
|
-
}
|
|
10271
|
-
throw new Error(
|
|
10272
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
10273
|
-
);
|
|
10274
|
-
};
|
|
10275
|
-
function parse(str) {
|
|
10276
|
-
str = String(str);
|
|
10277
|
-
if (str.length > 100) {
|
|
10278
|
-
return;
|
|
10279
|
-
}
|
|
10280
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
10281
|
-
str
|
|
10282
|
-
);
|
|
10283
|
-
if (!match) {
|
|
10284
|
-
return;
|
|
10285
|
-
}
|
|
10286
|
-
var n = parseFloat(match[1]);
|
|
10287
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
10288
|
-
switch (type) {
|
|
10289
|
-
case "years":
|
|
10290
|
-
case "year":
|
|
10291
|
-
case "yrs":
|
|
10292
|
-
case "yr":
|
|
10293
|
-
case "y":
|
|
10294
|
-
return n * y;
|
|
10295
|
-
case "weeks":
|
|
10296
|
-
case "week":
|
|
10297
|
-
case "w":
|
|
10298
|
-
return n * w;
|
|
10299
|
-
case "days":
|
|
10300
|
-
case "day":
|
|
10301
|
-
case "d":
|
|
10302
|
-
return n * d;
|
|
10303
|
-
case "hours":
|
|
10304
|
-
case "hour":
|
|
10305
|
-
case "hrs":
|
|
10306
|
-
case "hr":
|
|
10307
|
-
case "h":
|
|
10308
|
-
return n * h;
|
|
10309
|
-
case "minutes":
|
|
10310
|
-
case "minute":
|
|
10311
|
-
case "mins":
|
|
10312
|
-
case "min":
|
|
10313
|
-
case "m":
|
|
10314
|
-
return n * m;
|
|
10315
|
-
case "seconds":
|
|
10316
|
-
case "second":
|
|
10317
|
-
case "secs":
|
|
10318
|
-
case "sec":
|
|
10319
|
-
case "s":
|
|
10320
|
-
return n * s;
|
|
10321
|
-
case "milliseconds":
|
|
10322
|
-
case "millisecond":
|
|
10323
|
-
case "msecs":
|
|
10324
|
-
case "msec":
|
|
10325
|
-
case "ms":
|
|
10326
|
-
return n;
|
|
10327
|
-
default:
|
|
10328
|
-
return void 0;
|
|
10329
|
-
}
|
|
10330
|
-
}
|
|
10331
|
-
function fmtShort(ms2) {
|
|
10332
|
-
var msAbs = Math.abs(ms2);
|
|
10333
|
-
if (msAbs >= d) {
|
|
10334
|
-
return Math.round(ms2 / d) + "d";
|
|
10335
|
-
}
|
|
10336
|
-
if (msAbs >= h) {
|
|
10337
|
-
return Math.round(ms2 / h) + "h";
|
|
10338
|
-
}
|
|
10339
|
-
if (msAbs >= m) {
|
|
10340
|
-
return Math.round(ms2 / m) + "m";
|
|
10341
|
-
}
|
|
10342
|
-
if (msAbs >= s) {
|
|
10343
|
-
return Math.round(ms2 / s) + "s";
|
|
10344
|
-
}
|
|
10345
|
-
return ms2 + "ms";
|
|
10346
|
-
}
|
|
10347
|
-
function fmtLong(ms2) {
|
|
10348
|
-
var msAbs = Math.abs(ms2);
|
|
10349
|
-
if (msAbs >= d) {
|
|
10350
|
-
return plural(ms2, msAbs, d, "day");
|
|
10351
|
-
}
|
|
10352
|
-
if (msAbs >= h) {
|
|
10353
|
-
return plural(ms2, msAbs, h, "hour");
|
|
10354
|
-
}
|
|
10355
|
-
if (msAbs >= m) {
|
|
10356
|
-
return plural(ms2, msAbs, m, "minute");
|
|
10357
|
-
}
|
|
10358
|
-
if (msAbs >= s) {
|
|
10359
|
-
return plural(ms2, msAbs, s, "second");
|
|
10360
|
-
}
|
|
10361
|
-
return ms2 + " ms";
|
|
10362
|
-
}
|
|
10363
|
-
function plural(ms2, msAbs, n, name) {
|
|
10364
|
-
var isPlural = msAbs >= n * 1.5;
|
|
10365
|
-
return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : "");
|
|
10366
|
-
}
|
|
10367
|
-
return ms;
|
|
10368
|
-
}
|
|
10369
|
-
var common;
|
|
10370
|
-
var hasRequiredCommon;
|
|
10371
|
-
function requireCommon() {
|
|
10372
|
-
if (hasRequiredCommon) return common;
|
|
10373
|
-
hasRequiredCommon = 1;
|
|
10374
|
-
function setup(env) {
|
|
10375
|
-
createDebug.debug = createDebug;
|
|
10376
|
-
createDebug.default = createDebug;
|
|
10377
|
-
createDebug.coerce = coerce;
|
|
10378
|
-
createDebug.disable = disable;
|
|
10379
|
-
createDebug.enable = enable;
|
|
10380
|
-
createDebug.enabled = enabled;
|
|
10381
|
-
createDebug.humanize = requireMs();
|
|
10382
|
-
createDebug.destroy = destroy;
|
|
10383
|
-
Object.keys(env).forEach((key) => {
|
|
10384
|
-
createDebug[key] = env[key];
|
|
10385
|
-
});
|
|
10386
|
-
createDebug.names = [];
|
|
10387
|
-
createDebug.skips = [];
|
|
10388
|
-
createDebug.formatters = {};
|
|
10389
|
-
function selectColor(namespace) {
|
|
10390
|
-
let hash = 0;
|
|
10391
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
10392
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
10393
|
-
hash |= 0;
|
|
10394
|
-
}
|
|
10395
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
10396
|
-
}
|
|
10397
|
-
createDebug.selectColor = selectColor;
|
|
10398
|
-
function createDebug(namespace) {
|
|
10399
|
-
let prevTime;
|
|
10400
|
-
let enableOverride = null;
|
|
10401
|
-
let namespacesCache;
|
|
10402
|
-
let enabledCache;
|
|
10403
|
-
function debug(...args) {
|
|
10404
|
-
if (!debug.enabled) {
|
|
10405
|
-
return;
|
|
10406
|
-
}
|
|
10407
|
-
const self = debug;
|
|
10408
|
-
const curr = Number(/* @__PURE__ */ new Date());
|
|
10409
|
-
const ms2 = curr - (prevTime || curr);
|
|
10410
|
-
self.diff = ms2;
|
|
10411
|
-
self.prev = prevTime;
|
|
10412
|
-
self.curr = curr;
|
|
10413
|
-
prevTime = curr;
|
|
10414
|
-
args[0] = createDebug.coerce(args[0]);
|
|
10415
|
-
if (typeof args[0] !== "string") {
|
|
10416
|
-
args.unshift("%O");
|
|
10417
|
-
}
|
|
10418
|
-
let index = 0;
|
|
10419
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
10420
|
-
if (match === "%%") {
|
|
10421
|
-
return "%";
|
|
10422
|
-
}
|
|
10423
|
-
index++;
|
|
10424
|
-
const formatter = createDebug.formatters[format];
|
|
10425
|
-
if (typeof formatter === "function") {
|
|
10426
|
-
const val = args[index];
|
|
10427
|
-
match = formatter.call(self, val);
|
|
10428
|
-
args.splice(index, 1);
|
|
10429
|
-
index--;
|
|
10430
|
-
}
|
|
10431
|
-
return match;
|
|
10432
|
-
});
|
|
10433
|
-
createDebug.formatArgs.call(self, args);
|
|
10434
|
-
const logFn = self.log || createDebug.log;
|
|
10435
|
-
logFn.apply(self, args);
|
|
10436
|
-
}
|
|
10437
|
-
debug.namespace = namespace;
|
|
10438
|
-
debug.useColors = createDebug.useColors();
|
|
10439
|
-
debug.color = createDebug.selectColor(namespace);
|
|
10440
|
-
debug.extend = extend;
|
|
10441
|
-
debug.destroy = createDebug.destroy;
|
|
10442
|
-
Object.defineProperty(debug, "enabled", {
|
|
10443
|
-
enumerable: true,
|
|
10444
|
-
configurable: false,
|
|
10445
|
-
get: () => {
|
|
10446
|
-
if (enableOverride !== null) {
|
|
10447
|
-
return enableOverride;
|
|
10448
|
-
}
|
|
10449
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
10450
|
-
namespacesCache = createDebug.namespaces;
|
|
10451
|
-
enabledCache = createDebug.enabled(namespace);
|
|
10452
|
-
}
|
|
10453
|
-
return enabledCache;
|
|
10454
|
-
},
|
|
10455
|
-
set: (v) => {
|
|
10456
|
-
enableOverride = v;
|
|
10457
|
-
}
|
|
10458
|
-
});
|
|
10459
|
-
if (typeof createDebug.init === "function") {
|
|
10460
|
-
createDebug.init(debug);
|
|
10461
|
-
}
|
|
10462
|
-
return debug;
|
|
10463
|
-
}
|
|
10464
|
-
function extend(namespace, delimiter) {
|
|
10465
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
10466
|
-
newDebug.log = this.log;
|
|
10467
|
-
return newDebug;
|
|
10468
|
-
}
|
|
10469
|
-
function enable(namespaces) {
|
|
10470
|
-
createDebug.save(namespaces);
|
|
10471
|
-
createDebug.namespaces = namespaces;
|
|
10472
|
-
createDebug.names = [];
|
|
10473
|
-
createDebug.skips = [];
|
|
10474
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
10475
|
-
for (const ns of split) {
|
|
10476
|
-
if (ns[0] === "-") {
|
|
10477
|
-
createDebug.skips.push(ns.slice(1));
|
|
10478
|
-
} else {
|
|
10479
|
-
createDebug.names.push(ns);
|
|
10480
|
-
}
|
|
10481
|
-
}
|
|
10482
|
-
}
|
|
10483
|
-
function matchesTemplate(search, template) {
|
|
10484
|
-
let searchIndex = 0;
|
|
10485
|
-
let templateIndex = 0;
|
|
10486
|
-
let starIndex = -1;
|
|
10487
|
-
let matchIndex = 0;
|
|
10488
|
-
while (searchIndex < search.length) {
|
|
10489
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
10490
|
-
if (template[templateIndex] === "*") {
|
|
10491
|
-
starIndex = templateIndex;
|
|
10492
|
-
matchIndex = searchIndex;
|
|
10493
|
-
templateIndex++;
|
|
10494
|
-
} else {
|
|
10495
|
-
searchIndex++;
|
|
10496
|
-
templateIndex++;
|
|
10497
|
-
}
|
|
10498
|
-
} else if (starIndex !== -1) {
|
|
10499
|
-
templateIndex = starIndex + 1;
|
|
10500
|
-
matchIndex++;
|
|
10501
|
-
searchIndex = matchIndex;
|
|
10502
|
-
} else {
|
|
10503
|
-
return false;
|
|
10504
|
-
}
|
|
10505
|
-
}
|
|
10506
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
10507
|
-
templateIndex++;
|
|
10508
|
-
}
|
|
10509
|
-
return templateIndex === template.length;
|
|
10510
|
-
}
|
|
10511
|
-
function disable() {
|
|
10512
|
-
const namespaces = [
|
|
10513
|
-
...createDebug.names,
|
|
10514
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
10515
|
-
].join(",");
|
|
10516
|
-
createDebug.enable("");
|
|
10517
|
-
return namespaces;
|
|
10518
|
-
}
|
|
10519
|
-
function enabled(name) {
|
|
10520
|
-
for (const skip of createDebug.skips) {
|
|
10521
|
-
if (matchesTemplate(name, skip)) {
|
|
10522
|
-
return false;
|
|
10523
|
-
}
|
|
10524
|
-
}
|
|
10525
|
-
for (const ns of createDebug.names) {
|
|
10526
|
-
if (matchesTemplate(name, ns)) {
|
|
10527
|
-
return true;
|
|
10528
|
-
}
|
|
10529
|
-
}
|
|
10530
|
-
return false;
|
|
10531
|
-
}
|
|
10532
|
-
function coerce(val) {
|
|
10533
|
-
if (val instanceof Error) {
|
|
10534
|
-
return val.stack || val.message;
|
|
10535
|
-
}
|
|
10536
|
-
return val;
|
|
10537
|
-
}
|
|
10538
|
-
function destroy() {
|
|
10539
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
10540
|
-
}
|
|
10541
|
-
createDebug.enable(createDebug.load());
|
|
10542
|
-
return createDebug;
|
|
10543
|
-
}
|
|
10544
|
-
common = setup;
|
|
10545
|
-
return common;
|
|
10546
|
-
}
|
|
10547
|
-
var hasRequiredBrowser;
|
|
10548
|
-
function requireBrowser() {
|
|
10549
|
-
if (hasRequiredBrowser) return browser.exports;
|
|
10550
|
-
hasRequiredBrowser = 1;
|
|
10551
|
-
(function(module, exports) {
|
|
10552
|
-
exports.formatArgs = formatArgs;
|
|
10553
|
-
exports.save = save;
|
|
10554
|
-
exports.load = load;
|
|
10555
|
-
exports.useColors = useColors;
|
|
10556
|
-
exports.storage = localstorage();
|
|
10557
|
-
exports.destroy = /* @__PURE__ */ (() => {
|
|
10558
|
-
let warned = false;
|
|
10559
|
-
return () => {
|
|
10560
|
-
if (!warned) {
|
|
10561
|
-
warned = true;
|
|
10562
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
10563
|
-
}
|
|
10564
|
-
};
|
|
10565
|
-
})();
|
|
10566
|
-
exports.colors = [
|
|
10567
|
-
"#0000CC",
|
|
10568
|
-
"#0000FF",
|
|
10569
|
-
"#0033CC",
|
|
10570
|
-
"#0033FF",
|
|
10571
|
-
"#0066CC",
|
|
10572
|
-
"#0066FF",
|
|
10573
|
-
"#0099CC",
|
|
10574
|
-
"#0099FF",
|
|
10575
|
-
"#00CC00",
|
|
10576
|
-
"#00CC33",
|
|
10577
|
-
"#00CC66",
|
|
10578
|
-
"#00CC99",
|
|
10579
|
-
"#00CCCC",
|
|
10580
|
-
"#00CCFF",
|
|
10581
|
-
"#3300CC",
|
|
10582
|
-
"#3300FF",
|
|
10583
|
-
"#3333CC",
|
|
10584
|
-
"#3333FF",
|
|
10585
|
-
"#3366CC",
|
|
10586
|
-
"#3366FF",
|
|
10587
|
-
"#3399CC",
|
|
10588
|
-
"#3399FF",
|
|
10589
|
-
"#33CC00",
|
|
10590
|
-
"#33CC33",
|
|
10591
|
-
"#33CC66",
|
|
10592
|
-
"#33CC99",
|
|
10593
|
-
"#33CCCC",
|
|
10594
|
-
"#33CCFF",
|
|
10595
|
-
"#6600CC",
|
|
10596
|
-
"#6600FF",
|
|
10597
|
-
"#6633CC",
|
|
10598
|
-
"#6633FF",
|
|
10599
|
-
"#66CC00",
|
|
10600
|
-
"#66CC33",
|
|
10601
|
-
"#9900CC",
|
|
10602
|
-
"#9900FF",
|
|
10603
|
-
"#9933CC",
|
|
10604
|
-
"#9933FF",
|
|
10605
|
-
"#99CC00",
|
|
10606
|
-
"#99CC33",
|
|
10607
|
-
"#CC0000",
|
|
10608
|
-
"#CC0033",
|
|
10609
|
-
"#CC0066",
|
|
10610
|
-
"#CC0099",
|
|
10611
|
-
"#CC00CC",
|
|
10612
|
-
"#CC00FF",
|
|
10613
|
-
"#CC3300",
|
|
10614
|
-
"#CC3333",
|
|
10615
|
-
"#CC3366",
|
|
10616
|
-
"#CC3399",
|
|
10617
|
-
"#CC33CC",
|
|
10618
|
-
"#CC33FF",
|
|
10619
|
-
"#CC6600",
|
|
10620
|
-
"#CC6633",
|
|
10621
|
-
"#CC9900",
|
|
10622
|
-
"#CC9933",
|
|
10623
|
-
"#CCCC00",
|
|
10624
|
-
"#CCCC33",
|
|
10625
|
-
"#FF0000",
|
|
10626
|
-
"#FF0033",
|
|
10627
|
-
"#FF0066",
|
|
10628
|
-
"#FF0099",
|
|
10629
|
-
"#FF00CC",
|
|
10630
|
-
"#FF00FF",
|
|
10631
|
-
"#FF3300",
|
|
10632
|
-
"#FF3333",
|
|
10633
|
-
"#FF3366",
|
|
10634
|
-
"#FF3399",
|
|
10635
|
-
"#FF33CC",
|
|
10636
|
-
"#FF33FF",
|
|
10637
|
-
"#FF6600",
|
|
10638
|
-
"#FF6633",
|
|
10639
|
-
"#FF9900",
|
|
10640
|
-
"#FF9933",
|
|
10641
|
-
"#FFCC00",
|
|
10642
|
-
"#FFCC33"
|
|
10643
|
-
];
|
|
10644
|
-
function useColors() {
|
|
10645
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
10646
|
-
return true;
|
|
10647
|
-
}
|
|
10648
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
10649
|
-
return false;
|
|
10650
|
-
}
|
|
10651
|
-
let m;
|
|
10652
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
10653
|
-
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
10654
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
10655
|
-
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
10656
|
-
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
10657
|
-
}
|
|
10658
|
-
function formatArgs(args) {
|
|
10659
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
10660
|
-
if (!this.useColors) {
|
|
10661
|
-
return;
|
|
10662
|
-
}
|
|
10663
|
-
const c = "color: " + this.color;
|
|
10664
|
-
args.splice(1, 0, c, "color: inherit");
|
|
10665
|
-
let index = 0;
|
|
10666
|
-
let lastC = 0;
|
|
10667
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
10668
|
-
if (match === "%%") {
|
|
10669
|
-
return;
|
|
10670
|
-
}
|
|
10671
|
-
index++;
|
|
10672
|
-
if (match === "%c") {
|
|
10673
|
-
lastC = index;
|
|
10674
|
-
}
|
|
10675
|
-
});
|
|
10676
|
-
args.splice(lastC, 0, c);
|
|
10677
|
-
}
|
|
10678
|
-
exports.log = console.debug || console.log || (() => {
|
|
10679
|
-
});
|
|
10680
|
-
function save(namespaces) {
|
|
10681
|
-
try {
|
|
10682
|
-
if (namespaces) {
|
|
10683
|
-
exports.storage.setItem("debug", namespaces);
|
|
10684
|
-
} else {
|
|
10685
|
-
exports.storage.removeItem("debug");
|
|
10686
|
-
}
|
|
10687
|
-
} catch (error) {
|
|
10688
|
-
}
|
|
10689
|
-
}
|
|
10690
|
-
function load() {
|
|
10691
|
-
let r;
|
|
10692
|
-
try {
|
|
10693
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
10694
|
-
} catch (error) {
|
|
10695
|
-
}
|
|
10696
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
10697
|
-
r = process.env.DEBUG;
|
|
10698
|
-
}
|
|
10699
|
-
return r;
|
|
10700
|
-
}
|
|
10701
|
-
function localstorage() {
|
|
10702
|
-
try {
|
|
10703
|
-
return localStorage;
|
|
10704
|
-
} catch (error) {
|
|
10705
|
-
}
|
|
10706
|
-
}
|
|
10707
|
-
module.exports = requireCommon()(exports);
|
|
10708
|
-
const { formatters } = module.exports;
|
|
10709
|
-
formatters.j = function(v) {
|
|
10710
|
-
try {
|
|
10711
|
-
return JSON.stringify(v);
|
|
10712
|
-
} catch (error) {
|
|
10713
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
10714
|
-
}
|
|
10715
|
-
};
|
|
10716
|
-
})(browser, browser.exports);
|
|
10717
|
-
return browser.exports;
|
|
10718
|
-
}
|
|
10719
|
-
var hasRequiredDist;
|
|
10720
|
-
function requireDist() {
|
|
10721
|
-
if (hasRequiredDist) return dist;
|
|
10722
|
-
hasRequiredDist = 1;
|
|
10723
|
-
var __importDefault = dist && dist.__importDefault || function(mod) {
|
|
10724
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
10725
|
-
};
|
|
10726
|
-
Object.defineProperty(dist, "__esModule", { value: true });
|
|
10727
|
-
dist.NodeClusterAdapter = void 0;
|
|
10728
|
-
dist.createAdapter = createAdapter2;
|
|
10729
|
-
dist.setupPrimary = setupPrimary;
|
|
10730
|
-
const node_cluster_1 = __importDefault(require$$0$2);
|
|
10731
|
-
const socket_io_adapter_1 = require$$1$2;
|
|
10732
|
-
const debug_1 = __importDefault(requireBrowser());
|
|
10733
|
-
const debug = (0, debug_1.default)("socket.io-cluster-adapter");
|
|
10734
|
-
const MESSAGE_SOURCE = "_sio_adapter";
|
|
10735
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
10736
|
-
function ignoreError() {
|
|
10737
|
-
}
|
|
10738
|
-
function createAdapter2(opts = {}) {
|
|
10739
|
-
return function(nsp) {
|
|
10740
|
-
return new NodeClusterAdapter(nsp, opts);
|
|
10741
|
-
};
|
|
10742
|
-
}
|
|
10743
|
-
class NodeClusterAdapter extends socket_io_adapter_1.ClusterAdapterWithHeartbeat {
|
|
10744
|
-
constructor(nsp, opts = {}) {
|
|
10745
|
-
super(nsp, opts);
|
|
10746
|
-
process.on("message", (message) => {
|
|
10747
|
-
const isValidSource = (message === null || message === void 0 ? void 0 : message.source) === MESSAGE_SOURCE;
|
|
10748
|
-
if (!isValidSource) {
|
|
10749
|
-
debug("[%s] ignore unknown source", this.uid);
|
|
10750
|
-
return;
|
|
10751
|
-
}
|
|
10752
|
-
if (message.nsp !== this.nsp.name) {
|
|
10753
|
-
debug("[%s] ignore other namespace", this.uid);
|
|
10754
|
-
return;
|
|
10755
|
-
}
|
|
10756
|
-
this.onMessage(message);
|
|
10757
|
-
});
|
|
10758
|
-
this.init();
|
|
10759
|
-
}
|
|
10760
|
-
doPublish(message) {
|
|
10761
|
-
message.source = MESSAGE_SOURCE;
|
|
10762
|
-
process.send(message, null, {}, ignoreError);
|
|
10763
|
-
return Promise.resolve("");
|
|
10764
|
-
}
|
|
10765
|
-
doPublishResponse(requesterUid, response) {
|
|
10766
|
-
response.source = MESSAGE_SOURCE;
|
|
10767
|
-
response.requesterUid = requesterUid;
|
|
10768
|
-
process.send(response, null, {}, ignoreError);
|
|
10769
|
-
return Promise.resolve();
|
|
10770
|
-
}
|
|
10771
|
-
}
|
|
10772
|
-
dist.NodeClusterAdapter = NodeClusterAdapter;
|
|
10773
|
-
const UIDS = /* @__PURE__ */ Symbol("uids");
|
|
10774
|
-
function setupPrimary() {
|
|
10775
|
-
node_cluster_1.default.on("message", (worker, message) => {
|
|
10776
|
-
var _a;
|
|
10777
|
-
const isValidSource = (message === null || message === void 0 ? void 0 : message.source) === MESSAGE_SOURCE;
|
|
10778
|
-
if (!isValidSource) {
|
|
10779
|
-
return;
|
|
10780
|
-
}
|
|
10781
|
-
worker[UIDS] = worker[UIDS] || /* @__PURE__ */ new Set();
|
|
10782
|
-
worker[UIDS].add(message.uid);
|
|
10783
|
-
switch (message.type) {
|
|
10784
|
-
case socket_io_adapter_1.MessageType.FETCH_SOCKETS_RESPONSE:
|
|
10785
|
-
case socket_io_adapter_1.MessageType.SERVER_SIDE_EMIT_RESPONSE:
|
|
10786
|
-
const requesterUid = message.requesterUid;
|
|
10787
|
-
for (const workerId in node_cluster_1.default.workers) {
|
|
10788
|
-
if (hasOwnProperty.call(node_cluster_1.default.workers, workerId) && ((_a = node_cluster_1.default.workers[workerId][UIDS]) === null || _a === void 0 ? void 0 : _a.has(requesterUid))) {
|
|
10789
|
-
node_cluster_1.default.workers[workerId].send(message, null, ignoreError);
|
|
10790
|
-
break;
|
|
10791
|
-
}
|
|
10792
|
-
}
|
|
10793
|
-
break;
|
|
10794
|
-
default:
|
|
10795
|
-
const emitterIdAsString = String(worker.id);
|
|
10796
|
-
for (const workerId in node_cluster_1.default.workers) {
|
|
10797
|
-
if (hasOwnProperty.call(node_cluster_1.default.workers, workerId) && workerId !== emitterIdAsString) {
|
|
10798
|
-
node_cluster_1.default.workers[workerId].send(message, null, ignoreError);
|
|
10799
|
-
}
|
|
10800
|
-
}
|
|
10801
|
-
}
|
|
10802
|
-
});
|
|
10803
|
-
}
|
|
10804
|
-
return dist;
|
|
10805
|
-
}
|
|
10806
|
-
var distExports = requireDist();
|
|
10807
|
-
class SocketIoServer extends tinyEmitterExports$1.TinyEmitter {
|
|
10808
|
-
namespace;
|
|
10809
|
-
socketionamespace;
|
|
10810
|
-
//protected socketionamespace?: Namespace<ClientToServerEvents, ServerToClientEvents, InterServerEvents>
|
|
10811
|
-
logger;
|
|
10812
|
-
io;
|
|
10813
|
-
//#redisClient: RedisClientType | Redis | null = null;
|
|
10814
|
-
redisClient;
|
|
10815
|
-
listenPort;
|
|
10816
|
-
socketIoCustomPath;
|
|
10817
|
-
ioRedisMessageProcessorUrl;
|
|
10818
|
-
serverClusterMode;
|
|
10819
|
-
rooms;
|
|
10820
|
-
constructor() {
|
|
10821
|
-
super();
|
|
10822
|
-
}
|
|
10823
|
-
LogErrorMessage(message) {
|
|
10824
|
-
if (this.logger) {
|
|
10825
|
-
this.logger.error(`${this.namespace}: ${message}`);
|
|
10826
|
-
}
|
|
10827
|
-
}
|
|
10828
|
-
LogDebugMessage(message) {
|
|
10829
|
-
if (this.logger) {
|
|
10830
|
-
this.logger.debug(`${this.namespace}: ${message}`);
|
|
10831
|
-
}
|
|
10832
|
-
}
|
|
10833
|
-
LogInfoMessage(message) {
|
|
10834
|
-
if (this.logger) {
|
|
10835
|
-
this.logger.info(`${this.namespace}: ${message}`);
|
|
10836
|
-
}
|
|
10837
|
-
}
|
|
10838
|
-
LogWarnMessage(message) {
|
|
10839
|
-
if (this.logger) {
|
|
10840
|
-
this.logger.warn(`${this.namespace}: ${message}`);
|
|
10841
|
-
}
|
|
10842
|
-
}
|
|
10843
|
-
// https://socket.io/docs/v4/middlewares/
|
|
10844
|
-
// https://socket.io/docs/v4/server-socket-instance/#sockethandshake
|
|
10845
|
-
// https://socket.io/docs/v4/server-socket-instance/#socket-middlewares
|
|
10846
|
-
// Use this middleward to check every incomming connection
|
|
10847
|
-
SetupConnectionMiddleware = () => {
|
|
10848
|
-
};
|
|
10849
|
-
// Use this middleware to check every packet being received
|
|
10850
|
-
SetupMessageMiddleware = (socket) => {
|
|
10851
|
-
};
|
|
10852
|
-
SocketConnectCallBack = (socket) => {
|
|
10853
|
-
};
|
|
10854
|
-
SocketEventsCallBack = (socket) => {
|
|
10855
|
-
};
|
|
10856
|
-
GetConfig = (socketIoServeroptions) => {
|
|
10857
|
-
const options = {
|
|
10858
|
-
transports: ["websocket"]
|
|
10859
|
-
// or [ "websocket", "polling" ] (to use long-poolling. Note that the order matters)
|
|
10860
|
-
};
|
|
10861
|
-
if (socketIoServeroptions.ioRedisMessageProcessorUrl && socketIoServeroptions.ioRedisMessageProcessorUrl !== "") {
|
|
10862
|
-
this.redisClient = new Redis(socketIoServeroptions.ioRedisMessageProcessorUrl);
|
|
10863
|
-
options.adapter = createAdapter(this.redisClient);
|
|
10864
|
-
} else if (socketIoServeroptions.serverClusterMode && socketIoServeroptions.serverClusterMode === true) {
|
|
10865
|
-
options.adapter = distExports.createAdapter();
|
|
10866
|
-
}
|
|
10867
|
-
if (socketIoServeroptions.wssCustomPath && socketIoServeroptions.wssCustomPath.localeCompare("") !== 0) {
|
|
10868
|
-
options.path = socketIoServeroptions.wssCustomPath;
|
|
10869
|
-
}
|
|
10870
|
-
return options;
|
|
10871
|
-
};
|
|
10872
|
-
SetEngineEvents = () => {
|
|
10873
|
-
if (this.io) {
|
|
10874
|
-
this.io.engine.on("connection_error", (err) => {
|
|
10875
|
-
this.LogInfoMessage(err.req);
|
|
10876
|
-
this.LogInfoMessage(err.code);
|
|
10877
|
-
this.LogInfoMessage(err.message);
|
|
10878
|
-
this.LogInfoMessage(err.context);
|
|
10879
|
-
});
|
|
10880
|
-
}
|
|
10881
|
-
};
|
|
10882
|
-
WithLogger = (logger) => {
|
|
10883
|
-
this.logger = logger;
|
|
10884
|
-
return this;
|
|
10885
|
-
};
|
|
10886
|
-
WithExistingServer = (server) => {
|
|
10887
|
-
if (this.io) {
|
|
10888
|
-
throw new Error(`SocketIoServer:AttachServer(): Error: [Server already attached]`);
|
|
10889
|
-
}
|
|
10890
|
-
this.io = server;
|
|
10891
|
-
return this;
|
|
10892
|
-
};
|
|
10893
|
-
WithListenPort = (listenPort) => {
|
|
10894
|
-
this.listenPort = listenPort;
|
|
10895
|
-
return this;
|
|
10896
|
-
};
|
|
10897
|
-
WithSocketIoCustomPath = (socketIoCustomPath) => {
|
|
10898
|
-
this.socketIoCustomPath = socketIoCustomPath;
|
|
10899
|
-
return this;
|
|
10900
|
-
};
|
|
10901
|
-
WithIoRedisMessageProcessorUrl = (ioRedisMessageProcessorUrl) => {
|
|
10902
|
-
this.ioRedisMessageProcessorUrl = ioRedisMessageProcessorUrl;
|
|
10903
|
-
return this;
|
|
10904
|
-
};
|
|
10905
|
-
WithClusterMode = (serverClusterMode) => {
|
|
10906
|
-
this.serverClusterMode = serverClusterMode;
|
|
10907
|
-
return this;
|
|
10908
|
-
};
|
|
10909
|
-
WithRooms = (rooms) => {
|
|
10910
|
-
this.rooms = rooms;
|
|
10911
|
-
return this;
|
|
10912
|
-
};
|
|
10913
|
-
WithNamespace = (namespace) => {
|
|
10914
|
-
this.namespace = namespace;
|
|
10915
|
-
return this;
|
|
10916
|
-
};
|
|
10917
|
-
StartServer = async () => {
|
|
10918
|
-
if (!this.namespace) {
|
|
10919
|
-
throw new Error(`SocketIoServer:StartServer(): Error: [namespace not specified]`);
|
|
10920
|
-
}
|
|
10921
|
-
if (!this.io) {
|
|
10922
|
-
if (!this.listenPort) {
|
|
10923
|
-
throw new Error(`SocketIoServer:StartServer(): Error: [listenPort not specified]`);
|
|
10924
|
-
}
|
|
10925
|
-
const options = {
|
|
10926
|
-
transports: ["websocket"]
|
|
10927
|
-
// or [ "websocket", "polling" ] (to use long-poolling. Note that the order matters)
|
|
10928
|
-
};
|
|
10929
|
-
if (this.ioRedisMessageProcessorUrl && this.ioRedisMessageProcessorUrl !== "") {
|
|
10930
|
-
this.redisClient = new Redis(this.ioRedisMessageProcessorUrl);
|
|
10931
|
-
options.adapter = createAdapter(this.redisClient);
|
|
10932
|
-
} else if (this.serverClusterMode && this.serverClusterMode === true) {
|
|
10933
|
-
options.adapter = distExports.createAdapter();
|
|
10934
|
-
}
|
|
10935
|
-
if (this.socketIoCustomPath && this.socketIoCustomPath.localeCompare("") !== 0) {
|
|
10936
|
-
options.path = this.socketIoCustomPath;
|
|
10937
|
-
}
|
|
10938
|
-
this.io = new Server(this.listenPort, options);
|
|
10939
|
-
this.SetEngineEvents();
|
|
10940
|
-
await Sleep(500);
|
|
10941
|
-
}
|
|
10942
|
-
let autoJoinRooms;
|
|
10943
|
-
let rooms;
|
|
10944
|
-
if (this.rooms && this.rooms.length > 0) {
|
|
10945
|
-
autoJoinRooms = true;
|
|
10946
|
-
rooms = [...this.rooms];
|
|
10947
|
-
} else {
|
|
10948
|
-
autoJoinRooms = false;
|
|
10949
|
-
rooms = [];
|
|
10950
|
-
}
|
|
10951
|
-
this.SetupNamespace(rooms, autoJoinRooms);
|
|
10952
|
-
return this;
|
|
10953
|
-
};
|
|
10954
|
-
AttachServer = async (server) => {
|
|
10955
|
-
if (this.io) {
|
|
10956
|
-
throw new Error(`SocketIoServer:AttachServer(): Error: [Server already attached]`);
|
|
10957
|
-
}
|
|
10958
|
-
this.io = server;
|
|
10959
|
-
};
|
|
10960
|
-
StopServer = async () => {
|
|
10961
|
-
if (this.io) {
|
|
10962
|
-
await this.CloseNamespaceAdaptors();
|
|
10963
|
-
this.DisconnectNamespaceSockets();
|
|
10964
|
-
await this.io.of("/").adapter.close();
|
|
10965
|
-
if (this.redisClient) {
|
|
10966
|
-
await this.redisClient.disconnect();
|
|
10967
|
-
await Sleep(50);
|
|
10968
|
-
}
|
|
10969
|
-
this.io.disconnectSockets();
|
|
10970
|
-
this.io = void 0;
|
|
10971
|
-
}
|
|
10972
|
-
};
|
|
10973
|
-
LeaveRoom = (socket, room) => {
|
|
10974
|
-
this.LogDebugMessage(`Leaving room [${room}]`);
|
|
10975
|
-
socket.leave(room);
|
|
10976
|
-
};
|
|
10977
|
-
JoinRoom = (socket, room) => {
|
|
10978
|
-
this.LogDebugMessage(`Socket joining room [${room}], ID: [${socket.id}]`);
|
|
10979
|
-
socket.join(room);
|
|
10980
|
-
};
|
|
10981
|
-
SetupStandardEvents = (socket) => {
|
|
10982
|
-
socket.on("disconnect", (reason) => {
|
|
10983
|
-
this.LogDebugMessage(`socket disconnect, ID: [${socket.id}] [${reason}]`);
|
|
10984
|
-
});
|
|
10985
|
-
socket.on("disconnecting", (reason) => {
|
|
10986
|
-
this.LogDebugMessage(`socket disconnecting, ID: [${socket.id}] [${reason}]`);
|
|
10987
|
-
});
|
|
10988
|
-
socket.on("error", (error) => {
|
|
10989
|
-
this.LogDebugMessage(`socket error, ID: [${socket.id}] [${error}]`);
|
|
10990
|
-
});
|
|
10991
|
-
socket.on("__STSdisconnect", (reason) => {
|
|
10992
|
-
this.LogDebugMessage(`__STSdisconnect: socket disconnect, ID: [${socket.id}] [${reason}]`);
|
|
10993
|
-
});
|
|
10994
|
-
socket.on("__STSdisconnecting", (reason, callBackResult) => {
|
|
10995
|
-
this.LogDebugMessage(`__STSdisconnecting: socket disconnecting, ID: [${socket.id}] [${reason}]`);
|
|
10996
|
-
callBackResult("__STSdisconnecting accepted by server.");
|
|
10997
|
-
});
|
|
10998
|
-
socket.on("__STSjoinRoom", (rooms) => {
|
|
10999
|
-
rooms.forEach((room) => {
|
|
11000
|
-
this.JoinRoom(socket, room);
|
|
11001
|
-
});
|
|
11002
|
-
});
|
|
11003
|
-
socket.on("__STSleaveRoom", (rooms) => {
|
|
11004
|
-
rooms.forEach((room) => {
|
|
11005
|
-
this.LeaveRoom(socket, room);
|
|
11006
|
-
});
|
|
11007
|
-
});
|
|
11008
|
-
socket.on("__STSsendToRoom", (rooms, payload) => {
|
|
11009
|
-
rooms.forEach((room) => {
|
|
11010
|
-
if (this.socketionamespace) {
|
|
11011
|
-
this.LogDebugMessage(`socket.on: __STSsendToRoom: Sending to room [${room}], ID: [${socket.id}]`);
|
|
11012
|
-
this.socketionamespace.to(room).emit(payload.command, payload);
|
|
11013
|
-
}
|
|
11014
|
-
});
|
|
11015
|
-
});
|
|
11016
|
-
socket.on("__STSsendToRoomWithCallback", (room, timeout, payload, cb) => {
|
|
11017
|
-
if (this.socketionamespace) {
|
|
11018
|
-
this.socketionamespace.to(room).timeout(timeout).emit(payload.command, payload, (err, dataResponse) => {
|
|
11019
|
-
if (err) {
|
|
11020
|
-
console.error(err);
|
|
11021
|
-
const errorResponse = {
|
|
11022
|
-
error: true,
|
|
11023
|
-
errorName: err.name,
|
|
11024
|
-
errorMessage: err.message
|
|
11025
|
-
//errorCause: err.cause,
|
|
11026
|
-
//errorStack: err.stack
|
|
11027
|
-
};
|
|
11028
|
-
this.LogErrorMessage(`__STSsendToRoomWithCallback broadcast (error): [${JSON.stringify(errorResponse)}]`);
|
|
11029
|
-
cb(errorResponse);
|
|
11030
|
-
} else {
|
|
11031
|
-
this.LogDebugMessage(`__STSsendToRoomWithCallback broadcast: [${JSON.stringify(dataResponse)}]`);
|
|
11032
|
-
cb(dataResponse);
|
|
11033
|
-
}
|
|
11034
|
-
});
|
|
11035
|
-
}
|
|
11036
|
-
});
|
|
11037
|
-
socket.on("__STSsendToRoomsWithCallback", (rooms, timeout, payload, cb) => {
|
|
11038
|
-
const responses = [];
|
|
11039
|
-
const timeoutForComplete = setTimeout(() => {
|
|
11040
|
-
responses.push({
|
|
11041
|
-
room: "",
|
|
11042
|
-
responses: {
|
|
11043
|
-
error: true,
|
|
11044
|
-
errorName: "timeout",
|
|
11045
|
-
errorMessage: `__STSsendToRoomsWithCallback timeout: [${timeout}] before all responses received`
|
|
11046
|
-
}
|
|
11047
|
-
});
|
|
11048
|
-
cb(responses);
|
|
11049
|
-
}, timeout).unref();
|
|
11050
|
-
rooms.forEach((room) => {
|
|
11051
|
-
if (this.socketionamespace) {
|
|
11052
|
-
this.socketionamespace.to(room).timeout(timeout).emit(payload.command, payload, (err, dataResponse) => {
|
|
11053
|
-
if (err) {
|
|
11054
|
-
console.error(err);
|
|
11055
|
-
const errorResponse = {
|
|
11056
|
-
error: true,
|
|
11057
|
-
errorName: err.name,
|
|
11058
|
-
errorMessage: err.message
|
|
11059
|
-
//errorCause: err.cause,
|
|
11060
|
-
//errorStack: err.stack
|
|
11061
|
-
};
|
|
11062
|
-
this.LogErrorMessage(`__STSsendToRoomWithCallback broadcast (error): [${JSON.stringify(errorResponse)}]`);
|
|
11063
|
-
responses.push({
|
|
11064
|
-
room,
|
|
11065
|
-
responses: errorResponse
|
|
11066
|
-
});
|
|
11067
|
-
} else {
|
|
11068
|
-
this.LogDebugMessage(`__STSsendToRoomWithCallback broadcast: [${JSON.stringify(dataResponse)}]`);
|
|
11069
|
-
responses.push({
|
|
11070
|
-
room,
|
|
11071
|
-
responses: dataResponse
|
|
11072
|
-
});
|
|
11073
|
-
}
|
|
11074
|
-
if (responses.length === rooms.length) {
|
|
11075
|
-
clearTimeout(timeoutForComplete);
|
|
11076
|
-
cb(responses);
|
|
11077
|
-
}
|
|
11078
|
-
});
|
|
11079
|
-
}
|
|
11080
|
-
});
|
|
11081
|
-
});
|
|
11082
|
-
};
|
|
11083
|
-
SetupNamespace = (rooms, autoJoinRooms) => {
|
|
11084
|
-
if (this.io) {
|
|
11085
|
-
this.socketionamespace = this.io.of(`/${this.namespace}/`);
|
|
11086
|
-
this.SetupConnectionMiddleware();
|
|
11087
|
-
this.socketionamespace.on("connection", (socket) => {
|
|
11088
|
-
this.LogDebugMessage(`Socket connected, ID: [${socket.id}]`);
|
|
11089
|
-
this.LogDebugMessage(`Authentication Handshake (auth): [${JSON.stringify(socket.handshake.auth)}]`);
|
|
11090
|
-
this.LogDebugMessage(`Authentication Handshake (host): [${JSON.stringify(socket.handshake.headers.host)}]`);
|
|
11091
|
-
this.LogDebugMessage(`Authentication Handshake (url): [${JSON.stringify(socket.handshake.url)}]`);
|
|
11092
|
-
this.LogDebugMessage(`Authentication Handshake: [${JSON.stringify(socket.handshake)}]`);
|
|
11093
|
-
this.SetupMessageMiddleware(socket);
|
|
11094
|
-
if (autoJoinRooms) {
|
|
11095
|
-
rooms.map((room) => {
|
|
11096
|
-
this.JoinRoom(socket, room);
|
|
11097
|
-
});
|
|
11098
|
-
}
|
|
11099
|
-
this.SetupStandardEvents(socket);
|
|
11100
|
-
setTimeout(() => {
|
|
11101
|
-
this.SocketConnectCallBack(socket);
|
|
11102
|
-
}, 0);
|
|
11103
|
-
this.SocketEventsCallBack(socket);
|
|
11104
|
-
});
|
|
11105
|
-
} else {
|
|
11106
|
-
throw new Error("SocketIoServer:SetupNamespace(): Error: [No server attached");
|
|
11107
|
-
}
|
|
11108
|
-
return this;
|
|
11109
|
-
};
|
|
11110
|
-
CloseNamespaceAdaptors = async () => {
|
|
11111
|
-
if (this.socketionamespace) {
|
|
11112
|
-
await this.socketionamespace.adapter.close();
|
|
11113
|
-
}
|
|
11114
|
-
};
|
|
11115
|
-
DisconnectNamespaceSockets = () => {
|
|
11116
|
-
if (this.socketionamespace) {
|
|
11117
|
-
this.socketionamespace.disconnectSockets();
|
|
11118
|
-
this.socketionamespace = void 0;
|
|
11119
|
-
}
|
|
11120
|
-
};
|
|
11121
|
-
}
|
|
11122
10245
|
var tinyEmitter = { exports: {} };
|
|
11123
10246
|
var hasRequiredTinyEmitter;
|
|
11124
10247
|
function requireTinyEmitter() {
|