@zenflux/core 0.0.0-alpha.5 → 0.0.0-alpha.7
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/cjs/zenflux-core.js +58 -147
- package/dist/es/{src/clients → clients}/http.d.ts +1 -0
- package/dist/es/clients/http.d.ts.map +1 -0
- package/dist/es/{src/command-bases → command-bases}/command-base.d.ts +1 -0
- package/dist/es/command-bases/command-base.d.ts.map +1 -0
- package/dist/es/{src/command-bases → command-bases}/command-data.d.ts +1 -0
- package/dist/es/command-bases/command-data.d.ts.map +1 -0
- package/dist/es/{src/command-bases → command-bases}/command-internal.d.ts +1 -0
- package/dist/es/command-bases/command-internal.d.ts.map +1 -0
- package/dist/es/{src/command-bases → command-bases}/command-public.d.ts +1 -0
- package/dist/es/command-bases/command-public.d.ts.map +1 -0
- package/dist/es/{src/command-bases → command-bases}/index.d.ts +1 -0
- package/dist/es/command-bases/index.d.ts.map +1 -0
- package/dist/es/{src/core → core}/controller.d.ts +1 -0
- package/dist/es/core/controller.d.ts.map +1 -0
- package/dist/es/{src/core → core}/index.d.ts +1 -0
- package/dist/es/core/index.d.ts.map +1 -0
- package/dist/es/{src/core → core}/object-base.d.ts +1 -0
- package/dist/es/core/object-base.d.ts.map +1 -0
- package/dist/es/{src/enums → enums}/http.d.ts +1 -0
- package/dist/es/enums/http.d.ts.map +1 -0
- package/dist/es/{src/errors → errors}/command-already-registered.d.ts +1 -0
- package/dist/es/errors/command-already-registered.d.ts.map +1 -0
- package/dist/es/{src/errors → errors}/command-not-found.d.ts +1 -0
- package/dist/es/errors/command-not-found.d.ts.map +1 -0
- package/dist/es/{src/errors → errors}/controller-already-registered.d.ts +1 -0
- package/dist/es/errors/controller-already-registered.d.ts.map +1 -0
- package/dist/es/{src/errors → errors}/force-method.d.ts +1 -0
- package/dist/es/errors/force-method.d.ts.map +1 -0
- package/dist/es/{src/errors → errors}/index.d.ts +1 -0
- package/dist/es/errors/index.d.ts.map +1 -0
- package/dist/es/{src/exports.d.ts → exports.d.ts} +1 -0
- package/dist/es/exports.d.ts.map +1 -0
- package/dist/es/{src/index.d.ts → index.d.ts} +1 -0
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/{src/initializer.d.ts → initializer.d.ts} +1 -0
- package/dist/es/initializer.d.ts.map +1 -0
- package/dist/es/{src/interfaces → interfaces}/commands.d.ts +1 -0
- package/dist/es/interfaces/commands.d.ts.map +1 -0
- package/dist/es/{src/interfaces → interfaces}/config.d.ts +1 -0
- package/dist/es/interfaces/config.d.ts.map +1 -0
- package/dist/es/{src/interfaces → interfaces}/managers.d.ts +1 -0
- package/dist/es/interfaces/managers.d.ts.map +1 -0
- package/dist/es/{src/interfaces → interfaces}/object-base.d.ts +1 -0
- package/dist/es/interfaces/object-base.d.ts.map +1 -0
- package/dist/es/{src/manager-bases → manager-bases}/commands.d.ts +1 -0
- package/dist/es/manager-bases/commands.d.ts.map +1 -0
- package/dist/es/{src/manager-bases → manager-bases}/controllers.d.ts +1 -0
- package/dist/es/manager-bases/controllers.d.ts.map +1 -0
- package/dist/es/{src/manager-bases → manager-bases}/data.d.ts +1 -0
- package/dist/es/manager-bases/data.d.ts.map +1 -0
- package/dist/es/{src/manager-bases → manager-bases}/index.d.ts +1 -0
- package/dist/es/manager-bases/index.d.ts.map +1 -0
- package/dist/es/{src/manager-bases → manager-bases}/internal.d.ts +1 -0
- package/dist/es/manager-bases/internal.d.ts.map +1 -0
- package/dist/es/{src/managers → managers}/index.d.ts +1 -0
- package/dist/es/managers/index.d.ts.map +1 -0
- package/dist/es/{src/modules → modules}/index.d.ts +1 -0
- package/dist/es/modules/index.d.ts.map +1 -0
- package/dist/es/{src/modules → modules}/logger.d.ts +1 -0
- package/dist/es/modules/logger.d.ts.map +1 -0
- package/dist/es/{src/utils → utils}/index.d.ts +1 -0
- package/dist/es/utils/index.d.ts.map +1 -0
- package/dist/es/{src/utils → utils}/object.d.ts +1 -0
- package/dist/es/utils/object.d.ts.map +1 -0
- package/dist/es/{src/utils → utils}/rgb.d.ts +1 -0
- package/dist/es/utils/rgb.d.ts.map +1 -0
- package/dist/es/zenflux-core.js +58 -147
- package/dist/esm/zenflux-core.mjs +2083 -0
- package/dist/umd/zenflux-core.js +2100 -1
- package/package.json +3 -2
- package/src/initializer.ts +2 -1
- package/src/modules/logger.ts +53 -7
- package/types/index.d.ts +3 -3
- package/dist/es/rollup.config.d.ts +0 -23
- package/dist/es/src/globals.d.ts +0 -3
- package/dist/es/zenflux-core.mjs +0 -1
package/dist/es/zenflux-core.js
CHANGED
|
@@ -61,68 +61,7 @@ function _objectSpread2(target) {
|
|
|
61
61
|
return target;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
var
|
|
65
|
-
var version = "0.0.0-alpha.5";
|
|
66
|
-
var description = "ZenFlux core";
|
|
67
|
-
var keywords = [
|
|
68
|
-
"zenflux",
|
|
69
|
-
"zen",
|
|
70
|
-
"flux",
|
|
71
|
-
"commands",
|
|
72
|
-
"manager",
|
|
73
|
-
"commands manager",
|
|
74
|
-
"core",
|
|
75
|
-
"zenflux-core"
|
|
76
|
-
];
|
|
77
|
-
var repository = {
|
|
78
|
-
type: "git",
|
|
79
|
-
url: "git+https://github.com/zenflux/core.git"
|
|
80
|
-
};
|
|
81
|
-
var license = "MIT";
|
|
82
|
-
var author = "Leonid Vinikov <leonidvinikov@gmail.com> (https://github.com/iNewLegend)";
|
|
83
|
-
var main = "dist/cjs/zenflux-core.js";
|
|
84
|
-
var unpkg = "dist/umd/zenflux-core.js";
|
|
85
|
-
var module = "dist/es/zenflux-core.js";
|
|
86
|
-
var types = "types/index.d.ts";
|
|
87
|
-
var files = [
|
|
88
|
-
"dist",
|
|
89
|
-
"src",
|
|
90
|
-
"types"
|
|
91
|
-
];
|
|
92
|
-
var scripts = {
|
|
93
|
-
test: "export flow_modules_logger=off && jest",
|
|
94
|
-
"toolkit-build": "node_modules/@zenflux/rollup-toolkit/bin/run @build",
|
|
95
|
-
"toolkit-build-dev": "node_modules/@zenflux/rollup-toolkit/bin/dev @build",
|
|
96
|
-
"toolkit-watch": "node_modules/@zenflux/rollup-toolkit/bin/run @watch",
|
|
97
|
-
"toolkit-watch-dev": "node_modules/@zenflux/rollup-toolkit/bin/dev @watch"
|
|
98
|
-
};
|
|
99
|
-
var devDependencies = {
|
|
100
|
-
"@babel/preset-env": "^7.20.2",
|
|
101
|
-
"@babel/preset-typescript": "^7.18.6",
|
|
102
|
-
"@types/jest": "^29.2.5",
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
104
|
-
"@typescript-eslint/parser": "^5.48.0",
|
|
105
|
-
"@zenflux/rollup-toolkit": "^0.0.0-alpha.3",
|
|
106
|
-
"babel-jest": "^29.3.1",
|
|
107
|
-
"ts-jest": "^29.0.3",
|
|
108
|
-
tslib: "^2.4.1"
|
|
109
|
-
};
|
|
110
|
-
var pkg = {
|
|
111
|
-
name: name,
|
|
112
|
-
version: version,
|
|
113
|
-
description: description,
|
|
114
|
-
keywords: keywords,
|
|
115
|
-
repository: repository,
|
|
116
|
-
license: license,
|
|
117
|
-
author: author,
|
|
118
|
-
main: main,
|
|
119
|
-
unpkg: unpkg,
|
|
120
|
-
module: module,
|
|
121
|
-
types: types,
|
|
122
|
-
files: files,
|
|
123
|
-
scripts: scripts,
|
|
124
|
-
devDependencies: devDependencies
|
|
125
|
-
};
|
|
64
|
+
var version = "0.0.0-alpha.6";
|
|
126
65
|
|
|
127
66
|
function _regeneratorRuntime() {
|
|
128
67
|
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
@@ -637,28 +576,22 @@ var getCircularReplacer = function getCircularReplacer() {
|
|
|
637
576
|
var hexColorDelta = function hexColorDelta(hex1, hex2) {
|
|
638
577
|
hex1 = hex1.replace("#", "");
|
|
639
578
|
hex2 = hex2.replace("#", "");
|
|
640
|
-
|
|
641
579
|
// Get red/green/blue int values of hex1
|
|
642
580
|
var r1 = parseInt(hex1.substring(0, 2), 16);
|
|
643
581
|
var g1 = parseInt(hex1.substring(2, 4), 16);
|
|
644
582
|
var b1 = parseInt(hex1.substring(4, 6), 16);
|
|
645
|
-
|
|
646
583
|
// Get red/green/blue int values of hex2
|
|
647
584
|
var r2 = parseInt(hex2.substring(0, 2), 16);
|
|
648
585
|
var g2 = parseInt(hex2.substring(2, 4), 16);
|
|
649
586
|
var b2 = parseInt(hex2.substring(4, 6), 16);
|
|
650
|
-
|
|
651
587
|
// Calculate differences between reds, greens and blues
|
|
652
588
|
var r = 255 - Math.abs(r1 - r2);
|
|
653
589
|
var g = 255 - Math.abs(g1 - g2);
|
|
654
590
|
var b = 255 - Math.abs(b1 - b2);
|
|
655
|
-
|
|
656
591
|
// Limit differences between 0 and 1
|
|
657
|
-
|
|
658
592
|
r /= 255;
|
|
659
593
|
g /= 255;
|
|
660
594
|
b /= 255;
|
|
661
|
-
|
|
662
595
|
// 0 means opposite colors, 1 means same colors
|
|
663
596
|
return (r + g + b) / 3;
|
|
664
597
|
};
|
|
@@ -670,7 +603,12 @@ hexColorDelta: hexColorDelta
|
|
|
670
603
|
});
|
|
671
604
|
|
|
672
605
|
// TODO: Should by dynamic/configure-able.
|
|
673
|
-
var MAX_WRAPPING_RECURSIVE_DEPTH = 4
|
|
606
|
+
var MAX_WRAPPING_RECURSIVE_DEPTH = 4,
|
|
607
|
+
STACK_BACKWARD_CALLER_INDEX = 3,
|
|
608
|
+
UNKNOWN_CALLER_NAME = 'anonymous function',
|
|
609
|
+
BABEL_EXCLUDE_FUNCTIONS_NAMES = ['_callee', 'tryCatch', '<anonymous>', 'Generator.next', 'asyncGeneratorStep', '_next'];
|
|
610
|
+
// TODO: Should by dynamic/configure-able.
|
|
611
|
+
Error.stackTraceLimit = 50;
|
|
674
612
|
var Logger = /*#__PURE__*/function () {
|
|
675
613
|
/**
|
|
676
614
|
* Function constructor() : Create logger class.
|
|
@@ -697,7 +635,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
697
635
|
this.initialize();
|
|
698
636
|
}
|
|
699
637
|
}
|
|
700
|
-
|
|
701
638
|
/**
|
|
702
639
|
* Function initialize() : Initialize logger class.
|
|
703
640
|
*/
|
|
@@ -717,7 +654,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
717
654
|
this.outputHandler = console.log;
|
|
718
655
|
this.defaultStyle = ["color: grey;font-size:7px", "display: block", "color: ".concat(this.color), "color: grey", "font-weight: bold", "color: #607D8B", "font-size: 16px;color: red;font-weight:800"];
|
|
719
656
|
}
|
|
720
|
-
|
|
721
657
|
/**
|
|
722
658
|
* Function setOutputHandler() : Set custom output handler.
|
|
723
659
|
*/
|
|
@@ -726,7 +662,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
726
662
|
value: function setOutputHandler(outputHandler) {
|
|
727
663
|
this.outputHandler = outputHandler;
|
|
728
664
|
}
|
|
729
|
-
|
|
730
665
|
/**
|
|
731
666
|
* Function useWrapper() : Search for customized log view, each instance,
|
|
732
667
|
* that typeof the instance was registered wrapper will have unique output
|
|
@@ -741,10 +676,8 @@ var Logger = /*#__PURE__*/function () {
|
|
|
741
676
|
return obj;
|
|
742
677
|
}
|
|
743
678
|
Logger.wrapperDepth++;
|
|
744
|
-
|
|
745
679
|
// Result will lose classType (instanceOf will not work), now based on obj.
|
|
746
680
|
var result = _objectSpread2({}, obj);
|
|
747
|
-
|
|
748
681
|
// @ts-ignore
|
|
749
682
|
Object.values(Logger.wrappers).forEach(function (_ref) {
|
|
750
683
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
@@ -768,7 +701,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
768
701
|
Logger.wrapperDepth--;
|
|
769
702
|
return result;
|
|
770
703
|
}
|
|
771
|
-
|
|
772
704
|
/**
|
|
773
705
|
* Function startEmpty() : Notify function start without args.
|
|
774
706
|
*
|
|
@@ -781,7 +713,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
781
713
|
if (!this.state) return;
|
|
782
714
|
this.printFunctionNotify("se", Logger.getCallerName(), output);
|
|
783
715
|
}
|
|
784
|
-
|
|
785
716
|
/**
|
|
786
717
|
* Function startWith() : Notify function start with args.
|
|
787
718
|
*
|
|
@@ -797,22 +728,20 @@ var Logger = /*#__PURE__*/function () {
|
|
|
797
728
|
if (typeof params == "string") {
|
|
798
729
|
this.printInLineString(type, source, params);
|
|
799
730
|
} else if (Object.keys(params).length === 1) {
|
|
800
|
-
var
|
|
731
|
+
var key = Object.keys(params)[0];
|
|
801
732
|
var value = Object.values(params)[0];
|
|
802
|
-
|
|
803
733
|
// TODO: Check is repeated logic, handle it.
|
|
804
734
|
if (_typeof(value) === "object") {
|
|
805
|
-
this.printNextLineObject(type, source,
|
|
735
|
+
this.printNextLineObject(type, source, key, value || {});
|
|
806
736
|
} else if (typeof value == "function") {
|
|
807
|
-
this.printInLineFunction(type, source,
|
|
737
|
+
this.printInLineFunction(type, source, key, value);
|
|
808
738
|
} else {
|
|
809
|
-
this.printInLineElement(type, source,
|
|
739
|
+
this.printInLineElement(type, source, key, value);
|
|
810
740
|
}
|
|
811
741
|
} else {
|
|
812
742
|
this.printMultiLineObject(type, source, params);
|
|
813
743
|
}
|
|
814
744
|
}
|
|
815
|
-
|
|
816
745
|
/**
|
|
817
746
|
* Function object() : Prints object.
|
|
818
747
|
**/
|
|
@@ -824,14 +753,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
824
753
|
if (!this.state) return;
|
|
825
754
|
var source = Logger.getCallerName();
|
|
826
755
|
params = Object.create(params);
|
|
827
|
-
for (var
|
|
828
|
-
if (_typeof(params[
|
|
829
|
-
params[
|
|
756
|
+
for (var key in params) {
|
|
757
|
+
if (_typeof(params[key]) === "object") {
|
|
758
|
+
params[key] = JSON.stringify(this.useWrapper(params[key]), getCircularReplacer());
|
|
830
759
|
}
|
|
831
|
-
this.out.apply(this, ["%c(ob)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() [").concat(notice, "] ->> ").concat(
|
|
760
|
+
this.out.apply(this, ["%c(ob)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() [").concat(notice, "] ->> ").concat(key, ": '").concat(params[key], "'%c")].concat(this.defaultStyle));
|
|
832
761
|
}
|
|
833
762
|
}
|
|
834
|
-
|
|
835
763
|
/**
|
|
836
764
|
* Function debug() : Notify debug.
|
|
837
765
|
*/
|
|
@@ -841,7 +769,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
841
769
|
if (!this.state) return;
|
|
842
770
|
this.printFunctionNotify("db", Logger.getCallerName(), output);
|
|
843
771
|
}
|
|
844
|
-
|
|
845
772
|
/**
|
|
846
773
|
* Function drop : Preview as continue of log which drop ite.
|
|
847
774
|
*/
|
|
@@ -850,12 +777,11 @@ var Logger = /*#__PURE__*/function () {
|
|
|
850
777
|
value: function drop(according, data) {
|
|
851
778
|
if (!this.state) return;
|
|
852
779
|
var source = Logger.getCallerName();
|
|
853
|
-
for (var
|
|
854
|
-
this.out.apply(this, ["%c(dr)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() ->> corresponding ").concat(
|
|
780
|
+
for (var key in according) {
|
|
781
|
+
this.out.apply(this, ["%c(dr)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() ->> corresponding ").concat(key, ": '").concat(according[key], "' RESULT: %c\u2193")].concat(this.defaultStyle));
|
|
855
782
|
}
|
|
856
783
|
this.out(data);
|
|
857
784
|
}
|
|
858
|
-
|
|
859
785
|
/**
|
|
860
786
|
* Function throw() : Throws logged error.
|
|
861
787
|
*/
|
|
@@ -868,7 +794,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
868
794
|
if (params) this.printNextLineObject("tw", Logger.getCallerName(), name, params);
|
|
869
795
|
throw new Error().stack;
|
|
870
796
|
}
|
|
871
|
-
|
|
872
797
|
/**
|
|
873
798
|
* Function clone() : Create clone instance.
|
|
874
799
|
*/
|
|
@@ -877,7 +802,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
877
802
|
value: function clone() {
|
|
878
803
|
return Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
879
804
|
}
|
|
880
|
-
|
|
881
805
|
/**
|
|
882
806
|
* Function printFunctionNotify() : Print simple log for notify source (function).
|
|
883
807
|
*
|
|
@@ -887,7 +811,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
887
811
|
value: function printFunctionNotify(type, source, output) {
|
|
888
812
|
this.out.apply(this, ["%c(".concat(type, ")-> %c%c").concat(this.name, "%c::%c").concat(source, "%c() ").concat(output, "%c")].concat(this.defaultStyle));
|
|
889
813
|
}
|
|
890
|
-
|
|
891
814
|
/**
|
|
892
815
|
* Function printInLineElement() : Print in line element.
|
|
893
816
|
*/
|
|
@@ -896,7 +819,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
896
819
|
value: function printInLineElement(type, source, key, value) {
|
|
897
820
|
this.out.apply(this, ["%c(".concat(type, ")-> %c%c").concat(this.name, "%c::%c").concat(source, "%c() ->> ").concat(key, ": '").concat(value, "'%c")].concat(this.defaultStyle));
|
|
898
821
|
}
|
|
899
|
-
|
|
900
822
|
/**
|
|
901
823
|
* Function printInLineFunction() : Print in line function.
|
|
902
824
|
*/
|
|
@@ -906,7 +828,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
906
828
|
fn = Logger.getFunctionView(fn);
|
|
907
829
|
this.printInLineElement(type, source, key, fn);
|
|
908
830
|
}
|
|
909
|
-
|
|
910
831
|
/**
|
|
911
832
|
* Function printInLineString() : Print in line string.
|
|
912
833
|
*/
|
|
@@ -915,7 +836,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
915
836
|
value: function printInLineString(type, source, string) {
|
|
916
837
|
this.printInLineElement(type, source, "(string)", string);
|
|
917
838
|
}
|
|
918
|
-
|
|
919
839
|
/**
|
|
920
840
|
* Function printNextLineObject() : Print object in next line.
|
|
921
841
|
*/
|
|
@@ -927,7 +847,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
927
847
|
// print in next line
|
|
928
848
|
this.out(obj);
|
|
929
849
|
}
|
|
930
|
-
|
|
931
850
|
/**
|
|
932
851
|
* Function printMultiLineObject() : Print object in multiline format.
|
|
933
852
|
*/
|
|
@@ -935,17 +854,16 @@ var Logger = /*#__PURE__*/function () {
|
|
|
935
854
|
key: "printMultiLineObject",
|
|
936
855
|
value: function printMultiLineObject(type, source, obj) {
|
|
937
856
|
this.out.apply(this, ["%c(".concat(type, ")-> %c%c").concat(this.name, "%c::%c").concat(source, "%c(").concat(Object.keys(obj).join(", "), ") %c\u2193")].concat(this.defaultStyle));
|
|
938
|
-
for (var
|
|
939
|
-
var value = obj[
|
|
857
|
+
for (var key in obj) {
|
|
858
|
+
var value = obj[key];
|
|
940
859
|
if (_typeof(value) === "object") {
|
|
941
860
|
value = JSON.stringify(this.useWrapper(value), getCircularReplacer());
|
|
942
|
-
} else if (typeof obj[
|
|
861
|
+
} else if (typeof obj[key] == "function") {
|
|
943
862
|
value = Logger.getFunctionView(value);
|
|
944
863
|
}
|
|
945
|
-
this.out.apply(this, ["%c" +
|
|
864
|
+
this.out.apply(this, ["%c" + key + ": `" + this.useWrapper(value) + "`", "color: #a3a3a3"]);
|
|
946
865
|
}
|
|
947
866
|
}
|
|
948
|
-
|
|
949
867
|
/**
|
|
950
868
|
* Function getRandomColor() : Return random color.
|
|
951
869
|
*/
|
|
@@ -961,22 +879,20 @@ var Logger = /*#__PURE__*/function () {
|
|
|
961
879
|
// it returns the ratio of difference... closer to 1.0 is less difference.
|
|
962
880
|
return hexColorDelta(color, value) >= 0.8;
|
|
963
881
|
});
|
|
964
|
-
|
|
965
882
|
// if the color is similar, try again.
|
|
966
883
|
if (similar) {
|
|
967
884
|
return this.getRandomColor();
|
|
968
885
|
}
|
|
969
886
|
return color;
|
|
970
887
|
}
|
|
971
|
-
|
|
972
888
|
/**
|
|
973
889
|
* Function out() : Print console log with style
|
|
974
890
|
*/
|
|
975
891
|
}, {
|
|
976
892
|
key: "out",
|
|
977
893
|
value: function out() {
|
|
978
|
-
for (var _len = arguments.length, args = new Array(_len),
|
|
979
|
-
args[
|
|
894
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
895
|
+
args[_key] = arguments[_key];
|
|
980
896
|
}
|
|
981
897
|
this.outputHandler.apply(this, args);
|
|
982
898
|
}
|
|
@@ -985,7 +901,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
985
901
|
value: function getName() {
|
|
986
902
|
return 'Core/Modules/Logger';
|
|
987
903
|
}
|
|
988
|
-
|
|
989
904
|
/**
|
|
990
905
|
* Function reset() : Reset logger globals.
|
|
991
906
|
*/
|
|
@@ -997,7 +912,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
997
912
|
Logger.colorsInUse = [];
|
|
998
913
|
Logger.sharedData = {};
|
|
999
914
|
}
|
|
1000
|
-
|
|
1001
915
|
/**
|
|
1002
916
|
* Function createCustomWrapper() : Creates custom wrapper for log entities.
|
|
1003
917
|
*/
|
|
@@ -1015,29 +929,57 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1015
929
|
callback: callback
|
|
1016
930
|
});
|
|
1017
931
|
}
|
|
1018
|
-
|
|
1019
932
|
/**
|
|
1020
933
|
* Function getCallerName() : Return caller name.
|
|
1021
934
|
*/
|
|
1022
935
|
}, {
|
|
1023
936
|
key: "getCallerName",
|
|
1024
937
|
value: function getCallerName() {
|
|
938
|
+
var _error$stack;
|
|
1025
939
|
var error = new Error(),
|
|
1026
|
-
|
|
940
|
+
errorsPerLine = ((_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : _error$stack.split("\n")) || [],
|
|
941
|
+
caller = errorsPerLine.length ? errorsPerLine[STACK_BACKWARD_CALLER_INDEX].trim() : UNKNOWN_CALLER_NAME;
|
|
1027
942
|
if (caller.startsWith("at new")) {
|
|
1028
943
|
return "constructor";
|
|
1029
944
|
}
|
|
1030
|
-
|
|
945
|
+
var extractName = caller.split(".")[1].split(" ")[0],
|
|
946
|
+
isBabelAsyncRuntime = false;
|
|
947
|
+
// Babel compatibility.
|
|
948
|
+
if (extractName.includes('_callee')) {
|
|
949
|
+
var _loop = function _loop() {
|
|
950
|
+
var line = errorsPerLine[i];
|
|
951
|
+
var isExcluded = BABEL_EXCLUDE_FUNCTIONS_NAMES.some(function (excludeName) {
|
|
952
|
+
return line.includes(excludeName);
|
|
953
|
+
});
|
|
954
|
+
if (!isExcluded) {
|
|
955
|
+
var format = line.trim().split(' ');
|
|
956
|
+
if (format.length <= 2) {
|
|
957
|
+
return "continue";
|
|
958
|
+
}
|
|
959
|
+
extractName = format[1].split(".")[1];
|
|
960
|
+
isBabelAsyncRuntime = true;
|
|
961
|
+
return "break";
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
// Run till find reliable function name.
|
|
965
|
+
for (var i = STACK_BACKWARD_CALLER_INDEX; i < errorsPerLine.length; i++) {
|
|
966
|
+
var _ret = _loop();
|
|
967
|
+
if (_ret === "continue") continue;
|
|
968
|
+
if (_ret === "break") break;
|
|
969
|
+
}
|
|
970
|
+
if (!isBabelAsyncRuntime) {
|
|
971
|
+
extractName = UNKNOWN_CALLER_NAME;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
return extractName;
|
|
1031
975
|
}
|
|
1032
|
-
|
|
1033
976
|
/**
|
|
1034
977
|
* Function functionView() : Return function preview.
|
|
1035
978
|
*/
|
|
1036
979
|
}, {
|
|
1037
980
|
key: "getFunctionView",
|
|
1038
981
|
value: function getFunctionView(fn) {
|
|
1039
|
-
var fReturn =
|
|
1040
|
-
|
|
982
|
+
var fReturn = UNKNOWN_CALLER_NAME;
|
|
1041
983
|
// TODO: Check if works.
|
|
1042
984
|
if (typeof fn !== "string" && fn.name.length !== 0) {
|
|
1043
985
|
fReturn = fn.name.split(" ")[1] + "()";
|
|
@@ -1104,10 +1046,6 @@ function _wrapNativeSuper(Class) {
|
|
|
1104
1046
|
return _wrapNativeSuper(Class);
|
|
1105
1047
|
}
|
|
1106
1048
|
|
|
1107
|
-
/**
|
|
1108
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1109
|
-
*/
|
|
1110
|
-
|
|
1111
1049
|
var CommandAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
1112
1050
|
_inherits(CommandAlreadyRegistered, _Error);
|
|
1113
1051
|
var _super = _createSuper(CommandAlreadyRegistered);
|
|
@@ -1131,10 +1069,6 @@ var CommandNotFound = /*#__PURE__*/function (_Error) {
|
|
|
1131
1069
|
return _createClass(CommandNotFound);
|
|
1132
1070
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1133
1071
|
|
|
1134
|
-
/**
|
|
1135
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1136
|
-
*/
|
|
1137
|
-
|
|
1138
1072
|
var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
1139
1073
|
_inherits(ControllerAlreadyRegistered, _Error);
|
|
1140
1074
|
var _super = _createSuper(ControllerAlreadyRegistered);
|
|
@@ -1145,10 +1079,6 @@ var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
|
1145
1079
|
return _createClass(ControllerAlreadyRegistered);
|
|
1146
1080
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1147
1081
|
|
|
1148
|
-
/**
|
|
1149
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1150
|
-
*/
|
|
1151
|
-
|
|
1152
1082
|
var ForceMethodBase = /*#__PURE__*/function (_Error) {
|
|
1153
1083
|
_inherits(ForceMethodBase, _Error);
|
|
1154
1084
|
var _super = _createSuper(ForceMethodBase);
|
|
@@ -1177,7 +1107,6 @@ ForceMethod: ForceMethod
|
|
|
1177
1107
|
});
|
|
1178
1108
|
|
|
1179
1109
|
var IdCounter = 0;
|
|
1180
|
-
|
|
1181
1110
|
/**
|
|
1182
1111
|
* Base class 4 *
|
|
1183
1112
|
*/
|
|
@@ -1264,7 +1193,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1264
1193
|
key: "register",
|
|
1265
1194
|
value: function register(commands, controller) {
|
|
1266
1195
|
var _this2 = this;
|
|
1267
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1268
1196
|
var result = {};
|
|
1269
1197
|
Object.values(commands).forEach(function (command) {
|
|
1270
1198
|
var commandName = command.getName();
|
|
@@ -1300,11 +1228,9 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1300
1228
|
if (!CommandClass) {
|
|
1301
1229
|
throw new CommandNotFound(name);
|
|
1302
1230
|
}
|
|
1303
|
-
|
|
1304
1231
|
// @ts-ignore
|
|
1305
1232
|
return new CommandClass(args, options);
|
|
1306
1233
|
}
|
|
1307
|
-
|
|
1308
1234
|
/**
|
|
1309
1235
|
* Function onBefore() : Used to set hooks that effects only data and not UI.
|
|
1310
1236
|
*/
|
|
@@ -1313,7 +1239,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1313
1239
|
value: function onBefore(hookCommand, callback) {
|
|
1314
1240
|
Commands.hookCommand(this.onBeforeHooks, hookCommand, callback);
|
|
1315
1241
|
}
|
|
1316
|
-
|
|
1317
1242
|
/**
|
|
1318
1243
|
* Function onBeforeUI() : Used to set hooks that effects only UI.
|
|
1319
1244
|
*/
|
|
@@ -1322,7 +1247,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1322
1247
|
value: function onBeforeUI(hookCommand, callback) {
|
|
1323
1248
|
Commands.hookCommand(this.onBeforeUIHooks, hookCommand, callback);
|
|
1324
1249
|
}
|
|
1325
|
-
|
|
1326
1250
|
/**
|
|
1327
1251
|
* Function onAfter() : Used to set hooks that effects only data and not UI.
|
|
1328
1252
|
*/
|
|
@@ -1331,7 +1255,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1331
1255
|
value: function onAfter(hookCommand, callback) {
|
|
1332
1256
|
Commands.hookCommand(this.onAfterHooks, hookCommand, callback);
|
|
1333
1257
|
}
|
|
1334
|
-
|
|
1335
1258
|
/**
|
|
1336
1259
|
* Function onAfterUI() : Used to set hooks that effects only UI.
|
|
1337
1260
|
*/
|
|
@@ -1340,7 +1263,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1340
1263
|
value: function onAfterUI(command, callback) {
|
|
1341
1264
|
Commands.hookCommand(this.onAfterUIHooks, command, callback);
|
|
1342
1265
|
}
|
|
1343
|
-
|
|
1344
1266
|
/**
|
|
1345
1267
|
* Function onAfterOnce() : Used to set hooks that effects only data and not UI.
|
|
1346
1268
|
*/
|
|
@@ -1349,7 +1271,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1349
1271
|
value: function onAfterOnce(command, callback) {
|
|
1350
1272
|
Commands.hookCommand(this.onAfterOnceHooks, command, callback);
|
|
1351
1273
|
}
|
|
1352
|
-
|
|
1353
1274
|
/**
|
|
1354
1275
|
* Function onAfterAffect() : Used to register a trigger that runs command after `hookCommand` run's.
|
|
1355
1276
|
*/
|
|
@@ -1589,7 +1510,6 @@ var Controllers = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1589
1510
|
if (this.controllers[controller.getName()]) {
|
|
1590
1511
|
throw new ControllerAlreadyRegistered(controller);
|
|
1591
1512
|
}
|
|
1592
|
-
|
|
1593
1513
|
// Register.
|
|
1594
1514
|
this.controllers[controller.getName()] = controller;
|
|
1595
1515
|
return controller;
|
|
@@ -1660,7 +1580,6 @@ var Http = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1660
1580
|
_this.apiBaseUrl = apiBaseUrl + '/';
|
|
1661
1581
|
return _this;
|
|
1662
1582
|
}
|
|
1663
|
-
|
|
1664
1583
|
/**
|
|
1665
1584
|
* Function fetch() : Fetch api.
|
|
1666
1585
|
*/
|
|
@@ -1756,7 +1675,6 @@ var Data = /*#__PURE__*/function (_Commands) {
|
|
|
1756
1675
|
var _this;
|
|
1757
1676
|
_classCallCheck(this, Data);
|
|
1758
1677
|
_this = _super.call(this);
|
|
1759
|
-
|
|
1760
1678
|
// @ts-ignore
|
|
1761
1679
|
Data.client = new Http(Config.baseURL);
|
|
1762
1680
|
return _this;
|
|
@@ -1938,7 +1856,6 @@ var CommandBase = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1938
1856
|
value: function apply() {
|
|
1939
1857
|
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
|
|
1940
1858
|
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
|
|
1941
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1942
1859
|
throw new ForceMethod(this, "apply");
|
|
1943
1860
|
}
|
|
1944
1861
|
}, {
|
|
@@ -2024,7 +1941,6 @@ var CommandData = /*#__PURE__*/function (_CommandBase) {
|
|
|
2024
1941
|
value: function apply() {
|
|
2025
1942
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
|
|
2026
1943
|
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
|
|
2027
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2028
1944
|
var endpoint = this.applyEndpointFormat(this.getEndpoint(), args);
|
|
2029
1945
|
return data.getClient().fetch(endpoint, data.currentHttpMethod, args || null);
|
|
2030
1946
|
}
|
|
@@ -2119,10 +2035,6 @@ var Controller = /*#__PURE__*/function (_ObjectBase) {
|
|
|
2119
2035
|
value: function getInternal() {
|
|
2120
2036
|
return {};
|
|
2121
2037
|
}
|
|
2122
|
-
|
|
2123
|
-
/**
|
|
2124
|
-
* Function setupHooks() : Override this method to setup hooks.
|
|
2125
|
-
*/
|
|
2126
2038
|
}], [{
|
|
2127
2039
|
key: "getName",
|
|
2128
2040
|
value: function getName() {
|
|
@@ -2173,7 +2085,7 @@ function errorInitTwice() {
|
|
|
2173
2085
|
}
|
|
2174
2086
|
errorInitTwice();
|
|
2175
2087
|
var config = {
|
|
2176
|
-
version:
|
|
2088
|
+
version: version
|
|
2177
2089
|
};
|
|
2178
2090
|
var CoreAPI = _objectSpread2({
|
|
2179
2091
|
initialize: function initialize$1(configuration) {
|
|
@@ -2191,7 +2103,6 @@ var CoreAPI = _objectSpread2({
|
|
|
2191
2103
|
},
|
|
2192
2104
|
config: config
|
|
2193
2105
|
}, exported);
|
|
2194
|
-
|
|
2195
2106
|
// TODO: Make it available only for development.
|
|
2196
2107
|
if (!(globalThis !== null && globalThis !== void 0 && globalThis.ZenCore)) globalThis.ZenCore = CoreAPI;
|
|
2197
2108
|
|