@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.
Files changed (74) hide show
  1. package/dist/cjs/zenflux-core.js +18 -145
  2. package/dist/es/clients/http.d.ts +21 -0
  3. package/dist/es/clients/http.d.ts.map +1 -0
  4. package/dist/es/command-bases/command-base.d.ts +23 -0
  5. package/dist/es/command-bases/command-base.d.ts.map +1 -0
  6. package/dist/es/command-bases/command-data.d.ts +18 -0
  7. package/dist/es/command-bases/command-data.d.ts.map +1 -0
  8. package/dist/es/command-bases/command-internal.d.ts +10 -0
  9. package/dist/es/command-bases/command-internal.d.ts.map +1 -0
  10. package/dist/es/command-bases/command-public.d.ts +10 -0
  11. package/dist/es/command-bases/command-public.d.ts.map +1 -0
  12. package/dist/es/command-bases/index.d.ts +8 -0
  13. package/dist/es/command-bases/index.d.ts.map +1 -0
  14. package/dist/es/core/controller.d.ts +36 -0
  15. package/dist/es/core/controller.d.ts.map +1 -0
  16. package/dist/es/core/index.d.ts +3 -0
  17. package/dist/es/core/index.d.ts.map +1 -0
  18. package/dist/es/core/object-base.d.ts +15 -0
  19. package/dist/es/core/object-base.d.ts.map +1 -0
  20. package/dist/es/enums/http.d.ts +13 -0
  21. package/dist/es/enums/http.d.ts.map +1 -0
  22. package/dist/es/errors/command-already-registered.d.ts +9 -0
  23. package/dist/es/errors/command-already-registered.d.ts.map +1 -0
  24. package/dist/es/errors/command-not-found.d.ts +8 -0
  25. package/dist/es/errors/command-not-found.d.ts.map +1 -0
  26. package/dist/es/errors/controller-already-registered.d.ts +9 -0
  27. package/dist/es/errors/controller-already-registered.d.ts.map +1 -0
  28. package/dist/es/errors/force-method.d.ts +12 -0
  29. package/dist/es/errors/force-method.d.ts.map +1 -0
  30. package/dist/es/errors/index.d.ts +5 -0
  31. package/dist/es/errors/index.d.ts.map +1 -0
  32. package/dist/es/exports.d.ts +11 -0
  33. package/dist/es/exports.d.ts.map +1 -0
  34. package/dist/es/index.d.ts +6 -0
  35. package/dist/es/index.d.ts.map +1 -0
  36. package/dist/es/initializer.d.ts +20 -0
  37. package/dist/es/initializer.d.ts.map +1 -0
  38. package/dist/es/interfaces/commands.d.ts +14 -0
  39. package/dist/es/interfaces/commands.d.ts.map +1 -0
  40. package/dist/es/interfaces/config.d.ts +11 -0
  41. package/dist/es/interfaces/config.d.ts.map +1 -0
  42. package/dist/es/interfaces/managers.d.ts +14 -0
  43. package/dist/es/interfaces/managers.d.ts.map +1 -0
  44. package/dist/es/interfaces/object-base.d.ts +11 -0
  45. package/dist/es/interfaces/object-base.d.ts.map +1 -0
  46. package/dist/es/manager-bases/commands.d.ts +76 -0
  47. package/dist/es/manager-bases/commands.d.ts.map +1 -0
  48. package/dist/es/manager-bases/controllers.d.ts +19 -0
  49. package/dist/es/manager-bases/controllers.d.ts.map +1 -0
  50. package/dist/es/manager-bases/data.d.ts +24 -0
  51. package/dist/es/manager-bases/data.d.ts.map +1 -0
  52. package/dist/es/manager-bases/index.d.ts +8 -0
  53. package/dist/es/manager-bases/index.d.ts.map +1 -0
  54. package/dist/es/manager-bases/internal.d.ts +10 -0
  55. package/dist/es/manager-bases/internal.d.ts.map +1 -0
  56. package/dist/es/managers/index.d.ts +16 -0
  57. package/dist/es/managers/index.d.ts.map +1 -0
  58. package/dist/es/modules/index.d.ts +2 -0
  59. package/dist/es/modules/index.d.ts.map +1 -0
  60. package/dist/es/modules/logger.d.ts +118 -0
  61. package/dist/es/modules/logger.d.ts.map +1 -0
  62. package/dist/es/utils/index.d.ts +3 -0
  63. package/dist/es/utils/index.d.ts.map +1 -0
  64. package/dist/es/utils/object.d.ts +7 -0
  65. package/dist/es/utils/object.d.ts.map +1 -0
  66. package/dist/es/utils/rgb.d.ts +7 -0
  67. package/dist/es/utils/rgb.d.ts.map +1 -0
  68. package/dist/es/zenflux-core.js +18 -145
  69. package/dist/esm/zenflux-core.mjs +2083 -0
  70. package/dist/umd/zenflux-core.js +18 -145
  71. package/package.json +3 -2
  72. package/src/initializer.ts +2 -1
  73. package/types/index.d.ts +3 -3
  74. package/dist/es/zenflux-core.mjs +0 -1
