@zenflux/core 0.0.0-alpha.6 → 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 +18 -145
- package/dist/es/clients/http.d.ts +21 -0
- package/dist/es/clients/http.d.ts.map +1 -0
- package/dist/es/command-bases/command-base.d.ts +23 -0
- package/dist/es/command-bases/command-base.d.ts.map +1 -0
- package/dist/es/command-bases/command-data.d.ts +18 -0
- package/dist/es/command-bases/command-data.d.ts.map +1 -0
- package/dist/es/command-bases/command-internal.d.ts +10 -0
- package/dist/es/command-bases/command-internal.d.ts.map +1 -0
- package/dist/es/command-bases/command-public.d.ts +10 -0
- package/dist/es/command-bases/command-public.d.ts.map +1 -0
- package/dist/es/command-bases/index.d.ts +8 -0
- package/dist/es/command-bases/index.d.ts.map +1 -0
- package/dist/es/core/controller.d.ts +36 -0
- package/dist/es/core/controller.d.ts.map +1 -0
- package/dist/es/core/index.d.ts +3 -0
- package/dist/es/core/index.d.ts.map +1 -0
- package/dist/es/core/object-base.d.ts +15 -0
- package/dist/es/core/object-base.d.ts.map +1 -0
- package/dist/es/enums/http.d.ts +13 -0
- package/dist/es/enums/http.d.ts.map +1 -0
- package/dist/es/errors/command-already-registered.d.ts +9 -0
- package/dist/es/errors/command-already-registered.d.ts.map +1 -0
- package/dist/es/errors/command-not-found.d.ts +8 -0
- package/dist/es/errors/command-not-found.d.ts.map +1 -0
- package/dist/es/errors/controller-already-registered.d.ts +9 -0
- package/dist/es/errors/controller-already-registered.d.ts.map +1 -0
- package/dist/es/errors/force-method.d.ts +12 -0
- package/dist/es/errors/force-method.d.ts.map +1 -0
- package/dist/es/errors/index.d.ts +5 -0
- package/dist/es/errors/index.d.ts.map +1 -0
- package/dist/es/exports.d.ts +11 -0
- package/dist/es/exports.d.ts.map +1 -0
- package/dist/es/index.d.ts +6 -0
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/initializer.d.ts +20 -0
- package/dist/es/initializer.d.ts.map +1 -0
- package/dist/es/interfaces/commands.d.ts +14 -0
- package/dist/es/interfaces/commands.d.ts.map +1 -0
- package/dist/es/interfaces/config.d.ts +11 -0
- package/dist/es/interfaces/config.d.ts.map +1 -0
- package/dist/es/interfaces/managers.d.ts +14 -0
- package/dist/es/interfaces/managers.d.ts.map +1 -0
- package/dist/es/interfaces/object-base.d.ts +11 -0
- package/dist/es/interfaces/object-base.d.ts.map +1 -0
- package/dist/es/manager-bases/commands.d.ts +76 -0
- package/dist/es/manager-bases/commands.d.ts.map +1 -0
- package/dist/es/manager-bases/controllers.d.ts +19 -0
- package/dist/es/manager-bases/controllers.d.ts.map +1 -0
- package/dist/es/manager-bases/data.d.ts +24 -0
- package/dist/es/manager-bases/data.d.ts.map +1 -0
- package/dist/es/manager-bases/index.d.ts +8 -0
- package/dist/es/manager-bases/index.d.ts.map +1 -0
- package/dist/es/manager-bases/internal.d.ts +10 -0
- package/dist/es/manager-bases/internal.d.ts.map +1 -0
- package/dist/es/managers/index.d.ts +16 -0
- package/dist/es/managers/index.d.ts.map +1 -0
- package/dist/es/modules/index.d.ts +2 -0
- package/dist/es/modules/index.d.ts.map +1 -0
- package/dist/es/modules/logger.d.ts +118 -0
- package/dist/es/modules/logger.d.ts.map +1 -0
- package/dist/es/utils/index.d.ts +3 -0
- package/dist/es/utils/index.d.ts.map +1 -0
- package/dist/es/utils/object.d.ts +7 -0
- package/dist/es/utils/object.d.ts.map +1 -0
- package/dist/es/utils/rgb.d.ts +7 -0
- package/dist/es/utils/rgb.d.ts.map +1 -0
- package/dist/es/zenflux-core.js +18 -145
- package/dist/esm/zenflux-core.mjs +2083 -0
- package/dist/umd/zenflux-core.js +18 -145
- package/package.json +3 -2
- package/src/initializer.ts +2 -1
- package/types/index.d.ts +3 -3
- package/dist/es/zenflux-core.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rgb.d.ts","sourceRoot":"","sources":["../src/utils/rgb.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAoB,MAAM,QAAQ,MAAM,KAAI,MA2BrE,CAAC"}
|
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.4",
|
|
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
|
};
|
|
@@ -674,7 +607,6 @@ var MAX_WRAPPING_RECURSIVE_DEPTH = 4,
|
|
|
674
607
|
STACK_BACKWARD_CALLER_INDEX = 3,
|
|
675
608
|
UNKNOWN_CALLER_NAME = 'anonymous function',
|
|
676
609
|
BABEL_EXCLUDE_FUNCTIONS_NAMES = ['_callee', 'tryCatch', '<anonymous>', 'Generator.next', 'asyncGeneratorStep', '_next'];
|
|
677
|
-
|
|
678
610
|
// TODO: Should by dynamic/configure-able.
|
|
679
611
|
Error.stackTraceLimit = 50;
|
|
680
612
|
var Logger = /*#__PURE__*/function () {
|
|
@@ -703,7 +635,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
703
635
|
this.initialize();
|
|
704
636
|
}
|
|
705
637
|
}
|
|
706
|
-
|
|
707
638
|
/**
|
|
708
639
|
* Function initialize() : Initialize logger class.
|
|
709
640
|
*/
|
|
@@ -723,7 +654,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
723
654
|
this.outputHandler = console.log;
|
|
724
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"];
|
|
725
656
|
}
|
|
726
|
-
|
|
727
657
|
/**
|
|
728
658
|
* Function setOutputHandler() : Set custom output handler.
|
|
729
659
|
*/
|
|
@@ -732,7 +662,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
732
662
|
value: function setOutputHandler(outputHandler) {
|
|
733
663
|
this.outputHandler = outputHandler;
|
|
734
664
|
}
|
|
735
|
-
|
|
736
665
|
/**
|
|
737
666
|
* Function useWrapper() : Search for customized log view, each instance,
|
|
738
667
|
* that typeof the instance was registered wrapper will have unique output
|
|
@@ -747,10 +676,8 @@ var Logger = /*#__PURE__*/function () {
|
|
|
747
676
|
return obj;
|
|
748
677
|
}
|
|
749
678
|
Logger.wrapperDepth++;
|
|
750
|
-
|
|
751
679
|
// Result will lose classType (instanceOf will not work), now based on obj.
|
|
752
680
|
var result = _objectSpread2({}, obj);
|
|
753
|
-
|
|
754
681
|
// @ts-ignore
|
|
755
682
|
Object.values(Logger.wrappers).forEach(function (_ref) {
|
|
756
683
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
@@ -774,7 +701,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
774
701
|
Logger.wrapperDepth--;
|
|
775
702
|
return result;
|
|
776
703
|
}
|
|
777
|
-
|
|
778
704
|
/**
|
|
779
705
|
* Function startEmpty() : Notify function start without args.
|
|
780
706
|
*
|
|
@@ -787,7 +713,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
787
713
|
if (!this.state) return;
|
|
788
714
|
this.printFunctionNotify("se", Logger.getCallerName(), output);
|
|
789
715
|
}
|
|
790
|
-
|
|
791
716
|
/**
|
|
792
717
|
* Function startWith() : Notify function start with args.
|
|
793
718
|
*
|
|
@@ -803,22 +728,20 @@ var Logger = /*#__PURE__*/function () {
|
|
|
803
728
|
if (typeof params == "string") {
|
|
804
729
|
this.printInLineString(type, source, params);
|
|
805
730
|
} else if (Object.keys(params).length === 1) {
|
|
806
|
-
var
|
|
731
|
+
var key = Object.keys(params)[0];
|
|
807
732
|
var value = Object.values(params)[0];
|
|
808
|
-
|
|
809
733
|
// TODO: Check is repeated logic, handle it.
|
|
810
734
|
if (_typeof(value) === "object") {
|
|
811
|
-
this.printNextLineObject(type, source,
|
|
735
|
+
this.printNextLineObject(type, source, key, value || {});
|
|
812
736
|
} else if (typeof value == "function") {
|
|
813
|
-
this.printInLineFunction(type, source,
|
|
737
|
+
this.printInLineFunction(type, source, key, value);
|
|
814
738
|
} else {
|
|
815
|
-
this.printInLineElement(type, source,
|
|
739
|
+
this.printInLineElement(type, source, key, value);
|
|
816
740
|
}
|
|
817
741
|
} else {
|
|
818
742
|
this.printMultiLineObject(type, source, params);
|
|
819
743
|
}
|
|
820
744
|
}
|
|
821
|
-
|
|
822
745
|
/**
|
|
823
746
|
* Function object() : Prints object.
|
|
824
747
|
**/
|
|
@@ -830,14 +753,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
830
753
|
if (!this.state) return;
|
|
831
754
|
var source = Logger.getCallerName();
|
|
832
755
|
params = Object.create(params);
|
|
833
|
-
for (var
|
|
834
|
-
if (_typeof(params[
|
|
835
|
-
params[
|
|
756
|
+
for (var key in params) {
|
|
757
|
+
if (_typeof(params[key]) === "object") {
|
|
758
|
+
params[key] = JSON.stringify(this.useWrapper(params[key]), getCircularReplacer());
|
|
836
759
|
}
|
|
837
|
-
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));
|
|
838
761
|
}
|
|
839
762
|
}
|
|
840
|
-
|
|
841
763
|
/**
|
|
842
764
|
* Function debug() : Notify debug.
|
|
843
765
|
*/
|
|
@@ -847,7 +769,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
847
769
|
if (!this.state) return;
|
|
848
770
|
this.printFunctionNotify("db", Logger.getCallerName(), output);
|
|
849
771
|
}
|
|
850
|
-
|
|
851
772
|
/**
|
|
852
773
|
* Function drop : Preview as continue of log which drop ite.
|
|
853
774
|
*/
|
|
@@ -856,12 +777,11 @@ var Logger = /*#__PURE__*/function () {
|
|
|
856
777
|
value: function drop(according, data) {
|
|
857
778
|
if (!this.state) return;
|
|
858
779
|
var source = Logger.getCallerName();
|
|
859
|
-
for (var
|
|
860
|
-
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));
|
|
861
782
|
}
|
|
862
783
|
this.out(data);
|
|
863
784
|
}
|
|
864
|
-
|
|
865
785
|
/**
|
|
866
786
|
* Function throw() : Throws logged error.
|
|
867
787
|
*/
|
|
@@ -874,7 +794,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
874
794
|
if (params) this.printNextLineObject("tw", Logger.getCallerName(), name, params);
|
|
875
795
|
throw new Error().stack;
|
|
876
796
|
}
|
|
877
|
-
|
|
878
797
|
/**
|
|
879
798
|
* Function clone() : Create clone instance.
|
|
880
799
|
*/
|
|
@@ -883,7 +802,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
883
802
|
value: function clone() {
|
|
884
803
|
return Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
885
804
|
}
|
|
886
|
-
|
|
887
805
|
/**
|
|
888
806
|
* Function printFunctionNotify() : Print simple log for notify source (function).
|
|
889
807
|
*
|
|
@@ -893,7 +811,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
893
811
|
value: function printFunctionNotify(type, source, output) {
|
|
894
812
|
this.out.apply(this, ["%c(".concat(type, ")-> %c%c").concat(this.name, "%c::%c").concat(source, "%c() ").concat(output, "%c")].concat(this.defaultStyle));
|
|
895
813
|
}
|
|
896
|
-
|
|
897
814
|
/**
|
|
898
815
|
* Function printInLineElement() : Print in line element.
|
|
899
816
|
*/
|
|
@@ -902,7 +819,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
902
819
|
value: function printInLineElement(type, source, key, value) {
|
|
903
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));
|
|
904
821
|
}
|
|
905
|
-
|
|
906
822
|
/**
|
|
907
823
|
* Function printInLineFunction() : Print in line function.
|
|
908
824
|
*/
|
|
@@ -912,7 +828,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
912
828
|
fn = Logger.getFunctionView(fn);
|
|
913
829
|
this.printInLineElement(type, source, key, fn);
|
|
914
830
|
}
|
|
915
|
-
|
|
916
831
|
/**
|
|
917
832
|
* Function printInLineString() : Print in line string.
|
|
918
833
|
*/
|
|
@@ -921,7 +836,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
921
836
|
value: function printInLineString(type, source, string) {
|
|
922
837
|
this.printInLineElement(type, source, "(string)", string);
|
|
923
838
|
}
|
|
924
|
-
|
|
925
839
|
/**
|
|
926
840
|
* Function printNextLineObject() : Print object in next line.
|
|
927
841
|
*/
|
|
@@ -933,7 +847,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
933
847
|
// print in next line
|
|
934
848
|
this.out(obj);
|
|
935
849
|
}
|
|
936
|
-
|
|
937
850
|
/**
|
|
938
851
|
* Function printMultiLineObject() : Print object in multiline format.
|
|
939
852
|
*/
|
|
@@ -941,17 +854,16 @@ var Logger = /*#__PURE__*/function () {
|
|
|
941
854
|
key: "printMultiLineObject",
|
|
942
855
|
value: function printMultiLineObject(type, source, obj) {
|
|
943
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));
|
|
944
|
-
for (var
|
|
945
|
-
var value = obj[
|
|
857
|
+
for (var key in obj) {
|
|
858
|
+
var value = obj[key];
|
|
946
859
|
if (_typeof(value) === "object") {
|
|
947
860
|
value = JSON.stringify(this.useWrapper(value), getCircularReplacer());
|
|
948
|
-
} else if (typeof obj[
|
|
861
|
+
} else if (typeof obj[key] == "function") {
|
|
949
862
|
value = Logger.getFunctionView(value);
|
|
950
863
|
}
|
|
951
|
-
this.out.apply(this, ["%c" +
|
|
864
|
+
this.out.apply(this, ["%c" + key + ": `" + this.useWrapper(value) + "`", "color: #a3a3a3"]);
|
|
952
865
|
}
|
|
953
866
|
}
|
|
954
|
-
|
|
955
867
|
/**
|
|
956
868
|
* Function getRandomColor() : Return random color.
|
|
957
869
|
*/
|
|
@@ -967,22 +879,20 @@ var Logger = /*#__PURE__*/function () {
|
|
|
967
879
|
// it returns the ratio of difference... closer to 1.0 is less difference.
|
|
968
880
|
return hexColorDelta(color, value) >= 0.8;
|
|
969
881
|
});
|
|
970
|
-
|
|
971
882
|
// if the color is similar, try again.
|
|
972
883
|
if (similar) {
|
|
973
884
|
return this.getRandomColor();
|
|
974
885
|
}
|
|
975
886
|
return color;
|
|
976
887
|
}
|
|
977
|
-
|
|
978
888
|
/**
|
|
979
889
|
* Function out() : Print console log with style
|
|
980
890
|
*/
|
|
981
891
|
}, {
|
|
982
892
|
key: "out",
|
|
983
893
|
value: function out() {
|
|
984
|
-
for (var _len = arguments.length, args = new Array(_len),
|
|
985
|
-
args[
|
|
894
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
895
|
+
args[_key] = arguments[_key];
|
|
986
896
|
}
|
|
987
897
|
this.outputHandler.apply(this, args);
|
|
988
898
|
}
|
|
@@ -991,7 +901,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
991
901
|
value: function getName() {
|
|
992
902
|
return 'Core/Modules/Logger';
|
|
993
903
|
}
|
|
994
|
-
|
|
995
904
|
/**
|
|
996
905
|
* Function reset() : Reset logger globals.
|
|
997
906
|
*/
|
|
@@ -1003,7 +912,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1003
912
|
Logger.colorsInUse = [];
|
|
1004
913
|
Logger.sharedData = {};
|
|
1005
914
|
}
|
|
1006
|
-
|
|
1007
915
|
/**
|
|
1008
916
|
* Function createCustomWrapper() : Creates custom wrapper for log entities.
|
|
1009
917
|
*/
|
|
@@ -1021,7 +929,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1021
929
|
callback: callback
|
|
1022
930
|
});
|
|
1023
931
|
}
|
|
1024
|
-
|
|
1025
932
|
/**
|
|
1026
933
|
* Function getCallerName() : Return caller name.
|
|
1027
934
|
*/
|
|
@@ -1037,7 +944,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1037
944
|
}
|
|
1038
945
|
var extractName = caller.split(".")[1].split(" ")[0],
|
|
1039
946
|
isBabelAsyncRuntime = false;
|
|
1040
|
-
|
|
1041
947
|
// Babel compatibility.
|
|
1042
948
|
if (extractName.includes('_callee')) {
|
|
1043
949
|
var _loop = function _loop() {
|
|
@@ -1067,7 +973,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1067
973
|
}
|
|
1068
974
|
return extractName;
|
|
1069
975
|
}
|
|
1070
|
-
|
|
1071
976
|
/**
|
|
1072
977
|
* Function functionView() : Return function preview.
|
|
1073
978
|
*/
|
|
@@ -1075,7 +980,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1075
980
|
key: "getFunctionView",
|
|
1076
981
|
value: function getFunctionView(fn) {
|
|
1077
982
|
var fReturn = UNKNOWN_CALLER_NAME;
|
|
1078
|
-
|
|
1079
983
|
// TODO: Check if works.
|
|
1080
984
|
if (typeof fn !== "string" && fn.name.length !== 0) {
|
|
1081
985
|
fReturn = fn.name.split(" ")[1] + "()";
|
|
@@ -1142,10 +1046,6 @@ function _wrapNativeSuper(Class) {
|
|
|
1142
1046
|
return _wrapNativeSuper(Class);
|
|
1143
1047
|
}
|
|
1144
1048
|
|
|
1145
|
-
/**
|
|
1146
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1147
|
-
*/
|
|
1148
|
-
|
|
1149
1049
|
var CommandAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
1150
1050
|
_inherits(CommandAlreadyRegistered, _Error);
|
|
1151
1051
|
var _super = _createSuper(CommandAlreadyRegistered);
|
|
@@ -1169,10 +1069,6 @@ var CommandNotFound = /*#__PURE__*/function (_Error) {
|
|
|
1169
1069
|
return _createClass(CommandNotFound);
|
|
1170
1070
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1171
1071
|
|
|
1172
|
-
/**
|
|
1173
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1174
|
-
*/
|
|
1175
|
-
|
|
1176
1072
|
var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
1177
1073
|
_inherits(ControllerAlreadyRegistered, _Error);
|
|
1178
1074
|
var _super = _createSuper(ControllerAlreadyRegistered);
|
|
@@ -1183,10 +1079,6 @@ var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
|
|
|
1183
1079
|
return _createClass(ControllerAlreadyRegistered);
|
|
1184
1080
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1185
1081
|
|
|
1186
|
-
/**
|
|
1187
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
1188
|
-
*/
|
|
1189
|
-
|
|
1190
1082
|
var ForceMethodBase = /*#__PURE__*/function (_Error) {
|
|
1191
1083
|
_inherits(ForceMethodBase, _Error);
|
|
1192
1084
|
var _super = _createSuper(ForceMethodBase);
|
|
@@ -1215,7 +1107,6 @@ ForceMethod: ForceMethod
|
|
|
1215
1107
|
});
|
|
1216
1108
|
|
|
1217
1109
|
var IdCounter = 0;
|
|
1218
|
-
|
|
1219
1110
|
/**
|
|
1220
1111
|
* Base class 4 *
|
|
1221
1112
|
*/
|
|
@@ -1302,7 +1193,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1302
1193
|
key: "register",
|
|
1303
1194
|
value: function register(commands, controller) {
|
|
1304
1195
|
var _this2 = this;
|
|
1305
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1306
1196
|
var result = {};
|
|
1307
1197
|
Object.values(commands).forEach(function (command) {
|
|
1308
1198
|
var commandName = command.getName();
|
|
@@ -1338,11 +1228,9 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1338
1228
|
if (!CommandClass) {
|
|
1339
1229
|
throw new CommandNotFound(name);
|
|
1340
1230
|
}
|
|
1341
|
-
|
|
1342
1231
|
// @ts-ignore
|
|
1343
1232
|
return new CommandClass(args, options);
|
|
1344
1233
|
}
|
|
1345
|
-
|
|
1346
1234
|
/**
|
|
1347
1235
|
* Function onBefore() : Used to set hooks that effects only data and not UI.
|
|
1348
1236
|
*/
|
|
@@ -1351,7 +1239,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1351
1239
|
value: function onBefore(hookCommand, callback) {
|
|
1352
1240
|
Commands.hookCommand(this.onBeforeHooks, hookCommand, callback);
|
|
1353
1241
|
}
|
|
1354
|
-
|
|
1355
1242
|
/**
|
|
1356
1243
|
* Function onBeforeUI() : Used to set hooks that effects only UI.
|
|
1357
1244
|
*/
|
|
@@ -1360,7 +1247,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1360
1247
|
value: function onBeforeUI(hookCommand, callback) {
|
|
1361
1248
|
Commands.hookCommand(this.onBeforeUIHooks, hookCommand, callback);
|
|
1362
1249
|
}
|
|
1363
|
-
|
|
1364
1250
|
/**
|
|
1365
1251
|
* Function onAfter() : Used to set hooks that effects only data and not UI.
|
|
1366
1252
|
*/
|
|
@@ -1369,7 +1255,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1369
1255
|
value: function onAfter(hookCommand, callback) {
|
|
1370
1256
|
Commands.hookCommand(this.onAfterHooks, hookCommand, callback);
|
|
1371
1257
|
}
|
|
1372
|
-
|
|
1373
1258
|
/**
|
|
1374
1259
|
* Function onAfterUI() : Used to set hooks that effects only UI.
|
|
1375
1260
|
*/
|
|
@@ -1378,7 +1263,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1378
1263
|
value: function onAfterUI(command, callback) {
|
|
1379
1264
|
Commands.hookCommand(this.onAfterUIHooks, command, callback);
|
|
1380
1265
|
}
|
|
1381
|
-
|
|
1382
1266
|
/**
|
|
1383
1267
|
* Function onAfterOnce() : Used to set hooks that effects only data and not UI.
|
|
1384
1268
|
*/
|
|
@@ -1387,7 +1271,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1387
1271
|
value: function onAfterOnce(command, callback) {
|
|
1388
1272
|
Commands.hookCommand(this.onAfterOnceHooks, command, callback);
|
|
1389
1273
|
}
|
|
1390
|
-
|
|
1391
1274
|
/**
|
|
1392
1275
|
* Function onAfterAffect() : Used to register a trigger that runs command after `hookCommand` run's.
|
|
1393
1276
|
*/
|
|
@@ -1627,7 +1510,6 @@ var Controllers = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1627
1510
|
if (this.controllers[controller.getName()]) {
|
|
1628
1511
|
throw new ControllerAlreadyRegistered(controller);
|
|
1629
1512
|
}
|
|
1630
|
-
|
|
1631
1513
|
// Register.
|
|
1632
1514
|
this.controllers[controller.getName()] = controller;
|
|
1633
1515
|
return controller;
|
|
@@ -1698,7 +1580,6 @@ var Http = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1698
1580
|
_this.apiBaseUrl = apiBaseUrl + '/';
|
|
1699
1581
|
return _this;
|
|
1700
1582
|
}
|
|
1701
|
-
|
|
1702
1583
|
/**
|
|
1703
1584
|
* Function fetch() : Fetch api.
|
|
1704
1585
|
*/
|
|
@@ -1794,7 +1675,6 @@ var Data = /*#__PURE__*/function (_Commands) {
|
|
|
1794
1675
|
var _this;
|
|
1795
1676
|
_classCallCheck(this, Data);
|
|
1796
1677
|
_this = _super.call(this);
|
|
1797
|
-
|
|
1798
1678
|
// @ts-ignore
|
|
1799
1679
|
Data.client = new Http(Config.baseURL);
|
|
1800
1680
|
return _this;
|
|
@@ -1976,7 +1856,6 @@ var CommandBase = /*#__PURE__*/function (_ObjectBase) {
|
|
|
1976
1856
|
value: function apply() {
|
|
1977
1857
|
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
|
|
1978
1858
|
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
|
|
1979
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1980
1859
|
throw new ForceMethod(this, "apply");
|
|
1981
1860
|
}
|
|
1982
1861
|
}, {
|
|
@@ -2062,7 +1941,6 @@ var CommandData = /*#__PURE__*/function (_CommandBase) {
|
|
|
2062
1941
|
value: function apply() {
|
|
2063
1942
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
|
|
2064
1943
|
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
|
|
2065
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2066
1944
|
var endpoint = this.applyEndpointFormat(this.getEndpoint(), args);
|
|
2067
1945
|
return data.getClient().fetch(endpoint, data.currentHttpMethod, args || null);
|
|
2068
1946
|
}
|
|
@@ -2157,10 +2035,6 @@ var Controller = /*#__PURE__*/function (_ObjectBase) {
|
|
|
2157
2035
|
value: function getInternal() {
|
|
2158
2036
|
return {};
|
|
2159
2037
|
}
|
|
2160
|
-
|
|
2161
|
-
/**
|
|
2162
|
-
* Function setupHooks() : Override this method to setup hooks.
|
|
2163
|
-
*/
|
|
2164
2038
|
}], [{
|
|
2165
2039
|
key: "getName",
|
|
2166
2040
|
value: function getName() {
|
|
@@ -2211,7 +2085,7 @@ function errorInitTwice() {
|
|
|
2211
2085
|
}
|
|
2212
2086
|
errorInitTwice();
|
|
2213
2087
|
var config = {
|
|
2214
|
-
version:
|
|
2088
|
+
version: version
|
|
2215
2089
|
};
|
|
2216
2090
|
var CoreAPI = _objectSpread2({
|
|
2217
2091
|
initialize: function initialize$1(configuration) {
|
|
@@ -2229,7 +2103,6 @@ var CoreAPI = _objectSpread2({
|
|
|
2229
2103
|
},
|
|
2230
2104
|
config: config
|
|
2231
2105
|
}, exported);
|
|
2232
|
-
|
|
2233
2106
|
// TODO: Make it available only for development.
|
|
2234
2107
|
if (!(globalThis !== null && globalThis !== void 0 && globalThis.ZenCore)) globalThis.ZenCore = CoreAPI;
|
|
2235
2108
|
|