@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/cjs/zenflux-core.js
CHANGED
|
@@ -65,68 +65,7 @@ function _objectSpread2(target) {
|
|
|
65
65
|
return target;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
var
|
|
69
|
-
var version = "0.0.0-alpha.5";
|
|
70
|
-
var description = "ZenFlux core";
|
|
71
|
-
var keywords = [
|
|
72
|
-
"zenflux",
|
|
73
|
-
"zen",
|
|
74
|
-
"flux",
|
|
75
|
-
"commands",
|
|
76
|
-
"manager",
|
|
77
|
-
"commands manager",
|
|
78
|
-
"core",
|
|
79
|
-
"zenflux-core"
|
|
80
|
-
];
|
|
81
|
-
var repository = {
|
|
82
|
-
type: "git",
|
|
83
|
-
url: "git+https://github.com/zenflux/core.git"
|
|
84
|
-
};
|
|
85
|
-
var license = "MIT";
|
|
86
|
-
var author = "Leonid Vinikov <leonidvinikov@gmail.com> (https://github.com/iNewLegend)";
|
|
87
|
-
var main = "dist/cjs/zenflux-core.js";
|
|
88
|
-
var unpkg = "dist/umd/zenflux-core.js";
|
|
89
|
-
var module$1 = "dist/es/zenflux-core.js";
|
|
90
|
-
var types = "types/index.d.ts";
|
|
91
|
-
var files = [
|
|
92
|
-
"dist",
|
|
93
|
-
"src",
|
|
94
|
-
"types"
|
|
95
|
-
];
|
|
96
|
-
var scripts = {
|
|
97
|
-
test: "export flow_modules_logger=off && jest",
|
|
98
|
-
"toolkit-build": "node_modules/@zenflux/rollup-toolkit/bin/run @build",
|
|
99
|
-
"toolkit-build-dev": "node_modules/@zenflux/rollup-toolkit/bin/dev @build",
|
|
100
|
-
"toolkit-watch": "node_modules/@zenflux/rollup-toolkit/bin/run @watch",
|
|
101
|
-
"toolkit-watch-dev": "node_modules/@zenflux/rollup-toolkit/bin/dev @watch"
|
|
102
|
-
};
|
|
103
|
-
var devDependencies = {
|
|
104
|
-
"@babel/preset-env": "^7.20.2",
|
|
105
|
-
"@babel/preset-typescript": "^7.18.6",
|
|
106
|
-
"@types/jest": "^29.2.5",
|
|
107
|
-
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
108
|
-
"@typescript-eslint/parser": "^5.48.0",
|
|
109
|
-
"@zenflux/rollup-toolkit": "^0.0.0-alpha.3",
|
|
110
|
-
"babel-jest": "^29.3.1",
|
|
111
|
-
"ts-jest": "^29.0.3",
|
|
112
|
-
tslib: "^2.4.1"
|
|
113
|
-
};
|
|
114
|
-
var pkg = {
|
|
115
|
-
name: name,
|
|
116
|
-
version: version,
|
|
117
|
-
description: description,
|
|
118
|
-
keywords: keywords,
|
|
119
|
-
repository: repository,
|
|
120
|
-
license: license,
|
|
121
|
-
author: author,
|
|
122
|
-
main: main,
|
|
123
|
-
unpkg: unpkg,
|
|
124
|
-
module: module$1,
|
|
125
|
-
types: types,
|
|
126
|
-
files: files,
|
|
127
|
-
scripts: scripts,
|
|
128
|
-
devDependencies: devDependencies
|
|
129
|
-
};
|
|
68
|
+
var version = "0.0.0-alpha.6";
|
|
130
69
|
|
|
131
70
|
function _regeneratorRuntime() {
|
|
132
71
|
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
@@ -641,28 +580,22 @@ var getCircularReplacer = function getCircularReplacer() {
|
|
|
641
580
|
var hexColorDelta = function hexColorDelta(hex1, hex2) {
|
|
642
581
|
hex1 = hex1.replace("#", "");
|
|
643
582
|
hex2 = hex2.replace("#", "");
|
|
644
|
-
|
|
645
583
|
// Get red/green/blue int values of hex1
|
|
646
584
|
var r1 = parseInt(hex1.substring(0, 2), 16);
|
|
647
585
|
var g1 = parseInt(hex1.substring(2, 4), 16);
|
|
648
586
|
var b1 = parseInt(hex1.substring(4, 6), 16);
|
|
649
|
-
|
|
650
587
|
// Get red/green/blue int values of hex2
|
|
651
588
|
var r2 = parseInt(hex2.substring(0, 2), 16);
|
|
652
589
|
var g2 = parseInt(hex2.substring(2, 4), 16);
|
|
653
590
|
var b2 = parseInt(hex2.substring(4, 6), 16);
|
|
654
|
-
|
|
655
591
|
// Calculate differences between reds, greens and blues
|
|
656
592
|
var r = 255 - Math.abs(r1 - r2);
|
|
657
593
|
var g = 255 - Math.abs(g1 - g2);
|
|
658
594
|
var b = 255 - Math.abs(b1 - b2);
|
|
659
|
-
|
|
660
595
|
// Limit differences between 0 and 1
|
|
661
|
-
|
|
662
596
|
r /= 255;
|
|
663
597
|
g /= 255;
|
|
664
598
|
b /= 255;
|
|
665
|
-
|
|
666
599
|
// 0 means opposite colors, 1 means same colors
|
|
667
600
|
return (r + g + b) / 3;
|
|
668
601
|
};
|
|
@@ -674,7 +607,12 @@ hexColorDelta: hexColorDelta
|
|
|
674
607
|
});
|
|
675
608
|
|
|
676
609
|
// TODO: Should by dynamic/configure-able.
|
|
677
|
-
var MAX_WRAPPING_RECURSIVE_DEPTH = 4
|
|
610
|
+
var MAX_WRAPPING_RECURSIVE_DEPTH = 4,
|
|
611
|
+
STACK_BACKWARD_CALLER_INDEX = 3,
|
|
612
|
+
UNKNOWN_CALLER_NAME = 'anonymous function',
|
|
613
|
+
BABEL_EXCLUDE_FUNCTIONS_NAMES = ['_callee', 'tryCatch', '<anonymous>', 'Generator.next', 'asyncGeneratorStep', '_next'];
|
|
614
|
+
// TODO: Should by dynamic/configure-able.
|
|
615
|
+
Error.stackTraceLimit = 50;
|
|
678
616
|
var Logger = /*#__PURE__*/function () {
|
|
679
617
|
/**
|
|
680
618
|
* Function constructor() : Create logger class.
|
|
@@ -701,7 +639,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
701
639
|
this.initialize();
|
|
702
640
|
}
|
|
703
641
|
}
|
|
704
|
-
|
|
705
642
|
/**
|
|
706
643
|
* Function initialize() : Initialize logger class.
|
|
707
644
|
*/
|
|
@@ -721,7 +658,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
721
658
|
this.outputHandler = console.log;
|
|
722
659
|
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"];
|
|
723
660
|
}
|
|
724
|
-
|
|
725
661
|
/**
|
|
726
662
|
* Function setOutputHandler() : Set custom output handler.
|
|
727
663
|
*/
|
|
@@ -730,7 +666,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
730
666
|
value: function setOutputHandler(outputHandler) {
|
|
731
667
|
this.outputHandler = outputHandler;
|
|
732
668
|
}
|
|
733
|
-
|
|
734
669
|
/**
|
|
735
670
|
* Function useWrapper() : Search for customized log view, each instance,
|
|
736
671
|
* that typeof the instance was registered wrapper will have unique output
|
|
@@ -745,10 +680,8 @@ var Logger = /*#__PURE__*/function () {
|
|
|
745
680
|
return obj;
|
|
746
681
|
}
|
|
747
682
|
Logger.wrapperDepth++;
|
|
748
|
-
|
|
749
683
|
// Result will lose classType (instanceOf will not work), now based on obj.
|
|
750
684
|
var result = _objectSpread2({}, obj);
|
|
751
|
-
|
|
752
685
|
// @ts-ignore
|
|
753
686
|
Object.values(Logger.wrappers).forEach(function (_ref) {
|
|
754
687
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
@@ -772,7 +705,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
772
705
|
Logger.wrapperDepth--;
|
|
773
706
|
return result;
|
|
774
707
|
}
|
|
775
|
-
|
|
776
708
|
/**
|
|
777
709
|
* Function startEmpty() : Notify function start without args.
|
|
778
710
|
*
|
|
@@ -785,7 +717,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
785
717
|
if (!this.state) return;
|
|
786
718
|
this.printFunctionNotify("se", Logger.getCallerName(), output);
|
|
787
719
|
}
|
|
788
|
-
|
|
789
720
|
/**
|
|
790
721
|
* Function startWith() : Notify function start with args.
|
|
791
722
|
*
|
|
@@ -801,22 +732,20 @@ var Logger = /*#__PURE__*/function () {
|
|
|
801
732
|
if (typeof params == "string") {
|
|
802
733
|
this.printInLineString(type, source, params);
|
|
803
734
|
} else if (Object.keys(params).length === 1) {
|
|
804
|
-
var
|
|
735
|
+
var key = Object.keys(params)[0];
|
|
805
736
|
var value = Object.values(params)[0];
|
|
806
|
-
|
|
807
737
|
// TODO: Check is repeated logic, handle it.
|
|
808
738
|
if (_typeof(value) === "object") {
|
|
809
|
-
this.printNextLineObject(type, source,
|
|
739
|
+
this.printNextLineObject(type, source, key, value || {});
|
|
810
740
|
} else if (typeof value == "function") {
|
|
811
|
-
this.printInLineFunction(type, source,
|
|
741
|
+
this.printInLineFunction(type, source, key, value);
|
|
812
742
|
} else {
|
|
813
|
-
this.printInLineElement(type, source,
|
|
743
|
+
this.printInLineElement(type, source, key, value);
|
|
814
744
|
}
|
|
815
745
|
} else {
|
|
816
746
|
this.printMultiLineObject(type, source, params);
|
|
817
747
|
}
|
|
818
748
|
}
|
|
819
|
-
|
|
820
749
|
/**
|
|
821
750
|
* Function object() : Prints object.
|
|
822
751
|
**/
|
|
@@ -828,14 +757,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
828
757
|
if (!this.state) return;
|
|
829
758
|
var source = Logger.getCallerName();
|
|
830
759
|
params = Object.create(params);
|
|
831
|
-
for (var
|
|
832
|
-
if (_typeof(params[
|
|
833
|
-
params[
|
|
760
|
+
for (var key in params) {
|
|
761
|
+
if (_typeof(params[key]) === "object") {
|
|
762
|
+
params[key] = JSON.stringify(this.useWrapper(params[key]), getCircularReplacer());
|
|
834
763
|
}
|
|
835
|
-
this.out.apply(this, ["%c(ob)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() [").concat(notice, "] ->> ").concat(
|
|
764
|
+
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));
|
|
836
765
|
}
|
|
837
766
|
}
|
|
838
|
-
|
|
839
767
|
/**
|
|
840
768
|
* Function debug() : Notify debug.
|
|
841
769
|
*/
|
|
@@ -845,7 +773,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
845
773
|
if (!this.state) return;
|
|
846
774
|
this.printFunctionNotify("db", Logger.getCallerName(), output);
|
|
847
775
|
}
|
|
848
|
-
|
|
849
776
|
/**
|
|
850
777
|
* Function drop : Preview as continue of log which drop ite.
|
|
851
778
|
*/
|
|
@@ -854,12 +781,11 @@ var Logger = /*#__PURE__*/function () {
|
|
|
854
781
|
value: function drop(according, data) {
|
|
855
782
|
if (!this.state) return;
|
|
856
783
|
var source = Logger.getCallerName();
|
|
857
|
-
for (var
|
|
858
|
-
this.out.apply(this, ["%c(dr)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() ->> corresponding ").concat(
|
|
784
|
+
for (var key in according) {
|
|
785
|
+
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));
|
|
859
786
|
}
|
|
860
787
|
this.out(data);
|
|
861
788
|
}
|
|
862
|
-
|
|
863
789
|
/**
|
|
864
790
|
* Function throw() : Throws logged error.
|
|
865
791
|
*/
|
|
@@ -872,7 +798,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
872
798
|
if (params) this.printNextLineObject("tw", Logger.getCallerName(), name, params);
|
|
873
799
|
throw new Error().stack;
|
|
874
800
|
}
|
|
875
|
-
|
|
876
801
|
/**
|
|
877
802
|
* Function clone() : Create clone instance.
|
|
878
803
|
*/
|
|
@@ -881,7 +806,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
881
806
|
value: function clone() {
|
|
882
807
|
return Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
883
808
|
}
|
|
884
|
-
|
|
885
809
|
/**
|
|
886
810
|
* Function printFunctionNotify() : Print simple log for notify source (function).
|
|
887
811
|
*
|
|
@@ -891,7 +815,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
891
815
|
value: function printFunctionNotify(type, source, output) {
|
|
892
816
|
this.out.apply(this, ["%c(".concat(type, ")-> %c%c").concat(this.name, "%c::%c").concat(source, "%c() ").concat(output, "%c")].concat(this.defaultStyle));
|
|
893
817
|
}
|
|
894
|
-
|
|
895
818
|
/**
|
|
896
819
|
* Function printInLineElement() : Print in line element.
|
|
897
820
|
*/
|
|
@@ -900,7 +823,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
900
823
|
value: function printInLineElement(type, source, key, value) {
|
|
901
824
|
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));
|
|
902
825
|
}
|
|
903
|
-
|
|
904
826
|
/**
|
|
905
827
|
* Function printInLineFunction() : Print in line function.
|
|
906
828
|
*/
|
|
@@ -910,7 +832,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
910
832
|
fn = Logger.getFunctionView(fn);
|
|
911
833
|
this.printInLineElement(type, source, key, fn);
|
|
912
834
|
}
|
|
913
|
-
|
|
914
835
|
/**
|
|
915
836
|
* Function printInLineString() : Print in line string.
|
|
916
837
|
*/
|
|
@@ -919,7 +840,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
919
840
|
value: function printInLineString(type, source, string) {
|
|
920
841
|
this.printInLineElement(type, source, "(string)", string);
|
|
921
842
|
}
|
|
922
|
-
|
|
923
843
|
/**
|
|
924
844
|
* Function printNextLineObject() : Print object in next line.
|
|
925
845
|
*/
|
|
@@ -931,7 +851,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
931
851
|
// print in next line
|
|
932
852
|
this.out(obj);
|
|
933
853
|
}
|
|
934
|
-
|
|
935
854
|
/**
|
|
936
855
|
* Function printMultiLineObject() : Print object in multiline format.
|
|
937
856
|
*/
|
|
@@ -939,17 +858,16 @@ var Logger = /*#__PURE__*/function () {
|
|
|
939
858
|
key: "printMultiLineObject",
|
|
940
859
|
value: function printMultiLineObject(type, source, obj) {
|
|
941
860
|
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));
|
|
942
|
-
for (var
|
|
943
|
-
var value = obj[
|
|
861
|
+
for (var key in obj) {
|
|
862
|
+
var value = obj[key];
|
|
944
863
|
if (_typeof(value) === "object") {
|
|
945
864
|
value = JSON.stringify(this.useWrapper(value), getCircularReplacer());
|
|
946
|
-
} else if (typeof obj[
|
|
865
|
+
} else if (typeof obj[key] == "function") {
|
|
947
866
|
value = Logger.getFunctionView(value);
|
|
948
867
|
}
|
|
949
|
-
this.out.apply(this, ["%c" +
|
|
868
|
+
this.out.apply(this, ["%c" + key + ": `" + this.useWrapper(value) + "`", "color: #a3a3a3"]);
|
|
950
869
|
}
|
|
951
870
|
}
|
|
952
|
-
|
|
953
871
|
/**
|
|
954
872
|
* Function getRandomColor() : Return random color.
|
|
955
873
|
*/
|
|
@@ -965,22 +883,20 @@ var Logger = /*#__PURE__*/function () {
|
|
|
965
883
|
// it returns the ratio of difference... closer to 1.0 is less difference.
|
|
966
884
|
return hexColorDelta(color, value) >= 0.8;
|
|
967
885
|
});
|
|
968
|
-
|
|
969
886
|
// if the color is similar, try again.
|
|
970
887
|
if (similar) {
|
|
971
888
|
return this.getRandomColor();
|
|
972
889
|
}
|
|
973
890
|
return color;
|
|
974
891
|
}
|
|
975
|
-
|
|
976
892
|
/**
|
|
977
893
|
* Function out() : Print console log with style
|
|
978
894
|
*/
|
|
979
895
|
}, {
|
|
980
896
|
key: "out",
|
|
981
897
|
value: function out() {
|
|
982
|
-
for (var _len = arguments.length, args = new Array(_len),
|
|
983
|
-
args[
|
|
898
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
899
|
+
args[_key] = arguments[_key];
|
|
984
900
|
}
|
|
985
901
|
this.outputHandler.apply(this, args);
|
|
986
902
|
}
|
|
@@ -989,7 +905,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
989
905
|
value: function getName() {
|
|
990
906
|
return 'Core/Modules/Logger';
|
|
991
907
|
}
|
|
992
|
-
|
|
993
908
|
/**
|
|
994
909
|
* Function reset() : Reset logger globals.
|
|
995
910
|
*/
|
|
@@ -1001,7 +916,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1001
916
|
Logger.colorsInUse = [];
|
|
1002
917
|
Logger.sharedData = {};
|
|
1003
918
|
}
|
|
1004
|
-
|
|
1005
919
|
/**
|
|
1006
920
|
* Function createCustomWrapper() : Creates custom wrapper for log entities.
|
|
1007
921
|
*/
|
|
@@ -1019,29 +933,57 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1019
933
|
callback: callback
|
|
1020
934
|
});
|
|
1021
935
|
}
|
|
1022
|
-
|
|
1023
936
|
/**
|
|
1024
937
|
* Function getCallerName() : Return caller name.
|
|
1025
938
|
*/
|
|
1026
939
|
}, {
|
|
1027
940
|
key: "getCallerName",
|
|
1028
941
|
value: function getCallerName() {
|
|
942
|
+
var _error$stack;
|
|
1029
943
|
var error = new Error(),
|
|
1030
|
-
|
|
944
|
+
errorsPerLine = ((_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : _error$stack.split("\n")) || [],
|
|
945
|
+
caller = errorsPerLine.length ? errorsPerLine[STACK_BACKWARD_CALLER_INDEX].trim() : UNKNOWN_CALLER_NAME;
|
|
1031
946
|
if (caller.startsWith("at new")) {
|
|
1032
947
|
return "constructor";
|
|
1033
948
|
}
|
|
1034
|
-
|
|
949
|
+
var extractName = caller.split(".")[1].split(" ")[0],
|
|
950
|
+
isBabelAsyncRuntime = false;
|
|
951
|
+
// Babel compatibility.
|
|
952
|
+
if (extractName.includes('_callee')) {
|
|
953
|
+
var _loop = function _loop() {
|
|
954
|
+
var line = errorsPerLine[i];
|
|
955
|
+
var isExcluded = BABEL_EXCLUDE_FUNCTIONS_NAMES.some(function (excludeName) {
|
|
956
|
+
return line.includes(excludeName);
|
|
957
|
+
});
|
|
958
|
+
if (!isExcluded) {
|
|
959
|
+
var format = line.trim().split(' ');
|
|
960
|
+
if (format.length <= 2) {
|
|
961
|
+
return "continue";
|
|
962
|
+
}
|
|
963
|
+
extractName = format[1].split(".")[1];
|
|
964
|
+
isBabelAsyncRuntime = true;
|
|
965
|
+
return "break";
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
// Run till find reliable function name.
|
|
969
|
+
for (var i = STACK_BACKWARD_CALLER_INDEX; i < errorsPerLine.length; i++) {
|
|
970
|
+
var _ret = _loop();
|
|
971
|
+
if (_ret === "continue") continue;
|
|
972
|
+
if (_ret === "break") break;
|
|
973
|
+
}
|
|
974
|
+
if (!isBabelAsyncRuntime) {
|
|
975
|
+
extractName = UNKNOWN_CALLER_NAME;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return extractName;
|
|
1035
979
|
}
|
|
1036
|
-
|
|
1037
980
|
/**
|
|
1038
981
|
* Function functionView() : Return function preview.
|
|
1039
982
|
*/
|
|
1040
983
|
}, {
|
|
1041
984
|
key: "getFunctionView",
|
|
1042
985
|
value: function getFunctionView(fn) {
|
|
1043
|
-
var fReturn =
|
|
1044
|
-
|
|
986
|
+
var fReturn = UNKNOWN_CALLER_NAME;
|
|
1045
987
|
// TODO: Check if works.
|
|
1046
988
|
if (typeof fn !== "string" && fn.name.length !== 0) {
|
|
1047
989
|
fReturn = fn.name.split(" ")[1] + "()";
|
|
@@ -1108,10 +1050,6 @@ function _wrapNativeSuper(Class) {
|
|
|
1108
1050
|
return _wrapNativeSuper(Class);
|
|
1109
1051
|
}
|
|
1110
1052
|
|
|
1111
|
-
/**
|
|
1112
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1113
|
-
*/
|
|
1114
|
-
|
|
1115
1053
|
var CommandAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
1116
1054
|
_inherits(CommandAlreadyRegistered, _Error);
|
|
1117
1055
|
var _super = _createSuper(CommandAlreadyRegistered);
|
|
@@ -1135,10 +1073,6 @@ var CommandNotFound = /*#__PURE__*/function (_Error) {
|
|
|
1135
1073
|
return _createClass(CommandNotFound);
|
|
1136
1074
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1137
1075
|
|
|
1138
|
-
/**
|
|
1139
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1140
|
-
*/
|
|
1141
|
-
|
|
1142
1076
|
var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
1143
1077
|
_inherits(ControllerAlreadyRegistered, _Error);
|
|
1144
1078
|
var _super = _createSuper(ControllerAlreadyRegistered);
|
|
@@ -1149,10 +1083,6 @@ var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
|
1149
1083
|
return _createClass(ControllerAlreadyRegistered);
|
|
1150
1084
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1151
1085
|
|
|
1152
|
-
/**
|
|
1153
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1154
|
-
*/
|
|
1155
|
-
|
|
1156
1086
|
var ForceMethodBase = /*#__PURE__*/function (_Error) {
|
|
1157
1087
|
_inherits(ForceMethodBase, _Error);
|
|
1158
1088
|
var _super = _createSuper(ForceMethodBase);
|
|
@@ -1181,7 +1111,6 @@ ForceMethod: ForceMethod
|
|
|
1181
1111
|
});
|
|
1182
1112
|
|
|
1183
1113
|
var IdCounter = 0;
|
|
1184
|
-
|
|
1185
1114
|
/**
|
|
1186
1115
|
* Base class 4 *
|
|
1187
1116
|
*/
|
|
@@ -1268,7 +1197,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1268
1197
|
key: "register",
|
|
1269
1198
|
value: function register(commands, controller) {
|
|
1270
1199
|
var _this2 = this;
|
|
1271
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1272
1200
|
var result = {};
|
|
1273
1201
|
Object.values(commands).forEach(function (command) {
|
|
1274
1202
|
var commandName = command.getName();
|
|
@@ -1304,11 +1232,9 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1304
1232
|
if (!CommandClass) {
|
|
1305
1233
|
throw new CommandNotFound(name);
|
|
1306
1234
|
}
|
|
1307
|
-
|
|
1308
1235
|
// @ts-ignore
|
|
1309
1236
|
return new CommandClass(args, options);
|
|
1310
1237
|
}
|
|
1311
|
-
|
|
1312
1238
|
/**
|
|
1313
1239
|
* Function onBefore() : Used to set hooks that effects only data and not UI.
|
|
1314
1240
|
*/
|
|
@@ -1317,7 +1243,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1317
1243
|
value: function onBefore(hookCommand, callback) {
|
|
1318
1244
|
Commands.hookCommand(this.onBeforeHooks, hookCommand, callback);
|
|
1319
1245
|
}
|
|
1320
|
-
|
|
1321
1246
|
/**
|
|
1322
1247
|
* Function onBeforeUI() : Used to set hooks that effects only UI.
|
|
1323
1248
|
*/
|
|
@@ -1326,7 +1251,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1326
1251
|
value: function onBeforeUI(hookCommand, callback) {
|
|
1327
1252
|
Commands.hookCommand(this.onBeforeUIHooks, hookCommand, callback);
|
|
1328
1253
|
}
|
|
1329
|
-
|
|
1330
1254
|
/**
|
|
1331
1255
|
* Function onAfter() : Used to set hooks that effects only data and not UI.
|
|
1332
1256
|
*/
|
|
@@ -1335,7 +1259,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1335
1259
|
value: function onAfter(hookCommand, callback) {
|
|
1336
1260
|
Commands.hookCommand(this.onAfterHooks, hookCommand, callback);
|
|
1337
1261
|
}
|
|
1338
|
-
|
|
1339
1262
|
/**
|
|
1340
1263
|
* Function onAfterUI() : Used to set hooks that effects only UI.
|
|
1341
1264
|
*/
|
|
@@ -1344,7 +1267,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1344
1267
|
value: function onAfterUI(command, callback) {
|
|
1345
1268
|
Commands.hookCommand(this.onAfterUIHooks, command, callback);
|
|
1346
1269
|
}
|
|
1347
|
-
|
|
1348
1270
|
/**
|
|
1349
1271
|
* Function onAfterOnce() : Used to set hooks that effects only data and not UI.
|
|
1350
1272
|
*/
|
|
@@ -1353,7 +1275,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1353
1275
|
value: function onAfterOnce(command, callback) {
|
|
1354
1276
|
Commands.hookCommand(this.onAfterOnceHooks, command, callback);
|
|
1355
1277
|
}
|
|
1356
|
-
|
|
1357
1278
|
/**
|
|
1358
1279
|
* Function onAfterAffect() : Used to register a trigger that runs command after `hookCommand` run's.
|
|
1359
1280
|
*/
|
|
@@ -1593,7 +1514,6 @@ var Controllers = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1593
1514
|
if (this.controllers[controller.getName()]) {
|
|
1594
1515
|
throw new ControllerAlreadyRegistered(controller);
|
|
1595
1516
|
}
|
|
1596
|
-
|
|
1597
1517
|
// Register.
|
|
1598
1518
|
this.controllers[controller.getName()] = controller;
|
|
1599
1519
|
return controller;
|
|
@@ -1664,7 +1584,6 @@ var Http = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1664
1584
|
_this.apiBaseUrl = apiBaseUrl + '/';
|
|
1665
1585
|
return _this;
|
|
1666
1586
|
}
|
|
1667
|
-
|
|
1668
1587
|
/**
|
|
1669
1588
|
* Function fetch() : Fetch api.
|
|
1670
1589
|
*/
|
|
@@ -1760,7 +1679,6 @@ var Data = /*#__PURE__*/function (_Commands) {
|
|
|
1760
1679
|
var _this;
|
|
1761
1680
|
_classCallCheck(this, Data);
|
|
1762
1681
|
_this = _super.call(this);
|
|
1763
|
-
|
|
1764
1682
|
// @ts-ignore
|
|
1765
1683
|
Data.client = new Http(Config.baseURL);
|
|
1766
1684
|
return _this;
|
|
@@ -1942,7 +1860,6 @@ var CommandBase = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1942
1860
|
value: function apply() {
|
|
1943
1861
|
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
|
|
1944
1862
|
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
|
|
1945
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1946
1863
|
throw new ForceMethod(this, "apply");
|
|
1947
1864
|
}
|
|
1948
1865
|
}, {
|
|
@@ -2028,7 +1945,6 @@ var CommandData = /*#__PURE__*/function (_CommandBase) {
|
|
|
2028
1945
|
value: function apply() {
|
|
2029
1946
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
|
|
2030
1947
|
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
|
|
2031
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2032
1948
|
var endpoint = this.applyEndpointFormat(this.getEndpoint(), args);
|
|
2033
1949
|
return data.getClient().fetch(endpoint, data.currentHttpMethod, args || null);
|
|
2034
1950
|
}
|
|
@@ -2123,10 +2039,6 @@ var Controller = /*#__PURE__*/function (_ObjectBase) {
|
|
|
2123
2039
|
value: function getInternal() {
|
|
2124
2040
|
return {};
|
|
2125
2041
|
}
|
|
2126
|
-
|
|
2127
|
-
/**
|
|
2128
|
-
* Function setupHooks() : Override this method to setup hooks.
|
|
2129
|
-
*/
|
|
2130
2042
|
}], [{
|
|
2131
2043
|
key: "getName",
|
|
2132
2044
|
value: function getName() {
|
|
@@ -2177,7 +2089,7 @@ function errorInitTwice() {
|
|
|
2177
2089
|
}
|
|
2178
2090
|
errorInitTwice();
|
|
2179
2091
|
var config = {
|
|
2180
|
-
version:
|
|
2092
|
+
version: version
|
|
2181
2093
|
};
|
|
2182
2094
|
var CoreAPI = _objectSpread2({
|
|
2183
2095
|
initialize: function initialize$1(configuration) {
|
|
@@ -2195,7 +2107,6 @@ var CoreAPI = _objectSpread2({
|
|
|
2195
2107
|
},
|
|
2196
2108
|
config: config
|
|
2197
2109
|
}, exported);
|
|
2198
|
-
|
|
2199
2110
|
// TODO: Make it available only for development.
|
|
2200
2111
|
if (!(globalThis !== null && globalThis !== void 0 && globalThis.ZenCore)) globalThis.ZenCore = CoreAPI;
|
|
2201
2112
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/clients/http.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAI7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,qBAAa,IAAK,SAAQ,UAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAEpC,MAAM,CAAC,OAAO;IAId;;OAEG;gBACU,UAAU,SAAqB;IAU5C;;OAEG;IACG,KAAK,CAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,GAAE,EAAE,GAAG,IAAW;CA2C5E;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-base.d.ts","sourceRoot":"","sources":["../src/command-bases/command-base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAM7C,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,8BAAsB,WAAY,SAAQ,UAAU;IAChD,SAAS,CAAC,IAAI,EAAE,qBAAqB,CAAM;IAC3C,SAAS,CAAC,OAAO,EAAE,wBAAwB,CAAM;IAEjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEnB,IAAI,GAAE,qBAA0B,EAAE,OAAO,KAAK;IAc3D,UAAU,CAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,wBAAwB;IAK1E,KAAK,CAAE,IAAI,wBAAY,EAAE,OAAO,2BAAe,GAAI,GAAG;IAIhD,GAAG;IAUT,OAAO;IAIP,UAAU;IAIV,aAAa,CAAC,IAAG,IAAI;IAErB,YAAY,CAAC,IAAG,IAAI;CACvB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-data.d.ts","sourceRoot":"","sources":["../src/command-bases/command-data.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,8BAAsB,WAAY,SAAQ,WAAW;IACjD,MAAM,CAAC,OAAO;IAId;;;;;;;;OAQG;IACH,WAAW,IAAI,MAAM;IAIrB,KAAK,CAAE,IAAI,yDAAY,EAAE,OAAO,4DAAe;IAQ/C,OAAO,CAAC,mBAAmB;CAgB9B;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-internal.d.ts","sourceRoot":"","sources":["../src/command-bases/command-internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,eAAgB,SAAQ,WAAW;IAC5C,MAAM,CAAC,OAAO;CAGjB;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-public.d.ts","sourceRoot":"","sources":["../src/command-bases/command-public.ts"],"names":[],"mappings":"AAAA;;;KAGK;AACL,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,aAAc,SAAQ,WAAW;IAC1C,MAAM,CAAC,OAAO;CAGjB;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/command-bases/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/core/controller.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAI/E,8BAAsB,UAAW,SAAQ,UAAU;IAC/C,QAAQ,EAAE;QAAE,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,aAAa,CAAA;KAAE,CAAC;IACpD,IAAI,EAAE;QAAE,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,WAAW,CAAA;KAAE,CAAC;IAC9C,QAAQ,EAAE;QAAE,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,eAAe,CAAA;KAAE,CAAC;IAEtD,MAAM,CAAC,OAAO;;IAUd,UAAU;IAMV,QAAQ;IAWR,WAAW,IAAI;QAAE,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,aAAa,CAAA;KAAE;IAIxD,OAAO,IAAI;QAAE,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,WAAW,CAAA;KAAE;IAIlD,WAAW,IAAI;QAAE,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,eAAe,CAAA;KAAE;IAI1D;;OAEG;IACH,UAAU,CAAC,IAAG,IAAI;CACrB;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-base.d.ts","sourceRoot":"","sources":["../src/core/object-base.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE;;GAEG;AACH,8BAAsB,UAAW,YAAW,oBAAoB;IACrD,SAAS,EAAE,MAAM,CAAK;IAE7B,MAAM,CAAC,OAAO,IAAI,MAAM;;IAUxB,OAAO,IAAI,MAAM;CAGpB;AAED,wBAAgB,iBAAiB,WAIhC;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/enums/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,cAAc;IACtB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,WAAW,KAAK;CACnB"}
|