@@ -65,68 +65,7 @@ function _objectSpread2(target) {
65
65
  return target;
66
66
  }
67
67
 
68
- var name = "@zenflux/core";
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.4",
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
  };
@@ -678,7 +611,6 @@ var MAX_WRAPPING_RECURSIVE_DEPTH = 4,
678
611
  STACK_BACKWARD_CALLER_INDEX = 3,
679
612
  UNKNOWN_CALLER_NAME = 'anonymous function',
680
613
  BABEL_EXCLUDE_FUNCTIONS_NAMES = ['_callee', 'tryCatch', '<anonymous>', 'Generator.next', 'asyncGeneratorStep', '_next'];
681
-
682
614
  // TODO: Should by dynamic/configure-able.
683
615
  Error.stackTraceLimit = 50;
684
616
  var Logger = /*#__PURE__*/function () {
@@ -707,7 +639,6 @@ var Logger = /*#__PURE__*/function () {
707
639
  this.initialize();
708
640
  }
709
641
  }
710
-
711
642
  /**
712
643
  * Function initialize() : Initialize logger class.
713
644
  */
@@ -727,7 +658,6 @@ var Logger = /*#__PURE__*/function () {
727
658
  this.outputHandler = console.log;
728
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"];
729
660
  }
730
-
731
661
  /**
732
662
  * Function setOutputHandler() : Set custom output handler.
733
663
  */
