@sockethub/platform-irc 4.0.0-alpha.10 → 4.0.0-alpha.11
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/index.js +45 -795
- package/dist/index.js.map +5 -12
- package/package.json +6 -5
- package/src/index.test.ts +10 -6
- package/src/index.ts +52 -37
package/dist/index.js
CHANGED
|
@@ -491,752 +491,6 @@ var require_irc_socket = __commonJS((exports, module) => {
|
|
|
491
491
|
module.exports = IrcSocket;
|
|
492
492
|
});
|
|
493
493
|
|
|
494
|
-
// ../../node_modules/ms/index.js
|
|
495
|
-
var require_ms = __commonJS((exports, module) => {
|
|
496
|
-
var s = 1000;
|
|
497
|
-
var m = s * 60;
|
|
498
|
-
var h = m * 60;
|
|
499
|
-
var d = h * 24;
|
|
500
|
-
var w = d * 7;
|
|
501
|
-
var y = d * 365.25;
|
|
502
|
-
module.exports = function(val, options) {
|
|
503
|
-
options = options || {};
|
|
504
|
-
var type = typeof val;
|
|
505
|
-
if (type === "string" && val.length > 0) {
|
|
506
|
-
return parse(val);
|
|
507
|
-
} else if (type === "number" && isFinite(val)) {
|
|
508
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
509
|
-
}
|
|
510
|
-
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
511
|
-
};
|
|
512
|
-
function parse(str) {
|
|
513
|
-
str = String(str);
|
|
514
|
-
if (str.length > 100) {
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
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(str);
|
|
518
|
-
if (!match) {
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
var n = parseFloat(match[1]);
|
|
522
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
523
|
-
switch (type) {
|
|
524
|
-
case "years":
|
|
525
|
-
case "year":
|
|
526
|
-
case "yrs":
|
|
527
|
-
case "yr":
|
|
528
|
-
case "y":
|
|
529
|
-
return n * y;
|
|
530
|
-
case "weeks":
|
|
531
|
-
case "week":
|
|
532
|
-
case "w":
|
|
533
|
-
return n * w;
|
|
534
|
-
case "days":
|
|
535
|
-
case "day":
|
|
536
|
-
case "d":
|
|
537
|
-
return n * d;
|
|
538
|
-
case "hours":
|
|
539
|
-
case "hour":
|
|
540
|
-
case "hrs":
|
|
541
|
-
case "hr":
|
|
542
|
-
case "h":
|
|
543
|
-
return n * h;
|
|
544
|
-
case "minutes":
|
|
545
|
-
case "minute":
|
|
546
|
-
case "mins":
|
|
547
|
-
case "min":
|
|
548
|
-
case "m":
|
|
549
|
-
return n * m;
|
|
550
|
-
case "seconds":
|
|
551
|
-
case "second":
|
|
552
|
-
case "secs":
|
|
553
|
-
case "sec":
|
|
554
|
-
case "s":
|
|
555
|
-
return n * s;
|
|
556
|
-
case "milliseconds":
|
|
557
|
-
case "millisecond":
|
|
558
|
-
case "msecs":
|
|
559
|
-
case "msec":
|
|
560
|
-
case "ms":
|
|
561
|
-
return n;
|
|
562
|
-
default:
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
function fmtShort(ms) {
|
|
567
|
-
var msAbs = Math.abs(ms);
|
|
568
|
-
if (msAbs >= d) {
|
|
569
|
-
return Math.round(ms / d) + "d";
|
|
570
|
-
}
|
|
571
|
-
if (msAbs >= h) {
|
|
572
|
-
return Math.round(ms / h) + "h";
|
|
573
|
-
}
|
|
574
|
-
if (msAbs >= m) {
|
|
575
|
-
return Math.round(ms / m) + "m";
|
|
576
|
-
}
|
|
577
|
-
if (msAbs >= s) {
|
|
578
|
-
return Math.round(ms / s) + "s";
|
|
579
|
-
}
|
|
580
|
-
return ms + "ms";
|
|
581
|
-
}
|
|
582
|
-
function fmtLong(ms) {
|
|
583
|
-
var msAbs = Math.abs(ms);
|
|
584
|
-
if (msAbs >= d) {
|
|
585
|
-
return plural(ms, msAbs, d, "day");
|
|
586
|
-
}
|
|
587
|
-
if (msAbs >= h) {
|
|
588
|
-
return plural(ms, msAbs, h, "hour");
|
|
589
|
-
}
|
|
590
|
-
if (msAbs >= m) {
|
|
591
|
-
return plural(ms, msAbs, m, "minute");
|
|
592
|
-
}
|
|
593
|
-
if (msAbs >= s) {
|
|
594
|
-
return plural(ms, msAbs, s, "second");
|
|
595
|
-
}
|
|
596
|
-
return ms + " ms";
|
|
597
|
-
}
|
|
598
|
-
function plural(ms, msAbs, n, name) {
|
|
599
|
-
var isPlural = msAbs >= n * 1.5;
|
|
600
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
// ../../node_modules/debug/src/common.js
|
|
605
|
-
var require_common = __commonJS((exports, module) => {
|
|
606
|
-
function setup(env) {
|
|
607
|
-
createDebug.debug = createDebug;
|
|
608
|
-
createDebug.default = createDebug;
|
|
609
|
-
createDebug.coerce = coerce;
|
|
610
|
-
createDebug.disable = disable;
|
|
611
|
-
createDebug.enable = enable;
|
|
612
|
-
createDebug.enabled = enabled;
|
|
613
|
-
createDebug.humanize = require_ms();
|
|
614
|
-
createDebug.destroy = destroy;
|
|
615
|
-
Object.keys(env).forEach((key) => {
|
|
616
|
-
createDebug[key] = env[key];
|
|
617
|
-
});
|
|
618
|
-
createDebug.names = [];
|
|
619
|
-
createDebug.skips = [];
|
|
620
|
-
createDebug.formatters = {};
|
|
621
|
-
function selectColor(namespace) {
|
|
622
|
-
let hash = 0;
|
|
623
|
-
for (let i = 0;i < namespace.length; i++) {
|
|
624
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
625
|
-
hash |= 0;
|
|
626
|
-
}
|
|
627
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
628
|
-
}
|
|
629
|
-
createDebug.selectColor = selectColor;
|
|
630
|
-
function createDebug(namespace) {
|
|
631
|
-
let prevTime;
|
|
632
|
-
let enableOverride = null;
|
|
633
|
-
let namespacesCache;
|
|
634
|
-
let enabledCache;
|
|
635
|
-
function debug(...args) {
|
|
636
|
-
if (!debug.enabled) {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
const self = debug;
|
|
640
|
-
const curr = Number(new Date);
|
|
641
|
-
const ms = curr - (prevTime || curr);
|
|
642
|
-
self.diff = ms;
|
|
643
|
-
self.prev = prevTime;
|
|
644
|
-
self.curr = curr;
|
|
645
|
-
prevTime = curr;
|
|
646
|
-
args[0] = createDebug.coerce(args[0]);
|
|
647
|
-
if (typeof args[0] !== "string") {
|
|
648
|
-
args.unshift("%O");
|
|
649
|
-
}
|
|
650
|
-
let index = 0;
|
|
651
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
652
|
-
if (match === "%%") {
|
|
653
|
-
return "%";
|
|
654
|
-
}
|
|
655
|
-
index++;
|
|
656
|
-
const formatter = createDebug.formatters[format];
|
|
657
|
-
if (typeof formatter === "function") {
|
|
658
|
-
const val = args[index];
|
|
659
|
-
match = formatter.call(self, val);
|
|
660
|
-
args.splice(index, 1);
|
|
661
|
-
index--;
|
|
662
|
-
}
|
|
663
|
-
return match;
|
|
664
|
-
});
|
|
665
|
-
createDebug.formatArgs.call(self, args);
|
|
666
|
-
const logFn = self.log || createDebug.log;
|
|
667
|
-
logFn.apply(self, args);
|
|
668
|
-
}
|
|
669
|
-
debug.namespace = namespace;
|
|
670
|
-
debug.useColors = createDebug.useColors();
|
|
671
|
-
debug.color = createDebug.selectColor(namespace);
|
|
672
|
-
debug.extend = extend;
|
|
673
|
-
debug.destroy = createDebug.destroy;
|
|
674
|
-
Object.defineProperty(debug, "enabled", {
|
|
675
|
-
enumerable: true,
|
|
676
|
-
configurable: false,
|
|
677
|
-
get: () => {
|
|
678
|
-
if (enableOverride !== null) {
|
|
679
|
-
return enableOverride;
|
|
680
|
-
}
|
|
681
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
682
|
-
namespacesCache = createDebug.namespaces;
|
|
683
|
-
enabledCache = createDebug.enabled(namespace);
|
|
684
|
-
}
|
|
685
|
-
return enabledCache;
|
|
686
|
-
},
|
|
687
|
-
set: (v) => {
|
|
688
|
-
enableOverride = v;
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
if (typeof createDebug.init === "function") {
|
|
692
|
-
createDebug.init(debug);
|
|
693
|
-
}
|
|
694
|
-
return debug;
|
|
695
|
-
}
|
|
696
|
-
function extend(namespace, delimiter) {
|
|
697
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
698
|
-
newDebug.log = this.log;
|
|
699
|
-
return newDebug;
|
|
700
|
-
}
|
|
701
|
-
function enable(namespaces) {
|
|
702
|
-
createDebug.save(namespaces);
|
|
703
|
-
createDebug.namespaces = namespaces;
|
|
704
|
-
createDebug.names = [];
|
|
705
|
-
createDebug.skips = [];
|
|
706
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
707
|
-
for (const ns of split) {
|
|
708
|
-
if (ns[0] === "-") {
|
|
709
|
-
createDebug.skips.push(ns.slice(1));
|
|
710
|
-
} else {
|
|
711
|
-
createDebug.names.push(ns);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
function matchesTemplate(search, template) {
|
|
716
|
-
let searchIndex = 0;
|
|
717
|
-
let templateIndex = 0;
|
|
718
|
-
let starIndex = -1;
|
|
719
|
-
let matchIndex = 0;
|
|
720
|
-
while (searchIndex < search.length) {
|
|
721
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
722
|
-
if (template[templateIndex] === "*") {
|
|
723
|
-
starIndex = templateIndex;
|
|
724
|
-
matchIndex = searchIndex;
|
|
725
|
-
templateIndex++;
|
|
726
|
-
} else {
|
|
727
|
-
searchIndex++;
|
|
728
|
-
templateIndex++;
|
|
729
|
-
}
|
|
730
|
-
} else if (starIndex !== -1) {
|
|
731
|
-
templateIndex = starIndex + 1;
|
|
732
|
-
matchIndex++;
|
|
733
|
-
searchIndex = matchIndex;
|
|
734
|
-
} else {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
739
|
-
templateIndex++;
|
|
740
|
-
}
|
|
741
|
-
return templateIndex === template.length;
|
|
742
|
-
}
|
|
743
|
-
function disable() {
|
|
744
|
-
const namespaces = [
|
|
745
|
-
...createDebug.names,
|
|
746
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
747
|
-
].join(",");
|
|
748
|
-
createDebug.enable("");
|
|
749
|
-
return namespaces;
|
|
750
|
-
}
|
|
751
|
-
function enabled(name) {
|
|
752
|
-
for (const skip of createDebug.skips) {
|
|
753
|
-
if (matchesTemplate(name, skip)) {
|
|
754
|
-
return false;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
for (const ns of createDebug.names) {
|
|
758
|
-
if (matchesTemplate(name, ns)) {
|
|
759
|
-
return true;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
return false;
|
|
763
|
-
}
|
|
764
|
-
function coerce(val) {
|
|
765
|
-
if (val instanceof Error) {
|
|
766
|
-
return val.stack || val.message;
|
|
767
|
-
}
|
|
768
|
-
return val;
|
|
769
|
-
}
|
|
770
|
-
function destroy() {
|
|
771
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
772
|
-
}
|
|
773
|
-
createDebug.enable(createDebug.load());
|
|
774
|
-
return createDebug;
|
|
775
|
-
}
|
|
776
|
-
module.exports = setup;
|
|
777
|
-
});
|
|
778
|
-
|
|
779
|
-
// ../../node_modules/debug/src/browser.js
|
|
780
|
-
var require_browser = __commonJS((exports, module) => {
|
|
781
|
-
exports.formatArgs = formatArgs;
|
|
782
|
-
exports.save = save;
|
|
783
|
-
exports.load = load;
|
|
784
|
-
exports.useColors = useColors;
|
|
785
|
-
exports.storage = localstorage();
|
|
786
|
-
exports.destroy = (() => {
|
|
787
|
-
let warned = false;
|
|
788
|
-
return () => {
|
|
789
|
-
if (!warned) {
|
|
790
|
-
warned = true;
|
|
791
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
})();
|
|
795
|
-
exports.colors = [
|
|
796
|
-
"#0000CC",
|
|
797
|
-
"#0000FF",
|
|
798
|
-
"#0033CC",
|
|
799
|
-
"#0033FF",
|
|
800
|
-
"#0066CC",
|
|
801
|
-
"#0066FF",
|
|
802
|
-
"#0099CC",
|
|
803
|
-
"#0099FF",
|
|
804
|
-
"#00CC00",
|
|
805
|
-
"#00CC33",
|
|
806
|
-
"#00CC66",
|
|
807
|
-
"#00CC99",
|
|
808
|
-
"#00CCCC",
|
|
809
|
-
"#00CCFF",
|
|
810
|
-
"#3300CC",
|
|
811
|
-
"#3300FF",
|
|
812
|
-
"#3333CC",
|
|
813
|
-
"#3333FF",
|
|
814
|
-
"#3366CC",
|
|
815
|
-
"#3366FF",
|
|
816
|
-
"#3399CC",
|
|
817
|
-
"#3399FF",
|
|
818
|
-
"#33CC00",
|
|
819
|
-
"#33CC33",
|
|
820
|
-
"#33CC66",
|
|
821
|
-
"#33CC99",
|
|
822
|
-
"#33CCCC",
|
|
823
|
-
"#33CCFF",
|
|
824
|
-
"#6600CC",
|
|
825
|
-
"#6600FF",
|
|
826
|
-
"#6633CC",
|
|
827
|
-
"#6633FF",
|
|
828
|
-
"#66CC00",
|
|
829
|
-
"#66CC33",
|
|
830
|
-
"#9900CC",
|
|
831
|
-
"#9900FF",
|
|
832
|
-
"#9933CC",
|
|
833
|
-
"#9933FF",
|
|
834
|
-
"#99CC00",
|
|
835
|
-
"#99CC33",
|
|
836
|
-
"#CC0000",
|
|
837
|
-
"#CC0033",
|
|
838
|
-
"#CC0066",
|
|
839
|
-
"#CC0099",
|
|
840
|
-
"#CC00CC",
|
|
841
|
-
"#CC00FF",
|
|
842
|
-
"#CC3300",
|
|
843
|
-
"#CC3333",
|
|
844
|
-
"#CC3366",
|
|
845
|
-
"#CC3399",
|
|
846
|
-
"#CC33CC",
|
|
847
|
-
"#CC33FF",
|
|
848
|
-
"#CC6600",
|
|
849
|
-
"#CC6633",
|
|
850
|
-
"#CC9900",
|
|
851
|
-
"#CC9933",
|
|
852
|
-
"#CCCC00",
|
|
853
|
-
"#CCCC33",
|
|
854
|
-
"#FF0000",
|
|
855
|
-
"#FF0033",
|
|
856
|
-
"#FF0066",
|
|
857
|
-
"#FF0099",
|
|
858
|
-
"#FF00CC",
|
|
859
|
-
"#FF00FF",
|
|
860
|
-
"#FF3300",
|
|
861
|
-
"#FF3333",
|
|
862
|
-
"#FF3366",
|
|
863
|
-
"#FF3399",
|
|
864
|
-
"#FF33CC",
|
|
865
|
-
"#FF33FF",
|
|
866
|
-
"#FF6600",
|
|
867
|
-
"#FF6633",
|
|
868
|
-
"#FF9900",
|
|
869
|
-
"#FF9933",
|
|
870
|
-
"#FFCC00",
|
|
871
|
-
"#FFCC33"
|
|
872
|
-
];
|
|
873
|
-
function useColors() {
|
|
874
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
875
|
-
return true;
|
|
876
|
-
}
|
|
877
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
878
|
-
return false;
|
|
879
|
-
}
|
|
880
|
-
let m;
|
|
881
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
882
|
-
}
|
|
883
|
-
function formatArgs(args) {
|
|
884
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
885
|
-
if (!this.useColors) {
|
|
886
|
-
return;
|
|
887
|
-
}
|
|
888
|
-
const c = "color: " + this.color;
|
|
889
|
-
args.splice(1, 0, c, "color: inherit");
|
|
890
|
-
let index = 0;
|
|
891
|
-
let lastC = 0;
|
|
892
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
893
|
-
if (match === "%%") {
|
|
894
|
-
return;
|
|
895
|
-
}
|
|
896
|
-
index++;
|
|
897
|
-
if (match === "%c") {
|
|
898
|
-
lastC = index;
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
args.splice(lastC, 0, c);
|
|
902
|
-
}
|
|
903
|
-
exports.log = console.debug || console.log || (() => {});
|
|
904
|
-
function save(namespaces) {
|
|
905
|
-
try {
|
|
906
|
-
if (namespaces) {
|
|
907
|
-
exports.storage.setItem("debug", namespaces);
|
|
908
|
-
} else {
|
|
909
|
-
exports.storage.removeItem("debug");
|
|
910
|
-
}
|
|
911
|
-
} catch (error) {}
|
|
912
|
-
}
|
|
913
|
-
function load() {
|
|
914
|
-
let r;
|
|
915
|
-
try {
|
|
916
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
917
|
-
} catch (error) {}
|
|
918
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
919
|
-
r = process.env.DEBUG;
|
|
920
|
-
}
|
|
921
|
-
return r;
|
|
922
|
-
}
|
|
923
|
-
function localstorage() {
|
|
924
|
-
try {
|
|
925
|
-
return localStorage;
|
|
926
|
-
} catch (error) {}
|
|
927
|
-
}
|
|
928
|
-
module.exports = require_common()(exports);
|
|
929
|
-
var { formatters } = module.exports;
|
|
930
|
-
formatters.j = function(v) {
|
|
931
|
-
try {
|
|
932
|
-
return JSON.stringify(v);
|
|
933
|
-
} catch (error) {
|
|
934
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
});
|
|
938
|
-
|
|
939
|
-
// ../../node_modules/has-flag/index.js
|
|
940
|
-
var require_has_flag = __commonJS((exports, module) => {
|
|
941
|
-
module.exports = (flag, argv = process.argv) => {
|
|
942
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
943
|
-
const position = argv.indexOf(prefix + flag);
|
|
944
|
-
const terminatorPosition = argv.indexOf("--");
|
|
945
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
946
|
-
};
|
|
947
|
-
});
|
|
948
|
-
|
|
949
|
-
// ../../node_modules/supports-color/index.js
|
|
950
|
-
var require_supports_color = __commonJS((exports, module) => {
|
|
951
|
-
var os = __require("os");
|
|
952
|
-
var tty = __require("tty");
|
|
953
|
-
var hasFlag = require_has_flag();
|
|
954
|
-
var { env } = process;
|
|
955
|
-
var flagForceColor;
|
|
956
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
957
|
-
flagForceColor = 0;
|
|
958
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
959
|
-
flagForceColor = 1;
|
|
960
|
-
}
|
|
961
|
-
function envForceColor() {
|
|
962
|
-
if ("FORCE_COLOR" in env) {
|
|
963
|
-
if (env.FORCE_COLOR === "true") {
|
|
964
|
-
return 1;
|
|
965
|
-
}
|
|
966
|
-
if (env.FORCE_COLOR === "false") {
|
|
967
|
-
return 0;
|
|
968
|
-
}
|
|
969
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
function translateLevel(level) {
|
|
973
|
-
if (level === 0) {
|
|
974
|
-
return false;
|
|
975
|
-
}
|
|
976
|
-
return {
|
|
977
|
-
level,
|
|
978
|
-
hasBasic: true,
|
|
979
|
-
has256: level >= 2,
|
|
980
|
-
has16m: level >= 3
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
984
|
-
const noFlagForceColor = envForceColor();
|
|
985
|
-
if (noFlagForceColor !== undefined) {
|
|
986
|
-
flagForceColor = noFlagForceColor;
|
|
987
|
-
}
|
|
988
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
989
|
-
if (forceColor === 0) {
|
|
990
|
-
return 0;
|
|
991
|
-
}
|
|
992
|
-
if (sniffFlags) {
|
|
993
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
994
|
-
return 3;
|
|
995
|
-
}
|
|
996
|
-
if (hasFlag("color=256")) {
|
|
997
|
-
return 2;
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
1001
|
-
return 0;
|
|
1002
|
-
}
|
|
1003
|
-
const min = forceColor || 0;
|
|
1004
|
-
if (env.TERM === "dumb") {
|
|
1005
|
-
return min;
|
|
1006
|
-
}
|
|
1007
|
-
if (process.platform === "win32") {
|
|
1008
|
-
const osRelease = os.release().split(".");
|
|
1009
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
1010
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1011
|
-
}
|
|
1012
|
-
return 1;
|
|
1013
|
-
}
|
|
1014
|
-
if ("CI" in env) {
|
|
1015
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
1016
|
-
return 1;
|
|
1017
|
-
}
|
|
1018
|
-
return min;
|
|
1019
|
-
}
|
|
1020
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
1021
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1022
|
-
}
|
|
1023
|
-
if (env.COLORTERM === "truecolor") {
|
|
1024
|
-
return 3;
|
|
1025
|
-
}
|
|
1026
|
-
if ("TERM_PROGRAM" in env) {
|
|
1027
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1028
|
-
switch (env.TERM_PROGRAM) {
|
|
1029
|
-
case "iTerm.app":
|
|
1030
|
-
return version >= 3 ? 3 : 2;
|
|
1031
|
-
case "Apple_Terminal":
|
|
1032
|
-
return 2;
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
1036
|
-
return 2;
|
|
1037
|
-
}
|
|
1038
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
1039
|
-
return 1;
|
|
1040
|
-
}
|
|
1041
|
-
if ("COLORTERM" in env) {
|
|
1042
|
-
return 1;
|
|
1043
|
-
}
|
|
1044
|
-
return min;
|
|
1045
|
-
}
|
|
1046
|
-
function getSupportLevel(stream, options = {}) {
|
|
1047
|
-
const level = supportsColor(stream, {
|
|
1048
|
-
streamIsTTY: stream && stream.isTTY,
|
|
1049
|
-
...options
|
|
1050
|
-
});
|
|
1051
|
-
return translateLevel(level);
|
|
1052
|
-
}
|
|
1053
|
-
module.exports = {
|
|
1054
|
-
supportsColor: getSupportLevel,
|
|
1055
|
-
stdout: getSupportLevel({ isTTY: tty.isatty(1) }),
|
|
1056
|
-
stderr: getSupportLevel({ isTTY: tty.isatty(2) })
|
|
1057
|
-
};
|
|
1058
|
-
});
|
|
1059
|
-
|
|
1060
|
-
// ../../node_modules/debug/src/node.js
|
|
1061
|
-
var require_node = __commonJS((exports, module) => {
|
|
1062
|
-
var tty = __require("tty");
|
|
1063
|
-
var util = __require("util");
|
|
1064
|
-
exports.init = init;
|
|
1065
|
-
exports.log = log;
|
|
1066
|
-
exports.formatArgs = formatArgs;
|
|
1067
|
-
exports.save = save;
|
|
1068
|
-
exports.load = load;
|
|
1069
|
-
exports.useColors = useColors;
|
|
1070
|
-
exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
1071
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
1072
|
-
try {
|
|
1073
|
-
const supportsColor = require_supports_color();
|
|
1074
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
1075
|
-
exports.colors = [
|
|
1076
|
-
20,
|
|
1077
|
-
21,
|
|
1078
|
-
26,
|
|
1079
|
-
27,
|
|
1080
|
-
32,
|
|
1081
|
-
33,
|
|
1082
|
-
38,
|
|
1083
|
-
39,
|
|
1084
|
-
40,
|
|
1085
|
-
41,
|
|
1086
|
-
42,
|
|
1087
|
-
43,
|
|
1088
|
-
44,
|
|
1089
|
-
45,
|
|
1090
|
-
56,
|
|
1091
|
-
57,
|
|
1092
|
-
62,
|
|
1093
|
-
63,
|
|
1094
|
-
68,
|
|
1095
|
-
69,
|
|
1096
|
-
74,
|
|
1097
|
-
75,
|
|
1098
|
-
76,
|
|
1099
|
-
77,
|
|
1100
|
-
78,
|
|
1101
|
-
79,
|
|
1102
|
-
80,
|
|
1103
|
-
81,
|
|
1104
|
-
92,
|
|
1105
|
-
93,
|
|
1106
|
-
98,
|
|
1107
|
-
99,
|
|
1108
|
-
112,
|
|
1109
|
-
113,
|
|
1110
|
-
128,
|
|
1111
|
-
129,
|
|
1112
|
-
134,
|
|
1113
|
-
135,
|
|
1114
|
-
148,
|
|
1115
|
-
149,
|
|
1116
|
-
160,
|
|
1117
|
-
161,
|
|
1118
|
-
162,
|
|
1119
|
-
163,
|
|
1120
|
-
164,
|
|
1121
|
-
165,
|
|
1122
|
-
166,
|
|
1123
|
-
167,
|
|
1124
|
-
168,
|
|
1125
|
-
169,
|
|
1126
|
-
170,
|
|
1127
|
-
171,
|
|
1128
|
-
172,
|
|
1129
|
-
173,
|
|
1130
|
-
178,
|
|
1131
|
-
179,
|
|
1132
|
-
184,
|
|
1133
|
-
185,
|
|
1134
|
-
196,
|
|
1135
|
-
197,
|
|
1136
|
-
198,
|
|
1137
|
-
199,
|
|
1138
|
-
200,
|
|
1139
|
-
201,
|
|
1140
|
-
202,
|
|
1141
|
-
203,
|
|
1142
|
-
204,
|
|
1143
|
-
205,
|
|
1144
|
-
206,
|
|
1145
|
-
207,
|
|
1146
|
-
208,
|
|
1147
|
-
209,
|
|
1148
|
-
214,
|
|
1149
|
-
215,
|
|
1150
|
-
220,
|
|
1151
|
-
221
|
|
1152
|
-
];
|
|
1153
|
-
}
|
|
1154
|
-
} catch (error) {}
|
|
1155
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
1156
|
-
return /^debug_/i.test(key);
|
|
1157
|
-
}).reduce((obj, key) => {
|
|
1158
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
1159
|
-
return k.toUpperCase();
|
|
1160
|
-
});
|
|
1161
|
-
let val = process.env[key];
|
|
1162
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
1163
|
-
val = true;
|
|
1164
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
1165
|
-
val = false;
|
|
1166
|
-
} else if (val === "null") {
|
|
1167
|
-
val = null;
|
|
1168
|
-
} else {
|
|
1169
|
-
val = Number(val);
|
|
1170
|
-
}
|
|
1171
|
-
obj[prop] = val;
|
|
1172
|
-
return obj;
|
|
1173
|
-
}, {});
|
|
1174
|
-
function useColors() {
|
|
1175
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
1176
|
-
}
|
|
1177
|
-
function formatArgs(args) {
|
|
1178
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
1179
|
-
if (useColors2) {
|
|
1180
|
-
const c = this.color;
|
|
1181
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
1182
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
1183
|
-
args[0] = prefix + args[0].split(`
|
|
1184
|
-
`).join(`
|
|
1185
|
-
` + prefix);
|
|
1186
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
1187
|
-
} else {
|
|
1188
|
-
args[0] = getDate() + name + " " + args[0];
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
function getDate() {
|
|
1192
|
-
if (exports.inspectOpts.hideDate) {
|
|
1193
|
-
return "";
|
|
1194
|
-
}
|
|
1195
|
-
return new Date().toISOString() + " ";
|
|
1196
|
-
}
|
|
1197
|
-
function log(...args) {
|
|
1198
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + `
|
|
1199
|
-
`);
|
|
1200
|
-
}
|
|
1201
|
-
function save(namespaces) {
|
|
1202
|
-
if (namespaces) {
|
|
1203
|
-
process.env.DEBUG = namespaces;
|
|
1204
|
-
} else {
|
|
1205
|
-
delete process.env.DEBUG;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
function load() {
|
|
1209
|
-
return process.env.DEBUG;
|
|
1210
|
-
}
|
|
1211
|
-
function init(debug) {
|
|
1212
|
-
debug.inspectOpts = {};
|
|
1213
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
1214
|
-
for (let i = 0;i < keys.length; i++) {
|
|
1215
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
module.exports = require_common()(exports);
|
|
1219
|
-
var { formatters } = module.exports;
|
|
1220
|
-
formatters.o = function(v) {
|
|
1221
|
-
this.inspectOpts.colors = this.useColors;
|
|
1222
|
-
return util.inspect(v, this.inspectOpts).split(`
|
|
1223
|
-
`).map((str) => str.trim()).join(" ");
|
|
1224
|
-
};
|
|
1225
|
-
formatters.O = function(v) {
|
|
1226
|
-
this.inspectOpts.colors = this.useColors;
|
|
1227
|
-
return util.inspect(v, this.inspectOpts);
|
|
1228
|
-
};
|
|
1229
|
-
});
|
|
1230
|
-
|
|
1231
|
-
// ../../node_modules/debug/src/index.js
|
|
1232
|
-
var require_src = __commonJS((exports, module) => {
|
|
1233
|
-
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
1234
|
-
module.exports = require_browser();
|
|
1235
|
-
} else {
|
|
1236
|
-
module.exports = require_node();
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1239
|
-
|
|
1240
494
|
// src/octal-hack.js
|
|
1241
495
|
var require_octal_hack = __commonJS((exports, module) => {
|
|
1242
496
|
module.exports = (content) => {
|
|
@@ -1250,7 +504,6 @@ import net from "node:net";
|
|
|
1250
504
|
import tls from "node:tls";
|
|
1251
505
|
|
|
1252
506
|
// ../irc2as/src/index.js
|
|
1253
|
-
var import_debug = __toESM(require_src(), 1);
|
|
1254
507
|
import events from "node:events";
|
|
1255
508
|
|
|
1256
509
|
// ../irc2as/src/as-emitter.js
|
|
@@ -1514,7 +767,6 @@ class ASEmitter {
|
|
|
1514
767
|
}
|
|
1515
768
|
|
|
1516
769
|
// ../irc2as/src/index.js
|
|
1517
|
-
var log = import_debug.default("irc2as");
|
|
1518
770
|
var EVENT_INCOMING2 = "incoming";
|
|
1519
771
|
var EVENT_PONG = "pong";
|
|
1520
772
|
var EVENT_PING = "ping";
|
|
@@ -1572,13 +824,10 @@ class IrcToActivityStreams {
|
|
|
1572
824
|
this.__buffer[NAMES] = {};
|
|
1573
825
|
}
|
|
1574
826
|
input(payload) {
|
|
1575
|
-
log(payload);
|
|
1576
827
|
if (typeof payload !== "string") {
|
|
1577
|
-
log("unable to process incoming message as it was not a string.");
|
|
1578
828
|
return false;
|
|
1579
829
|
}
|
|
1580
830
|
if (payload.length < 3) {
|
|
1581
|
-
log("unable to process incoming string, length smaller than 3.");
|
|
1582
831
|
return false;
|
|
1583
832
|
}
|
|
1584
833
|
const incoming = payload.trim();
|
|
@@ -1589,7 +838,6 @@ class IrcToActivityStreams {
|
|
|
1589
838
|
this.events.emit(EVENT_PING, `${Date.now()}`);
|
|
1590
839
|
return true;
|
|
1591
840
|
}
|
|
1592
|
-
log(`[${code}] server: ${server} channel: ${channel} 1: ${pos1}, 2: ${pos2}, 3: ${pos3}. content: `, content);
|
|
1593
841
|
this.__processIRCCodes(code, server, channel, pos1, pos2, pos3, content, msg, incoming);
|
|
1594
842
|
}
|
|
1595
843
|
__processIRCCodes(code, server, channel, pos1, pos2, pos3, content, msg, incoming) {
|
|
@@ -1745,7 +993,7 @@ class IrcToActivityStreams {
|
|
|
1745
993
|
var package_default = {
|
|
1746
994
|
name: "@sockethub/platform-irc",
|
|
1747
995
|
description: "A sockethub platform module implementing IRC functionality",
|
|
1748
|
-
version: "4.0.0-alpha.
|
|
996
|
+
version: "4.0.0-alpha.11",
|
|
1749
997
|
private: false,
|
|
1750
998
|
author: "Nick Jennings <nick@silverbucket.net>",
|
|
1751
999
|
license: "LGPL-3.0+",
|
|
@@ -1783,26 +1031,27 @@ var package_default = {
|
|
|
1783
1031
|
scripts: {
|
|
1784
1032
|
build: "bun build src/index.ts --outdir dist --target node --format esm --sourcemap=external",
|
|
1785
1033
|
clean: "rm -rf dist",
|
|
1034
|
+
"clean:deps": "rm -rf node_modules",
|
|
1786
1035
|
doc: "typedoc --options typedoc.json"
|
|
1787
1036
|
},
|
|
1788
1037
|
dependencies: {
|
|
1789
|
-
"@sockethub/irc2as": "^4.0.0-alpha.
|
|
1038
|
+
"@sockethub/irc2as": "^4.0.0-alpha.11",
|
|
1790
1039
|
"irc-socket-sasl": "^4.0.0"
|
|
1791
1040
|
},
|
|
1792
1041
|
devDependencies: {
|
|
1793
|
-
"@sockethub/schemas": "^3.0.0-alpha.
|
|
1042
|
+
"@sockethub/schemas": "^3.0.0-alpha.11",
|
|
1794
1043
|
"@types/bun": "latest",
|
|
1795
1044
|
typedoc: "^0.28.14"
|
|
1796
1045
|
},
|
|
1797
1046
|
peerDependencies: {
|
|
1798
|
-
"@sockethub/server": "^5.0.0-alpha.
|
|
1047
|
+
"@sockethub/server": "^5.0.0-alpha.11"
|
|
1799
1048
|
},
|
|
1800
1049
|
peerDependenciesMeta: {
|
|
1801
1050
|
"@sockethub/server": {
|
|
1802
1051
|
optional: true
|
|
1803
1052
|
}
|
|
1804
1053
|
},
|
|
1805
|
-
gitHead: "
|
|
1054
|
+
gitHead: "f7fb4fa2599da1def438c710ce81a41b6cfee8a7"
|
|
1806
1055
|
};
|
|
1807
1056
|
|
|
1808
1057
|
// src/schema.ts
|
|
@@ -1871,12 +1120,11 @@ var PlatformIrcSchema = {
|
|
|
1871
1120
|
|
|
1872
1121
|
// src/index.ts
|
|
1873
1122
|
class IRC {
|
|
1874
|
-
|
|
1123
|
+
log;
|
|
1875
1124
|
credentialsHash;
|
|
1876
1125
|
config = {
|
|
1877
1126
|
persist: true,
|
|
1878
1127
|
requireCredentials: ["connect", "update"],
|
|
1879
|
-
initialized: false,
|
|
1880
1128
|
connectTimeoutMs: 30000
|
|
1881
1129
|
};
|
|
1882
1130
|
updateActor;
|
|
@@ -1884,18 +1132,22 @@ class IRC {
|
|
|
1884
1132
|
irc2as;
|
|
1885
1133
|
forceDisconnect = false;
|
|
1886
1134
|
clientConnecting = false;
|
|
1135
|
+
initialized = false;
|
|
1887
1136
|
client;
|
|
1888
1137
|
jobQueue = [];
|
|
1889
1138
|
channels = new Set;
|
|
1890
1139
|
handledActors = new Set;
|
|
1891
1140
|
constructor(session) {
|
|
1892
|
-
this.
|
|
1141
|
+
this.log = session.log;
|
|
1893
1142
|
this.sendToClient = session.sendToClient;
|
|
1894
1143
|
this.updateActor = session.updateActor;
|
|
1895
1144
|
}
|
|
1896
1145
|
get schema() {
|
|
1897
1146
|
return PlatformIrcSchema;
|
|
1898
1147
|
}
|
|
1148
|
+
isInitialized() {
|
|
1149
|
+
return this.initialized;
|
|
1150
|
+
}
|
|
1899
1151
|
connect(job, credentials, done) {
|
|
1900
1152
|
this.getClient(job.actor.id, credentials, (err) => {
|
|
1901
1153
|
if (err) {
|
|
@@ -1905,26 +1157,26 @@ class IRC {
|
|
|
1905
1157
|
});
|
|
1906
1158
|
}
|
|
1907
1159
|
join(job, done) {
|
|
1908
|
-
this.debug(`join() called for ${job.actor.id}`);
|
|
1160
|
+
this.log.debug(`join() called for ${job.actor.id}`);
|
|
1909
1161
|
this.getClient(job.actor.id, false, (err, client) => {
|
|
1910
1162
|
if (err) {
|
|
1911
1163
|
return done(err);
|
|
1912
1164
|
}
|
|
1913
1165
|
if (this.channels.has(job.target.name)) {
|
|
1914
|
-
this.debug(`channel ${job.target.name} already joined`);
|
|
1166
|
+
this.log.debug(`channel ${job.target.name} already joined`);
|
|
1915
1167
|
return done();
|
|
1916
1168
|
}
|
|
1917
1169
|
this.jobQueue.push(() => {
|
|
1918
1170
|
this.hasJoined(job.target.name);
|
|
1919
1171
|
done();
|
|
1920
1172
|
});
|
|
1921
|
-
this.debug(`sending join ${job.target.name}`);
|
|
1173
|
+
this.log.debug(`sending join ${job.target.name}`);
|
|
1922
1174
|
client.raw(["JOIN", job.target.name]);
|
|
1923
1175
|
client.raw(`PING ${job.actor.name}`);
|
|
1924
1176
|
});
|
|
1925
1177
|
}
|
|
1926
1178
|
leave(job, done) {
|
|
1927
|
-
this.debug(`leave() called for ${job.actor.name}`);
|
|
1179
|
+
this.log.debug(`leave() called for ${job.actor.name}`);
|
|
1928
1180
|
this.getClient(job.actor.id, false, (err, client) => {
|
|
1929
1181
|
if (err) {
|
|
1930
1182
|
return done(err);
|
|
@@ -1935,7 +1187,7 @@ class IRC {
|
|
|
1935
1187
|
});
|
|
1936
1188
|
}
|
|
1937
1189
|
send(job, done) {
|
|
1938
|
-
this.debug(`send() called for ${job.actor.id} target: ${job.target.id}`);
|
|
1190
|
+
this.log.debug(`send() called for ${job.actor.id} target: ${job.target.id}`);
|
|
1939
1191
|
this.getClient(job.actor.id, false, async (err, client) => {
|
|
1940
1192
|
if (err) {
|
|
1941
1193
|
return done(err);
|
|
@@ -1975,13 +1227,13 @@ class IRC {
|
|
|
1975
1227
|
});
|
|
1976
1228
|
}
|
|
1977
1229
|
update(job, credentials, done) {
|
|
1978
|
-
this.debug(`update() called for ${job.actor.id}`);
|
|
1230
|
+
this.log.debug(`update() called for ${job.actor.id}`);
|
|
1979
1231
|
this.getClient(job.actor.id, false, (err, client) => {
|
|
1980
1232
|
if (err) {
|
|
1981
1233
|
return done(err);
|
|
1982
1234
|
}
|
|
1983
1235
|
if (job.object.type === "address") {
|
|
1984
|
-
this.debug(`changing nick from ${job.actor.name} to ${job.target.name}`);
|
|
1236
|
+
this.log.debug(`changing nick from ${job.actor.name} to ${job.target.name}`);
|
|
1985
1237
|
this.handledActors.add(job.target.id);
|
|
1986
1238
|
this.jobQueue.push(async (err2) => {
|
|
1987
1239
|
if (err2) {
|
|
@@ -1996,7 +1248,7 @@ class IRC {
|
|
|
1996
1248
|
});
|
|
1997
1249
|
client.raw(["NICK", job.target.name]);
|
|
1998
1250
|
} else if (job.object.type === "topic") {
|
|
1999
|
-
this.debug(`changing topic in channel ${job.target.name}`);
|
|
1251
|
+
this.log.debug(`changing topic in channel ${job.target.name}`);
|
|
2000
1252
|
this.jobQueue.push(done);
|
|
2001
1253
|
client.raw(["topic", job.target.name, job.object.content]);
|
|
2002
1254
|
} else {
|
|
@@ -2006,13 +1258,13 @@ class IRC {
|
|
|
2006
1258
|
});
|
|
2007
1259
|
}
|
|
2008
1260
|
query(job, done) {
|
|
2009
|
-
this.debug(`query() called for ${job.actor.id}`);
|
|
1261
|
+
this.log.debug(`query() called for ${job.actor.id}`);
|
|
2010
1262
|
this.getClient(job.actor.id, false, (err, client) => {
|
|
2011
1263
|
if (err) {
|
|
2012
1264
|
return done(err);
|
|
2013
1265
|
}
|
|
2014
1266
|
if (job.object.type === "attendance") {
|
|
2015
|
-
this.debug(`query() - sending NAMES for ${job.target.name}`);
|
|
1267
|
+
this.log.debug(`query() - sending NAMES for ${job.target.name}`);
|
|
2016
1268
|
client.raw(["NAMES", job.target.name]);
|
|
2017
1269
|
done();
|
|
2018
1270
|
} else {
|
|
@@ -2021,12 +1273,12 @@ class IRC {
|
|
|
2021
1273
|
});
|
|
2022
1274
|
}
|
|
2023
1275
|
disconnect(job, done) {
|
|
2024
|
-
this.debug(`disconnect called for ${job.actor.id}`);
|
|
1276
|
+
this.log.debug(`disconnect called for ${job.actor.id}`);
|
|
2025
1277
|
this.cleanup(done);
|
|
2026
1278
|
}
|
|
2027
1279
|
cleanup(done) {
|
|
2028
|
-
this.debug("cleanup() called");
|
|
2029
|
-
this.
|
|
1280
|
+
this.log.debug("cleanup() called");
|
|
1281
|
+
this.initialized = false;
|
|
2030
1282
|
this.forceDisconnect = true;
|
|
2031
1283
|
if (typeof this.client === "object") {
|
|
2032
1284
|
if (typeof this.client.end === "function") {
|
|
@@ -2043,19 +1295,19 @@ class IRC {
|
|
|
2043
1295
|
return true;
|
|
2044
1296
|
}
|
|
2045
1297
|
hasJoined(channel) {
|
|
2046
|
-
this.debug(`joined ${channel}`);
|
|
1298
|
+
this.log.debug(`joined ${channel}`);
|
|
2047
1299
|
if (!this.channels.has(channel)) {
|
|
2048
1300
|
this.channels.add(channel);
|
|
2049
1301
|
}
|
|
2050
1302
|
}
|
|
2051
1303
|
hasLeft(channel) {
|
|
2052
|
-
this.debug(`left ${channel}`);
|
|
1304
|
+
this.log.debug(`left ${channel}`);
|
|
2053
1305
|
if (this.channels.has(channel)) {
|
|
2054
1306
|
this.channels.delete(channel);
|
|
2055
1307
|
}
|
|
2056
1308
|
}
|
|
2057
1309
|
getClient(key, credentials, cb) {
|
|
2058
|
-
this.debug(`getClient called, connecting: ${this.clientConnecting}`);
|
|
1310
|
+
this.log.debug(`getClient called, connecting: ${this.clientConnecting}`);
|
|
2059
1311
|
if (this.client) {
|
|
2060
1312
|
this.handledActors.add(key);
|
|
2061
1313
|
return cb(null, this.client);
|
|
@@ -2063,7 +1315,7 @@ class IRC {
|
|
|
2063
1315
|
if (this.clientConnecting) {
|
|
2064
1316
|
setTimeout(() => {
|
|
2065
1317
|
if (this.client) {
|
|
2066
|
-
this.debug(`resolving delayed getClient call for ${key}`);
|
|
1318
|
+
this.log.debug(`resolving delayed getClient call for ${key}`);
|
|
2067
1319
|
this.handledActors.add(key);
|
|
2068
1320
|
return cb(null, this.client);
|
|
2069
1321
|
}
|
|
@@ -2076,13 +1328,13 @@ class IRC {
|
|
|
2076
1328
|
}
|
|
2077
1329
|
this.ircConnect(credentials, (err, client) => {
|
|
2078
1330
|
if (err) {
|
|
2079
|
-
this.
|
|
1331
|
+
this.initialized = false;
|
|
2080
1332
|
return cb(err);
|
|
2081
1333
|
}
|
|
2082
1334
|
this.handledActors.add(key);
|
|
2083
1335
|
this.client = client;
|
|
2084
1336
|
this.registerListeners(credentials.object.server);
|
|
2085
|
-
this.
|
|
1337
|
+
this.initialized = true;
|
|
2086
1338
|
return cb(null, client);
|
|
2087
1339
|
});
|
|
2088
1340
|
}
|
|
@@ -2105,7 +1357,7 @@ class IRC {
|
|
|
2105
1357
|
module_options.saslPassword = credentials.object.password;
|
|
2106
1358
|
module_options.capabilities = { requires: ["sasl"] };
|
|
2107
1359
|
}
|
|
2108
|
-
this.debug(`attempting to connect to ${module_options.server}:${module_options.port} transport: ${is_secure ? "secure" : "clear"} sasl: ${is_sasl}`);
|
|
1360
|
+
this.log.debug(`attempting to connect to ${module_options.server}:${module_options.port} transport: ${is_secure ? "secure" : "clear"} sasl: ${is_sasl}`);
|
|
2109
1361
|
const client = new import_irc_socket_sasl.default(module_options, is_secure ? tls : net);
|
|
2110
1362
|
const forceDisconnect = (err) => {
|
|
2111
1363
|
this.forceDisconnect = true;
|
|
@@ -2119,15 +1371,15 @@ class IRC {
|
|
|
2119
1371
|
cb(err);
|
|
2120
1372
|
};
|
|
2121
1373
|
client.once("error", (err) => {
|
|
2122
|
-
this.debug(`irc client 'error' occurred. `, err);
|
|
1374
|
+
this.log.debug(`irc client 'error' occurred. `, err);
|
|
2123
1375
|
forceDisconnect("error connecting to server.");
|
|
2124
1376
|
});
|
|
2125
1377
|
client.once("close", () => {
|
|
2126
|
-
this.debug(`irc client 'close' event fired.`);
|
|
1378
|
+
this.log.debug(`irc client 'close' event fired.`);
|
|
2127
1379
|
forceDisconnect("connection to server closed.");
|
|
2128
1380
|
});
|
|
2129
1381
|
client.once("timeout", () => {
|
|
2130
|
-
this.debug("timeout occurred, force-disconnect");
|
|
1382
|
+
this.log.debug("timeout occurred, force-disconnect");
|
|
2131
1383
|
forceDisconnect("connection timeout to server.");
|
|
2132
1384
|
});
|
|
2133
1385
|
client.connect().then((res) => {
|
|
@@ -2140,19 +1392,19 @@ class IRC {
|
|
|
2140
1392
|
client.end();
|
|
2141
1393
|
return cb("force disconnect active, aborting connect.");
|
|
2142
1394
|
}
|
|
2143
|
-
this.debug(`connected to ${module_options.server} capabilities: `, capabilities);
|
|
1395
|
+
this.log.debug(`connected to ${module_options.server} capabilities: `, capabilities);
|
|
2144
1396
|
return cb(null, client);
|
|
2145
1397
|
});
|
|
2146
1398
|
}
|
|
2147
1399
|
completeJob(err) {
|
|
2148
|
-
this.debug(`completing job, queue count: ${this.jobQueue.length}`);
|
|
1400
|
+
this.log.debug(`completing job, queue count: ${this.jobQueue.length}`);
|
|
2149
1401
|
const done = this.jobQueue.shift();
|
|
2150
1402
|
if (typeof done === "function") {
|
|
2151
1403
|
done(err);
|
|
2152
1404
|
} else if (this.jobQueue.length === 0) {
|
|
2153
|
-
this.debug("WARNING: job completion event received with an empty job queue.");
|
|
1405
|
+
this.log.debug("WARNING: job completion event received with an empty job queue.");
|
|
2154
1406
|
} else {
|
|
2155
|
-
this.debug(`WARNING: job completion found non-function in queue (${typeof done}), ${this.jobQueue.length} items remain.`);
|
|
1407
|
+
this.log.debug(`WARNING: job completion found non-function in queue (${typeof done}), ${this.jobQueue.length} items remain.`);
|
|
2156
1408
|
}
|
|
2157
1409
|
}
|
|
2158
1410
|
registerListeners(server) {
|
|
@@ -2164,25 +1416,23 @@ class IRC {
|
|
|
2164
1416
|
if (typeof asObject.actor === "object" && typeof asObject.actor.name === "string" && this.handledActors.has(asObject.actor.id)) {
|
|
2165
1417
|
this.completeJob();
|
|
2166
1418
|
} else {
|
|
2167
|
-
this.debug(`calling sendToClient for ${asObject.actor.id}`, [
|
|
2168
|
-
...this.handledActors.keys()
|
|
2169
|
-
]);
|
|
1419
|
+
this.log.debug(`calling sendToClient for ${asObject.actor.id}`, [...this.handledActors.keys()]);
|
|
2170
1420
|
this.sendToClient(asObject);
|
|
2171
1421
|
}
|
|
2172
1422
|
});
|
|
2173
1423
|
this.irc2as.events.on("unprocessed", (s) => {
|
|
2174
|
-
this.debug(`unprocessed irc message:> ${s}`);
|
|
1424
|
+
this.log.debug(`unprocessed irc message:> ${s}`);
|
|
2175
1425
|
});
|
|
2176
1426
|
this.irc2as.events.on("error", (asObject) => {
|
|
2177
|
-
this.debug(`message error response ${asObject.object.content}`);
|
|
1427
|
+
this.log.debug(`message error response ${asObject.object.content}`);
|
|
2178
1428
|
this.completeJob(asObject.object.content);
|
|
2179
1429
|
});
|
|
2180
1430
|
this.irc2as.events.on("pong", (timestamp) => {
|
|
2181
|
-
this.debug(`received PONG at ${timestamp}`);
|
|
1431
|
+
this.log.debug(`received PONG at ${timestamp}`);
|
|
2182
1432
|
this.completeJob();
|
|
2183
1433
|
});
|
|
2184
1434
|
this.irc2as.events.on("ping", (timestamp) => {
|
|
2185
|
-
this.debug(`received PING at ${timestamp}`);
|
|
1435
|
+
this.log.debug(`received PING at ${timestamp}`);
|
|
2186
1436
|
this.client.raw("PONG");
|
|
2187
1437
|
});
|
|
2188
1438
|
}
|
|
@@ -2191,4 +1441,4 @@ export {
|
|
|
2191
1441
|
IRC as default
|
|
2192
1442
|
};
|
|
2193
1443
|
|
|
2194
|
-
//# debugId=
|
|
1444
|
+
//# debugId=E3813C8FABB6857464756E2164756E21
|