@@ -736,7 +666,6 @@ var Logger = /*#__PURE__*/function () {
736
666
  value: function setOutputHandler(outputHandler) {
737
667
  this.outputHandler = outputHandler;
738
668
  }
739
-
740
669
  /**
741
670
  * Function useWrapper() : Search for customized log view, each instance,
742
671
  * that typeof the instance was registered wrapper will have unique output
@@ -751,10 +680,8 @@ var Logger = /*#__PURE__*/function () {
751
680
  return obj;
752
681
  }
753
682
  Logger.wrapperDepth++;
754
-
755
683
  // Result will lose classType (instanceOf will not work), now based on obj.
756
684
  var result = _objectSpread2({}, obj);
757
-
758
685
  // @ts-ignore
759
686
  Object.values(Logger.wrappers).forEach(function (_ref) {
760
687
  var _ref2 = _slicedToArray(_ref, 1),
@@ -778,7 +705,6 @@ var Logger = /*#__PURE__*/function () {
778
705
  Logger.wrapperDepth--;
779
706
  return result;
780
707
  }
781
-
782
708
  /**
783
709
  * Function startEmpty() : Notify function start without args.
784
710
  *
@@ -791,7 +717,6 @@ var Logger = /*#__PURE__*/function () {
791
717
  if (!this.state) return;
792
718
  this.printFunctionNotify("se", Logger.getCallerName(), output);
793
719
  }
794
-
795
720
  /**
796
721
  * Function startWith() : Notify function start with args.
797
722
  *
@@ -807,22 +732,20 @@ var Logger = /*#__PURE__*/function () {
807
732
  if (typeof params == "string") {
808
733
  this.printInLineString(type, source, params);
809
734
  } else if (Object.keys(params).length === 1) {
810
- var _key = Object.keys(params)[0];
735
+ var key = Object.keys(params)[0];
811
736
  var value = Object.values(params)[0];
812
-
813
737
  // TODO: Check is repeated logic, handle it.
814
738
  if (_typeof(value) === "object") {
815
- this.printNextLineObject(type, source, _key, value || {});
739
+ this.printNextLineObject(type, source, key, value || {});
816
740
  } else if (typeof value == "function") {
817
- this.printInLineFunction(type, source, _key, value);
741
+ this.printInLineFunction(type, source, key, value);
818
742
  } else {
819
- this.printInLineElement(type, source, _key, value);
743
+ this.printInLineElement(type, source, key, value);
820
744
  }
821
745
  } else {
822
746
  this.printMultiLineObject(type, source, params);
823
747
  }
824
748
  }
825
-
826
749
  /**
827
750
  * Function object() : Prints object.
828
751
  **/
@@ -834,14 +757,13 @@ var Logger = /*#__PURE__*/function () {
834
757
  if (!this.state) return;
835
758
  var source = Logger.getCallerName();
836
759
  params = Object.create(params);
837
- for (var _key2 in params) {
838
- if (_typeof(params[_key2]) === "object") {
839
- params[_key2] = JSON.stringify(this.useWrapper(params[_key2]), getCircularReplacer());
760
+ for (var key in params) {
761
+ if (_typeof(params[key]) === "object") {
762
+ params[key] = JSON.stringify(this.useWrapper(params[key]), getCircularReplacer());
840
763
  }
841
- this.out.apply(this, ["%c(ob)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() [").concat(notice, "] ->> ").concat(_key2, ": '").concat(params[_key2], "'%c")].concat(this.defaultStyle));
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));
842
765
  }
843
766
  }
844
-
845
767
  /**
846
768
  * Function debug() : Notify debug.
847
769
  */
@@ -851,7 +773,6 @@ var Logger = /*#__PURE__*/function () {
851
773
  if (!this.state) return;
852
774
  this.printFunctionNotify("db", Logger.getCallerName(), output);
853
775
  }
854
-
855
776
  /**
856
777
  * Function drop : Preview as continue of log which drop ite.
857
778
  */
@@ -860,12 +781,11 @@ var Logger = /*#__PURE__*/function () {
860
781
  value: function drop(according, data) {
861
782
  if (!this.state) return;
862
783
  var source = Logger.getCallerName();
863
- for (var _key3 in according) {
864
- this.out.apply(this, ["%c(dr)-> %c%c".concat(this.name, "%c::%c").concat(source, "%c() ->> corresponding ").concat(_key3, ": '").concat(according[_key3], "' RESULT: %c\u2193")].concat(this.defaultStyle));
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));
865
786
  }
866
787
  this.out(data);
867
788
  }
868
-
869
789
  /**
870
790
  * Function throw() : Throws logged error.
871
791
  */
@@ -878,7 +798,6 @@ var Logger = /*#__PURE__*/function () {
878
798
  if (params) this.printNextLineObject("tw", Logger.getCallerName(), name, params);
879
799
  throw new Error().stack;
880
800
  }
881
-
882
801
  /**
883
802
  * Function clone() : Create clone instance.
884
803
  */
@@ -887,7 +806,6 @@ var Logger = /*#__PURE__*/function () {
887
806
  value: function clone() {
888
807
  return Object.assign(Object.create(Object.getPrototypeOf(this)), this);
889
808
  }
890
-
891
809
  /**
892
810
  * Function printFunctionNotify() : Print simple log for notify source (function).
893
811
  *
@@ -897,7 +815,6 @@ var Logger = /*#__PURE__*/function () {
897
815
  value: function printFunctionNotify(type, source, output) {
898
816
  this.out.apply(this, ["%c(".concat(type, ")-> %c%c").concat(this.name, "%c::%c").concat(source, "%c() ").concat(output, "%c")].concat(this.defaultStyle));
899
817
  }
900
-
901
818
  /**
902
819
  * Function printInLineElement() : Print in line element.
903
820
  */
@@ -906,7 +823,6 @@ var Logger = /*#__PURE__*/function () {
906
823
  value: function printInLineElement(type, source, key, value) {
907
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));
908
825
  }
909
-
910
826
  /**
911
827
  * Function printInLineFunction() : Print in line function.
912
828
  */
@@ -916,7 +832,6 @@ var Logger = /*#__PURE__*/function () {
916
832
  fn = Logger.getFunctionView(fn);
917
833
  this.printInLineElement(type, source, key, fn);
918
834
  }
919
-
920
835
  /**
921
836
  * Function printInLineString() : Print in line string.
922
837
  */
@@ -925,7 +840,6 @@ var Logger = /*#__PURE__*/function () {
925
840
  value: function printInLineString(type, source, string) {
926
841
  this.printInLineElement(type, source, "(string)", string);
927
842
  }
928
-
929
843
  /**
930
844
  * Function printNextLineObject() : Print object in next line.
931
845
  */
@@ -937,7 +851,6 @@ var Logger = /*#__PURE__*/function () {
937
851
  // print in next line
938
852
  this.out(obj);
939
853
  }
940
-
941
854
  /**
942
855
  * Function printMultiLineObject() : Print object in multiline format.
943
856
  */
@@ -945,17 +858,16 @@ var Logger = /*#__PURE__*/function () {
945
858
  key: "printMultiLineObject",
946
859
  value: function printMultiLineObject(type, source, obj) {
947
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));
948
- for (var _key4 in obj) {
949
- var value = obj[_key4];
861
+ for (var key in obj) {
862
+ var value = obj[key];
950
863
  if (_typeof(value) === "object") {
951
864
  value = JSON.stringify(this.useWrapper(value), getCircularReplacer());
952
- } else if (typeof obj[_key4] == "function") {
865
+ } else if (typeof obj[key] == "function") {
953
866
  value = Logger.getFunctionView(value);
954
867
  }
955
- this.out.apply(this, ["%c" + _key4 + ": `" + this.useWrapper(value) + "`", "color: #a3a3a3"]);
868
+ this.out.apply(this, ["%c" + key + ": `" + this.useWrapper(value) + "`", "color: #a3a3a3"]);
956
869
  }
957
870
  }
958
-
959
871
  /**
960
872
  * Function getRandomColor() : Return random color.
961
873
  */
@@ -971,22 +883,20 @@ var Logger = /*#__PURE__*/function () {
971
883
  // it returns the ratio of difference... closer to 1.0 is less difference.
972
884
  return hexColorDelta(color, value) >= 0.8;
973
885
  });
974
-
975
886
  // if the color is similar, try again.
976
887
  if (similar) {
977
888
  return this.getRandomColor();
978
889
  }
979
890
  return color;
980
891
  }
981
-
982
892
  /**
983
893
  * Function out() : Print console log with style
984
894
  */
985
895
  }, {
986
896
  key: "out",
987
897
  value: function out() {
988
- for (var _len = arguments.length, args = new Array(_len), _key5 = 0; _key5 < _len; _key5++) {
989
- args[_key5] = arguments[_key5];
898
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
899
+ args[_key] = arguments[_key];
990
900
  }
991
901
  this.outputHandler.apply(this, args);
992
902
  }
@@ -995,7 +905,6 @@ var Logger = /*#__PURE__*/function () {
995
905
  value: function getName() {
996
906
  return 'Core/Modules/Logger';
997
907
  }
998
-
999
908
  /**
1000
909
  * Function reset() : Reset logger globals.
1001
910
  */
@@ -1007,7 +916,6 @@ var Logger = /*#__PURE__*/function () {
1007
916
  Logger.colorsInUse = [];
1008
917
  Logger.sharedData = {};
1009
918
  }
1010
-
1011
919
  /**
1012
920
  * Function createCustomWrapper() : Creates custom wrapper for log entities.
1013
921
  */
@@ -1025,7 +933,6 @@ var Logger = /*#__PURE__*/function () {
1025
933
  callback: callback
1026
934
  });
1027
935
  }
1028
-
1029
936
  /**
1030
937
  * Function getCallerName() : Return caller name.
1031
938
  */
@@ -1041,7 +948,6 @@ var Logger = /*#__PURE__*/function () {
1041
948
  }
1042
949
  var extractName = caller.split(".")[1].split(" ")[0],
1043
950
  isBabelAsyncRuntime = false;
1044
-
1045
951
  // Babel compatibility.
1046
952
  if (extractName.includes('_callee')) {
1047
953
  var _loop = function _loop() {
@@ -1071,7 +977,6 @@ var Logger = /*#__PURE__*/function () {
1071
977
  }
1072
978
  return extractName;
1073
979
  }
1074
-
1075
980
  /**
1076
981
  * Function functionView() : Return function preview.
1077
982
  */
@@ -1079,7 +984,6 @@ var Logger = /*#__PURE__*/function () {
1079
984
  key: "getFunctionView",
1080
985
  value: function getFunctionView(fn) {
1081
986
  var fReturn = UNKNOWN_CALLER_NAME;
1082
-
1083
987
  // TODO: Check if works.
1084
988
  if (typeof fn !== "string" && fn.name.length !== 0) {
1085
989
  fReturn = fn.name.split(" ")[1] + "()";
@@ -1146,10 +1050,6 @@ function _wrapNativeSuper(Class) {
1146
1050
  return _wrapNativeSuper(Class);
1147
1051
  }
1148
1052
 
1149
- /**
1150
- * @author: Leonid Vinikov <leonidvinikov@gmail.com>
1151
- */
1152
-
1153
1053
  var CommandAlreadyRegistered = /*#__PURE__*/function (_Error) {
1154
1054
  _inherits(CommandAlreadyRegistered, _Error);
1155
1055
  var _super = _createSuper(CommandAlreadyRegistered);
@@ -1173,10 +1073,6 @@ var CommandNotFound = /*#__PURE__*/function (_Error) {
1173
1073
  return _createClass(CommandNotFound);
1174
1074
  }( /*#__PURE__*/_wrapNativeSuper(Error));
1175
1075
 
1176
- /**
1177
- * @author: Leonid Vinikov <leonidvinikov@gmail.com>
1178
- */
1179
-
1180
1076
  var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
1181
1077
  _inherits(ControllerAlreadyRegistered, _Error);
1182
1078
  var _super = _createSuper(ControllerAlreadyRegistered);
@@ -1187,10 +1083,6 @@ var ControllerAlreadyRegistered = /*#__PURE__*/function (_Error) {
1187
1083
  return _createClass(ControllerAlreadyRegistered);
1188
1084
  }( /*#__PURE__*/_wrapNativeSuper(Error));
1189
1085
 
1190
- /**
1191
- * @author: Leonid Vinikov <leonidvinikov@gmail.com>
1192
- */
1193
-
1194
1086
  var ForceMethodBase = /*#__PURE__*/function (_Error) {
1195
1087
  _inherits(ForceMethodBase, _Error);
1196
1088
  var _super = _createSuper(ForceMethodBase);
@@ -1219,7 +1111,6 @@ ForceMethod: ForceMethod
1219
1111
  });
1220
1112
 
1221
1113
  var IdCounter = 0;
1222
-
1223
1114
  /**
1224
1115
  * Base class 4 *
1225
1116
  */
@@ -1306,7 +1197,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1306
1197
  key: "register",
1307
1198
  value: function register(commands, controller) {
1308
1199
  var _this2 = this;
1309
- // eslint-disable-line @typescript-eslint/no-unused-vars
1310
1200
  var result = {};
1311
1201
  Object.values(commands).forEach(function (command) {
1312
1202
  var commandName = command.getName();
@@ -1342,11 +1232,9 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1342
1232
  if (!CommandClass) {
1343
1233
  throw new CommandNotFound(name);
1344
1234
  }
1345
-
1346
1235
  // @ts-ignore
1347
1236
  return new CommandClass(args, options);
1348
1237
  }
1349
-
1350
1238
  /**
1351
1239
  * Function onBefore() : Used to set hooks that effects only data and not UI.
1352
1240
  */
@@ -1355,7 +1243,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1355
1243
  value: function onBefore(hookCommand, callback) {
1356
1244
  Commands.hookCommand(this.onBeforeHooks, hookCommand, callback);
1357
1245
  }
1358
-
1359
1246
  /**
1360
1247
  * Function onBeforeUI() : Used to set hooks that effects only UI.
1361
1248
  */
@@ -1364,7 +1251,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1364
1251
  value: function onBeforeUI(hookCommand, callback) {
1365
1252
  Commands.hookCommand(this.onBeforeUIHooks, hookCommand, callback);
1366
1253
  }
1367
-
1368
1254
  /**
1369
1255
  * Function onAfter() : Used to set hooks that effects only data and not UI.
1370
1256
  */
@@ -1373,7 +1259,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1373
1259
  value: function onAfter(hookCommand, callback) {
1374
1260
  Commands.hookCommand(this.onAfterHooks, hookCommand, callback);
1375
1261
  }
1376
-
1377
1262
  /**
1378
1263
  * Function onAfterUI() : Used to set hooks that effects only UI.
1379
1264
  */
@@ -1382,7 +1267,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1382
1267
  value: function onAfterUI(command, callback) {
1383
1268
  Commands.hookCommand(this.onAfterUIHooks, command, callback);
1384
1269
  }
1385
-
1386
1270
  /**
1387
1271
  * Function onAfterOnce() : Used to set hooks that effects only data and not UI.
1388
1272
  */
@@ -1391,7 +1275,6 @@ var Commands = /*#__PURE__*/function (_ObjectBase) {
1391
1275
  value: function onAfterOnce(command, callback) {
1392
1276
  Commands.hookCommand(this.onAfterOnceHooks, command, callback);
1393
1277
  }
1394
-
1395
1278
  /**
1396
1279
  * Function onAfterAffect() : Used to register a trigger that runs command after `hookCommand` run's.
1397
1280
  */
@@ -1631,7 +1514,6 @@ var Controllers = /*#__PURE__*/function (_ObjectBase) {
1631
1514
  if (this.controllers[controller.getName()]) {
1632
1515
  throw new ControllerAlreadyRegistered(controller);
1633
1516
  }
1634
-
1635
1517
  // Register.
1636
1518
  this.controllers[controller.getName()] = controller;
1637
1519
  return controller;
@@ -1702,7 +1584,6 @@ var Http = /*#__PURE__*/function (_ObjectBase) {
1702
1584
  _this.apiBaseUrl = apiBaseUrl + '/';
1703
1585
  return _this;
1704
1586
  }
1705
-
1706
1587
  /**
1707
1588
  * Function fetch() : Fetch api.
1708
1589
  */
@@ -1798,7 +1679,6 @@ var Data = /*#__PURE__*/function (_Commands) {
1798
1679
  var _this;
1799
1680
  _classCallCheck(this, Data);
1800
1681
  _this = _super.call(this);
1801
-
1802
1682
  // @ts-ignore
1803
1683
  Data.client = new Http(Config.baseURL);
1804
1684
  return _this;
@@ -1980,7 +1860,6 @@ var CommandBase = /*#__PURE__*/function (_ObjectBase) {
1980
1860
  value: function apply() {
1981
1861
  arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
1982
1862
  arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
1983
- // eslint-disable-line @typescript-eslint/no-unused-vars
1984
1863
  throw new ForceMethod(this, "apply");
1985
1864
  }
1986
1865
  }, {
@@ -2066,7 +1945,6 @@ var CommandData = /*#__PURE__*/function (_CommandBase) {
2066
1945
  value: function apply() {
2067
1946
  var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.args;
2068
1947
  arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options;
2069
- // eslint-disable-line @typescript-eslint/no-unused-vars
2070
1948
  var endpoint = this.applyEndpointFormat(this.getEndpoint(), args);
2071
1949
  return data.getClient().fetch(endpoint, data.currentHttpMethod, args || null);
2072
1950
  }
@@ -2161,10 +2039,6 @@ var Controller = /*#__PURE__*/function (_ObjectBase) {
2161
2039
  value: function getInternal() {
2162
2040
  return {};
2163
2041
  }
2164
-
2165
- /**
2166
- * Function setupHooks() : Override this method to setup hooks.
2167
- */
2168
2042
  }], [{
2169
2043
  key: "getName",
2170
2044
  value: function getName() {
@@ -2215,7 +2089,7 @@ function errorInitTwice() {
2215
2089
  }
2216
2090
  errorInitTwice();
2217
2091
  var config = {
2218
- version: pkg.version
2092
+ version: version
2219
2093
  };
2220
2094
  var CoreAPI = _objectSpread2({
2221
2095
  initialize: function initialize$1(configuration) {
@@ -2233,7 +2107,6 @@ var CoreAPI = _objectSpread2({
2233
2107
  },
2234
2108
  config: config
2235
2109
  }, exported);
2236
-
2237
2110
  // TODO: Make it available only for development.
2238
2111
  if (!(globalThis !== null && globalThis !== void 0 && globalThis.ZenCore)) globalThis.ZenCore = CoreAPI;
2239
2112
 
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author: Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description: Providing a simple wrapper for fetch API.
4
+ */
5
+ import ObjectBase from "../core/object-base";
6
+ import { HTTPMethodEnum } from "../enums/http";
7
+ export declare class Http extends ObjectBase {
8
+ private readonly logger;
9
+ private readonly apiBaseUrl;
10
+ static getName(): string;
11
+ /**
12
+ * Function constructor() : Create the http.
13
+ */
14
+ constructor(apiBaseUrl?: string);
15
+ /**
16
+ * Function fetch() : Fetch api.
17
+ */
18
+ fetch(path: string, method: HTTPMethodEnum, body?: {} | null): Promise<any>;
19
+ }
20
+ export default Http;
21
+ //# sourceMappingURL=http.d.ts.map
@@ -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,23 @@
1
+ /**
2
+ * @author: Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description: Base for all commands, they are all will be managed by the `Commands` managers.
4
+ * @TODO
5
+ * - Add validateArgs method or find something better.
6
+ */
7
+ import ObjectBase from "../core/object-base";
8
+ import { ICommandArgsInterface, ICommandOptionsInterface } from "../interfaces/commands";
9
+ export declare abstract class CommandBase extends ObjectBase {
10
+ protected args: ICommandArgsInterface;
11
+ protected options: ICommandOptionsInterface;
12
+ private readonly logger;
13
+ constructor(args?: ICommandArgsInterface, options?: {});
14
+ initialize(args: ICommandArgsInterface, options: ICommandOptionsInterface): void;
15
+ apply(args?: ICommandArgsInterface, options?: ICommandOptionsInterface): any;
16
+ run(): Promise<any>;
17
+ getArgs(): ICommandArgsInterface;
18
+ getOptions(): ICommandOptionsInterface;
19
+ onBeforeApply?(): void;
20
+ onAfterApply?(): void;
21
+ }
22
+ export default CommandBase;
23
+ //# sourceMappingURL=command-base.d.ts.map
@@ -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,18 @@
1
+ import { CommandBase } from './command-base';
2
+ export declare abstract class CommandData extends CommandBase {
3
+ static getName(): string;
4
+ /**
5
+ * Function getEndpoint() : Override this method is required to determine endpoint and magic query params.
6
+ * @example
7
+ * ```
8
+ * args = { query: { id: 1 } };
9
+ * getEndpoint() = '/api/v1/users/{id}';
10
+ * result = '/api/v1/users/1';
11
+ * ```
12
+ */
13
+ getEndpoint(): string;
14
+ apply(args?: import("../interfaces/commands").ICommandArgsInterface, options?: import("../interfaces/commands").ICommandOptionsInterface): Promise<any>;
15
+ private applyEndpointFormat;
16
+ }
17
+ export default CommandData;
18
+ //# sourceMappingURL=command-data.d.ts.map
@@ -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,10 @@
1
+ /**
2
+ * @author: Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description: CommandInternal, is used when part of the logic needed to be in the command but not represent a user action.
4
+ */
5
+ import CommandBase from "./command-base";
6
+ export declare class CommandInternal extends CommandBase {
7
+ static getName(): string;
8
+ }
9
+ export default CommandInternal;
10
+ //# sourceMappingURL=command-internal.d.ts.map
@@ -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,10 @@
1
+ /**
2
+ * @author: Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description: CommandPublic represents a USER action, every class which inherit from this class will USER action.
4
+ * */
5
+ import CommandBase from "./command-base";
6
+ export declare class CommandPublic extends CommandBase {
7
+ static getName(): string;
8
+ }
9
+ export default CommandPublic;
10
+ //# sourceMappingURL=command-public.d.ts.map
@@ -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,8 @@
1
+ /**
2
+ * @author: Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ export { CommandPublic } from "./command-public";
5
+ export { CommandData } from "./command-data";
6
+ export { CommandBase } from "./command-base";
7
+ export { CommandInternal } from "./command-internal";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}